Merge pull request #4229 from devilcoredev/fix_002

Core/Spells: Fix the spell immunity system to be effect-dependent
This commit is contained in:
Shocker
2012-01-04 13:41:51 -08:00
5 changed files with 35 additions and 7 deletions
+11 -5
View File
@@ -11475,7 +11475,8 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo)
return true;
}
if (spellInfo->Mechanic)
// Spells that don't have effectMechanics.
if (!spellInfo->HasAnyEffectMechanic() && spellInfo->Mechanic)
{
SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
@@ -11483,14 +11484,19 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo)
return true;
}
for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
bool immuneToAllEffects = true;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
// State/effect immunities applied by aura expect full spell immunity
// Ignore effects with mechanic, they are supposed to be checked separately
if (!spellInfo->Effects[i].Mechanic)
if (IsImmunedToSpellEffect(spellInfo, i))
return true;
if (spellInfo->Effects[i].Mechanic || !IsImmunedToSpellEffect(spellInfo, i))
{
immuneToAllEffects = false;
break;
}
}
if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects.
return true;
if (spellInfo->Id != 42292 && spellInfo->Id !=59752)
{