terraria-source-code/Terraria/NPC.cs
TheVamp 0462173018 Version 1.2.0.3.1
Decompiled with IlSpy
Fixes Source Code
2013-10-12 11:25:17 +02:00

40617 lines
2.1 MiB

using Microsoft.Xna.Framework;
using System;
namespace Terraria
{
public class NPC
{
public const int maxBuffs = 5;
public float teleportTime;
public static int immuneTime = 20;
public static int maxAI = 4;
public int netSpam;
public static bool noStream = false;
private static int spawnSpaceX = 3;
private static int spawnSpaceY = 3;
public float gfxOffY;
public float stepSpeed;
private static float gravity = 0.3f;
public bool teleporting;
private static int maxAttack = 20;
private static int[] attackNPC = new int[NPC.maxAttack];
private byte netStream;
private byte[] streamPlayer = new byte[255];
public Vector2[] oldPos = new Vector2[10];
public bool setFrameSize;
public static int golemBoss = -1;
public static int plantBoss = -1;
public static int crimsonBoss = -1;
public int netSkip;
public bool netAlways;
public int realLife = -1;
public static int sWidth = 1920;
public static int sHeight = 1080;
private static int spawnRangeX = (int)((double)(NPC.sWidth / 16) * 0.7);
private static int spawnRangeY = (int)((double)(NPC.sHeight / 16) * 0.7);
public static int safeRangeX = (int)((double)(NPC.sWidth / 16) * 0.52);
public static int safeRangeY = (int)((double)(NPC.sHeight / 16) * 0.52);
private static int activeRangeX = (int)((double)NPC.sWidth * 2.1);
private static int activeRangeY = (int)((double)NPC.sHeight * 2.1);
private static int townRangeX = NPC.sWidth;
private static int townRangeY = NPC.sHeight;
public float npcSlots = 1f;
private static bool noSpawnCycle = false;
private static int activeTime = 750;
private static int defaultSpawnRate = 600;
private static int defaultMaxSpawns = 5;
public bool wet;
public bool honeyWet;
public byte wetCount;
public bool lavaWet;
public int[] buffType = new int[5];
public int[] buffTime = new int[5];
public bool[] buffImmune = new bool[81];
public bool midas;
public bool ichor;
public bool onFire;
public bool onFire2;
public bool onFrostBurn;
public bool poisoned;
public bool venom;
public int lifeRegen;
public int lifeRegenCount;
public bool confused;
public static bool downedBoss1 = false;
public static bool downedBoss2 = false;
public static bool downedBoss3 = false;
public static bool downedQueenBee = false;
public static bool savedGoblin = false;
public static bool savedWizard = false;
public static bool savedMech = false;
public static bool downedGoblins = false;
public static bool downedFrost = false;
public static bool downedPirates = false;
public static bool downedClown = false;
public static bool downedPlantBoss = false;
public static bool downedGolemBoss = false;
public static bool downedMechBossAny = false;
public static bool downedMechBoss1 = false;
public static bool downedMechBoss2 = false;
public static bool downedMechBoss3 = false;
private static int spawnRate = NPC.defaultSpawnRate;
private static int maxSpawns = NPC.defaultMaxSpawns;
public int soundDelay;
public Vector2 position;
public Vector2 velocity;
public Vector2 oldPosition;
public Vector2 oldVelocity;
public int width;
public int height;
public bool active;
public int[] immune = new int[256];
public int direction = 1;
public int directionY = 1;
public int type;
public float[] ai = new float[NPC.maxAI];
public float[] localAI = new float[NPC.maxAI];
public int aiAction;
public int aiStyle;
public bool justHit;
public int timeLeft;
public int target = -1;
public int damage;
public int defense;
public int defDamage;
public int defDefense;
public int soundHit;
public int soundKilled;
public int life;
public int lifeMax;
public Rectangle targetRect;
public double frameCounter;
public Rectangle frame;
public string name;
public string displayName;
public Color color;
public int alpha;
public float scale = 1f;
public float knockBackResist = 1f;
public int oldDirection;
public int oldDirectionY;
public int oldTarget;
public int whoAmI;
public float rotation;
public bool noGravity;
public bool noTileCollide;
public bool netUpdate;
public bool netUpdate2;
public bool collideX;
public bool collideY;
public bool boss;
public int spriteDirection = -1;
public bool behindTiles;
public bool lavaImmune;
public float value;
public bool dontTakeDamage;
public int netID;
public bool townNPC;
public bool homeless;
public int homeTileX = -1;
public int homeTileY = -1;
public bool oldHomeless;
public int oldHomeTileX = -1;
public int oldHomeTileY = -1;
public bool friendly;
public bool closeDoor;
public int doorX;
public int doorY;
public int friendlyRegen;
public static void clrNames()
{
for (int i = 0; i < 301; i++)
{
Main.chrName[i] = "";
}
}
public static void setNames()
{
if (WorldGen.genRand == null)
{
WorldGen.genRand = new Random();
}
int num = WorldGen.genRand.Next(24);
string text;
if (num == 0)
{
text = "Molly";
}
else
{
if (num == 1)
{
text = "Amy";
}
else
{
if (num == 2)
{
text = "Claire";
}
else
{
if (num == 3)
{
text = "Emily";
}
else
{
if (num == 4)
{
text = "Katie";
}
else
{
if (num == 5)
{
text = "Madeline";
}
else
{
if (num == 6)
{
text = "Katelyn";
}
else
{
if (num == 7)
{
text = "Emma";
}
else
{
if (num == 8)
{
text = "Abigail";
}
else
{
if (num == 9)
{
text = "Carly";
}
else
{
if (num == 10)
{
text = "Jenna";
}
else
{
if (num == 11)
{
text = "Heather";
}
else
{
if (num == 12)
{
text = "Katherine";
}
else
{
if (num == 13)
{
text = "Caitlin";
}
else
{
if (num == 14)
{
text = "Kaitlin";
}
else
{
if (num == 15)
{
text = "Holly";
}
else
{
if (num == 16)
{
text = "Kaitlyn";
}
else
{
if (num == 17)
{
text = "Hannah";
}
else
{
if (num == 18)
{
text = "Kathryn";
}
else
{
if (num == 19)
{
text = "Lorraine";
}
else
{
if (num == 20)
{
text = "Helen";
}
else
{
if (num == 21)
{
text = "Kayla";
}
else
{
if (num == 22)
{
text = "Lisa";
}
else
{
text = "Allison";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[18] == "")
{
Main.chrName[18] = text;
}
num = WorldGen.genRand.Next(24);
if (num == 0)
{
text = "Shayna";
}
else
{
if (num == 1)
{
text = "Korrie";
}
else
{
if (num == 2)
{
text = "Ginger";
}
else
{
if (num == 3)
{
text = "Brooke";
}
else
{
if (num == 4)
{
text = "Jenny";
}
else
{
if (num == 5)
{
text = "Autumn";
}
else
{
if (num == 6)
{
text = "Nancy";
}
else
{
if (num == 7)
{
text = "Ella";
}
else
{
if (num == 8)
{
text = "Kayla";
}
else
{
if (num == 9)
{
text = "Selah";
}
else
{
if (num == 10)
{
text = "Sophia";
}
else
{
if (num == 11)
{
text = "Marshanna";
}
else
{
if (num == 12)
{
text = "Lauren";
}
else
{
if (num == 13)
{
text = "Trisha";
}
else
{
if (num == 14)
{
text = "Shirlena";
}
else
{
if (num == 15)
{
text = "Sheena";
}
else
{
if (num == 16)
{
text = "Ellen";
}
else
{
if (num == 17)
{
text = "Amy";
}
else
{
if (num == 18)
{
text = "Dawn";
}
else
{
if (num == 19)
{
text = "Susana";
}
else
{
if (num == 20)
{
text = "Meredith";
}
else
{
if (num == 21)
{
text = "Selene";
}
else
{
if (num == 22)
{
text = "Terra";
}
else
{
text = "Sally";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[124] == "")
{
Main.chrName[124] = text;
}
num = WorldGen.genRand.Next(24);
if (num == 0)
{
text = "DeShawn";
}
else
{
if (num == 1)
{
text = "DeAndre";
}
else
{
if (num == 2)
{
text = "Marquis";
}
else
{
if (num == 3)
{
text = "Darnell";
}
else
{
if (num == 4)
{
text = "Terrell";
}
else
{
if (num == 5)
{
text = "Malik";
}
else
{
if (num == 6)
{
text = "Trevon";
}
else
{
if (num == 7)
{
text = "Tyrone";
}
else
{
if (num == 8)
{
text = "Willie";
}
else
{
if (num == 9)
{
text = "Dominique";
}
else
{
if (num == 10)
{
text = "Demetrius";
}
else
{
if (num == 11)
{
text = "Reginald";
}
else
{
if (num == 12)
{
text = "Jamal";
}
else
{
if (num == 13)
{
text = "Maurice";
}
else
{
if (num == 14)
{
text = "Jalen";
}
else
{
if (num == 15)
{
text = "Darius";
}
else
{
if (num == 16)
{
text = "Xavier";
}
else
{
if (num == 17)
{
text = "Terrance";
}
else
{
if (num == 18)
{
text = "Andre";
}
else
{
if (num == 19)
{
text = "Dante";
}
else
{
if (num == 20)
{
text = "Brimst";
}
else
{
if (num == 21)
{
text = "Bronson";
}
else
{
if (num == 22)
{
text = "Tony";
}
else
{
text = "Darryl";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[19] == "")
{
Main.chrName[19] = text;
}
num = WorldGen.genRand.Next(35);
if (num == 0)
{
text = "Joe";
}
else
{
if (num == 1)
{
text = "Connor";
}
else
{
if (num == 2)
{
text = "Tanner";
}
else
{
if (num == 3)
{
text = "Wyatt";
}
else
{
if (num == 4)
{
text = "Cody";
}
else
{
if (num == 5)
{
text = "Levi";
}
else
{
if (num == 6)
{
text = "Luke";
}
else
{
if (num == 7)
{
text = "Jack";
}
else
{
if (num == 8)
{
text = "Scott";
}
else
{
if (num == 9)
{
text = "Logan";
}
else
{
if (num == 10)
{
text = "Cole";
}
else
{
if (num == 11)
{
text = "Asher";
}
else
{
if (num == 12)
{
text = "Bradley";
}
else
{
if (num == 13)
{
text = "Jacob";
}
else
{
if (num == 14)
{
text = "Garrett";
}
else
{
if (num == 15)
{
text = "Dylan";
}
else
{
if (num == 16)
{
text = "Maxwell";
}
else
{
if (num == 17)
{
text = "Steve";
}
else
{
if (num == 18)
{
text = "Brett";
}
else
{
if (num == 19)
{
text = "Andrew";
}
else
{
if (num == 20)
{
text = "Harley";
}
else
{
if (num == 21)
{
text = "Kyle";
}
else
{
if (num == 22)
{
text = "Jake";
}
else
{
if (num == 23)
{
text = "Ryan";
}
else
{
if (num == 24)
{
text = "Jeffrey";
}
else
{
if (num == 25)
{
text = "Seth";
}
else
{
if (num == 26)
{
text = "Marty";
}
else
{
if (num == 27)
{
text = "Brandon";
}
else
{
if (num == 28)
{
text = "Zach";
}
else
{
if (num == 29)
{
text = "Jeff";
}
else
{
if (num == 30)
{
text = "Daniel";
}
else
{
if (num == 31)
{
text = "Trent";
}
else
{
if (num == 32)
{
text = "Kevin";
}
else
{
if (num == 33)
{
text = "Brian";
}
else
{
text = "Colin";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[22] == "")
{
Main.chrName[22] = text;
}
num = WorldGen.genRand.Next(22);
if (num == 0)
{
text = "Alalia";
}
else
{
if (num == 1)
{
text = "Alalia";
}
else
{
if (num == 2)
{
text = "Alura";
}
else
{
if (num == 3)
{
text = "Ariella";
}
else
{
if (num == 4)
{
text = "Caelia";
}
else
{
if (num == 5)
{
text = "Calista";
}
else
{
if (num == 6)
{
text = "Chryseis";
}
else
{
if (num == 7)
{
text = "Emerenta";
}
else
{
if (num == 8)
{
text = "Elysia";
}
else
{
if (num == 9)
{
text = "Evvie";
}
else
{
if (num == 10)
{
text = "Faye";
}
else
{
if (num == 11)
{
text = "Felicitae";
}
else
{
if (num == 12)
{
text = "Lunette";
}
else
{
if (num == 13)
{
text = "Nata";
}
else
{
if (num == 14)
{
text = "Nissa";
}
else
{
if (num == 15)
{
text = "Tatiana";
}
else
{
if (num == 16)
{
text = "Rosalva";
}
else
{
if (num == 17)
{
text = "Shea";
}
else
{
if (num == 18)
{
text = "Tania";
}
else
{
if (num == 19)
{
text = "Isis";
}
else
{
if (num == 20)
{
text = "Celestia";
}
else
{
text = "Xylia";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[20] == "")
{
Main.chrName[20] = text;
}
num = WorldGen.genRand.Next(22);
if (num == 0)
{
text = "Dolbere";
}
else
{
if (num == 1)
{
text = "Bazdin";
}
else
{
if (num == 2)
{
text = "Durim";
}
else
{
if (num == 3)
{
text = "Tordak";
}
else
{
if (num == 4)
{
text = "Garval";
}
else
{
if (num == 5)
{
text = "Morthal";
}
else
{
if (num == 6)
{
text = "Oten";
}
else
{
if (num == 7)
{
text = "Dolgen";
}
else
{
if (num == 8)
{
text = "Gimli";
}
else
{
if (num == 9)
{
text = "Gimut";
}
else
{
if (num == 10)
{
text = "Duerthen";
}
else
{
if (num == 11)
{
text = "Beldin";
}
else
{
if (num == 12)
{
text = "Jarut";
}
else
{
if (num == 13)
{
text = "Ovbere";
}
else
{
if (num == 14)
{
text = "Norkas";
}
else
{
if (num == 15)
{
text = "Dolgrim";
}
else
{
if (num == 16)
{
text = "Boften";
}
else
{
if (num == 17)
{
text = "Norsun";
}
else
{
if (num == 18)
{
text = "Dias";
}
else
{
if (num == 19)
{
text = "Fikod";
}
else
{
if (num == 20)
{
text = "Urist";
}
else
{
text = "Darur";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[38] == "")
{
Main.chrName[38] = text;
}
num = WorldGen.genRand.Next(21);
if (num == 0)
{
text = "Dalamar";
}
else
{
if (num == 1)
{
text = "Dulais";
}
else
{
if (num == 2)
{
text = "Elric";
}
else
{
if (num == 3)
{
text = "Arddun";
}
else
{
if (num == 4)
{
text = "Maelor";
}
else
{
if (num == 5)
{
text = "Leomund";
}
else
{
if (num == 6)
{
text = "Hirael";
}
else
{
if (num == 7)
{
text = "Gwentor";
}
else
{
if (num == 8)
{
text = "Greum";
}
else
{
if (num == 9)
{
text = "Gearroid";
}
else
{
if (num == 10)
{
text = "Fizban";
}
else
{
if (num == 11)
{
text = "Ningauble";
}
else
{
if (num == 12)
{
text = "Seonag";
}
else
{
if (num == 13)
{
text = "Sargon";
}
else
{
if (num == 14)
{
text = "Merlyn";
}
else
{
if (num == 15)
{
text = "Magius";
}
else
{
if (num == 16)
{
text = "Berwyn";
}
else
{
if (num == 17)
{
text = "Arwyn";
}
else
{
if (num == 18)
{
text = "Alasdair";
}
else
{
if (num == 19)
{
text = "Tagar";
}
else
{
text = "Xanadu";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[108] == "")
{
Main.chrName[108] = text;
}
num = WorldGen.genRand.Next(23);
if (num == 0)
{
text = "Alfred";
}
else
{
if (num == 1)
{
text = "Barney";
}
else
{
if (num == 2)
{
text = "Calvin";
}
else
{
if (num == 3)
{
text = "Edmund";
}
else
{
if (num == 4)
{
text = "Edwin";
}
else
{
if (num == 5)
{
text = "Eugene";
}
else
{
if (num == 6)
{
text = "Frank";
}
else
{
if (num == 7)
{
text = "Frederick";
}
else
{
if (num == 8)
{
text = "Gilbert";
}
else
{
if (num == 9)
{
text = "Gus";
}
else
{
if (num == 10)
{
text = "Wilbur";
}
else
{
if (num == 11)
{
text = "Seymour";
}
else
{
if (num == 12)
{
text = "Louis";
}
else
{
if (num == 13)
{
text = "Humphrey";
}
else
{
if (num == 14)
{
text = "Harold";
}
else
{
if (num == 15)
{
text = "Milton";
}
else
{
if (num == 16)
{
text = "Mortimer";
}
else
{
if (num == 17)
{
text = "Howard";
}
else
{
if (num == 18)
{
text = "Walter";
}
else
{
if (num == 19)
{
text = "Finn";
}
else
{
if (num == 20)
{
text = "Isacc";
}
else
{
if (num == 21)
{
text = "Joseph";
}
else
{
text = "Ralph";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[17] == "")
{
Main.chrName[17] = text;
}
num = WorldGen.genRand.Next(24);
if (num == 0)
{
text = "Sebastian";
}
else
{
if (num == 1)
{
text = "Rupert";
}
else
{
if (num == 2)
{
text = "Clive";
}
else
{
if (num == 3)
{
text = "Nigel";
}
else
{
if (num == 4)
{
text = "Mervyn";
}
else
{
if (num == 5)
{
text = "Cedric";
}
else
{
if (num == 6)
{
text = "Pip";
}
else
{
if (num == 7)
{
text = "Cyril";
}
else
{
if (num == 8)
{
text = "Fitz";
}
else
{
if (num == 9)
{
text = "Lloyd";
}
else
{
if (num == 10)
{
text = "Arthur";
}
else
{
if (num == 11)
{
text = "Rodney";
}
else
{
if (num == 12)
{
text = "Graham";
}
else
{
if (num == 13)
{
text = "Edward";
}
else
{
if (num == 14)
{
text = "Alfred";
}
else
{
if (num == 15)
{
text = "Edmund";
}
else
{
if (num == 16)
{
text = "Henry";
}
else
{
if (num == 17)
{
text = "Herald";
}
else
{
if (num == 18)
{
text = "Roland";
}
else
{
if (num == 19)
{
text = "Lincoln";
}
else
{
if (num == 20)
{
text = "Lloyd";
}
else
{
if (num == 21)
{
text = "Edgar";
}
else
{
if (num == 22)
{
text = "Eustace";
}
else
{
text = "Rodrick";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[54] == "")
{
Main.chrName[54] = text;
}
num = WorldGen.genRand.Next(25);
if (num == 0)
{
text = "Grodax";
}
else
{
if (num == 1)
{
text = "Sarx";
}
else
{
if (num == 2)
{
text = "Xon";
}
else
{
if (num == 3)
{
text = "Mrunok";
}
else
{
if (num == 4)
{
text = "Nuxatk";
}
else
{
if (num == 5)
{
text = "Tgerd";
}
else
{
if (num == 6)
{
text = "Darz";
}
else
{
if (num == 7)
{
text = "Smador";
}
else
{
if (num == 8)
{
text = "Stazen";
}
else
{
if (num == 9)
{
text = "Mobart";
}
else
{
if (num == 10)
{
text = "Knogs";
}
else
{
if (num == 11)
{
text = "Tkanus";
}
else
{
if (num == 12)
{
text = "Negurk";
}
else
{
if (num == 13)
{
text = "Nort";
}
else
{
if (num == 14)
{
text = "Durnok";
}
else
{
if (num == 15)
{
text = "Trogem";
}
else
{
if (num == 16)
{
text = "Stezom";
}
else
{
if (num == 17)
{
text = "Gnudar";
}
else
{
if (num == 18)
{
text = "Ragz";
}
else
{
if (num == 19)
{
text = "Fahd";
}
else
{
if (num == 20)
{
text = "Xanos";
}
else
{
if (num == 21)
{
text = "Arback";
}
else
{
if (num == 22)
{
text = "Fjell";
}
else
{
if (num == 23)
{
text = "Dalek";
}
else
{
text = "Knub";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[107] == "")
{
Main.chrName[107] = text;
}
num = WorldGen.genRand.Next(12);
if (num == 0)
{
text = "Reishi";
}
else
{
if (num == 1)
{
text = "Maitake";
}
else
{
if (num == 2)
{
text = "Chanterelle";
}
else
{
if (num == 3)
{
text = "Porcini";
}
else
{
if (num == 4)
{
text = "Shimeji";
}
else
{
if (num == 5)
{
text = "Amanita";
}
else
{
if (num == 6)
{
text = "Muscaria";
}
else
{
if (num == 7)
{
text = "Agaric";
}
else
{
if (num == 8)
{
text = "Cremini";
}
else
{
if (num == 9)
{
text = "Morel";
}
else
{
if (num == 10)
{
text = "Enoki";
}
else
{
text = "Shiitake";
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[160] == "")
{
Main.chrName[160] = text;
}
num = WorldGen.genRand.Next(20);
if (num == 0)
{
text = "Whitney";
}
else
{
if (num == 1)
{
text = "Verity";
}
else
{
if (num == 2)
{
text = "Ada";
}
else
{
if (num == 3)
{
text = "Cornelia";
}
else
{
if (num == 4)
{
text = "Lydia";
}
else
{
if (num == 5)
{
text = "Leila";
}
else
{
if (num == 6)
{
text = "Minerva";
}
else
{
if (num == 7)
{
text = "Emeline";
}
else
{
if (num == 8)
{
text = "Cynthia";
}
else
{
if (num == 9)
{
text = "Fidelia";
}
else
{
if (num == 10)
{
text = "Lilly";
}
else
{
if (num == 11)
{
text = "Phoebe";
}
else
{
if (num == 12)
{
text = "Zylphia";
}
else
{
if (num == 13)
{
text = "Zelda";
}
else
{
if (num == 14)
{
text = "Selina";
}
else
{
if (num == 15)
{
text = "Hope";
}
else
{
if (num == 16)
{
text = "Isabella";
}
else
{
if (num == 17)
{
text = "Judith";
}
else
{
if (num == 18)
{
text = "Savannah";
}
else
{
text = "Vivian";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[178] == "")
{
Main.chrName[178] = text;
}
num = WorldGen.genRand.Next(16);
if (num == 0)
{
text = "Abdosir";
}
else
{
if (num == 1)
{
text = "Akbar";
}
else
{
if (num == 2)
{
text = "Bodashtart";
}
else
{
if (num == 3)
{
text = "Danel";
}
else
{
if (num == 4)
{
text = "Hanno";
}
else
{
if (num == 5)
{
text = "Hiram";
}
else
{
if (num == 6)
{
text = "Kanmi";
}
else
{
if (num == 7)
{
text = "Philosir";
}
else
{
if (num == 8)
{
text = "Tabnit";
}
else
{
if (num == 9)
{
text = "Yutpan";
}
else
{
if (num == 10)
{
text = "Ahirom";
}
else
{
if (num == 11)
{
text = "Batnoam";
}
else
{
if (num == 12)
{
text = "Sikarbaal";
}
else
{
if (num == 13)
{
text = "Hannibal";
}
else
{
if (num == 14)
{
text = "Yehomilk";
}
else
{
text = "Ahinadab";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[207] == "")
{
Main.chrName[207] = text;
}
num = WorldGen.genRand.Next(18);
if (num == 0)
{
text = "Candy";
}
else
{
if (num == 1)
{
text = "Roxanne";
}
else
{
if (num == 2)
{
text = "Trixy";
}
else
{
if (num == 3)
{
text = "Destiny";
}
else
{
if (num == 4)
{
text = "Lexus";
}
else
{
if (num == 5)
{
text = "Bambi";
}
else
{
if (num == 6)
{
text = "Bailey";
}
else
{
if (num == 7)
{
text = "Glitter";
}
else
{
if (num == 8)
{
text = "Sparkle";
}
else
{
if (num == 9)
{
text = "Paris";
}
else
{
if (num == 10)
{
text = "Dazzle";
}
else
{
if (num == 11)
{
text = "Fantasy";
}
else
{
if (num == 12)
{
text = "Bunny";
}
else
{
if (num == 13)
{
text = "Sugar";
}
else
{
if (num == 14)
{
text = "Fantasia";
}
else
{
if (num == 15)
{
text = "Star";
}
else
{
if (num == 16)
{
text = "Isis";
}
else
{
text = "Cherry";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[208] == "")
{
Main.chrName[208] = text;
}
num = WorldGen.genRand.Next(23);
if (num == 0)
{
text = "Alpha";
}
else
{
if (num == 1)
{
text = "Beta";
}
else
{
if (num == 2)
{
text = "Delta";
}
else
{
if (num == 3)
{
text = "Omega";
}
else
{
if (num == 4)
{
text = "Gamma";
}
else
{
if (num == 5)
{
text = "Theta";
}
else
{
if (num == 6)
{
text = "Kappa";
}
else
{
if (num == 7)
{
text = "Omicron";
}
else
{
if (num == 8)
{
text = "Sigma";
}
else
{
if (num == 9)
{
text = "Upsilon";
}
else
{
if (num == 10)
{
text = "Phi";
}
else
{
if (num == 11)
{
text = "Zeta";
}
else
{
if (num == 12)
{
text = "Lambda";
}
else
{
if (num == 13)
{
text = "Nu";
}
else
{
if (num == 14)
{
text = "Ci";
}
else
{
if (num == 15)
{
text = "Rho";
}
else
{
if (num == 16)
{
text = "Phi";
}
else
{
if (num == 17)
{
text = "Fender";
}
else
{
if (num == 18)
{
text = "T-3E0";
}
else
{
if (num == 19)
{
text = "Niner-7";
}
else
{
if (num == 20)
{
text = "A.N.D.Y";
}
else
{
if (num == 21)
{
text = "Syn-X";
}
else
{
text = "Mu";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[209] == "")
{
Main.chrName[209] = text;
}
num = WorldGen.genRand.Next(17);
if (num == 0)
{
text = "Marco";
}
else
{
if (num == 1)
{
text = "Guido";
}
else
{
if (num == 2)
{
text = "Enzo";
}
else
{
if (num == 3)
{
text = "Martino";
}
else
{
if (num == 4)
{
text = "Mauro";
}
else
{
if (num == 5)
{
text = "Lorenzo";
}
else
{
if (num == 6)
{
text = "Ludo";
}
else
{
if (num == 7)
{
text = "Luciano";
}
else
{
if (num == 8)
{
text = "Carlo";
}
else
{
if (num == 9)
{
text = "Bruno";
}
else
{
if (num == 10)
{
text = "Mario";
}
else
{
if (num == 11)
{
text = "Leonardo";
}
else
{
if (num == 12)
{
text = "Raphael";
}
else
{
if (num == 13)
{
text = "Luigi";
}
else
{
if (num == 14)
{
text = "Luca";
}
else
{
if (num == 15)
{
text = "Darren";
}
else
{
text = "Stefano";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[227] == "")
{
Main.chrName[227] = text;
}
num = WorldGen.genRand.Next(10);
if (num == 0)
{
text = "Abibe";
}
else
{
if (num == 1)
{
text = "Jamundi";
}
else
{
if (num == 2)
{
text = "U'wa";
}
else
{
if (num == 3)
{
text = "Tairona";
}
else
{
if (num == 4)
{
text = "Xirigua";
}
else
{
if (num == 5)
{
text = "Zop'a";
}
else
{
if (num == 6)
{
text = "Opuni";
}
else
{
if (num == 7)
{
text = "Kogi-ghi";
}
else
{
if (num == 8)
{
text = "Konah";
}
else
{
text = "Gboto";
}
}
}
}
}
}
}
}
}
if (Main.chrName[228] == "")
{
Main.chrName[228] = text;
}
num = WorldGen.genRand.Next(11);
if (num == 0)
{
text = "David";
}
else
{
if (num == 1)
{
text = "Red Beard";
}
else
{
if (num == 2)
{
text = "Jack";
}
else
{
if (num == 3)
{
text = "Black Beard";
}
else
{
if (num == 4)
{
text = "Captain Morgan";
}
else
{
if (num == 5)
{
text = "Wet Beard";
}
else
{
if (num == 6)
{
text = "James T. Beard";
}
else
{
if (num == 7)
{
text = "Gunpowder Garry";
}
else
{
if (num == 8)
{
text = "Captain Stoney Dirt";
}
else
{
if (num == 9)
{
text = "Jake";
}
else
{
text = "Captain Bullywort";
}
}
}
}
}
}
}
}
}
}
if (Main.chrName[229] == "")
{
Main.chrName[229] = text;
}
}
public void netDefaults(int type)
{
if (type < 0)
{
if (type == -1)
{
this.SetDefaults("Slimeling");
return;
}
if (type == -2)
{
this.SetDefaults("Slimer2");
return;
}
if (type == -3)
{
this.SetDefaults("Green Slime");
return;
}
if (type == -4)
{
this.SetDefaults("Pinky");
return;
}
if (type == -5)
{
this.SetDefaults("Baby Slime");
return;
}
if (type == -6)
{
this.SetDefaults("Black Slime");
return;
}
if (type == -7)
{
this.SetDefaults("Purple Slime");
return;
}
if (type == -8)
{
this.SetDefaults("Red Slime");
return;
}
if (type == -9)
{
this.SetDefaults("Yellow Slime");
return;
}
if (type == -10)
{
this.SetDefaults("Jungle Slime");
return;
}
if (type == -11)
{
this.SetDefaults("Little Eater");
return;
}
if (type == -12)
{
this.SetDefaults("Big Eater");
return;
}
if (type == -13)
{
this.SetDefaults("Short Bones");
return;
}
if (type == -14)
{
this.SetDefaults("Big Boned");
return;
}
if (type == -15)
{
this.SetDefaults("Heavy Skeleton");
return;
}
if (type == -16)
{
this.SetDefaults("Little Stinger");
return;
}
if (type == -17)
{
this.SetDefaults("Big Stinger");
return;
}
if (type == -18)
{
this.SetDefaults("Tiny Moss Hornet");
return;
}
if (type == -19)
{
this.SetDefaults("Little Moss Hornet");
return;
}
if (type == -20)
{
this.SetDefaults("Big Moss Hornet");
return;
}
if (type == -21)
{
this.SetDefaults("Giant Moss Hornet");
return;
}
if (type == -22)
{
this.SetDefaults("Little Crimera");
return;
}
if (type == -23)
{
this.SetDefaults("Big Crimera");
return;
}
if (type == -24)
{
this.SetDefaults("Little Crimslime");
return;
}
if (type == -25)
{
this.SetDefaults("Big Crimslime");
return;
}
if (type == -26)
{
this.SetDefaults("Small Zombie");
return;
}
if (type == -27)
{
this.SetDefaults("Big Zombie");
return;
}
if (type == -28)
{
this.SetDefaults("Small Bald Zombie");
return;
}
if (type == -29)
{
this.SetDefaults("Big Bald Zombie");
return;
}
if (type == -30)
{
this.SetDefaults("Small Pincushion Zombie");
return;
}
if (type == -31)
{
this.SetDefaults("Big Pincushion Zombie");
return;
}
if (type == -32)
{
this.SetDefaults("Small Slimed Zombie");
return;
}
if (type == -33)
{
this.SetDefaults("Big Slimed Zombie");
return;
}
if (type == -34)
{
this.SetDefaults("Small Swamp Zombie");
return;
}
if (type == -35)
{
this.SetDefaults("Big Swamp Zombie");
return;
}
if (type == -36)
{
this.SetDefaults("Small Twiggy Zombie");
return;
}
if (type == -37)
{
this.SetDefaults("Big Twiggy Zombie");
return;
}
if (type == -38)
{
this.SetDefaults("Cataract Eye 2");
return;
}
if (type == -39)
{
this.SetDefaults("Sleepy Eye 2");
return;
}
if (type == -40)
{
this.SetDefaults("Dialated Eye 2");
return;
}
if (type == -41)
{
this.SetDefaults("Green Eye 2");
return;
}
if (type == -42)
{
this.SetDefaults("Purple Eye 2");
return;
}
if (type == -43)
{
this.SetDefaults("Demon Eye 2");
return;
}
if (type == -44)
{
this.SetDefaults("Small Female Zombie");
return;
}
if (type == -45)
{
this.SetDefaults("Big Female Zombie");
return;
}
if (type == -46)
{
this.SetDefaults("Small Skeleton");
return;
}
if (type == -47)
{
this.SetDefaults("Big Skeleton");
return;
}
if (type == -48)
{
this.SetDefaults("Small Headache Skeleton");
return;
}
if (type == -49)
{
this.SetDefaults("Big Headache Skeleton");
return;
}
if (type == -50)
{
this.SetDefaults("Small Misassembled Skeleton");
return;
}
if (type == -51)
{
this.SetDefaults("Big Misassembled Skeleton");
return;
}
if (type == -52)
{
this.SetDefaults("Small Pantless Skeleton");
return;
}
if (type == -53)
{
this.SetDefaults("Big Pantless Skeleton");
return;
}
if (type == -54)
{
this.SetDefaults("Small Rain Zombie");
return;
}
if (type == -55)
{
this.SetDefaults("Big Rain Zombie");
return;
}
if (type == -56)
{
this.SetDefaults("Little Hornet Fatty");
return;
}
if (type == -57)
{
this.SetDefaults("Big Hornet Fatty");
return;
}
if (type == -58)
{
this.SetDefaults("Little Hornet Honey");
return;
}
if (type == -59)
{
this.SetDefaults("Big Hornet Honey");
return;
}
if (type == -60)
{
this.SetDefaults("Little Hornet Leafy");
return;
}
if (type == -61)
{
this.SetDefaults("Big Hornet Leafy");
return;
}
if (type == -62)
{
this.SetDefaults("Little Hornet Spikey");
return;
}
if (type == -63)
{
this.SetDefaults("Big Hornet Spikey");
return;
}
if (type == -64)
{
this.SetDefaults("Little Hornet Stingy");
return;
}
if (type == -65)
{
this.SetDefaults("Big Hornet Stingy");
return;
}
}
else
{
this.SetDefaults(type, -1f);
}
}
public void SetDefaults(string Name)
{
this.SetDefaults(0, -1f);
if (Name == "Slimeling")
{
this.SetDefaults(81, 0.6f);
this.name = Name;
this.damage = 45;
this.defense = 10;
this.life = 90;
this.knockBackResist = 1.2f;
this.value = 100f;
this.netID = -1;
}
else
{
if (Name == "Slimer2")
{
this.SetDefaults(81, 0.9f);
this.displayName = "Slimer";
this.name = Name;
this.damage = 45;
this.defense = 20;
this.life = 90;
this.knockBackResist = 1.2f;
this.value = 100f;
this.netID = -2;
}
else
{
if (Name == "Green Slime")
{
this.SetDefaults(1, 0.9f);
this.name = Name;
this.damage = 6;
this.defense = 0;
this.life = 14;
this.knockBackResist = 1.2f;
this.color = new Color(0, 220, 40, 100);
this.value = 3f;
this.netID = -3;
}
else
{
if (Name == "Pinky")
{
this.SetDefaults(1, 0.6f);
this.name = Name;
this.damage = 5;
this.defense = 5;
this.life = 150;
this.knockBackResist = 1.4f;
this.color = new Color(250, 30, 90, 90);
this.value = 10000f;
this.netID = -4;
}
else
{
if (Name == "Baby Slime")
{
this.SetDefaults(1, 0.9f);
this.name = Name;
this.damage = 13;
this.defense = 4;
this.life = 30;
this.knockBackResist = 0.95f;
this.alpha = 120;
this.color = new Color(0, 0, 0, 50);
this.value = 10f;
this.netID = -5;
}
else
{
if (Name == "Black Slime")
{
this.SetDefaults(1, -1f);
this.name = Name;
this.damage = 15;
this.defense = 4;
this.life = 45;
this.color = new Color(0, 0, 0, 50);
this.value = 20f;
this.netID = -6;
}
else
{
if (Name == "Purple Slime")
{
this.SetDefaults(1, 1.2f);
this.name = Name;
this.damage = 12;
this.defense = 6;
this.life = 40;
this.knockBackResist = 0.9f;
this.color = new Color(200, 0, 255, 150);
this.value = 10f;
this.netID = -7;
}
else
{
if (Name == "Red Slime")
{
this.SetDefaults(1, -1f);
this.name = Name;
this.damage = 12;
this.defense = 4;
this.life = 35;
this.color = new Color(255, 30, 0, 100);
this.value = 8f;
this.netID = -8;
}
else
{
if (Name == "Yellow Slime")
{
this.SetDefaults(1, 1.2f);
this.name = Name;
this.damage = 15;
this.defense = 7;
this.life = 45;
this.color = new Color(255, 255, 0, 100);
this.value = 10f;
this.netID = -9;
}
else
{
if (Name == "Jungle Slime")
{
this.SetDefaults(1, 1.1f);
this.name = Name;
this.damage = 18;
this.defense = 6;
this.life = 60;
this.color = new Color(143, 215, 93, 100);
this.value = 500f;
this.netID = -10;
}
else
{
if (Name == "Little Eater")
{
this.SetDefaults(6, 0.85f);
this.name = Name;
this.displayName = "Eater of Souls";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -11;
}
else
{
if (Name == "Big Eater")
{
this.SetDefaults(6, 1.15f);
this.name = Name;
this.displayName = "Eater of Souls";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -12;
}
else
{
if (Name == "Short Bones")
{
this.SetDefaults(31, 0.9f);
this.name = Name;
this.displayName = "Angry Bones";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.netID = -13;
}
else
{
if (Name == "Big Boned")
{
this.SetDefaults(31, 1.15f);
this.name = Name;
this.displayName = "Angry Bones";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((double)((float)this.damage * this.scale) * 1.1);
this.life = (int)((double)((float)this.life * this.scale) * 1.1);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots = 2f;
this.knockBackResist *= 2f - this.scale;
this.netID = -14;
}
else
{
if (Name == "Heavy Skeleton")
{
this.SetDefaults(77, 1.15f);
this.name = Name;
this.displayName = "Armored Skeleton";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((double)((float)this.damage * this.scale) * 1.1);
this.life = 400;
this.value = (float)((int)(this.value * this.scale));
this.npcSlots = 2f;
this.knockBackResist *= 2f - this.scale;
this.height = 44;
this.netID = -15;
}
else
{
if (Name == "Little Stinger")
{
this.SetDefaults(42, 0.85f);
this.displayName = "Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -16;
}
else
{
if (Name == "Big Stinger")
{
this.SetDefaults(42, 1.2f);
this.displayName = "Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -17;
}
else
{
if (Name == "Tiny Moss Hornet")
{
this.SetDefaults(176, 0.8f);
this.displayName = "Moss Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -18;
}
else
{
if (Name == "Little Moss Hornet")
{
this.SetDefaults(176, 0.9f);
this.displayName = "Moss Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -19;
}
else
{
if (Name == "Big Moss Hornet")
{
this.SetDefaults(176, 1.1f);
this.displayName = "Moss Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -20;
}
else
{
if (Name == "Giant Moss Hornet")
{
this.SetDefaults(176, 1.2f);
this.displayName = "Moss Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -21;
}
else
{
if (Name == "Little Crimera")
{
this.SetDefaults(173, 0.85f);
this.displayName = "Crimera";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -22;
}
else
{
if (Name == "Big Crimera")
{
this.SetDefaults(173, 1.15f);
this.displayName = "Crimera";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -23;
}
else
{
if (Name == "Little Crimslime")
{
this.SetDefaults(183, 0.85f);
this.displayName = "Crimslime";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -24;
}
else
{
if (Name == "Big Crimslime")
{
this.SetDefaults(183, 1.15f);
this.displayName = "Crimslime";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -25;
}
else
{
if (Name == "Small Zombie")
{
this.SetDefaults(3, 0.9f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -26;
}
else
{
if (Name == "Big Zombie")
{
this.SetDefaults(3, 1.1f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -27;
}
else
{
if (Name == "Small Bald Zombie")
{
this.SetDefaults(132, 0.85f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -28;
}
else
{
if (Name == "Big Bald Zombie")
{
this.SetDefaults(132, 1.15f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -29;
}
else
{
if (Name == "Small Pincushion Zombie")
{
this.SetDefaults(186, 0.93f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -30;
}
else
{
if (Name == "Big Pincushion Zombie")
{
this.SetDefaults(186, 1.13f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -31;
}
else
{
if (Name == "Small Slimed Zombie")
{
this.SetDefaults(187, 0.89f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -32;
}
else
{
if (Name == "Big Slimed Zombie")
{
this.SetDefaults(187, 1.11f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -33;
}
else
{
if (Name == "Small Swamp Zombie")
{
this.SetDefaults(188, 0.87f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -34;
}
else
{
if (Name == "Big Swamp Zombie")
{
this.SetDefaults(188, 1.13f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -35;
}
else
{
if (Name == "Small Twiggy Zombie")
{
this.SetDefaults(189, 0.92f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -36;
}
else
{
if (Name == "Big Twiggy Zombie")
{
this.SetDefaults(189, 1.08f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -37;
}
else
{
if (Name == "Cataract Eye 2")
{
this.SetDefaults(190, 1.15f);
this.name = Name;
this.displayName = "Demon Eye";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -38;
}
else
{
if (Name == "Sleepy Eye 2")
{
this.SetDefaults(191, 1.1f);
this.name = Name;
this.displayName = "Demon Eye";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -39;
}
else
{
if (Name == "Dialated Eye 2")
{
this.SetDefaults(192, 0.9f);
this.name = Name;
this.displayName = "Demon Eye";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -40;
}
else
{
if (Name == "Green Eye 2")
{
this.SetDefaults(193, 0.85f);
this.name = Name;
this.displayName = "Demon Eye";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -41;
}
else
{
if (Name == "Purple Eye 2")
{
this.SetDefaults(194, 1.1f);
this.name = Name;
this.displayName = "Demon Eye";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -42;
}
else
{
if (Name == "Demon Eye 2")
{
this.SetDefaults(2, 1.15f);
this.name = Name;
this.displayName = "Demon Eye";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -43;
}
else
{
if (Name == "Small Female Zombie")
{
this.SetDefaults(200, 0.87f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -44;
}
else
{
if (Name == "Big Female Zombie")
{
this.SetDefaults(200, 1.05f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -45;
}
else
{
if (Name == "Small Skeleton")
{
this.SetDefaults(21, 0.9f);
this.name = Name;
this.displayName = "Skeleton";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -46;
}
else
{
if (Name == "Big Skeleton")
{
this.SetDefaults(21, 1.1f);
this.name = Name;
this.displayName = "Skeleton";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -47;
}
else
{
if (Name == "Small Headache Skeleton")
{
this.SetDefaults(201, 0.93f);
this.name = Name;
this.displayName = "Skeleton";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -48;
}
else
{
if (Name == "Big Headache Skeleton")
{
this.SetDefaults(201, 1.07f);
this.name = Name;
this.displayName = "Skeleton";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -49;
}
else
{
if (Name == "Small Misassembled Skeleton")
{
this.SetDefaults(202, 0.87f);
this.name = Name;
this.displayName = "Skeleton";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -50;
}
else
{
if (Name == "Big Misassembled Skeleton")
{
this.SetDefaults(202, 1.13f);
this.name = Name;
this.displayName = "Skeleton";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -51;
}
else
{
if (Name == "Small Pantless Skeleton")
{
this.SetDefaults(203, 0.85f);
this.name = Name;
this.displayName = "Skeleton";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -52;
}
else
{
if (Name == "Big Pantless Skeleton")
{
this.SetDefaults(203, 1.15f);
this.name = Name;
this.displayName = "Skeleton";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -53;
}
else
{
if (Name == "Small Rain Zombie")
{
this.SetDefaults(223, 0.9f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -54;
}
else
{
if (Name == "Big Rain Zombie")
{
this.SetDefaults(223, 1.1f);
this.name = Name;
this.displayName = "Zombie";
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -55;
}
else
{
if (Name == "Little Hornet Fatty")
{
this.SetDefaults(231, 0.85f);
this.displayName = "Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -56;
}
else
{
if (Name == "Big Hornet Fatty")
{
this.SetDefaults(231, 1.25f);
this.displayName = "Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -57;
}
else
{
if (Name == "Little Hornet Honey")
{
this.SetDefaults(232, 0.8f);
this.displayName = "Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -58;
}
else
{
if (Name == "Big Hornet Honey")
{
this.SetDefaults(232, 1.15f);
this.displayName = "Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -59;
}
else
{
if (Name == "Little Hornet Leafy")
{
this.SetDefaults(233, 0.92f);
this.displayName = "Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -60;
}
else
{
if (Name == "Big Hornet Leafy")
{
this.SetDefaults(233, 1.1f);
this.displayName = "Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -61;
}
else
{
if (Name == "Little Hornet Spikey")
{
this.SetDefaults(234, 0.78f);
this.displayName = "Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -62;
}
else
{
if (Name == "Big Hornet Spikey")
{
this.SetDefaults(234, 1.16f);
this.displayName = "Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -63;
}
else
{
if (Name == "Little Hornet Stingy")
{
this.SetDefaults(235, 0.87f);
this.displayName = "Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -64;
}
else
{
if (Name == "Big Hornet Stingy")
{
this.SetDefaults(235, 1.21f);
this.displayName = "Hornet";
this.name = Name;
this.defense = (int)((float)this.defense * this.scale);
this.damage = (int)((float)this.damage * this.scale);
this.life = (int)((float)this.life * this.scale);
this.value = (float)((int)(this.value * this.scale));
this.npcSlots *= this.scale;
this.knockBackResist *= 2f - this.scale;
this.netID = -65;
}
else
{
if (Name != "")
{
for (int i = 1; i < 301; i++)
{
if (Main.npcName[i] == Name)
{
this.SetDefaults(i, -1f);
return;
}
}
this.SetDefaults(0, -1f);
this.active = false;
}
else
{
this.active = false;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
this.displayName = Lang.npcName(this.netID, false);
this.lifeMax = this.life;
this.defDamage = this.damage;
this.defDefense = this.defense;
}
public static bool MechSpawn(float x, float y, int type)
{
int num = 0;
int num2 = 0;
int num3 = 0;
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].active && Main.npc[i].type == type)
{
num++;
Vector2 vector = new Vector2(x, y);
float num4 = Main.npc[i].position.X - vector.X;
float num5 = Main.npc[i].position.Y - vector.Y;
float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5));
if (num6 < 200f)
{
num2++;
}
if (num6 < 600f)
{
num3++;
}
}
}
return num2 < 3 && num3 < 6 && num < 10;
}
public static int TypeToNum(int type)
{
if (type == 17)
{
return 2;
}
if (type == 18)
{
return 3;
}
if (type == 19)
{
return 6;
}
if (type == 20)
{
return 5;
}
if (type == 22)
{
return 1;
}
if (type == 38)
{
return 4;
}
if (type == 54)
{
return 7;
}
if (type == 107)
{
return 9;
}
if (type == 108)
{
return 10;
}
if (type == 124)
{
return 8;
}
if (type == 142)
{
return 11;
}
if (type == 160)
{
return 12;
}
if (type == 178)
{
return 13;
}
if (type == 207)
{
return 14;
}
if (type == 208)
{
return 15;
}
if (type == 209)
{
return 16;
}
if (type == 227)
{
return 17;
}
if (type == 228)
{
return 18;
}
if (type == 229)
{
return 19;
}
return -1;
}
public static int NumToType(int type)
{
if (type == 2)
{
return 17;
}
if (type == 3)
{
return 18;
}
if (type == 6)
{
return 19;
}
if (type == 5)
{
return 20;
}
if (type == 1)
{
return 22;
}
if (type == 4)
{
return 38;
}
if (type == 7)
{
return 54;
}
if (type == 9)
{
return 107;
}
if (type == 10)
{
return 108;
}
if (type == 8)
{
return 124;
}
if (type == 11)
{
return 142;
}
if (type == 12)
{
return 160;
}
if (type == 13)
{
return 178;
}
if (type == 14)
{
return 207;
}
if (type == 15)
{
return 208;
}
if (type == 16)
{
return 209;
}
if (type == 17)
{
return 227;
}
if (type == 18)
{
return 228;
}
if (type == 19)
{
return 229;
}
return -1;
}
public void SetDefaults(int Type, float scaleOverride = -1f)
{
NPC.noStream = false;
this.netStream = 32;
bool flag = false;
this.netID = 0;
this.netAlways = false;
this.netSpam = 0;
for (int i = 0; i < this.oldPos.Length; i++)
{
this.oldPos[i].X = 0f;
this.oldPos[i].Y = 0f;
}
for (int j = 0; j < 5; j++)
{
this.buffTime[j] = 0;
this.buffType[j] = 0;
}
for (int k = 0; k < 81; k++)
{
this.buffImmune[k] = false;
}
this.setFrameSize = false;
this.buffImmune[31] = true;
this.netSkip = -2;
this.realLife = -1;
this.lifeRegen = 0;
this.lifeRegenCount = 0;
this.poisoned = false;
this.venom = false;
this.onFire = false;
this.midas = false;
this.ichor = false;
this.onFrostBurn = false;
this.confused = false;
this.onFire2 = false;
this.justHit = false;
this.dontTakeDamage = false;
this.npcSlots = 1f;
this.lavaImmune = false;
this.lavaWet = false;
this.wetCount = 0;
this.wet = false;
this.townNPC = false;
this.homeless = false;
this.homeTileX = -1;
this.homeTileY = -1;
this.friendly = false;
this.behindTiles = false;
this.boss = false;
this.noTileCollide = false;
this.rotation = 0f;
this.active = true;
this.alpha = 0;
this.color = default(Color);
this.collideX = false;
this.collideY = false;
this.direction = 0;
this.oldDirection = this.direction;
this.frameCounter = 0.0;
this.netUpdate = true;
this.netUpdate2 = false;
this.knockBackResist = 1f;
this.name = "";
this.displayName = "";
this.noGravity = false;
this.scale = 1f;
this.soundHit = 0;
this.soundKilled = 0;
this.spriteDirection = -1;
this.target = 255;
this.oldTarget = this.target;
this.targetRect = default(Rectangle);
this.timeLeft = NPC.activeTime;
this.type = Type;
this.value = 0f;
for (int l = 0; l < NPC.maxAI; l++)
{
this.ai[l] = 0f;
}
for (int m = 0; m < NPC.maxAI; m++)
{
this.localAI[m] = 0f;
}
if (this.type == 1)
{
this.name = "Blue Slime";
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 7;
this.defense = 2;
this.lifeMax = 25;
this.soundHit = 1;
this.soundKilled = 1;
this.alpha = 175;
this.color = new Color(0, 80, 255, 100);
this.value = 25f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 2)
{
this.name = "Demon Eye";
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 18;
this.defense = 2;
this.lifeMax = 60;
this.soundHit = 1;
this.knockBackResist = 0.8f;
this.soundKilled = 1;
this.value = 75f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 3)
{
this.name = "Zombie";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 14;
this.defense = 6;
this.lifeMax = 45;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.5f;
this.value = 60f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 4)
{
this.name = "Eye of Cthulhu";
this.width = 100;
this.height = 110;
this.aiStyle = 4;
this.damage = 15;
this.defense = 12;
this.lifeMax = 2800;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0f;
this.noGravity = true;
this.noTileCollide = true;
this.timeLeft = NPC.activeTime * 30;
this.boss = true;
this.value = 30000f;
this.npcSlots = 5f;
}
else
{
if (this.type == 5)
{
this.name = "Servant of Cthulhu";
this.width = 20;
this.height = 20;
this.aiStyle = 5;
this.damage = 12;
this.defense = 0;
this.lifeMax = 8;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
}
else
{
if (this.type == 6)
{
this.npcSlots = 1f;
this.name = "Eater of Souls";
this.width = 30;
this.height = 30;
this.aiStyle = 5;
this.damage = 22;
this.defense = 8;
this.lifeMax = 40;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.knockBackResist = 0.5f;
this.value = 90f;
}
else
{
if (this.type == 7)
{
this.displayName = "Devourer";
this.npcSlots = 3.5f;
this.name = "Devourer Head";
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.damage = 31;
this.defense = 2;
this.lifeMax = 100;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 140f;
this.netAlways = true;
}
else
{
if (this.type == 8)
{
this.displayName = "Devourer";
this.name = "Devourer Body";
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 16;
this.defense = 6;
this.lifeMax = 100;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 140f;
NPC.noStream = true;
}
else
{
if (this.type == 9)
{
this.displayName = "Devourer";
this.name = "Devourer Tail";
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 13;
this.defense = 10;
this.lifeMax = 100;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 140f;
NPC.noStream = true;
}
else
{
if (this.type == 10)
{
this.displayName = "Giant Worm";
this.name = "Giant Worm Head";
this.width = 14;
this.height = 14;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 8;
this.defense = 0;
this.lifeMax = 30;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 40f;
}
else
{
if (this.type == 11)
{
this.displayName = "Giant Worm";
this.name = "Giant Worm Body";
this.width = 14;
this.height = 14;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 4;
this.defense = 4;
this.lifeMax = 30;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 40f;
NPC.noStream = true;
}
else
{
if (this.type == 12)
{
this.displayName = "Giant Worm";
this.name = "Giant Worm Tail";
this.width = 14;
this.height = 14;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 4;
this.defense = 6;
this.lifeMax = 30;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 40f;
NPC.noStream = true;
}
else
{
if (this.type == 13)
{
this.displayName = "Eater of Worlds";
this.npcSlots = 5f;
this.name = "Eater of Worlds Head";
this.width = 38;
this.height = 38;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 22;
this.defense = 2;
this.lifeMax = 65;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 300f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 14)
{
this.displayName = "Eater of Worlds";
this.name = "Eater of Worlds Body";
this.width = 38;
this.height = 38;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 13;
this.defense = 4;
this.lifeMax = 150;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 300f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
NPC.noStream = true;
}
else
{
if (this.type == 15)
{
this.displayName = "Eater of Worlds";
this.name = "Eater of Worlds Tail";
this.width = 38;
this.height = 38;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 11;
this.defense = 8;
this.lifeMax = 220;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 300f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
NPC.noStream = true;
}
else
{
if (this.type == 16)
{
this.npcSlots = 2f;
this.name = "Mother Slime";
this.width = 36;
this.height = 24;
this.aiStyle = 1;
this.damage = 20;
this.defense = 7;
this.lifeMax = 90;
this.soundHit = 1;
this.soundKilled = 1;
this.alpha = 120;
this.color = new Color(0, 0, 0, 50);
this.value = 75f;
this.scale = 1.25f;
this.knockBackResist = 0.6f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 17)
{
this.townNPC = true;
this.friendly = true;
this.name = "Merchant";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 18)
{
this.townNPC = true;
this.friendly = true;
this.name = "Nurse";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 19)
{
this.townNPC = true;
this.friendly = true;
this.name = "Arms Dealer";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 20)
{
this.townNPC = true;
this.friendly = true;
this.name = "Dryad";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 21)
{
this.name = "Skeleton";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 8;
this.lifeMax = 60;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.5f;
this.value = 100f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 22)
{
this.townNPC = true;
this.friendly = true;
this.name = "Guide";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 23)
{
this.name = "Meteor Head";
this.width = 22;
this.height = 22;
this.aiStyle = 5;
this.damage = 40;
this.defense = 6;
this.lifeMax = 26;
this.soundHit = 3;
this.soundKilled = 3;
this.noGravity = true;
this.noTileCollide = true;
this.value = 80f;
this.knockBackResist = 0.4f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 24)
{
this.npcSlots = 3f;
this.name = "Fire Imp";
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 30;
this.defense = 16;
this.lifeMax = 70;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
this.lavaImmune = true;
this.value = 350f;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 25)
{
this.name = "Burning Sphere";
this.width = 16;
this.height = 16;
this.aiStyle = 9;
this.damage = 30;
this.defense = 0;
this.lifeMax = 1;
this.soundHit = 3;
this.soundKilled = 3;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.alpha = 100;
}
else
{
if (this.type == 26)
{
this.name = "Goblin Peon";
this.scale = 0.9f;
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 12;
this.defense = 4;
this.lifeMax = 60;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.8f;
this.value = 100f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 27)
{
this.name = "Goblin Thief";
this.scale = 0.95f;
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 6;
this.lifeMax = 80;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.7f;
this.value = 200f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 28)
{
this.name = "Goblin Warrior";
this.scale = 1.1f;
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 25;
this.defense = 8;
this.lifeMax = 110;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
this.value = 150f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 29)
{
this.name = "Goblin Sorcerer";
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 20;
this.defense = 2;
this.lifeMax = 40;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.6f;
this.value = 200f;
}
else
{
if (this.type == 30)
{
this.name = "Chaos Ball";
this.width = 16;
this.height = 16;
this.aiStyle = 9;
this.damage = 20;
this.defense = 0;
this.lifeMax = 1;
this.soundHit = 3;
this.soundKilled = 3;
this.noGravity = true;
this.noTileCollide = true;
this.alpha = 100;
this.knockBackResist = 0f;
}
else
{
if (this.type == 31)
{
this.name = "Angry Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 26;
this.defense = 8;
this.lifeMax = 80;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.8f;
this.value = 130f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 32)
{
this.name = "Dark Caster";
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 20;
this.defense = 2;
this.lifeMax = 50;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.6f;
this.value = 140f;
this.npcSlots = 2f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 33)
{
this.name = "Water Sphere";
this.width = 16;
this.height = 16;
this.aiStyle = 9;
this.damage = 20;
this.defense = 0;
this.lifeMax = 1;
this.soundHit = 3;
this.soundKilled = 3;
this.noGravity = true;
this.noTileCollide = true;
this.alpha = 255;
this.knockBackResist = 0f;
}
else
{
if (this.type == 34)
{
this.name = "Cursed Skull";
this.width = 26;
this.height = 28;
this.aiStyle = 10;
this.damage = 35;
this.defense = 6;
this.lifeMax = 40;
this.soundHit = 2;
this.soundKilled = 2;
this.noGravity = true;
this.noTileCollide = true;
this.value = 150f;
this.knockBackResist = 0.2f;
this.npcSlots = 0.75f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 35)
{
this.displayName = "Skeletron";
this.name = "Skeletron Head";
this.width = 80;
this.height = 102;
this.aiStyle = 11;
this.damage = 32;
this.defense = 10;
this.lifeMax = 4400;
this.soundHit = 2;
this.soundKilled = 2;
this.noGravity = true;
this.noTileCollide = true;
this.value = 50000f;
this.knockBackResist = 0f;
this.boss = true;
this.npcSlots = 6f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 36)
{
this.displayName = "Skeletron";
this.name = "Skeletron Hand";
this.width = 52;
this.height = 52;
this.aiStyle = 12;
this.damage = 20;
this.defense = 14;
this.lifeMax = 600;
this.soundHit = 2;
this.soundKilled = 2;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 37)
{
this.townNPC = true;
this.friendly = true;
this.name = "Old Man";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 38)
{
this.townNPC = true;
this.friendly = true;
this.name = "Demolitionist";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 39)
{
this.npcSlots = 6f;
this.name = "Bone Serpent Head";
this.displayName = "Bone Serpent";
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 30;
this.defense = 10;
this.lifeMax = 250;
this.soundHit = 2;
this.soundKilled = 5;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 1200f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 40)
{
this.name = "Bone Serpent Body";
this.displayName = "Bone Serpent";
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 15;
this.defense = 12;
this.lifeMax = 250;
this.soundHit = 2;
this.soundKilled = 5;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 1200f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 41)
{
this.name = "Bone Serpent Tail";
this.displayName = "Bone Serpent";
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 10;
this.defense = 18;
this.lifeMax = 250;
this.soundHit = 2;
this.soundKilled = 5;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 1200f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 42)
{
this.name = "Hornet";
this.width = 34;
this.height = 32;
this.aiStyle = 5;
this.damage = 26;
this.defense = 12;
this.lifeMax = 48;
this.soundHit = 1;
this.knockBackResist = 0.5f;
this.soundKilled = 1;
this.value = 200f;
this.noGravity = true;
this.buffImmune[20] = true;
}
else
{
if (this.type == 43)
{
this.noGravity = true;
this.noTileCollide = true;
this.name = "Man Eater";
this.width = 30;
this.height = 30;
this.aiStyle = 13;
this.damage = 34;
this.defense = 10;
this.lifeMax = 110;
this.soundHit = 1;
this.knockBackResist = 0f;
this.soundKilled = 1;
this.value = 350f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 44)
{
this.name = "Undead Miner";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 22;
this.defense = 9;
this.lifeMax = 70;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.5f;
this.value = 250f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 45)
{
this.name = "Tim";
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 20;
this.defense = 4;
this.lifeMax = 200;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.6f;
this.value = 5000f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 46)
{
this.name = "Bunny";
this.width = 18;
this.height = 20;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.soundHit = 1;
this.soundKilled = 1;
}
else
{
if (this.type == 47)
{
this.name = "Corrupt Bunny";
this.width = 18;
this.height = 20;
this.aiStyle = 3;
this.damage = 20;
this.defense = 4;
this.lifeMax = 70;
this.soundHit = 1;
this.soundKilled = 1;
this.value = 500f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 48)
{
this.name = "Harpy";
this.width = 24;
this.height = 34;
this.aiStyle = 14;
this.damage = 25;
this.defense = 8;
this.lifeMax = 100;
this.soundHit = 1;
this.knockBackResist = 0.6f;
this.soundKilled = 1;
this.value = 300f;
}
else
{
if (this.type == 49)
{
this.npcSlots = 0.5f;
this.name = "Cave Bat";
this.width = 22;
this.height = 18;
this.aiStyle = 14;
this.damage = 13;
this.defense = 2;
this.lifeMax = 16;
this.soundHit = 1;
this.knockBackResist = 0.8f;
this.soundKilled = 4;
this.value = 90f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 50)
{
this.boss = true;
this.name = "King Slime";
this.width = 98;
this.height = 92;
this.aiStyle = 15;
this.damage = 40;
this.defense = 10;
this.lifeMax = 2000;
this.knockBackResist = 0f;
this.soundHit = 1;
this.soundKilled = 1;
this.alpha = 30;
this.value = 10000f;
this.scale = 1.25f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 51)
{
this.npcSlots = 0.5f;
this.name = "Jungle Bat";
this.width = 22;
this.height = 18;
this.aiStyle = 14;
this.damage = 20;
this.defense = 4;
this.lifeMax = 34;
this.soundHit = 1;
this.knockBackResist = 0.8f;
this.soundKilled = 4;
this.value = 80f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 52)
{
this.name = "Doctor Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 10;
this.lifeMax = 500;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.5f;
this.value = 1000f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 53)
{
this.name = "The Groom";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 14;
this.defense = 8;
this.lifeMax = 200;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.5f;
this.value = 1000f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 54)
{
this.townNPC = true;
this.friendly = true;
this.name = "Clothier";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 55)
{
this.noGravity = true;
this.name = "Goldfish";
this.width = 20;
this.height = 18;
this.aiStyle = 16;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 56)
{
this.noTileCollide = true;
this.noGravity = true;
this.name = "Snatcher";
this.width = 30;
this.height = 30;
this.aiStyle = 13;
this.damage = 25;
this.defense = 10;
this.lifeMax = 60;
this.soundHit = 1;
this.knockBackResist = 0f;
this.soundKilled = 1;
this.value = 90f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 57)
{
this.noGravity = true;
this.name = "Corrupt Goldfish";
this.width = 18;
this.height = 20;
this.aiStyle = 16;
this.damage = 30;
this.defense = 6;
this.lifeMax = 100;
this.soundHit = 1;
this.soundKilled = 1;
this.value = 500f;
}
else
{
if (this.type == 58)
{
this.npcSlots = 0.5f;
this.noGravity = true;
this.name = "Piranha";
this.width = 18;
this.height = 20;
this.aiStyle = 16;
this.damage = 25;
this.defense = 2;
this.lifeMax = 30;
this.soundHit = 1;
this.soundKilled = 1;
this.value = 50f;
}
else
{
if (this.type == 59)
{
this.name = "Lava Slime";
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 15;
this.defense = 10;
this.lifeMax = 50;
this.soundHit = 1;
this.soundKilled = 1;
this.scale = 1.1f;
this.alpha = 50;
this.lavaImmune = true;
this.value = 120f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 60)
{
this.npcSlots = 0.5f;
this.name = "Hellbat";
this.width = 22;
this.height = 18;
this.aiStyle = 14;
this.damage = 35;
this.defense = 8;
this.lifeMax = 46;
this.soundHit = 1;
this.knockBackResist = 0.8f;
this.soundKilled = 4;
this.value = 120f;
this.scale = 1.1f;
this.lavaImmune = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 61)
{
this.name = "Vulture";
this.width = 36;
this.height = 36;
this.aiStyle = 17;
this.damage = 15;
this.defense = 4;
this.lifeMax = 40;
this.soundHit = 1;
this.knockBackResist = 0.8f;
this.soundKilled = 1;
this.value = 60f;
}
else
{
if (this.type == 62)
{
this.npcSlots = 2f;
this.name = "Demon";
this.width = 28;
this.height = 48;
this.aiStyle = 14;
this.damage = 32;
this.defense = 8;
this.lifeMax = 120;
this.soundHit = 1;
this.knockBackResist = 0.8f;
this.soundKilled = 1;
this.value = 300f;
this.lavaImmune = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 63)
{
this.noGravity = true;
this.name = "Blue Jellyfish";
this.width = 26;
this.height = 26;
this.aiStyle = 18;
this.damage = 20;
this.defense = 2;
this.lifeMax = 30;
this.soundHit = 1;
this.soundKilled = 1;
this.value = 100f;
this.alpha = 20;
}
else
{
if (this.type == 64)
{
this.noGravity = true;
this.name = "Pink Jellyfish";
this.width = 26;
this.height = 26;
this.aiStyle = 18;
this.damage = 30;
this.defense = 6;
this.lifeMax = 70;
this.soundHit = 1;
this.soundKilled = 1;
this.value = 100f;
this.alpha = 20;
}
else
{
if (this.type == 65)
{
this.noGravity = true;
this.name = "Shark";
this.width = 100;
this.height = 24;
this.aiStyle = 16;
this.damage = 40;
this.defense = 2;
this.lifeMax = 300;
this.soundHit = 1;
this.soundKilled = 1;
this.value = 400f;
this.knockBackResist = 0.7f;
}
else
{
if (this.type == 66)
{
this.npcSlots = 2f;
this.name = "Voodoo Demon";
this.width = 28;
this.height = 48;
this.aiStyle = 14;
this.damage = 32;
this.defense = 8;
this.lifeMax = 140;
this.soundHit = 1;
this.knockBackResist = 0.8f;
this.soundKilled = 1;
this.value = 1000f;
this.lavaImmune = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 67)
{
this.name = "Crab";
this.width = 28;
this.height = 20;
this.aiStyle = 3;
this.damage = 20;
this.defense = 10;
this.lifeMax = 40;
this.soundHit = 1;
this.soundKilled = 1;
this.value = 60f;
}
else
{
if (this.type == 68)
{
this.name = "Dungeon Guardian";
this.width = 80;
this.height = 102;
this.aiStyle = 11;
this.damage = 1000;
this.defense = 9000;
this.lifeMax = 9999;
this.soundHit = 2;
this.soundKilled = 2;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 69)
{
this.name = "Antlion";
this.width = 24;
this.height = 24;
this.aiStyle = 19;
this.damage = 10;
this.defense = 6;
this.lifeMax = 45;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0f;
this.value = 60f;
this.behindTiles = true;
}
else
{
if (this.type == 70)
{
this.npcSlots = 0.3f;
this.name = "Spike Ball";
this.width = 34;
this.height = 34;
this.aiStyle = 20;
this.damage = 32;
this.defense = 100;
this.lifeMax = 100;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0f;
this.noGravity = true;
this.noTileCollide = true;
this.dontTakeDamage = true;
this.scale = 1.5f;
}
else
{
if (this.type == 71)
{
this.npcSlots = 2f;
this.name = "Dungeon Slime";
this.width = 36;
this.height = 24;
this.aiStyle = 1;
this.damage = 30;
this.defense = 7;
this.lifeMax = 150;
this.soundHit = 1;
this.soundKilled = 1;
this.alpha = 60;
this.value = 150f;
this.scale = 1.25f;
this.knockBackResist = 0.6f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 72)
{
this.npcSlots = 0.3f;
this.name = "Blazing Wheel";
this.width = 34;
this.height = 34;
this.aiStyle = 21;
this.damage = 24;
this.defense = 100;
this.lifeMax = 100;
this.alpha = 100;
this.behindTiles = true;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0f;
this.noGravity = true;
this.dontTakeDamage = true;
this.scale = 1.2f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 73)
{
this.name = "Goblin Scout";
this.scale = 0.95f;
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 6;
this.lifeMax = 80;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.7f;
this.value = 200f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 74 || this.type == 297 || this.type == 298)
{
this.name = "Bird";
this.width = 14;
this.height = 14;
this.aiStyle = 24;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.soundHit = 1;
this.knockBackResist = 0.8f;
this.soundKilled = 1;
}
else
{
if (this.type == 75)
{
this.noGravity = true;
this.name = "Pixie";
this.width = 20;
this.height = 20;
this.aiStyle = 22;
this.damage = 55;
this.defense = 20;
this.lifeMax = 150;
this.soundHit = 5;
this.knockBackResist = 0.6f;
this.soundKilled = 7;
this.value = 350f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 77)
{
this.name = "Armored Skeleton";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 40;
this.defense = 28;
this.lifeMax = 260;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.4f;
this.value = 400f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 78)
{
this.name = "Mummy";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 50;
this.defense = 16;
this.lifeMax = 130;
this.soundHit = 1;
this.soundKilled = 6;
this.knockBackResist = 0.6f;
this.value = 600f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 79)
{
this.name = "Dark Mummy";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 60;
this.defense = 18;
this.lifeMax = 180;
this.soundHit = 1;
this.soundKilled = 6;
this.knockBackResist = 0.5f;
this.value = 700f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 80)
{
this.name = "Light Mummy";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 55;
this.defense = 18;
this.lifeMax = 200;
this.soundHit = 1;
this.soundKilled = 6;
this.knockBackResist = 0.55f;
this.value = 700f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 81)
{
this.name = "Corrupt Slime";
this.width = 40;
this.height = 30;
this.aiStyle = 1;
this.damage = 55;
this.defense = 20;
this.lifeMax = 170;
this.soundHit = 1;
this.soundKilled = 1;
this.alpha = 55;
this.value = 400f;
this.scale = 1.1f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 82)
{
this.noGravity = true;
this.noTileCollide = true;
this.name = "Wraith";
this.width = 24;
this.height = 44;
this.aiStyle = 22;
this.damage = 65;
this.defense = 16;
this.lifeMax = 160;
this.soundHit = 1;
this.soundKilled = 6;
this.alpha = 100;
this.value = 500f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.7f;
}
else
{
if (this.type == 83)
{
this.name = "Cursed Hammer";
this.width = 40;
this.height = 40;
this.aiStyle = 23;
this.damage = 80;
this.defense = 18;
this.lifeMax = 200;
this.soundHit = 4;
this.soundKilled = 6;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.4f;
}
else
{
if (this.type == 84)
{
this.name = "Enchanted Sword";
this.width = 40;
this.height = 40;
this.aiStyle = 23;
this.damage = 80;
this.defense = 18;
this.lifeMax = 200;
this.soundHit = 4;
this.soundKilled = 6;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.4f;
}
else
{
if (this.type == 85)
{
this.name = "Mimic";
this.width = 24;
this.height = 24;
this.aiStyle = 25;
this.damage = 80;
this.defense = 30;
this.lifeMax = 500;
this.soundHit = 4;
this.soundKilled = 6;
this.value = 100000f;
this.knockBackResist = 0.3f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 86)
{
this.name = "Unicorn";
this.width = 46;
this.height = 42;
this.aiStyle = 26;
this.damage = 65;
this.defense = 30;
this.lifeMax = 400;
this.soundHit = 12;
this.soundKilled = 18;
this.knockBackResist = 0.3f;
this.value = 1000f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 87)
{
this.displayName = "Wyvern";
this.noTileCollide = true;
this.npcSlots = 5f;
this.name = "Wyvern Head";
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 80;
this.defense = 10;
this.lifeMax = 4000;
this.soundHit = 7;
this.soundKilled = 8;
this.noGravity = true;
this.knockBackResist = 0f;
this.value = 10000f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 88)
{
this.displayName = "Wyvern";
this.noTileCollide = true;
this.name = "Wyvern Legs";
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 40;
this.defense = 20;
this.lifeMax = 4000;
this.soundHit = 7;
this.soundKilled = 8;
this.noGravity = true;
this.knockBackResist = 0f;
this.value = 10000f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
NPC.noStream = true;
}
else
{
if (this.type == 89)
{
this.displayName = "Wyvern";
this.noTileCollide = true;
this.name = "Wyvern Body";
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 40;
this.defense = 20;
this.lifeMax = 4000;
this.soundHit = 7;
this.soundKilled = 8;
this.noGravity = true;
this.knockBackResist = 0f;
this.value = 2000f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
NPC.noStream = true;
}
else
{
if (this.type == 90)
{
this.displayName = "Wyvern";
this.noTileCollide = true;
this.name = "Wyvern Body 2";
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 40;
this.defense = 20;
this.lifeMax = 4000;
this.soundHit = 7;
this.soundKilled = 8;
this.noGravity = true;
this.knockBackResist = 0f;
this.value = 10000f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
NPC.noStream = true;
}
else
{
if (this.type == 91)
{
this.displayName = "Wyvern";
this.noTileCollide = true;
this.name = "Wyvern Body 3";
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 40;
this.defense = 20;
this.lifeMax = 4000;
this.soundHit = 7;
this.soundKilled = 8;
this.noGravity = true;
this.knockBackResist = 0f;
this.value = 10000f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
NPC.noStream = true;
}
else
{
if (this.type == 92)
{
this.displayName = "Wyvern";
this.noTileCollide = true;
this.name = "Wyvern Tail";
this.width = 32;
this.height = 32;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 40;
this.defense = 20;
this.lifeMax = 4000;
this.soundHit = 7;
this.soundKilled = 8;
this.noGravity = true;
this.knockBackResist = 0f;
this.value = 10000f;
this.scale = 1f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
NPC.noStream = true;
}
else
{
if (this.type == 93)
{
this.npcSlots = 0.5f;
this.name = "Giant Bat";
this.width = 26;
this.height = 20;
this.aiStyle = 14;
this.damage = 45;
this.defense = 16;
this.lifeMax = 100;
this.soundHit = 1;
this.knockBackResist = 0.75f;
this.soundKilled = 4;
this.value = 400f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 94)
{
this.npcSlots = 1f;
this.name = "Corruptor";
this.width = 44;
this.height = 44;
this.aiStyle = 5;
this.damage = 60;
this.defense = 32;
this.lifeMax = 230;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.knockBackResist = 0.55f;
this.value = 500f;
}
else
{
if (this.type == 95)
{
this.displayName = "Digger";
this.name = "Digger Head";
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 45;
this.defense = 10;
this.lifeMax = 200;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.scale = 0.9f;
this.value = 300f;
}
else
{
if (this.type == 96)
{
this.displayName = "Digger";
this.name = "Digger Body";
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 28;
this.defense = 20;
this.lifeMax = 200;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.scale = 0.9f;
this.value = 300f;
NPC.noStream = true;
}
else
{
if (this.type == 97)
{
this.displayName = "Digger";
this.name = "Digger Tail";
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 26;
this.defense = 30;
this.lifeMax = 200;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.scale = 0.9f;
this.value = 300f;
NPC.noStream = true;
}
else
{
if (this.type == 98)
{
this.displayName = "World Feeder";
this.npcSlots = 3.5f;
this.name = "Seeker Head";
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 70;
this.defense = 36;
this.lifeMax = 500;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 700f;
}
else
{
if (this.type == 99)
{
this.displayName = "World Feeder";
this.name = "Seeker Body";
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 55;
this.defense = 40;
this.lifeMax = 500;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 700f;
NPC.noStream = true;
}
else
{
if (this.type == 100)
{
this.displayName = "World Feeder";
this.name = "Seeker Tail";
this.width = 22;
this.height = 22;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 40;
this.defense = 44;
this.lifeMax = 500;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 700f;
NPC.noStream = true;
}
else
{
if (this.type == 101)
{
this.noGravity = true;
this.noTileCollide = true;
this.behindTiles = true;
this.name = "Clinger";
this.width = 30;
this.height = 30;
this.aiStyle = 13;
this.damage = 70;
this.defense = 30;
this.lifeMax = 320;
this.soundHit = 1;
this.knockBackResist = 0.2f;
this.soundKilled = 1;
this.value = 600f;
}
else
{
if (this.type == 102)
{
this.npcSlots = 0.5f;
this.noGravity = true;
this.name = "Angler Fish";
this.width = 18;
this.height = 20;
this.aiStyle = 16;
this.damage = 80;
this.defense = 22;
this.lifeMax = 90;
this.soundHit = 1;
this.soundKilled = 1;
this.value = 500f;
}
else
{
if (this.type == 103)
{
this.noGravity = true;
this.name = "Green Jellyfish";
this.width = 26;
this.height = 26;
this.aiStyle = 18;
this.damage = 80;
this.defense = 30;
this.lifeMax = 120;
this.soundHit = 1;
this.soundKilled = 1;
this.value = 800f;
this.alpha = 20;
}
else
{
if (this.type == 104)
{
this.name = "Werewolf";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 70;
this.defense = 40;
this.lifeMax = 400;
this.soundHit = 6;
this.soundKilled = 1;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 105)
{
this.friendly = true;
this.name = "Bound Goblin";
this.width = 18;
this.height = 34;
this.aiStyle = 0;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
this.scale = 0.9f;
}
else
{
if (this.type == 106)
{
this.friendly = true;
this.name = "Bound Wizard";
this.width = 18;
this.height = 40;
this.aiStyle = 0;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 107)
{
this.townNPC = true;
this.friendly = true;
this.name = "Goblin Tinkerer";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
this.scale = 0.9f;
}
else
{
if (this.type == 108)
{
this.townNPC = true;
this.friendly = true;
this.name = "Wizard";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 109)
{
this.name = "Clown";
this.width = 34;
this.height = 78;
this.aiStyle = 3;
this.damage = 50;
this.defense = 20;
this.lifeMax = 400;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.4f;
this.value = 8000f;
}
else
{
if (this.type == 110)
{
this.name = "Skeleton Archer";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 45;
this.defense = 14;
this.lifeMax = 210;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.55f;
this.value = 400f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 111)
{
this.name = "Goblin Archer";
this.scale = 0.95f;
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 6;
this.lifeMax = 80;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.7f;
this.value = 200f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 112)
{
this.name = "Vile Spit";
this.width = 16;
this.height = 16;
this.aiStyle = 9;
this.damage = 65;
this.defense = 0;
this.lifeMax = 1;
this.soundHit = 0;
this.soundKilled = 9;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.scale = 0.9f;
this.alpha = 80;
}
else
{
if (this.type == 113)
{
this.npcSlots = 10f;
this.name = "Wall of Flesh";
this.width = 100;
this.height = 100;
this.aiStyle = 27;
this.damage = 50;
this.defense = 12;
this.lifeMax = 8000;
this.soundHit = 8;
this.soundKilled = 10;
this.noGravity = true;
this.noTileCollide = true;
this.behindTiles = true;
this.knockBackResist = 0f;
this.scale = 1.2f;
this.boss = true;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.value = 80000f;
}
else
{
if (this.type == 114)
{
this.name = "Wall of Flesh Eye";
this.displayName = "Wall of Flesh";
this.width = 100;
this.height = 100;
this.aiStyle = 28;
this.damage = 50;
this.defense = 0;
this.lifeMax = 8000;
this.soundHit = 8;
this.soundKilled = 10;
this.noGravity = true;
this.noTileCollide = true;
this.behindTiles = true;
this.knockBackResist = 0f;
this.scale = 1.2f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.value = 80000f;
}
else
{
if (this.type == 115)
{
this.name = "The Hungry";
this.width = 30;
this.height = 30;
this.aiStyle = 29;
this.damage = 30;
this.defense = 10;
this.lifeMax = 240;
this.soundHit = 9;
this.soundKilled = 11;
this.noGravity = true;
this.behindTiles = true;
this.noTileCollide = true;
this.knockBackResist = 1.1f;
}
else
{
if (this.type == 116)
{
this.name = "The Hungry II";
this.displayName = "The Hungry";
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 30;
this.defense = 6;
this.lifeMax = 80;
this.soundHit = 9;
this.knockBackResist = 0.8f;
this.soundKilled = 12;
}
else
{
if (this.type == 117)
{
this.displayName = "Leech";
this.name = "Leech Head";
this.width = 14;
this.height = 14;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 26;
this.defense = 2;
this.lifeMax = 60;
this.soundHit = 9;
this.soundKilled = 12;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
}
else
{
if (this.type == 118)
{
this.displayName = "Leech";
this.name = "Leech Body";
this.width = 14;
this.height = 14;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 22;
this.defense = 6;
this.lifeMax = 60;
this.soundHit = 9;
this.soundKilled = 12;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
}
else
{
if (this.type == 119)
{
this.displayName = "Leech";
this.name = "Leech Tail";
this.width = 14;
this.height = 14;
this.aiStyle = 6;
this.netAlways = true;
this.damage = 18;
this.defense = 10;
this.lifeMax = 60;
this.soundHit = 9;
this.soundKilled = 12;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
}
else
{
if (this.type == 120)
{
this.name = "Chaos Elemental";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 40;
this.defense = 30;
this.lifeMax = 370;
this.soundHit = 1;
this.soundKilled = 6;
this.knockBackResist = 0.4f;
this.value = 600f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 121)
{
this.name = "Slimer";
this.width = 40;
this.height = 30;
this.aiStyle = 14;
this.damage = 45;
this.defense = 20;
this.lifeMax = 60;
this.soundHit = 1;
this.alpha = 55;
this.knockBackResist = 0.8f;
this.scale = 1.1f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 122)
{
this.noGravity = true;
this.name = "Gastropod";
this.width = 20;
this.height = 20;
this.aiStyle = 22;
this.damage = 60;
this.defense = 22;
this.lifeMax = 220;
this.soundHit = 1;
this.knockBackResist = 0.8f;
this.soundKilled = 1;
this.value = 600f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 123)
{
this.friendly = true;
this.name = "Bound Mechanic";
this.width = 18;
this.height = 34;
this.aiStyle = 0;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
this.scale = 0.9f;
}
else
{
if (this.type == 124)
{
this.townNPC = true;
this.friendly = true;
this.name = "Mechanic";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 125)
{
this.name = "Retinazer";
this.width = 100;
this.height = 110;
this.aiStyle = 30;
this.damage = 40;
this.defense = 10;
this.lifeMax = 20000;
this.soundHit = 1;
this.soundKilled = 14;
this.knockBackResist = 0f;
this.noGravity = true;
this.noTileCollide = true;
this.timeLeft = NPC.activeTime * 30;
this.boss = true;
this.value = 120000f;
this.npcSlots = 5f;
this.boss = true;
}
else
{
if (this.type == 126)
{
this.name = "Spazmatism";
this.width = 100;
this.height = 110;
this.aiStyle = 31;
this.damage = 40;
this.defense = 10;
this.lifeMax = 20000;
this.soundHit = 1;
this.soundKilled = 14;
this.knockBackResist = 0f;
this.noGravity = true;
this.noTileCollide = true;
this.timeLeft = NPC.activeTime * 30;
this.boss = true;
this.value = 120000f;
this.npcSlots = 5f;
this.boss = true;
}
else
{
if (this.type == 127)
{
this.name = "Skeletron Prime";
this.width = 80;
this.height = 102;
this.aiStyle = 32;
this.damage = 45;
this.defense = 22;
this.lifeMax = 25000;
this.soundHit = 4;
this.soundKilled = 14;
this.noGravity = true;
this.noTileCollide = true;
this.value = 120000f;
this.knockBackResist = 0f;
this.boss = true;
this.npcSlots = 6f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.boss = true;
}
else
{
if (this.type == 128)
{
this.name = "Prime Cannon";
this.width = 52;
this.height = 52;
this.aiStyle = 35;
this.damage = 30;
this.defense = 20;
this.lifeMax = 6000;
this.soundHit = 4;
this.soundKilled = 14;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.netAlways = true;
}
else
{
if (this.type == 129)
{
this.name = "Prime Saw";
this.width = 52;
this.height = 52;
this.aiStyle = 33;
this.damage = 47;
this.defense = 36;
this.lifeMax = 8000;
this.soundHit = 4;
this.soundKilled = 14;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.netAlways = true;
}
else
{
if (this.type == 130)
{
this.name = "Prime Vice";
this.width = 52;
this.height = 52;
this.aiStyle = 34;
this.damage = 40;
this.defense = 30;
this.lifeMax = 8000;
this.soundHit = 4;
this.soundKilled = 14;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.netAlways = true;
}
else
{
if (this.type == 131)
{
this.name = "Prime Laser";
this.width = 52;
this.height = 52;
this.aiStyle = 36;
this.damage = 29;
this.defense = 20;
this.lifeMax = 5000;
this.soundHit = 4;
this.soundKilled = 14;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.netAlways = true;
}
else
{
if (this.type == 132)
{
this.displayName = "Zombie";
this.name = "Bald Zombie";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 15;
this.defense = 5;
this.lifeMax = 40;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.5f;
this.value = 65f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 133)
{
this.name = "Wandering Eye";
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 40;
this.defense = 20;
this.lifeMax = 300;
this.soundHit = 1;
this.knockBackResist = 0.8f;
this.soundKilled = 1;
this.value = 500f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 134)
{
this.displayName = "The Destroyer";
this.npcSlots = 5f;
this.name = "The Destroyer";
this.width = 38;
this.height = 38;
this.aiStyle = 37;
this.damage = 50;
this.defense = 0;
this.lifeMax = 60000;
this.soundHit = 4;
this.soundKilled = 14;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.value = 120000f;
this.scale = 1.25f;
this.boss = true;
this.netAlways = true;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
flag = true;
}
else
{
if (this.type == 135)
{
this.displayName = "The Destroyer";
this.npcSlots = 5f;
this.name = "The Destroyer Body";
this.width = 38;
this.height = 38;
this.aiStyle = 37;
this.damage = 35;
this.defense = 26;
this.lifeMax = 60000;
this.soundHit = 4;
this.soundKilled = 14;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.netAlways = true;
this.scale = 1.25f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
NPC.noStream = true;
}
else
{
if (this.type == 136)
{
this.displayName = "The Destroyer";
this.npcSlots = 5f;
this.name = "The Destroyer Tail";
this.width = 38;
this.height = 38;
this.aiStyle = 37;
this.damage = 20;
this.defense = 30;
this.lifeMax = 60000;
this.soundHit = 4;
this.soundKilled = 14;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.behindTiles = true;
this.scale = 1.25f;
this.netAlways = true;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
NPC.noStream = true;
}
else
{
if (this.type == 139)
{
this.npcSlots = 1f;
this.name = "Probe";
this.width = 30;
this.height = 30;
this.aiStyle = 5;
this.damage = 40;
this.defense = 18;
this.lifeMax = 180;
this.soundHit = 4;
this.soundKilled = 14;
this.noGravity = true;
this.knockBackResist = 0.8f;
this.noTileCollide = true;
}
else
{
if (this.type == 137)
{
this.name = "Illuminant Bat";
this.width = 26;
this.height = 20;
this.aiStyle = 14;
this.damage = 75;
this.defense = 30;
this.lifeMax = 200;
this.soundHit = 1;
this.knockBackResist = 0.75f;
this.soundKilled = 6;
this.value = 500f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 138)
{
this.name = "Illuminant Slime";
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 70;
this.defense = 30;
this.lifeMax = 180;
this.soundHit = 1;
this.soundKilled = 6;
this.alpha = 100;
this.value = 400f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.85f;
this.scale = 1.05f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 140)
{
this.name = "Possessed Armor";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 55;
this.defense = 28;
this.lifeMax = 260;
this.soundHit = 4;
this.soundKilled = 6;
this.knockBackResist = 0.4f;
this.value = 400f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.buffImmune[24] = true;
}
else
{
if (this.type == 141)
{
this.name = "Toxic Sludge";
this.width = 34;
this.height = 28;
this.aiStyle = 1;
this.damage = 50;
this.defense = 18;
this.lifeMax = 150;
this.soundHit = 1;
this.soundKilled = 1;
this.alpha = 55;
this.value = 400f;
this.scale = 1.1f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.knockBackResist = 0.8f;
}
else
{
if (this.type == 142)
{
this.townNPC = true;
this.friendly = true;
this.name = "Santa Claus";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 143)
{
this.name = "Snowman Gangsta";
this.width = 26;
this.height = 40;
this.aiStyle = 38;
this.damage = 50;
this.defense = 20;
this.lifeMax = 200;
this.soundHit = 11;
this.soundKilled = 15;
this.knockBackResist = 0.6f;
this.value = 400f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 144)
{
this.name = "Mister Stabby";
this.width = 26;
this.height = 40;
this.aiStyle = 38;
this.damage = 65;
this.defense = 26;
this.lifeMax = 240;
this.soundHit = 11;
this.soundKilled = 15;
this.knockBackResist = 0.6f;
this.value = 400f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 145)
{
this.name = "Snow Balla";
this.width = 26;
this.height = 40;
this.aiStyle = 38;
this.damage = 55;
this.defense = 22;
this.lifeMax = 220;
this.soundHit = 11;
this.soundKilled = 15;
this.knockBackResist = 0.6f;
this.value = 400f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 147)
{
this.name = "Ice Slime";
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 8;
this.defense = 4;
this.lifeMax = 30;
this.soundHit = 1;
this.soundKilled = 1;
this.alpha = 50;
this.value = 50f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 148)
{
this.name = "Penguin";
this.width = 16;
this.height = 34;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.soundHit = 1;
this.soundKilled = 1;
}
else
{
if (this.type == 149)
{
this.name = "Penguin";
this.width = 16;
this.height = 34;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.soundHit = 1;
this.soundKilled = 1;
}
else
{
if (this.type == 150)
{
this.npcSlots = 0.5f;
this.name = "Ice Bat";
this.width = 22;
this.height = 22;
this.aiStyle = 14;
this.damage = 18;
this.defense = 6;
this.lifeMax = 30;
this.soundHit = 1;
this.knockBackResist = 0.8f;
this.soundKilled = 4;
this.value = 130f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 151)
{
this.npcSlots = 0.5f;
this.name = "Lava bat";
this.width = 22;
this.height = 22;
this.aiStyle = 14;
this.damage = 50;
this.defense = 16;
this.lifeMax = 160;
this.soundHit = 1;
this.knockBackResist = 0.6f;
this.soundKilled = 4;
this.value = 400f;
this.scale = 1.15f;
this.lavaImmune = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 152)
{
this.npcSlots = 0.5f;
this.name = "Giant Flying Fox";
this.width = 38;
this.height = 34;
this.aiStyle = 14;
this.damage = 80;
this.defense = 24;
this.lifeMax = 220;
this.soundHit = 1;
this.knockBackResist = 0.65f;
this.soundKilled = 4;
this.value = 400f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 153)
{
this.npcSlots = 2f;
this.name = "Giant Tortoise";
this.width = 46;
this.height = 32;
this.aiStyle = 39;
this.damage = 80;
this.defense = 30;
this.lifeMax = 470;
this.soundHit = 7;
this.knockBackResist = 0.3f;
this.soundKilled = 5;
this.value = 500f;
this.noGravity = false;
this.buffImmune[31] = false;
}
else
{
if (this.type == 154)
{
this.npcSlots = 1.5f;
this.name = "Ice Tortoise";
this.width = 46;
this.height = 32;
this.aiStyle = 39;
this.damage = 55;
this.defense = 28;
this.lifeMax = 400;
this.soundHit = 7;
this.knockBackResist = 0.3f;
this.soundKilled = 5;
this.value = 450f;
this.noGravity = false;
this.buffImmune[31] = false;
}
else
{
if (this.type == 155)
{
this.name = "Wolf";
this.width = 46;
this.height = 30;
this.aiStyle = 26;
this.damage = 65;
this.defense = 30;
this.lifeMax = 300;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.3f;
this.value = 1000f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 156)
{
this.npcSlots = 2f;
this.name = "Red Devil";
this.width = 28;
this.height = 48;
this.aiStyle = 14;
this.damage = 50;
this.defense = 40;
this.lifeMax = 600;
this.soundHit = 1;
this.knockBackResist = 0.5f;
this.soundKilled = 1;
this.value = 1200f;
this.lavaImmune = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 157)
{
this.npcSlots = 0.5f;
this.noGravity = true;
this.name = "Arapaima";
this.width = 74;
this.height = 20;
this.aiStyle = 16;
this.damage = 75;
this.defense = 30;
this.lifeMax = 200;
this.soundHit = 1;
this.soundKilled = 1;
this.value = 500f;
}
else
{
if (this.type == 158)
{
this.npcSlots = 2f;
this.name = "Vampire";
this.width = 22;
this.height = 22;
this.aiStyle = 14;
this.damage = 60;
this.defense = 30;
this.lifeMax = 500;
this.soundHit = 1;
this.knockBackResist = 0.75f;
this.soundKilled = 6;
this.value = 5000f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 159)
{
this.npcSlots = 2f;
this.name = "Vampire";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 80;
this.defense = 20;
this.lifeMax = 500;
this.soundHit = 1;
this.soundKilled = 6;
this.knockBackResist = 0.4f;
this.value = 5000f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 160)
{
this.townNPC = true;
this.friendly = true;
this.name = "Truffle";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 161)
{
this.name = "Zombie Eskimo";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 16;
this.defense = 8;
this.lifeMax = 50;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.45f;
this.value = 80f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 162)
{
this.name = "Frankenstein";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 60;
this.defense = 18;
this.lifeMax = 220;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.3f;
this.value = 600f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 163)
{
this.name = "Black Recluse";
this.width = 50;
this.height = 20;
this.aiStyle = 3;
this.damage = 90;
this.defense = 40;
this.lifeMax = 200;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.25f;
this.value = 500f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
this.npcSlots = 0.5f;
this.timeLeft = NPC.activeTime * 2;
}
else
{
if (this.type == 238)
{
this.noGravity = true;
this.name = "Black Recluse";
this.width = 50;
this.height = 20;
this.aiStyle = 40;
this.damage = 100;
this.defense = 40;
this.lifeMax = 200;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.25f;
this.value = 500f;
this.timeLeft = NPC.activeTime * 2;
this.npcSlots = 0.5f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 164)
{
this.name = "Wall Creeper";
this.width = 50;
this.height = 20;
this.aiStyle = 3;
this.damage = 30;
this.defense = 10;
this.lifeMax = 80;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.25f;
this.value = 100f;
this.timeLeft = NPC.activeTime * 2;
this.npcSlots = 0.5f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 165)
{
this.noGravity = true;
this.name = "Wall Creeper";
this.width = 50;
this.height = 20;
this.aiStyle = 40;
this.damage = 30;
this.defense = 10;
this.lifeMax = 80;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.25f;
this.value = 100f;
this.timeLeft = NPC.activeTime * 2;
this.npcSlots = 0.5f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 166)
{
this.name = "Swamp Thing";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 80;
this.defense = 32;
this.lifeMax = 350;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.2f;
this.value = 1000f;
this.buffImmune[31] = false;
this.buffImmune[20] = true;
}
else
{
if (this.type == 167)
{
this.name = "Undead Viking";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 24;
this.defense = 10;
this.lifeMax = 70;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.5f;
this.value = 200f;
this.buffImmune[31] = false;
this.buffImmune[20] = true;
}
else
{
if (this.type == 168)
{
this.name = "Corrupt Penguin";
this.width = 16;
this.height = 34;
this.aiStyle = 3;
this.damage = 20;
this.defense = 4;
this.lifeMax = 70;
this.soundHit = 1;
this.soundKilled = 1;
this.value = 500f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 169)
{
this.noGravity = true;
this.name = "Ice Elemental";
this.width = 18;
this.height = 40;
this.aiStyle = 22;
this.damage = 55;
this.defense = 20;
this.lifeMax = 200;
this.soundHit = 5;
this.knockBackResist = 0.6f;
this.soundKilled = 7;
this.value = 1500f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.buffImmune[31] = false;
this.buffImmune[44] = true;
}
else
{
if (this.type == 170)
{
this.name = "Pigron";
this.width = 44;
this.height = 36;
this.aiStyle = 2;
this.damage = 70;
this.defense = 16;
this.lifeMax = 210;
this.soundHit = 7;
this.soundKilled = 17;
this.knockBackResist = 0.5f;
this.value = 2000f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 171)
{
this.name = "Pigron";
this.width = 44;
this.height = 36;
this.aiStyle = 2;
this.damage = 70;
this.defense = 16;
this.lifeMax = 210;
this.soundHit = 7;
this.soundKilled = 17;
this.knockBackResist = 0.5f;
this.value = 2000f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 172)
{
this.name = "Rune Wizard";
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 200;
this.defense = 30;
this.lifeMax = 600;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.3f;
this.value = 5000f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 173)
{
this.npcSlots = 1f;
this.name = "Crimera";
this.width = 30;
this.height = 30;
this.aiStyle = 5;
this.damage = 22;
this.defense = 8;
this.lifeMax = 40;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.knockBackResist = 0.5f;
this.value = 90f;
}
else
{
if (this.type == 174)
{
this.npcSlots = 1f;
this.name = "Herpling";
this.width = 52;
this.height = 26;
this.aiStyle = 41;
this.damage = 65;
this.defense = 26;
this.lifeMax = 220;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.3f;
this.value = 450f;
}
else
{
if (this.type == 175)
{
this.noGravity = true;
this.noTileCollide = true;
this.name = "Angry Trapper";
this.width = 30;
this.height = 30;
this.aiStyle = 13;
this.damage = 100;
this.defense = 30;
this.lifeMax = 300;
this.soundHit = 1;
this.knockBackResist = 0.25f;
this.soundKilled = 1;
this.value = 650f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 176)
{
this.name = "Moss Hornet";
this.width = 34;
this.height = 32;
this.aiStyle = 5;
this.damage = 70;
this.defense = 22;
this.lifeMax = 220;
this.soundHit = 1;
this.knockBackResist = 0.5f;
this.soundKilled = 1;
this.value = 600f;
this.noGravity = true;
this.buffImmune[20] = true;
this.npcSlots = 1.5f;
}
else
{
if (this.type == 177)
{
this.npcSlots = 1f;
this.name = "Derpling";
this.width = 58;
this.height = 44;
this.aiStyle = 41;
this.damage = 80;
this.defense = 26;
this.lifeMax = 300;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
this.value = 500f;
}
else
{
if (this.type == 178)
{
this.townNPC = true;
this.friendly = true;
this.name = "Steampunker";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 179)
{
this.name = "Crimson Axe";
this.width = 40;
this.height = 40;
this.aiStyle = 23;
this.damage = 80;
this.defense = 18;
this.lifeMax = 200;
this.soundHit = 4;
this.soundKilled = 6;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.4f;
}
else
{
if (this.type == 180)
{
this.name = "Pigron";
this.width = 44;
this.height = 36;
this.aiStyle = 2;
this.damage = 70;
this.defense = 16;
this.lifeMax = 210;
this.soundHit = 7;
this.soundKilled = 17;
this.knockBackResist = 0.5f;
this.value = 4000f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 181)
{
this.name = "Face Monster";
this.width = 18;
this.height = 44;
this.aiStyle = 3;
this.damage = 25;
this.defense = 10;
this.lifeMax = 70;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.4f;
this.value = 200f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 182)
{
this.noGravity = true;
this.noTileCollide = true;
this.name = "Floaty Gross";
this.width = 24;
this.height = 62;
this.aiStyle = 22;
this.damage = 65;
this.defense = 18;
this.lifeMax = 240;
this.soundHit = 1;
this.soundKilled = 2;
this.alpha = 100;
this.value = 500f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.7f;
}
else
{
if (this.type == 183)
{
this.name = "Crimslime";
this.width = 40;
this.height = 30;
this.aiStyle = 1;
this.damage = 60;
this.defense = 26;
this.lifeMax = 200;
this.soundHit = 1;
this.soundKilled = 1;
this.alpha = 55;
this.value = 400f;
this.scale = 1.1f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 184)
{
this.name = "Spiked Ice Slime";
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 12;
this.defense = 8;
this.lifeMax = 60;
this.scale = 1.1f;
this.soundHit = 1;
this.soundKilled = 1;
this.alpha = 50;
this.value = 200f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 185)
{
this.name = "Snow Flinx";
this.width = 28;
this.height = 28;
this.aiStyle = 3;
this.damage = 26;
this.defense = 12;
this.lifeMax = 70;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 1.1f;
this.value = 200f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 186)
{
this.name = "Pincushion Zombie";
this.displayName = "Zombie";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 16;
this.defense = 8;
this.lifeMax = 50;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.45f;
this.value = 65f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 187)
{
this.name = "Slimed Zombie";
this.displayName = "Zombie";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 13;
this.defense = 6;
this.lifeMax = 40;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.55f;
this.value = 55f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 188)
{
this.name = "Swamp Zombie";
this.displayName = "Zombie";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 13;
this.defense = 8;
this.lifeMax = 45;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.45f;
this.value = 80f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 189)
{
this.name = "Twiggy Zombie";
this.displayName = "Zombie";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 16;
this.defense = 4;
this.lifeMax = 45;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.55f;
this.value = 70f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 190)
{
this.name = "Cataract Eye";
this.displayName = "Demon Eye";
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 18;
this.defense = 4;
this.lifeMax = 65;
this.soundHit = 1;
this.knockBackResist = 0.7f;
this.soundKilled = 1;
this.value = 75f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 191)
{
this.name = "Sleepy Eye";
this.displayName = "Demon Eye";
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 16;
this.defense = 2;
this.lifeMax = 60;
this.soundHit = 1;
this.knockBackResist = 0.85f;
this.soundKilled = 1;
this.value = 75f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 192)
{
this.name = "Dialated Eye";
this.displayName = "Demon Eye";
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 18;
this.defense = 2;
this.lifeMax = 50;
this.soundHit = 1;
this.knockBackResist = 0.8f;
this.soundKilled = 1;
this.value = 75f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 193)
{
this.name = "Green Eye";
this.displayName = "Demon Eye";
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 20;
this.defense = 0;
this.lifeMax = 60;
this.soundHit = 1;
this.knockBackResist = 0.8f;
this.soundKilled = 1;
this.value = 75f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 194)
{
this.name = "Purple Eye";
this.displayName = "Demon Eye";
this.width = 30;
this.height = 32;
this.aiStyle = 2;
this.damage = 14;
this.defense = 4;
this.lifeMax = 60;
this.soundHit = 1;
this.knockBackResist = 0.8f;
this.soundKilled = 1;
this.value = 75f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 195)
{
this.name = "Lost Girl";
this.width = 18;
this.height = 40;
this.aiStyle = 42;
this.damage = 10;
this.defense = 30;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 196)
{
this.name = "Nymph";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 35;
this.defense = 16;
this.lifeMax = 300;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.4f;
this.value = 10000f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 197)
{
this.name = "Armored Viking";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 50;
this.defense = 28;
this.lifeMax = 280;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.45f;
this.value = 500f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 198)
{
this.name = "Lihzahrd";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 38;
this.defense = 20;
this.lifeMax = 400;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.4f;
this.value = 650f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 199)
{
this.name = "Lihzahrd";
this.width = 42;
this.height = 30;
this.aiStyle = 3;
this.damage = 60;
this.defense = 30;
this.lifeMax = 400;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0f;
this.value = 650f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 200)
{
this.name = "Female Zombie";
this.displayName = "Zombie";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 12;
this.defense = 4;
this.lifeMax = 38;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.6f;
this.value = 65f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 201)
{
this.name = "Headache Skeleton";
this.displayName = "Skeleton";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 20;
this.defense = 12;
this.lifeMax = 55;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.5f;
this.value = 130f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 202)
{
this.name = "Misassembled Skeleton";
this.displayName = "Skeleton";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 18;
this.defense = 8;
this.lifeMax = 65;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.5f;
this.value = 120f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 203)
{
this.name = "Pantless Skeleton";
this.displayName = "Skeleton";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 22;
this.defense = 8;
this.lifeMax = 60;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.5f;
this.value = 110f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 204)
{
this.name = "Spiked Jungle Slime";
this.width = 24;
this.height = 18;
this.aiStyle = 1;
this.damage = 28;
this.defense = 8;
this.lifeMax = 65;
this.scale = 1.15f;
this.soundHit = 1;
this.soundKilled = 1;
this.alpha = 50;
this.value = 300f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 205)
{
this.name = "Moth";
this.width = 40;
this.height = 40;
this.aiStyle = 5;
this.damage = 70;
this.defense = 28;
this.lifeMax = 1000;
this.soundHit = 1;
this.knockBackResist = 0.4f;
this.soundKilled = 1;
this.value = 600f;
this.noGravity = true;
this.buffImmune[20] = true;
}
else
{
if (this.type == 206)
{
this.name = "Icy Merman";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 60;
this.defense = 30;
this.lifeMax = 280;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
this.value = 500f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 207)
{
this.townNPC = true;
this.friendly = true;
this.name = "Dye Trader";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 208)
{
this.townNPC = true;
this.friendly = true;
this.name = "Party Girl";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 209)
{
this.townNPC = true;
this.friendly = true;
this.name = "Cyborg";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 210)
{
this.name = "Bee";
this.width = 12;
this.height = 12;
this.aiStyle = 5;
this.damage = 20;
this.defense = 5;
this.lifeMax = 20;
this.soundHit = 1;
this.knockBackResist = 0.5f;
this.soundKilled = 1;
this.noGravity = true;
this.buffImmune[20] = true;
}
else
{
if (this.type == 211)
{
this.name = "Bee";
this.width = 8;
this.height = 8;
this.aiStyle = 5;
this.damage = 15;
this.defense = 2;
this.lifeMax = 10;
this.soundHit = 1;
this.knockBackResist = 0.5f;
this.soundKilled = 1;
this.noGravity = true;
this.buffImmune[20] = true;
}
else
{
if (this.type == 212)
{
this.name = "Pirate Deckhand";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 35;
this.defense = 16;
this.lifeMax = 200;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.4f;
this.value = 700f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 213)
{
this.name = "Pirate Corsair";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 50;
this.defense = 20;
this.lifeMax = 300;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.2f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 214)
{
this.name = "Pirate Deadeye";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 30;
this.defense = 12;
this.lifeMax = 150;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.3f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 215)
{
this.name = "Pirate Crossbower";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 35;
this.defense = 18;
this.lifeMax = 260;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.35f;
this.value = 1500f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 216)
{
this.name = "Pirate Captain";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 70;
this.defense = 28;
this.lifeMax = 2000;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0f;
this.value = 50000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 217)
{
this.name = "Cochineal Beetle";
this.width = 28;
this.height = 20;
this.aiStyle = 3;
this.damage = 20;
this.defense = 10;
this.lifeMax = 40;
this.soundHit = 1;
this.soundKilled = 16;
this.value = 60f;
}
else
{
if (this.type == 218)
{
this.name = "Cyan Beetle";
this.width = 28;
this.height = 20;
this.aiStyle = 3;
this.damage = 20;
this.defense = 10;
this.lifeMax = 40;
this.soundHit = 1;
this.soundKilled = 16;
this.value = 60f;
}
else
{
if (this.type == 219)
{
this.name = "Lac Beetle";
this.width = 28;
this.height = 20;
this.aiStyle = 3;
this.damage = 20;
this.defense = 10;
this.lifeMax = 40;
this.soundHit = 1;
this.soundKilled = 16;
this.value = 60f;
}
else
{
if (this.type == 220)
{
this.name = "Sea Snail";
this.width = 28;
this.height = 20;
this.aiStyle = 3;
this.damage = 20;
this.defense = 10;
this.lifeMax = 40;
this.soundHit = 1;
this.soundKilled = 1;
this.value = 60f;
}
else
{
if (this.type == 221)
{
this.noGravity = true;
this.name = "Squid";
this.width = 26;
this.height = 26;
this.aiStyle = 18;
this.damage = 20;
this.defense = 2;
this.lifeMax = 30;
this.soundHit = 1;
this.soundKilled = 1;
this.value = 100f;
this.alpha = 20;
}
else
{
if (this.type == 222)
{
this.name = "Queen Bee";
this.width = 66;
this.height = 66;
this.aiStyle = 43;
this.damage = 30;
this.defense = 8;
this.lifeMax = 3400;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0f;
this.noGravity = true;
this.noTileCollide = true;
this.timeLeft = NPC.activeTime * 30;
this.boss = true;
this.value = 100000f;
this.npcSlots = 5f;
}
else
{
if (this.type == 223)
{
this.name = "Zombie";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 16;
this.defense = 8;
this.lifeMax = 50;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.45f;
this.value = 70f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 224)
{
this.name = "Flying Fish";
this.width = 32;
this.height = 18;
this.aiStyle = 44;
this.damage = 9;
this.defense = 4;
this.lifeMax = 20;
this.soundHit = 1;
this.knockBackResist = 0.8f;
this.soundKilled = 1;
this.value = 90f;
this.buffImmune[31] = false;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (this.type == 225)
{
this.name = "Umbrella Slime";
this.width = 38;
this.height = 26;
this.aiStyle = 1;
this.damage = 10;
this.defense = 5;
this.lifeMax = 35;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.75f;
this.value = 25f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 226)
{
this.npcSlots = 0.5f;
this.name = "Flying Snake";
this.width = 34;
this.height = 50;
this.aiStyle = 14;
this.damage = 85;
this.defense = 28;
this.lifeMax = 260;
this.soundHit = 1;
this.knockBackResist = 0.65f;
this.soundKilled = 1;
this.value = 400f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 227)
{
this.townNPC = true;
this.friendly = true;
this.name = "Painter";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 228)
{
this.townNPC = true;
this.friendly = true;
this.name = "Witch Doctor";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 229)
{
this.townNPC = true;
this.friendly = true;
this.name = "Pirate";
this.width = 18;
this.height = 40;
this.aiStyle = 7;
this.damage = 10;
this.defense = 15;
this.lifeMax = 250;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.5f;
}
else
{
if (this.type == 230)
{
this.name = "Goldfish";
this.width = 18;
this.height = 20;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.soundHit = 1;
this.soundKilled = 1;
}
else
{
if (this.type == 231)
{
this.name = "Hornet Fatty";
this.width = 34;
this.height = 32;
this.aiStyle = 5;
this.damage = 22;
this.defense = 16;
this.lifeMax = 50;
this.soundHit = 1;
this.knockBackResist = 0.3f;
this.soundKilled = 1;
this.value = 200f;
this.noGravity = true;
this.buffImmune[20] = true;
}
else
{
if (this.type == 232)
{
this.name = "Hornet Honey";
this.width = 34;
this.height = 32;
this.aiStyle = 5;
this.damage = 28;
this.defense = 12;
this.lifeMax = 42;
this.soundHit = 1;
this.knockBackResist = 0.6f;
this.soundKilled = 1;
this.value = 200f;
this.noGravity = true;
this.buffImmune[20] = true;
}
else
{
if (this.type == 233)
{
this.name = "Hornet Leafy";
this.width = 34;
this.height = 32;
this.aiStyle = 5;
this.damage = 30;
this.defense = 14;
this.lifeMax = 38;
this.soundHit = 1;
this.knockBackResist = 0.45f;
this.soundKilled = 1;
this.value = 200f;
this.noGravity = true;
this.buffImmune[20] = true;
}
else
{
if (this.type == 234)
{
this.name = "Hornet Spikey";
this.width = 34;
this.height = 32;
this.aiStyle = 5;
this.damage = 32;
this.defense = 6;
this.lifeMax = 42;
this.soundHit = 1;
this.knockBackResist = 0.55f;
this.soundKilled = 1;
this.value = 200f;
this.noGravity = true;
this.buffImmune[20] = true;
}
else
{
if (this.type == 235)
{
this.name = "Hornet Stingy";
this.width = 34;
this.height = 32;
this.aiStyle = 5;
this.damage = 34;
this.defense = 4;
this.lifeMax = 38;
this.soundHit = 1;
this.knockBackResist = 0.6f;
this.soundKilled = 1;
this.value = 200f;
this.noGravity = true;
this.buffImmune[20] = true;
}
else
{
if (this.type == 236)
{
this.name = "Jungle Creeper";
this.width = 50;
this.height = 20;
this.aiStyle = 3;
this.damage = 50;
this.defense = 14;
this.lifeMax = 120;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.25f;
this.value = 1000f;
this.timeLeft = NPC.activeTime * 2;
this.npcSlots = 0.75f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 237)
{
this.noGravity = true;
this.name = "Jungle Creeper";
this.width = 50;
this.height = 20;
this.aiStyle = 40;
this.damage = 50;
this.defense = 14;
this.lifeMax = 120;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0.25f;
this.value = 1000f;
this.timeLeft = NPC.activeTime * 2;
this.npcSlots = 0.75f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 239)
{
this.name = "Blood Crawler";
this.width = 50;
this.height = 20;
this.aiStyle = 3;
this.damage = 30;
this.defense = 8;
this.lifeMax = 60;
this.soundHit = 13;
this.soundKilled = 19;
this.knockBackResist = 0.5f;
this.value = 130f;
this.timeLeft = NPC.activeTime * 2;
this.buffImmune[20] = true;
}
else
{
if (this.type == 240)
{
this.noGravity = true;
this.name = "Blood Crawler";
this.width = 50;
this.height = 20;
this.aiStyle = 40;
this.damage = 30;
this.defense = 8;
this.lifeMax = 60;
this.soundHit = 13;
this.soundKilled = 19;
this.knockBackResist = 0.5f;
this.value = 130f;
this.timeLeft = NPC.activeTime * 2;
this.buffImmune[20] = true;
}
else
{
if (this.type == 241)
{
this.npcSlots = 0.5f;
this.noGravity = true;
this.name = "Blood Feeder";
this.width = 18;
this.height = 20;
this.aiStyle = 16;
this.damage = 30;
this.defense = 4;
this.lifeMax = 20;
this.soundHit = 13;
this.soundKilled = 19;
this.value = 350f;
}
else
{
if (this.type == 242)
{
this.noGravity = true;
this.name = "Blood Jelly";
this.width = 26;
this.height = 26;
this.aiStyle = 18;
this.damage = 75;
this.defense = 20;
this.lifeMax = 150;
this.soundHit = 13;
this.soundKilled = 19;
this.value = 800f;
this.alpha = 20;
}
else
{
if (this.type == 243)
{
this.name = "Ice Golem";
this.width = 30;
this.height = 114;
this.aiStyle = 3;
this.damage = 50;
this.defense = 32;
this.lifeMax = 3000;
this.soundHit = 5;
this.soundKilled = 7;
this.knockBackResist = 0.05f;
this.value = (float)Item.buyPrice(0, 1, 50, 0);
this.buffImmune[20] = true;
this.buffImmune[44] = true;
}
else
{
if (this.type == 244)
{
this.name = "Rainbow Slime";
this.width = 60;
this.height = 42;
this.aiStyle = 1;
this.damage = 85;
this.defense = 26;
this.lifeMax = 400;
this.soundHit = 1;
this.soundKilled = 1;
this.alpha = 175;
this.value = (float)Item.buyPrice(0, 0, 20, 0);
this.knockBackResist = 0.3f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 245)
{
this.name = "Golem";
this.width = 140;
this.height = 140;
this.aiStyle = 45;
this.damage = 70;
this.defense = 24;
this.lifeMax = 8000;
this.soundHit = 4;
this.soundKilled = 14;
this.knockBackResist = 0f;
this.alpha = 255;
this.boss = true;
}
else
{
if (this.type == 246)
{
this.noGravity = true;
this.name = "Golem Head";
this.width = 70;
this.height = 70;
this.aiStyle = 46;
this.damage = 60;
this.defense = 18;
this.lifeMax = 15000;
this.soundHit = 4;
this.soundKilled = 0;
this.knockBackResist = 0f;
this.alpha = 255;
}
else
{
if (this.type == 247 || this.type == 248)
{
this.noGravity = true;
this.name = "Golem Fist";
this.width = 40;
this.height = 30;
this.aiStyle = 47;
this.damage = 55;
this.defense = 28;
this.lifeMax = 6000;
this.soundHit = 4;
this.soundKilled = 14;
this.alpha = 255;
}
else
{
if (this.type == 249)
{
this.noGravity = true;
this.name = "Golem Head";
this.width = 70;
this.height = 70;
this.aiStyle = 48;
this.damage = 80;
this.defense = 30;
this.lifeMax = 10000;
this.soundHit = 4;
this.soundKilled = 14;
this.knockBackResist = 0f;
this.dontTakeDamage = true;
}
else
{
if (this.type == 250)
{
this.name = "Angry Nimbus";
this.width = 34;
this.height = 26;
this.aiStyle = 49;
this.damage = 50;
this.defense = 24;
this.lifeMax = 300;
this.soundHit = 1;
this.soundKilled = 6;
this.knockBackResist = 0.3f;
this.value = 300f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 251)
{
this.name = "Eyezor";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 50;
this.defense = 30;
this.lifeMax = 1000;
this.soundHit = 1;
this.soundKilled = 2;
this.knockBackResist = 0.3f;
this.value = (float)Item.buyPrice(0, 0, 50, 0);
this.buffImmune[31] = false;
}
else
{
if (this.type == 252)
{
this.noGravity = true;
this.npcSlots = 0.5f;
this.name = "Parrot";
this.width = 32;
this.height = 32;
this.aiStyle = 5;
this.damage = 80;
this.defense = 12;
this.lifeMax = 100;
this.soundHit = 1;
this.knockBackResist = 0.7f;
this.soundKilled = 4;
this.value = 500f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 253)
{
this.noGravity = true;
this.noTileCollide = true;
this.name = "Reaper";
this.width = 24;
this.height = 44;
this.aiStyle = 22;
this.damage = 80;
this.defense = 18;
this.lifeMax = 300;
this.soundHit = 1;
this.soundKilled = 6;
this.alpha = 100;
this.value = 1500f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
this.knockBackResist = 0.6f;
}
else
{
if (this.type == 254)
{
this.name = "Zombie";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 40;
this.defense = 10;
this.lifeMax = 180;
this.soundHit = 1;
this.soundKilled = 6;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 255)
{
this.name = "Zombie";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 38;
this.defense = 16;
this.lifeMax = 220;
this.soundHit = 1;
this.soundKilled = 6;
this.knockBackResist = 0.3f;
this.value = 1200f;
this.buffImmune[31] = false;
}
else
{
if (this.type == 256)
{
this.noGravity = true;
this.name = "Fungo Fish";
this.width = 26;
this.height = 26;
this.aiStyle = 18;
this.damage = 90;
this.defense = 20;
this.lifeMax = 140;
this.soundHit = 1;
this.soundKilled = 6;
this.value = 1200f;
this.alpha = 20;
this.npcSlots = 0.3f;
}
else
{
if (this.type == 257)
{
this.name = "Anomura Fungus";
this.width = 44;
this.height = 34;
this.aiStyle = 3;
this.damage = 38;
this.defense = 24;
this.lifeMax = 230;
this.soundHit = 1;
this.soundKilled = 6;
this.knockBackResist = 0.3f;
this.value = 1300f;
this.buffImmune[31] = false;
this.npcSlots = 0.3f;
}
else
{
if (this.type == 258)
{
this.name = "Mushi Ladybug";
this.width = 30;
this.height = 24;
this.aiStyle = 3;
this.damage = 60;
this.defense = 16;
this.lifeMax = 220;
this.soundHit = 1;
this.soundKilled = 6;
this.knockBackResist = 0.3f;
this.value = 1500f;
this.buffImmune[31] = false;
this.npcSlots = 0.3f;
}
else
{
if (this.type == 259)
{
this.noGravity = true;
this.noTileCollide = true;
this.name = "Fungi Bulb";
this.width = 20;
this.height = 20;
this.aiStyle = 13;
this.damage = 24;
this.defense = 4;
this.lifeMax = 90;
this.soundHit = 1;
this.knockBackResist = 0f;
this.soundKilled = 1;
this.value = 350f;
this.buffImmune[20] = true;
this.npcSlots = 0.3f;
}
else
{
if (this.type == 260)
{
this.noGravity = true;
this.noTileCollide = true;
this.name = "Giant Fungi Bulb";
this.width = 36;
this.height = 36;
this.aiStyle = 13;
this.damage = 70;
this.defense = 20;
this.lifeMax = 300;
this.soundHit = 1;
this.knockBackResist = 0f;
this.soundKilled = 1;
this.value = 1250f;
this.buffImmune[20] = true;
this.npcSlots = 0.3f;
}
else
{
if (this.type == 261)
{
this.name = "Fungi Spore";
this.width = 12;
this.height = 12;
this.aiStyle = 50;
this.damage = 80;
this.defense = 0;
this.lifeMax = 1;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.npcSlots = 0f;
}
else
{
if (this.type == 262)
{
this.noTileCollide = true;
this.name = "Plantera";
this.width = 86;
this.height = 86;
this.aiStyle = 51;
this.damage = 50;
this.defense = 14;
this.lifeMax = 30000;
this.soundHit = 1;
this.soundKilled = 1;
this.knockBackResist = 0f;
this.noGravity = true;
this.boss = true;
this.npcSlots = 16f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 263)
{
this.noTileCollide = true;
this.noGravity = true;
this.name = "Plantera's Hook";
this.width = 40;
this.height = 40;
this.aiStyle = 52;
this.damage = 60;
this.defense = 24;
this.lifeMax = 4000;
this.dontTakeDamage = true;
this.soundHit = 1;
this.soundKilled = 1;
this.buffImmune[20] = true;
}
else
{
if (this.type == 264)
{
this.name = "Plantera's Tentacle";
this.width = 24;
this.height = 24;
this.aiStyle = 53;
this.damage = 60;
this.defense = 20;
this.lifeMax = 1000;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.buffImmune[20] = true;
}
else
{
if (this.type == 265)
{
this.name = "Spore";
this.width = 18;
this.height = 18;
this.aiStyle = 50;
this.damage = 70;
this.defense = 0;
this.lifeMax = 1;
this.soundHit = 1;
this.soundKilled = 1;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0f;
this.npcSlots = 0f;
}
else
{
if (this.type == 266)
{
this.name = "Brain of Cthulhu";
this.dontTakeDamage = true;
this.width = 160;
this.height = 110;
this.aiStyle = 54;
this.damage = 30;
this.defense = 14;
this.lifeMax = 1000;
this.soundHit = 9;
this.soundKilled = 11;
this.knockBackResist = 0f;
this.noGravity = true;
this.noTileCollide = true;
this.timeLeft = NPC.activeTime * 30;
this.boss = true;
this.value = 50000f;
this.npcSlots = 6f;
}
else
{
if (this.type == 267)
{
this.name = "Creeper";
this.width = 30;
this.height = 30;
this.aiStyle = 55;
this.damage = 20;
this.defense = 10;
this.lifeMax = 100;
this.soundHit = 9;
this.soundKilled = 11;
this.noGravity = true;
this.noTileCollide = true;
this.knockBackResist = 0.8f;
}
else
{
if (this.type == 268)
{
this.noGravity = true;
this.name = "Ichor Sticker";
this.width = 28;
this.height = 56;
this.aiStyle = 22;
this.damage = 55;
this.defense = 20;
this.lifeMax = 340;
this.soundHit = 13;
this.soundKilled = 19;
this.knockBackResist = 0.6f;
this.value = 450f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 269)
{
this.name = "Rusty Armored Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 70;
this.defense = 34;
this.lifeMax = 550;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.3f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 270)
{
this.name = "Rusty Armored Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 55;
this.defense = 50;
this.lifeMax = 400;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.2f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 271)
{
this.name = "Rusty Armored Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 70;
this.defense = 40;
this.lifeMax = 450;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.25f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 272)
{
this.name = "Rusty Armored Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 75;
this.defense = 28;
this.lifeMax = 400;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.35f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 273)
{
this.name = "Blue Armored Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 45;
this.defense = 50;
this.lifeMax = 500;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.15f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 274)
{
this.name = "Blue Armored Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 65;
this.defense = 34;
this.lifeMax = 350;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 275)
{
this.name = "Blue Armored Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 45;
this.defense = 50;
this.lifeMax = 550;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.15f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 276)
{
this.name = "Blue Armored Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 85;
this.defense = 54;
this.lifeMax = 500;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.2f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 277)
{
this.name = "Hell Armored Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 70;
this.defense = 32;
this.lifeMax = 400;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 278)
{
this.name = "Hell Armored Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 65;
this.defense = 48;
this.lifeMax = 450;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.3f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 279)
{
this.name = "Hell Armored Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 40;
this.defense = 54;
this.lifeMax = 500;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.2f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 280)
{
this.name = "Hell Armored Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 75;
this.defense = 34;
this.lifeMax = 500;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 281)
{
this.name = "Ragged Caster";
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 40;
this.defense = 20;
this.lifeMax = 400;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.6f;
this.value = 1500f;
this.npcSlots = 2f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 282)
{
this.name = "Ragged Caster";
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 35;
this.defense = 28;
this.lifeMax = 450;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.5f;
this.value = 1500f;
this.npcSlots = 2f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 283)
{
this.name = "Necromancer";
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 50;
this.defense = 18;
this.lifeMax = 300;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.55f;
this.value = 1500f;
this.npcSlots = 2f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 284)
{
this.name = "Necromancer";
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 35;
this.defense = 24;
this.lifeMax = 450;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.5f;
this.value = 1500f;
this.npcSlots = 2f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 285)
{
this.name = "Diabolist";
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 50;
this.defense = 12;
this.lifeMax = 200;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.7f;
this.value = 1500f;
this.npcSlots = 2f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 286)
{
this.name = "Diabolist";
this.width = 18;
this.height = 40;
this.aiStyle = 8;
this.damage = 60;
this.defense = 10;
this.lifeMax = 250;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.65f;
this.value = 1500f;
this.npcSlots = 2f;
this.buffImmune[20] = true;
}
else
{
if (this.type == 287)
{
this.name = "Bone Lee";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 90;
this.defense = 42;
this.lifeMax = 1000;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.3f;
this.value = 2000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 288)
{
this.name = "Dungeon Spirit";
this.width = 20;
this.height = 20;
this.aiStyle = 56;
this.damage = 70;
this.defense = 30;
this.lifeMax = 200;
this.knockBackResist = 0.2f;
this.soundHit = 1;
this.soundKilled = 6;
this.value = 500f;
this.noTileCollide = true;
this.noGravity = true;
flag = true;
}
else
{
if (this.type == 289)
{
this.name = "Giant Cursed Skull";
this.width = 44;
this.height = 44;
this.aiStyle = 10;
this.damage = 60;
this.defense = 20;
this.lifeMax = 400;
this.soundHit = 2;
this.soundKilled = 2;
this.noGravity = true;
this.noTileCollide = true;
this.value = 150f;
this.knockBackResist = 0.2f;
this.npcSlots = 0.75f;
this.buffImmune[20] = true;
this.buffImmune[24] = true;
this.buffImmune[39] = true;
}
else
{
if (this.type == 290)
{
this.name = "Paladin";
this.width = 34;
this.height = 62;
this.aiStyle = 3;
this.damage = 100;
this.defense = 50;
this.lifeMax = 5000;
this.soundHit = 4;
this.soundKilled = 6;
this.knockBackResist = 0f;
this.value = 50000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 291)
{
this.name = "Skeleton Sniper";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 60;
this.defense = 28;
this.lifeMax = 400;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 292)
{
this.name = "Tactical Skeleton";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 60;
this.defense = 28;
this.lifeMax = 400;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 293)
{
this.name = "Skeleton Commando";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 60;
this.defense = 28;
this.lifeMax = 400;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.4f;
this.value = 1000f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 294)
{
this.name = "Angry Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 34;
this.defense = 6;
this.lifeMax = 70;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.9f;
this.value = 130f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 295)
{
this.name = "Angry Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 28;
this.defense = 12;
this.lifeMax = 70;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.7f;
this.value = 130f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 296)
{
this.name = "Angry Bones";
this.width = 18;
this.height = 40;
this.aiStyle = 3;
this.damage = 24;
this.defense = 14;
this.lifeMax = 120;
this.soundHit = 2;
this.soundKilled = 2;
this.knockBackResist = 0.6f;
this.value = 130f;
this.buffImmune[20] = true;
this.buffImmune[31] = false;
}
else
{
if (this.type == 299)
{
this.name = "Squirrel";
this.width = 18;
this.height = 20;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.soundHit = 1;
this.soundKilled = 1;
}
else
{
if (this.type == 300)
{
this.name = "Mouse";
this.width = 14;
this.height = 12;
this.aiStyle = 7;
this.damage = 0;
this.defense = 0;
this.lifeMax = 5;
this.soundHit = 1;
this.soundKilled = 4;
this.npcSlots = 0.25f;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (flag)
{
for (int n = 0; n < 81; n++)
{
this.buffImmune[n] = true;
}
}
if (Main.dedServ)
{
this.frame = default(Rectangle);
}
else
{
if (Main.NPCLoaded[this.type])
{
this.frame = new Rectangle(0, 0, Main.npcTexture[this.type].Width, Main.npcTexture[this.type].Height / Main.npcFrameCount[this.type]);
}
else
{
this.setFrameSize = true;
}
}
if (scaleOverride > 0f)
{
int num = (int)((float)this.width * this.scale);
int num2 = (int)((float)this.height * this.scale);
this.position.X = this.position.X + (float)(num / 2);
this.position.Y = this.position.Y + (float)num2;
this.scale = scaleOverride;
this.width = (int)((float)this.width * this.scale);
this.height = (int)((float)this.height * this.scale);
if (this.height == 16 || this.height == 32)
{
this.height++;
}
this.position.X = this.position.X - (float)(this.width / 2);
this.position.Y = this.position.Y - (float)this.height;
}
else
{
this.width = (int)((float)this.width * this.scale);
this.height = (int)((float)this.height * this.scale);
}
if (this.buffImmune[20])
{
this.buffImmune[70] = true;
}
this.life = this.lifeMax;
this.defDamage = this.damage;
this.defDefense = this.defense;
this.netID = this.type;
this.displayName = Lang.npcName(this.netID, false);
}
public void AI()
{
if (this.aiStyle == 0)
{
for (int i = 0; i < 255; i++)
{
if (Main.player[i].active && Main.player[i].talkNPC == this.whoAmI)
{
if (this.type == 105)
{
this.Transform(107);
return;
}
if (this.type == 106)
{
this.Transform(108);
return;
}
if (this.type == 123)
{
this.Transform(124);
return;
}
}
}
this.velocity.X = this.velocity.X * 0.93f;
if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1)
{
this.velocity.X = 0f;
}
this.TargetClosest(true);
this.spriteDirection = this.direction;
return;
}
if (this.aiStyle == 1)
{
if (this.type == 244)
{
float num = (float)Main.DiscoR / 255f;
float num2 = (float)Main.DiscoG / 255f;
float num3 = (float)Main.DiscoB / 255f;
num *= 1f;
num2 *= 1f;
num3 *= 1f;
Lighting.addLight((int)((this.position.X + (float)(this.width / 2)) / 16f), (int)((this.position.Y + (float)(this.height / 2)) / 16f), num, num2, num3);
this.color.R = (byte)Main.DiscoR;
this.color.G = (byte)Main.DiscoG;
this.color.B = (byte)Main.DiscoB;
this.color.A = 100;
this.alpha = 175;
}
bool flag = false;
if (!Main.dayTime || this.life != this.lifeMax || (double)this.position.Y > Main.worldSurface * 16.0)
{
flag = true;
}
if (this.type == 81)
{
flag = true;
if (Main.rand.Next(30) == 0)
{
int num4 = Dust.NewDust(this.position, this.width, this.height, 14, 0f, 0f, this.alpha, this.color, 1f);
Main.dust[num4].velocity *= 0.3f;
}
}
if (this.type == 183)
{
flag = true;
}
if (this.type == 147 && Main.rand.Next(10) == 0)
{
int num5 = Dust.NewDust(this.position, this.width, this.height, 76, 0f, 0f, 0, default(Color), 1f);
Main.dust[num5].noGravity = true;
Main.dust[num5].velocity *= 0.1f;
}
if (this.type == 244)
{
flag = true;
this.ai[0] += 2f;
}
if (this.type == 184)
{
if (Main.rand.Next(8) == 0)
{
int num6 = Dust.NewDust(this.position - this.velocity, this.width, this.height, 76, 0f, 0f, 0, default(Color), 1f);
Main.dust[num6].noGravity = true;
Main.dust[num6].velocity *= 0.15f;
}
flag = true;
if (this.localAI[0] > 0f)
{
this.localAI[0] -= 1f;
}
if (!this.wet)
{
Vector2 vector = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num7 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector.X;
float num8 = Main.player[this.target].position.Y - vector.Y;
float num9 = (float)Math.Sqrt((double)(num7 * num7 + num8 * num8));
if (num9 < 200f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && this.velocity.Y == 0f)
{
this.ai[0] = -40f;
if (this.velocity.Y == 0f)
{
this.velocity.X = this.velocity.X * 0.9f;
}
if (Main.netMode != 1 && this.localAI[0] == 0f)
{
num8 = Main.player[this.target].position.Y - vector.Y - (float)Main.rand.Next(0, 200);
num9 = (float)Math.Sqrt((double)(num7 * num7 + num8 * num8));
num9 = 4.5f / num9;
num7 *= num9;
num8 *= num9;
this.localAI[0] = 50f;
Projectile.NewProjectile(vector.X, vector.Y, num7, num8, 174, 9, 0f, Main.myPlayer, 0f, 0f);
}
}
}
}
if (this.type == 204)
{
flag = true;
if (this.localAI[0] > 0f)
{
this.localAI[0] -= 1f;
}
if (!this.wet)
{
Vector2 vector2 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num10 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2.X;
float num11 = Main.player[this.target].position.Y - vector2.Y;
float num12 = (float)Math.Sqrt((double)(num10 * num10 + num11 * num11));
if (num12 < 400f && Collision.CanHit(new Vector2(this.position.X, this.position.Y - 20f), this.width, this.height + 20, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && this.velocity.Y == 0f)
{
this.ai[0] = -80f;
if (this.velocity.Y == 0f)
{
this.velocity.X = this.velocity.X * 0.9f;
}
if (Main.netMode != 1 && this.localAI[0] == 0f)
{
num11 = Main.player[this.target].position.Y - vector2.Y - (float)Main.rand.Next(-30, 20);
num11 -= num12 * 0.05f;
num10 = Main.player[this.target].position.X - vector2.X - (float)Main.rand.Next(-20, 20);
num12 = (float)Math.Sqrt((double)(num10 * num10 + num11 * num11));
num12 = 7f / num12;
num10 *= num12;
num11 *= num12;
this.localAI[0] = 65f;
Projectile.NewProjectile(vector2.X, vector2.Y, num10, num11, 176, 13, 0f, Main.myPlayer, 0f, 0f);
}
}
}
}
if (this.type == 59)
{
Lighting.addLight((int)((this.position.X + (float)(this.width / 2)) / 16f), (int)((this.position.Y + (float)(this.height / 2)) / 16f), 1f, 0.3f, 0.1f);
int num13 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 1.7f);
Main.dust[num13].noGravity = true;
}
if (this.ai[2] > 1f)
{
this.ai[2] -= 1f;
}
if (this.wet)
{
if (this.collideY)
{
this.velocity.Y = -2f;
}
if (this.velocity.Y < 0f && this.ai[3] == this.position.X)
{
this.direction *= -1;
this.ai[2] = 200f;
}
if (this.velocity.Y > 0f)
{
this.ai[3] = this.position.X;
}
if (this.type == 59)
{
if (this.velocity.Y > 2f)
{
this.velocity.Y = this.velocity.Y * 0.9f;
}
else
{
if (this.directionY < 0)
{
this.velocity.Y = this.velocity.Y - 0.8f;
}
}
this.velocity.Y = this.velocity.Y - 0.5f;
if (this.velocity.Y < -10f)
{
this.velocity.Y = -10f;
}
}
else
{
if (this.velocity.Y > 2f)
{
this.velocity.Y = this.velocity.Y * 0.9f;
}
this.velocity.Y = this.velocity.Y - 0.5f;
if (this.velocity.Y < -4f)
{
this.velocity.Y = -4f;
}
}
if (this.ai[2] == 1f && flag)
{
this.TargetClosest(true);
}
}
this.aiAction = 0;
if (this.ai[2] == 0f)
{
this.ai[0] = -100f;
this.ai[2] = 1f;
this.TargetClosest(true);
}
if (this.velocity.Y == 0f)
{
if (this.ai[3] == this.position.X)
{
this.direction *= -1;
this.ai[2] = 200f;
}
this.ai[3] = 0f;
this.velocity.X = this.velocity.X * 0.8f;
if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1)
{
this.velocity.X = 0f;
}
if (flag)
{
this.ai[0] += 1f;
}
this.ai[0] += 1f;
if (this.type == 59)
{
this.ai[0] += 2f;
}
if (this.type == 71)
{
this.ai[0] += 3f;
}
if (this.type == 138)
{
this.ai[0] += 2f;
}
if (this.type == 183)
{
this.ai[0] += 1f;
}
if (this.type == 81)
{
if (this.scale >= 0f)
{
this.ai[0] += 4f;
}
else
{
this.ai[0] += 1f;
}
}
if (this.ai[0] >= 0f)
{
this.netUpdate = true;
if (flag && this.ai[2] == 1f)
{
this.TargetClosest(true);
}
if (this.ai[1] == 2f)
{
this.velocity.Y = -8f;
if (this.type == 59)
{
this.velocity.Y = this.velocity.Y - 2f;
}
this.velocity.X = this.velocity.X + (float)(3 * this.direction);
if (this.type == 59)
{
this.velocity.X = this.velocity.X + 0.5f * (float)this.direction;
}
this.ai[0] = -200f;
this.ai[1] = 0f;
this.ai[3] = this.position.X;
}
else
{
this.velocity.Y = -6f;
this.velocity.X = this.velocity.X + (float)(2 * this.direction);
if (this.type == 59)
{
this.velocity.X = this.velocity.X + (float)(2 * this.direction);
}
this.ai[0] = -120f;
this.ai[1] += 1f;
}
if (this.type == 141)
{
this.velocity.Y = this.velocity.Y * 1.3f;
this.velocity.X = this.velocity.X * 1.2f;
return;
}
}
else
{
if (this.ai[0] >= -30f)
{
this.aiAction = 1;
return;
}
}
}
else
{
if (this.target < 255 && ((this.direction == 1 && this.velocity.X < 3f) || (this.direction == -1 && this.velocity.X > -3f)))
{
if ((this.direction == -1 && (double)this.velocity.X < 0.1) || (this.direction == 1 && (double)this.velocity.X > -0.1))
{
this.velocity.X = this.velocity.X + 0.2f * (float)this.direction;
return;
}
this.velocity.X = this.velocity.X * 0.93f;
return;
}
}
}
else
{
if (this.aiStyle == 2)
{
if ((this.type == 170 || this.type == 171 || this.type == 180) && Main.rand.Next(1000) == 0)
{
Main.PlaySound(29, (int)this.position.X, (int)this.position.Y, 9);
}
this.noGravity = true;
if (!this.noTileCollide)
{
if (this.collideX)
{
this.velocity.X = this.oldVelocity.X * -0.5f;
if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f)
{
this.velocity.X = 2f;
}
if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f)
{
this.velocity.X = -2f;
}
}
if (this.collideY)
{
this.velocity.Y = this.oldVelocity.Y * -0.5f;
if (this.velocity.Y > 0f && this.velocity.Y < 1f)
{
this.velocity.Y = 1f;
}
if (this.velocity.Y < 0f && this.velocity.Y > -1f)
{
this.velocity.Y = -1f;
}
}
}
if (Main.dayTime && (double)this.position.Y <= Main.worldSurface * 16.0 && (this.type == 2 || this.type == 133 || this.type == 190 || this.type == 191 || this.type == 192 || this.type == 193 || this.type == 194))
{
if (this.timeLeft > 10)
{
this.timeLeft = 10;
}
this.directionY = -1;
if (this.velocity.Y > 0f)
{
this.direction = 1;
}
this.direction = -1;
if (this.velocity.X > 0f)
{
this.direction = 1;
}
}
else
{
this.TargetClosest(true);
}
if (this.type == 170 || this.type == 171 || this.type == 180)
{
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
if (this.ai[1] > 0f && !Collision.SolidCollision(this.position, this.width, this.height))
{
this.ai[1] = 0f;
this.ai[0] = 0f;
this.netUpdate = true;
}
}
else
{
if (this.ai[1] == 0f)
{
this.ai[0] += 1f;
}
}
if (this.ai[0] >= 300f)
{
this.ai[1] = 1f;
this.ai[0] = 0f;
this.netUpdate = true;
}
if (this.ai[1] == 0f)
{
this.alpha = 0;
this.noTileCollide = false;
}
else
{
this.wet = false;
this.alpha = 200;
this.noTileCollide = true;
}
this.rotation = this.velocity.Y * 0.1f * (float)this.direction;
this.TargetClosest(true);
if (this.direction == -1 && this.velocity.X > -4f && this.position.X > Main.player[this.target].position.X + (float)Main.player[this.target].width)
{
this.velocity.X = this.velocity.X - 0.08f;
if (this.velocity.X > 4f)
{
this.velocity.X = this.velocity.X - 0.04f;
}
else
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X - 0.2f;
}
}
if (this.velocity.X < -4f)
{
this.velocity.X = -4f;
}
}
else
{
if (this.direction == 1 && this.velocity.X < 4f && this.position.X + (float)this.width < Main.player[this.target].position.X)
{
this.velocity.X = this.velocity.X + 0.08f;
if (this.velocity.X < -4f)
{
this.velocity.X = this.velocity.X + 0.04f;
}
else
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X + 0.2f;
}
}
if (this.velocity.X > 4f)
{
this.velocity.X = 4f;
}
}
}
if (this.directionY == -1 && (double)this.velocity.Y > -2.5 && this.position.Y > Main.player[this.target].position.Y + (float)Main.player[this.target].height)
{
this.velocity.Y = this.velocity.Y - 0.1f;
if ((double)this.velocity.Y > 2.5)
{
this.velocity.Y = this.velocity.Y - 0.05f;
}
else
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y - 0.15f;
}
}
if ((double)this.velocity.Y < -2.5)
{
this.velocity.Y = -2.5f;
}
}
else
{
if (this.directionY == 1 && (double)this.velocity.Y < 2.5 && this.position.Y + (float)this.height < Main.player[this.target].position.Y)
{
this.velocity.Y = this.velocity.Y + 0.1f;
if ((double)this.velocity.Y < -2.5)
{
this.velocity.Y = this.velocity.Y + 0.05f;
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y + 0.15f;
}
}
if ((double)this.velocity.Y > 2.5)
{
this.velocity.Y = 2.5f;
}
}
}
}
else
{
if (this.type == 116)
{
this.TargetClosest(true);
Lighting.addLight((int)(this.position.X + (float)(this.width / 2)) / 16, (int)(this.position.Y + (float)(this.height / 2)) / 16, 0.3f, 0.2f, 0.1f);
if (this.direction == -1 && this.velocity.X > -6f)
{
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X > 6f)
{
this.velocity.X = this.velocity.X - 0.1f;
}
else
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X - 0.2f;
}
}
if (this.velocity.X < -6f)
{
this.velocity.X = -6f;
}
}
else
{
if (this.direction == 1 && this.velocity.X < 6f)
{
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X < -6f)
{
this.velocity.X = this.velocity.X + 0.1f;
}
else
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X + 0.2f;
}
}
if (this.velocity.X > 6f)
{
this.velocity.X = 6f;
}
}
}
if (this.directionY == -1 && (double)this.velocity.Y > -2.5)
{
this.velocity.Y = this.velocity.Y - 0.04f;
if ((double)this.velocity.Y > 2.5)
{
this.velocity.Y = this.velocity.Y - 0.05f;
}
else
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y - 0.15f;
}
}
if ((double)this.velocity.Y < -2.5)
{
this.velocity.Y = -2.5f;
}
}
else
{
if (this.directionY == 1 && (double)this.velocity.Y < 1.5)
{
this.velocity.Y = this.velocity.Y + 0.04f;
if ((double)this.velocity.Y < -2.5)
{
this.velocity.Y = this.velocity.Y + 0.05f;
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y + 0.15f;
}
}
if ((double)this.velocity.Y > 2.5)
{
this.velocity.Y = 2.5f;
}
}
}
if (Main.rand.Next(40) == 0)
{
int num14 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height * 0.25f), this.width, (int)((float)this.height * 0.5f), 5, this.velocity.X, 2f, 0, default(Color), 1f);
Dust expr_1B42_cp_0 = Main.dust[num14];
expr_1B42_cp_0.velocity.X = expr_1B42_cp_0.velocity.X * 0.5f;
Dust expr_1B60_cp_0 = Main.dust[num14];
expr_1B60_cp_0.velocity.Y = expr_1B60_cp_0.velocity.Y * 0.1f;
}
}
else
{
if (this.type == 133)
{
if ((double)this.life < (double)this.lifeMax * 0.5)
{
if (this.direction == -1 && this.velocity.X > -6f)
{
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X > 6f)
{
this.velocity.X = this.velocity.X - 0.1f;
}
else
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X + 0.05f;
}
}
if (this.velocity.X < -6f)
{
this.velocity.X = -6f;
}
}
else
{
if (this.direction == 1 && this.velocity.X < 6f)
{
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X < -6f)
{
this.velocity.X = this.velocity.X + 0.1f;
}
else
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X - 0.05f;
}
}
if (this.velocity.X > 6f)
{
this.velocity.X = 6f;
}
}
}
if (this.directionY == -1 && this.velocity.Y > -4f)
{
this.velocity.Y = this.velocity.Y - 0.1f;
if (this.velocity.Y > 4f)
{
this.velocity.Y = this.velocity.Y - 0.1f;
}
else
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y + 0.05f;
}
}
if (this.velocity.Y < -4f)
{
this.velocity.Y = -4f;
}
}
else
{
if (this.directionY == 1 && this.velocity.Y < 4f)
{
this.velocity.Y = this.velocity.Y + 0.1f;
if (this.velocity.Y < -4f)
{
this.velocity.Y = this.velocity.Y + 0.1f;
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y - 0.05f;
}
}
if (this.velocity.Y > 4f)
{
this.velocity.Y = 4f;
}
}
}
}
else
{
if (this.direction == -1 && this.velocity.X > -4f)
{
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X > 4f)
{
this.velocity.X = this.velocity.X - 0.1f;
}
else
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X + 0.05f;
}
}
if (this.velocity.X < -4f)
{
this.velocity.X = -4f;
}
}
else
{
if (this.direction == 1 && this.velocity.X < 4f)
{
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X < -4f)
{
this.velocity.X = this.velocity.X + 0.1f;
}
else
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X - 0.05f;
}
}
if (this.velocity.X > 4f)
{
this.velocity.X = 4f;
}
}
}
if (this.directionY == -1 && (double)this.velocity.Y > -1.5)
{
this.velocity.Y = this.velocity.Y - 0.04f;
if ((double)this.velocity.Y > 1.5)
{
this.velocity.Y = this.velocity.Y - 0.05f;
}
else
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y + 0.03f;
}
}
if ((double)this.velocity.Y < -1.5)
{
this.velocity.Y = -1.5f;
}
}
else
{
if (this.directionY == 1 && (double)this.velocity.Y < 1.5)
{
this.velocity.Y = this.velocity.Y + 0.04f;
if ((double)this.velocity.Y < -1.5)
{
this.velocity.Y = this.velocity.Y + 0.05f;
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y - 0.03f;
}
}
if ((double)this.velocity.Y > 1.5)
{
this.velocity.Y = 1.5f;
}
}
}
}
}
else
{
float num15 = 4f;
float num16 = 1.5f;
num15 *= 1f + (1f - this.scale);
num16 *= 1f + (1f - this.scale);
if (this.direction == -1 && this.velocity.X > -num15)
{
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X > num15)
{
this.velocity.X = this.velocity.X - 0.1f;
}
else
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X + 0.05f;
}
}
if (this.velocity.X < -num15)
{
this.velocity.X = -num15;
}
}
else
{
if (this.direction == 1 && this.velocity.X < num15)
{
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X < -num15)
{
this.velocity.X = this.velocity.X + 0.1f;
}
else
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X - 0.05f;
}
}
if (this.velocity.X > num15)
{
this.velocity.X = num15;
}
}
}
if (this.directionY == -1 && this.velocity.Y > -num16)
{
this.velocity.Y = this.velocity.Y - 0.04f;
if (this.velocity.Y > num16)
{
this.velocity.Y = this.velocity.Y - 0.05f;
}
else
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y + 0.03f;
}
}
if (this.velocity.Y < -num16)
{
this.velocity.Y = -num16;
}
}
else
{
if (this.directionY == 1 && this.velocity.Y < num16)
{
this.velocity.Y = this.velocity.Y + 0.04f;
if (this.velocity.Y < -num16)
{
this.velocity.Y = this.velocity.Y + 0.05f;
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y - 0.03f;
}
}
if (this.velocity.Y > num16)
{
this.velocity.Y = num16;
}
}
}
}
}
}
if ((this.type == 2 || this.type == 133 || this.type == 190 || this.type == 191 || this.type == 192 || this.type == 193 || this.type == 194) && Main.rand.Next(40) == 0)
{
int num17 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height * 0.25f), this.width, (int)((float)this.height * 0.5f), 5, this.velocity.X, 2f, 0, default(Color), 1f);
Dust expr_251E_cp_0 = Main.dust[num17];
expr_251E_cp_0.velocity.X = expr_251E_cp_0.velocity.X * 0.5f;
Dust expr_253C_cp_0 = Main.dust[num17];
expr_253C_cp_0.velocity.Y = expr_253C_cp_0.velocity.Y * 0.1f;
}
if (this.wet && this.type != 170 && this.type != 171 && this.type != 172)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.95f;
}
this.velocity.Y = this.velocity.Y - 0.5f;
if (this.velocity.Y < -4f)
{
this.velocity.Y = -4f;
}
this.TargetClosest(true);
return;
}
}
else
{
if (this.aiStyle == 3)
{
bool flag2 = false;
if (this.velocity.X == 0f)
{
flag2 = true;
}
if (this.justHit)
{
flag2 = false;
}
if (Main.netMode != 1 && this.type == 198 && (double)this.life <= (double)this.lifeMax * 0.55)
{
this.Transform(199);
}
int num18 = 60;
if (this.type == 120)
{
num18 = 180;
if (this.ai[3] == -120f)
{
this.velocity *= 0f;
this.ai[3] = 0f;
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8);
Vector2 vector3 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num19 = this.oldPos[2].X + (float)this.width * 0.5f - vector3.X;
float num20 = this.oldPos[2].Y + (float)this.height * 0.5f - vector3.Y;
float num21 = (float)Math.Sqrt((double)(num19 * num19 + num20 * num20));
num21 = 2f / num21;
num19 *= num21;
num20 *= num21;
for (int j = 0; j < 20; j++)
{
int num22 = Dust.NewDust(this.position, this.width, this.height, 71, num19, num20, 200, default(Color), 2f);
Main.dust[num22].noGravity = true;
Dust expr_27D5_cp_0 = Main.dust[num22];
expr_27D5_cp_0.velocity.X = expr_27D5_cp_0.velocity.X * 2f;
}
for (int k = 0; k < 20; k++)
{
int num23 = Dust.NewDust(this.oldPos[2], this.width, this.height, 71, -num19, -num20, 200, default(Color), 2f);
Main.dust[num23].noGravity = true;
Dust expr_2856_cp_0 = Main.dust[num23];
expr_2856_cp_0.velocity.X = expr_2856_cp_0.velocity.X * 2f;
}
}
}
bool flag3 = false;
bool flag4 = true;
if (this.type == 47 || this.type == 67 || this.type == 109 || this.type == 110 || this.type == 111 || this.type == 120 || this.type == 163 || this.type == 164 || this.type == 239 || this.type == 168 || this.type == 199 || this.type == 206 || this.type == 214 || this.type == 215 || this.type == 216 || this.type == 217 || this.type == 218 || this.type == 219 || this.type == 220 || this.type == 226 || this.type == 243 || this.type == 251 || this.type == 257 || this.type == 258 || this.type == 290 || this.type == 291 || this.type == 292 || this.type == 293)
{
flag4 = false;
}
if ((this.type != 110 && this.type != 111 && this.type != 206 && this.type != 216 && this.type != 214 && this.type != 215 && this.type != 291 && this.type != 292 && this.type != 293) || this.ai[2] <= 0f)
{
if (this.velocity.Y == 0f && ((this.velocity.X > 0f && this.direction < 0) || (this.velocity.X < 0f && this.direction > 0)))
{
flag3 = true;
}
if (this.position.X == this.oldPosition.X || this.ai[3] >= (float)num18 || flag3)
{
this.ai[3] += 1f;
}
else
{
if ((double)Math.Abs(this.velocity.X) > 0.9 && this.ai[3] > 0f)
{
this.ai[3] -= 1f;
}
}
if (this.ai[3] > (float)(num18 * 10))
{
this.ai[3] = 0f;
}
if (this.justHit)
{
this.ai[3] = 0f;
}
if (this.ai[3] == (float)num18)
{
this.netUpdate = true;
}
}
if ((Main.eclipse || !Main.dayTime || (double)this.position.Y > Main.worldSurface * 16.0 || this.type == 26 || this.type == 27 || this.type == 28 || this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 47 || this.type == 67 || this.type == 73 || this.type == 77 || this.type == 78 || this.type == 79 || this.type == 80 || this.type == 110 || this.type == 111 || this.type == 120 || this.type == 168 || this.type == 181 || this.type == 185 || this.type == 198 || this.type == 199 || this.type == 198 || this.type == 206 || this.type == 217 || this.type == 218 || this.type == 219 || this.type == 220 || this.type == 239 || this.type == 243 || this.type == 254 || (this.type == 255 | this.type == 257) || this.type == 258 || this.type == 291 || this.type == 292 || this.type == 293 || (this.type >= 212 && this.type <= 216)) && this.ai[3] < (float)num18)
{
if ((this.type == 3 || this.type == 21 || this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 77 || this.type == 110 || this.type == 132 || this.type == 167 || this.type == 161 || this.type == 162 || this.type == 186 || this.type == 187 || this.type == 188 || this.type == 189 || this.type == 197 || this.type == 200 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 223 || this.type == 291 || this.type == 292 || this.type == 293) && Main.rand.Next(1000) == 0)
{
Main.PlaySound(14, (int)this.position.X, (int)this.position.Y, 1);
}
if ((this.type == 78 || this.type == 79 || this.type == 80) && Main.rand.Next(500) == 0)
{
Main.PlaySound(26, (int)this.position.X, (int)this.position.Y, 1);
}
if (this.type == 159 && Main.rand.Next(500) == 0)
{
Main.PlaySound(29, (int)this.position.X, (int)this.position.Y, 7);
}
if (this.type == 162 && Main.rand.Next(500) == 0)
{
Main.PlaySound(29, (int)this.position.X, (int)this.position.Y, 6);
}
if (this.type == 181 && Main.rand.Next(500) == 0)
{
Main.PlaySound(29, (int)this.position.X, (int)this.position.Y, 8);
}
if (this.type >= 269 && this.type <= 280 && Main.rand.Next(1000) == 0)
{
Main.PlaySound(14, (int)this.position.X, (int)this.position.Y, 1);
}
this.TargetClosest(true);
}
else
{
if ((this.type != 110 && this.type != 111 && this.type != 206 && this.type != 216 && this.type != 214 && this.type != 215 && this.type != 291 && this.type != 292 && this.type != 293) || this.ai[2] <= 0f)
{
if (Main.dayTime && (double)(this.position.Y / 16f) < Main.worldSurface && this.timeLeft > 10)
{
this.timeLeft = 10;
}
if (this.velocity.X == 0f)
{
if (this.velocity.Y == 0f)
{
this.ai[0] += 1f;
if (this.ai[0] >= 2f)
{
this.direction *= -1;
this.spriteDirection = this.direction;
this.ai[0] = 0f;
}
}
}
else
{
this.ai[0] = 0f;
}
if (this.direction == 0)
{
this.direction = 1;
}
}
}
if (this.type == 159)
{
if (this.type == 159 && ((this.velocity.X > 0f && this.direction < 0) || (this.velocity.X < 0f && this.direction > 0)))
{
this.velocity.X = this.velocity.X * 0.95f;
}
if (this.velocity.X < -6f || this.velocity.X > 6f)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.8f;
}
}
else
{
if (this.velocity.X < 6f && this.direction == 1)
{
if (this.velocity.Y == 0f && this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.99f;
}
this.velocity.X = this.velocity.X + 0.07f;
if (this.velocity.X > 6f)
{
this.velocity.X = 6f;
}
}
else
{
if (this.velocity.X > -6f && this.direction == -1)
{
if (this.velocity.Y == 0f && this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.99f;
}
this.velocity.X = this.velocity.X - 0.07f;
if (this.velocity.X < -6f)
{
this.velocity.X = -6f;
}
}
}
}
}
else
{
if (this.type == 199)
{
if (this.velocity.X < -4f || this.velocity.X > 4f)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.8f;
}
}
else
{
if (this.velocity.X < 4f && this.direction == 1)
{
if (this.velocity.Y == 0f && this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.8f;
}
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X > 4f)
{
this.velocity.X = 4f;
}
}
else
{
if (this.velocity.X > -4f && this.direction == -1)
{
if (this.velocity.Y == 0f && this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.8f;
}
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X < -4f)
{
this.velocity.X = -4f;
}
}
}
}
}
else
{
if (this.type == 120 || this.type == 166 || this.type == 213 || this.type == 258)
{
if (this.velocity.X < -3f || this.velocity.X > 3f)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.8f;
}
}
else
{
if (this.velocity.X < 3f && this.direction == 1)
{
if (this.velocity.Y == 0f && this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.99f;
}
this.velocity.X = this.velocity.X + 0.07f;
if (this.velocity.X > 3f)
{
this.velocity.X = 3f;
}
}
else
{
if (this.velocity.X > -3f && this.direction == -1)
{
if (this.velocity.Y == 0f && this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.99f;
}
this.velocity.X = this.velocity.X - 0.07f;
if (this.velocity.X < -3f)
{
this.velocity.X = -3f;
}
}
}
}
}
else
{
if (this.type == 27 || this.type == 77 || this.type == 104 || this.type == 163 || this.type == 162 || this.type == 196 || this.type == 197 || this.type == 212 || this.type == 257)
{
if (this.velocity.X < -2f || this.velocity.X > 2f)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.8f;
}
}
else
{
if (this.velocity.X < 2f && this.direction == 1)
{
this.velocity.X = this.velocity.X + 0.07f;
if (this.velocity.X > 2f)
{
this.velocity.X = 2f;
}
}
else
{
if (this.velocity.X > -2f && this.direction == -1)
{
this.velocity.X = this.velocity.X - 0.07f;
if (this.velocity.X < -2f)
{
this.velocity.X = -2f;
}
}
}
}
}
else
{
if (this.type == 109)
{
if (this.velocity.X < -2f || this.velocity.X > 2f)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.8f;
}
}
else
{
if (this.velocity.X < 2f && this.direction == 1)
{
this.velocity.X = this.velocity.X + 0.04f;
if (this.velocity.X > 2f)
{
this.velocity.X = 2f;
}
}
else
{
if (this.velocity.X > -2f && this.direction == -1)
{
this.velocity.X = this.velocity.X - 0.04f;
if (this.velocity.X < -2f)
{
this.velocity.X = -2f;
}
}
}
}
}
else
{
if (this.type == 21 || this.type == 26 || this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 47 || this.type == 73 || this.type == 140 || this.type == 164 || this.type == 239 || this.type == 167 || this.type == 168 || this.type == 185 || this.type == 198 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 217 || this.type == 218 || this.type == 219 || this.type == 226 || this.type == 181 || this.type == 254)
{
float num24 = 1.5f;
if (this.type == 294)
{
num24 = 2f;
}
if (this.type == 295)
{
num24 = 1.75f;
}
if (this.type == 296)
{
num24 = 1.25f;
}
if (this.type == 201)
{
num24 = 1.1f;
}
if (this.type == 202)
{
num24 = 0.9f;
}
if (this.type == 203)
{
num24 = 1.2f;
}
if (this.type == 21 || this.type == 201 || this.type == 202 || this.type == 203)
{
num24 *= 1f + (1f - this.scale);
}
if (this.velocity.X < -num24 || this.velocity.X > num24)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.8f;
}
}
else
{
if (this.velocity.X < num24 && this.direction == 1)
{
this.velocity.X = this.velocity.X + 0.07f;
if (this.velocity.X > num24)
{
this.velocity.X = num24;
}
}
else
{
if (this.velocity.X > -num24 && this.direction == -1)
{
this.velocity.X = this.velocity.X - 0.07f;
if (this.velocity.X < -num24)
{
this.velocity.X = -num24;
}
}
}
}
}
else
{
if (this.type >= 269 && this.type <= 280)
{
float num25 = 1.5f;
if (this.type == 269)
{
num25 = 2f;
}
if (this.type == 270)
{
num25 = 1f;
}
if (this.type == 271)
{
num25 = 1.5f;
}
if (this.type == 272)
{
num25 = 3f;
}
if (this.type == 273)
{
num25 = 1.25f;
}
if (this.type == 274)
{
num25 = 3f;
}
if (this.type == 275)
{
num25 = 3.25f;
}
if (this.type == 276)
{
num25 = 2f;
}
if (this.type == 277)
{
num25 = 2.75f;
}
if (this.type == 278)
{
num25 = 1.8f;
}
if (this.type == 279)
{
num25 = 1.3f;
}
if (this.type == 280)
{
num25 = 2.5f;
}
num25 *= 1f + (1f - this.scale);
if (this.velocity.X < -num25 || this.velocity.X > num25)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.8f;
}
}
else
{
if (this.velocity.X < num25 && this.direction == 1)
{
this.velocity.X = this.velocity.X + 0.07f;
if (this.velocity.X > num25)
{
this.velocity.X = num25;
}
}
else
{
if (this.velocity.X > -num25 && this.direction == -1)
{
this.velocity.X = this.velocity.X - 0.07f;
if (this.velocity.X < -num25)
{
this.velocity.X = -num25;
}
}
}
}
}
else
{
if (this.type == 67 || this.type == 220)
{
if (this.velocity.X < -0.5f || this.velocity.X > 0.5f)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.7f;
}
}
else
{
if (this.velocity.X < 0.5f && this.direction == 1)
{
this.velocity.X = this.velocity.X + 0.03f;
if (this.velocity.X > 0.5f)
{
this.velocity.X = 0.5f;
}
}
else
{
if (this.velocity.X > -0.5f && this.direction == -1)
{
this.velocity.X = this.velocity.X - 0.03f;
if (this.velocity.X < -0.5f)
{
this.velocity.X = -0.5f;
}
}
}
}
}
else
{
if (this.type == 78 || this.type == 79 || this.type == 80)
{
float num26 = 1f;
float num27 = 0.05f;
if (this.life < this.lifeMax / 2)
{
num26 = 2f;
num27 = 0.1f;
}
if (this.type == 79)
{
num26 *= 1.5f;
}
if (this.velocity.X < -num26 || this.velocity.X > num26)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.7f;
}
}
else
{
if (this.velocity.X < num26 && this.direction == 1)
{
this.velocity.X = this.velocity.X + num27;
if (this.velocity.X > num26)
{
this.velocity.X = num26;
}
}
else
{
if (this.velocity.X > -num26 && this.direction == -1)
{
this.velocity.X = this.velocity.X - num27;
if (this.velocity.X < -num26)
{
this.velocity.X = -num26;
}
}
}
}
}
else
{
if (this.type == 287)
{
float num28 = 5f;
float num29 = 0.2f;
if (this.velocity.X < -num28 || this.velocity.X > num28)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.7f;
}
}
else
{
if (this.velocity.X < num28 && this.direction == 1)
{
this.velocity.X = this.velocity.X + num29;
if (this.velocity.X > num28)
{
this.velocity.X = num28;
}
}
else
{
if (this.velocity.X > -num28 && this.direction == -1)
{
this.velocity.X = this.velocity.X - num29;
if (this.velocity.X < -num28)
{
this.velocity.X = -num28;
}
}
}
}
}
else
{
if (this.type == 243)
{
float num30 = 1f;
float num31 = 0.07f;
num30 += (1f - (float)this.life / (float)this.lifeMax) * 1.5f;
num31 += (1f - (float)this.life / (float)this.lifeMax) * 0.15f;
if (this.velocity.X < -num30 || this.velocity.X > num30)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.7f;
}
}
else
{
if (this.velocity.X < num30 && this.direction == 1)
{
this.velocity.X = this.velocity.X + num31;
if (this.velocity.X > num30)
{
this.velocity.X = num30;
}
}
else
{
if (this.velocity.X > -num30 && this.direction == -1)
{
this.velocity.X = this.velocity.X - num31;
if (this.velocity.X < -num30)
{
this.velocity.X = -num30;
}
}
}
}
}
else
{
if (this.type == 251)
{
float num32 = 1f;
float num33 = 0.08f;
num32 += (1f - (float)this.life / (float)this.lifeMax) * 2f;
num33 += (1f - (float)this.life / (float)this.lifeMax) * 0.2f;
if (this.velocity.X < -num32 || this.velocity.X > num32)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.7f;
}
}
else
{
if (this.velocity.X < num32 && this.direction == 1)
{
this.velocity.X = this.velocity.X + num33;
if (this.velocity.X > num32)
{
this.velocity.X = num32;
}
}
else
{
if (this.velocity.X > -num32 && this.direction == -1)
{
this.velocity.X = this.velocity.X - num33;
if (this.velocity.X < -num32)
{
this.velocity.X = -num32;
}
}
}
}
}
else
{
if (this.type != 110 && this.type != 111 && this.type != 206 && this.type != 214 && this.type != 215 && this.type != 216 && this.type != 290 && this.type != 291 && this.type != 292 && this.type != 293)
{
float num34 = 1f;
if (this.type == 186)
{
num34 = 1.1f;
}
if (this.type == 187)
{
num34 = 0.9f;
}
if (this.type == 188)
{
num34 = 1.2f;
}
if (this.type == 189)
{
num34 = 0.8f;
}
if (this.type == 132)
{
num34 = 0.95f;
}
if (this.type == 200)
{
num34 = 0.87f;
}
if (this.type == 223)
{
num34 = 1.05f;
}
if (this.type == 3 || this.type == 132 || this.type == 186 || this.type == 187 || this.type == 188 || this.type == 189 || this.type == 200 || this.type == 223)
{
num34 *= 1f + (1f - this.scale);
}
if (this.velocity.X < -num34 || this.velocity.X > num34)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.8f;
}
}
else
{
if (this.velocity.X < num34 && this.direction == 1)
{
this.velocity.X = this.velocity.X + 0.07f;
if (this.velocity.X > num34)
{
this.velocity.X = num34;
}
}
else
{
if (this.velocity.X > -num34 && this.direction == -1)
{
this.velocity.X = this.velocity.X - 0.07f;
if (this.velocity.X < -num34)
{
this.velocity.X = -num34;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (this.type >= 277 && this.type <= 280)
{
Lighting.addLight((int)this.center().X / 16, (int)this.center().Y / 16, 0.2f, 0.1f, 0f);
}
if (this.type == 258)
{
if (this.velocity.Y != 0f)
{
this.TargetClosest(true);
this.spriteDirection = this.direction;
if (Main.player[this.target].center().X < this.position.X && this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.95f;
}
else
{
if (Main.player[this.target].center().X > this.position.X + (float)this.width && this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.95f;
}
}
if (Main.player[this.target].center().X < this.position.X && this.velocity.X > -5f)
{
this.velocity.X = this.velocity.X - 0.1f;
}
else
{
if (Main.player[this.target].center().X > this.position.X + (float)this.width && this.velocity.X < 5f)
{
this.velocity.X = this.velocity.X + 0.1f;
}
}
}
else
{
if (Main.player[this.target].center().Y + 50f < this.position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.velocity.Y = -7f;
}
}
}
if (this.type == 185)
{
if (this.velocity.Y == 0f)
{
this.rotation = 0f;
this.localAI[0] = 0f;
}
else
{
if (this.localAI[0] == 1f)
{
this.rotation += this.velocity.X * 0.05f;
}
}
}
if (this.type == 159 && Main.netMode != 1)
{
Vector2 vector4 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num35 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector4.X;
float num36 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector4.Y;
float num37 = (float)Math.Sqrt((double)(num35 * num35 + num36 * num36));
if (num37 > 300f)
{
this.Transform(158);
}
}
if (this.type == 164 && Main.netMode != 1 && this.velocity.Y == 0f)
{
int num38 = (int)this.center().X / 16;
int num39 = (int)this.center().Y / 16;
bool flag5 = false;
for (int l = num38 - 1; l <= num38 + 1; l++)
{
for (int m = num39 - 1; m <= num39 + 1; m++)
{
if (Main.tile[l, m].wall > 0)
{
flag5 = true;
}
}
}
if (flag5)
{
this.Transform(165);
}
}
if (this.type == 239 && Main.netMode != 1 && this.velocity.Y == 0f)
{
int num40 = (int)this.center().X / 16;
int num41 = (int)this.center().Y / 16;
bool flag6 = false;
for (int n = num40 - 1; n <= num40 + 1; n++)
{
for (int num42 = num41 - 1; num42 <= num41 + 1; num42++)
{
if (Main.tile[n, num42].wall > 0)
{
flag6 = true;
}
}
}
if (flag6)
{
this.Transform(240);
}
}
if (this.type == 163 && Main.netMode != 1 && this.velocity.Y == 0f)
{
int num43 = (int)this.center().X / 16;
int num44 = (int)this.center().Y / 16;
bool flag7 = false;
for (int num45 = num43 - 1; num45 <= num43 + 1; num45++)
{
for (int num46 = num44 - 1; num46 <= num44 + 1; num46++)
{
if (Main.tile[num45, num46].wall > 0)
{
flag7 = true;
}
}
}
if (flag7)
{
this.Transform(238);
}
}
if (this.type == 236 && Main.netMode != 1 && this.velocity.Y == 0f)
{
int num47 = (int)this.center().X / 16;
int num48 = (int)this.center().Y / 16;
bool flag8 = false;
for (int num49 = num47 - 1; num49 <= num47 + 1; num49++)
{
for (int num50 = num48 - 1; num50 <= num48 + 1; num50++)
{
if (Main.tile[num49, num50].wall > 0)
{
flag8 = true;
}
}
}
if (flag8)
{
this.Transform(237);
}
}
if (this.type == 243)
{
if (this.justHit && Main.rand.Next(3) == 0)
{
this.ai[2] -= (float)Main.rand.Next(30);
}
if (this.ai[2] < 0f)
{
this.ai[2] = 0f;
}
if (this.confused)
{
this.ai[2] = 0f;
}
this.ai[2] += 1f;
float num51 = (float)Main.rand.Next(30, 900);
num51 *= (float)this.life / (float)this.lifeMax;
num51 += 30f;
if (Main.netMode != 1 && this.ai[2] >= num51 && this.velocity.Y == 0f && !Main.player[this.target].dead && !Main.player[this.target].frozen && ((this.direction > 0 && this.center().X < Main.player[this.target].center().X) || (this.direction < 0 && this.center().X > Main.player[this.target].center().X)) && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
float num52 = 15f;
Vector2 vector5 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + 20f);
vector5.X += (float)(10 * this.direction);
float num53 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector5.X;
float num54 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector5.Y;
num53 += (float)Main.rand.Next(-40, 41);
num54 += (float)Main.rand.Next(-40, 41);
float num55 = (float)Math.Sqrt((double)(num53 * num53 + num54 * num54));
this.netUpdate = true;
num55 = num52 / num55;
num53 *= num55;
num54 *= num55;
int num56 = 32;
int num57 = 257;
vector5.X += num53 * 3f;
vector5.Y += num54 * 3f;
Projectile.NewProjectile(vector5.X, vector5.Y, num53, num54, num57, num56, 0f, Main.myPlayer, 0f, 0f);
this.ai[2] = 0f;
}
}
if (this.type == 251)
{
if (this.justHit)
{
this.ai[2] -= (float)Main.rand.Next(30);
}
if (this.ai[2] < 0f)
{
this.ai[2] = 0f;
}
if (this.confused)
{
this.ai[2] = 0f;
}
this.ai[2] += 1f;
float num58 = (float)Main.rand.Next(60, 1800);
num58 *= (float)this.life / (float)this.lifeMax;
num58 += 15f;
if (Main.netMode != 1 && this.ai[2] >= num58 && this.velocity.Y == 0f && !Main.player[this.target].dead && !Main.player[this.target].frozen && ((this.direction > 0 && this.center().X < Main.player[this.target].center().X) || (this.direction < 0 && this.center().X > Main.player[this.target].center().X)) && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
float num59 = 15f;
Vector2 vector6 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + 12f);
vector6.X += (float)(6 * this.direction);
float num60 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector6.X;
float num61 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector6.Y;
num60 += (float)Main.rand.Next(-40, 41);
num61 += (float)Main.rand.Next(-30, 0);
float num62 = (float)Math.Sqrt((double)(num60 * num60 + num61 * num61));
this.netUpdate = true;
num62 = num59 / num62;
num60 *= num62;
num61 *= num62;
int num63 = 30;
int num64 = 83;
vector6.X += num60 * 3f;
vector6.Y += num61 * 3f;
Projectile.NewProjectile(vector6.X, vector6.Y, num60, num61, num64, num63, 0f, Main.myPlayer, 0f, 0f);
this.ai[2] = 0f;
}
}
if (this.type == 110 || this.type == 111 || this.type == 206 || this.type == 214 || this.type == 215 || this.type == 216 || this.type == 290 || this.type == 291 || this.type == 292 || this.type == 293)
{
if (this.confused)
{
this.ai[2] = 0f;
}
else
{
if (this.ai[1] > 0f)
{
this.ai[1] -= 1f;
}
if (this.justHit)
{
this.ai[1] = 30f;
this.ai[2] = 0f;
}
int num65 = 70;
if (this.type == 291)
{
num65 = 200;
}
if (this.type == 292)
{
num65 = 120;
}
if (this.type == 293)
{
num65 = 90;
}
if (this.type == 111)
{
num65 = 180;
}
if (this.type == 206)
{
num65 = 50;
}
if (this.type == 214)
{
num65 = 40;
}
if (this.type == 215)
{
num65 = 80;
}
if (this.type == 290)
{
num65 = 30;
}
bool flag9 = false;
if (this.type == 216)
{
if (this.localAI[2] >= 20f)
{
flag9 = true;
}
if (flag9)
{
num65 = 60;
}
else
{
num65 = 8;
}
}
if (this.ai[2] > 0f)
{
this.TargetClosest(true);
if (this.ai[1] == (float)(num65 / 2))
{
if (this.type == 216)
{
this.localAI[2] += 1f;
}
float num66 = 11f;
if (this.type == 111)
{
num66 = 9f;
}
if (this.type == 206)
{
num66 = 7f;
}
if (this.type == 290)
{
num66 = 9f;
}
if (this.type == 293)
{
num66 = 4f;
}
if (this.type == 214)
{
num66 = 14f;
}
if (this.type == 215)
{
num66 = 16f;
}
Vector2 vector7 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
if (this.type == 206)
{
vector7.Y -= 10f;
}
if (this.type == 290)
{
vector7.Y -= 10f;
}
float num67 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector7.X;
float num68 = Math.Abs(num67) * 0.1f;
if (this.type == 291 || this.type == 292)
{
num68 = 0f;
}
if (this.type == 215)
{
num68 = Math.Abs(num67) * 0.08f;
}
if (this.type == 214 || (this.type == 216 && !flag9))
{
num68 = 0f;
}
float num69 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector7.Y - num68;
if (this.type == 291)
{
num67 += (float)Main.rand.Next(-40, 41) * 0.2f;
num69 += (float)Main.rand.Next(-40, 41) * 0.2f;
}
else
{
if (this.type != 292)
{
num67 += (float)Main.rand.Next(-40, 41);
num69 += (float)Main.rand.Next(-40, 41);
}
}
float num70 = (float)Math.Sqrt((double)(num67 * num67 + num69 * num69));
this.netUpdate = true;
num70 = num66 / num70;
num67 *= num70;
num69 *= num70;
int num71 = 35;
if (this.type == 111)
{
num71 = 11;
}
if (this.type == 206)
{
num71 = 37;
}
int num72 = 82;
if (this.type == 111)
{
num72 = 81;
}
if (this.type == 206)
{
num72 = 177;
}
if (this.type == 291)
{
num72 = 302;
num71 = 100;
}
if (this.type == 290)
{
num72 = 300;
num71 = 60;
}
if (this.type == 293)
{
num72 = 303;
num71 = 60;
}
if (this.type == 214)
{
num72 = 180;
num71 = 25;
}
if (this.type == 215)
{
num72 = 82;
num71 = 40;
}
if (this.type == 292)
{
num71 = 50;
num72 = 180;
}
if (this.type == 216)
{
num72 = 180;
num71 = 30;
if (flag9)
{
num71 = 100;
num72 = 240;
this.localAI[2] = 0f;
}
}
vector7.X += num67;
vector7.Y += num69;
if (Main.netMode != 1)
{
if (this.type == 292)
{
for (int num73 = 0; num73 < 4; num73++)
{
num67 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector7.X;
num69 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector7.Y;
num70 = (float)Math.Sqrt((double)(num67 * num67 + num69 * num69));
num70 = 12f / num70;
num67 += (float)Main.rand.Next(-40, 41);
num69 += (float)Main.rand.Next(-40, 41);
num67 *= num70;
num69 *= num70;
Projectile.NewProjectile(vector7.X, vector7.Y, num67, num69, num72, num71, 0f, Main.myPlayer, 0f, 0f);
}
}
else
{
Projectile.NewProjectile(vector7.X, vector7.Y, num67, num69, num72, num71, 0f, Main.myPlayer, 0f, 0f);
}
}
if (Math.Abs(num69) > Math.Abs(num67) * 2f)
{
if (num69 > 0f)
{
this.ai[2] = 1f;
}
else
{
this.ai[2] = 5f;
}
}
else
{
if (Math.Abs(num67) > Math.Abs(num69) * 2f)
{
this.ai[2] = 3f;
}
else
{
if (num69 > 0f)
{
this.ai[2] = 2f;
}
else
{
this.ai[2] = 4f;
}
}
}
}
if (this.velocity.Y != 0f || this.ai[1] <= 0f)
{
this.ai[2] = 0f;
this.ai[1] = 0f;
}
else
{
this.velocity.X = this.velocity.X * 0.9f;
this.spriteDirection = this.direction;
}
}
if (this.ai[2] <= 0f && this.velocity.Y == 0f && this.ai[1] <= 0f && !Main.player[this.target].dead && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
float num74 = 10f;
Vector2 vector8 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num75 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector8.X;
float num76 = Math.Abs(num75) * 0.1f;
float num77 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector8.Y - num76;
num75 += (float)Main.rand.Next(-40, 41);
num77 += (float)Main.rand.Next(-40, 41);
float num78 = (float)Math.Sqrt((double)(num75 * num75 + num77 * num77));
float num79 = 700f;
if (this.type == 214)
{
num79 = 550f;
}
if (this.type == 215)
{
num79 = 800f;
}
if (num78 < num79)
{
this.netUpdate = true;
this.velocity.X = this.velocity.X * 0.5f;
num78 = num74 / num78;
num75 *= num78;
num77 *= num78;
this.ai[2] = 3f;
this.ai[1] = (float)num65;
if (Math.Abs(num77) > Math.Abs(num75) * 2f)
{
if (num77 > 0f)
{
this.ai[2] = 1f;
}
else
{
this.ai[2] = 5f;
}
}
else
{
if (Math.Abs(num75) > Math.Abs(num77) * 2f)
{
this.ai[2] = 3f;
}
else
{
if (num77 > 0f)
{
this.ai[2] = 2f;
}
else
{
this.ai[2] = 4f;
}
}
}
}
}
if (this.ai[2] <= 0f)
{
float num80 = 1f;
float num81 = 0.07f;
if (this.type == 214)
{
num80 = 2f;
num81 = 0.09f;
}
else
{
if (this.type == 215)
{
num80 = 1.5f;
num81 = 0.08f;
}
}
if (this.velocity.X < -num80 || this.velocity.X > num80)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.8f;
}
}
else
{
if (this.velocity.X < num80 && this.direction == 1)
{
this.velocity.X = this.velocity.X + num81;
if (this.velocity.X > num80)
{
this.velocity.X = num80;
}
}
else
{
if (this.velocity.X > -1f && this.direction == -1)
{
this.velocity.X = this.velocity.X - num81;
if (this.velocity.X < -num80)
{
this.velocity.X = -num80;
}
}
}
}
}
}
}
if (this.type == 109 && Main.netMode != 1 && !Main.player[this.target].dead)
{
if (this.justHit)
{
this.ai[2] = 0f;
}
this.ai[2] += 1f;
if (this.ai[2] > 450f)
{
Vector2 vector9 = new Vector2(this.position.X + (float)this.width * 0.5f - (float)(this.direction * 24), this.position.Y + 4f);
int num82 = 3 * this.direction;
int num83 = -5;
int num84 = Projectile.NewProjectile(vector9.X, vector9.Y, (float)num82, (float)num83, 75, 0, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num84].timeLeft = 300;
this.ai[2] = 0f;
}
}
bool flag10 = false;
if (this.velocity.Y == 0f)
{
int num85 = (int)(this.position.Y + (float)this.height + 7f) / 16;
int num86 = (int)this.position.X / 16;
int num87 = (int)(this.position.X + (float)this.width) / 16;
for (int num88 = num86; num88 <= num87; num88++)
{
if (Main.tile[num88, num85] == null)
{
return;
}
if (Main.tile[num88, num85].nactive() && Main.tileSolid[(int)Main.tile[num88, num85].type])
{
flag10 = true;
break;
}
}
}
if (this.velocity.Y >= 0f)
{
int num89 = 0;
if (this.velocity.X < 0f)
{
num89 = -1;
}
if (this.velocity.X > 0f)
{
num89 = 1;
}
Vector2 vector10 = this.position;
vector10.X += this.velocity.X;
int num90 = (int)((vector10.X + (float)(this.width / 2) + (float)((this.width / 2 + 1) * num89)) / 16f);
int num91 = (int)((vector10.Y + (float)this.height - 1f) / 16f);
if (Main.tile[num90, num91] == null)
{
Main.tile[num90, num91] = new Tile();
}
if (Main.tile[num90, num91 - 1] == null)
{
Main.tile[num90, num91 - 1] = new Tile();
}
if (Main.tile[num90, num91 - 2] == null)
{
Main.tile[num90, num91 - 2] = new Tile();
}
if (Main.tile[num90, num91 - 3] == null)
{
Main.tile[num90, num91 - 3] = new Tile();
}
if (Main.tile[num90, num91 + 1] == null)
{
Main.tile[num90, num91 + 1] = new Tile();
}
if (Main.tile[num90 - num89, num91 - 3] == null)
{
Main.tile[num90 - num89, num91 - 3] = new Tile();
}
if ((float)(num90 * 16) < vector10.X + (float)this.width && (float)(num90 * 16 + 16) > vector10.X && ((Main.tile[num90, num91].nactive() && Main.tile[num90, num91].slope() == 0 && Main.tile[num90, num91 - 1].slope() == 0 && Main.tileSolid[(int)Main.tile[num90, num91].type] && !Main.tileSolidTop[(int)Main.tile[num90, num91].type]) || (Main.tile[num90, num91 - 1].halfBrick() && Main.tile[num90, num91 - 1].nactive())) && (!Main.tile[num90, num91 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num90, num91 - 1].type] || Main.tileSolidTop[(int)Main.tile[num90, num91 - 1].type] || (Main.tile[num90, num91 - 1].halfBrick() && (!Main.tile[num90, num91 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num90, num91 - 4].type] || Main.tileSolidTop[(int)Main.tile[num90, num91 - 4].type]))) && (!Main.tile[num90, num91 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num90, num91 - 2].type] || Main.tileSolidTop[(int)Main.tile[num90, num91 - 2].type]) && (!Main.tile[num90, num91 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num90, num91 - 3].type] || Main.tileSolidTop[(int)Main.tile[num90, num91 - 3].type]) && (!Main.tile[num90 - num89, num91 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num90 - num89, num91 - 3].type]))
{
float num92 = (float)(num91 * 16);
if (Main.tile[num90, num91].halfBrick())
{
num92 += 8f;
}
if (Main.tile[num90, num91 - 1].halfBrick())
{
num92 -= 8f;
}
if (num92 < vector10.Y + (float)this.height)
{
float num93 = vector10.Y + (float)this.height - num92;
float num94 = 16.1f;
if (this.type == 163 || this.type == 164 || this.type == 236 || this.type == 239)
{
num94 += 8f;
}
if (num93 <= num94)
{
this.gfxOffY += this.position.Y + (float)this.height - num92;
this.position.Y = num92 - (float)this.height;
if (num93 < 9f)
{
this.stepSpeed = 1f;
}
else
{
this.stepSpeed = 2f;
}
}
}
}
}
if (flag10)
{
int num95 = (int)((this.position.X + (float)(this.width / 2) + (float)(15 * this.direction)) / 16f);
int num96 = (int)((this.position.Y + (float)this.height - 15f) / 16f);
if (this.type == 109 || this.type == 163 || this.type == 164 || this.type == 199 || this.type == 236 || this.type == 239 || this.type == 257 || this.type == 258 || this.type == 290)
{
num95 = (int)((this.position.X + (float)(this.width / 2) + (float)((this.width / 2 + 16) * this.direction)) / 16f);
}
if (Main.tile[num95, num96] == null)
{
Main.tile[num95, num96] = new Tile();
}
if (Main.tile[num95, num96 - 1] == null)
{
Main.tile[num95, num96 - 1] = new Tile();
}
if (Main.tile[num95, num96 - 2] == null)
{
Main.tile[num95, num96 - 2] = new Tile();
}
if (Main.tile[num95, num96 - 3] == null)
{
Main.tile[num95, num96 - 3] = new Tile();
}
if (Main.tile[num95, num96 + 1] == null)
{
Main.tile[num95, num96 + 1] = new Tile();
}
if (Main.tile[num95 + this.direction, num96 - 1] == null)
{
Main.tile[num95 + this.direction, num96 - 1] = new Tile();
}
if (Main.tile[num95 + this.direction, num96 + 1] == null)
{
Main.tile[num95 + this.direction, num96 + 1] = new Tile();
}
if (Main.tile[num95 - this.direction, num96 + 1] == null)
{
Main.tile[num95 - this.direction, num96 + 1] = new Tile();
}
Main.tile[num95, num96 + 1].halfBrick();
if (Main.tile[num95, num96 - 1].nactive() && Main.tile[num95, num96 - 1].type == 10 && flag4)
{
this.ai[2] += 1f;
this.ai[3] = 0f;
if (this.ai[2] >= 60f)
{
if (!Main.bloodMoon && (this.type == 3 || this.type == 132 || this.type == 161 || this.type == 186 || this.type == 187 || this.type == 188 || this.type == 189 || this.type == 200 || this.type == 223))
{
this.ai[1] = 0f;
}
this.velocity.X = 0.5f * (float)(-(float)this.direction);
this.ai[1] += 5f;
if (this.type == 27)
{
this.ai[1] += 1f;
}
if (this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296)
{
this.ai[1] += 6f;
}
this.ai[2] = 0f;
bool flag11 = false;
if (this.ai[1] >= 10f)
{
flag11 = true;
this.ai[1] = 10f;
}
WorldGen.KillTile(num95, num96 - 1, true, false, false);
if ((Main.netMode != 1 || !flag11) && flag11 && Main.netMode != 1)
{
if (this.type == 26)
{
WorldGen.KillTile(num95, num96 - 1, false, false, false);
if (Main.netMode == 2)
{
NetMessage.SendData(17, -1, -1, "", 0, (float)num95, (float)(num96 - 1), 0f, 0);
}
}
else
{
bool flag12 = WorldGen.OpenDoor(num95, num96 - 1, this.direction);
if (!flag12)
{
this.ai[3] = (float)num18;
this.netUpdate = true;
}
if (Main.netMode == 2 && flag12)
{
NetMessage.SendData(19, -1, -1, "", 0, (float)num95, (float)(num96 - 1), (float)this.direction, 0);
}
}
}
}
}
else
{
if ((this.velocity.X < 0f && this.spriteDirection == -1) || (this.velocity.X > 0f && this.spriteDirection == 1))
{
if (Main.tile[num95, num96 - 2].nactive() && Main.tileSolid[(int)Main.tile[num95, num96 - 2].type])
{
if (Main.tile[num95, num96 - 3].nactive() && Main.tileSolid[(int)Main.tile[num95, num96 - 3].type])
{
this.velocity.Y = -8f;
this.netUpdate = true;
}
else
{
this.velocity.Y = -7f;
this.netUpdate = true;
}
}
else
{
if (Main.tile[num95, num96 - 1].nactive() && Main.tileSolid[(int)Main.tile[num95, num96 - 1].type])
{
this.velocity.Y = -6f;
this.netUpdate = true;
}
else
{
if (this.position.Y + (float)this.height - (float)(num96 * 16) > 20f && Main.tile[num95, num96].nactive() && Main.tile[num95, num96].slope() == 0 && Main.tileSolid[(int)Main.tile[num95, num96].type])
{
this.velocity.Y = -5f;
this.netUpdate = true;
}
else
{
if (this.directionY < 0 && this.type != 67 && (!Main.tile[num95, num96 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num95, num96 + 1].type]) && (!Main.tile[num95 + this.direction, num96 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num95 + this.direction, num96 + 1].type]))
{
this.velocity.Y = -8f;
this.velocity.X = this.velocity.X * 1.5f;
this.netUpdate = true;
}
else
{
if (flag4)
{
this.ai[1] = 0f;
this.ai[2] = 0f;
}
}
}
}
}
if (this.velocity.Y == 0f && flag2 && this.ai[3] == 1f)
{
this.velocity.Y = -5f;
}
}
if ((this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 47 || this.type == 77 || this.type == 104 || this.type == 168 || this.type == 196) && this.velocity.Y == 0f && Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) < 100f && Math.Abs(this.position.Y + (float)(this.height / 2) - (Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2))) < 50f && ((this.direction > 0 && this.velocity.X >= 1f) || (this.direction < 0 && this.velocity.X <= -1f)))
{
this.velocity.X = this.velocity.X * 2f;
if (this.velocity.X > 3f)
{
this.velocity.X = 3f;
}
if (this.velocity.X < -3f)
{
this.velocity.X = -3f;
}
this.velocity.Y = -4f;
this.netUpdate = true;
}
if (this.type == 120 && this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 1.1f;
}
if (this.type == 287 && this.velocity.Y == 0f && Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) < 150f && Math.Abs(this.position.Y + (float)(this.height / 2) - (Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2))) < 50f && ((this.direction > 0 && this.velocity.X >= 1f) || (this.direction < 0 && this.velocity.X <= -1f)))
{
this.velocity.X = (float)(8 * this.direction);
this.velocity.Y = -4f;
this.netUpdate = true;
}
if (this.type == 287 && this.velocity.Y < 0f)
{
this.velocity.X = this.velocity.X * 1.2f;
this.velocity.Y = this.velocity.Y * 1.1f;
}
}
}
else
{
if (flag4)
{
this.ai[1] = 0f;
this.ai[2] = 0f;
}
}
if (Main.netMode != 1 && this.type == 120 && this.ai[3] >= (float)num18)
{
int num97 = (int)Main.player[this.target].position.X / 16;
int num98 = (int)Main.player[this.target].position.Y / 16;
int num99 = (int)this.position.X / 16;
int num100 = (int)this.position.Y / 16;
int num101 = 20;
int num102 = 0;
bool flag13 = false;
if (Math.Abs(this.position.X - Main.player[this.target].position.X) + Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f)
{
num102 = 100;
flag13 = true;
}
while (!flag13)
{
if (num102 >= 100)
{
return;
}
num102++;
int num103 = Main.rand.Next(num97 - num101, num97 + num101);
int num104 = Main.rand.Next(num98 - num101, num98 + num101);
for (int num105 = num104; num105 < num98 + num101; num105++)
{
if ((num105 < num98 - 4 || num105 > num98 + 4 || num103 < num97 - 4 || num103 > num97 + 4) && (num105 < num100 - 1 || num105 > num100 + 1 || num103 < num99 - 1 || num103 > num99 + 1) && Main.tile[num103, num105].nactive())
{
bool flag14 = true;
if (this.type == 32 && Main.tile[num103, num105 - 1].wall == 0)
{
flag14 = false;
}
else
{
if (Main.tile[num103, num105 - 1].lava())
{
flag14 = false;
}
}
if (flag14 && Main.tileSolid[(int)Main.tile[num103, num105].type] && !Collision.SolidTiles(num103 - 1, num103 + 1, num105 - 4, num105 - 1))
{
this.position.X = (float)(num103 * 16 - this.width / 2);
this.position.Y = (float)(num105 * 16 - this.height);
this.netUpdate = true;
this.ai[3] = -120f;
}
}
}
}
}
}
else
{
if (this.aiStyle == 4)
{
if (this.target < 0 || this.target == 255 || Main.player[this.target].dead || !Main.player[this.target].active)
{
this.TargetClosest(true);
}
bool dead = Main.player[this.target].dead;
float num106 = this.position.X + (float)(this.width / 2) - Main.player[this.target].position.X - (float)(Main.player[this.target].width / 2);
float num107 = this.position.Y + (float)this.height - 59f - Main.player[this.target].position.Y - (float)(Main.player[this.target].height / 2);
float num108 = (float)Math.Atan2((double)num107, (double)num106) + 1.57f;
if (num108 < 0f)
{
num108 += 6.283f;
}
else
{
if ((double)num108 > 6.283)
{
num108 -= 6.283f;
}
}
float num109 = 0f;
if (this.ai[0] == 0f && this.ai[1] == 0f)
{
num109 = 0.02f;
}
if (this.ai[0] == 0f && this.ai[1] == 2f && this.ai[2] > 40f)
{
num109 = 0.05f;
}
if (this.ai[0] == 3f && this.ai[1] == 0f)
{
num109 = 0.05f;
}
if (this.ai[0] == 3f && this.ai[1] == 2f && this.ai[2] > 40f)
{
num109 = 0.08f;
}
if (this.rotation < num108)
{
if ((double)(num108 - this.rotation) > 3.1415)
{
this.rotation -= num109;
}
else
{
this.rotation += num109;
}
}
else
{
if (this.rotation > num108)
{
if ((double)(this.rotation - num108) > 3.1415)
{
this.rotation += num109;
}
else
{
this.rotation -= num109;
}
}
}
if (this.rotation > num108 - num109 && this.rotation < num108 + num109)
{
this.rotation = num108;
}
if (this.rotation < 0f)
{
this.rotation += 6.283f;
}
else
{
if ((double)this.rotation > 6.283)
{
this.rotation -= 6.283f;
}
}
if (this.rotation > num108 - num109 && this.rotation < num108 + num109)
{
this.rotation = num108;
}
if (Main.rand.Next(5) == 0)
{
int num110 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height * 0.25f), this.width, (int)((float)this.height * 0.5f), 5, this.velocity.X, 2f, 0, default(Color), 1f);
Dust expr_7973_cp_0 = Main.dust[num110];
expr_7973_cp_0.velocity.X = expr_7973_cp_0.velocity.X * 0.5f;
Dust expr_7991_cp_0 = Main.dust[num110];
expr_7991_cp_0.velocity.Y = expr_7991_cp_0.velocity.Y * 0.1f;
}
if (Main.dayTime || dead)
{
this.velocity.Y = this.velocity.Y - 0.04f;
if (this.timeLeft > 10)
{
this.timeLeft = 10;
return;
}
}
else
{
if (this.ai[0] == 0f)
{
if (this.ai[1] == 0f)
{
float num111 = 5f;
float num112 = 0.04f;
Vector2 vector11 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num113 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector11.X;
float num114 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 200f - vector11.Y;
float num115 = (float)Math.Sqrt((double)(num113 * num113 + num114 * num114));
float num116 = num115;
num115 = num111 / num115;
num113 *= num115;
num114 *= num115;
if (this.velocity.X < num113)
{
this.velocity.X = this.velocity.X + num112;
if (this.velocity.X < 0f && num113 > 0f)
{
this.velocity.X = this.velocity.X + num112;
}
}
else
{
if (this.velocity.X > num113)
{
this.velocity.X = this.velocity.X - num112;
if (this.velocity.X > 0f && num113 < 0f)
{
this.velocity.X = this.velocity.X - num112;
}
}
}
if (this.velocity.Y < num114)
{
this.velocity.Y = this.velocity.Y + num112;
if (this.velocity.Y < 0f && num114 > 0f)
{
this.velocity.Y = this.velocity.Y + num112;
}
}
else
{
if (this.velocity.Y > num114)
{
this.velocity.Y = this.velocity.Y - num112;
if (this.velocity.Y > 0f && num114 < 0f)
{
this.velocity.Y = this.velocity.Y - num112;
}
}
}
this.ai[2] += 1f;
if (this.ai[2] >= 600f)
{
this.ai[1] = 1f;
this.ai[2] = 0f;
this.ai[3] = 0f;
this.target = 255;
this.netUpdate = true;
}
else
{
if (this.position.Y + (float)this.height < Main.player[this.target].position.Y && num116 < 500f)
{
if (!Main.player[this.target].dead)
{
this.ai[3] += 1f;
}
if (this.ai[3] >= 110f)
{
this.ai[3] = 0f;
this.rotation = num108;
float num117 = 5f;
float num118 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector11.X;
float num119 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector11.Y;
float num120 = (float)Math.Sqrt((double)(num118 * num118 + num119 * num119));
num120 = num117 / num120;
Vector2 vector12 = vector11;
Vector2 vector13;
vector13.X = num118 * num120;
vector13.Y = num119 * num120;
vector12.X += vector13.X * 10f;
vector12.Y += vector13.Y * 10f;
if (Main.netMode != 1)
{
int num121 = NPC.NewNPC((int)vector12.X, (int)vector12.Y, 5, 0);
Main.npc[num121].velocity.X = vector13.X;
Main.npc[num121].velocity.Y = vector13.Y;
if (Main.netMode == 2 && num121 < 200)
{
NetMessage.SendData(23, -1, -1, "", num121, 0f, 0f, 0f, 0);
}
}
Main.PlaySound(3, (int)vector12.X, (int)vector12.Y, 1);
for (int num122 = 0; num122 < 10; num122++)
{
Dust.NewDust(vector12, 20, 20, 5, vector13.X * 0.4f, vector13.Y * 0.4f, 0, default(Color), 1f);
}
}
}
}
}
else
{
if (this.ai[1] == 1f)
{
this.rotation = num108;
float num123 = 6f;
Vector2 vector14 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num124 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector14.X;
float num125 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector14.Y;
float num126 = (float)Math.Sqrt((double)(num124 * num124 + num125 * num125));
num126 = num123 / num126;
this.velocity.X = num124 * num126;
this.velocity.Y = num125 * num126;
this.ai[1] = 2f;
}
else
{
if (this.ai[1] == 2f)
{
this.ai[2] += 1f;
if (this.ai[2] >= 40f)
{
this.velocity.X = this.velocity.X * 0.98f;
this.velocity.Y = this.velocity.Y * 0.98f;
if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1)
{
this.velocity.X = 0f;
}
if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1)
{
this.velocity.Y = 0f;
}
}
else
{
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f;
}
if (this.ai[2] >= 150f)
{
this.ai[3] += 1f;
this.ai[2] = 0f;
this.target = 255;
this.rotation = num108;
if (this.ai[3] >= 3f)
{
this.ai[1] = 0f;
this.ai[3] = 0f;
}
else
{
this.ai[1] = 1f;
}
}
}
}
}
if ((double)this.life < (double)this.lifeMax * 0.5)
{
this.ai[0] = 1f;
this.ai[1] = 0f;
this.ai[2] = 0f;
this.ai[3] = 0f;
this.netUpdate = true;
return;
}
}
else
{
if (this.ai[0] == 1f || this.ai[0] == 2f)
{
if (this.ai[0] == 1f)
{
this.ai[2] += 0.005f;
if ((double)this.ai[2] > 0.5)
{
this.ai[2] = 0.5f;
}
}
else
{
this.ai[2] -= 0.005f;
if (this.ai[2] < 0f)
{
this.ai[2] = 0f;
}
}
this.rotation += this.ai[2];
this.ai[1] += 1f;
if (this.ai[1] == 100f)
{
this.ai[0] += 1f;
this.ai[1] = 0f;
if (this.ai[0] == 3f)
{
this.ai[2] = 0f;
}
else
{
Main.PlaySound(3, (int)this.position.X, (int)this.position.Y, 1);
for (int num127 = 0; num127 < 2; num127++)
{
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 8, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6, 1f);
}
for (int num128 = 0; num128 < 20; num128++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f);
}
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
}
}
Dust.NewDust(this.position, this.width, this.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f);
this.velocity.X = this.velocity.X * 0.98f;
this.velocity.Y = this.velocity.Y * 0.98f;
if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1)
{
this.velocity.X = 0f;
}
if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1)
{
this.velocity.Y = 0f;
return;
}
}
else
{
this.damage = 23;
this.defense = 0;
if (this.ai[1] == 0f)
{
float num129 = 6f;
float num130 = 0.07f;
Vector2 vector15 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num131 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector15.X;
float num132 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 120f - vector15.Y;
float num133 = (float)Math.Sqrt((double)(num131 * num131 + num132 * num132));
num133 = num129 / num133;
num131 *= num133;
num132 *= num133;
if (this.velocity.X < num131)
{
this.velocity.X = this.velocity.X + num130;
if (this.velocity.X < 0f && num131 > 0f)
{
this.velocity.X = this.velocity.X + num130;
}
}
else
{
if (this.velocity.X > num131)
{
this.velocity.X = this.velocity.X - num130;
if (this.velocity.X > 0f && num131 < 0f)
{
this.velocity.X = this.velocity.X - num130;
}
}
}
if (this.velocity.Y < num132)
{
this.velocity.Y = this.velocity.Y + num130;
if (this.velocity.Y < 0f && num132 > 0f)
{
this.velocity.Y = this.velocity.Y + num130;
}
}
else
{
if (this.velocity.Y > num132)
{
this.velocity.Y = this.velocity.Y - num130;
if (this.velocity.Y > 0f && num132 < 0f)
{
this.velocity.Y = this.velocity.Y - num130;
}
}
}
this.ai[2] += 1f;
if (this.ai[2] >= 200f)
{
this.ai[1] = 1f;
this.ai[2] = 0f;
this.ai[3] = 0f;
this.target = 255;
this.netUpdate = true;
return;
}
}
else
{
if (this.ai[1] == 1f)
{
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
this.rotation = num108;
float num134 = 6.8f;
Vector2 vector16 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num135 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector16.X;
float num136 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector16.Y;
float num137 = (float)Math.Sqrt((double)(num135 * num135 + num136 * num136));
num137 = num134 / num137;
this.velocity.X = num135 * num137;
this.velocity.Y = num136 * num137;
this.ai[1] = 2f;
return;
}
if (this.ai[1] == 2f)
{
this.ai[2] += 1f;
if (this.ai[2] >= 40f)
{
this.velocity.X = this.velocity.X * 0.97f;
this.velocity.Y = this.velocity.Y * 0.97f;
if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1)
{
this.velocity.X = 0f;
}
if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1)
{
this.velocity.Y = 0f;
}
}
else
{
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f;
}
if (this.ai[2] >= 130f)
{
this.ai[3] += 1f;
this.ai[2] = 0f;
this.target = 255;
this.rotation = num108;
if (this.ai[3] >= 3f)
{
this.ai[1] = 0f;
this.ai[3] = 0f;
return;
}
this.ai[1] = 1f;
return;
}
}
}
}
}
}
}
else
{
if (this.aiStyle == 5)
{
if (this.target < 0 || this.target == 255 || Main.player[this.target].dead)
{
this.TargetClosest(true);
}
float num138 = 6f;
float num139 = 0.05f;
if (this.type == 6 || this.type == 173)
{
num138 = 4f;
num139 = 0.02f;
}
else
{
if (this.type == 94)
{
num138 = 4.2f;
num139 = 0.022f;
}
else
{
if (this.type == 252)
{
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
num138 = 6f;
num139 = 0.1f;
}
else
{
num139 = 0.01f;
num138 = 2f;
}
}
else
{
if (this.type == 42 || (this.type >= 231 && this.type <= 235))
{
num138 = 3.5f;
num139 = 0.021f;
if (this.type == 231)
{
num138 = 3f;
num139 = 0.017f;
}
num138 *= 1f - this.scale;
num139 *= 1f - this.scale;
}
else
{
if (this.type == 205)
{
num138 = 3.25f;
num139 = 0.018f;
}
else
{
if (this.type == 176)
{
num138 = 4f;
num139 = 0.017f;
}
else
{
if (this.type == 23)
{
num138 = 1f;
num139 = 0.03f;
}
else
{
if (this.type == 5)
{
num138 = 5f;
num139 = 0.03f;
}
else
{
if (this.type == 210 || this.type == 211)
{
this.localAI[0] += 1f;
float num140 = (this.localAI[0] - 60f) / 60f;
if (num140 > 1f)
{
num140 = 1f;
}
else
{
if (this.velocity.X > 6f)
{
this.velocity.X = 6f;
}
if (this.velocity.X < -6f)
{
this.velocity.X = -6f;
}
if (this.velocity.Y > 6f)
{
this.velocity.Y = 6f;
}
if (this.velocity.Y < -6f)
{
this.velocity.Y = -6f;
}
}
num138 = 5f;
num139 = 0.1f;
num139 *= num140;
}
}
}
}
}
}
}
}
}
Vector2 vector17 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num141 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2);
float num142 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2);
num141 = (float)((int)(num141 / 8f) * 8);
num142 = (float)((int)(num142 / 8f) * 8);
vector17.X = (float)((int)(vector17.X / 8f) * 8);
vector17.Y = (float)((int)(vector17.Y / 8f) * 8);
num141 -= vector17.X;
num142 -= vector17.Y;
float num143 = (float)Math.Sqrt((double)(num141 * num141 + num142 * num142));
float num144 = num143;
bool flag15 = false;
if (num143 > 600f)
{
flag15 = true;
}
if (num143 == 0f)
{
num141 = this.velocity.X;
num142 = this.velocity.Y;
}
else
{
num143 = num138 / num143;
num141 *= num143;
num142 *= num143;
}
if (this.type == 6 || this.type == 42 || this.type == 94 || this.type == 139 || this.type == 173 || this.type == 176 || this.type == 205 || this.type == 210 || this.type == 211 || (this.type >= 231 && this.type <= 235))
{
if (num144 > 100f || this.type == 42 || this.type == 94 || this.type == 176 || this.type == 210 || this.type == 211 || (this.type >= 231 && this.type <= 235))
{
this.ai[0] += 1f;
if (this.ai[0] > 0f)
{
this.velocity.Y = this.velocity.Y + 0.023f;
}
else
{
this.velocity.Y = this.velocity.Y - 0.023f;
}
if (this.ai[0] < -100f || this.ai[0] > 100f)
{
this.velocity.X = this.velocity.X + 0.023f;
}
else
{
this.velocity.X = this.velocity.X - 0.023f;
}
if (this.ai[0] > 200f)
{
this.ai[0] = -200f;
}
}
if (num144 < 150f && (this.type == 6 || this.type == 94 || this.type == 173))
{
this.velocity.X = this.velocity.X + num141 * 0.007f;
this.velocity.Y = this.velocity.Y + num142 * 0.007f;
}
}
if (Main.player[this.target].dead)
{
num141 = (float)this.direction * num138 / 2f;
num142 = -num138 / 2f;
}
if (this.velocity.X < num141)
{
this.velocity.X = this.velocity.X + num139;
if (this.type != 173 && this.type != 6 && this.type != 42 && (this.type < 231 || this.type > 235) && this.type != 94 && this.type != 139 && this.velocity.X < 0f && num141 > 0f)
{
this.velocity.X = this.velocity.X + num139;
}
}
else
{
if (this.velocity.X > num141)
{
this.velocity.X = this.velocity.X - num139;
if (this.type != 173 && this.type != 6 && this.type != 42 && (this.type < 231 || this.type > 235) && this.type != 94 && this.type != 139 && this.velocity.X > 0f && num141 < 0f)
{
this.velocity.X = this.velocity.X - num139;
}
}
}
if (this.velocity.Y < num142)
{
this.velocity.Y = this.velocity.Y + num139;
if (this.type != 173 && this.type != 6 && this.type != 42 && (this.type < 231 || this.type > 235) && this.type != 94 && this.type != 139 && this.velocity.Y < 0f && num142 > 0f)
{
this.velocity.Y = this.velocity.Y + num139;
}
}
else
{
if (this.velocity.Y > num142)
{
this.velocity.Y = this.velocity.Y - num139;
if (this.type != 173 && this.type != 6 && this.type != 42 && (this.type < 231 || this.type > 235) && this.type != 94 && this.type != 139 && this.velocity.Y > 0f && num142 < 0f)
{
this.velocity.Y = this.velocity.Y - num139;
}
}
}
if (this.type == 23)
{
if (num141 > 0f)
{
this.spriteDirection = 1;
this.rotation = (float)Math.Atan2((double)num142, (double)num141);
}
else
{
if (num141 < 0f)
{
this.spriteDirection = -1;
this.rotation = (float)Math.Atan2((double)num142, (double)num141) + 3.14f;
}
}
}
else
{
if (this.type == 139)
{
this.localAI[0] += 1f;
if (this.justHit)
{
this.localAI[0] = 0f;
}
if (Main.netMode != 1 && this.localAI[0] >= 120f)
{
this.localAI[0] = 0f;
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
int num145 = 25;
int num146 = 84;
Projectile.NewProjectile(vector17.X, vector17.Y, num141, num142, num146, num145, 0f, Main.myPlayer, 0f, 0f);
}
}
int num147 = (int)this.position.X + this.width / 2;
int num148 = (int)this.position.Y + this.height / 2;
num147 /= 16;
num148 /= 16;
if (!WorldGen.SolidTile(num147, num148))
{
Lighting.addLight((int)((this.position.X + (float)(this.width / 2)) / 16f), (int)((this.position.Y + (float)(this.height / 2)) / 16f), 0.3f, 0.1f, 0.05f);
}
if (num141 > 0f)
{
this.spriteDirection = 1;
this.rotation = (float)Math.Atan2((double)num142, (double)num141);
}
if (num141 < 0f)
{
this.spriteDirection = -1;
this.rotation = (float)Math.Atan2((double)num142, (double)num141) + 3.14f;
}
}
else
{
if (this.type == 6 || this.type == 94 || this.type == 173)
{
this.rotation = (float)Math.Atan2((double)num142, (double)num141) - 1.57f;
}
else
{
if (this.type == 42 || this.type == 176 || this.type == 205 || (this.type >= 231 && this.type <= 235))
{
if (this.velocity.X > 0f)
{
this.spriteDirection = 1;
}
if (this.velocity.X < 0f)
{
this.spriteDirection = -1;
}
this.rotation = this.velocity.X * 0.1f;
}
else
{
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f;
}
}
}
}
if (this.type == 6 || this.type == 23 || this.type == 42 || this.type == 94 || this.type == 139 || this.type == 173 || this.type == 176 || this.type == 205 || this.type == 210 || this.type == 211 || (this.type >= 231 && this.type <= 235))
{
float num149 = 0.7f;
if (this.type == 6 || this.type == 173)
{
num149 = 0.4f;
}
if (this.collideX)
{
this.netUpdate = true;
this.velocity.X = this.oldVelocity.X * -num149;
if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f)
{
this.velocity.X = 2f;
}
if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f)
{
this.velocity.X = -2f;
}
}
if (this.collideY)
{
this.netUpdate = true;
this.velocity.Y = this.oldVelocity.Y * -num149;
if (this.velocity.Y > 0f && (double)this.velocity.Y < 1.5)
{
this.velocity.Y = 2f;
}
if (this.velocity.Y < 0f && (double)this.velocity.Y > -1.5)
{
this.velocity.Y = -2f;
}
}
if (this.type == 23)
{
int num150 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X, this.position.Y - this.velocity.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 2f);
Main.dust[num150].noGravity = true;
Dust expr_9A75_cp_0 = Main.dust[num150];
expr_9A75_cp_0.velocity.X = expr_9A75_cp_0.velocity.X * 0.3f;
Dust expr_9A93_cp_0 = Main.dust[num150];
expr_9A93_cp_0.velocity.Y = expr_9A93_cp_0.velocity.Y * 0.3f;
}
else
{
if (this.type != 42 && this.type != 139 && this.type != 176 && this.type != 205 && this.type != 210 && this.type != 211 && this.type != 252 && (this.type < 231 || this.type > 235) && Main.rand.Next(20) == 0)
{
int num151 = 18;
if (this.type == 173)
{
num151 = 5;
}
int num152 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height * 0.25f), this.width, (int)((float)this.height * 0.5f), num151, this.velocity.X, 2f, 75, this.color, this.scale);
Dust expr_9BC9_cp_0 = Main.dust[num152];
expr_9BC9_cp_0.velocity.X = expr_9BC9_cp_0.velocity.X * 0.5f;
Dust expr_9BE7_cp_0 = Main.dust[num152];
expr_9BE7_cp_0.velocity.Y = expr_9BE7_cp_0.velocity.Y * 0.1f;
}
}
}
else
{
if (this.type != 252 && Main.rand.Next(40) == 0)
{
int num153 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height * 0.25f), this.width, (int)((float)this.height * 0.5f), 5, this.velocity.X, 2f, 0, default(Color), 1f);
Dust expr_9C94_cp_0 = Main.dust[num153];
expr_9C94_cp_0.velocity.X = expr_9C94_cp_0.velocity.X * 0.5f;
Dust expr_9CB2_cp_0 = Main.dust[num153];
expr_9CB2_cp_0.velocity.Y = expr_9CB2_cp_0.velocity.Y * 0.1f;
}
}
if ((this.type == 6 || this.type == 94 || this.type == 173) && this.wet)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.95f;
}
this.velocity.Y = this.velocity.Y - 0.3f;
if (this.velocity.Y < -2f)
{
this.velocity.Y = -2f;
}
}
if (this.type == 205 && this.wet)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.95f;
}
this.velocity.Y = this.velocity.Y - 0.5f;
if (this.velocity.Y < -4f)
{
this.velocity.Y = -4f;
}
this.TargetClosest(true);
}
if (this.type == 42 || this.type == 176 || (this.type >= 231 && this.type <= 235))
{
if (this.wet)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.95f;
}
this.velocity.Y = this.velocity.Y - 0.5f;
if (this.velocity.Y < -4f)
{
this.velocity.Y = -4f;
}
this.TargetClosest(true);
}
if (this.ai[1] == 101f)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 17);
this.ai[1] = 0f;
}
if (Main.netMode != 1)
{
this.ai[1] += (float)Main.rand.Next(5, 20) * 0.1f * this.scale;
if (this.type == 176)
{
this.ai[1] += (float)Main.rand.Next(5, 20) * 0.1f * this.scale;
}
if (this.ai[1] >= 130f)
{
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
float num154 = 8f;
Vector2 vector18 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)(this.height / 2));
float num155 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector18.X + (float)Main.rand.Next(-20, 21);
float num156 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector18.Y + (float)Main.rand.Next(-20, 21);
if ((num155 < 0f && this.velocity.X < 0f) || (num155 > 0f && this.velocity.X > 0f))
{
float num157 = (float)Math.Sqrt((double)(num155 * num155 + num156 * num156));
num157 = num154 / num157;
num155 *= num157;
num156 *= num157;
int num158 = (int)(10f * this.scale);
if (this.type == 176)
{
num158 = (int)(30f * this.scale);
}
int num159 = 55;
int num160 = Projectile.NewProjectile(vector18.X, vector18.Y, num155, num156, num159, num158, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num160].timeLeft = 300;
this.ai[1] = 101f;
this.netUpdate = true;
}
else
{
this.ai[1] = 0f;
}
}
else
{
this.ai[1] = 0f;
}
}
}
}
if (this.type == 139 && flag15)
{
if ((this.velocity.X > 0f && num141 > 0f) || (this.velocity.X < 0f && num141 < 0f))
{
if (Math.Abs(this.velocity.X) < 12f)
{
this.velocity.X = this.velocity.X * 1.05f;
}
}
else
{
this.velocity.X = this.velocity.X * 0.9f;
}
}
if (Main.netMode != 1 && this.type == 94 && !Main.player[this.target].dead)
{
if (this.justHit)
{
this.localAI[0] = 0f;
}
this.localAI[0] += 1f;
if (this.localAI[0] == 180f)
{
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
NPC.NewNPC((int)(this.position.X + (float)(this.width / 2) + this.velocity.X), (int)(this.position.Y + (float)(this.height / 2) + this.velocity.Y), 112, 0);
}
this.localAI[0] = 0f;
}
}
if ((Main.dayTime && this.type != 173 && this.type != 6 && this.type != 23 && this.type != 42 && this.type != 94 && this.type != 176 && this.type != 205 && this.type != 210 && this.type != 211 && this.type != 252 && (this.type < 231 || this.type > 235)) || Main.player[this.target].dead)
{
this.velocity.Y = this.velocity.Y - num139 * 2f;
if (this.timeLeft > 10)
{
this.timeLeft = 10;
}
}
if (((this.velocity.X > 0f && this.oldVelocity.X < 0f) || (this.velocity.X < 0f && this.oldVelocity.X > 0f) || (this.velocity.Y > 0f && this.oldVelocity.Y < 0f) || (this.velocity.Y < 0f && this.oldVelocity.Y > 0f)) && !this.justHit)
{
this.netUpdate = true;
return;
}
}
else
{
if (this.aiStyle == 6)
{
if (this.type == 117 && this.localAI[1] == 0f)
{
this.localAI[1] = 1f;
Main.PlaySound(4, (int)this.position.X, (int)this.position.Y, 13);
int num161 = 1;
if (this.velocity.X < 0f)
{
num161 = -1;
}
for (int num162 = 0; num162 < 20; num162++)
{
Dust.NewDust(new Vector2(this.position.X - 20f, this.position.Y - 20f), this.width + 40, this.height + 40, 5, (float)(num161 * 8), -1f, 0, default(Color), 1f);
}
}
if (this.type >= 13 && this.type <= 15)
{
this.realLife = -1;
}
else
{
if (this.ai[3] > 0f)
{
this.realLife = (int)this.ai[3];
}
}
if (this.target < 0 || this.target == 255 || Main.player[this.target].dead)
{
this.TargetClosest(true);
}
if (Main.player[this.target].dead && this.timeLeft > 300)
{
this.timeLeft = 300;
}
if (Main.netMode != 1)
{
if (this.type == 87 && this.ai[0] == 0f)
{
this.ai[3] = (float)this.whoAmI;
this.realLife = this.whoAmI;
int num163 = this.whoAmI;
for (int num164 = 0; num164 < 14; num164++)
{
int num165 = 89;
if (num164 == 1 || num164 == 8)
{
num165 = 88;
}
else
{
if (num164 == 11)
{
num165 = 90;
}
else
{
if (num164 == 12)
{
num165 = 91;
}
else
{
if (num164 == 13)
{
num165 = 92;
}
}
}
}
int num166 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), num165, this.whoAmI);
Main.npc[num166].ai[3] = (float)this.whoAmI;
Main.npc[num166].realLife = this.whoAmI;
Main.npc[num166].ai[1] = (float)num163;
Main.npc[num163].ai[0] = (float)num166;
NetMessage.SendData(23, -1, -1, "", num166, 0f, 0f, 0f, 0);
num163 = num166;
}
}
if ((this.type == 7 || this.type == 8 || this.type == 10 || this.type == 11 || this.type == 13 || this.type == 14 || this.type == 39 || this.type == 40 || this.type == 95 || this.type == 96 || this.type == 98 || this.type == 99 || this.type == 117 || this.type == 118) && this.ai[0] == 0f)
{
if (this.type == 7 || this.type == 10 || this.type == 13 || this.type == 39 || this.type == 95 || this.type == 98 || this.type == 117)
{
if (this.type < 13 || this.type > 15)
{
this.ai[3] = (float)this.whoAmI;
this.realLife = this.whoAmI;
}
this.ai[2] = (float)Main.rand.Next(8, 13);
if (this.type == 10)
{
this.ai[2] = (float)Main.rand.Next(4, 7);
}
if (this.type == 13)
{
this.ai[2] = (float)Main.rand.Next(45, 56);
}
if (this.type == 39)
{
this.ai[2] = (float)Main.rand.Next(12, 19);
}
if (this.type == 95)
{
this.ai[2] = (float)Main.rand.Next(6, 12);
}
if (this.type == 98)
{
this.ai[2] = (float)Main.rand.Next(20, 26);
}
if (this.type == 117)
{
this.ai[2] = (float)Main.rand.Next(3, 6);
}
this.ai[0] = (float)NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), this.type + 1, this.whoAmI);
}
else
{
if ((this.type == 8 || this.type == 11 || this.type == 14 || this.type == 40 || this.type == 96 || this.type == 99 || this.type == 118) && this.ai[2] > 0f)
{
this.ai[0] = (float)NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), this.type, this.whoAmI);
}
else
{
this.ai[0] = (float)NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), this.type + 1, this.whoAmI);
}
}
if (this.type < 13 || this.type > 15)
{
Main.npc[(int)this.ai[0]].ai[3] = this.ai[3];
Main.npc[(int)this.ai[0]].realLife = this.realLife;
}
Main.npc[(int)this.ai[0]].ai[1] = (float)this.whoAmI;
Main.npc[(int)this.ai[0]].ai[2] = this.ai[2] - 1f;
this.netUpdate = true;
}
if ((this.type == 8 || this.type == 9 || this.type == 11 || this.type == 12 || this.type == 40 || this.type == 41 || this.type == 96 || this.type == 97 || this.type == 99 || this.type == 100 || (this.type > 87 && this.type <= 92) || this.type == 118 || this.type == 119) && (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != this.aiStyle))
{
this.life = 0;
this.HitEffect(0, 10.0);
this.active = false;
}
if ((this.type == 7 || this.type == 8 || this.type == 10 || this.type == 11 || this.type == 39 || this.type == 40 || this.type == 95 || this.type == 96 || this.type == 98 || this.type == 99 || (this.type >= 87 && this.type < 92) || this.type == 117 || this.type == 118) && (!Main.npc[(int)this.ai[0]].active || Main.npc[(int)this.ai[0]].aiStyle != this.aiStyle))
{
this.life = 0;
this.HitEffect(0, 10.0);
this.active = false;
}
if (this.type == 13 || this.type == 14 || this.type == 15)
{
if (!Main.npc[(int)this.ai[1]].active && !Main.npc[(int)this.ai[0]].active)
{
this.life = 0;
this.HitEffect(0, 10.0);
this.active = false;
}
if (this.type == 13 && !Main.npc[(int)this.ai[0]].active)
{
this.life = 0;
this.HitEffect(0, 10.0);
this.active = false;
}
if (this.type == 15 && !Main.npc[(int)this.ai[1]].active)
{
this.life = 0;
this.HitEffect(0, 10.0);
this.active = false;
}
if (this.type == 14 && (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != this.aiStyle))
{
this.type = 13;
int num167 = this.whoAmI;
float num168 = (float)this.life / (float)this.lifeMax;
float num169 = this.ai[0];
this.SetDefaults(this.type, -1f);
this.life = (int)((float)this.lifeMax * num168);
this.ai[0] = num169;
this.TargetClosest(true);
this.netUpdate = true;
this.whoAmI = num167;
}
if (this.type == 14 && (!Main.npc[(int)this.ai[0]].active || Main.npc[(int)this.ai[0]].aiStyle != this.aiStyle))
{
int num170 = this.whoAmI;
float num171 = (float)this.life / (float)this.lifeMax;
float num172 = this.ai[1];
this.SetDefaults(this.type, -1f);
this.life = (int)((float)this.lifeMax * num171);
this.ai[1] = num172;
this.TargetClosest(true);
this.netUpdate = true;
this.whoAmI = num170;
}
if (this.life == 0)
{
bool flag16 = true;
for (int num173 = 0; num173 < 200; num173++)
{
if (Main.npc[num173].active && (Main.npc[num173].type == 13 || Main.npc[num173].type == 14 || Main.npc[num173].type == 15))
{
flag16 = false;
break;
}
}
if (flag16)
{
this.boss = true;
this.NPCLoot();
}
}
}
if (!this.active && Main.netMode == 2)
{
NetMessage.SendData(28, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0);
}
}
int num174 = (int)(this.position.X / 16f) - 1;
int num175 = (int)((this.position.X + (float)this.width) / 16f) + 2;
int num176 = (int)(this.position.Y / 16f) - 1;
int num177 = (int)((this.position.Y + (float)this.height) / 16f) + 2;
if (num174 < 0)
{
num174 = 0;
}
if (num175 > Main.maxTilesX)
{
num175 = Main.maxTilesX;
}
if (num176 < 0)
{
num176 = 0;
}
if (num177 > Main.maxTilesY)
{
num177 = Main.maxTilesY;
}
bool flag17 = false;
if (this.type >= 87 && this.type <= 92)
{
flag17 = true;
}
if (!flag17)
{
for (int num178 = num174; num178 < num175; num178++)
{
for (int num179 = num176; num179 < num177; num179++)
{
if (Main.tile[num178, num179] != null && ((Main.tile[num178, num179].nactive() && (Main.tileSolid[(int)Main.tile[num178, num179].type] || (Main.tileSolidTop[(int)Main.tile[num178, num179].type] && Main.tile[num178, num179].frameY == 0))) || Main.tile[num178, num179].liquid > 64))
{
Vector2 vector19;
vector19.X = (float)(num178 * 16);
vector19.Y = (float)(num179 * 16);
if (this.position.X + (float)this.width > vector19.X && this.position.X < vector19.X + 16f && this.position.Y + (float)this.height > vector19.Y && this.position.Y < vector19.Y + 16f)
{
flag17 = true;
if (Main.rand.Next(100) == 0 && this.type != 117 && Main.tile[num178, num179].nactive())
{
WorldGen.KillTile(num178, num179, true, true, false);
}
if (Main.netMode != 1 && Main.tile[num178, num179].type == 2)
{
byte arg_B1F3_0 = Main.tile[num178, num179 - 1].type;
}
}
}
}
}
}
if (!flag17 && (this.type == 7 || this.type == 10 || this.type == 13 || this.type == 39 || this.type == 95 || this.type == 98 || this.type == 117))
{
Rectangle rectangle = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height);
int num180 = 1000;
bool flag18 = true;
for (int num181 = 0; num181 < 255; num181++)
{
if (Main.player[num181].active)
{
Rectangle rectangle2 = new Rectangle((int)Main.player[num181].position.X - num180, (int)Main.player[num181].position.Y - num180, num180 * 2, num180 * 2);
if (rectangle.Intersects(rectangle2))
{
flag18 = false;
break;
}
}
}
if (flag18)
{
flag17 = true;
}
}
if (this.type >= 87 && this.type <= 92)
{
if (this.velocity.X < 0f)
{
this.spriteDirection = 1;
}
else
{
if (this.velocity.X > 0f)
{
this.spriteDirection = -1;
}
}
}
float num182 = 8f;
float num183 = 0.07f;
if (this.type == 95)
{
num182 = 5.5f;
num183 = 0.045f;
}
if (this.type == 10)
{
num182 = 6f;
num183 = 0.05f;
}
if (this.type == 13)
{
num182 = 10f;
num183 = 0.07f;
}
if (this.type == 87)
{
num182 = 11f;
num183 = 0.25f;
}
if (this.type == 117 && Main.wof >= 0)
{
float num184 = (float)Main.npc[Main.wof].life / (float)Main.npc[Main.wof].lifeMax;
if ((double)num184 < 0.5)
{
num182 += 1f;
num183 += 0.1f;
}
if ((double)num184 < 0.25)
{
num182 += 1f;
num183 += 0.1f;
}
if ((double)num184 < 0.1)
{
num182 += 2f;
num183 += 0.1f;
}
}
Vector2 vector20 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num185 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2);
float num186 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2);
num185 = (float)((int)(num185 / 16f) * 16);
num186 = (float)((int)(num186 / 16f) * 16);
vector20.X = (float)((int)(vector20.X / 16f) * 16);
vector20.Y = (float)((int)(vector20.Y / 16f) * 16);
num185 -= vector20.X;
num186 -= vector20.Y;
float num187 = (float)Math.Sqrt((double)(num185 * num185 + num186 * num186));
if (this.ai[1] > 0f && this.ai[1] < (float)Main.npc.Length)
{
try
{
vector20 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num185 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - vector20.X;
num186 = Main.npc[(int)this.ai[1]].position.Y + (float)(Main.npc[(int)this.ai[1]].height / 2) - vector20.Y;
}
catch
{
}
this.rotation = (float)Math.Atan2((double)num186, (double)num185) + 1.57f;
num187 = (float)Math.Sqrt((double)(num185 * num185 + num186 * num186));
int num188 = this.width;
if (this.type >= 87 && this.type <= 92)
{
num188 = 42;
}
num187 = (num187 - (float)num188) / num187;
num185 *= num187;
num186 *= num187;
this.velocity = default(Vector2);
this.position.X = this.position.X + num185;
this.position.Y = this.position.Y + num186;
if (this.type >= 87 && this.type <= 92)
{
if (num185 < 0f)
{
this.spriteDirection = 1;
return;
}
if (num185 > 0f)
{
this.spriteDirection = -1;
return;
}
}
}
else
{
if (!flag17)
{
this.TargetClosest(true);
this.velocity.Y = this.velocity.Y + 0.11f;
if (this.velocity.Y > num182)
{
this.velocity.Y = num182;
}
if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)num182 * 0.4)
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X - num183 * 1.1f;
}
else
{
this.velocity.X = this.velocity.X + num183 * 1.1f;
}
}
else
{
if (this.velocity.Y == num182)
{
if (this.velocity.X < num185)
{
this.velocity.X = this.velocity.X + num183;
}
else
{
if (this.velocity.X > num185)
{
this.velocity.X = this.velocity.X - num183;
}
}
}
else
{
if (this.velocity.Y > 4f)
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X + num183 * 0.9f;
}
else
{
this.velocity.X = this.velocity.X - num183 * 0.9f;
}
}
}
}
}
else
{
if (this.type != 87 && this.type != 117 && this.soundDelay == 0)
{
float num189 = num187 / 40f;
if (num189 < 10f)
{
num189 = 10f;
}
if (num189 > 20f)
{
num189 = 20f;
}
this.soundDelay = (int)num189;
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 1);
}
num187 = (float)Math.Sqrt((double)(num185 * num185 + num186 * num186));
float num190 = Math.Abs(num185);
float num191 = Math.Abs(num186);
float num192 = num182 / num187;
num185 *= num192;
num186 *= num192;
if ((this.type == 13 || this.type == 7) && !Main.player[this.target].zoneEvil && !Main.player[this.target].zoneBlood)
{
bool flag19 = true;
for (int num193 = 0; num193 < 255; num193++)
{
if (Main.player[num193].active && !Main.player[num193].dead && Main.player[num193].zoneEvil)
{
flag19 = false;
}
}
if (flag19)
{
if (Main.netMode != 1 && (double)(this.position.Y / 16f) > (Main.rockLayer + (double)Main.maxTilesY) / 2.0)
{
this.active = false;
int num194 = (int)this.ai[0];
while (num194 > 0 && num194 < 200 && Main.npc[num194].active && Main.npc[num194].aiStyle == this.aiStyle)
{
int num195 = (int)Main.npc[num194].ai[0];
Main.npc[num194].active = false;
this.life = 0;
if (Main.netMode == 2)
{
NetMessage.SendData(23, -1, -1, "", num194, 0f, 0f, 0f, 0);
}
num194 = num195;
}
if (Main.netMode == 2)
{
NetMessage.SendData(23, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0);
}
}
num185 = 0f;
num186 = num182;
}
}
bool flag20 = false;
if (this.type == 87)
{
if (((this.velocity.X > 0f && num185 < 0f) || (this.velocity.X < 0f && num185 > 0f) || (this.velocity.Y > 0f && num186 < 0f) || (this.velocity.Y < 0f && num186 > 0f)) && Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) > num183 / 2f && num187 < 300f)
{
flag20 = true;
if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < num182)
{
this.velocity *= 1.1f;
}
}
if (this.position.Y > Main.player[this.target].position.Y || (double)(Main.player[this.target].position.Y / 16f) > Main.worldSurface || Main.player[this.target].dead)
{
flag20 = true;
if (Math.Abs(this.velocity.X) < num182 / 2f)
{
if (this.velocity.X == 0f)
{
this.velocity.X = this.velocity.X - (float)this.direction;
}
this.velocity.X = this.velocity.X * 1.1f;
}
else
{
if (this.velocity.Y > -num182)
{
this.velocity.Y = this.velocity.Y - num183;
}
}
}
}
if (!flag20)
{
if ((this.velocity.X > 0f && num185 > 0f) || (this.velocity.X < 0f && num185 < 0f) || (this.velocity.Y > 0f && num186 > 0f) || (this.velocity.Y < 0f && num186 < 0f))
{
if (this.velocity.X < num185)
{
this.velocity.X = this.velocity.X + num183;
}
else
{
if (this.velocity.X > num185)
{
this.velocity.X = this.velocity.X - num183;
}
}
if (this.velocity.Y < num186)
{
this.velocity.Y = this.velocity.Y + num183;
}
else
{
if (this.velocity.Y > num186)
{
this.velocity.Y = this.velocity.Y - num183;
}
}
if ((double)Math.Abs(num186) < (double)num182 * 0.2 && ((this.velocity.X > 0f && num185 < 0f) || (this.velocity.X < 0f && num185 > 0f)))
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y + num183 * 2f;
}
else
{
this.velocity.Y = this.velocity.Y - num183 * 2f;
}
}
if ((double)Math.Abs(num185) < (double)num182 * 0.2 && ((this.velocity.Y > 0f && num186 < 0f) || (this.velocity.Y < 0f && num186 > 0f)))
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X + num183 * 2f;
}
else
{
this.velocity.X = this.velocity.X - num183 * 2f;
}
}
}
else
{
if (num190 > num191)
{
if (this.velocity.X < num185)
{
this.velocity.X = this.velocity.X + num183 * 1.1f;
}
else
{
if (this.velocity.X > num185)
{
this.velocity.X = this.velocity.X - num183 * 1.1f;
}
}
if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)num182 * 0.5)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y + num183;
}
else
{
this.velocity.Y = this.velocity.Y - num183;
}
}
}
else
{
if (this.velocity.Y < num186)
{
this.velocity.Y = this.velocity.Y + num183 * 1.1f;
}
else
{
if (this.velocity.Y > num186)
{
this.velocity.Y = this.velocity.Y - num183 * 1.1f;
}
}
if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)num182 * 0.5)
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X + num183;
}
else
{
this.velocity.X = this.velocity.X - num183;
}
}
}
}
}
}
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
if (this.type == 7 || this.type == 10 || this.type == 13 || this.type == 39 || this.type == 95 || this.type == 98 || this.type == 117)
{
if (flag17)
{
if (this.localAI[0] != 1f)
{
this.netUpdate = true;
}
this.localAI[0] = 1f;
}
else
{
if (this.localAI[0] != 0f)
{
this.netUpdate = true;
}
this.localAI[0] = 0f;
}
if (((this.velocity.X > 0f && this.oldVelocity.X < 0f) || (this.velocity.X < 0f && this.oldVelocity.X > 0f) || (this.velocity.Y > 0f && this.oldVelocity.Y < 0f) || (this.velocity.Y < 0f && this.oldVelocity.Y > 0f)) && !this.justHit)
{
this.netUpdate = true;
return;
}
}
}
}
else
{
if (this.aiStyle == 7)
{
bool flag21 = Main.raining;
if (!Main.dayTime)
{
flag21 = true;
}
if (this.type == 142 && Main.netMode != 1 && !Main.xMas)
{
this.StrikeNPC(9999, 0f, 0, false, false);
if (Main.netMode == 2)
{
NetMessage.SendData(28, -1, -1, "", this.whoAmI, 9999f, 0f, 0f, 0);
}
}
if ((this.type == 148 || this.type == 149) && this.localAI[0] == 0f)
{
this.localAI[0] = (float)Main.rand.Next(1, 5);
}
int num196 = (int)(this.position.X + (float)(this.width / 2)) / 16;
int num197 = (int)(this.position.Y + (float)this.height + 1f) / 16;
if (this.type == 107)
{
NPC.savedGoblin = true;
}
if (this.type == 108)
{
NPC.savedWizard = true;
}
if (this.type == 124)
{
NPC.savedMech = true;
}
if ((this.type == 46 || this.type == 148 || this.type == 149 || this.type == 230 || this.type == 299 || this.type == 300) && this.target == 255)
{
this.TargetClosest(true);
if (this.position.X < Main.player[this.target].position.X)
{
this.direction = 1;
this.spriteDirection = this.direction;
}
if (this.position.X > Main.player[this.target].position.X)
{
this.direction = -1;
this.spriteDirection = this.direction;
}
if (this.homeTileX == -1)
{
this.homeTileX = (int)((this.position.X + (float)(this.width / 2)) / 16f);
}
}
bool flag22 = false;
this.directionY = -1;
if (this.direction == 0)
{
this.direction = 1;
}
for (int num198 = 0; num198 < 255; num198++)
{
if (Main.player[num198].active && Main.player[num198].talkNPC == this.whoAmI)
{
flag22 = true;
if (this.ai[0] != 0f)
{
this.netUpdate = true;
}
this.ai[0] = 0f;
this.ai[1] = 300f;
this.ai[2] = 100f;
if (Main.player[num198].position.X + (float)(Main.player[num198].width / 2) < this.position.X + (float)(this.width / 2))
{
this.direction = -1;
}
else
{
this.direction = 1;
}
}
}
if (this.ai[3] > 0f)
{
this.life = -1;
this.HitEffect(0, 10.0);
this.active = false;
if (this.type == 37)
{
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
}
}
if (this.type == 37 && Main.netMode != 1)
{
this.homeless = false;
this.homeTileX = Main.dungeonX;
this.homeTileY = Main.dungeonY;
if (NPC.downedBoss3)
{
this.ai[3] = 1f;
this.netUpdate = true;
}
}
int num199 = this.homeTileY;
if (Main.netMode != 1 && this.homeTileY > 0)
{
while (!WorldGen.SolidTile(this.homeTileX, num199) && num199 < Main.maxTilesY - 20)
{
num199++;
}
}
if (Main.netMode != 1 && this.townNPC && (flag21 || Main.tileDungeon[(int)Main.tile[num196, num197].type]) && (num196 != this.homeTileX || num197 != num199) && !this.homeless)
{
bool flag23 = true;
for (int num200 = 0; num200 < 2; num200++)
{
Rectangle rectangle3 = new Rectangle((int)(this.position.X + (float)(this.width / 2) - (float)(NPC.sWidth / 2) - (float)NPC.safeRangeX), (int)(this.position.Y + (float)(this.height / 2) - (float)(NPC.sHeight / 2) - (float)NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2);
if (num200 == 1)
{
rectangle3 = new Rectangle(this.homeTileX * 16 + 8 - NPC.sWidth / 2 - NPC.safeRangeX, num199 * 16 + 8 - NPC.sHeight / 2 - NPC.safeRangeY, NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2);
}
for (int num201 = 0; num201 < 255; num201++)
{
if (Main.player[num201].active)
{
Rectangle rectangle4 = new Rectangle((int)Main.player[num201].position.X, (int)Main.player[num201].position.Y, Main.player[num201].width, Main.player[num201].height);
if (rectangle4.Intersects(rectangle3))
{
flag23 = false;
break;
}
}
if (!flag23)
{
break;
}
}
}
if (flag23)
{
if (this.type == 37 || !Collision.SolidTiles(this.homeTileX - 1, this.homeTileX + 1, num199 - 3, num199 - 1))
{
this.velocity.X = 0f;
this.velocity.Y = 0f;
this.position.X = (float)(this.homeTileX * 16 + 8 - this.width / 2);
this.position.Y = (float)(num199 * 16 - this.height) - 0.1f;
this.netUpdate = true;
}
else
{
this.homeless = true;
WorldGen.QuickFindHome(this.whoAmI);
}
}
}
if (this.ai[0] == 0f)
{
if (this.ai[2] > 0f)
{
this.ai[2] -= 1f;
}
if (flag21 && !flag22 && this.type != 46 && this.type != 148 && this.type != 149 && this.type != 230 && this.type != 299 && this.type != 300)
{
if (Main.netMode != 1)
{
if (num196 == this.homeTileX && num197 == num199)
{
if (this.velocity.X != 0f)
{
this.netUpdate = true;
}
if ((double)this.velocity.X > 0.1)
{
this.velocity.X = this.velocity.X - 0.1f;
}
else
{
if ((double)this.velocity.X < -0.1)
{
this.velocity.X = this.velocity.X + 0.1f;
}
else
{
this.velocity.X = 0f;
}
}
}
else
{
if (!flag22)
{
if (num196 > this.homeTileX)
{
this.direction = -1;
}
else
{
this.direction = 1;
}
this.ai[0] = 1f;
this.ai[1] = (float)(200 + Main.rand.Next(200));
this.ai[2] = 0f;
this.netUpdate = true;
}
}
}
}
else
{
if (this.type == 300)
{
this.velocity.X = this.velocity.X * 0.5f;
}
if ((double)this.velocity.X > 0.1)
{
this.velocity.X = this.velocity.X - 0.1f;
}
else
{
if ((double)this.velocity.X < -0.1)
{
this.velocity.X = this.velocity.X + 0.1f;
}
else
{
this.velocity.X = 0f;
}
}
if (Main.netMode != 1)
{
if (this.ai[1] > 0f)
{
this.ai[1] -= 1f;
}
if (this.ai[1] <= 0f)
{
this.ai[0] = 1f;
this.ai[1] = (float)(200 + Main.rand.Next(200));
if (this.type == 46 || this.type == 148 || this.type == 149 || this.type == 230 || this.type == 299 || this.type == 300)
{
this.ai[1] += (float)Main.rand.Next(200, 400);
}
this.ai[2] = 0f;
this.netUpdate = true;
}
}
}
if (Main.netMode != 1 && (!flag21 || (num196 == this.homeTileX && num197 == num199)))
{
if (num196 < this.homeTileX - 25 || num196 > this.homeTileX + 25)
{
if (this.ai[2] == 0f)
{
if (num196 < this.homeTileX - 50 && this.direction == -1)
{
this.direction = 1;
this.netUpdate = true;
return;
}
if (num196 > this.homeTileX + 50 && this.direction == 1)
{
this.direction = -1;
this.netUpdate = true;
return;
}
}
}
else
{
if (Main.rand.Next(80) == 0 && this.ai[2] == 0f)
{
this.ai[2] = 200f;
this.direction *= -1;
this.netUpdate = true;
return;
}
}
}
}
else
{
if (this.ai[0] == 1f)
{
if (Main.netMode != 1 && flag21 && num196 == this.homeTileX && num197 == this.homeTileY && this.type != 46 && this.type != 148 && this.type != 149 && this.type != 230 && this.type != 299 && this.type != 300)
{
this.ai[0] = 0f;
this.ai[1] = (float)(200 + Main.rand.Next(200));
this.ai[2] = 60f;
this.netUpdate = true;
return;
}
if (Main.netMode != 1 && !this.homeless && !Main.tileDungeon[(int)Main.tile[num196, num197].type] && (num196 < this.homeTileX - 35 || num196 > this.homeTileX + 35))
{
if (this.position.X < (float)(this.homeTileX * 16) && this.direction == -1)
{
this.ai[1] -= 5f;
}
else
{
if (this.position.X > (float)(this.homeTileX * 16) && this.direction == 1)
{
this.ai[1] -= 5f;
}
}
}
this.ai[1] -= 1f;
if (this.ai[1] <= 0f)
{
this.ai[0] = 0f;
this.ai[1] = (float)(300 + Main.rand.Next(300));
if (this.type == 46 || this.type == 148 || this.type == 149 || this.type == 230 || this.type == 299 || this.type == 300)
{
this.ai[1] -= (float)Main.rand.Next(100);
}
this.ai[2] = 60f;
this.netUpdate = true;
}
if (this.closeDoor && ((this.position.X + (float)(this.width / 2)) / 16f > (float)(this.doorX + 2) || (this.position.X + (float)(this.width / 2)) / 16f < (float)(this.doorX - 2)))
{
bool flag24 = WorldGen.CloseDoor(this.doorX, this.doorY, false);
if (flag24)
{
this.closeDoor = false;
NetMessage.SendData(19, -1, -1, "", 1, (float)this.doorX, (float)this.doorY, (float)this.direction, 0);
}
if ((this.position.X + (float)(this.width / 2)) / 16f > (float)(this.doorX + 4) || (this.position.X + (float)(this.width / 2)) / 16f < (float)(this.doorX - 4) || (this.position.Y + (float)(this.height / 2)) / 16f > (float)(this.doorY + 4) || (this.position.Y + (float)(this.height / 2)) / 16f < (float)(this.doorY - 4))
{
this.closeDoor = false;
}
}
float num202 = 1f;
float num203 = 0.07f;
if (this.type == 299)
{
num202 = 1.5f;
}
if (this.type == 300)
{
num202 = 2f;
num203 = 1f;
}
if (this.velocity.X < -num202 || this.velocity.X > num202)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.8f;
}
}
else
{
if (this.velocity.X < num202 && this.direction == 1)
{
this.velocity.X = this.velocity.X + num203;
if (this.velocity.X > num202)
{
this.velocity.X = num202;
}
}
else
{
if (this.velocity.X > -num202 && this.direction == -1)
{
this.velocity.X = this.velocity.X - num203;
if (this.velocity.X > num202)
{
this.velocity.X = num202;
}
}
}
}
bool flag25 = (float)((this.homeTileY - 2) * 16) <= this.position.Y;
if ((this.direction == 1 && this.position.Y + (float)(this.width / 2) > (float)(this.homeTileX * 16)) || (this.direction == -1 && this.position.Y + (float)(this.width / 2) < (float)(this.homeTileX * 16)))
{
flag25 = true;
}
if (this.velocity.Y >= 0f)
{
int num204 = 0;
if (this.velocity.X < 0f)
{
num204 = -1;
}
if (this.velocity.X > 0f)
{
num204 = 1;
}
Vector2 vector21 = this.position;
vector21.X += this.velocity.X;
int num205 = (int)((vector21.X + (float)(this.width / 2) + (float)((this.width / 2 + 1) * num204)) / 16f);
int num206 = (int)((vector21.Y + (float)this.height - 1f) / 16f);
if ((float)(num205 * 16) < vector21.X + (float)this.width && (float)(num205 * 16 + 16) > vector21.X)
{
if (Main.tile[num205, num206] == null)
{
Main.tile[num205, num206] = new Tile();
}
if (Main.tile[num205, num206 - 1] == null)
{
Main.tile[num205, num206 - 1] = new Tile();
}
if (Main.tile[num205, num206 - 2] == null)
{
Main.tile[num205, num206 - 2] = new Tile();
}
if (Main.tile[num205, num206 - 3] == null)
{
Main.tile[num205, num206 - 3] = new Tile();
}
if (Main.tile[num205, num206 + 1] == null)
{
Main.tile[num205, num206 + 1] = new Tile();
}
if (((Main.tile[num205, num206].nactive() && Main.tile[num205, num206].slope() == 0 && Main.tile[num205, num206 - 1].slope() == 0 && ((Main.tileSolid[(int)Main.tile[num205, num206].type] && !Main.tileSolidTop[(int)Main.tile[num205, num206].type]) || (flag25 && Main.tileSolidTop[(int)Main.tile[num205, num206].type] && Main.tile[num205, num206].frameY == 0 && (!Main.tileSolid[(int)Main.tile[num205, num206 - 1].type] || !Main.tile[num205, num206 - 1].nactive()) && Main.tile[num205, num206].type != 16 && Main.tile[num205, num206].type != 18 && Main.tile[num205, num206].type != 134))) || (Main.tile[num205, num206 - 1].halfBrick() && Main.tile[num205, num206 - 1].nactive())) && (!Main.tile[num205, num206 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num205, num206 - 1].type] || Main.tileSolidTop[(int)Main.tile[num205, num206 - 1].type] || (Main.tile[num205, num206 - 1].halfBrick() && (!Main.tile[num205, num206 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num205, num206 - 4].type] || Main.tileSolidTop[(int)Main.tile[num205, num206 - 4].type]))) && (!Main.tile[num205, num206 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num205, num206 - 2].type] || Main.tileSolidTop[(int)Main.tile[num205, num206 - 2].type]) && (!Main.tile[num205, num206 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num205, num206 - 3].type] || Main.tileSolidTop[(int)Main.tile[num205, num206 - 3].type]) && (!Main.tile[num205 - num204, num206 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num205 - num204, num206 - 3].type] || Main.tileSolidTop[(int)Main.tile[num205 - num204, num206 - 3].type]))
{
float num207 = (float)(num206 * 16);
if (Main.tile[num205, num206].halfBrick())
{
num207 += 8f;
}
if (Main.tile[num205, num206 - 1].halfBrick())
{
num207 -= 8f;
}
if (num207 < vector21.Y + (float)this.height)
{
float num208 = vector21.Y + (float)this.height - num207;
if ((double)num208 <= 16.1)
{
this.gfxOffY += this.position.Y + (float)this.height - num207;
this.position.Y = num207 - (float)this.height;
if (num208 < 9f)
{
this.stepSpeed = 1f;
}
else
{
this.stepSpeed = 2f;
}
}
}
}
}
}
if (this.velocity.Y == 0f)
{
if (this.position.X == this.ai[2])
{
this.direction *= -1;
}
this.ai[2] = -1f;
int num209 = (int)((this.position.X + (float)(this.width / 2) + (float)(15 * this.direction)) / 16f);
int num210 = (int)((this.position.Y + (float)this.height - 16f) / 16f);
if (Main.tile[num209, num210] == null)
{
Main.tile[num209, num210] = new Tile();
}
if (Main.tile[num209, num210 - 1] == null)
{
Main.tile[num209, num210 - 1] = new Tile();
}
if (Main.tile[num209, num210 - 2] == null)
{
Main.tile[num209, num210 - 2] = new Tile();
}
if (Main.tile[num209, num210 - 3] == null)
{
Main.tile[num209, num210 - 3] = new Tile();
}
if (Main.tile[num209, num210 + 1] == null)
{
Main.tile[num209, num210 + 1] = new Tile();
}
if (Main.tile[num209 - this.direction, num210 + 1] == null)
{
Main.tile[num209 - this.direction, num210 + 1] = new Tile();
}
if (Main.tile[num209 + this.direction, num210 - 1] == null)
{
Main.tile[num209 + this.direction, num210 - 1] = new Tile();
}
if (Main.tile[num209 + this.direction, num210 + 1] == null)
{
Main.tile[num209 + this.direction, num210 + 1] = new Tile();
}
Main.tile[num209 - this.direction, num210 + 1].halfBrick();
if (this.townNPC && Main.tile[num209, num210 - 2].nactive() && Main.tile[num209, num210 - 2].type == 10 && (Main.rand.Next(10) == 0 || flag21))
{
if (Main.netMode != 1)
{
bool flag26 = WorldGen.OpenDoor(num209, num210 - 2, this.direction);
if (flag26)
{
this.closeDoor = true;
this.doorX = num209;
this.doorY = num210 - 2;
NetMessage.SendData(19, -1, -1, "", 0, (float)num209, (float)(num210 - 2), (float)this.direction, 0);
this.netUpdate = true;
this.ai[1] += 80f;
return;
}
if (WorldGen.OpenDoor(num209, num210 - 2, -this.direction))
{
this.closeDoor = true;
this.doorX = num209;
this.doorY = num210 - 2;
NetMessage.SendData(19, -1, -1, "", 0, (float)num209, (float)(num210 - 2), (float)(-(float)this.direction), 0);
this.netUpdate = true;
this.ai[1] += 80f;
return;
}
this.direction *= -1;
this.netUpdate = true;
return;
}
}
else
{
if ((this.velocity.X < 0f && this.spriteDirection == -1) || (this.velocity.X > 0f && this.spriteDirection == 1))
{
if (Main.tile[num209, num210 - 2].nactive() && Main.tileSolid[(int)Main.tile[num209, num210 - 2].type] && !Main.tileSolidTop[(int)Main.tile[num209, num210 - 2].type])
{
if ((this.direction == 1 && !Collision.SolidTiles(num209 - 2, num209 - 1, num210 - 5, num210 - 1)) || (this.direction == -1 && !Collision.SolidTiles(num209 + 1, num209 + 2, num210 - 5, num210 - 1)))
{
if (!Collision.SolidTiles(num209, num209, num210 - 5, num210 - 3))
{
this.velocity.Y = -6f;
this.netUpdate = true;
}
else
{
if (this.type == 300)
{
if (WorldGen.SolidTile((int)(this.center().X / 16f) + this.direction, (int)(this.center().Y / 16f)))
{
this.direction *= -1;
this.velocity.X = this.velocity.X * 0f;
this.netUpdate = true;
}
}
else
{
this.direction *= -1;
this.netUpdate = true;
}
}
}
else
{
if (this.type == 300)
{
if (WorldGen.SolidTile((int)(this.center().X / 16f) + this.direction, (int)(this.center().Y / 16f)))
{
this.direction *= -1;
this.velocity.X = this.velocity.X * 0f;
this.netUpdate = true;
}
}
else
{
this.direction *= -1;
this.netUpdate = true;
}
}
}
else
{
if (Main.tile[num209, num210 - 1].nactive() && Main.tileSolid[(int)Main.tile[num209, num210 - 1].type] && !Main.tileSolidTop[(int)Main.tile[num209, num210 - 1].type])
{
if ((this.direction == 1 && !Collision.SolidTiles(num209 - 2, num209 - 1, num210 - 4, num210 - 1)) || (this.direction == -1 && !Collision.SolidTiles(num209 + 1, num209 + 2, num210 - 4, num210 - 1)))
{
if (!Collision.SolidTiles(num209, num209, num210 - 4, num210 - 2))
{
this.velocity.Y = -5f;
this.netUpdate = true;
}
else
{
this.direction *= -1;
this.netUpdate = true;
}
}
else
{
this.direction *= -1;
this.netUpdate = true;
}
}
else
{
if (this.position.Y + (float)this.height - (float)(num210 * 16) > 20f && Main.tile[num209, num210].nactive() && Main.tileSolid[(int)Main.tile[num209, num210].type] && Main.tile[num209, num210].slope() == 0)
{
if ((this.direction == 1 && !Collision.SolidTiles(num209 - 2, num209, num210 - 3, num210 - 1)) || (this.direction == -1 && !Collision.SolidTiles(num209, num209 + 2, num210 - 3, num210 - 1)))
{
this.velocity.Y = -4.4f;
this.netUpdate = true;
}
else
{
this.direction *= -1;
this.netUpdate = true;
}
}
}
}
try
{
if (Main.tile[num209, num210 + 1] == null)
{
Main.tile[num209, num210 + 1] = new Tile();
}
if (Main.tile[num209 - this.direction, num210 + 1] == null)
{
Main.tile[num209 - this.direction, num210 + 1] = new Tile();
}
if (Main.tile[num209, num210 + 2] == null)
{
Main.tile[num209, num210 + 2] = new Tile();
}
if (Main.tile[num209 - this.direction, num210 + 2] == null)
{
Main.tile[num209 - this.direction, num210 + 2] = new Tile();
}
if (Main.tile[num209, num210 + 3] == null)
{
Main.tile[num209, num210 + 3] = new Tile();
}
if (Main.tile[num209 - this.direction, num210 + 3] == null)
{
Main.tile[num209 - this.direction, num210 + 3] = new Tile();
}
if (Main.tile[num209, num210 + 4] == null)
{
Main.tile[num209, num210 + 4] = new Tile();
}
if (Main.tile[num209 - this.direction, num210 + 4] == null)
{
Main.tile[num209 - this.direction, num210 + 4] = new Tile();
}
else
{
if (num196 >= this.homeTileX - 35 && num196 <= this.homeTileX + 35 && (!Main.tile[num209, num210 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num209, num210 + 1].type]) && (!Main.tile[num209 - this.direction, num210 + 1].active() || !Main.tileSolid[(int)Main.tile[num209 - this.direction, num210 + 1].type]) && (!Main.tile[num209, num210 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num209, num210 + 2].type]) && (!Main.tile[num209 - this.direction, num210 + 2].active() || !Main.tileSolid[(int)Main.tile[num209 - this.direction, num210 + 2].type]) && (!Main.tile[num209, num210 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num209, num210 + 3].type]) && (!Main.tile[num209 - this.direction, num210 + 3].active() || !Main.tileSolid[(int)Main.tile[num209 - this.direction, num210 + 3].type]) && (!Main.tile[num209, num210 + 4].nactive() || !Main.tileSolid[(int)Main.tile[num209, num210 + 4].type]) && (!Main.tile[num209 - this.direction, num210 + 4].nactive() || !Main.tileSolid[(int)Main.tile[num209 - this.direction, num210 + 4].type]) && this.type != 46 && this.type != 148 && this.type != 149 && this.type != 230 && this.type != 299 && this.type != 300)
{
this.direction *= -1;
this.velocity.X = this.velocity.X * -1f;
this.netUpdate = true;
}
}
}
catch
{
}
if (this.velocity.Y < 0f)
{
this.ai[2] = this.position.X;
}
}
if (this.velocity.Y < 0f && this.wet)
{
this.velocity.Y = this.velocity.Y * 1.2f;
}
if (this.velocity.Y < 0f && (this.type == 46 || this.type == 299))
{
this.velocity.Y = this.velocity.Y * 1.2f;
return;
}
}
}
}
}
}
else
{
if (this.aiStyle == 8)
{
this.TargetClosest(true);
this.velocity.X = this.velocity.X * 0.93f;
if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1)
{
this.velocity.X = 0f;
}
if (this.ai[0] == 0f)
{
this.ai[0] = 500f;
}
if (this.type == 172)
{
if (this.alpha < 255)
{
this.alpha++;
}
if (this.justHit)
{
this.alpha = 0;
}
}
if (this.ai[2] != 0f && this.ai[3] != 0f)
{
if (this.type == 172)
{
this.alpha = 255;
}
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8);
for (int num211 = 0; num211 < 50; num211++)
{
if (this.type == 29 || this.type == 45)
{
int num212 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, 0f, 0f, 100, default(Color), (float)Main.rand.Next(1, 3));
Main.dust[num212].velocity *= 3f;
if (Main.dust[num212].scale > 1f)
{
Main.dust[num212].noGravity = true;
}
}
else
{
if (this.type == 32)
{
int num213 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 172, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num213].velocity *= 3f;
Main.dust[num213].noGravity = true;
}
else
{
if (this.type == 283 || this.type == 284)
{
int num214 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 173, 0f, 0f, 0, default(Color), 1f);
Main.dust[num214].velocity *= 2f;
Main.dust[num214].scale = 1.4f;
}
else
{
if (this.type == 285 || this.type == 286)
{
int num215 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 174, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num215].velocity *= 3f;
Main.dust[num215].noGravity = true;
}
else
{
if (this.type == 281 || this.type == 282)
{
int num216 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 175, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num216].velocity *= 3f;
Main.dust[num216].noGravity = true;
}
else
{
if (this.type == 172)
{
int num217 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 106, 0f, 0f, 100, default(Color), 2.5f);
Main.dust[num217].velocity *= 3f;
Main.dust[num217].noGravity = true;
}
else
{
int num218 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f);
Main.dust[num218].velocity *= 3f;
Main.dust[num218].noGravity = true;
}
}
}
}
}
}
}
this.position.X = this.ai[2] * 16f - (float)(this.width / 2) + 8f;
this.position.Y = this.ai[3] * 16f - (float)this.height;
this.velocity.X = 0f;
this.velocity.Y = 0f;
this.ai[2] = 0f;
this.ai[3] = 0f;
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8);
for (int num219 = 0; num219 < 50; num219++)
{
if (this.type == 29 || this.type == 45)
{
int num220 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, 0f, 0f, 100, default(Color), (float)Main.rand.Next(1, 3));
Main.dust[num220].velocity *= 3f;
if (Main.dust[num220].scale > 1f)
{
Main.dust[num220].noGravity = true;
}
}
else
{
if (this.type == 32)
{
int num221 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 172, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num221].velocity *= 3f;
Main.dust[num221].noGravity = true;
}
else
{
if (this.type == 172)
{
int num222 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 106, 0f, 0f, 100, default(Color), 2.5f);
Main.dust[num222].velocity *= 3f;
Main.dust[num222].noGravity = true;
}
else
{
if (this.type == 283 || this.type == 284)
{
int num223 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 173, 0f, 0f, 0, default(Color), 1f);
Main.dust[num223].velocity *= 2f;
Main.dust[num223].scale = 1.4f;
}
else
{
if (this.type == 285 || this.type == 286)
{
int num224 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 174, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num224].velocity *= 3f;
Main.dust[num224].noGravity = true;
}
else
{
if (this.type == 281 || this.type == 282)
{
int num225 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 175, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num225].velocity *= 3f;
Main.dust[num225].noGravity = true;
}
else
{
int num226 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f);
Main.dust[num226].velocity *= 3f;
Main.dust[num226].noGravity = true;
}
}
}
}
}
}
}
}
this.ai[0] += 1f;
if (this.type == 283 || this.type == 284)
{
if (this.ai[0] == 50f || this.ai[0] == 100f || this.ai[0] == 150f || this.ai[0] == 200f || this.ai[0] == 250f)
{
this.ai[1] = 30f;
this.netUpdate = true;
}
if (this.ai[0] >= 400f)
{
this.ai[0] = 700f;
}
}
else
{
if (this.type == 172 && (this.ai[0] == 75f || this.ai[0] == 150f || this.ai[0] == 225f || this.ai[0] == 300f || this.ai[0] == 375f || this.ai[0] == 450f))
{
this.ai[1] = 30f;
this.netUpdate = true;
}
}
if (this.type == 281 || this.type == 282)
{
if (this.ai[0] == 20f || this.ai[0] == 40f || this.ai[0] == 60f || this.ai[0] == 120f || this.ai[0] == 140f || this.ai[0] == 160f || this.ai[0] == 220f || this.ai[0] == 240f || this.ai[0] == 260f)
{
this.ai[1] = 30f;
this.netUpdate = true;
}
if (this.ai[0] >= 460f)
{
this.ai[0] = 700f;
}
}
else
{
if (this.ai[0] == 100f || this.ai[0] == 200f || this.ai[0] == 300f)
{
this.ai[1] = 30f;
this.netUpdate = true;
}
}
if ((this.type == 285 || this.type == 286) && this.ai[0] > 400f)
{
this.ai[0] = 650f;
}
if (this.ai[0] >= 650f && Main.netMode != 1)
{
this.ai[0] = 1f;
int num227 = (int)Main.player[this.target].position.X / 16;
int num228 = (int)Main.player[this.target].position.Y / 16;
int num229 = (int)this.position.X / 16;
int num230 = (int)this.position.Y / 16;
int num231 = 20;
int num232 = 0;
bool flag27 = false;
if (Math.Abs(this.position.X - Main.player[this.target].position.X) + Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f)
{
num232 = 100;
flag27 = true;
}
while (!flag27 && num232 < 100)
{
num232++;
int num233 = Main.rand.Next(num227 - num231, num227 + num231);
int num234 = Main.rand.Next(num228 - num231, num228 + num231);
for (int num235 = num234; num235 < num228 + num231; num235++)
{
if ((num235 < num228 - 4 || num235 > num228 + 4 || num233 < num227 - 4 || num233 > num227 + 4) && (num235 < num230 - 1 || num235 > num230 + 1 || num233 < num229 - 1 || num233 > num229 + 1) && Main.tile[num233, num235].nactive())
{
bool flag28 = true;
if ((this.type == 32 || (this.type >= 281 && this.type <= 286)) && !Main.wallDungeon[(int)Main.tile[num233, num235 - 1].wall])
{
flag28 = false;
}
else
{
if (Main.tile[num233, num235 - 1].lava())
{
flag28 = false;
}
}
if (flag28 && Main.tileSolid[(int)Main.tile[num233, num235].type] && !Collision.SolidTiles(num233 - 1, num233 + 1, num235 - 4, num235 - 1))
{
this.ai[1] = 20f;
this.ai[2] = (float)num233;
this.ai[3] = (float)num235;
flag27 = true;
break;
}
}
}
}
this.netUpdate = true;
}
if (this.ai[1] > 0f)
{
this.ai[1] -= 1f;
if (this.ai[1] == 25f)
{
if (this.type >= 281 && this.type <= 286)
{
float num236 = 6f;
if (this.type == 285 || this.type == 286)
{
num236 = 8f;
}
if (this.type == 281 || this.type == 282)
{
num236 = 4f;
}
Vector2 vector22 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y);
float num237 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector22.X;
float num238 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector22.Y;
if (this.type == 283 || this.type == 284)
{
num237 += (float)Main.rand.Next(-30, 31);
num238 += (float)Main.rand.Next(-30, 31);
num237 -= Main.player[this.target].velocity.X * 10f;
num238 -= Main.player[this.target].velocity.Y * 10f;
}
float num239 = (float)Math.Sqrt((double)(num237 * num237 + num238 * num238));
num239 = num236 / num239;
num237 *= num239;
num238 *= num239;
int num240 = 30;
int num241 = 290;
if (this.type == 285 || this.type == 286)
{
num241 = 291;
num240 = 40;
}
if (this.type == 281 || this.type == 282)
{
num241 = 293;
num240 = 40;
}
int num242 = Projectile.NewProjectile(vector22.X, vector22.Y, num237, num238, num241, num240, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num242].timeLeft = 300;
if (num241 == 291)
{
Main.projectile[num242].ai[0] = Main.player[this.target].center().X;
Main.projectile[num242].ai[1] = Main.player[this.target].center().Y;
Main.projectile[num242].netUpdate = true;
}
this.localAI[0] = 0f;
}
else
{
if (this.type != 172)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8);
}
if (Main.netMode != 1)
{
if (this.type == 29 || this.type == 45)
{
NPC.NewNPC((int)this.position.X + this.width / 2, (int)this.position.Y - 8, 30, 0);
}
else
{
if (this.type == 32)
{
NPC.NewNPC((int)this.position.X + this.width / 2, (int)this.position.Y - 8, 33, 0);
}
else
{
if (this.type == 172)
{
float num243 = 10f;
Vector2 vector23 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num244 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector23.X + (float)Main.rand.Next(-10, 11);
float num245 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector23.Y + (float)Main.rand.Next(-10, 11);
float num246 = (float)Math.Sqrt((double)(num244 * num244 + num245 * num245));
num246 = num243 / num246;
num244 *= num246;
num245 *= num246;
int num247 = 40;
int num248 = 129;
int num249 = Projectile.NewProjectile(vector23.X, vector23.Y, num244, num245, num248, num247, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num249].timeLeft = 300;
this.localAI[0] = 0f;
}
else
{
NPC.NewNPC((int)this.position.X + this.width / 2 + this.direction * 8, (int)this.position.Y + 20, 25, 0);
}
}
}
}
}
}
}
if (this.type == 29 || this.type == 45)
{
if (Main.rand.Next(5) == 0)
{
int num250 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 27, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 1.5f);
Main.dust[num250].noGravity = true;
Dust expr_FC8F_cp_0 = Main.dust[num250];
expr_FC8F_cp_0.velocity.X = expr_FC8F_cp_0.velocity.X * 0.5f;
Main.dust[num250].velocity.Y = -2f;
return;
}
}
else
{
if (this.type == 32)
{
if (Main.rand.Next(3) != 0)
{
int num251 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 172, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 0.9f);
Main.dust[num251].noGravity = true;
Dust expr_FD68_cp_0 = Main.dust[num251];
expr_FD68_cp_0.velocity.X = expr_FD68_cp_0.velocity.X * 0.3f;
Dust expr_FD88_cp_0 = Main.dust[num251];
expr_FD88_cp_0.velocity.Y = expr_FD88_cp_0.velocity.Y * 0.2f;
Dust expr_FDA8_cp_0 = Main.dust[num251];
expr_FDA8_cp_0.velocity.Y = expr_FDA8_cp_0.velocity.Y - 1f;
return;
}
}
else
{
if (this.type == 172)
{
int num252 = 1;
if (this.alpha == 255)
{
num252 = 2;
}
for (int num253 = 0; num253 < num252; num253++)
{
if (Main.rand.Next(255) > 255 - this.alpha)
{
int num254 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 106, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 1.2f);
Main.dust[num254].noGravity = true;
Dust expr_FE99_cp_0 = Main.dust[num254];
expr_FE99_cp_0.velocity.X = expr_FE99_cp_0.velocity.X * (0.1f + (float)Main.rand.Next(30) * 0.01f);
Dust expr_FECD_cp_0 = Main.dust[num254];
expr_FECD_cp_0.velocity.Y = expr_FECD_cp_0.velocity.Y * (0.1f + (float)Main.rand.Next(30) * 0.01f);
Main.dust[num254].scale *= 1f + (float)Main.rand.Next(6) * 0.1f;
}
}
return;
}
if (this.type == 283 || this.type == 284)
{
if (Main.rand.Next(2) == 0)
{
int num255 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 173, 0f, 0f, 0, default(Color), 1f);
Dust expr_FFCD_cp_0 = Main.dust[num255];
expr_FFCD_cp_0.velocity.X = expr_FFCD_cp_0.velocity.X * 0.5f;
Dust expr_FFED_cp_0 = Main.dust[num255];
expr_FFED_cp_0.velocity.Y = expr_FFED_cp_0.velocity.Y * 0.5f;
return;
}
}
else
{
if (this.type == 285 || this.type == 286)
{
if (Main.rand.Next(2) == 0)
{
int num256 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 174, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 1f);
Main.dust[num256].noGravity = true;
Main.dust[num256].velocity *= 0.4f;
Dust expr_100DC_cp_0 = Main.dust[num256];
expr_100DC_cp_0.velocity.Y = expr_100DC_cp_0.velocity.Y - 0.7f;
return;
}
}
else
{
if (this.type == 281 || this.type == 282)
{
if (Main.rand.Next(2) == 0)
{
int num257 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 175, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 0.1f);
Main.dust[num257].noGravity = true;
Main.dust[num257].velocity *= 0.5f;
Main.dust[num257].fadeIn = 1.2f;
return;
}
}
else
{
if (Main.rand.Next(2) == 0)
{
int num258 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 2f);
Main.dust[num258].noGravity = true;
Dust expr_1026E_cp_0 = Main.dust[num258];
expr_1026E_cp_0.velocity.X = expr_1026E_cp_0.velocity.X * 1f;
Dust expr_1028E_cp_0 = Main.dust[num258];
expr_1028E_cp_0.velocity.Y = expr_1028E_cp_0.velocity.Y * 1f;
return;
}
}
}
}
}
}
}
else
{
if (this.aiStyle == 9)
{
if (this.target == 255)
{
this.TargetClosest(true);
float num259 = 6f;
if (this.type == 25)
{
num259 = 5f;
}
if (this.type == 112)
{
num259 = 7f;
}
Vector2 vector24 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num260 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector24.X;
float num261 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector24.Y;
float num262 = (float)Math.Sqrt((double)(num260 * num260 + num261 * num261));
num262 = num259 / num262;
this.velocity.X = num260 * num262;
this.velocity.Y = num261 * num262;
}
if (this.type == 112)
{
this.ai[0] += 1f;
if (this.ai[0] > 3f)
{
this.ai[0] = 3f;
}
if (this.ai[0] == 2f)
{
this.position += this.velocity;
Main.PlaySound(4, (int)this.position.X, (int)this.position.Y, 9);
for (int num263 = 0; num263 < 20; num263++)
{
int num264 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 18, 0f, 0f, 100, default(Color), 1.8f);
Main.dust[num264].velocity *= 1.3f;
Main.dust[num264].velocity += this.velocity;
Main.dust[num264].noGravity = true;
}
}
}
if (this.type == 112 && Collision.SolidCollision(this.position, this.width, this.height))
{
int arg_1056F_0 = Main.netMode;
this.StrikeNPC(999, 0f, 0, false, false);
}
if (this.timeLeft > 100)
{
this.timeLeft = 100;
}
for (int num265 = 0; num265 < 2; num265++)
{
if (this.type == 30)
{
int num266 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 27, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 2f);
Main.dust[num266].noGravity = true;
Main.dust[num266].velocity *= 0.3f;
Dust expr_1065A_cp_0 = Main.dust[num266];
expr_1065A_cp_0.velocity.X = expr_1065A_cp_0.velocity.X - this.velocity.X * 0.2f;
Dust expr_10686_cp_0 = Main.dust[num266];
expr_10686_cp_0.velocity.Y = expr_10686_cp_0.velocity.Y - this.velocity.Y * 0.2f;
}
else
{
if (this.type == 33)
{
for (int num267 = 0; num267 < 3; num267++)
{
float num268 = this.velocity.X / 3f * (float)num265;
float num269 = this.velocity.Y / 3f * (float)num265;
int num270 = 2;
int num271 = Dust.NewDust(new Vector2(this.position.X + (float)num270, this.position.Y + (float)num270), this.width - num270 * 2, this.height - num270 * 2, 172, 0f, 0f, 100, default(Color), 1.2f);
Main.dust[num271].noGravity = true;
Main.dust[num271].velocity *= 0.1f;
Main.dust[num271].velocity += this.velocity * 0.5f;
Dust expr_107D0_cp_0 = Main.dust[num271];
expr_107D0_cp_0.position.X = expr_107D0_cp_0.position.X - num268;
Dust expr_107EF_cp_0 = Main.dust[num271];
expr_107EF_cp_0.position.Y = expr_107EF_cp_0.position.Y - num269;
}
if (Main.rand.Next(5) == 0)
{
int num272 = 2;
int num273 = Dust.NewDust(new Vector2(this.position.X + (float)num272, this.position.Y + (float)num272), this.width - num272 * 2, this.height - num272 * 2, 172, 0f, 0f, 100, default(Color), 0.6f);
Main.dust[num273].velocity *= 0.25f;
Main.dust[num273].velocity += this.velocity * 0.5f;
}
}
else
{
if (this.type == 112)
{
int num274 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 18, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 80, default(Color), 1.3f);
Main.dust[num274].velocity *= 0.3f;
Main.dust[num274].noGravity = true;
}
else
{
Lighting.addLight((int)((this.position.X + (float)(this.width / 2)) / 16f), (int)((this.position.Y + (float)(this.height / 2)) / 16f), 1f, 0.3f, 0.1f);
int num275 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 2f);
Main.dust[num275].noGravity = true;
Dust expr_10A6D_cp_0 = Main.dust[num275];
expr_10A6D_cp_0.velocity.X = expr_10A6D_cp_0.velocity.X * 0.3f;
Dust expr_10A8D_cp_0 = Main.dust[num275];
expr_10A8D_cp_0.velocity.Y = expr_10A8D_cp_0.velocity.Y * 0.3f;
}
}
}
}
this.rotation += 0.4f * (float)this.direction;
return;
}
if (this.aiStyle == 10)
{
float num276 = 1f;
float num277 = 0.011f;
this.TargetClosest(true);
Vector2 vector25 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num278 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector25.X;
float num279 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector25.Y;
float num280 = (float)Math.Sqrt((double)(num278 * num278 + num279 * num279));
float num281 = num280;
this.ai[1] += 1f;
if (this.ai[1] > 600f)
{
num277 *= 8f;
num276 = 4f;
if (this.ai[1] > 650f)
{
this.ai[1] = 0f;
}
}
else
{
if (num281 < 250f)
{
this.ai[0] += 0.9f;
if (this.ai[0] > 0f)
{
this.velocity.Y = this.velocity.Y + 0.019f;
}
else
{
this.velocity.Y = this.velocity.Y - 0.019f;
}
if (this.ai[0] < -100f || this.ai[0] > 100f)
{
this.velocity.X = this.velocity.X + 0.019f;
}
else
{
this.velocity.X = this.velocity.X - 0.019f;
}
if (this.ai[0] > 200f)
{
this.ai[0] = -200f;
}
}
}
if (num281 > 350f)
{
num276 = 5f;
num277 = 0.3f;
}
else
{
if (num281 > 300f)
{
num276 = 3f;
num277 = 0.2f;
}
else
{
if (num281 > 250f)
{
num276 = 1.5f;
num277 = 0.1f;
}
}
}
num280 = num276 / num280;
num278 *= num280;
num279 *= num280;
if (Main.player[this.target].dead)
{
num278 = (float)this.direction * num276 / 2f;
num279 = -num276 / 2f;
}
if (this.velocity.X < num278)
{
this.velocity.X = this.velocity.X + num277;
}
else
{
if (this.velocity.X > num278)
{
this.velocity.X = this.velocity.X - num277;
}
}
if (this.velocity.Y < num279)
{
this.velocity.Y = this.velocity.Y + num277;
}
else
{
if (this.velocity.Y > num279)
{
this.velocity.Y = this.velocity.Y - num277;
}
}
if (num278 > 0f)
{
this.spriteDirection = -1;
this.rotation = (float)Math.Atan2((double)num279, (double)num278);
}
if (num278 < 0f)
{
this.spriteDirection = 1;
this.rotation = (float)Math.Atan2((double)num279, (double)num278) + 3.14f;
}
if (this.type == 289)
{
if (this.justHit)
{
this.ai[2] = 0f;
this.ai[3] = 0f;
}
vector25 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num278 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector25.X;
num279 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector25.Y;
num280 = (float)Math.Sqrt((double)(num278 * num278 + num279 * num279));
if (num280 > 500f)
{
this.ai[2] = 0f;
this.ai[3] = 0f;
return;
}
this.ai[2] += 1f;
if (this.ai[3] == 0f)
{
if (this.ai[2] > 120f)
{
this.ai[2] = 0f;
this.ai[3] = 1f;
this.netUpdate = true;
return;
}
}
else
{
if (this.ai[2] > 40f)
{
this.ai[3] = 0f;
}
if (Main.netMode != 1 && this.ai[2] == 20f)
{
float num282 = 6f;
int num283 = 25;
int num284 = 299;
num280 = num282 / num280;
num278 *= num280;
num279 *= num280;
Projectile.NewProjectile(vector25.X, vector25.Y, num278, num279, num284, num283, 0f, Main.myPlayer, 0f, 0f);
return;
}
}
}
}
else
{
if (this.aiStyle == 11)
{
if (this.ai[0] == 0f && Main.netMode != 1)
{
this.TargetClosest(true);
this.ai[0] = 1f;
if (this.type != 68)
{
int num285 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 36, this.whoAmI);
Main.npc[num285].ai[0] = -1f;
Main.npc[num285].ai[1] = (float)this.whoAmI;
Main.npc[num285].target = this.target;
Main.npc[num285].netUpdate = true;
num285 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 36, this.whoAmI);
Main.npc[num285].ai[0] = 1f;
Main.npc[num285].ai[1] = (float)this.whoAmI;
Main.npc[num285].ai[3] = 150f;
Main.npc[num285].target = this.target;
Main.npc[num285].netUpdate = true;
}
}
if (this.type == 68 && this.ai[1] != 3f && this.ai[1] != 2f)
{
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
this.ai[1] = 2f;
}
if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 2000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f)
{
this.TargetClosest(true);
if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 2000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f)
{
this.ai[1] = 3f;
}
}
if (Main.dayTime && this.ai[1] != 3f && this.ai[1] != 2f)
{
this.ai[1] = 2f;
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
}
if (this.ai[1] == 0f)
{
this.defense = 10;
this.ai[2] += 1f;
if (this.ai[2] >= 800f)
{
this.ai[2] = 0f;
this.ai[1] = 1f;
this.TargetClosest(true);
this.netUpdate = true;
}
this.rotation = this.velocity.X / 15f;
if (this.position.Y > Main.player[this.target].position.Y - 250f)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.98f;
}
this.velocity.Y = this.velocity.Y - 0.02f;
if (this.velocity.Y > 2f)
{
this.velocity.Y = 2f;
}
}
else
{
if (this.position.Y < Main.player[this.target].position.Y - 250f)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.98f;
}
this.velocity.Y = this.velocity.Y + 0.02f;
if (this.velocity.Y < -2f)
{
this.velocity.Y = -2f;
}
}
}
if (this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.98f;
}
this.velocity.X = this.velocity.X - 0.05f;
if (this.velocity.X > 8f)
{
this.velocity.X = 8f;
}
}
if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.98f;
}
this.velocity.X = this.velocity.X + 0.05f;
if (this.velocity.X < -8f)
{
this.velocity.X = -8f;
}
}
}
else
{
if (this.ai[1] == 1f)
{
this.defense = 0;
this.ai[2] += 1f;
if (this.ai[2] == 2f)
{
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
}
if (this.ai[2] >= 400f)
{
this.ai[2] = 0f;
this.ai[1] = 0f;
}
this.rotation += (float)this.direction * 0.3f;
Vector2 vector26 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num286 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector26.X;
float num287 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector26.Y;
float num288 = (float)Math.Sqrt((double)(num286 * num286 + num287 * num287));
num288 = 1.5f / num288;
this.velocity.X = num286 * num288;
this.velocity.Y = num287 * num288;
}
else
{
if (this.ai[1] == 2f)
{
this.damage = 9999;
this.defense = 9999;
this.rotation += (float)this.direction * 0.3f;
Vector2 vector27 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num289 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector27.X;
float num290 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector27.Y;
float num291 = (float)Math.Sqrt((double)(num289 * num289 + num290 * num290));
num291 = 8f / num291;
this.velocity.X = num289 * num291;
this.velocity.Y = num290 * num291;
}
else
{
if (this.ai[1] == 3f)
{
this.velocity.Y = this.velocity.Y + 0.1f;
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.95f;
}
this.velocity.X = this.velocity.X * 0.95f;
if (this.timeLeft > 500)
{
this.timeLeft = 500;
}
}
}
}
}
if (this.ai[1] != 2f && this.ai[1] != 3f && this.type != 68)
{
int num292 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) - 15f - this.velocity.X * 5f, this.position.Y + (float)this.height - 2f), 30, 10, 5, -this.velocity.X * 0.2f, 3f, 0, default(Color), 2f);
Main.dust[num292].noGravity = true;
Dust expr_11B42_cp_0 = Main.dust[num292];
expr_11B42_cp_0.velocity.X = expr_11B42_cp_0.velocity.X * 1.3f;
Dust expr_11B62_cp_0 = Main.dust[num292];
expr_11B62_cp_0.velocity.X = expr_11B62_cp_0.velocity.X + this.velocity.X * 0.4f;
Dust expr_11B8E_cp_0 = Main.dust[num292];
expr_11B8E_cp_0.velocity.Y = expr_11B8E_cp_0.velocity.Y + (2f + this.velocity.Y);
for (int num293 = 0; num293 < 2; num293++)
{
num292 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 120f), this.width, 60, 5, this.velocity.X, this.velocity.Y, 0, default(Color), 2f);
Main.dust[num292].noGravity = true;
Main.dust[num292].velocity -= this.velocity;
Dust expr_11C51_cp_0 = Main.dust[num292];
expr_11C51_cp_0.velocity.Y = expr_11C51_cp_0.velocity.Y + 5f;
}
return;
}
}
else
{
if (this.aiStyle == 12)
{
this.spriteDirection = -(int)this.ai[0];
if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 11)
{
this.ai[2] += 10f;
if (this.ai[2] > 50f || Main.netMode != 2)
{
this.life = -1;
this.HitEffect(0, 10.0);
this.active = false;
}
}
if (this.ai[2] == 0f || this.ai[2] == 3f)
{
if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10)
{
this.timeLeft = 10;
}
if (Main.npc[(int)this.ai[1]].ai[1] != 0f)
{
if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y - 0.07f;
if (this.velocity.Y > 6f)
{
this.velocity.Y = 6f;
}
}
else
{
if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y + 0.07f;
if (this.velocity.Y < -6f)
{
this.velocity.Y = -6f;
}
}
}
if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0])
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X > 8f)
{
this.velocity.X = 8f;
}
}
if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0])
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X < -8f)
{
this.velocity.X = -8f;
}
}
}
else
{
this.ai[3] += 1f;
if (this.ai[3] >= 300f)
{
this.ai[2] += 1f;
this.ai[3] = 0f;
this.netUpdate = true;
}
if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y + 230f)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y - 0.04f;
if (this.velocity.Y > 3f)
{
this.velocity.Y = 3f;
}
}
else
{
if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y + 230f)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y + 0.04f;
if (this.velocity.Y < -3f)
{
this.velocity.Y = -3f;
}
}
}
if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0])
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X - 0.07f;
if (this.velocity.X > 8f)
{
this.velocity.X = 8f;
}
}
if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0])
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X + 0.07f;
if (this.velocity.X < -8f)
{
this.velocity.X = -8f;
}
}
}
Vector2 vector28 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num294 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector28.X;
float num295 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector28.Y;
Math.Sqrt((double)(num294 * num294 + num295 * num295));
this.rotation = (float)Math.Atan2((double)num295, (double)num294) + 1.57f;
return;
}
if (this.ai[2] == 1f)
{
Vector2 vector29 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num296 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector29.X;
float num297 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector29.Y;
float num298 = (float)Math.Sqrt((double)(num296 * num296 + num297 * num297));
this.rotation = (float)Math.Atan2((double)num297, (double)num296) + 1.57f;
this.velocity.X = this.velocity.X * 0.95f;
this.velocity.Y = this.velocity.Y - 0.1f;
if (this.velocity.Y < -8f)
{
this.velocity.Y = -8f;
}
if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 200f)
{
this.TargetClosest(true);
this.ai[2] = 2f;
vector29 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num296 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector29.X;
num297 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector29.Y;
num298 = (float)Math.Sqrt((double)(num296 * num296 + num297 * num297));
num298 = 18f / num298;
this.velocity.X = num296 * num298;
this.velocity.Y = num297 * num298;
this.netUpdate = true;
return;
}
}
else
{
if (this.ai[2] == 2f)
{
if (this.position.Y > Main.player[this.target].position.Y || this.velocity.Y < 0f)
{
this.ai[2] = 3f;
return;
}
}
else
{
if (this.ai[2] == 4f)
{
Vector2 vector30 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num299 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector30.X;
float num300 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector30.Y;
float num301 = (float)Math.Sqrt((double)(num299 * num299 + num300 * num300));
this.rotation = (float)Math.Atan2((double)num300, (double)num299) + 1.57f;
this.velocity.Y = this.velocity.Y * 0.95f;
this.velocity.X = this.velocity.X + 0.1f * -this.ai[0];
if (this.velocity.X < -8f)
{
this.velocity.X = -8f;
}
if (this.velocity.X > 8f)
{
this.velocity.X = 8f;
}
if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 500f || this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 500f)
{
this.TargetClosest(true);
this.ai[2] = 5f;
vector30 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num299 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector30.X;
num300 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector30.Y;
num301 = (float)Math.Sqrt((double)(num299 * num299 + num300 * num300));
num301 = 17f / num301;
this.velocity.X = num299 * num301;
this.velocity.Y = num300 * num301;
this.netUpdate = true;
return;
}
}
else
{
if (this.ai[2] == 5f && ((this.velocity.X > 0f && this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)) || (this.velocity.X < 0f && this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))))
{
this.ai[2] = 0f;
return;
}
}
}
}
}
else
{
if (this.aiStyle == 13)
{
if (this.ai[0] < 0f || this.ai[0] >= (float)Main.maxTilesX || this.ai[1] < 0f || this.ai[1] >= (float)Main.maxTilesX)
{
return;
}
if (Main.tile[(int)this.ai[0], (int)this.ai[1]] == null)
{
Main.tile[(int)this.ai[0], (int)this.ai[1]] = new Tile();
}
if (!Main.tile[(int)this.ai[0], (int)this.ai[1]].active())
{
this.life = -1;
this.HitEffect(0, 10.0);
this.active = false;
return;
}
this.TargetClosest(true);
float num302 = 0.035f;
float num303 = 150f;
if (this.type == 43)
{
num303 = 250f;
}
if (this.type == 101)
{
num303 = 175f;
}
if (this.type == 259)
{
num303 = 100f;
}
if (this.type == 175)
{
num303 = 500f;
num302 = 0.05f;
}
if (this.type == 260)
{
num303 = 350f;
num302 = 0.15f;
}
this.ai[2] += 1f;
if (this.ai[2] > 300f)
{
num303 = (float)((int)((double)num303 * 1.3));
if (this.ai[2] > 450f)
{
this.ai[2] = 0f;
}
}
Vector2 vector31 = new Vector2(this.ai[0] * 16f + 8f, this.ai[1] * 16f + 8f);
float num304 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - (float)(this.width / 2) - vector31.X;
float num305 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - (float)(this.height / 2) - vector31.Y;
float num306 = (float)Math.Sqrt((double)(num304 * num304 + num305 * num305));
if (num306 > num303)
{
num306 = num303 / num306;
num304 *= num306;
num305 *= num306;
}
if (this.position.X < this.ai[0] * 16f + 8f + num304)
{
this.velocity.X = this.velocity.X + num302;
if (this.velocity.X < 0f && num304 > 0f)
{
this.velocity.X = this.velocity.X + num302 * 1.5f;
}
}
else
{
if (this.position.X > this.ai[0] * 16f + 8f + num304)
{
this.velocity.X = this.velocity.X - num302;
if (this.velocity.X > 0f && num304 < 0f)
{
this.velocity.X = this.velocity.X - num302 * 1.5f;
}
}
}
if (this.position.Y < this.ai[1] * 16f + 8f + num305)
{
this.velocity.Y = this.velocity.Y + num302;
if (this.velocity.Y < 0f && num305 > 0f)
{
this.velocity.Y = this.velocity.Y + num302 * 1.5f;
}
}
else
{
if (this.position.Y > this.ai[1] * 16f + 8f + num305)
{
this.velocity.Y = this.velocity.Y - num302;
if (this.velocity.Y > 0f && num305 < 0f)
{
this.velocity.Y = this.velocity.Y - num302 * 1.5f;
}
}
}
if (this.type == 43)
{
if (this.velocity.X > 3f)
{
this.velocity.X = 3f;
}
if (this.velocity.X < -3f)
{
this.velocity.X = -3f;
}
if (this.velocity.Y > 3f)
{
this.velocity.Y = 3f;
}
if (this.velocity.Y < -3f)
{
this.velocity.Y = -3f;
}
}
else
{
if (this.type == 175)
{
if (this.velocity.X > 4f)
{
this.velocity.X = 4f;
}
if (this.velocity.X < -4f)
{
this.velocity.X = -4f;
}
if (this.velocity.Y > 4f)
{
this.velocity.Y = 4f;
}
if (this.velocity.Y < -4f)
{
this.velocity.Y = -4f;
}
}
else
{
if (this.velocity.X > 2f)
{
this.velocity.X = 2f;
}
if (this.velocity.X < -2f)
{
this.velocity.X = -2f;
}
if (this.velocity.Y > 2f)
{
this.velocity.Y = 2f;
}
if (this.velocity.Y < -2f)
{
this.velocity.Y = -2f;
}
}
}
if (this.type == 259 || this.type == 260)
{
this.rotation = (float)Math.Atan2((double)num305, (double)num304) + 1.57f;
}
else
{
if (num304 > 0f)
{
this.spriteDirection = 1;
this.rotation = (float)Math.Atan2((double)num305, (double)num304);
}
if (num304 < 0f)
{
this.spriteDirection = -1;
this.rotation = (float)Math.Atan2((double)num305, (double)num304) + 3.14f;
}
}
if (this.collideX)
{
this.netUpdate = true;
this.velocity.X = this.oldVelocity.X * -0.7f;
if (this.velocity.X > 0f && this.velocity.X < 2f)
{
this.velocity.X = 2f;
}
if (this.velocity.X < 0f && this.velocity.X > -2f)
{
this.velocity.X = -2f;
}
}
if (this.collideY)
{
this.netUpdate = true;
this.velocity.Y = this.oldVelocity.Y * -0.7f;
if (this.velocity.Y > 0f && this.velocity.Y < 2f)
{
this.velocity.Y = 2f;
}
if (this.velocity.Y < 0f && this.velocity.Y > -2f)
{
this.velocity.Y = -2f;
}
}
if (Main.netMode != 1)
{
if (this.type == 101 && !Main.player[this.target].dead)
{
if (this.justHit)
{
this.localAI[0] = 0f;
}
this.localAI[0] += 1f;
if (this.localAI[0] >= 120f)
{
if (!Collision.SolidCollision(this.position, this.width, this.height) && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
float num307 = 10f;
vector31 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num304 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector31.X + (float)Main.rand.Next(-10, 11);
num305 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector31.Y + (float)Main.rand.Next(-10, 11);
num306 = (float)Math.Sqrt((double)(num304 * num304 + num305 * num305));
num306 = num307 / num306;
num304 *= num306;
num305 *= num306;
int num308 = 22;
int num309 = 96;
int num310 = Projectile.NewProjectile(vector31.X, vector31.Y, num304, num305, num309, num308, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num310].timeLeft = 300;
this.localAI[0] = 0f;
}
else
{
this.localAI[0] = 100f;
}
}
}
if (this.type == 260 && !Main.player[this.target].dead)
{
if (this.justHit)
{
this.localAI[0] = 0f;
}
this.localAI[0] += 1f;
if (this.localAI[0] >= 150f)
{
if (!Collision.SolidCollision(this.position, this.width, this.height))
{
float num311 = 14f;
vector31 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num304 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector31.X + (float)Main.rand.Next(-10, 11);
float num312 = Math.Abs(num304 * 0.1f);
if (num305 > 0f)
{
num312 = 0f;
}
num305 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector31.Y + (float)Main.rand.Next(-10, 11) - num312;
num306 = (float)Math.Sqrt((double)(num304 * num304 + num305 * num305));
num306 = num311 / num306;
num304 *= num306;
num305 *= num306;
int num313 = NPC.NewNPC((int)this.center().X, (int)this.center().Y, 261, 0);
Main.npc[num313].velocity.X = num304;
Main.npc[num313].velocity.Y = num305;
Main.npc[num313].netUpdate = true;
this.localAI[0] = 0f;
return;
}
this.localAI[0] = 250f;
return;
}
}
}
}
else
{
if (this.aiStyle == 14)
{
if (this.type == 60 || this.type == 151)
{
int num314 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 2f);
Main.dust[num314].noGravity = true;
}
if (this.type == 150 && Main.rand.Next(10) == 0)
{
int num315 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 67, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 90, default(Color), 1.5f);
Main.dust[num315].noGravity = true;
Main.dust[num315].velocity *= 0.2f;
Main.dust[num315].noLight = true;
}
this.noGravity = true;
if (this.collideX)
{
this.velocity.X = this.oldVelocity.X * -0.5f;
if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f)
{
this.velocity.X = 2f;
}
if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f)
{
this.velocity.X = -2f;
}
}
if (this.collideY)
{
this.velocity.Y = this.oldVelocity.Y * -0.5f;
if (this.velocity.Y > 0f && this.velocity.Y < 1f)
{
this.velocity.Y = 1f;
}
if (this.velocity.Y < 0f && this.velocity.Y > -1f)
{
this.velocity.Y = -1f;
}
}
if (this.type == 226)
{
int num316 = 1;
int num317 = 1;
if (this.velocity.X < 0f)
{
num316 = -1;
}
if (this.velocity.Y < 0f)
{
num317 = -1;
}
this.TargetClosest(true);
if (!Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.direction = num316;
this.directionY = num317;
}
}
else
{
this.TargetClosest(true);
}
if (this.type == 158)
{
if ((double)this.position.Y < Main.worldSurface * 16.0 && Main.dayTime && !Main.eclipse)
{
this.directionY = -1;
this.direction *= -1;
}
if (this.direction == -1 && this.velocity.X > -7f)
{
this.velocity.X = this.velocity.X - 0.2f;
if (this.velocity.X > 4f)
{
this.velocity.X = this.velocity.X - 0.1f;
}
else
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X + 0.05f;
}
}
if (this.velocity.X < -7f)
{
this.velocity.X = -7f;
}
}
else
{
if (this.direction == 1 && this.velocity.X < 7f)
{
this.velocity.X = this.velocity.X + 0.2f;
if (this.velocity.X < -4f)
{
this.velocity.X = this.velocity.X + 0.1f;
}
else
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X - 0.05f;
}
}
if (this.velocity.X > 7f)
{
this.velocity.X = 7f;
}
}
}
if (this.directionY == -1 && this.velocity.Y > -7f)
{
this.velocity.Y = this.velocity.Y - 0.2f;
if (this.velocity.Y > 4f)
{
this.velocity.Y = this.velocity.Y - 0.1f;
}
else
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y + 0.05f;
}
}
if (this.velocity.Y < -7f)
{
this.velocity.Y = -7f;
}
}
else
{
if (this.directionY == 1 && this.velocity.Y < 7f)
{
this.velocity.Y = this.velocity.Y + 0.2f;
if (this.velocity.Y < -4f)
{
this.velocity.Y = this.velocity.Y + 0.1f;
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y - 0.05f;
}
}
if (this.velocity.Y > 7f)
{
this.velocity.Y = 7f;
}
}
}
}
else
{
if (this.type == 226)
{
if (this.direction == -1 && this.velocity.X > -4f)
{
this.velocity.X = this.velocity.X - 0.2f;
if (this.velocity.X > 4f)
{
this.velocity.X = this.velocity.X - 0.1f;
}
else
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X + 0.05f;
}
}
if (this.velocity.X < -4f)
{
this.velocity.X = -4f;
}
}
else
{
if (this.direction == 1 && this.velocity.X < 4f)
{
this.velocity.X = this.velocity.X + 0.2f;
if (this.velocity.X < -4f)
{
this.velocity.X = this.velocity.X + 0.1f;
}
else
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X - 0.05f;
}
}
if (this.velocity.X > 4f)
{
this.velocity.X = 4f;
}
}
}
if (this.directionY == -1 && (double)this.velocity.Y > -2.5)
{
this.velocity.Y = this.velocity.Y - 0.1f;
if ((double)this.velocity.Y > 2.5)
{
this.velocity.Y = this.velocity.Y - 0.05f;
}
else
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y + 0.03f;
}
}
if ((double)this.velocity.Y < -2.5)
{
this.velocity.Y = -2.5f;
}
}
else
{
if (this.directionY == 1 && (double)this.velocity.Y < 2.5)
{
this.velocity.Y = this.velocity.Y + 0.1f;
if ((double)this.velocity.Y < -2.5)
{
this.velocity.Y = this.velocity.Y + 0.05f;
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y - 0.03f;
}
}
if ((double)this.velocity.Y > 2.5)
{
this.velocity.Y = 2.5f;
}
}
}
}
else
{
if (this.direction == -1 && this.velocity.X > -4f)
{
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X > 4f)
{
this.velocity.X = this.velocity.X - 0.1f;
}
else
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X + 0.05f;
}
}
if (this.velocity.X < -4f)
{
this.velocity.X = -4f;
}
}
else
{
if (this.direction == 1 && this.velocity.X < 4f)
{
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X < -4f)
{
this.velocity.X = this.velocity.X + 0.1f;
}
else
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X - 0.05f;
}
}
if (this.velocity.X > 4f)
{
this.velocity.X = 4f;
}
}
}
if (this.directionY == -1 && (double)this.velocity.Y > -1.5)
{
this.velocity.Y = this.velocity.Y - 0.04f;
if ((double)this.velocity.Y > 1.5)
{
this.velocity.Y = this.velocity.Y - 0.05f;
}
else
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y + 0.03f;
}
}
if ((double)this.velocity.Y < -1.5)
{
this.velocity.Y = -1.5f;
}
}
else
{
if (this.directionY == 1 && (double)this.velocity.Y < 1.5)
{
this.velocity.Y = this.velocity.Y + 0.04f;
if ((double)this.velocity.Y < -1.5)
{
this.velocity.Y = this.velocity.Y + 0.05f;
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y - 0.03f;
}
}
if ((double)this.velocity.Y > 1.5)
{
this.velocity.Y = 1.5f;
}
}
}
}
}
if (this.type == 49 || this.type == 51 || this.type == 60 || this.type == 62 || this.type == 66 || this.type == 93 || this.type == 137 || this.type == 150 || this.type == 151 || this.type == 152)
{
if (this.wet)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.95f;
}
this.velocity.Y = this.velocity.Y - 0.5f;
if (this.velocity.Y < -4f)
{
this.velocity.Y = -4f;
}
this.TargetClosest(true);
}
if (this.type == 60)
{
if (this.direction == -1 && this.velocity.X > -4f)
{
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X > 4f)
{
this.velocity.X = this.velocity.X - 0.07f;
}
else
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X + 0.03f;
}
}
if (this.velocity.X < -4f)
{
this.velocity.X = -4f;
}
}
else
{
if (this.direction == 1 && this.velocity.X < 4f)
{
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X < -4f)
{
this.velocity.X = this.velocity.X + 0.07f;
}
else
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X - 0.03f;
}
}
if (this.velocity.X > 4f)
{
this.velocity.X = 4f;
}
}
}
if (this.directionY == -1 && (double)this.velocity.Y > -1.5)
{
this.velocity.Y = this.velocity.Y - 0.04f;
if ((double)this.velocity.Y > 1.5)
{
this.velocity.Y = this.velocity.Y - 0.03f;
}
else
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y + 0.02f;
}
}
if ((double)this.velocity.Y < -1.5)
{
this.velocity.Y = -1.5f;
}
}
else
{
if (this.directionY == 1 && (double)this.velocity.Y < 1.5)
{
this.velocity.Y = this.velocity.Y + 0.04f;
if ((double)this.velocity.Y < -1.5)
{
this.velocity.Y = this.velocity.Y + 0.03f;
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y - 0.02f;
}
}
if ((double)this.velocity.Y > 1.5)
{
this.velocity.Y = 1.5f;
}
}
}
}
else
{
if (this.direction == -1 && this.velocity.X > -4f)
{
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X > 4f)
{
this.velocity.X = this.velocity.X - 0.1f;
}
else
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X + 0.05f;
}
}
if (this.velocity.X < -4f)
{
this.velocity.X = -4f;
}
}
else
{
if (this.direction == 1 && this.velocity.X < 4f)
{
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X < -4f)
{
this.velocity.X = this.velocity.X + 0.1f;
}
else
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X - 0.05f;
}
}
if (this.velocity.X > 4f)
{
this.velocity.X = 4f;
}
}
}
if (this.directionY == -1 && (double)this.velocity.Y > -1.5)
{
this.velocity.Y = this.velocity.Y - 0.04f;
if ((double)this.velocity.Y > 1.5)
{
this.velocity.Y = this.velocity.Y - 0.05f;
}
else
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y + 0.03f;
}
}
if ((double)this.velocity.Y < -1.5)
{
this.velocity.Y = -1.5f;
}
}
else
{
if (this.directionY == 1 && (double)this.velocity.Y < 1.5)
{
this.velocity.Y = this.velocity.Y + 0.04f;
if ((double)this.velocity.Y < -1.5)
{
this.velocity.Y = this.velocity.Y + 0.05f;
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y - 0.03f;
}
}
if ((double)this.velocity.Y > 1.5)
{
this.velocity.Y = 1.5f;
}
}
}
}
}
if (this.type == 158 && Main.netMode != 1)
{
Vector2 vector32 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num318 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector32.X;
float num319 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector32.Y;
float num320 = (float)Math.Sqrt((double)(num318 * num318 + num319 * num319));
if (num320 < 200f && this.position.Y + (float)this.height < Main.player[this.target].position.Y + (float)Main.player[this.target].height && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.Transform(159);
}
}
this.ai[1] += 1f;
if (this.type == 158)
{
this.ai[1] += 1f;
}
if (this.ai[1] > 200f)
{
if (!Main.player[this.target].wet && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.ai[1] = 0f;
}
float num321 = 0.2f;
float num322 = 0.1f;
float num323 = 4f;
float num324 = 1.5f;
if (this.type == 48 || this.type == 62 || this.type == 66)
{
num321 = 0.12f;
num322 = 0.07f;
num323 = 3f;
num324 = 1.25f;
}
if (this.ai[1] > 1000f)
{
this.ai[1] = 0f;
}
this.ai[2] += 1f;
if (this.ai[2] > 0f)
{
if (this.velocity.Y < num324)
{
this.velocity.Y = this.velocity.Y + num322;
}
}
else
{
if (this.velocity.Y > -num324)
{
this.velocity.Y = this.velocity.Y - num322;
}
}
if (this.ai[2] < -150f || this.ai[2] > 150f)
{
if (this.velocity.X < num323)
{
this.velocity.X = this.velocity.X + num321;
}
}
else
{
if (this.velocity.X > -num323)
{
this.velocity.X = this.velocity.X - num321;
}
}
if (this.ai[2] > 300f)
{
this.ai[2] = -300f;
}
}
if (Main.netMode != 1)
{
if (this.type == 48)
{
this.ai[0] += 1f;
if (this.ai[0] == 30f || this.ai[0] == 60f || this.ai[0] == 90f)
{
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
float num325 = 6f;
Vector2 vector33 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num326 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector33.X + (float)Main.rand.Next(-100, 101);
float num327 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector33.Y + (float)Main.rand.Next(-100, 101);
float num328 = (float)Math.Sqrt((double)(num326 * num326 + num327 * num327));
num328 = num325 / num328;
num326 *= num328;
num327 *= num328;
int num329 = 15;
int num330 = 38;
int num331 = Projectile.NewProjectile(vector33.X, vector33.Y, num326, num327, num330, num329, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num331].timeLeft = 300;
}
}
else
{
if (this.ai[0] >= (float)(400 + Main.rand.Next(400)))
{
this.ai[0] = 0f;
}
}
}
if (this.type == 62 || this.type == 66)
{
this.ai[0] += 1f;
if (this.ai[0] == 20f || this.ai[0] == 40f || this.ai[0] == 60f || this.ai[0] == 80f)
{
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
float num332 = 0.2f;
Vector2 vector34 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num333 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector34.X + (float)Main.rand.Next(-100, 101);
float num334 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector34.Y + (float)Main.rand.Next(-100, 101);
float num335 = (float)Math.Sqrt((double)(num333 * num333 + num334 * num334));
num335 = num332 / num335;
num333 *= num335;
num334 *= num335;
int num336 = 21;
int num337 = 44;
int num338 = Projectile.NewProjectile(vector34.X, vector34.Y, num333, num334, num337, num336, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num338].timeLeft = 300;
}
}
else
{
if (this.ai[0] >= (float)(300 + Main.rand.Next(300)))
{
this.ai[0] = 0f;
}
}
}
if (this.type == 156)
{
this.ai[0] += 1f;
if (this.ai[0] == 20f || this.ai[0] == 40f || this.ai[0] == 60f || this.ai[0] == 80f || this.ai[0] == 100f)
{
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
float num339 = 0.2f;
Vector2 value = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num340 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - value.X + (float)Main.rand.Next(-50, 51);
float num341 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - value.Y + (float)Main.rand.Next(-50, 51);
float num342 = (float)Math.Sqrt((double)(num340 * num340 + num341 * num341));
num342 = num339 / num342;
num340 *= num342;
num341 *= num342;
int num343 = 80;
int num344 = 115;
value += this.velocity * 5f;
int num345 = Projectile.NewProjectile(value.X + num340 * 100f, value.Y + num341 * 100f, num340, num341, num344, num343, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num345].timeLeft = 300;
return;
}
}
else
{
if (this.ai[0] >= (float)(250 + Main.rand.Next(250)))
{
this.ai[0] = 0f;
return;
}
}
}
}
}
else
{
if (this.aiStyle == 15)
{
this.aiAction = 0;
if (this.ai[3] == 0f && this.life > 0)
{
this.ai[3] = (float)this.lifeMax;
}
if (this.ai[2] == 0f)
{
this.ai[0] = -100f;
this.ai[2] = 1f;
this.TargetClosest(true);
}
if (this.velocity.Y == 0f)
{
this.velocity.X = this.velocity.X * 0.8f;
if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1)
{
this.velocity.X = 0f;
}
this.ai[0] += 2f;
if ((double)this.life < (double)this.lifeMax * 0.8)
{
this.ai[0] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.6)
{
this.ai[0] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.4)
{
this.ai[0] += 2f;
}
if ((double)this.life < (double)this.lifeMax * 0.2)
{
this.ai[0] += 3f;
}
if ((double)this.life < (double)this.lifeMax * 0.1)
{
this.ai[0] += 4f;
}
if (this.ai[0] >= 0f)
{
this.netUpdate = true;
this.TargetClosest(true);
if (this.ai[1] == 3f)
{
this.velocity.Y = -13f;
this.velocity.X = this.velocity.X + 3.5f * (float)this.direction;
this.ai[0] = -200f;
this.ai[1] = 0f;
}
else
{
if (this.ai[1] == 2f)
{
this.velocity.Y = -6f;
this.velocity.X = this.velocity.X + 4.5f * (float)this.direction;
this.ai[0] = -120f;
this.ai[1] += 1f;
}
else
{
this.velocity.Y = -8f;
this.velocity.X = this.velocity.X + 4f * (float)this.direction;
this.ai[0] = -120f;
this.ai[1] += 1f;
}
}
}
else
{
if (this.ai[0] >= -30f)
{
this.aiAction = 1;
}
}
}
else
{
if (this.target < 255 && ((this.direction == 1 && this.velocity.X < 3f) || (this.direction == -1 && this.velocity.X > -3f)))
{
if ((this.direction == -1 && (double)this.velocity.X < 0.1) || (this.direction == 1 && (double)this.velocity.X > -0.1))
{
this.velocity.X = this.velocity.X + 0.2f * (float)this.direction;
}
else
{
this.velocity.X = this.velocity.X * 0.93f;
}
}
}
int num346 = Dust.NewDust(this.position, this.width, this.height, 4, this.velocity.X, this.velocity.Y, 255, new Color(0, 80, 255, 80), this.scale * 1.2f);
Main.dust[num346].noGravity = true;
Main.dust[num346].velocity *= 0.5f;
if (this.life > 0)
{
float num347 = (float)this.life / (float)this.lifeMax;
num347 = num347 * 0.5f + 0.75f;
if (num347 != this.scale)
{
this.position.X = this.position.X + (float)(this.width / 2);
this.position.Y = this.position.Y + (float)this.height;
this.scale = num347;
this.width = (int)(98f * this.scale);
this.height = (int)(92f * this.scale);
this.position.X = this.position.X - (float)(this.width / 2);
this.position.Y = this.position.Y - (float)this.height;
}
if (Main.netMode != 1)
{
int num348 = (int)((double)this.lifeMax * 0.05);
if ((float)(this.life + num348) < this.ai[3])
{
this.ai[3] = (float)this.life;
int num349 = Main.rand.Next(1, 4);
for (int num350 = 0; num350 < num349; num350++)
{
int x = (int)(this.position.X + (float)Main.rand.Next(this.width - 32));
int y = (int)(this.position.Y + (float)Main.rand.Next(this.height - 32));
int num351 = NPC.NewNPC(x, y, 1, 0);
Main.npc[num351].SetDefaults(1, -1f);
Main.npc[num351].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f;
Main.npc[num351].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f;
Main.npc[num351].ai[1] = (float)Main.rand.Next(3);
if (Main.netMode == 2 && num351 < 200)
{
NetMessage.SendData(23, -1, -1, "", num351, 0f, 0f, 0f, 0);
}
}
return;
}
}
}
}
else
{
if (this.aiStyle == 16)
{
if (this.direction == 0)
{
this.TargetClosest(true);
}
if (this.wet)
{
bool flag29 = false;
if (this.type != 55)
{
this.TargetClosest(false);
if (Main.player[this.target].wet && !Main.player[this.target].dead)
{
flag29 = true;
}
}
if (!flag29)
{
if (this.collideX)
{
this.velocity.X = this.velocity.X * -1f;
this.direction *= -1;
this.netUpdate = true;
}
if (this.collideY)
{
this.netUpdate = true;
if (this.velocity.Y > 0f)
{
this.velocity.Y = Math.Abs(this.velocity.Y) * -1f;
this.directionY = -1;
this.ai[0] = -1f;
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = Math.Abs(this.velocity.Y);
this.directionY = 1;
this.ai[0] = 1f;
}
}
}
}
if (this.type == 102)
{
Lighting.addLight((int)(this.position.X + (float)(this.width / 2) + (float)(this.direction * (this.width + 8))) / 16, (int)(this.position.Y + 2f) / 16, 0.07f, 0.04f, 0.025f);
}
if (flag29)
{
this.TargetClosest(true);
if (this.type == 157)
{
if (this.velocity.X > 0f && this.direction < 0)
{
this.velocity.X = this.velocity.X * 0.95f;
}
if (this.velocity.X < 0f && this.direction > 0)
{
this.velocity.X = this.velocity.X * 0.95f;
}
this.velocity.X = this.velocity.X + (float)this.direction * 0.25f;
this.velocity.Y = this.velocity.Y + (float)this.directionY * 0.2f;
if (this.velocity.X > 8f)
{
this.velocity.X = 7f;
}
if (this.velocity.X < -8f)
{
this.velocity.X = -7f;
}
if (this.velocity.Y > 5f)
{
this.velocity.Y = 4f;
}
if (this.velocity.Y < -5f)
{
this.velocity.Y = -4f;
}
}
else
{
if (this.type == 65 || this.type == 102)
{
this.velocity.X = this.velocity.X + (float)this.direction * 0.15f;
this.velocity.Y = this.velocity.Y + (float)this.directionY * 0.15f;
if (this.velocity.X > 5f)
{
this.velocity.X = 5f;
}
if (this.velocity.X < -5f)
{
this.velocity.X = -5f;
}
if (this.velocity.Y > 3f)
{
this.velocity.Y = 3f;
}
if (this.velocity.Y < -3f)
{
this.velocity.Y = -3f;
}
}
else
{
this.velocity.X = this.velocity.X + (float)this.direction * 0.1f;
this.velocity.Y = this.velocity.Y + (float)this.directionY * 0.1f;
if (this.velocity.X > 3f)
{
this.velocity.X = 3f;
}
if (this.velocity.X < -3f)
{
this.velocity.X = -3f;
}
if (this.velocity.Y > 2f)
{
this.velocity.Y = 2f;
}
if (this.velocity.Y < -2f)
{
this.velocity.Y = -2f;
}
}
}
}
else
{
if (this.type == 157)
{
if (Main.player[this.target].position.Y > this.position.Y)
{
this.directionY = 1;
}
else
{
this.directionY = -1;
}
this.velocity.X = this.velocity.X + (float)this.direction * 0.2f;
if (this.velocity.X < -2f || this.velocity.X > 2f)
{
this.velocity.X = this.velocity.X * 0.95f;
}
if (this.ai[0] == -1f)
{
float num352 = -0.6f;
if (this.directionY < 0)
{
num352 = -1f;
}
if (this.directionY > 0)
{
num352 = -0.2f;
}
this.velocity.Y = this.velocity.Y - 0.02f;
if (this.velocity.Y < num352)
{
this.ai[0] = 1f;
}
}
else
{
float num353 = 0.6f;
if (this.directionY < 0)
{
num353 = 0.2f;
}
if (this.directionY > 0)
{
num353 = 1f;
}
this.velocity.Y = this.velocity.Y + 0.02f;
if (this.velocity.Y > num353)
{
this.ai[0] = -1f;
}
}
}
else
{
this.velocity.X = this.velocity.X + (float)this.direction * 0.1f;
if (this.velocity.X < -1f || this.velocity.X > 1f)
{
this.velocity.X = this.velocity.X * 0.95f;
}
if (this.ai[0] == -1f)
{
this.velocity.Y = this.velocity.Y - 0.01f;
if ((double)this.velocity.Y < -0.3)
{
this.ai[0] = 1f;
}
}
else
{
this.velocity.Y = this.velocity.Y + 0.01f;
if ((double)this.velocity.Y > 0.3)
{
this.ai[0] = -1f;
}
}
}
int num354 = (int)(this.position.X + (float)(this.width / 2)) / 16;
int num355 = (int)(this.position.Y + (float)(this.height / 2)) / 16;
if (Main.tile[num354, num355 - 1] == null)
{
Main.tile[num354, num355 - 1] = new Tile();
}
if (Main.tile[num354, num355 + 1] == null)
{
Main.tile[num354, num355 + 1] = new Tile();
}
if (Main.tile[num354, num355 + 2] == null)
{
Main.tile[num354, num355 + 2] = new Tile();
}
if (Main.tile[num354, num355 - 1].liquid > 128)
{
if (Main.tile[num354, num355 + 1].active())
{
this.ai[0] = -1f;
}
else
{
if (Main.tile[num354, num355 + 2].active())
{
this.ai[0] = -1f;
}
}
}
if (this.type != 157 && ((double)this.velocity.Y > 0.4 || (double)this.velocity.Y < -0.4))
{
this.velocity.Y = this.velocity.Y * 0.95f;
}
}
}
else
{
if (this.velocity.Y == 0f)
{
if (this.type == 65)
{
this.velocity.X = this.velocity.X * 0.94f;
if ((double)this.velocity.X > -0.2 && (double)this.velocity.X < 0.2)
{
this.velocity.X = 0f;
}
}
else
{
if (Main.netMode != 1)
{
this.velocity.Y = (float)Main.rand.Next(-50, -20) * 0.1f;
this.velocity.X = (float)Main.rand.Next(-20, 20) * 0.1f;
this.netUpdate = true;
}
}
}
this.velocity.Y = this.velocity.Y + 0.3f;
if (this.velocity.Y > 10f)
{
this.velocity.Y = 10f;
}
this.ai[0] = 1f;
}
this.rotation = this.velocity.Y * (float)this.direction * 0.1f;
if ((double)this.rotation < -0.2)
{
this.rotation = -0.2f;
}
if ((double)this.rotation > 0.2)
{
this.rotation = 0.2f;
return;
}
}
else
{
if (this.aiStyle == 17)
{
this.noGravity = true;
if (this.ai[0] == 0f)
{
this.noGravity = false;
this.TargetClosest(true);
if (Main.netMode != 1)
{
if (this.velocity.X != 0f || this.velocity.Y < 0f || (double)this.velocity.Y > 0.3)
{
this.ai[0] = 1f;
this.netUpdate = true;
}
else
{
Rectangle rectangle5 = new Rectangle((int)Main.player[this.target].position.X, (int)Main.player[this.target].position.Y, Main.player[this.target].width, Main.player[this.target].height);
Rectangle rectangle6 = new Rectangle((int)this.position.X - 100, (int)this.position.Y - 100, this.width + 200, this.height + 200);
if (rectangle6.Intersects(rectangle5) || this.life < this.lifeMax)
{
this.ai[0] = 1f;
this.velocity.Y = this.velocity.Y - 6f;
this.netUpdate = true;
}
}
}
}
else
{
if (!Main.player[this.target].dead)
{
if (this.collideX)
{
this.velocity.X = this.oldVelocity.X * -0.5f;
if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f)
{
this.velocity.X = 2f;
}
if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f)
{
this.velocity.X = -2f;
}
}
if (this.collideY)
{
this.velocity.Y = this.oldVelocity.Y * -0.5f;
if (this.velocity.Y > 0f && this.velocity.Y < 1f)
{
this.velocity.Y = 1f;
}
if (this.velocity.Y < 0f && this.velocity.Y > -1f)
{
this.velocity.Y = -1f;
}
}
this.TargetClosest(true);
if (this.direction == -1 && this.velocity.X > -3f)
{
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X > 3f)
{
this.velocity.X = this.velocity.X - 0.1f;
}
else
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X - 0.05f;
}
}
if (this.velocity.X < -3f)
{
this.velocity.X = -3f;
}
}
else
{
if (this.direction == 1 && this.velocity.X < 3f)
{
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X < -3f)
{
this.velocity.X = this.velocity.X + 0.1f;
}
else
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X + 0.05f;
}
}
if (this.velocity.X > 3f)
{
this.velocity.X = 3f;
}
}
}
float num356 = Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)));
float num357 = Main.player[this.target].position.Y - (float)(this.height / 2);
if (num356 > 50f)
{
num357 -= 100f;
}
if (this.position.Y < num357)
{
this.velocity.Y = this.velocity.Y + 0.05f;
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y + 0.01f;
}
}
else
{
this.velocity.Y = this.velocity.Y - 0.05f;
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y - 0.01f;
}
}
if (this.velocity.Y < -3f)
{
this.velocity.Y = -3f;
}
if (this.velocity.Y > 3f)
{
this.velocity.Y = 3f;
}
}
}
if (this.wet)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.95f;
}
this.velocity.Y = this.velocity.Y - 0.5f;
if (this.velocity.Y < -4f)
{
this.velocity.Y = -4f;
}
this.TargetClosest(true);
return;
}
}
else
{
if (this.aiStyle == 18)
{
if (this.type == 63)
{
Lighting.addLight((int)(this.position.X + (float)(this.height / 2)) / 16, (int)(this.position.Y + (float)(this.height / 2)) / 16, 0.05f, 0.15f, 0.4f);
}
else
{
if (this.type == 103)
{
Lighting.addLight((int)(this.position.X + (float)(this.height / 2)) / 16, (int)(this.position.Y + (float)(this.height / 2)) / 16, 0.05f, 0.45f, 0.1f);
}
else
{
if (this.type != 221 && this.type != 242)
{
Lighting.addLight((int)(this.position.X + (float)(this.height / 2)) / 16, (int)(this.position.Y + (float)(this.height / 2)) / 16, 0.35f, 0.05f, 0.2f);
}
}
}
if (this.direction == 0)
{
this.TargetClosest(true);
}
if (!this.wet)
{
this.rotation += this.velocity.X * 0.1f;
if (this.velocity.Y == 0f)
{
this.velocity.X = this.velocity.X * 0.98f;
if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01)
{
this.velocity.X = 0f;
}
}
this.velocity.Y = this.velocity.Y + 0.2f;
if (this.velocity.Y > 10f)
{
this.velocity.Y = 10f;
}
this.ai[0] = 1f;
return;
}
if (this.collideX)
{
this.velocity.X = this.velocity.X * -1f;
this.direction *= -1;
}
if (this.collideY)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = Math.Abs(this.velocity.Y) * -1f;
this.directionY = -1;
this.ai[0] = -1f;
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = Math.Abs(this.velocity.Y);
this.directionY = 1;
this.ai[0] = 1f;
}
}
}
bool flag30 = false;
if (!this.friendly)
{
this.TargetClosest(false);
if (Main.player[this.target].wet && !Main.player[this.target].dead)
{
flag30 = true;
}
}
if (flag30)
{
this.localAI[2] = 1f;
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
this.velocity *= 0.98f;
float num358 = 0.2f;
if (this.type == 103)
{
this.velocity *= 0.98f;
num358 = 0.6f;
}
if (this.type == 221)
{
this.velocity *= 0.99f;
num358 = 1f;
}
if (this.type == 242)
{
this.velocity *= 0.995f;
num358 = 3f;
}
if (this.velocity.X > -num358 && this.velocity.X < num358 && this.velocity.Y > -num358 && this.velocity.Y < num358)
{
if (this.type == 221)
{
this.localAI[0] = 1f;
}
this.TargetClosest(true);
float num359 = 7f;
if (this.type == 103)
{
num359 = 9f;
}
Vector2 vector35 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num360 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector35.X;
float num361 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector35.Y;
float num362 = (float)Math.Sqrt((double)(num360 * num360 + num361 * num361));
num362 = num359 / num362;
num360 *= num362;
num361 *= num362;
this.velocity.X = num360;
this.velocity.Y = num361;
return;
}
}
else
{
this.localAI[2] = 0f;
this.velocity.X = this.velocity.X + (float)this.direction * 0.02f;
this.rotation = this.velocity.X * 0.4f;
if (this.velocity.X < -1f || this.velocity.X > 1f)
{
this.velocity.X = this.velocity.X * 0.95f;
}
if (this.ai[0] == -1f)
{
this.velocity.Y = this.velocity.Y - 0.01f;
if (this.velocity.Y < -1f)
{
this.ai[0] = 1f;
}
}
else
{
this.velocity.Y = this.velocity.Y + 0.01f;
if (this.velocity.Y > 1f)
{
this.ai[0] = -1f;
}
}
int num363 = (int)(this.position.X + (float)(this.width / 2)) / 16;
int num364 = (int)(this.position.Y + (float)(this.height / 2)) / 16;
if (Main.tile[num363, num364 - 1] == null)
{
Main.tile[num363, num364 - 1] = new Tile();
}
if (Main.tile[num363, num364 + 1] == null)
{
Main.tile[num363, num364 + 1] = new Tile();
}
if (Main.tile[num363, num364 + 2] == null)
{
Main.tile[num363, num364 + 2] = new Tile();
}
if (Main.tile[num363, num364 - 1].liquid > 128)
{
if (Main.tile[num363, num364 + 1].active())
{
this.ai[0] = -1f;
}
else
{
if (Main.tile[num363, num364 + 2].active())
{
this.ai[0] = -1f;
}
}
}
else
{
this.ai[0] = 1f;
}
if ((double)this.velocity.Y > 1.2 || (double)this.velocity.Y < -1.2)
{
this.velocity.Y = this.velocity.Y * 0.99f;
return;
}
}
}
else
{
if (this.aiStyle == 19)
{
this.TargetClosest(true);
float num365 = 12f;
Vector2 vector36 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num366 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector36.X;
float num367 = Main.player[this.target].position.Y - vector36.Y;
float num368 = (float)Math.Sqrt((double)(num366 * num366 + num367 * num367));
num368 = num365 / num368;
num366 *= num368;
num367 *= num368;
bool flag31 = false;
if (this.directionY < 0)
{
this.rotation = (float)(Math.Atan2((double)num367, (double)num366) + 1.57);
flag31 = ((double)this.rotation >= -1.2 && (double)this.rotation <= 1.2);
if ((double)this.rotation < -0.8)
{
this.rotation = -0.8f;
}
else
{
if ((double)this.rotation > 0.8)
{
this.rotation = 0.8f;
}
}
if (this.velocity.X != 0f)
{
this.velocity.X = this.velocity.X * 0.9f;
if ((double)this.velocity.X > -0.1 || (double)this.velocity.X < 0.1)
{
this.netUpdate = true;
this.velocity.X = 0f;
}
}
}
if (this.ai[0] > 0f)
{
if (this.ai[0] == 200f)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 5);
}
this.ai[0] -= 1f;
}
if (Main.netMode != 1 && flag31 && this.ai[0] == 0f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.ai[0] = 200f;
int num369 = 10;
int num370 = 31;
int num371 = Projectile.NewProjectile(vector36.X, vector36.Y, num366, num367, num370, num369, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num371].ai[0] = 2f;
Main.projectile[num371].timeLeft = 300;
Main.projectile[num371].friendly = false;
NetMessage.SendData(27, -1, -1, "", num371, 0f, 0f, 0f, 0);
this.netUpdate = true;
}
try
{
int num372 = (int)this.position.X / 16;
int num373 = (int)(this.position.X + (float)(this.width / 2)) / 16;
int num374 = (int)(this.position.X + (float)this.width) / 16;
int num375 = (int)(this.position.Y + (float)this.height) / 16;
bool flag32 = false;
if (Main.tile[num372, num375] == null)
{
Main.tile[num372, num375] = new Tile();
}
if (Main.tile[num373, num375] == null)
{
Main.tile[num372, num375] = new Tile();
}
if (Main.tile[num374, num375] == null)
{
Main.tile[num372, num375] = new Tile();
}
if ((Main.tile[num372, num375].nactive() && Main.tileSolid[(int)Main.tile[num372, num375].type]) || (Main.tile[num373, num375].nactive() && Main.tileSolid[(int)Main.tile[num373, num375].type]) || (Main.tile[num374, num375].nactive() && Main.tileSolid[(int)Main.tile[num374, num375].type]))
{
flag32 = true;
}
if (flag32)
{
this.noGravity = true;
this.noTileCollide = true;
this.velocity.Y = -0.2f;
}
else
{
this.noGravity = false;
this.noTileCollide = false;
if (Main.rand.Next(2) == 0)
{
int num376 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float)this.height - 8f), this.width + 8, 24, 32, 0f, this.velocity.Y / 2f, 0, default(Color), 1f);
Dust expr_17B8A_cp_0 = Main.dust[num376];
expr_17B8A_cp_0.velocity.X = expr_17B8A_cp_0.velocity.X * 0.4f;
Dust expr_17BAA_cp_0 = Main.dust[num376];
expr_17BAA_cp_0.velocity.Y = expr_17BAA_cp_0.velocity.Y * -1f;
if (Main.rand.Next(2) == 0)
{
Main.dust[num376].noGravity = true;
Main.dust[num376].scale += 0.2f;
}
}
}
return;
}
catch
{
return;
}
}
if (this.aiStyle == 20)
{
if (this.ai[0] == 0f)
{
if (Main.netMode != 1)
{
this.TargetClosest(true);
this.direction *= -1;
this.directionY *= -1;
this.position.Y = this.position.Y + (float)(this.height / 2 + 8);
this.ai[1] = this.position.X + (float)(this.width / 2);
this.ai[2] = this.position.Y + (float)(this.height / 2);
if (this.direction == 0)
{
this.direction = 1;
}
if (this.directionY == 0)
{
this.directionY = 1;
}
this.ai[3] = 1f + (float)Main.rand.Next(15) * 0.1f;
this.velocity.Y = (float)(this.directionY * 6) * this.ai[3];
this.ai[0] += 1f;
this.netUpdate = true;
return;
}
this.ai[1] = this.position.X + (float)(this.width / 2);
this.ai[2] = this.position.Y + (float)(this.height / 2);
return;
}
else
{
float num377 = 6f * this.ai[3];
float num378 = 0.2f * this.ai[3];
float num379 = num377 / num378 / 2f;
if (this.ai[0] >= 1f && this.ai[0] < (float)((int)num379))
{
this.velocity.Y = (float)this.directionY * num377;
this.ai[0] += 1f;
return;
}
if (this.ai[0] >= (float)((int)num379))
{
this.velocity.Y = 0f;
this.directionY *= -1;
this.velocity.X = num377 * (float)this.direction;
this.ai[0] = -1f;
return;
}
if (this.directionY > 0)
{
if (this.velocity.Y >= num377)
{
this.directionY *= -1;
this.velocity.Y = num377;
}
}
else
{
if (this.directionY < 0 && this.velocity.Y <= -num377)
{
this.directionY *= -1;
this.velocity.Y = -num377;
}
}
if (this.direction > 0)
{
if (this.velocity.X >= num377)
{
this.direction *= -1;
this.velocity.X = num377;
}
}
else
{
if (this.direction < 0 && this.velocity.X <= -num377)
{
this.direction *= -1;
this.velocity.X = -num377;
}
}
this.velocity.X = this.velocity.X + num378 * (float)this.direction;
this.velocity.Y = this.velocity.Y + num378 * (float)this.directionY;
return;
}
}
else
{
if (this.aiStyle == 21)
{
if (this.ai[0] == 0f)
{
this.TargetClosest(true);
this.directionY = 1;
this.ai[0] = 1f;
}
int num380 = 6;
if (this.ai[1] == 0f)
{
this.rotation += (float)(this.direction * this.directionY) * 0.13f;
if (this.collideY)
{
this.ai[0] = 2f;
}
if (!this.collideY && this.ai[0] == 2f)
{
this.direction = -this.direction;
this.ai[1] = 1f;
this.ai[0] = 1f;
}
if (this.collideX)
{
this.directionY = -this.directionY;
this.ai[1] = 1f;
}
}
else
{
this.rotation -= (float)(this.direction * this.directionY) * 0.13f;
if (this.collideX)
{
this.ai[0] = 2f;
}
if (!this.collideX && this.ai[0] == 2f)
{
this.directionY = -this.directionY;
this.ai[1] = 0f;
this.ai[0] = 1f;
}
if (this.collideY)
{
this.direction = -this.direction;
this.ai[1] = 0f;
}
}
this.velocity.X = (float)(num380 * this.direction);
this.velocity.Y = (float)(num380 * this.directionY);
float num381 = (float)(270 - (int)Main.mouseTextColor) / 400f;
Lighting.addLight((int)(this.position.X + (float)(this.width / 2)) / 16, (int)(this.position.Y + (float)(this.height / 2)) / 16, 0.9f, 0.3f + num381, 0.2f);
return;
}
if (this.aiStyle == 22)
{
bool flag33 = false;
if (this.justHit)
{
this.ai[2] = 0f;
}
if (this.ai[2] >= 0f)
{
int num382 = 16;
bool flag34 = false;
bool flag35 = false;
if (this.position.X > this.ai[0] - (float)num382 && this.position.X < this.ai[0] + (float)num382)
{
flag34 = true;
}
else
{
if ((this.velocity.X < 0f && this.direction > 0) || (this.velocity.X > 0f && this.direction < 0))
{
flag34 = true;
}
}
num382 += 24;
if (this.position.Y > this.ai[1] - (float)num382 && this.position.Y < this.ai[1] + (float)num382)
{
flag35 = true;
}
if (flag34 && flag35)
{
this.ai[2] += 1f;
if (this.ai[2] >= 30f && num382 == 16)
{
flag33 = true;
}
if (this.ai[2] >= 60f)
{
this.ai[2] = -200f;
this.direction *= -1;
this.velocity.X = this.velocity.X * -1f;
this.collideX = false;
}
}
else
{
this.ai[0] = this.position.X;
this.ai[1] = this.position.Y;
this.ai[2] = 0f;
}
this.TargetClosest(true);
}
else
{
if (this.type == 253)
{
this.TargetClosest(true);
this.ai[2] += 2f;
}
else
{
this.ai[2] += 1f;
if (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) > this.position.X + (float)(this.width / 2))
{
this.direction = -1;
}
else
{
this.direction = 1;
}
}
}
int num383 = (int)((this.position.X + (float)(this.width / 2)) / 16f) + this.direction * 2;
int num384 = (int)((this.position.Y + (float)this.height) / 16f);
bool flag36 = true;
bool flag37 = false;
int num385 = 3;
if (this.type == 122)
{
if (this.justHit)
{
this.ai[3] = 0f;
this.localAI[1] = 0f;
}
float num386 = 7f;
Vector2 vector37 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num387 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector37.X;
float num388 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector37.Y;
float num389 = (float)Math.Sqrt((double)(num387 * num387 + num388 * num388));
num389 = num386 / num389;
num387 *= num389;
num388 *= num389;
if (Main.netMode != 1 && this.ai[3] == 32f)
{
int num390 = 25;
int num391 = 84;
Projectile.NewProjectile(vector37.X, vector37.Y, num387, num388, num391, num390, 0f, Main.myPlayer, 0f, 0f);
}
num385 = 8;
if (this.ai[3] > 0f)
{
this.ai[3] += 1f;
if (this.ai[3] >= 64f)
{
this.ai[3] = 0f;
}
}
if (Main.netMode != 1 && this.ai[3] == 0f)
{
this.localAI[1] += 1f;
if (this.localAI[1] > 120f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.localAI[1] = 0f;
this.ai[3] = 1f;
this.netUpdate = true;
}
}
}
else
{
if (this.type == 75)
{
num385 = 4;
if (Main.rand.Next(6) == 0)
{
int num392 = Dust.NewDust(this.position, this.width, this.height, 55, 0f, 0f, 200, this.color, 1f);
Main.dust[num392].velocity *= 0.3f;
}
if (Main.rand.Next(40) == 0)
{
Main.PlaySound(27, (int)this.position.X, (int)this.position.Y, 1);
}
}
else
{
if (this.type == 169)
{
Lighting.addLight((int)((this.position.X + (float)(this.width / 2)) / 16f), (int)((this.position.Y + (float)(this.height / 2)) / 16f), 0f, 0.6f, 0.75f);
this.alpha = 30;
if (Main.rand.Next(3) == 0)
{
int num393 = Dust.NewDust(this.position, this.width, this.height, 92, 0f, 0f, 200, default(Color), 1f);
Main.dust[num393].velocity *= 0.3f;
Main.dust[num393].noGravity = true;
}
if (this.justHit)
{
this.ai[3] = 0f;
this.localAI[1] = 0f;
}
float num394 = 5f;
Vector2 vector38 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num395 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector38.X;
float num396 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector38.Y;
float num397 = (float)Math.Sqrt((double)(num395 * num395 + num396 * num396));
num397 = num394 / num397;
num395 *= num397;
num396 *= num397;
if (num395 > 0f)
{
this.direction = 1;
}
else
{
this.direction = -1;
}
this.spriteDirection = this.direction;
if (this.direction < 0)
{
this.rotation = (float)Math.Atan2((double)(-(double)num396), (double)(-(double)num395));
}
else
{
this.rotation = (float)Math.Atan2((double)num396, (double)num395);
}
if (Main.netMode != 1 && this.ai[3] == 16f)
{
int num398 = 45;
int num399 = 128;
Projectile.NewProjectile(vector38.X, vector38.Y, num395, num396, num399, num398, 0f, Main.myPlayer, 0f, 0f);
}
num385 = 10;
if (this.ai[3] > 0f)
{
this.ai[3] += 1f;
if (this.ai[3] >= 64f)
{
this.ai[3] = 0f;
}
}
if (Main.netMode != 1 && this.ai[3] == 0f)
{
this.localAI[1] += 1f;
if (this.localAI[1] > 120f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.localAI[1] = 0f;
this.ai[3] = 1f;
this.netUpdate = true;
}
}
}
else
{
if (this.type == 268)
{
this.rotation = this.velocity.X * 0.1f;
if (Main.player[this.target].center().Y < this.center().Y)
{
num385 = 12;
}
else
{
num385 = 6;
}
if (Main.netMode != 1 && !this.confused)
{
this.ai[3] += 1f;
if (this.justHit)
{
this.ai[3] = -45f;
this.localAI[1] = 0f;
}
if (Main.netMode != 1 && this.ai[3] >= (float)(60 + Main.rand.Next(60)))
{
this.ai[3] = 0f;
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].head))
{
float num400 = 10f;
Vector2 vector39 = new Vector2(this.position.X + (float)this.width * 0.5f - 4f, this.position.Y + (float)this.height * 0.7f);
float num401 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector39.X;
float num402 = Math.Abs(num401) * 0.1f;
float num403 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector39.Y - num402;
num401 += (float)Main.rand.Next(-10, 11);
num403 += (float)Main.rand.Next(-30, 21);
float num404 = (float)Math.Sqrt((double)(num401 * num401 + num403 * num403));
num404 = num400 / num404;
num401 *= num404;
num403 *= num404;
int num405 = 40;
int num406 = 288;
Projectile.NewProjectile(vector39.X, vector39.Y, num401, num403, num406, num405, 0f, Main.myPlayer, 0f, 0f);
}
}
}
}
}
}
}
for (int num407 = num384; num407 < num384 + num385; num407++)
{
if (Main.tile[num383, num407] == null)
{
Main.tile[num383, num407] = new Tile();
}
if ((Main.tile[num383, num407].nactive() && Main.tileSolid[(int)Main.tile[num383, num407].type]) || Main.tile[num383, num407].liquid > 0)
{
if (num407 <= num384 + 1)
{
flag37 = true;
}
flag36 = false;
break;
}
}
if (this.type == 169 || this.type == 268)
{
for (int num408 = num384 - 3; num408 < num384; num408++)
{
if (Main.tile[num383, num408] == null)
{
Main.tile[num383, num408] = new Tile();
}
if ((Main.tile[num383, num408].nactive() && Main.tileSolid[(int)Main.tile[num383, num408].type]) || Main.tile[num383, num408].liquid > 0)
{
flag37 = false;
flag33 = true;
break;
}
}
}
if (flag33)
{
flag37 = false;
flag36 = true;
if (this.type == 268)
{
this.velocity.Y = this.velocity.Y + 2f;
}
}
if (flag36)
{
if (this.type == 75 || this.type == 169)
{
this.velocity.Y = this.velocity.Y + 0.2f;
if (this.velocity.Y > 2f)
{
this.velocity.Y = 2f;
}
}
else
{
this.velocity.Y = this.velocity.Y + 0.1f;
if (this.velocity.Y > 3f)
{
this.velocity.Y = 3f;
}
}
}
else
{
if (this.type == 75 || this.type == 169)
{
if ((this.directionY < 0 && this.velocity.Y > 0f) || flag37)
{
this.velocity.Y = this.velocity.Y - 0.2f;
}
}
else
{
if (this.directionY < 0 && this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y - 0.1f;
}
}
if (this.velocity.Y < -4f)
{
this.velocity.Y = -4f;
}
}
if (this.type == 75 && this.wet)
{
this.velocity.Y = this.velocity.Y - 0.2f;
if (this.velocity.Y < -2f)
{
this.velocity.Y = -2f;
}
}
if (this.collideX)
{
this.velocity.X = this.oldVelocity.X * -0.4f;
if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 1f)
{
this.velocity.X = 1f;
}
if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -1f)
{
this.velocity.X = -1f;
}
}
if (this.collideY)
{
this.velocity.Y = this.oldVelocity.Y * -0.25f;
if (this.velocity.Y > 0f && this.velocity.Y < 1f)
{
this.velocity.Y = 1f;
}
if (this.velocity.Y < 0f && this.velocity.Y > -1f)
{
this.velocity.Y = -1f;
}
}
float num409 = 2f;
if (this.type == 75)
{
num409 = 3f;
}
if (this.type == 253)
{
num409 = 4f;
}
if (this.direction == -1 && this.velocity.X > -num409)
{
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X > num409)
{
this.velocity.X = this.velocity.X - 0.1f;
}
else
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X + 0.05f;
}
}
if (this.velocity.X < -num409)
{
this.velocity.X = -num409;
}
}
else
{
if (this.direction == 1 && this.velocity.X < num409)
{
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X < -num409)
{
this.velocity.X = this.velocity.X + 0.1f;
}
else
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X - 0.05f;
}
}
if (this.velocity.X > num409)
{
this.velocity.X = num409;
}
}
}
if (this.directionY == -1 && (double)this.velocity.Y > -1.5)
{
this.velocity.Y = this.velocity.Y - 0.04f;
if ((double)this.velocity.Y > 1.5)
{
this.velocity.Y = this.velocity.Y - 0.05f;
}
else
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y + 0.03f;
}
}
if ((double)this.velocity.Y < -1.5)
{
this.velocity.Y = -1.5f;
}
}
else
{
if (this.directionY == 1 && (double)this.velocity.Y < 1.5)
{
this.velocity.Y = this.velocity.Y + 0.04f;
if ((double)this.velocity.Y < -1.5)
{
this.velocity.Y = this.velocity.Y + 0.05f;
}
else
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y - 0.03f;
}
}
if ((double)this.velocity.Y > 1.5)
{
this.velocity.Y = 1.5f;
}
}
}
if (this.type == 122)
{
Lighting.addLight((int)this.position.X / 16, (int)this.position.Y / 16, 0.4f, 0f, 0.25f);
return;
}
}
else
{
if (this.aiStyle == 23)
{
this.noGravity = true;
this.noTileCollide = true;
if (this.type == 83)
{
Lighting.addLight((int)((this.position.X + (float)(this.width / 2)) / 16f), (int)((this.position.Y + (float)(this.height / 2)) / 16f), 0.2f, 0.05f, 0.3f);
}
else
{
if (this.type == 179)
{
Lighting.addLight((int)((this.position.X + (float)(this.width / 2)) / 16f), (int)((this.position.Y + (float)(this.height / 2)) / 16f), 0.3f, 0.15f, 0.05f);
}
else
{
Lighting.addLight((int)((this.position.X + (float)(this.width / 2)) / 16f), (int)((this.position.Y + (float)(this.height / 2)) / 16f), 0.05f, 0.2f, 0.3f);
}
}
if (this.target < 0 || this.target == 255 || Main.player[this.target].dead)
{
this.TargetClosest(true);
}
if (this.ai[0] == 0f)
{
float num410 = 9f;
Vector2 vector40 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num411 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector40.X;
float num412 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector40.Y;
float num413 = (float)Math.Sqrt((double)(num411 * num411 + num412 * num412));
num413 = num410 / num413;
num411 *= num413;
num412 *= num413;
this.velocity.X = num411;
this.velocity.Y = num412;
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 0.785f;
this.ai[0] = 1f;
this.ai[1] = 0f;
return;
}
if (this.ai[0] == 1f)
{
if (this.justHit)
{
this.ai[0] = 2f;
this.ai[1] = 0f;
}
this.velocity *= 0.99f;
this.ai[1] += 1f;
if (this.ai[1] >= 100f)
{
this.ai[0] = 2f;
this.ai[1] = 0f;
this.velocity.X = 0f;
this.velocity.Y = 0f;
return;
}
}
else
{
if (this.justHit)
{
this.ai[0] = 2f;
this.ai[1] = 0f;
}
this.velocity *= 0.96f;
this.ai[1] += 1f;
float num414 = this.ai[1] / 120f;
num414 = 0.1f + num414 * 0.4f;
this.rotation += num414 * (float)this.direction;
if (this.ai[1] >= 120f)
{
this.netUpdate = true;
this.ai[0] = 0f;
this.ai[1] = 0f;
return;
}
}
}
else
{
if (this.aiStyle == 24)
{
this.noGravity = true;
if (this.ai[0] == 0f)
{
this.noGravity = false;
this.TargetClosest(true);
if (Main.netMode != 1)
{
if (this.velocity.X != 0f || this.velocity.Y < 0f || (double)this.velocity.Y > 0.3)
{
this.ai[0] = 1f;
this.netUpdate = true;
this.direction = -this.direction;
}
else
{
Rectangle rectangle7 = new Rectangle((int)Main.player[this.target].position.X, (int)Main.player[this.target].position.Y, Main.player[this.target].width, Main.player[this.target].height);
Rectangle rectangle8 = new Rectangle((int)this.position.X - 100, (int)this.position.Y - 100, this.width + 200, this.height + 200);
if (rectangle8.Intersects(rectangle7) || this.life < this.lifeMax)
{
this.ai[0] = 1f;
this.velocity.Y = this.velocity.Y - 6f;
this.netUpdate = true;
this.direction = -this.direction;
}
}
}
}
else
{
if (!Main.player[this.target].dead)
{
if (this.collideX)
{
this.direction *= -1;
this.velocity.X = this.oldVelocity.X * -0.5f;
if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f)
{
this.velocity.X = 2f;
}
if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f)
{
this.velocity.X = -2f;
}
}
if (this.collideY)
{
this.velocity.Y = this.oldVelocity.Y * -0.5f;
if (this.velocity.Y > 0f && this.velocity.Y < 1f)
{
this.velocity.Y = 1f;
}
if (this.velocity.Y < 0f && this.velocity.Y > -1f)
{
this.velocity.Y = -1f;
}
}
if (this.direction == -1 && this.velocity.X > -3f)
{
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X > 3f)
{
this.velocity.X = this.velocity.X - 0.1f;
}
else
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X - 0.05f;
}
}
if (this.velocity.X < -3f)
{
this.velocity.X = -3f;
}
}
else
{
if (this.direction == 1 && this.velocity.X < 3f)
{
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X < -3f)
{
this.velocity.X = this.velocity.X + 0.1f;
}
else
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X + 0.05f;
}
}
if (this.velocity.X > 3f)
{
this.velocity.X = 3f;
}
}
}
int num415 = (int)((this.position.X + (float)(this.width / 2)) / 16f) + this.direction;
int num416 = (int)((this.position.Y + (float)this.height) / 16f);
bool flag38 = true;
int num417 = 15;
bool flag39 = false;
for (int num418 = num416; num418 < num416 + num417; num418++)
{
if (Main.tile[num415, num418] == null)
{
Main.tile[num415, num418] = new Tile();
}
if ((Main.tile[num415, num418].nactive() && Main.tileSolid[(int)Main.tile[num415, num418].type]) || Main.tile[num415, num418].liquid > 0)
{
if (num418 < num416 + 5)
{
flag39 = true;
}
flag38 = false;
break;
}
}
if (flag38)
{
this.velocity.Y = this.velocity.Y + 0.1f;
}
else
{
this.velocity.Y = this.velocity.Y - 0.1f;
}
if (flag39)
{
this.velocity.Y = this.velocity.Y - 0.2f;
}
if (this.velocity.Y > 3f)
{
this.velocity.Y = 3f;
}
if (this.velocity.Y < -4f)
{
this.velocity.Y = -4f;
}
}
}
if (this.wet)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.95f;
}
this.velocity.Y = this.velocity.Y - 0.5f;
if (this.velocity.Y < -4f)
{
this.velocity.Y = -4f;
}
this.TargetClosest(true);
return;
}
}
else
{
if (this.aiStyle == 25)
{
if (this.ai[3] == 0f)
{
this.position.X = this.position.X + 8f;
if (this.position.Y / 16f > (float)(Main.maxTilesY - 200))
{
this.ai[3] = 3f;
}
else
{
if ((double)(this.position.Y / 16f) > Main.worldSurface)
{
this.TargetClosest(true);
if (Main.player[this.target].zoneSnow)
{
this.ai[3] = 4f;
}
else
{
this.ai[3] = 2f;
}
}
else
{
this.ai[3] = 1f;
}
}
}
if (this.ai[0] == 0f)
{
this.TargetClosest(true);
if (Main.netMode != 1)
{
if (this.velocity.X != 0f || this.velocity.Y < 0f || (double)this.velocity.Y > 0.3)
{
this.ai[0] = 1f;
this.netUpdate = true;
return;
}
Rectangle rectangle9 = new Rectangle((int)Main.player[this.target].position.X, (int)Main.player[this.target].position.Y, Main.player[this.target].width, Main.player[this.target].height);
Rectangle rectangle10 = new Rectangle((int)this.position.X - 100, (int)this.position.Y - 100, this.width + 200, this.height + 200);
if (rectangle10.Intersects(rectangle9) || this.life < this.lifeMax)
{
this.ai[0] = 1f;
this.netUpdate = true;
return;
}
}
}
else
{
if (this.velocity.Y == 0f)
{
this.ai[2] += 1f;
int num419 = 20;
if (this.ai[1] == 0f)
{
num419 = 12;
}
if (this.ai[2] < (float)num419)
{
this.velocity.X = this.velocity.X * 0.9f;
return;
}
this.ai[2] = 0f;
this.TargetClosest(true);
this.spriteDirection = this.direction;
this.ai[1] += 1f;
if (this.ai[1] == 2f)
{
this.velocity.X = (float)this.direction * 2.5f;
this.velocity.Y = -8f;
this.ai[1] = 0f;
}
else
{
this.velocity.X = (float)this.direction * 3.5f;
this.velocity.Y = -4f;
}
this.netUpdate = true;
return;
}
else
{
if (this.direction == 1 && this.velocity.X < 1f)
{
this.velocity.X = this.velocity.X + 0.1f;
return;
}
if (this.direction == -1 && this.velocity.X > -1f)
{
this.velocity.X = this.velocity.X - 0.1f;
return;
}
}
}
}
else
{
if (this.aiStyle == 26)
{
int num420 = 30;
bool flag40 = false;
if (this.velocity.Y == 0f && ((this.velocity.X > 0f && this.direction < 0) || (this.velocity.X < 0f && this.direction > 0)))
{
flag40 = true;
this.ai[3] += 1f;
}
if (this.position.X == this.oldPosition.X || this.ai[3] >= (float)num420 || flag40)
{
this.ai[3] += 1f;
}
else
{
if (this.ai[3] > 0f)
{
this.ai[3] -= 1f;
}
}
if (this.ai[3] > (float)(num420 * 10))
{
this.ai[3] = 0f;
}
if (this.justHit)
{
this.ai[3] = 0f;
}
if (this.ai[3] == (float)num420)
{
this.netUpdate = true;
}
Vector2 vector41 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num421 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector41.X;
float num422 = Main.player[this.target].position.Y - vector41.Y;
float num423 = (float)Math.Sqrt((double)(num421 * num421 + num422 * num422));
if (num423 < 200f)
{
this.ai[3] = 0f;
}
if (this.type == 155 && this.velocity.Y == 0f && num423 < 100f && Math.Abs(this.velocity.X) > 3f && ((this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) && this.velocity.X > 0f) || (this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) && this.velocity.X < 0f)))
{
this.velocity.Y = this.velocity.Y - 4f;
}
if (this.ai[3] < (float)num420)
{
this.TargetClosest(true);
}
else
{
if (this.velocity.X == 0f)
{
if (this.velocity.Y == 0f)
{
this.ai[0] += 1f;
if (this.ai[0] >= 2f)
{
this.direction *= -1;
this.spriteDirection = this.direction;
this.ai[0] = 0f;
}
}
}
else
{
this.ai[0] = 0f;
}
this.directionY = -1;
if (this.direction == 0)
{
this.direction = 1;
}
}
float num424 = 6f;
if (this.velocity.Y == 0f || this.wet || (this.velocity.X <= 0f && this.direction < 0) || (this.velocity.X >= 0f && this.direction > 0))
{
if (this.type == 155)
{
if (this.velocity.X > 0f && this.direction < 0)
{
this.velocity.X = this.velocity.X * 0.95f;
}
if (this.velocity.X < 0f && this.direction > 0)
{
this.velocity.X = this.velocity.X * 0.95f;
}
}
if (this.velocity.X < -num424 || this.velocity.X > num424)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.8f;
}
}
else
{
if (this.velocity.X < num424 && this.direction == 1)
{
this.velocity.X = this.velocity.X + 0.07f;
if (this.velocity.X > num424)
{
this.velocity.X = num424;
}
}
else
{
if (this.velocity.X > -num424 && this.direction == -1)
{
this.velocity.X = this.velocity.X - 0.07f;
if (this.velocity.X < -num424)
{
this.velocity.X = -num424;
}
}
}
}
}
if (this.velocity.Y >= 0f)
{
int num425 = 0;
if (this.velocity.X < 0f)
{
num425 = -1;
}
if (this.velocity.X > 0f)
{
num425 = 1;
}
Vector2 vector42 = this.position;
vector42.X += this.velocity.X;
int num426 = (int)((vector42.X + (float)(this.width / 2) + (float)((this.width / 2 + 1) * num425)) / 16f);
int num427 = (int)((vector42.Y + (float)this.height - 1f) / 16f);
if (Main.tile[num426, num427] == null)
{
Main.tile[num426, num427] = new Tile();
}
if (Main.tile[num426, num427 - 1] == null)
{
Main.tile[num426, num427 - 1] = new Tile();
}
if (Main.tile[num426, num427 - 2] == null)
{
Main.tile[num426, num427 - 2] = new Tile();
}
if (Main.tile[num426, num427 - 3] == null)
{
Main.tile[num426, num427 - 3] = new Tile();
}
if (Main.tile[num426, num427 + 1] == null)
{
Main.tile[num426, num427 + 1] = new Tile();
}
if ((float)(num426 * 16) < vector42.X + (float)this.width && (float)(num426 * 16 + 16) > vector42.X && ((Main.tile[num426, num427].nactive() && Main.tile[num426, num427].slope() == 0 && Main.tile[num426, num427 - 1].slope() == 0 && Main.tileSolid[(int)Main.tile[num426, num427].type] && !Main.tileSolidTop[(int)Main.tile[num426, num427].type]) || (Main.tile[num426, num427 - 1].halfBrick() && Main.tile[num426, num427 - 1].nactive())) && (!Main.tile[num426, num427 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num426, num427 - 1].type] || Main.tileSolidTop[(int)Main.tile[num426, num427 - 1].type] || (Main.tile[num426, num427 - 1].halfBrick() && (!Main.tile[num426, num427 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num426, num427 - 4].type] || Main.tileSolidTop[(int)Main.tile[num426, num427 - 4].type]))) && (!Main.tile[num426, num427 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num426, num427 - 2].type] || Main.tileSolidTop[(int)Main.tile[num426, num427 - 2].type]) && (!Main.tile[num426, num427 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num426, num427 - 3].type] || Main.tileSolidTop[(int)Main.tile[num426, num427 - 3].type]) && (!Main.tile[num426 - num425, num427 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num426 - num425, num427 - 3].type]))
{
float num428 = (float)(num427 * 16);
if (Main.tile[num426, num427].halfBrick())
{
num428 += 8f;
}
if (Main.tile[num426, num427 - 1].halfBrick())
{
num428 -= 8f;
}
if (num428 < vector42.Y + (float)this.height)
{
float num429 = vector42.Y + (float)this.height - num428;
if ((double)num429 <= 16.1)
{
this.gfxOffY += this.position.Y + (float)this.height - num428;
this.position.Y = num428 - (float)this.height;
if (num429 < 9f)
{
this.stepSpeed = 1f;
}
else
{
this.stepSpeed = 2f;
}
}
}
}
}
if (this.velocity.Y == 0f)
{
int num430 = (int)((this.position.X + (float)(this.width / 2) + (float)((this.width / 2 + 2) * this.direction) + this.velocity.X * 5f) / 16f);
int num431 = (int)((this.position.Y + (float)this.height - 15f) / 16f);
if (Main.tile[num430, num431] == null)
{
Main.tile[num430, num431] = new Tile();
}
if (Main.tile[num430, num431 - 1] == null)
{
Main.tile[num430, num431 - 1] = new Tile();
}
if (Main.tile[num430, num431 - 2] == null)
{
Main.tile[num430, num431 - 2] = new Tile();
}
if (Main.tile[num430, num431 - 3] == null)
{
Main.tile[num430, num431 - 3] = new Tile();
}
if (Main.tile[num430, num431 + 1] == null)
{
Main.tile[num430, num431 + 1] = new Tile();
}
if (Main.tile[num430 + this.direction, num431 - 1] == null)
{
Main.tile[num430 + this.direction, num431 - 1] = new Tile();
}
if (Main.tile[num430 + this.direction, num431 + 1] == null)
{
Main.tile[num430 + this.direction, num431 + 1] = new Tile();
}
if (Main.tile[num430 - this.direction, num431 + 1] == null)
{
Main.tile[num430 - this.direction, num431 + 1] = new Tile();
}
if ((this.velocity.X < 0f && this.spriteDirection == -1) || (this.velocity.X > 0f && this.spriteDirection == 1))
{
if (Main.tile[num430, num431 - 2].nactive() && Main.tileSolid[(int)Main.tile[num430, num431 - 2].type])
{
if (Main.tile[num430, num431 - 3].nactive() && Main.tileSolid[(int)Main.tile[num430, num431 - 3].type])
{
this.velocity.Y = -8.5f;
this.netUpdate = true;
return;
}
this.velocity.Y = -7.5f;
this.netUpdate = true;
return;
}
else
{
if (Main.tile[num430, num431 - 1].nactive() && Main.tile[num430, num431 - 1].slope() == 0 && Main.tileSolid[(int)Main.tile[num430, num431 - 1].type])
{
this.velocity.Y = -7f;
this.netUpdate = true;
return;
}
if (this.position.Y + (float)this.height - (float)(num431 * 16) > 20f && Main.tile[num430, num431].nactive() && Main.tile[num430, num431].slope() == 0 && Main.tileSolid[(int)Main.tile[num430, num431].type])
{
this.velocity.Y = -6f;
this.netUpdate = true;
return;
}
if ((this.directionY < 0 || Math.Abs(this.velocity.X) > 3f) && (!Main.tile[num430, num431 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num430, num431 + 2].type]) && (!Main.tile[num430 + this.direction, num431 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num430 + this.direction, num431 + 3].type]))
{
this.velocity.Y = -8f;
this.netUpdate = true;
return;
}
}
}
}
}
else
{
if (this.aiStyle == 27)
{
if (this.position.X < 160f || this.position.X > (float)((Main.maxTilesX - 10) * 16))
{
this.active = false;
}
if (this.localAI[0] == 0f)
{
this.localAI[0] = 1f;
Main.wofB = -1;
Main.wofT = -1;
}
this.ai[1] += 1f;
if (this.ai[2] == 0f)
{
if ((double)this.life < (double)this.lifeMax * 0.5)
{
this.ai[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.2)
{
this.ai[1] += 1f;
}
if (this.ai[1] > 2700f)
{
this.ai[2] = 1f;
}
}
if (this.ai[2] > 0f && this.ai[1] > 60f)
{
int num432 = 3;
if ((double)this.life < (double)this.lifeMax * 0.3)
{
num432++;
}
this.ai[2] += 1f;
this.ai[1] = 0f;
if (this.ai[2] > (float)num432)
{
this.ai[2] = 0f;
}
if (Main.netMode != 1)
{
int num433 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)(this.height / 2) + 20f), 117, 1);
Main.npc[num433].velocity.X = (float)(this.direction * 8);
}
}
this.localAI[3] += 1f;
if (this.localAI[3] >= (float)(600 + Main.rand.Next(1000)))
{
this.localAI[3] = (float)(-(float)Main.rand.Next(200));
Main.PlaySound(4, (int)this.position.X, (int)this.position.Y, 10);
}
Main.wof = this.whoAmI;
int num434 = (int)(this.position.X / 16f);
int num435 = (int)((this.position.X + (float)this.width) / 16f);
int num436 = (int)((this.position.Y + (float)(this.height / 2)) / 16f);
int num437 = 0;
int num438 = num436 + 7;
while (num437 < 15 && num438 > Main.maxTilesY - 200)
{
num438++;
for (int num439 = num434; num439 <= num435; num439++)
{
try
{
if (WorldGen.SolidTile(num439, num438) || Main.tile[num439, num438].liquid > 0)
{
num437++;
}
}
catch
{
num437 += 15;
}
}
}
num438 += 4;
if (Main.wofB == -1)
{
Main.wofB = num438 * 16;
}
else
{
if (Main.wofB > num438 * 16)
{
Main.wofB--;
if (Main.wofB < num438 * 16)
{
Main.wofB = num438 * 16;
}
}
else
{
if (Main.wofB < num438 * 16)
{
Main.wofB++;
if (Main.wofB > num438 * 16)
{
Main.wofB = num438 * 16;
}
}
}
}
num437 = 0;
num438 = num436 - 7;
while (num437 < 15 && num438 < Main.maxTilesY - 10)
{
num438--;
for (int num440 = num434; num440 <= num435; num440++)
{
try
{
if (WorldGen.SolidTile(num440, num438) || Main.tile[num440, num438].liquid > 0)
{
num437++;
}
}
catch
{
num437 += 15;
}
}
}
num438 -= 4;
if (Main.wofT == -1)
{
Main.wofT = num438 * 16;
}
else
{
if (Main.wofT > num438 * 16)
{
Main.wofT--;
if (Main.wofT < num438 * 16)
{
Main.wofT = num438 * 16;
}
}
else
{
if (Main.wofT < num438 * 16)
{
Main.wofT++;
if (Main.wofT > num438 * 16)
{
Main.wofT = num438 * 16;
}
}
}
}
float num441 = (float)((Main.wofB + Main.wofT) / 2 - this.height / 2);
if (this.position.Y > num441 + 1f)
{
this.velocity.Y = -1f;
}
else
{
if (this.position.Y < num441 - 1f)
{
this.velocity.Y = 1f;
}
}
this.velocity.Y = 0f;
this.position.Y = num441;
float num442 = 1.5f;
if ((double)this.life < (double)this.lifeMax * 0.75)
{
num442 += 0.25f;
}
if ((double)this.life < (double)this.lifeMax * 0.5)
{
num442 += 0.4f;
}
if ((double)this.life < (double)this.lifeMax * 0.25)
{
num442 += 0.5f;
}
if ((double)this.life < (double)this.lifeMax * 0.1)
{
num442 += 0.6f;
}
if (this.velocity.X == 0f)
{
this.TargetClosest(true);
this.velocity.X = (float)this.direction;
}
if (this.velocity.X < 0f)
{
this.velocity.X = -num442;
this.direction = -1;
}
else
{
this.velocity.X = num442;
this.direction = 1;
}
this.spriteDirection = this.direction;
Vector2 vector43 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num443 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector43.X;
float num444 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector43.Y;
float num445 = (float)Math.Sqrt((double)(num443 * num443 + num444 * num444));
num443 *= num445;
num444 *= num445;
if (this.direction > 0)
{
if (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) > this.position.X + (float)(this.width / 2))
{
this.rotation = (float)Math.Atan2((double)(-(double)num444), (double)(-(double)num443)) + 3.14f;
}
else
{
this.rotation = 0f;
}
}
else
{
if (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) < this.position.X + (float)(this.width / 2))
{
this.rotation = (float)Math.Atan2((double)num444, (double)num443) + 3.14f;
}
else
{
this.rotation = 0f;
}
}
if (this.localAI[0] == 1f && Main.netMode != 1)
{
this.localAI[0] = 2f;
num441 = (float)((Main.wofB + Main.wofT) / 2);
num441 = (num441 + (float)Main.wofT) / 2f;
int num446 = NPC.NewNPC((int)this.position.X, (int)num441, 114, this.whoAmI);
Main.npc[num446].ai[0] = 1f;
num441 = (float)((Main.wofB + Main.wofT) / 2);
num441 = (num441 + (float)Main.wofB) / 2f;
num446 = NPC.NewNPC((int)this.position.X, (int)num441, 114, this.whoAmI);
Main.npc[num446].ai[0] = -1f;
num441 = (float)((Main.wofB + Main.wofT) / 2);
num441 = (num441 + (float)Main.wofB) / 2f;
for (int num447 = 0; num447 < 11; num447++)
{
num446 = NPC.NewNPC((int)this.position.X, (int)num441, 115, this.whoAmI);
Main.npc[num446].ai[0] = (float)num447 * 0.1f - 0.05f;
}
return;
}
}
else
{
if (this.aiStyle == 28)
{
if (Main.wof < 0)
{
this.active = false;
return;
}
this.realLife = Main.wof;
if (Main.npc[Main.wof].life > 0)
{
this.life = Main.npc[Main.wof].life;
}
this.TargetClosest(true);
this.position.X = Main.npc[Main.wof].position.X;
this.direction = Main.npc[Main.wof].direction;
this.spriteDirection = this.direction;
float num448 = (float)((Main.wofB + Main.wofT) / 2);
if (this.ai[0] > 0f)
{
num448 = (num448 + (float)Main.wofT) / 2f;
}
else
{
num448 = (num448 + (float)Main.wofB) / 2f;
}
num448 -= (float)(this.height / 2);
if (this.position.Y > num448 + 1f)
{
this.velocity.Y = -1f;
}
else
{
if (this.position.Y < num448 - 1f)
{
this.velocity.Y = 1f;
}
else
{
this.velocity.Y = 0f;
this.position.Y = num448;
}
}
if (this.velocity.Y > 5f)
{
this.velocity.Y = 5f;
}
if (this.velocity.Y < -5f)
{
this.velocity.Y = -5f;
}
Vector2 vector44 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num449 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector44.X;
float num450 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector44.Y;
float num451 = (float)Math.Sqrt((double)(num449 * num449 + num450 * num450));
num449 *= num451;
num450 *= num451;
bool flag41 = true;
if (this.direction > 0)
{
if (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) > this.position.X + (float)(this.width / 2))
{
this.rotation = (float)Math.Atan2((double)(-(double)num450), (double)(-(double)num449)) + 3.14f;
}
else
{
this.rotation = 0f;
flag41 = false;
}
}
else
{
if (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) < this.position.X + (float)(this.width / 2))
{
this.rotation = (float)Math.Atan2((double)num450, (double)num449) + 3.14f;
}
else
{
this.rotation = 0f;
flag41 = false;
}
}
if (Main.netMode != 1)
{
int num452 = 4;
this.localAI[1] += 1f;
if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.75)
{
this.localAI[1] += 1f;
num452++;
}
if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.5)
{
this.localAI[1] += 1f;
num452++;
}
if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.25)
{
this.localAI[1] += 1f;
num452 += 2;
}
if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.1)
{
this.localAI[1] += 2f;
num452 += 3;
}
if (this.localAI[2] == 0f)
{
if (this.localAI[1] > 600f)
{
this.localAI[2] = 1f;
this.localAI[1] = 0f;
return;
}
}
else
{
if (this.localAI[1] > 45f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.localAI[1] = 0f;
this.localAI[2] += 1f;
if (this.localAI[2] >= (float)num452)
{
this.localAI[2] = 0f;
}
if (flag41)
{
float num453 = 9f;
int num454 = 11;
int num455 = 83;
if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.5)
{
num454++;
num453 += 1f;
}
if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.25)
{
num454++;
num453 += 1f;
}
if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.1)
{
num454 += 2;
num453 += 2f;
}
vector44 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num449 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector44.X;
num450 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector44.Y;
num451 = (float)Math.Sqrt((double)(num449 * num449 + num450 * num450));
num451 = num453 / num451;
num449 *= num451;
num450 *= num451;
vector44.X += num449;
vector44.Y += num450;
Projectile.NewProjectile(vector44.X, vector44.Y, num449, num450, num455, num454, 0f, Main.myPlayer, 0f, 0f);
return;
}
}
}
}
}
else
{
if (this.aiStyle == 29)
{
if (this.justHit)
{
this.ai[1] = 10f;
}
if (Main.wof < 0)
{
this.active = false;
return;
}
this.TargetClosest(true);
float num456 = 0.1f;
float num457 = 300f;
if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.25)
{
this.damage = 75;
this.defense = 40;
num457 = 900f;
}
else
{
if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.5)
{
this.damage = 60;
this.defense = 30;
num457 = 700f;
}
else
{
if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.75)
{
this.damage = 45;
this.defense = 20;
num457 = 500f;
}
}
}
float num458 = Main.npc[Main.wof].position.X + (float)(Main.npc[Main.wof].width / 2);
float num459 = Main.npc[Main.wof].position.Y;
float num460 = (float)(Main.wofB - Main.wofT);
num459 = (float)Main.wofT + num460 * this.ai[0];
this.ai[2] += 1f;
if (this.ai[2] > 100f)
{
num457 = (float)((int)(num457 * 1.3f));
if (this.ai[2] > 200f)
{
this.ai[2] = 0f;
}
}
Vector2 vector45 = new Vector2(num458, num459);
float num461 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - (float)(this.width / 2) - vector45.X;
float num462 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - (float)(this.height / 2) - vector45.Y;
float num463 = (float)Math.Sqrt((double)(num461 * num461 + num462 * num462));
if (this.ai[1] == 0f)
{
if (num463 > num457)
{
num463 = num457 / num463;
num461 *= num463;
num462 *= num463;
}
if (this.position.X < num458 + num461)
{
this.velocity.X = this.velocity.X + num456;
if (this.velocity.X < 0f && num461 > 0f)
{
this.velocity.X = this.velocity.X + num456 * 2.5f;
}
}
else
{
if (this.position.X > num458 + num461)
{
this.velocity.X = this.velocity.X - num456;
if (this.velocity.X > 0f && num461 < 0f)
{
this.velocity.X = this.velocity.X - num456 * 2.5f;
}
}
}
if (this.position.Y < num459 + num462)
{
this.velocity.Y = this.velocity.Y + num456;
if (this.velocity.Y < 0f && num462 > 0f)
{
this.velocity.Y = this.velocity.Y + num456 * 2.5f;
}
}
else
{
if (this.position.Y > num459 + num462)
{
this.velocity.Y = this.velocity.Y - num456;
if (this.velocity.Y > 0f && num462 < 0f)
{
this.velocity.Y = this.velocity.Y - num456 * 2.5f;
}
}
}
if (this.velocity.X > 4f)
{
this.velocity.X = 4f;
}
if (this.velocity.X < -4f)
{
this.velocity.X = -4f;
}
if (this.velocity.Y > 4f)
{
this.velocity.Y = 4f;
}
if (this.velocity.Y < -4f)
{
this.velocity.Y = -4f;
}
}
else
{
if (this.ai[1] > 0f)
{
this.ai[1] -= 1f;
}
else
{
this.ai[1] = 0f;
}
}
if (num461 > 0f)
{
this.spriteDirection = 1;
this.rotation = (float)Math.Atan2((double)num462, (double)num461);
}
if (num461 < 0f)
{
this.spriteDirection = -1;
this.rotation = (float)Math.Atan2((double)num462, (double)num461) + 3.14f;
}
Lighting.addLight((int)(this.position.X + (float)(this.width / 2)) / 16, (int)(this.position.Y + (float)(this.height / 2)) / 16, 0.3f, 0.2f, 0.1f);
return;
}
else
{
if (this.aiStyle == 30)
{
if (this.target < 0 || this.target == 255 || Main.player[this.target].dead || !Main.player[this.target].active)
{
this.TargetClosest(true);
}
bool dead2 = Main.player[this.target].dead;
float num464 = this.position.X + (float)(this.width / 2) - Main.player[this.target].position.X - (float)(Main.player[this.target].width / 2);
float num465 = this.position.Y + (float)this.height - 59f - Main.player[this.target].position.Y - (float)(Main.player[this.target].height / 2);
float num466 = (float)Math.Atan2((double)num465, (double)num464) + 1.57f;
if (num466 < 0f)
{
num466 += 6.283f;
}
else
{
if ((double)num466 > 6.283)
{
num466 -= 6.283f;
}
}
float num467 = 0.1f;
if (this.rotation < num466)
{
if ((double)(num466 - this.rotation) > 3.1415)
{
this.rotation -= num467;
}
else
{
this.rotation += num467;
}
}
else
{
if (this.rotation > num466)
{
if ((double)(this.rotation - num466) > 3.1415)
{
this.rotation += num467;
}
else
{
this.rotation -= num467;
}
}
}
if (this.rotation > num466 - num467 && this.rotation < num466 + num467)
{
this.rotation = num466;
}
if (this.rotation < 0f)
{
this.rotation += 6.283f;
}
else
{
if ((double)this.rotation > 6.283)
{
this.rotation -= 6.283f;
}
}
if (this.rotation > num466 - num467 && this.rotation < num466 + num467)
{
this.rotation = num466;
}
if (Main.rand.Next(5) == 0)
{
int num468 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height * 0.25f), this.width, (int)((float)this.height * 0.5f), 5, this.velocity.X, 2f, 0, default(Color), 1f);
Dust expr_1CF50_cp_0 = Main.dust[num468];
expr_1CF50_cp_0.velocity.X = expr_1CF50_cp_0.velocity.X * 0.5f;
Dust expr_1CF70_cp_0 = Main.dust[num468];
expr_1CF70_cp_0.velocity.Y = expr_1CF70_cp_0.velocity.Y * 0.1f;
}
if (Main.dayTime || dead2)
{
this.velocity.Y = this.velocity.Y - 0.04f;
if (this.timeLeft > 10)
{
this.timeLeft = 10;
return;
}
}
else
{
if (this.ai[0] == 0f)
{
if (this.ai[1] == 0f)
{
float num469 = 7f;
float num470 = 0.1f;
int num471 = 1;
if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)Main.player[this.target].width)
{
num471 = -1;
}
Vector2 vector46 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num472 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) + (float)(num471 * 300) - vector46.X;
float num473 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 300f - vector46.Y;
float num474 = (float)Math.Sqrt((double)(num472 * num472 + num473 * num473));
float num475 = num474;
num474 = num469 / num474;
num472 *= num474;
num473 *= num474;
if (this.velocity.X < num472)
{
this.velocity.X = this.velocity.X + num470;
if (this.velocity.X < 0f && num472 > 0f)
{
this.velocity.X = this.velocity.X + num470;
}
}
else
{
if (this.velocity.X > num472)
{
this.velocity.X = this.velocity.X - num470;
if (this.velocity.X > 0f && num472 < 0f)
{
this.velocity.X = this.velocity.X - num470;
}
}
}
if (this.velocity.Y < num473)
{
this.velocity.Y = this.velocity.Y + num470;
if (this.velocity.Y < 0f && num473 > 0f)
{
this.velocity.Y = this.velocity.Y + num470;
}
}
else
{
if (this.velocity.Y > num473)
{
this.velocity.Y = this.velocity.Y - num470;
if (this.velocity.Y > 0f && num473 < 0f)
{
this.velocity.Y = this.velocity.Y - num470;
}
}
}
this.ai[2] += 1f;
if (this.ai[2] >= 600f)
{
this.ai[1] = 1f;
this.ai[2] = 0f;
this.ai[3] = 0f;
this.target = 255;
this.netUpdate = true;
}
else
{
if (this.position.Y + (float)this.height < Main.player[this.target].position.Y && num475 < 400f)
{
if (!Main.player[this.target].dead)
{
this.ai[3] += 1f;
}
if (this.ai[3] >= 60f)
{
this.ai[3] = 0f;
vector46 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num472 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector46.X;
num473 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector46.Y;
if (Main.netMode != 1)
{
float num476 = 9f;
int num477 = 20;
int num478 = 83;
num474 = (float)Math.Sqrt((double)(num472 * num472 + num473 * num473));
num474 = num476 / num474;
num472 *= num474;
num473 *= num474;
num472 += (float)Main.rand.Next(-40, 41) * 0.08f;
num473 += (float)Main.rand.Next(-40, 41) * 0.08f;
vector46.X += num472 * 15f;
vector46.Y += num473 * 15f;
Projectile.NewProjectile(vector46.X, vector46.Y, num472, num473, num478, num477, 0f, Main.myPlayer, 0f, 0f);
}
}
}
}
}
else
{
if (this.ai[1] == 1f)
{
this.rotation = num466;
float num479 = 12f;
Vector2 vector47 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num480 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector47.X;
float num481 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector47.Y;
float num482 = (float)Math.Sqrt((double)(num480 * num480 + num481 * num481));
num482 = num479 / num482;
this.velocity.X = num480 * num482;
this.velocity.Y = num481 * num482;
this.ai[1] = 2f;
}
else
{
if (this.ai[1] == 2f)
{
this.ai[2] += 1f;
if (this.ai[2] >= 25f)
{
this.velocity.X = this.velocity.X * 0.96f;
this.velocity.Y = this.velocity.Y * 0.96f;
if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1)
{
this.velocity.X = 0f;
}
if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1)
{
this.velocity.Y = 0f;
}
}
else
{
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f;
}
if (this.ai[2] >= 70f)
{
this.ai[3] += 1f;
this.ai[2] = 0f;
this.target = 255;
this.rotation = num466;
if (this.ai[3] >= 4f)
{
this.ai[1] = 0f;
this.ai[3] = 0f;
}
else
{
this.ai[1] = 1f;
}
}
}
}
}
if ((double)this.life < (double)this.lifeMax * 0.5)
{
this.ai[0] = 1f;
this.ai[1] = 0f;
this.ai[2] = 0f;
this.ai[3] = 0f;
this.netUpdate = true;
return;
}
}
else
{
if (this.ai[0] == 1f || this.ai[0] == 2f)
{
if (this.ai[0] == 1f)
{
this.ai[2] += 0.005f;
if ((double)this.ai[2] > 0.5)
{
this.ai[2] = 0.5f;
}
}
else
{
this.ai[2] -= 0.005f;
if (this.ai[2] < 0f)
{
this.ai[2] = 0f;
}
}
this.rotation += this.ai[2];
this.ai[1] += 1f;
if (this.ai[1] == 100f)
{
this.ai[0] += 1f;
this.ai[1] = 0f;
if (this.ai[0] == 3f)
{
this.ai[2] = 0f;
}
else
{
Main.PlaySound(3, (int)this.position.X, (int)this.position.Y, 1);
for (int num483 = 0; num483 < 2; num483++)
{
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 143, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6, 1f);
}
for (int num484 = 0; num484 < 20; num484++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f);
}
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
}
}
Dust.NewDust(this.position, this.width, this.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f);
this.velocity.X = this.velocity.X * 0.98f;
this.velocity.Y = this.velocity.Y * 0.98f;
if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1)
{
this.velocity.X = 0f;
}
if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1)
{
this.velocity.Y = 0f;
return;
}
}
else
{
this.damage = (int)((double)this.defDamage * 1.5);
this.defense = this.defDefense + 15;
this.soundHit = 4;
if (this.ai[1] == 0f)
{
float num485 = 8f;
float num486 = 0.15f;
Vector2 vector48 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num487 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector48.X;
float num488 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 300f - vector48.Y;
float num489 = (float)Math.Sqrt((double)(num487 * num487 + num488 * num488));
num489 = num485 / num489;
num487 *= num489;
num488 *= num489;
if (this.velocity.X < num487)
{
this.velocity.X = this.velocity.X + num486;
if (this.velocity.X < 0f && num487 > 0f)
{
this.velocity.X = this.velocity.X + num486;
}
}
else
{
if (this.velocity.X > num487)
{
this.velocity.X = this.velocity.X - num486;
if (this.velocity.X > 0f && num487 < 0f)
{
this.velocity.X = this.velocity.X - num486;
}
}
}
if (this.velocity.Y < num488)
{
this.velocity.Y = this.velocity.Y + num486;
if (this.velocity.Y < 0f && num488 > 0f)
{
this.velocity.Y = this.velocity.Y + num486;
}
}
else
{
if (this.velocity.Y > num488)
{
this.velocity.Y = this.velocity.Y - num486;
if (this.velocity.Y > 0f && num488 < 0f)
{
this.velocity.Y = this.velocity.Y - num486;
}
}
}
this.ai[2] += 1f;
if (this.ai[2] >= 300f)
{
this.ai[1] = 1f;
this.ai[2] = 0f;
this.ai[3] = 0f;
this.TargetClosest(true);
this.netUpdate = true;
}
vector48 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num487 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector48.X;
num488 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector48.Y;
this.rotation = (float)Math.Atan2((double)num488, (double)num487) - 1.57f;
if (Main.netMode != 1)
{
this.localAI[1] += 1f;
if ((double)this.life < (double)this.lifeMax * 0.75)
{
this.localAI[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.5)
{
this.localAI[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.25)
{
this.localAI[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.1)
{
this.localAI[1] += 2f;
}
if (this.localAI[1] > 140f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.localAI[1] = 0f;
float num490 = 9f;
int num491 = 25;
int num492 = 100;
num489 = (float)Math.Sqrt((double)(num487 * num487 + num488 * num488));
num489 = num490 / num489;
num487 *= num489;
num488 *= num489;
vector48.X += num487 * 15f;
vector48.Y += num488 * 15f;
Projectile.NewProjectile(vector48.X, vector48.Y, num487, num488, num492, num491, 0f, Main.myPlayer, 0f, 0f);
return;
}
}
}
else
{
int num493 = 1;
if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)Main.player[this.target].width)
{
num493 = -1;
}
float num494 = 8f;
float num495 = 0.2f;
Vector2 vector49 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num496 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) + (float)(num493 * 340) - vector49.X;
float num497 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector49.Y;
float num498 = (float)Math.Sqrt((double)(num496 * num496 + num497 * num497));
num498 = num494 / num498;
num496 *= num498;
num497 *= num498;
if (this.velocity.X < num496)
{
this.velocity.X = this.velocity.X + num495;
if (this.velocity.X < 0f && num496 > 0f)
{
this.velocity.X = this.velocity.X + num495;
}
}
else
{
if (this.velocity.X > num496)
{
this.velocity.X = this.velocity.X - num495;
if (this.velocity.X > 0f && num496 < 0f)
{
this.velocity.X = this.velocity.X - num495;
}
}
}
if (this.velocity.Y < num497)
{
this.velocity.Y = this.velocity.Y + num495;
if (this.velocity.Y < 0f && num497 > 0f)
{
this.velocity.Y = this.velocity.Y + num495;
}
}
else
{
if (this.velocity.Y > num497)
{
this.velocity.Y = this.velocity.Y - num495;
if (this.velocity.Y > 0f && num497 < 0f)
{
this.velocity.Y = this.velocity.Y - num495;
}
}
}
vector49 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num496 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector49.X;
num497 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector49.Y;
this.rotation = (float)Math.Atan2((double)num497, (double)num496) - 1.57f;
if (Main.netMode != 1)
{
this.localAI[1] += 1f;
if ((double)this.life < (double)this.lifeMax * 0.75)
{
this.localAI[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.5)
{
this.localAI[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.25)
{
this.localAI[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.1)
{
this.localAI[1] += 2f;
}
if (this.localAI[1] > 45f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.localAI[1] = 0f;
float num499 = 9f;
int num500 = 20;
int num501 = 100;
num498 = (float)Math.Sqrt((double)(num496 * num496 + num497 * num497));
num498 = num499 / num498;
num496 *= num498;
num497 *= num498;
vector49.X += num496 * 15f;
vector49.Y += num497 * 15f;
Projectile.NewProjectile(vector49.X, vector49.Y, num496, num497, num501, num500, 0f, Main.myPlayer, 0f, 0f);
}
}
this.ai[2] += 1f;
if (this.ai[2] >= 200f)
{
this.ai[1] = 0f;
this.ai[2] = 0f;
this.ai[3] = 0f;
this.TargetClosest(true);
this.netUpdate = true;
return;
}
}
}
}
}
}
else
{
if (this.aiStyle == 31)
{
if (this.target < 0 || this.target == 255 || Main.player[this.target].dead || !Main.player[this.target].active)
{
this.TargetClosest(true);
}
bool dead3 = Main.player[this.target].dead;
float num502 = this.position.X + (float)(this.width / 2) - Main.player[this.target].position.X - (float)(Main.player[this.target].width / 2);
float num503 = this.position.Y + (float)this.height - 59f - Main.player[this.target].position.Y - (float)(Main.player[this.target].height / 2);
float num504 = (float)Math.Atan2((double)num503, (double)num502) + 1.57f;
if (num504 < 0f)
{
num504 += 6.283f;
}
else
{
if ((double)num504 > 6.283)
{
num504 -= 6.283f;
}
}
float num505 = 0.15f;
if (this.rotation < num504)
{
if ((double)(num504 - this.rotation) > 3.1415)
{
this.rotation -= num505;
}
else
{
this.rotation += num505;
}
}
else
{
if (this.rotation > num504)
{
if ((double)(this.rotation - num504) > 3.1415)
{
this.rotation += num505;
}
else
{
this.rotation -= num505;
}
}
}
if (this.rotation > num504 - num505 && this.rotation < num504 + num505)
{
this.rotation = num504;
}
if (this.rotation < 0f)
{
this.rotation += 6.283f;
}
else
{
if ((double)this.rotation > 6.283)
{
this.rotation -= 6.283f;
}
}
if (this.rotation > num504 - num505 && this.rotation < num504 + num505)
{
this.rotation = num504;
}
if (Main.rand.Next(5) == 0)
{
int num506 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height * 0.25f), this.width, (int)((float)this.height * 0.5f), 5, this.velocity.X, 2f, 0, default(Color), 1f);
Dust expr_1EBBF_cp_0 = Main.dust[num506];
expr_1EBBF_cp_0.velocity.X = expr_1EBBF_cp_0.velocity.X * 0.5f;
Dust expr_1EBDF_cp_0 = Main.dust[num506];
expr_1EBDF_cp_0.velocity.Y = expr_1EBDF_cp_0.velocity.Y * 0.1f;
}
if (Main.dayTime || dead3)
{
this.velocity.Y = this.velocity.Y - 0.04f;
if (this.timeLeft > 10)
{
this.timeLeft = 10;
return;
}
}
else
{
if (this.ai[0] == 0f)
{
if (this.ai[1] == 0f)
{
this.TargetClosest(true);
float num507 = 12f;
float num508 = 0.4f;
int num509 = 1;
if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)Main.player[this.target].width)
{
num509 = -1;
}
Vector2 vector50 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num510 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) + (float)(num509 * 400) - vector50.X;
float num511 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector50.Y;
float num512 = (float)Math.Sqrt((double)(num510 * num510 + num511 * num511));
num512 = num507 / num512;
num510 *= num512;
num511 *= num512;
if (this.velocity.X < num510)
{
this.velocity.X = this.velocity.X + num508;
if (this.velocity.X < 0f && num510 > 0f)
{
this.velocity.X = this.velocity.X + num508;
}
}
else
{
if (this.velocity.X > num510)
{
this.velocity.X = this.velocity.X - num508;
if (this.velocity.X > 0f && num510 < 0f)
{
this.velocity.X = this.velocity.X - num508;
}
}
}
if (this.velocity.Y < num511)
{
this.velocity.Y = this.velocity.Y + num508;
if (this.velocity.Y < 0f && num511 > 0f)
{
this.velocity.Y = this.velocity.Y + num508;
}
}
else
{
if (this.velocity.Y > num511)
{
this.velocity.Y = this.velocity.Y - num508;
if (this.velocity.Y > 0f && num511 < 0f)
{
this.velocity.Y = this.velocity.Y - num508;
}
}
}
this.ai[2] += 1f;
if (this.ai[2] >= 600f)
{
this.ai[1] = 1f;
this.ai[2] = 0f;
this.ai[3] = 0f;
this.target = 255;
this.netUpdate = true;
}
else
{
if (!Main.player[this.target].dead)
{
this.ai[3] += 1f;
}
if (this.ai[3] >= 60f)
{
this.ai[3] = 0f;
vector50 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num510 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector50.X;
num511 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector50.Y;
if (Main.netMode != 1)
{
float num513 = 12f;
int num514 = 25;
int num515 = 96;
num512 = (float)Math.Sqrt((double)(num510 * num510 + num511 * num511));
num512 = num513 / num512;
num510 *= num512;
num511 *= num512;
num510 += (float)Main.rand.Next(-40, 41) * 0.05f;
num511 += (float)Main.rand.Next(-40, 41) * 0.05f;
vector50.X += num510 * 4f;
vector50.Y += num511 * 4f;
Projectile.NewProjectile(vector50.X, vector50.Y, num510, num511, num515, num514, 0f, Main.myPlayer, 0f, 0f);
}
}
}
}
else
{
if (this.ai[1] == 1f)
{
this.rotation = num504;
float num516 = 13f;
Vector2 vector51 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num517 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector51.X;
float num518 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector51.Y;
float num519 = (float)Math.Sqrt((double)(num517 * num517 + num518 * num518));
num519 = num516 / num519;
this.velocity.X = num517 * num519;
this.velocity.Y = num518 * num519;
this.ai[1] = 2f;
}
else
{
if (this.ai[1] == 2f)
{
this.ai[2] += 1f;
if (this.ai[2] >= 8f)
{
this.velocity.X = this.velocity.X * 0.9f;
this.velocity.Y = this.velocity.Y * 0.9f;
if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1)
{
this.velocity.X = 0f;
}
if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1)
{
this.velocity.Y = 0f;
}
}
else
{
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f;
}
if (this.ai[2] >= 42f)
{
this.ai[3] += 1f;
this.ai[2] = 0f;
this.target = 255;
this.rotation = num504;
if (this.ai[3] >= 10f)
{
this.ai[1] = 0f;
this.ai[3] = 0f;
}
else
{
this.ai[1] = 1f;
}
}
}
}
}
if ((double)this.life < (double)this.lifeMax * 0.5)
{
this.ai[0] = 1f;
this.ai[1] = 0f;
this.ai[2] = 0f;
this.ai[3] = 0f;
this.netUpdate = true;
return;
}
}
else
{
if (this.ai[0] == 1f || this.ai[0] == 2f)
{
if (this.ai[0] == 1f)
{
this.ai[2] += 0.005f;
if ((double)this.ai[2] > 0.5)
{
this.ai[2] = 0.5f;
}
}
else
{
this.ai[2] -= 0.005f;
if (this.ai[2] < 0f)
{
this.ai[2] = 0f;
}
}
this.rotation += this.ai[2];
this.ai[1] += 1f;
if (this.ai[1] == 100f)
{
this.ai[0] += 1f;
this.ai[1] = 0f;
if (this.ai[0] == 3f)
{
this.ai[2] = 0f;
}
else
{
Main.PlaySound(3, (int)this.position.X, (int)this.position.Y, 1);
for (int num520 = 0; num520 < 2; num520++)
{
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 144, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6, 1f);
}
for (int num521 = 0; num521 < 20; num521++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f);
}
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
}
}
Dust.NewDust(this.position, this.width, this.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f);
this.velocity.X = this.velocity.X * 0.98f;
this.velocity.Y = this.velocity.Y * 0.98f;
if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1)
{
this.velocity.X = 0f;
}
if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1)
{
this.velocity.Y = 0f;
return;
}
}
else
{
this.soundHit = 4;
this.damage = (int)((double)this.defDamage * 1.5);
this.defense = this.defDefense + 25;
if (this.ai[1] == 0f)
{
float num522 = 4f;
float num523 = 0.1f;
int num524 = 1;
if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)Main.player[this.target].width)
{
num524 = -1;
}
Vector2 vector52 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num525 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) + (float)(num524 * 180) - vector52.X;
float num526 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector52.Y;
float num527 = (float)Math.Sqrt((double)(num525 * num525 + num526 * num526));
num527 = num522 / num527;
num525 *= num527;
num526 *= num527;
if (this.velocity.X < num525)
{
this.velocity.X = this.velocity.X + num523;
if (this.velocity.X < 0f && num525 > 0f)
{
this.velocity.X = this.velocity.X + num523;
}
}
else
{
if (this.velocity.X > num525)
{
this.velocity.X = this.velocity.X - num523;
if (this.velocity.X > 0f && num525 < 0f)
{
this.velocity.X = this.velocity.X - num523;
}
}
}
if (this.velocity.Y < num526)
{
this.velocity.Y = this.velocity.Y + num523;
if (this.velocity.Y < 0f && num526 > 0f)
{
this.velocity.Y = this.velocity.Y + num523;
}
}
else
{
if (this.velocity.Y > num526)
{
this.velocity.Y = this.velocity.Y - num523;
if (this.velocity.Y > 0f && num526 < 0f)
{
this.velocity.Y = this.velocity.Y - num523;
}
}
}
this.ai[2] += 1f;
if (this.ai[2] >= 400f)
{
this.ai[1] = 1f;
this.ai[2] = 0f;
this.ai[3] = 0f;
this.target = 255;
this.netUpdate = true;
}
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.localAI[2] += 1f;
if (this.localAI[2] > 22f)
{
this.localAI[2] = 0f;
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 34);
}
if (Main.netMode != 1)
{
this.localAI[1] += 1f;
if ((double)this.life < (double)this.lifeMax * 0.75)
{
this.localAI[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.5)
{
this.localAI[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.25)
{
this.localAI[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.1)
{
this.localAI[1] += 2f;
}
if (this.localAI[1] > 8f)
{
this.localAI[1] = 0f;
float num528 = 6f;
int num529 = 30;
int num530 = 101;
vector52 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num525 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector52.X;
num526 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector52.Y;
num527 = (float)Math.Sqrt((double)(num525 * num525 + num526 * num526));
num527 = num528 / num527;
num525 *= num527;
num526 *= num527;
num526 += (float)Main.rand.Next(-40, 41) * 0.01f;
num525 += (float)Main.rand.Next(-40, 41) * 0.01f;
num526 += this.velocity.Y * 0.5f;
num525 += this.velocity.X * 0.5f;
vector52.X -= num525 * 1f;
vector52.Y -= num526 * 1f;
Projectile.NewProjectile(vector52.X, vector52.Y, num525, num526, num530, num529, 0f, Main.myPlayer, 0f, 0f);
return;
}
}
}
}
else
{
if (this.ai[1] == 1f)
{
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
this.rotation = num504;
float num531 = 14f;
Vector2 vector53 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num532 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector53.X;
float num533 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector53.Y;
float num534 = (float)Math.Sqrt((double)(num532 * num532 + num533 * num533));
num534 = num531 / num534;
this.velocity.X = num532 * num534;
this.velocity.Y = num533 * num534;
this.ai[1] = 2f;
return;
}
if (this.ai[1] == 2f)
{
this.ai[2] += 1f;
if (this.ai[2] >= 50f)
{
this.velocity.X = this.velocity.X * 0.93f;
this.velocity.Y = this.velocity.Y * 0.93f;
if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1)
{
this.velocity.X = 0f;
}
if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1)
{
this.velocity.Y = 0f;
}
}
else
{
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f;
}
if (this.ai[2] >= 80f)
{
this.ai[3] += 1f;
this.ai[2] = 0f;
this.target = 255;
this.rotation = num504;
if (this.ai[3] >= 6f)
{
this.ai[1] = 0f;
this.ai[3] = 0f;
return;
}
this.ai[1] = 1f;
return;
}
}
}
}
}
}
}
else
{
if (this.aiStyle == 32)
{
this.damage = this.defDamage;
this.defense = this.defDefense;
if (this.ai[0] == 0f && Main.netMode != 1)
{
this.TargetClosest(true);
this.ai[0] = 1f;
if (this.type != 68)
{
int num535 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 128, this.whoAmI);
Main.npc[num535].ai[0] = -1f;
Main.npc[num535].ai[1] = (float)this.whoAmI;
Main.npc[num535].target = this.target;
Main.npc[num535].netUpdate = true;
num535 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 129, this.whoAmI);
Main.npc[num535].ai[0] = 1f;
Main.npc[num535].ai[1] = (float)this.whoAmI;
Main.npc[num535].target = this.target;
Main.npc[num535].netUpdate = true;
num535 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 130, this.whoAmI);
Main.npc[num535].ai[0] = -1f;
Main.npc[num535].ai[1] = (float)this.whoAmI;
Main.npc[num535].target = this.target;
Main.npc[num535].ai[3] = 150f;
Main.npc[num535].netUpdate = true;
num535 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 131, this.whoAmI);
Main.npc[num535].ai[0] = 1f;
Main.npc[num535].ai[1] = (float)this.whoAmI;
Main.npc[num535].target = this.target;
Main.npc[num535].netUpdate = true;
Main.npc[num535].ai[3] = 150f;
}
}
if (this.type == 68 && this.ai[1] != 3f && this.ai[1] != 2f)
{
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
this.ai[1] = 2f;
}
if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 6000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 6000f)
{
this.TargetClosest(true);
if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 6000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 6000f)
{
this.ai[1] = 3f;
}
}
if (Main.dayTime && this.ai[1] != 3f && this.ai[1] != 2f)
{
this.ai[1] = 2f;
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
}
if (this.ai[1] == 0f)
{
this.ai[2] += 1f;
if (this.ai[2] >= 600f)
{
this.ai[2] = 0f;
this.ai[1] = 1f;
this.TargetClosest(true);
this.netUpdate = true;
}
this.rotation = this.velocity.X / 15f;
if (this.position.Y > Main.player[this.target].position.Y - 200f)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.98f;
}
this.velocity.Y = this.velocity.Y - 0.1f;
if (this.velocity.Y > 2f)
{
this.velocity.Y = 2f;
}
}
else
{
if (this.position.Y < Main.player[this.target].position.Y - 500f)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.98f;
}
this.velocity.Y = this.velocity.Y + 0.1f;
if (this.velocity.Y < -2f)
{
this.velocity.Y = -2f;
}
}
}
if (this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) + 100f)
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.98f;
}
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X > 8f)
{
this.velocity.X = 8f;
}
}
if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - 100f)
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.98f;
}
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X < -8f)
{
this.velocity.X = -8f;
return;
}
}
}
else
{
if (this.ai[1] == 1f)
{
this.defense *= 2;
this.damage *= 2;
this.ai[2] += 1f;
if (this.ai[2] == 2f)
{
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
}
if (this.ai[2] >= 400f)
{
this.ai[2] = 0f;
this.ai[1] = 0f;
}
this.rotation += (float)this.direction * 0.3f;
Vector2 vector54 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num536 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector54.X;
float num537 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector54.Y;
float num538 = (float)Math.Sqrt((double)(num536 * num536 + num537 * num537));
num538 = 2f / num538;
this.velocity.X = num536 * num538;
this.velocity.Y = num537 * num538;
return;
}
if (this.ai[1] == 2f)
{
this.damage = 9999;
this.defense = 9999;
this.rotation += (float)this.direction * 0.3f;
Vector2 vector55 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num539 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector55.X;
float num540 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector55.Y;
float num541 = (float)Math.Sqrt((double)(num539 * num539 + num540 * num540));
num541 = 8f / num541;
this.velocity.X = num539 * num541;
this.velocity.Y = num540 * num541;
return;
}
if (this.ai[1] == 3f)
{
this.velocity.Y = this.velocity.Y + 0.1f;
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.95f;
}
this.velocity.X = this.velocity.X * 0.95f;
if (this.timeLeft > 500)
{
this.timeLeft = 500;
return;
}
}
}
}
else
{
if (this.aiStyle == 33)
{
Vector2 vector56 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num542 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector56.X;
float num543 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector56.Y;
float num544 = (float)Math.Sqrt((double)(num542 * num542 + num543 * num543));
if (this.ai[2] != 99f)
{
if (num544 > 800f)
{
this.ai[2] = 99f;
}
}
else
{
if (num544 < 400f)
{
this.ai[2] = 0f;
}
}
this.spriteDirection = -(int)this.ai[0];
if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32)
{
this.ai[2] += 10f;
if (this.ai[2] > 50f || Main.netMode != 2)
{
this.life = -1;
this.HitEffect(0, 10.0);
this.active = false;
}
}
if (this.ai[2] == 99f)
{
if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y - 0.1f;
if (this.velocity.Y > 8f)
{
this.velocity.Y = 8f;
}
}
else
{
if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y + 0.1f;
if (this.velocity.Y < -8f)
{
this.velocity.Y = -8f;
}
}
}
if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2))
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X - 0.5f;
if (this.velocity.X > 12f)
{
this.velocity.X = 12f;
}
}
if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2))
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X + 0.5f;
if (this.velocity.X < -12f)
{
this.velocity.X = -12f;
return;
}
}
}
else
{
if (this.ai[2] == 0f || this.ai[2] == 3f)
{
if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10)
{
this.timeLeft = 10;
}
if (Main.npc[(int)this.ai[1]].ai[1] != 0f)
{
this.TargetClosest(true);
if (Main.player[this.target].dead)
{
this.velocity.Y = this.velocity.Y + 0.1f;
if (this.velocity.Y > 16f)
{
this.velocity.Y = 16f;
}
}
else
{
Vector2 vector57 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num545 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector57.X;
float num546 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector57.Y;
float num547 = (float)Math.Sqrt((double)(num545 * num545 + num546 * num546));
num547 = 7f / num547;
num545 *= num547;
num546 *= num547;
this.rotation = (float)Math.Atan2((double)num546, (double)num545) - 1.57f;
if (this.velocity.X > num545)
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.97f;
}
this.velocity.X = this.velocity.X - 0.05f;
}
if (this.velocity.X < num545)
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.97f;
}
this.velocity.X = this.velocity.X + 0.05f;
}
if (this.velocity.Y > num546)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.97f;
}
this.velocity.Y = this.velocity.Y - 0.05f;
}
if (this.velocity.Y < num546)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.97f;
}
this.velocity.Y = this.velocity.Y + 0.05f;
}
}
this.ai[3] += 1f;
if (this.ai[3] >= 600f)
{
this.ai[2] = 0f;
this.ai[3] = 0f;
this.netUpdate = true;
}
}
else
{
this.ai[3] += 1f;
if (this.ai[3] >= 300f)
{
this.ai[2] += 1f;
this.ai[3] = 0f;
this.netUpdate = true;
}
if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y + 320f)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y - 0.04f;
if (this.velocity.Y > 3f)
{
this.velocity.Y = 3f;
}
}
else
{
if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y + 260f)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y + 0.04f;
if (this.velocity.Y < -3f)
{
this.velocity.Y = -3f;
}
}
}
if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2))
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X - 0.3f;
if (this.velocity.X > 12f)
{
this.velocity.X = 12f;
}
}
if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 250f)
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X + 0.3f;
if (this.velocity.X < -12f)
{
this.velocity.X = -12f;
}
}
}
Vector2 vector58 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num548 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector58.X;
float num549 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector58.Y;
Math.Sqrt((double)(num548 * num548 + num549 * num549));
this.rotation = (float)Math.Atan2((double)num549, (double)num548) + 1.57f;
return;
}
if (this.ai[2] == 1f)
{
Vector2 vector59 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num550 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector59.X;
float num551 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector59.Y;
float num552 = (float)Math.Sqrt((double)(num550 * num550 + num551 * num551));
this.rotation = (float)Math.Atan2((double)num551, (double)num550) + 1.57f;
this.velocity.X = this.velocity.X * 0.95f;
this.velocity.Y = this.velocity.Y - 0.1f;
if (this.velocity.Y < -8f)
{
this.velocity.Y = -8f;
}
if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 200f)
{
this.TargetClosest(true);
this.ai[2] = 2f;
vector59 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num550 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector59.X;
num551 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector59.Y;
num552 = (float)Math.Sqrt((double)(num550 * num550 + num551 * num551));
num552 = 22f / num552;
this.velocity.X = num550 * num552;
this.velocity.Y = num551 * num552;
this.netUpdate = true;
return;
}
}
else
{
if (this.ai[2] == 2f)
{
if (this.position.Y > Main.player[this.target].position.Y || this.velocity.Y < 0f)
{
this.ai[2] = 3f;
return;
}
}
else
{
if (this.ai[2] == 4f)
{
this.TargetClosest(true);
Vector2 vector60 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num553 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector60.X;
float num554 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector60.Y;
float num555 = (float)Math.Sqrt((double)(num553 * num553 + num554 * num554));
num555 = 7f / num555;
num553 *= num555;
num554 *= num555;
if (this.velocity.X > num553)
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.97f;
}
this.velocity.X = this.velocity.X - 0.05f;
}
if (this.velocity.X < num553)
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.97f;
}
this.velocity.X = this.velocity.X + 0.05f;
}
if (this.velocity.Y > num554)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.97f;
}
this.velocity.Y = this.velocity.Y - 0.05f;
}
if (this.velocity.Y < num554)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.97f;
}
this.velocity.Y = this.velocity.Y + 0.05f;
}
this.ai[3] += 1f;
if (this.ai[3] >= 600f)
{
this.ai[2] = 0f;
this.ai[3] = 0f;
this.netUpdate = true;
}
vector60 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num553 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector60.X;
num554 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector60.Y;
num555 = (float)Math.Sqrt((double)(num553 * num553 + num554 * num554));
this.rotation = (float)Math.Atan2((double)num554, (double)num553) + 1.57f;
return;
}
if (this.ai[2] == 5f && ((this.velocity.X > 0f && this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)) || (this.velocity.X < 0f && this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))))
{
this.ai[2] = 0f;
return;
}
}
}
}
}
else
{
if (this.aiStyle == 34)
{
this.spriteDirection = -(int)this.ai[0];
Vector2 vector61 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num556 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector61.X;
float num557 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector61.Y;
float num558 = (float)Math.Sqrt((double)(num556 * num556 + num557 * num557));
if (this.ai[2] != 99f)
{
if (num558 > 800f)
{
this.ai[2] = 99f;
}
}
else
{
if (num558 < 400f)
{
this.ai[2] = 0f;
}
}
if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32)
{
this.ai[2] += 10f;
if (this.ai[2] > 50f || Main.netMode != 2)
{
this.life = -1;
this.HitEffect(0, 10.0);
this.active = false;
}
}
if (this.ai[2] == 99f)
{
if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y - 0.1f;
if (this.velocity.Y > 8f)
{
this.velocity.Y = 8f;
}
}
else
{
if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y + 0.1f;
if (this.velocity.Y < -8f)
{
this.velocity.Y = -8f;
}
}
}
if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2))
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X - 0.5f;
if (this.velocity.X > 12f)
{
this.velocity.X = 12f;
}
}
if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2))
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X + 0.5f;
if (this.velocity.X < -12f)
{
this.velocity.X = -12f;
return;
}
}
}
else
{
if (this.ai[2] == 0f || this.ai[2] == 3f)
{
if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10)
{
this.timeLeft = 10;
}
if (Main.npc[(int)this.ai[1]].ai[1] != 0f)
{
this.TargetClosest(true);
this.TargetClosest(true);
if (Main.player[this.target].dead)
{
this.velocity.Y = this.velocity.Y + 0.1f;
if (this.velocity.Y > 16f)
{
this.velocity.Y = 16f;
}
}
else
{
Vector2 vector62 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num559 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector62.X;
float num560 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector62.Y;
float num561 = (float)Math.Sqrt((double)(num559 * num559 + num560 * num560));
num561 = 12f / num561;
num559 *= num561;
num560 *= num561;
this.rotation = (float)Math.Atan2((double)num560, (double)num559) - 1.57f;
if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < 2f)
{
this.rotation = (float)Math.Atan2((double)num560, (double)num559) - 1.57f;
this.velocity.X = num559;
this.velocity.Y = num560;
this.netUpdate = true;
}
else
{
this.velocity *= 0.97f;
}
this.ai[3] += 1f;
if (this.ai[3] >= 600f)
{
this.ai[2] = 0f;
this.ai[3] = 0f;
this.netUpdate = true;
}
}
}
else
{
this.ai[3] += 1f;
if (this.ai[3] >= 600f)
{
this.ai[2] += 1f;
this.ai[3] = 0f;
this.netUpdate = true;
}
if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y + 300f)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y - 0.1f;
if (this.velocity.Y > 3f)
{
this.velocity.Y = 3f;
}
}
else
{
if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y + 230f)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y + 0.1f;
if (this.velocity.Y < -3f)
{
this.velocity.Y = -3f;
}
}
}
if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 250f)
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.94f;
}
this.velocity.X = this.velocity.X - 0.3f;
if (this.velocity.X > 9f)
{
this.velocity.X = 9f;
}
}
if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2))
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.94f;
}
this.velocity.X = this.velocity.X + 0.2f;
if (this.velocity.X < -8f)
{
this.velocity.X = -8f;
}
}
}
Vector2 vector63 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num562 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector63.X;
float num563 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector63.Y;
Math.Sqrt((double)(num562 * num562 + num563 * num563));
this.rotation = (float)Math.Atan2((double)num563, (double)num562) + 1.57f;
return;
}
if (this.ai[2] == 1f)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.9f;
}
Vector2 vector64 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num564 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 280f * this.ai[0] - vector64.X;
float num565 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector64.Y;
float num566 = (float)Math.Sqrt((double)(num564 * num564 + num565 * num565));
this.rotation = (float)Math.Atan2((double)num565, (double)num564) + 1.57f;
this.velocity.X = (this.velocity.X * 5f + Main.npc[(int)this.ai[1]].velocity.X) / 6f;
this.velocity.X = this.velocity.X + 0.5f;
this.velocity.Y = this.velocity.Y - 0.5f;
if (this.velocity.Y < -9f)
{
this.velocity.Y = -9f;
}
if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 280f)
{
this.TargetClosest(true);
this.ai[2] = 2f;
vector64 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num564 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector64.X;
num565 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector64.Y;
num566 = (float)Math.Sqrt((double)(num564 * num564 + num565 * num565));
num566 = 20f / num566;
this.velocity.X = num564 * num566;
this.velocity.Y = num565 * num566;
this.netUpdate = true;
return;
}
}
else
{
if (this.ai[2] == 2f)
{
if (this.position.Y > Main.player[this.target].position.Y || this.velocity.Y < 0f)
{
if (this.ai[3] >= 4f)
{
this.ai[2] = 3f;
this.ai[3] = 0f;
return;
}
this.ai[2] = 1f;
this.ai[3] += 1f;
return;
}
}
else
{
if (this.ai[2] == 4f)
{
Vector2 vector65 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num567 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector65.X;
float num568 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector65.Y;
float num569 = (float)Math.Sqrt((double)(num567 * num567 + num568 * num568));
this.rotation = (float)Math.Atan2((double)num568, (double)num567) + 1.57f;
this.velocity.Y = (this.velocity.Y * 5f + Main.npc[(int)this.ai[1]].velocity.Y) / 6f;
this.velocity.X = this.velocity.X + 0.5f;
if (this.velocity.X > 12f)
{
this.velocity.X = 12f;
}
if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 500f || this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 500f)
{
this.TargetClosest(true);
this.ai[2] = 5f;
vector65 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num567 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector65.X;
num568 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector65.Y;
num569 = (float)Math.Sqrt((double)(num567 * num567 + num568 * num568));
num569 = 17f / num569;
this.velocity.X = num567 * num569;
this.velocity.Y = num568 * num569;
this.netUpdate = true;
return;
}
}
else
{
if (this.ai[2] == 5f && this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - 100f)
{
if (this.ai[3] >= 4f)
{
this.ai[2] = 0f;
this.ai[3] = 0f;
return;
}
this.ai[2] = 4f;
this.ai[3] += 1f;
return;
}
}
}
}
}
}
else
{
if (this.aiStyle == 35)
{
this.spriteDirection = -(int)this.ai[0];
if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32)
{
this.ai[2] += 10f;
if (this.ai[2] > 50f || Main.netMode != 2)
{
this.life = -1;
this.HitEffect(0, 10.0);
this.active = false;
}
}
if (this.ai[2] == 0f)
{
if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10)
{
this.timeLeft = 10;
}
if (Main.npc[(int)this.ai[1]].ai[1] != 0f)
{
this.localAI[0] += 2f;
if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y - 0.07f;
if (this.velocity.Y > 6f)
{
this.velocity.Y = 6f;
}
}
else
{
if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y + 0.07f;
if (this.velocity.Y < -6f)
{
this.velocity.Y = -6f;
}
}
}
if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0])
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X > 8f)
{
this.velocity.X = 8f;
}
}
if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0])
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X < -8f)
{
this.velocity.X = -8f;
}
}
}
else
{
this.ai[3] += 1f;
if (this.ai[3] >= 1100f)
{
this.localAI[0] = 0f;
this.ai[2] = 1f;
this.ai[3] = 0f;
this.netUpdate = true;
}
if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y - 150f)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y - 0.04f;
if (this.velocity.Y > 3f)
{
this.velocity.Y = 3f;
}
}
else
{
if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 150f)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y + 0.04f;
if (this.velocity.Y < -3f)
{
this.velocity.Y = -3f;
}
}
}
if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 200f)
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X - 0.2f;
if (this.velocity.X > 8f)
{
this.velocity.X = 8f;
}
}
if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 160f)
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X + 0.2f;
if (this.velocity.X < -8f)
{
this.velocity.X = -8f;
}
}
}
Vector2 vector66 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num570 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector66.X;
float num571 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector66.Y;
float num572 = (float)Math.Sqrt((double)(num570 * num570 + num571 * num571));
this.rotation = (float)Math.Atan2((double)num571, (double)num570) + 1.57f;
if (Main.netMode != 1)
{
this.localAI[0] += 1f;
if (this.localAI[0] > 140f)
{
this.localAI[0] = 0f;
float num573 = 12f;
int num574 = 0;
int num575 = 102;
num572 = num573 / num572;
num570 = -num570 * num572;
num571 = -num571 * num572;
num570 += (float)Main.rand.Next(-40, 41) * 0.01f;
num571 += (float)Main.rand.Next(-40, 41) * 0.01f;
vector66.X += num570 * 4f;
vector66.Y += num571 * 4f;
Projectile.NewProjectile(vector66.X, vector66.Y, num570, num571, num575, num574, 0f, Main.myPlayer, 0f, 0f);
return;
}
}
}
else
{
if (this.ai[2] == 1f)
{
this.ai[3] += 1f;
if (this.ai[3] >= 300f)
{
this.localAI[0] = 0f;
this.ai[2] = 0f;
this.ai[3] = 0f;
this.netUpdate = true;
}
Vector2 vector67 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num576 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - vector67.X;
float num577 = Main.npc[(int)this.ai[1]].position.Y - vector67.Y;
num577 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 80f - vector67.Y;
float num578 = (float)Math.Sqrt((double)(num576 * num576 + num577 * num577));
num578 = 6f / num578;
num576 *= num578;
num577 *= num578;
if (this.velocity.X > num576)
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.9f;
}
this.velocity.X = this.velocity.X - 0.04f;
}
if (this.velocity.X < num576)
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.9f;
}
this.velocity.X = this.velocity.X + 0.04f;
}
if (this.velocity.Y > num577)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.9f;
}
this.velocity.Y = this.velocity.Y - 0.08f;
}
if (this.velocity.Y < num577)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.9f;
}
this.velocity.Y = this.velocity.Y + 0.08f;
}
this.TargetClosest(true);
vector67 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num576 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector67.X;
num577 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector67.Y;
num578 = (float)Math.Sqrt((double)(num576 * num576 + num577 * num577));
this.rotation = (float)Math.Atan2((double)num577, (double)num576) - 1.57f;
if (Main.netMode != 1)
{
this.localAI[0] += 1f;
if (this.localAI[0] > 40f)
{
this.localAI[0] = 0f;
float num579 = 10f;
int num580 = 0;
int num581 = 102;
num578 = num579 / num578;
num576 *= num578;
num577 *= num578;
num576 += (float)Main.rand.Next(-40, 41) * 0.01f;
num577 += (float)Main.rand.Next(-40, 41) * 0.01f;
vector67.X += num576 * 4f;
vector67.Y += num577 * 4f;
Projectile.NewProjectile(vector67.X, vector67.Y, num576, num577, num581, num580, 0f, Main.myPlayer, 0f, 0f);
return;
}
}
}
}
}
else
{
if (this.aiStyle == 36)
{
this.spriteDirection = -(int)this.ai[0];
if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32)
{
this.ai[2] += 10f;
if (this.ai[2] > 50f || Main.netMode != 2)
{
this.life = -1;
this.HitEffect(0, 10.0);
this.active = false;
}
}
if (this.ai[2] == 0f || this.ai[2] == 3f)
{
if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10)
{
this.timeLeft = 10;
}
if (Main.npc[(int)this.ai[1]].ai[1] != 0f)
{
this.localAI[0] += 3f;
if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y - 0.07f;
if (this.velocity.Y > 6f)
{
this.velocity.Y = 6f;
}
}
else
{
if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y + 0.07f;
if (this.velocity.Y < -6f)
{
this.velocity.Y = -6f;
}
}
}
if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0])
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X - 0.1f;
if (this.velocity.X > 8f)
{
this.velocity.X = 8f;
}
}
if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0])
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X + 0.1f;
if (this.velocity.X < -8f)
{
this.velocity.X = -8f;
}
}
}
else
{
this.ai[3] += 1f;
if (this.ai[3] >= 800f)
{
this.ai[2] += 1f;
this.ai[3] = 0f;
this.netUpdate = true;
}
if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y - 0.1f;
if (this.velocity.Y > 3f)
{
this.velocity.Y = 3f;
}
}
else
{
if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.96f;
}
this.velocity.Y = this.velocity.Y + 0.1f;
if (this.velocity.Y < -3f)
{
this.velocity.Y = -3f;
}
}
}
if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 180f * this.ai[0])
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X - 0.14f;
if (this.velocity.X > 8f)
{
this.velocity.X = 8f;
}
}
if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 180f * this.ai[0])
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.96f;
}
this.velocity.X = this.velocity.X + 0.14f;
if (this.velocity.X < -8f)
{
this.velocity.X = -8f;
}
}
}
this.TargetClosest(true);
Vector2 vector68 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num582 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector68.X;
float num583 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector68.Y;
float num584 = (float)Math.Sqrt((double)(num582 * num582 + num583 * num583));
this.rotation = (float)Math.Atan2((double)num583, (double)num582) - 1.57f;
if (Main.netMode != 1)
{
this.localAI[0] += 1f;
if (this.localAI[0] > 200f)
{
this.localAI[0] = 0f;
float num585 = 8f;
int num586 = 25;
int num587 = 100;
num584 = num585 / num584;
num582 *= num584;
num583 *= num584;
num582 += (float)Main.rand.Next(-40, 41) * 0.05f;
num583 += (float)Main.rand.Next(-40, 41) * 0.05f;
vector68.X += num582 * 8f;
vector68.Y += num583 * 8f;
Projectile.NewProjectile(vector68.X, vector68.Y, num582, num583, num587, num586, 0f, Main.myPlayer, 0f, 0f);
return;
}
}
}
else
{
if (this.ai[2] == 1f)
{
this.ai[3] += 1f;
if (this.ai[3] >= 200f)
{
this.localAI[0] = 0f;
this.ai[2] = 0f;
this.ai[3] = 0f;
this.netUpdate = true;
}
Vector2 vector69 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num588 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - 350f - vector69.X;
float num589 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 20f - vector69.Y;
float num590 = (float)Math.Sqrt((double)(num588 * num588 + num589 * num589));
num590 = 7f / num590;
num588 *= num590;
num589 *= num590;
if (this.velocity.X > num588)
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.9f;
}
this.velocity.X = this.velocity.X - 0.1f;
}
if (this.velocity.X < num588)
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.9f;
}
this.velocity.X = this.velocity.X + 0.1f;
}
if (this.velocity.Y > num589)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y * 0.9f;
}
this.velocity.Y = this.velocity.Y - 0.03f;
}
if (this.velocity.Y < num589)
{
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.9f;
}
this.velocity.Y = this.velocity.Y + 0.03f;
}
this.TargetClosest(true);
vector69 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num588 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector69.X;
num589 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector69.Y;
num590 = (float)Math.Sqrt((double)(num588 * num588 + num589 * num589));
this.rotation = (float)Math.Atan2((double)num589, (double)num588) - 1.57f;
if (Main.netMode == 1)
{
this.localAI[0] += 1f;
if (this.localAI[0] > 80f)
{
this.localAI[0] = 0f;
float num591 = 10f;
int num592 = 25;
int num593 = 100;
num590 = num591 / num590;
num588 *= num590;
num589 *= num590;
num588 += (float)Main.rand.Next(-40, 41) * 0.05f;
num589 += (float)Main.rand.Next(-40, 41) * 0.05f;
vector69.X += num588 * 8f;
vector69.Y += num589 * 8f;
Projectile.NewProjectile(vector69.X, vector69.Y, num588, num589, num593, num592, 0f, Main.myPlayer, 0f, 0f);
return;
}
}
}
}
}
else
{
if (this.aiStyle == 37)
{
if (this.ai[3] > 0f)
{
this.realLife = (int)this.ai[3];
}
if (this.target < 0 || this.target == 255 || Main.player[this.target].dead)
{
this.TargetClosest(true);
}
if (this.type > 134)
{
bool flag42 = false;
if (this.ai[1] <= 0f)
{
flag42 = true;
}
else
{
if (Main.npc[(int)this.ai[1]].life <= 0)
{
flag42 = true;
}
}
if (flag42)
{
this.life = 0;
this.HitEffect(0, 10.0);
this.checkDead();
}
}
if (Main.netMode != 1)
{
if (this.ai[0] == 0f && this.type == 134)
{
this.ai[3] = (float)this.whoAmI;
this.realLife = this.whoAmI;
int num594 = this.whoAmI;
int num595 = 80;
for (int num596 = 0; num596 <= num595; num596++)
{
int num597 = 135;
if (num596 == num595)
{
num597 = 136;
}
int num598 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), num597, this.whoAmI);
Main.npc[num598].ai[3] = (float)this.whoAmI;
Main.npc[num598].realLife = this.whoAmI;
Main.npc[num598].ai[1] = (float)num594;
Main.npc[num594].ai[0] = (float)num598;
NetMessage.SendData(23, -1, -1, "", num598, 0f, 0f, 0f, 0);
num594 = num598;
}
}
if (this.type == 135)
{
this.localAI[0] += (float)Main.rand.Next(4);
if (this.localAI[0] >= (float)Main.rand.Next(1400, 26000))
{
this.localAI[0] = 0f;
this.TargetClosest(true);
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
float num599 = 8f;
Vector2 vector70 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)(this.height / 2));
float num600 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector70.X + (float)Main.rand.Next(-20, 21);
float num601 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector70.Y + (float)Main.rand.Next(-20, 21);
float num602 = (float)Math.Sqrt((double)(num600 * num600 + num601 * num601));
num602 = num599 / num602;
num600 *= num602;
num601 *= num602;
num600 += (float)Main.rand.Next(-20, 21) * 0.05f;
num601 += (float)Main.rand.Next(-20, 21) * 0.05f;
int num603 = 22;
int num604 = 100;
vector70.X += num600 * 5f;
vector70.Y += num601 * 5f;
int num605 = Projectile.NewProjectile(vector70.X, vector70.Y, num600, num601, num604, num603, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num605].timeLeft = 300;
this.netUpdate = true;
}
}
}
}
int num606 = (int)(this.position.X / 16f) - 1;
int num607 = (int)((this.position.X + (float)this.width) / 16f) + 2;
int num608 = (int)(this.position.Y / 16f) - 1;
int num609 = (int)((this.position.Y + (float)this.height) / 16f) + 2;
if (num606 < 0)
{
num606 = 0;
}
if (num607 > Main.maxTilesX)
{
num607 = Main.maxTilesX;
}
if (num608 < 0)
{
num608 = 0;
}
if (num609 > Main.maxTilesY)
{
num609 = Main.maxTilesY;
}
bool flag43 = false;
if (!flag43)
{
for (int num610 = num606; num610 < num607; num610++)
{
for (int num611 = num608; num611 < num609; num611++)
{
if (Main.tile[num610, num611] != null && ((Main.tile[num610, num611].nactive() && (Main.tileSolid[(int)Main.tile[num610, num611].type] || (Main.tileSolidTop[(int)Main.tile[num610, num611].type] && Main.tile[num610, num611].frameY == 0))) || Main.tile[num610, num611].liquid > 64))
{
Vector2 vector71;
vector71.X = (float)(num610 * 16);
vector71.Y = (float)(num611 * 16);
if (this.position.X + (float)this.width > vector71.X && this.position.X < vector71.X + 16f && this.position.Y + (float)this.height > vector71.Y && this.position.Y < vector71.Y + 16f)
{
flag43 = true;
break;
}
}
}
}
}
if (!flag43)
{
if (this.type != 135 || this.ai[2] != 1f)
{
Lighting.addLight((int)((this.position.X + (float)(this.width / 2)) / 16f), (int)((this.position.Y + (float)(this.height / 2)) / 16f), 0.3f, 0.1f, 0.05f);
}
this.localAI[1] = 1f;
if (this.type == 134)
{
Rectangle rectangle11 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height);
int num612 = 1000;
bool flag44 = true;
if (this.position.Y > Main.player[this.target].position.Y)
{
for (int num613 = 0; num613 < 255; num613++)
{
if (Main.player[num613].active)
{
Rectangle rectangle12 = new Rectangle((int)Main.player[num613].position.X - num612, (int)Main.player[num613].position.Y - num612, num612 * 2, num612 * 2);
if (rectangle11.Intersects(rectangle12))
{
flag44 = false;
break;
}
}
}
if (flag44)
{
flag43 = true;
}
}
}
}
else
{
this.localAI[1] = 0f;
}
float num614 = 16f;
if (Main.dayTime || Main.player[this.target].dead)
{
flag43 = false;
this.velocity.Y = this.velocity.Y + 1f;
if ((double)this.position.Y > Main.worldSurface * 16.0)
{
this.velocity.Y = this.velocity.Y + 1f;
num614 = 32f;
}
if ((double)this.position.Y > Main.rockLayer * 16.0)
{
for (int num615 = 0; num615 < 200; num615++)
{
if (Main.npc[num615].aiStyle == this.aiStyle)
{
Main.npc[num615].active = false;
}
}
}
}
float num616 = 0.1f;
float num617 = 0.15f;
Vector2 vector72 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num618 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2);
float num619 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2);
num618 = (float)((int)(num618 / 16f) * 16);
num619 = (float)((int)(num619 / 16f) * 16);
vector72.X = (float)((int)(vector72.X / 16f) * 16);
vector72.Y = (float)((int)(vector72.Y / 16f) * 16);
num618 -= vector72.X;
num619 -= vector72.Y;
float num620 = (float)Math.Sqrt((double)(num618 * num618 + num619 * num619));
if (this.ai[1] > 0f && this.ai[1] < (float)Main.npc.Length)
{
try
{
vector72 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
num618 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - vector72.X;
num619 = Main.npc[(int)this.ai[1]].position.Y + (float)(Main.npc[(int)this.ai[1]].height / 2) - vector72.Y;
}
catch
{
}
this.rotation = (float)Math.Atan2((double)num619, (double)num618) + 1.57f;
num620 = (float)Math.Sqrt((double)(num618 * num618 + num619 * num619));
int num621 = (int)(44f * this.scale);
num620 = (num620 - (float)num621) / num620;
num618 *= num620;
num619 *= num620;
this.velocity = default(Vector2);
this.position.X = this.position.X + num618;
this.position.Y = this.position.Y + num619;
return;
}
if (!flag43)
{
this.TargetClosest(true);
this.velocity.Y = this.velocity.Y + 0.15f;
if (this.velocity.Y > num614)
{
this.velocity.Y = num614;
}
if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)num614 * 0.4)
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X - num616 * 1.1f;
}
else
{
this.velocity.X = this.velocity.X + num616 * 1.1f;
}
}
else
{
if (this.velocity.Y == num614)
{
if (this.velocity.X < num618)
{
this.velocity.X = this.velocity.X + num616;
}
else
{
if (this.velocity.X > num618)
{
this.velocity.X = this.velocity.X - num616;
}
}
}
else
{
if (this.velocity.Y > 4f)
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X + num616 * 0.9f;
}
else
{
this.velocity.X = this.velocity.X - num616 * 0.9f;
}
}
}
}
}
else
{
if (this.soundDelay == 0)
{
float num622 = num620 / 40f;
if (num622 < 10f)
{
num622 = 10f;
}
if (num622 > 20f)
{
num622 = 20f;
}
this.soundDelay = (int)num622;
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 1);
}
num620 = (float)Math.Sqrt((double)(num618 * num618 + num619 * num619));
float num623 = Math.Abs(num618);
float num624 = Math.Abs(num619);
float num625 = num614 / num620;
num618 *= num625;
num619 *= num625;
if (((this.velocity.X > 0f && num618 > 0f) || (this.velocity.X < 0f && num618 < 0f)) && ((this.velocity.Y > 0f && num619 > 0f) || (this.velocity.Y < 0f && num619 < 0f)))
{
if (this.velocity.X < num618)
{
this.velocity.X = this.velocity.X + num617;
}
else
{
if (this.velocity.X > num618)
{
this.velocity.X = this.velocity.X - num617;
}
}
if (this.velocity.Y < num619)
{
this.velocity.Y = this.velocity.Y + num617;
}
else
{
if (this.velocity.Y > num619)
{
this.velocity.Y = this.velocity.Y - num617;
}
}
}
if ((this.velocity.X > 0f && num618 > 0f) || (this.velocity.X < 0f && num618 < 0f) || (this.velocity.Y > 0f && num619 > 0f) || (this.velocity.Y < 0f && num619 < 0f))
{
if (this.velocity.X < num618)
{
this.velocity.X = this.velocity.X + num616;
}
else
{
if (this.velocity.X > num618)
{
this.velocity.X = this.velocity.X - num616;
}
}
if (this.velocity.Y < num619)
{
this.velocity.Y = this.velocity.Y + num616;
}
else
{
if (this.velocity.Y > num619)
{
this.velocity.Y = this.velocity.Y - num616;
}
}
if ((double)Math.Abs(num619) < (double)num614 * 0.2 && ((this.velocity.X > 0f && num618 < 0f) || (this.velocity.X < 0f && num618 > 0f)))
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y + num616 * 2f;
}
else
{
this.velocity.Y = this.velocity.Y - num616 * 2f;
}
}
if ((double)Math.Abs(num618) < (double)num614 * 0.2 && ((this.velocity.Y > 0f && num619 < 0f) || (this.velocity.Y < 0f && num619 > 0f)))
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X + num616 * 2f;
}
else
{
this.velocity.X = this.velocity.X - num616 * 2f;
}
}
}
else
{
if (num623 > num624)
{
if (this.velocity.X < num618)
{
this.velocity.X = this.velocity.X + num616 * 1.1f;
}
else
{
if (this.velocity.X > num618)
{
this.velocity.X = this.velocity.X - num616 * 1.1f;
}
}
if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)num614 * 0.5)
{
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y + num616;
}
else
{
this.velocity.Y = this.velocity.Y - num616;
}
}
}
else
{
if (this.velocity.Y < num619)
{
this.velocity.Y = this.velocity.Y + num616 * 1.1f;
}
else
{
if (this.velocity.Y > num619)
{
this.velocity.Y = this.velocity.Y - num616 * 1.1f;
}
}
if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)num614 * 0.5)
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X + num616;
}
else
{
this.velocity.X = this.velocity.X - num616;
}
}
}
}
}
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f;
if (this.type == 134)
{
if (flag43)
{
if (this.localAI[0] != 1f)
{
this.netUpdate = true;
}
this.localAI[0] = 1f;
}
else
{
if (this.localAI[0] != 0f)
{
this.netUpdate = true;
}
this.localAI[0] = 0f;
}
if (((this.velocity.X > 0f && this.oldVelocity.X < 0f) || (this.velocity.X < 0f && this.oldVelocity.X > 0f) || (this.velocity.Y > 0f && this.oldVelocity.Y < 0f) || (this.velocity.Y < 0f && this.oldVelocity.Y > 0f)) && !this.justHit)
{
this.netUpdate = true;
return;
}
}
}
else
{
if (this.aiStyle == 38)
{
float num626 = 4f;
float num627 = 1f;
if (this.type == 143)
{
num626 = 3f;
num627 = 0.7f;
}
if (this.type == 145)
{
num626 = 3.5f;
num627 = 0.8f;
}
if (this.type == 143)
{
this.ai[2] += 1f;
if (this.ai[2] >= 120f)
{
this.ai[2] = 0f;
if (Main.netMode != 1)
{
Vector2 vector73 = new Vector2(this.position.X + (float)this.width * 0.5f - (float)(this.direction * 12), this.position.Y + (float)this.height * 0.5f);
float speedX = (float)(12 * this.spriteDirection);
float speedY = 0f;
if (Main.netMode != 1)
{
int num628 = 25;
int num629 = 110;
int num630 = Projectile.NewProjectile(vector73.X, vector73.Y, speedX, speedY, num629, num628, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num630].ai[0] = 2f;
Main.projectile[num630].timeLeft = 300;
Main.projectile[num630].friendly = false;
NetMessage.SendData(27, -1, -1, "", num630, 0f, 0f, 0f, 0);
this.netUpdate = true;
}
}
}
}
if (this.type == 144 && this.ai[1] >= 3f)
{
this.TargetClosest(true);
this.spriteDirection = this.direction;
if (this.velocity.Y == 0f)
{
this.velocity.X = this.velocity.X * 0.9f;
this.ai[2] += 1f;
if ((double)this.velocity.X > -0.3 && (double)this.velocity.X < 0.3)
{
this.velocity.X = 0f;
}
if (this.ai[2] >= 200f)
{
this.ai[2] = 0f;
this.ai[1] = 0f;
}
}
}
else
{
if (this.type == 145 && this.ai[1] >= 3f)
{
this.TargetClosest(true);
if (this.velocity.Y == 0f)
{
this.velocity.X = this.velocity.X * 0.9f;
this.ai[2] += 1f;
if ((double)this.velocity.X > -0.3 && (double)this.velocity.X < 0.3)
{
this.velocity.X = 0f;
}
if (this.ai[2] >= 16f)
{
this.ai[2] = 0f;
this.ai[1] = 0f;
}
}
if (this.velocity.X == 0f && this.velocity.Y == 0f && this.ai[2] == 8f)
{
float num631 = 10f;
Vector2 vector74 = new Vector2(this.position.X + (float)this.width * 0.5f - (float)(this.direction * 12), this.position.Y + (float)this.height * 0.25f);
float num632 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector74.X;
float num633 = Main.player[this.target].position.Y - vector74.Y;
float num634 = (float)Math.Sqrt((double)(num632 * num632 + num633 * num633));
num634 = num631 / num634;
num632 *= num634;
num633 *= num634;
if (Main.netMode != 1)
{
int num635 = 35;
int num636 = 109;
int num637 = Projectile.NewProjectile(vector74.X, vector74.Y, num632, num633, num636, num635, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num637].ai[0] = 2f;
Main.projectile[num637].timeLeft = 300;
Main.projectile[num637].friendly = false;
NetMessage.SendData(27, -1, -1, "", num637, 0f, 0f, 0f, 0);
this.netUpdate = true;
}
}
}
else
{
if (this.velocity.Y == 0f)
{
if (this.localAI[2] == this.position.X)
{
this.direction *= -1;
this.ai[3] = 60f;
}
this.localAI[2] = this.position.X;
if (this.ai[3] == 0f)
{
this.TargetClosest(true);
}
this.ai[0] += 1f;
if (this.ai[0] > 2f)
{
this.ai[0] = 0f;
this.ai[1] += 1f;
this.velocity.Y = -8.2f;
this.velocity.X = this.velocity.X + (float)this.direction * num627 * 1.1f;
}
else
{
this.velocity.Y = -6f;
this.velocity.X = this.velocity.X + (float)this.direction * num627 * 0.9f;
}
this.spriteDirection = this.direction;
}
this.velocity.X = this.velocity.X + (float)this.direction * num627 * 0.01f;
}
}
if (this.ai[3] > 0f)
{
this.ai[3] -= 1f;
}
if (this.velocity.X > num626 && this.direction > 0)
{
this.velocity.X = 4f;
}
if (this.velocity.X < -num626 && this.direction < 0)
{
this.velocity.X = -4f;
return;
}
}
else
{
if (this.aiStyle == 39)
{
if (this.target < 0 || Main.player[this.target].dead || this.direction == 0)
{
this.TargetClosest(true);
}
bool flag45 = true;
int num638 = 0;
if (this.velocity.X < 0f)
{
num638 = -1;
}
if (this.velocity.X > 0f)
{
num638 = 1;
}
Vector2 vector75 = this.position;
vector75.X += this.velocity.X;
int num639 = (int)((vector75.X + (float)(this.width / 2) + (float)((this.width / 2 + 1) * num638)) / 16f);
int num640 = (int)((vector75.Y + (float)this.height - 1f) / 16f);
if ((float)(num639 * 16) < vector75.X + (float)this.width && (float)(num639 * 16 + 16) > vector75.X && ((Main.tile[num639, num640].nactive() && Main.tile[num639, num640].slope() == 0 && Main.tile[num639, num640 - 1].slope() == 0 && ((Main.tileSolid[(int)Main.tile[num639, num640].type] && !Main.tileSolidTop[(int)Main.tile[num639, num640].type]) || (flag45 && Main.tileSolidTop[(int)Main.tile[num639, num640].type] && (!Main.tileSolid[(int)Main.tile[num639, num640 - 1].type] || !Main.tile[num639, num640 - 1].nactive()) && Main.tile[num639, num640].type != 16 && Main.tile[num639, num640].type != 18 && Main.tile[num639, num640].type != 134))) || (Main.tile[num639, num640 - 1].halfBrick() && Main.tile[num639, num640 - 1].nactive())) && (!Main.tile[num639, num640 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num639, num640 - 1].type] || Main.tileSolidTop[(int)Main.tile[num639, num640 - 1].type] || (Main.tile[num639, num640 - 1].halfBrick() && (!Main.tile[num639, num640 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num639, num640 - 4].type] || Main.tileSolidTop[(int)Main.tile[num639, num640 - 4].type]))) && (!Main.tile[num639, num640 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num639, num640 - 2].type] || Main.tileSolidTop[(int)Main.tile[num639, num640 - 2].type]) && (!Main.tile[num639, num640 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num639, num640 - 3].type] || Main.tileSolidTop[(int)Main.tile[num639, num640 - 3].type]) && (!Main.tile[num639 - num638, num640 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num639 - num638, num640 - 3].type] || Main.tileSolidTop[(int)Main.tile[num639 - num638, num640 - 3].type]))
{
float num641 = (float)(num640 * 16);
if (Main.tile[num639, num640].halfBrick())
{
num641 += 8f;
}
if (Main.tile[num639, num640 - 1].halfBrick())
{
num641 -= 8f;
}
if (num641 < vector75.Y + (float)this.height)
{
float num642 = vector75.Y + (float)this.height - num641;
if ((double)num642 <= 16.1)
{
this.gfxOffY += this.position.Y + (float)this.height - num641;
this.position.Y = num641 - (float)this.height;
if (num642 < 9f)
{
this.stepSpeed = 0.75f;
}
else
{
this.stepSpeed = 1.5f;
}
}
}
}
if (this.justHit)
{
this.ai[0] = 0f;
this.ai[1] = 0f;
this.TargetClosest(true);
}
if (this.type == 154 && Main.rand.Next(10) == 0)
{
int num643 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 67, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 90, default(Color), 1.5f);
Main.dust[num643].noGravity = true;
Main.dust[num643].velocity *= 0.2f;
}
if (this.ai[0] == 0f)
{
if (this.velocity.X < 0f)
{
this.direction = -1;
}
else
{
if (this.velocity.X > 0f)
{
this.direction = 1;
}
}
this.spriteDirection = this.direction;
Vector2 vector76 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num644 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector76.X;
float num645 = Main.player[this.target].position.Y - vector76.Y;
float num646 = (float)Math.Sqrt((double)(num644 * num644 + num645 * num645));
bool flag46 = Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height);
if (num646 > 200f && flag46)
{
this.ai[1] += 4f;
}
if (num646 > 600f && (flag46 || this.position.Y + (float)this.height > Main.player[this.target].position.Y - 200f))
{
this.ai[1] += 10f;
}
if (this.wet)
{
this.ai[1] = 1000f;
}
this.defense = 30;
this.damage = 80;
this.knockBackResist = 0.3f;
this.ai[1] += 1f;
if (this.ai[1] >= 400f)
{
this.ai[1] = 0f;
this.ai[0] = 1f;
}
if (!this.justHit && this.velocity.X != this.oldVelocity.X)
{
this.direction *= -1;
}
if (this.velocity.Y == 0f && Main.player[this.target].position.Y < this.position.Y + (float)this.height)
{
int num647;
int num648;
if (this.direction > 0)
{
num647 = (int)(((double)this.position.X + (double)this.width * 0.5) / 16.0);
num648 = num647 + 3;
}
else
{
num648 = (int)(((double)this.position.X + (double)this.width * 0.5) / 16.0);
num647 = num648 - 3;
}
int num649 = (int)((this.position.Y + (float)this.height + 2f) / 16f) - 1;
int num650 = num649 + 4;
bool flag47 = false;
for (int num651 = num647; num651 <= num648; num651++)
{
for (int num652 = num649; num652 <= num650; num652++)
{
if (Main.tile[num651, num652] != null && Main.tile[num651, num652].nactive() && Main.tileSolid[(int)Main.tile[num651, num652].type])
{
flag47 = true;
}
}
}
if (!flag47)
{
this.direction *= -1;
this.velocity.X = 0.1f * (float)this.direction;
}
}
if (num646 < 400f)
{
if (this.velocity.X < -1f || this.velocity.X > 1f)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.8f;
return;
}
}
else
{
if (this.velocity.X < 1f && this.direction == 1)
{
this.velocity.X = this.velocity.X + 0.07f;
if (this.velocity.X > 1f)
{
this.velocity.X = 1f;
return;
}
}
else
{
if (this.velocity.X > -1f && this.direction == -1)
{
this.velocity.X = this.velocity.X - 0.07f;
if (this.velocity.X < -1f)
{
this.velocity.X = -1f;
return;
}
}
}
}
}
else
{
if (this.velocity.X < -1.5f || this.velocity.X > 1.5f)
{
if (this.velocity.Y == 0f)
{
this.velocity *= 0.8f;
return;
}
}
else
{
if (this.velocity.X < 1.5f && this.direction == 1)
{
this.velocity.X = this.velocity.X + 0.07f;
if (this.velocity.X > 1.5f)
{
this.velocity.X = 1.5f;
return;
}
}
else
{
if (this.velocity.X > -1.5f && this.direction == -1)
{
this.velocity.X = this.velocity.X - 0.07f;
if (this.velocity.X < -1.5f)
{
this.velocity.X = -1.5f;
return;
}
}
}
}
}
}
else
{
if (this.ai[0] == 1f)
{
this.velocity.X = this.velocity.X * 0.5f;
this.ai[1] += 1f;
if (this.ai[1] >= 30f)
{
this.netUpdate = true;
this.TargetClosest(true);
this.ai[1] = 0f;
this.ai[0] = 3f;
this.ai[2] = 0f;
return;
}
}
else
{
if (this.ai[0] == 3f)
{
if (this.type == 154 && Main.rand.Next(3) < 2)
{
int num653 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 67, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 90, default(Color), 1.5f);
Main.dust[num653].noGravity = true;
Main.dust[num653].velocity *= 0.2f;
}
this.damage = 120;
this.defense = 70;
this.ai[1] += 1f;
if (this.ai[1] == 1f)
{
this.netUpdate = true;
this.TargetClosest(true);
this.ai[2] += 0.3f;
this.rotation += this.ai[2] * (float)this.direction;
this.ai[1] += 1f;
bool flag48 = Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height);
float num654 = 10f;
if (!flag48)
{
num654 = 6f;
}
Vector2 vector77 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num655 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector77.X;
float num656 = Math.Abs(num655) * 0.2f;
if (this.directionY > 0)
{
num656 = 0f;
}
float num657 = Main.player[this.target].position.Y - vector77.Y - num656;
float num658 = (float)Math.Sqrt((double)(num655 * num655 + num657 * num657));
this.netUpdate = true;
num658 = num654 / num658;
num655 *= num658;
num657 *= num658;
if (!flag48)
{
num657 = -10f;
}
this.velocity.X = num655;
this.velocity.Y = num657;
this.ai[3] = this.velocity.X;
}
else
{
if (this.position.X + (float)this.width > Main.player[this.target].position.X && this.position.X < Main.player[this.target].position.X + (float)Main.player[this.target].width && this.position.Y < Main.player[this.target].position.Y + (float)Main.player[this.target].height)
{
this.velocity.X = this.velocity.X * 0.8f;
this.ai[3] = 0f;
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y + 0.2f;
}
}
if (this.ai[3] != 0f)
{
this.velocity.X = this.ai[3];
this.velocity.Y = this.velocity.Y - 0.22f;
}
if (this.ai[1] >= 90f)
{
this.noGravity = false;
this.ai[1] = 0f;
this.ai[0] = 4f;
}
}
if (this.wet && this.directionY < 0)
{
this.velocity.Y = this.velocity.Y - 0.3f;
}
this.rotation += this.ai[2] * (float)this.direction;
return;
}
if (this.ai[0] == 4f)
{
if (this.wet && this.directionY < 0)
{
this.velocity.Y = this.velocity.Y - 0.3f;
}
this.velocity.X = this.velocity.X * 0.96f;
if (this.ai[2] > 0f)
{
this.ai[2] -= 0.01f;
this.rotation += this.ai[2] * (float)this.direction;
}
else
{
if (this.velocity.Y >= 0f)
{
this.rotation = 0f;
}
}
if (this.ai[2] <= 0f && (this.velocity.Y == 0f || this.wet))
{
this.netUpdate = true;
this.rotation = 0f;
this.ai[2] = 0f;
this.ai[1] = 0f;
this.ai[0] = 5f;
return;
}
}
else
{
if (this.ai[0] == 5f)
{
this.rotation = 0f;
this.velocity.X = 0f;
this.ai[1] += 1f;
if (this.ai[1] >= 30f)
{
this.TargetClosest(true);
this.netUpdate = true;
this.ai[1] = 0f;
this.ai[0] = 0f;
}
if (this.wet)
{
this.ai[0] = 3f;
this.ai[1] = 0f;
return;
}
}
}
}
}
}
else
{
if (this.aiStyle == 40)
{
if (this.target < 0 || this.target == 255 || Main.player[this.target].dead)
{
this.TargetClosest(true);
}
float num659 = 2f;
float num660 = 0.08f;
Vector2 vector78 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num661 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2);
float num662 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2);
num661 = (float)((int)(num661 / 8f) * 8);
num662 = (float)((int)(num662 / 8f) * 8);
vector78.X = (float)((int)(vector78.X / 8f) * 8);
vector78.Y = (float)((int)(vector78.Y / 8f) * 8);
num661 -= vector78.X;
num662 -= vector78.Y;
float num663 = (float)Math.Sqrt((double)(num661 * num661 + num662 * num662));
if (num663 == 0f)
{
num661 = this.velocity.X;
num662 = this.velocity.Y;
}
else
{
num663 = num659 / num663;
num661 *= num663;
num662 *= num663;
}
if (Main.player[this.target].dead)
{
num661 = (float)this.direction * num659 / 2f;
num662 = -num659 / 2f;
}
this.spriteDirection = -1;
if (!Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.ai[0] += 1f;
if (this.ai[0] > 0f)
{
this.velocity.Y = this.velocity.Y + 0.023f;
}
else
{
this.velocity.Y = this.velocity.Y - 0.023f;
}
if (this.ai[0] < -100f || this.ai[0] > 100f)
{
this.velocity.X = this.velocity.X + 0.023f;
}
else
{
this.velocity.X = this.velocity.X - 0.023f;
}
if (this.ai[0] > 200f)
{
this.ai[0] = -200f;
}
this.velocity.X = this.velocity.X + num661 * 0.007f;
this.velocity.Y = this.velocity.Y + num662 * 0.007f;
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
if ((double)this.velocity.X > 1.5)
{
this.velocity.X = this.velocity.X * 0.9f;
}
if ((double)this.velocity.X < -1.5)
{
this.velocity.X = this.velocity.X * 0.9f;
}
if ((double)this.velocity.Y > 1.5)
{
this.velocity.Y = this.velocity.Y * 0.9f;
}
if ((double)this.velocity.Y < -1.5)
{
this.velocity.Y = this.velocity.Y * 0.9f;
}
if (this.velocity.X > 3f)
{
this.velocity.X = 3f;
}
if (this.velocity.X < -3f)
{
this.velocity.X = -3f;
}
if (this.velocity.Y > 3f)
{
this.velocity.Y = 3f;
}
if (this.velocity.Y < -3f)
{
this.velocity.Y = -3f;
}
}
else
{
if (this.velocity.X < num661)
{
this.velocity.X = this.velocity.X + num660;
if (this.velocity.X < 0f && num661 > 0f)
{
this.velocity.X = this.velocity.X + num660;
}
}
else
{
if (this.velocity.X > num661)
{
this.velocity.X = this.velocity.X - num660;
if (this.velocity.X > 0f && num661 < 0f)
{
this.velocity.X = this.velocity.X - num660;
}
}
}
if (this.velocity.Y < num662)
{
this.velocity.Y = this.velocity.Y + num660;
if (this.velocity.Y < 0f && num662 > 0f)
{
this.velocity.Y = this.velocity.Y + num660;
}
}
else
{
if (this.velocity.Y > num662)
{
this.velocity.Y = this.velocity.Y - num660;
if (this.velocity.Y > 0f && num662 < 0f)
{
this.velocity.Y = this.velocity.Y - num660;
}
}
}
this.rotation = (float)Math.Atan2((double)num662, (double)num661);
}
float num664 = 0.5f;
if (this.collideX)
{
this.netUpdate = true;
this.velocity.X = this.oldVelocity.X * -num664;
if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f)
{
this.velocity.X = 2f;
}
if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f)
{
this.velocity.X = -2f;
}
}
if (this.collideY)
{
this.netUpdate = true;
this.velocity.Y = this.oldVelocity.Y * -num664;
if (this.velocity.Y > 0f && (double)this.velocity.Y < 1.5)
{
this.velocity.Y = 2f;
}
if (this.velocity.Y < 0f && (double)this.velocity.Y > -1.5)
{
this.velocity.Y = -2f;
}
}
if (((this.velocity.X > 0f && this.oldVelocity.X < 0f) || (this.velocity.X < 0f && this.oldVelocity.X > 0f) || (this.velocity.Y > 0f && this.oldVelocity.Y < 0f) || (this.velocity.Y < 0f && this.oldVelocity.Y > 0f)) && !this.justHit)
{
this.netUpdate = true;
}
if (Main.netMode != 1)
{
int num665 = (int)this.center().X / 16;
int num666 = (int)this.center().Y / 16;
bool flag49 = false;
for (int num667 = num665 - 1; num667 <= num665 + 1; num667++)
{
for (int num668 = num666 - 1; num668 <= num666 + 1; num668++)
{
if (Main.tile[num667, num668].wall > 0)
{
flag49 = true;
}
}
}
if (!flag49)
{
if (this.type == 237)
{
this.Transform(236);
return;
}
if (this.type == 238)
{
this.Transform(163);
return;
}
if (this.type == 240)
{
this.Transform(239);
return;
}
this.Transform(164);
return;
}
}
}
else
{
if (this.aiStyle == 41)
{
if (this.ai[2] > 1f)
{
this.ai[2] -= 1f;
}
if (this.ai[2] == 0f)
{
this.ai[0] = -100f;
this.ai[2] = 1f;
this.TargetClosest(true);
this.spriteDirection = this.direction;
}
if (this.wet && this.type != 177)
{
if (this.collideX)
{
this.direction *= -this.direction;
this.spriteDirection = this.direction;
}
if (this.collideY)
{
this.TargetClosest(true);
if (this.oldVelocity.Y < 0f)
{
this.velocity.Y = 5f;
}
else
{
this.velocity.Y = this.velocity.Y - 2f;
}
this.spriteDirection = this.direction;
}
if (this.velocity.Y > 4f)
{
this.velocity.Y = this.velocity.Y * 0.95f;
}
this.velocity.Y = this.velocity.Y - 0.3f;
if (this.velocity.Y < -4f)
{
this.velocity.Y = -4f;
}
}
if (this.velocity.Y == 0f)
{
if (this.ai[3] == this.position.X)
{
this.direction *= -1;
this.ai[2] = 300f;
}
this.ai[3] = 0f;
this.velocity.X = this.velocity.X * 0.8f;
if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1)
{
this.velocity.X = 0f;
}
if (this.type == 177)
{
this.ai[0] += 2f;
}
else
{
this.ai[0] += 5f;
}
Vector2 vector79 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num669 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector79.X;
float num670 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector79.Y;
float num671 = (float)Math.Sqrt((double)(num669 * num669 + num670 * num670));
float num672 = 400f / num671;
if (this.type == 177)
{
num672 *= 5f;
}
else
{
num672 *= 10f;
}
if (num672 > 30f)
{
num672 = 30f;
}
this.ai[0] += (float)((int)num672);
if (this.ai[0] >= 0f)
{
this.netUpdate = true;
if (this.ai[2] == 1f)
{
this.TargetClosest(true);
}
if (this.type == 177)
{
if (this.ai[1] == 2f)
{
this.velocity.Y = -11.5f;
this.velocity.X = this.velocity.X + 2f * (float)this.direction;
if (num671 < 350f && num671 > 200f)
{
this.velocity.X = this.velocity.X + (float)this.direction;
}
this.ai[0] = -200f;
this.ai[1] = 0f;
this.ai[3] = this.position.X;
}
else
{
this.velocity.Y = -7.5f;
this.velocity.X = this.velocity.X + (float)(4 * this.direction);
if (num671 < 350f && num671 > 200f)
{
this.velocity.X = this.velocity.X + (float)this.direction;
}
this.ai[0] = -120f;
this.ai[1] += 1f;
}
}
else
{
if (this.ai[1] == 3f)
{
this.velocity.Y = -9f;
this.velocity.X = this.velocity.X + (float)(3 * this.direction);
if (num671 < 350f && num671 > 200f)
{
this.velocity.X = this.velocity.X + (float)this.direction;
}
this.ai[0] = -200f;
this.ai[1] = 0f;
this.ai[3] = this.position.X;
}
else
{
this.velocity.Y = -5f;
this.velocity.X = this.velocity.X + (float)(5 * this.direction);
if (num671 < 350f && num671 > 200f)
{
this.velocity.X = this.velocity.X + (float)this.direction;
}
this.ai[0] = -120f;
this.ai[1] += 1f;
}
}
}
else
{
if (this.ai[0] >= -30f)
{
this.aiAction = 1;
}
}
this.spriteDirection = this.direction;
return;
}
if (this.target < 255)
{
if (this.type == 177)
{
bool flag50 = false;
if (this.position.Y + (float)this.height < Main.player[this.target].position.Y && this.position.X + (float)this.width > Main.player[this.target].position.X && this.position.X < Main.player[this.target].position.X + (float)Main.player[this.target].width)
{
flag50 = true;
this.velocity.X = this.velocity.X * 0.92f;
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.9f;
this.velocity.Y = this.velocity.Y + 0.1f;
}
}
if (!flag50 && ((this.direction == 1 && this.velocity.X < 4f) || (this.direction == -1 && this.velocity.X > -4f)))
{
if ((this.direction == -1 && (double)this.velocity.X < 0.1) || (this.direction == 1 && (double)this.velocity.X > -0.1))
{
this.velocity.X = this.velocity.X + 0.2f * (float)this.direction;
return;
}
this.velocity.X = this.velocity.X * 0.93f;
return;
}
}
else
{
if ((this.direction == 1 && this.velocity.X < 3f) || (this.direction == -1 && this.velocity.X > -3f))
{
if ((this.direction == -1 && (double)this.velocity.X < 0.1) || (this.direction == 1 && (double)this.velocity.X > -0.1))
{
this.velocity.X = this.velocity.X + 0.2f * (float)this.direction;
return;
}
this.velocity.X = this.velocity.X * 0.93f;
return;
}
}
}
}
else
{
if (this.aiStyle == 42)
{
this.TargetClosest(true);
if (this.ai[0] == 0f)
{
if (this.target >= 0)
{
Vector2 vector80 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num673 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector80.X;
float num674 = Main.player[this.target].position.Y - vector80.Y;
float num675 = (float)Math.Sqrt((double)(num673 * num673 + num674 * num674));
if (num675 < 200f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.ai[0] = 1f;
}
}
if (this.velocity.X != 0f || this.velocity.Y < 0f || this.velocity.Y > 2f || this.life != this.lifeMax)
{
this.ai[0] = 1f;
return;
}
}
else
{
this.ai[0] += 1f;
if (this.ai[0] >= 21f)
{
this.ai[0] = 21f;
this.Transform(196);
return;
}
}
}
else
{
if (this.aiStyle == 43)
{
if (this.target == -1 || Main.player[this.target].dead || !Main.player[this.target].active)
{
this.TargetClosest(true);
}
if (this.ai[0] == -1f && Main.netMode != 1)
{
float num676 = this.ai[1];
int num677;
do
{
num677 = Main.rand.Next(3);
if (num677 == 1)
{
num677 = 2;
}
else
{
if (num677 == 2)
{
num677 = 3;
}
}
}
while ((float)num677 == num676);
this.ai[0] = (float)num677;
this.ai[1] = 0f;
this.ai[2] = 0f;
}
if (this.ai[0] == 0f)
{
if (this.ai[1] > 4f && this.ai[1] % 2f == 0f)
{
this.ai[0] = -1f;
this.ai[1] = 0f;
this.ai[2] = 0f;
this.netUpdate = true;
}
else
{
if (this.ai[1] % 2f == 0f)
{
this.TargetClosest(true);
if (Math.Abs(this.position.Y + (float)(this.height / 2) - (Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2))) < 20f)
{
this.localAI[0] = 1f;
this.ai[1] += 1f;
this.ai[2] = 0f;
float num678 = 12f;
Vector2 vector81 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num679 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector81.X;
float num680 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector81.Y;
float num681 = (float)Math.Sqrt((double)(num679 * num679 + num680 * num680));
num681 = num678 / num681;
this.velocity.X = num679 * num681;
this.velocity.Y = num680 * num681;
this.spriteDirection = this.direction;
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
}
else
{
this.localAI[0] = 0f;
if (this.position.Y + (float)(this.height / 2) < Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2))
{
this.velocity.Y = this.velocity.Y + 0.15f;
}
else
{
this.velocity.Y = this.velocity.Y - 0.15f;
}
if (this.velocity.Y < -12f)
{
this.velocity.Y = -12f;
}
if (this.velocity.Y > 12f)
{
this.velocity.Y = 12f;
}
if (Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) > 600f)
{
this.velocity.X = this.velocity.X + 0.15f * (float)this.direction;
}
else
{
if (Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) < 300f)
{
this.velocity.X = this.velocity.X - 0.15f * (float)this.direction;
}
else
{
this.velocity.X = this.velocity.X * 0.8f;
}
}
if (this.velocity.X < -16f)
{
this.velocity.X = -16f;
}
if (this.velocity.X > 16f)
{
this.velocity.X = 16f;
}
this.spriteDirection = this.direction;
}
}
else
{
if (this.velocity.X < 0f)
{
this.direction = -1;
}
else
{
this.direction = 1;
}
this.spriteDirection = this.direction;
int num682 = 1;
if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))
{
num682 = -1;
}
if (this.direction == num682 && Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) > 600f)
{
this.ai[2] = 1f;
}
if (this.ai[2] == 1f)
{
this.TargetClosest(true);
this.spriteDirection = this.direction;
this.localAI[0] = 0f;
this.velocity *= 0.9f;
if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < 0.1)
{
this.ai[2] = 0f;
this.ai[1] += 1f;
}
}
else
{
this.localAI[0] = 1f;
}
}
}
}
if (this.ai[0] == 2f)
{
this.TargetClosest(true);
this.spriteDirection = this.direction;
float num683 = 12f;
float num684 = 0.07f;
Vector2 vector82 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num685 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector82.X;
float num686 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 200f - vector82.Y;
float num687 = (float)Math.Sqrt((double)(num685 * num685 + num686 * num686));
if (num687 < 200f)
{
this.ai[0] = 1f;
this.ai[1] = 0f;
this.netUpdate = true;
}
else
{
num687 = num683 / num687;
if (this.velocity.X < num685)
{
this.velocity.X = this.velocity.X + num684;
if (this.velocity.X < 0f && num685 > 0f)
{
this.velocity.X = this.velocity.X + num684;
}
}
else
{
if (this.velocity.X > num685)
{
this.velocity.X = this.velocity.X - num684;
if (this.velocity.X > 0f && num685 < 0f)
{
this.velocity.X = this.velocity.X - num684;
}
}
}
if (this.velocity.Y < num686)
{
this.velocity.Y = this.velocity.Y + num684;
if (this.velocity.Y < 0f && num686 > 0f)
{
this.velocity.Y = this.velocity.Y + num684;
}
}
else
{
if (this.velocity.Y > num686)
{
this.velocity.Y = this.velocity.Y - num684;
if (this.velocity.Y > 0f && num686 < 0f)
{
this.velocity.Y = this.velocity.Y - num684;
}
}
}
}
}
if (this.ai[0] == 1f)
{
this.localAI[0] = 0f;
this.TargetClosest(true);
Vector2 vector83 = new Vector2(this.position.X + (float)(this.width / 2) + (float)(Main.rand.Next(20) * this.direction), this.position.Y + (float)this.height * 0.8f);
Vector2 vector84 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num688 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector84.X;
float num689 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector84.Y;
float num690 = (float)Math.Sqrt((double)(num688 * num688 + num689 * num689));
if (Collision.CanHit(vector83, 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
this.ai[1] += 1f;
if (this.ai[1] > 40f)
{
this.ai[1] = 0f;
this.ai[2] += 1f;
Main.PlaySound(3, (int)this.position.X, (int)this.position.Y, 1);
if (Main.netMode != 1)
{
int num691 = Main.rand.Next(210, 212);
int num692 = NPC.NewNPC((int)vector83.X, (int)vector83.Y, num691, 0);
Main.npc[num692].velocity.X = (float)Main.rand.Next(-200, 201) * 0.002f;
Main.npc[num692].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.002f;
Main.npc[num692].localAI[0] = 60f;
Main.npc[num692].netUpdate = true;
}
}
}
if (num690 > 400f || !Collision.CanHit(new Vector2(vector83.X, vector83.Y - 30f), 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
float num693 = 14f;
float num694 = 0.1f;
vector84 = vector83;
num688 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector84.X;
num689 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector84.Y;
num690 = (float)Math.Sqrt((double)(num688 * num688 + num689 * num689));
num690 = num693 / num690;
if (this.velocity.X < num688)
{
this.velocity.X = this.velocity.X + num694;
if (this.velocity.X < 0f && num688 > 0f)
{
this.velocity.X = this.velocity.X + num694;
}
}
else
{
if (this.velocity.X > num688)
{
this.velocity.X = this.velocity.X - num694;
if (this.velocity.X > 0f && num688 < 0f)
{
this.velocity.X = this.velocity.X - num694;
}
}
}
if (this.velocity.Y < num689)
{
this.velocity.Y = this.velocity.Y + num694;
if (this.velocity.Y < 0f && num689 > 0f)
{
this.velocity.Y = this.velocity.Y + num694;
}
}
else
{
if (this.velocity.Y > num689)
{
this.velocity.Y = this.velocity.Y - num694;
if (this.velocity.Y > 0f && num689 < 0f)
{
this.velocity.Y = this.velocity.Y - num694;
}
}
}
}
else
{
this.velocity *= 0.9f;
}
this.spriteDirection = this.direction;
if (this.ai[2] > 5f)
{
this.ai[0] = -1f;
this.ai[1] = 1f;
this.netUpdate = true;
}
}
if (this.ai[0] == 3f)
{
float num695 = 4f;
float num696 = 0.05f;
Vector2 vector85 = new Vector2(this.position.X + (float)(this.width / 2) + (float)(Main.rand.Next(20) * this.direction), this.position.Y + (float)this.height * 0.8f);
Vector2 vector86 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num697 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector86.X;
float num698 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 300f - vector86.Y;
float num699 = (float)Math.Sqrt((double)(num697 * num697 + num698 * num698));
this.ai[1] += 1f;
if (this.ai[1] % 40f == 39f && this.position.Y + (float)this.height < Main.player[this.target].position.Y && Collision.CanHit(vector85, 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 17);
if (Main.netMode != 1)
{
float num700 = 8f;
float num701 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector85.X + (float)Main.rand.Next(-80, 81);
float num702 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector85.Y + (float)Main.rand.Next(-40, 41);
float num703 = (float)Math.Sqrt((double)(num701 * num701 + num702 * num702));
num703 = num700 / num703;
num701 *= num703;
num702 *= num703;
int num704 = 11;
int num705 = 55;
int num706 = Projectile.NewProjectile(vector85.X, vector85.Y, num701, num702, num705, num704, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num706].timeLeft = 300;
}
}
if (!Collision.CanHit(new Vector2(vector85.X, vector85.Y - 30f), 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
num695 = 14f;
num696 = 0.1f;
vector86 = vector85;
num697 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector86.X;
num698 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector86.Y;
num699 = (float)Math.Sqrt((double)(num697 * num697 + num698 * num698));
num699 = num695 / num699;
if (this.velocity.X < num697)
{
this.velocity.X = this.velocity.X + num696;
if (this.velocity.X < 0f && num697 > 0f)
{
this.velocity.X = this.velocity.X + num696;
}
}
else
{
if (this.velocity.X > num697)
{
this.velocity.X = this.velocity.X - num696;
if (this.velocity.X > 0f && num697 < 0f)
{
this.velocity.X = this.velocity.X - num696;
}
}
}
if (this.velocity.Y < num698)
{
this.velocity.Y = this.velocity.Y + num696;
if (this.velocity.Y < 0f && num698 > 0f)
{
this.velocity.Y = this.velocity.Y + num696;
}
}
else
{
if (this.velocity.Y > num698)
{
this.velocity.Y = this.velocity.Y - num696;
if (this.velocity.Y > 0f && num698 < 0f)
{
this.velocity.Y = this.velocity.Y - num696;
}
}
}
}
else
{
if (num699 > 100f)
{
this.TargetClosest(true);
this.spriteDirection = this.direction;
num699 = num695 / num699;
if (this.velocity.X < num697)
{
this.velocity.X = this.velocity.X + num696;
if (this.velocity.X < 0f && num697 > 0f)
{
this.velocity.X = this.velocity.X + num696 * 2f;
}
}
else
{
if (this.velocity.X > num697)
{
this.velocity.X = this.velocity.X - num696;
if (this.velocity.X > 0f && num697 < 0f)
{
this.velocity.X = this.velocity.X - num696 * 2f;
}
}
}
if (this.velocity.Y < num698)
{
this.velocity.Y = this.velocity.Y + num696;
if (this.velocity.Y < 0f && num698 > 0f)
{
this.velocity.Y = this.velocity.Y + num696 * 2f;
}
}
else
{
if (this.velocity.Y > num698)
{
this.velocity.Y = this.velocity.Y - num696;
if (this.velocity.Y > 0f && num698 < 0f)
{
this.velocity.Y = this.velocity.Y - num696 * 2f;
}
}
}
}
}
if (this.ai[1] > 800f)
{
this.ai[0] = -1f;
this.ai[1] = 3f;
this.netUpdate = true;
return;
}
}
}
else
{
if (this.aiStyle == 44)
{
this.noGravity = true;
if (this.collideX)
{
this.velocity.X = this.oldVelocity.X * -0.5f;
if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f)
{
this.velocity.X = 2f;
}
if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f)
{
this.velocity.X = -2f;
}
}
if (this.collideY)
{
this.velocity.Y = this.oldVelocity.Y * -0.5f;
if (this.velocity.Y > 0f && this.velocity.Y < 1f)
{
this.velocity.Y = 1f;
}
if (this.velocity.Y < 0f && this.velocity.Y > -1f)
{
this.velocity.Y = -1f;
}
}
this.TargetClosest(true);
float num707 = 0.05f;
float num708 = 3f;
float num709 = Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)));
float num710 = Main.player[this.target].position.Y - (float)(this.height / 2);
if (num709 > 30f)
{
if (this.direction == -1 && this.velocity.X > -num708)
{
this.velocity.X = this.velocity.X - num707;
if (this.velocity.X > num708)
{
this.velocity.X = this.velocity.X - num707;
}
else
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X - num707 / 2f;
}
}
if (this.velocity.X < -num708)
{
this.velocity.X = -num708;
}
}
else
{
if (this.direction == 1 && this.velocity.X < num708)
{
this.velocity.X = this.velocity.X + num707;
if (this.velocity.X < -num708)
{
this.velocity.X = this.velocity.X + num707;
}
else
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X + num707 / 2f;
}
}
if (this.velocity.X > num708)
{
this.velocity.X = num708;
}
}
}
}
if (num709 > 100f)
{
num710 -= 50f;
}
if (this.position.Y < num710)
{
this.velocity.Y = this.velocity.Y + 0.01f;
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y + 0.01f;
}
}
else
{
this.velocity.Y = this.velocity.Y - 0.01f;
if (this.velocity.Y > 0f)
{
this.velocity.Y = this.velocity.Y - 0.01f;
}
}
if (this.velocity.Y < -1f)
{
this.velocity.Y = -1f;
}
if (this.velocity.Y > 1f)
{
this.velocity.Y = 1f;
return;
}
}
else
{
if (this.aiStyle == 45)
{
NPC.golemBoss = this.whoAmI;
if (this.localAI[0] == 0f && Main.netMode != 1)
{
this.localAI[0] = 1f;
NPC.NewNPC((int)this.center().X - 84, (int)this.center().Y - 9, 247, 0);
NPC.NewNPC((int)this.center().X + 78, (int)this.center().Y - 9, 248, 0);
NPC.NewNPC((int)this.center().X - 3, (int)this.center().Y - 57, 246, 0);
}
if (this.alpha > 0)
{
this.alpha -= 10;
if (this.alpha < 0)
{
this.alpha = 0;
}
this.ai[1] = 0f;
}
bool flag51 = false;
bool flag52 = false;
bool flag53 = false;
this.dontTakeDamage = false;
for (int num711 = 0; num711 < 200; num711++)
{
if (Main.npc[num711].active && Main.npc[num711].type == 246)
{
flag51 = true;
}
if (Main.npc[num711].active && Main.npc[num711].type == 247)
{
flag52 = true;
}
if (Main.npc[num711].active && Main.npc[num711].type == 248)
{
flag53 = true;
}
}
this.dontTakeDamage = flag51;
if (!flag52)
{
int num712 = Dust.NewDust(new Vector2(this.center().X - 80f, this.center().Y - 9f), 8, 8, 31, 0f, 0f, 100, default(Color), 1f);
Main.dust[num712].alpha += Main.rand.Next(100);
Main.dust[num712].velocity *= 0.2f;
Dust expr_2B011_cp_0 = Main.dust[num712];
expr_2B011_cp_0.velocity.Y = expr_2B011_cp_0.velocity.Y - (0.5f + (float)Main.rand.Next(10) * 0.1f);
Main.dust[num712].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f;
if (Main.rand.Next(10) == 0)
{
num712 = Dust.NewDust(new Vector2(this.center().X - 80f, this.center().Y - 9f), 8, 8, 6, 0f, 0f, 0, default(Color), 1f);
if (Main.rand.Next(20) != 0)
{
Main.dust[num712].noGravity = true;
Main.dust[num712].scale *= 1f + (float)Main.rand.Next(10) * 0.1f;
Dust expr_2B11C_cp_0 = Main.dust[num712];
expr_2B11C_cp_0.velocity.Y = expr_2B11C_cp_0.velocity.Y - 1f;
}
}
}
if (!flag53)
{
int num713 = Dust.NewDust(new Vector2(this.center().X + 62f, this.center().Y - 9f), 8, 8, 31, 0f, 0f, 100, default(Color), 1f);
Main.dust[num713].alpha += Main.rand.Next(100);
Main.dust[num713].velocity *= 0.2f;
Dust expr_2B1D9_cp_0 = Main.dust[num713];
expr_2B1D9_cp_0.velocity.Y = expr_2B1D9_cp_0.velocity.Y - (0.5f + (float)Main.rand.Next(10) * 0.1f);
Main.dust[num713].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f;
if (Main.rand.Next(10) == 0)
{
num713 = Dust.NewDust(new Vector2(this.center().X + 62f, this.center().Y - 9f), 8, 8, 6, 0f, 0f, 0, default(Color), 1f);
if (Main.rand.Next(20) != 0)
{
Main.dust[num713].noGravity = true;
Main.dust[num713].scale *= 1f + (float)Main.rand.Next(10) * 0.1f;
Dust expr_2B2E4_cp_0 = Main.dust[num713];
expr_2B2E4_cp_0.velocity.Y = expr_2B2E4_cp_0.velocity.Y - 1f;
}
}
}
if (this.ai[0] == 0f)
{
if (this.velocity.Y == 0f)
{
this.velocity.X = this.velocity.X * 0.8f;
this.ai[1] += 1f;
if (this.ai[1] > 0f)
{
if (!flag52)
{
this.ai[1] += 2f;
}
if (!flag53)
{
this.ai[1] += 2f;
}
if (!flag51)
{
this.ai[1] += 4f;
}
if (this.life < this.lifeMax)
{
this.ai[1] += 2f;
}
if (this.life < this.lifeMax / 2)
{
this.ai[1] += 4f;
}
if (this.life < this.lifeMax / 3)
{
this.ai[1] += 8f;
}
}
if (this.ai[1] >= 300f)
{
this.ai[1] = -20f;
this.frameCounter = 0.0;
}
else
{
if (this.ai[1] == -1f)
{
this.TargetClosest(true);
this.velocity.X = (float)(4 * this.direction);
this.velocity.Y = -12.1f;
this.ai[0] = 1f;
this.ai[1] = 0f;
}
}
}
}
else
{
if (this.ai[0] == 1f)
{
if (this.velocity.Y == 0f)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14);
this.ai[0] = 0f;
for (int num714 = (int)this.position.X - 20; num714 < (int)this.position.X + this.width + 40; num714 += 20)
{
for (int num715 = 0; num715 < 4; num715++)
{
int num716 = Dust.NewDust(new Vector2(this.position.X - 20f, this.position.Y + (float)this.height), this.width + 20, 4, 31, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num716].velocity *= 0.2f;
}
int num717 = Gore.NewGore(new Vector2((float)(num714 - 20), this.position.Y + (float)this.height - 8f), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num717].velocity *= 0.4f;
}
}
else
{
this.TargetClosest(true);
if (this.position.X < Main.player[this.target].position.X && this.position.X + (float)this.width > Main.player[this.target].position.X + (float)Main.player[this.target].width)
{
this.velocity.X = this.velocity.X * 0.9f;
this.velocity.Y = this.velocity.Y + 0.2f;
}
else
{
if (this.direction < 0)
{
this.velocity.X = this.velocity.X - 0.2f;
}
else
{
if (this.direction > 0)
{
this.velocity.X = this.velocity.X + 0.2f;
}
}
float num718 = 3f;
if (this.life < this.lifeMax)
{
num718 += 1f;
}
if (this.life < this.lifeMax / 2)
{
num718 += 1f;
}
if (this.life < this.lifeMax / 4)
{
num718 += 1f;
}
if (this.velocity.X < -num718)
{
this.velocity.X = -num718;
}
if (this.velocity.X > num718)
{
this.velocity.X = num718;
}
}
}
}
}
if (this.target <= 0 || this.target == 255 || Main.player[this.target].dead)
{
this.TargetClosest(true);
}
int num719 = 3000;
if (Math.Abs(this.center().X - Main.player[this.target].center().X) + Math.Abs(this.center().Y - Main.player[this.target].center().Y) > (float)num719)
{
this.TargetClosest(true);
if (Math.Abs(this.center().X - Main.player[this.target].center().X) + Math.Abs(this.center().Y - Main.player[this.target].center().Y) > (float)num719)
{
this.active = false;
return;
}
}
}
else
{
if (this.aiStyle == 46)
{
if (NPC.golemBoss < 0)
{
this.StrikeNPC(9999, 0f, 0, false, false);
return;
}
this.noTileCollide = false;
float num720 = 12f;
Vector2 vector87 = new Vector2(this.center().X, this.center().Y);
float num721 = Main.npc[NPC.golemBoss].center().X - vector87.X;
float num722 = Main.npc[NPC.golemBoss].center().Y - vector87.Y;
num722 -= 57f;
num721 -= 3f;
float num723 = (float)Math.Sqrt((double)(num721 * num721 + num722 * num722));
if (num723 < 20f)
{
this.rotation = 0f;
this.velocity.X = num721;
this.velocity.Y = num722;
}
else
{
num723 = num720 / num723;
this.velocity.X = num721 * num723;
this.velocity.Y = num722 * num723;
this.rotation = this.velocity.X * 0.1f;
}
if (this.alpha > 0)
{
this.alpha -= 10;
if (this.alpha < 0)
{
this.alpha = 0;
}
this.ai[1] = 30f;
}
if (this.ai[0] == 0f)
{
this.ai[1] += 1f;
int num724 = 300;
if (this.ai[1] < 20f || this.ai[1] > (float)(num724 - 20))
{
this.localAI[0] = 1f;
}
else
{
this.localAI[0] = 0f;
}
if (this.ai[1] >= (float)num724)
{
this.TargetClosest(true);
this.ai[1] = 0f;
Vector2 vector88 = new Vector2(this.center().X, this.center().Y + 10f);
float num725 = 8f;
float num726 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector88.X;
float num727 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector88.Y;
float num728 = (float)Math.Sqrt((double)(num726 * num726 + num727 * num727));
num728 = num725 / num728;
num726 *= num728;
num727 *= num728;
int num729 = 18;
int num730 = 258;
if (Main.netMode != 1)
{
Projectile.NewProjectile(vector88.X, vector88.Y, num726, num727, num730, num729, 0f, Main.myPlayer, 0f, 0f);
}
}
}
else
{
if (this.ai[0] == 1f)
{
this.TargetClosest(true);
Vector2 vector89 = new Vector2(this.center().X, this.center().Y + 10f);
if (Main.player[this.target].center().X < this.center().X - (float)this.width)
{
this.localAI[1] = -1f;
vector89.X -= 40f;
}
else
{
if (Main.player[this.target].center().X > this.center().X + (float)this.width)
{
this.localAI[1] = 1f;
vector89.X += 40f;
}
else
{
this.localAI[1] = 0f;
}
}
this.ai[1] += 1f;
if ((double)this.life < (double)this.lifeMax * 0.4)
{
this.ai[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.3)
{
this.ai[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.2)
{
this.ai[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.1)
{
this.ai[1] += 1f;
}
int num731 = 300;
if (this.ai[1] < 20f || this.ai[1] > (float)(num731 - 20))
{
this.localAI[0] = 1f;
}
else
{
this.localAI[0] = 0f;
}
if (this.ai[1] >= (float)num731)
{
this.TargetClosest(true);
this.ai[1] = 0f;
float num732 = 8f;
float num733 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector89.X;
float num734 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector89.Y;
float num735 = (float)Math.Sqrt((double)(num733 * num733 + num734 * num734));
num735 = num732 / num735;
num733 *= num735;
num734 *= num735;
int num736 = 24;
int num737 = 258;
if (Main.netMode != 1)
{
Projectile.NewProjectile(vector89.X, vector89.Y, num733, num734, num737, num736, 0f, Main.myPlayer, 0f, 0f);
}
}
this.ai[2] += 1f;
if (this.life < this.lifeMax / 3)
{
this.ai[2] += 1f;
}
if (this.life < this.lifeMax / 4)
{
this.ai[2] += 1f;
}
if (this.life < this.lifeMax / 5)
{
this.ai[2] += 1f;
}
if (this.ai[2] > (float)(60 + Main.rand.Next(600)))
{
this.ai[2] = 0f;
if (this.localAI[1] != 0f)
{
vector89 = new Vector2(this.center().X, this.center().Y - 22f);
if (this.localAI[1] == -1f)
{
vector89.X -= 30f;
}
else
{
if (this.localAI[1] == 1f)
{
vector89.X += 30f;
}
}
float num738 = 12f;
float num739 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector89.X;
float num740 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector89.Y;
float num741 = (float)Math.Sqrt((double)(num739 * num739 + num740 * num740));
num741 = num738 / num741;
num739 *= num741;
num740 *= num741;
int num742 = 29;
int num743 = 259;
vector89.X += num739 * 3f;
vector89.Y += num740 * 3f;
if (Main.netMode != 1)
{
int num744 = Projectile.NewProjectile(vector89.X, vector89.Y, num739, num740, num743, num742, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num744].timeLeft = 300;
}
}
}
}
}
if (this.life < this.lifeMax / 2)
{
this.ai[0] = 1f;
return;
}
this.ai[0] = 0f;
return;
}
else
{
if (this.aiStyle == 47)
{
if (NPC.golemBoss < 0)
{
this.StrikeNPC(9999, 0f, 0, false, false);
return;
}
if (this.alpha > 0)
{
this.alpha -= 10;
if (this.alpha < 0)
{
this.alpha = 0;
}
this.ai[1] = 0f;
}
if (this.ai[0] == 0f)
{
this.noTileCollide = true;
float num745 = 8f;
if (this.life < this.lifeMax / 2)
{
num745 += 2f;
}
if (this.life < this.lifeMax / 4)
{
num745 += 2f;
}
if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax)
{
num745 += 8f;
}
Vector2 vector90 = new Vector2(this.center().X, this.center().Y);
float num746 = Main.npc[NPC.golemBoss].center().X - vector90.X;
float num747 = Main.npc[NPC.golemBoss].center().Y - vector90.Y;
num747 -= 9f;
if (this.type == 247)
{
num746 -= 84f;
}
else
{
num746 += 78f;
}
float num748 = (float)Math.Sqrt((double)(num746 * num746 + num747 * num747));
if (num748 < 12f + num745)
{
this.rotation = 0f;
this.velocity.X = num746;
this.velocity.Y = num747;
this.ai[1] += 1f;
if (this.life < this.lifeMax / 2)
{
this.ai[1] += 1f;
}
if (this.life < this.lifeMax / 4)
{
this.ai[1] += 1f;
}
if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax)
{
this.ai[1] += 10f;
}
if (this.ai[1] >= 60f)
{
this.TargetClosest(true);
if ((this.type == 247 && this.center().X + 100f > Main.player[this.target].center().X) || (this.type == 248 && this.center().X - 100f < Main.player[this.target].center().X))
{
this.ai[1] = 0f;
this.ai[0] = 1f;
return;
}
this.ai[1] = 0f;
return;
}
}
else
{
num748 = num745 / num748;
this.velocity.X = num746 * num748;
this.velocity.Y = num747 * num748;
this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X));
if (this.type == 247)
{
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
return;
}
}
}
else
{
if (this.ai[0] == 1f)
{
this.noTileCollide = false;
float num749 = 10f;
if (this.life < this.lifeMax / 2)
{
num749 += 4f;
}
if (this.life < this.lifeMax / 4)
{
num749 += 4f;
}
if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax)
{
num749 += 10f;
}
Vector2 vector91 = new Vector2(this.center().X, this.center().Y);
float num750 = Main.player[this.target].center().X - vector91.X;
float num751 = Main.player[this.target].center().Y - vector91.Y;
float num752 = (float)Math.Sqrt((double)(num750 * num750 + num751 * num751));
num752 = num749 / num752;
this.velocity.X = num750 * num752;
this.velocity.Y = num751 * num752;
this.ai[0] = 2f;
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
if (this.type == 247)
{
this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X));
return;
}
}
else
{
if (this.ai[0] == 2f)
{
Vector2 vector92 = new Vector2(this.center().X, this.center().Y);
float num753 = Main.npc[NPC.golemBoss].center().X - vector92.X;
float num754 = Main.npc[NPC.golemBoss].center().Y - vector92.Y;
num753 += Main.npc[NPC.golemBoss].velocity.X;
num754 += Main.npc[NPC.golemBoss].velocity.Y;
num754 -= 9f;
if (this.type == 247)
{
num753 -= 84f;
}
else
{
num753 += 78f;
}
float num755 = (float)Math.Sqrt((double)(num753 * num753 + num754 * num754));
if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax)
{
this.knockBackResist = 0f;
if (num755 > 700f || this.collideX || this.collideY)
{
this.noTileCollide = true;
this.ai[0] = 0f;
return;
}
}
else
{
if (num755 > 600f || this.collideX || this.collideY || this.justHit)
{
this.noTileCollide = true;
this.ai[0] = 0f;
return;
}
}
}
else
{
if (this.ai[0] == 3f)
{
this.noTileCollide = true;
float num756 = 12f;
float num757 = 0.4f;
Vector2 vector93 = new Vector2(this.center().X, this.center().Y);
float num758 = Main.player[this.target].center().X - vector93.X;
float num759 = Main.player[this.target].center().Y - vector93.Y;
float num760 = (float)Math.Sqrt((double)(num758 * num758 + num759 * num759));
num760 = num756 / num760;
num758 *= num760;
num759 *= num760;
if (this.velocity.X < num758)
{
this.velocity.X = this.velocity.X + num757;
if (this.velocity.X < 0f && num758 > 0f)
{
this.velocity.X = this.velocity.X + num757 * 2f;
}
}
else
{
if (this.velocity.X > num758)
{
this.velocity.X = this.velocity.X - num757;
if (this.velocity.X > 0f && num758 < 0f)
{
this.velocity.X = this.velocity.X - num757 * 2f;
}
}
}
if (this.velocity.Y < num759)
{
this.velocity.Y = this.velocity.Y + num757;
if (this.velocity.Y < 0f && num759 > 0f)
{
this.velocity.Y = this.velocity.Y + num757 * 2f;
}
}
else
{
if (this.velocity.Y > num759)
{
this.velocity.Y = this.velocity.Y - num757;
if (this.velocity.Y > 0f && num759 < 0f)
{
this.velocity.Y = this.velocity.Y - num757 * 2f;
}
}
}
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
if (this.type == 247)
{
this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X));
return;
}
}
}
}
}
}
else
{
if (this.aiStyle == 48)
{
if (NPC.golemBoss < 0)
{
this.StrikeNPC(9999, 0f, 0, false, false);
return;
}
this.TargetClosest(true);
float num761 = 7f;
float num762 = 0.05f;
Vector2 vector94 = new Vector2(this.center().X, this.center().Y);
float num763 = Main.player[this.target].center().X - vector94.X;
float num764 = Main.player[this.target].center().Y - vector94.Y - 300f;
float num765 = (float)Math.Sqrt((double)(num763 * num763 + num764 * num764));
num765 = num761 / num765;
num763 *= num765;
num764 *= num765;
if (this.velocity.X < num763)
{
this.velocity.X = this.velocity.X + num762;
if (this.velocity.X < 0f && num763 > 0f)
{
this.velocity.X = this.velocity.X + num762;
}
}
else
{
if (this.velocity.X > num763)
{
this.velocity.X = this.velocity.X - num762;
if (this.velocity.X > 0f && num763 < 0f)
{
this.velocity.X = this.velocity.X - num762;
}
}
}
if (this.velocity.Y < num764)
{
this.velocity.Y = this.velocity.Y + num762;
if (this.velocity.Y < 0f && num764 > 0f)
{
this.velocity.Y = this.velocity.Y + num762;
}
}
else
{
if (this.velocity.Y > num764)
{
this.velocity.Y = this.velocity.Y - num762;
if (this.velocity.Y > 0f && num764 < 0f)
{
this.velocity.Y = this.velocity.Y - num762;
}
}
}
this.ai[1] += 1f;
if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.8)
{
this.ai[1] += 1f;
}
if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.6)
{
this.ai[1] += 1f;
}
if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.4)
{
this.ai[1] += 1f;
}
if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.2)
{
this.ai[1] += 1f;
}
int num766 = 300;
if (this.ai[1] < 20f || this.ai[1] > (float)(num766 - 20))
{
this.localAI[0] = 1f;
}
else
{
this.localAI[0] = 0f;
}
if (this.ai[1] >= (float)num766)
{
this.TargetClosest(true);
this.ai[1] = 0f;
Vector2 vector95 = new Vector2(this.center().X, this.center().Y - 10f);
float num767 = 8f;
float num768 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector95.X;
float num769 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector95.Y;
float num770 = (float)Math.Sqrt((double)(num768 * num768 + num769 * num769));
num770 = num767 / num770;
num768 *= num770;
num769 *= num770;
int num771 = 20;
int num772 = 258;
if (Main.netMode != 1)
{
Projectile.NewProjectile(vector95.X, vector95.Y, num768, num769, num772, num771, 0f, Main.myPlayer, 0f, 0f);
}
}
if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 2)
{
this.ai[2] += 1f;
}
if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 3)
{
this.ai[2] += 1f;
}
if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 4)
{
this.ai[2] += 1f;
}
if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 5)
{
this.ai[2] += 1f;
}
if (this.ai[2] > (float)(80 + Main.rand.Next(1200)))
{
this.ai[2] = 0f;
for (int num773 = 0; num773 < 2; num773++)
{
Vector2 vector96 = new Vector2(this.center().X, this.center().Y - 50f);
if (num773 == 0)
{
vector96.X -= 14f;
}
else
{
if (num773 == 1)
{
vector96.X += 14f;
}
}
float num774 = 12f;
float num775 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector96.X;
float num776 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector96.Y;
float num777 = (float)Math.Sqrt((double)(num775 * num775 + num776 * num776));
num777 = num774 / num777;
num775 *= num777;
num776 *= num777;
int num778 = 25;
int num779 = 259;
vector96.X += num775 * 3f;
vector96.Y += num776 * 3f;
if (Main.netMode != 1)
{
int num780 = Projectile.NewProjectile(vector96.X, vector96.Y, num775, num776, num779, num778, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[num780].timeLeft = 300;
}
}
return;
}
}
else
{
if (this.aiStyle == 49)
{
this.noGravity = true;
this.TargetClosest(true);
float num781 = 4f;
float num782 = 0.25f;
Vector2 vector97 = new Vector2(this.center().X, this.center().Y);
float num783 = Main.player[this.target].center().X - vector97.X;
float num784 = Main.player[this.target].center().Y - vector97.Y - 200f;
float num785 = (float)Math.Sqrt((double)(num783 * num783 + num784 * num784));
if (num785 < 20f)
{
num783 = this.velocity.X;
num784 = this.velocity.Y;
}
else
{
num785 = num781 / num785;
num783 *= num785;
num784 *= num785;
}
if (this.velocity.X < num783)
{
this.velocity.X = this.velocity.X + num782;
if (this.velocity.X < 0f && num783 > 0f)
{
this.velocity.X = this.velocity.X + num782 * 2f;
}
}
else
{
if (this.velocity.X > num783)
{
this.velocity.X = this.velocity.X - num782;
if (this.velocity.X > 0f && num783 < 0f)
{
this.velocity.X = this.velocity.X - num782 * 2f;
}
}
}
if (this.velocity.Y < num784)
{
this.velocity.Y = this.velocity.Y + num782;
if (this.velocity.Y < 0f && num784 > 0f)
{
this.velocity.Y = this.velocity.Y + num782 * 2f;
}
}
else
{
if (this.velocity.Y > num784)
{
this.velocity.Y = this.velocity.Y - num782;
if (this.velocity.Y > 0f && num784 < 0f)
{
this.velocity.Y = this.velocity.Y - num782 * 2f;
}
}
}
if (this.position.X + (float)this.width > Main.player[this.target].position.X && this.position.X < Main.player[this.target].position.X + (float)Main.player[this.target].width && this.position.Y + (float)this.height < Main.player[this.target].position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && Main.netMode != 1)
{
this.ai[0] += 1f;
if (this.ai[0] > 8f)
{
this.ai[0] = 0f;
int num786 = (int)(this.position.X + 10f + (float)Main.rand.Next(this.width - 20));
int num787 = (int)(this.position.Y + (float)this.height + 4f);
Projectile.NewProjectile((float)num786, (float)num787, 0f, 5f, 264, 20, 0f, Main.myPlayer, 0f, 0f);
return;
}
}
}
else
{
if (this.aiStyle == 50)
{
if (this.timeLeft > 5)
{
this.timeLeft = 5;
}
this.noTileCollide = true;
this.velocity.Y = this.velocity.Y + 0.02f;
if (this.velocity.Y < 0f)
{
this.velocity.Y = this.velocity.Y * 0.99f;
}
if (this.velocity.Y > 1f)
{
this.velocity.Y = 1f;
}
this.TargetClosest(true);
if (this.position.X + (float)this.width < Main.player[this.target].position.X)
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X * 0.98f;
}
this.velocity.X = this.velocity.X + 0.1f;
}
else
{
if (this.position.X > Main.player[this.target].position.X + (float)Main.player[this.target].width)
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X * 0.98f;
}
this.velocity.X = this.velocity.X - 0.1f;
}
}
if (this.velocity.X > 5f || this.velocity.X < -5f)
{
this.velocity.X = this.velocity.X * 0.97f;
}
this.rotation = this.velocity.X * 0.2f;
return;
}
if (this.aiStyle == 51)
{
this.TargetClosest(true);
if (Main.netMode != 1)
{
int num788 = 6000;
if (Math.Abs(this.center().X - Main.player[this.target].center().X) + Math.Abs(this.center().Y - Main.player[this.target].center().Y) > (float)num788)
{
this.active = false;
this.life = 0;
if (Main.netMode == 2)
{
NetMessage.SendData(23, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0);
}
}
}
NPC.plantBoss = this.whoAmI;
if (this.localAI[0] == 0f && Main.netMode != 1)
{
this.localAI[0] = 1f;
NPC.NewNPC((int)this.center().X, (int)this.center().Y, 263, this.whoAmI);
NPC.NewNPC((int)this.center().X, (int)this.center().Y, 263, this.whoAmI);
NPC.NewNPC((int)this.center().X, (int)this.center().Y, 263, this.whoAmI);
}
int[] array = new int[3];
float num789 = 0f;
float num790 = 0f;
int num791 = 0;
for (int num792 = 0; num792 < 200; num792++)
{
if (Main.npc[num792].active && Main.npc[num792].aiStyle == 52)
{
num789 += Main.npc[num792].center().X;
num790 += Main.npc[num792].center().Y;
array[num791] = num792;
num791++;
if (num791 > 2)
{
break;
}
}
}
num789 /= (float)num791;
num790 /= (float)num791;
float num793 = 2.5f;
float num794 = 0.025f;
if (this.life < this.lifeMax / 2)
{
num793 = 5f;
num794 = 0.05f;
}
if (this.life < this.lifeMax / 4)
{
num793 = 7f;
}
if (!Main.player[this.target].zoneJungle || (double)Main.player[this.target].position.Y < Main.worldSurface / 16.0 || Main.player[this.target].position.Y > (float)(Main.maxTilesY / 16 - 300))
{
num793 += 4f;
}
Vector2 vector98 = new Vector2(num789, num790);
float num795 = Main.player[this.target].center().X - vector98.X;
float num796 = Main.player[this.target].center().Y - vector98.Y;
float num797 = (float)Math.Sqrt((double)(num795 * num795 + num796 * num796));
int num798 = 500;
if (num797 >= (float)num798)
{
num797 = (float)num798 / num797;
num795 *= num797;
num796 *= num797;
}
num789 += num795;
num790 += num796;
vector98 = new Vector2(this.center().X, this.center().Y);
num795 = num789 - vector98.X;
num796 = num790 - vector98.Y;
num797 = (float)Math.Sqrt((double)(num795 * num795 + num796 * num796));
if (num797 < num793)
{
num795 = this.velocity.X;
num796 = this.velocity.Y;
}
else
{
num797 = num793 / num797;
num795 *= num797;
num796 *= num797;
}
if (this.velocity.X < num795)
{
this.velocity.X = this.velocity.X + num794;
if (this.velocity.X < 0f && num795 > 0f)
{
this.velocity.X = this.velocity.X + num794 * 2f;
}
}
else
{
if (this.velocity.X > num795)
{
this.velocity.X = this.velocity.X - num794;
if (this.velocity.X > 0f && num795 < 0f)
{
this.velocity.X = this.velocity.X - num794 * 2f;
}
}
}
if (this.velocity.Y < num796)
{
this.velocity.Y = this.velocity.Y + num794;
if (this.velocity.Y < 0f && num796 > 0f)
{
this.velocity.Y = this.velocity.Y + num794 * 2f;
}
}
else
{
if (this.velocity.Y > num796)
{
this.velocity.Y = this.velocity.Y - num794;
if (this.velocity.Y > 0f && num796 < 0f)
{
this.velocity.Y = this.velocity.Y - num794 * 2f;
}
}
}
Vector2 vector99 = new Vector2(this.center().X, this.center().Y);
float num799 = Main.player[this.target].center().X - vector99.X;
float num800 = Main.player[this.target].center().Y - vector99.Y;
this.rotation = (float)Math.Atan2((double)num800, (double)num799) + 1.57f;
if (this.life > this.lifeMax / 2)
{
this.defense = 36;
this.damage = 50;
if (Main.netMode != 1)
{
this.localAI[1] += 1f;
if ((double)this.life < (double)this.lifeMax * 0.9)
{
this.localAI[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.8)
{
this.localAI[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.7)
{
this.localAI[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.6)
{
this.localAI[1] += 1f;
}
if (this.localAI[1] > 80f)
{
this.localAI[1] = 0f;
if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
Vector2 vector100 = new Vector2(this.center().X, this.center().Y);
float num801 = 15f;
float num802 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector100.X;
float num803 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector100.Y;
float num804 = (float)Math.Sqrt((double)(num802 * num802 + num803 * num803));
num804 = num801 / num804;
num802 *= num804;
num803 *= num804;
int num805 = 22;
int num806 = 275;
if ((double)this.life < (double)this.lifeMax * 0.8 && Main.rand.Next(4) == 0)
{
num805 = 27;
this.localAI[1] = -30f;
num806 = 276;
}
else
{
if ((double)this.life < (double)this.lifeMax * 0.8 && Main.rand.Next(8) == 0)
{
num805 = 31;
this.localAI[1] = -120f;
num806 = 277;
}
}
vector100.X += num802 * 3f;
vector100.Y += num803 * 3f;
int num807 = Projectile.NewProjectile(vector100.X, vector100.Y, num802, num803, num806, num805, 0f, Main.myPlayer, 0f, 0f);
if (num806 != 277)
{
Main.projectile[num807].timeLeft = 300;
return;
}
}
}
}
}
else
{
this.defense = 10;
this.damage = 70;
if (this.localAI[0] == 1f && Main.netMode != 1)
{
this.localAI[0] = 2f;
for (int num808 = 0; num808 < 8; num808++)
{
NPC.NewNPC((int)this.center().X, (int)this.center().Y, 264, this.whoAmI);
}
}
if (this.localAI[2] == 0f)
{
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 378, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 379, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 380, this.scale);
this.localAI[2] = 1f;
}
this.localAI[1] += 1f;
if ((double)this.life < (double)this.lifeMax * 0.4)
{
this.localAI[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.3)
{
this.localAI[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.2)
{
this.localAI[1] += 1f;
}
if ((double)this.life < (double)this.lifeMax * 0.1)
{
this.localAI[1] += 1f;
}
if (this.localAI[1] >= 350f)
{
float num809 = 8f;
Vector2 vector101 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f);
float num810 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector101.X + (float)Main.rand.Next(-10, 11);
float num811 = Math.Abs(num810 * 0.2f);
float num812 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector101.Y + (float)Main.rand.Next(-10, 11);
if (num812 > 0f)
{
num811 = 0f;
}
num812 -= num811;
float num813 = (float)Math.Sqrt((double)(num810 * num810 + num812 * num812));
num813 = num809 / num813;
num810 *= num813;
num812 *= num813;
int num814 = NPC.NewNPC((int)this.center().X, (int)this.center().Y, 265, 0);
Main.npc[num814].velocity.X = num810;
Main.npc[num814].velocity.Y = num812;
Main.npc[num814].netUpdate = true;
this.localAI[1] = 0f;
return;
}
}
}
else
{
if (this.aiStyle == 52)
{
if (NPC.plantBoss < 0)
{
this.StrikeNPC(9999, 0f, 0, false, false);
this.netUpdate = true;
return;
}
if (Main.netMode == 1)
{
if (this.ai[0] == 0f)
{
this.ai[0] = (float)((int)(this.center().X / 16f));
}
if (this.ai[1] == 0f)
{
this.ai[1] = (float)((int)(this.center().X / 16f));
}
}
if (Main.netMode != 1)
{
if (this.ai[0] == 0f || this.ai[1] == 0f)
{
this.localAI[0] = 0f;
}
this.localAI[0] -= 1f;
if (Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 2)
{
this.localAI[0] -= 2f;
}
if (Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 4)
{
this.localAI[0] -= 2f;
}
if (!Main.player[Main.npc[NPC.plantBoss].target].zoneJungle || (double)Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface / 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > (float)(Main.maxTilesY / 16 - 300))
{
this.localAI[0] -= 4f;
}
if (this.localAI[0] <= 0f && this.ai[0] != 0f)
{
for (int num815 = 0; num815 < 200; num815++)
{
if (num815 != this.whoAmI && Main.npc[num815].active && Main.npc[num815].type == this.type && (Main.npc[num815].velocity.X != 0f || Main.npc[num815].velocity.Y != 0f))
{
this.localAI[0] = (float)Main.rand.Next(60, 300);
}
}
}
if (this.localAI[0] <= 0f)
{
this.localAI[0] = (float)Main.rand.Next(300, 600);
bool flag54 = false;
int num816 = 0;
while (!flag54 && num816 <= 1000)
{
num816++;
int num817 = (int)(Main.player[Main.npc[NPC.plantBoss].target].center().X / 16f);
int num818 = (int)(Main.player[Main.npc[NPC.plantBoss].target].center().Y / 16f);
if (this.ai[0] == 0f)
{
num817 = (int)((Main.player[Main.npc[NPC.plantBoss].target].center().X + Main.npc[NPC.plantBoss].center().X) / 32f);
num818 = (int)((Main.player[Main.npc[NPC.plantBoss].target].center().Y + Main.npc[NPC.plantBoss].center().Y) / 32f);
}
int num819 = 20;
num819 += (int)(100f * ((float)num816 / 1000f));
int num820 = num817 + Main.rand.Next(-num819, num819 + 1);
int num821 = num818 + Main.rand.Next(-num819, num819 + 1);
if (Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 2 && Main.rand.Next(6) == 0)
{
this.TargetClosest(true);
int num822 = (int)(Main.player[this.target].center().X / 16f);
int num823 = (int)(Main.player[this.target].center().Y / 16f);
if (Main.tile[num822, num823].wall > 0)
{
num820 = num822;
num821 = num823;
}
}
if (WorldGen.SolidTile(num820, num821) || (Main.tile[num820, num821].wall > 0 && (num816 > 500 || Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 2)))
{
flag54 = true;
this.ai[0] = (float)num820;
this.ai[1] = (float)num821;
this.netUpdate = true;
}
}
}
}
if (this.ai[0] > 0f && this.ai[1] > 0f)
{
float num824 = 6f;
if (Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 2)
{
num824 = 8f;
}
if (Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 4)
{
num824 = 10f;
}
if (!Main.player[Main.npc[NPC.plantBoss].target].zoneJungle || (double)Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface / 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > (float)(Main.maxTilesY / 16 - 300))
{
num824 += 6f;
}
Vector2 vector102 = new Vector2(this.center().X, this.center().Y);
float num825 = this.ai[0] * 16f - 8f - vector102.X;
float num826 = this.ai[1] * 16f - 8f - vector102.Y;
float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826));
if (num827 < 12f + num824)
{
this.velocity.X = num825;
this.velocity.Y = num826;
}
else
{
num827 = num824 / num827;
this.velocity.X = num825 * num827;
this.velocity.Y = num826 * num827;
}
Vector2 vector103 = new Vector2(this.center().X, this.center().Y);
float num828 = Main.npc[NPC.plantBoss].center().X - vector103.X;
float num829 = Main.npc[NPC.plantBoss].center().Y - vector103.Y;
this.rotation = (float)Math.Atan2((double)num829, (double)num828) - 1.57f;
return;
}
}
else
{
if (this.aiStyle == 53)
{
if (NPC.plantBoss < 0)
{
this.StrikeNPC(9999, 0f, 0, false, false);
this.netUpdate = true;
return;
}
int num830 = NPC.plantBoss;
if (Main.netMode != 1)
{
this.localAI[0] -= 1f;
if (this.localAI[0] <= 0f)
{
this.localAI[0] = (float)Main.rand.Next(120, 480);
this.ai[0] = (float)Main.rand.Next(-100, 101);
this.ai[1] = (float)Main.rand.Next(-100, 101);
this.netUpdate = true;
}
}
this.TargetClosest(true);
float num831 = 0.2f;
float num832 = 200f;
if ((double)Main.npc[num830].life < (double)Main.npc[num830].lifeMax * 0.25)
{
num832 += 100f;
}
if ((double)Main.npc[num830].life < (double)Main.npc[num830].lifeMax * 0.1)
{
num832 += 100f;
}
if (!Main.npc[num830].active || NPC.plantBoss < 0)
{
this.active = false;
return;
}
float num833 = Main.npc[num830].position.X + (float)(Main.npc[num830].width / 2);
float num834 = Main.npc[num830].position.Y + (float)(Main.npc[num830].height / 2);
Vector2 vector104 = new Vector2(num833, num834);
float num835 = num833 + this.ai[0];
float num836 = num834 + this.ai[1];
float num837 = num835 - vector104.X;
float num838 = num836 - vector104.Y;
float num839 = (float)Math.Sqrt((double)(num837 * num837 + num838 * num838));
num839 = num832 / num839;
num837 *= num839;
num838 *= num839;
if (this.position.X < num833 + num837)
{
this.velocity.X = this.velocity.X + num831;
if (this.velocity.X < 0f && num837 > 0f)
{
this.velocity.X = this.velocity.X * 0.9f;
}
}
else
{
if (this.position.X > num833 + num837)
{
this.velocity.X = this.velocity.X - num831;
if (this.velocity.X > 0f && num837 < 0f)
{
this.velocity.X = this.velocity.X * 0.9f;
}
}
}
if (this.position.Y < num834 + num838)
{
this.velocity.Y = this.velocity.Y + num831;
if (this.velocity.Y < 0f && num838 > 0f)
{
this.velocity.Y = this.velocity.Y * 0.9f;
}
}
else
{
if (this.position.Y > num834 + num838)
{
this.velocity.Y = this.velocity.Y - num831;
if (this.velocity.Y > 0f && num838 < 0f)
{
this.velocity.Y = this.velocity.Y * 0.9f;
}
}
}
if (this.velocity.X > 8f)
{
this.velocity.X = 8f;
}
if (this.velocity.X < -8f)
{
this.velocity.X = -8f;
}
if (this.velocity.Y > 8f)
{
this.velocity.Y = 8f;
}
if (this.velocity.Y < -8f)
{
this.velocity.Y = -8f;
}
if (num837 > 0f)
{
this.spriteDirection = 1;
this.rotation = (float)Math.Atan2((double)num838, (double)num837);
}
if (num837 < 0f)
{
this.spriteDirection = -1;
this.rotation = (float)Math.Atan2((double)num838, (double)num837) + 3.14f;
return;
}
}
else
{
if (this.aiStyle == 54)
{
NPC.crimsonBoss = this.whoAmI;
if (Main.netMode != 1 && this.localAI[0] == 0f)
{
this.localAI[0] = 1f;
for (int num840 = 0; num840 < 20; num840++)
{
float num841 = this.center().X;
float num842 = this.center().Y;
num841 += (float)Main.rand.Next(-this.width, this.width);
num842 += (float)Main.rand.Next(-this.height, this.height);
int num843 = NPC.NewNPC((int)num841, (int)num842, 267, 0);
Main.npc[num843].velocity = new Vector2((float)Main.rand.Next(-30, 31) * 0.1f, (float)Main.rand.Next(-30, 31) * 0.1f);
Main.npc[num843].netUpdate = true;
}
}
if (Main.netMode != 1)
{
this.TargetClosest(true);
int num844 = 6000;
if (Math.Abs(this.center().X - Main.player[this.target].center().X) + Math.Abs(this.center().Y - Main.player[this.target].center().Y) > (float)num844)
{
this.active = false;
this.life = 0;
if (Main.netMode == 2)
{
NetMessage.SendData(23, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0);
}
}
}
if (this.ai[0] < 0f)
{
if (this.localAI[2] == 0f)
{
Main.PlaySound(3, (int)this.position.X, (int)this.position.Y, 1);
this.localAI[2] = 1f;
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 392, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 393, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 394, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 395, 1f);
for (int num845 = 0; num845 < 20; num845++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f, 0, default(Color), 1f);
}
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
}
this.dontTakeDamage = false;
this.knockBackResist = 0.5f;
this.TargetClosest(true);
Vector2 vector105 = new Vector2(this.center().X, this.center().Y);
float num846 = Main.player[this.target].center().X - vector105.X;
float num847 = Main.player[this.target].center().Y - vector105.Y;
float num848 = (float)Math.Sqrt((double)(num846 * num846 + num847 * num847));
float num849 = 8f;
num848 = num849 / num848;
num846 *= num848;
num847 *= num848;
this.velocity.X = (this.velocity.X * 50f + num846) / 51f;
this.velocity.Y = (this.velocity.Y * 50f + num847) / 51f;
if (this.ai[0] == -1f)
{
if (Main.netMode != 1)
{
this.localAI[1] += 1f;
if (this.localAI[1] >= (float)(60 + Main.rand.Next(120)))
{
this.localAI[1] = 0f;
this.TargetClosest(true);
int num850 = 0;
int num851;
int num852;
while (true)
{
num850++;
num851 = (int)Main.player[this.target].center().X / 16;
num852 = (int)Main.player[this.target].center().Y / 16;
if (Main.rand.Next(2) == 0)
{
num851 += Main.rand.Next(7, 13);
}
else
{
num851 -= Main.rand.Next(7, 13);
}
if (Main.rand.Next(2) == 0)
{
num852 += Main.rand.Next(7, 13);
}
else
{
num852 -= Main.rand.Next(7, 13);
}
if (!WorldGen.SolidTile(num851, num852))
{
break;
}
if (num850 > 100)
{
return;
}
}
this.ai[0] = -2f;
this.ai[1] = (float)num851;
this.ai[2] = (float)num852;
this.netUpdate = true;
return;
}
}
}
else
{
if (this.ai[0] == -2f)
{
this.velocity *= 0.9f;
this.alpha += 25;
if (this.alpha >= 255)
{
this.alpha = 255;
this.position.X = this.ai[1] * 16f - (float)(this.width / 2);
this.position.Y = this.ai[2] * 16f - (float)(this.height / 2);
Main.PlaySound(2, (int)this.center().X, (int)this.center().Y, 8);
this.ai[0] = -3f;
return;
}
}
else
{
if (this.ai[0] == -3f)
{
this.alpha -= 25;
if (this.alpha <= 0)
{
this.alpha = 0;
this.ai[0] = -1f;
return;
}
}
}
}
}
else
{
this.TargetClosest(true);
Vector2 vector106 = new Vector2(this.center().X, this.center().Y);
float num853 = Main.player[this.target].center().X - vector106.X;
float num854 = Main.player[this.target].center().Y - vector106.Y;
float num855 = (float)Math.Sqrt((double)(num853 * num853 + num854 * num854));
float num856 = 1f;
if (num855 < num856)
{
this.velocity.X = num853;
this.velocity.Y = num854;
}
else
{
num855 = num856 / num855;
this.velocity.X = num853 * num855;
this.velocity.Y = num854 * num855;
}
if (this.ai[0] == 0f)
{
if (Main.netMode != 1)
{
int num857 = 0;
for (int num858 = 0; num858 < 200; num858++)
{
if (Main.npc[num858].active && Main.npc[num858].type == 267)
{
num857++;
}
}
if (num857 == 0)
{
this.ai[0] = -1f;
this.localAI[1] = 0f;
this.alpha = 0;
this.netUpdate = true;
}
this.localAI[1] += 1f;
if (this.localAI[1] >= (float)(120 + Main.rand.Next(300)))
{
this.localAI[1] = 0f;
this.TargetClosest(true);
int num859 = 0;
int num860;
int num861;
while (true)
{
num859++;
num860 = (int)Main.player[this.target].center().X / 16;
num861 = (int)Main.player[this.target].center().Y / 16;
num860 += Main.rand.Next(-50, 51);
num861 += Main.rand.Next(-50, 51);
if (!WorldGen.SolidTile(num860, num861) && Collision.CanHit(new Vector2((float)(num860 * 16), (float)(num861 * 16)), 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height))
{
break;
}
if (num859 > 100)
{
return;
}
}
this.ai[0] = 1f;
this.ai[1] = (float)num860;
this.ai[2] = (float)num861;
this.netUpdate = true;
return;
}
}
}
else
{
if (this.ai[0] == 1f)
{
this.alpha += 5;
if (this.alpha >= 255)
{
Main.PlaySound(2, (int)this.center().X, (int)this.center().Y, 8);
this.alpha = 255;
this.position.X = this.ai[1] * 16f - (float)(this.width / 2);
this.position.Y = this.ai[2] * 16f - (float)(this.height / 2);
this.ai[0] = 2f;
return;
}
}
else
{
if (this.ai[0] == 2f)
{
this.alpha -= 5;
if (this.alpha <= 0)
{
this.alpha = 0;
this.ai[0] = 0f;
return;
}
}
}
}
}
}
else
{
if (this.aiStyle == 55)
{
if (NPC.crimsonBoss < 0)
{
this.active = false;
this.netUpdate = true;
return;
}
if (this.ai[0] == 0f)
{
Vector2 vector107 = new Vector2(this.center().X, this.center().Y);
float num862 = Main.npc[NPC.crimsonBoss].center().X - vector107.X;
float num863 = Main.npc[NPC.crimsonBoss].center().Y - vector107.Y;
float num864 = (float)Math.Sqrt((double)(num862 * num862 + num863 * num863));
if (num864 > 90f)
{
num864 = 8f / num864;
num862 *= num864;
num863 *= num864;
this.velocity.X = (this.velocity.X * 15f + num862) / 16f;
this.velocity.Y = (this.velocity.Y * 15f + num863) / 16f;
return;
}
if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < 8f)
{
this.velocity.Y = this.velocity.Y * 1.05f;
this.velocity.X = this.velocity.X * 1.05f;
}
if (Main.netMode != 1 && Main.rand.Next(200) == 0)
{
this.TargetClosest(true);
vector107 = new Vector2(this.center().X, this.center().Y);
num862 = Main.player[this.target].center().X - vector107.X;
num863 = Main.player[this.target].center().Y - vector107.Y;
num864 = (float)Math.Sqrt((double)(num862 * num862 + num863 * num863));
num864 = 8f / num864;
this.velocity.X = num862 * num864;
this.velocity.Y = num863 * num864;
this.ai[0] = 1f;
this.netUpdate = true;
return;
}
}
else
{
Vector2 vector108 = new Vector2(this.center().X, this.center().Y);
float num865 = Main.npc[NPC.crimsonBoss].center().X - vector108.X;
float num866 = Main.npc[NPC.crimsonBoss].center().Y - vector108.Y;
float num867 = (float)Math.Sqrt((double)(num865 * num865 + num866 * num866));
if (num867 > 700f || this.justHit)
{
this.ai[0] = 0f;
return;
}
}
}
else
{
if (this.aiStyle == 56)
{
this.TargetClosest(true);
Vector2 vector109 = new Vector2(this.center().X, this.center().Y);
float num868 = Main.player[this.target].center().X - vector109.X;
float num869 = Main.player[this.target].center().Y - vector109.Y;
float num870 = (float)Math.Sqrt((double)(num868 * num868 + num869 * num869));
float num871 = 12f;
num870 = num871 / num870;
num868 *= num870;
num869 *= num870;
this.velocity.X = (this.velocity.X * 100f + num868) / 101f;
this.velocity.Y = (this.velocity.Y * 100f + num869) / 101f;
this.rotation = (float)Math.Atan2((double)num869, (double)num868) - 1.57f;
int num872 = Dust.NewDust(this.position, this.width, this.height, 180, 0f, 0f, 0, default(Color), 1f);
Main.dust[num872].velocity *= 0.1f;
Main.dust[num872].scale = 1.3f;
Main.dust[num872].noGravity = true;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
public void FindFrame()
{
int num = 1;
if (!Main.dedServ)
{
if (!Main.NPCLoaded[this.type])
{
return;
}
num = Main.npcTexture[this.type].Height / Main.npcFrameCount[this.type];
}
int num2 = 0;
if (this.aiAction == 0)
{
if (this.velocity.Y < 0f)
{
num2 = 2;
}
else
{
if (this.velocity.Y > 0f)
{
num2 = 3;
}
else
{
if (this.velocity.X != 0f)
{
num2 = 1;
}
else
{
num2 = 0;
}
}
}
}
else
{
if (this.aiAction == 1)
{
num2 = 4;
}
}
if (this.type == 1 || this.type == 16 || this.type == 59 || this.type == 71 || this.type == 81 || this.type == 138 || this.type == 147 || this.type == 183 || this.type == 184 || this.type == 204 || this.type == 225)
{
this.frameCounter += 1.0;
if (num2 > 0)
{
this.frameCounter += 1.0;
}
if (num2 == 4)
{
this.frameCounter += 1.0;
}
if (this.frameCounter >= 8.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
if (this.type == 266)
{
this.frameCounter += 1.0;
if (this.frameCounter > 6.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
}
if (this.ai[0] >= 0f)
{
if (this.frame.Y > num * 3)
{
this.frame.Y = 0;
}
}
else
{
if (this.frame.Y < num * 4)
{
this.frame.Y = num * 4;
}
if (this.frame.Y > num * 7)
{
this.frame.Y = num * 4;
}
}
}
if (this.type == 262)
{
this.frameCounter += 1.0;
if (this.frameCounter > 6.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
}
if (this.life > this.lifeMax / 2)
{
if (this.frame.Y > num * 3)
{
this.frame.Y = 0;
}
}
else
{
if (this.frame.Y < num * 4)
{
this.frame.Y = num * 4;
}
if (this.frame.Y > num * 7)
{
this.frame.Y = num * 4;
}
}
}
if (this.type == 263)
{
if (this.velocity.X == 0f && this.velocity.Y == 0f)
{
if (this.frame.Y > 0)
{
this.frameCounter += 1.0;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y - num;
}
}
}
else
{
if (this.frame.Y < 2)
{
this.frameCounter += 1.0;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
}
}
}
}
if (this.type == 244)
{
this.frameCounter += 1.0;
if (num2 > 0)
{
this.frameCounter += 1.0;
}
if (num2 == 4)
{
this.frameCounter += 1.0;
}
if (this.frameCounter >= 8.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
if (this.type == 289)
{
this.frameCounter += 1.0;
if (this.frameCounter < 2.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 3.0)
{
this.frame.Y = num;
}
else
{
this.frame.Y = num * 2;
this.frameCounter = 0.0;
}
}
if (this.ai[3] == 1f)
{
this.frame.Y = this.frame.Y + num * 3;
}
}
if (this.type == 288)
{
this.frameCounter += 1.0;
if (this.frameCounter >= 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
if (this.type == 250 || this.type == 264 || this.type == 268)
{
this.frameCounter += 1.0;
if (this.frameCounter >= 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
if (this.type == 245)
{
if (this.ai[0] == 0f)
{
if (this.ai[1] < -16f)
{
this.frame.Y = 0;
}
else
{
if (this.ai[1] < -12f)
{
this.frame.Y = num;
}
else
{
if (this.ai[1] < -8f)
{
this.frame.Y = num * 2;
}
else
{
if (this.ai[1] < -4f)
{
this.frame.Y = num * 3;
}
else
{
if (this.ai[1] < 0f)
{
this.frame.Y = num * 4;
}
else
{
this.frame.Y = 0;
}
}
}
}
}
}
else
{
if (this.ai[0] == 1f)
{
this.frame.Y = 1;
}
}
}
if (this.type == 246)
{
if (this.ai[0] == 0f)
{
if (this.localAI[0] == 1f)
{
this.frame.Y = num;
}
else
{
this.frame.Y = 0;
}
}
else
{
if (this.ai[0] == 1f)
{
if (this.localAI[0] == 1f)
{
this.frame.Y = num;
}
else
{
this.frame.Y = 0;
}
if (this.localAI[1] == -1f)
{
this.frame.Y = this.frame.Y + num * 4;
}
if (this.localAI[1] == 1f)
{
this.frame.Y = this.frame.Y + num * 2;
}
}
}
}
if (this.type == 249)
{
if (this.localAI[0] == 1f)
{
this.frame.Y = num;
}
else
{
this.frame.Y = 0;
}
}
if (this.type == 141)
{
this.spriteDirection = this.direction;
if (this.velocity.Y != 0f)
{
this.frame.Y = num * 2;
}
else
{
this.frameCounter += 1.0;
if (this.frameCounter >= 8.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y > num)
{
this.frame.Y = 0;
}
}
}
if (this.type == 243)
{
if (this.frameCounter < 0.0)
{
if (this.velocity.Y == 0f)
{
this.frameCounter += 1.0;
if (this.frameCounter < -12.0)
{
if (this.frame.Y > num * 9)
{
this.frame.Y = num * 11;
}
}
else
{
if (this.frameCounter < -6.0)
{
if (this.frame.Y > num * 9)
{
this.frame.Y = num * 12;
}
}
else
{
if (this.frameCounter < 0.0)
{
this.frameCounter = 0.0;
if (this.frame.Y > num * 9)
{
this.frame.Y = num * 11;
}
}
}
}
}
else
{
this.frameCounter = -18.0;
if (this.velocity.Y < 0f)
{
this.frame.Y = num * 14;
}
else
{
this.frame.Y = num * 13;
}
}
}
else
{
this.spriteDirection = this.direction;
this.frameCounter += (double)Math.Abs(this.velocity.X * 1.1f);
if (this.frameCounter >= 6.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
if (this.frame.Y > num * 9)
{
this.frame.Y = 0;
}
}
if (this.velocity.Y < -2f || this.velocity.Y > 5f)
{
this.frameCounter = -18.0;
}
}
}
if (this.type == 222)
{
this.frameCounter += 1.0;
if (this.localAI[0] == 1f)
{
if (this.frameCounter > 4.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * 4)
{
this.frame.Y = 0;
}
}
else
{
if (this.frameCounter > 4.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y < num * 4)
{
this.frame.Y = num * 4;
}
if (this.frame.Y >= num * 12)
{
this.frame.Y = num * 4;
}
}
}
if (this.type == 164 || this.type == 239)
{
if (this.velocity.Y != 0f)
{
this.frameCounter = 0.0;
if (this.velocity.Y < 0f)
{
this.frame.Y = num * 4;
}
else
{
this.frame.Y = 0;
}
}
else
{
this.spriteDirection = this.direction;
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 1.1f);
if (this.frameCounter < 6.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 12.0)
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < 18.0)
{
this.frame.Y = num * 3;
}
else
{
this.frameCounter = 0.0;
}
}
}
}
}
if (this.type == 236)
{
if (this.velocity.Y == 0f)
{
this.spriteDirection = this.direction;
}
else
{
this.frame.Y = 0;
}
this.frameCounter += (double)Math.Abs(this.velocity.X);
if (this.frameCounter > 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y > num || this.velocity.Y != 0f)
{
this.frame.Y = 0;
}
}
if (this.type == 165 || this.type == 237 || this.type == 238 || this.type == 240)
{
this.frameCounter += (double)((Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * 0.5f);
if (this.frameCounter < 6.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 12.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 18.0)
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < 24.0)
{
this.frame.Y = num * 3;
}
else
{
this.frameCounter = 0.0;
}
}
}
}
}
if (this.type == 195)
{
if (this.ai[0] < 3f)
{
this.frame.Y = 0;
}
else
{
if (this.ai[0] < 6f)
{
this.frame.Y = num;
}
else
{
if (this.ai[0] < 9f)
{
this.frame.Y = num * 2;
}
else
{
if (this.ai[0] < 12f)
{
this.frame.Y = num * 3;
}
else
{
if (this.ai[0] < 15f)
{
this.frame.Y = num * 4;
}
else
{
this.frame.Y = num * 5;
}
}
}
}
}
}
if (this.type == 174)
{
if (this.velocity.Y == 0f)
{
this.frame.Y = 0;
}
else
{
if ((double)this.velocity.Y < -1.5)
{
this.frame.Y = num;
}
else
{
if ((double)this.velocity.Y > 1.5)
{
this.frame.Y = num * 3;
}
else
{
this.frame.Y = num * 2;
}
}
}
}
if (this.type == 177)
{
if (this.velocity.Y == 0f)
{
this.frameCounter += 1.0;
if (this.frameCounter >= 10.0)
{
this.frameCounter = 30.0;
this.frame.Y = 0;
}
else
{
this.frame.Y = num;
}
}
else
{
if (this.velocity.Y < 0f)
{
this.frame.Y = num * 2;
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num * 2;
}
}
}
if (this.type == 163)
{
if (this.velocity.Y != 0f)
{
this.frameCounter = -12.0;
if (this.velocity.Y < 0f)
{
this.frame.Y = num * 5;
}
else
{
this.frame.Y = num * 6;
}
}
else
{
this.spriteDirection = this.direction;
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 1.1f);
if (this.frameCounter < -6.0)
{
this.frame.Y = num * 6;
}
else
{
if (this.frameCounter < 0.0)
{
this.frame.Y = num * 7;
}
else
{
if (this.frameCounter < 6.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 12.0)
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < 18.0)
{
this.frame.Y = num * 3;
}
else
{
this.frameCounter = 0.0;
}
}
}
}
}
}
}
if (this.type == 143)
{
if (this.velocity.Y > 0f)
{
this.frameCounter += 1.0;
}
else
{
if (this.velocity.Y < 0f)
{
this.frameCounter -= 1.0;
}
}
if (this.frameCounter < 6.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 12.0)
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < 18.0)
{
this.frame.Y = num * 3;
}
}
}
if (this.frameCounter < 0.0)
{
this.frameCounter = 0.0;
}
if (this.frameCounter > 17.0)
{
this.frameCounter = 17.0;
}
}
if (this.type == 144)
{
if (this.velocity.X == 0f && this.velocity.Y == 0f)
{
this.localAI[3] += 1f;
if (this.localAI[3] < 6f)
{
this.frame.Y = 0;
}
else
{
if (this.localAI[3] < 12f)
{
this.frame.Y = num;
}
}
if (this.localAI[3] >= 11f)
{
this.localAI[3] = 0f;
}
}
else
{
if (this.velocity.Y > 0f)
{
this.frameCounter += 1.0;
}
else
{
if (this.velocity.Y < 0f)
{
this.frameCounter -= 1.0;
}
}
if (this.frameCounter < 6.0)
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < 12.0)
{
this.frame.Y = num * 3;
}
else
{
if (this.frameCounter < 18.0)
{
this.frame.Y = num * 4;
}
}
}
if (this.frameCounter < 0.0)
{
this.frameCounter = 0.0;
}
if (this.frameCounter > 17.0)
{
this.frameCounter = 17.0;
}
}
}
if (this.type == 145)
{
if (this.velocity.X == 0f && this.velocity.Y == 0f)
{
if (this.ai[2] < 4f)
{
this.frame.Y = 0;
}
else
{
if (this.ai[2] < 8f)
{
this.frame.Y = num;
}
else
{
if (this.ai[2] < 12f)
{
this.frame.Y = num * 2;
}
else
{
if (this.ai[2] < 16f)
{
this.frame.Y = num * 3;
}
}
}
}
}
else
{
if (this.velocity.Y > 0f)
{
this.frameCounter += 1.0;
}
else
{
if (this.velocity.Y < 0f)
{
this.frameCounter -= 1.0;
}
}
if (this.frameCounter < 6.0)
{
this.frame.Y = num * 4;
}
else
{
if (this.frameCounter < 12.0)
{
this.frame.Y = num * 5;
}
else
{
if (this.frameCounter < 18.0)
{
this.frame.Y = num * 6;
}
}
}
if (this.frameCounter < 0.0)
{
this.frameCounter = 0.0;
}
if (this.frameCounter > 17.0)
{
this.frameCounter = 17.0;
}
}
}
if (this.aiStyle == 39)
{
if (this.ai[0] == 0f)
{
this.rotation = 0f;
if (this.velocity.Y == 0f)
{
this.spriteDirection = this.direction;
}
else
{
if (this.velocity.Y < 0f)
{
this.frameCounter = 0.0;
}
}
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 1.1f);
if (this.frameCounter < 6.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 12.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 18.0)
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < 24.0)
{
this.frame.Y = num * 3;
}
else
{
if (this.frameCounter < 32.0)
{
this.frame.Y = num * 4;
}
else
{
this.frameCounter = 0.0;
}
}
}
}
}
}
else
{
if (this.ai[0] == 1f)
{
this.frameCounter = 0.0;
if (this.ai[1] < 10f)
{
this.frame.Y = num * 5;
}
else
{
if (this.ai[1] < 20f)
{
this.frame.Y = num * 6;
}
else
{
this.frame.Y = num * 7;
}
}
}
else
{
if (this.ai[0] == 5f)
{
this.frameCounter = 0.0;
if (this.ai[1] < 10f)
{
this.frame.Y = num * 7;
}
else
{
if (this.ai[1] < 20f)
{
this.frame.Y = num * 6;
}
else
{
this.frame.Y = num * 5;
}
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num * 7;
}
}
}
}
if (this.type == 50)
{
if (this.velocity.Y != 0f)
{
this.frame.Y = num * 4;
}
else
{
this.frameCounter += 1.0;
if (num2 > 0)
{
this.frameCounter += 1.0;
}
if (num2 == 4)
{
this.frameCounter += 1.0;
}
if (this.frameCounter >= 8.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * 4)
{
this.frame.Y = 0;
}
}
}
if (this.type == 170 || this.type == 171 || this.type == 180)
{
this.spriteDirection = this.direction;
this.frameCounter += 1.0;
if (this.frameCounter >= 4.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * 14)
{
this.frame.Y = 0;
}
}
if (this.type == 135)
{
if (this.ai[2] == 0f)
{
this.frame.Y = 0;
}
else
{
this.frame.Y = num;
}
}
if (this.type == 85)
{
if (this.ai[0] == 0f)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
int num3 = 3;
if (this.velocity.Y == 0f)
{
this.frameCounter -= 1.0;
}
else
{
this.frameCounter += 1.0;
}
if (this.frameCounter < 0.0)
{
this.frameCounter = 0.0;
}
if (this.frameCounter > (double)(num3 * 4))
{
this.frameCounter = (double)(num3 * 4);
}
if (this.frameCounter < (double)num3)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < (double)(num3 * 2))
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < (double)(num3 * 3))
{
this.frame.Y = num * 3;
}
else
{
if (this.frameCounter < (double)(num3 * 4))
{
this.frame.Y = num * 4;
}
else
{
if (this.frameCounter < (double)(num3 * 5))
{
this.frame.Y = num * 5;
}
else
{
if (this.frameCounter < (double)(num3 * 6))
{
this.frame.Y = num * 4;
}
else
{
if (this.frameCounter < (double)(num3 * 7))
{
this.frame.Y = num * 3;
}
else
{
this.frame.Y = num * 2;
if (this.frameCounter >= (double)(num3 * 8))
{
this.frameCounter = (double)num3;
}
}
}
}
}
}
}
}
}
if (this.ai[3] == 2f)
{
this.frame.Y = this.frame.Y + num * 6;
}
else
{
if (this.ai[3] == 3f)
{
this.frame.Y = this.frame.Y + num * 12;
}
else
{
if (this.ai[3] == 4f)
{
this.frame.Y = this.frame.Y + num * 18;
}
}
}
}
if (this.type == 113 || this.type == 114)
{
if (this.ai[2] == 0f)
{
this.frameCounter += 1.0;
if (this.frameCounter >= 12.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
else
{
this.frame.Y = 0;
this.frameCounter = -60.0;
}
}
if (this.type == 61)
{
this.spriteDirection = this.direction;
this.rotation = this.velocity.X * 0.1f;
if (this.velocity.X == 0f && this.velocity.Y == 0f)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += 1.0;
if (this.frameCounter < 4.0)
{
this.frame.Y = num;
}
else
{
this.frame.Y = num * 2;
if (this.frameCounter >= 7.0)
{
this.frameCounter = 0.0;
}
}
}
}
if (this.type == 252)
{
if ((double)this.velocity.X > 0.5)
{
this.spriteDirection = 1;
}
if ((double)this.velocity.X < -0.5)
{
this.spriteDirection = -1;
}
this.rotation = this.velocity.X * 0.1f;
if (this.velocity.X == 0f && this.velocity.Y == 0f)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += 1.0;
if (this.frameCounter > 4.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
}
if (this.frame.Y > num * 4 || this.frame.Y == 0)
{
this.frame.Y = num;
}
}
}
if (this.type == 122)
{
this.spriteDirection = this.direction;
this.rotation = this.velocity.X * 0.05f;
if (this.ai[3] > 0f)
{
int num4 = (int)(this.ai[3] / 8f);
this.frameCounter = 0.0;
this.frame.Y = (num4 + 3) * num;
}
else
{
this.frameCounter += 1.0;
if (this.frameCounter >= 8.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * 3)
{
this.frame.Y = 0;
}
}
}
if (this.type == 74 || this.type == 297 || this.type == 298)
{
this.spriteDirection = this.direction;
this.rotation = this.velocity.X * 0.1f;
if (this.velocity.X == 0f && this.velocity.Y == 0f)
{
this.frame.Y = num * 4;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += 1.0;
if (this.frameCounter >= 4.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
}
if (this.type == 62 || this.type == 66 || this.type == 156)
{
this.spriteDirection = this.direction;
this.rotation = this.velocity.X * 0.1f;
this.frameCounter += 1.0;
if (this.frameCounter < 6.0)
{
this.frame.Y = 0;
}
else
{
this.frame.Y = num;
if (this.frameCounter >= 11.0)
{
this.frameCounter = 0.0;
}
}
}
if (this.type == 63 || this.type == 64 || this.type == 103 || this.type == 242 || this.type == 256)
{
this.frameCounter += 1.0;
if (this.frameCounter < 6.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 12.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 18.0)
{
this.frame.Y = num * 2;
}
else
{
this.frame.Y = num * 3;
if (this.frameCounter >= 23.0)
{
this.frameCounter = 0.0;
}
}
}
}
}
if (this.type == 221)
{
if (this.localAI[2] == 1f)
{
if (this.localAI[0] == 1f)
{
this.frame.Y = 0;
this.localAI[0] = 0f;
}
this.frameCounter += 1.0;
if (this.frameCounter >= 8.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * Main.npcFrameCount[this.type])
{
this.frame.Y = num * Main.npcFrameCount[this.type] - num;
}
}
else
{
this.frameCounter += 1.0;
if (this.frameCounter >= 13.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
}
if (this.type == 2 || this.type == 23 || this.type == 121 || this.type == 169 || this.type == 190 || this.type == 191 || this.type == 192 || this.type == 193 || this.type == 194)
{
if (this.type == 2 || this.type == 190 || this.type == 191 || this.type == 192 || this.type == 193 || this.type == 194)
{
if (this.velocity.X > 0f)
{
this.spriteDirection = 1;
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
}
if (this.velocity.X < 0f)
{
this.spriteDirection = -1;
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 3.14f;
}
}
else
{
if (this.type == 2 || this.type == 121)
{
if (this.velocity.X > 0f)
{
this.spriteDirection = 1;
}
if (this.velocity.X < 0f)
{
this.spriteDirection = -1;
}
this.rotation = this.velocity.X * 0.1f;
}
}
this.frameCounter += 1.0;
if (this.frameCounter >= 8.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
if (this.type == 133)
{
if (this.velocity.X > 0f)
{
this.spriteDirection = 1;
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
}
if (this.velocity.X < 0f)
{
this.spriteDirection = -1;
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 3.14f;
}
this.frameCounter += 1.0;
if (this.frameCounter >= 8.0)
{
this.frame.Y = num;
}
else
{
this.frame.Y = 0;
}
if (this.frameCounter >= 16.0)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
if ((double)this.life < (double)this.lifeMax * 0.5)
{
this.frame.Y = this.frame.Y + num * 2;
}
}
if (this.type == 116)
{
if (this.velocity.X > 0f)
{
this.spriteDirection = 1;
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X);
}
if (this.velocity.X < 0f)
{
this.spriteDirection = -1;
this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 3.14f;
}
this.frameCounter += 1.0;
if (this.frameCounter >= 5.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
if (this.type == 75)
{
if (this.velocity.X > 0f)
{
this.spriteDirection = 1;
}
else
{
this.spriteDirection = -1;
}
this.rotation = this.velocity.X * 0.1f;
this.frameCounter += 1.0;
if (this.frameCounter >= 4.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
if (this.type == 157)
{
this.spriteDirection = this.direction;
this.frameCounter += 1.0;
if (!this.wet)
{
this.frameCounter += 1.0;
}
int num5 = 5;
if (this.frameCounter < (double)num5)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < (double)(num5 * 2))
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < (double)(num5 * 3))
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < (double)(num5 * 4))
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < (double)(num5 * 5))
{
this.frame.Y = num * 3;
}
else
{
if (this.frameCounter < (double)(num5 * 6))
{
this.frame.Y = num * 4;
}
else
{
if (this.frameCounter < (double)(num5 * 7))
{
this.frame.Y = num * 5;
}
else
{
if (this.frameCounter < (double)(num5 * 8))
{
this.frame.Y = num * 4;
}
else
{
this.frameCounter = 0.0;
}
}
}
}
}
}
}
}
}
if (this.type == 55 || this.type == 57 || this.type == 58 || this.type == 102 || this.type == 241)
{
this.spriteDirection = this.direction;
this.frameCounter += 1.0;
if (this.wet)
{
if (this.frameCounter < 6.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 12.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 18.0)
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < 24.0)
{
this.frame.Y = num * 3;
}
else
{
this.frameCounter = 0.0;
}
}
}
}
}
else
{
if (this.frameCounter < 6.0)
{
this.frame.Y = num * 4;
}
else
{
if (this.frameCounter < 12.0)
{
this.frame.Y = num * 5;
}
else
{
this.frameCounter = 0.0;
}
}
}
}
if (this.type == 69)
{
if (this.ai[0] < 190f)
{
this.frameCounter += 1.0;
if (this.frameCounter >= 6.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
if (this.frame.Y / num >= Main.npcFrameCount[this.type] - 1)
{
this.frame.Y = 0;
}
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num * (Main.npcFrameCount[this.type] - 1);
}
}
if (this.type == 155)
{
if (this.velocity.Y > 0f)
{
this.frame.Y = num * 4;
this.frameCounter = 0.0;
}
else
{
if (this.velocity.Y < 0f)
{
this.frame.Y = num * 6;
this.frameCounter = 0.0;
}
else
{
this.spriteDirection = this.direction;
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 0.4f);
if ((this.direction > 0 && this.velocity.X < 0f) || (this.direction < 0 && this.velocity.X > 0f))
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 8.0)
{
this.frame.Y = num * 3;
}
else
{
if (this.frameCounter < 16.0)
{
this.frame.Y = num * 6;
}
else
{
if (this.frameCounter < 24.0)
{
this.frame.Y = num * 4;
}
else
{
if (this.frameCounter < 32.0)
{
this.frame.Y = num * 5;
}
else
{
this.frameCounter = 0.0;
}
}
}
}
}
}
}
}
if (this.type == 86)
{
if (this.velocity.Y == 0f || this.wet)
{
if (this.velocity.X < -2f)
{
this.spriteDirection = -1;
}
else
{
if (this.velocity.X > 2f)
{
this.spriteDirection = 1;
}
else
{
this.spriteDirection = this.direction;
}
}
}
if (this.velocity.Y != 0f)
{
this.frame.Y = num * 15;
this.frameCounter = 0.0;
}
else
{
if (this.velocity.X == 0f)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
if (Math.Abs(this.velocity.X) < 3f)
{
this.frameCounter += (double)Math.Abs(this.velocity.X);
if (this.frameCounter >= 6.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
if (this.frame.Y / num >= 9)
{
this.frame.Y = num;
}
if (this.frame.Y / num <= 0)
{
this.frame.Y = num;
}
}
}
else
{
this.frameCounter += (double)Math.Abs(this.velocity.X);
if (this.frameCounter >= 10.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
if (this.frame.Y / num >= 15)
{
this.frame.Y = num * 9;
}
if (this.frame.Y / num <= 8)
{
this.frame.Y = num * 9;
}
}
}
}
}
}
if (this.type == 127)
{
if (this.ai[1] == 0f)
{
this.frameCounter += 1.0;
if (this.frameCounter >= 12.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
if (this.frame.Y / num >= 2)
{
this.frame.Y = 0;
}
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num * 2;
}
}
if (this.type == 129)
{
if (this.velocity.Y == 0f)
{
this.spriteDirection = this.direction;
}
this.frameCounter += 1.0;
if (this.frameCounter >= 2.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
}
if (this.type == 130)
{
if (this.velocity.Y == 0f)
{
this.spriteDirection = this.direction;
}
this.frameCounter += 1.0;
if (this.frameCounter >= 8.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
}
if (this.type == 67 || this.type == 217 || this.type == 218 || this.type == 219)
{
if (this.velocity.Y == 0f)
{
this.spriteDirection = this.direction;
}
this.frameCounter += 1.0;
if (this.frameCounter >= 6.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
}
if (this.type == 220)
{
if (this.velocity.Y == 0f)
{
this.spriteDirection = this.direction;
}
this.frameCounter += 1.0;
if (this.frameCounter >= 10.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
}
if (this.type == 109)
{
if (this.velocity.Y == 0f && ((this.velocity.X <= 0f && this.direction < 0) || (this.velocity.X >= 0f && this.direction > 0)))
{
this.spriteDirection = this.direction;
}
this.frameCounter += (double)Math.Abs(this.velocity.X);
if (this.frameCounter >= 7.0)
{
this.frameCounter -= 7.0;
this.frame.Y = this.frame.Y + num;
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
}
if (this.type == 83 || this.type == 84 || this.type == 179)
{
if (this.ai[0] == 2f)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += 1.0;
if (this.frameCounter >= 4.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
}
}
if (this.type == 72)
{
this.frameCounter += 1.0;
if (this.frameCounter >= 3.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
}
if (this.type == 65)
{
this.spriteDirection = this.direction;
this.frameCounter += 1.0;
if (this.wet)
{
if (this.frameCounter < 6.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 12.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 18.0)
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < 24.0)
{
this.frame.Y = num * 3;
}
else
{
this.frameCounter = 0.0;
}
}
}
}
}
}
if (this.type == 224)
{
if (this.velocity.X > 0f)
{
this.spriteDirection = 1;
this.rotation = this.velocity.Y * 0.2f;
}
if (this.velocity.X < 0f)
{
this.spriteDirection = -1;
this.rotation = -this.velocity.Y * 0.2f;
}
this.frameCounter += 1.0;
if (this.frameCounter >= 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * 4)
{
this.frame.Y = 0;
}
}
if (this.type == 150 || this.type == 151 || this.type == 152 || this.type == 158 || this.type == 226)
{
if (this.velocity.X > 0f)
{
this.spriteDirection = 1;
}
if (this.velocity.X < 0f)
{
this.spriteDirection = -1;
}
this.rotation = this.velocity.X * 0.1f;
this.frameCounter += 1.0;
if (this.frameCounter >= 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * 4)
{
this.frame.Y = 0;
}
}
if (this.type == 48 || this.type == 49 || this.type == 51 || this.type == 60 || this.type == 82 || this.type == 93 || this.type == 137 || this.type == 182 || this.type == 210 || this.type == 211 || this.type == 253)
{
if (this.velocity.X > 0f)
{
this.spriteDirection = 1;
}
if (this.velocity.X < 0f)
{
this.spriteDirection = -1;
}
this.rotation = this.velocity.X * 0.1f;
if (this.type == 210 || this.type == 211)
{
this.frameCounter += 1.0;
this.rotation = this.velocity.X * 0.2f;
}
this.frameCounter += 1.0;
if (this.frameCounter >= 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
if (this.type == 42 || (this.type >= 231 && this.type <= 235))
{
this.frameCounter += 1.0;
if (this.frameCounter < 2.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 4.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 6.0)
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < 8.0)
{
this.frame.Y = num;
}
else
{
this.frameCounter = 0.0;
}
}
}
}
}
if (this.type == 205)
{
this.frameCounter += 0.5;
if (this.frameCounter < 2.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 4.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 6.0)
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < 8.0)
{
this.frame.Y = num;
}
else
{
this.frameCounter = 0.0;
}
}
}
}
}
if (this.type == 176)
{
this.frameCounter += 1.0;
if (this.frameCounter > 4.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y > num)
{
this.frame.Y = 0;
}
}
if (this.type == 43 || this.type == 56 || this.type == 175)
{
this.frameCounter += 1.0;
if (this.frameCounter < 6.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 12.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 18.0)
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < 24.0)
{
this.frame.Y = num;
}
}
}
}
if (this.frameCounter == 23.0)
{
this.frameCounter = 0.0;
}
}
if (this.type == 115)
{
this.frameCounter += 1.0;
if (this.frameCounter < 3.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 6.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 12.0)
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < 15.0)
{
this.frame.Y = num;
}
}
}
}
if (this.frameCounter == 15.0)
{
this.frameCounter = 0.0;
}
}
if (this.type == 101)
{
this.frameCounter += 1.0;
if (this.frameCounter > 6.0)
{
this.frame.Y = this.frame.Y + num * 2;
this.frameCounter = 0.0;
}
if (this.frame.Y > num * 2)
{
this.frame.Y = 0;
}
}
if (this.type == 199)
{
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
}
if (this.frame.Y < num * 3)
{
this.frameCounter += 1.0;
if (this.frameCounter > 6.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
}
}
else
{
if (this.velocity.Y == 0f)
{
this.frameCounter += (double)Math.Abs(this.velocity.X);
if (this.frameCounter > 12.0)
{
this.frameCounter = 0.0;
this.frame.Y = this.frame.Y + num;
if (this.frame.Y > num * 7)
{
this.frame.Y = num * 3;
}
}
}
}
}
if (this.type == 17 || this.type == 18 || this.type == 19 || this.type == 20 || this.type == 22 || this.type == 142 || this.type == 178 || this.type == 38 || this.type == 26 || this.type == 27 || this.type == 28 || this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 21 || this.type == 44 || this.type == 54 || this.type == 37 || this.type == 73 || this.type == 77 || this.type == 78 || this.type == 79 || this.type == 80 || this.type == 104 || this.type == 107 || this.type == 108 || this.type == 120 || this.type == 124 || this.type == 140 || this.type == 159 || this.type == 160 || this.type == 167 || this.type == 181 || this.type == 185 || this.type == 196 || this.type == 197 || this.type == 198 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 207 || this.type == 208 || this.type == 209 || this.type == 212 || this.type == 213 || this.type == 227 || this.type == 228 || this.type == 229 || this.type == 287)
{
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
if (this.velocity.X == 0f)
{
if (this.type == 140 || this.type == 287)
{
this.frame.Y = num;
this.frameCounter = 0.0;
}
else
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
}
else
{
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 2f);
this.frameCounter += 1.0;
if (this.frameCounter > 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = num * 2;
}
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num;
if (this.type == 21 || this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 44 || this.type == 77 || this.type == 78 || this.type == 79 || this.type == 80 || this.type == 120 || this.type == 140 || this.type == 159 || this.type == 167 || this.type == 197 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 287)
{
this.frame.Y = 0;
}
if (this.type == 181)
{
this.frame.Y = num * 14;
}
}
}
if (this.type >= 269 && this.type <= 280)
{
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
if (this.velocity.X == 0f)
{
if (this.type == 140)
{
this.frame.Y = num;
this.frameCounter = 0.0;
}
else
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
}
else
{
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 2f);
this.frameCounter += 1.0;
if (this.frameCounter > 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = num * 2;
}
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
}
if (this.type == 230)
{
if (this.velocity.Y == 0f)
{
this.rotation = 0f;
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
if (this.velocity.X == 0f)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 2f);
this.frameCounter += 1.0;
if (this.frameCounter > 10.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = 0;
if (this.velocity.Y > 4f)
{
this.rotation -= this.velocity.Y * 0.01f;
}
}
}
else
{
if (this.type == 290)
{
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
if (this.ai[2] > 0f)
{
if (this.ai[1] < 10f)
{
this.frame.Y = num * 11;
}
else
{
if (this.ai[1] < 20f)
{
this.frame.Y = num * 10;
}
else
{
this.frame.Y = num * 9;
}
}
}
else
{
if (this.velocity.X == 0f)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
if (this.frame.Y < num * 2)
{
this.frame.Y = num * 2;
}
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 1f);
if (this.frameCounter > 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y > num * 8)
{
this.frame.Y = num * 2;
}
}
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num;
}
}
else
{
if (this.type == 110 || this.type == 214 || this.type == 215 || this.type == 216 || this.type == 291 || this.type == 292 || this.type == 293)
{
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
if (this.ai[2] > 0f)
{
this.spriteDirection = this.direction;
this.frame.Y = num * (int)this.ai[2];
this.frameCounter = 0.0;
}
else
{
if (this.frame.Y < num * 6)
{
this.frame.Y = num * 6;
}
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 2f);
this.frameCounter += (double)this.velocity.X;
if (this.frameCounter > 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = num * 6;
}
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
}
else
{
if (this.type == 206)
{
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
if (this.ai[2] > 0f)
{
this.spriteDirection = this.direction;
this.frame.Y = num * (int)this.ai[2];
this.frameCounter = 0.0;
}
else
{
if (this.frame.Y < num * 6)
{
this.frame.Y = num * 6;
}
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 2f);
this.frameCounter += (double)this.velocity.X;
if (this.frameCounter > 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = num * 6;
}
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
}
}
}
}
if (this.type == 111)
{
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
if (this.ai[2] > 0f)
{
this.spriteDirection = this.direction;
this.frame.Y = num * ((int)this.ai[2] - 1);
this.frameCounter = 0.0;
}
else
{
if (this.frame.Y < num * 7)
{
this.frame.Y = num * 7;
}
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 2f);
this.frameCounter += (double)(this.velocity.X * 1.3f);
if (this.frameCounter > 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = num * 7;
}
}
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num * 6;
}
}
else
{
if (this.type == 257)
{
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
}
if (this.velocity.Y != 0f || (this.direction == -1 && this.velocity.X > 0f) || (this.direction == 1 && this.velocity.X < 0f))
{
this.frameCounter = 0.0;
this.frame.Y = num * 4;
}
else
{
if (this.velocity.X == 0f)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double)Math.Abs(this.velocity.X);
if (this.frameCounter < 8.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 16.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 24.0)
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < 32.0)
{
this.frame.Y = num * 3;
}
else
{
this.frameCounter = 0.0;
}
}
}
}
}
}
}
else
{
if (this.type == 258)
{
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
}
if (this.velocity.Y != 0f || (this.direction == -1 && this.velocity.X > 0f) || (this.direction == 1 && this.velocity.X < 0f))
{
this.frameCounter += 1.0;
if (this.frameCounter > 1.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y > num * 5 || this.frame.Y < num * 3)
{
this.frame.Y = num * 3;
}
}
else
{
if (this.velocity.X == 0f)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double)Math.Abs(this.velocity.X);
if (this.frameCounter < 8.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 16.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 24.0)
{
this.frame.Y = num * 2;
}
else
{
this.frameCounter = 0.0;
}
}
}
}
}
}
else
{
if (this.type == 3 || this.type == 52 || this.type == 53 || this.type == 132 || this.type == 161 || this.type == 162 || this.type == 166 || this.type == 186 || this.type == 187 || this.type == 188 || this.type == 189 || this.type == 200 || this.type == 223 || this.type == 251 || this.type == 254 || this.type == 255)
{
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
}
if (this.velocity.Y != 0f || (this.direction == -1 && this.velocity.X > 0f) || (this.direction == 1 && this.velocity.X < 0f))
{
this.frameCounter = 0.0;
this.frame.Y = num * 2;
}
else
{
if (this.velocity.X == 0f)
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
else
{
this.frameCounter += (double)Math.Abs(this.velocity.X);
if (this.frameCounter < 8.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 16.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 24.0)
{
this.frame.Y = num * 2;
}
else
{
if (this.frameCounter < 32.0)
{
this.frame.Y = num;
}
else
{
this.frameCounter = 0.0;
}
}
}
}
}
}
}
else
{
if (this.type == 148 || this.type == 149 || this.type == 168)
{
int num6 = 0;
if (this.localAI[0] == 2f)
{
num6 = 3;
}
if (this.localAI[0] == 3f)
{
num6 = 6;
}
if (this.localAI[0] == 4f)
{
num6 = 9;
}
num6 *= num;
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
if (this.velocity.X == 0f)
{
this.frame.Y = num6;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 1f);
if (this.frameCounter < 6.0)
{
this.frame.Y = num6;
}
else
{
if (this.frameCounter < 12.0)
{
this.frame.Y = num + num6;
}
else
{
if (this.frameCounter < 15.0)
{
this.frame.Y = num * 2 + num6;
}
else
{
this.frameCounter = 0.0;
this.frame.Y = num * 2 + num6;
}
}
}
}
}
else
{
if (this.velocity.Y < 0f)
{
this.frameCounter = 0.0;
this.frame.Y = num * 2 + num6;
}
else
{
if (this.velocity.Y > 0f)
{
this.frameCounter = 0.0;
this.frame.Y = num * 2 + num6;
}
}
}
}
else
{
if (this.type == 299)
{
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
if (this.velocity.X == 0f)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 0.5f);
this.frameCounter += 1.0;
if (this.frameCounter > 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y / num >= Main.npcFrameCount[this.type] - 1)
{
this.frame.Y = num;
}
}
}
else
{
if (this.velocity.Y < 0f)
{
this.frameCounter = 0.0;
this.frame.Y = num * 2;
}
else
{
if (this.velocity.Y > 0f)
{
this.frameCounter = 0.0;
this.frame.Y = num * 4;
}
}
}
}
else
{
if (this.type == 300)
{
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
if (this.velocity.X == 0f)
{
this.frameCounter += 1.0;
if (this.frameCounter > 8.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y / num > 1)
{
this.frame.Y = 0;
}
}
else
{
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 0.5f);
this.frameCounter += 1.0;
if (this.frameCounter > 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = num * 2;
}
}
}
else
{
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 0.5f);
this.frameCounter += 1.0;
if (this.frameCounter > 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = num * 2;
}
}
}
else
{
if (this.type == 46 || this.type == 47)
{
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
if (this.velocity.X == 0f)
{
this.frame.Y = 0;
this.frameCounter = 0.0;
}
else
{
this.frameCounter += (double)(Math.Abs(this.velocity.X) * 1f);
this.frameCounter += 1.0;
if (this.frameCounter > 6.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y / num >= Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
}
else
{
if (this.velocity.Y < 0f)
{
this.frameCounter = 0.0;
this.frame.Y = num * 4;
}
else
{
if (this.velocity.Y > 0f)
{
this.frameCounter = 0.0;
this.frame.Y = num * 6;
}
}
}
}
else
{
if (this.type == 4 || this.type == 125 || this.type == 126)
{
this.frameCounter += 1.0;
if (this.frameCounter < 7.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 14.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 21.0)
{
this.frame.Y = num * 2;
}
else
{
this.frameCounter = 0.0;
this.frame.Y = 0;
}
}
}
if (this.ai[0] > 1f)
{
this.frame.Y = this.frame.Y + num * 3;
}
}
else
{
if (this.type == 5)
{
this.frameCounter += 1.0;
if (this.frameCounter >= 8.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
else
{
if (this.type == 94)
{
this.frameCounter += 1.0;
if (this.frameCounter < 6.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter < 12.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter < 18.0)
{
this.frame.Y = num * 2;
}
else
{
this.frame.Y = num;
if (this.frameCounter >= 23.0)
{
this.frameCounter = 0.0;
}
}
}
}
}
else
{
if (this.type == 6 || this.type == 173)
{
this.frameCounter += 1.0;
if (this.frameCounter >= 8.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
else
{
if (this.type == 24)
{
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
}
if (this.ai[1] > 0f)
{
if (this.frame.Y < 4)
{
this.frameCounter = 0.0;
}
this.frameCounter += 1.0;
if (this.frameCounter <= 4.0)
{
this.frame.Y = num * 4;
}
else
{
if (this.frameCounter <= 8.0)
{
this.frame.Y = num * 5;
}
else
{
if (this.frameCounter <= 12.0)
{
this.frame.Y = num * 6;
}
else
{
if (this.frameCounter <= 16.0)
{
this.frame.Y = num * 7;
}
else
{
if (this.frameCounter <= 20.0)
{
this.frame.Y = num * 8;
}
else
{
this.frame.Y = num * 9;
this.frameCounter = 100.0;
}
}
}
}
}
}
else
{
this.frameCounter += 1.0;
if (this.frameCounter <= 4.0)
{
this.frame.Y = 0;
}
else
{
if (this.frameCounter <= 8.0)
{
this.frame.Y = num;
}
else
{
if (this.frameCounter <= 12.0)
{
this.frame.Y = num * 2;
}
else
{
this.frame.Y = num * 3;
if (this.frameCounter >= 16.0)
{
this.frameCounter = 0.0;
}
}
}
}
}
}
else
{
if (this.type == 29 || this.type == 32 || this.type == 45 || this.type == 172 || (this.type >= 281 && this.type <= 286))
{
if (this.velocity.Y == 0f)
{
if (this.direction == 1)
{
this.spriteDirection = 1;
}
if (this.direction == -1)
{
this.spriteDirection = -1;
}
}
this.frame.Y = 0;
if (this.velocity.Y != 0f)
{
this.frame.Y = this.frame.Y + num;
}
else
{
if (this.ai[1] > 0f)
{
this.frame.Y = this.frame.Y + num * 2;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (this.type == 34)
{
this.frameCounter += 1.0;
if (this.frameCounter >= 4.0)
{
this.frame.Y = this.frame.Y + num;
this.frameCounter = 0.0;
}
if (this.frame.Y >= num * Main.npcFrameCount[this.type])
{
this.frame.Y = 0;
}
}
}
public void TargetClosest(bool faceTarget = true)
{
float num = 0f;
bool flag = false;
for (int i = 0; i < 255; i++)
{
if (Main.player[i].active && !Main.player[i].dead)
{
float num2 = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - this.position.X + (float)(this.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - this.position.Y + (float)(this.height / 2));
num2 -= (float)Main.player[i].aggro;
if (!flag || num2 < num)
{
flag = true;
num = Math.Abs(Main.player[i].position.X + (float)(Main.player[i].width / 2) - this.position.X + (float)(this.width / 2)) + Math.Abs(Main.player[i].position.Y + (float)(Main.player[i].height / 2) - this.position.Y + (float)(this.height / 2));
this.target = i;
}
}
}
if (this.target < 0 || this.target >= 255)
{
this.target = 0;
}
this.targetRect = new Rectangle((int)Main.player[this.target].position.X, (int)Main.player[this.target].position.Y, Main.player[this.target].width, Main.player[this.target].height);
if (Main.player[this.target].dead)
{
faceTarget = false;
}
if (faceTarget)
{
this.direction = 1;
if ((float)(this.targetRect.X + this.targetRect.Width / 2) < this.position.X + (float)(this.width / 2))
{
this.direction = -1;
}
this.directionY = 1;
if ((float)(this.targetRect.Y + this.targetRect.Height / 2) < this.position.Y + (float)(this.height / 2))
{
this.directionY = -1;
}
}
if (this.confused)
{
this.direction *= -1;
}
if ((this.direction != this.oldDirection || this.directionY != this.oldDirectionY || this.target != this.oldTarget) && !this.collideX && !this.collideY)
{
this.netUpdate = true;
}
}
public void CheckActive()
{
if (this.active)
{
if (this.type == 8 || this.type == 9 || this.type == 11 || this.type == 12 || this.type == 14 || this.type == 15 || this.type == 40 || this.type == 41 || this.type == 96 || this.type == 97 || this.type == 99 || this.type == 100 || (this.type > 87 && this.type <= 92) || this.type == 118 || this.type == 119 || this.type == 113 || this.type == 114 || this.type == 115 || this.type == 263 || this.type == 267)
{
return;
}
if (this.type >= 246 && this.type <= 249)
{
return;
}
if (this.type >= 134 && this.type <= 136)
{
return;
}
if (this.townNPC)
{
Rectangle rectangle = new Rectangle((int)(this.position.X + (float)(this.width / 2) - (float)NPC.townRangeX), (int)(this.position.Y + (float)(this.height / 2) - (float)NPC.townRangeY), NPC.townRangeX * 2, NPC.townRangeY * 2);
for (int i = 0; i < 255; i++)
{
if (Main.player[i].active && rectangle.Intersects(new Rectangle((int)Main.player[i].position.X, (int)Main.player[i].position.Y, Main.player[i].width, Main.player[i].height)))
{
Main.player[i].townNPCs += this.npcSlots;
}
}
return;
}
bool flag = false;
Rectangle rectangle2 = new Rectangle((int)(this.position.X + (float)(this.width / 2) - (float)NPC.activeRangeX), (int)(this.position.Y + (float)(this.height / 2) - (float)NPC.activeRangeY), NPC.activeRangeX * 2, NPC.activeRangeY * 2);
Rectangle rectangle3 = new Rectangle((int)((double)(this.position.X + (float)(this.width / 2)) - (double)NPC.sWidth * 0.5 - (double)this.width), (int)((double)(this.position.Y + (float)(this.height / 2)) - (double)NPC.sHeight * 0.5 - (double)this.height), NPC.sWidth + this.width * 2, NPC.sHeight + this.height * 2);
for (int j = 0; j < 255; j++)
{
if (Main.player[j].active)
{
if (rectangle2.Intersects(new Rectangle((int)Main.player[j].position.X, (int)Main.player[j].position.Y, Main.player[j].width, Main.player[j].height)))
{
flag = true;
if (this.type != 25 && this.type != 30 && this.type != 33 && this.lifeMax > 0)
{
Main.player[j].activeNPCs += this.npcSlots;
}
}
if (rectangle3.Intersects(new Rectangle((int)Main.player[j].position.X, (int)Main.player[j].position.Y, Main.player[j].width, Main.player[j].height)))
{
this.timeLeft = NPC.activeTime;
}
if (this.type == 7 || this.type == 10 || this.type == 13 || this.type == 39 || this.type == 87)
{
flag = true;
}
if (this.boss || this.type == 35 || this.type == 36 || this.type == 127 || this.type == 128 || this.type == 129 || this.type == 130 || this.type == 131)
{
flag = true;
}
}
}
this.timeLeft--;
if (this.timeLeft <= 0)
{
flag = false;
}
if (!flag && Main.netMode != 1)
{
NPC.noSpawnCycle = true;
this.active = false;
if (Main.netMode == 2)
{
this.netSkip = -1;
this.life = 0;
NetMessage.SendData(23, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0);
}
if (this.aiStyle == 6)
{
for (int k = (int)this.ai[0]; k > 0; k = (int)Main.npc[k].ai[0])
{
if (Main.npc[k].active)
{
Main.npc[k].active = false;
if (Main.netMode == 2)
{
Main.npc[k].life = 0;
Main.npc[k].netSkip = -1;
NetMessage.SendData(23, -1, -1, "", k, 0f, 0f, 0f, 0);
}
}
}
}
}
}
}
public static void SpawnNPC()
{
if (NPC.noSpawnCycle)
{
NPC.noSpawnCycle = false;
return;
}
bool flag = false;
int num = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
for (int i = 0; i < 255; i++)
{
if (Main.player[i].active)
{
num4++;
}
}
for (int j = 0; j < 255; j++)
{
if (Main.player[j].active && !Main.player[j].dead)
{
bool flag2 = false;
bool flag3 = false;
bool flag4 = false;
bool flag5 = false;
bool flag6 = false;
if (Main.player[j].active && Main.invasionType > 0 && Main.invasionDelay == 0 && Main.invasionSize > 0 && (double)Main.player[j].position.Y < Main.worldSurface * 16.0 + (double)NPC.sHeight)
{
int num5 = 3000;
if ((double)Main.player[j].position.X > Main.invasionX * 16.0 - (double)num5 && (double)Main.player[j].position.X < Main.invasionX * 16.0 + (double)num5)
{
flag4 = true;
}
}
bool flag7 = false;
NPC.spawnRate = NPC.defaultSpawnRate;
NPC.maxSpawns = NPC.defaultMaxSpawns;
if (Main.hardMode)
{
NPC.spawnRate = (int)((double)NPC.defaultSpawnRate * 0.9);
NPC.maxSpawns = NPC.defaultMaxSpawns + 1;
}
if (Main.player[j].position.Y > (float)((Main.maxTilesY - 200) * 16))
{
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 2f);
}
else
{
if ((double)Main.player[j].position.Y > Main.rockLayer * 16.0 + (double)NPC.sHeight)
{
NPC.spawnRate = (int)((double)NPC.spawnRate * 0.4);
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 1.9f);
}
else
{
if ((double)Main.player[j].position.Y > Main.worldSurface * 16.0 + (double)NPC.sHeight)
{
if (Main.hardMode)
{
NPC.spawnRate = (int)((double)NPC.spawnRate * 0.45);
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 1.8f);
}
else
{
NPC.spawnRate = (int)((double)NPC.spawnRate * 0.5);
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 1.7f);
}
}
else
{
if (!Main.dayTime)
{
NPC.spawnRate = (int)((double)NPC.spawnRate * 0.6);
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 1.3f);
if (Main.bloodMoon)
{
NPC.spawnRate = (int)((double)NPC.spawnRate * 0.3);
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 1.8f);
}
}
else
{
if (Main.dayTime && Main.eclipse)
{
NPC.spawnRate = (int)((double)NPC.spawnRate * 0.2);
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 1.9f);
}
}
}
}
}
if (Main.player[j].zoneSnow && (double)(Main.player[j].position.Y / 16f) < Main.worldSurface)
{
NPC.maxSpawns = (int)((float)NPC.maxSpawns + (float)NPC.maxSpawns * Main.cloudAlpha);
NPC.spawnRate = (int)((float)NPC.spawnRate * (1f - Main.cloudAlpha + 1f) / 2f);
}
if (Main.player[j].zoneDungeon)
{
NPC.spawnRate = (int)((double)NPC.spawnRate * 0.4);
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 1.7f);
}
else
{
if (Main.player[j].zoneJungle)
{
NPC.spawnRate = (int)((double)NPC.spawnRate * 0.4);
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 1.5f);
}
else
{
if (Main.player[j].zoneEvil || Main.player[j].zoneBlood)
{
NPC.spawnRate = (int)((double)NPC.spawnRate * 0.65);
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 1.3f);
}
else
{
if (Main.player[j].zoneMeteor)
{
NPC.spawnRate = (int)((double)NPC.spawnRate * 0.4);
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 1.1f);
}
}
}
}
if (Main.player[j].zoneHoly && (double)Main.player[j].position.Y > Main.rockLayer * 16.0 + (double)NPC.sHeight)
{
NPC.spawnRate = (int)((double)NPC.spawnRate * 0.65);
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 1.3f);
}
if (Main.wof >= 0 && Main.player[j].position.Y > (float)((Main.maxTilesY - 200) * 16))
{
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 0.3f);
NPC.spawnRate *= 3;
}
if ((double)Main.player[j].activeNPCs < (double)NPC.maxSpawns * 0.2)
{
NPC.spawnRate = (int)((float)NPC.spawnRate * 0.6f);
}
else
{
if ((double)Main.player[j].activeNPCs < (double)NPC.maxSpawns * 0.4)
{
NPC.spawnRate = (int)((float)NPC.spawnRate * 0.7f);
}
else
{
if ((double)Main.player[j].activeNPCs < (double)NPC.maxSpawns * 0.6)
{
NPC.spawnRate = (int)((float)NPC.spawnRate * 0.8f);
}
else
{
if ((double)Main.player[j].activeNPCs < (double)NPC.maxSpawns * 0.8)
{
NPC.spawnRate = (int)((float)NPC.spawnRate * 0.9f);
}
}
}
}
if ((double)(Main.player[j].position.Y * 16f) > (Main.worldSurface + Main.rockLayer) / 2.0 || Main.player[j].zoneEvil || Main.player[j].zoneBlood)
{
if ((double)Main.player[j].activeNPCs < (double)NPC.maxSpawns * 0.2)
{
NPC.spawnRate = (int)((float)NPC.spawnRate * 0.7f);
}
else
{
if ((double)Main.player[j].activeNPCs < (double)NPC.maxSpawns * 0.4)
{
NPC.spawnRate = (int)((float)NPC.spawnRate * 0.9f);
}
}
}
if (Main.player[j].inventory[Main.player[j].selectedItem].type == 148)
{
NPC.spawnRate = (int)((double)NPC.spawnRate * 0.75);
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 1.5f);
}
if (Main.player[j].enemySpawns)
{
NPC.spawnRate = (int)((double)NPC.spawnRate * 0.5);
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 2f);
}
if (Main.player[j].zoneCandle)
{
NPC.spawnRate = (int)((double)NPC.spawnRate * 0.75);
NPC.maxSpawns = (int)((float)NPC.maxSpawns * 1.5f);
}
if ((double)NPC.spawnRate < (double)NPC.defaultSpawnRate * 0.1)
{
NPC.spawnRate = (int)((double)NPC.defaultSpawnRate * 0.1);
}
if (NPC.maxSpawns > NPC.defaultMaxSpawns * 3)
{
NPC.maxSpawns = NPC.defaultMaxSpawns * 3;
}
if (flag4)
{
NPC.maxSpawns = (int)((double)NPC.defaultMaxSpawns * (2.0 + 0.3 * (double)num4));
NPC.spawnRate = 20;
}
if (Main.player[j].zoneDungeon && !NPC.downedBoss3)
{
NPC.spawnRate = 10;
}
bool flag8 = false;
if (!flag4 && (!Main.bloodMoon || Main.dayTime) && (!Main.eclipse || !Main.dayTime) && !Main.player[j].zoneDungeon && !Main.player[j].zoneEvil && !Main.player[j].zoneBlood && !Main.player[j].zoneMeteor)
{
if (Main.player[j].townNPCs == 1f)
{
flag3 = true;
if (Main.rand.Next(3) <= 1)
{
flag8 = true;
NPC.maxSpawns = (int)((double)((float)NPC.maxSpawns) * 0.6);
}
else
{
NPC.spawnRate = (int)((float)NPC.spawnRate * 2f);
}
}
else
{
if (Main.player[j].townNPCs == 2f)
{
flag3 = true;
if (Main.rand.Next(3) == 0)
{
flag8 = true;
NPC.maxSpawns = (int)((double)((float)NPC.maxSpawns) * 0.6);
}
else
{
NPC.spawnRate = (int)((float)NPC.spawnRate * 3f);
}
}
else
{
if (Main.player[j].townNPCs >= 3f)
{
flag3 = true;
flag8 = true;
NPC.maxSpawns = (int)((double)((float)NPC.maxSpawns) * 0.6);
}
}
}
}
int num6 = (int)(Main.player[j].position.X + (float)(Main.player[j].width / 2)) / 16;
int num7 = (int)(Main.player[j].position.Y + (float)(Main.player[j].height / 2)) / 16;
if (Main.wallHouse[(int)Main.tile[num6, num7].wall])
{
flag3 = true;
}
if (Main.tile[num6, num7].wall == 87)
{
flag2 = true;
}
if (Main.player[j].active && !Main.player[j].dead && Main.player[j].activeNPCs < (float)NPC.maxSpawns && Main.rand.Next(NPC.spawnRate) == 0)
{
NPC.spawnRangeX = (int)((double)(NPC.sWidth / 16) * 0.7);
NPC.spawnRangeY = (int)((double)(NPC.sHeight / 16) * 0.7);
NPC.safeRangeX = (int)((double)(NPC.sWidth / 16) * 0.52);
NPC.safeRangeY = (int)((double)(NPC.sHeight / 16) * 0.52);
if (Main.player[j].inventory[Main.player[j].selectedItem].type == 1254 || Main.player[j].inventory[Main.player[j].selectedItem].type == 1299 || Main.player[j].scope)
{
float num8 = 1.5f;
if (Main.player[j].inventory[Main.player[j].selectedItem].type == 1254 && Main.player[j].scope)
{
num8 = 1.25f;
}
else
{
if (Main.player[j].inventory[Main.player[j].selectedItem].type == 1254)
{
num8 = 1.5f;
}
else
{
if (Main.player[j].inventory[Main.player[j].selectedItem].type == 1299)
{
num8 = 1.5f;
}
else
{
if (Main.player[j].scope)
{
num8 = 2f;
}
}
}
}
NPC.spawnRangeX += (int)((double)(NPC.sWidth / 16) * 0.5 / (double)num8);
NPC.spawnRangeY += (int)((double)(NPC.sHeight / 16) * 0.5 / (double)num8);
NPC.safeRangeX += (int)((double)(NPC.sWidth / 16) * 0.5 / (double)num8);
NPC.safeRangeY += (int)((double)(NPC.sHeight / 16) * 0.5 / (double)num8);
}
int num9 = (int)(Main.player[j].position.X / 16f) - NPC.spawnRangeX;
int num10 = (int)(Main.player[j].position.X / 16f) + NPC.spawnRangeX;
int num11 = (int)(Main.player[j].position.Y / 16f) - NPC.spawnRangeY;
int num12 = (int)(Main.player[j].position.Y / 16f) + NPC.spawnRangeY;
int num13 = (int)(Main.player[j].position.X / 16f) - NPC.safeRangeX;
int num14 = (int)(Main.player[j].position.X / 16f) + NPC.safeRangeX;
int num15 = (int)(Main.player[j].position.Y / 16f) - NPC.safeRangeY;
int num16 = (int)(Main.player[j].position.Y / 16f) + NPC.safeRangeY;
if (num9 < 0)
{
num9 = 0;
}
if (num10 > Main.maxTilesX)
{
num10 = Main.maxTilesX;
}
if (num11 < 0)
{
num11 = 0;
}
if (num12 > Main.maxTilesY)
{
num12 = Main.maxTilesY;
}
int k = 0;
while (k < 50)
{
int num17 = Main.rand.Next(num9, num10);
int num18 = Main.rand.Next(num11, num12);
if (Main.tile[num17, num18].nactive() && Main.tileSolid[(int)Main.tile[num17, num18].type])
{
goto IL_FF5;
}
if (!Main.wallHouse[(int)Main.tile[num17, num18].wall])
{
if (!flag4 && (double)num18 < Main.worldSurface * 0.34999999403953552 && !flag8 && ((double)num17 < (double)Main.maxTilesX * 0.45 || (double)num17 > (double)Main.maxTilesX * 0.55 || Main.hardMode))
{
num3 = (int)Main.tile[num17, num18].type;
num = num17;
num2 = num18;
flag7 = true;
flag = true;
}
else
{
if (!flag4 && (double)num18 < Main.worldSurface * 0.44999998807907104 && !flag8 && Main.hardMode && Main.rand.Next(10) == 0)
{
num3 = (int)Main.tile[num17, num18].type;
num = num17;
num2 = num18;
flag7 = true;
flag = true;
}
else
{
int l = num18;
while (l < Main.maxTilesY)
{
if (Main.tile[num17, l].nactive() && Main.tileSolid[(int)Main.tile[num17, l].type])
{
if (num17 < num13 || num17 > num14 || l < num15 || l > num16)
{
num3 = (int)Main.tile[num17, l].type;
num = num17;
num2 = l;
flag7 = true;
break;
}
break;
}
else
{
l++;
}
}
}
}
if (!flag7)
{
goto IL_FF5;
}
int num19 = num - NPC.spawnSpaceX / 2;
int num20 = num + NPC.spawnSpaceX / 2;
int num21 = num2 - NPC.spawnSpaceY;
int num22 = num2;
if (num19 < 0)
{
flag7 = false;
}
if (num20 > Main.maxTilesX)
{
flag7 = false;
}
if (num21 < 0)
{
flag7 = false;
}
if (num22 > Main.maxTilesY)
{
flag7 = false;
}
if (flag7)
{
for (int m = num19; m < num20; m++)
{
for (int n = num21; n < num22; n++)
{
if (Main.tile[m, n].nactive() && Main.tileSolid[(int)Main.tile[m, n].type])
{
flag7 = false;
break;
}
if (Main.tile[m, n].lava())
{
flag7 = false;
break;
}
}
}
goto IL_FF5;
}
goto IL_FF5;
}
IL_FFB:
k++;
continue;
IL_FF5:
if (!flag7 && !flag7)
{
goto IL_FFB;
}
break;
}
}
if (flag7)
{
Rectangle rectangle = new Rectangle(num * 16, num2 * 16, 16, 16);
for (int num23 = 0; num23 < 255; num23++)
{
if (Main.player[num23].active)
{
Rectangle rectangle2 = new Rectangle((int)(Main.player[num23].position.X + (float)(Main.player[num23].width / 2) - (float)(NPC.sWidth / 2) - (float)NPC.safeRangeX), (int)(Main.player[num23].position.Y + (float)(Main.player[num23].height / 2) - (float)(NPC.sHeight / 2) - (float)NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2);
if (rectangle.Intersects(rectangle2))
{
flag7 = false;
}
}
}
}
if (flag7)
{
if (Main.player[j].zoneDungeon && (!Main.tileDungeon[(int)Main.tile[num, num2].type] || Main.tile[num, num2 - 1].wall == 0))
{
flag7 = false;
}
if (Main.tile[num, num2 - 1].liquid > 0 && Main.tile[num, num2 - 2].liquid > 0 && !Main.tile[num, num2 - 1].lava())
{
if (Main.tile[num, num2 - 1].honey())
{
flag6 = true;
}
else
{
flag5 = true;
}
}
}
if (flag6)
{
flag7 = false;
}
if (flag7)
{
bool flag9 = false;
if ((double)num2 > Main.rockLayer && num2 < Main.maxTilesY - 200 && !Main.player[j].zoneDungeon && !flag4)
{
if (Main.rand.Next(3) == 0)
{
int num24 = Main.rand.Next(5, 15);
if (num - num24 >= 0 && num + num24 < Main.maxTilesX)
{
for (int num25 = num - num24; num25 < num + num24; num25++)
{
for (int num26 = num2 - num24; num26 < num2 + num24; num26++)
{
if (Main.tile[num25, num26].wall == 62)
{
flag9 = true;
}
}
}
}
}
else
{
int num27 = (int)Main.player[j].position.X / 16;
int num28 = (int)Main.player[j].position.Y / 16;
if (Main.tile[num27, num28].wall == 62)
{
flag9 = true;
}
}
}
bool flag10 = false;
if (NPC.downedPlantBoss && Main.hardMode)
{
flag10 = true;
}
int num29 = (int)Main.tile[num, num2].type;
int num30 = 200;
if (flag)
{
if (Main.hardMode && Main.rand.Next(10) == 0 && !NPC.AnyNPCs(87) && !flag3)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 87, 1);
}
else
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 48, 0);
}
}
else
{
if (flag4)
{
if (Main.invasionType == 1)
{
if (Main.rand.Next(9) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 29, 0);
}
else
{
if (Main.rand.Next(5) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 26, 0);
}
else
{
if (Main.rand.Next(3) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 111, 0);
}
else
{
if (Main.rand.Next(3) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 27, 0);
}
else
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 28, 0);
}
}
}
}
}
else
{
if (Main.invasionType == 2)
{
if (Main.rand.Next(7) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 145, 0);
}
else
{
if (Main.rand.Next(3) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 143, 0);
}
else
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 144, 0);
}
}
}
else
{
if (Main.invasionType == 3)
{
if (Main.rand.Next(30) == 0 && !NPC.AnyNPCs(216))
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 216, 0);
}
else
{
if (Main.rand.Next(11) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 215, 0);
}
else
{
if (Main.rand.Next(9) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 252, 0);
}
else
{
if (Main.rand.Next(7) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 214, 0);
}
else
{
if (Main.rand.Next(3) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 213, 0);
}
else
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 212, 0);
}
}
}
}
}
}
}
}
}
else
{
if (Main.tile[num, num2].wall == 62 || flag9)
{
if (Main.hardMode)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 163, 0);
}
else
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 164, 0);
}
}
else
{
if (Main.hardMode && flag5 && Main.player[j].zoneJungle && Main.rand.Next(3) != 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 157, 0);
}
else
{
if (Main.hardMode && flag5 && Main.player[j].zoneBlood && Main.rand.Next(3) != 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 242, 0);
}
else
{
if (Main.hardMode && flag5 && Main.player[j].zoneBlood && Main.rand.Next(3) != 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 241, 0);
}
else
{
if (flag5 && (num < 250 || num > Main.maxTilesX - 250) && num29 == 53 && (double)num2 < Main.rockLayer)
{
if (Main.rand.Next(60) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 220, 0);
}
else
{
if (Main.rand.Next(25) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 221, 0);
}
else
{
if (Main.rand.Next(8) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 65, 0);
}
else
{
if (Main.rand.Next(3) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 67, 0);
}
else
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 64, 0);
}
}
}
}
}
else
{
if (flag5 && (((double)num2 > Main.rockLayer && Main.rand.Next(2) == 0) || num29 == 60))
{
if (Main.hardMode && Main.rand.Next(3) > 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 102, 0);
}
else
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 58, 0);
}
}
else
{
if (flag5 && (double)num2 > Main.worldSurface && Main.rand.Next(3) == 0)
{
if (Main.hardMode)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 103, 0);
}
else
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 63, 0);
}
}
else
{
if (flag5 && Main.rand.Next(4) == 0)
{
if (Main.player[j].zoneEvil)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 57, 0);
}
else
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 55, 0);
}
}
else
{
if (NPC.downedGoblins && Main.rand.Next(20) == 0 && !flag5 && (double)num2 >= Main.rockLayer && num2 < Main.maxTilesY - 210 && !NPC.savedGoblin && !NPC.AnyNPCs(105))
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 105, 0);
}
else
{
if (Main.hardMode && Main.rand.Next(20) == 0 && !flag5 && (double)num2 >= Main.rockLayer && num2 < Main.maxTilesY - 210 && !NPC.savedWizard && !NPC.AnyNPCs(106))
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 106, 0);
}
else
{
if (flag8)
{
if (flag5)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 55, 0);
}
else
{
if (num29 == 147 || num29 == 161)
{
if (Main.rand.Next(2) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 148, 0);
}
else
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 149, 0);
}
}
else
{
if (num29 != 2 && num29 != 109 && (double)num2 <= Main.worldSurface)
{
return;
}
if (Main.raining)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 230, 0);
}
else
{
if (Main.rand.Next(2) == 0 && (double)num2 <= Main.worldSurface)
{
int num31 = Main.rand.Next(4);
if (num31 == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 297, 0);
}
else
{
if (num31 == 1)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 298, 0);
}
else
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 74, 0);
}
}
}
else
{
if (Main.rand.Next(3) == 0 && (double)num2 <= Main.worldSurface)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 299, 0);
}
else
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 46, 0);
}
}
}
}
}
}
else
{
if (Main.player[j].zoneDungeon)
{
int num32 = 0;
if (Main.tile[num, num2].wall == 94 || Main.tile[num, num2].wall == 96 || Main.tile[num, num2].wall == 98)
{
num32 = 1;
}
if (Main.tile[num, num2].wall == 95 || Main.tile[num, num2].wall == 97 || Main.tile[num, num2].wall == 99)
{
num32 = 2;
}
if (!NPC.downedBoss3)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 68, 0);
}
else
{
if (!NPC.savedMech && Main.rand.Next(5) == 0 && !flag5 && !NPC.AnyNPCs(123) && (double)num2 > Main.rockLayer)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 123, 0);
}
else
{
if (flag10 && Main.rand.Next(75) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 287, 0);
}
else
{
if (flag10 && num32 == 0 && Main.rand.Next(25) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 293, 0);
}
else
{
if (flag10 && num32 == 1 && Main.rand.Next(25) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 291, 0);
}
else
{
if (flag10 && num32 == 2 && Main.rand.Next(25) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 292, 0);
}
else
{
if (flag10 && !NPC.AnyNPCs(290) && num32 == 0 && Main.rand.Next(45) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 290, 0);
}
else
{
if (flag10 && (num32 == 1 || num32 == 2) && Main.rand.Next(30) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 289, 0);
}
else
{
if (flag10 && Main.rand.Next(20) == 0)
{
int num33 = 281;
if (num32 == 0)
{
num33 += 2;
}
if (num32 == 2)
{
num33 += 4;
}
num33 += Main.rand.Next(2);
if (!NPC.AnyNPCs(num33))
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, num33, 0);
}
}
else
{
if (flag10 && Main.rand.Next(3) != 0)
{
int num34 = 269;
if (num32 == 0)
{
num34 += 4;
}
if (num32 == 2)
{
num34 += 8;
}
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, num34 + Main.rand.Next(4), 0);
}
else
{
if (Main.rand.Next(37) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 71, 0);
}
else
{
if (num32 == 1 && Main.rand.Next(4) == 0 && !NPC.NearSpikeBall(num, num2))
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 70, 0);
}
else
{
if (num32 == 2 && Main.rand.Next(15) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 72, 0);
}
else
{
if (num32 == 0 && Main.rand.Next(9) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 34, 0);
}
else
{
if (Main.rand.Next(7) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 32, 0);
}
else
{
int num35 = Main.rand.Next(5);
if (num35 == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 294, 0);
}
else
{
if (num35 == 1)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 295, 0);
}
else
{
if (num35 == 2)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 296, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 31, 0);
if (Main.rand.Next(4) == 0)
{
Main.npc[num30].SetDefaults("Big Boned");
}
else
{
if (Main.rand.Next(5) == 0)
{
Main.npc[num30].SetDefaults("Short Bones");
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
else
{
if (Main.player[j].zoneMeteor)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 23, 0);
}
else
{
if ((double)num2 <= Main.worldSurface && Main.dayTime && Main.eclipse)
{
if (Main.rand.Next(50) == 0 && !NPC.AnyNPCs(251))
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 251, 0);
}
else
{
if (Main.rand.Next(10) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 253, 0);
}
else
{
if (Main.rand.Next(12) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 158, 0);
}
else
{
if (Main.rand.Next(3) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 162, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 166, 0);
}
}
}
}
}
else
{
if (Main.hardMode && num3 == 70 && flag5)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 256, 0);
}
else
{
if (num3 == 70 && (double)num2 <= Main.worldSurface && Main.rand.Next(3) != 0)
{
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(4) == 0)
{
if (Main.hardMode && Main.rand.Next(3) != 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 260, 0);
Main.npc[num30].ai[0] = (float)num;
Main.npc[num30].ai[1] = (float)num2;
Main.npc[num30].netUpdate = true;
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 259, 0);
Main.npc[num30].ai[0] = (float)num;
Main.npc[num30].ai[1] = (float)num2;
Main.npc[num30].netUpdate = true;
}
}
else
{
if (Main.rand.Next(2) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 257, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 258, 0);
}
}
}
else
{
if (Main.rand.Next(2) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 254, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 255, 0);
}
}
}
else
{
if (num3 == 70 && Main.hardMode && (double)num2 >= Main.worldSurface && Main.rand.Next(3) != 0)
{
if (Main.rand.Next(4) == 0)
{
if (Main.hardMode && Main.rand.Next(3) != 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 260, 0);
Main.npc[num30].ai[0] = (float)num;
Main.npc[num30].ai[1] = (float)num2;
Main.npc[num30].netUpdate = true;
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 259, 0);
Main.npc[num30].ai[0] = (float)num;
Main.npc[num30].ai[1] = (float)num2;
Main.npc[num30].netUpdate = true;
}
}
else
{
if (Main.rand.Next(2) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 257, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 258, 0);
}
}
}
else
{
if (Main.player[j].zoneEvil && Main.rand.Next(65) == 0 && !flag3)
{
if (Main.hardMode && Main.rand.Next(4) != 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 98, 1);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 7, 1);
}
}
else
{
if (Main.hardMode && (double)num2 > Main.worldSurface && Main.rand.Next(75) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 85, 0);
}
else
{
if (Main.hardMode && Main.tile[num, num2 - 1].wall == 2 && Main.rand.Next(20) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 85, 0);
}
else
{
if (Main.hardMode && (double)num2 <= Main.worldSurface && !Main.dayTime && (Main.rand.Next(20) == 0 || (Main.rand.Next(5) == 0 && Main.moonPhase == 4)))
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 82, 0);
}
else
{
if (num29 == 60 && Main.rand.Next(500) == 0 && !Main.dayTime)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 52, 0);
}
else
{
if (num29 == 60 && (double)num2 > Main.worldSurface && Main.rand.Next(60) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 219, 0);
}
else
{
if ((double)num2 > Main.worldSurface && !Main.player[j].zoneSnow && !Main.player[j].zoneBlood && !Main.player[j].zoneEvil && !Main.player[j].zoneJungle && !Main.player[j].zoneHoly && Main.rand.Next(10) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 300, 0);
}
else
{
if (num29 == 60 && Main.hardMode && Main.rand.Next(3) != 0)
{
if ((double)num2 < Main.worldSurface && !Main.dayTime && Main.rand.Next(3) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 152, 0);
}
else
{
if ((double)num2 < Main.worldSurface && Main.dayTime && Main.rand.Next(4) != 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 177, 0);
}
else
{
if ((double)num2 > Main.worldSurface && Main.rand.Next(100) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 205, 0);
}
else
{
if ((double)num2 > Main.worldSurface && Main.rand.Next(5) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 236, 0);
}
else
{
if ((double)num2 > Main.worldSurface && Main.rand.Next(4) != 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 176, 0);
if (Main.rand.Next(10) == 0)
{
Main.npc[num30].SetDefaults("Tiny Moss Hornet");
}
if (Main.rand.Next(10) == 0)
{
Main.npc[num30].SetDefaults("Little Moss Hornet");
}
if (Main.rand.Next(10) == 0)
{
Main.npc[num30].SetDefaults("Big Moss Hornet");
}
if (Main.rand.Next(10) == 0)
{
Main.npc[num30].SetDefaults("Giant Moss Hornet");
}
}
else
{
if (Main.rand.Next(3) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 175, 0);
Main.npc[num30].ai[0] = (float)num;
Main.npc[num30].ai[1] = (float)num2;
Main.npc[num30].netUpdate = true;
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 153, 0);
}
}
}
}
}
}
}
else
{
if (num29 == 226 && flag2)
{
if (Main.rand.Next(3) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 226, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 198, 0);
}
}
else
{
if (num29 == 60 && (double)num2 > (Main.worldSurface + Main.rockLayer) / 2.0)
{
if (Main.rand.Next(4) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 204, 0);
}
else
{
if (Main.rand.Next(4) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 43, 0);
Main.npc[num30].ai[0] = (float)num;
Main.npc[num30].ai[1] = (float)num2;
Main.npc[num30].netUpdate = true;
}
else
{
int num36 = Main.rand.Next(8);
if (num36 == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 231, 0);
if (Main.rand.Next(4) == 0)
{
Main.npc[num30].SetDefaults("Little Hornet Fatty");
}
else
{
if (Main.rand.Next(4) == 0)
{
Main.npc[num30].SetDefaults("Big Hornet Fatty");
}
}
}
else
{
if (num36 == 1)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 232, 0);
if (Main.rand.Next(4) == 0)
{
Main.npc[num30].SetDefaults("Little Hornet Honey");
}
else
{
if (Main.rand.Next(4) == 0)
{
Main.npc[num30].SetDefaults("Big Hornet Honey");
}
}
}
else
{
if (num36 == 2)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 233, 0);
if (Main.rand.Next(4) == 0)
{
Main.npc[num30].SetDefaults("Little Hornet Leafy");
}
else
{
if (Main.rand.Next(4) == 0)
{
Main.npc[num30].SetDefaults("Big Hornet Leafy");
}
}
}
else
{
if (num36 == 3)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 234, 0);
if (Main.rand.Next(4) == 0)
{
Main.npc[num30].SetDefaults("Little Hornet Spikey");
}
else
{
if (Main.rand.Next(4) == 0)
{
Main.npc[num30].SetDefaults("Big Hornet Spikey");
}
}
}
else
{
if (num36 == 4)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 235, 0);
if (Main.rand.Next(4) == 0)
{
Main.npc[num30].SetDefaults("Little Hornet Stingy");
}
else
{
if (Main.rand.Next(4) == 0)
{
Main.npc[num30].SetDefaults("Big Hornet Stingy");
}
}
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 42, 0);
if (Main.rand.Next(4) == 0)
{
Main.npc[num30].SetDefaults("Little Stinger");
}
else
{
if (Main.rand.Next(4) == 0)
{
Main.npc[num30].SetDefaults("Big Stinger");
}
}
}
}
}
}
}
}
}
}
else
{
if (num29 == 60 && Main.rand.Next(4) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 51, 0);
}
else
{
if (num29 == 60 && Main.rand.Next(8) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 56, 0);
Main.npc[num30].ai[0] = (float)num;
Main.npc[num30].ai[1] = (float)num2;
Main.npc[num30].netUpdate = true;
}
else
{
if (Main.hardMode && num29 == 53 && Main.rand.Next(3) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 78, 0);
}
else
{
if (Main.hardMode && (num29 == 112 || num29 == 234) && Main.rand.Next(2) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 79, 0);
}
else
{
if (Main.hardMode && num29 == 116 && Main.rand.Next(2) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 80, 0);
}
else
{
if (Main.hardMode && !flag5 && (double)num2 < Main.rockLayer && (num29 == 116 || num29 == 117 || num29 == 109 || num29 == 164))
{
if (!Main.dayTime && Main.rand.Next(2) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 122, 0);
}
else
{
if (Main.rand.Next(10) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 86, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 75, 0);
}
}
}
else
{
if (!flag3 && Main.hardMode && Main.rand.Next(50) == 0 && !flag5 && (double)num2 >= Main.rockLayer && (num29 == 116 || num29 == 117 || num29 == 109 || num29 == 164))
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 84, 0);
}
else
{
if ((num29 == 204 && Main.player[j].zoneBlood) || num29 == 199 || num29 == 200 || num29 == 203)
{
if (Main.hardMode && (double)num2 >= Main.rockLayer && Main.rand.Next(5) == 0 && !flag3)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 182, 0);
}
else
{
if (Main.hardMode && (double)num2 >= Main.rockLayer && Main.rand.Next(2) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 268, 0);
}
else
{
if (Main.hardMode && Main.rand.Next(3) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 183, 0);
if (Main.rand.Next(3) == 0)
{
Main.npc[num30].SetDefaults("Little Crimslime");
}
else
{
if (Main.rand.Next(3) == 0)
{
Main.npc[num30].SetDefaults("Big Crimslime");
}
}
}
else
{
if (Main.hardMode && (double)num2 >= Main.rockLayer && Main.rand.Next(40) == 0 && !flag3)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 179, 0);
}
else
{
if (Main.hardMode && (Main.rand.Next(2) == 0 || (double)num2 > Main.worldSurface))
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 174, 0);
}
else
{
if ((Main.tile[num, num2].wall > 0 && Main.rand.Next(4) != 0) || Main.rand.Next(8) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 239, 0);
}
else
{
if (Main.rand.Next(2) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 181, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 173, 0);
if (Main.rand.Next(3) == 0)
{
Main.npc[num30].SetDefaults("Little Crimera");
}
else
{
if (Main.rand.Next(3) == 0)
{
Main.npc[num30].SetDefaults("Big Crimera");
}
}
}
}
}
}
}
}
}
}
else
{
if ((num29 == 22 && Main.player[j].zoneEvil) || num29 == 23 || num29 == 25 || num29 == 112 || num29 == 163)
{
if (Main.hardMode && (double)num2 >= Main.rockLayer && Main.rand.Next(3) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 101, 0);
Main.npc[num30].ai[0] = (float)num;
Main.npc[num30].ai[1] = (float)num2;
Main.npc[num30].netUpdate = true;
}
else
{
if (Main.hardMode && Main.rand.Next(3) == 0)
{
if (Main.rand.Next(3) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 121, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 81, 0);
}
}
else
{
if (Main.hardMode && (double)num2 >= Main.rockLayer && Main.rand.Next(40) == 0 && !flag3)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 83, 0);
}
else
{
if (Main.hardMode && (Main.rand.Next(2) == 0 || (double)num2 > Main.rockLayer))
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 94, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 6, 0);
if (Main.rand.Next(3) == 0)
{
Main.npc[num30].SetDefaults("Little Eater");
}
else
{
if (Main.rand.Next(3) == 0)
{
Main.npc[num30].SetDefaults("Big Eater");
}
}
}
}
}
}
}
else
{
if ((double)num2 <= Main.worldSurface)
{
if (Main.player[j].zoneSnow && Main.hardMode && Main.cloudAlpha > 0f && !NPC.AnyNPCs(243) && Main.rand.Next(20) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 243, 0);
}
else
{
if (Main.player[j].zoneHoly && Main.hardMode && Main.cloudAlpha > 0f && !NPC.AnyNPCs(244) && Main.rand.Next(20) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 244, 0);
}
else
{
if (!Main.player[j].zoneSnow && Main.hardMode && Main.cloudAlpha > 0f && !NPC.AnyNPCs(250) && Main.rand.Next(14) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 250, 0);
}
else
{
if (Main.dayTime)
{
int num37 = Math.Abs(num - Main.spawnTileX);
if (num37 < Main.maxTilesX / 3 && Main.rand.Next(15) == 0 && (num29 == 2 || num29 == 109 || num29 == 147 || num29 == 161))
{
if (num29 == 147 || num29 == 161)
{
if (Main.rand.Next(2) == 0)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 148, 0);
}
else
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 149, 0);
}
}
else
{
if (Main.rand.Next(3) == 0 && (double)num2 <= Main.worldSurface)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 299, 0);
}
else
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 46, 0);
}
}
}
else
{
if (num37 < Main.maxTilesX / 3 && Main.rand.Next(15) == 0 && (num29 == 2 || num29 == 109 || num29 == 147))
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 74, 0);
}
else
{
if (num37 > Main.maxTilesX / 3 && num29 == 2 && Main.rand.Next(300) == 0 && !NPC.AnyNPCs(50))
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 50, 0);
}
else
{
if (num29 == 53 && Main.rand.Next(5) == 0 && !flag5)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 69, 0);
}
else
{
if (num29 == 53 && !flag5)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 61, 0);
}
else
{
if (num37 > Main.maxTilesX / 3 && (Main.rand.Next(15) == 0 || (!NPC.downedGoblins && WorldGen.shadowOrbSmashed && Main.rand.Next(7) == 0)))
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 73, 0);
}
else
{
if (Main.raining && Main.rand.Next(3) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 224, 0);
}
else
{
if (Main.raining && Main.rand.Next(2) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 225, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 1, 0);
if (num29 == 60)
{
Main.npc[num30].SetDefaults("Jungle Slime");
}
else
{
if (num29 == 161 || num29 == 147)
{
Main.npc[num30].SetDefaults("Ice Slime");
}
else
{
if (Main.rand.Next(3) == 0 || num37 < 200)
{
Main.npc[num30].SetDefaults("Green Slime");
}
else
{
if (Main.rand.Next(10) == 0 && num37 > 400)
{
Main.npc[num30].SetDefaults("Purple Slime");
}
}
}
}
}
}
}
}
}
}
}
}
}
else
{
if (Main.rand.Next(6) == 0 || (Main.moonPhase == 4 && Main.rand.Next(2) == 0))
{
if (Main.hardMode && Main.rand.Next(3) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 133, 0);
}
else
{
if (Main.rand.Next(2) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 2, 0);
if (Main.rand.Next(4) == 0)
{
Main.npc[num30].SetDefaults("Demon Eye 2");
}
}
else
{
int num38 = Main.rand.Next(5);
if (num38 == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 190, 0);
if (Main.rand.Next(3) == 0)
{
Main.npc[num30].SetDefaults("Cataract Eye 2");
}
}
else
{
if (num38 == 1)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 191, 0);
if (Main.rand.Next(3) == 0)
{
Main.npc[num30].SetDefaults("Sleepy Eye 2");
}
}
else
{
if (num38 == 2)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 192, 0);
if (Main.rand.Next(3) == 0)
{
Main.npc[num30].SetDefaults("Dialated Eye 2");
}
}
else
{
if (num38 == 3)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 193, 0);
if (Main.rand.Next(3) == 0)
{
Main.npc[num30].SetDefaults("Green Eye 2");
}
}
else
{
if (num38 == 4)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 194, 0);
if (Main.rand.Next(3) == 0)
{
Main.npc[num30].SetDefaults("Purple Eye 2");
}
}
}
}
}
}
}
}
}
else
{
if (Main.hardMode && Main.rand.Next(50) == 0 && Main.bloodMoon && !NPC.AnyNPCs(109))
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 109, 0);
}
else
{
if (Main.rand.Next(250) == 0 && Main.bloodMoon)
{
NPC.NewNPC(num * 16 + 8, num2 * 16, 53, 0);
}
else
{
if (Main.moonPhase == 0 && Main.hardMode && Main.rand.Next(3) != 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 104, 0);
}
else
{
if (Main.hardMode && Main.rand.Next(3) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 140, 0);
}
else
{
if (num3 == 147 || num3 == 161 || num3 == 163 || num3 == 164 || num3 == 162)
{
if (Main.hardMode && Main.rand.Next(4) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 169, 0);
}
else
{
if (Main.hardMode && Main.rand.Next(3) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 155, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 161, 0);
}
}
}
else
{
if (Main.raining && Main.rand.Next(2) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 223, 0);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[num30].SetDefaults("Small Rain Zombie");
}
else
{
Main.npc[num30].SetDefaults("Big Rain Zombie");
}
}
}
else
{
int num39 = Main.rand.Next(7);
if (num39 == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 3, 0);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[num30].SetDefaults("Small Zombie");
}
else
{
Main.npc[num30].SetDefaults("Big Zombie");
}
}
}
else
{
if (num39 == 1)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 132, 0);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[num30].SetDefaults("Small Bald Zombie");
}
else
{
Main.npc[num30].SetDefaults("Big Bald Zombie");
}
}
}
else
{
if (num39 == 2)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 186, 0);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[num30].SetDefaults("Small Pincushion Zombie");
}
else
{
Main.npc[num30].SetDefaults("Big Pincushion Zombie");
}
}
}
else
{
if (num39 == 3)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 187, 0);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[num30].SetDefaults("Small Slimed Zombie");
}
else
{
Main.npc[num30].SetDefaults("Big Slimed Zombie");
}
}
}
else
{
if (num39 == 4)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 188, 0);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[num30].SetDefaults("Small Swamp Zombie");
}
else
{
Main.npc[num30].SetDefaults("Big Swamp Zombie");
}
}
}
else
{
if (num39 == 5)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 189, 0);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[num30].SetDefaults("Small Twiggy Zombie");
}
else
{
Main.npc[num30].SetDefaults("Big Twiggy Zombie");
}
}
}
else
{
if (num39 == 6)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 200, 0);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[num30].SetDefaults("Small Female Zombie");
}
else
{
Main.npc[num30].SetDefaults("Big Female Zombie");
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
else
{
if ((double)num2 <= Main.rockLayer)
{
if (!flag3 && Main.rand.Next(50) == 0 && !Main.player[j].zoneSnow)
{
if (Main.hardMode)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 95, 1);
}
else
{
if (Main.player[j].zoneSnow)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 185, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 10, 1);
}
}
}
else
{
if (Main.hardMode && Main.rand.Next(3) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 140, 0);
}
else
{
if (Main.hardMode && Main.rand.Next(4) != 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 141, 0);
}
else
{
if (num29 == 147 || num29 == 161 || Main.player[j].zoneSnow)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 147, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 1, 0);
if (Main.rand.Next(5) == 0)
{
Main.npc[num30].SetDefaults("Yellow Slime");
}
else
{
if (Main.rand.Next(2) == 0)
{
Main.npc[num30].SetDefaults("Blue Slime");
}
else
{
Main.npc[num30].SetDefaults("Red Slime");
}
}
}
}
}
}
}
else
{
if (num2 > Main.maxTilesY - 190)
{
if (Main.rand.Next(40) == 0 && !NPC.AnyNPCs(39))
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 39, 1);
}
else
{
if (Main.rand.Next(14) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 24, 0);
}
else
{
if (Main.rand.Next(8) == 0)
{
if (Main.rand.Next(7) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 66, 0);
}
else
{
if (NPC.downedMechBossAny && Main.rand.Next(5) != 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 156, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 62, 0);
}
}
}
else
{
if (Main.rand.Next(3) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 59, 0);
}
else
{
if (NPC.downedMechBossAny && Main.rand.Next(5) != 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 151, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 60, 0);
}
}
}
}
}
}
else
{
if (Main.rand.Next(60) == 0)
{
if (Main.player[j].zoneSnow)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 218, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 217, 0);
}
}
else
{
if ((num29 == 116 || num29 == 117 || num29 == 164) && !flag3 && Main.rand.Next(8) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 120, 0);
}
else
{
if ((num3 == 147 || num3 == 161 || num3 == 162 || num3 == 163 || num3 == 164) && !flag3 && Main.hardMode && Main.player[j].zoneEvil && Main.rand.Next(30) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 170, 0);
}
else
{
if ((num3 == 147 || num3 == 161 || num3 == 162 || num3 == 163 || num3 == 164) && !flag3 && Main.hardMode && Main.player[j].zoneHoly && Main.rand.Next(30) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 171, 0);
}
else
{
if ((num3 == 147 || num3 == 161 || num3 == 162 || num3 == 163 || num3 == 164) && !flag3 && Main.hardMode && Main.player[j].zoneBlood && Main.rand.Next(30) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 171, 0);
}
else
{
if (Main.hardMode && Main.player[j].zoneSnow && Main.rand.Next(10) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 154, 0);
}
else
{
if (!flag3 && Main.rand.Next(100) == 0 && !Main.player[j].zoneHoly)
{
if (Main.hardMode)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 95, 1);
}
else
{
if (Main.player[j].zoneSnow)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 185, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 10, 1);
}
}
}
else
{
if (Main.player[j].zoneSnow && Main.rand.Next(20) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 185, 0);
}
else
{
if (!Main.hardMode && Main.rand.Next(10) == 0)
{
if (Main.player[j].zoneSnow)
{
Main.npc[num30].SetDefaults(184, -1f);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 16, 0);
}
}
else
{
if (!Main.hardMode && Main.rand.Next(4) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 1, 0);
if (Main.player[j].zoneJungle)
{
Main.npc[num30].SetDefaults("Jungle Slime");
}
else
{
if (Main.player[j].zoneSnow)
{
Main.npc[num30].SetDefaults(184, -1f);
}
else
{
Main.npc[num30].SetDefaults("Black Slime");
}
}
}
else
{
if (Main.rand.Next(2) == 0)
{
if ((!Main.hardMode && Main.rand.Next(100) == 0) || Main.rand.Next(500) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 195, 0);
}
else
{
if (Main.hardMode && (double)num2 > (Main.rockLayer + (double)Main.maxTilesY) / 2.0 && Main.rand.Next(400) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 172, 0);
}
else
{
if ((double)num2 > (Main.rockLayer + (double)Main.maxTilesY) / 2.0 && Main.rand.Next(350) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 45, 0);
}
else
{
if (Main.hardMode && Main.rand.Next(10) != 0)
{
if (Main.rand.Next(2) == 0)
{
if (Main.player[j].zoneSnow)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 197, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 77, 0);
if ((double)num2 > (Main.rockLayer + (double)Main.maxTilesY) / 2.0 && Main.rand.Next(5) == 0)
{
Main.npc[num30].SetDefaults("Heavy Skeleton");
}
}
}
else
{
if (Main.player[j].zoneSnow)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 206, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 110, 0);
}
}
}
else
{
if (Main.rand.Next(20) == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 44, 0);
}
else
{
if (num3 == 147 || num3 == 161 || num3 == 162)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 167, 0);
}
else
{
if (Main.player[j].zoneSnow)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 185, 0);
}
else
{
int num40 = Main.rand.Next(4);
if (num40 == 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 21, 0);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[num30].SetDefaults("Big Skeleton");
}
else
{
Main.npc[num30].SetDefaults("Small Skeleton");
}
}
}
else
{
if (num40 == 1)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 201, 0);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[num30].SetDefaults("Big Headache Skeleton");
}
else
{
Main.npc[num30].SetDefaults("Small Headache Skeleton");
}
}
}
else
{
if (num40 == 2)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 202, 0);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[num30].SetDefaults("Big Misassembled Skeleton");
}
else
{
Main.npc[num30].SetDefaults("Small Misassembled Skeleton");
}
}
}
else
{
if (num40 == 3)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 203, 0);
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(2) == 0)
{
Main.npc[num30].SetDefaults("Big Pantless Skeleton");
}
else
{
Main.npc[num30].SetDefaults("Small Pantless Skeleton");
}
}
}
}
}
}
}
}
}
}
}
}
}
}
else
{
if (Main.hardMode && (Main.player[j].zoneHoly & Main.rand.Next(2) == 0))
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 138, 0);
}
else
{
if (Main.player[j].zoneJungle)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 51, 0);
}
else
{
if (Main.hardMode && Main.player[j].zoneHoly)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 137, 0);
}
else
{
if (Main.hardMode && Main.rand.Next(6) > 0)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 93, 0);
}
else
{
if (num3 == 147 || num3 == 161 || num3 == 162)
{
if (Main.hardMode)
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 169, 0);
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 150, 0);
}
}
else
{
num30 = NPC.NewNPC(num * 16 + 8, num2 * 16, 49, 0);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (Main.npc[num30].type == 1 && Main.rand.Next(250) == 0)
{
Main.npc[num30].SetDefaults("Pinky");
}
if (Main.netMode == 2 && num30 < 200)
{
NetMessage.SendData(23, -1, -1, "", num30, 0f, 0f, 0f, 0);
return;
}
break;
}
}
}
}
public static void SpawnWOF(Vector2 pos)
{
if (pos.Y / 16f < (float)(Main.maxTilesY - 205))
{
return;
}
if (Main.wof >= 0)
{
return;
}
if (Main.netMode == 1)
{
return;
}
Player.FindClosest(pos, 16, 16);
int num = 1;
if (pos.X / 16f > (float)(Main.maxTilesX / 2))
{
num = -1;
}
bool flag = false;
int num2 = (int)pos.X;
while (!flag)
{
flag = true;
for (int i = 0; i < 255; i++)
{
if (Main.player[i].active && Main.player[i].position.X > (float)(num2 - 1200) && Main.player[i].position.X < (float)(num2 + 1200))
{
num2 -= num * 16;
flag = false;
}
}
if (num2 / 16 < 20 || num2 / 16 > Main.maxTilesX - 20)
{
flag = true;
}
}
int num3 = (int)pos.Y;
int num4 = num2 / 16;
int num5 = num3 / 16;
int num6 = 0;
try
{
while (WorldGen.SolidTile(num4, num5 - num6) || Main.tile[num4, num5 - num6].liquid >= 100)
{
if (!WorldGen.SolidTile(num4, num5 + num6) && Main.tile[num4, num5 + num6].liquid < 100)
{
num5 += num6;
goto IL_162;
}
num6++;
}
num5 -= num6;
}
catch
{
}
IL_162:
num3 = num5 * 16;
int num7 = NPC.NewNPC(num2, num3, 113, 0);
if (Main.npc[num7].displayName == "")
{
Main.npc[num7].displayName = Main.npc[num7].name;
}
if (Main.netMode == 0)
{
Main.NewText(Main.npc[num7].displayName + " " + Lang.misc[16], 175, 75, 255, false);
return;
}
if (Main.netMode == 2)
{
NetMessage.SendData(25, -1, -1, Main.npc[num7].displayName + " " + Lang.misc[16], 255, 175f, 75f, 255f, 0);
}
}
public static void SpawnOnPlayer(int plr, int Type)
{
if (Main.netMode == 1)
{
return;
}
if (Type == 262 && NPC.AnyNPCs(262))
{
return;
}
if (Type != 245)
{
bool flag = false;
int num = 0;
int num2 = 0;
int num3 = (int)(Main.player[plr].position.X / 16f) - NPC.spawnRangeX * 2;
int num4 = (int)(Main.player[plr].position.X / 16f) + NPC.spawnRangeX * 2;
int num5 = (int)(Main.player[plr].position.Y / 16f) - NPC.spawnRangeY * 2;
int num6 = (int)(Main.player[plr].position.Y / 16f) + NPC.spawnRangeY * 2;
int num7 = (int)(Main.player[plr].position.X / 16f) - NPC.safeRangeX;
int num8 = (int)(Main.player[plr].position.X / 16f) + NPC.safeRangeX;
int num9 = (int)(Main.player[plr].position.Y / 16f) - NPC.safeRangeY;
int num10 = (int)(Main.player[plr].position.Y / 16f) + NPC.safeRangeY;
if (num3 < 0)
{
num3 = 0;
}
if (num4 > Main.maxTilesX)
{
num4 = Main.maxTilesX;
}
if (num5 < 0)
{
num5 = 0;
}
if (num6 > Main.maxTilesY)
{
num6 = Main.maxTilesY;
}
for (int i = 0; i < 1000; i++)
{
int j = 0;
while (j < 100)
{
int num11 = Main.rand.Next(num3, num4);
int num12 = Main.rand.Next(num5, num6);
if (Main.tile[num11, num12].nactive() && Main.tileSolid[(int)Main.tile[num11, num12].type])
{
goto IL_518;
}
if (!Main.wallHouse[(int)Main.tile[num11, num12].wall] || i >= 999)
{
int k = num12;
while (k < Main.maxTilesY)
{
if (Main.tile[num11, k].nactive() && Main.tileSolid[(int)Main.tile[num11, k].type])
{
if (num11 < num7 || num11 > num8 || k < num9 || k > num10 || i == 999)
{
byte arg_43A_0 = Main.tile[num11, k].type;
num = num11;
num2 = k;
flag = true;
break;
}
break;
}
else
{
k++;
}
}
if (!flag || i >= 999)
{
goto IL_518;
}
int num13 = num - NPC.spawnSpaceX / 2;
int num14 = num + NPC.spawnSpaceX / 2;
int num15 = num2 - NPC.spawnSpaceY;
int num16 = num2;
if (num13 < 0)
{
flag = false;
}
if (num14 > Main.maxTilesX)
{
flag = false;
}
if (num15 < 0)
{
flag = false;
}
if (num16 > Main.maxTilesY)
{
flag = false;
}
if (flag)
{
for (int l = num13; l < num14; l++)
{
for (int m = num15; m < num16; m++)
{
if (Main.tile[l, m].nactive() && Main.tileSolid[(int)Main.tile[l, m].type])
{
flag = false;
break;
}
}
}
goto IL_518;
}
goto IL_518;
}
IL_520:
j++;
continue;
IL_518:
if (!flag && !flag)
{
goto IL_520;
}
break;
}
if (flag && i < 999)
{
Rectangle rectangle = new Rectangle(num * 16, num2 * 16, 16, 16);
for (int n = 0; n < 255; n++)
{
if (Main.player[n].active)
{
Rectangle rectangle2 = new Rectangle((int)(Main.player[n].position.X + (float)(Main.player[n].width / 2) - (float)(NPC.sWidth / 2) - (float)NPC.safeRangeX), (int)(Main.player[n].position.Y + (float)(Main.player[n].height / 2) - (float)(NPC.sHeight / 2) - (float)NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2);
if (rectangle.Intersects(rectangle2))
{
flag = false;
}
}
}
}
if (flag)
{
break;
}
}
if (flag)
{
int num17 = NPC.NewNPC(num * 16 + 8, num2 * 16, Type, 1);
if (num17 == 200)
{
return;
}
Main.npc[num17].target = plr;
Main.npc[num17].timeLeft *= 20;
string str = Main.npc[num17].name;
if (Main.npc[num17].displayName != "")
{
str = Main.npc[num17].displayName;
}
if (Main.netMode == 2 && num17 < 200)
{
NetMessage.SendData(23, -1, -1, "", num17, 0f, 0f, 0f, 0);
}
if (Type == 125)
{
if (Main.netMode == 0)
{
Main.NewText("The Twins " + Lang.misc[16], 175, 75, 255, false);
return;
}
if (Main.netMode == 2)
{
NetMessage.SendData(25, -1, -1, "The Twins " + Lang.misc[16], 255, 175f, 75f, 255f, 0);
return;
}
}
else
{
if (Type != 82 && Type != 126 && Type != 50)
{
if (Main.netMode == 0)
{
Main.NewText(str + " " + Lang.misc[16], 175, 75, 255, false);
return;
}
if (Main.netMode == 2)
{
NetMessage.SendData(25, -1, -1, str + " " + Lang.misc[16], 255, 175f, 75f, 255f, 0);
}
}
}
}
return;
}
if (NPC.AnyNPCs(245))
{
return;
}
try
{
int num18 = (int)Main.player[plr].center().X / 16;
int num19 = (int)Main.player[plr].center().Y / 16;
int num20 = 0;
int num21 = 0;
for (int num22 = num18 - 20; num22 < num18 + 20; num22++)
{
for (int num23 = num19 - 20; num23 < num19 + 20; num23++)
{
if (Main.tile[num22, num23].active() && Main.tile[num22, num23].type == 237 && Main.tile[num22, num23].frameX == 18 && Main.tile[num22, num23].frameY == 0)
{
num20 = num22;
num21 = num23;
}
}
}
if (num20 > 0 && num21 > 0)
{
int num24 = num21 - 15;
int num25 = num21 - 15;
for (int num26 = num21; num26 > num21 - 100; num26--)
{
if (WorldGen.SolidTile(num20, num26))
{
num24 = num26;
break;
}
}
for (int num27 = num21; num27 < num21 + 100; num27++)
{
if (WorldGen.SolidTile(num20, num27))
{
num25 = num27;
break;
}
}
num21 = (num24 + num24 + num25) / 3;
int num28 = NPC.NewNPC(num20 * 16 + 8, num21 * 16, 245, 100);
Main.npc[num28].target = plr;
string str2 = Main.npc[num28].name;
if (Main.netMode == 0)
{
Main.NewText(str2 + " " + Lang.misc[16], 175, 75, 255, false);
}
else
{
if (Main.netMode == 2)
{
NetMessage.SendData(25, -1, -1, str2 + " " + Lang.misc[16], 255, 175f, 75f, 255f, 0);
}
}
}
}
catch
{
}
}
public static int NewNPC(int X, int Y, int Type, int Start = 0)
{
int num = -1;
if (Type == 222)
{
for (int i = 199; i >= 0; i--)
{
if (!Main.npc[i].active)
{
num = i;
break;
}
}
}
else
{
for (int j = Start; j < 200; j++)
{
if (!Main.npc[j].active)
{
num = j;
break;
}
}
}
if (num >= 0)
{
Main.npc[num] = new NPC();
Main.npc[num].SetDefaults(Type, -1f);
Main.npc[num].position.X = (float)(X - Main.npc[num].width / 2);
Main.npc[num].position.Y = (float)(Y - Main.npc[num].height);
Main.npc[num].active = true;
Main.npc[num].timeLeft = (int)((double)NPC.activeTime * 1.25);
Main.npc[num].wet = Collision.WetCollision(Main.npc[num].position, Main.npc[num].width, Main.npc[num].height);
if (Type == 50)
{
if (Main.netMode == 0)
{
Main.NewText(Main.npc[num].name + " " + Lang.misc[16], 175, 75, 255, false);
}
else
{
if (Main.netMode == 2)
{
NetMessage.SendData(25, -1, -1, Main.npc[num].name + " " + Lang.misc[16], 255, 175f, 75f, 255f, 0);
}
}
}
return num;
}
return 200;
}
public void xForm(int oldType, int newType)
{
if ((oldType == 158 && newType == 159) || (oldType == 159 && newType == 158))
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8);
int num = Gore.NewGore(new Vector2(this.position.X, this.position.Y - 10f), this.velocity, 99, this.scale);
Main.gore[num].velocity *= 0.3f;
num = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2) - 10f), this.velocity, 99, this.scale);
Main.gore[num].velocity *= 0.3f;
num = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)this.height - 10f), this.velocity, 99, this.scale);
Main.gore[num].velocity *= 0.3f;
}
}
public void Teleport(Vector2 newPos, int Style = 0)
{
Main.TeleportEffect(this.getRect(), Style);
this.position = newPos;
Main.TeleportEffect(this.getRect(), Style);
this.teleportTime = 1f;
if (Main.netMode == 2)
{
NetMessage.SendData(65, -1, -1, "", 1, (float)this.whoAmI, newPos.X, newPos.Y, Style);
}
}
public void Transform(int newType)
{
if (Main.netMode != 1)
{
bool flag = false;
if (this.value == 0f)
{
flag = true;
}
int oldType = this.type;
int num = this.life;
int num2 = this.lifeMax;
Vector2 vector = this.velocity;
this.position.Y = this.position.Y + (float)this.height;
int num3 = this.spriteDirection;
this.SetDefaults(newType, -1f);
this.spriteDirection = num3;
this.TargetClosest(true);
this.velocity = vector;
this.position.Y = this.position.Y - (float)this.height;
if (flag)
{
this.value = 0f;
}
if (this.lifeMax == num2)
{
this.life = num;
}
if (newType == 107 || newType == 108)
{
this.homeTileX = (int)(this.position.X + (float)(this.width / 2)) / 16;
this.homeTileY = (int)(this.position.Y + (float)this.height) / 16;
this.homeless = true;
}
if (Main.netMode == 2)
{
this.netUpdate = true;
NetMessage.SendData(23, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0);
}
this.xForm(oldType, newType);
}
}
public double StrikeNPC(int Damage, float knockBack, int hitDirection, bool crit = false, bool noEffect = false)
{
if (!this.active || this.life <= 0)
{
return 0.0;
}
double num = (double)Damage;
if (this.ichor)
{
num = Main.CalculateDamage((int)num, this.defense - 20);
}
else
{
num = Main.CalculateDamage((int)num, this.defense);
}
if (crit)
{
num *= 2.0;
}
if (Damage != 9999 && this.lifeMax > 1)
{
if (this.friendly)
{
CombatText.NewText(new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height), new Color(255, 80, 90, 255), string.Concat((int)num), crit, false);
}
else
{
CombatText.NewText(new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height), new Color(255, 160, 80, 255), string.Concat((int)num), crit, false);
}
}
if (num >= 1.0)
{
this.justHit = true;
if (this.townNPC)
{
this.ai[0] = 1f;
this.ai[1] = (float)(300 + Main.rand.Next(300));
this.ai[2] = 0f;
this.direction = hitDirection;
this.netUpdate = true;
}
if (this.aiStyle == 8 && Main.netMode != 1)
{
if (this.type == 172)
{
this.ai[0] = 450f;
}
else
{
this.ai[0] = 400f;
}
this.TargetClosest(true);
}
if (this.type == 184)
{
this.localAI[0] = 60f;
}
if (this.type == 185)
{
this.localAI[0] = 1f;
}
if (this.realLife >= 0)
{
Main.npc[this.realLife].life -= (int)num;
this.life = Main.npc[this.realLife].life;
this.lifeMax = Main.npc[this.realLife].lifeMax;
}
else
{
this.life -= (int)num;
}
if (knockBack > 0f && this.knockBackResist > 0f)
{
float num2 = knockBack * this.knockBackResist;
if (num2 > 8f)
{
num2 = 8f;
}
if (crit)
{
num2 *= 1.4f;
}
if (num * 10.0 > (double)this.lifeMax)
{
if (hitDirection < 0 && this.velocity.X > -num2)
{
if (this.velocity.X > 0f)
{
this.velocity.X = this.velocity.X - num2;
}
this.velocity.X = this.velocity.X - num2;
if (this.velocity.X < -num2)
{
this.velocity.X = -num2;
}
}
else
{
if (hitDirection > 0 && this.velocity.X < num2)
{
if (this.velocity.X < 0f)
{
this.velocity.X = this.velocity.X + num2;
}
this.velocity.X = this.velocity.X + num2;
if (this.velocity.X > num2)
{
this.velocity.X = num2;
}
}
}
if (this.type == 185)
{
num2 *= 1.5f;
}
if (!this.noGravity)
{
num2 *= -0.75f;
}
else
{
num2 *= -0.5f;
}
if (this.velocity.Y > num2)
{
this.velocity.Y = this.velocity.Y + num2;
if (this.velocity.Y < num2)
{
this.velocity.Y = num2;
}
}
}
else
{
if (!this.noGravity)
{
this.velocity.Y = -num2 * 0.75f * this.knockBackResist;
}
else
{
this.velocity.Y = -num2 * 0.5f * this.knockBackResist;
}
this.velocity.X = num2 * (float)hitDirection * this.knockBackResist;
}
}
if ((this.type == 113 || this.type == 114) && this.life <= 0)
{
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].active && (Main.npc[i].type == 113 || Main.npc[i].type == 114))
{
Main.npc[i].HitEffect(hitDirection, num);
}
}
}
else
{
this.HitEffect(hitDirection, num);
}
if (this.soundHit > 0)
{
Main.PlaySound(3, (int)this.position.X, (int)this.position.Y, this.soundHit);
}
if (this.realLife >= 0)
{
Main.npc[this.realLife].checkDead();
}
else
{
this.checkDead();
}
return num;
}
return 0.0;
}
public void checkDead()
{
if (!this.active)
{
return;
}
if (this.realLife >= 0 && this.realLife != this.whoAmI)
{
return;
}
if (this.life <= 0)
{
NPC.noSpawnCycle = true;
if (this.townNPC && this.type != 37)
{
string str = this.name;
if (this.displayName != "")
{
str = this.displayName;
}
if (Main.netMode == 0)
{
Main.NewText(str + Lang.misc[19], 255, 25, 25, false);
}
else
{
if (Main.netMode == 2)
{
NetMessage.SendData(25, -1, -1, str + Lang.misc[19], 255, 255f, 25f, 25f, 0);
}
}
}
if (Main.netMode != 1 && !Main.dayTime && this.type == 54 && !NPC.AnyNPCs(35))
{
for (int i = 0; i < 255; i++)
{
if (Main.player[i].active && !Main.player[i].dead && Main.player[i].killClothier)
{
NPC.SpawnOnPlayer(i, 35);
break;
}
}
}
if (this.townNPC && Main.netMode != 1 && this.homeless && WorldGen.spawnNPC == this.type)
{
WorldGen.spawnNPC = 0;
}
if (this.soundKilled > 0)
{
Main.PlaySound(4, (int)this.position.X, (int)this.position.Y, this.soundKilled);
}
this.NPCLoot();
if (this.townNPC && this.type != 37 && Main.netMode != 1)
{
Main.chrName[this.type] = "";
NPC.setNames();
NetMessage.SendData(56, -1, -1, "", this.type, 0f, 0f, 0f, 0);
}
this.active = false;
if (this.type == 26 || this.type == 27 || this.type == 28 || this.type == 29 || this.type == 111 || this.type == 143 || this.type == 144 || this.type == 145 || this.type == 212 || this.type == 213 || this.type == 214 || this.type == 215)
{
Main.invasionSize--;
}
if (this.type == 216)
{
Main.invasionSize -= 5;
}
}
}
public void NPCLoot()
{
if (Main.netMode == 1)
{
return;
}
if (Main.hardMode && this.lifeMax > 1 && this.damage > 0 && !this.friendly && (double)this.position.Y > Main.rockLayer * 16.0 && Main.rand.Next(5) == 0 && this.type != 121 && this.value > 0f)
{
if (Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].zoneEvil || Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].zoneBlood)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 521, 1, false, 0, false);
}
if (Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].zoneHoly)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 520, 1, false, 0, false);
}
}
if (this.type == 22 && Main.chrName[22] == "Andrew")
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 867, 1, false, 0, false);
}
if (Main.rand.Next(200) == 0)
{
int num = Item.NPCtoBanner(this.type);
if (num > 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1615 + num - 1, 1, false, 0, false);
}
}
if (Main.hardMode && this.value > 0f)
{
if (!NPC.downedMechBoss1 && Main.rand.Next(1000) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 556, 1, false, 0, false);
}
else
{
if (!NPC.downedMechBoss2 && Main.rand.Next(1000) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 544, 1, false, 0, false);
}
else
{
if (!NPC.downedMechBoss3 && Main.rand.Next(1000) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 557, 1, false, 0, false);
}
}
}
}
if (Main.hardMode && this.value > 0f)
{
if (Main.rand.Next(4000) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].zoneJungle)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1533, 1, false, 0, false);
}
if (Main.rand.Next(4000) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].zoneEvil)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1534, 1, false, 0, false);
}
if (Main.rand.Next(4000) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].zoneBlood)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1535, 1, false, 0, false);
}
if (Main.rand.Next(4000) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].zoneHoly)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1536, 1, false, 0, false);
}
if (Main.rand.Next(4000) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].zoneSnow)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1537, 1, false, 0, false);
}
}
if (this.type == 68)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1169, 1, false, 0, false);
}
if (this.type == 156 && Main.rand.Next(75) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1518, 1, false, 0, false);
}
if (this.type == 243 && Main.rand.Next(3) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1519, 1, false, 0, false);
}
if (this.type >= 269 && this.type <= 280 && Main.rand.Next(450) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1517, 1, false, 0, false);
}
if ((this.type == 158 || this.type == 159) && Main.rand.Next(40) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1520, 1, false, 0, false);
}
if (this.type == 176 && Main.rand.Next(150) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1521, 1, false, 0, false);
}
if (this.type == 48 && Main.rand.Next(200) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1516, 1, false, 0, false);
}
if (this.type == 205 && Main.rand.Next(2) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1611, 1, false, 0, false);
}
if (Main.xMas && this.lifeMax > 1 && this.damage > 0 && !this.friendly && this.type != 121 && this.value > 0f && Main.rand.Next(13) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, Main.rand.Next(599, 602), 1, false, 0, false);
}
if ((this.type == 281 || this.type == 282) && Main.rand.Next(40) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1446, 1, false, -1, false);
}
if ((this.type == 283 || this.type == 284) && Main.rand.Next(40) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1444, 1, false, -1, false);
}
if ((this.type == 285 || this.type == 286) && Main.rand.Next(40) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1445, 1, false, -1, false);
}
if (this.lifeMax > 100 && this.type != 288 && this.target >= 0 && Main.hardMode && NPC.downedPlantBoss && Main.player[this.target].zoneDungeon && Main.rand.Next(13) == 0 && Main.wallDungeon[(int)Main.tile[(int)this.center().X / 16, (int)this.center().Y / 16].wall])
{
NPC.NewNPC((int)this.center().X, (int)this.center().Y, 288, 0);
}
if (this.type == 288)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1508, Main.rand.Next(1, 3), false, -1, false);
}
if ((this.type == 162 || this.type == 166) && Main.rand.Next(250) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1570, 1, false, -1, false);
}
if ((this.type == 158 || this.type == 159) && Main.rand.Next(100) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 900, 1, false, -1, false);
}
if (this.type == 35)
{
if (Main.rand.Next(7) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1281, 1, false, -1, false);
}
else
{
if (Main.rand.Next(7) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1273, 1, false, -1, false);
}
else
{
if (Main.rand.Next(7) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1313, 1, false, -1, false);
}
}
}
}
if (Main.bloodMoon && Main.hardMode && Main.rand.Next(1000) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1314, 1, false, -1, false);
}
if (Main.rand.Next(100) == 0)
{
if (this.type == 104 || this.type == 102 || (this.type >= 269 && this.type <= 272))
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 885, 1, false, -1, false);
}
if (this.type == 77 || (this.type >= 273 && this.type <= 276))
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 886, 1, false, -1, false);
}
if (this.type == 141 || this.type == 178 || this.type == 42 || (this.type >= 231 && this.type <= 235))
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 887, 1, false, -1, false);
}
if (this.type == 79 || this.type == 81)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 888, 1, false, -1, false);
}
if (this.type == 75 || this.type == 78 || this.type == 82)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 889, 1, false, -1, false);
}
if (this.type == 75 || this.type == 79 || this.type == 103)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 890, 1, false, -1, false);
}
if (this.type == 34 || this.type == 83 || this.type == 84)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 891, 1, false, -1, false);
}
if (this.type == 94)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 892, 1, false, -1, false);
}
if (this.type == 93 || this.type == 109 || this.type == 80)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 893, 1, false, -1, false);
}
}
if (this.type == 290)
{
if (Main.rand.Next(35) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1513, 1, false, -1, false);
}
else
{
if (Main.rand.Next(15) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 938, 1, false, -1, false);
}
}
}
if (this.type == 291)
{
if (Main.rand.Next(15) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1300, 1, false, -1, false);
}
else
{
if (Main.rand.Next(15) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1254, 1, false, -1, false);
}
}
}
if (this.type == 292)
{
if (Main.rand.Next(15) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1514, 1, false, -1, false);
}
else
{
if (Main.rand.Next(15) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 679, 1, false, -1, false);
}
}
}
if (this.type == 293 && Main.rand.Next(20) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 759, 1, false, -1, false);
}
if (this.type == 156 && Main.rand.Next(30) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 683, 1, false, -1, false);
}
if (this.type == 245)
{
int num2 = Main.rand.Next(8);
if (num2 == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1258, 1, false, -1, false);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1261, Main.rand.Next(60, 100), false, 0, false);
}
else
{
if (num2 == 1)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1122, 1, false, -1, false);
}
else
{
if (num2 == 2)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 899, 1, false, -1, false);
}
else
{
if (num2 == 3)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1248, 1, false, -1, false);
}
else
{
if (num2 == 4)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1294, 1, false, -1, false);
}
else
{
if (num2 == 5)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1295, 1, false, -1, false);
}
else
{
if (num2 == 6)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1296, 1, false, -1, false);
}
else
{
if (num2 == 7)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1297, 1, false, -1, false);
}
}
}
}
}
}
}
}
NPC.downedGolemBoss = true;
}
if (this.type == 268)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1332, Main.rand.Next(1, 4), false, 0, false);
}
if (this.type == 109 && !NPC.downedClown)
{
NPC.downedClown = true;
if (Main.netMode == 2)
{
NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0);
}
}
if (this.type == 153 && Main.rand.Next(17) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1328, 1, false, -1, false);
}
if (this.type == 253 && Main.rand.Next(250) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1327, 1, false, -1, false);
}
if (this.type == 120 && Main.rand.Next(500) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1326, 1, false, -1, false);
}
if (this.type == 49 && Main.rand.Next(250) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1325, 1, false, -1, false);
}
if (this.type == 185 && Main.rand.Next(150) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 951, 1, false, -1, false);
}
if (this.type == 44 && Main.rand.Next(75) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1320, 1, false, -1, false);
}
if (this.type == 110 && Main.rand.Next(100) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1321, 1, false, -1, false);
}
if (this.type == 260 && Main.rand.Next(150) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1322, 1, false, -1, false);
}
if (this.type == 151 && Main.rand.Next(50) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1322, 1, false, -1, false);
}
if (this.type == 24 && Main.rand.Next(75) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1323, 1, false, -1, false);
}
if (this.type == 109 && Main.rand.Next(30) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1324, Main.rand.Next(1, 5), false, -1, false);
}
if ((this.type == 163 || this.type == 238) && Main.rand.Next(40) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1308, 1, false, -1, false);
}
if (this.type == 287 && Main.rand.Next(7) == 0)
{
if (Main.rand.Next(2) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 963, 1, false, -1, false);
}
else
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 977, 1, false, -1, false);
}
}
if (this.type == 77 && Main.rand.Next(150) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 723, 1, false, -1, false);
}
if (this.type == 251 && Main.rand.Next(50) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1311, 1, false, -1, false);
}
if (this.type == 197 && Main.rand.Next(200) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1306, 1, false, -1, false);
}
if (this.type == 244)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 23, Main.rand.Next(1, 6), false, 0, false);
if (Main.rand.Next(2) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 23, Main.rand.Next(1, 6), false, 0, false);
}
if (Main.rand.Next(2) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 23, Main.rand.Next(1, 6), false, 0, false);
}
if (Main.rand.Next(2) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 23, Main.rand.Next(1, 6), false, 0, false);
}
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 662, Main.rand.Next(30, 60), false, 0, false);
}
if (this.type == 250 && Main.rand.Next(15) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1244, 1, false, -1, false);
}
if (this.type == 172)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 754, 1, false, -1, false);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 755, 1, false, -1, false);
}
if (this.type == 110 && Main.rand.Next(200) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 682, 1, false, -1, false);
}
if (this.type >= 269 && this.type <= 280)
{
if (Main.rand.Next(600) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1183, 1, false, -1, false);
}
else
{
if (Main.rand.Next(400) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1266, 1, false, -1, false);
}
else
{
if (Main.rand.Next(300) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 671, 1, false, -1, false);
}
}
}
}
if (this.type == 154 && Main.rand.Next(100) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1253, 1, false, -1, false);
}
if ((this.type == 169 || this.type == 206) && Main.rand.Next(50) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 726, 1, false, -1, false);
}
if (this.type == 243)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, Main.rand.Next(684, 687), 1, false, -1, false);
}
if (this.type == 198 || this.type == 199 || this.type == 226)
{
if (Main.rand.Next(3000) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1172, 1, false, -1, false);
}
if (Main.rand.Next(100) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1293, 1, false, -1, false);
}
}
if (this.type == 78 || this.type == 79 || this.type == 80)
{
if (Main.rand.Next(75) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 870, 1, false, -1, false);
}
if (Main.rand.Next(75) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 871, 1, false, -1, false);
}
if (Main.rand.Next(75) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 872, 1, false, -1, false);
}
}
if (this.type == 85 && this.value > 0f)
{
if (this.ai[3] == 4f)
{
if (Main.rand.Next(20) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1312, 1, false, -1, false);
}
else
{
int num3 = Main.rand.Next(3);
if (num3 == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 676, 1, false, -1, false);
}
else
{
if (num3 == 1)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 725, 1, false, -1, false);
}
else
{
if (num3 == 2)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1264, 1, false, -1, false);
}
}
}
}
}
else
{
int num4 = Main.rand.Next(7);
if (num4 == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 437, 1, false, -1, false);
}
if (num4 == 1)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 517, 1, false, -1, false);
}
if (num4 == 2)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 535, 1, false, -1, false);
}
if (num4 == 3)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 536, 1, false, -1, false);
}
if (num4 == 4)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 532, 1, false, -1, false);
}
if (num4 == 5)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 393, 1, false, -1, false);
}
if (num4 == 6)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 554, 1, false, -1, false);
}
}
}
if (this.type == 87)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 575, Main.rand.Next(5, 11), false, 0, false);
}
if (this.type >= 212 && this.type <= 215)
{
if (Main.rand.Next(8000) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 905, 1, false, -1, false);
}
if (Main.rand.Next(4000) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 855, 1, false, -1, false);
}
if (Main.rand.Next(2000) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 854, 1, false, -1, false);
}
if (Main.rand.Next(200) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 672, 1, false, -1, false);
}
if (Main.rand.Next(500) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1277, 1, false, 0, false);
}
if (Main.rand.Next(500) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1278, 1, false, 0, false);
}
if (Main.rand.Next(500) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1279, 1, false, 0, false);
}
if (Main.rand.Next(500) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1280, 1, false, 0, false);
}
if (Main.rand.Next(300) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1704, 1, false, 0, false);
}
if (Main.rand.Next(300) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1705, 1, false, 0, false);
}
if (Main.rand.Next(300) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1710, 1, false, 0, false);
}
if (Main.rand.Next(300) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1716, 1, false, 0, false);
}
if (Main.rand.Next(300) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1720, 1, false, 0, false);
}
}
else
{
if (this.type == 216)
{
if (Main.rand.Next(4000) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 905, 1, false, -1, false);
}
if (Main.rand.Next(2000) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 855, 1, false, -1, false);
}
if (Main.rand.Next(1000) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 854, 1, false, -1, false);
}
if (Main.rand.Next(100) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 672, 1, false, -1, false);
}
}
}
if (this.type == 161 && Main.rand.Next(50) == 0)
{
int num5 = Main.rand.Next(3);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 803 + num5, 1, false, 0, false);
}
if (this.type == 217)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1115, 1, false, -1, false);
}
if (this.type == 218)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1116, 1, false, -1, false);
}
if (this.type == 219)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1117, 1, false, -1, false);
}
if (this.type == 220)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1118, 1, false, -1, false);
}
if (this.type == 221)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1119, 1, false, -1, false);
}
if (this.type == 167 && Main.rand.Next(50) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 879, 1, false, -1, false);
}
if (this.type == 143 || this.type == 144 || this.type == 145)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 593, Main.rand.Next(5, 11), false, 0, false);
}
if (this.type == 79)
{
if (Main.rand.Next(10) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 527, 1, false, 0, false);
}
}
else
{
if (this.type == 80 && Main.rand.Next(10) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 528, 1, false, 0, false);
}
}
if (this.type == 49 && Main.rand.Next(200) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 18, 1, false, -1, false);
}
if (this.type == 21 || this.type == 201 || this.type == 202 || this.type == 203)
{
if (Main.rand.Next(100) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 954, 1, false, -1, false);
}
else
{
if (Main.rand.Next(200) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 955, 1, false, -1, false);
}
else
{
if (Main.rand.Next(200) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1166, 1, false, -1, false);
}
else
{
if (Main.rand.Next(500) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1274, 1, false, -1, false);
}
}
}
}
}
else
{
if (this.type == 6)
{
if (Main.rand.Next(150) == 0)
{
int num6 = Main.rand.Next(3);
if (num6 == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 956, 1, false, -1, false);
}
if (num6 == 1)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 957, 1, false, -1, false);
}
else
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 958, 1, false, -1, false);
}
}
}
else
{
if (this.type == 42 || this.type == 43 || (this.type >= 231 && this.type <= 235))
{
if (Main.rand.Next(100) == 0)
{
int num7 = Main.rand.Next(3);
if (num7 == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 960, 1, false, -1, false);
}
if (num7 == 1)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 961, 1, false, -1, false);
}
else
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 962, 1, false, -1, false);
}
}
}
else
{
if (this.type == 31 || this.type == 32 || this.type == 294 || this.type == 295 || this.type == 296)
{
if (Main.rand.Next(450) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 959, 1, false, -1, false);
}
if (Main.rand.Next(300) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1307, 1, false, -1, false);
}
}
}
}
}
if ((this.type == 174 || this.type == 179 || this.type == 182 || this.type == 183) && Main.rand.Next(200) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 996, 1, false, 0, false);
}
if (this.type == 101 || this.type == 98)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 522, Main.rand.Next(2, 6), false, 0, false);
}
if (this.type == 86)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 526, 1, false, 0, false);
if (Main.rand.Next(100) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 856, 1, false, 0, false);
}
}
if (this.type == 113)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 367, 1, false, -1, false);
if (Main.rand.Next(2) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, Main.rand.Next(489, 492), 1, false, -1, false);
}
else
{
int num8 = Main.rand.Next(3);
if (num8 == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 514, 1, false, -1, false);
}
else
{
if (num8 == 1)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 426, 1, false, -1, false);
}
else
{
if (num8 == 2)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 434, 1, false, -1, false);
}
}
}
}
if (Main.netMode != 1)
{
int num9 = (int)(this.position.X + (float)(this.width / 2)) / 16;
int num10 = (int)(this.position.Y + (float)(this.height / 2)) / 16;
int num11 = this.width / 2 / 16 + 1;
for (int i = num9 - num11; i <= num9 + num11; i++)
{
for (int j = num10 - num11; j <= num10 + num11; j++)
{
if ((i == num9 - num11 || i == num9 + num11 || j == num10 - num11 || j == num10 + num11) && !Main.tile[i, j].active())
{
Main.tile[i, j].type = 140;
Main.tile[i, j].active(true);
}
Main.tile[i, j].lava(false);
Main.tile[i, j].liquid = 0;
if (Main.netMode == 2)
{
NetMessage.SendTileSquare(-1, i, j, 1);
}
else
{
WorldGen.SquareTileFrame(i, j, true);
}
}
}
}
}
if (this.type == 186)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 40, Main.rand.Next(1, 10), false, 0, false);
}
if (this.type == 225)
{
if (Main.rand.Next(45) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1243, 1, false, 0, false);
}
else
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 23, Main.rand.Next(2, 6), false, 0, false);
}
}
if (this.type == 1 || this.type == 16 || this.type == 138 || this.type == 141 || this.type == 147 || this.type == 184 || this.type == 187 || this.type == 204)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 23, Main.rand.Next(1, 3), false, 0, false);
if (Main.rand.Next(10000) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1309, 1, false, -1, false);
}
}
if (this.type == 75)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 501, Main.rand.Next(1, 4), false, 0, false);
}
if (this.type == 81)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 23, Main.rand.Next(2, 5), false, 0, false);
}
if (this.type == 122)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 23, Main.rand.Next(5, 11), false, 0, false);
}
if (this.type == 71)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 327, 1, false, 0, false);
}
if (this.type == 2)
{
if (Main.rand.Next(3) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 38, 1, false, 0, false);
}
else
{
if (Main.rand.Next(100) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 236, 1, false, 0, false);
}
}
}
if (this.type == 104 && Main.rand.Next(60) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 485, 1, false, -1, false);
}
if (this.type == 58)
{
if (Main.rand.Next(500) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 263, 1, false, 0, false);
}
else
{
if (Main.rand.Next(40) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 118, 1, false, 0, false);
}
}
}
if (this.type == 102 && Main.rand.Next(500) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 263, 1, false, 0, false);
}
if (this.type == 3 || this.type == 132 || this.type == 161 || this.type == 186 || this.type == 187 || this.type == 188 || this.type == 189 || this.type == 200 || this.type == 223)
{
if (Main.rand.Next(50) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 216, 1, false, -1, false);
}
if (Main.rand.Next(250) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1304, 1, false, -1, false);
}
}
if (this.type == 223 && Main.rand.Next(10) == 0)
{
if (Main.rand.Next(2) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1135, 1, false, -1, false);
}
else
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1136, 1, false, -1, false);
}
}
if (this.type == 66)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 267, 1, false, 0, false);
}
if (this.type == 62 && Main.rand.Next(50) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 272, 1, false, -1, false);
}
if (this.value > 0f && Main.hardMode && (double)(this.position.Y / 16f) < Main.worldSurface + 10.0 && (this.center().X / 16f < 380f || this.center().X / 16f > (float)(Main.maxTilesX - 380)) && Main.rand.Next(100) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1315, 1, false, 0, false);
}
if (this.type == 52)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 251, 1, false, 0, false);
}
if (this.type == 53)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 239, 1, false, 0, false);
}
if (this.type == 54)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 260, 1, false, 0, false);
}
if (this.type == 55 || this.type == 230)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 261, 1, false, 0, false);
}
if (this.type == 69 && Main.rand.Next(7) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 323, 1, false, 0, false);
}
if (this.type == 73)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 362, Main.rand.Next(1, 3), false, 0, false);
}
if (this.type == 4)
{
if (Main.rand.Next(150) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1299, 1, false, 0, false);
}
if (WorldGen.crimson)
{
int stack = Main.rand.Next(20) + 10;
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 880, stack, false, 0, false);
stack = Main.rand.Next(20) + 10;
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 880, stack, false, 0, false);
stack = Main.rand.Next(20) + 10;
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 880, stack, false, 0, false);
}
else
{
int stack2 = Main.rand.Next(30) + 20;
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 47, stack2, false, 0, false);
stack2 = Main.rand.Next(20) + 10;
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 56, stack2, false, 0, false);
stack2 = Main.rand.Next(20) + 10;
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 56, stack2, false, 0, false);
stack2 = Main.rand.Next(20) + 10;
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 56, stack2, false, 0, false);
stack2 = Main.rand.Next(3) + 1;
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 59, stack2, false, 0, false);
}
}
if ((this.type == 6 || this.type == 94) && Main.rand.Next(3) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 68, 1, false, 0, false);
}
if ((this.type == 181 || this.type == 173 || this.type == 239 || this.type == 240) && Main.rand.Next(3) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1330, 1, false, 0, false);
}
if (this.type == 7 || this.type == 8 || this.type == 9)
{
if (Main.rand.Next(3) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 68, Main.rand.Next(1, 3), false, 0, false);
}
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 69, Main.rand.Next(3, 9), false, 0, false);
}
if ((this.type == 10 || this.type == 11 || this.type == 12 || this.type == 95 || this.type == 96 || this.type == 97) && Main.rand.Next(100) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 215, 1, false, 0, false);
}
if (this.type == 47 && Main.rand.Next(75) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 243, 1, false, 0, false);
}
if (this.type == 222)
{
NPC.downedQueenBee = true;
int num12 = Main.rand.Next(3);
if (num12 == 0)
{
num12 = 1121;
}
else
{
if (num12 == 1)
{
num12 = 1123;
}
else
{
if (num12 == 2)
{
num12 = 1132;
}
}
}
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num12, 1, false, 0, false);
if (Main.rand.Next(20) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1170, 1, false, 0, false);
}
if (Main.rand.Next(3) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1129, 1, false, 0, false);
}
else
{
if (Main.rand.Next(2) == 0)
{
num12 = Main.rand.Next(842, 845);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num12, 1, false, 0, false);
}
}
if (Main.rand.Next(4) != 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1130, Main.rand.Next(10, 30), false, 0, false);
}
}
if (this.type == 266)
{
int stack3 = Main.rand.Next(15, 41);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 880, stack3, false, 0, false);
stack3 = Main.rand.Next(15, 41);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 880, stack3, false, 0, false);
}
if (this.type == 267 && NPC.AnyNPCs(266))
{
int stack4 = Main.rand.Next(2, 6);
if (Main.rand.Next(3) != 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1329, stack4, false, 0, false);
}
if (Main.rand.Next(3) != 0)
{
stack4 = Main.rand.Next(4, 11);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 880, stack4, false, 0, false);
}
if (Main.rand.Next(2) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statLife < Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statLifeMax)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 58, 1, false, 0, false);
}
}
if (this.type == 13 || this.type == 14 || this.type == 15)
{
int stack5 = Main.rand.Next(1, 3);
if (Main.rand.Next(2) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 86, stack5, false, 0, false);
}
if (Main.rand.Next(2) == 0)
{
stack5 = Main.rand.Next(2, 6);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 56, stack5, false, 0, false);
}
if (this.boss)
{
stack5 = Main.rand.Next(10, 30);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 56, stack5, false, 0, false);
stack5 = Main.rand.Next(10, 31);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 56, stack5, false, 0, false);
if (Main.rand.Next(30) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 995, 1, false, 0, false);
}
}
if (Main.rand.Next(4) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statLife < Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statLifeMax)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 58, 1, false, 0, false);
}
}
if (this.type == 116 || this.type == 117 || this.type == 118 || this.type == 119 || this.type == 139)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 58, 1, false, 0, false);
}
if (this.type == 63 || this.type == 64 || this.type == 103)
{
if (Main.rand.Next(100) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1303, 1, false, -1, false);
}
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 282, Main.rand.Next(1, 5), false, 0, false);
}
if (this.type == 21 || this.type == 44 || this.type == 167 || this.type == 201 || this.type == 202 || this.type == 203)
{
if (Main.rand.Next(25) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 118, 1, false, 0, false);
}
else
{
if (this.type == 44)
{
if (Main.rand.Next(20) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, Main.rand.Next(410, 412), 1, false, 0, false);
}
else
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 166, Main.rand.Next(1, 4), false, 0, false);
}
}
}
}
if (this.type == 45)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 238, 1, false, 0, false);
}
if (this.type == 50)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, Main.rand.Next(256, 259), 1, false, 0, false);
}
if (this.type == 23 && Main.rand.Next(50) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 116, 1, false, 0, false);
}
if (this.type == 24 && Main.rand.Next(300) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 244, 1, false, 0, false);
}
if (this.type == 31 || this.type == 32 || this.type == 34)
{
if (Main.rand.Next(250) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 932, 1, false, 0, false);
}
else
{
if (Main.rand.Next(65) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 327, 1, false, 0, false);
}
else
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 154, Main.rand.Next(1, 4), false, 0, false);
}
}
}
if (this.type == 26 || this.type == 27 || this.type == 28 || this.type == 29 || this.type == 111)
{
if (Main.rand.Next(200) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 160, 1, false, 0, false);
}
else
{
if (Main.rand.Next(2) == 0)
{
int stack6 = Main.rand.Next(1, 6);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 161, stack6, false, 0, false);
}
}
}
if (this.type == 175 && Main.rand.Next(200) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1265, 1, false, -1, false);
}
if ((this.type == 42 || (this.type >= 231 && this.type <= 235)) && Main.rand.Next(2) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 209, 1, false, 0, false);
}
if (this.type == 204 && Main.rand.Next(3) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 209, 1, false, 0, false);
}
if (this.type == 43 && Main.rand.Next(3) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 210, 1, false, 0, false);
}
if (this.type == 65)
{
if (Main.rand.Next(50) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 268, 1, false, 0, false);
}
else
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 319, 1, false, 0, false);
}
}
if (this.type == 48 && Main.rand.Next(2) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 320, 1, false, 0, false);
}
if (this.type == 125 || this.type == 126)
{
int num13 = 125;
if (this.type == 125)
{
num13 = 126;
}
if (!NPC.AnyNPCs(num13))
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 549, Main.rand.Next(25, 41), false, 0, false);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1225, Main.rand.Next(20, 36), false, 0, false);
}
else
{
this.value = 0f;
this.boss = false;
}
}
else
{
if (this.type == 127)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 547, Main.rand.Next(25, 41), false, 0, false);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1225, Main.rand.Next(20, 36), false, 0, false);
}
else
{
if (this.type == 134)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 548, Main.rand.Next(25, 41), false, 0, false);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1225, Main.rand.Next(20, 36), false, 0, false);
}
}
}
if (this.type == 262)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1141, 1, false, -1, false);
if (Main.rand.Next(20) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1182, 1, false, -1, false);
}
if (Main.rand.Next(200) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1305, 1, false, -1, false);
}
if (Main.rand.Next(4) == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1157, 1, false, -1, false);
}
int num14 = Main.rand.Next(6);
if (!NPC.downedPlantBoss)
{
num14 = 0;
}
if (num14 == 0)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 758, 1, false, -1, false);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 771, Main.rand.Next(20, 50), false, 0, false);
}
else
{
if (num14 == 1)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1255, 1, false, -1, false);
}
else
{
if (num14 == 2)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 788, 1, false, -1, false);
}
else
{
if (num14 == 3)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1178, 1, false, -1, false);
}
else
{
if (num14 == 4)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1259, 1, false, -1, false);
}
else
{
if (num14 == 5)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1155, 1, false, -1, false);
}
}
}
}
}
}
NPC.downedPlantBoss = true;
}
if ((this.boss || this.type == 125 || this.type == 126) && Main.rand.Next(10) == 0)
{
if (this.type == 4)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1360, 1, false, 0, false);
}
if (this.type == 13 || this.type == 14 || this.type == 15)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1361, 1, false, 0, false);
}
if (this.type == 266)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1362, 1, false, 0, false);
}
if (this.type == 35)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1363, 1, false, 0, false);
}
if (this.type == 222)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1364, 1, false, 0, false);
}
if (this.type == 113)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1365, 1, false, 0, false);
}
if (this.type == 134)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1366, 1, false, 0, false);
}
if (this.type == 127)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1367, 1, false, 0, false);
}
if (this.type == 125)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1368, 1, false, 0, false);
}
if (this.type == 126)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1369, 1, false, 0, false);
}
if (this.type == 262)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1370, 1, false, 0, false);
}
if (this.type == 245)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 1371, 1, false, 0, false);
}
}
if (this.boss)
{
if (this.type == 4)
{
NPC.downedBoss1 = true;
}
else
{
if (this.type == 13 || this.type == 14 || this.type == 15)
{
NPC.downedBoss2 = true;
this.name = "Eater of Worlds";
}
else
{
if (this.type == 35)
{
NPC.downedBoss3 = true;
this.name = "Skeletron";
}
else
{
this.name = this.displayName;
}
}
}
if (this.type == 127)
{
NPC.downedMechBoss3 = true;
NPC.downedMechBossAny = true;
}
if (this.type == 134)
{
NPC.downedMechBoss1 = true;
NPC.downedMechBossAny = true;
}
string str = this.name;
if (this.displayName != "")
{
str = this.displayName;
}
int stack7 = Main.rand.Next(5, 16);
int num15 = 28;
if (this.type == 113)
{
num15 = 188;
}
else
{
if (this.type == 222)
{
num15 = 1134;
}
else
{
if (this.type > 113 && this.type < 222)
{
num15 = 499;
}
else
{
if (this.type == 245 || this.type == 262)
{
num15 = 499;
}
}
}
}
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num15, stack7, false, 0, false);
int num16 = Main.rand.Next(5) + 5;
for (int k = 0; k < num16; k++)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 58, 1, false, 0, false);
}
if (this.type == 125 || this.type == 126)
{
NPC.downedMechBoss2 = true;
NPC.downedMechBossAny = true;
if (Main.netMode == 0)
{
Main.NewText("The Twins " + Lang.misc[17], 175, 75, 255, false);
}
else
{
if (Main.netMode == 2)
{
NetMessage.SendData(25, -1, -1, "The Twins " + Lang.misc[17], 255, 175f, 75f, 255f, 0);
}
}
}
else
{
if (Main.netMode == 0)
{
Main.NewText(str + " " + Lang.misc[17], 175, 75, 255, false);
}
else
{
if (Main.netMode == 2)
{
NetMessage.SendData(25, -1, -1, str + " " + Lang.misc[17], 255, 175f, 75f, 255f, 0);
}
}
}
if (this.type == 113 && Main.netMode != 1)
{
WorldGen.StartHardmode();
}
if (Main.netMode == 2)
{
NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0);
}
}
if (Main.rand.Next(6) == 0 && this.lifeMax > 1 && this.damage > 0)
{
if (Main.rand.Next(2) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statMana < Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statManaMax)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 184, 1, false, 0, false);
}
else
{
if (Main.rand.Next(2) == 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statLife < Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statLifeMax)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 58, 1, false, 0, false);
}
}
}
if (Main.rand.Next(2) == 0 && this.lifeMax > 1 && this.damage > 0 && Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statMana < Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].statManaMax)
{
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 184, 1, false, 0, false);
}
float num17 = this.value;
if (this.midas)
{
num17 *= 1f + (float)Main.rand.Next(10, 50) * 0.01f;
}
num17 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
if (Main.rand.Next(5) == 0)
{
num17 *= 1f + (float)Main.rand.Next(5, 11) * 0.01f;
}
if (Main.rand.Next(10) == 0)
{
num17 *= 1f + (float)Main.rand.Next(10, 21) * 0.01f;
}
if (Main.rand.Next(15) == 0)
{
num17 *= 1f + (float)Main.rand.Next(15, 31) * 0.01f;
}
if (Main.rand.Next(20) == 0)
{
num17 *= 1f + (float)Main.rand.Next(20, 41) * 0.01f;
}
while ((int)num17 > 0)
{
if (num17 > 1000000f)
{
int num18 = (int)(num17 / 1000000f);
if (num18 > 50 && Main.rand.Next(5) == 0)
{
num18 /= Main.rand.Next(3) + 1;
}
if (Main.rand.Next(5) == 0)
{
num18 /= Main.rand.Next(3) + 1;
}
num17 -= (float)(1000000 * num18);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 74, num18, false, 0, false);
}
else
{
if (num17 > 10000f)
{
int num19 = (int)(num17 / 10000f);
if (num19 > 50 && Main.rand.Next(5) == 0)
{
num19 /= Main.rand.Next(3) + 1;
}
if (Main.rand.Next(5) == 0)
{
num19 /= Main.rand.Next(3) + 1;
}
num17 -= (float)(10000 * num19);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 73, num19, false, 0, false);
}
else
{
if (num17 > 100f)
{
int num20 = (int)(num17 / 100f);
if (num20 > 50 && Main.rand.Next(5) == 0)
{
num20 /= Main.rand.Next(3) + 1;
}
if (Main.rand.Next(5) == 0)
{
num20 /= Main.rand.Next(3) + 1;
}
num17 -= (float)(100 * num20);
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 72, num20, false, 0, false);
}
else
{
int num21 = (int)num17;
if (num21 > 50 && Main.rand.Next(5) == 0)
{
num21 /= Main.rand.Next(3) + 1;
}
if (Main.rand.Next(5) == 0)
{
num21 /= Main.rand.Next(4) + 1;
}
if (num21 < 1)
{
num21 = 1;
}
num17 -= (float)num21;
Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 71, num21, false, 0, false);
}
}
}
}
}
public void HitEffect(int hitDirection = 0, double dmg = 10.0)
{
if (!this.active)
{
return;
}
if (this.type == 1 || this.type == 16 || this.type == 71 || this.type == 244)
{
if (this.life > 0)
{
int num = 0;
while ((double)num < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 4, (float)hitDirection, -1f, this.alpha, this.color, 1f);
num++;
}
}
else
{
for (int i = 0; i < 50; i++)
{
Dust.NewDust(this.position, this.width, this.height, 4, (float)(2 * hitDirection), -2f, this.alpha, this.color, 1f);
}
if (Main.netMode != 1 && this.type == 16)
{
int num2 = Main.rand.Next(2) + 2;
for (int j = 0; j < num2; j++)
{
int num3 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), 1, 0);
Main.npc[num3].SetDefaults("Baby Slime");
Main.npc[num3].velocity.X = this.velocity.X * 2f;
Main.npc[num3].velocity.Y = this.velocity.Y;
NPC expr_193_cp_0 = Main.npc[num3];
expr_193_cp_0.velocity.X = expr_193_cp_0.velocity.X + ((float)Main.rand.Next(-20, 20) * 0.1f + (float)(j * this.direction) * 0.3f);
NPC expr_1D1_cp_0 = Main.npc[num3];
expr_1D1_cp_0.velocity.Y = expr_1D1_cp_0.velocity.Y - ((float)Main.rand.Next(0, 10) * 0.1f + (float)j);
Main.npc[num3].ai[1] = (float)j;
if (Main.netMode == 2 && num3 < 200)
{
NetMessage.SendData(23, -1, -1, "", num3, 0f, 0f, 0f, 0);
}
}
}
}
}
if (this.type >= 245 && this.type <= 249)
{
if (this.life > 0)
{
int num4 = 0;
while ((double)num4 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 148, (float)hitDirection, -1f, 0, default(Color), 1f);
num4++;
}
}
else
{
if (this.type == 246)
{
if (Main.netMode != 1)
{
NPC.NewNPC((int)this.center().X, (int)this.position.Y + this.height, 249, this.whoAmI);
}
}
else
{
for (int k = 0; k < 50; k++)
{
Dust.NewDust(this.position, this.width, this.height, 148, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
if (this.type == 245)
{
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 368, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 370, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 368, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 370, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 368, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 370, this.scale);
Gore.NewGore(this.position, this.velocity, 360, this.scale);
Gore.NewGore(this.position, this.velocity, 361, this.scale);
Gore.NewGore(this.position, this.velocity, 362, this.scale);
Gore.NewGore(this.position, this.velocity, 363, this.scale);
Gore.NewGore(this.position, this.velocity, 364, this.scale);
Gore.NewGore(this.position, this.velocity, 367, this.scale);
Gore.NewGore(this.position, this.velocity, 366, this.scale);
}
else
{
if (this.type == 249)
{
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 368, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 370, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 368, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 370, this.scale);
Gore.NewGore(this.position, this.velocity, 365, this.scale);
Gore.NewGore(this.position, this.velocity, 363, this.scale);
Gore.NewGore(this.position, this.velocity, 362, this.scale);
}
else
{
Gore.NewGore(this.position, this.velocity, 369, this.scale);
Gore.NewGore(this.position, this.velocity, 371, this.scale);
Gore.NewGore(this.position, this.velocity, 370, this.scale);
}
}
}
}
}
if (this.type == 288 && this.life <= 0)
{
for (int l = 0; l < 50; l++)
{
int num5 = Dust.NewDust(this.position, this.width, this.height, 180, this.velocity.X, this.velocity.Y, 0, default(Color), 1f);
Main.dust[num5].velocity *= 2f;
Main.dust[num5].noGravity = true;
Main.dust[num5].scale = 1.4f;
}
}
if (this.type == 204)
{
if (this.life > 0)
{
int num6 = 0;
while ((double)num6 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 4, (float)hitDirection, -1f, 100, new Color(149, 208, 104), 1f);
num6++;
}
}
else
{
for (int m = 0; m < 50; m++)
{
Dust.NewDust(this.position, this.width, this.height, 4, (float)(2 * hitDirection), -2f, 100, new Color(149, 208, 104), 1f);
}
}
}
if (this.type == 225)
{
if (this.life > 0)
{
int num7 = 0;
while ((double)num7 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 4, (float)hitDirection, -1f, 100, new Color(0, 80, 255, 100), 1f);
num7++;
}
}
else
{
for (int n = 0; n < 50; n++)
{
Dust.NewDust(this.position, this.width, this.height, 4, (float)(2 * hitDirection), -2f, 100, new Color(0, 80, 255, 100), 1f);
}
Gore.NewGore(this.position, this.velocity, 314, this.scale);
}
}
if (this.type == 243)
{
if (this.life > 0)
{
int num8 = 0;
while ((double)num8 < dmg / (double)this.lifeMax * 150.0)
{
Dust.NewDust(this.position, this.width, this.height, 161, (float)hitDirection, -1f, 0, default(Color), 1f);
num8++;
}
}
else
{
for (int num9 = 0; num9 < 200; num9++)
{
Dust.NewDust(this.position, this.width, this.height, 161, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 359, this.scale);
}
}
if ((this.type == 210 || this.type == 211) && this.life <= 0)
{
for (int num10 = 0; num10 < 6; num10++)
{
int num11 = Dust.NewDust(this.position, this.width, this.height, 150, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
if (Main.rand.Next(2) == 0)
{
Main.dust[num11].noGravity = true;
Main.dust[num11].scale = 1.5f;
}
else
{
Main.dust[num11].scale = 0.8f;
}
}
}
if (this.type == 154)
{
if (this.life > 0)
{
int num12 = 0;
while ((double)num12 < dmg / (double)this.lifeMax * 50.0)
{
int num13 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 67, this.velocity.X, this.velocity.Y, 90, default(Color), 1.5f);
Main.dust[num13].noGravity = true;
Main.dust[num13].velocity *= 0.2f;
num12++;
}
}
else
{
for (int num14 = 0; num14 < 50; num14++)
{
int num15 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 67, this.velocity.X, this.velocity.Y, 90, default(Color), 1.5f);
Main.dust[num15].noGravity = true;
Main.dust[num15].velocity *= 0.2f;
}
Gore.NewGore(this.position, this.velocity, 180, this.scale);
}
}
if (this.type == 147 || this.type == 184)
{
if (this.life > 0)
{
int num16 = 0;
while ((double)num16 < dmg / (double)this.lifeMax * 50.0)
{
int num17 = Dust.NewDust(this.position, this.width, this.height, 76, (float)hitDirection, -1f, 0, default(Color), 1f);
Main.dust[num17].noGravity = true;
Dust.NewDust(this.position, this.width, this.height, 4, (float)hitDirection, -1f, 100, new Color(97, 200, 255, 100), 1f);
num16++;
}
}
else
{
for (int num18 = 0; num18 < 30; num18++)
{
int num19 = Dust.NewDust(this.position, this.width, this.height, 76, (float)hitDirection, -2f, 0, default(Color), 1f);
Main.dust[num19].noGravity = true;
Dust.NewDust(this.position, this.width, this.height, 4, (float)hitDirection, -2f, 100, new Color(97, 200, 255, 100), 1f);
}
}
}
if (this.type == 143 || this.type == 144 || this.type == 145)
{
if (this.life > 0)
{
int num20 = 0;
while ((double)num20 < dmg / (double)this.lifeMax * 100.0)
{
int num21 = Dust.NewDust(this.position, this.width, this.height, 76, (float)hitDirection, -1f, 0, default(Color), 1f);
Main.dust[num21].noGravity = true;
num20++;
}
}
else
{
for (int num22 = 0; num22 < 50; num22++)
{
int num23 = Dust.NewDust(this.position, this.width, this.height, 76, (float)hitDirection, -1f, 0, default(Color), 1f);
Main.dust[num23].noGravity = true;
Main.dust[num23].scale *= 1.2f;
}
}
}
if (this.type == 141)
{
if (this.life > 0)
{
int num24 = 0;
while ((double)num24 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 4, (float)hitDirection, -1f, this.alpha, new Color(210, 230, 140), 1f);
num24++;
}
}
else
{
for (int num25 = 0; num25 < 50; num25++)
{
Dust.NewDust(this.position, this.width, this.height, 4, (float)(2 * hitDirection), -2f, this.alpha, new Color(210, 230, 140), 1f);
}
}
}
if (this.type == 112)
{
for (int num26 = 0; num26 < 20; num26++)
{
int num27 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 18, 0f, 0f, 100, default(Color), 2f);
if (Main.rand.Next(2) == 0)
{
Main.dust[num27].scale *= 0.6f;
}
else
{
Main.dust[num27].velocity *= 1.4f;
Main.dust[num27].noGravity = true;
}
}
}
if (this.type == 183)
{
if (this.life > 0)
{
int num28 = 0;
while ((double)num28 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 136, 0f, 0f, this.alpha, this.color, 1f);
num28++;
}
}
else
{
for (int num29 = 0; num29 < 50; num29++)
{
int num30 = Dust.NewDust(this.position, this.width, this.height, 136, (float)hitDirection, 0f, this.alpha, this.color, 1f);
Main.dust[num30].velocity *= 2f;
}
}
}
if (this.type == 81 || this.type == 121)
{
if (this.life > 0)
{
int num31 = 0;
while ((double)num31 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 14, 0f, 0f, this.alpha, this.color, 1f);
num31++;
}
}
else
{
for (int num32 = 0; num32 < 50; num32++)
{
int num33 = Dust.NewDust(this.position, this.width, this.height, 14, (float)hitDirection, 0f, this.alpha, this.color, 1f);
Main.dust[num33].velocity *= 2f;
}
if (Main.netMode != 1)
{
if (this.type == 121)
{
int num34 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), 81, 0);
Main.npc[num34].SetDefaults("Slimer2");
Main.npc[num34].velocity.X = this.velocity.X;
Main.npc[num34].velocity.Y = this.velocity.Y;
Gore.NewGore(this.position, this.velocity, 94, this.scale);
if (Main.netMode == 2 && num34 < 200)
{
NetMessage.SendData(23, -1, -1, "", num34, 0f, 0f, 0f, 0);
}
}
else
{
if (this.scale >= 1f)
{
int num35 = Main.rand.Next(2) + 2;
for (int num36 = 0; num36 < num35; num36++)
{
int num37 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), 1, 0);
Main.npc[num37].SetDefaults("Slimeling");
Main.npc[num37].velocity.X = this.velocity.X * 3f;
Main.npc[num37].velocity.Y = this.velocity.Y;
NPC expr_1545_cp_0 = Main.npc[num37];
expr_1545_cp_0.velocity.X = expr_1545_cp_0.velocity.X + ((float)Main.rand.Next(-10, 10) * 0.1f + (float)(num36 * this.direction) * 0.3f);
NPC expr_1584_cp_0 = Main.npc[num37];
expr_1584_cp_0.velocity.Y = expr_1584_cp_0.velocity.Y - ((float)Main.rand.Next(0, 10) * 0.1f + (float)num36);
Main.npc[num37].ai[1] = (float)num36;
if (Main.netMode == 2 && num37 < 200)
{
NetMessage.SendData(23, -1, -1, "", num37, 0f, 0f, 0f, 0);
}
}
}
}
}
}
}
if (this.type == 120 || this.type == 137 || this.type == 138)
{
if (this.life > 0)
{
int num38 = 0;
while ((double)num38 < dmg / (double)this.lifeMax * 50.0)
{
int num39 = Dust.NewDust(this.position, this.width, this.height, 71, 0f, 0f, 200, default(Color), 1f);
Main.dust[num39].velocity *= 1.5f;
num38++;
}
}
else
{
for (int num40 = 0; num40 < 50; num40++)
{
int num41 = Dust.NewDust(this.position, this.width, this.height, 71, (float)hitDirection, 0f, 200, default(Color), 1f);
Main.dust[num41].velocity *= 1.5f;
}
}
}
if (this.type == 122)
{
if (this.life > 0)
{
int num42 = 0;
while ((double)num42 < dmg / (double)this.lifeMax * 50.0)
{
int num43 = Dust.NewDust(this.position, this.width, this.height, 72, 0f, 0f, 200, default(Color), 1f);
Main.dust[num43].velocity *= 1.5f;
num42++;
}
}
else
{
for (int num44 = 0; num44 < 50; num44++)
{
int num45 = Dust.NewDust(this.position, this.width, this.height, 72, (float)hitDirection, 0f, 200, default(Color), 1f);
Main.dust[num45].velocity *= 1.5f;
}
}
}
if (this.type == 75)
{
if (this.life > 0)
{
int num46 = 0;
while ((double)num46 < dmg / (double)this.lifeMax * 50.0)
{
Dust.NewDust(this.position, this.width, this.height, 55, 0f, 0f, 200, this.color, 1f);
num46++;
}
}
else
{
for (int num47 = 0; num47 < 50; num47++)
{
int num48 = Dust.NewDust(this.position, this.width, this.height, 55, (float)hitDirection, 0f, 200, this.color, 1f);
Main.dust[num48].velocity *= 2f;
}
}
}
if (this.type == 63 || this.type == 64 || this.type == 103)
{
Color newColor = new Color(50, 120, 255, 100);
if (this.type == 64)
{
newColor = new Color(225, 70, 140, 100);
}
if (this.type == 103)
{
newColor = new Color(70, 225, 140, 100);
}
if (this.life > 0)
{
int num49 = 0;
while ((double)num49 < dmg / (double)this.lifeMax * 50.0)
{
Dust.NewDust(this.position, this.width, this.height, 4, (float)hitDirection, -1f, 0, newColor, 1f);
num49++;
}
return;
}
for (int num50 = 0; num50 < 25; num50++)
{
Dust.NewDust(this.position, this.width, this.height, 4, (float)(2 * hitDirection), -2f, 0, newColor, 1f);
}
return;
}
else
{
if (this.type != 59 && this.type != 60 && this.type != 151)
{
if (this.type == 50)
{
if (this.life > 0)
{
int num51 = 0;
while ((double)num51 < dmg / (double)this.lifeMax * 300.0)
{
Dust.NewDust(this.position, this.width, this.height, 4, (float)hitDirection, -1f, 175, new Color(0, 80, 255, 100), 1f);
num51++;
}
return;
}
for (int num52 = 0; num52 < 200; num52++)
{
Dust.NewDust(this.position, this.width, this.height, 4, (float)(2 * hitDirection), -2f, 175, new Color(0, 80, 255, 100), 1f);
}
if (Main.netMode != 1)
{
int num53 = Main.rand.Next(4) + 4;
for (int num54 = 0; num54 < num53; num54++)
{
int x = (int)(this.position.X + (float)Main.rand.Next(this.width - 32));
int y = (int)(this.position.Y + (float)Main.rand.Next(this.height - 32));
int num55 = NPC.NewNPC(x, y, 1, 0);
Main.npc[num55].SetDefaults(1, -1f);
Main.npc[num55].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f;
Main.npc[num55].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f;
Main.npc[num55].ai[1] = (float)Main.rand.Next(3);
if (Main.netMode == 2 && num55 < 200)
{
NetMessage.SendData(23, -1, -1, "", num55, 0f, 0f, 0f, 0);
}
}
return;
}
}
else
{
if (this.type == 153)
{
if (this.life > 0)
{
int num56 = 0;
while ((double)num56 < dmg / (double)this.lifeMax * 30.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num56++;
}
return;
}
for (int num57 = 0; num57 < 15; num57++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 177, 1f);
Gore.NewGore(this.position, this.velocity, 178, 1f);
Gore.NewGore(this.position, this.velocity, 179, 1f);
Gore.NewGore(this.position, this.velocity, 179, 1f);
return;
}
else
{
if (this.type == 177)
{
if (this.life > 0)
{
int num58 = 0;
while ((double)num58 < dmg / (double)this.lifeMax * 30.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num58++;
}
return;
}
for (int num59 = 0; num59 < 15; num59++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 234, 1f);
Gore.NewGore(this.position, this.velocity, 235, 1f);
Gore.NewGore(this.position, this.velocity, 236, 1f);
Gore.NewGore(this.position, this.velocity, 236, 1f);
return;
}
else
{
if (this.type == 49 || this.type == 51 || this.type == 93 || this.type == 150 || this.type == 152 || this.type == 226)
{
if (this.life > 0)
{
int num60 = 0;
while ((double)num60 < dmg / (double)this.lifeMax * 30.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num60++;
}
return;
}
for (int num61 = 0; num61 < 15; num61++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
if (this.type == 51)
{
Gore.NewGore(this.position, this.velocity, 83, 1f);
return;
}
if (this.type == 93)
{
Gore.NewGore(this.position, this.velocity, 107, 1f);
return;
}
if (this.type == 150)
{
Gore.NewGore(this.position, this.velocity, 164, 1f);
Gore.NewGore(this.position, this.velocity, 165, 1f);
return;
}
if (this.type == 152)
{
Gore.NewGore(this.position, this.velocity, 175, 1f);
Gore.NewGore(this.position, this.velocity, 176, 1f);
Gore.NewGore(this.position, this.velocity, 176, 1f);
return;
}
if (this.type == 226)
{
Gore.NewGore(this.position, this.velocity, 317, 1f);
Gore.NewGore(this.position, this.velocity, 318, 1f);
Gore.NewGore(this.position, this.velocity, 318, 1f);
Gore.NewGore(this.position, this.velocity, 319, 1f);
return;
}
Gore.NewGore(this.position, this.velocity, 82, 1f);
return;
}
else
{
if (this.type == 46 || this.type == 55 || this.type == 67 || this.type == 74 || this.type == 102 || this.type == 224 || this.type == 230 || this.type == 297 || this.type == 298 || this.type == 299 || this.type == 300)
{
if (this.life > 0)
{
int num62 = 0;
while ((double)num62 < dmg / (double)this.lifeMax * 20.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num62++;
}
return;
}
for (int num63 = 0; num63 < 10; num63++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
if (this.type == 46)
{
Gore.NewGore(this.position, this.velocity, 76, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y), this.velocity, 77, 1f);
return;
}
if (this.type == 67)
{
Gore.NewGore(this.position, this.velocity, 95, 1f);
Gore.NewGore(this.position, this.velocity, 95, 1f);
Gore.NewGore(this.position, this.velocity, 96, 1f);
return;
}
if (this.type == 74)
{
Gore.NewGore(this.position, this.velocity, 100, 1f);
return;
}
if (this.type == 297)
{
Gore.NewGore(this.position, this.velocity, 431, 1f);
return;
}
if (this.type == 298)
{
Gore.NewGore(this.position, this.velocity, 432, 1f);
return;
}
if (this.type == 299)
{
Gore.NewGore(this.position, this.velocity, 433, 1f);
return;
}
if (this.type == 300)
{
Gore.NewGore(this.position, this.velocity, 434, 1f);
return;
}
if (this.type == 102)
{
Gore.NewGore(this.position, this.velocity, 116, 1f);
return;
}
if (this.type == 224)
{
Gore.NewGore(this.position, this.velocity, 312, 1f);
Gore.NewGore(this.position, this.velocity, 313, 1f);
return;
}
}
else
{
if (this.type == 148 || this.type == 149 || this.type == 168)
{
if (this.life > 0)
{
int num64 = 0;
while ((double)num64 < dmg / (double)this.lifeMax * 20.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num64++;
}
return;
}
for (int num65 = 0; num65 < 10; num65++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
if (this.type == 148)
{
Gore.NewGore(this.position, this.velocity, 160, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y), this.velocity, 161, 1f);
return;
}
if (this.type == 149)
{
Gore.NewGore(this.position, this.velocity, 162, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y), this.velocity, 163, 1f);
return;
}
if (this.type == 168)
{
Gore.NewGore(this.position, this.velocity, 215, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y), this.velocity, 216, 1f);
return;
}
}
else
{
if (this.type == 47 || this.type == 57 || this.type == 58)
{
if (this.life > 0)
{
int num66 = 0;
while ((double)num66 < dmg / (double)this.lifeMax * 20.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num66++;
}
return;
}
for (int num67 = 0; num67 < 10; num67++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
if (this.type == 57)
{
Gore.NewGore(new Vector2(this.position.X, this.position.Y), this.velocity, 84, 1f);
return;
}
if (this.type == 58)
{
Gore.NewGore(new Vector2(this.position.X, this.position.Y), this.velocity, 85, 1f);
return;
}
Gore.NewGore(this.position, this.velocity, 78, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y), this.velocity, 79, 1f);
return;
}
else
{
if (this.type == 173 || this.type == 174 || this.type == 181 || this.type == 182 || this.type == 268)
{
if (this.life > 0)
{
int num68 = 0;
while ((double)num68 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, this.alpha, default(Color), 1f);
num68++;
}
return;
}
for (int num69 = 0; num69 < 50; num69++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, this.alpha, default(Color), 1f);
}
if (this.type == 173)
{
Gore.NewGore(this.position, this.velocity, 223, 1f);
Gore.NewGore(this.position, this.velocity, 224, 1f);
return;
}
if (this.type == 174)
{
Gore.NewGore(this.position, this.velocity, 225, 1f);
Gore.NewGore(this.position, this.velocity, 226, 1f);
return;
}
if (this.type == 181)
{
Gore.NewGore(this.position, this.velocity, 237, 1f);
return;
}
if (this.type == 182)
{
Gore.NewGore(this.position, this.velocity, 238, 1f);
Gore.NewGore(this.position, this.velocity, 239, 1f);
return;
}
if (this.type == 268)
{
Gore.NewGore(this.position, this.velocity, 403, 1f);
Gore.NewGore(this.position, this.velocity, 404, 1f);
Gore.NewGore(this.position, this.velocity, 405, 1f);
return;
}
}
else
{
if (this.type == 2 || this.type == 190 || this.type == 191 || this.type == 192 || this.type == 193 || this.type == 194)
{
if (this.life > 0)
{
int num70 = 0;
while ((double)num70 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num70++;
}
return;
}
for (int num71 = 0; num71 < 50; num71++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
if (this.type == 190)
{
Gore.NewGore(this.position, this.velocity, 249, this.scale);
Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity, 2, this.scale);
return;
}
if (this.type == 191)
{
Gore.NewGore(this.position, this.velocity, 248, this.scale);
Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity, 2, this.scale);
return;
}
if (this.type == 192)
{
Gore.NewGore(this.position, this.velocity, 247, this.scale);
Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity, 2, this.scale);
return;
}
if (this.type == 193)
{
Gore.NewGore(this.position, this.velocity, 252, this.scale);
Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity, 253, this.scale);
return;
}
if (this.type == 194)
{
Gore.NewGore(this.position, this.velocity, 250, this.scale);
Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity, 251, this.scale);
return;
}
Gore.NewGore(this.position, this.velocity, 1, this.scale);
Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity, 2, this.scale);
return;
}
else
{
if (this.type == 157)
{
if (this.life > 0)
{
int num72 = 0;
while ((double)num72 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num72++;
}
return;
}
for (int num73 = 0; num73 < 50; num73++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 186, 1f);
Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity, 187, 1f);
return;
}
else
{
if (this.type == 133)
{
if (this.life <= 0)
{
for (int num74 = 0; num74 < 50; num74++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 155, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 14f), this.velocity, 155, 1f);
return;
}
int num75 = 0;
while ((double)num75 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num75++;
}
if ((float)this.life < (float)this.lifeMax * 0.5f && this.localAI[0] == 0f)
{
this.localAI[0] = 1f;
Gore.NewGore(this.position, this.velocity, 1, 1f);
return;
}
}
else
{
if (this.type == 69)
{
if (this.life > 0)
{
int num76 = 0;
while ((double)num76 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num76++;
}
return;
}
for (int num77 = 0; num77 < 50; num77++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 97, 1f);
Gore.NewGore(this.position, this.velocity, 98, 1f);
return;
}
else
{
if (this.type == 61)
{
if (this.life > 0)
{
int num78 = 0;
while ((double)num78 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num78++;
}
return;
}
for (int num79 = 0; num79 < 50; num79++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 86, 1f);
Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity, 87, 1f);
Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity, 88, 1f);
return;
}
else
{
if (this.type == 252)
{
if (this.life > 0)
{
int num80 = 0;
while ((double)num80 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num80++;
}
return;
}
for (int num81 = 0; num81 < 50; num81++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 373, 1f);
Gore.NewGore(this.position, this.velocity, 374, 1f);
return;
}
else
{
if (this.type == 65)
{
if (this.life > 0)
{
int num82 = 0;
while ((double)num82 < dmg / (double)this.lifeMax * 150.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num82++;
}
return;
}
for (int num83 = 0; num83 < 75; num83++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity * 0.8f, 89, 1f);
Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity * 0.8f, 90, 1f);
Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity * 0.8f, 91, 1f);
Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity * 0.8f, 92, 1f);
return;
}
else
{
if (this.type == 195 || this.type == 196)
{
if (this.life > 0)
{
int num84 = 0;
while ((double)num84 < dmg / (double)this.lifeMax * 150.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num84++;
}
return;
}
for (int num85 = 0; num85 < 75; num85++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 254, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 255, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 255, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 256, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 256, this.scale);
return;
}
else
{
if (this.type == 198 || this.type == 199)
{
if (this.life > 0)
{
int num86 = 0;
while ((double)num86 < dmg / (double)this.lifeMax * 150.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num86++;
}
return;
}
for (int num87 = 0; num87 < 75; num87++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 258, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 259, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 259, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 260, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 260, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 261, this.scale);
return;
}
else
{
if (this.type == 206)
{
if (this.life > 0)
{
int num88 = 0;
while ((double)num88 < dmg / (double)this.lifeMax * 150.0)
{
Dust.NewDust(this.position, this.width, this.height, 137, (float)hitDirection, -1f, 0, default(Color), 1f);
num88++;
}
return;
}
for (int num89 = 0; num89 < 75; num89++)
{
Dust.NewDust(this.position, this.width, this.height, 137, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 273, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 274, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 274, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 275, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 275, this.scale);
return;
}
else
{
if (this.type == 3 || this.type == 52 || this.type == 53 || this.type == 104 || this.type == 109 || this.type == 132 || this.type == 161 || this.type == 162 || this.type == 186 || this.type == 187 || this.type == 188 || this.type == 189 || this.type == 200 || this.type == 223 || this.type == 251)
{
if (this.life > 0)
{
int num90 = 0;
while ((double)num90 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num90++;
}
if (this.type == 186 && Main.rand.Next(5) == 0)
{
Gore.NewGore(this.position, this.velocity, 242, 1f);
}
if (this.type == 187)
{
int num91 = 0;
while ((double)num91 < dmg / (double)this.lifeMax * 200.0)
{
Dust.NewDust(this.position, this.width, 24, 4, (float)hitDirection, -1f, 125, new Color(0, 80, 255, 100), 1f);
num91++;
}
return;
}
}
else
{
for (int num92 = 0; num92 < 50; num92++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
if (this.type == 187)
{
for (int num93 = 0; num93 < 25; num93++)
{
Dust.NewDust(this.position, this.width, 24, 4, (float)hitDirection, -1f, 125, new Color(0, 80, 255, 100), 1f);
}
}
if (this.type == 104)
{
Gore.NewGore(this.position, this.velocity, 117, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 118, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 118, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 119, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 119, this.scale);
return;
}
if (this.type == 109)
{
Gore.NewGore(this.position, this.velocity, 121, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 122, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 122, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 123, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 123, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 46f), this.velocity, 120, this.scale);
return;
}
if (this.type == 161)
{
Gore.NewGore(this.position, this.velocity, 191, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 192, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 192, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 193, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 193, this.scale);
return;
}
if (this.type == 162)
{
Gore.NewGore(this.position, this.velocity, 194, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 195, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 195, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 196, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 196, this.scale);
return;
}
if (this.type == 188)
{
Gore.NewGore(this.position, this.velocity, 243, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 244, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 244, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 245, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 245, this.scale);
return;
}
if (this.type == 200)
{
Gore.NewGore(this.position, this.velocity, 262, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 263, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 263, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 264, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 264, this.scale);
return;
}
if (this.type == 223)
{
Gore.NewGore(this.position, this.velocity, 309, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 310, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 310, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 311, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 311, this.scale);
return;
}
if (this.type == 132)
{
Gore.NewGore(this.position, this.velocity, 154, 1f);
}
else
{
if (this.type == 186)
{
Gore.NewGore(this.position, this.velocity, 241, 1f);
}
else
{
if (this.type == 189)
{
Gore.NewGore(this.position, this.velocity, 246, 1f);
}
else
{
if (this.type == 251)
{
Gore.NewGore(this.position, this.velocity, 372, 1f);
}
else
{
if (this.type != 187)
{
Gore.NewGore(this.position, this.velocity, 3, 1f);
}
}
}
}
}
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 4, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 4, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 5, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 5, 1f);
if (this.type == 186)
{
Gore.NewGore(this.position, this.velocity, 242, 1f);
}
if (this.type == 186 && Main.rand.Next(2) == 0)
{
Gore.NewGore(this.position, this.velocity, 242, 1f);
return;
}
}
}
else
{
if (this.type == 83 || this.type == 84 || this.type == 179)
{
if (this.life > 0)
{
int num94 = 0;
while ((double)num94 < dmg / (double)this.lifeMax * 50.0)
{
int num95 = Dust.NewDust(this.position, this.width, this.height, 31, 0f, 0f, 0, default(Color), 1.5f);
Main.dust[num95].noGravity = true;
num94++;
}
return;
}
for (int num96 = 0; num96 < 20; num96++)
{
int num97 = Dust.NewDust(this.position, this.width, this.height, 31, 0f, 0f, 0, default(Color), 1.5f);
Main.dust[num97].velocity *= 2f;
Main.dust[num97].noGravity = true;
}
int num98 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2) - 10f), new Vector2((float)Main.rand.Next(-2, 3), (float)Main.rand.Next(-2, 3)), 61, this.scale);
Main.gore[num98].velocity *= 0.5f;
num98 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2) - 10f), new Vector2((float)Main.rand.Next(-2, 3), (float)Main.rand.Next(-2, 3)), 61, this.scale);
Main.gore[num98].velocity *= 0.5f;
num98 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2) - 10f), new Vector2((float)Main.rand.Next(-2, 3), (float)Main.rand.Next(-2, 3)), 61, this.scale);
Main.gore[num98].velocity *= 0.5f;
return;
}
else
{
if (this.type == 262 || this.type == 263 || this.type == 264)
{
if (this.life > 0)
{
int num99 = 0;
while ((double)num99 < dmg / (double)this.lifeMax * 100.0)
{
if (this.type == 262 && this.life > this.lifeMax / 2 && Main.rand.Next(3) != 0)
{
Dust.NewDust(this.position, this.width, this.height, 166, (float)hitDirection, -1f, 0, default(Color), 1f);
}
else
{
if (this.type == 265 && Main.rand.Next(3) != 0)
{
Dust.NewDust(this.position, this.width, this.height, 166, (float)hitDirection, -1f, 0, default(Color), 1f);
}
else
{
Dust.NewDust(this.position, this.width, this.height, 167, (float)hitDirection, -1f, 0, default(Color), 1f);
}
}
num99++;
}
return;
}
for (int num100 = 0; num100 < 150; num100++)
{
if (this.type == 265 && Main.rand.Next(3) != 0)
{
Dust.NewDust(this.position, this.width, this.height, 166, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
else
{
Dust.NewDust(this.position, this.width, this.height, 167, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
}
if (this.type == 262)
{
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 381, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 382, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 383, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 384, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 385, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 386, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 386, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 387, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 387, this.scale);
}
if (this.type == 263)
{
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 390, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 391, this.scale);
}
if (this.type == 264)
{
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 388, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), this.velocity, 389, this.scale);
return;
}
}
else
{
if (this.type == 265)
{
if (this.life < 0)
{
for (int num101 = 0; num101 < 15; num101++)
{
if (Main.rand.Next(3) != 0)
{
Dust.NewDust(this.position, this.width, this.height, 166, (float)hitDirection, -1f, 0, default(Color), 1f);
}
else
{
Dust.NewDust(this.position, this.width, this.height, 167, (float)hitDirection, -1f, 0, default(Color), 1f);
}
}
return;
}
}
else
{
if (this.type == 266)
{
if (this.life > 0)
{
int num102 = 0;
while ((double)num102 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num102++;
}
return;
}
for (int num103 = 0; num103 < 150; num103++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 396, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 397, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 398, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 399, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 400, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 401, 1f);
return;
}
else
{
if (this.type == 267)
{
if (this.life > 0)
{
int num104 = 0;
while ((double)num104 < dmg / (double)this.lifeMax * 50.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num104++;
}
return;
}
for (int num105 = 0; num105 < 20; num105++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 402, 1f);
return;
}
else
{
if (this.type == 4 || this.type == 126 || this.type == 125)
{
if (this.life > 0)
{
int num106 = 0;
while ((double)num106 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num106++;
}
return;
}
for (int num107 = 0; num107 < 150; num107++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
for (int num108 = 0; num108 < 2; num108++)
{
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 2, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, 1f);
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 9, 1f);
if (this.type == 4)
{
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 10, 1f);
Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0);
}
else
{
if (this.type == 125)
{
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 146, 1f);
}
else
{
if (this.type == 126)
{
Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 145, 1f);
}
}
}
}
if (this.type == 125 || this.type == 126)
{
for (int num109 = 0; num109 < 10; num109++)
{
int num110 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num110].velocity *= 1.4f;
}
for (int num111 = 0; num111 < 5; num111++)
{
int num112 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f);
Main.dust[num112].noGravity = true;
Main.dust[num112].velocity *= 5f;
num112 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num112].velocity *= 3f;
}
int num113 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num113].velocity *= 0.4f;
Gore expr_575D_cp_0 = Main.gore[num113];
expr_575D_cp_0.velocity.X = expr_575D_cp_0.velocity.X + 1f;
Gore expr_577B_cp_0 = Main.gore[num113];
expr_577B_cp_0.velocity.Y = expr_577B_cp_0.velocity.Y + 1f;
num113 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num113].velocity *= 0.4f;
Gore expr_57F9_cp_0 = Main.gore[num113];
expr_57F9_cp_0.velocity.X = expr_57F9_cp_0.velocity.X - 1f;
Gore expr_5817_cp_0 = Main.gore[num113];
expr_5817_cp_0.velocity.Y = expr_5817_cp_0.velocity.Y + 1f;
num113 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num113].velocity *= 0.4f;
Gore expr_5895_cp_0 = Main.gore[num113];
expr_5895_cp_0.velocity.X = expr_5895_cp_0.velocity.X + 1f;
Gore expr_58B3_cp_0 = Main.gore[num113];
expr_58B3_cp_0.velocity.Y = expr_58B3_cp_0.velocity.Y - 1f;
num113 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num113].velocity *= 0.4f;
Gore expr_5931_cp_0 = Main.gore[num113];
expr_5931_cp_0.velocity.X = expr_5931_cp_0.velocity.X - 1f;
Gore expr_594F_cp_0 = Main.gore[num113];
expr_594F_cp_0.velocity.Y = expr_594F_cp_0.velocity.Y - 1f;
return;
}
}
else
{
if (this.type == 5)
{
if (this.life > 0)
{
int num114 = 0;
while ((double)num114 < dmg / (double)this.lifeMax * 50.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num114++;
}
return;
}
for (int num115 = 0; num115 < 20; num115++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 6, 1f);
Gore.NewGore(this.position, this.velocity, 7, 1f);
return;
}
else
{
if (this.type == 113 || this.type == 114)
{
if (this.life > 0)
{
for (int num116 = 0; num116 < 20; num116++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
}
return;
}
for (int num117 = 0; num117 < 50; num117++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -1f, 0, default(Color), 1f);
}
if (this.type == 114)
{
Gore.NewGore(new Vector2(this.position.X, this.position.Y), this.velocity, 137, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2)), this.velocity, 139, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2), this.position.Y), this.velocity, 139, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2)), this.velocity, 137, this.scale);
return;
}
Gore.NewGore(new Vector2(this.position.X, this.position.Y), this.velocity, 137, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2)), this.velocity, 138, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2), this.position.Y), this.velocity, 138, this.scale);
Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2)), this.velocity, 137, this.scale);
if (Main.player[Main.myPlayer].position.Y / 16f > (float)(Main.maxTilesY - 250))
{
int num118 = (int)Main.screenPosition.Y;
int num119 = num118 + Main.screenWidth;
int num120 = (int)this.position.X;
if (this.direction > 0)
{
num120 -= 80;
}
int num121 = num120 + 140;
int num122 = num120;
for (int num123 = num118; num123 < num119; num123 += 50)
{
while (num122 < num121)
{
for (int num124 = 0; num124 < 5; num124++)
{
Dust.NewDust(new Vector2((float)num122, (float)num123), 32, 32, 5, (float)Main.rand.Next(-60, 61) * 0.1f, (float)Main.rand.Next(-60, 61) * 0.1f, 0, default(Color), 1f);
}
Vector2 vector = new Vector2((float)Main.rand.Next(-80, 81) * 0.1f, (float)Main.rand.Next(-60, 21) * 0.1f);
Gore.NewGore(new Vector2((float)num122, (float)num123), vector, Main.rand.Next(140, 143), 1f);
num122 += 46;
}
num122 = num120;
}
return;
}
}
else
{
if (this.type == 115 || this.type == 116)
{
if (this.life > 0)
{
for (int num125 = 0; num125 < 5; num125++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
}
return;
}
if (this.type == 115 && Main.netMode != 1)
{
NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), 116, 0);
for (int num126 = 0; num126 < 10; num126++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
}
return;
}
for (int num127 = 0; num127 < 20; num127++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 132, this.scale);
Gore.NewGore(this.position, this.velocity, 133, this.scale);
return;
}
else
{
if (this.type >= 117 && this.type <= 119)
{
if (this.life > 0)
{
for (int num128 = 0; num128 < 5; num128++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
}
return;
}
for (int num129 = 0; num129 < 10; num129++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 134 + this.type - 117, this.scale);
return;
}
else
{
if (this.type == 217 || this.type == 218 || this.type == 219)
{
if (this.life > 0)
{
int num130 = 0;
while ((double)num130 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -1f, this.alpha, this.color, this.scale);
num130++;
}
return;
}
for (int num131 = 0; num131 < 50; num131++)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -2f, this.alpha, this.color, this.scale);
}
if (this.type == 217)
{
Gore.NewGore(this.position, this.velocity, 292, this.scale);
Gore.NewGore(this.position, this.velocity, 293, this.scale);
}
if (this.type == 218)
{
Gore.NewGore(this.position, this.velocity, 295, this.scale);
Gore.NewGore(this.position, this.velocity, 296, this.scale);
}
if (this.type == 219)
{
Gore.NewGore(this.position, this.velocity, 294, this.scale);
return;
}
}
else
{
if (this.type == 222)
{
if (this.life > 0)
{
int num132 = 0;
while ((double)num132 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -1f, this.alpha, this.color, this.scale);
num132++;
}
return;
}
for (int num133 = 0; num133 < 50; num133++)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -2f, this.alpha, this.color, this.scale);
}
Gore.NewGore(new Vector2(this.position.X, this.position.Y - 35f), this.velocity, 303, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y - 45f), this.velocity, 304, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y), this.velocity, 305, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 306, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 10f), this.velocity, 307, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y - 10f), this.velocity, 308, this.scale);
return;
}
else
{
if (this.type == 6 || this.type == 94 || this.type == 166)
{
if (this.life > 0)
{
int num134 = 0;
while ((double)num134 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -1f, this.alpha, this.color, this.scale);
num134++;
}
return;
}
for (int num135 = 0; num135 < 50; num135++)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -2f, this.alpha, this.color, this.scale);
}
int num136;
if (this.type == 94)
{
num136 = Gore.NewGore(this.position, this.velocity, 108, this.scale);
num136 = Gore.NewGore(this.position, this.velocity, 108, this.scale);
num136 = Gore.NewGore(this.position, this.velocity, 109, this.scale);
num136 = Gore.NewGore(this.position, this.velocity, 110, this.scale);
return;
}
if (this.type == 166)
{
num136 = Gore.NewGore(this.position, this.velocity, 209, this.scale);
num136 = Gore.NewGore(this.position, this.velocity, 210, this.scale);
num136 = Gore.NewGore(this.position, this.velocity, 211, this.scale);
return;
}
num136 = Gore.NewGore(this.position, this.velocity, 14, this.scale);
Main.gore[num136].alpha = this.alpha;
num136 = Gore.NewGore(this.position, this.velocity, 15, this.scale);
Main.gore[num136].alpha = this.alpha;
return;
}
else
{
if (this.type == 101)
{
if (this.life > 0)
{
int num137 = 0;
while ((double)num137 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -1f, this.alpha, this.color, this.scale);
num137++;
}
return;
}
for (int num138 = 0; num138 < 50; num138++)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -2f, this.alpha, this.color, this.scale);
}
Gore.NewGore(this.position, this.velocity, 110, this.scale);
Gore.NewGore(this.position, this.velocity, 114, this.scale);
Gore.NewGore(this.position, this.velocity, 114, this.scale);
Gore.NewGore(this.position, this.velocity, 115, this.scale);
return;
}
else
{
if (this.type == 7 || this.type == 8 || this.type == 9)
{
if (this.life > 0)
{
int num139 = 0;
while ((double)num139 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -1f, this.alpha, this.color, this.scale);
num139++;
}
return;
}
for (int num140 = 0; num140 < 50; num140++)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -2f, this.alpha, this.color, this.scale);
}
int num141 = Gore.NewGore(this.position, this.velocity, this.type - 7 + 18, 1f);
Main.gore[num141].alpha = this.alpha;
return;
}
else
{
if (this.type == 98 || this.type == 99 || this.type == 100)
{
if (this.life > 0)
{
int num142 = 0;
while ((double)num142 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -1f, this.alpha, this.color, this.scale);
num142++;
}
return;
}
for (int num143 = 0; num143 < 50; num143++)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -2f, this.alpha, this.color, this.scale);
}
int num144 = Gore.NewGore(this.position, this.velocity, 110, 1f);
Main.gore[num144].alpha = this.alpha;
return;
}
else
{
if (this.type == 10 || this.type == 11 || this.type == 12)
{
if (this.life > 0)
{
int num145 = 0;
while ((double)num145 < dmg / (double)this.lifeMax * 50.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num145++;
}
return;
}
for (int num146 = 0; num146 < 10; num146++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, this.type - 7 + 18, 1f);
return;
}
else
{
if (this.type == 95 || this.type == 96 || this.type == 97)
{
if (this.life > 0)
{
int num147 = 0;
while ((double)num147 < dmg / (double)this.lifeMax * 50.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num147++;
}
return;
}
for (int num148 = 0; num148 < 10; num148++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, this.type - 95 + 111, 1f);
return;
}
else
{
if (this.type == 13 || this.type == 14 || this.type == 15)
{
if (this.life > 0)
{
int num149 = 0;
while ((double)num149 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -1f, this.alpha, this.color, this.scale);
num149++;
}
return;
}
for (int num150 = 0; num150 < 50; num150++)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -2f, this.alpha, this.color, this.scale);
}
if (this.type == 13)
{
Gore.NewGore(this.position, this.velocity, 24, 1f);
Gore.NewGore(this.position, this.velocity, 25, 1f);
return;
}
if (this.type == 14)
{
Gore.NewGore(this.position, this.velocity, 26, 1f);
Gore.NewGore(this.position, this.velocity, 27, 1f);
return;
}
Gore.NewGore(this.position, this.velocity, 28, 1f);
Gore.NewGore(this.position, this.velocity, 29, 1f);
return;
}
else
{
if (this.type == 17)
{
if (this.life > 0)
{
int num151 = 0;
while ((double)num151 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num151++;
}
return;
}
for (int num152 = 0; num152 < 50; num152++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 30, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 31, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 31, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 32, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 32, 1f);
return;
}
else
{
if (this.type == 86)
{
if (this.life > 0)
{
int num153 = 0;
while ((double)num153 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num153++;
}
return;
}
for (int num154 = 0; num154 < 50; num154++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 101, 1f);
Gore.NewGore(this.position, this.velocity, 102, 1f);
Gore.NewGore(this.position, this.velocity, 103, 1f);
Gore.NewGore(this.position, this.velocity, 103, 1f);
Gore.NewGore(this.position, this.velocity, 104, 1f);
Gore.NewGore(this.position, this.velocity, 104, 1f);
Gore.NewGore(this.position, this.velocity, 105, 1f);
return;
}
else
{
if (this.type == 155)
{
if (this.life > 0)
{
int num155 = 0;
while ((double)num155 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num155++;
}
return;
}
for (int num156 = 0; num156 < 50; num156++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 181, 1f);
Gore.NewGore(this.position, this.velocity, 182, 1f);
Gore.NewGore(this.position, this.velocity, 183, 1f);
Gore.NewGore(this.position, this.velocity, 183, 1f);
return;
}
else
{
if (this.type == 163 || this.type == 238)
{
if (this.life > 0)
{
int num157 = 0;
while ((double)num157 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -1f, 0, default(Color), 1f);
num157++;
}
return;
}
for (int num158 = 0; num158 < 50; num158++)
{
Dust.NewDust(this.position, this.width, this.height, 18, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 205, 1f);
Gore.NewGore(this.position, this.velocity, 206, 1f);
Gore.NewGore(this.position, this.velocity, 206, 1f);
Gore.NewGore(this.position, this.velocity, 206, 1f);
Gore.NewGore(this.position, this.velocity, 206, 1f);
return;
}
else
{
if (this.type == 164 || this.type == 165)
{
if (this.life > 0)
{
int num159 = 0;
while ((double)num159 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -1f, 0, default(Color), 1f);
num159++;
}
return;
}
for (int num160 = 0; num160 < 50; num160++)
{
Dust.NewDust(this.position, this.width, this.height, 18, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 207, 1f);
Gore.NewGore(this.position, this.velocity, 208, 1f);
Gore.NewGore(this.position, this.velocity, 208, 1f);
Gore.NewGore(this.position, this.velocity, 208, 1f);
Gore.NewGore(this.position, this.velocity, 208, 1f);
return;
}
else
{
if (this.type == 239 || this.type == 240)
{
if (this.life > 0)
{
int num161 = 0;
while ((double)num161 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num161++;
}
return;
}
for (int num162 = 0; num162 < 50; num162++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 351, 1f);
Gore.NewGore(this.position, this.velocity, 352, 1f);
Gore.NewGore(this.position, this.velocity, 352, 1f);
Gore.NewGore(this.position, this.velocity, 353, 1f);
Gore.NewGore(this.position, this.velocity, 353, 1f);
return;
}
else
{
if (this.type == 236 || this.type == 237)
{
if (this.life > 0)
{
int num163 = 0;
while ((double)num163 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -1f, 0, default(Color), 1f);
num163++;
}
return;
}
for (int num164 = 0; num164 < 50; num164++)
{
Dust.NewDust(this.position, this.width, this.height, 18, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 332, 1f);
Gore.NewGore(this.position, this.velocity, 333, 1f);
Gore.NewGore(this.position, this.velocity, 334, 1f);
Gore.NewGore(this.position, this.velocity, 335, 1f);
Gore.NewGore(this.position, this.velocity, 335, 1f);
return;
}
else
{
if (this.type == 241)
{
if (this.life > 0)
{
int num165 = 0;
while ((double)num165 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num165++;
}
return;
}
for (int num166 = 0; num166 < 50; num166++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 354, 1f);
Gore.NewGore(this.position, this.velocity, 355, 1f);
return;
}
else
{
if (this.type == 242)
{
if (this.life > 0)
{
int num167 = 0;
while ((double)num167 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num167++;
}
return;
}
for (int num168 = 0; num168 < 50; num168++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 356, 1f);
Gore.NewGore(this.position, this.velocity, 357, 1f);
Gore.NewGore(this.position, this.velocity, 357, 1f);
Gore.NewGore(this.position, this.velocity, 358, 1f);
Gore.NewGore(this.position, this.velocity, 358, 1f);
return;
}
else
{
if (this.type >= 105 && this.type <= 108)
{
if (this.life > 0)
{
int num169 = 0;
while ((double)num169 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num169++;
}
return;
}
for (int num170 = 0; num170 < 50; num170++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
if (this.type == 105 || this.type == 107)
{
Gore.NewGore(this.position, this.velocity, 124, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 125, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 125, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 126, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 126, 1f);
return;
}
Gore.NewGore(this.position, this.velocity, 127, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 128, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 128, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 129, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 129, 1f);
return;
}
else
{
if (this.type == 123 || this.type == 124)
{
if (this.life > 0)
{
int num171 = 0;
while ((double)num171 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num171++;
}
return;
}
for (int num172 = 0; num172 < 50; num172++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 151, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 152, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 152, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 153, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 153, 1f);
return;
}
else
{
if (this.type == 22)
{
if (this.life > 0)
{
int num173 = 0;
while ((double)num173 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num173++;
}
return;
}
for (int num174 = 0; num174 < 50; num174++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 73, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 74, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 74, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 75, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 75, 1f);
return;
}
else
{
if (this.type == 227)
{
if (this.life > 0)
{
int num175 = 0;
while ((double)num175 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num175++;
}
return;
}
for (int num176 = 0; num176 < 50; num176++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 320, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 321, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 322, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 323, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 323, 1f);
return;
}
else
{
if (this.type == 228)
{
if (this.life > 0)
{
int num177 = 0;
while ((double)num177 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num177++;
}
return;
}
for (int num178 = 0; num178 < 50; num178++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 324, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 325, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 326, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 327, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 327, 1f);
return;
}
else
{
if (this.type == 229)
{
if (this.life > 0)
{
int num179 = 0;
while ((double)num179 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num179++;
}
return;
}
for (int num180 = 0; num180 < 50; num180++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 328, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 329, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 329, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 330, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 330, 1f);
return;
}
else
{
if (this.type == 142)
{
if (this.life > 0)
{
int num181 = 0;
while ((double)num181 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num181++;
}
return;
}
for (int num182 = 0; num182 < 50; num182++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 157, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 158, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 158, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 159, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 159, 1f);
return;
}
else
{
if (this.type == 178)
{
if (this.life > 0)
{
int num183 = 0;
while ((double)num183 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num183++;
}
return;
}
for (int num184 = 0; num184 < 50; num184++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 231, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 232, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 232, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 233, 1f);
return;
}
else
{
if (this.type == 37 || this.type == 54)
{
if (this.life > 0)
{
int num185 = 0;
while ((double)num185 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num185++;
}
return;
}
for (int num186 = 0; num186 < 50; num186++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 58, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 59, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 59, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 60, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 60, 1f);
return;
}
else
{
if (this.type == 160)
{
if (this.life > 0)
{
int num187 = 0;
while ((double)num187 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 26, (float)hitDirection, -1f, 0, default(Color), 1f);
num187++;
}
return;
}
for (int num188 = 0; num188 < 50; num188++)
{
Dust.NewDust(this.position, this.width, this.height, 26, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 188, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 189, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 189, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 190, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 190, 1f);
return;
}
else
{
if (this.type == 18)
{
if (this.life > 0)
{
int num189 = 0;
while ((double)num189 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num189++;
}
return;
}
for (int num190 = 0; num190 < 50; num190++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 33, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 34, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 34, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 35, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 35, 1f);
return;
}
else
{
if (this.type == 19)
{
if (this.life > 0)
{
int num191 = 0;
while ((double)num191 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num191++;
}
return;
}
for (int num192 = 0; num192 < 50; num192++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 36, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 37, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 37, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 38, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 38, 1f);
return;
}
else
{
if (this.type == 38)
{
if (this.life > 0)
{
int num193 = 0;
while ((double)num193 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num193++;
}
return;
}
for (int num194 = 0; num194 < 50; num194++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 64, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 65, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 65, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 66, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 66, 1f);
return;
}
else
{
if (this.type == 20)
{
if (this.life > 0)
{
int num195 = 0;
while ((double)num195 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num195++;
}
return;
}
for (int num196 = 0; num196 < 50; num196++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 39, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 40, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 40, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 41, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 41, 1f);
return;
}
else
{
if (this.type == 207)
{
if (this.life > 0)
{
int num197 = 0;
while ((double)num197 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num197++;
}
return;
}
for (int num198 = 0; num198 < 50; num198++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 283, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 284, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 284, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 285, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 285, 1f);
return;
}
else
{
if (this.type == 208)
{
if (this.life > 0)
{
int num199 = 0;
while ((double)num199 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num199++;
}
return;
}
for (int num200 = 0; num200 < 50; num200++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 286, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 287, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 287, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 288, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 288, 1f);
return;
}
else
{
if (this.type == 209)
{
if (this.life > 0)
{
int num201 = 0;
while ((double)num201 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num201++;
}
return;
}
for (int num202 = 0; num202 < 50; num202++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 289, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 290, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 290, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 291, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 291, 1f);
return;
}
else
{
if (this.type >= 212 && this.type <= 216)
{
if (this.life > 0)
{
int num203 = 0;
while ((double)num203 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num203++;
}
return;
}
for (int num204 = 0; num204 < 50; num204++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
if (this.type == 212)
{
Gore.NewGore(this.position, this.velocity, 336, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 337, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 337, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 338, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 338, 1f);
return;
}
if (this.type == 213)
{
Gore.NewGore(this.position, this.velocity, 339, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 340, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 340, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 341, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 341, 1f);
return;
}
if (this.type == 214)
{
Gore.NewGore(this.position, this.velocity, 342, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 343, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 343, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 344, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 344, 1f);
return;
}
if (this.type == 215)
{
Gore.NewGore(this.position, this.velocity, 345, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 346, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 346, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 347, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 347, 1f);
return;
}
if (this.type == 216)
{
Gore.NewGore(this.position, this.velocity, 348, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 348, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 348, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 348, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 348, 1f);
return;
}
}
else
{
if (this.type == 220 || this.type == 221)
{
if (this.life > 0)
{
int num205 = 0;
while ((double)num205 < dmg / (double)this.lifeMax * 50.0)
{
Dust.NewDust(this.position, this.width, this.height, 151, (float)hitDirection, -1f, 0, default(Color), 0.7f);
num205++;
}
return;
}
for (int num206 = 0; num206 < 20; num206++)
{
Dust.NewDust(this.position, this.width, this.height, 151, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 0.7f);
}
if (this.type == 221)
{
Gore.NewGore(this.position, this.velocity, 298, this.scale);
Gore.NewGore(this.position, this.velocity, 299, this.scale);
return;
}
Gore.NewGore(this.position, this.velocity, 297, this.scale);
return;
}
else
{
if (this.type == 21 || this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 32 || this.type == 44 || this.type == 45 || this.type == 77 || this.type == 110 || this.type == 167 || this.type == 197 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 287 || this.type == 291 || this.type == 292 || this.type == 293)
{
if (this.life > 0)
{
int num207 = 0;
while ((double)num207 < dmg / (double)this.lifeMax * 50.0)
{
Dust.NewDust(this.position, this.width, this.height, 26, (float)hitDirection, -1f, 0, default(Color), 1f);
num207++;
}
return;
}
for (int num208 = 0; num208 < 20; num208++)
{
Dust.NewDust(this.position, this.width, this.height, 26, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
if (this.type == 167)
{
Gore.NewGore(this.position, this.velocity, 213, this.scale);
Gore.NewGore(this.position, this.velocity, 214, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 43, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 43, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 212, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 212, this.scale);
return;
}
if (this.type == 197)
{
Gore.NewGore(this.position, this.velocity, 257, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 43, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 43, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 212, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 212, this.scale);
return;
}
if (this.type == 201)
{
Gore.NewGore(this.position, this.velocity, 265, this.scale);
Gore.NewGore(this.position, this.velocity, 267, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 43, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 43, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 44, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 44, this.scale);
return;
}
if (this.type == 202)
{
Gore.NewGore(this.position, this.velocity, 268, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 43, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 43, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 44, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 44, this.scale);
return;
}
if (this.type == 203)
{
Gore.NewGore(this.position, this.velocity, 269, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 43, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 43, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 266, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 266, this.scale);
return;
}
Gore.NewGore(this.position, this.velocity, 42, this.scale);
if (this.type == 77)
{
Gore.NewGore(this.position, this.velocity, 106, this.scale);
}
if (this.type == 110)
{
Gore.NewGore(this.position, this.velocity, 130, this.scale);
}
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 43, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 43, this.scale);
if (this.type == 110)
{
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 131, this.scale);
}
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 44, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 44, this.scale);
return;
}
else
{
if ((this.type >= 269 && this.type <= 276) || (this.type >= 281 && this.type <= 286))
{
if (this.life > 0)
{
int num209 = 0;
while ((double)num209 < dmg / (double)this.lifeMax * 50.0)
{
Dust.NewDust(this.position, this.width, this.height, 26, (float)hitDirection, -1f, 0, default(Color), 1f);
num209++;
}
return;
}
for (int num210 = 0; num210 < 20; num210++)
{
Dust.NewDust(this.position, this.width, this.height, 26, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 42, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 43, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 43, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 44, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 44, this.scale);
if (this.type == 269)
{
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 406, this.scale);
}
if (this.type == 270)
{
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 407, this.scale);
}
if (this.type == 271 || this.type == 272)
{
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 408, this.scale);
}
if (this.type == 274)
{
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 409, this.scale);
}
if (this.type == 276)
{
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 410, this.scale);
return;
}
}
else
{
if (this.type >= 277 && this.type <= 280)
{
if (this.life > 0)
{
int num211 = 0;
while ((double)num211 < dmg / (double)this.lifeMax * 100.0)
{
int num212 = Dust.NewDust(this.position, this.width, this.height, 174, (float)hitDirection, -1f, 0, default(Color), 1f);
Main.dust[num212].scale = 1.1f;
Main.dust[num212].noGravity = true;
num211++;
}
return;
}
for (int num213 = 0; num213 < 75; num213++)
{
int num214 = Dust.NewDust(this.position, this.width, this.height, 174, 1.5f * (float)hitDirection, -0.5f, 0, default(Color), 1f);
Main.dust[num214].velocity *= 2f;
Main.dust[num214].scale = 1.4f;
Main.dust[num214].noGravity = true;
}
return;
}
else
{
if (this.type == 85)
{
int num215 = 7;
if (this.ai[3] == 2f)
{
num215 = 10;
}
if (this.ai[3] == 3f)
{
num215 = 37;
}
if (this.life > 0)
{
int num216 = 0;
while ((double)num216 < dmg / (double)this.lifeMax * 50.0)
{
Dust.NewDust(this.position, this.width, this.height, num215, 0f, 0f, 0, default(Color), 1f);
num216++;
}
return;
}
for (int num217 = 0; num217 < 20; num217++)
{
Dust.NewDust(this.position, this.width, this.height, num215, 0f, 0f, 0, default(Color), 1f);
}
int num218 = Gore.NewGore(new Vector2(this.position.X, this.position.Y - 10f), new Vector2((float)hitDirection, 0f), 61, this.scale);
Main.gore[num218].velocity *= 0.3f;
num218 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2) - 10f), new Vector2((float)hitDirection, 0f), 62, this.scale);
Main.gore[num218].velocity *= 0.3f;
num218 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)this.height - 10f), new Vector2((float)hitDirection, 0f), 63, this.scale);
Main.gore[num218].velocity *= 0.3f;
return;
}
else
{
if (this.type == 169)
{
if (this.life > 0)
{
int num219 = 0;
while ((double)num219 < dmg / (double)this.lifeMax * 50.0)
{
int num220 = Dust.NewDust(this.position, this.width, this.height, 92, 0f, 0f, 0, default(Color), 1.5f);
Main.dust[num220].velocity *= 1.5f;
Main.dust[num220].noGravity = true;
num219++;
}
return;
}
for (int num221 = 0; num221 < 100; num221++)
{
int num222 = Dust.NewDust(this.position, this.width, this.height, 92, 0f, 0f, 0, default(Color), 1.5f);
Main.dust[num222].scale = 1.5f;
Main.dust[num222].velocity *= 2f;
Main.dust[num222].noGravity = true;
}
return;
}
else
{
if (this.type == 170 || this.type == 180)
{
if (this.life > 0)
{
int num223 = 0;
while ((double)num223 < dmg / (double)this.lifeMax * 50.0)
{
int num224 = Dust.NewDust(this.position, this.width, this.height, 54, 0f, 0f, 0, default(Color), 1.5f);
Main.dust[num224].velocity *= 1.5f;
Main.dust[num224].noGravity = true;
num223++;
}
return;
}
for (int num225 = 0; num225 < 10; num225++)
{
int num226 = Dust.NewDust(this.position, this.width, this.height, 54, 0f, 0f, 0, default(Color), 1.5f);
Main.dust[num226].velocity *= 2f;
Main.dust[num226].noGravity = true;
}
for (int num227 = 0; num227 < 4; num227++)
{
int num228 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2) - 10f), new Vector2((float)hitDirection, 0f), 99, this.scale);
Main.gore[num228].velocity *= 0.3f;
}
return;
}
else
{
if (this.type == 171)
{
if (this.life > 0)
{
int num229 = 0;
while ((double)num229 < dmg / (double)this.lifeMax * 50.0)
{
int num230 = Dust.NewDust(this.position, this.width, this.height, 16, 0f, 0f, 0, default(Color), 1.5f);
Main.dust[num230].velocity *= 1.5f;
Main.dust[num230].noGravity = true;
num229++;
}
return;
}
for (int num231 = 0; num231 < 10; num231++)
{
int num232 = Dust.NewDust(this.position, this.width, this.height, 16, 0f, 0f, 0, default(Color), 1.5f);
Main.dust[num232].velocity *= 2f;
Main.dust[num232].noGravity = true;
}
for (int num233 = 0; num233 < 4; num233++)
{
int num234 = 11 + num233;
if (num234 > 13)
{
num234 = Main.rand.Next(11, 14);
}
int num235 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2) - 10f), new Vector2((float)hitDirection, 0f), num234, this.scale);
Main.gore[num235].velocity *= 0.3f;
}
return;
}
else
{
if (this.type == 290)
{
if (this.life <= 0)
{
for (int num236 = 0; num236 < 10; num236++)
{
int num237 = Dust.NewDust(this.position, this.width, this.height, 16, 0f, 0f, 0, default(Color), 1.5f);
Main.dust[num237].velocity *= 2f;
Main.dust[num237].noGravity = true;
}
int num238 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(11, 14), this.scale);
Main.gore[num238].velocity *= 0.5f;
num238 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), default(Vector2), Main.rand.Next(11, 14), this.scale);
Main.gore[num238].velocity *= 0.5f;
num238 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + 40f), default(Vector2), Main.rand.Next(11, 14), this.scale);
Main.gore[num238].velocity *= 0.5f;
return;
}
}
else
{
if (this.type >= 87 && this.type <= 92)
{
if (this.life > 0)
{
int num239 = 0;
while ((double)num239 < dmg / (double)this.lifeMax * 50.0)
{
int num240 = Dust.NewDust(this.position, this.width, this.height, 16, 0f, 0f, 0, default(Color), 1.5f);
Main.dust[num240].velocity *= 1.5f;
Main.dust[num240].noGravity = true;
num239++;
}
return;
}
for (int num241 = 0; num241 < 10; num241++)
{
int num242 = Dust.NewDust(this.position, this.width, this.height, 16, 0f, 0f, 0, default(Color), 1.5f);
Main.dust[num242].velocity *= 2f;
Main.dust[num242].noGravity = true;
}
int num243 = Main.rand.Next(1, 4);
for (int num244 = 0; num244 < num243; num244++)
{
int num245 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2) - 10f), new Vector2((float)hitDirection, 0f), Main.rand.Next(11, 14), this.scale);
Main.gore[num245].velocity *= 0.8f;
}
return;
}
else
{
if (this.type == 78 || this.type == 79 || this.type == 80)
{
if (this.life > 0)
{
int num246 = 0;
while ((double)num246 < dmg / (double)this.lifeMax * 50.0)
{
int num247 = Dust.NewDust(this.position, this.width, this.height, 31, 0f, 0f, 0, default(Color), 1.5f);
Main.dust[num247].velocity *= 2f;
Main.dust[num247].noGravity = true;
num246++;
}
return;
}
for (int num248 = 0; num248 < 20; num248++)
{
int num249 = Dust.NewDust(this.position, this.width, this.height, 31, 0f, 0f, 0, default(Color), 1.5f);
Main.dust[num249].velocity *= 2f;
Main.dust[num249].noGravity = true;
}
int num250 = Gore.NewGore(new Vector2(this.position.X, this.position.Y - 10f), new Vector2((float)hitDirection, 0f), 61, this.scale);
Main.gore[num250].velocity *= 0.3f;
num250 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2) - 10f), new Vector2((float)hitDirection, 0f), 62, this.scale);
Main.gore[num250].velocity *= 0.3f;
num250 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)this.height - 10f), new Vector2((float)hitDirection, 0f), 63, this.scale);
Main.gore[num250].velocity *= 0.3f;
return;
}
else
{
if (this.type == 82 || this.type == 158 || this.type == 159 || this.type == 250 || this.type == 253)
{
if (this.life > 0)
{
int num251 = 0;
while ((double)num251 < dmg / (double)this.lifeMax * 50.0)
{
int num252 = Dust.NewDust(this.position, this.width, this.height, 54, 0f, 0f, 50, default(Color), 1.5f);
Main.dust[num252].velocity *= 2f;
Main.dust[num252].noGravity = true;
num251++;
}
return;
}
for (int num253 = 0; num253 < 20; num253++)
{
int num254 = Dust.NewDust(this.position, this.width, this.height, 54, 0f, 0f, 50, default(Color), 1.5f);
Main.dust[num254].velocity *= 2f;
Main.dust[num254].noGravity = true;
}
int num255 = Gore.NewGore(new Vector2(this.position.X, this.position.Y - 10f), new Vector2((float)hitDirection, 0f), 99, this.scale);
Main.gore[num255].velocity *= 0.3f;
num255 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2) - 15f), new Vector2((float)hitDirection, 0f), 99, this.scale);
Main.gore[num255].velocity *= 0.3f;
num255 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)this.height - 20f), new Vector2((float)hitDirection, 0f), 99, this.scale);
Main.gore[num255].velocity *= 0.3f;
return;
}
else
{
if (this.type == 254 || this.type == 255 || this.type == 256 || this.type == 257 || this.type == 258 || this.type == 259 || this.type == 260 || this.type == 261)
{
if (this.life > 0)
{
int num256 = 0;
while ((double)num256 < dmg / (double)this.lifeMax * 50.0)
{
int num257 = Dust.NewDust(this.position, this.width, this.height, 165, 0f, 0f, 50, default(Color), 1.5f);
Main.dust[num257].velocity *= 2f;
Main.dust[num257].noGravity = true;
num256++;
}
return;
}
for (int num258 = 0; num258 < 20; num258++)
{
int num259 = Dust.NewDust(this.position, this.width, this.height, 165, 0f, 0f, 50, default(Color), 1.5f);
Main.dust[num259].velocity *= 2f;
Main.dust[num259].noGravity = true;
}
if (this.type != 261)
{
int num260 = Gore.NewGore(new Vector2(this.position.X, this.position.Y - 10f), new Vector2((float)hitDirection, 0f), 375, this.scale);
Main.gore[num260].velocity *= 0.3f;
num260 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2) - 15f), new Vector2((float)hitDirection, 0f), 376, this.scale);
Main.gore[num260].velocity *= 0.3f;
num260 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)this.height - 20f), new Vector2((float)hitDirection, 0f), 377, this.scale);
Main.gore[num260].velocity *= 0.3f;
return;
}
}
else
{
if (this.type == 140)
{
if (this.life <= 0)
{
for (int num261 = 0; num261 < 20; num261++)
{
int num262 = Dust.NewDust(this.position, this.width, this.height, 54, 0f, 0f, 50, default(Color), 1.5f);
Main.dust[num262].velocity *= 2f;
Main.dust[num262].noGravity = true;
}
int num263 = Gore.NewGore(new Vector2(this.position.X, this.position.Y - 10f), new Vector2((float)hitDirection, 0f), 99, this.scale);
Main.gore[num263].velocity *= 0.3f;
num263 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)(this.height / 2) - 15f), new Vector2((float)hitDirection, 0f), 99, this.scale);
Main.gore[num263].velocity *= 0.3f;
num263 = Gore.NewGore(new Vector2(this.position.X, this.position.Y + (float)this.height - 20f), new Vector2((float)hitDirection, 0f), 99, this.scale);
Main.gore[num263].velocity *= 0.3f;
return;
}
}
else
{
if (this.type == 39 || this.type == 40 || this.type == 41)
{
if (this.life > 0)
{
int num264 = 0;
while ((double)num264 < dmg / (double)this.lifeMax * 50.0)
{
Dust.NewDust(this.position, this.width, this.height, 26, (float)hitDirection, -1f, 0, default(Color), 1f);
num264++;
}
return;
}
for (int num265 = 0; num265 < 20; num265++)
{
Dust.NewDust(this.position, this.width, this.height, 26, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, this.type - 39 + 67, 1f);
return;
}
else
{
if (this.type == 34)
{
if (this.life > 0)
{
int num266 = 0;
while ((double)num266 < dmg / (double)this.lifeMax * 30.0)
{
int num267 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 15, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 1.8f);
Main.dust[num267].noLight = true;
Main.dust[num267].noGravity = true;
Main.dust[num267].velocity *= 1.3f;
num267 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 26, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 0, default(Color), 0.9f);
Main.dust[num267].noLight = true;
Main.dust[num267].velocity *= 1.3f;
num266++;
}
return;
}
for (int num268 = 0; num268 < 15; num268++)
{
int num269 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 15, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 1.8f);
Main.dust[num269].noLight = true;
Main.dust[num269].noGravity = true;
Main.dust[num269].velocity *= 1.3f;
num269 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 26, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 0, default(Color), 0.9f);
Main.dust[num269].noLight = true;
Main.dust[num269].velocity *= 1.3f;
}
return;
}
else
{
if (this.type == 289)
{
if (this.life > 0)
{
int num270 = 0;
while ((double)num270 < dmg / (double)this.lifeMax * 30.0)
{
int num271 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 181, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 1.8f);
Main.dust[num271].noLight = true;
Main.dust[num271].noGravity = true;
Main.dust[num271].velocity *= 1.3f;
num270++;
}
return;
}
for (int num272 = 0; num272 < 50; num272++)
{
int num273 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 181, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 1.8f);
Main.dust[num273].noLight = true;
Main.dust[num273].noGravity = true;
Main.dust[num273].velocity *= 1.3f;
}
return;
}
else
{
if (this.type == 35 || this.type == 36)
{
if (this.life > 0)
{
int num274 = 0;
while ((double)num274 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 26, (float)hitDirection, -1f, 0, default(Color), 1f);
num274++;
}
return;
}
for (int num275 = 0; num275 < 150; num275++)
{
Dust.NewDust(this.position, this.width, this.height, 26, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
if (this.type == 35)
{
Gore.NewGore(this.position, this.velocity, 54, 1f);
Gore.NewGore(this.position, this.velocity, 55, 1f);
return;
}
Gore.NewGore(this.position, this.velocity, 56, 1f);
Gore.NewGore(this.position, this.velocity, 57, 1f);
Gore.NewGore(this.position, this.velocity, 57, 1f);
Gore.NewGore(this.position, this.velocity, 57, 1f);
return;
}
else
{
if (this.type == 139)
{
if (this.life <= 0)
{
for (int num276 = 0; num276 < 10; num276++)
{
int num277 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num277].velocity *= 1.4f;
}
for (int num278 = 0; num278 < 5; num278++)
{
int num279 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f);
Main.dust[num279].noGravity = true;
Main.dust[num279].velocity *= 5f;
num279 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num279].velocity *= 3f;
}
int num280 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num280].velocity *= 0.4f;
Gore expr_C6F1_cp_0 = Main.gore[num280];
expr_C6F1_cp_0.velocity.X = expr_C6F1_cp_0.velocity.X + 1f;
Gore expr_C711_cp_0 = Main.gore[num280];
expr_C711_cp_0.velocity.Y = expr_C711_cp_0.velocity.Y + 1f;
num280 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num280].velocity *= 0.4f;
Gore expr_C795_cp_0 = Main.gore[num280];
expr_C795_cp_0.velocity.X = expr_C795_cp_0.velocity.X - 1f;
Gore expr_C7B5_cp_0 = Main.gore[num280];
expr_C7B5_cp_0.velocity.Y = expr_C7B5_cp_0.velocity.Y + 1f;
num280 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num280].velocity *= 0.4f;
Gore expr_C839_cp_0 = Main.gore[num280];
expr_C839_cp_0.velocity.X = expr_C839_cp_0.velocity.X + 1f;
Gore expr_C859_cp_0 = Main.gore[num280];
expr_C859_cp_0.velocity.Y = expr_C859_cp_0.velocity.Y - 1f;
num280 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num280].velocity *= 0.4f;
Gore expr_C8DD_cp_0 = Main.gore[num280];
expr_C8DD_cp_0.velocity.X = expr_C8DD_cp_0.velocity.X - 1f;
Gore expr_C8FD_cp_0 = Main.gore[num280];
expr_C8FD_cp_0.velocity.Y = expr_C8FD_cp_0.velocity.Y - 1f;
return;
}
}
else
{
if (this.type >= 134 && this.type <= 136)
{
if (this.type == 135 && this.life > 0 && Main.netMode != 1 && this.ai[2] == 0f && Main.rand.Next(25) == 0)
{
this.ai[2] = 1f;
int num281 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), 139, 0);
if (Main.netMode == 2 && num281 < 200)
{
NetMessage.SendData(23, -1, -1, "", num281, 0f, 0f, 0f, 0);
}
this.netUpdate = true;
}
if (this.life <= 0)
{
Gore.NewGore(this.position, this.velocity, 156, 1f);
if (Main.rand.Next(2) == 0)
{
for (int num282 = 0; num282 < 10; num282++)
{
int num283 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num283].velocity *= 1.4f;
}
for (int num284 = 0; num284 < 5; num284++)
{
int num285 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f);
Main.dust[num285].noGravity = true;
Main.dust[num285].velocity *= 5f;
num285 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num285].velocity *= 3f;
}
int num286 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num286].velocity *= 0.4f;
Gore expr_CC3E_cp_0 = Main.gore[num286];
expr_CC3E_cp_0.velocity.X = expr_CC3E_cp_0.velocity.X + 1f;
Gore expr_CC5E_cp_0 = Main.gore[num286];
expr_CC5E_cp_0.velocity.Y = expr_CC5E_cp_0.velocity.Y + 1f;
num286 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num286].velocity *= 0.4f;
Gore expr_CCE2_cp_0 = Main.gore[num286];
expr_CCE2_cp_0.velocity.X = expr_CCE2_cp_0.velocity.X - 1f;
Gore expr_CD02_cp_0 = Main.gore[num286];
expr_CD02_cp_0.velocity.Y = expr_CD02_cp_0.velocity.Y + 1f;
num286 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num286].velocity *= 0.4f;
Gore expr_CD86_cp_0 = Main.gore[num286];
expr_CD86_cp_0.velocity.X = expr_CD86_cp_0.velocity.X + 1f;
Gore expr_CDA6_cp_0 = Main.gore[num286];
expr_CDA6_cp_0.velocity.Y = expr_CDA6_cp_0.velocity.Y - 1f;
num286 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num286].velocity *= 0.4f;
Gore expr_CE2A_cp_0 = Main.gore[num286];
expr_CE2A_cp_0.velocity.X = expr_CE2A_cp_0.velocity.X - 1f;
Gore expr_CE4A_cp_0 = Main.gore[num286];
expr_CE4A_cp_0.velocity.Y = expr_CE4A_cp_0.velocity.Y - 1f;
return;
}
}
}
else
{
if (this.type == 127)
{
if (this.life <= 0)
{
Gore.NewGore(this.position, this.velocity, 149, 1f);
Gore.NewGore(this.position, this.velocity, 150, 1f);
for (int num287 = 0; num287 < 10; num287++)
{
int num288 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num288].velocity *= 1.4f;
}
for (int num289 = 0; num289 < 5; num289++)
{
int num290 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f);
Main.dust[num290].noGravity = true;
Main.dust[num290].velocity *= 5f;
num290 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num290].velocity *= 3f;
}
int num291 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num291].velocity *= 0.4f;
Gore expr_D0B8_cp_0 = Main.gore[num291];
expr_D0B8_cp_0.velocity.X = expr_D0B8_cp_0.velocity.X + 1f;
Gore expr_D0D8_cp_0 = Main.gore[num291];
expr_D0D8_cp_0.velocity.Y = expr_D0D8_cp_0.velocity.Y + 1f;
num291 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num291].velocity *= 0.4f;
Gore expr_D15C_cp_0 = Main.gore[num291];
expr_D15C_cp_0.velocity.X = expr_D15C_cp_0.velocity.X - 1f;
Gore expr_D17C_cp_0 = Main.gore[num291];
expr_D17C_cp_0.velocity.Y = expr_D17C_cp_0.velocity.Y + 1f;
num291 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num291].velocity *= 0.4f;
Gore expr_D200_cp_0 = Main.gore[num291];
expr_D200_cp_0.velocity.X = expr_D200_cp_0.velocity.X + 1f;
Gore expr_D220_cp_0 = Main.gore[num291];
expr_D220_cp_0.velocity.Y = expr_D220_cp_0.velocity.Y - 1f;
num291 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num291].velocity *= 0.4f;
Gore expr_D2A4_cp_0 = Main.gore[num291];
expr_D2A4_cp_0.velocity.X = expr_D2A4_cp_0.velocity.X - 1f;
Gore expr_D2C4_cp_0 = Main.gore[num291];
expr_D2C4_cp_0.velocity.Y = expr_D2C4_cp_0.velocity.Y - 1f;
return;
}
}
else
{
if (this.type >= 128 && this.type <= 131)
{
if (this.life <= 0)
{
Gore.NewGore(this.position, this.velocity, 147, 1f);
Gore.NewGore(this.position, this.velocity, 148, 1f);
for (int num292 = 0; num292 < 10; num292++)
{
int num293 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num293].velocity *= 1.4f;
}
for (int num294 = 0; num294 < 5; num294++)
{
int num295 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f);
Main.dust[num295].noGravity = true;
Main.dust[num295].velocity *= 5f;
num295 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num295].velocity *= 3f;
}
int num296 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num296].velocity *= 0.4f;
Gore expr_D545_cp_0 = Main.gore[num296];
expr_D545_cp_0.velocity.X = expr_D545_cp_0.velocity.X + 1f;
Gore expr_D565_cp_0 = Main.gore[num296];
expr_D565_cp_0.velocity.Y = expr_D565_cp_0.velocity.Y + 1f;
num296 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num296].velocity *= 0.4f;
Gore expr_D5E9_cp_0 = Main.gore[num296];
expr_D5E9_cp_0.velocity.X = expr_D5E9_cp_0.velocity.X - 1f;
Gore expr_D609_cp_0 = Main.gore[num296];
expr_D609_cp_0.velocity.Y = expr_D609_cp_0.velocity.Y + 1f;
num296 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num296].velocity *= 0.4f;
Gore expr_D68D_cp_0 = Main.gore[num296];
expr_D68D_cp_0.velocity.X = expr_D68D_cp_0.velocity.X + 1f;
Gore expr_D6AD_cp_0 = Main.gore[num296];
expr_D6AD_cp_0.velocity.Y = expr_D6AD_cp_0.velocity.Y - 1f;
num296 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num296].velocity *= 0.4f;
Gore expr_D731_cp_0 = Main.gore[num296];
expr_D731_cp_0.velocity.X = expr_D731_cp_0.velocity.X - 1f;
Gore expr_D751_cp_0 = Main.gore[num296];
expr_D751_cp_0.velocity.Y = expr_D751_cp_0.velocity.Y - 1f;
return;
}
}
else
{
if (this.type == 23)
{
if (this.life > 0)
{
int num297 = 0;
while ((double)num297 < dmg / (double)this.lifeMax * 100.0)
{
int num298 = 25;
if (Main.rand.Next(2) == 0)
{
num298 = 6;
}
Dust.NewDust(this.position, this.width, this.height, num298, (float)hitDirection, -1f, 0, default(Color), 1f);
int num299 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 2f);
Main.dust[num299].noGravity = true;
num297++;
}
return;
}
for (int num300 = 0; num300 < 50; num300++)
{
int num301 = 25;
if (Main.rand.Next(2) == 0)
{
num301 = 6;
}
Dust.NewDust(this.position, this.width, this.height, num301, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
for (int num302 = 0; num302 < 50; num302++)
{
int num303 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 2.5f);
Main.dust[num303].velocity *= 6f;
Main.dust[num303].noGravity = true;
}
return;
}
else
{
if (this.type == 24)
{
if (this.life > 0)
{
int num304 = 0;
while ((double)num304 < dmg / (double)this.lifeMax * 100.0)
{
int num305 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X, this.velocity.Y, 100, default(Color), 2.5f);
Main.dust[num305].noGravity = true;
num304++;
}
return;
}
for (int num306 = 0; num306 < 50; num306++)
{
int num307 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X, this.velocity.Y, 100, default(Color), 2.5f);
Main.dust[num307].noGravity = true;
Main.dust[num307].velocity *= 2f;
}
Gore.NewGore(this.position, this.velocity, 45, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 46, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 46, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 47, 1f);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 47, 1f);
return;
}
else
{
if (this.type == 25)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10);
for (int num308 = 0; num308 < 20; num308++)
{
int num309 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 2f);
Main.dust[num309].noGravity = true;
Main.dust[num309].velocity *= 2f;
num309 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 1f);
Main.dust[num309].velocity *= 2f;
}
return;
}
if (this.type == 33)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10);
for (int num310 = 0; num310 < 20; num310++)
{
int num311 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 172, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 1.2f);
Main.dust[num311].noGravity = true;
Main.dust[num311].velocity *= 2f;
num311 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 172, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 0.6f);
Main.dust[num311].velocity *= 2f;
}
return;
}
if (this.type == 26 || this.type == 27 || this.type == 28 || this.type == 29 || this.type == 73 || this.type == 111)
{
if (this.life > 0)
{
int num312 = 0;
while ((double)num312 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num312++;
}
return;
}
for (int num313 = 0; num313 < 50; num313++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 48, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 49, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 49, this.scale);
if (this.type == 111)
{
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 131, this.scale);
}
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 50, this.scale);
Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 50, this.scale);
return;
}
else
{
if (this.type == 185)
{
if (this.life > 0)
{
int num314 = 0;
while ((double)num314 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num314++;
}
return;
}
for (int num315 = 0; num315 < 50; num315++)
{
Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * (float)hitDirection, -2.5f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 240, this.scale);
return;
}
else
{
if (this.type == 30)
{
Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10);
for (int num316 = 0; num316 < 20; num316++)
{
int num317 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 2f);
Main.dust[num317].noGravity = true;
Main.dust[num317].velocity *= 2f;
num317 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 1f);
Main.dust[num317].velocity *= 2f;
}
return;
}
if (this.type == 42 || this.type == 176 || this.type == 205 || (this.type >= 231 && this.type <= 235))
{
if (this.life > 0)
{
int num318 = 0;
while ((double)num318 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -1f, this.alpha, this.color, this.scale);
num318++;
}
return;
}
for (int num319 = 0; num319 < 50; num319++)
{
Dust.NewDust(this.position, this.width, this.height, 18, (float)hitDirection, -2f, this.alpha, this.color, this.scale);
}
if (this.type == 205)
{
Gore.NewGore(this.position, this.velocity, 270, this.scale);
Gore.NewGore(this.position, this.velocity, 271, this.scale);
Gore.NewGore(this.position, this.velocity, 271, this.scale);
Gore.NewGore(this.position, this.velocity, 272, this.scale);
return;
}
if (this.type == 176)
{
Gore.NewGore(this.position, this.velocity, 229, this.scale);
Gore.NewGore(this.position, this.velocity, 230, this.scale);
return;
}
Gore.NewGore(this.position, this.velocity, 70, this.scale);
Gore.NewGore(this.position, this.velocity, 71, this.scale);
return;
}
else
{
if (this.type == 43 || this.type == 56)
{
if (this.life > 0)
{
int num320 = 0;
while ((double)num320 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 40, (float)hitDirection, -1f, this.alpha, this.color, 1.2f);
num320++;
}
return;
}
for (int num321 = 0; num321 < 50; num321++)
{
Dust.NewDust(this.position, this.width, this.height, 40, (float)hitDirection, -2f, this.alpha, this.color, 1.2f);
}
Gore.NewGore(this.position, this.velocity, 72, 1f);
Gore.NewGore(this.position, this.velocity, 72, 1f);
return;
}
else
{
if (this.type == 175)
{
if (this.life > 0)
{
int num322 = 0;
while ((double)num322 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 40, (float)hitDirection, -1f, this.alpha, this.color, 1.2f);
num322++;
}
return;
}
for (int num323 = 0; num323 < 50; num323++)
{
Dust.NewDust(this.position, this.width, this.height, 40, (float)hitDirection, -2f, this.alpha, this.color, 1.2f);
}
Gore.NewGore(this.position, this.velocity, 227, 1f);
Gore.NewGore(this.position, this.velocity, 228, 1f);
return;
}
else
{
if (this.type == 48)
{
if (this.life > 0)
{
int num324 = 0;
while ((double)num324 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num324++;
}
return;
}
for (int num325 = 0; num325 < 50; num325++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 80, 1f);
Gore.NewGore(this.position, this.velocity, 81, 1f);
return;
}
else
{
if (this.type == 62 || this.type == 66)
{
if (this.life > 0)
{
int num326 = 0;
while ((double)num326 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num326++;
}
return;
}
for (int num327 = 0; num327 < 50; num327++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 93, 1f);
Gore.NewGore(this.position, this.velocity, 94, 1f);
Gore.NewGore(this.position, this.velocity, 94, 1f);
return;
}
else
{
if (this.type == 156)
{
if (this.life > 0)
{
int num328 = 0;
while ((double)num328 < dmg / (double)this.lifeMax * 100.0)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f);
num328++;
}
return;
}
for (int num329 = 0; num329 < 50; num329++)
{
Dust.NewDust(this.position, this.width, this.height, 5, (float)(2 * hitDirection), -2f, 0, default(Color), 1f);
}
Gore.NewGore(this.position, this.velocity, 184, 1f);
Gore.NewGore(this.position, this.velocity, 185, 1f);
Gore.NewGore(this.position, this.velocity, 185, 1f);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return;
}
if (this.life > 0)
{
int num330 = 0;
while ((double)num330 < dmg / (double)this.lifeMax * 80.0)
{
Dust.NewDust(this.position, this.width, this.height, 6, (float)(hitDirection * 2), -1f, this.alpha, default(Color), 1.5f);
num330++;
}
return;
}
for (int num331 = 0; num331 < 40; num331++)
{
Dust.NewDust(this.position, this.width, this.height, 6, (float)(hitDirection * 2), -1f, this.alpha, default(Color), 1.5f);
}
return;
}
}
public static bool AnyNPCs(int Type)
{
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].active && Main.npc[i].type == Type)
{
return true;
}
}
return false;
}
public static void SpawnSkeletron()
{
bool flag = true;
bool flag2 = false;
Vector2 vector = default(Vector2);
int num = 0;
int num2 = 0;
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].active && Main.npc[i].type == 35)
{
flag = false;
break;
}
}
for (int j = 0; j < 200; j++)
{
if (Main.npc[j].active && Main.npc[j].type == 37)
{
flag2 = true;
Main.npc[j].ai[3] = 1f;
vector = Main.npc[j].position;
num = Main.npc[j].width;
num2 = Main.npc[j].height;
if (Main.netMode == 2)
{
NetMessage.SendData(23, -1, -1, "", j, 0f, 0f, 0f, 0);
}
}
}
if (flag && flag2)
{
int num3 = NPC.NewNPC((int)vector.X + num / 2, (int)vector.Y + num2 / 2, 35, 0);
Main.npc[num3].netUpdate = true;
string str = "Skeletron";
if (Main.netMode == 0)
{
Main.NewText(str + " " + Lang.misc[16], 175, 75, 255, false);
return;
}
if (Main.netMode == 2)
{
NetMessage.SendData(25, -1, -1, str + " " + Lang.misc[16], 255, 175f, 75f, 255f, 0);
}
}
}
public static bool NearSpikeBall(int x, int y)
{
Rectangle rectangle = new Rectangle(x * 16 - 300, y * 16 - 300, 600, 600);
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].active && Main.npc[i].aiStyle == 20)
{
Rectangle rectangle2 = new Rectangle((int)Main.npc[i].ai[1], (int)Main.npc[i].ai[2], 20, 20);
if (rectangle.Intersects(rectangle2))
{
return true;
}
}
}
return false;
}
public void AddBuff(int type, int time, bool quiet = false)
{
if (this.buffImmune[type])
{
return;
}
if (!quiet)
{
if (Main.netMode == 1)
{
NetMessage.SendData(53, -1, -1, "", this.whoAmI, (float)type, (float)time, 0f, 0);
}
else
{
if (Main.netMode == 2)
{
NetMessage.SendData(54, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0);
}
}
}
int num = -1;
for (int i = 0; i < 5; i++)
{
if (this.buffType[i] == type)
{
if (this.buffTime[i] < time)
{
this.buffTime[i] = time;
}
return;
}
}
while (num == -1)
{
int num2 = -1;
for (int j = 0; j < 5; j++)
{
if (!Main.debuff[this.buffType[j]])
{
num2 = j;
break;
}
}
if (num2 == -1)
{
return;
}
for (int k = num2; k < 5; k++)
{
if (this.buffType[k] == 0)
{
num = k;
break;
}
}
if (num == -1)
{
this.DelBuff(num2);
}
}
this.buffType[num] = type;
this.buffTime[num] = time;
}
public void DelBuff(int b)
{
this.buffTime[b] = 0;
this.buffType[b] = 0;
for (int i = 0; i < 4; i++)
{
if (this.buffTime[i] == 0 || this.buffType[i] == 0)
{
for (int j = i + 1; j < 5; j++)
{
this.buffTime[j - 1] = this.buffTime[j];
this.buffType[j - 1] = this.buffType[j];
this.buffTime[j] = 0;
this.buffType[j] = 0;
}
}
}
if (Main.netMode == 2)
{
NetMessage.SendData(54, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0);
}
}
public Vector2 center()
{
return new Vector2(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2));
}
public Rectangle getRect()
{
return new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height);
}
public void UpdateNPC(int i)
{
this.whoAmI = i;
if (this.active)
{
if (this.realLife >= 0)
{
this.life = Main.npc[this.realLife].life;
}
if (Main.netMode == 1)
{
bool flag = false;
int num = (int)(this.position.X + (float)(this.width / 2)) / 16;
int num2 = (int)(this.position.Y + (float)(this.height / 2)) / 16;
try
{
if (num >= 4 && num <= Main.maxTilesX - 4 && num2 >= 4 && num2 <= Main.maxTilesY - 4)
{
if (Main.tile[num, num2] == null)
{
flag = true;
}
else
{
if (Main.tile[num - 3, num2] == null)
{
flag = true;
}
else
{
if (Main.tile[num + 3, num2] == null)
{
flag = true;
}
else
{
if (Main.tile[num, num2 - 3] == null)
{
flag = true;
}
else
{
if (Main.tile[num, num2 + 3] == null)
{
flag = true;
}
}
}
}
}
}
}
catch
{
flag = true;
}
if (flag)
{
return;
}
}
if (this.displayName == "")
{
this.displayName = this.name;
}
if (this.townNPC && Main.chrName[this.type] != "")
{
this.displayName = Main.chrName[this.type];
}
this.lifeRegen = 0;
this.poisoned = false;
this.venom = false;
this.onFire = false;
this.midas = false;
this.ichor = false;
this.onFrostBurn = false;
this.onFire2 = false;
this.confused = false;
for (int j = 0; j < 5; j++)
{
if (this.buffType[j] > 0 && this.buffTime[j] > 0)
{
this.buffTime[j]--;
if (this.buffType[j] == 20)
{
this.poisoned = true;
}
if (this.buffType[j] == 70)
{
this.venom = true;
}
if (this.buffType[j] == 24)
{
this.onFire = true;
}
if (this.buffType[j] == 72)
{
this.midas = true;
}
if (this.buffType[j] == 69)
{
this.ichor = true;
}
if (this.buffType[j] == 31)
{
this.confused = true;
}
if (this.buffType[j] == 39)
{
this.onFire2 = true;
}
if (this.buffType[j] == 44)
{
this.onFrostBurn = true;
}
}
}
if (Main.netMode != 1)
{
for (int k = 0; k < 5; k++)
{
if (this.buffType[k] > 0 && this.buffTime[k] <= 0)
{
this.DelBuff(k);
if (Main.netMode == 2)
{
NetMessage.SendData(54, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0);
}
}
}
}
if (this.teleportTime > 0f)
{
if ((float)Main.rand.Next(100) <= 100f * this.teleportTime * 2f)
{
int num3 = Dust.NewDust(new Vector2((float)this.getRect().X, (float)this.getRect().Y), this.getRect().Width, this.getRect().Height, 159, 0f, 0f, 0, default(Color), 1f);
Main.dust[num3].scale = this.teleportTime * 1.5f;
Main.dust[num3].noGravity = true;
Main.dust[num3].velocity *= 1.1f;
}
this.teleportTime -= 0.005f;
}
if (this.type >= 254 && this.type <= 261)
{
float num4 = (float)Main.rand.Next(28, 42) * 0.005f;
num4 += (float)(270 - (int)Main.mouseTextColor) / 500f;
float num5 = 0.1f;
float num6 = 0.3f + num4 / 2f;
float num7 = 0.6f + num4;
float num8 = 0.35f;
num5 *= num8;
num6 *= num8;
num7 *= num8;
Lighting.addLight((int)this.center().X / 16, (int)this.center().Y / 16, num5, num6, num7);
}
if (!this.dontTakeDamage)
{
if (this.poisoned)
{
if (this.lifeRegen > 0)
{
this.lifeRegen = 0;
}
this.lifeRegen -= 4;
}
if (this.onFire)
{
if (this.lifeRegen > 0)
{
this.lifeRegen = 0;
}
this.lifeRegen -= 8;
}
if (this.onFrostBurn)
{
if (this.lifeRegen > 0)
{
this.lifeRegen = 0;
}
this.lifeRegen -= 12;
}
if (this.onFire2)
{
if (this.lifeRegen > 0)
{
this.lifeRegen = 0;
}
this.lifeRegen -= 12;
}
if (this.venom)
{
if (this.lifeRegen > 0)
{
this.lifeRegen = 0;
}
this.lifeRegen -= 12;
}
this.lifeRegenCount += this.lifeRegen;
while (this.lifeRegenCount >= 120)
{
this.lifeRegenCount -= 120;
if (this.life < this.lifeMax)
{
this.life++;
}
if (this.life > this.lifeMax)
{
this.life = this.lifeMax;
}
}
while (this.lifeRegenCount <= -120)
{
this.lifeRegenCount += 120;
int num9 = this.whoAmI;
if (this.realLife >= 0)
{
num9 = this.realLife;
}
Main.npc[num9].life--;
CombatText.NewText(new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height), new Color(255, 140, 40, 255), string.Concat(1), false, true);
if (Main.npc[num9].life <= 0)
{
Main.npc[num9].life = 1;
if (Main.netMode != 1)
{
Main.npc[num9].StrikeNPC(9999, 0f, 0, false, false);
if (Main.netMode == 2)
{
NetMessage.SendData(28, -1, -1, "", num9, 9999f, 0f, 0f, 0);
}
}
}
}
}
if (Main.netMode != 1 && Main.bloodMoon)
{
bool flag2 = false;
if (this.value == 0f)
{
flag2 = true;
}
if (this.type == 46)
{
this.Transform(47);
}
else
{
if (this.type == 55)
{
this.Transform(57);
}
else
{
if (this.type == 148 || this.type == 149)
{
this.Transform(168);
}
}
}
if (flag2)
{
this.value = 0f;
}
}
float num10 = 10f;
NPC.gravity = 0.3f;
if (this.type == 258)
{
NPC.gravity = 0.1f;
if (this.velocity.Y > 3f)
{
this.velocity.Y = 3f;
}
}
float num11 = (float)(Main.maxTilesX / 4200);
num11 *= num11;
float num12 = (float)((double)(this.position.Y / 16f - (60f + 10f * num11)) / (Main.worldSurface / 6.0));
if ((double)num12 < 0.25)
{
num12 = 0.25f;
}
if (num12 > 1f)
{
num12 = 1f;
}
NPC.gravity *= num12;
if (this.wet)
{
if (this.honeyWet)
{
NPC.gravity = 0.1f;
num10 = 4f;
}
else
{
NPC.gravity = 0.2f;
num10 = 7f;
}
}
if (this.soundDelay > 0)
{
this.soundDelay--;
}
if (this.life <= 0)
{
this.active = false;
}
this.oldTarget = this.target;
this.oldDirection = this.direction;
this.oldDirectionY = this.directionY;
float num13 = 1f + Math.Abs(this.velocity.X) / 3f;
if (this.gfxOffY > 0f)
{
this.gfxOffY -= num13 * this.stepSpeed;
if (this.gfxOffY < 0f)
{
this.gfxOffY = 0f;
}
}
else
{
if (this.gfxOffY < 0f)
{
this.gfxOffY += num13 * this.stepSpeed;
if (this.gfxOffY > 0f)
{
this.gfxOffY = 0f;
}
}
}
if (this.gfxOffY > 16f)
{
this.gfxOffY = 16f;
}
if (this.gfxOffY < -16f)
{
this.gfxOffY = -16f;
}
this.AI();
if (this.type == 44)
{
Lighting.addLight((int)(this.position.X + (float)(this.width / 2)) / 16, (int)(this.position.Y + 4f) / 16, 0.9f, 0.75f, 0.5f);
}
for (int l = 0; l < 256; l++)
{
if (this.immune[l] > 0)
{
this.immune[l]--;
}
}
if (!this.noGravity && !this.noTileCollide)
{
int num14 = (int)(this.position.X + (float)(this.width / 2)) / 16;
int num15 = (int)(this.position.Y + (float)(this.height / 2)) / 16;
if (Main.tile[num14, num15] == null)
{
NPC.gravity = 0f;
this.velocity.X = 0f;
this.velocity.Y = 0f;
}
}
if (!this.noGravity)
{
this.velocity.Y = this.velocity.Y + NPC.gravity;
if (this.velocity.Y > num10)
{
this.velocity.Y = num10;
}
}
if ((double)this.velocity.X < 0.005 && (double)this.velocity.X > -0.005)
{
this.velocity.X = 0f;
}
if (Main.netMode != 1 && this.type != 37 && (this.friendly || this.type == 46 || this.type == 55 || this.type == 74 || this.type == 148 || this.type == 149 || this.type == 230 || this.type == 297 || this.type == 298 || this.type == 299 || this.type == 300))
{
if (this.life < this.lifeMax)
{
this.friendlyRegen++;
if (this.friendlyRegen > 300)
{
this.friendlyRegen = 0;
this.life++;
this.netUpdate = true;
}
}
if (this.immune[255] == 0)
{
Rectangle rectangle = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height);
for (int m = 0; m < 200; m++)
{
if (Main.npc[m].active && !Main.npc[m].friendly && Main.npc[m].damage > 0)
{
Rectangle rectangle2 = new Rectangle((int)Main.npc[m].position.X, (int)Main.npc[m].position.Y, Main.npc[m].width, Main.npc[m].height);
if (rectangle.Intersects(rectangle2))
{
int num16 = Main.npc[m].damage;
int num17 = 6;
int num18 = 1;
if (Main.npc[m].position.X + (float)(Main.npc[m].width / 2) > this.position.X + (float)(this.width / 2))
{
num18 = -1;
}
Main.npc[i].StrikeNPC(num16, (float)num17, num18, false, false);
if (Main.netMode != 0)
{
NetMessage.SendData(28, -1, -1, "", i, (float)num16, (float)num17, (float)num18, 0);
}
this.netUpdate = true;
this.immune[255] = 30;
}
}
}
}
}
if (!this.noTileCollide)
{
Vector4 vector = Collision.WalkDownSlope(this.position, this.velocity, this.width, this.height, NPC.gravity);
this.position.X = vector.X;
this.position.Y = vector.Y;
this.velocity.X = vector.Z;
this.velocity.Y = vector.W;
bool flag3 = Collision.LavaCollision(this.position, this.width, this.height);
if (flag3)
{
this.lavaWet = true;
if (!this.lavaImmune && !this.dontTakeDamage && Main.netMode != 1 && this.immune[255] == 0)
{
this.AddBuff(24, 420, false);
this.immune[255] = 30;
this.StrikeNPC(50, 0f, 0, false, false);
if (Main.netMode == 2 && Main.netMode != 0)
{
NetMessage.SendData(28, -1, -1, "", this.whoAmI, 50f, 0f, 0f, 0);
}
}
}
bool flag4;
if (this.type == 72 || this.aiStyle == 21)
{
flag4 = false;
this.wetCount = 0;
flag3 = false;
}
else
{
flag4 = Collision.WetCollision(this.position, this.width, this.height);
if (Collision.honey)
{
this.honeyWet = true;
}
}
if (flag4)
{
if (this.onFire && !this.lavaWet && Main.netMode != 1)
{
for (int n = 0; n < 5; n++)
{
if (this.buffType[n] == 24)
{
this.DelBuff(n);
}
}
}
if (!this.wet && this.wetCount == 0)
{
this.wetCount = 10;
if (!flag3)
{
if (this.honeyWet)
{
for (int num19 = 0; num19 < 10; num19++)
{
int num20 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 152, 0f, 0f, 0, default(Color), 1f);
Dust expr_F65_cp_0 = Main.dust[num20];
expr_F65_cp_0.velocity.Y = expr_F65_cp_0.velocity.Y - 1f;
Dust expr_F83_cp_0 = Main.dust[num20];
expr_F83_cp_0.velocity.X = expr_F83_cp_0.velocity.X * 2.5f;
Main.dust[num20].scale = 1.3f;
Main.dust[num20].alpha = 100;
Main.dust[num20].noGravity = true;
}
if (this.aiStyle != 1 && this.type != 1 && this.type != 16 && this.type != 147 && this.type != 59 && this.aiStyle != 39 && !this.noGravity)
{
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1);
}
}
else
{
for (int num21 = 0; num21 < 30; num21++)
{
int num22 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, Dust.dustWater(), 0f, 0f, 0, default(Color), 1f);
Dust expr_10C8_cp_0 = Main.dust[num22];
expr_10C8_cp_0.velocity.Y = expr_10C8_cp_0.velocity.Y - 4f;
Dust expr_10E6_cp_0 = Main.dust[num22];
expr_10E6_cp_0.velocity.X = expr_10E6_cp_0.velocity.X * 2.5f;
Main.dust[num22].scale *= 0.8f;
Main.dust[num22].alpha = 100;
Main.dust[num22].noGravity = true;
}
if (this.aiStyle != 1 && this.type != 1 && this.type != 16 && this.type != 147 && this.type != 59 && this.aiStyle != 39 && !this.noGravity)
{
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 0);
}
}
}
else
{
for (int num23 = 0; num23 < 10; num23++)
{
int num24 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 35, 0f, 0f, 0, default(Color), 1f);
Dust expr_122F_cp_0 = Main.dust[num24];
expr_122F_cp_0.velocity.Y = expr_122F_cp_0.velocity.Y - 1.5f;
Dust expr_124D_cp_0 = Main.dust[num24];
expr_124D_cp_0.velocity.X = expr_124D_cp_0.velocity.X * 2.5f;
Main.dust[num24].scale = 1.3f;
Main.dust[num24].alpha = 100;
Main.dust[num24].noGravity = true;
}
if (this.aiStyle != 1 && this.type != 1 && this.type != 16 && this.type != 147 && this.type != 59 && this.aiStyle != 39 && !this.noGravity)
{
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1);
}
}
}
this.wet = true;
}
else
{
if (this.wet)
{
this.velocity.X = this.velocity.X * 0.5f;
this.wet = false;
if (this.wetCount == 0)
{
this.wetCount = 10;
if (!this.lavaWet)
{
if (this.honeyWet)
{
for (int num25 = 0; num25 < 10; num25++)
{
int num26 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 152, 0f, 0f, 0, default(Color), 1f);
Dust expr_13D6_cp_0 = Main.dust[num26];
expr_13D6_cp_0.velocity.Y = expr_13D6_cp_0.velocity.Y - 1f;
Dust expr_13F4_cp_0 = Main.dust[num26];
expr_13F4_cp_0.velocity.X = expr_13F4_cp_0.velocity.X * 2.5f;
Main.dust[num26].scale = 1.3f;
Main.dust[num26].alpha = 100;
Main.dust[num26].noGravity = true;
}
if (this.aiStyle != 1 && this.type != 1 && this.type != 16 && this.type != 147 && this.type != 59 && this.aiStyle != 39 && !this.noGravity)
{
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1);
}
}
else
{
for (int num27 = 0; num27 < 30; num27++)
{
int num28 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, Dust.dustWater(), 0f, 0f, 0, default(Color), 1f);
Dust expr_1539_cp_0 = Main.dust[num28];
expr_1539_cp_0.velocity.Y = expr_1539_cp_0.velocity.Y - 4f;
Dust expr_1557_cp_0 = Main.dust[num28];
expr_1557_cp_0.velocity.X = expr_1557_cp_0.velocity.X * 2.5f;
Main.dust[num28].scale *= 0.8f;
Main.dust[num28].alpha = 100;
Main.dust[num28].noGravity = true;
}
if (this.aiStyle != 1 && this.type != 1 && this.type != 16 && this.type != 59 && this.aiStyle != 39 && !this.noGravity)
{
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 0);
}
}
}
else
{
for (int num29 = 0; num29 < 10; num29++)
{
int num30 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 35, 0f, 0f, 0, default(Color), 1f);
Dust expr_1690_cp_0 = Main.dust[num30];
expr_1690_cp_0.velocity.Y = expr_1690_cp_0.velocity.Y - 1.5f;
Dust expr_16AE_cp_0 = Main.dust[num30];
expr_16AE_cp_0.velocity.X = expr_16AE_cp_0.velocity.X * 2.5f;
Main.dust[num30].scale = 1.3f;
Main.dust[num30].alpha = 100;
Main.dust[num30].noGravity = true;
}
if (this.aiStyle != 1 && this.type != 1 && this.type != 16 && this.type != 59 && this.aiStyle != 39 && !this.noGravity)
{
Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1);
}
}
}
}
}
if (!this.wet)
{
this.lavaWet = false;
this.honeyWet = false;
}
if (this.wetCount > 0)
{
this.wetCount -= 1;
}
bool flag5 = false;
if (this.aiStyle == 10)
{
flag5 = true;
}
if (this.aiStyle == 14)
{
flag5 = true;
}
if (this.aiStyle == 3 && this.directionY == 1)
{
flag5 = true;
}
this.oldVelocity = this.velocity;
this.collideX = false;
this.collideY = false;
if (Main.netMode != 1)
{
if (this.type == 230 && this.wet)
{
int num31 = this.direction;
Vector2 vector2 = this.velocity;
this.Transform(55);
this.direction = num31;
this.velocity = vector2;
this.wet = true;
if (this.velocity.Y < 0f)
{
this.velocity.Y = 0f;
}
}
else
{
if (this.type == 55 && !this.wet && Main.raining)
{
int num32 = this.direction;
Vector2 vector3 = this.velocity;
this.Transform(230);
this.direction = num32;
this.velocity = vector3;
this.homeTileX = (int)(this.position.X / 16f) + 10 * this.direction;
}
}
}
Vector2 vector4 = this.position;
int num33 = this.width;
int num34 = this.height;
if (this.type == 243)
{
num34 = 90;
}
if (this.type == 290)
{
num34 = 40;
}
if (num34 != this.height)
{
vector4.Y += (float)(this.height - num34);
}
if (this.wet)
{
if (this.honeyWet)
{
Vector2 vector5 = this.velocity;
this.velocity = Collision.TileCollision(vector4, this.velocity, num33, num34, flag5, flag5);
if (Collision.up)
{
this.velocity.Y = 0.01f;
}
Vector2 value = this.velocity * 0.25f;
if (this.velocity.X != vector5.X)
{
value.X = this.velocity.X;
this.collideX = true;
}
if (this.velocity.Y != vector5.Y)
{
value.Y = this.velocity.Y;
this.collideY = true;
}
this.oldPosition = this.position;
this.position += value;
}
else
{
Vector2 vector6 = this.velocity;
this.velocity = Collision.TileCollision(vector4, this.velocity, num33, num34, flag5, flag5);
if (Collision.up)
{
this.velocity.Y = 0.01f;
}
Vector2 value2 = this.velocity * 0.5f;
if (this.velocity.X != vector6.X)
{
value2.X = this.velocity.X;
this.collideX = true;
}
if (this.velocity.Y != vector6.Y)
{
value2.Y = this.velocity.Y;
this.collideY = true;
}
this.oldPosition = this.position;
this.position += value2;
}
}
else
{
if (this.type == 72)
{
Vector2 vector7 = new Vector2(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2));
int num35 = 12;
int num36 = 12;
vector7.X -= (float)(num35 / 2);
vector7.Y -= (float)(num36 / 2);
this.velocity = Collision.noSlopeCollision(vector4, this.velocity, num33, num34, true, true);
}
else
{
this.velocity = Collision.TileCollision(vector4, this.velocity, num33, num34, flag5, flag5);
}
if (Collision.up)
{
this.velocity.Y = 0.01f;
}
if (this.oldVelocity.X != this.velocity.X)
{
this.collideX = true;
}
if (this.oldVelocity.Y != this.velocity.Y)
{
this.collideY = true;
}
this.oldPosition = this.position;
this.position += this.velocity;
}
Vector4 vector8 = Collision.SlopeCollision(this.position, this.velocity, this.width, this.height, NPC.gravity);
this.position.X = vector8.X;
this.position.Y = vector8.Y;
this.velocity.X = vector8.Z;
this.velocity.Y = vector8.W;
}
else
{
this.oldPosition = this.position;
this.position += this.velocity;
}
if (Main.netMode != 1 && !this.noTileCollide && this.lifeMax > 1 && Collision.SwitchTiles(this.position, this.width, this.height, this.oldPosition, 2) && (this.type == 46 || this.type == 148 || this.type == 149))
{
this.ai[0] = 1f;
this.ai[1] = 400f;
this.ai[2] = 0f;
}
this.FindFrame();
if (this.type == 120 || this.type == 137 || this.type == 138)
{
for (int num37 = this.oldPos.Length - 1; num37 > 0; num37--)
{
this.oldPos[num37] = this.oldPos[num37 - 1];
Lighting.addLight((int)this.position.X / 16, (int)this.position.Y / 16, 0.3f, 0f, 0.2f);
}
this.oldPos[0] = this.position;
}
else
{
if (this.type == 94)
{
for (int num38 = this.oldPos.Length - 1; num38 > 0; num38--)
{
this.oldPos[num38] = this.oldPos[num38 - 1];
}
this.oldPos[0] = this.position;
}
else
{
if (this.type == 125 || this.type == 126 || this.type == 127 || this.type == 128 || this.type == 129 || this.type == 130 || this.type == 131 || this.type == 139 || this.type == 140)
{
for (int num39 = this.oldPos.Length - 1; num39 > 0; num39--)
{
this.oldPos[num39] = this.oldPos[num39 - 1];
}
this.oldPos[0] = this.position;
}
}
}
if (!this.active)
{
this.netUpdate = true;
}
if (Main.netMode == 2)
{
if (Main.npcStreamSpeed > 0 && !this.townNPC && Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) > 1f)
{
this.netStream += 1;
if ((int)this.netStream > Main.npcStreamSpeed)
{
for (int num40 = 0; num40 < 255; num40++)
{
if (Main.player[num40].active)
{
float num41 = Math.Abs(this.center().X - Main.player[num40].center().X) + Math.Abs(this.center().Y - Main.player[num40].center().Y);
if (num41 < 250f)
{
byte[] expr_1FAE_cp_0 = this.streamPlayer;
int expr_1FAE_cp_1 = num40;
expr_1FAE_cp_0[expr_1FAE_cp_1] -= 8;
}
else
{
if (num41 < 500f)
{
byte[] expr_1FD4_cp_0 = this.streamPlayer;
int expr_1FD4_cp_1 = num40;
expr_1FD4_cp_0[expr_1FD4_cp_1] -= 4;
}
else
{
if (num41 < 1000f)
{
byte[] expr_1FFA_cp_0 = this.streamPlayer;
int expr_1FFA_cp_1 = num40;
expr_1FFA_cp_0[expr_1FFA_cp_1] -= 2;
}
else
{
if (num41 < 1500f)
{
byte[] expr_2020_cp_0 = this.streamPlayer;
int expr_2020_cp_1 = num40;
expr_2020_cp_0[expr_2020_cp_1] -= 1;
}
}
}
}
if (this.streamPlayer[num40] <= 0)
{
this.streamPlayer[num40] = 8;
NetMessage.SendData(23, num40, -1, "", i, 0f, 0f, 0f, 0);
}
}
}
}
}
if (this.townNPC)
{
this.netSpam = 0;
}
if (this.netUpdate2)
{
this.netUpdate = true;
}
if (!this.active)
{
this.netSpam = 0;
}
if (this.netUpdate)
{
if (this.netSpam <= 90)
{
this.netSpam += 30;
NetMessage.SendData(23, -1, -1, "", i, 0f, 0f, 0f, 0);
this.netUpdate2 = false;
}
else
{
this.netUpdate2 = true;
}
}
if (this.netSpam > 0)
{
this.netSpam--;
}
if (this.active && this.townNPC && NPC.TypeToNum(this.type) != -1)
{
if (this.homeless != this.oldHomeless || this.homeTileX != this.oldHomeTileX || this.homeTileY != this.oldHomeTileY)
{
int num42 = 0;
if (this.homeless)
{
num42 = 1;
}
NetMessage.SendData(60, -1, -1, "", i, (float)Main.npc[i].homeTileX, (float)Main.npc[i].homeTileY, (float)num42, 0);
}
this.oldHomeless = this.homeless;
this.oldHomeTileX = this.homeTileX;
this.oldHomeTileY = this.homeTileY;
}
}
this.CheckActive();
this.netUpdate = false;
this.justHit = false;
}
}
public Color GetAlpha(Color newColor)
{
float num = (float)(255 - this.alpha) / 255f;
int num2 = (int)((float)newColor.R * num);
int num3 = (int)((float)newColor.G * num);
int num4 = (int)((float)newColor.B * num);
int num5 = (int)newColor.A - this.alpha;
if (this.type == 25 || this.type == 30 || this.type == 59 || this.type == 60)
{
return new Color(200, 200, 200, 0);
}
if (this.type == 72)
{
num2 = (int)newColor.R;
num3 = (int)newColor.G;
num4 = (int)newColor.B;
}
else
{
if (this.type == 288)
{
return new Color(200, 200, 200, 0);
}
if (this.type == 289)
{
return new Color(250, 250, 250, 50);
}
if (this.type >= 254 && this.type <= 261)
{
num4 = 255;
if (num2 < 100)
{
num2 = 100;
}
if (num3 < 150)
{
num3 = 150;
}
}
else
{
if (this.type == 64 || this.type == 63 || this.type == 75 || this.type == 103)
{
num2 = (int)((double)newColor.R * 1.5);
num3 = (int)((double)newColor.G * 1.5);
num4 = (int)((double)newColor.B * 1.5);
if (num2 > 255)
{
num2 = 255;
}
if (num3 > 255)
{
num3 = 255;
}
if (num4 > 255)
{
num4 = 255;
}
}
}
}
if (num5 < 0)
{
num5 = 0;
}
if (num5 > 255)
{
num5 = 255;
}
return new Color(num2, num3, num4, num5);
}
public Color GetColor(Color newColor)
{
int num = (int)(this.color.R - (255 - newColor.R));
int num2 = (int)(this.color.G - (255 - newColor.G));
int num3 = (int)(this.color.B - (255 - newColor.B));
int num4 = (int)(this.color.A - (255 - newColor.A));
if (num < 0)
{
num = 0;
}
if (num > 255)
{
num = 255;
}
if (num2 < 0)
{
num2 = 0;
}
if (num2 > 255)
{
num2 = 255;
}
if (num3 < 0)
{
num3 = 0;
}
if (num3 > 255)
{
num3 = 255;
}
if (num4 < 0)
{
num4 = 0;
}
if (num4 > 255)
{
num4 = 255;
}
return new Color(num, num2, num3, num4);
}
public string GetChat()
{
Recipe.FindRecipes();
bool flag = false;
bool flag2 = false;
bool flag3 = false;
bool flag4 = false;
bool flag5 = false;
bool flag6 = false;
bool flag7 = false;
bool flag8 = false;
bool flag9 = false;
bool flag10 = false;
bool flag11 = false;
bool flag12 = false;
bool flag13 = false;
bool flag14 = false;
bool flag15 = false;
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].active)
{
if (Main.npc[i].type == 17)
{
flag = true;
}
else
{
if (Main.npc[i].type == 18)
{
flag2 = true;
}
else
{
if (Main.npc[i].type == 19)
{
flag3 = true;
}
else
{
if (Main.npc[i].type == 20)
{
flag4 = true;
}
else
{
if (Main.npc[i].type == 37)
{
flag5 = true;
}
else
{
if (Main.npc[i].type == 38)
{
flag6 = true;
}
else
{
if (Main.npc[i].type == 124)
{
flag7 = true;
}
else
{
if (Main.npc[i].type == 107)
{
flag8 = true;
}
else
{
if (Main.npc[i].type == 54)
{
flag9 = true;
}
else
{
if (Main.npc[i].type == 160)
{
flag10 = true;
}
else
{
if (Main.npc[i].type == 178)
{
flag11 = true;
}
else
{
if (Main.npc[i].type == 229)
{
flag12 = true;
}
else
{
if (Main.npc[i].type == 209)
{
flag13 = true;
}
else
{
if (Main.npc[i].type == 208)
{
flag14 = true;
}
else
{
if (Main.npc[i].type == 2)
{
flag15 = true;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
string result = "";
if (this.type == 17)
{
if (!NPC.downedBoss1 && Main.rand.Next(3) == 0)
{
if (Main.player[Main.myPlayer].statLifeMax < 200)
{
result = Lang.dialog(1, false);
}
else
{
if (Main.player[Main.myPlayer].statDefense <= 10)
{
result = Lang.dialog(2, false);
}
else
{
result = Lang.dialog(3, false);
}
}
}
else
{
if (Main.dayTime)
{
if (Main.time < 16200.0)
{
int num = Main.rand.Next(3);
if (num == 0)
{
result = Lang.dialog(4, false);
}
else
{
if (num == 1)
{
result = Lang.dialog(5, false);
}
else
{
result = Lang.dialog(6, false);
}
}
}
else
{
if (Main.time > 37800.0)
{
int num2 = Main.rand.Next(3);
if (num2 == 0)
{
result = Lang.dialog(7, false);
}
else
{
if (num2 == 1)
{
result = Lang.dialog(8, false);
}
else
{
result = Lang.dialog(9, false);
}
}
}
else
{
int num3 = Main.rand.Next(3);
if (num3 == 0)
{
result = Lang.dialog(10, false);
}
else
{
if (num3 == 1)
{
result = Lang.dialog(11, false);
}
else
{
result = Lang.dialog(12, false);
}
}
}
}
}
else
{
if (Main.bloodMoon)
{
if (flag2 && flag7 && Main.rand.Next(3) == 0)
{
result = Lang.dialog(13, false);
}
else
{
int num4 = Main.rand.Next(4);
if (num4 == 0)
{
result = Lang.dialog(14, false);
}
else
{
if (num4 == 1)
{
result = Lang.dialog(15, false);
}
else
{
if (num4 == 2)
{
result = Lang.dialog(16, false);
}
else
{
result = Lang.dialog(17, false);
}
}
}
}
}
else
{
if (Main.time < 9720.0)
{
if (Main.rand.Next(2) == 0)
{
result = Lang.dialog(18, false);
}
else
{
result = Lang.dialog(19, false);
}
}
else
{
if (Main.time > 22680.0)
{
if (Main.rand.Next(2) == 0)
{
result = Lang.dialog(20, false);
}
else
{
result = Lang.dialog(21, false);
}
}
else
{
int num5 = Main.rand.Next(3);
if (num5 == 0)
{
result = Lang.dialog(22, false);
}
else
{
if (num5 == 1)
{
result = Lang.dialog(23, false);
}
else
{
result = Lang.dialog(24, false);
}
}
}
}
}
}
}
}
else
{
if (this.type == 18)
{
if (Main.bloodMoon)
{
if ((double)Main.player[Main.myPlayer].statLife < (double)Main.player[Main.myPlayer].statLifeMax * 0.66)
{
int num6 = Main.rand.Next(3);
if (num6 == 0)
{
result = Lang.dialog(25, false);
}
else
{
if (num6 == 1)
{
result = Lang.dialog(26, false);
}
else
{
result = Lang.dialog(27, false);
}
}
}
else
{
int num7 = Main.rand.Next(4);
if (num7 == 0)
{
result = Lang.dialog(28, false);
}
else
{
if (num7 == 1)
{
result = Lang.dialog(29, false);
}
else
{
if (num7 == 2)
{
result = Lang.dialog(30, false);
}
else
{
result = Lang.dialog(31, false);
}
}
}
}
}
else
{
if (Main.rand.Next(3) == 0 && !NPC.downedBoss3)
{
result = Lang.dialog(32, false);
}
else
{
if (flag6 && Main.rand.Next(4) == 0)
{
result = Lang.dialog(33, false);
}
else
{
if (flag3 && Main.rand.Next(4) == 0)
{
result = Lang.dialog(34, false);
}
else
{
if (flag15 && Main.rand.Next(4) == 0)
{
result = Lang.dialog(35, false);
}
else
{
if ((double)Main.player[Main.myPlayer].statLife < (double)Main.player[Main.myPlayer].statLifeMax * 0.33)
{
int num8 = Main.rand.Next(5);
if (num8 == 0)
{
result = Lang.dialog(36, false);
}
else
{
if (num8 == 1)
{
result = Lang.dialog(37, false);
}
else
{
if (num8 == 2)
{
result = Lang.dialog(38, false);
}
else
{
if (num8 == 3)
{
result = Lang.dialog(39, false);
}
else
{
result = Lang.dialog(40, false);
}
}
}
}
}
else
{
if ((double)Main.player[Main.myPlayer].statLife < (double)Main.player[Main.myPlayer].statLifeMax * 0.66)
{
int num9 = Main.rand.Next(7);
if (num9 == 0)
{
result = Lang.dialog(41, false);
}
else
{
if (num9 == 1)
{
result = Lang.dialog(42, false);
}
else
{
if (num9 == 2)
{
result = Lang.dialog(43, false);
}
else
{
if (num9 == 3)
{
result = Lang.dialog(44, false);
}
else
{
if (num9 == 4)
{
result = Lang.dialog(45, false);
}
else
{
if (num9 == 5)
{
result = Lang.dialog(46, false);
}
else
{
result = Lang.dialog(47, false);
}
}
}
}
}
}
}
else
{
int num10 = Main.rand.Next(4);
if (num10 == 0)
{
result = Lang.dialog(48, false);
}
else
{
if (num10 == 1)
{
result = Lang.dialog(49, false);
}
else
{
if (num10 == 2)
{
result = Lang.dialog(50, false);
}
else
{
result = Lang.dialog(51, false);
}
}
}
}
}
}
}
}
}
}
}
else
{
if (this.type == 19)
{
if (NPC.downedBoss3 && !Main.hardMode)
{
result = Lang.dialog(58, false);
}
else
{
if (flag2 && Main.rand.Next(5) == 0)
{
result = Lang.dialog(59, false);
}
else
{
if (flag2 && Main.rand.Next(5) == 0)
{
result = Lang.dialog(60, false);
}
else
{
if (flag4 && Main.rand.Next(5) == 0)
{
result = Lang.dialog(61, false);
}
else
{
if (flag6 && Main.rand.Next(5) == 0)
{
result = Lang.dialog(62, false);
}
else
{
if (flag6 && Main.rand.Next(5) == 0)
{
result = Lang.dialog(63, false);
}
else
{
if (Main.bloodMoon)
{
if (Main.rand.Next(2) == 0)
{
result = Lang.dialog(64, false);
}
else
{
result = Lang.dialog(65, false);
}
}
else
{
int num11 = Main.rand.Next(3);
if (num11 == 0)
{
result = Lang.dialog(66, false);
}
else
{
if (num11 == 1)
{
result = Lang.dialog(67, false);
}
else
{
result = Lang.dialog(68, false);
}
}
}
}
}
}
}
}
}
}
else
{
if (this.type == 20)
{
if (!NPC.downedBoss2 && Main.rand.Next(3) == 0)
{
result = Lang.dialog(69, false);
}
else
{
if (flag3 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(70, false);
}
else
{
if (flag && Main.rand.Next(6) == 0)
{
result = Lang.dialog(71, false);
}
else
{
if (flag5 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(72, false);
}
else
{
if (flag10 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(238, false);
}
else
{
if (Main.bloodMoon)
{
int num12 = Main.rand.Next(4);
if (num12 == 0)
{
result = Lang.dialog(73, false);
}
else
{
if (num12 == 1)
{
result = Lang.dialog(74, false);
}
else
{
if (num12 == 2)
{
result = Lang.dialog(75, false);
}
else
{
result = Lang.dialog(76, false);
}
}
}
}
else
{
int num13 = Main.rand.Next(5);
if (num13 == 0)
{
result = Lang.dialog(77, false);
}
else
{
if (num13 == 1)
{
result = Lang.dialog(78, false);
}
else
{
if (num13 == 2)
{
result = Lang.dialog(79, false);
}
else
{
if (num13 == 3)
{
result = Lang.dialog(80, false);
}
else
{
result = Lang.dialog(81, false);
}
}
}
}
}
}
}
}
}
}
}
else
{
if (this.type == 37)
{
if (Main.dayTime)
{
int num14 = Main.rand.Next(3);
if (num14 == 0)
{
result = Lang.dialog(82, false);
}
else
{
if (num14 == 1)
{
result = Lang.dialog(83, false);
}
else
{
result = Lang.dialog(84, false);
}
}
}
else
{
if (Main.player[Main.myPlayer].statLifeMax < 300 || Main.player[Main.myPlayer].statDefense < 10)
{
int num15 = Main.rand.Next(4);
if (num15 == 0)
{
result = Lang.dialog(85, false);
}
else
{
if (num15 == 1)
{
result = Lang.dialog(86, false);
}
else
{
if (num15 == 2)
{
result = Lang.dialog(87, false);
}
else
{
result = Lang.dialog(88, false);
}
}
}
}
else
{
int num16 = Main.rand.Next(4);
if (num16 == 0)
{
result = Lang.dialog(89, false);
}
else
{
if (num16 == 1)
{
result = Lang.dialog(90, false);
}
else
{
if (num16 == 2)
{
result = Lang.dialog(91, false);
}
else
{
result = Lang.dialog(92, false);
}
}
}
}
}
}
else
{
if (this.type == 38)
{
if (!NPC.downedBoss2 && Main.rand.Next(3) == 0)
{
result = Lang.dialog(93, false);
}
if (Main.bloodMoon)
{
int num17 = Main.rand.Next(3);
if (num17 == 0)
{
result = Lang.dialog(94, false);
}
else
{
if (num17 == 1)
{
result = Lang.dialog(95, false);
}
else
{
result = Lang.dialog(96, false);
}
}
}
else
{
if (flag3 && Main.rand.Next(5) == 0)
{
result = Lang.dialog(97, false);
}
else
{
if (flag3 && Main.rand.Next(5) == 0)
{
result = Lang.dialog(98, false);
}
else
{
if (flag2 && Main.rand.Next(4) == 0)
{
result = Lang.dialog(99, false);
}
else
{
if (flag4 && Main.rand.Next(4) == 0)
{
result = Lang.dialog(100, false);
}
else
{
if (!Main.dayTime)
{
int num18 = Main.rand.Next(4);
if (num18 == 0)
{
result = Lang.dialog(101, false);
}
else
{
if (num18 == 1)
{
result = Lang.dialog(102, false);
}
else
{
if (num18 == 2)
{
result = Lang.dialog(103, false);
}
else
{
result = Lang.dialog(104, false);
}
}
}
}
else
{
int num19 = Main.rand.Next(5);
if (num19 == 0)
{
result = Lang.dialog(105, false);
}
else
{
if (num19 == 1)
{
result = Lang.dialog(106, false);
}
else
{
if (num19 == 2)
{
result = Lang.dialog(107, false);
}
else
{
if (num19 == 3)
{
result = Lang.dialog(108, false);
}
else
{
result = Lang.dialog(109, false);
}
}
}
}
}
}
}
}
}
}
}
else
{
if (this.type == 54)
{
if (!flag7 && Main.rand.Next(2) == 0)
{
result = Lang.dialog(110, false);
}
else
{
if (flag10 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(237, false);
}
else
{
if (Main.bloodMoon)
{
result = Lang.dialog(111, false);
}
else
{
if (flag2 && Main.rand.Next(4) == 0)
{
result = Lang.dialog(112, false);
}
else
{
if (Main.player[Main.myPlayer].head == 24)
{
result = Lang.dialog(113, false);
}
else
{
int num20 = Main.rand.Next(6);
if (num20 == 0)
{
result = Lang.dialog(114, false);
}
else
{
if (num20 == 1)
{
result = Lang.dialog(115, false);
}
else
{
if (num20 == 2)
{
result = Lang.dialog(116, false);
}
else
{
if (num20 == 3)
{
result = Lang.dialog(117, false);
}
else
{
if (num20 == 4)
{
result = Lang.dialog(118, false);
}
else
{
result = Lang.dialog(119, false);
}
}
}
}
}
}
}
}
}
}
}
else
{
if (this.type == 105)
{
result = Lang.dialog(120, false);
}
else
{
if (this.type == 107)
{
if (this.homeless)
{
int num21 = Main.rand.Next(5);
if (num21 == 0)
{
result = Lang.dialog(121, false);
}
else
{
if (num21 == 1)
{
result = Lang.dialog(122, false);
}
else
{
if (num21 == 2)
{
result = Lang.dialog(123, false);
}
else
{
if (num21 == 3)
{
result = Lang.dialog(124, false);
}
else
{
result = Lang.dialog(125, false);
}
}
}
}
}
else
{
if (flag7 && Main.rand.Next(4) == 0)
{
result = Lang.dialog(126, false);
}
else
{
if (!Main.dayTime)
{
int num22 = Main.rand.Next(5);
if (num22 == 0)
{
result = Lang.dialog(127, false);
}
else
{
if (num22 == 1)
{
result = Lang.dialog(128, false);
}
else
{
if (num22 == 2)
{
result = Lang.dialog(129, false);
}
else
{
if (num22 == 3)
{
result = Lang.dialog(130, false);
}
else
{
result = Lang.dialog(131, false);
}
}
}
}
}
else
{
int num23 = Main.rand.Next(5);
if (num23 == 0)
{
result = Lang.dialog(132, false);
}
else
{
if (num23 == 1)
{
result = Lang.dialog(133, false);
}
else
{
if (num23 == 2)
{
result = Lang.dialog(134, false);
}
else
{
if (num23 == 3)
{
result = Lang.dialog(135, false);
}
else
{
result = Lang.dialog(136, false);
}
}
}
}
}
}
}
}
else
{
if (this.type == 106)
{
result = Lang.dialog(137, false);
}
else
{
if (this.type == 108)
{
if (this.homeless)
{
int num24 = Main.rand.Next(3);
if (num24 == 0)
{
result = Lang.dialog(138, false);
}
else
{
if (num24 == 1 && !Main.player[Main.myPlayer].male)
{
result = Lang.dialog(139, false);
}
else
{
if (num24 == 1)
{
result = Lang.dialog(140, false);
}
else
{
if (num24 == 2)
{
result = Lang.dialog(141, false);
}
}
}
}
}
else
{
if (Main.player[Main.myPlayer].male && flag15 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(142, false);
}
else
{
if (Main.player[Main.myPlayer].male && flag6 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(143, false);
}
else
{
if (Main.player[Main.myPlayer].male && flag8 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(144, false);
}
else
{
if (!Main.player[Main.myPlayer].male && flag2 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(145, false);
}
else
{
if (!Main.player[Main.myPlayer].male && flag7 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(146, false);
}
else
{
if (!Main.player[Main.myPlayer].male && flag4 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(147, false);
}
else
{
if (!Main.dayTime)
{
int num25 = Main.rand.Next(3);
if (num25 == 0)
{
result = Lang.dialog(148, false);
}
else
{
if (num25 == 1)
{
result = Lang.dialog(149, false);
}
else
{
if (num25 == 2)
{
result = Lang.dialog(150, false);
}
}
}
}
else
{
int num26 = Main.rand.Next(5);
if (num26 == 0)
{
result = Lang.dialog(151, false);
}
else
{
if (num26 == 1)
{
result = Lang.dialog(152, false);
}
else
{
if (num26 == 2)
{
result = Lang.dialog(153, false);
}
else
{
if (num26 == 3)
{
result = Lang.dialog(154, false);
}
else
{
result = Lang.dialog(155, false);
}
}
}
}
}
}
}
}
}
}
}
}
}
else
{
if (this.type == 123)
{
result = Lang.dialog(156, false);
}
else
{
if (this.type == 124)
{
if (this.homeless)
{
int num27 = Main.rand.Next(4);
if (num27 == 0)
{
result = Lang.dialog(157, false);
}
else
{
if (num27 == 1)
{
result = Lang.dialog(158, false);
}
else
{
if (num27 == 2)
{
result = Lang.dialog(159, false);
}
else
{
result = Lang.dialog(160, false);
}
}
}
}
else
{
if (Main.bloodMoon)
{
int num28 = Main.rand.Next(4);
if (num28 == 0)
{
result = Lang.dialog(161, false);
}
else
{
if (num28 == 1)
{
result = Lang.dialog(162, false);
}
else
{
if (num28 == 2)
{
result = Lang.dialog(163, false);
}
else
{
result = Lang.dialog(164, false);
}
}
}
}
else
{
if (flag8 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(165, false);
}
else
{
if (flag3 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(166, false);
}
else
{
int num29 = Main.rand.Next(3);
if (num29 == 0)
{
result = Lang.dialog(167, false);
}
else
{
if (num29 == 1)
{
result = Lang.dialog(168, false);
}
else
{
result = Lang.dialog(169, false);
}
}
}
}
}
}
}
else
{
if (this.type == 22)
{
if (Main.bloodMoon)
{
int num30 = Main.rand.Next(3);
if (num30 == 0)
{
result = Lang.dialog(170, false);
}
else
{
if (num30 == 1)
{
result = Lang.dialog(171, false);
}
else
{
result = Lang.dialog(172, false);
}
}
}
else
{
if (!Main.dayTime)
{
result = Lang.dialog(173, false);
}
else
{
int num31 = Main.rand.Next(3);
if (num31 == 0)
{
result = Lang.dialog(174, false);
}
else
{
if (num31 == 1)
{
result = Lang.dialog(175, false);
}
else
{
result = Lang.dialog(176, false);
}
}
}
}
}
else
{
if (this.type == 142)
{
int num32 = Main.rand.Next(3);
if (num32 == 0)
{
result = Lang.dialog(224, false);
}
else
{
if (num32 == 1)
{
result = Lang.dialog(225, false);
}
else
{
if (num32 == 2)
{
result = Lang.dialog(226, false);
}
}
}
}
else
{
if (this.type == 160)
{
int num33 = Main.rand.Next(6);
if (flag4 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(232, false);
}
else
{
if (flag9 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(236, false);
}
else
{
if (num33 == 0)
{
result = Lang.dialog(231, false);
}
else
{
if (num33 == 1)
{
result = Lang.dialog(233, false);
}
else
{
if (num33 == 2)
{
result = Lang.dialog(234, false);
}
else
{
if (num33 == 3)
{
result = Lang.dialog(235, false);
}
else
{
if (num33 == 4)
{
result = Lang.dialog(240, false);
}
else
{
if (num33 == 5)
{
result = Lang.dialog(241, false);
}
}
}
}
}
}
}
}
}
else
{
if (this.type == 178)
{
int num34 = Main.rand.Next(5);
if (Main.bloodMoon && Main.rand.Next(3) == 0)
{
result = Lang.dialog(245, false);
}
else
{
if (flag13 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(246, false);
}
else
{
if (flag12 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(247, false);
}
else
{
if (num34 == 0)
{
result = Lang.dialog(242, false);
}
else
{
if (num34 == 1)
{
result = Lang.dialog(243, false);
}
else
{
if (num34 == 2)
{
result = Lang.dialog(244, false);
}
else
{
if (num34 == 3)
{
result = Lang.dialog(248, false);
}
else
{
if (num34 == 4)
{
result = Lang.dialog(249, false);
}
}
}
}
}
}
}
}
}
else
{
if (this.type == 207)
{
int num35 = Main.rand.Next(3);
if (flag12 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(260, false);
}
else
{
if (num35 == 0)
{
result = Lang.dialog(257, false);
}
else
{
if (num35 == 1)
{
result = Lang.dialog(258, false);
}
else
{
if (num35 == 2)
{
result = Lang.dialog(259, false);
}
}
}
}
}
else
{
if (this.type == 208)
{
int num36 = Main.rand.Next(7);
if (Main.player[Main.myPlayer].male && Main.rand.Next(5) == 0)
{
result = Lang.dialog(268, false);
}
else
{
if (num36 == 0)
{
result = Lang.dialog(265, false);
}
else
{
if (num36 == 1)
{
result = Lang.dialog(266, false);
}
else
{
if (num36 == 2)
{
result = Lang.dialog(267, false);
}
else
{
if (num36 == 3)
{
result = Lang.dialog(269, false);
}
else
{
if (num36 == 4)
{
result = Lang.dialog(270, false);
}
else
{
if (num36 == 5)
{
result = Lang.dialog(271, false);
}
else
{
if (num36 == 6)
{
result = Lang.dialog(272, false);
}
}
}
}
}
}
}
}
}
else
{
if (this.type == 209)
{
int num37 = Main.rand.Next(5);
if (flag12 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(284, false);
}
else
{
if (flag11 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(283, false);
}
else
{
if (num37 == 0)
{
result = Lang.dialog(280, false);
}
else
{
if (num37 == 1)
{
result = Lang.dialog(281, false);
}
else
{
if (num37 == 2)
{
result = Lang.dialog(282, false);
}
else
{
if (num37 == 3)
{
result = Lang.dialog(285, false);
}
else
{
if (num37 == 4)
{
result = Lang.dialog(286, false);
}
}
}
}
}
}
}
}
else
{
if (this.type == 227)
{
int num38 = Main.rand.Next(5);
if (Main.hardMode && Main.rand.Next(7) == 0)
{
result = Lang.dialog(250, false);
}
else
{
if (flag14 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(251, false);
}
else
{
if (num38 == 0)
{
result = Lang.dialog(252, false);
}
else
{
if (num38 == 1)
{
result = Lang.dialog(253, false);
}
else
{
if (num38 == 2)
{
result = Lang.dialog(254, false);
}
else
{
if (num38 == 3)
{
result = Lang.dialog(255, false);
}
else
{
if (num38 == 4)
{
result = Lang.dialog(256, false);
}
}
}
}
}
}
}
}
else
{
if (this.type == 228)
{
int num39 = Main.rand.Next(3);
if (flag2 && Main.rand.Next(6) == 0)
{
result = Lang.dialog(263, false);
}
else
{
if (num39 == 0)
{
result = Lang.dialog(261, false);
}
else
{
if (num39 == 1)
{
result = Lang.dialog(262, false);
}
else
{
if (num39 == 2)
{
result = Lang.dialog(264, false);
}
}
}
}
}
else
{
if (this.type == 229)
{
int num40 = Main.rand.Next(6);
if (!Main.player[Main.myPlayer].male && Main.rand.Next(5) == 0)
{
result = Lang.dialog(276, false);
}
else
{
if (num40 == 0)
{
result = Lang.dialog(273, false);
}
else
{
if (num40 == 1)
{
result = Lang.dialog(274, false);
}
else
{
if (num40 == 2)
{
result = Lang.dialog(275, false);
}
else
{
if (num40 == 3)
{
result = Lang.dialog(277, false);
}
else
{
if (num40 == 4)
{
result = Lang.dialog(278, false);
}
else
{
if (num40 == 5)
{
result = Lang.dialog(279, false);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return result;
}
public object Clone()
{
return base.MemberwiseClone();
}
}
}