aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/SpellInfo.cpp')
-rw-r--r--src/server/game/Spells/SpellInfo.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 958bcc82f16..d1dfa32f7cb 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -3698,6 +3698,19 @@ std::vector<SpellPowerCost> SpellInfo::CalcPowerCost(Unit const* caster, SpellSc
if (power->PowerCostMaxPct)
healthCost += int32(CalculatePct(caster->GetMaxHealth(), power->PowerCostMaxPct));
+ int32 optionalCost = int32(power->OptionalCost);
+ optionalCost += caster->GetTotalAuraModifier(SPELL_AURA_MOD_ADDITIONAL_POWER_COST, [this, power](AuraEffect const* aurEff) -> bool
+ {
+ return aurEff->GetMiscValue() == power->PowerType
+ && aurEff->IsAffectingSpell(this);
+ });
+
+ if (optionalCost)
+ {
+ int32 remainingPower = caster->GetPower(Powers(power->PowerType)) - powerCost;
+ powerCost += RoundToInterval<int32>(remainingPower, 0, optionalCost);
+ }
+
if (power->PowerType != POWER_HEALTH)
{
// Flat mod from caster auras by spell school and power type