The Doctor's fantasy becomes a risk.
The Doctor asks Janeway to let him take command in an emergency, and when she refuses, he gives himself a daydreaming program in which he is a hero, a lover and an Emergency Command Hologram who saves the ship. The daydreams begin taking over at bad moments, and the crew must switch them off.
Meanwhile an alien race known as the Hierarchy is secretly studying Voyager to judge whether to attack it. One observer, Phlox, has been watching the Doctor's daydreams and takes them for real reports, convincing his superiors that Voyager has a deadly photonic cannon. When the crew find out, Janeway lets the Doctor play the command role for real, and he bluffs the Hierarchy into retreating. The sixth-season episode is a comedy that parodies Walter Mitty-style daydreams, and it ends with Janeway agreeing to consider giving the Doctor command training.
