ac5ccffc2e987ce6c1b8bb8ac8ed9b14047b36f3
[xogo.git] / variants / Madrasi / class.js
1 import ChessRules from "/base_rules.js";
2
3 export default class MadrasiRules extends ChessRules {
4
5 static get Options() {
6 return {
7 select: C.Options.select,
8 input: [
9 {
10 label: "Rex Incl.",
11 variable: "rexincl",
12 type: "checkbox",
13 defaut: false
14 }
15 ].concat(C.Options.input),
16 styles: C.Options.styles.filter(s => s != "madrasi")
17 };
18 }
19
20 constructor(o) {
21 o.options["madrasi"] = true;
22 super(o);
23 }
24
25 canTake([x1, y1], [x2, y2]) {
26 return (
27 (
28 !this.options["rexincl"] ||
29 this.getPiece(x1, y1) != 'k' ||
30 this.getPiece(x2, y2) != 'k'
31 )
32 &&
33 super.canTake([x1, y1], [x2, y2])
34 );
35 }
36
37 };