X-Git-Url: https://git.auder.net/js/rpsls.js?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FBerolina.js;h=0765d4b9ecd670bf25fbc78e42762a0e8f85a2af;hb=fe9ba5a032da752af31c079115c2d264a956a594;hp=8473b13ef2e18757105e9a082a24c3c4e824f538;hpb=6e47d367d4b1b4500bc46d65b44c5e55b52221bb;p=vchess.git diff --git a/client/src/variants/Berolina.js b/client/src/variants/Berolina.js index 8473b13e..0765d4b9 100644 --- a/client/src/variants/Berolina.js +++ b/client/src/variants/Berolina.js @@ -1,6 +1,7 @@ import { ChessRules } from "@/base_rules"; export class BerolinaRules extends ChessRules { + // En-passant after 2-sq jump getEpSquare(moveOrSquare) { if (!moveOrSquare) return undefined; @@ -129,15 +130,11 @@ export class BerolinaRules extends ChessRules { isAttackedByPawn([x, y], color) { let pawnShift = (color == "w" ? 1 : -1); - if (x + pawnShift >= 0 && x + pawnShift < V.size.x) { - if ( - this.getPiece(x + pawnShift, y) == V.PAWN && - this.getColor(x + pawnShift, y) == color - ) { - return true; - } - } - return false; + return ( + x + pawnShift >= 0 && x + pawnShift < V.size.x && + this.getPiece(x + pawnShift, y) == V.PAWN && + this.getColor(x + pawnShift, y) == color + ); } static get SEARCH_DEPTH() { @@ -165,4 +162,5 @@ export class BerolinaRules extends ChessRules { } return super.getNotation(move); //all other pieces are orthodox } + };