fix(Core/Movement): creatures should not cast while moving (#9141)
- Closes #8843
This commit is contained in:
parent
006ee3b7e2
commit
70fbaefa8e
10 changed files with 53 additions and 52 deletions
|
|
@ -260,10 +260,10 @@ void RandomMovementGenerator<Creature>::DoFinalize(Creature* creature)
|
|||
template<>
|
||||
bool RandomMovementGenerator<Creature>::DoUpdate(Creature* creature, const uint32 diff)
|
||||
{
|
||||
if (creature->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED))
|
||||
if (creature->HasUnitState(UNIT_STATE_NOT_MOVE) || creature->IsMovementPreventedByCasting())
|
||||
{
|
||||
_nextMoveTime.Reset(0); // Expire the timer
|
||||
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
|
||||
creature->StopMoving();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -275,23 +275,6 @@ bool RandomMovementGenerator<Creature>::DoUpdate(Creature* creature, const uint3
|
|||
return true;
|
||||
}
|
||||
|
||||
// prevent movement while casting spells with cast time or channel time
|
||||
if (creature->HasUnitState(UNIT_STATE_CASTING))
|
||||
{
|
||||
bool stop = true;
|
||||
if (Spell* spell = creature->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||
if (!(spell->GetSpellInfo()->ChannelInterruptFlags & (AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING)) && !(spell->GetSpellInfo()->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT))
|
||||
stop = false;
|
||||
|
||||
if (stop)
|
||||
{
|
||||
if (!creature->IsStopped())
|
||||
creature->StopMoving();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (creature->movespline->Finalized())
|
||||
{
|
||||
_nextMoveTime.Update(diff);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue