X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FDark.js;h=65934e6914a46ff0d206d53cc0aa8921e6a7503e;hp=cb073cfd7c9b74f8ca742a2da218d6e509657d5b;hb=737a5dafb39740ebe304b8d0a82df85070def571;hpb=1b56b73614509d1dca8c4353f18fb78349940cf8 diff --git a/client/src/variants/Dark.js b/client/src/variants/Dark.js index cb073cfd..65934e69 100644 --- a/client/src/variants/Dark.js +++ b/client/src/variants/Dark.js @@ -109,7 +109,7 @@ export class DarkRules extends ChessRules { postPlay(move) { super.postPlay(move); - if (move.vanish.length >= 2 && move.vanish[1].p == V.KING) + if (move.vanish.length == 2 && move.vanish[1].p == V.KING) // We took opponent king (because if castle vanish[1] is a rook) this.kingPos[this.turn] = [-1, -1]; @@ -119,11 +119,9 @@ export class DarkRules extends ChessRules { postUndo(move) { super.postUndo(move); - const c = move.vanish[0].c; - const oppCol = V.GetOppCol(c); - if (this.kingPos[oppCol][0] < 0) + if (move.vanish.length == 2 && move.vanish[1].p == V.KING) // Last move took opponent's king: - this.kingPos[oppCol] = [move.vanish[1].x, move.vanish[1].y]; + this.kingPos[move.vanish[1].c] = [move.vanish[1].x, move.vanish[1].y]; // Update lights for both colors: this.updateEnlightened();