You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.6 KiB
62 lines
1.6 KiB
import {Character, CharacterId, CharacterSide, SPType} from "./Character";
|
|
|
|
export enum ClockMode {
|
|
HEROES_FILL = "heroes fill",
|
|
HEROES_EMPTY = "heroes empty",
|
|
}
|
|
|
|
export interface Clock {
|
|
readonly id: string
|
|
readonly text: string
|
|
readonly segments: number
|
|
readonly filled: number
|
|
readonly mode: ClockMode
|
|
}
|
|
|
|
export interface SessionState {
|
|
readonly usedSp: {readonly [key in SPType]?: number}
|
|
}
|
|
|
|
export interface ConflictState {
|
|
readonly round: number
|
|
readonly activeSide: CharacterSide
|
|
readonly activeCharacterId: string|null
|
|
readonly timers: readonly TimerState[]
|
|
}
|
|
|
|
export interface BaseTimerState {
|
|
readonly type: string
|
|
readonly id: string
|
|
readonly text: string
|
|
}
|
|
|
|
export interface CountupTimerState extends BaseTimerState {
|
|
readonly type: "up"
|
|
readonly timeStartAt: number
|
|
}
|
|
|
|
export interface CountdownTimerState extends BaseTimerState {
|
|
readonly type: "down"
|
|
readonly timeEndAt: number
|
|
readonly timeStartAt: number|null
|
|
}
|
|
|
|
export type TimerState = CountupTimerState|CountdownTimerState;
|
|
|
|
export interface GameState {
|
|
readonly session: SessionState
|
|
readonly conflict?: ConflictState
|
|
readonly clocks: readonly Clock[]
|
|
readonly characters: readonly Character[]
|
|
}
|
|
|
|
export interface PastState {
|
|
// The unix timestamp in ms when changing _away_ from this state.
|
|
readonly timestamp: number
|
|
readonly logMarkdown: string
|
|
readonly state: GameState
|
|
}
|
|
|
|
export function getCharacterById(state: GameState, id: CharacterId): Character|undefined {
|
|
return state.characters.find((character) => character.id === id)
|
|
} |