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-
2016-10-17 04:33:36 -03:00
parent 2b9f807fd9
commit 2d0fb356de

View File

@@ -3583,8 +3583,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)