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.
14 lines (11 loc) • 533 B
text/typescript
import { lensPath, set } from 'ramda'
import { GameCommandEnum, GameStatePlaying, StateReducer } from '../../types'
const frameBonusActions = lensPath(['frame', 'bonusActions'])
export const checkSoloSettlementReady: StateReducer = (state) =>
state &&
// if we start the frame with buildings, only allow building them, otherwise only allow settle (or commit)
set<GameStatePlaying, GameCommandEnum[]>(
frameBonusActions,
state.buildings.length !== 0 ? [GameCommandEnum.BUILD] : [GameCommandEnum.SETTLE],
state
)