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
+24 -6
View File
@@ -25,6 +25,7 @@ export interface PlayerView {
seat: number
coins: number
trophies: number
roundWins?: number[] // rounds this player won a battle in (public)
ready: boolean
connected: boolean
isBot?: boolean
@@ -100,15 +101,25 @@ export interface BattleEvent {
text?: string
}
// A round runs one battle per pairing, so a six-player round has three of
// these. Everything inside is indexed by *side* — 0 or 1 within this battle —
// rather than by seat at the table, including BattleEvent.seat/target. `seats`
// maps the two apart. winnerSeat is the exception: it's a real seat.
export interface BattleResult {
round: number
seats: number[] // the two seats fighting, first player first
stackSizes: number[]
lineups?: Card[][] // each seat's arranged deck (top first); public for peeking
lineups?: Card[][] // each side's arranged deck (top first); public for peeking
events: BattleEvent[] | null
winnerSeat: number
trophies: number
}
// sideOf maps a seat to its side index in a battle, or -1 if it wasn't in it.
export function sideOf(battle: BattleResult, seat: number): number {
return battle.seats?.indexOf(seat) ?? -1
}
export interface LogEntry {
seq: number
round: number
@@ -135,27 +146,34 @@ export interface GameView {
round: number
maxRounds: number
maxPets: number
pack: string
packs: PackInfo[]
packs: string[] // selected packs, shuffled together
packCatalog: PackInfo[] // the choices offered in the lobby
packsNeeded: number // packs the current table size requires
hostSeat: number
minPlayers: number
maxPlayers: number
playerCounts: number[] // table sizes a game can start at (2, 4, 6)
youSeat: number
turn: number
prioritySeat: number
shopRow: Card[]
deckCounts: number[]
players: PlayerView[]
matchups?: [number, number][] // this round's battle pairings (public)
yourOpponent: number // the seat you face this round, or -1
pending?: PendingTrade
pendingReveal?: PendingReveal
pendingSacrifice?: PendingSacrifice
battle?: BattleResult
winnerSeat: number
battle?: BattleResult // your own battle this round
battles?: BattleResult[] // every table's, all replayable
winnerSeat: number // outright winner, or -1 when shared
winnerSeats?: number[] // everyone holding the title
log?: LogEntry[]
debug?: boolean // server DEBUG mode: unlocks the buy-any-card panel
}
export type ClientMessage =
| { type: 'setPack'; pack: string }
| { type: 'setPacks'; packs: string[] }
| { type: 'addBot'; difficulty: string }
| { type: 'removePlayer'; target: string }
| { type: 'start' }