aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
authorMrSmite <no_mail@email.com>2012-04-05 20:32:02 -0400
committerMrSmite <no_mail@email.com>2012-04-06 12:26:45 -0400
commitb843688fa8326579427381b9ee15f2b42d49f42e (patch)
treecdf9d9c07b65f4db2db404edaf2b8c41d3765517 /src/server/game/Spells/Spell.cpp
parentb5dc7bc45b658bc0f5627628337992c944224345 (diff)
PeAI update
* Better handle target selection for defensive pets. Adds triggers for when owner is damaged or begins attacking something. * Defensive pets no longer run off as soon as a mob aggros the owner but rather at first damage to owner or owner first attack * Pets on stay will continue to attack unless target unreachable
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)