From: Benjamin Auder <benjamin.auder@somewhere> Date: Tue, 8 Sep 2020 15:19:26 +0000 (+0200) Subject: Fix CastleChess X-Git-Url: https://git.auder.net/doc/html/css/scripts/current/pieces/cn.svg?a=commitdiff_plain;h=aafc804f005917facbdc85b870d7b109fbac13e5;p=vchess.git Fix CastleChess --- diff --git a/client/src/variants/Castle.js b/client/src/variants/Castle.js index af3710c9..e6b0470d 100644 --- a/client/src/variants/Castle.js +++ b/client/src/variants/Castle.js @@ -4,9 +4,11 @@ export class CastleRules extends ChessRules { getCurrentScore() { const baseScore = super.getCurrentScore(); if (baseScore != '*') return baseScore; - if (this.getPiece(0,2) == V.KING && this.getPiece(0,3) == V.ROOK) - return "0-1"; - if (this.castleFlags['b'][0] >= 8) return "1-0"; + if (this.castleFlags['b'][0] >= 8) { + if (this.getPiece(0,2) == V.KING && this.getPiece(0,3) == V.ROOK) + return "0-1"; + return "1-0"; + } return '*'; } };