Core/Auras: Implemented Aura 178 (SPELL_AURA_MOD_MAX_POWER_PCT) (#21804)

This commit is contained in:
hondacrx
2018-04-12 09:57:26 -04:00
parent 097ee01d19
commit 3ff01ee33b
2 changed files with 27 additions and 1 deletions
@@ -199,7 +199,7 @@ namespace Framework.Constants
ModSpellHealingOfStatPercent = 175,
SpiritOfRedemption = 176,
AoeCharm = 177,
ModMaxPowerPct = 178, // NYI
ModMaxPowerPct = 178,
ModPowerDisplay = 179,
ModFlatSpellDamageVersus = 180,
Unk181 = 181, // Old ModFlatSpellCritDamageVersus - Possible Flat Spell Crit Damage Versus
+26
View File
@@ -3516,6 +3516,32 @@ namespace Game.Spells
target.SetUInt32Value(UnitFields.OverrideDisplayPowerId, 0);
}
[AuraEffectHandler(AuraType.ModMaxPowerPct)]
void HandleAuraModMaxPowerPct(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
if (!mode.HasAnyFlag(AuraEffectHandleModes.ChangeAmountMask | AuraEffectHandleModes.Stat))
return;
Unit target = aurApp.GetTarget();
if (!target.IsPlayer())
return;
PowerType powerType = (PowerType)GetMiscValue();
UnitMods unitMod = UnitMods.PowerStart + (int)powerType;
// 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, (float)GetAmount(), apply);
// Calculate the current power change
int change = target.GetMaxPower(powerType) - oldMaxPower;
change = (oldPower + change) - target.GetPower(powerType);
target.ModifyPower(powerType, change);
}
/********************************/
/*** FIGHT ***/
/********************************/