X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FCheckered2.js;h=997c1c7aed1b5cc6adc8df2cf654a66264142a43;hb=d807470f965d4d60a7fe6e1320ac7dfd3f0ea03f;hp=db288766e2085fa4d0e764ecddee58cff3b68caf;hpb=af34341d92d47d14f396e7f4adb81f2a7e9d9a61;p=vchess.git diff --git a/client/src/variants/Checkered2.js b/client/src/variants/Checkered2.js index db288766..997c1c7a 100644 --- a/client/src/variants/Checkered2.js +++ b/client/src/variants/Checkered2.js @@ -1,6 +1,7 @@ import { ChessRules, Move, PiPo } from "@/base_rules"; export class Checkered2Rules extends ChessRules { + static board2fen(b) { const checkered_codes = { p: "s", @@ -350,8 +351,13 @@ export class Checkered2Rules extends ChessRules { postPlay(move) { super.postPlay(move); // Does this move turn off a 2-squares pawn flag? - if ([1, 6].includes(move.start.x) && move.vanish[0].p == V.PAWN) + if ( + [1, 6].includes(move.start.x) && + move.vanish[0].p == V.PAWN && + Math.abs(move.end.x - move.start.x) == 2 + ) { this.pawnFlags[move.start.x == 6 ? "w" : "b"][move.start.y] = false; + } this.cmoves.push(this.getCmove(move)); } @@ -462,4 +468,5 @@ export class Checkered2Rules extends ChessRules { notation += "=" + move.appear[0].p.toUpperCase(); return notation; } + };