- return (
- this.filterValid(super.getPotentialMovesFrom([x, y]))
- // Augment with potential recaptures:
- .concat(this.getRecaptures([x, y]))
- );
+ let moves = this.filterValid(super.getPotentialMovesFrom([x, y]));
+ if (!this.underCheck(this.getColor(x, y)))
+ // Augment with potential recaptures, except if we are under check
+ Array.prototype.push.apply(moves, this.getRecaptures([x, y]));
+ return moves;