X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FTakenmake.js;h=d37edf6c658ab2de25e3d0fd9168079032988b6e;hb=89a6214b27561878670914a65902aa51682efe61;hp=72268636d7e5309907c1c2ffe3e8c353821488ac;hpb=1d92e1e913d216fa96c12a5dc810fe117c384196;p=vchess.git diff --git a/client/src/variants/Takenmake.js b/client/src/variants/Takenmake.js index 72268636..d37edf6c 100644 --- a/client/src/variants/Takenmake.js +++ b/client/src/variants/Takenmake.js @@ -2,6 +2,7 @@ import { ChessRules } from "@/base_rules"; import { randInt } from "@/utils/alea"; export class TakenmakeRules extends ChessRules { + setOtherVariables(fen) { super.setOtherVariables(fen); // Stack of "last move" only for intermediate captures @@ -12,17 +13,16 @@ export class TakenmakeRules extends ChessRules { const L = this.lastMoveEnd.length; if (!asA && !!this.lastMoveEnd[L-1]) { asA = this.lastMoveEnd[L-1].p; - if (x != this.lastMoveEnd[L-1].x || y != this.lastMoveEnd[L-1].y) { + if (x != this.lastMoveEnd[L-1].x || y != this.lastMoveEnd[L-1].y) // A capture was played: wrong square return []; - } } let moves = []; const piece = this.getPiece(x, y); switch (asA || piece) { case V.PAWN: if (!asA || piece == V.PAWN) - moves = this.getPotentialPawnMoves([x, y]); + moves = super.getPotentialPawnMoves([x, y]); else { // Special case: we don't want promotion, since just moving like // a pawn, but I'm in fact not a pawn :) @@ -131,7 +131,7 @@ export class TakenmakeRules extends ChessRules { this.kingPos[c][0] = move.appear[0].x; this.kingPos[c][1] = move.appear[0].y; } - super.updateCastleFlags(move, piece); + super.updateCastleFlags(move, piece, c); } undo(move) { @@ -197,4 +197,5 @@ export class TakenmakeRules extends ChessRules { delete moves[mIdx]["next"]; return [moves[mIdx], move2]; } + };