fix(Core/Player): Don't modify health in a couple functions when player is dead. (#27885)

Co-authored-by: Claude <[email protected]>
This commit is contained in:
Benjamin Jackson
2026-10-01 11:00:07 -03:00
committed by GitHub
co-authored by Claude
parent 9a992112a6
commit 7dd02b23c8
2 changed files with 16 additions and 14 deletions
+6 -9
View File
@@ -2075,23 +2075,20 @@ void Player::RegenerateHealth()
void Player::ResetAllPowers()
{
SetHealth(GetMaxHealth());
if (IsAlive())
SetHealth(GetMaxHealth());
if (HasActivePowerType(POWER_MANA))
{
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
}
if (HasActivePowerType(POWER_RAGE))
{
SetPower(POWER_RAGE, 0);
}
if (HasActivePowerType(POWER_ENERGY))
{
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
}
if (HasActivePowerType(POWER_RUNIC_POWER))
{
SetPower(POWER_RUNIC_POWER, 0);
}
}
bool Player::CanInteractWithQuestGiver(Object* questGiver)
@@ -4469,14 +4469,19 @@ void AuraEffect::HandleAuraModIncreaseHealth(AuraApplication const* aurApp, uint
if (apply)
{
target->HandleStatFlatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
target->ModifyHealth(GetAmount());
// If target is dead, this could break the client's perception of their alive status
if (target->IsAlive())
target->ModifyHealth(GetAmount());
}
else
{
if (int32(target->GetHealth()) > GetAmount())
target->ModifyHealth(-GetAmount());
else
target->SetHealth(1);
if (target->IsAlive())
{
if (int32(target->GetHealth()) > GetAmount())
target->ModifyHealth(-GetAmount());
else
target->SetHealth(1);
}
target->HandleStatFlatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
}
}