From b3f8d33b3b6aea56cbe9c2374c0b0057bfdb147d Mon Sep 17 00:00:00 2001 From: megamage Date: Thu, 30 Apr 2009 12:02:24 -0500 Subject: *Move spellhit AI function call after damage done. --HG-- branch : trunk --- src/game/Spell.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 28cbd541b00..d774b62af5f 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -998,9 +998,6 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) caster->ProcDamageAndSpell(unit, procAttacker, procVictim, procEx, 0, m_attackType, m_spellInfo); } - // Needs to be called after dealing damage/healing to not remove breaking on damage auras - DoTriggersOnSpellHit(spellHitTarget); - // Call scripted function for AI if this spell is casted upon a creature (except pets) if(IS_CREATURE_GUID(target->targetGUID)) { @@ -1022,6 +1019,19 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) unit->SetStandState(UNIT_STAND_STATE_STAND); } } + + if(spellHitTarget) + { + //AI functions + if(spellHitTarget->GetTypeId() == TYPEID_UNIT && ((Creature*)spellHitTarget)->IsAIEnabled) + ((Creature*)spellHitTarget)->AI()->SpellHit(m_caster, m_spellInfo); + + if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->IsAIEnabled) + ((Creature*)m_caster)->AI()->SpellHitTarget(spellHitTarget, m_spellInfo); + + // Needs to be called after dealing damage/healing to not remove breaking on damage auras + DoTriggersOnSpellHit(spellHitTarget); + } } void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) @@ -1155,20 +1165,10 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) if (unit->AddAura(Aur)) m_spellAura = Aur; } - - //AI functions - if(unit->GetTypeId() == TYPEID_UNIT && ((Creature*)unit)->IsAIEnabled) - ((Creature*)unit)->AI()->SpellHit(m_caster, m_spellInfo); - - if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->IsAIEnabled) - ((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo); } void Spell::DoTriggersOnSpellHit(Unit *unit) { - if (!unit) - return; - // Apply additional spell effects to target if (m_preCastSpell) { -- cgit v1.2.3