UNPKG

hathora-et-labora-game

Version:

Game logic reducer for Uwe Rosenberg's Ora et Labora

20 lines (17 loc) 443 B
import { GameStatusEnum, StateReducer } from '../types' export const removeWonder: StateReducer = (state) => { if (state === undefined) return state const wonders = state.wonders ?? 0 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, } }