fix(Core/Movement): creatures should not cast while moving (#9141)

- Closes #8843
This commit is contained in:
UltraNix
2021-11-15 14:39:36 +01:00
committed by GitHub
parent 006ee3b7e2
commit 70fbaefa8e
10 changed files with 53 additions and 52 deletions

View File

@@ -3683,6 +3683,30 @@ int32 Unit::GetCurrentSpellCastTime(uint32 spell_id) const
return 0;
}
bool Unit::IsMovementPreventedByCasting() const
{
// can always move when not casting
if (!HasUnitState(UNIT_STATE_CASTING))
{
return false;
}
// channeled spells during channel stage (after the initial cast timer) allow movement with a specific spell attribute
if (Spell* spell = m_currentSpells[CURRENT_CHANNELED_SPELL])
{
if (spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive())
{
if (spell->GetSpellInfo()->IsMoveAllowedChannel())
{
return false;
}
}
}
// prohibit movement for all other spell casts
return true;
}
bool Unit::CanMoveDuringChannel() const
{
if (Spell* spell = m_currentSpells[CURRENT_CHANNELED_SPELL])