diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index f61289405..276295881 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -298,7 +298,7 @@ namespace Framework.Constants Interrupt = 26, Daze = 27, Discovery = 28, - Immune_Shield = 29, // Divine (Blessing) Shield/Protection And Ice Block + ImmuneShield = 29, // Divine (Blessing) Shield/Protection And Ice Block Sapped = 30, Enraged = 31, Wounded = 32, diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index 616f85032..fa4309cd9 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -1557,7 +1557,7 @@ namespace Game.Entities { // State/effect immunities applied by aura expect full spell immunity // Ignore effects with mechanic, they are supposed to be checked separately - if (effect == null) + if (effect == null || !effect.IsEffect()) continue; 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. 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]; - foreach (var pair in schoolList) - { - SpellInfo immuneSpellInfo = Global.SpellMgr.GetSpellInfo(pair.Value); - if (Convert.ToBoolean(pair.Key & (uint)spellInfo.GetSchoolMask()) - && !(immuneSpellInfo != null && immuneSpellInfo.IsPositive() && spellInfo.IsPositive() && IsFriendlyTo(caster)) - && !spellInfo.CanPierceImmuneAura(immuneSpellInfo)) - return true; - } + SpellInfo immuneSpellInfo = Global.SpellMgr.GetSpellInfo(pair.Value); + if (Convert.ToBoolean(pair.Key & (uint)spellInfo.GetSchoolMask()) + && !(immuneSpellInfo != null && immuneSpellInfo.IsPositive() && spellInfo.IsPositive() && IsFriendlyTo(caster)) + && !spellInfo.CanPierceImmuneAura(immuneSpellInfo)) + return true; } return false; diff --git a/Source/Game/Entities/Vehicle.cs b/Source/Game/Entities/Vehicle.cs index d3af2edf2..c3a3cf61a 100644 --- a/Source/Game/Entities/Vehicle.cs +++ b/Source/Game/Entities/Vehicle.cs @@ -152,7 +152,7 @@ namespace Game.Entities _me.ApplySpellImmune(0, SpellImmunity.State, AuraType.ModUnattackable, 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.Immune_Shield, true); + _me.ApplySpellImmune(0, SpellImmunity.Mechanic, (uint)Mechanics.ImmuneShield, true); // ... Resistance, Split damage, Change stats ... _me.ApplySpellImmune(0, SpellImmunity.State, AuraType.DamageShield, true); diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index aa9ebf6e2..c016e88c4 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -675,6 +675,17 @@ namespace Game.Spells if (HasAttribute(SpellAttr0.UnaffectedByInvulnerability)) 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 if (HasAttribute(SpellAttr1.DispelAurasOnImmunity) && CanSpellProvideImmunityAgainstAura(auraSpellInfo)) return true; @@ -3186,7 +3197,7 @@ namespace Game.Spells break; } - if (Mechanic == Mechanics.Immune_Shield) + if (Mechanic == Mechanics.ImmuneShield) return true; // Special case: effects which determine positivity of whole spell diff --git a/Source/Scripts/Spells/Warrior.cs b/Source/Scripts/Spells/Warrior.cs index 73eebc842..215a81c44 100644 --- a/Source/Scripts/Spells/Warrior.cs +++ b/Source/Scripts/Spells/Warrior.cs @@ -577,7 +577,7 @@ namespace Scripts.Spells.Warrior // remove shields, will still display immune to damage part Unit target = GetHitUnit(); if (target) - target.RemoveAurasWithMechanic(1 << (int)Mechanics.Immune_Shield, AuraRemoveMode.EnemySpell); + target.RemoveAurasWithMechanic(1 << (int)Mechanics.ImmuneShield, AuraRemoveMode.EnemySpell); } public override void Register()