| 1 | import ChessRules from "/base_rules.js"; |
| 2 | |
| 3 | export default class TeleportRules extends ChessRules { |
| 4 | |
| 5 | static get Options() { |
| 6 | return { |
| 7 | select: C.Options.select, |
| 8 | input: C.Options.input.concat({ |
| 9 | label: "Teleport king", |
| 10 | variable: "tpking", |
| 11 | type: "checkbox", |
| 12 | defaut: false |
| 13 | }), |
| 14 | styles: C.Options.styles.filter(s => s != "teleport") |
| 15 | }; |
| 16 | } |
| 17 | |
| 18 | constructor(o) { |
| 19 | o.options["teleport"] = true; |
| 20 | super(o); |
| 21 | } |
| 22 | |
| 23 | canSelfTake([x1, y1], [x2, y2]) { |
| 24 | return (this.options["tpking"] || !this.isKing(x2, y2)); |
| 25 | } |
| 26 | |
| 27 | }; |