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.

17 lines 729 B
import { always, curry, identity, pipe, view } from 'ramda'; import { P, match } from 'ts-pattern'; import { activeLens, getCost, payCost, withActivePlayer } from '../board/player'; import { costMoney, parseResourceParam } from '../board/resource'; export const grainStorage = (param = '') => { const input = parseResourceParam(param); if (costMoney(input) < 1) return identity; return withActivePlayer(pipe( // payCost(input), getCost({ grain: 6 }))); }; export const complete = curry((partial, state) => match(partial) .with([], () => (view(activeLens(state), state).penny ? ['Pn', ''] : [''])) .with([P._], always([''])) .otherwise(always([]))); //# sourceMappingURL=grainStorage.js.map