X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fbase_rules.js;h=95a90cf73000683f3956dab5477de6404ec5814d;hb=15d6904394c63102e7865b5537eb3b533e3ac06f;hp=99de62658f9f3df3df795d50840bde55f1e4483a;hpb=107dc1bd5361e2538b1551bdcc37c1e90a444b83;p=vchess.git diff --git a/client/src/base_rules.js b/client/src/base_rules.js index 99de6265..95a90cf7 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -80,6 +80,11 @@ export const ChessRules = class ChessRules { return V.ShowMoves; } + // Generally true, unless the variant includes random effects + static get CorrConfirm() { + return true; + } + // Used for Monochrome variant (TODO: harmonize: !canFlip ==> showFirstTurn) get showFirstTurn() { return false; @@ -117,6 +122,11 @@ export const ChessRules = class ChessRules { return null; } + // Some variants may need to highlight squares on hover (Hamilton, Weiqi...) + hoverHighlight() { + return false; + } + static get IMAGE_EXTENSION() { // All pieces should be in the SVG format return ".svg"; @@ -733,8 +743,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) { @@ -783,10 +792,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])