From 0bfca1c18f1896521246e164501f8c41c7be715c Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Fri, 3 Jan 2025 16:34:25 +0100 Subject: Core/Units: ensure that damaging hits will always award at least one rage point --- src/server/game/Entities/Unit/Unit.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index bb921c0953b..ca6ee19873f 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1321,6 +1321,9 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage const* damageInfo, bool durabilit return uint32(rage * 10); } +// The minimum amount a damaging hit should award +constexpr uint32 MIN_RAGE_AMOUNT = 10; + // Calculates the amount of rage gained from taking damage /*static*/ uint32 Unit::CalcDamageTakenRageGain(Unit const* victim, uint32 damage) { @@ -1331,7 +1334,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage const* damageInfo, bool durabilit // This formula is based on sampling multiple sniff data at multiple level ranges // There has never been any leak and the only info we have is that the amount is based on max HP and damage taken and that there is a hidden constant - return uint32(std::ceil(400 * multiplier)); + return uint32(std::max(MIN_RAGE_AMOUNT, std::ceil(400 * multiplier))); } /// @todo for melee need create structure as in -- cgit v1.2.3