Add support for up to 6 players.

This commit is contained in:
Greyson Parrelli
2026-07-28 07:36:09 -04:00
parent e542118175
commit a4f5f6910d
38 changed files with 2306 additions and 713 deletions
+12 -4
View File
@@ -33,8 +33,16 @@ func TestLobbyManualStart(t *testing.T) {
if _, err := g.AddPlayer("Bob"); err != nil {
t.Fatal(err)
}
if _, err := g.AddPlayer("Carol"); err == nil {
t.Fatal("third player should be rejected while MaxPlayers=2")
// An odd table can't pair off, so a third player has to be matched by a
// fourth (or removed) before the host can start.
if _, err := g.AddPlayer("Carol"); err != nil {
t.Fatal(err)
}
if err := g.StartGame(); err == nil {
t.Fatal("start should be rejected with an odd number of players")
}
if err := g.RemovePlayer(g.Players[2].ID); err != nil {
t.Fatal(err)
}
// The lobby stays open until the host explicitly starts.
if g.Phase != PhaseLobby {
@@ -503,11 +511,11 @@ func TestFullGameFlow(t *testing.T) {
if g.Phase != PhaseBattle {
t.Fatalf("expected battle after both arrange, got %s", g.Phase)
}
if g.Battle.WinnerSeat != p1.Seat {
if g.Battles[0].WinnerSeat != p1.Seat {
t.Fatalf("round %d: seat 0 should win", round)
}
// The winner hands the token to the loser; a loser keeps it.
if wantPriority == g.Battle.WinnerSeat {
if wantPriority == g.Battles[0].WinnerSeat {
wantPriority = (wantPriority + 1) % len(g.Players)
}
for _, p := range g.Players {