fix(Core/Spell): Make use of SPELL_ATTR2_NO_SCHOOL_IMMUNITIES (#5880)

This commit is contained in:
Kitzunu
2021-07-31 15:31:00 +02:00
committed by GitHub
parent 19bbe2cd79
commit 87b2cd1299
2 changed files with 50 additions and 21 deletions

View File

@@ -1289,15 +1289,27 @@ bool SpellInfo::IsAffectedBySpellMod(SpellModifier const* mod) const
bool SpellInfo::CanPierceImmuneAura(SpellInfo const* aura) const
{
// aura can't be pierced
if (!aura || aura->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
{
return false;
}
// these spells pierce all avalible spells (Resurrection Sickness for example)
if (HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
return true;
// these spells (Cyclone for example) can pierce all...
if ((AttributesEx & SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS)
// ...but not these (Divine shield for example) // xinef: banish exception, banish can override banish to cancel itself
&& !(aura && (aura->Mechanic == MECHANIC_IMMUNE_SHIELD || aura->Mechanic == MECHANIC_INVULNERABILITY || (aura->Mechanic == MECHANIC_BANISH && (Mechanic != MECHANIC_BANISH || !(AttributesEx2 & SPELL_ATTR2_CANNOT_CAST_ON_TAPPED))))))
return true;
if (HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS) || HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
{
if (aura->Mechanic != MECHANIC_IMMUNE_SHIELD &&
aura->Mechanic != MECHANIC_INVULNERABILITY &&
aura->Mechanic != MECHANIC_BANISH)
{
return true;
}
}
return false;
}
@@ -1308,22 +1320,20 @@ bool SpellInfo::CanDispelAura(SpellInfo const* aura) const
if (aura->IsPassive())
return false;
// Xinef: At frist we check non-player auras, that should be never dispellable
// Xinef: Eg. Mark of the Fallen Champion
if (aura->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && aura->SpellFamilyName == SPELLFAMILY_GENERIC)
// These auras (like Divine Shield) can't be dispelled
if (aura->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
return false;
// These spells (like Mass Dispel) can dispell all auras
if (HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
return true;
// These auras (like Divine Shield) can't be dispelled
if (aura->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
return false;
// These auras (Cyclone for example) are not dispelable
if (aura->HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS))
if ((aura->HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS) && aura->Mechanic != MECHANIC_NONE)
|| aura->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
{
return false;
}
return true;
}