X-Git-Url: https://git.auder.net/?a=blobdiff_plain;ds=sidebyside;f=client%2Fsrc%2Fvariants%2FDark.js;h=81f87008b011353c0443cf36ea450a22a864c34a;hb=d048c4c997a6f7de8a612b99dcfccd26e4de2606;hp=6cf3b6787996314abc0ac38c0a0292db7ad50c59;hpb=b627d118ab41dccbda68f4523de8f063d0fa89df;p=vchess.git diff --git a/client/src/variants/Dark.js b/client/src/variants/Dark.js index 6cf3b678..81f87008 100644 --- a/client/src/variants/Dark.js +++ b/client/src/variants/Dark.js @@ -63,6 +63,19 @@ export const VariantRules = class DarkRules extends ChessRules { this.enlightened["w"][move.end.x][move.end.y] = true; for (let move of movesBlack) this.enlightened["b"][move.end.x][move.end.y] = true; + // Include en-passant capturing square if any: + let moves = currentTurn == "w" ? movesWhite : movesBlack; + for (let m of moves) { + if ( + m.appear[0].p == V.PAWN && + m.vanish.length == 2 && + m.vanish[1].x != m.end.x + ) { + const psq = m.vanish[1]; + this.enlightened[currentTurn][psq.x][psq.y] = true; + break; + } + } } // Has to be redefined to avoid an infinite loop