| 1 | import ChessRules from "/base_rules.js"; |
| 2 | |
| 3 | export default class AntimatterRules extends ChessRules { |
| 4 | |
| 5 | static get Options() { |
| 6 | return { |
| 7 | select: C.Options.select, |
| 8 | input: C.Options.input, |
| 9 | styles: C.Options.styles.filter(s => !["atomic", "madrasi"].includes(s)) |
| 10 | }; |
| 11 | } |
| 12 | |
| 13 | getPotentialMovesFrom([x, y]) { |
| 14 | let moves = super.getPotentialMovesFrom([x, y]); |
| 15 | // Handle "matter collisions" |
| 16 | moves.forEach(m => { |
| 17 | if ( |
| 18 | m.vanish.length == 2 && |
| 19 | m.appear.length == 1 && |
| 20 | m.vanish[0].p == m.vanish[1].p && |
| 21 | m.vanish[0].c != m.vanish[1].c //for Recycle & Teleport |
| 22 | ) { |
| 23 | m.appear.pop(); |
| 24 | } |
| 25 | }); |
| 26 | return moves; |
| 27 | } |
| 28 | |
| 29 | }; |