diff options
| author | Treeston <treeston.mmoc@gmail.com> | 2017-06-07 02:33:47 +0200 |
|---|---|---|
| committer | Carbenium <carbenium@outlook.com> | 2020-07-16 21:47:28 +0200 |
| commit | f7a7d02a7f50400cdc2be3c4722afeefe7efce80 (patch) | |
| tree | 0f405c9382ec9e96b3a40a8f4f722a07c791bd0f /src/server/game/AI/CreatureAI.h | |
| parent | 5903a10a834b1198702b024182581799648540ff (diff) | |
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.
(cherry picked from commit 1660bb7d27d6f42b49012a6b57e3c2b2eab20fd3)
Diffstat (limited to 'src/server/game/AI/CreatureAI.h')
| -rw-r--r-- | src/server/game/AI/CreatureAI.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index 41e6ab2501d..754e936862d 100644 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -119,8 +119,6 @@ class TC_GAME_API CreatureAI : public UnitAI // Called when spell hits a target virtual void SpellHitTarget(Unit* /*target*/, SpellInfo const* /*spell*/) { } - // Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc) - virtual void AttackedBy(Unit* /*attacker*/) { } virtual bool IsEscorted() const { return false; } // Called when creature is spawned or respawned @@ -146,15 +144,14 @@ class TC_GAME_API CreatureAI : public UnitAI virtual void ReceiveEmote(Player* /*player*/, uint32 /*emoteId*/) { } // Called when owner takes damage - virtual void OwnerAttackedBy(Unit* /*attacker*/) { } + virtual void OwnerAttackedBy(Unit* attacker) { _OnOwnerCombatInteraction(attacker); } // Called when owner attacks something - virtual void OwnerAttacked(Unit* /*target*/) { } + virtual void OwnerAttacked(Unit* target) { _OnOwnerCombatInteraction(target); } /// == Triggered Actions Requested ================== // Called when creature attack expected (if creature can and no have current victim) - // Note: for reaction at hostile action must be called AttackedBy function. //virtual void AttackStart(Unit*) { } // Called at World update tick @@ -202,6 +199,7 @@ class TC_GAME_API CreatureAI : public UnitAI private: bool m_MoveInLineOfSight_locked; + void _OnOwnerCombatInteraction(Unit* target); }; enum Permitions : int32 |
