Core/Spell: partial revert of SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE immunity handling
This commit is contained in:
@@ -298,7 +298,7 @@ namespace Framework.Constants
|
|||||||
Interrupt = 26,
|
Interrupt = 26,
|
||||||
Daze = 27,
|
Daze = 27,
|
||||||
Discovery = 28,
|
Discovery = 28,
|
||||||
Immune_Shield = 29, // Divine (Blessing) Shield/Protection And Ice Block
|
ImmuneShield = 29, // Divine (Blessing) Shield/Protection And Ice Block
|
||||||
Sapped = 30,
|
Sapped = 30,
|
||||||
Enraged = 31,
|
Enraged = 31,
|
||||||
Wounded = 32,
|
Wounded = 32,
|
||||||
|
|||||||
@@ -1557,7 +1557,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
// 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 (effect == null)
|
if (effect == null || !effect.IsEffect())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!IsImmunedToSpellEffect(spellInfo, effect.EffectIndex, caster))
|
if (!IsImmunedToSpellEffect(spellInfo, effect.EffectIndex, caster))
|
||||||
@@ -1570,17 +1570,14 @@ namespace Game.Entities
|
|||||||
if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects.
|
if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects.
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!spellInfo.HasAttribute(SpellAttr1.UnaffectedBySchoolImmune) && !spellInfo.HasAttribute(SpellAttr2.UnaffectedByAuraSchoolImmune))
|
var schoolList = m_spellImmune[(int)SpellImmunity.School];
|
||||||
|
foreach (var pair in schoolList)
|
||||||
{
|
{
|
||||||
var schoolList = m_spellImmune[(int)SpellImmunity.School];
|
SpellInfo immuneSpellInfo = Global.SpellMgr.GetSpellInfo(pair.Value);
|
||||||
foreach (var pair in schoolList)
|
if (Convert.ToBoolean(pair.Key & (uint)spellInfo.GetSchoolMask())
|
||||||
{
|
&& !(immuneSpellInfo != null && immuneSpellInfo.IsPositive() && spellInfo.IsPositive() && IsFriendlyTo(caster))
|
||||||
SpellInfo immuneSpellInfo = Global.SpellMgr.GetSpellInfo(pair.Value);
|
&& !spellInfo.CanPierceImmuneAura(immuneSpellInfo))
|
||||||
if (Convert.ToBoolean(pair.Key & (uint)spellInfo.GetSchoolMask())
|
return true;
|
||||||
&& !(immuneSpellInfo != null && immuneSpellInfo.IsPositive() && spellInfo.IsPositive() && IsFriendlyTo(caster))
|
|
||||||
&& !spellInfo.CanPierceImmuneAura(immuneSpellInfo))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ namespace Game.Entities
|
|||||||
_me.ApplySpellImmune(0, SpellImmunity.State, AuraType.ModUnattackable, true);
|
_me.ApplySpellImmune(0, SpellImmunity.State, AuraType.ModUnattackable, true);
|
||||||
_me.ApplySpellImmune(0, SpellImmunity.State, AuraType.SchoolAbsorb, true);
|
_me.ApplySpellImmune(0, SpellImmunity.State, AuraType.SchoolAbsorb, true);
|
||||||
_me.ApplySpellImmune(0, SpellImmunity.Mechanic, (uint)Mechanics.Shield, true);
|
_me.ApplySpellImmune(0, SpellImmunity.Mechanic, (uint)Mechanics.Shield, true);
|
||||||
_me.ApplySpellImmune(0, SpellImmunity.Mechanic, (uint)Mechanics.Immune_Shield, true);
|
_me.ApplySpellImmune(0, SpellImmunity.Mechanic, (uint)Mechanics.ImmuneShield, true);
|
||||||
|
|
||||||
// ... Resistance, Split damage, Change stats ...
|
// ... Resistance, Split damage, Change stats ...
|
||||||
_me.ApplySpellImmune(0, SpellImmunity.State, AuraType.DamageShield, true);
|
_me.ApplySpellImmune(0, SpellImmunity.State, AuraType.DamageShield, true);
|
||||||
|
|||||||
@@ -675,6 +675,17 @@ namespace Game.Spells
|
|||||||
if (HasAttribute(SpellAttr0.UnaffectedByInvulnerability))
|
if (HasAttribute(SpellAttr0.UnaffectedByInvulnerability))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
// these spells (Cyclone for example) can pierce all...
|
||||||
|
if (HasAttribute(SpellAttr1.UnaffectedBySchoolImmune) || HasAttribute(SpellAttr2.UnaffectedByAuraSchoolImmune))
|
||||||
|
{
|
||||||
|
// ...but not these (Divine shield, Ice block, Cyclone and Banish for example)
|
||||||
|
if (auraSpellInfo == null ||
|
||||||
|
(auraSpellInfo.Mechanic != Mechanics.ImmuneShield &&
|
||||||
|
auraSpellInfo.Mechanic != Mechanics.Invulnerability &&
|
||||||
|
(auraSpellInfo.Mechanic != Mechanics.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
|
// Dispels other auras on immunity, check if this spell makes the unit immune to aura
|
||||||
if (HasAttribute(SpellAttr1.DispelAurasOnImmunity) && CanSpellProvideImmunityAgainstAura(auraSpellInfo))
|
if (HasAttribute(SpellAttr1.DispelAurasOnImmunity) && CanSpellProvideImmunityAgainstAura(auraSpellInfo))
|
||||||
return true;
|
return true;
|
||||||
@@ -3186,7 +3197,7 @@ namespace Game.Spells
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mechanic == Mechanics.Immune_Shield)
|
if (Mechanic == Mechanics.ImmuneShield)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Special case: effects which determine positivity of whole spell
|
// Special case: effects which determine positivity of whole spell
|
||||||
|
|||||||
@@ -577,7 +577,7 @@ namespace Scripts.Spells.Warrior
|
|||||||
// remove shields, will still display immune to damage part
|
// remove shields, will still display immune to damage part
|
||||||
Unit target = GetHitUnit();
|
Unit target = GetHitUnit();
|
||||||
if (target)
|
if (target)
|
||||||
target.RemoveAurasWithMechanic(1 << (int)Mechanics.Immune_Shield, AuraRemoveMode.EnemySpell);
|
target.RemoveAurasWithMechanic(1 << (int)Mechanics.ImmuneShield, AuraRemoveMode.EnemySpell);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Register()
|
public override void Register()
|
||||||
|
|||||||
Reference in New Issue
Block a user