Core/Spells: Moved power cost RequiredAuraSpellID condition checking to make sure all overloads of SpellInfo.CalcPowerCost take it into account
Port From (https://github.com/TrinityCore/TrinityCore/commit/ea63cd882c9f1438ab75036420a2bd3c18a3ecb5)
This commit is contained in:
@@ -2677,11 +2677,7 @@ namespace Game.Spells
|
|||||||
|
|
||||||
SpellPowerCost CalcPowerCost(PowerType powerType, bool optionalCost, Unit caster, SpellSchoolMask schoolMask, Spell spell = null)
|
SpellPowerCost CalcPowerCost(PowerType powerType, bool optionalCost, Unit caster, SpellSchoolMask schoolMask, Spell spell = null)
|
||||||
{
|
{
|
||||||
var spellPowerRecord = PowerCosts.First(spellPowerEntry =>
|
var spellPowerRecord = PowerCosts.First(spellPowerEntry => spellPowerEntry?.PowerType == powerType);
|
||||||
{
|
|
||||||
return spellPowerEntry.PowerType == powerType;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (spellPowerRecord == null)
|
if (spellPowerRecord == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -2690,6 +2686,9 @@ namespace Game.Spells
|
|||||||
|
|
||||||
SpellPowerCost CalcPowerCost(SpellPowerRecord power, bool optionalCost, Unit caster, SpellSchoolMask schoolMask, Spell spell = null)
|
SpellPowerCost CalcPowerCost(SpellPowerRecord power, bool optionalCost, Unit caster, SpellSchoolMask schoolMask, Spell spell = null)
|
||||||
{
|
{
|
||||||
|
if (power.RequiredAuraSpellID != 0 && !caster.HasAura(power.RequiredAuraSpellID))
|
||||||
|
return null;
|
||||||
|
|
||||||
SpellPowerCost cost = new();
|
SpellPowerCost cost = new();
|
||||||
|
|
||||||
// Spell drain all exist power on cast (Only paladin lay of Hands)
|
// Spell drain all exist power on cast (Only paladin lay of Hands)
|
||||||
@@ -2895,9 +2894,6 @@ namespace Game.Spells
|
|||||||
if (power == null)
|
if (power == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (power.RequiredAuraSpellID != 0 && !caster.HasAura(power.RequiredAuraSpellID))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
SpellPowerCost cost = CalcPowerCost(power, false, caster, schoolMask, spell);
|
SpellPowerCost cost = CalcPowerCost(power, false, caster, schoolMask, spell);
|
||||||
if (cost != null)
|
if (cost != null)
|
||||||
getOrCreatePowerCost(cost.Power).Amount += cost.Amount;
|
getOrCreatePowerCost(cost.Power).Amount += cost.Amount;
|
||||||
|
|||||||
Reference in New Issue
Block a user