X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FHiddenqueen.js;h=72feea4dda45f605070505288a7a7d5083273134;hb=90df90bca1a993930a0e1a07a1b4990dd538c6e2;hp=8db5a50e041e58d3a85502be2370e45c665ab724;hpb=32f6285ee325a14286562a53baefc647201df2af;p=vchess.git diff --git a/client/src/variants/Hiddenqueen.js b/client/src/variants/Hiddenqueen.js index 8db5a50e..72feea4d 100644 --- a/client/src/variants/Hiddenqueen.js +++ b/client/src/variants/Hiddenqueen.js @@ -13,7 +13,7 @@ export class HiddenqueenRules extends ChessRules { } static get PIECES() { - return ChessRules.PIECES.concat(Object.values(V.HIDDEN_CODE)); + return ChessRules.PIECES.concat([V.HIDDEN_QUEEN]); } getPiece(i, j) { @@ -156,10 +156,22 @@ export class HiddenqueenRules extends ChessRules { } getNotation(move) { - const notation = super.getNotation(move); - if (notation.charAt(0) == 'T') - // Do not reveal hidden queens - return notation.substr(1); + if (this.getPiece(move.start.x, move.start.y) != V.HIDDEN_QUEEN) + return super.getNotation(move); + const finalSquare = V.CoordsToSquare(move.end); + if (move.appear[0].p == V.QUEEN) { + return ( + "Q" + + (move.vanish.length > move.appear.length ? "x" : "") + + finalSquare + ); + } + // Do not reveal hidden queens playing as pawns + let notation = ""; + if (move.vanish.length == 2) + // Capture + notation = V.CoordToColumn(move.start.y) + "x" + finalSquare; + else notation = finalSquare; return notation; } };