diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2024-03-25 18:30:26 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:55 +0100 |
| commit | 65a72a3c6d46a8ac4287cd152846a4935fca8d6d (patch) | |
| tree | 95d404eb438d161e23452021f016902c817a4c47 | |
| parent | d821bafbfdf6a67531f7aef13221c1846220f1ee (diff) | |
| download | muhqs-game-65a72a3c6d46a8ac4287cd152846a4935fca8d6d.tar.gz muhqs-game-65a72a3c6d46a8ac4287cd152846a4935fca8d6d.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...) |
