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:
 * 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.

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.
 * 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!" The music track "Golem" will then proceed to play as the players fight the pirates.

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 Key Molds 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.

Trivia

 * The pirates are the only human enemies in Terraria (aside from the Nymph, which initially appears as the Lost Girl).