Generates all legal moves for the current player, filtering out pseudo-legal moves that would leave the player's king in check.
Returns a list of all legal moves for the current player.