From be092be0a6bdfb5f99a58e2c75cb7599bd6ed931 Mon Sep 17 00:00:00 2001 From: killerwife Date: Wed, 25 Dec 2024 21:33:45 +0100 Subject: [PATCH] Spell: Immediately interrupt cast if target dies mid cast --- src/game/Spells/Spell.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index 529e481b94..884e4ff727 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -3707,6 +3707,12 @@ void Spell::update(uint32 difftime) { if (m_timer) { + if (m_targets.getUnitTarget() && !m_IsTriggeredSpell && !IsAllowingDeadTarget(m_spellInfo) && !m_targets.getUnitTarget()->IsAlive()) + { + cancel(); + return; + } + if (difftime >= m_timer) m_timer = 0; else @@ -3724,14 +3730,20 @@ void Spell::update(uint32 difftime) { // check if player has jumped before the channeling finished if (m_caster->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLING)) + { cancel(); + return; + } // check for incapacitating player states if (m_caster->IsCrowdControlled()) { // certain channel spells are not interrupted if (!m_spellInfo->HasAttribute(SPELL_ATTR_EX_IS_CHANNELED) && !m_spellInfo->HasAttribute(SPELL_ATTR_EX3_IGNORE_CASTER_AND_TARGET_RESTRICTIONS)) + { cancel(); + return; + } } if (m_spellInfo->HasAttribute(SPELL_ATTR_EX2_SPECIAL_TAMING_FLAG)) // these fail on lost target attention (aggro) @@ -3740,7 +3752,10 @@ void Spell::update(uint32 difftime) { Unit* targetsTarget = target->GetTarget(); if (targetsTarget && targetsTarget != m_caster) + { cancel(); + return; + } } } @@ -3789,6 +3804,7 @@ void Spell::update(uint32 difftime) if (!m_caster->IsWithinCombatDistInMap(channelTarget, m_maxRange * 1.5f)) { cancel(); + return; } } }