mirror of
https://gitcode.com/GitHub_Trending/az/azerothcore-wotlk.git
synced 2026-10-10 07:06:38 +08:00
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:
co-authored by
Claude
parent
9a992112a6
commit
7dd02b23c8
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user