X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FDynamo.js;h=67065d7c197470c76013aad245a4635b3cfe3ad8;hb=7e8a7ea1cb66adb4a987badfb0a3c2f99a21bd0a;hp=15cfe95f1d9efaebdf72353192eca8a2664d73f7;hpb=08ccbb7827e93df14cd3206a57ec5e598afd93f3;p=vchess.git diff --git a/client/src/variants/Dynamo.js b/client/src/variants/Dynamo.js index 15cfe95f..67065d7c 100644 --- a/client/src/variants/Dynamo.js +++ b/client/src/variants/Dynamo.js @@ -2,6 +2,7 @@ import { ChessRules, Move, PiPo } from "@/base_rules"; import { randInt } from "@/utils/alea"; export class DynamoRules extends ChessRules { + // TODO? later, allow to push out pawns on a and h files static get HasEnpassant() { return false; @@ -43,7 +44,6 @@ export class DynamoRules extends ChessRules { }); this.amoves.push(move); } - this.subTurn = 1; // Stack "first moves" (on subTurn 1) to merge and check opposite moves this.firstMove = []; } @@ -739,18 +739,11 @@ export class DynamoRules extends ChessRules { return potentialMoves; } - getCurrentScore() { - if (this.subTurn == 2) - // Move not over - return "*"; - return super.getCurrentScore(); - } - doClick(square) { // A click to promote a piece on subTurn 2 would trigger this. // For now it would then return [NaN, NaN] because surrounding squares // have no IDs in the promotion modal. TODO: improve this? - if (!square[0]) return null; + if (isNaN(square[0])) return null; // If subTurn == 2 && square is empty && !underCheck && !isOpposite, // then return an empty move, allowing to "pass" subTurn2 const La = this.amoves.length; @@ -881,4 +874,5 @@ export class DynamoRules extends ChessRules { return initialSquare + "R"; return move.appear[0].p.toUpperCase() + initialSquare + finalSquare; } + };