diff options
author | megamage <none@none> | 2009-05-20 12:43:08 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-20 12:43:08 -0500 |
commit | 0870adb1d200dac79493cf3dc7f8b1bc999b103d (patch) | |
tree | 72da73ee5e04250af7c91bfc9bbbdcd68b9ed4aa /src | |
parent | 49a39abf8fc5cfb0d23a5fba665a1fbd1a172da8 (diff) |
*Do not let delayed spell hit dead target. This fix the bug that penance heal dead player and make him stuck. Thanks to Stokrotka.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Spell.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index b1e1549cc5b..ae010213950 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1116,22 +1116,21 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) if(spellHitTarget) { - // Call scripted function for AI if this spell is casted upon a creature (except pets) - if(IS_CREATURE_GUID(target->targetGUID)) + //AI functions + if(spellHitTarget->GetTypeId() == TYPEID_UNIT) { + if(((Creature*)spellHitTarget)->IsAIEnabled) + ((Creature*)spellHitTarget)->AI()->SpellHit(m_caster, m_spellInfo); + // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) // ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm... ) - if( !((Creature*)unit)->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) + if(!((Creature*)spellHitTarget)->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) { if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() ) - p->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id); + p->CastedCreatureOrGO(spellHitTarget->GetEntry(),spellHitTarget->GetGUID(),m_spellInfo->Id); } } - //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); @@ -1146,11 +1145,12 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) return SPELL_MISS_EVADE; // Recheck immune (only for delayed spells) - if( m_spellInfo->speed && - (unit->IsImmunedToDamage(m_spellInfo) || - unit->IsImmunedToSpell(m_spellInfo))) + if(m_spellInfo->speed) { - return SPELL_MISS_IMMUNE; + if(!unit->isAlive()) + return SPELL_MISS_EVADE; + else if(unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo)) + return SPELL_MISS_IMMUNE; } if (unit->GetTypeId() == TYPEID_PLAYER) |