mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +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 (cherry picked from commit7ced76bab2) Core/Unit: fix warning reported by VS2015 C4146: unary minus operator applied to unsigned type, result still unsigned (cherry picked from commit7b1a0c3698) Core/Unit: consistency fix (cherry picked from commit042023877a)
This commit is contained in:
@@ -173,7 +173,7 @@ DamageInfo::DamageInfo(SpellNonMeleeDamage const& spellNonMeleeDamage, DamageEff
|
||||
|
||||
void DamageInfo::ModifyDamage(int32 amount)
|
||||
{
|
||||
amount = std::min(amount, int32(GetDamage()));
|
||||
amount = std::max(amount, -static_cast<int32>(GetDamage()));
|
||||
m_damage += amount;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user