X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FHiddenqueen.js;h=f8247856add80cbcb035eeedf2f406aed217a89d;hb=00eef1ca12534a43cb8e2e12155a46c00353eac2;hp=f3b5e3c89fba8dbe4b7a685ea750f16a1ffb5593;hpb=6f2f94374f1e73c375edf732d9425e575e81fff7;p=vchess.git diff --git a/client/src/variants/Hiddenqueen.js b/client/src/variants/Hiddenqueen.js index f3b5e3c8..f8247856 100644 --- a/client/src/variants/Hiddenqueen.js +++ b/client/src/variants/Hiddenqueen.js @@ -12,6 +12,10 @@ export class HiddenqueenRules extends ChessRules { return 't'; } + static get SomeHiddenMoves() { + return true; + } + static get PIECES() { return ChessRules.PIECES.concat([V.HIDDEN_QUEEN]); } @@ -156,10 +160,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; } };