X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fvariants%2FZen.js;h=6a568db926c5ca2617d61c8070ead4b97b3160b8;hb=b955c65b942d09d24b5c3bed0d755d4f2f8f71f1;hp=66cd61f4678495d09d2dd4b25ae112f9ed2d04b6;hpb=fb6ceeff17b53ab049e14d2bee7a61de92ca4762;p=vchess.git diff --git a/public/javascripts/variants/Zen.js b/public/javascripts/variants/Zen.js index 66cd61f4..6a568db9 100644 --- a/public/javascripts/variants/Zen.js +++ b/public/javascripts/variants/Zen.js @@ -52,7 +52,7 @@ class ZenRules extends ChessRules i += step[0]; j += step[1]; } - if (V.OnBoard(i,j) && this.getColor(i,j) == this.getOppCol(color) + if (V.OnBoard(i,j) && this.getColor(i,j) == V.GetOppCol(color) && this.getPiece(i,j) == asA) { // eat! @@ -97,7 +97,7 @@ class ZenRules extends ChessRules const firstRank = (color == 'w' ? sizeY-1 : 0); const lastRank = (color == "w" ? 0 : sizeY-1); - if (x+shift >= 0 && x+shift < sizeX && x+shift != lastRank) + if (x+shift != lastRank) { // Normal moves if (this.board[x+shift][y] == V.EMPTY) @@ -111,9 +111,8 @@ class ZenRules extends ChessRules } } - if (x+shift == lastRank) + else //promotion { - // Promotion let promotionPieces = [V.ROOK,V.KNIGHT,V.BISHOP,V.QUEEN]; promotionPieces.forEach(p => { // Normal move @@ -226,5 +225,3 @@ class ZenRules extends ChessRules } } } - -const VariantRules = ZenRules;