);
}
+ isKing(x, y, p) {
+ if (!p)
+ p = this.getPiece(x, y);
+ return ['k', 'l'].includes(p);
+ }
+
genRandInitBaseFen() {
const s = FenUtil.setupPieces(
['r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'],
});
break;
case "koopa":
- // Reverse move
+ // Reverse move, if possible
em = new Move({
- appear: [
- new PiPo({
- x: move.start.x, y: move.start.y, c: color, p: move.appear[0].p
- })
- ],
+ appear: [],
vanish: [
new PiPo({
x: move.end.x, y: move.end.y, c: color, p: move.appear[0].p
})
- ]
+ ],
+ end: {x: move.start.x, y: move.start.y} //may be irrelevant
});
+ em.koopa = true; //avoid applying effect
+ if (move.vanish.length == 0)
+ // After toadette+drop, just erase piece
+ break;
+ em.appear.push(
+ new PiPo({
+ x: move.start.x, y: move.start.y, c: color, p: move.appear[0].p
+ })
+ );
if (this.board[move.start.x][move.start.y] != "") {
// Pawn or knight let something on init square
em.vanish.push(new PiPo({
p: this.getPiece(move.start.x, move.start.y)
}));
}
- em.koopa = true; //avoid applying effect
break;
case "chomp":
// Eat piece