X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=variants%2FProgressive%2Fclass.js;fp=variants%2FProgressive%2Fclass.js;h=c209821f632679cd1cc927f9ab53516a26827f13;hb=a7d092011535bc7da231c2c254ec5c936b62cd71;hp=0000000000000000000000000000000000000000;hpb=57b8015b5c22ccfd419df11b9d0174484397c417;p=xogo.git diff --git a/variants/Progressive/class.js b/variants/Progressive/class.js new file mode 100644 index 0000000..c209821 --- /dev/null +++ b/variants/Progressive/class.js @@ -0,0 +1,40 @@ +import ChessRules from "/base_rules.js"; + +export default class ProgressiveRules extends ChessRules { + + static get Options() { + return { + select: C.Options.select, + check: [ + { + label: "Logical", + defaut: false, + variable: "logical" + } + ].concat(C.Options.check), + styles: C.Options.styles.filter(s => s != "progressive") + }; + } + + constructor(o) { + o.options["progressive"] = true; + super(o); + } + + get hasCastle() { + return !this.options["logical"]; + } + + pieces(color, x, y) { + let res = super.pieces(color, x, y); + if (this.options["logical"]) { + const pawnShift = (color == "w" ? -1 : 1); + res["p"].moves[0] = { + steps: [[pawnShift, 0]], + range: 1 //always + }; + } + return res; + } + +};