X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FEightpieces.js;h=4f487647f7e92acc9958c9c9c8f412d0f7238a1b;hb=2c5d7b20742b802d9c47916915c1114bcfc9a9c3;hp=fa80824bef1fddef326a51e7e15017531c944b2a;hpb=d54f6261c9e30f4eabb402ad301dd5c5e40fb656;p=vchess.git diff --git a/client/src/variants/Eightpieces.js b/client/src/variants/Eightpieces.js index fa80824b..4f487647 100644 --- a/client/src/variants/Eightpieces.js +++ b/client/src/variants/Eightpieces.js @@ -83,8 +83,15 @@ export class EightpiecesRules extends ChessRules { return "Eightpieces/tmp_png/" + b; } - getPPpath(b, orientation) { - return this.getPpath(b, null, null, orientation); + getPPpath(m, orientation) { + return ( + this.getPpath( + m.appear[0].c + m.appear[0].p, + null, + null, + orientation + ) + ); } static ParseFen(fen) { @@ -286,7 +293,8 @@ export class EightpiecesRules extends ChessRules { canIplay(side, [x, y]) { return ( - (this.subTurn == 1 && this.turn == side && this.getColor(x, y) == side) || + (this.subTurn == 1 && this.turn == side && this.getColor(x, y) == side) + || (this.subTurn == 2 && x == this.sentryPos.x && y == this.sentryPos.y) ); } @@ -788,8 +796,8 @@ export class EightpiecesRules extends ChessRules { case V.QUEEN: return sliderAttack(V.steps[V.ROOK].concat(V.steps[V.BISHOP])); case V.LANCER: { - // Special case: as long as no enemy units stands in-between, it attacks - // (if it points toward the king). + // Special case: as long as no enemy units stands in-between, + // it attacks (if it points toward the king). const allowedStep = V.LANCER_DIRS[this.board[x1][y1].charAt(1)]; return sliderAttack([allowedStep], "lancer"); } @@ -1036,7 +1044,8 @@ export class EightpiecesRules extends ChessRules { Object.keys(V.LANCER_DIRNAMES).includes(move.appear[0].p) ) { // Fix promotions in lancer: - notation = notation.slice(0, -1) + "L:" + V.LANCER_DIRNAMES[move.appear[0].p]; + notation = notation.slice(0, -1) + + "L:" + V.LANCER_DIRNAMES[move.appear[0].p]; } return notation; }