X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FMaxima.js;h=d8347ac550cac952f59e95241338a5b1f0be9ee3;hb=cc0f1cbf5844499838d34d7c7342e64e5d33dbe3;hp=05df0bd990cbe1c247e39181343c9510713e4cd1;hpb=7e8a7ea1cb66adb4a987badfb0a3c2f99a21bd0a;p=vchess.git diff --git a/client/src/variants/Maxima.js b/client/src/variants/Maxima.js index 05df0bd9..d8347ac5 100644 --- a/client/src/variants/Maxima.js +++ b/client/src/variants/Maxima.js @@ -4,6 +4,10 @@ import { shuffle } from "@/utils/alea"; export class MaximaRules extends ChessRules { + static get Options() { + return null; + } + static get HasFlags() { return false; } @@ -141,8 +145,9 @@ export class MaximaRules extends ChessRules { // Pre-check: is thing on this square immobilized? const imSq = this.isImmobilized([x, y]); const piece = this.getPiece(x, y); - if (!!imSq && piece != V.KING) { - // Only option is suicide, if I'm not a king: + if (!!imSq) { + if (piece == V.KING) return []; + // Only option is suicide return [ new Move({ start: { x: x, y: y }, @@ -192,7 +197,7 @@ export class MaximaRules extends ChessRules { if (piece == V.KING) j = j % V.size.y; while (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY) { moves.push(this.getBasicMove(initSquare, [i, j])); - if (!!oneStep) continue outerLoop; + if (oneStep) continue outerLoop; i += step[0]; j += step[1]; } @@ -450,14 +455,8 @@ export class MaximaRules extends ChessRules { } getPotentialGuardMoves(sq) { - return ( - this.getSlideNJumpMoves( - sq, - V.steps[V.ROOK].concat(V.steps[V.BISHOP]), - "oneStep", - null - ) - ); + return this.getSlideNJumpMoves( + sq, V.steps[V.ROOK].concat(V.steps[V.BISHOP]), "oneStep"); } getNextMageSteps(step) { @@ -679,15 +678,8 @@ export class MaximaRules extends ChessRules { } isAttackedByGuard(sq, color) { - return ( - super.isAttackedBySlideNJump( - sq, - color, - V.GUARD, - V.steps[V.ROOK].concat(V.steps[V.BISHOP]), - "oneStep" - ) - ); + return super.isAttackedBySlideNJump( + sq, color, V.GUARD, V.steps[V.ROOK].concat(V.steps[V.BISHOP]), 1); } getNextMageCheck(step) {