Core/Units: Fixed crash in Unit::CalcArmorReducedDamage when called from periodic aura tick if caster is no longer in world

Port From (https://github.com/TrinityCore/TrinityCore/commit/9067eb22ced9fdceb36f344b63af0edae1f4142a)
This commit is contained in:
hondacrx
2021-08-08 14:47:17 -04:00
parent 65a807c13e
commit ab6bd1e71f
+5 -1
View File
@@ -3797,11 +3797,15 @@ namespace Game.Entities
if (MathFunctions.fuzzyLe(armor, 0.0f))
return damage;
Class attackerClass = Class.Warrior;
if (attacker != null)
{
attackerLevel = attacker.GetLevelForTarget(victim);
attackerClass = attacker.GetClass();
}
// Expansion and ContentTuningID necessary? Does Player get a ContentTuningID too ?
float armorConstant = Global.DB2Mgr.EvaluateExpectedStat(ExpectedStatType.ArmorConstant, attackerLevel, -2, 0, attacker.GetClass());
float armorConstant = Global.DB2Mgr.EvaluateExpectedStat(ExpectedStatType.ArmorConstant, attackerLevel, -2, 0, attackerClass);
if ((armor + armorConstant) == 0)
return damage;