mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 00:18:43 +01:00
Core/Spells: Fix SPELL_AURA_MOD_POWER_COST_SCHOOL and SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user