Can I ready witch bolt, for instance, with the condition of attacking “the first goblin to come out of the cave” if I cannot see the goblin at the time of my (Ready) action? To be perfectly clear: at the time of the Ready action, the goblin is around a corner, in darkness: not targetable by witch bolt.
On the one hand: the Ready action states that (PHB p.193)
when you ready a spell, you cast it as normal but hold its energy….”
Part of casting a spell is targeting (inferred from “Targeting” as a sub-heading under “Casting a Spell”, PHB pp.202-204).
You can’t target something that you can’t see, so it would seem that since you can’t target the goblin at the time of the Ready action you can’t cast the spell in the first place.
On the other hand: isn’t this use of “Ready” the same as the “I’ll attack the first goblin to come out of the cave” that is the classic use-case for Ready? Picking a target is part of the Attack action, after all.