declare const brand: unique symbol; // branded typing export type Brand = T & { [brand]: TBrand; }; export type Player = Brand; export type CardId = Brand; export type FactionId = 'a' | 'c' | 'm'; export type FrontId = 'a' | 'm' | 'n' | 's'; export interface Front { value: number; contributions: FactionId[]; status: 'Victory' | 'Defeat' | null; } export interface Game { // TODO: why is this needed? [index: number]: any; // RTT active: Player | 'None' | null; log: string[]; seed: number; state: string | null; undo: Game[]; result?: string; victory?: string; // Game specific active_abilities: number[]; turn: number; year: number; bag_of_glory: FactionId[]; blank_markers: number[][]; bonuses: number[]; current_events: CardId[]; discard: Record; engine: EngineNode[]; /** * Set to faction whos turn it is or null if not player turn * Used to determine who can spend Hero Points. Could be the case * a player becomes active in another players turn. */ faction_turn: FactionId | null; fronts: { a: Front; m: Front; n: Front; s: Front; }; glory: FactionId[]; hands: Record; hero_points: Record; initiative: FactionId; medallions: Record & { pool: Array }; played_card: CardId | null; selected_cards: Record; selectable_cards: CardId[]; // used for specific events tableaus: Record; /** * Used for event effect that allows Anarchist to put an event * card on top of the deck */ top_of_events_deck: CardId | null; tracks: number[]; trash: Record; triggered_track_effects: number[]; used_medallions: number[]; } export interface View { engine: Game['engine']; log: number | string[]; active?: string | null; prompt: string | null; actions?: any; victory?: string; selected_cards: CardId[]; bag_of_glory: Game['bag_of_glory']; bonuses: Game['bonuses']; current_events: CardId[]; fronts: Game['fronts']; glory: Game['glory']; hand: CardId[]; hero_points: Game['hero_points']; initiative: Game['initiative']; medallions: Game['medallions']; played_card: Game['played_card']; selectable_cards: Game['selectable_cards']; tableaus: Game['tableaus']; tracks: number[]; triggered_track_effects: Game['triggered_track_effects']; undo: Game['undo']; used_medallions: Game['used_medallions']; year: number; } export type States = { [key: string]: any; }; export type EngineNode = FunctionNode | LeafNode | SeqNode; export interface FunctionNode { t: 'f'; f: string; // function to be triggered a?: any; // args r?: 0 | 1; // 1 if resolved } export interface SeqNode { t: 's'; // Type c: EngineNode[]; } export interface LeafNode { t: 'l'; s: string; // State p: FactionId | 'None'; // Player a?: any; // args r?: 0 | 1; // 1 if resolved } export interface CardBase { id: number; title: string; } export type Card = EventCard | PlayerCard; export interface EventCard extends CardBase { type: 'ec'; year: number; effects: Effect[]; test: { front: FrontId; value: number; pass: Effect; fail: Effect; }; } export type Icon = | 'add_to_front' | 'collectivization' | 'd_collectivization' | 'd_foreign_aid' | 'd_government' | 'd_liberty' | 'd_soviet_support' | 'draw_card' | 'foreign_aid' | 'government' | 'government_to_center' | 'liberty' | 'soviet_support' | 'teamwork_on'; export interface PlayerCard extends CardBase { type: 'pc'; strength: number; effects: Effect[]; icons: Icon[]; } export interface Effect { type: | 'attack' | 'track' | 'bonus' | 'hero_points' | 'front' | 'function' // Use for unqique effects | 'medallion' | 'draw_card' | 'play_card' | 'swap_card_tableau_hand' | 'state' | 'add_card_to_tableau' | 'remove_blank_marker' | 'return_card' | 'take_hero_points'; target: string | number | FactionId; value: number; faction?: FactionId | 'i'; } export interface StaticData { cards: Card[]; fronts: Array<{ id: string; name: string; left: number; top: number; }>; medallions: Array<{ id: number; name: string; }>; tracks: Array<{ id: number; name: string; triggers: Array; }>; }