UNPKG

hathora-et-labora-game

Version:

Game logic reducer for Uwe Rosenberg's Ora et Labora

23 lines 823 B
import { always, curry, identity, pipe, view } from 'ramda'; import { P, match } from 'ts-pattern'; import { allOccupiedBuildingsUsable } from '../board/frame'; import { activeLens, payCost, withActivePlayer } from '../board/player'; import { parseResourceParam } from '../board/resource'; export const palace = (input = '') => { const { wine = 0 } = parseResourceParam(input); if (wine === 0) return identity; return pipe( // withActivePlayer(payCost({ wine })), allOccupiedBuildingsUsable); }; export const complete = curry((partial, state) => match(partial) .with([], () => { const { wine = 0 } = view(activeLens(state), state); if (wine) return ['Wn', '']; return ['']; }) .with([P._], always([''])) .otherwise(always([]))); //# sourceMappingURL=palace.js.map