X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FTeleport.js;h=eadaf13b4689ead3ced3c9f0e17e915f979d46ad;hp=6cf14a8023285a1209bbc7214e42c93f4e8bc1d1;hb=a9e1202b681d9d2f814767180183a0b04c58f8ab;hpb=f60aaac95dde260bbf897afee957406281068755 diff --git a/client/src/variants/Teleport.js b/client/src/variants/Teleport.js index 6cf14a80..eadaf13b 100644 --- a/client/src/variants/Teleport.js +++ b/client/src/variants/Teleport.js @@ -135,13 +135,6 @@ export class TeleportRules extends ChessRules { return super.underCheck(color); } - getCurrentScore() { - if (this.subTurn == 2) - // Move not over - return "*"; - return super.getCurrentScore(); - } - doClick(square) { if (isNaN(square[0])) return null; // If subTurn == 2 && square is empty && !underCheck, then teleport @@ -228,28 +221,8 @@ export class TeleportRules extends ChessRules { } } } - else { - // Normal move - const firstRank = (c == "w" ? V.size.x - 1 : 0); - const oppCol = V.GetOppCol(c); - const oppFirstRank = V.size.x - 1 - firstRank; - if (move.vanish[0].p == V.KING && move.appear.length > 0) - this.castleFlags[c] = [V.size.y, V.size.y]; - else if ( - move.start.x == firstRank && - this.castleFlags[c].includes(move.start.y) - ) { - const flagIdx = (move.start.y == this.castleFlags[c][0] ? 0 : 1); - this.castleFlags[c][flagIdx] = V.size.y; - } - if ( - move.end.x == oppFirstRank && - this.castleFlags[oppCol].includes(move.end.y) - ) { - const flagIdx = (move.end.y == this.castleFlags[oppCol][0] ? 0 : 1); - this.castleFlags[oppCol][flagIdx] = V.size.y; - } - } + // Normal check: + super.updateCastleFlags(move, move.vanish[0].p, c); } undo(move) {