X-Git-Url: https://git.auder.net/images/pieces/%22%20%20%20VariantRules.getPpath%28board%5Bi%5D%5Bj%5D%29%20%20%20%22.svg?a=blobdiff_plain;f=base_rules.js;h=4627eb78e34aef0a152fc7009ae67fc644cb0cdf;hb=9a036f5fbfe3cc1df18b47e43d5db293de013e47;hp=88197ea0bed834c970659b95068aa5bec6f0b1aa;hpb=182ba661e9c6e30fc641f4e71f29ae76961f4510;p=xogo.git diff --git a/base_rules.js b/base_rules.js index 88197ea..4627eb7 100644 --- a/base_rules.js +++ b/base_rules.js @@ -1341,7 +1341,13 @@ export default class ChessRules { } getStepSpec(color, x, y, piece) { - return this.pieces(color, x, y)[piece || this.getPieceType(x, y)]; + let pieceType = piece; + const allSpecs = this.pieces(color, x, y); + if (!piece) + pieceType = this.getPieceType(x, y); + else if (allSpecs[piece].moveas) + pieceType = allSpecs[piece].moveas; + return allSpecs[pieceType]; } // Can thing on square1 capture thing on square2? @@ -2340,14 +2346,13 @@ export default class ChessRules { } postPlay(move) { - const color = this.turn; if (this.options["dark"]) this.updateEnlightened(); if (this.options["teleport"]) { if ( this.subTurnTeleport == 1 && move.vanish.length > move.appear.length && - move.vanish[1].c == color + move.vanish[1].c == this.turn ) { const v = move.vanish[move.vanish.length - 1]; this.captured = {x: v.x, y: v.y, c: v.c, p: v.p}; @@ -2362,7 +2367,7 @@ export default class ChessRules { tryChangeTurn(move) { if (this.isLastMove(move)) { - this.turn = C.GetOppCol(color); + this.turn = C.GetOppCol(this.turn); this.movesCount++; this.subTurn = 1; }