X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FTeleport.js;h=6cf14a8023285a1209bbc7214e42c93f4e8bc1d1;hp=f5422c73e0fb8e7e199dcb19ebf2d931a8bb8410;hb=bc0b9205e41c5db0552e4ccf060b945342e36ed0;hpb=ad030c7d24804fbfa06158e93d89a3f101d2c8b3 diff --git a/client/src/variants/Teleport.js b/client/src/variants/Teleport.js index f5422c73..6cf14a80 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) { @@ -329,8 +311,6 @@ export class TeleportRules extends ChessRules { (color == 'w' && mvEval > m.eval) || (color == 'b' && mvEval < m.eval) ) { - // TODO: if many second moves have the same eval, only the - // first is kept. Could be randomized. m.eval = mvEval; m.next = m2; }