X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FWildebeest.js;h=93353f9e01e8875643aa02b863d07a0bdbcb7ab7;hp=a49da9b2a239c050b153ccd39896087cec1aefd0;hb=278a28a16bfee8c64746e2ec1423259009bff886;hpb=27ebf6afe4671ce23758724d308b2f9cf2b5b815 diff --git a/client/src/variants/Wildebeest.js b/client/src/variants/Wildebeest.js index a49da9b2..93353f9e 100644 --- a/client/src/variants/Wildebeest.js +++ b/client/src/variants/Wildebeest.js @@ -112,10 +112,12 @@ export class WildebeestRules extends ChessRules { const [sizeX, sizeY] = [V.size.x, V.size.y]; const shiftX = color == "w" ? -1 : 1; const startRanks = color == "w" ? [sizeX - 2, sizeX - 3] : [1, 2]; - const lastRank = color == "w" ? 0 : sizeX - 1; - const finalPieces = x + shiftX == lastRank - ? [V.WILDEBEEST, V.QUEEN] - : [V.PAWN]; + const lastRanks = color == "w" ? [0, 1] : [sizeX - 1, sizeX -2]; + let finalPieces = [V.PAWN]; + if (x + shiftX == lastRanks[1]) + Array.prototype.push.apply(finalPieces, [V.WILDEBEEST, V.QUEEN]); + else if (x + shiftX == lastRanks[0]) + finalPieces = [V.WILDEBEEST, V.QUEEN]; if (this.board[x + shiftX][y] == V.EMPTY) { // One square forward