hathora-et-labora-game
Version:
Plays Uwe Rosenberg's Ora et Labora for the Hathora engine. It reduces a list of moves into a board game state.
21 lines • 833 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 shipyard = (param = '') => {
var _a;
const iterations = ((_a = parseResourceParam(param).wood) !== null && _a !== void 0 ? _a : 0) / 2;
return withActivePlayer(pipe(
//
payCost({ wood: iterations * 2 }), getCost({ ornament: iterations, nickel: iterations })));
};
export const complete = curry((partial, state) => match(partial)
.with([], () => {
const { wood = 0 } = view(activeLens(state), state);
if (wood >= 2)
return ['WoWo', ''];
return [''];
})
.with([P._], always(['']))
.otherwise(always([])));
//# sourceMappingURL=shipyard.js.map