- if (!!this.lastMoveEnd[L-1]) {
- if (x != this.lastMoveEnd[L-1].x || y != this.lastMoveEnd[L-1].y)
- // A capture was played: wrong square
- return [];
- asA = this.lastMoveEnd[L-1].p;
- }
- switch (asA || this.getPiece(x, y)) {
- case V.PAWN: return super.getPotentialPawnMoves([x, y]);
- case V.ROOK: return super.getPotentialRookMoves([x, y]);
- case V.KNIGHT: return super.getPotentialKnightMoves([x, y]);
- case V.BISHOP: return super.getPotentialBishopMoves([x, y]);
- case V.QUEEN: return super.getPotentialQueenMoves([x, y]);
- case V.KING: return super.getPotentialKingMoves([x, y]);
- }
- return [];
+ if (L >= 1 && this.lastMoveEnd[L-1].x == x && this.lastMoveEnd[L-1].y == y)
+ return this.lastMoveEnd[L-1].p;
+ return super.getPiece(x, y);