X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FEightpieces.js;h=bea261a38ee5829abb8f21b9b678937420715c23;hb=1c58eb76b86d89b9aad29920240b12451f77ab95;hp=fe36ab24d7020734682d93343e084c84972d938e;hpb=7769191167d394c3b52625dae62b4af93803d656;p=vchess.git diff --git a/client/src/variants/Eightpieces.js b/client/src/variants/Eightpieces.js index fe36ab24..bea261a3 100644 --- a/client/src/variants/Eightpieces.js +++ b/client/src/variants/Eightpieces.js @@ -247,21 +247,23 @@ export class EightpiecesRules extends ChessRules { // Because of the lancers, getPiece() could be wrong: // use board[x][y][1] instead (always valid). getBasicMove([sx, sy], [ex, ey], tr) { + const initColor = this.getColor(sx, sy); + const initPiece = this.board[sx][sy].charAt(1); let mv = new Move({ appear: [ new PiPo({ x: ex, y: ey, - c: tr ? tr.c : this.getColor(sx, sy), - p: tr ? tr.p : this.board[sx][sy].charAt(1) + c: tr ? tr.c : initColor, + p: tr ? tr.p : initPiece }) ], vanish: [ new PiPo({ x: sx, y: sy, - c: this.getColor(sx, sy), - p: this.board[sx][sy].charAt(1) + c: initColor, + p: initPiece }) ] });