hathora-et-labora-game
Version:
Game logic reducer for Uwe Rosenberg's Ora et Labora
27 lines • 866 B
JavaScript
import { always, curry, identity, pipe, view } from 'ramda';
import { P, match } from 'ts-pattern';
import { activeLens, getCost, payCost, withActivePlayer } from '../board/player';
import { parseResourceParam } from '../board/resource';
export const portico = (param = '') => {
const { reliquary = 0 } = parseResourceParam(param);
if (reliquary < 1)
return identity;
return withActivePlayer(pipe(payCost({ reliquary }), getCost({
stone: 2,
clay: 2,
wood: 2,
peat: 2,
penny: 2,
grain: 2,
sheep: 2,
})));
};
export const complete = curry((partial, state) => match(partial)
.with([], () => {
if (view(activeLens(state), state).reliquary)
return ['Rq', ''];
return [''];
})
.with([P._], always(['']))
.otherwise(always([])));
//# sourceMappingURL=portico.js.map