hathora-et-labora-game
Version:
Game logic reducer for Uwe Rosenberg's Ora et Labora
16 lines • 685 B
JavaScript
import { always, curry, 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 malthouse = (param = '') => {
const { grain = 0 } = parseResourceParam(param);
return withActivePlayer(pipe(payCost({ grain }), getCost({
malt: grain,
straw: grain,
})));
};
export const complete = curry((partial, state) => match(partial)
.with([], () => (view(activeLens(state), state).grain ? ['Gn', ''] : ['']))
.with([P._], always(['']))
.otherwise(always([])));
//# sourceMappingURL=malthouse.js.map