aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 82a89e97e4b..ea4b79cf99a 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -3101,11 +3101,22 @@ void Spell::cast(bool skipCheck)
return;
}
- // now that we've done the basic check, now run the scripts
- // should be done before the spell is actually executed
if (Player* playerCaster = m_caster->ToPlayer())
+ {
+ // now that we've done the basic check, now run the scripts
+ // should be done before the spell is actually executed
sScriptMgr->OnPlayerSpellCast(playerCaster, this, skipCheck);
+ // Let any pets know we've attacked something. As of 3.0.2 pets begin
+ // attacking their owner's target immediately
+ if (Pet* playerPet = playerCaster->GetPet())
+ {
+ if (playerPet->isAlive() && playerPet->isControlled() && (m_targets.GetTargetMask() & TARGET_FLAG_UNIT))
+ {
+ playerPet->AI()->OwnerAttacked(m_targets.GetObjectTarget()->ToUnit());
+ }
+ }
+ }
SetExecutedCurrently(true);
if (m_caster->GetTypeId() != TYPEID_PLAYER && m_targets.GetUnitTarget() && m_targets.GetUnitTarget() != m_caster)