From b99f574f64c37fbfc686f0ea0b7cb24bd59786c4 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 14 Sep 2023 06:59:49 -0400 Subject: [PATCH] Core/Spells: Allow cancelling spell missiles without cancelling the entire spell Port From (https://github.com/TrinityCore/TrinityCore/commit/ed98146d317f9b956e8ca23524631cdd2388492b) --- Source/Game/Entities/Unit/Unit.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index 71fa2468d..9e542e6d8 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -1212,21 +1212,26 @@ namespace Game.Entities SendMessageToSet(cancelSpellVisualKit, true); } - public void CancelSpellMissiles(uint spellId, bool reverseMissile = false) + public void CancelSpellMissiles(uint spellId, bool reverseMissile = false, bool abortSpell = false) { bool hasMissile = false; - foreach (var pair in m_Events.GetEvents()) + if (abortSpell) { - Spell spell = Spell.ExtractSpellFromEvent(pair.Value); - if (spell != null) + foreach (var pair in m_Events.GetEvents()) { - if (spell.GetSpellInfo().Id == spellId) + Spell spell = Spell.ExtractSpellFromEvent(pair.Value); + if (spell != null) { - pair.Value.ScheduleAbort(); - hasMissile = true; + if (spell.GetSpellInfo().Id == spellId) + { + pair.Value.ScheduleAbort(); + hasMissile = true; + } } } } + else + hasMissile = true; if (hasMissile) {