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:
jackpoz committed 2015-08-05 19:58:19 +02:00
1 parent 578bb8452f
commit 143026ed19
1 file changed
+3
+3
View File
@@ -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);