X-Git-Url: https://git.auder.net/?a=blobdiff_plain;ds=sidebyside;f=variants%2FBario%2Fclass.js;h=1874383224ff4c6d60ec529ff5e8cd9432346b73;hb=8d19ea48d57c7d97dd1c6f5b6d4c3132cbf2075c;hp=01cb3d7f8ed33f44c54047ad76893a19b5a15eab;hpb=0e466aac11288f35b34d744b2652c7b4e9df2e24;p=xogo.git diff --git a/variants/Bario/class.js b/variants/Bario/class.js index 01cb3d7..1874383 100644 --- a/variants/Bario/class.js +++ b/variants/Bario/class.js @@ -26,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) ); } @@ -165,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