From 0e7b46eac4f3424940f4a90c9149e766ded11d55 Mon Sep 17 00:00:00 2001 From: Shocker Date: Wed, 6 Feb 2013 22:27:53 +0200 Subject: Core/Spells: Fix SPELL_AURA_MOD_POWER_COST_SCHOOL and SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT (cherry picked from commit be07a7d481bdd6728463cf63ee236d27df45e550) --- src/server/game/Spells/SpellInfo.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 80f7aa8e87a..6e317052f94 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -3281,8 +3281,15 @@ int32 SpellInfo::CalcPowerCost(WorldObject const* caster, SpellSchoolMask school } SpellSchools school = GetFirstSchoolInMask(schoolMask); // Flat mod from caster auras by spell school - powerCost += unitCaster->GetInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + AsUnderlyingType(school)); - + AuraEffectList const& auras = unitCaster->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 (HasAttribute(SPELL_ATTR4_SPELL_VS_EXTEND_COST)) { @@ -3311,7 +3318,15 @@ int32 SpellInfo::CalcPowerCost(WorldObject const* caster, SpellSchoolMask school } // PCT mod from user auras by school - powerCost = int32(powerCost * (1.0f + unitCaster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + AsUnderlyingType(school)))); + AuraEffectList const& aurasPct = unitCaster->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; -- cgit v1.2.3