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

Port From (https://github.com/TrinityCore/TrinityCore/commit/d3f93bcc2632ed334ddf7acd1f068734bd507877)
This commit is contained in:
hondacrx
2021-10-20 22:27:36 -04:00
parent 612ebb506e
commit c9ea148490
+7 -14
View File
@@ -3315,21 +3315,14 @@ namespace Game.Spells
Unit target = aurApp.GetTarget();
if (apply)
{
target.HandleStatFlatModifier(UnitMods.Health, UnitModifierFlatType.Total, GetAmount(), apply);
target.ModifyHealth(GetAmount());
}
else
{
if (target.GetHealth() > 0)
{
int value = (int)Math.Min(target.GetHealth() - 1, (ulong)GetAmount());
target.ModifyHealth(-value);
}
int amt = apply ? GetAmount() : -GetAmount();
if (amt < 0)
target.ModifyHealth(Math.Max((int)(1 - target.GetHealth()), amt));
target.HandleStatFlatModifier(UnitMods.Health, UnitModifierFlatType.Total, GetAmount(), apply);
}
target.HandleStatFlatModifier(UnitMods.Health, UnitModifierFlatType.Total, GetAmount(), apply);
if (amt > 0)
target.ModifyHealth(amt);
}
void HandleAuraModIncreaseMaxHealth(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)