Sparrow teams up with blacksmith Will Turner (Orlando Bloom) to rescue the beautiful daughter (Keira Knightley) of the governor of Port Royal. She’s been kidnapped by Sparrow’s pirate nemesis, Barbossa (Geoffrey Rush), who thinks she can dispel an ancient curse that has turned him and his greedy, grimy crew into the undead. And so on. “Pirates of the Caribbean” has its ups and downs, but it’s better than a movie based on a theme-park ride has any right to be. The screenplay, by Ted Elliott and Terry Rossio, tends to work best in its comic mode. After a while, the sea battles begin to feel redundant. Director Gore Verbinski’s fight scenes between the good guys and the ghostly pirate warriors suffer from the same problem that afflicted “The Matrix Reloaded”: how can you generate life-or-death suspense with characters who can’t die? Fortunately, whenever the movie starts to sag, Depp flies to the rescue. It’s a truly piratical performance: with his flamboyantly fluttering fingers he steals every scene in the movie.