Core/Spell: partial revert of SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE immunity handling

- Bonus: without breaking Banish... yay!
Closes #18370
(cherry picked from commit 560c882b36)
This commit is contained in:
ariel-
2016-12-13 15:15:20 -03:00
committed by DoctorKraft
parent 0449d3a836
commit 536ae257c9
2 changed files with 19 additions and 11 deletions

View File

@@ -7167,7 +7167,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster) const
{
// State/effect immunities applied by aura expect full spell immunity
// Ignore effects with mechanic, they are supposed to be checked separately
if (!effect)
if (!effect || !effect->IsEffect())
continue;
if (!IsImmunedToSpellEffect(spellInfo, effect->EffectIndex, caster))
{
@@ -7179,17 +7179,14 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster) const
if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects.
return true;
if (!spellInfo->HasAttribute(SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE) && !spellInfo->HasAttribute(SPELL_ATTR2_UNAFFECTED_BY_AURA_SCHOOL_IMMUNE))
SpellImmuneContainer const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
for (auto itr = schoolList.begin(); itr != schoolList.end(); ++itr)
{
SpellImmuneContainer const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
for (auto itr = schoolList.begin(); itr != schoolList.end(); ++itr)
{
SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(itr->second);
if ((itr->first & spellInfo->GetSchoolMask())
&& !(immuneSpellInfo && immuneSpellInfo->IsPositive() && spellInfo->IsPositive() && IsFriendlyTo(caster))
&& !spellInfo->CanPierceImmuneAura(immuneSpellInfo))
return true;
}
SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(itr->second);
if ((itr->first & spellInfo->GetSchoolMask())
&& !(immuneSpellInfo && immuneSpellInfo->IsPositive() && spellInfo->IsPositive() && IsFriendlyTo(caster))
&& !spellInfo->CanPierceImmuneAura(immuneSpellInfo))
return true;
}
return false;

View File

@@ -1615,6 +1615,17 @@ bool SpellInfo::CanPierceImmuneAura(SpellInfo const* auraSpellInfo) const
if (HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))
return true;
// these spells (Cyclone for example) can pierce all...
if (HasAttribute(SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE) || HasAttribute(SPELL_ATTR2_UNAFFECTED_BY_AURA_SCHOOL_IMMUNE))
{
// ...but not these (Divine shield, Ice block, Cyclone and Banish for example)
if (!auraSpellInfo ||
(auraSpellInfo->Mechanic != MECHANIC_IMMUNE_SHIELD &&
auraSpellInfo->Mechanic != MECHANIC_INVULNERABILITY &&
(auraSpellInfo->Mechanic != MECHANIC_BANISH || IsRankOf(auraSpellInfo)))) // Banish shouldn't be immune to itself
return true;
}
// Dispels other auras on immunity, check if this spell makes the unit immune to aura
if (HasAttribute(SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY) && CanSpellProvideImmunityAgainstAura(auraSpellInfo))
return true;