X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FBario.js;h=f344d3a2d58baea8765c1005c99586634f10ec01;hb=c4244fcb06fd281722b57acd499c433150970e47;hp=21965e16b01168f8ada0149c0f017ddffcd95a51;hpb=d2af3400944331ffd0c770f83857257c2f48e487;p=vchess.git diff --git a/client/src/variants/Bario.js b/client/src/variants/Bario.js index 21965e16..f344d3a2 100644 --- a/client/src/variants/Bario.js +++ b/client/src/variants/Bario.js @@ -35,7 +35,7 @@ export class BarioRules extends ChessRules { ); } - hoverHighlight(x, y) { + hoverHighlight([x, y]) { const c = this.turn; return ( this.movesCount <= 1 && @@ -262,7 +262,6 @@ export class BarioRules extends ChessRules { const color = this.turn; if (this.movesCount <= 1) { // Just put the king on the board - let moves = []; const firstRank = (color == 'w' ? 7 : 0); return [...Array(8)].map((x, j) => { return new Move({ @@ -293,6 +292,7 @@ export class BarioRules extends ChessRules { } filterValid(moves) { + if (this.movesCount <= 1) return moves; const color = this.turn; return moves.filter(m => { if (m.vanish.length == 0) return true; @@ -519,7 +519,7 @@ export class BarioRules extends ChessRules { this.movesCount--; this.postUndo(move); }; - if (this.movesCount <= 2) toPrevPlayer(); + if (this.movesCount <= 2 && move.appear[0].p == V.KING) toPrevPlayer(); else if (move.vanish.length == 0) { this.reserve[this.turn][move.start.p]++; this.subTurn = move.turn[1];