add IsEffect() check to correct IsImmunedToSpell

Signed-off-by: dr.skull <[email protected]>
This commit is contained in:
dr.skull
2012-06-17 02:23:47 +02:00
parent 63dd625154
commit 3f8efb21cd
2 changed files with 8 additions and 2 deletions
@@ -1675,12 +1675,16 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo)
// This check must be done instead of 'if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))' for not break // This check must be done instead of 'if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))' for not break
// the check of mechanic immunity on DB (tested) because GetCreatureTemplate()->MechanicImmuneMask and m_spellImmune[IMMUNITY_MECHANIC] don't have same data. // the check of mechanic immunity on DB (tested) because GetCreatureTemplate()->MechanicImmuneMask and m_spellImmune[IMMUNITY_MECHANIC] don't have same data.
bool immunedToAllEffects = true; bool immunedToAllEffects = true;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if(!spellInfo->Effects[i].IsEffect())
break;
if (!IsImmunedToSpellEffect(spellInfo, i)) if (!IsImmunedToSpellEffect(spellInfo, i))
{ {
immunedToAllEffects = false; immunedToAllEffects = false;
break; break;
} }
}
if (immunedToAllEffects) if (immunedToAllEffects)
return true; return true;
+3 -1
View File
@@ -11534,10 +11534,12 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo)
} }
bool immuneToAllEffects = true; bool immuneToAllEffects = true;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{ {
// State/effect immunities applied by aura expect full spell immunity // State/effect immunities applied by aura expect full spell immunity
// Ignore effects with mechanic, they are supposed to be checked separately // Ignore effects with mechanic, they are supposed to be checked separately
if(!spellInfo->Effects[i].IsEffect())
break;
if (!IsImmunedToSpellEffect(spellInfo, i)) if (!IsImmunedToSpellEffect(spellInfo, i))
{ {
immuneToAllEffects = false; immuneToAllEffects = false;