diff options
author | Shocker <shocker@freakz.ro> | 2013-02-06 22:27:53 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2025-07-25 19:47:13 +0200 |
commit | 0e7b46eac4f3424940f4a90c9149e766ded11d55 (patch) | |
tree | 6fedcb3f3d522b72baee2ec78ca7ac595b40c062 | |
parent | df42c474c151a494ce4b386dbc43fa7f64db76b4 (diff) |
Core/Spells: Fix SPELL_AURA_MOD_POWER_COST_SCHOOL and SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
(cherry picked from commit be07a7d481bdd6728463cf63ee236d27df45e550)
-rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
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; |