Spells/Auras: Properly handle negative health modifiers on application. Closes #22211.

This commit is contained in:
Treeston
2018-08-12 14:17:26 +02:00
parent 59edf6b100
commit 41982aa300

View File

@@ -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