From 311af3a1cd4a5dd4fac74a4eb96bc06dda069e42 Mon Sep 17 00:00:00 2001 From: ToxicKevinFerm Date: Sun, 12 May 2024 20:45:43 +0200 Subject: [PATCH] Add WaitUntil --- sim/encounters/movement_ai.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sim/encounters/movement_ai.go b/sim/encounters/movement_ai.go index fbbe8d5d34..f973af7863 100644 --- a/sim/encounters/movement_ai.go +++ b/sim/encounters/movement_ai.go @@ -103,9 +103,6 @@ func (ai *MovementAI) Reset(sim *core.Simulation) { func (ai *MovementAI) ExecuteCustomRotation(sim *core.Simulation) { players := sim.Raid.AllPlayerUnits - if !ai.ShouldMove(sim) { - return - } for i := 0; i < len(players); i++ { player := players[i] duration := ai.TimeToMove(ai.MoveYards, player) @@ -128,14 +125,9 @@ func (ai *MovementAI) ExecuteCustomRotation(sim *core.Simulation) { player.MoveDuration(duration, sim) } } + + ai.Target.WaitUntil(sim, sim.CurrentTime+ai.MoveInterval) } func (ai *MovementAI) TimeToMove(distance float64, unit *core.Unit) time.Duration { return core.DurationFromSeconds(distance / unit.GetMovementSpeed()) } -func (ai *MovementAI) ShouldMove(sim *core.Simulation) bool { - if sim.CurrentTime-ai.LastMoveTime >= ai.MoveInterval { - ai.LastMoveTime = sim.CurrentTime - return true - } - return false -}