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