X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FJoker.js;fp=client%2Fsrc%2Fvariants%2FJoker.js;h=a3cbdad550086a52a10a20c4146d105ab869e312;hp=bc3a7f1bf82e3192e28145e16910566d3f534ecc;hb=4c3031a52a1b95ad8002a3f055d4475130297a7b;hpb=a550511adb077ee08686934f67c64b0832d2bb36 diff --git a/client/src/variants/Joker.js b/client/src/variants/Joker.js index bc3a7f1b..a3cbdad5 100644 --- a/client/src/variants/Joker.js +++ b/client/src/variants/Joker.js @@ -58,18 +58,21 @@ export class JokerRules extends ChessRules { // Following test is OK because only one Joker on board at a time if (this.board[i][j] != V.EMPTY && this.getColor(i, j) == c) { const p = this.getPiece(i, j); - swapping.push( - new Move({ - vanish: [ - new PiPo({ x: x, y: y, c: c, p: V.JOKER }), - new PiPo({ x: i, y: j, c: c, p: p }) - ], - appear: [ - new PiPo({ x: i, y: j, c: c, p: V.JOKER }), - new PiPo({ x: x, y: y, c: c, p: p }) - ] - }) - ); + const lastRank = (c == 'w' ? 0 : 7); + if (p != V.KING && (p != V.PAWN || x != lastRank)) { + swapping.push( + new Move({ + vanish: [ + new PiPo({ x: x, y: y, c: c, p: V.JOKER }), + new PiPo({ x: i, y: j, c: c, p: p }) + ], + appear: [ + new PiPo({ x: i, y: j, c: c, p: V.JOKER }), + new PiPo({ x: x, y: y, c: c, p: p }) + ] + }) + ); + } } } }