hathora-et-labora-game
Version:
Game logic reducer for Uwe Rosenberg's Ora et Labora
22 lines • 800 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 townEstate = (param = '') => {
const { ceramic = 0 } = parseResourceParam(param);
if (ceramic === 0)
return identity;
return withActivePlayer(pipe(
//
payCost({ ceramic }), getCost({ nickel: 2, penny: 2 })));
};
export const complete = curry((partial, state) => match(partial)
.with([], () => {
const { ceramic = 0 } = view(activeLens(state), state);
if (ceramic)
return ['Ce', ''];
return [''];
})
.with([P._], always(['']))
.otherwise(always([])));
//# sourceMappingURL=townEstate.js.map