Can I play Ultra Ball if there are no cards left in my deck?
No, you cannot. Discarding the two cards is a cost not the effect, and you cannot play Trainer cards for no effect.
Source: TPCi Rules Team (2017-04-27)

Relevant cards

Note: All applicable cards may not be listed below.
XY2_99