Core/Spell: clear auras of channeled spells if channeling is cancelled due to invalid targets (dead or w/e)

Closes #14859
Closes #15186
This commit is contained in:
ariel- authored and Aokromes committed 2016-10-24 13:59:54 +02:00
1 parent 657aea3d5b
commit 162eaad0ee
1 file changed
+6 -2
+6 -2
View File
@@ -3577,8 +3577,12 @@ void Spell::update(uint32 difftime)
if (!UpdateChanneledTargetList())
{
TC_LOG_DEBUG("spells", "Channeled spell %d is removed due to lack of targets", m_spellInfo->Id);
SendChannelUpdate(0);
finish();
m_timer = 0;
// Also remove applied auras
for (TargetInfo const& target : m_UniqueTargetInfo)
if (Unit* unit = m_caster->GetGUID() == target.targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target.targetGUID))
unit->RemoveOwnedAura(m_spellInfo->Id, m_originalCasterGUID, 0, AURA_REMOVE_BY_CANCEL);
}
if (m_timer > 0)