twenty-one/src/shared/game/gameActions.ts
2023-04-19 01:03:37 +02:00

37 lines
No EOL
599 B
TypeScript

import type { SpecialCardType } from "./cards"
type PlayerAction = {
initiatingPlayerId: string
} & (
| {
type: "draw"
}
| {
type: "stay"
}
| {
type: "use-special"
cardType: SpecialCardType
}
)
type ServerAction =
| {
type: "start"
numberCardsByPlayerId: Record<string, number[]> // if redacted: only contains the player themself
targetSum: number
}
| {
type: "deal-number"
toPlayerId: string
number: number
}
| {
type: "deal-special"
toPlayerId: string
cardType: SpecialCardType
}
export type GameAction = {
index: number
} & (PlayerAction | ServerAction)