X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FRecycle.js;h=bf252632241c8ca04483a62cbb5511673b9c25aa;hb=bc0b9205e41c5db0552e4ccf060b945342e36ed0;hp=adaceb04c9aacd3336fb0386d34b3f6d711b5c16;hpb=0d5335de5c94d780e03ac0aa3279b731c69455cc;p=vchess.git diff --git a/client/src/variants/Recycle.js b/client/src/variants/Recycle.js index adaceb04..bf252632 100644 --- a/client/src/variants/Recycle.js +++ b/client/src/variants/Recycle.js @@ -144,12 +144,13 @@ export class RecycleRules extends ChessRules { } getAllValidMoves() { - let moves = super.getAllValidMoves(); + let moves = super.getAllPotentialMoves(); const color = this.turn; - for (let i = 0; i < V.RESERVE_PIECES.length; i++) + for (let i = 0; i < V.RESERVE_PIECES.length; i++) { moves = moves.concat( this.getReserveMoves([V.size.x + (color == "w" ? 0 : 1), i]) ); + } return this.filterValid(moves); } @@ -174,7 +175,8 @@ export class RecycleRules extends ChessRules { prePlay(move) { super.prePlay(move); - if (move.vanish.length == 2 && move.appear.length == 2) return; //skip castle + // Skip castle: + if (move.vanish.length == 2 && move.appear.length == 2) return; const color = this.turn; if (move.vanish.length == 0) this.reserve[color][move.appear[0].p]--; else if (move.vanish.length == 2 && move.vanish[1].c == color)