From: Benjamin Auder Date: Sat, 16 Jan 2021 21:09:19 +0000 (+0100) Subject: Fix notation for Pacosako + Otage X-Git-Url: https://git.auder.net/variants/current/css/doc/scripts/pieces/R.css?a=commitdiff_plain;h=afcfb85255ee152e3d6bced74260f586ced0f3e8;p=vchess.git Fix notation for Pacosako + Otage --- diff --git a/client/src/variants/Otage.js b/client/src/variants/Otage.js index 4cfe1e7a..938ef0ee 100644 --- a/client/src/variants/Otage.js +++ b/client/src/variants/Otage.js @@ -799,8 +799,13 @@ export class OtageRules extends ChessRules { // Add potential promotion indications: const firstLastRank = (c == 'w' ? [7, 0] : [0, 7]); if (move.end.x == firstLastRank[1] && piece == V.PAWN) { - const up = this.getUnionPieces(move.appear[0].c, move.appear[0].p); - notation += "=" + up[c].toUpperCase(); + notation += "="; + if (ChessRules.PIECES.includes(move.appear[0].p)) + notation += move.appear[0].p.toUpperCase(); + else { + const up = this.getUnionPieces(move.appear[0].c, move.appear[0].p); + notation += up[c].toUpperCase(); + } } else if ( move.end.x == firstLastRank[0] && diff --git a/client/src/variants/Pacosako.js b/client/src/variants/Pacosako.js index 8fc5a86b..218980c4 100644 --- a/client/src/variants/Pacosako.js +++ b/client/src/variants/Pacosako.js @@ -871,8 +871,13 @@ export class PacosakoRules extends ChessRules { // Add potential promotion indications: const firstLastRank = (c == 'w' ? [7, 0] : [0, 7]); if (move.end.x == firstLastRank[1] && piece == V.PAWN) { - const up = this.getUnionPieces(move.appear[0].c, move.appear[0].p); - notation += "=" + up[c].toUpperCase(); + notation += "="; + if (ChessRules.PIECES.includes(move.appear[0].p)) + notation += move.appear[0].p.toUpperCase(); + else { + const up = this.getUnionPieces(move.appear[0].c, move.appear[0].p); + notation += up[c].toUpperCase(); + } } else if ( move.end.x == firstLastRank[0] &&