X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=base_rules.js;h=0f89cc429b8c97da44272d3add07813c90df776f;hb=5212758164eaa08e382b7bc281f87999c8af352b;hp=757707da92a8713872962aaed259f0826bb58be1;hpb=a55fde41f82207bf401c54b158dd6d0182799fd3;p=xogo.git diff --git a/base_rules.js b/base_rules.js index 757707d..0f89cc4 100644 --- a/base_rules.js +++ b/base_rules.js @@ -579,11 +579,18 @@ export default class ChessRules { // Get SVG board (background, no pieces) getSvgChessboard() { - const flipped = this.flippedBoard; let board = ` `; + board += this.getBaseSvgChessboard(); + board += ""; + return board; + } + + getBaseSvgChessboard() { + let board = ""; + const flipped = this.flippedBoard; for (let i=0; i < this.size.x; i++) { for (let j=0; j < this.size.y; j++) { if (!this.onBoard(i, j)) @@ -605,7 +612,6 @@ export default class ChessRules { />`; } } - board += ""; return board; } @@ -2341,10 +2347,11 @@ export default class ChessRules { if (this.options["teleport"]) { if ( this.subTurnTeleport == 1 && - move.vanish.length > move.appear.length && + move.vanish.length == 2 && + move.appear.length == 1 && move.vanish[1].c == this.turn ) { - const v = move.vanish[move.vanish.length - 1]; + const v = move.vanish[1]; this.captured = {x: v.x, y: v.y, c: v.c, p: v.p}; this.subTurnTeleport = 2; return;