From: Benjamin Auder Date: Mon, 25 Jan 2021 18:17:14 +0000 (+0100) Subject: Fix Spartan rules + better moves notation X-Git-Url: https://git.auder.net/app_dev.php/current/assets/doc/index.css?a=commitdiff_plain;h=26580d874deaea68cfb1b926549b1ee2720e9ec9;p=vchess.git Fix Spartan rules + better moves notation --- diff --git a/client/src/translations/rules/Spartan/en.pug b/client/src/translations/rules/Spartan/en.pug index 25205d15..6d64d3e4 100644 --- a/client/src/translations/rules/Spartan/en.pug +++ b/client/src/translations/rules/Spartan/en.pug @@ -39,9 +39,9 @@ ul li. Hoplite (Pawn) = Berolina pawn, with an extra option on its initial rank: it can jump over an obstacle for the 2-squares advance. - li Captain = Rook limited to 2 squares maximum. + li Captain = Rook limited to 2 squares maximum, but which can jump. li. - Lieutenant = Bishop limted to two squares maximum. + Lieutenant = Bishop limted to two squares maximum (potential jump). It can also move horizontally by one square, without capturing. li General = Rook + King li Warlord = Bishop + Knight diff --git a/client/src/translations/rules/Spartan/es.pug b/client/src/translations/rules/Spartan/es.pug index bb3b41da..a77b2f54 100644 --- a/client/src/translations/rules/Spartan/es.pug +++ b/client/src/translations/rules/Spartan/es.pug @@ -41,9 +41,11 @@ ul Hoplite (Peón) = peón Berolina, con una opción adicional de su fila inicial: puede saltar un obstáculo para el avance de dos casillas. - li Capitán = Torre limitada a dos casillas como máximo. li. - Teniente = Loco limitado a dos casillas como máximo. + Capitán = Torre limitada a dos casillas como máximo, + pero ella puede saltar. + li. + Teniente = Alfil limitado a dos casillas como máximo (salto potencial). También puede moverse horizontalmente un cuadrado, sin capturar. li General = Torre + Rey li Warlord = Alfil + Caballo diff --git a/client/src/translations/rules/Spartan/fr.pug b/client/src/translations/rules/Spartan/fr.pug index 399a1858..7cc2d150 100644 --- a/client/src/translations/rules/Spartan/fr.pug +++ b/client/src/translations/rules/Spartan/fr.pug @@ -41,9 +41,9 @@ ul Hoplite (Pion) = pion Berolina, avec une option supplémentaire depuis sa rangée initiale : il peut sauter par dessus un obstacle pour l'avancée de deux cases. - li Capitaine = Tour limitée à deux cases maximum. + li Capitaine = Tour limitée à deux cases maximum, mais elle peut sauter. li. - Lieutenant = Fou limité à deux cases maximum. + Lieutenant = Fou limité à deux cases maximum (saut potentiel). Il peut aussi se mouvoir horizontalement d'une case, sans capturer. li Général = Tour + Roi li Warlord = Fou + Cavalier diff --git a/client/src/variants/Spartan.js b/client/src/variants/Spartan.js index 5b0ccecb..3b4fc771 100644 --- a/client/src/variants/Spartan.js +++ b/client/src/variants/Spartan.js @@ -398,4 +398,26 @@ export class SpartanRules extends ChessRules { return 2; } + getNotation(move) { + const piece = this.getPiece(move.start.x, move.start.y); + if (piece == V.PAWN) { + // Pawn move + const finalSquare = V.CoordsToSquare(move.end); + let notation = ""; + if (move.vanish.length == 2) + // Capture + notation = "Px" + finalSquare; + else { + // No capture: indicate the initial square for potential ambiguity + const startSquare = V.CoordsToSquare(move.start); + notation = startSquare + finalSquare; + } + if (move.appear[0].p != V.PAWN) + // Promotion + notation += "=" + move.appear[0].p.toUpperCase(); + return notation; + } + return super.getNotation(move); //OK for all other pieces + } + };