The Practical Joker

After avoiding a Romulan ambush by three of their warships, the U.S.S. Enterprise enters a strange energy cloud. The gaseous cloud affects the ship's computer turning it insane. With the crew at the mercy of the Enterprise's computer, it indulges in a series of increasingly aggressive practical jokes.