From ce5afae7847431d33b55efec89d735acfcb31752 Mon Sep 17 00:00:00 2001 From: Benjamin Auder <benjamin.auder@somewhere> Date: Wed, 24 Mar 2021 14:51:21 +0100 Subject: [PATCH] Fix Titan --- client/src/variants/Titan.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/client/src/variants/Titan.js b/client/src/variants/Titan.js index 427eecdb..4d71b857 100644 --- a/client/src/variants/Titan.js +++ b/client/src/variants/Titan.js @@ -231,17 +231,16 @@ export class TitanRules extends ChessRules { if (this.movesCount > 4) { let piece = move.vanish[0].p; if (['j', 'l'].includes(piece)) piece = V.KING; - if (piece == V.KING && move.appear.length > 0) - this.kingPos[c] = [move.appear[0].x, move.appear[0].y]; + if (piece == V.KING) + this.kingPos[move.appear[0].c] = [move.appear[0].x, move.appear[0].y]; this.updateCastleFlags(move, piece); } } postUndo(move) { if (this.movesCount >= 4) { - const c = this.getColor(move.start.x, move.start.y); if (['j', 'k', 'l'].includes(this.getPiece(move.start.x, move.start.y))) - this.kingPos[c] = [move.start.x, move.start.y]; + this.kingPos[move.vanish[0].c] = [move.start.x, move.start.y]; } } -- 2.44.0