Core/Spells: Rename SpellAttr4 to use official attribute names

Port From (https://github.com/TrinityCore/TrinityCore/commit/8d16a79dea4c0100d36e13b068c42499a3a48154)
This commit is contained in:
hondacrx
2022-06-01 13:37:39 -04:00
parent c5ed815f84
commit 62c2d34f1a
12 changed files with 154 additions and 134 deletions
+9 -6
View File
@@ -273,8 +273,8 @@ namespace Game.Entities
if (cheatDeath.GetMiscValue().HasAnyFlag((int)SpellSchoolMask.Normal))
MathFunctions.AddPct(ref TakenTotalMod, cheatDeath.GetAmount());
// Spells with SPELL_ATTR4_FIXED_DAMAGE should only benefit from mechanic damage mod auras.
if (!spellProto.HasAttribute(SpellAttr4.FixedDamage))
// Spells with SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS should only benefit from mechanic damage mod auras.
if (!spellProto.HasAttribute(SpellAttr4.IgnoreDamageTakenModifiers))
{
// Versatility
Player modOwner = GetSpellModOwner();
@@ -1216,7 +1216,7 @@ namespace Game.Entities
}
}
}
public virtual bool IsImmunedToSpell(SpellInfo spellInfo, WorldObject caster)
public bool IsImmunedToSpell(SpellInfo spellInfo, WorldObject caster)
{
if (spellInfo == null)
return false;
@@ -1259,6 +1259,9 @@ namespace Game.Entities
immuneToAllEffects = false;
break;
}
if (spellInfo.HasAttribute(SpellAttr4.NoPartialImmunity))
return true;
}
if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects.
@@ -1939,8 +1942,8 @@ namespace Game.Entities
SpellSchoolMask damageSchoolMask = damageInfo.schoolMask;
// Spells with SPELL_ATTR4_FIXED_DAMAGE ignore resilience because their damage is based off another spell's damage.
if (!spellInfo.HasAttribute(SpellAttr4.FixedDamage))
// Spells with SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS ignore resilience because their damage is based off another spell's damage.
if (!spellInfo.HasAttribute(SpellAttr4.IgnoreDamageTakenModifiers))
{
if (IsDamageReducedByArmor(damageSchoolMask, spellInfo))
damage = (int)CalcArmorReducedDamage(damageInfo.attacker, victim, (uint)damage, spellInfo, attackType);
@@ -3433,7 +3436,7 @@ namespace Game.Entities
RemoveAppliedAuras(aurApp =>
{
Aura aura = aurApp.GetBase();
return (!aura.GetSpellInfo().HasAttribute(SpellAttr4.DontRemoveInArena) // don't remove stances, shadowform, pally/hunter auras
return (!aura.GetSpellInfo().HasAttribute(SpellAttr4.AllowEnteringArena) // don't remove stances, shadowform, pally/hunter auras
&& !aura.IsPassive() // don't remove passive auras
&& (aurApp.IsPositive() || !aura.GetSpellInfo().HasAttribute(SpellAttr3.AllowAuraWhileDead))) || // not negative death persistent auras
aura.GetSpellInfo().HasAttribute(SpellAttr5.RemoveEnteringArena); // special marker, always remove
+2 -9
View File
@@ -2440,7 +2440,7 @@ namespace Game.Entities
// interrupting auras with SpellAuraInterruptFlags.Damage before checking !damage (absorbed damage breaks that type of auras)
if (spellProto != null)
{
if (!spellProto.HasAttribute(SpellAttr4.DamageDoesntBreakAuras))
if (!spellProto.HasAttribute(SpellAttr4.ReactiveDamageProc))
victim.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Damage, spellProto);
}
else
@@ -2657,7 +2657,7 @@ namespace Game.Entities
if (damagetype != DamageEffectType.DOT && damage > 0 && !victim.GetOwnerGUID().IsPlayer() && (spellProto == null || !spellProto.HasAura(AuraType.DamageShield)))
victim.ToCreature().SetLastDamagedTime(GameTime.GetGameTime() + SharedConst.MaxAggroResetTime);
if (attacker != null)
if (attacker != null && (spellProto == null || !spellProto.HasAttribute(SpellAttr4.NoHarmfulThreat)))
victim.GetThreatManager().AddThreat(attacker, damage, spellProto);
}
else // victim is a player
@@ -3245,13 +3245,6 @@ namespace Game.Entities
if (schoolMask.HasAnyFlag(SpellSchoolMask.Holy) && victim.GetTypeId() != TypeId.Unit)
return 0;
// Ignore spells that can't be resisted
if (spellInfo != null)
{
if (spellInfo.HasAttribute(SpellAttr4.IgnoreResistances))
return 0;
}
float averageResist = CalculateAverageResistReduction(attacker, schoolMask, victim, spellInfo);
float[] discreteResistProbability = new float[11];