From afcfb85255ee152e3d6bced74260f586ced0f3e8 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Sat, 16 Jan 2021 22:09:19 +0100 Subject: [PATCH] Fix notation for Pacosako + Otage --- client/src/variants/Otage.js | 9 +++++++-- client/src/variants/Pacosako.js | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) 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] && -- 2.44.0