mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 03:45:43 +00:00
fix(Core/Movement): creatures should not cast while moving (#9141)
- Closes #8843
This commit is contained in:
@@ -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])
|
||||
|
||||
@@ -2145,6 +2145,8 @@ public:
|
||||
[[nodiscard]] Spell* FindCurrentSpellBySpellId(uint32 spell_id) const;
|
||||
[[nodiscard]] int32 GetCurrentSpellCastTime(uint32 spell_id) const;
|
||||
|
||||
virtual bool IsMovementPreventedByCasting() const;
|
||||
|
||||
ObjectGuid m_SummonSlot[MAX_SUMMON_SLOT];
|
||||
ObjectGuid m_ObjectSlot[MAX_GAMEOBJECT_SLOT];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user