Core/Players: Preserve fractional health regen amounts between regen ticks (#31820)

(cherry picked from commit bcb5746e3ee1b9336fedd1b8edd39ef165c882b6)
This commit is contained in:
ccrs
2026-07-19 23:52:03 +02:00
committed by Shauren
parent 036f78539e
commit 6b01ccefd0
2 changed files with 20 additions and 2 deletions
+19 -2
View File
@@ -324,6 +324,7 @@ Player::Player(WorldSession* session) : Unit(true), m_sceneMgr(this)
m_ChampioningFaction = 0;
m_healthFraction = 0.0f;
m_powerFraction.fill(0.0f);
isDebugAreaTriggers = false;
@@ -1779,9 +1780,25 @@ void Player::RegenerateHealth()
addValue += m_baseHealthRegen / 2.5f;
if (addValue < 0.0f)
addValue = 0.0f;
return;
ModifyHealth(int32(addValue));
addValue += m_healthFraction;
int32 integerValue = int32(addValue);
if (!integerValue)
return;
if (curValue + integerValue < maxValue)
{
curValue += integerValue;
m_healthFraction = addValue - integerValue;
}
else
{
curValue = maxValue;
m_healthFraction = 0.0f;
}
SetHealth(curValue);
}
void Player::ResetAllPowers()
+1
View File
@@ -3074,6 +3074,7 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
GuidList WhisperList;
TimePoint m_regenInterruptTimestamp;
uint32 m_regenTimerCount;
float m_healthFraction;
std::array<float, MAX_POWERS_PER_CLASS> m_powerFraction;
uint32 m_contestedPvPTimer;