diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2024-03-25 18:30:26 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:57:10 +0200 |
| commit | e4a4b0b22da7bdf6e5a7033b9b02c57204c010cf (patch) | |
| tree | a4b919543881c37a4fc34679c18ec64666ad2bb1 | |
| parent | a635c5a045ec0ea74993f5de877e8a2010009156 (diff) | |
| download | muhqs-game-e4a4b0b22da7bdf6e5a7033b9b02c57204c010cf.tar.gz muhqs-game-e4a4b0b22da7bdf6e5a7033b9b02c57204c010cf.zip | |
fix trigger ordering for kraken AI always sending PassPriority
| -rw-r--r-- | go/game/state.go | 9 |
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...) |
