aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortreeston <treeston.mmoc@gmail.com>2017-03-20 22:47:41 +0100
committertreeston <treeston.mmoc@gmail.com>2017-03-20 22:47:41 +0100
commit2a462e93093d177a0e0bedf3e94ac2cf4e66a3c3 (patch)
tree0e383b8572b6fcc094cb8eced2986e867c3e9eaa /src
parent333a4034099e262db8db0a1736d01c30a8cf9d52 (diff)
Spell/Aura: Fix handling of max power reducing debuffs when removed. Fixes issues with Reliquary of Souls encounter.
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index a038d52e418..71dce8bf3d7 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -3689,25 +3689,33 @@ void AuraEffect::HandleAuraModIncreaseEnergyPercent(AuraApplication const* aurAp
return;
Unit* target = aurApp->GetTarget();
-
Powers powerType = Powers(GetMiscValue());
-
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
+ uint32 curPower = target->GetPower(powerType);
+ uint32 oldMaxPower = target->GetMaxPower(powerType);
+
if (apply)
{
float amount = float(GetAmount());
target->ApplyStatPctModifier(unitMod, TOTAL_PCT, amount);
-
- float power = target->GetMaxPower(powerType);
- AddPct(power, amount);
- target->ModifyPower(powerType, (int32)power - (int32)target->GetMaxPower(powerType));
}
else
{
float amount = target->GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT, GetMiscValue());
target->SetStatPctModifier(unitMod, TOTAL_PCT, amount);
}
+
+ int32 dmax = ((int32)target->GetMaxPower(powerType)) - oldMaxPower;
+ if (dmax >= 0) // increase current power by dmax on both buff application and debuff removal
+ target->SetPower(powerType, curPower + dmax);
+ else if (apply) // do not reduce current power on buff removal (Hymn of Hope et al), but reduce it on debuff application (Aura of Desire)
+ {
+ if ((uint32)(-dmax) <= curPower)
+ target->SetPower(powerType, curPower + dmax);
+ else
+ target->SetPower(powerType, 0);
+ }
}
void AuraEffect::HandleAuraModIncreaseHealthPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const