From f0bbedddee8918136061e191c8fb39352fe674c8 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 4 Mar 2021 20:32:07 -0500 Subject: [PATCH] Core/Spells: Add Spell.HasPowerTypeCost to check which power types a spell uses Port From (https://github.com/TrinityCore/TrinityCore/commit/0960308cfcfab740456b070901bed92b4d6fb4a7) --- Source/Game/Spells/Spell.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index fead4df73..b6b462748 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -3591,7 +3591,7 @@ namespace Game.Spells if ((m_caster.IsTypeId(TypeId.Player) || (m_caster.IsTypeId(TypeId.Unit) && m_caster.IsPet())) && m_powerCost.Any(cost => cost.Power != PowerType.Health)) castFlags |= SpellCastFlags.PowerLeftSelf; - if (m_powerCost.Any(cost => cost.Power == PowerType.Runes)) + if (HasPowerTypeCost(PowerType.Runes)) castFlags |= SpellCastFlags.NoGCD; // not needed, but Blizzard sends it SpellStart packet = new SpellStart(); @@ -3692,8 +3692,8 @@ namespace Game.Spells if ((m_caster.IsTypeId(TypeId.Player) || (m_caster.IsTypeId(TypeId.Unit) && m_caster.IsPet())) && m_powerCost.Any(cost => cost.Power != PowerType.Health)) castFlags |= SpellCastFlags.PowerLeftSelf; // should only be sent to self, but the current messaging doesn't make that possible - if ((m_caster.IsTypeId(TypeId.Player)) && (m_caster.GetClass() == Class.Deathknight) && - m_powerCost.Any(cost => cost.Power == PowerType.Runes) && !_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.IgnorePowerAndReagentCost)) + if (m_caster.IsTypeId(TypeId.Player) && m_caster.GetClass() == Class.Deathknight && + HasPowerTypeCost(PowerType.Runes) && !_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.IgnorePowerAndReagentCost)) { castFlags |= SpellCastFlags.NoGCD; // same as in SMSG_SPELL_START castFlags |= SpellCastFlags.RuneList; // rune cooldowns list @@ -6502,6 +6502,11 @@ namespace Game.Spells SendChannelUpdate((uint)m_timer); } + bool HasPowerTypeCost(PowerType power) + { + return m_powerCost.Any(cost => cost.Power == power); + } + bool UpdatePointers() { if (m_originalCasterGUID == m_caster.GetGUID())