X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FApocalypse.js;h=4587be3b49f399e4013956aaa54d3af24b826f0b;hb=af34341d92d47d14f396e7f4adb81f2a7e9d9a61;hp=abcfd703c07c0003899f79dc65ea1a1582ba1a33;hpb=2c5d7b20742b802d9c47916915c1114bcfc9a9c3;p=vchess.git diff --git a/client/src/variants/Apocalypse.js b/client/src/variants/Apocalypse.js index abcfd703..4587be3b 100644 --- a/client/src/variants/Apocalypse.js +++ b/client/src/variants/Apocalypse.js @@ -274,29 +274,44 @@ export class ApocalypseRules extends ChessRules { return ( ( m.vanish[0].p == V.KNIGHT && - (m.vanish.length == 1 || m.vanish[1].c != m.vanish[0].c) - ) - || - ( - // Promotion attempt - m.end.x == (m.vanish[0].c == "w" ? 0 : V.size.x - 1) && - other.vanish.length == 2 && - other.vanish[1].p == V.KNIGHT && - other.vanish[1].c == m.vanish[0].c - ) - || - ( - // Moving attempt - !movingLikeCapture(m) && - other.start.x == m.end.x && - other.start.y == m.end.y + ( + m.vanish.length == 1 || + m.vanish[1].c != m.vanish[0].c || + // Self-capture attempt + ( + !other.illegal && + other.end.x == m.end.x && + other.end.y == m.end.y + ) + ) ) || ( - // Capture attempt - movingLikeCapture(m) && - other.end.x == m.end.x && - other.end.y == m.end.y + m.vanish[0].p == V.PAWN && + !other.illegal && + ( + ( + // Promotion attempt + m.end.x == (m.vanish[0].c == "w" ? 0 : V.size.x - 1) && + other.vanish.length == 2 && + other.vanish[1].p == V.KNIGHT && + other.vanish[1].c == m.vanish[0].c + ) + || + ( + // Moving attempt + !movingLikeCapture(m) && + other.start.x == m.end.x && + other.start.y == m.end.y + ) + || + ( + // Capture attempt + movingLikeCapture(m) && + other.end.x == m.end.x && + other.end.y == m.end.y + ) + ) ) ); }; @@ -413,7 +428,7 @@ export class ApocalypseRules extends ChessRules { else this.whiteMove = move.whiteMove; } - getCheckSquares(color) { + getCheckSquares() { return []; }