Core/Spells: Implemented NoImmunity spell effect attribute
Port From (https://github.com/TrinityCore/TrinityCore/commit/e883b61094c3a5d2e80d2165e53921631e72e33e)
This commit is contained in:
@@ -1973,7 +1973,7 @@ namespace Framework.Constants
|
||||
public enum SpellEffectAttributes
|
||||
{
|
||||
None = 0,
|
||||
NoImmunity = 0x01, /*NYI*/ // not cancelled by immunities
|
||||
NoImmunity = 0x01, // not cancelled by immunities
|
||||
PositionIsFacingRelative = 0x02, /*NYI*/
|
||||
JumpChargeUnitMeleeRange = 0x04, /*NYI*/
|
||||
JumpChargeUnitStrictPathCheck = 0x08, /*NYI*/
|
||||
|
||||
@@ -1373,6 +1373,9 @@ namespace Game.Entities
|
||||
if (spellInfo.HasAttribute(SpellAttr0.NoImmunities))
|
||||
return false;
|
||||
|
||||
if (spellEffectInfo.EffectAttributes.HasFlag(SpellEffectAttributes.NoImmunity))
|
||||
return false;
|
||||
|
||||
bool hasImmunity(MultiMap<uint, uint> container, uint key)
|
||||
{
|
||||
var range = container.LookupByKey(key);
|
||||
@@ -1445,7 +1448,7 @@ namespace Game.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsImmunedToDamage(SpellInfo spellInfo)
|
||||
public bool IsImmunedToDamage(SpellInfo spellInfo, SpellEffectInfo spellEffectInfo = null)
|
||||
{
|
||||
if (spellInfo == null)
|
||||
return false;
|
||||
@@ -1457,6 +1460,9 @@ namespace Game.Entities
|
||||
if (spellInfo.HasAttribute(SpellAttr1.ImmunityToHostileAndFriendlyEffects) || spellInfo.HasAttribute(SpellAttr2.NoSchoolImmunities))
|
||||
return false;
|
||||
|
||||
if (spellEffectInfo != null && spellEffectInfo.EffectAttributes.HasFlag(SpellEffectAttributes.NoImmunity))
|
||||
return false;
|
||||
|
||||
uint schoolMask = (uint)spellInfo.GetSchoolMask();
|
||||
if (schoolMask != 0)
|
||||
{
|
||||
|
||||
@@ -5043,7 +5043,7 @@ namespace Game.Spells
|
||||
if (!target.IsAlive())
|
||||
return;
|
||||
|
||||
if (target.HasUnitState(UnitState.Isolated) || target.IsImmunedToDamage(GetSpellInfo()))
|
||||
if (target.HasUnitState(UnitState.Isolated) || target.IsImmunedToDamage(GetSpellInfo(), GetSpellEffectInfo()))
|
||||
{
|
||||
SendTickImmune(target, caster);
|
||||
return;
|
||||
@@ -5171,7 +5171,7 @@ namespace Game.Spells
|
||||
if (!target.IsAlive())
|
||||
return;
|
||||
|
||||
if (target.HasUnitState(UnitState.Isolated) || target.IsImmunedToDamage(GetSpellInfo()))
|
||||
if (target.HasUnitState(UnitState.Isolated) || target.IsImmunedToDamage(GetSpellInfo(), GetSpellEffectInfo()))
|
||||
{
|
||||
SendTickImmune(target, caster);
|
||||
return;
|
||||
@@ -5361,7 +5361,7 @@ namespace Game.Spells
|
||||
if (caster == null || !caster.IsAlive() || !target.IsAlive() || target.GetPowerType() != powerType)
|
||||
return;
|
||||
|
||||
if (target.HasUnitState(UnitState.Isolated) || target.IsImmunedToDamage(GetSpellInfo()))
|
||||
if (target.HasUnitState(UnitState.Isolated) || target.IsImmunedToDamage(GetSpellInfo(), GetSpellEffectInfo()))
|
||||
{
|
||||
SendTickImmune(target, caster);
|
||||
return;
|
||||
@@ -5479,7 +5479,7 @@ namespace Game.Spells
|
||||
if (caster == null || !target.IsAlive() || target.GetPowerType() != powerType)
|
||||
return;
|
||||
|
||||
if (target.HasUnitState(UnitState.Isolated) || target.IsImmunedToDamage(GetSpellInfo()))
|
||||
if (target.HasUnitState(UnitState.Isolated) || target.IsImmunedToDamage(GetSpellInfo(), GetSpellEffectInfo()))
|
||||
{
|
||||
SendTickImmune(target, caster);
|
||||
return;
|
||||
@@ -5605,7 +5605,7 @@ namespace Game.Spells
|
||||
{
|
||||
Unit target = aurApp.GetTarget();
|
||||
Unit triggerTarget = eventInfo.GetProcTarget();
|
||||
if (triggerTarget.HasUnitState(UnitState.Isolated) || triggerTarget.IsImmunedToDamage(GetSpellInfo()))
|
||||
if (triggerTarget.HasUnitState(UnitState.Isolated) || triggerTarget.IsImmunedToDamage(GetSpellInfo(), GetSpellEffectInfo()))
|
||||
{
|
||||
SendTickImmune(triggerTarget, target);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user