Skip to content

Commit

Permalink
Add WaitUntil
Browse files Browse the repository at this point in the history
  • Loading branch information
ToxicKevinFerm committed May 12, 2024
1 parent aaf6ce9 commit 311af3a
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions sim/encounters/movement_ai.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}

0 comments on commit 311af3a

Please sign in to comment.