From 6f8dc61871137efc5450bf8181b0482a521b9238 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 20 May 2009 12:58:38 -0500 Subject: [PATCH] *Record target live state at filltarget and check live state at doeffect. --HG-- branch : trunk --- src/game/Spell.cpp | 15 +++++++-------- src/game/Spell.h | 1 + 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index ae01021395..ac9eb8f559 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -842,6 +842,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex) target.targetGUID = targetGUID; // Store target GUID target.effectMask = immuned ? 0 : 1<isAlive(); target.damage = 0; // Calculate hit result @@ -981,6 +982,9 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) if (!unit) return; + if(unit->isAlive() != target->alive) + return; + // Get original caster (if exist) and calculate damage/healing from him data Unit *caster = m_originalCaster ? m_originalCaster : m_caster; @@ -1145,13 +1149,8 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) return SPELL_MISS_EVADE; // Recheck immune (only for delayed spells) - if(m_spellInfo->speed) - { - if(!unit->isAlive()) - return SPELL_MISS_EVADE; - else if(unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo)) - return SPELL_MISS_IMMUNE; - } + if(m_spellInfo->speed && (unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo))) + return SPELL_MISS_IMMUNE; if (unit->GetTypeId() == TYPEID_PLAYER) { @@ -5906,7 +5905,7 @@ void Spell::CalculateDamageDoneForAllTargets() continue; Unit* unit = m_caster->GetGUID()==target.targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target.targetGUID); - if (!unit) + if (!unit) // || !unit->isAlive()) do we need to check alive here? continue; if (usesAmmo) diff --git a/src/game/Spell.h b/src/game/Spell.h index 99017742e2..ee045faa01 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -568,6 +568,7 @@ class Spell SpellMissInfo reflectResult:8; uint8 effectMask:8; bool processed:1; + bool alive:1; int32 damage; }; std::list m_UniqueTargetInfo;