Goblin Army

The Goblin Army (also known as the Goblin Invasion and the Goblin Siege) is an event when unique Goblin enemies spawn and swarm the map's original spawn point. A Goblin invasion has a random chance of occurring at any particular dawn, if the criteria stated below are met, or it occurs when the player uses a Goblin Battle Standard to summon it. You can craft the Goblin Battle Standard with 10 Tattered Cloth and 5 Wood.

Criteria
The criteria for a goblin invasion to occur at all is as follows:
 * You must have at least one person in the game with 200+ current life.
 * You must have smashed at least one Shadow Orb or Demon Heart.
 * You must not have had an invasion within seven in-game days.

Chances

 * After the spawn criteria have been met, there will be a 1/3 chance every day for the army to first invade.
 * Further invasions (after the first has been defeated) have a 1/15 chance of occurring.
 * The Goblin invasion takes a higher priority than the Pirate Invasion, which can only occur when the Goblin invasion fails to do so.

Initial event
When a Goblin invasion is coming, a message will appear reading: "A Goblin Army is approaching from the [east/west]!"

This message repeats a few times (five times on a medium-sized world, &plusmn;1 for small/large worlds). The direction specified in this message only pertains to the initial wave of Goblins, which spawns at the World's edge and travels to the player's original spawn point. Additional waves spawn immediately within the player's original spawn area. If the message says "West", the Goblins will come from the left. If the message says "East", they'll arrive from the right. Note that these directions are not related to the apparent motion of the Sun and the Moon, which, in Terraria, appear to move from left ("west") to right ("east").

When the Goblin Army is about to begin spawning around the player's spawn point, the following message appears: A Goblin Army has arrived! and the theme music will switch to the "boss fight" theme.

Completing the event
The event is completed when the player(s) defeat all goblins in the army. The size of the army is based on the count and health of the players within the game. There will be 80 Goblins, plus an additional 40 for each player that has a maximum health of 200 or more. In single player, the army will consist of 120 goblins, while in an 8-player game, with each player having 200 HP or more, it will spawn 400 Goblins. With the maximum of 255 players above 200 health, the maximum number of goblins in an invasion is 10,280.

When the final wave of Goblins is on the screen, a message will appear saying A Goblin Army has been defeated!, and the theme music will return to normal after the last goblin is killed.

Contents
Other Goblins linked to the invasion:
 * Goblin Scout: An enemy Goblin that drops Tattered Cloth and spawns near the edges of the world. Tattered cloth can be collected and used to craft a Goblin Battle Standard, which is used to cause the invasion.
 * Goblin Tinkerer: A town NPC. Appears randomly as a bound goblin after the goblin army has been defeated.

Strategies

 * If you have the Vilethorn, you can simply remain in your house, barricade all doors with blocks (any type), and attack the Goblins as they come within range of your Vilethorn. You will be safe from all attacks except for the Goblin Sorcerer; however, they will always teleport close enough to hit with the Vilethorn anyway (even if not on their initial spawn), and the Vilethorn will also repel their projectiles easily.
 * On an open, flat space, you can easily deal with the fighters (they won't jump around and will be lined up for multiple hits) and help you get to the Sorcerer and dodge/destroy their projectiles more easily.
 * Dig a pit deep enough so the Goblin Army cannot jump out, and buy about 80 grenades. Toss the grenades into the pit, and use ranged weapons to take out the Goblin Sorcerers.
 * A more complex strategy requires several buckets of lava and a long, flat space. Choose a point roughly in the middle of this space; this is where you will stand during the invasion. On each side of this space, dig a trench 1 block deep and 10-12 blocks wide. Use the lava buckets to fill these trenches (one bucket for a twelve block trench is usually sufficient). After filling the trenches, test the lava depth by throwing a single copper coin into the lava. If your coin disappears, lengthen your trench by one block. Repeat the coin test until it no longer disintegrates in the lava. Now check if you have enough lava to cause damage; you can test this either with yourself (make sure you can survive 100 damage and burning) or by luring a monster in. Once your trenches are sufficiently filled, place two wooden platforms in the air several blocks above the trenches. Make sure you can see the entire platform from your center space! If your setup is correct, the goblin army will spawn offscreen and die harmlessly in your trenches; the Goblin Sorcerers will spawn on the wooden platforms, wide open for a ranged assault; and the entirety of the loot will be waiting for you to pick up from the traps.
 * It is possible to do the strategy above but without lava. All you need is a long flat surface and an elevated platform unreachable by any goblin. Assuming the Goblin Sorcerers do not spawn where you're standing, any ranged weapon and a fast swinging melee weapon should suffice to kill the majority. To make the job easier, collect the spiky balls that the Goblins drop to harm many Goblins at once.
 * If you have acquired the Minishark and a lot of Musket Balls then it is very easy to defeat the Goblin Army . Just build a wall behind you or stay on one side of the house (facing the edge of the screen) and just shoot . If there are no goblins on the screen then you can stop for a while until more goblins spawn. But then the only problems are Goblin Archers because they can still shoot you, and Goblin Sorcerer because they can shoot projectiles through walls. But Goblin Archers are vulnerable to knockback so you should be fine.
 * You can build a lava pit with much smaller dimensions, as well. Build an empty 5x5 room and put an extra block in each of the four corners.  Open up the top of the room by removing the three center blocks.  Drop a bucket of lava into the pit, and pick it up again - a small amount should remain.  Goblins that enter the pit will be unable to escape due to the overhang.  If you build two of these rooms and stand between them (below the mouth of the trap), only the Goblin Sorcerers will pose any threat to you, and the Vilethorn will make short work of them.  This design makes it easy to collect your loot: Just fall in and grapple out.
 * Collect the Spiky Balls the Goblin Army drops, then throw them all over the ground in the path of the Goblins. Each Spiky Ball will stay on the ground until it has hit 5 Goblins, effectively turning the walkway into a minefield.
 * If you find dealing with the goblin warriors difficult, make a wide pit and cover the top with wooden platforms. The warriors will fall down into the pit through the platforms, while other goblins will be able to walk on them. However, this strategy relies on a bug that is currently in the game.
 * If you have a series of Dart Traps and a one second or three second timer, you can barrage the enemies to death. Find a flat space larger than your screen and set up a column of three traps on each side of you and facing away from you.  Link them up with wires and a three second timer; then, you can activate the timer to create a zone of death. The occasional warrior will make it to you, but even sorcerers will be killed before they can teleport from their spawn towards you.
 * Fighting inside a tunnel lets you force the goblins to approach from a single direction, and it neutralizes the archers. (The archers' arrows are fired in an arc, hitting the ceiling before they reach you.)  Also, if the tunnel is buried in the ground, the sorcerers will be further away from you (giving you more time to deflect their shots) or will need to teleport to you.
 * Because the goblins will only continue to spawn at the map's original spawn point, building your home away from there may allow a player to avoid the army entirely, or until choosing to travel to it to fight.
 * If you make two holes at the edge of your screen then the goblins will not jump over them, but instead they will walk straight in. (See the picture.)