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:
1 parent
2da34a4dbb
commit
c0ef2ba55c
1 file changed
+2
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user