X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FAllmate2.js;h=9ba91ef05ab91b00bcf4ec198a85c99e4afbfa67;hb=fd7295e824c0199ad5a1ea40ec4b1f0630a5d806;hp=424ff61bb73e394f79e0b852643507d6ef99a738;hpb=a68362420a3a92099dfaacea10f6cbd579161183;p=vchess.git diff --git a/client/src/variants/Allmate2.js b/client/src/variants/Allmate2.js index 424ff61b..9ba91ef0 100644 --- a/client/src/variants/Allmate2.js +++ b/client/src/variants/Allmate2.js @@ -61,7 +61,12 @@ export class Allmate2Rules extends ChessRules { oppMoves = this.getPotentialQueenMoves([i, j]); break; case V.KING: - oppMoves = this.getPotentialKingMoves([i, j]); + // Do not allow castling to escape from check + oppMoves = super.getSlideNJumpMoves( + sq, + V.steps[V.ROOK].concat(V.steps[V.BISHOP]), + "oneStep" + ); break; } for (let om of oppMoves) { @@ -207,8 +212,7 @@ export class Allmate2Rules extends ChessRules { if (kp[0] < 0) // King disappeared return color == "w" ? "0-1" : "1-0"; - if (this.atLeastOneMove()) - return "*"; + if (this.atLeastOneMove()) return "*"; // Kings still there, no moves: return "1/2"; }