Do Princesses Dream of Magic Sheep?

Do Princesses Dream of Magic Sheep? is the thirteenth episode of the fifth season of My Little Pony Friendship is Magic and the one hundred and fourth episode overall. The title is a play on the 1968 science fiction novel Do Androids Dream of Electric Sheep? by Philip K. Dick.

In this episode, Princess Luna enlists the Mane Six to hunt down a magical force that turns dreams into nightmares.

Production and development
The plot of this episode was first revealed at San Diego Comic-Con 2014.

M.A. Larson's website has listed season five episode thirteen with the title From Seapony to Shining Seapony; on June 27, 2015, Larson tweeted "Who do you trust more: me or zap2it??" and later tweeted that the correct answer is Zap2it.

Princess Luna's bedroom was designed by Phil Caesar.

Prologue
The episode opens at the Castle of the Two Sisters, with the Mane Six racing toward Princess Luna. Luna speaks with a small sphere of black smoke, calling it the "Tantabus," and tells it that she's ready. As the Tantabus eclipses the sun, Luna suddenly transforms into Nightmare Moon.

To combat this threat, the Mane Six channel the magic of Rainbow Power and fire upon Nightmare Moon with beams of multicolored light. Nightmare Moon appears to resist it at first, but when the Tantabus tears open a hole in reality and escapes, the Mane Six's magic successfully returns Princess Luna to normal. The Mane Six gather around the confused Luna for a group hug. Luna wakes up in her bed, the entire experience having been a dream, but she expresses deep concern:

"My dream ended... happily? That... cannot... happen!"

- Princess Luna

A shared nightmare
The next day, the Mane Six have a grooming day for their pets at Carousel Boutique, but they have trouble staying awake after not getting enough sleep the previous night. Fluttershy mentions having had a terrible nightmare, and the others say the same. When Twilight Sparkle mentions seeing a "blue smoke monster" in her nightmare, her friends are shocked to realize they all saw the same creature.

Twilight has Spike send a letter to Princess Luna to inform her about this smoke creature, and she arrives almost as soon as the letter is sent. Luna explains to the ponies that the Tantabus is a parasitic creature of nightmares that feeds on and infects dreams—when Luna dreamt of the Mane Six the night before, the Tantabus escaped Luna's dream and invaded theirs.

Luna goes on to explain that the more dreams the Tantabus feeds on, the stronger it gets—if it grows too powerful, it could escape into the real world and turn all of Equestria into a living nightmare.

Pursuing the Tantabus
That night, Twilight arranges several beds in her castle bedroom; as the Mane Six slumber, Princess Luna will pursue the Tantabus into whoever's dream it invades while the well-rested Spike keeps watch. Twilight suggests asking Princess Celestia for help, but Luna says Celestia has no power over sleep and that this is her fight alone. As the Mane Six drift to sleep, Luna uses her magic to enter their dreams.

In Rarity's dream, the Tantabus turns a collection of flying dresses into living monsters of fabric. Luna briefly fights off the attacking dresses before the Tantabus escapes into another dream. In Pinkie Pie's constantly changing dream, the Tantabus attacks her with vicious living cake. Luna intervenes, but the Tantabus escapes yet again. Pinkie's dream ends with her sharing a giant ice cream cone with the rest of Ponyville.

The Tantabus subsequently invades the rest of the Mane Six's dreams. It attacks Fluttershy with a monstrous Angel, rots Applejack's prized apples, turns Rainbow Dash's favorite dream of fighting changelings into a sickeningly cute flower field, and assaults Twilight with bat-like books. It escapes Luna's pursuit each time until the Mane Six finally wake up from their nightmares.

Much to Princess Luna's shame, the Tantabus remains on the loose. Luna regrets causing ponies more suffering even after her actions as Nightmare Moon, but Pinkie assures her that everyone makes mistakes. Luna says she can stop the Tantabus as long as it remains confined to the Mane Six's dreams, but due to Pinkie dreaming about the rest of Ponyville, the entire town is now exposed to the Tantabus' reach.