X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FTitan.js;h=4d71b857fbfb522d96d4d6525db06d98aa5e5a17;hb=ce5afae7847431d33b55efec89d735acfcb31752;hp=836acc1f6c5686bec187c9857866bad0e5871a74;hpb=e9437f4b2ee9a40013ee514562f39a36d551faab;p=vchess.git diff --git a/client/src/variants/Titan.js b/client/src/variants/Titan.js index 836acc1f..4d71b857 100644 --- a/client/src/variants/Titan.js +++ b/client/src/variants/Titan.js @@ -228,11 +228,20 @@ export class TitanRules extends ChessRules { } postPlay(move) { - if (this.movesCount > 4) super.postPlay(move); + if (this.movesCount > 4) { + let piece = move.vanish[0].p; + if (['j', 'l'].includes(piece)) piece = V.KING; + 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) super.postUndo(move); + if (this.movesCount >= 4) { + if (['j', 'k', 'l'].includes(this.getPiece(move.start.x, move.start.y))) + this.kingPos[move.vanish[0].c] = [move.start.x, move.start.y]; + } } evalPosition() {