hathora-et-labora-game
Version:
Game logic reducer for Uwe Rosenberg's Ora et Labora
23 lines • 846 B
JavaScript
import { always, curry, identity, pipe, view } from 'ramda';
import { P, match } from 'ts-pattern';
import { allOccupiedBuildingsUsable } from '../board/frame';
import { activeLens, payCost, withActivePlayer } from '../board/player';
import { parseResourceParam } from '../board/resource';
export const grandManor = (input = '') => {
const { whiskey = 0 } = parseResourceParam(input);
if (whiskey === 0)
return identity;
return pipe(
//
withActivePlayer(payCost({ whiskey })), allOccupiedBuildingsUsable);
};
export const complete = curry((partial, state) => match(partial)
.with([], () => {
const { whiskey = 0 } = view(activeLens(state), state);
if (whiskey)
return ['Wh', ''];
return [''];
})
.with([P._], always(['']))
.otherwise(always([])));
//# sourceMappingURL=grandManor.js.map