diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 652cc34ae5d..6c0913dd2fa 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -2249,7 +2249,15 @@ int32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask) c } SpellSchools school = GetFirstSchoolInMask(schoolMask); // Flat mod from caster auras by spell school - powerCost += caster->GetInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + school); + AuraEffectList const& auras = caster->GetAuraEffectsByType(SPELL_AURA_MOD_POWER_COST_SCHOOL); + for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i) + { + if (!((*i)->GetMiscValue() & schoolMask)) + continue; + if (!((*i)->GetMiscValueB() & (1 << PowerType))) + continue; + powerCost += (*i)->GetAmount(); + } // Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost) if (AttributesEx4 & SPELL_ATTR4_SPELL_VS_EXTEND_COST) powerCost += caster->GetAttackTime(OFF_ATTACK) / 100; @@ -2261,7 +2269,15 @@ int32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask) c powerCost = int32(powerCost / (1.117f * SpellLevel / caster->getLevel() -0.1327f)); // PCT mod from user auras by school - powerCost = int32(powerCost * (1.0f + caster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + school))); + AuraEffectList const& aurasPct = caster->GetAuraEffectsByType(SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT); + for (AuraEffectList::const_iterator i = aurasPct.begin(); i != aurasPct.end(); ++i) + { + if (!((*i)->GetMiscValue() & schoolMask)) + continue; + if (!((*i)->GetMiscValueB() & (1 << PowerType))) + continue; + powerCost += CalculatePct(powerCost, (*i)->GetAmount()); + } if (powerCost < 0) powerCost = 0; return powerCost; |