UNPKG

hathora-et-labora-game

Version:

Plays Uwe Rosenberg's Ora et Labora for the Hathora engine. It reduces a list of moves into a board game state.

20 lines (17 loc) 434 B
import { GameStatusEnum, StateReducer } from '../types' export const removeWonder: StateReducer = (state) => { if (state === undefined) return state const { wonders } = state if (wonders === 0) return undefined return { ...state, wonders: wonders - 1, } } export const gameEnd: StateReducer = (state) => { if (state === undefined) return state return { ...state, status: GameStatusEnum.FINISHED, } }