It began when the widowed wife of the famous pirate, Captain Flynn married the king of the of the nation of Danville. Years later Captain Flynn's former first mate, Heinz Doofenshmirtz attacks the royal family to find the deceased captain's treasure map. Before her last breath the wife gives her son Phineas the map of his father. Along with his step brother Ferb Fletcher, and a young crew, Phineas goes on a journey to claim his birthright, followed by Captain Doofenshmirtz. Meanwhile Phineas' sister Candace who inherited the throne, is disgusted by her family heritage, and seeks to clean her name by sending her navy soldiers to kill Phineas and finding the treasure.