Commit | Line | Data |
---|---|---|
a7d09201 BA |
1 | import ChessRules from "/base_rules.js"; |
2 | ||
3 | export default class ProgressiveRules extends ChessRules { | |
4 | ||
5 | static get Options() { | |
6 | return { | |
7 | select: C.Options.select, | |
8 | check: [ | |
9 | { | |
10 | label: "Logical", | |
11 | defaut: false, | |
12 | variable: "logical" | |
13 | } | |
14 | ].concat(C.Options.check), | |
15 | styles: C.Options.styles.filter(s => s != "progressive") | |
16 | }; | |
17 | } | |
18 | ||
19 | constructor(o) { | |
20 | o.options["progressive"] = true; | |
21 | super(o); | |
22 | } | |
23 | ||
24 | get hasCastle() { | |
25 | return !this.options["logical"]; | |
26 | } | |
27 | ||
28 | pieces(color, x, y) { | |
29 | let res = super.pieces(color, x, y); | |
30 | if (this.options["logical"]) { | |
31 | const pawnShift = (color == "w" ? -1 : 1); | |
32 | res["p"].moves[0] = { | |
33 | steps: [[pawnShift, 0]], | |
34 | range: 1 //always | |
35 | }; | |
36 | } | |
37 | return res; | |
38 | } | |
39 | ||
40 | }; |