Pirate Invasion

The Pirate Invasion is a Hardmode event where Pirate enemies spawn and swarm the map's original spawn point. A Pirate Invasion can occur after certain conditions are met, or alternatively, when the player uses a Pirate Map, which has a chance of dropping from enemies killed within an Ocean biome.

For a single-player invasion, the player is required to kill 120 Pirates before the event is completed. This number increases with each additional player.

Defeating your first Pirate Invasion unlocks the Pirate NPC.

Criteria
The criteria for a random Pirate Invasion to occur is as follows: If the player fails to meet any of these requirements, they will also be unable to summon a Pirate Invasion by means of Pirate Map, either.
 * No other events are currently in progress.
 * The Wall of Flesh must have been defeated.
 * At least one Demon Altar or Crimson Altar must be destroyed.
 * The player must also have smashed a Shadow Orb or Crimson Heart and have 200 or more maximum life, the same requirements that apply to a Goblin Army, oddly enough.

Chances

 * First, the Goblin Army event must fail to occur. (59/60 chance)
 * Then, there is a 1/30 chance that the Pirates will invade that day if they haven't invaded yet, otherwise the chance is 1/50
 * The final probability comes out as 3.27% each morning for the first invasion and 1.96% for subsequent ones.
 * On average, you will get a random invasion about every 20 hours and 20 minutes of playing Terraria.
 * If, however, there is another invasion in progress, then there is no chance until the other invasion ends.

Initial event
When a Pirate Invasion spawns or is summoned using a Pirate Map, a message will appear saying that "Pirates are approaching from the (East/West)!"

The message will repeat several times until the Pirates reach the initial spawn of the world or any area of the world above the surface which has a nearby NPC. When the Pirates' initial wave reaches the spawn, their arrival is announced with "The Pirates have arrived!"

Flying Dutchman
During a Pirate Invasion, no matter if your world is in Expert or Normal, the Flying Dutchman will spawn. The Flying Dutchman is a bosslike enemy with four cannons on the side of the ship. In order to defeat the enemy, you must destroy the four cannons. Defeating the Flying Dutchman will not end the Pirate Invasion, though it is worth more than a single pirate towards the completion percentage. More than one of these enemies may spawn, but not at the same time, similar to the Martian Saucers.

Tips

 * Pirates are essentially a harder version of the Goblin Army. Many of the same tactics and preparations will still prove effective.
 * If fought while using a Flask of Gold, one can average between per event, thus making this one of the easiest ways to make money.
 * The Biome Keys for the Crimson, Corruption, Hallow, Jungle, and Frost Biome Chests can easily be obtained if you arrange for the pirates to fight you in that biome. One way to do so is to set up an artificial biome near the spawn point. The other is to simply go near your spawn point to trigger the invasion, then fly to an existing biome that has been prepared to handle an invasion.
 * Pirates themselves can drop Pirate Maps if fought within the Ocean biome.
 * Using Goblin Battle Standard in the Ocean can give you a few Pirate Maps with little effort.

Trivia

 * The pirates are some of the only human enemies in Terraria (aside from the Nymph, which initially appears as the Lost Girl, and as in 1.3.0.1, the Cultists and their leader, the Lunatic (Ancient) Cultist and the Tortured Soul.).