X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=variants%2FBario%2Fclass.js;h=6a44834a7623b3c58e90131c173edb24a8fb8695;hb=HEAD;hp=871a5377904ec0d02d9736c9fd81adeaabde78b6;hpb=74d30010ee6952632b8c6676c1fefb446c541707;p=xogo.git diff --git a/variants/Bario/class.js b/variants/Bario/class.js index 871a537..2dd64d6 100644 --- a/variants/Bario/class.js +++ b/variants/Bario/class.js @@ -6,7 +6,8 @@ export default class BarioRules extends ChessRules { static get Options() { return { - // TODO: Zen too? + select: C.Options.select, + input: C.Options.input, styles: [ "atomic", "cannibal", "capture", "cylinder", "dark", "madrasi", "rifle", "teleport" @@ -25,12 +26,7 @@ export default class BarioRules extends ChessRules { pieces(color, x, y) { return Object.assign( - { - 'u': { - "class": "undefined", - moves: [] - } - }, + { 'u': {"class": "undefined"} }, super.pieces(color, x, y) ); } @@ -113,6 +109,8 @@ export default class BarioRules extends ChessRules { case 0: if (typeof x == "string") moves = this.getDropMovesFrom([x, y]); + // Empty move: just start + end + moves.forEach(m => {m.vanish.pop(); m.appear.pop();}); break; case 1: // Both normal move (from defined piece) and definition allowed @@ -162,8 +160,10 @@ export default class BarioRules extends ChessRules { if (super.underCheck(square_s, oppCol)) return true; // Check potential specializations of undefined using reserve: + const inReserve = Object.keys(this.reserve[oppCol]) + .filter(k => this.reserve[oppCol][k] >= 1); const allAttacks = Array.prototype.concat.apply( - ['r', 'n', 'b', 'q'].map(p => this.pieces()[p].moves[0])); + inReserve.map(p => this.pieces()[p].both[0])); const [x, y] = square_s[0]; for (let i=0; i