Core/Spells: Fixed SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT

This commit is contained in:
hondacrx
2017-12-30 16:49:45 -05:00
parent 523a61b8ca
commit e7565adaf7
2 changed files with 12 additions and 30 deletions
+2 -8
View File
@@ -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)
{
+10 -22
View File
@@ -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)]