42980 {
42981 int num = 0;
42984 {
42987 {
42988 if (Main.npc[
num3].active && Main.npc[
num3].type >= 134 && Main.npc[
num3].type <= 136)
42989 {
42990 num++;
42991 if (Main.npc[
num3].type == 134)
42992 {
42993 break;
42994 }
42996 {
42997 num = 0;
42998 break;
42999 }
43001 continue;
43002 }
43003 num = 0;
43004 break;
43005 }
43006 }
43008 {
43010 }
43012 {
43014 }
43016 {
43018 if (
type == 134 || (
type != 134 && Main.npc[(
int)
ai[1]].alpha < 128))
43019 {
43021 {
43022 for (
int i = 0;
i < 2;
i++)
43023 {
43025 Main.dust[
num4].noGravity =
true;
43026 Main.dust[
num4].noLight =
true;
43027 }
43028 }
43031 {
43033 }
43034 }
43035 }
43037 {
43038 bool flag = false;
43040 {
43041 flag = true;
43042 }
43043 else if (Main.npc[(
int)
ai[1]].life <= 0)
43044 {
43045 flag = true;
43046 }
43047 if (flag)
43048 {
43052 }
43053 }
43054 if (Main.netMode != 1)
43055 {
43056 if (
ai[0] == 0f &&
type == 134)
43057 {
43064 {
43067 {
43069 }
43075 NetMessage.SendData(23, -1, -1,
null,
num5);
43077 }
43078 }
43080 {
43081 localAI[0] += Main.rand.Next(4);
43082 if (
localAI[0] >= (
float)Main.rand.Next(1400, 26000))
43083 {
43087 {
43089 float num8 = Main.player[
target].position.X + (float)Main.player[
target].width * 0.5f -
vector.X + (
float)Main.rand.Next(-20, 21);
43090 float num9 = Main.player[
target].position.Y + (float)Main.player[
target].height * 0.5f -
vector.Y + (
float)Main.rand.Next(-20, 21);
43095 num8 += (float)Main.rand.Next(-20, 21) * 0.05f;
43096 num9 += (float)Main.rand.Next(-20, 21) * 0.05f;
43099 vector.X +=
num8 * 5f;
43100 vector.Y +=
num9 * 5f;
43102 Main.projectile[
num12].timeLeft = 300;
43104 }
43105 }
43106 }
43107 }
43113 {
43115 }
43116 if (
num14 > Main.maxTilesX)
43117 {
43118 num14 = Main.maxTilesX;
43119 }
43121 {
43123 }
43124 if (
num16 > Main.maxTilesY)
43125 {
43126 num16 = Main.maxTilesY;
43127 }
43128 bool flag2 =
false;
43130 {
43133 {
43135 {
43136 if (Main.tile[
k,
l] !=
null && ((Main.tile[
k,
l].nactive() && (Main.tileSolid[Main.tile[
k,
l].type] || (Main.tileSolidTop[Main.tile[
k,
l].type] && Main.tile[
k,
l].frameY == 0))) || Main.tile[
k,
l].liquid > 64))
43137 {
43138 vector2.X =
k * 16;
43139 vector2.Y =
l * 16;
43141 {
43143 break;
43144 }
43145 }
43146 }
43147 }
43148 }
43150 {
43151 if (
type != 135 ||
ai[2] != 1f)
43152 {
43153 Lighting.AddLight((
int)((position.X + (float)(
width / 2)) / 16f), (int)((
position.
Y + (
float)(
height / 2)) / 16f), 0.3f, 0.1f, 0.05f);
43154 }
43157 {
43162 {
43163 for (
int m = 0;
m < 255;
m++)
43164 {
43165 if (Main.player[
m].active)
43166 {
43169 {
43171 break;
43172 }
43173 }
43174 }
43176 {
43178 }
43179 }
43180 }
43181 }
43182 else
43183 {
43185 }
43187 if (Main.IsItDay() || Main.player[
target].dead)
43188 {
43190 velocity.Y += 1f;
43191 if ((
double)
position.
Y > Main.worldSurface * 16.0)
43192 {
43193 velocity.Y += 1f;
43195 }
43196 if ((
double)
position.
Y > Main.rockLayer * 16.0)
43197 {
43198 for (
int n = 0;
n < 200;
n++)
43199 {
43200 if (Main.npc[
n].aiStyle ==
aiStyle)
43201 {
43202 Main.npc[
n].active =
false;
43203 }
43204 }
43205 }
43206 }
43207 float num19 = 0.1f;
43208 float num20 = 0.15f;
43209 if (Main.getGoodWorld)
43210 {
43213 }
43215 float num21 = Main.player[
target].position.X + (float)(Main.player[
target].width / 2);
43216 float num22 = Main.player[
target].position.Y + (float)(Main.player[
target].height / 2);
43219 vector3.X = (int)(
vector3.X / 16f) * 16;
43220 vector3.Y = (int)(
vector3.Y / 16f) * 16;
43224 if (
ai[1] > 0f &&
ai[1] < (
float)Main.npc.Length)
43225 {
43227 try
43228 {
43232 }
43233 catch
43234 {
43235 }
43236 if (num > 0)
43237 {
43238 float num25 = (float)
num24 - (
float)
num24 * (((float)num - 1f) * 0.1f);
43240 {
43242 }
43244 {
43246 }
43248 }
43251 if (num > 0)
43252 {
43254 }
43259 position.X +=
num21;
43260 position.Y +=
num22;
43264 }
43265 else
43266 {
43268 {
43270 velocity.Y += 0.15f;
43272 {
43273 velocity.Y =
num18;
43274 }
43276 {
43278 {
43279 velocity.X -=
num19 * 1.1f;
43280 }
43281 else
43282 {
43283 velocity.X +=
num19 * 1.1f;
43284 }
43285 }
43287 {
43289 {
43290 velocity.X +=
num19;
43291 }
43293 {
43294 velocity.X -=
num19;
43295 }
43296 }
43298 {
43300 {
43301 velocity.X +=
num19 * 0.9f;
43302 }
43303 else
43304 {
43305 velocity.X -=
num19 * 0.9f;
43306 }
43307 }
43308 }
43309 else
43310 {
43312 {
43315 {
43317 }
43319 {
43321 }
43324 }
43332 {
43334 {
43335 velocity.X +=
num20;
43336 }
43338 {
43339 velocity.X -=
num20;
43340 }
43342 {
43343 velocity.Y +=
num20;
43344 }
43346 {
43347 velocity.Y -=
num20;
43348 }
43349 }
43351 {
43353 {
43354 velocity.X +=
num19;
43355 }
43357 {
43358 velocity.X -=
num19;
43359 }
43361 {
43362 velocity.Y +=
num19;
43363 }
43365 {
43366 velocity.Y -=
num19;
43367 }
43369 {
43371 {
43372 velocity.Y +=
num19 * 2f;
43373 }
43374 else
43375 {
43376 velocity.Y -=
num19 * 2f;
43377 }
43378 }
43380 {
43382 {
43383 velocity.X +=
num19 * 2f;
43384 }
43385 else
43386 {
43387 velocity.X -=
num19 * 2f;
43388 }
43389 }
43390 }
43392 {
43394 {
43395 velocity.X +=
num19 * 1.1f;
43396 }
43398 {
43399 velocity.X -=
num19 * 1.1f;
43400 }
43402 {
43404 {
43405 velocity.Y +=
num19;
43406 }
43407 else
43408 {
43409 velocity.Y -=
num19;
43410 }
43411 }
43412 }
43413 else
43414 {
43416 {
43417 velocity.Y +=
num19 * 1.1f;
43418 }
43420 {
43421 velocity.Y -=
num19 * 1.1f;
43422 }
43424 {
43426 {
43427 velocity.X +=
num19;
43428 }
43429 else
43430 {
43431 velocity.X -=
num19;
43432 }
43433 }
43434 }
43435 }
43438 {
43440 {
43442 {
43444 }
43446 }
43447 else
43448 {
43450 {
43452 }
43454 }
43456 {
43458 }
43459 }
43460 }
43462 {
43467 float num30 = nPC.velocity.X * 0.025f;
43470 velocity.X = 0f;
43471 velocity.Y = 0f;
43473 }
43474 }
static double Atan2(double y, double x)
static double Sqrt(double d)
static double Abs(double value)
static void PlaySound(int type, Vector2 position, int style=1)
static int GetDestroyerSegmentsCount()
void TargetClosest(bool faceTarget=true)
static bool IsMechQueenUp
IEntitySource GetSpawnSourceForNPCFromNPCAI()
static int NewNPC(IEntitySource source, int X, int Y, int Type, int Start=0, float ai0=0f, float ai1=0f, float ai2=0f, float ai3=0f, int Target=255)
int GetAttackDamage_ForProjectiles(float normalDamage, float expertDamage)
void HitEffect(int hitDirection=0, double dmg=10.0)
IEntitySource GetSpawnSource_ForProjectile()