From 65a72a3c6d46a8ac4287cd152846a4935fca8d6d Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 25 Mar 2024 18:30:26 +0100 Subject: fix trigger ordering for kraken AI always sending PassPriority --- go/game/state.go | 9 +++++++-- 1 file 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...) -- cgit v1.2.3