[Core] Fix channeling spells for unit (will not cast channeling spells when walking, attacking etc.) (c2632)

This commit is contained in:
kvipka 2015-03-26 11:27:29 +00:00 committed by Antz
parent 606bcfc495
commit f119a6119b

View File

@ -2966,10 +2966,10 @@ void Spell::update(uint32 difftime)
return;
}
// check if the player caster has moved before the spell finished
if ((m_caster->GetTypeId() == TYPEID_PLAYER && m_timer != 0) &&
// check if the player or unit caster has moved before the spell finished (exclude casting on vehicles)
if (((m_caster->GetTypeId() == TYPEID_PLAYER || m_caster->GetTypeId() == TYPEID_UNIT) && m_timer != 0) &&
(m_castPositionX != m_caster->GetPositionX() || m_castPositionY != m_caster->GetPositionY() || m_castPositionZ != m_caster->GetPositionZ()) &&
(m_spellInfo->Effect[EFFECT_INDEX_0] != SPELL_EFFECT_STUCK || !((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLINGFAR)))
(m_spellInfo->Effect[EFFECT_INDEX_0] != SPELL_EFFECT_STUCK || !m_caster->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLINGFAR)))
{
// always cancel for channeled spells
if (m_spellState == SPELL_STATE_CASTING)
@ -2998,10 +2998,10 @@ void Spell::update(uint32 difftime)
{
if (m_timer > 0)
{
if (m_caster->GetTypeId() == TYPEID_PLAYER)
if (m_caster->GetTypeId() == TYPEID_PLAYER || m_caster->GetTypeId() == TYPEID_UNIT)
{
// check if player has jumped before the channeling finished
if (((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLING))
if (m_caster->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLING))
{ cancel(); }
// check for incapacitating player states