mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-13 11:43:18 -04: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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user