diff options
| author | Treeston <treeston.mmoc@gmail.com> | 2017-06-07 02:33:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-07 02:33:47 +0200 |
| commit | 1660bb7d27d6f42b49012a6b57e3c2b2eab20fd3 (patch) | |
| tree | cf63a9cb6e89e621d7ae8b901684bc98a40a7e08 /src/server/game/Spells/Spell.cpp | |
| parent | 2335b9de1a46a409c714a1dc89cbd0565545e70e (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.
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 83d19be8472..4b08d3bf9c3 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3116,9 +3116,11 @@ void Spell::_cast(bool skipCheck) // Let any pets know we've attacked something. Check DmgClass for harmful spells only // This prevents spells such as Hunter's Mark from triggering pet attack if (this->GetSpellInfo()->DmgClass != SPELL_DAMAGE_CLASS_NONE) - if (Pet* playerPet = playerCaster->GetPet()) - if (playerPet->IsAlive() && playerPet->isControlled() && (m_targets.GetTargetMask() & TARGET_FLAG_UNIT)) - playerPet->AI()->OwnerAttacked(m_targets.GetUnitTarget()); + if (Unit* unitTarget = m_targets.GetUnitTarget()) + for (Unit* controlled : playerCaster->m_Controlled) + if (Creature* cControlled = controlled->ToCreature()) + if (cControlled->IsAIEnabled) + cControlled->AI()->OwnerAttacked(unitTarget); } SetExecutedCurrently(true); |
