X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FAllmate.js;h=728de25fc790f5be6c4c55d7a5f0557d34a07929;hb=4404e58c0a30105472942367dce894223b05c7fe;hp=2fa56b57d55c19584b9ca6a385531a7fafe0c4e6;hpb=094e11f228623dae26d1c93813db4deaebca293d;p=vchess.git diff --git a/client/src/variants/Allmate.js b/client/src/variants/Allmate.js index 2fa56b57..728de25f 100644 --- a/client/src/variants/Allmate.js +++ b/client/src/variants/Allmate.js @@ -5,10 +5,6 @@ export const VariantRules = class AllmateRules extends ChessRules { return false; } - canTake(sq1, sq2) { - return false; //Captures handled differently - } - getCheckSquares() { // No notion of check return []; @@ -20,6 +16,10 @@ export const VariantRules = class AllmateRules extends ChessRules { getPotentialMovesFrom([x, y]) { let moves = super.getPotentialMovesFrom([x, y]); + // Remove standard captures (without removing castling): + moves = moves.filter(m => { + return m.vanish.length == 1 || m.appear.length == 2; + }); // Augment moves with "mate-captures": // TODO: this is coded in a highly inefficient way... @@ -290,12 +290,11 @@ export const VariantRules = class AllmateRules extends ChessRules { getNotation(move) { let notation = super.getNotation(move); // Add a capture mark (not describing what is captured...): - if (move.vanish.length > 1 && move.appear[0].p != V.KING) { - if (notation.match(/^[a-h]/)) - // Pawn capture: remove "bx" in bxc4 for example - notation = notation.substr(2); - else - notation = notation.replace("x","") + "X"; + if (move.vanish.length > 1 && move.appear.length == 1) { + if (notation.match(/^[a-h]x/)) + // Pawn capture: remove initial "b" in bxc4 for example + notation = notation.substr(1); + notation = notation.replace("x","") + "X"; } return notation; }