Having looked at a few games' source code, are there really any complex games with pretty code? With as many subsystems, items, and enemies as Terraria has, it feels almost inevitable that you'll have complexity like this snippet for determining when to spawn the hair stylist NPC:
else if ((int) Main.tile[index1, y].wall == SpiderUnsafe | flag10)
{
if ((int) Main.tile[index1, y].wall == SpiderUnsafe && Main.rand.Next(8) == 0 && (!flag6 && (double) y >= Main.rockLayer) && (y < Main.maxTilesY - 210 && !NPC.savedStylist && !NPC.AnyNPCs(WebbedStylist)))
NPC.NewNPC(index1 \* 16 + 8, y \* 16, WebbedStylist, 0, 0.0f, 0.0f, 0.0f, 0.0f, (int) byte.MaxValue);
else if (Main.hardMode)
NPC.NewNPC(index1 \* 16 + 8, y \* 16, BlackRecluse, 0, 0.0f, 0.0f, 0.0f, 0.0f, (int) byte.MaxValue);
else
NPC.NewNPC(index1 \* 16 + 8, y \* 16, WallCreeper, 0, 0.0f, 0.0f, 0.0f, 0.0f, (int) byte.MaxValue);
}