X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fbase_rules.js;h=e0353e8f8a5f29b1917dd9b93982227fdc3bd22b;hb=34bfe15106aab64346f549420f066fe72441172f;hp=cfb8f84169dddeafe4eabe163cbbec388eee9611;hpb=ad030c7d24804fbfa06158e93d89a3f101d2c8b3;p=vchess.git diff --git a/client/src/base_rules.js b/client/src/base_rules.js index cfb8f841..e0353e8f 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -80,6 +80,14 @@ export const ChessRules = class ChessRules { return V.ShowMoves; } + // Sometimes moves must remain hidden until game ends + static get SomeHiddenMoves() { + return false; + } + get someHiddenMoves() { + return V.SomeHiddenMoves; + } + // Generally true, unless the variant includes random effects static get CorrConfirm() { return true; @@ -743,8 +751,7 @@ export const ChessRules = class ChessRules { if (x2 == lastRank) { // promotions arg: special override for Hiddenqueen variant if (!!promotions) finalPieces = promotions; - else if (!!V.PawnSpecs.promotions) - finalPieces = V.PawnSpecs.promotions; + else if (!!V.PawnSpecs.promotions) finalPieces = V.PawnSpecs.promotions; } let tr = null; for (let piece of finalPieces) { @@ -793,10 +800,7 @@ export const ChessRules = class ChessRules { // Captures if (V.PawnSpecs.canCapture) { for (let shiftY of [-1, 1]) { - if ( - y + shiftY >= 0 && - y + shiftY < sizeY - ) { + if (y + shiftY >= 0 && y + shiftY < sizeY) { if ( this.board[x + shiftX][y + shiftY] != V.EMPTY && this.canTake([x, y], [x + shiftX, y + shiftY]) @@ -913,6 +917,7 @@ export const ChessRules = class ChessRules { if ( // NOTE: "castling" arg is used by some variants (Monster), // where "isAttacked" is overloaded in an infinite-recursive way. + // TODO: not used anymore (Monster + Doublemove2 are simplified). (!castleInCheck && this.isAttacked([x, i], oppCol, "castling")) || (this.board[x][i] != V.EMPTY && // NOTE: next check is enough, because of chessboard constraints