From 3e070cedf2455cb7513c0200512f2105fa2f1871 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 30 Jul 2025 14:52:13 +0200 Subject: fix SimpleAi unit handling Remove finished unit AIs. Skip Units with only street actions left. --- go/game/ai.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/go/game/ai.go b/go/game/ai.go index f630b41b..928285bc 100644 --- a/go/game/ai.go +++ b/go/game/ai.go @@ -652,7 +652,13 @@ func (ai *SimpleAiControl) handlePriority() Action { // Slow Actions if s.stack.IsEmpty() { for _, u := range s.OwnUnits(ai.p) { - if len(u.AvailSlowActions()) == 0 { + as := u.AvailSlowActions() + if len(as) == 0 { + delete(ai.uAis, u) + continue + } else if _, ok := as[0].(*StreetAction); ok && len(as) == 1 { + // FIXME: Support Street Actions + delete(ai.uAis, u) continue } @@ -667,6 +673,8 @@ func (ai *SimpleAiControl) handlePriority() Action { if !more { // Consume all available actions to not consider the unit this term again. u.tap() + // Delete unitAI if it finished its turn + delete(ai.uAis, u) continue } if a == nil && more { -- cgit v1.2.3