On a normal day, Billy Batson transforms into Shazam (previously Captain Marvel) by saying "Shazam!" and being struck by lightning. Upon being impacted by the lightning, he switches between his two forms.
But on several instances, he's shown to use this phenomenon as an attack, holding someone above him and shouting "Shazam" so that the lightning bolt hits his opponent.
Notably, in these instances where something blocks the path of the lightning bolt, Billy/Shazam isn't transformed. It seems that, if the lightning doesn't reach him, it doesn't effect him. And more importantly, it's possible for the lightning not to reach him.
I'm not too familiar with the character, so maybe this is a common occurrence, but are Billy's powers effectively nerfed if he's kept in a bunker or a building with a lightning rod? Does he have to have access to an open sky to transform, or can he summon "local lightning" to transform him anywhere?