X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FSynchrone.js;fp=client%2Fsrc%2Fvariants%2FSynchrone.js;h=70afa0e5c32c3acdba3496573ee407f9f98eef84;hb=d448f93296ce2a4fcc6f2fbb959ec2485e172432;hp=1af9379fe284879f0f6ecb0eab59c298187a5689;hpb=515ae62f54a6b60c5932cb928fdc55a1d9ebad8b;p=vchess.git diff --git a/client/src/variants/Synchrone.js b/client/src/variants/Synchrone.js index 1af9379f..70afa0e5 100644 --- a/client/src/variants/Synchrone.js +++ b/client/src/variants/Synchrone.js @@ -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