Core/Creatures: Fix IsMovementPreventedByCasting logic (#28551)

This commit is contained in:
Meji
2023-01-09 23:08:22 +01:00
committed by GitHub
parent d90b526c28
commit e2ed3e23f8

View File

@@ -3389,20 +3389,21 @@ void Creature::DoNotReacquireSpellFocusTarget()
bool Creature::IsMovementPreventedByCasting() const
{
// Can always move when not casting
if (!HasUnitState(UNIT_STATE_CASTING))
return false;
// first check if currently a movement allowed channel is active and we're not casting
if (Spell* spell = m_currentSpells[CURRENT_CHANNELED_SPELL])
{
if (spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive())
if (spell->CheckMovement() != SPELL_CAST_OK)
return false;
return true;
}
if (HasSpellFocus())
return true;
if (HasUnitState(UNIT_STATE_CASTING))
return true;
return false;
}