mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-13 17:09:08 +00:00
Put IsValidAttackTarget check on both bots and their pets (#833)
* Prevent PetAttackAction on invalid targets * Prevent AttackAction on invalid targets in general
This commit is contained in:
@@ -67,11 +67,18 @@ bool PetAttackAction::Execute(Event event)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Unit* target = AI_VALUE(Unit*, "current target");
|
||||
if (!target)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!bot->IsValidAttackTarget(target))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pet->SetReactState(REACT_PASSIVE);
|
||||
pet->ClearUnitState(UNIT_STATE_FOLLOW);
|
||||
pet->AttackStop();
|
||||
@@ -85,4 +92,4 @@ bool PetAttackAction::Execute(Event event)
|
||||
|
||||
pet->ToCreature()->AI()->AttackStart(target);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user