aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShocker <shocker@freakz.ro>2013-02-06 22:27:53 +0200
committerShocker <shocker@freakz.ro>2013-02-06 22:27:53 +0200
commitbe07a7d481bdd6728463cf63ee236d27df45e550 (patch)
tree1cd62d7dbeea0596bee9c314e570f858ca4e3ba8
parent6a0b7950a7966ee212d728b16ef197a88ebe8bb6 (diff)
Core/Spells: Fix SPELL_AURA_MOD_POWER_COST_SCHOOL and SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
-rw-r--r--src/server/game/Spells/SpellInfo.cpp20
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;