From: Benjamin Auder Date: Sun, 25 Apr 2021 07:32:33 +0000 (+0200) Subject: Fix Synochess X-Git-Url: https://git.auder.net/variants/Baroque/current/css/index.css?a=commitdiff_plain;h=a550511adb077ee08686934f67c64b0832d2bb36;p=vchess.git Fix Synochess --- diff --git a/client/src/variants/Synochess.js b/client/src/variants/Synochess.js index 74eecace..aa758760 100644 --- a/client/src/variants/Synochess.js +++ b/client/src/variants/Synochess.js @@ -475,7 +475,7 @@ export class SynochessRules extends ChessRules { updateCastleFlags(move, piece) { // Only white can castle: - const firstRank = 0; + const firstRank = 7; if (piece == V.KING && move.appear[0].c == 'w') this.castleFlags['w'] = [8, 8]; else if ( @@ -495,18 +495,19 @@ export class SynochessRules extends ChessRules { } postPlay(move) { - super.postPlay(move); // After black move, turn == 'w': - if (!!this.reserve && this.turn == 'w' && move.vanish.length == 0) + if (!!this.reserve && this.turn == 'w' && move.vanish.length == 0) { if (--this.reserve['b'][V.SOLDIER] == 0) this.reserve = null; + } + else super.postPlay(move); } postUndo(move) { - super.postUndo(move); if (this.turn == 'b' && move.vanish.length == 0) { if (!this.reserve) this.reserve = { 'b': { [V.SOLDIER]: 1 } }; else this.reserve['b'][V.SOLDIER]++; } + else super.postUndo(move); } static get VALUES() { @@ -533,4 +534,9 @@ export class SynochessRules extends ChessRules { return evaluation; } + getNotation(move) { + if (move.vanish.length == 0) return "@" + V.CoordsToSquare(move.end); + return super.getNotation(move); + } + };