From bd6ff57c4533799ab853fa95a53d68deaa4c500d Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Sun, 18 Nov 2018 13:25:59 +0100 Subject: [PATCH] Adjustement to highlight checkered checks --- public/javascripts/variants/Checkered.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/public/javascripts/variants/Checkered.js b/public/javascripts/variants/Checkered.js index 322d8fc0..a481a54f 100644 --- a/public/javascripts/variants/Checkered.js +++ b/public/javascripts/variants/Checkered.js @@ -36,6 +36,7 @@ class CheckeredRules extends ChessRules { super.initVariables(fen); // Decode last non-capturing checkered move (if any) + // TODO: since now we store moves list, this can disappear const cmove = fen.split(" ")[4]; if (cmove != "-") { @@ -353,6 +354,18 @@ class CheckeredRules extends ChessRules return res; } + getCheckSquares(move, c) + { + this.play(move); + const kingAttacked = this.isAttacked(this.kingPos[c], this.getOppCol(c)) + || this.isAttacked(this.kingPos[c], 'c'); + let res = kingAttacked + ? [ JSON.parse(JSON.stringify(this.kingPos[c])) ] //need to duplicate! + : [ ]; + this.undo(move); + return res; + } + updateVariables(move) { const piece = this.getPiece(move.start.x,move.start.y); -- 2.44.0