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

Closes #26776
This commit is contained in:
Shauren
2021-08-08 13:03:57 +02:00
parent 6c005fadfa
commit 9067eb22ce

View File

@@ -1634,11 +1634,15 @@ void Unit::HandleEmoteCommand(uint32 anim_id, Trinity::IteratorPair<int32 const*
if (G3D::fuzzyLe(armor, 0.0f))
return damage;
Classes attackerClass = CLASS_WARRIOR;
if (attacker)
{
attackerLevel = attacker->GetLevelForTarget(victim);
attackerClass = Classes(attacker->getClass());
}
// Expansion and ContentTuningID necessary? Does Player get a ContentTuningID too ?
float armorConstant = sDB2Manager.EvaluateExpectedStat(ExpectedStatType::ArmorConstant, attackerLevel, -2, 0, Classes(attacker->getClass()));
float armorConstant = sDB2Manager.EvaluateExpectedStat(ExpectedStatType::ArmorConstant, attackerLevel, -2, 0, attackerClass);
if (!(armor + armorConstant))
return damage;