Pirate Invasion

The Pirate Invasion is a hardmode event where pirate themed 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.

Criteria
The criteria for a random Pirate Invasion to occur is as follows:
 * No other invasions are currently in progress.
 * The Wall of Flesh must have been defeated.
 * At least one Demon Altar or Crimson Altar must be destroyed.
 * At least one Shadow Orb or a Crimson Heart 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. When the Pirates' initial wave reaches the spawn, their arrival is announced with "The Pirates have arrived!" The music track "Boss 4" will then proceed to play as the players fight the pirates.

Pirates drop several kinds of loot; of particular note is the Cutlass, which has a high enough speed to outclass the Excalibur in DPS (damage per second). It is dropped by any pirate invasion creature but the parrot. Pirates also randomly drop Golden Tables, Golden Chairs and other golden pieces of furniture, as well as a pirate-themed vanity clothing set.

Completing the Event
Similar to a Goblin Invasion, you are required to defeat a large number of pirates in order to end the invasion. This may require the player(s) to kill many Pirate Captains. For a single-player invasion, the player is required to kill 120 Pirates before the event is completed, and this number increases with each additional player.

This is currently the Invasion rated for the highest-tier equipment in Terraria. Enemies have higher damage and defense than other invasions, but due to the limited AI, they might actually be easier than the goblin invasion for a weak but prepared player to overcome.

Defeating your first pirate invasion unlocks the Pirate NPC.

Trivia

 * The pirates are the only human enemies. (Besides the Nymph, which initially appears as the Lost Girl)

Strategies
If you want to face the pirates head-on you must be prepared. Defeating these pirates is not an easy feat for a fresh hardmode player. You will want to use weapons that pierces multiple enemies at once, such as the Shadowbeam Staff or the Magical Harp. Alternatively, you can make sure the pirates stay below you, with you on a wooden platform. Then use some kind of high-level Spear to slay the attackers. When a captain attacks, focus all of your attention on him, because he will stop attacking when attacked. If you have the Uzi, Flamethrower, or Minishark/Megashark it is good to continually fly over the pirates and shoot at them as it is hard for them to shoot you down.

Otherwise, you can make an anti-pirate special construction as pictured, which will prevent enemies from shooting at you. It is very effective and easy to build. It may be made of any stable block (so anything besides sand, silt and slush), but with some block types the Captain's cannonball still can hurt you. You will need ricochet ammo, such as Meteor bullets, or simply a bouncing or controllable spell, (Waterbolt, Rainbow Rod etc.) in order to deal damage.

The simplest and easiest way to face the pirate invasion is not to face them at all. Simply make a shallow lava pit for them to fry themselves upon, and let the lava do the work for you. Shown in this video. Lava in its shallowest state will allow you to loot drops. You can dig a passageway underneath the lava pit to collect the dropped loot. For an endgame player, Spiky Ball Traps hooked up to a 1 Second Timer will kill pirates as fast, if not faster, and can be easily turned off or moved, unlike lava.

Another way to face them is to completely enclose yourself with solid blocks, then use a Inferno Fork as the inferno will hurt the pirates through blocks. However, this requires that Plantera be defeated and the player has found an Inferno Fork. This is also possible with a Death Sickle, or a Nettle Burst, which can both pierce blocks. You could also leave your Minions outside of your hole and let them do the dirty work.

Surprisingly, Beenades used with Shroomite armor are very effective against a Pirate Invasion. Simply stand in an enclosed tunnel, and throw Beenades at any pirates trying to enter. A melee weapon is recommended for finishing off any stragglers that manage to make it in. Alternatively, stand on top of a platform out of reach of the pirates and drop Beenades down on them.

An easy way to deal with the Pirate Invasion is to dig a small 3-block tunnel with a 3-block wide pit next to it and then close it off. Mine the two blocks out starting from the ground up, then mine out the block directly above your head, and the block next to it so that you have 1 "floating" block right in front of your face. Just stand there and swing with any Broadsword-type weapon (Cutlass and Night's Edge work well). It is very unlikely you will get hit doing this, though sometimes parrots get hung up on nearby terrain and they will need to be killed separately after the Invasion is defeated.

For advanced hardmode players, a simple long, flat platform is yet another effective way to defeat the Pirate Invasion. With a weapon like the Stake Launcher, pirates can be killed simultaneously and with great ease as the Stakes fired by the Stake Launcher travel at high velocities and can pierce up to 10 enemies. Any swarm-type weapon (eg. Bat Scepter, Scourge of the Corruptor, etc.) will also make the invasion short work.

Another very simple strategy for early hardmode is make a straight upside corridor,fill it with ropes so you can stay clinged ,make two openings so the pirates can enter by the sides, put a shallow pit of lava so the drops don't burn and use a minishark with explosive ammo to finish the most resillient pirates.