Skip to content

Commit 0e7b46e

Browse files
ShockerShauren
authored andcommitted
Core/Spells: Fix SPELL_AURA_MOD_POWER_COST_SCHOOL and SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
(cherry picked from commit be07a7d)
1 parent df42c47 commit 0e7b46e

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/server/game/Spells/SpellInfo.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3281,8 +3281,15 @@ int32 SpellInfo::CalcPowerCost(WorldObject const* caster, SpellSchoolMask school
32813281
}
32823282
SpellSchools school = GetFirstSchoolInMask(schoolMask);
32833283
// Flat mod from caster auras by spell school
3284-
powerCost += unitCaster->GetInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + AsUnderlyingType(school));
3285-
3284+
AuraEffectList const& auras = unitCaster->GetAuraEffectsByType(SPELL_AURA_MOD_POWER_COST_SCHOOL);
3285+
for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
3286+
{
3287+
if (!((*i)->GetMiscValue() & schoolMask))
3288+
continue;
3289+
if (!((*i)->GetMiscValueB() & (1 << PowerType)))
3290+
continue;
3291+
powerCost += (*i)->GetAmount();
3292+
}
32863293
// Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost)
32873294
if (HasAttribute(SPELL_ATTR4_SPELL_VS_EXTEND_COST))
32883295
{
@@ -3311,7 +3318,15 @@ int32 SpellInfo::CalcPowerCost(WorldObject const* caster, SpellSchoolMask school
33113318
}
33123319

33133320
// PCT mod from user auras by school
3314-
powerCost = int32(powerCost * (1.0f + unitCaster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + AsUnderlyingType(school))));
3321+
AuraEffectList const& aurasPct = unitCaster->GetAuraEffectsByType(SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT);
3322+
for (AuraEffectList::const_iterator i = aurasPct.begin(); i != aurasPct.end(); ++i)
3323+
{
3324+
if (!((*i)->GetMiscValue() & schoolMask))
3325+
continue;
3326+
if (!((*i)->GetMiscValueB() & (1 << PowerType)))
3327+
continue;
3328+
powerCost += CalculatePct(powerCost, (*i)->GetAmount());
3329+
}
33153330
if (powerCost < 0)
33163331
powerCost = 0;
33173332
return powerCost;

0 commit comments

Comments
 (0)