How is the second part optional?
Once during your turn (before your attack), you may discard a card from your hand. Then, if you have Solrock in play, draw a card. This power can't be used if Lunatone is affected by a Special Condition.
Part1: You may discard a card from your hand.
THEN
Part2: If you have Solrock in play, draw a card.
It says "draw a card" not "you may draw a card". If you use the poké-power with a Solrock in play, you have to do as much as you can. Much like the drawing part of Oak's Visit is compulsory.
However, with a Solrock in play you can't just use the poké-power and draw without discarding, even if your hand is 0.
That works like the returning a card part POV.
To say you can't discard (the first part) unless you can draw (the second part) is like saying you can't play Team Galactic's Mars to draw unless your opponent has cards in their hand. Which makes no sense.
Remember the "THEN" works one way but not the other. You can't do part 2 unless you can do Part 1 but that doesn't mean you have to be able to do part 2 to do part 1.
---------------------------
If I'm right about that, then you could play Bill's Maintenance on an empty deck, as long as you have a card to shuffle back. Which is strange because that wouldn't actually accomplish anything apart from reducing your hand size by 1 (bill's m itself) but with the deck being not public knowledge it means once you put the card in your empty deck, it's unknown what you'll draw.
---------------------------
By the way, I have something else to say about all this. With POV saying "then", it means you only do the second part if you've done the first part of drawing. OK, now this sounds really crazy but even without a deck, you've still drawn 3 cards. Ha ha
Seriously, if you play it and draw 2 does that mean you don't have to shuffle back? No of course not, so why not for 0? Zero and two are both less than what the card tells you to draw. Drawing 0 is not drawing three and drawing 2 is not drawing three, so how does one satisfy the "then" meaning you have to shuffle while the other doesn't? Surely whatever occurs for when you only draw 2 occurs when you only draw 0? I don't get why its considered a failure when your deck is zero but a success when you have 1 or 2. I've only heard the "do as much as possible" rule applied to cards as a whole, not individual effects within a card as here.