Stargate Atlantis/Recap/S04/E04 Doppelganger

"So far the only behavior we have to evaluate suggests a certain malice. Based on what's been described to me the personification of Colonel Sheppard in everyone's dreams is behaving much like a sociopath."

- Dr. Heightmeyer

While exploring a jungle planet, Col. Sheppard touches a glowing crystal. Dr. Keller gives him a clean bill of health, but over the next couple of days the rest of the team start sequentially experiencing vivid nightmares, all featuring Sheppard as an antagonist. Things start to escalate when it comes around to Major Lorne, who has a history of sleepwalking and almost shoots Sheppard while asleep. They escalate even further when the team finds  dead, having been killed in the dream.

Returning to the planet, they bring back the original crystal and a second, still glowing one for analysis. The crystal turns out to house an alien entity that jumps from person to person via electric conduction and feeds off the fear of the host. Zelenka is able to modify the life-signs detector to pick up the entity's unique energy signature, determining that after killing  the entity jumped to McKay. They stick him in a rubber room, ply him with coffee, and try to figure out what to do next.

Carter hypothesizes that they might be able to convince or force the entity to return to its crystal if they can communicate with it. They put McKay under and use an old piece of Phlebotinum to hook Sheppard up to his dreams to help out. McKay's nightmare turns out to be a rowboat in the rain, and Sheppard and the entity (also known as Evil Sheppard) play Good Angel, Bad Angel by encouraging and discouraging McKay's progress. Then the whole thing gets eaten by a whale. McKay flatlines and defibrilators are applied, with the usual amount of success for stargateverse defibrilators.

Sheppard is devestated. This isn't helped by the fact that everyone else feels the need to remind him what a terrible friend he is. Even Evil Sheppard turns up to taunt him, which shouldn't really be possible, and then proceed to beat the crap out of him. Suddenly, McKay appears out of thin air and zaps Evil Sheppard with force lightning. It turns out the defibrilators worked after all (and are now being vigorously applied to Sheppard), with the added bonus that the entity is weak against electricity. With Evil Sheppard thus weakened, Sheppard and McKay are able to throw him bodily through the Stargate, and the entity retreats back into its crystal.

Sheppard and McKay share a moment of disappointment that Sheppard's subconscious isn't more full of hot chicks, then leave the dream and return the crystals to the jungle planet.

Tropes:

 * Acting for Two
 * Battle in The Center of The Mind
 * Beard of Evil: Lampshaded. Sheppard inquires about the other Sheppard, "Did I have a goatee?" (he didn't)
 * The Bet: McKay is unusually gung-ho about exploring the jungle planet because Zelenka bet him that there was nothing of value there.
 * Call Back: Carter compares the situation initially to the SG-1 first season episode "Cold Lazarus." The latter half of the episode involves technology picked up in the fourth season episode "The Gamekeeper."
 * Don't Touch It You Idiot: Sheppard gets pretty brow-beaten for touching the glowy rock thing.
 * Dream Within a Dream: 's death.
 * Dropped a Bridge On Him:
 * Emotion Eater: The entity feeds on the fear of its host - and also, as the episode progresses, the thrill of killing them.
 * Monster Clown: one briefly shows up in the boat with Sheppard and McKay
 * Power Glows
 * Plug N Play Friends: Dr. Keller is suddenly one of the gang, routinely having lunch with the rest of the team, with really no buildup.
 * Seen It All: Carter
 * Shipper On Deck: Ronon again. This time he offers to set up Sheppard and Dr. Keller.
 * Shout Out: Several elements of the plot bear strong resembelences to Alien and to the Freddy Cougar movies - and the characters are quick to point this out.
 * Also to Moby Dick
 * Your Mind Makes It Real: As the entity grows stronger, the dreams it creates can put the victim into cardiac arrest. This happens to both  - but the latter gets better.
 * Your Worst Nightmare