X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FRampage.js;h=79b8b956461e7cc764186676b704819eb5ac3d4e;hp=2fe96db65d3e534b4b472cf8f80d9dbf2bea0ba9;hb=0b8bd1214d662f6b1964f0807eda114ed1cac3c4;hpb=ff8100f795dc70eeb67120fd34573d9e62dc9d8f diff --git a/client/src/variants/Rampage.js b/client/src/variants/Rampage.js index 2fe96db6..79b8b956 100644 --- a/client/src/variants/Rampage.js +++ b/client/src/variants/Rampage.js @@ -62,13 +62,19 @@ export class RampageRules extends ChessRules { return moves; // Remember current final squares to not add moves twice: const destinations = {}; + const lastRank = (color == 'w' ? 0 : 7); + const piece = this.getPiece(x, y); moves.forEach(m => destinations[m.end.x + "_" + m.end.y] = true); for (let i=0; i<8; i++) { for (let j=0; j<8; j++) { if (this.board[i][j] == V.EMPTY && !destinations[i + "_" + j]) { const sa = this.sumAttacks([i, j]); - if ((color == 'w' && sa > 0) || (color == 'b' && sa < 0)) + if ( + ((color == 'w' && sa > 0) || (color == 'b' && sa < 0)) && + (piece != V.PAWN || i != lastRank) + ) { moves.push(this.getBasicMove([x, y], [i, j])); + } } } }