mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 16:10:49 +01:00
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:
@@ -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