Core/Unit: fix logic error in DamageInfo::ModifyDamage.

Previous code did not protect against m_damage underflow, rather only allow up to duplicate damage.
It now should work as intended.

Closes #18154
This commit is contained in:
ariel-
2016-10-27 13:29:56 -03:00
parent b7efd40c30
commit 7ced76bab2

View File

@@ -161,7 +161,8 @@ DamageInfo::DamageInfo(SpellNonMeleeDamage const& spellNonMeleeDamage, DamageEff
void DamageInfo::ModifyDamage(int32 amount)
{
amount = std::min(amount, int32(GetDamage()));
if (amount < 0)
amount = std::max(amount, static_cast<int32>(-GetDamage()));
m_damage += amount;
}