4bd27122749cad4dec8ee903188ab14aa18b5f2e
1 import ChessRules
from "/base_rules.js";
2 import PiPo
from "/utils/PiPo.js";
3 import Move
from "/utils/Move.js";
5 export default class AtomicRules
extends ChessRules
{
9 select: C
.Options
.select
,
17 ].concat(C
.Options
.input
.filter(i
=> i
.variable
== "pawnfall")),
18 styles: C
.Options
.styles
.filter(s
=> s
!= "atomic")
23 o
.options
["atomic"] = true;
28 if (this.options
["rempawn"] && this.movesCount
== 0)
29 return (this.playerColor
== this.turn
&& this.getPiece(x
, y
) == "p");
30 return super.canIplay(x
, y
);
33 getPotentialMovesFrom([x
, y
], color
) {
34 if (this.options
["rempawn"] && this.movesCount
== 0) {
35 if ([1, 6].includes(x
)) {
36 const c
= this.getColor(x
, y
);
55 return super.getPotentialMovesFrom([x
, y
], color
);
59 if (!this.options
["rempawn"] || this.movesCount
>= 1)
60 return super.doClick(square
);
61 const [x
, y
] = [square
[0], square
[1]];
62 const moves
= this.getPotentialMovesFrom([x
, y
]);
63 return (moves
.length
>= 1 ? moves
[0] : null);