X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fvariants%2FAntiking.js;h=ed69ab71cfde392e5e53f07d0666c968b51a87b8;hb=f6dbe8e31a3260487664f1e0b50710b3f3efaf5f;hp=25a9dfcd0fc3da080512f3859f1086cf1136f53b;hpb=388e4c401f05b1f6a4c54e33c9da9114969a53c0;p=vchess.git diff --git a/public/javascripts/variants/Antiking.js b/public/javascripts/variants/Antiking.js index 25a9dfcd..ed69ab71 100644 --- a/public/javascripts/variants/Antiking.js +++ b/public/javascripts/variants/Antiking.js @@ -88,25 +88,19 @@ class AntikingRules extends ChessRules V.steps[V.ROOK].concat(V.steps[V.BISHOP]), "oneStep"); } - underCheck(move) + underCheck(color) { - const c = this.turn; - const oppCol = this.getOppCol(c); - this.play(move) - let res = this.isAttacked(this.kingPos[c], [oppCol]) - || !this.isAttacked(this.antikingPos[c], [oppCol]); - this.undo(move); + const oppCol = this.getOppCol(color); + let res = this.isAttacked(this.kingPos[color], [oppCol]) + || !this.isAttacked(this.antikingPos[color], [oppCol]); return res; } - getCheckSquares(move) + getCheckSquares(color) { - let res = super.getCheckSquares(move); - this.play(move); - const c = this.turn; - if (!this.isAttacked(this.antikingPos[c], [this.getOppCol(c)])) - res.push(JSON.parse(JSON.stringify(this.antikingPos[c]))); - this.undo(move); + let res = super.getCheckSquares(color); + if (!this.isAttacked(this.antikingPos[color], [this.getOppCol(color)])) + res.push(JSON.parse(JSON.stringify(this.antikingPos[color]))); return res; }