*Record target live state at filltarget and check live state at doeffect.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-20 12:58:38 -05:00
parent 0870adb1d2
commit 6f8dc61871
2 changed files with 8 additions and 8 deletions
+7 -8
View File
@@ -842,6 +842,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
target.targetGUID = targetGUID; // Store target GUID target.targetGUID = targetGUID; // Store target GUID
target.effectMask = immuned ? 0 : 1<<effIndex; // Store index of effect if not immuned target.effectMask = immuned ? 0 : 1<<effIndex; // Store index of effect if not immuned
target.processed = false; // Effects not apply on target target.processed = false; // Effects not apply on target
target.alive = pVictim->isAlive();
target.damage = 0; target.damage = 0;
// Calculate hit result // Calculate hit result
@@ -981,6 +982,9 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
if (!unit) if (!unit)
return; return;
if(unit->isAlive() != target->alive)
return;
// Get original caster (if exist) and calculate damage/healing from him data // Get original caster (if exist) and calculate damage/healing from him data
Unit *caster = m_originalCaster ? m_originalCaster : m_caster; Unit *caster = m_originalCaster ? m_originalCaster : m_caster;
@@ -1145,13 +1149,8 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
return SPELL_MISS_EVADE; return SPELL_MISS_EVADE;
// Recheck immune (only for delayed spells) // Recheck immune (only for delayed spells)
if(m_spellInfo->speed) if(m_spellInfo->speed && (unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo)))
{ 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) if (unit->GetTypeId() == TYPEID_PLAYER)
{ {
@@ -5906,7 +5905,7 @@ void Spell::CalculateDamageDoneForAllTargets()
continue; continue;
Unit* unit = m_caster->GetGUID()==target.targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target.targetGUID); 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; continue;
if (usesAmmo) if (usesAmmo)
+1
View File
@@ -568,6 +568,7 @@ class Spell
SpellMissInfo reflectResult:8; SpellMissInfo reflectResult:8;
uint8 effectMask:8; uint8 effectMask:8;
bool processed:1; bool processed:1;
bool alive:1;
int32 damage; int32 damage;
}; };
std::list<TargetInfo> m_UniqueTargetInfo; std::list<TargetInfo> m_UniqueTargetInfo;