X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FTeleport.js;h=82528c1868428c6e4a8c55257f8c1c2decf1bb4c;hb=9a7a1ccca45d083f50d92bc15cd389c14149b50a;hp=eadaf13b4689ead3ced3c9f0e17e915f979d46ad;hpb=a9e1202b681d9d2f814767180183a0b04c58f8ab;p=vchess.git diff --git a/client/src/variants/Teleport.js b/client/src/variants/Teleport.js index eadaf13b..82528c18 100644 --- a/client/src/variants/Teleport.js +++ b/client/src/variants/Teleport.js @@ -2,6 +2,7 @@ import { ChessRules, Move, PiPo } from "@/base_rules"; import { randInt } from "@/utils/alea"; export class TeleportRules extends ChessRules { + hoverHighlight(x, y) { // Testing move validity results in an infinite update loop. // TODO: find a way to test validity anyway. @@ -18,6 +19,11 @@ export class TeleportRules extends ChessRules { return this.subTurn == 1; } + canIplay(side, [x, y]) { + if (this.subTurn == 2) return (this.board[x][y] == V.EMPTY); + return super.canIplay(side, [x, y]); + } + getPPpath(m) { if ( m.vanish.length == 2 && @@ -319,4 +325,5 @@ export class TeleportRules extends ChessRules { move.appear[0].p != V.PAWN ? move.appear[0].p.toUpperCase() : ""; return piece + "@" + V.CoordsToSquare(move.end); } + };