X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FAllmate2.js;h=259faa74e628a672765e8b0e03a758b04cdcee50;hp=9ba91ef05ab91b00bcf4ec198a85c99e4afbfa67;hb=6f10b38369cc92057a25cc0150727aeeeaa6f1d1;hpb=fd7295e824c0199ad5a1ea40ec4b1f0630a5d806 diff --git a/client/src/variants/Allmate2.js b/client/src/variants/Allmate2.js index 9ba91ef0..259faa74 100644 --- a/client/src/variants/Allmate2.js +++ b/client/src/variants/Allmate2.js @@ -63,14 +63,14 @@ export class Allmate2Rules extends ChessRules { case V.KING: // Do not allow castling to escape from check oppMoves = super.getSlideNJumpMoves( - sq, + [i, j], V.steps[V.ROOK].concat(V.steps[V.BISHOP]), "oneStep" ); break; } for (let om of oppMoves) { - if (om.vanish.length == 2 && om.appear.length == 1) + if (om.vanish.length == 2) // Skip captures: forbidden in this mode continue; V.PlayOnBoard(this.board, om); @@ -90,6 +90,7 @@ export class Allmate2Rules extends ChessRules { } } } + this.undo(m); // 3) Add mate-captures: Object.values(attacked).forEach(sq => { @@ -100,8 +101,6 @@ export class Allmate2Rules extends ChessRules { p: this.getPiece(sq[0], sq[1]) })); }); - - this.undo(m); }); return moves;