aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOvahlord <dreadkiller@gmx.de>2025-01-03 16:34:25 +0100
committerOvahlord <dreadkiller@gmx.de>2025-01-03 16:34:25 +0100
commit0bfca1c18f1896521246e164501f8c41c7be715c (patch)
treeb6074067e39b540e04feaf7fdb16a8a1e4ec4f6b /src
parentcfbb909f3e5470be467e2d175b6e8a9440d9a3d8 (diff)
Core/Units: ensure that damaging hits will always award at least one rage point
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp5
1 files changed, 4 insertions, 1 deletions
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<uint32>(MIN_RAGE_AMOUNT, std::ceil(400 * multiplier)));
}
/// @todo for melee need create structure as in