From 0e282dacccac1f1dd36c3c7f01e9d63157b22b98 Mon Sep 17 00:00:00 2001 From: QAston Date: Mon, 16 Feb 2009 17:09:26 +0100 Subject: *Check range for channeled spells during their duration. --HG-- branch : trunk --- src/game/Spell.cpp | 7 +++++-- src/game/Spell.h | 2 +- src/game/Unit.cpp | 11 +---------- 3 files changed, 7 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 36d0da7cae0..4ebd405e16e 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2108,7 +2108,7 @@ void Spell::prepare(SpellCastTargets * targets, Aura* triggeredByAura) } } -void Spell::cancel(bool report) +void Spell::cancel() { if(m_spellState == SPELL_STATE_FINISHED) return; @@ -2138,7 +2138,7 @@ void Spell::cancel(bool report) m_caster->RemoveAurasDueToCasterSpell(m_spellInfo->Id, m_caster->GetGUID()); SendChannelUpdate(0); SendInterrupted(0); - SendCastResult(report ? SPELL_FAILED_INTERRUPTED : SPELL_FAILED_DONT_REPORT); + SendCastResult(SPELL_FAILED_INTERRUPTED); } break; default: @@ -5248,6 +5248,9 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time) // another non-melee non-delayed spell is casted now, abort m_Spell->cancel(); } + // Check if target of channeled spell still in range + else if (m_Spell->CheckRange(false)) + m_Spell->cancel(); else { // do the action (pass spell to channeling state) diff --git a/src/game/Spell.h b/src/game/Spell.h index 42725aa11c7..a7110803ee9 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -324,7 +324,7 @@ class Spell ~Spell(); void prepare(SpellCastTargets * targets, Aura* triggeredByAura = NULL); - void cancel(bool report = true); + void cancel(); void update(uint32 difftime); void cast(bool skipCheck = false); void finish(bool ok = true); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 6bb085eca11..cc6d1f7aa94 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4692,8 +4692,7 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) && AurSpellInfo->EffectApplyAuraName[Aur->GetEffIndex()]!= SPELL_AURA_DUMMY) //don't stop channeling of scripted spells (this is actually a hack) { - caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel(false); - channeled = true; + caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel(); } } } @@ -4733,14 +4732,6 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) delete Aur; - if(channeled) - { - //if target is not caster remove auras also on caster - if (caster!=this) - caster->RemoveAurasAtChanneledTarget (AurSpellInfo, caster); - RemoveAurasAtChanneledTarget (AurSpellInfo, caster); - } - if(statue) statue->UnSummon(); -- cgit v1.2.3