+ getEnpassantCaptures([x, y], shiftX) {
+ const Lep = this.epSquares.length;
+ const epSquare = this.epSquares[Lep - 1]; //always at least one element
+ let enpassantMove = null;
+ if (
+ !!epSquare &&
+ epSquare.x == x + shiftX &&
+ Math.abs(epSquare.y - y) == 1
+ ) {
+ // Not using this.getBasicMove() because the mushroom has no effect
+ enpassantMove = super.getBasicMove([x, y], [epSquare.x, epSquare.y]);
+ enpassantMove.vanish.push({
+ x: x,
+ y: epSquare.y,
+ p: V.PAWN,
+ c: this.getColor(x, epSquare.y)
+ });
+ }
+ return !!enpassantMove ? [enpassantMove] : [];
+ }
+
+ getPotentialQueenMoves(sq) {
+ const normalMoves = super.getPotentialQueenMoves(sq);
+ // If flag allows it, add 'invisible movements'
+ let invisibleMoves = [];
+ if (this.powerFlags[this.turn][V.QUEEN]) {
+ normalMoves.forEach(m => {
+ if (m.vanish.length == 1) {
+ let im = JSON.parse(JSON.stringify(m));
+ m.appear[0].p = V.INVISIBLE_QUEEN;
+ invisibleMoves.push(im);
+ }
+ });
+ }
+ return normalMoves.concat(invisibleMoves);
+ }
+