X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FSwap.js;h=4d97ae934fbe4e1cf913fc9e11d15cba1aff3045;hb=1349f848f772a0fc41efd3648bf065b7172315e7;hp=bf4e78715c000b9b0992733db0859edab0c89efb;hpb=964eda04ad6415b4ec95387ea08b63a3d0f0f9cc;p=vchess.git diff --git a/client/src/variants/Swap.js b/client/src/variants/Swap.js index bf4e7871..4d97ae93 100644 --- a/client/src/variants/Swap.js +++ b/client/src/variants/Swap.js @@ -34,7 +34,7 @@ export class SwapRules extends ChessRules { } getPPpath(m) { - if (m.vanish.length == 1) return super.getPPpath(m); + if (m.appear.length == 1) return super.getPPpath(m); // Swap promotion: return m.appear[1].c + m.appear[1].p; } @@ -71,7 +71,7 @@ export class SwapRules extends ChessRules { const color = this.turn; const piece = this.getPiece(x, y); const addSmoves = (i, j) => { - if (this.getPiece(i, j) != piece) + if (this.getPiece(i, j) != piece || this.getColor(i, j) != color) Array.prototype.push.apply(moves, this.getSwapMoves([x, y], [i, j])); }; switch (piece) {