X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FSynchrone.js;h=c8f2be575e97d392f93f8374ca885a59f6c920bd;hb=af34341d92d47d14f396e7f4adb81f2a7e9d9a61;hp=1af9379fe284879f0f6ecb0eab59c298187a5689;hpb=515ae62f54a6b60c5932cb928fdc55a1d9ebad8b;p=vchess.git diff --git a/client/src/variants/Synchrone.js b/client/src/variants/Synchrone.js index 1af9379f..c8f2be57 100644 --- a/client/src/variants/Synchrone.js +++ b/client/src/variants/Synchrone.js @@ -3,7 +3,7 @@ import { randInt } from "@/utils/alea"; export class SynchroneRules extends ChessRules { static get CanAnalyze() { - return true; //false; + return false; } static get ShowMoves() { @@ -107,11 +107,11 @@ export class SynchroneRules extends ChessRules { } getPossibleMovesFrom([x, y]) { - return ( - this.filterValid(super.getPotentialMovesFrom([x, y])) - // Augment with potential recaptures: - .concat(this.getRecaptures([x, y])) - ); + let moves = this.filterValid(super.getPotentialMovesFrom([x, y])); + if (!this.underCheck(this.getColor(x, y))) + // Augment with potential recaptures, except if we are under check + Array.prototype.push.apply(moves, this.getRecaptures([x, y])); + return moves; } // Aux function used to find opponent and self captures @@ -433,7 +433,8 @@ export class SynchroneRules extends ChessRules { } else this.whiteMove = move.whiteMove; } - getCheckSquares(color) { + getCheckSquares() { + const color = this.turn; if (color == 'b') { // kingPos must be reset for appropriate highlighting: var lastMove = JSON.parse(JSON.stringify(this.whiteMove));