From eee80bad681422a71774509b6b8e407ab23210c8 Mon Sep 17 00:00:00 2001 From: Hondacrx Date: Thu, 26 Sep 2024 13:07:53 -0400 Subject: [PATCH] Core/Spells: Implemented SpellAuraInterruptFlags2::ReleaseEmpower Port From (https://github.com/TrinityCore/TrinityCore/commit/2c06e7fcdab677df4e5908f69b9655577e08fe69) --- Source/Framework/Constants/Spells/SpellConst.cs | 1 + Source/Game/Spells/Spell.cs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index 404ad2e05..3484b9fa1 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -176,6 +176,7 @@ namespace Framework.Constants ChallengeModeStart = 0x400000, // Implemented in Unit::AtStartOfEncounter StartOfEncounter = 0x800000, // Implemented in Unit::AtStartOfEncounter EndOfEncounter = 0x1000000, // Implemented in Unit::AtEndOfEncounter + ReleaseEmpower = 0x02000000, // Implemented in Spell::update } // Enum with EffectRadiusIndex and their actual radius diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index 9459f6ab0..1ed053151 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -3492,7 +3492,7 @@ namespace Game.Spells if (IsEmpowerSpell()) { - int getCompletedEmpowerStages() + int completedStages = new Func(() => { TimeSpan passed = TimeSpan.FromMilliseconds(m_channeledDuration - m_timer); for (int i = 0; i < m_empower.StageDurations.Count; ++i) @@ -3503,9 +3503,8 @@ namespace Game.Spells } return m_empower.StageDurations.Count; - }; + })(); - int completedStages = getCompletedEmpowerStages(); if (completedStages != m_empower.CompletedStages) { SpellEmpowerSetStage empowerSetStage = new(); @@ -3518,6 +3517,7 @@ namespace Game.Spells m_caster.ToUnit().SetSpellEmpowerStage((sbyte)completedStages); CallScriptEmpowerStageCompletedHandlers(completedStages); + m_caster.ToUnit().RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2.ReleaseEmpower, m_spellInfo); } if (CanReleaseEmpowerSpell())