Progress on Go game
[xogo.git] / variants / Madrasi / class.js
CommitLineData
57b8015b
BA
1import ChessRules from "/base_rules.js";
2
3export default class MadrasiRules extends ChessRules {
4
5 static get Options() {
6 return {
7 select: C.Options.select,
535c464b 8 input: [
57b8015b
BA
9 {
10 label: "Rex Incl.",
535c464b
BA
11 variable: "rexincl",
12 type: "checkbox",
13 defaut: false
57b8015b 14 }
535c464b 15 ].concat(C.Options.input),
57b8015b
BA
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
f3e90e30
BA
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 );
57b8015b
BA
35 }
36
37};