UNPKG

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.

14 lines 807 B
import { any, filter, map } from 'ramda'; import { clergyForColor, isLayBrother, isPrior, priors, withEachPlayer } from '../player'; import { tileWithoutClergy } from '../tile'; export const allPriorsComeBack = (state) => withEachPlayer((player) => { if (state === undefined) return undefined; // short circuit if player already has unplaced prior if (any(isPrior, player.clergy)) return player; const prior = filter(isPrior, clergyForColor(state.config)(player.color))[0]; const landscapeWithoutClergy = map(map(tileWithoutClergy(priors(state))))(player.landscape); return Object.assign(Object.assign({}, player), { clergy: [...player.clergy.filter(isLayBrother), prior], landscape: landscapeWithoutClergy }); })(state); //# sourceMappingURL=allPriorsComeBack.js.map