X-Git-Url: https://git.auder.net/?p=xogo.git;a=blobdiff_plain;f=base_rules.js;h=1b22ae5e256588eb4d8731e37e7ace4df68eaa31;hp=8b070598b1ab5a0f24009d5d7d79c3412267416f;hb=f54357573d4fdf87a05b19f78506c11f16bb3a26;hpb=fe234391b05ffef5e3236e82ca1391adcb784b45 diff --git a/base_rules.js b/base_rules.js index 8b07059..1b22ae5 100644 --- a/base_rules.js +++ b/base_rules.js @@ -1908,10 +1908,12 @@ export default class ChessRules { return [-1, -1]; //king not found } - filterValid(moves) { + // Some variants (e.g. Refusal) may need to check opponent moves too + filterValid(moves, color) { if (moves.length == 0) return []; - const color = this.turn; + if (!color) + color = this.turn; const oppCol = C.GetOppCol(color); if (this.options["balance"] && [1, 3].includes(this.movesCount)) { // Forbid moves either giving check or exploding opponent's king: