Pirate Invasion

The Pirate Invasion is an event when 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.
 * A Pirate Invasion has been defeated through the use of a Pirate Map.

Chances

 * A Goblin Army invasion is contemplated first and must fail to occur. (98.33% chance)
 * The Pirates then contemplate their own invasion. (1.67% chance)
 * The probability of both outcomes occurring is 1.64% each morning.

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

Pirates drop all kinds of loot like the Cutlass. The Cutlass is a sword that does 52 base damage, hits really fast and is dropped by the Pirate Captain. Pirates randomly drop Golden Tables, Golden Chairs and other golden pieces of furniture.

Completing the Event
Defeating your first pirate invasion unlocks the Pirate NPC.

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. This is currently the most difficult Invasion in Terraria.

Types of Pirates
The crew will be made up of the following Pirate types:
 * Pirate Deckhand: A basic fighter-type Pirate that functions somewhat like a Goblin Peon.
 * Pirate Deadeye: An enemy who is very basic, and is basically just the Deckhand with a gun.
 * Pirate Corsair: A faster, stronger version of the Deckhand that carries the Cutlass.
 * Pirate Crossbower: A Pirate enemy who carries a crossbow that resembles the repeaters a player can craft in Hardmode.
 * Pirate Captain: The strongest enemy you will fight during the event. He has 2000 HP and walks towards you normally until you enter his range. When you enter his general area, he will start to fire on you with a machine gun. Once attacked, he ceases his fire, so it is recommended to keep your fire trained on him. He has a chance of shooting cannonballs, so be careful.
 * Parrot: A flying enemy that seems to spawn near the Captain and deals considerable amounts of damage, especially with its ability to fly.

Most Pirates are capable of opening and/or breaking down your Doors. A broken-down door appears as a dropped item which you can pick up and place again.

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 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 Anti-pirate special construction, which will prevent enemies to shoot at you. It is very effective and easy to build, may be made of any stable block (any, but sand,silt and slush), but sometimes Captain's cannonball still can hurt you. Note, that you will need any ricochet ammo, like Meteor bullets in order to deal a damage.

You can also use a simple lowered area with a lava base (shallow enough lava not to destroy the dropped items/coins), since none of the enemies have the ability to teleport. Shown in this video.