UNPKG

@gamepark/rules-api

Version:

API to implement the rules of a board game

18 lines (17 loc) 1.07 kB
import { Action } from '../Action'; import { HiddenInformation } from '../HiddenInformation'; import { Rules } from '../Rules'; export type ActionWithViews<Move = any, MoveView = Move, PlayerId = any> = { action: Action<Move, PlayerId>; views: ActionView<MoveView, PlayerId>[]; }; export type ActionView<MoveView = any, PlayerId = any> = { recipient?: PlayerId; action: Action<MoveView, PlayerId>; }; export declare function playActionWithViews<Game, View, Move, MoveView, PlayerId>(rules: Rules<Game, Move, PlayerId> & HiddenInformation<View, Move, MoveView>, move: Move, playerId: PlayerId, recipients: PlayerId[], id?: string): ActionWithViews<Move, MoveView, PlayerId>; export declare function getMoveView<GameView, Move, MoveView, PlayerId>(rules: Rules<any, Move, PlayerId>, move: Move, playerId?: PlayerId): MoveView; export type SecretAction<Move = any, MoveView = Move, PlayerId = any> = Action<Move, PlayerId> & { secrets: ActionView<MoveView, PlayerId>[]; }; export declare function isSecretAction(action: Action): action is SecretAction;