From 0f7b23070fd61ac4afd65d415bd56876d3716ea1 Mon Sep 17 00:00:00 2001 From: megamage Date: Fri, 7 Aug 2009 16:12:50 -0500 Subject: [PATCH] *Fix a bug introduced in 3874. This makes IsNonMeleeSpellCasted cannot correctly check if caster is casting. *This fixes the bug that Heigan chases players when he is channelling. --HG-- branch : trunk --- src/game/Spell.cpp | 2 +- src/game/Unit.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 21d7cf0250e..9b45eac6b2d 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3287,7 +3287,7 @@ void Spell::finish(bool ok) if(IsChanneledSpell(m_spellInfo)) m_caster->UpdateInterruptMask(); - if(!m_caster->IsNonMeleeSpellCasted(false, false, true)) + if(m_caster->hasUnitState(UNIT_STAT_CASTING) && !m_caster->IsNonMeleeSpellCasted(false, false, true)) m_caster->clearUnitState(UNIT_STAT_CASTING); // Unsummon summon as possessed creatures on spell cancel diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 5c666f3778f..d6abba40659 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3502,15 +3502,17 @@ bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skip if ( m_currentSpells[CURRENT_GENERIC_SPELL] && (m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_FINISHED) && (withDelayed || m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_DELAYED) ) + { if (!isAutoshoot || !(m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_RESET_AUTOSHOT)) return(true); - + } // channeled spells may be delayed, but they are still considered casted else if ( !skipChanneled && m_currentSpells[CURRENT_CHANNELED_SPELL] && (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED) ) + { if (!isAutoshoot || !(m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_RESET_AUTOSHOT)) return(true); - + } // autorepeat spells may be finished or delayed, but they are still considered casted else if ( !skipAutorepeat && m_currentSpells[CURRENT_AUTOREPEAT_SPELL] ) return(true);