X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=variants%2FBicolour%2Fclass.js;h=e049e0c96e13a459de547ab31f2fdd3e050d7c4f;hb=727f2e558776b14a29cb1552a05a88cc9a4b0297;hp=3812d4cc62e475f499e3b06003e03d0bc5eabd8e;hpb=bc97fdd1302473b774cfb19e65dc3ed3ed388901;p=xogo.git diff --git a/variants/Bicolour/class.js b/variants/Bicolour/class.js index 3812d4c..e049e0c 100644 --- a/variants/Bicolour/class.js +++ b/variants/Bicolour/class.js @@ -4,12 +4,38 @@ import {ArrayFun} from "/utils/array.js"; export default class BicolourRules extends ChessRules { + static get Options() { + return { + select: C.Options.select, + input: [ + { + label: "King takes all", + variable: "takeboth", + type: "checkbox", + defaut: true + }, + { + label: "Capture king", + variable: "taking", + type: "checkbox", + defaut: false + } + ], + styles: ["balance", "capture", "cylinder", "dark", + "doublemove", "madrasi", "progressive", "zen"] + }; + } + get hasFlags() { return false; } canTake([x1, y1], [x2, y2]) { - return (this.getPiece(x2, y2) == 'k' || super.canTake([x1, y1], [x2, y2])); + return ( + this.getPiece(x2, y2) == 'k' || + (this.getPiece(x1, y1) == 'k' && this.options["takeboth"]) || + super.canTake([x1, y1], [x2, y2]) + ); } genRandInitBaseFen() { @@ -102,10 +128,7 @@ export default class BicolourRules extends ChessRules { } underCheck(square_s) { - return ( - this.underAttack(square_s[0], 'w') || - this.underAttack(square_s[0], 'b') - ); + return super.underCheck(square_s, ['w', 'b']); } };