diff options
| author | ariel- <ariel-@users.noreply.github.com> | 2016-10-27 13:29:56 -0300 |
|---|---|---|
| committer | ariel- <ariel-@users.noreply.github.com> | 2016-10-27 13:29:56 -0300 |
| commit | 7ced76bab271f7fd1116455e2003d82d103e2854 (patch) | |
| tree | 0e226d1e5bee757aa0c6c530c6247c7979997318 | |
| parent | b7efd40c301ba1f98f00e3768bf7f1a3d0137f01 (diff) | |
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
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index e9f20b1e01e..284a0503fa6 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -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; } |
