aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2024-03-25 18:30:26 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:10 +0200
commite4a4b0b22da7bdf6e5a7033b9b02c57204c010cf (patch)
treea4b919543881c37a4fc34679c18ec64666ad2bb1
parenta635c5a045ec0ea74993f5de877e8a2010009156 (diff)
downloadmuhqs-game-e4a4b0b22da7bdf6e5a7033b9b02c57204c010cf.tar.gz
muhqs-game-e4a4b0b22da7bdf6e5a7033b9b02c57204c010cf.zip
fix trigger ordering for kraken AI always sending PassPriority
-rw-r--r--go/game/state.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/go/game/state.go b/go/game/state.go
index 6c1182d2..021d88ab 100644
--- a/go/game/state.go
+++ b/go/game/state.go
@@ -387,12 +387,17 @@ func (s *State) orderTriggeredActions(triggeredActions []*TriggeredAction) []Act
p := s.Players[(i+s.ActivePlayer.Id-1)%nPlayers]
actions := playerActions[p]
+ pActions := make([]Action, 0, len(actions))
p.Ctrl.SendNotification(newDeclareTriggeredActionsPrompt(actions))
switch a := p.Ctrl.RecvAction().(type) {
case *DeclareTriggeredActionsAction:
- pActions := make([]Action, 0, len(a.actions))
- for _, a := range a.actions {
+ for _, a := range a.actions { // Use the order passed back by the user
+ pActions = append(pActions, a)
+ }
+ orderedActions = append(orderedActions, pActions...)
+ case *PassPriority: // Support kraken AI always sending PassPriority
+ for _, a := range actions { // Simply use the order the actions were triggered
pActions = append(pActions, a)
}
orderedActions = append(orderedActions, pActions...)