diff --git a/Source/Game/Entities/StatSystem.cs b/Source/Game/Entities/StatSystem.cs index c7f4290ee..49f6041ab 100644 --- a/Source/Game/Entities/StatSystem.cs +++ b/Source/Game/Entities/StatSystem.cs @@ -121,15 +121,9 @@ namespace Game.Entities return true; } - int GetMinPower(PowerType power) { return power == PowerType.LunarPower ? -100 : 0; } - // returns negative amount on power reduction - public int ModifyPowerPct(PowerType power, float pct, bool apply) - { - float amount = GetMaxPower(power); - MathFunctions.ApplyPercentModFloatVar(ref amount, pct, apply); - return ModifyPower(power, (int)amount - GetMaxPower(power)); - } + int GetMinPower(PowerType power) { return power == PowerType.LunarPower ? -100 : 0; } + // returns negative amount on power reduction public int ModifyPower(PowerType power, int dVal) { diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index 1ce2c20fb..d0e42a266 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -3411,15 +3411,9 @@ namespace Game.Spells return; Unit target = aurApp.GetTarget(); - PowerType powerType = (PowerType)GetMiscValue(); - // do not check power type, we can always modify the maximum - // as the client will not see any difference - // also, placing conditions that may change during the aura duration - // inside effect handlers is not a good idea UnitMods unitMod = (UnitMods.PowerStart + (int)powerType); - target.HandleStatModifier(unitMod, UnitModifierType.TotalValue, GetAmount(), apply); } @@ -3430,26 +3424,20 @@ namespace Game.Spells return; Unit target = aurApp.GetTarget(); - PowerType powerType = (PowerType)GetMiscValue(); - // do not check power type, we can always modify the maximum - // as the client will not see any difference - // also, placing conditions that may change during the aura duration - // inside effect handlers is not a good idea UnitMods unitMod = UnitMods.PowerStart + (int)powerType; - float amount = GetAmount(); - if (apply) - { - target.HandleStatModifier(unitMod, UnitModifierType.TotalPCT, amount, apply); - target.ModifyPowerPct(powerType, amount, apply); - } - else - { - target.ModifyPowerPct(powerType, amount, apply); - target.HandleStatModifier(unitMod, UnitModifierType.TotalPCT, amount, apply); - } + // Save old powers for further calculation + int oldPower = target.GetPower(powerType); + int oldMaxPower = target.GetMaxPower(powerType); + + // Handle aura effect for max power + target.HandleStatModifier(unitMod, UnitModifierType.TotalPCT, GetAmount(), apply); + + // Calculate the current power change + int change = target.GetMaxPower(powerType) - oldMaxPower; + change = (oldPower + change) - target.GetPower(powerType); } [AuraEffectHandler(AuraType.ModIncreaseHealthPercent)]