X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FCannibal.js;h=b66ac3827478457f81609f67531c3acbe2c807a7;hp=a08f197547d88ded964ede5635136b3d463df19a;hb=305ede7ec3753fc669b7c86af5b5c5b2fc78a164;hpb=dcb3637c5bd34c44806c6aeefe5964ce12a0261f diff --git a/client/src/variants/Cannibal.js b/client/src/variants/Cannibal.js index a08f1975..b66ac382 100644 --- a/client/src/variants/Cannibal.js +++ b/client/src/variants/Cannibal.js @@ -234,4 +234,19 @@ export class CannibalRules extends ChessRules { static get SEARCH_DEPTH() { return 4; } + + getNotation(move) { + let notation = super.getNotation(move); + const lastRank = (move.appear[0].c == "w" ? 0 : 7); + if ( + move.end.x != lastRank && + this.getPiece(move.start.x, move.start.y) == V.PAWN && + move.vanish.length == 2 && + move.appear[0].p != V.PAWN + ) { + // Fix "promotion" (transform indicator) from base_rules notation + notation = notation.slice(0, -2); + } + return notation; + } };