UNPKG

hathora-et-labora-game

Version:

Game logic reducer for Uwe Rosenberg's Ora et Labora

21 lines 791 B
import { always, curry } from 'ramda'; import { P, match } from 'ts-pattern'; import { getCost, withActivePlayer } from '../board/player'; import { parseResourceParam } from '../board/resource'; export const sacredSite = (param = '') => { const { grain = 0, malt = 0, beer = 0, whiskey = 0 } = parseResourceParam(param); return withActivePlayer( // getCost({ grain: grain && !malt ? 2 : 0, malt: malt && !grain ? 2 : 0, beer: beer && !whiskey ? 1 : 0, whiskey: whiskey && !beer ? 1 : 0, book: 1, })); }; export const complete = curry((partial, state) => match(partial) .with([], always(['GnGnBe', 'GnGnWh', 'MaMaBe', 'MaMaWh'])) .with([P._], always([''])) .otherwise(always([]))); //# sourceMappingURL=sacredSite.js.map