aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/Spell.cpp15
-rw-r--r--src/game/Spell.h1
2 files changed, 8 insertions, 8 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index ae010213950..ac9eb8f5593 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<<effIndex; // Store index of effect if not immuned
target.processed = false; // Effects not apply on target
+ target.alive = pVictim->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 99017742e2f..ee045faa017 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<TargetInfo> m_UniqueTargetInfo;