Core/Spells: all bleed effects should ignore armor

Port From (https://github.com/TrinityCore/TrinityCore/commit/3ea88f814a6be7487ef8a3d5c6237981d20f5063)
This commit is contained in:
hondacrx
2021-09-24 10:19:33 -04:00
parent dbfef1ee87
commit 61b14b5da0
3 changed files with 8 additions and 19 deletions
+2 -17
View File
@@ -2089,28 +2089,13 @@ namespace Game.Entities
RemoveDynamicUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.ChannelObjects), index);
}
public static bool IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellInfo spellInfo = null, SpellEffectInfo spellEffectInfo = null)
public static bool IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellInfo spellInfo = null)
{
// only physical spells damage gets reduced by armor
if ((schoolMask & SpellSchoolMask.Normal) == 0)
return false;
if (spellInfo != null)
{
// there are spells with no specific attribute but they have "ignores armor" in tooltip
if (spellInfo.HasAttribute(SpellCustomAttributes.IgnoreArmor))
return false;
// bleeding effects are not reduced by armor
if (spellEffectInfo != null)
{
if (spellEffectInfo.ApplyAuraName == AuraType.PeriodicDamage || spellEffectInfo.Effect == SpellEffectName.SchoolDamage)
if (spellInfo.GetEffectMechanicMask(spellEffectInfo.EffectIndex).HasAnyFlag((1u << (int)Mechanics.Bleed)))
return false;
}
}
return true;
return spellInfo == null || !spellInfo.HasAttribute(SpellCustomAttributes.IgnoreArmor);
}
public override UpdateFieldFlag GetUpdateFieldFlagsFor(Player target)
+2 -2
View File
@@ -4967,7 +4967,7 @@ namespace Game.Spells
damage = Unit.SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
// Calculate armor mitigation
if (Unit.IsDamageReducedByArmor(GetSpellInfo().GetSchoolMask(), GetSpellInfo(), GetSpellEffectInfo()))
if (Unit.IsDamageReducedByArmor(GetSpellInfo().GetSchoolMask(), GetSpellInfo()))
{
uint damageReducedArmor = Unit.CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetSpellInfo().GetAttackType(), GetBase().GetCasterLevel());
cleanDamage.mitigated_damage += damage - damageReducedArmor;
@@ -5049,7 +5049,7 @@ namespace Game.Spells
damage = Unit.SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
// Calculate armor mitigation
if (Unit.IsDamageReducedByArmor(GetSpellInfo().GetSchoolMask(), GetSpellInfo(), GetSpellEffectInfo()))
if (Unit.IsDamageReducedByArmor(GetSpellInfo().GetSchoolMask(), GetSpellInfo()))
{
uint damageReducedArmor = Unit.CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetSpellInfo().GetAttackType(), GetBase().GetCasterLevel());
cleanDamage.mitigated_damage += damage - damageReducedArmor;
+4
View File
@@ -2630,6 +2630,10 @@ namespace Game.Entities
{
foreach (var spellEffectInfo in spellInfo.GetEffects())
{
// all bleed effects and spells ignore armor
if ((spellInfo.GetEffectMechanicMask(spellEffectInfo.EffectIndex) & (1 << (int)Mechanics.Bleed)) != 0)
spellInfo.AttributesCu |= SpellCustomAttributes.IgnoreArmor;
switch (spellEffectInfo.ApplyAuraName)
{
case AuraType.ModPossess: