mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Spells/Auras: Properly handle negative health modifiers on application. Closes #22211.
This commit is contained in:
@@ -3620,20 +3620,14 @@ void AuraEffect::HandleAuraModIncreaseHealth(AuraApplication const* aurApp, uint
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
if (apply)
|
||||
{
|
||||
target->HandleStatFlatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
|
||||
target->ModifyHealth(GetAmount());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target->GetHealth() > 0)
|
||||
{
|
||||
int32 value = std::min<int32>(target->GetHealth() - 1, GetAmount());
|
||||
target->ModifyHealth(-value);
|
||||
}
|
||||
target->HandleStatFlatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
|
||||
}
|
||||
int32 const amt = apply ? GetAmount() : -GetAmount();
|
||||
if (amt < 0)
|
||||
target->ModifyHealth(std::max<int32>(1 - target->GetHealth(), amt));
|
||||
|
||||
target->HandleStatFlatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, GetAmount(), apply);
|
||||
|
||||
if (amt > 0)
|
||||
target->ModifyHealth(amt);
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraModIncreaseMaxHealth(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||
|
||||
Reference in New Issue
Block a user