Core/Spells: Fix damage done by SPELL_EFFECT_NORMALIZED_WEAPON_DMG
Fix a rare case that would cause SPELL_EFFECT_NORMALIZED_WEAPON_DMG to do 4 billions damage or to trigger an assertion in Unit::CalculateDamage() depending by Unit base damage. To reproduce the issue cast spell 25816 on a level 1-14 warrior, then make the warrior cast spell 694 on a Creature.
This commit is contained in:
1 parent
578bb8452f
commit
143026ed19
1 file changed
+3
@@ -2206,6 +2206,9 @@ uint32 Unit::CalculateDamage(WeaponAttackType attType, bool normalized, bool add
|
||||
}
|
||||
}
|
||||
|
||||
minDamage = std::max(0.f, minDamage);
|
||||
maxDamage = std::max(0.f, maxDamage);
|
||||
|
||||
if (minDamage > maxDamage)
|
||||
std::swap(minDamage, maxDamage);
|
||||
|
||||
|
||||
Reference in new issue
Block a user