X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fvariants%2FAntiking.js;h=ac25c736c91299aa82a9ea0cf712d0d6f5ae6e3b;hb=818ede16c09c2f5650d7a6b7b5ea42d6dd1a0c30;hp=ddfd9677003a9b6aa1c84c9337e7fa25553d74f4;hpb=f61349e6ed2f190dd89bc74786eb106ec79e4262;p=vchess.git diff --git a/public/javascripts/variants/Antiking.js b/public/javascripts/variants/Antiking.js index ddfd9677..ac25c736 100644 --- a/public/javascripts/variants/Antiking.js +++ b/public/javascripts/variants/Antiking.js @@ -8,10 +8,10 @@ class AntikingRules static get ANTIKING() { return 'a'; } - // TODO: more subtle than that, require changing args: wp, bk and not just colors - canTake(color1, color2) + canTake(color1, color2, [x,y]) { - return color1 != color2; + const piece = this.getPiece(x,y); + return (piece != "a" && color1 != color2) || (piece == "a" && color1 == color2); } getPotentialMovesFrom([x,y]) @@ -26,6 +26,8 @@ class AntikingRules } } +// TODO: generaliser (à moindre coût) base_rules ? Ou spécialiser variantes ? + getPotentialAntikingMoves(x, y, c) { // TODO