diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-07-30 14:52:13 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-07-30 14:52:13 +0200 |
| commit | fd9a96f0afcae4d2bdad931252c85b593024548b (patch) | |
| tree | c805128657c1811f2ab4ed3b70a8388805c28c46 | |
| parent | fb3965c169013fff76622f684a545bf191274a7a (diff) | |
| download | muhqs-game-fd9a96f0afcae4d2bdad931252c85b593024548b.tar.gz muhqs-game-fd9a96f0afcae4d2bdad931252c85b593024548b.zip | |
fix SimpleAi unit handling
Remove finished unit AIs.
Skip Units with only street actions left.
| -rw-r--r-- | go/game/ai.go | 10 |
1 files changed, 9 insertions, 1 deletions
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 { |
