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
committed by Aokromes
parent 2da34a4dbb
commit c0ef2ba55c

View File

@@ -122,7 +122,8 @@ m_damageType(DIRECT_DAMAGE), m_attackType(dmgInfo.attackType)
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;
}