Pet/Guardian AI hook re-organizing (#19824)

* Pet/Guardian AI hook re-organizing:
- Adjust OwnerAttacked/OwnerAttackedBy hooks on CreatureAI to fire for all owned units, not just player pets. This should allow guardians to more reliably recognize valid targets.
- Kill off the AttackedBy hook. While it was defined in CreatureAI.h as virtual, it was only ever invoked for player pets in specific situations. This makes it classic developer bait.
  - Adjust PetAI to use DamageTaken instead of AttackedBy.
  - Adjust behavior of AttackStart on PetAI to compensate.
This commit is contained in:
Aokromes
2017-06-07 02:50:14 +02:00
parent 2b721ca16c
commit 0bb27ecd4b
9 changed files with 62 additions and 81 deletions

View File

@@ -106,17 +106,6 @@ public:
summoned->AI()->AttackStart(player);
}
void AttackedBy(Unit* pAttacker) override
{
if (me->GetVictim())
return;
if (me->IsFriendlyTo(pAttacker))
return;
AttackStart(pAttacker);
}
void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) override
{
if (HealthBelowPct(20))