@hanabi-live/game
    Preparing search index...

    Function toGameAction

    • Converts a game event into the action that the game state applies.

      Parameters

      • event:
            | Readonly<
                {
                    identity?: Readonly<
                        { rank: 1
                        | 2
                        | 3
                        | 4
                        | 5
                        | 7; suitIndex: 0 | 1 | 2 | 3 | 4 | 5 },
                    >;
                    order: number & $brand<"CardOrder">;
                    playerIndex: 0 | 1 | 2 | 3 | 4;
                    type: "draw";
                },
            >
            | Readonly<
                {
                    identity?: Readonly<
                        { rank: 1
                        | 2
                        | 3
                        | 4
                        | 5
                        | 7; suitIndex: 0 | 1 | 2 | 3 | 4 | 5 },
                    >;
                    order: number & $brand<"CardOrder">;
                    playerIndex: 0 | 1 | 2 | 3 | 4;
                    type: "play";
                },
            >
            | Readonly<
                {
                    identity?: Readonly<
                        { rank: 1
                        | 2
                        | 3
                        | 4
                        | 5
                        | 7; suitIndex: 0 | 1 | 2 | 3 | 4 | 5 },
                    >;
                    order: number & $brand<"CardOrder">;
                    playerIndex: 0 | 1 | 2 | 3 | 4;
                    type: "discard";
                },
            >
            | Readonly<
                {
                    identity?: Readonly<
                        { rank: 1
                        | 2
                        | 3
                        | 4
                        | 5
                        | 7; suitIndex: 0 | 1 | 2 | 3 | 4 | 5 },
                    >;
                    order: number & $brand<"CardOrder">;
                    playerIndex: 0 | 1 | 2 | 3 | 4;
                    type: "misplay";
                },
            >
            | Readonly<
                {
                    clue?: | Readonly<{ color?: 0 | 2 | 5 | 1 | 3 | 4; type: "color" }>
                    | Readonly<{ rank?: 2 | 5 | 1 | 3 | 4; type: "rank" }>;
                    ignoreNegative?: boolean;
                    orders: readonly (number & $brand<"CardOrder">)[];
                    playerIndex: 0 | 1 | 2 | 3 | 4;
                    receiverIndex: 0 | 1 | 2 | 3 | 4;
                    type: "clue";
                },
            >
            | Readonly<
                { currentPlayerIndex?: 0
                | 2
                | 1
                | 3
                | 4; turn: number; type: "turn" },
            >
            | Readonly<
                {
                    endCondition: | "normal"
                    | "strikeout"
                    | "timeout"
                    | "terminatedByPlayer"
                    | "idleTimeout"
                    | "allOrNothingFail"
                    | "allOrNothingSoftlock"
                    | "terminatedByVote";
                    playerIndex?: 0
                    | 2
                    | 1
                    | 3
                    | 4;
                    type: "gameOver";
                    voters: readonly (0 | 1 | 2 | 3 | 4)[];
                },
            >
            | Readonly<
                {
                    durationMs: number;
                    playerTimesMs: readonly number[];
                    type: "playerTimes";
                },
            >

      Returns GameAction