X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FTeleport.js;fp=client%2Fsrc%2Fvariants%2FTeleport.js;h=7704184f1f22099235cbf82782633d70ecb44003;hb=596e24d030f94682a31df74799c13eb792a63cdf;hp=f5422c73e0fb8e7e199dcb19ebf2d931a8bb8410;hpb=00eef1ca12534a43cb8e2e12155a46c00353eac2;p=vchess.git diff --git a/client/src/variants/Teleport.js b/client/src/variants/Teleport.js index f5422c73..7704184f 100644 --- a/client/src/variants/Teleport.js +++ b/client/src/variants/Teleport.js @@ -3,27 +3,9 @@ import { randInt } from "@/utils/alea"; export class TeleportRules extends ChessRules { hoverHighlight(x, y) { - if (this.subTurn == 1 || this.board[x][y] != V.EMPTY) - return false; - // Only highlight if the move is legal - const color = this.turn; - const tMove = new Move({ - appear: [ - new PiPo({ - x: x, - y: y, - c: color, - // The dropped piece nature has no importance: - p: V.KNIGHT - }) - ], - vanish: [], - start: { x: -1, y: -1 } - }); - this.play(tMove); - const moveOk = !this.underCheck(color); - this.undo(tMove); - return moveOk; + // Testing move validity results in an infinite update loop. + // TODO: find a way to test validity anyway. + return (this.subTurn == 2 && this.board[x][y] == V.EMPTY); } setOtherVariables(fen) {