fix(Core/Players): don't set full heath/mana/rage while Dead (#20723)

fix level up while dead -> check if player is not dead, then update health/mana/rage/..

Co-authored-by: gontrannopier <gontrannopier@gontrannopier.com>
This commit is contained in:
gontrannopier
2024-12-01 21:09:26 +01:00
committed by GitHub
parent ffe7d42831
commit cf7959238a

View File

@@ -2507,14 +2507,17 @@ void Player::GiveLevel(uint8 level)
_ApplyAllLevelScaleItemMods(true);
// set current level health and mana/energy to maximum after applying all mods.
SetFullHealth();
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE));
SetPower(POWER_FOCUS, 0);
SetPower(POWER_HAPPINESS, 0);
if (!isDead())
{
// set current level health and mana/energy to maximum after applying all mods.
SetFullHealth();
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE));
SetPower(POWER_FOCUS, 0);
SetPower(POWER_HAPPINESS, 0);
}
// update level to hunter/summon pet
if (Pet* pet = GetPet())