Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ AI()

void Terraria.Projectile.AI ( )
inline

Definition at line 18853 of file Projectile.cs.

18854 {
18855 //IL_1ac5c: Unknown result type (might be due to invalid IL or missing references)
18856 //IL_1acde: Unknown result type (might be due to invalid IL or missing references)
18857 //IL_1ace3: Unknown result type (might be due to invalid IL or missing references)
18858 //IL_1ac98: Unknown result type (might be due to invalid IL or missing references)
18859 //IL_1ac9d: Unknown result type (might be due to invalid IL or missing references)
18860 //IL_2feb4: Unknown result type (might be due to invalid IL or missing references)
18861 //IL_30646: Unknown result type (might be due to invalid IL or missing references)
18862 //IL_30735: Unknown result type (might be due to invalid IL or missing references)
18863 if (aiStyle == 1)
18864 {
18865 AI_001();
18866 }
18867 else if (aiStyle == 2)
18868 {
18869 if (Main.windPhysics)
18870 {
18871 velocity.X += Main.windSpeedCurrent * Main.windPhysicsStrength;
18872 }
18873 if (type == 93 && Main.rand.Next(5) == 0)
18874 {
18875 int num = Dust.NewDust(base.position, width, height, 57, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100);
18876 Main.dust[num].noGravity = true;
18877 Main.dust[num].fadeIn = 1f;
18878 Main.dust[num].velocity.X *= 0.3f;
18879 Main.dust[num].velocity.Y *= 0.3f;
18880 }
18881 if (type == 968)
18882 {
18883 if (localAI[0] == 0f)
18884 {
18885 localAI[0] = 1f;
18886 Vector2 vector = Main.player[owner].velocity;
18887 float num2 = Utils.Remap(vector.Length(), 0f, 3f, 0f, 0.5f);
18888 Vector2 vector2 = base.Center + new Vector2(-8f, -8f) + velocity.SafeNormalize(Vector2.Zero) * 25f;
18889 for (int i = 0; i < 8; i++)
18890 {
18891 Dust dust = Main.dust[Dust.NewDust(vector2, 16, 16, 31, velocity.X, velocity.Y, 50, default(Color), 0.75f + Main.rand.NextFloat() * 0.3f)];
18892 dust.velocity = (velocity * (0.2f + num2)).RotatedByRandom(0.699999988079071) + vector * 0.25f;
18893 Dust dust2 = dust;
18894 dust2.velocity *= 0f + Main.rand.NextFloat() * 1f;
18895 dust.fadeIn = 0.1f;
18896 dust2 = dust;
18897 dust2.position -= dust.velocity;
18898 dust.noGravity = true;
18899 }
18900 }
18901 alpha = Math.Max(0, alpha - 50);
18902 frame = (int)this.ai[1];
18903 }
18904 if (type == 304 && localAI[0] == 0f)
18905 {
18906 localAI[0] += 1f;
18907 alpha = 0;
18908 }
18909 if (type == 510)
18910 {
18911 rotation += Math.Abs(velocity.X) * 0.04f * (float)direction;
18912 }
18913 else
18914 {
18915 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.03f * (float)direction;
18916 }
18917 if (type == 909)
18918 {
18919 int num3 = 38;
18920 this.ai[0] += 1f;
18921 if (this.ai[0] >= (float)num3)
18922 {
18923 velocity.Y += 0.4f;
18924 velocity.X *= 0.97f;
18925 }
18926 if (Main.netMode != 1 && this.ai[1] == 0f)
18927 {
18928 this.ai[1] = 1 + Main.rand.Next(6);
18929 netUpdate = true;
18930 }
18931 if (this.ai[1] > 0f)
18932 {
18933 frame = (int)this.ai[1] - 1;
18934 }
18935 }
18936 else if (type == 162)
18937 {
18938 if (this.ai[1] == 0f)
18939 {
18940 this.ai[1] = 1f;
18942 }
18943 this.ai[0] += 1f;
18944 if (this.ai[0] >= 18f)
18945 {
18946 velocity.Y += 0.28f;
18947 velocity.X *= 0.99f;
18948 }
18949 if (this.ai[0] > 2f)
18950 {
18951 alpha = 0;
18952 if (this.ai[0] == 3f)
18953 {
18954 for (int j = 0; j < 10; j++)
18955 {
18956 int num4 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
18957 Dust dust2 = Main.dust[num4];
18958 dust2.velocity *= 0.5f;
18959 dust2 = Main.dust[num4];
18960 dust2.velocity += velocity * 0.1f;
18961 }
18962 for (int k = 0; k < 5; k++)
18963 {
18964 int num5 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2f);
18965 Main.dust[num5].noGravity = true;
18966 Dust dust2 = Main.dust[num5];
18967 dust2.velocity *= 3f;
18968 dust2 = Main.dust[num5];
18969 dust2.velocity += velocity * 0.2f;
18970 num5 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100);
18971 dust2 = Main.dust[num5];
18972 dust2.velocity *= 2f;
18973 dust2 = Main.dust[num5];
18974 dust2.velocity += velocity * 0.3f;
18975 }
18976 for (int l = 0; l < 1; l++)
18977 {
18978 int num6 = Gore.NewGore(new Vector2(base.position.X - 10f, base.position.Y - 10f), default(Vector2), Main.rand.Next(61, 64));
18979 Gore gore = Main.gore[num6];
18980 gore.position += velocity * 1.25f;
18981 Main.gore[num6].scale = 1.5f;
18982 gore = Main.gore[num6];
18983 gore.velocity += velocity * 0.5f;
18984 gore = Main.gore[num6];
18985 gore.velocity *= 0.02f;
18986 }
18987 }
18988 }
18989 }
18990 else if (type == 281)
18991 {
18992 if (this.ai[1] == 0f)
18993 {
18994 this.ai[1] = 1f;
18996 }
18997 this.ai[0] += 1f;
18998 if (this.ai[0] >= 18f)
18999 {
19000 velocity.Y += 0.28f;
19001 velocity.X *= 0.99f;
19002 }
19003 if (this.ai[0] > 2f)
19004 {
19005 alpha = 0;
19006 if (this.ai[0] == 3f)
19007 {
19008 for (int m = 0; m < 10; m++)
19009 {
19010 int num7 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
19011 Dust dust2 = Main.dust[num7];
19012 dust2.velocity *= 0.5f;
19013 dust2 = Main.dust[num7];
19014 dust2.velocity += velocity * 0.1f;
19015 }
19016 for (int n = 0; n < 5; n++)
19017 {
19018 int num8 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2f);
19019 Main.dust[num8].noGravity = true;
19020 Dust dust2 = Main.dust[num8];
19021 dust2.velocity *= 3f;
19022 dust2 = Main.dust[num8];
19023 dust2.velocity += velocity * 0.2f;
19024 num8 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100);
19025 dust2 = Main.dust[num8];
19026 dust2.velocity *= 2f;
19027 dust2 = Main.dust[num8];
19028 dust2.velocity += velocity * 0.3f;
19029 }
19030 for (int num9 = 0; num9 < 1; num9++)
19031 {
19032 int num10 = Gore.NewGore(new Vector2(base.position.X - 10f, base.position.Y - 10f), default(Vector2), Main.rand.Next(61, 64));
19033 Gore gore = Main.gore[num10];
19034 gore.position += velocity * 1.25f;
19035 Main.gore[num10].scale = 1.5f;
19036 gore = Main.gore[num10];
19037 gore.velocity += velocity * 0.5f;
19038 gore = Main.gore[num10];
19039 gore.velocity *= 0.02f;
19040 }
19041 }
19042 }
19043 }
19044 else if (type == 240)
19045 {
19046 if (this.ai[1] == 0f)
19047 {
19048 this.ai[1] = 1f;
19050 }
19051 this.ai[0] += 1f;
19052 if (this.ai[0] >= 16f)
19053 {
19054 velocity.Y += 0.18f;
19055 velocity.X *= 0.991f;
19056 }
19057 if (this.ai[0] > 2f)
19058 {
19059 alpha = 0;
19060 if (this.ai[0] == 3f)
19061 {
19062 for (int num11 = 0; num11 < 7; num11++)
19063 {
19064 int num12 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
19065 Dust dust2 = Main.dust[num12];
19066 dust2.velocity *= 0.5f;
19067 dust2 = Main.dust[num12];
19068 dust2.velocity += velocity * 0.1f;
19069 }
19070 for (int num13 = 0; num13 < 3; num13++)
19071 {
19072 int num14 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2f);
19073 Main.dust[num14].noGravity = true;
19074 Dust dust2 = Main.dust[num14];
19075 dust2.velocity *= 3f;
19076 dust2 = Main.dust[num14];
19077 dust2.velocity += velocity * 0.2f;
19078 num14 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100);
19079 dust2 = Main.dust[num14];
19080 dust2.velocity *= 2f;
19081 dust2 = Main.dust[num14];
19082 dust2.velocity += velocity * 0.3f;
19083 }
19084 for (int num15 = 0; num15 < 1; num15++)
19085 {
19086 int num16 = Gore.NewGore(new Vector2(base.position.X - 10f, base.position.Y - 10f), default(Vector2), Main.rand.Next(61, 64));
19087 Gore gore = Main.gore[num16];
19088 gore.position += velocity * 1.25f;
19089 Main.gore[num16].scale = 1.25f;
19090 gore = Main.gore[num16];
19091 gore.velocity += velocity * 0.5f;
19092 gore = Main.gore[num16];
19093 gore.velocity *= 0.02f;
19094 }
19095 }
19096 }
19097 }
19098 else if (type == 497)
19099 {
19100 int num17 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 27, velocity.X, velocity.Y, 100, default(Color), 1.2f);
19101 Main.dust[num17].position = (Main.dust[num17].position + base.Center) / 2f;
19102 Main.dust[num17].noGravity = true;
19103 Dust dust2 = Main.dust[num17];
19104 dust2.velocity *= 0.3f;
19105 dust2 = Main.dust[num17];
19106 dust2.velocity -= velocity * 0.1f;
19107 this.ai[0] += 1f;
19108 if (this.ai[0] >= 30f)
19109 {
19110 velocity.X *= 0.99f;
19111 velocity.Y += 0.5f;
19112 }
19113 else
19114 {
19115 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
19116 }
19117 }
19118 else if (type == 861)
19119 {
19120 if (Main.myPlayer == owner)
19121 {
19122 localAI[0]++;
19123 if (localAI[0] > 30f)
19124 {
19125 localAI[0] = 30f;
19126 }
19127 Player player = Main.player[owner];
19128 for (int num18 = 0; num18 < 255; num18++)
19129 {
19130 Player player2 = Main.player[num18];
19131 if (player2 != null && player2.active && !player2.dead && (player2.whoAmI != player.whoAmI || !(localAI[0] < 30f)) && Colliding(base.Hitbox, player2.Hitbox))
19132 {
19133 Kill();
19134 break;
19135 }
19136 }
19137 }
19138 if (velocity.Y == 0f)
19139 {
19140 velocity.X *= 0.95f;
19141 }
19142 else
19143 {
19144 velocity.X *= 0.995f;
19145 }
19146 if (Math.Abs(velocity.X) < 0.5f)
19147 {
19148 velocity.X = 0f;
19149 }
19150 if (velocity.X == 0f && velocity.Y == 0f)
19151 {
19152 Kill();
19153 }
19154 velocity.Y += 0.1f;
19155 if (this.ai[1] == 1f)
19156 {
19157 frame = (frameCounter = 0);
19158 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.03f * (float)direction;
19159 }
19160 else
19161 {
19162 if (frame == 0)
19163 {
19164 frame = 1;
19165 }
19166 frameCounter++;
19167 if (frameCounter > 4)
19168 {
19169 frameCounter = 0;
19170 frame++;
19171 if (frame >= Main.projFrames[type])
19172 {
19173 frame = 1;
19174 }
19175 }
19176 rotation = velocity.ToRotation() + (float)Math.PI / 4f;
19177 spriteDirection = ((!(velocity.X < 0f)) ? 1 : (-1));
19178 if (spriteDirection == -1)
19179 {
19180 rotation += (float)Math.PI / 2f;
19181 }
19182 }
19183 }
19184 else if (type == 249)
19185 {
19186 this.ai[0] += 1f;
19187 if (this.ai[0] >= 0f)
19188 {
19189 velocity.Y += 0.25f;
19190 }
19191 }
19192 else if (type == 347)
19193 {
19194 this.ai[0] += 1f;
19195 if (this.ai[0] >= 5f)
19196 {
19197 velocity.Y += 0.25f;
19198 }
19199 }
19200 else if (type == 501)
19201 {
19202 this.ai[0] += 1f;
19203 if (this.ai[0] >= 18f)
19204 {
19205 velocity.X *= 0.995f;
19206 velocity.Y += 0.2f;
19207 }
19208 }
19209 else if (type == 504 || type == 954 || type == 979)
19210 {
19211 alpha = 255;
19212 this.ai[0] += 1f;
19213 if (this.ai[0] > 3f)
19214 {
19215 int num19 = 100;
19216 if (this.ai[0] > 20f)
19217 {
19218 int num20 = 40;
19219 float num21 = this.ai[0] - 20f;
19220 num19 = (int)(100f * (1f - num21 / (float)num20));
19221 if (num21 >= (float)num20)
19222 {
19223 Kill();
19224 }
19225 }
19226 if (this.ai[0] <= 10f)
19227 {
19228 num19 = (int)this.ai[0] * 10;
19229 }
19230 if (Main.rand.Next(100) < num19)
19231 {
19232 int num22 = ((type != 979) ? Dust.NewDust(base.position, width, height, 6, 0f, 0f, 150) : Dust.NewDust(base.position, width, height, 135, 0f, 0f, 150));
19233 Main.dust[num22].position = (Main.dust[num22].position + base.Center) / 2f;
19234 Main.dust[num22].noGravity = true;
19235 Dust dust2 = Main.dust[num22];
19236 dust2.velocity *= 2f;
19237 dust2 = Main.dust[num22];
19238 dust2.scale *= 1.6f;
19239 dust2 = Main.dust[num22];
19240 dust2.velocity += velocity;
19241 }
19242 }
19243 if (this.ai[0] >= 20f)
19244 {
19245 velocity.X *= 0.99f;
19246 velocity.Y += 0.1f;
19247 }
19248 }
19249 else if (type == 69 || type == 70 || type == 621)
19250 {
19251 this.ai[0] += 1f;
19252 if (this.ai[0] >= 10f)
19253 {
19254 velocity.Y += 0.25f;
19255 velocity.X *= 0.99f;
19256 }
19257 }
19258 else if (type == 166)
19259 {
19260 if (owner == Main.myPlayer && this.ai[1] == 1f)
19261 {
19262 for (int num23 = 0; num23 < 200; num23++)
19263 {
19264 if (Main.npc[num23].active && Main.npc[num23].townNPC && Colliding(base.Hitbox, Main.npc[num23].Hitbox))
19265 {
19266 Kill();
19267 return;
19268 }
19269 }
19270 if (Main.netMode == 1)
19271 {
19272 for (int num24 = 0; num24 < 255; num24++)
19273 {
19274 if (num24 != owner && Main.player[num24].active && !Main.player[owner].InOpposingTeam(Main.player[num24]) && Colliding(base.Hitbox, Main.player[num24].Hitbox))
19275 {
19276 Kill();
19277 return;
19278 }
19279 }
19280 }
19281 }
19282 this.ai[0] += 1f;
19283 if (this.ai[0] >= 20f)
19284 {
19285 velocity.Y += 0.3f;
19286 velocity.X *= 0.98f;
19287 }
19288 }
19289 else if (type == 300)
19290 {
19291 if (this.ai[0] == 0f)
19292 {
19294 }
19295 this.ai[0] += 1f;
19296 if (this.ai[0] >= 60f)
19297 {
19298 velocity.Y += 0.2f;
19299 velocity.X *= 0.99f;
19300 }
19301 }
19302 else if (type == 306)
19303 {
19304 if (alpha <= 200)
19305 {
19306 for (int num25 = 0; num25 < 4; num25++)
19307 {
19308 float num26 = velocity.X / 4f * (float)num25;
19309 float num27 = velocity.Y / 4f * (float)num25;
19310 int num28 = Dust.NewDust(base.position, width, height, 184);
19311 Main.dust[num28].position.X = base.Center.X - num26;
19312 Main.dust[num28].position.Y = base.Center.Y - num27;
19313 Dust dust2 = Main.dust[num28];
19314 dust2.velocity *= 0f;
19315 Main.dust[num28].scale = 0.7f;
19316 }
19317 }
19318 alpha -= 50;
19319 if (alpha < 0)
19320 {
19321 alpha = 0;
19322 }
19323 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 0.785f;
19324 }
19325 else if (type == 304)
19326 {
19327 this.ai[0] += 1f;
19328 if (this.ai[0] >= 30f)
19329 {
19330 alpha += 10;
19331 damage = (int)((double)damage * 0.9);
19332 knockBack = (int)((double)knockBack * 0.9);
19333 if (alpha >= 255)
19334 {
19335 active = false;
19336 }
19337 }
19338 if (this.ai[0] < 30f)
19339 {
19340 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
19341 }
19342 }
19343 else if (type == 370 || type == 371 || type == 936)
19344 {
19345 this.ai[0] += 1f;
19346 if (this.ai[0] >= 15f)
19347 {
19348 velocity.Y += 0.3f;
19349 velocity.X *= 0.98f;
19350 }
19351 }
19352 else
19353 {
19354 int num29 = 20;
19355 if (type == 93)
19356 {
19357 num29 = 28 + Main.rand.Next(6);
19358 }
19359 this.ai[0] += 1f;
19360 if (this.ai[0] >= (float)num29)
19361 {
19362 if (type == 93)
19363 {
19364 this.ai[0] = 40f;
19365 }
19366 velocity.Y += 0.4f;
19367 velocity.X *= 0.97f;
19368 }
19369 else if (type == 48 || type == 54 || type == 93 || type == 520 || type == 599)
19370 {
19371 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
19372 }
19373 }
19374 if (velocity.Y > 16f)
19375 {
19376 velocity.Y = 16f;
19377 }
19378 if (type == 54 && Main.rand.Next(20) == 0)
19379 {
19380 Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 40, velocity.X * 0.1f, velocity.Y * 0.1f, 0, default(Color), 0.75f);
19381 }
19382 }
19383 else if (aiStyle == 3)
19384 {
19385 if (soundDelay == 0 && type != 383)
19386 {
19387 soundDelay = 8;
19389 }
19390 if (type == 19)
19391 {
19392 for (int num30 = 0; num30 < 2; num30++)
19393 {
19394 int num31 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
19395 Main.dust[num31].noGravity = true;
19396 Main.dust[num31].velocity.X *= 0.3f;
19397 Main.dust[num31].velocity.Y *= 0.3f;
19398 }
19399 }
19400 else if (type == 1000)
19401 {
19402 if (Main.rand.Next(3) == 0)
19403 {
19404 switch (Main.rand.Next(3))
19405 {
19406 default:
19407 {
19408 int num32 = Main.rand.Next(3) switch
19409 {
19410 1 => 57,
19411 2 => 58,
19412 _ => 15,
19413 };
19414 Dust dust3 = Main.dust[Dust.NewDust(base.position, width, height, num32, velocity.X * 0.25f, velocity.Y * 0.25f, 150, default(Color), 0.7f)];
19415 Dust dust2 = dust3;
19416 dust2.velocity *= 0.5f;
19417 break;
19418 }
19419 case 1:
19420 {
19421 Dust dust3 = Main.dust[Dust.NewDust(base.position, width, height, 267, velocity.X, velocity.Y, 50, new Color(50, 50, 200), 1.1f)];
19422 dust3.fadeIn = 0.1f;
19423 dust3.velocity = velocity * 0.5f;
19424 dust3.noGravity = true;
19425 break;
19426 }
19427 case 2:
19428 {
19429 Dust dust3 = Main.dust[Dust.NewDust(base.position, width, height, 76, velocity.X * 0.15f, velocity.Y * 0.15f, 0, default(Color), 1.1f)];
19430 dust3.noGravity = true;
19431 Dust.NewDust(base.position, width, height, 15, velocity.X * 0.05f, velocity.Y * 0.05f, 150, default(Color), 0.6f);
19432 break;
19433 }
19434 }
19435 }
19436 }
19437 else if (type == 867)
19438 {
19439 if (Main.rand.Next(3) == 0)
19440 {
19441 int num33 = Dust.NewDust(base.position, width, height, 165, velocity.X, velocity.Y, 50);
19442 Dust dust2 = Main.dust[num33];
19443 dust2.velocity *= 0.5f;
19444 Main.dust[num33].noGravity = true;
19445 }
19446 }
19447 else if (type == 33)
19448 {
19449 if (Main.rand.Next(1) == 0)
19450 {
19451 int num34 = Dust.NewDust(base.position, width, height, 40, velocity.X * 0.25f, velocity.Y * 0.25f, 0, default(Color), 1.4f);
19452 Main.dust[num34].noGravity = true;
19453 }
19454 }
19455 else if (type == 320)
19456 {
19457 if (Main.rand.Next(3) == 0)
19458 {
19459 int num35 = Dust.NewDust(base.position, width, height, 5, velocity.X * 0.25f, velocity.Y * 0.25f, 0, default(Color), 1.1f);
19460 if (Main.rand.Next(2) == 0)
19461 {
19462 Main.dust[num35].scale = 0.9f;
19463 Dust dust2 = Main.dust[num35];
19464 dust2.velocity *= 0.2f;
19465 }
19466 else
19467 {
19468 Main.dust[num35].noGravity = true;
19469 }
19470 }
19471 }
19472 else if (type == 6)
19473 {
19474 if (Main.rand.Next(5) == 0)
19475 {
19476 int num36 = Main.rand.Next(3);
19477 Dust.NewDust(base.position, width, height, num36 switch
19478 {
19479 0 => 15,
19480 1 => 57,
19481 _ => 58,
19482 }, velocity.X * 0.25f, velocity.Y * 0.25f, 150, default(Color), 0.7f);
19483 }
19484 }
19485 else if (type == 113 && Main.rand.Next(1) == 0)
19486 {
19487 int num37 = Dust.NewDust(base.position, width, height, 76, velocity.X * 0.15f, velocity.Y * 0.15f, 0, default(Color), 1.1f);
19488 Main.dust[num37].noGravity = true;
19489 Dust.NewDust(base.position, width, height, 15, velocity.X * 0.05f, velocity.Y * 0.05f, 150, default(Color), 0.6f);
19490 }
19491 if (this.ai[0] == 0f)
19492 {
19493 bool flag = true;
19494 int num38 = type;
19495 if (num38 == 866)
19496 {
19497 flag = false;
19498 }
19499 if (flag)
19500 {
19501 this.ai[1] += 1f;
19502 }
19503 if (type == 106 && this.ai[1] >= 45f)
19504 {
19505 this.ai[0] = 1f;
19506 this.ai[1] = 0f;
19507 netUpdate = true;
19508 }
19509 if (type == 320 || type == 383)
19510 {
19511 if (this.ai[1] >= 10f)
19512 {
19513 velocity.Y += 0.5f;
19514 if (type == 383 && velocity.Y < 0f)
19515 {
19516 velocity.Y += 0.35f;
19517 }
19518 velocity.X *= 0.95f;
19519 if (velocity.Y > 16f)
19520 {
19521 velocity.Y = 16f;
19522 }
19523 if (type == 383 && Vector2.Distance(base.Center, Main.player[owner].Center) > 800f)
19524 {
19525 this.ai[0] = 1f;
19526 netUpdate = true;
19527 }
19528 }
19529 }
19530 else if (type == 182)
19531 {
19532 if (Main.rand.Next(2) == 0)
19533 {
19534 int num39 = Dust.NewDust(base.position, width, height, 57, 0f, 0f, 255, default(Color), 0.75f);
19535 Dust dust2 = Main.dust[num39];
19536 dust2.velocity *= 0.1f;
19537 Main.dust[num39].noGravity = true;
19538 }
19539 if (velocity.X > 0f)
19540 {
19541 spriteDirection = 1;
19542 }
19543 else if (velocity.X < 0f)
19544 {
19545 spriteDirection = -1;
19546 }
19547 float num40 = base.position.X;
19548 float num41 = base.position.Y;
19549 float num42 = 800f;
19550 bool flag2 = false;
19551 if (this.ai[1] > 10f && this.ai[1] < 360f)
19552 {
19553 for (int num43 = 0; num43 < 200; num43++)
19554 {
19555 if (Main.npc[num43].CanBeChasedBy(this))
19556 {
19557 float num44 = Main.npc[num43].position.X + (float)(Main.npc[num43].width / 2);
19558 float num45 = Main.npc[num43].position.Y + (float)(Main.npc[num43].height / 2);
19559 float num46 = Distance(Main.npc[num43].Center);
19560 if (num46 < num42 && Collision.CanHit(new Vector2(base.position.X + (float)(width / 2), base.position.Y + (float)(height / 2)), 1, 1, Main.npc[num43].position, Main.npc[num43].width, Main.npc[num43].height))
19561 {
19562 num42 = num46;
19563 num40 = num44;
19564 num41 = num45;
19565 flag2 = true;
19566 }
19567 }
19568 }
19569 }
19570 if (!flag2)
19571 {
19572 num40 = base.position.X + (float)(width / 2) + velocity.X * 100f;
19573 num41 = base.position.Y + (float)(height / 2) + velocity.Y * 100f;
19574 if (this.ai[1] >= 30f)
19575 {
19576 this.ai[0] = 1f;
19577 this.ai[1] = 0f;
19578 netUpdate = true;
19579 }
19580 }
19581 float num47 = 12f;
19582 float num48 = 0.25f;
19583 Vector2 vector3 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
19584 float num49 = num40 - vector3.X;
19585 float num50 = num41 - vector3.Y;
19586 float num51 = (float)Math.Sqrt(num49 * num49 + num50 * num50);
19587 float num52 = num51;
19588 num51 = num47 / num51;
19589 num49 *= num51;
19590 num50 *= num51;
19591 if (velocity.X < num49)
19592 {
19593 velocity.X += num48;
19594 if (velocity.X < 0f && num49 > 0f)
19595 {
19596 velocity.X += num48 * 2f;
19597 }
19598 }
19599 else if (velocity.X > num49)
19600 {
19601 velocity.X -= num48;
19602 if (velocity.X > 0f && num49 < 0f)
19603 {
19604 velocity.X -= num48 * 2f;
19605 }
19606 }
19607 if (velocity.Y < num50)
19608 {
19609 velocity.Y += num48;
19610 if (velocity.Y < 0f && num50 > 0f)
19611 {
19612 velocity.Y += num48 * 2f;
19613 }
19614 }
19615 else if (velocity.Y > num50)
19616 {
19617 velocity.Y -= num48;
19618 if (velocity.Y > 0f && num50 < 0f)
19619 {
19620 velocity.Y -= num48 * 2f;
19621 }
19622 }
19623 }
19624 else if (type == 866)
19625 {
19626 if (owner == Main.myPlayer && damage > 0)
19627 {
19628 float num53 = this.ai[1];
19629 if (localAI[0] >= 10f && localAI[0] <= 360f)
19630 {
19632 this.ai[1] = num54;
19633 }
19634 else
19635 {
19636 this.ai[1] = -1f;
19637 }
19638 if (this.ai[1] != num53)
19639 {
19640 netUpdate = true;
19641 }
19642 }
19643 localAI[0] += 1f;
19644 int num55 = (int)this.ai[1];
19646 if (Main.npc.IndexInRange(num55) && Main.npc[num55].CanBeChasedBy(this))
19647 {
19648 vector4 = Main.npc[num55].Center;
19649 }
19650 else
19651 {
19652 vector4 = base.Center + velocity * 100f;
19653 int num56 = 30;
19654 if (owner != Main.myPlayer)
19655 {
19656 num56 = 60;
19657 }
19658 if (localAI[0] >= (float)num56)
19659 {
19660 this.ai[0] = 1f;
19661 this.ai[1] = 0f;
19662 netUpdate = true;
19663 }
19664 }
19665 float num57 = 12f;
19666 float num58 = 0.25f;
19667 Vector2 vector5 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
19668 float num59 = vector4.X - vector5.X;
19669 float num60 = vector4.Y - vector5.Y;
19670 float num61 = (float)Math.Sqrt(num59 * num59 + num60 * num60);
19671 float num62 = num61;
19672 num61 = num57 / num61;
19673 num59 *= num61;
19674 num60 *= num61;
19675 if (velocity.X < num59)
19676 {
19677 velocity.X += num58;
19678 if (velocity.X < 0f && num59 > 0f)
19679 {
19680 velocity.X += num58 * 2f;
19681 }
19682 }
19683 else if (velocity.X > num59)
19684 {
19685 velocity.X -= num58;
19686 if (velocity.X > 0f && num59 < 0f)
19687 {
19688 velocity.X -= num58 * 2f;
19689 }
19690 }
19691 if (velocity.Y < num60)
19692 {
19693 velocity.Y += num58;
19694 if (velocity.Y < 0f && num60 > 0f)
19695 {
19696 velocity.Y += num58 * 2f;
19697 }
19698 }
19699 else if (velocity.Y > num60)
19700 {
19701 velocity.Y -= num58;
19702 if (velocity.Y > 0f && num60 < 0f)
19703 {
19704 velocity.Y -= num58 * 2f;
19705 }
19706 }
19707 }
19708 else if (type == 301)
19709 {
19710 if (this.ai[1] >= 20f)
19711 {
19712 this.ai[0] = 1f;
19713 this.ai[1] = 0f;
19715 netUpdate = true;
19716 }
19717 }
19718 else if (this.ai[1] >= 30f)
19719 {
19720 this.ai[0] = 1f;
19721 this.ai[1] = 0f;
19722 netUpdate = true;
19723 }
19724 }
19725 else
19726 {
19727 tileCollide = false;
19728 float num63 = 9f;
19729 float num64 = 0.4f;
19730 if (type == 1000)
19731 {
19732 num63 = 9.5f;
19733 }
19734 if (type == 19)
19735 {
19736 num63 = 20f;
19737 num64 = 1.5f;
19738 }
19739 else if (type == 33)
19740 {
19741 num63 = 18f;
19742 num64 = 1.2f;
19743 }
19744 else if (type == 182)
19745 {
19746 num63 = 16f;
19747 num64 = 1.2f;
19748 }
19749 else if (type == 866)
19750 {
19751 num63 = 16f;
19752 num64 = 1.2f;
19753 }
19754 else if (type == 106)
19755 {
19756 num63 = 16f;
19757 num64 = 1.2f;
19758 }
19759 else if (type == 272)
19760 {
19761 num63 = 20f;
19762 num64 = 1.5f;
19763 }
19764 else if (type == 333)
19765 {
19766 num63 = 12f;
19767 num64 = 0.6f;
19768 }
19769 else if (type == 301)
19770 {
19771 num63 = 15f;
19772 num64 = 3f;
19773 }
19774 else if (type == 320)
19775 {
19776 num63 = 15f;
19777 num64 = 3f;
19778 }
19779 else if (type == 383)
19780 {
19781 num63 = 16f;
19782 num64 = 4f;
19783 }
19784 Vector2 vector6 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
19785 float num65 = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - vector6.X;
19786 float num66 = Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - vector6.Y;
19787 float num67 = (float)Math.Sqrt(num65 * num65 + num66 * num66);
19788 if (num67 > 3000f)
19789 {
19790 Kill();
19791 }
19792 num67 = num63 / num67;
19793 num65 *= num67;
19794 num66 *= num67;
19795 if (type == 383)
19796 {
19798 if (vector7 != Vector2.Zero)
19799 {
19801 vector8.Normalize();
19802 velocity += vector8 * Math.Min(num64, vector7.Length());
19803 }
19804 }
19805 else
19806 {
19807 if (velocity.X < num65)
19808 {
19809 velocity.X += num64;
19810 if (velocity.X < 0f && num65 > 0f)
19811 {
19812 velocity.X += num64;
19813 }
19814 }
19815 else if (velocity.X > num65)
19816 {
19817 velocity.X -= num64;
19818 if (velocity.X > 0f && num65 < 0f)
19819 {
19820 velocity.X -= num64;
19821 }
19822 }
19823 if (velocity.Y < num66)
19824 {
19825 velocity.Y += num64;
19826 if (velocity.Y < 0f && num66 > 0f)
19827 {
19828 velocity.Y += num64;
19829 }
19830 }
19831 else if (velocity.Y > num66)
19832 {
19833 velocity.Y -= num64;
19834 if (velocity.Y > 0f && num66 < 0f)
19835 {
19836 velocity.Y -= num64;
19837 }
19838 }
19839 }
19840 if (Main.myPlayer == owner)
19841 {
19842 Rectangle rectangle = new Rectangle((int)base.position.X, (int)base.position.Y, width, height);
19843 Rectangle value = new Rectangle((int)Main.player[owner].position.X, (int)Main.player[owner].position.Y, Main.player[owner].width, Main.player[owner].height);
19844 if (rectangle.Intersects(value))
19845 {
19846 Kill();
19847 }
19848 }
19849 }
19850 if (type == 106)
19851 {
19852 rotation += 0.3f * (float)direction;
19853 }
19854 else if (type == 866)
19855 {
19856 rotation = velocity.ToRotation();
19857 if (Main.rand.Next(2) == 0)
19858 {
19859 int num68 = Dust.NewDust(base.position, width, height, 212);
19860 Dust dust2 = Main.dust[num68];
19861 dust2.velocity *= 0.1f;
19862 Main.dust[num68].noGravity = true;
19863 }
19864 }
19865 else if (type == 383)
19866 {
19867 if (this.ai[0] == 0f)
19868 {
19869 Vector2 v = velocity;
19870 v = v.SafeNormalize(Vector2.Zero);
19871 rotation = (float)Math.Atan2(v.Y, v.X) + 1.57f;
19872 }
19873 else
19874 {
19875 Vector2 v2 = base.Center - Main.player[owner].Center;
19876 v2 = v2.SafeNormalize(Vector2.Zero);
19877 rotation = (float)Math.Atan2(v2.Y, v2.X) + 1.57f;
19878 }
19879 }
19880 else if (type == 301)
19881 {
19882 if (this.ai[0] == 0f)
19883 {
19884 rotation = velocity.ToRotation() + (float)Math.PI / 4f;
19885 if (Main.rand.Next(2) == 0)
19886 {
19887 int num69 = Dust.NewDust(base.position, width, height, 57, velocity.X * 0.2f, velocity.Y * 0.2f, 200, default(Color), 1.2f);
19888 Dust dust2 = Main.dust[num69];
19889 dust2.velocity += velocity * 0.3f;
19890 dust2 = Main.dust[num69];
19891 dust2.velocity *= 0.2f;
19892 Main.dust[num69].noGravity = true;
19893 }
19894 if (Main.rand.Next(3) == 0)
19895 {
19896 int num70 = Dust.NewDust(base.position, width, height, 43, 0f, 0f, 254, default(Color), 0.3f);
19897 Dust dust2 = Main.dust[num70];
19898 dust2.velocity += velocity * 0.5f;
19899 dust2 = Main.dust[num70];
19900 dust2.velocity *= 0.5f;
19901 Main.dust[num70].noGravity = true;
19902 }
19903 }
19904 else
19905 {
19906 rotation += 0.4f * (float)direction;
19907 }
19908 }
19909 else
19910 {
19911 rotation += 0.4f * (float)direction;
19912 }
19913 }
19914 else if (aiStyle == 4)
19915 {
19916 if (Main.netMode != 2 && this.ai[1] == 0f && localAI[0] == 0f)
19917 {
19918 localAI[0] = 1f;
19920 if (type == 494)
19921 {
19923 }
19925 }
19926 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
19927 if (this.ai[0] == 0f)
19928 {
19929 if (type >= 150 && type <= 152 && this.ai[1] == 0f && alpha == 255 && Main.rand.Next(2) == 0)
19930 {
19931 type++;
19932 netUpdate = true;
19933 }
19934 alpha -= 50;
19935 if (type >= 150 && type <= 152)
19936 {
19937 alpha -= 25;
19938 }
19939 else if (type == 493 || type == 494)
19940 {
19941 alpha -= 50;
19942 }
19943 if (alpha > 0)
19944 {
19945 return;
19946 }
19947 alpha = 0;
19948 this.ai[0] = 1f;
19949 if (this.ai[1] == 0f)
19950 {
19951 this.ai[1] += 1f;
19952 base.position += velocity * 1f;
19953 }
19954 if (type == 7 && Main.myPlayer == owner)
19955 {
19956 int num71 = type;
19957 if (this.ai[1] >= 6f)
19958 {
19959 num71++;
19960 }
19961 int num72 = NewProjectile(GetProjectileSource_FromThis(), base.position.X + velocity.X + (float)(width / 2), base.position.Y + velocity.Y + (float)(height / 2), velocity.X, velocity.Y, num71, damage, knockBack, owner);
19962 Main.projectile[num72].damage = damage;
19963 Main.projectile[num72].ai[1] = this.ai[1] + 1f;
19964 NetMessage.SendData(27, -1, -1, null, num72);
19965 }
19966 else if (type == 494 && Main.myPlayer == owner)
19967 {
19968 int num73 = type;
19969 if (this.ai[1] >= (float)(7 + Main.rand.Next(2)))
19970 {
19971 num73--;
19972 }
19973 int num74 = damage;
19974 float num75 = knockBack;
19975 if (num73 == 493)
19976 {
19977 num74 = (int)((double)damage * 1.25);
19978 num75 = knockBack * 1.25f;
19979 }
19980 int number = NewProjectile(GetProjectileSource_FromThis(), base.position.X + velocity.X + (float)(width / 2), base.position.Y + velocity.Y + (float)(height / 2), velocity.X, velocity.Y, num73, num74, num75, owner, 0f, this.ai[1] + 1f);
19981 NetMessage.SendData(27, -1, -1, null, number);
19982 }
19983 else if ((type == 150 || type == 151) && Main.myPlayer == owner)
19984 {
19985 int num76 = type;
19986 if (type == 150)
19987 {
19988 num76 = 151;
19989 }
19990 else if (type == 151)
19991 {
19992 num76 = 150;
19993 }
19994 if (this.ai[1] >= 10f && type == 151)
19995 {
19996 num76 = 152;
19997 }
19998 int num77 = NewProjectile(GetProjectileSource_FromThis(), base.position.X + velocity.X + (float)(width / 2), base.position.Y + velocity.Y + (float)(height / 2), velocity.X, velocity.Y, num76, damage, knockBack, owner);
19999 Main.projectile[num77].damage = damage;
20000 Main.projectile[num77].ai[1] = this.ai[1] + 1f;
20001 NetMessage.SendData(27, -1, -1, null, num77);
20002 }
20003 return;
20004 }
20006 {
20007 if (type >= 150 && type <= 152)
20008 {
20009 for (int num78 = 0; num78 < 8; num78++)
20010 {
20011 int num79 = Dust.NewDust(base.position, width, height, 7, velocity.X * 0.025f, velocity.Y * 0.025f, 200, default(Color), 1.3f);
20012 Main.dust[num79].noGravity = true;
20013 Dust dust2 = Main.dust[num79];
20014 dust2.velocity *= 0.5f;
20015 }
20016 }
20017 else if (type == 493 || type == 494)
20018 {
20019 for (int num80 = 0; num80 < 8; num80++)
20020 {
20021 int num81 = Dust.NewDust(base.position, width, height, Main.rand.Next(68, 71), velocity.X * 0.025f, velocity.Y * 0.025f, 200, default(Color), 1.3f);
20022 Main.dust[num81].noGravity = true;
20023 Dust dust2 = Main.dust[num81];
20024 dust2.velocity *= 0.5f;
20025 }
20026 }
20027 else
20028 {
20029 for (int num82 = 0; num82 < 3; num82++)
20030 {
20031 Dust.NewDust(base.position, width, height, 18, velocity.X * 0.025f, velocity.Y * 0.025f, 170, default(Color), 1.2f);
20032 }
20033 Dust.NewDust(base.position, width, height, 14, 0f, 0f, 170, default(Color), 1.1f);
20034 }
20035 }
20036 if (type >= 150 && type <= 152)
20037 {
20038 alpha += 3;
20039 }
20040 else if (type == 493 || type == 494)
20041 {
20042 alpha += 4;
20043 }
20044 else
20045 {
20046 alpha += 5;
20047 }
20048 if (alpha >= 255)
20049 {
20050 Kill();
20051 }
20052 }
20053 else if (aiStyle == 5)
20054 {
20055 if (!Main.remixWorld && type == 12 && Main.dayTime && damage == 1000)
20056 {
20057 Kill();
20058 }
20059 if (type == 503 || type == 723 || type == 724 || type == 725 || type == 726)
20060 {
20061 if (base.Center.Y > this.ai[1])
20062 {
20063 tileCollide = true;
20064 }
20065 }
20066 else if (type == 92)
20067 {
20068 if (base.position.Y > this.ai[1])
20069 {
20070 tileCollide = true;
20071 }
20072 }
20073 else if (type == 9)
20074 {
20075 tileCollide = base.Bottom.Y >= this.ai[1];
20076 }
20077 else
20078 {
20079 if (this.ai[1] == 0f && !Collision.SolidCollision(base.position, width, height))
20080 {
20081 this.ai[1] = 1f;
20082 netUpdate = true;
20083 }
20084 if (this.ai[1] != 0f)
20085 {
20086 tileCollide = true;
20087 }
20088 }
20089 if (soundDelay == 0)
20090 {
20091 soundDelay = 20 + Main.rand.Next(40);
20093 }
20094 if (type == 503 || type == 9)
20095 {
20096 alpha -= 15;
20097 int num83 = 150;
20098 if (base.Center.Y >= this.ai[1])
20099 {
20100 num83 = 0;
20101 }
20102 if (alpha < num83)
20103 {
20104 alpha = num83;
20105 }
20106 localAI[0] += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.01f * (float)direction;
20107 }
20108 else if (type == 723 || type == 724 || type == 725 || type == 726)
20109 {
20110 alpha -= 15;
20111 int num84 = 100;
20112 if (base.Center.Y >= this.ai[1])
20113 {
20114 num84 = 0;
20115 }
20116 if (alpha < num84)
20117 {
20118 alpha = num84;
20119 }
20120 localAI[0] += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.01f * (float)direction;
20121 }
20122 else
20123 {
20124 if (localAI[0] == 0f)
20125 {
20126 localAI[0] = 1f;
20127 }
20128 alpha += (int)(25f * localAI[0]);
20129 if (alpha > 200)
20130 {
20131 alpha = 200;
20132 localAI[0] = -1f;
20133 }
20134 if (alpha < 0)
20135 {
20136 alpha = 0;
20137 localAI[0] = 1f;
20138 }
20139 }
20140 if (type == 503)
20141 {
20142 rotation = velocity.ToRotation() - (float)Math.PI / 2f;
20143 }
20144 else
20145 {
20146 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.01f * (float)direction;
20147 }
20148 if (type == 503)
20149 {
20150 if (Main.rand.Next(16) == 0)
20151 {
20152 Vector2 vector9 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy(velocity.ToRotation());
20153 int num85 = Dust.NewDust(base.position, width, height, 58, velocity.X * 0.5f, velocity.Y * 0.5f, 150, default(Color), 1.2f);
20154 Main.dust[num85].velocity = vector9 * 0.66f;
20155 Main.dust[num85].position = base.Center + vector9 * 12f;
20156 }
20157 if (Main.rand.Next(48) == 0)
20158 {
20159 int num86 = Gore.NewGore(base.Center, new Vector2(velocity.X * 0.2f, velocity.Y * 0.2f), 16);
20160 Gore gore = Main.gore[num86];
20161 gore.velocity *= 0.66f;
20162 gore = Main.gore[num86];
20163 gore.velocity += velocity * 0.3f;
20164 }
20165 }
20166 if (type == 12 || type == 955)
20167 {
20168 Vector2 vector10 = new Vector2(Main.screenWidth, Main.screenHeight);
20169 if (base.Hitbox.Intersects(Utils.CenteredRectangle(Main.screenPosition + vector10 / 2f, vector10 + new Vector2(400f))) && Main.rand.Next(6) == 0)
20170 {
20171 int num87 = Utils.SelectRandom<int>(Main.rand, 16, 17, 17, 17);
20172 if (Main.tenthAnniversaryWorld)
20173 {
20174 num87 = Utils.SelectRandom<int>(Main.rand, 16, 16, 16, 17);
20175 }
20176 Gore.NewGore(base.position, velocity * 0.2f, num87);
20177 }
20178 light = 0.9f;
20179 if (Main.rand.Next(20) == 0 || (Main.tenthAnniversaryWorld && Main.rand.Next(15) == 0))
20180 {
20181 Dust.NewDust(base.position, width, height, 58, velocity.X * 0.5f, velocity.Y * 0.5f, 150, default(Color), 1.2f);
20182 }
20183 }
20184 else if (type == 723 || type == 724 || type == 725 || type == 726)
20185 {
20186 if (type == 726 || type == 725 || type == 726)
20187 {
20188 Vector2 vector11 = new Vector2(Main.screenWidth, Main.screenHeight);
20189 if (base.Hitbox.Intersects(Utils.CenteredRectangle(Main.screenPosition + vector11 / 2f, vector11 + new Vector2(400f))) && Main.rand.Next(24) == 0)
20190 {
20191 Gore.NewGore(base.position, velocity * 0.2f, Utils.SelectRandom<int>(Main.rand, 16, 17));
20192 }
20193 if (Main.rand.Next(3) == 0)
20194 {
20195 Dust dust4 = Dust.NewDustDirect(base.position, width, height, 86, 0f, 0f, 127);
20196 Dust dust2 = dust4;
20197 dust2.velocity *= 0.5f;
20198 dust4.noGravity = true;
20199 }
20200 }
20201 if (type == 723)
20202 {
20203 Vector2 vector12 = new Vector2(Main.screenWidth, Main.screenHeight);
20204 if (base.Hitbox.Intersects(Utils.CenteredRectangle(Main.screenPosition + vector12 / 2f, vector12 + new Vector2(400f))) && Main.rand.Next(6) == 0)
20205 {
20206 Gore.NewGore(base.position, velocity * 0.2f, 17);
20207 }
20208 for (float num88 = 0f; num88 < 3f; num88 += 1f)
20209 {
20210 Vector2 vector13 = base.Center + new Vector2(0f, 12f * scale).RotatedBy(base.position.Y / 200f + num88 * ((float)Math.PI * 2f) + rotation) - velocity * 0.5f;
20211 Dust dust5 = Dust.NewDustPerfect(vector13, 267, velocity * 0.2f * num88, 0, Color.Blue);
20212 dust5.noLight = true;
20213 dust5.noGravity = true;
20214 dust5 = Dust.NewDustPerfect(vector13, 267, velocity * 0.2f * num88, 0, Color.White, 0.4f);
20215 dust5.noLight = true;
20216 dust5.noGravity = true;
20217 }
20218 }
20219 }
20220 else if (type == 9)
20221 {
20222 Vector2 vector14 = new Vector2(Main.screenWidth, Main.screenHeight);
20223 if (base.Hitbox.Intersects(Utils.CenteredRectangle(Main.screenPosition + vector14 / 2f, vector14 + new Vector2(400f))) && Main.rand.Next(20) == 0)
20224 {
20225 Gore.NewGore(base.position, velocity * 0.2f, Main.rand.Next(16, 18));
20226 }
20227 if (Main.rand.Next(4) == 0)
20228 {
20229 Dust dust6 = Dust.NewDustDirect(base.position, width, height, 86, 0f, 0f, 127);
20230 Dust dust2 = dust6;
20231 dust2.velocity *= 0.7f;
20232 dust6.noGravity = true;
20233 dust2 = dust6;
20234 dust2.velocity += velocity * 0.3f;
20235 if (Main.rand.Next(2) == 0)
20236 {
20237 dust2 = dust6;
20238 dust2.position -= velocity * 4f;
20239 }
20240 }
20241 }
20242 else if (this.ai[1] == 1f || type == 92)
20243 {
20244 light = 0.9f;
20245 if (Main.rand.Next(10) == 0)
20246 {
20247 Dust.NewDust(base.position, width, height, 58, velocity.X * 0.5f, velocity.Y * 0.5f, 150, default(Color), 1.2f);
20248 }
20249 if (Main.rand.Next(20) == 0)
20250 {
20251 Gore.NewGore(base.position, new Vector2(velocity.X * 0.2f, velocity.Y * 0.2f), Main.rand.Next(16, 18));
20252 }
20253 }
20254 }
20255 else if (aiStyle == 6)
20256 {
20257 bool flag3 = type == 1019;
20258 velocity *= 0.95f;
20259 this.ai[0] += 1f;
20260 if (this.ai[0] == 180f)
20261 {
20262 Kill();
20263 }
20264 if (this.ai[1] == 0f)
20265 {
20266 this.ai[1] = 1f;
20267 int num89 = 10 + type;
20268 int num90 = 30;
20269 if (type == 463)
20270 {
20271 num89 = 231;
20272 }
20273 if (flag3)
20274 {
20275 num89 = 0;
20276 num90 = 40;
20277 }
20278 for (int num91 = 0; num91 < num90; num91++)
20279 {
20280 Dust dust7 = Main.dust[Dust.NewDust(base.position, width, height, num89, velocity.X, velocity.Y, 50)];
20281 if (flag3)
20282 {
20283 dust7.noGravity = num91 % 3 != 0;
20284 if (!dust7.noGravity)
20285 {
20286 Dust dust2 = dust7;
20287 dust2.scale *= 1.25f;
20288 dust2 = dust7;
20289 dust2.velocity /= 2f;
20290 dust7.velocity.Y -= 2.2f;
20291 }
20292 else
20293 {
20294 Dust dust2 = dust7;
20295 dust2.scale *= 1.75f;
20296 dust2 = dust7;
20297 dust2.velocity += velocity * 0.65f;
20298 }
20299 }
20300 }
20301 }
20302 bool flag4 = Main.myPlayer == owner;
20303 if (flag3)
20304 {
20305 flag4 = Main.netMode != 1;
20306 }
20307 if (flag4 && (type == 10 || type == 11 || type == 463 || flag3))
20308 {
20309 int num92 = (int)(base.position.X / 16f) - 1;
20310 int num93 = (int)((base.position.X + (float)width) / 16f) + 2;
20311 int num94 = (int)(base.position.Y / 16f) - 1;
20312 int num95 = (int)((base.position.Y + (float)height) / 16f) + 2;
20313 if (num92 < 0)
20314 {
20315 num92 = 0;
20316 }
20317 if (num93 > Main.maxTilesX)
20318 {
20319 num93 = Main.maxTilesX;
20320 }
20321 if (num94 < 0)
20322 {
20323 num94 = 0;
20324 }
20325 if (num95 > Main.maxTilesY)
20326 {
20327 num95 = Main.maxTilesY;
20328 }
20329 Vector2 vector15 = default(Vector2);
20330 for (int num96 = num92; num96 < num93; num96++)
20331 {
20332 for (int num97 = num94; num97 < num95; num97++)
20333 {
20334 vector15.X = num96 * 16;
20335 vector15.Y = num97 * 16;
20336 if (!(base.position.X + (float)width > vector15.X) || !(base.position.X < vector15.X + 16f) || !(base.position.Y + (float)height > vector15.Y) || !(base.position.Y < vector15.Y + 16f) || !Main.tile[num96, num97].active())
20337 {
20338 continue;
20339 }
20340 if (type == 10)
20341 {
20342 if (Main.tile[num96, num97].type == 23 || Main.tile[num96, num97].type == 199)
20343 {
20344 Main.tile[num96, num97].type = 2;
20345 WorldGen.SquareTileFrame(num96, num97);
20346 if (Main.netMode == 1)
20347 {
20348 NetMessage.SendTileSquare(-1, num96, num97);
20349 }
20350 }
20351 if (Main.tile[num96, num97].type == 25 || Main.tile[num96, num97].type == 203)
20352 {
20353 Main.tile[num96, num97].type = 1;
20354 WorldGen.SquareTileFrame(num96, num97);
20355 if (Main.netMode == 1)
20356 {
20357 NetMessage.SendTileSquare(-1, num96, num97);
20358 }
20359 }
20360 if (Main.tile[num96, num97].type == 112 || Main.tile[num96, num97].type == 234)
20361 {
20362 Main.tile[num96, num97].type = 53;
20363 WorldGen.SquareTileFrame(num96, num97);
20364 if (Main.netMode == 1)
20365 {
20366 NetMessage.SendTileSquare(-1, num96, num97);
20367 }
20368 }
20369 if (Main.tile[num96, num97].type == 163 || Main.tile[num96, num97].type == 200)
20370 {
20371 Main.tile[num96, num97].type = 161;
20372 WorldGen.SquareTileFrame(num96, num97);
20373 if (Main.netMode == 1)
20374 {
20375 NetMessage.SendTileSquare(-1, num96, num97);
20376 }
20377 }
20378 if (Main.tile[num96, num97].type == 400 || Main.tile[num96, num97].type == 401)
20379 {
20380 Main.tile[num96, num97].type = 396;
20381 WorldGen.SquareTileFrame(num96, num97);
20382 if (Main.netMode == 1)
20383 {
20384 NetMessage.SendTileSquare(-1, num96, num97);
20385 }
20386 }
20387 if (Main.tile[num96, num97].type == 398 || Main.tile[num96, num97].type == 399)
20388 {
20389 Main.tile[num96, num97].type = 397;
20390 WorldGen.SquareTileFrame(num96, num97);
20391 if (Main.netMode == 1)
20392 {
20393 NetMessage.SendTileSquare(-1, num96, num97);
20394 }
20395 }
20396 if (Main.tile[num96, num97].type == 661 || Main.tile[num96, num97].type == 662)
20397 {
20398 Main.tile[num96, num97].type = 60;
20399 WorldGen.SquareTileFrame(num96, num97);
20400 if (Main.netMode == 1)
20401 {
20402 NetMessage.SendTileSquare(-1, num96, num97);
20403 }
20404 }
20405 }
20406 if (type == 11 || type == 463)
20407 {
20408 if (type == 11)
20409 {
20410 WorldGen.Convert(num96, num97, 1, 1);
20411 }
20412 if (type == 463)
20413 {
20414 WorldGen.Convert(num96, num97, 4, 1);
20415 }
20416 }
20417 if (!flag3)
20418 {
20419 continue;
20420 }
20421 Tile tile = Main.tile[num96, num97];
20422 if (tile.type >= 0 && tile.type < TileID.Count && TileID.Sets.CommonSapling[tile.type])
20423 {
20424 if (Main.remixWorld && num97 >= (int)Main.worldSurface - 1 && num97 < Main.maxTilesY - 20)
20425 {
20426 WorldGen.AttemptToGrowTreeFromSapling(num96, num97, underground: false);
20427 }
20428 WorldGen.AttemptToGrowTreeFromSapling(num96, num97, num97 > (int)Main.worldSurface - 1);
20429 }
20430 }
20431 }
20432 }
20433 if (flag3 && velocity.Length() < 0.5f)
20434 {
20435 Kill();
20436 }
20437 }
20438 else if (aiStyle == 7)
20439 {
20441 }
20442 else if (aiStyle == 8)
20443 {
20444 if (type == 258 && localAI[0] == 0f)
20445 {
20446 localAI[0] = 1f;
20448 }
20449 if (type == 96 && localAI[0] == 0f)
20450 {
20451 localAI[0] = 1f;
20453 }
20454 if (type == 27)
20455 {
20456 for (int num98 = 0; num98 < 5; num98++)
20457 {
20458 float num99 = velocity.X / 3f * (float)num98;
20459 float num100 = velocity.Y / 3f * (float)num98;
20460 int num101 = 4;
20461 int num102 = Dust.NewDust(new Vector2(base.position.X + (float)num101, base.position.Y + (float)num101), width - num101 * 2, height - num101 * 2, 172, 0f, 0f, 100, default(Color), 1.2f);
20462 Main.dust[num102].noGravity = true;
20463 Dust dust2 = Main.dust[num102];
20464 dust2.velocity *= 0.1f;
20465 dust2 = Main.dust[num102];
20466 dust2.velocity += velocity * 0.1f;
20467 Main.dust[num102].position.X -= num99;
20468 Main.dust[num102].position.Y -= num100;
20469 }
20470 if (Main.rand.Next(5) == 0)
20471 {
20472 int num103 = 4;
20473 int num104 = Dust.NewDust(new Vector2(base.position.X + (float)num103, base.position.Y + (float)num103), width - num103 * 2, height - num103 * 2, 172, 0f, 0f, 100, default(Color), 0.6f);
20474 Dust dust2 = Main.dust[num104];
20475 dust2.velocity *= 0.25f;
20476 dust2 = Main.dust[num104];
20477 dust2.velocity += velocity * 0.5f;
20478 }
20479 }
20480 else if (type == 502)
20481 {
20482 float num105 = (float)Main.DiscoR / 255f;
20483 float num106 = (float)Main.DiscoG / 255f;
20484 float num107 = (float)Main.DiscoB / 255f;
20485 num105 = (0.5f + num105) / 2f;
20486 num106 = (0.5f + num106) / 2f;
20487 num107 = (0.5f + num107) / 2f;
20488 Lighting.AddLight(base.Center, num105, num106, num107);
20489 }
20490 else if (type == 95 || type == 96)
20491 {
20492 int num108 = Dust.NewDust(new Vector2(base.position.X + velocity.X, base.position.Y + velocity.Y), width, height, 75, velocity.X, velocity.Y, 100, default(Color), 3f * scale);
20493 Main.dust[num108].noGravity = true;
20494 }
20495 else if (type == 253)
20496 {
20497 for (int num109 = 0; num109 < 2; num109++)
20498 {
20499 int num110 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 135, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
20500 Main.dust[num110].noGravity = true;
20501 Main.dust[num110].velocity.X *= 0.3f;
20502 Main.dust[num110].velocity.Y *= 0.3f;
20503 }
20504 }
20505 else
20506 {
20507 for (int num111 = 0; num111 < 2; num111++)
20508 {
20509 int num112 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
20510 if (type == 258 && Main.getGoodWorld)
20511 {
20512 Main.dust[num112].noLight = true;
20513 }
20514 Main.dust[num112].noGravity = true;
20515 Main.dust[num112].velocity.X *= 0.3f;
20516 Main.dust[num112].velocity.Y *= 0.3f;
20517 }
20518 }
20519 if (type != 27 && type != 96 && type != 258)
20520 {
20521 this.ai[1] += 1f;
20522 }
20523 if (this.ai[1] >= 20f)
20524 {
20525 velocity.Y += 0.2f;
20526 }
20527 if (type == 502)
20528 {
20529 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
20530 if (velocity.X != 0f)
20531 {
20533 }
20534 }
20535 else
20536 {
20537 rotation += 0.3f * (float)direction;
20538 }
20539 if (velocity.Y > 16f)
20540 {
20541 velocity.Y = 16f;
20542 }
20543 }
20544 else if (aiStyle == 9)
20545 {
20547 }
20548 else if (aiStyle == 10)
20549 {
20550 AI_010();
20551 }
20552 else if (aiStyle == 11)
20553 {
20554 bool flag5 = type == 72 || type == 86 || type == 87;
20555 if (flag5)
20556 {
20557 if (velocity.X > 0f)
20558 {
20559 spriteDirection = -1;
20560 }
20561 else if (velocity.X < 0f)
20562 {
20563 spriteDirection = 1;
20564 }
20565 rotation = velocity.X * 0.1f;
20566 frameCounter++;
20567 if (frameCounter >= 4)
20568 {
20569 frame++;
20570 frameCounter = 0;
20571 }
20572 if (frame >= 4)
20573 {
20574 frame = 0;
20575 }
20576 if (Main.rand.Next(6) == 0)
20577 {
20578 int num113 = 56;
20579 if (type == 86)
20580 {
20581 num113 = 73;
20582 }
20583 else if (type == 87)
20584 {
20585 num113 = 74;
20586 }
20587 int num114 = Dust.NewDust(base.position, width, height, num113, 0f, 0f, 200, default(Color), 0.8f);
20588 Dust dust2 = Main.dust[num114];
20589 dust2.velocity *= 0.3f;
20590 Main.dust[num114].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cLight, Main.player[owner]);
20591 }
20592 }
20593 else
20594 {
20595 rotation += 0.02f;
20596 }
20597 if (type == 72)
20598 {
20599 if (Main.player[owner].blueFairy)
20600 {
20601 timeLeft = 2;
20602 }
20603 }
20604 else if (type == 86)
20605 {
20606 if (Main.player[owner].redFairy)
20607 {
20608 timeLeft = 2;
20609 }
20610 }
20611 else if (type == 87)
20612 {
20613 if (Main.player[owner].greenFairy)
20614 {
20615 timeLeft = 2;
20616 }
20617 }
20618 else if (type == 18 && Main.player[owner].lightOrb)
20619 {
20620 timeLeft = 2;
20621 }
20622 if (!Main.player[owner].dead)
20623 {
20624 float num115 = 3f;
20625 if (flag5)
20626 {
20627 num115 = 6f;
20628 }
20629 Vector2 vector16 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
20630 float num116 = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - vector16.X;
20631 float num117 = Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - vector16.Y;
20632 int num118 = 800;
20633 int num119 = 70;
20634 if (type == 18)
20635 {
20636 if (Main.player[owner].controlUp)
20637 {
20638 num117 = Main.player[owner].position.Y - 40f - vector16.Y;
20639 num116 -= 6f;
20640 num119 = 4;
20641 }
20642 else if (Main.player[owner].controlDown)
20643 {
20644 num117 = Main.player[owner].position.Y + (float)Main.player[owner].height + 40f - vector16.Y;
20645 num116 -= 6f;
20646 num119 = 4;
20647 }
20648 }
20649 if (flag5)
20650 {
20651 num119 = 50;
20652 }
20653 float num120 = (float)Math.Sqrt(num116 * num116 + num117 * num117);
20654 num120 = (float)Math.Sqrt(num116 * num116 + num117 * num117);
20655 if (num120 > (float)num118)
20656 {
20657 base.position.X = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - (float)(width / 2);
20658 base.position.Y = Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - (float)(height / 2);
20659 }
20660 else if (num120 > (float)num119)
20661 {
20662 float num121 = num120 - (float)num119;
20663 num120 = num115 / num120;
20664 num116 *= num120;
20665 num117 *= num120;
20666 velocity.X = num116;
20667 velocity.Y = num117;
20668 if (flag5 && velocity.Length() > num121)
20669 {
20670 velocity = velocity.SafeNormalize(Vector2.Zero) * num121;
20671 }
20672 }
20673 else
20674 {
20675 velocity.X = (velocity.Y = 0f);
20676 }
20677 }
20678 else
20679 {
20680 Kill();
20681 }
20682 }
20683 else if (aiStyle == 12)
20684 {
20685 if (type == 288 && localAI[0] == 0f)
20686 {
20687 localAI[0] = 1f;
20689 }
20690 if (type == 280 || type == 288)
20691 {
20692 scale -= 0.002f;
20693 if (scale <= 0f)
20694 {
20695 Kill();
20696 }
20697 if (type == 288)
20698 {
20699 this.ai[0] = 4f;
20700 }
20701 if (this.ai[0] > 3f)
20702 {
20703 velocity.Y += 0.075f;
20704 for (int num122 = 0; num122 < 3; num122++)
20705 {
20706 float num123 = velocity.X / 3f * (float)num122;
20707 float num124 = velocity.Y / 3f * (float)num122;
20708 int num125 = 14;
20709 int num126 = Dust.NewDust(new Vector2(base.position.X + (float)num125, base.position.Y + (float)num125), width - num125 * 2, height - num125 * 2, 170, 0f, 0f, 100);
20710 Main.dust[num126].noGravity = true;
20711 Dust dust2 = Main.dust[num126];
20712 dust2.velocity *= 0.1f;
20713 dust2 = Main.dust[num126];
20714 dust2.velocity += velocity * 0.5f;
20715 Main.dust[num126].position.X -= num123;
20716 Main.dust[num126].position.Y -= num124;
20717 }
20718 if (Main.rand.Next(8) == 0)
20719 {
20720 int num127 = 16;
20721 int num128 = Dust.NewDust(new Vector2(base.position.X + (float)num127, base.position.Y + (float)num127), width - num127 * 2, height - num127 * 2, 170, 0f, 0f, 100, default(Color), 0.5f);
20722 Dust dust2 = Main.dust[num128];
20723 dust2.velocity *= 0.25f;
20724 dust2 = Main.dust[num128];
20725 dust2.velocity += velocity * 0.5f;
20726 }
20727 }
20728 else
20729 {
20730 this.ai[0] += 1f;
20731 }
20732 return;
20733 }
20734 float num129 = 0.02f;
20735 float num130 = 0.2f;
20736 if (type == 22)
20737 {
20738 num129 = 0.01f;
20739 num130 = 0.15f;
20740 }
20741 scale -= num129;
20742 if (scale <= 0f)
20743 {
20744 Kill();
20745 }
20746 if (this.ai[0] > 3f)
20747 {
20748 velocity.Y += num130;
20749 for (int num131 = 0; num131 < 1; num131++)
20750 {
20751 for (int num132 = 0; num132 < 3; num132++)
20752 {
20753 float num133 = velocity.X / 3f * (float)num132;
20754 float num134 = velocity.Y / 3f * (float)num132;
20755 int num135 = 6;
20756 int num136 = Dust.NewDust(new Vector2(base.position.X + (float)num135, base.position.Y + (float)num135), width - num135 * 2, height - num135 * 2, 172, 0f, 0f, 100, default(Color), 1.2f);
20757 Main.dust[num136].noGravity = true;
20758 Dust dust2 = Main.dust[num136];
20759 dust2.velocity *= 0.3f;
20760 dust2 = Main.dust[num136];
20761 dust2.velocity += velocity * 0.5f;
20762 Main.dust[num136].position.X -= num133;
20763 Main.dust[num136].position.Y -= num134;
20764 }
20765 if (Main.rand.Next(8) == 0)
20766 {
20767 int num137 = 6;
20768 int num138 = Dust.NewDust(new Vector2(base.position.X + (float)num137, base.position.Y + (float)num137), width - num137 * 2, height - num137 * 2, 172, 0f, 0f, 100, default(Color), 0.75f);
20769 Dust dust2 = Main.dust[num138];
20770 dust2.velocity *= 0.5f;
20771 dust2 = Main.dust[num138];
20772 dust2.velocity += velocity * 0.5f;
20773 }
20774 }
20775 }
20776 else
20777 {
20778 this.ai[0] += 1f;
20779 }
20780 }
20781 else if (aiStyle == 13)
20782 {
20783 bool flag6 = Main.player[owner].dead;
20784 if (!flag6)
20785 {
20786 float num139 = (Main.player[owner].Center - base.Center).Length();
20787 flag6 = num139 > 2000f;
20788 }
20789 if (flag6)
20790 {
20791 Kill();
20792 return;
20793 }
20794 if (type != 481)
20795 {
20796 int dummyItemTime = 5;
20797 Main.player[owner].SetDummyItemTime(dummyItemTime);
20798 }
20799 if (alpha == 0)
20800 {
20801 if (base.position.X + (float)(width / 2) > Main.player[owner].position.X + (float)(Main.player[owner].width / 2))
20802 {
20803 Main.player[owner].ChangeDir(1);
20804 }
20805 else
20806 {
20807 Main.player[owner].ChangeDir(-1);
20808 }
20809 }
20810 if (type == 481)
20811 {
20812 if (this.ai[0] == 0f)
20813 {
20814 extraUpdates = 1;
20815 }
20816 else
20817 {
20818 extraUpdates = 2;
20819 }
20820 }
20821 Vector2 vector17 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
20822 float num140 = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - vector17.X;
20823 float num141 = Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - vector17.Y;
20824 float num142 = (float)Math.Sqrt(num140 * num140 + num141 * num141);
20825 if (this.ai[0] == 0f)
20826 {
20827 if (num142 > 700f)
20828 {
20829 this.ai[0] = 1f;
20830 }
20831 else if (type == 262 && num142 > 500f)
20832 {
20833 this.ai[0] = 1f;
20834 }
20835 else if (type == 271 && num142 > 200f)
20836 {
20837 this.ai[0] = 1f;
20838 }
20839 else if (type == 273 && (Main.remixWorld ? (num142 > 300f) : (num142 > 150f)))
20840 {
20841 this.ai[0] = 1f;
20842 }
20843 else if (type == 481 && num142 > 525f)
20844 {
20845 this.ai[0] = 1f;
20846 }
20847 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
20848 this.ai[1] += 1f;
20849 if (this.ai[1] > 5f)
20850 {
20851 alpha = 0;
20852 }
20853 if (type == 262 && this.ai[1] > 8f)
20854 {
20855 this.ai[1] = 8f;
20856 }
20857 if (type == 271 && this.ai[1] > 8f)
20858 {
20859 this.ai[1] = 8f;
20860 }
20861 if (type == 273 && this.ai[1] > 8f)
20862 {
20863 this.ai[1] = 8f;
20864 }
20865 if (type == 481 && this.ai[1] > 8f)
20866 {
20867 this.ai[1] = 8f;
20868 }
20869 if (type == 404 && this.ai[1] > 8f)
20870 {
20871 this.ai[1] = 0f;
20872 }
20873 if (this.ai[1] >= 10f)
20874 {
20875 this.ai[1] = 15f;
20876 velocity.Y += 0.3f;
20877 }
20878 if (type == 262 && velocity.X < 0f)
20879 {
20880 spriteDirection = -1;
20881 }
20882 else if (type == 262)
20883 {
20884 spriteDirection = 1;
20885 }
20886 if (type == 271 && velocity.X < 0f)
20887 {
20888 spriteDirection = -1;
20889 }
20890 else if (type == 271)
20891 {
20892 spriteDirection = 1;
20893 }
20894 }
20895 else if (this.ai[0] == 1f)
20896 {
20897 tileCollide = false;
20898 rotation = (float)Math.Atan2(num141, num140) - 1.57f;
20899 float num143 = 20f;
20900 if (type == 262)
20901 {
20902 num143 = 30f;
20903 }
20904 if (num142 < 50f)
20905 {
20906 Kill();
20907 }
20908 num142 = num143 / num142;
20909 num140 *= num142;
20910 num141 *= num142;
20911 velocity.X = num140;
20912 velocity.Y = num141;
20913 if (type == 262 && velocity.X < 0f)
20914 {
20915 spriteDirection = 1;
20916 }
20917 else if (type == 262)
20918 {
20919 spriteDirection = -1;
20920 }
20921 if (type == 271 && velocity.X < 0f)
20922 {
20923 spriteDirection = 1;
20924 }
20925 else if (type == 271)
20926 {
20927 spriteDirection = -1;
20928 }
20929 }
20930 }
20931 else if (aiStyle == 14)
20932 {
20933 if (type == 870 && this.ai[1] > 0f)
20934 {
20935 aiStyle = 170;
20936 }
20937 if (type == 473 && Main.netMode != 2)
20938 {
20939 localAI[0] += 1f;
20940 if (localAI[0] >= 10f)
20941 {
20942 localAI[0] = 0f;
20943 int num144 = 30;
20944 if ((base.Center - Main.player[Main.myPlayer].Center).Length() < (float)(Main.screenWidth + num144 * 16))
20945 {
20946 Main.instance.SpelunkerProjectileHelper.AddSpotToCheck(base.Center);
20947 }
20948 }
20949 }
20950 if (type == 352)
20951 {
20952 if (localAI[1] == 0f)
20953 {
20954 localAI[1] = 1f;
20955 }
20956 alpha += (int)(25f * localAI[1]);
20957 if (alpha <= 0)
20958 {
20959 alpha = 0;
20960 localAI[1] = 1f;
20961 }
20962 else if (alpha >= 255)
20963 {
20964 alpha = 255;
20965 localAI[1] = -1f;
20966 }
20967 scale += localAI[1] * 0.01f;
20968 }
20969 if (type == 346)
20970 {
20971 if (localAI[0] == 0f)
20972 {
20973 localAI[0] = 1f;
20975 }
20976 frame = (int)this.ai[1];
20977 if (frame == 0)
20978 {
20979 Lighting.AddLight(base.Center, 0.25f, 0.2f, 0f);
20980 }
20981 else
20982 {
20983 Lighting.AddLight(base.Center, 0.15f, 0.15f, 0.15f);
20984 }
20985 if (owner == Main.myPlayer && timeLeft == 1)
20986 {
20987 for (int num145 = 0; num145 < 5; num145++)
20988 {
20989 float num146 = 10f;
20990 Vector2 vector18 = new Vector2(base.Center.X, base.Center.Y);
20991 float num147 = Main.rand.Next(-20, 21);
20992 float num148 = Main.rand.Next(-20, 0);
20993 float num149 = (float)Math.Sqrt(num147 * num147 + num148 * num148);
20994 num149 = num146 / num149;
20995 num147 *= num149;
20996 num148 *= num149;
20997 num147 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
20998 num148 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
20999 int num150 = NewProjectile(GetProjectileSource_FromThis(), vector18.X, vector18.Y, num147, num148, 347, 40, 0f, Main.myPlayer, 0f, this.ai[1]);
21000 }
21001 }
21002 }
21003 if (type == 196)
21004 {
21005 int num151 = Main.rand.Next(1, 3);
21006 for (int num152 = 0; num152 < num151; num152++)
21007 {
21008 int num153 = Dust.NewDust(base.position, width, height, 31, 0f, 0f, 100);
21009 Dust dust2 = Main.dust[num153];
21010 dust2.alpha += Main.rand.Next(100);
21011 dust2 = Main.dust[num153];
21012 dust2.velocity *= 0.3f;
21013 Main.dust[num153].velocity.X += (float)Main.rand.Next(-10, 11) * 0.025f;
21014 Main.dust[num153].velocity.Y -= 0.4f + (float)Main.rand.Next(-3, 14) * 0.15f;
21015 Main.dust[num153].fadeIn = 1.25f + (float)Main.rand.Next(20) * 0.15f;
21016 }
21017 }
21018 if (type == 53)
21019 {
21020 try
21021 {
21022 int num154 = (int)(base.position.X / 16f) - 1;
21023 int num155 = (int)((base.position.X + (float)width) / 16f) + 2;
21024 int num156 = (int)(base.position.Y / 16f) - 1;
21025 int num157 = (int)((base.position.Y + (float)height) / 16f) + 2;
21026 if (num154 < 0)
21027 {
21028 num154 = 0;
21029 }
21030 if (num155 > Main.maxTilesX)
21031 {
21032 num155 = Main.maxTilesX;
21033 }
21034 if (num156 < 0)
21035 {
21036 num156 = 0;
21037 }
21038 if (num157 > Main.maxTilesY)
21039 {
21040 num157 = Main.maxTilesY;
21041 }
21042 Vector2 vector19 = default(Vector2);
21043 for (int num158 = num154; num158 < num155; num158++)
21044 {
21045 for (int num159 = num156; num159 < num157; num159++)
21046 {
21047 if (Main.tile[num158, num159] != null && Main.tile[num158, num159].nactive() && Main.tileSolid[Main.tile[num158, num159].type] && !Main.tileSolidTop[Main.tile[num158, num159].type])
21048 {
21049 vector19.X = num158 * 16;
21050 vector19.Y = num159 * 16;
21051 if (base.position.X + (float)width > vector19.X && base.position.X < vector19.X + 16f && base.position.Y + (float)height > vector19.Y && base.position.Y < vector19.Y + 16f)
21052 {
21053 velocity.X = 0f;
21054 velocity.Y = -0.2f;
21055 }
21056 }
21057 }
21058 }
21059 }
21060 catch
21061 {
21062 }
21063 }
21064 if (type == 277)
21065 {
21066 if (alpha > 0)
21067 {
21068 alpha -= 30;
21069 if (alpha < 0)
21070 {
21071 alpha = 0;
21072 }
21073 }
21074 if (Main.expertMode)
21075 {
21076 float num160 = 12f;
21077 int num161 = Player.FindClosest(base.Center, 1, 1);
21078 Vector2 vector20 = Main.player[num161].Center - base.Center;
21079 vector20.Normalize();
21080 vector20 *= num160;
21081 int num162 = 200;
21082 velocity.X = (velocity.X * (float)(num162 - 1) + vector20.X) / (float)num162;
21083 if (velocity.Length() > 16f)
21084 {
21086 velocity *= 16f;
21087 }
21088 }
21089 }
21090 if (type == 261)
21091 {
21092 if (localAI[1] == 0f)
21093 {
21094 localAI[1] = 1f;
21095 localAI[0] = 80f;
21096 }
21097 rotation += velocity.X * 0.05f;
21098 if (velocity.Y != 0f)
21099 {
21100 rotation += (float)spriteDirection * 0.01f;
21101 }
21102 this.ai[0]++;
21103 if (this.ai[0] > 15f)
21104 {
21105 if (velocity.Y == 0f && velocity.X != 0f)
21106 {
21107 velocity.X *= 0.97f;
21108 Math.Abs(velocity.X);
21109 _ = 2f;
21110 if (Math.Abs(velocity.X) <= 0.01f)
21111 {
21112 Kill();
21113 }
21114 }
21115 this.ai[0] = 15f;
21116 velocity.Y += 0.2f;
21117 }
21118 if (localAI[0] > 0f)
21119 {
21120 localAI[0]--;
21121 int num163 = 5;
21122 int maxValue = num163;
21123 if (localAI[0] < 20f)
21124 {
21126 }
21127 if (localAI[0] < 10f)
21128 {
21130 }
21131 if (Main.rand.Next(maxValue) == 0)
21132 {
21133 Dust dust8 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(width / 2, height / 2), 31);
21134 Dust dust2 = dust8;
21135 dust2.velocity *= 0.33f;
21136 dust8.scale = 0.7f;
21137 }
21138 if (Main.rand.Next(maxValue) == 0)
21139 {
21140 Dust dust9 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(width / 2, height / 2), 228, Main.rand.NextVector2Circular(3f, 3f));
21141 dust9.scale = 0.6f;
21142 Dust dust2 = dust9;
21143 dust2.velocity *= 0.33f;
21144 }
21145 }
21146 }
21147 else if (type == 277)
21148 {
21149 this.ai[0] += 1f;
21150 if (this.ai[0] > 15f)
21151 {
21152 this.ai[0] = 15f;
21153 if (velocity.Y == 0f && velocity.X != 0f)
21154 {
21155 velocity.X *= 0.97f;
21156 if ((double)velocity.X > -0.01 && (double)velocity.X < 0.01)
21157 {
21158 Kill();
21159 }
21160 }
21161 velocity.Y += 0.2f;
21162 }
21163 rotation += velocity.X * 0.05f;
21164 }
21165 else if (type == 378)
21166 {
21167 if (localAI[0] == 0f)
21168 {
21170 localAI[0] += 1f;
21171 }
21172 Rectangle rectangle2 = new Rectangle((int)base.position.X, (int)base.position.Y, width, height);
21173 for (int num164 = 0; num164 < 200; num164++)
21174 {
21175 if (Main.npc[num164].CanBeChasedBy(this, ignoreDontTakeDamage: true))
21176 {
21177 Rectangle value2 = new Rectangle((int)Main.npc[num164].position.X, (int)Main.npc[num164].position.Y, Main.npc[num164].width, Main.npc[num164].height);
21178 if (rectangle2.Intersects(value2))
21179 {
21180 Kill();
21181 return;
21182 }
21183 }
21184 }
21185 this.ai[0] += 1f;
21186 if (this.ai[0] > 10f)
21187 {
21188 this.ai[0] = 90f;
21189 if (velocity.Y == 0f && velocity.X != 0f)
21190 {
21191 velocity.X *= 0.96f;
21192 if ((double)velocity.X > -0.01 && (double)velocity.X < 0.01)
21193 {
21194 Kill();
21195 }
21196 }
21197 velocity.Y += 0.2f;
21198 }
21199 rotation += velocity.X * 0.1f;
21200 }
21201 else if (type == 483)
21202 {
21203 this.ai[0] += 1f;
21204 if (this.ai[0] > 5f)
21205 {
21206 if (owner == Main.myPlayer && this.ai[0] > (float)Main.rand.Next(20, 130))
21207 {
21208 Kill();
21209 }
21210 if (velocity.Y == 0f && velocity.X != 0f)
21211 {
21212 velocity.X *= 0.97f;
21213 if ((double)velocity.X > -0.01 && (double)velocity.X < 0.01)
21214 {
21215 velocity.X = 0f;
21216 netUpdate = true;
21217 }
21218 }
21219 velocity.Y += 0.3f;
21220 velocity.X *= 0.99f;
21221 }
21222 rotation += velocity.X * 0.05f;
21223 }
21224 else if (type == 538)
21225 {
21226 this.ai[0] += 1f;
21227 if (this.ai[0] > 60f || velocity.Y >= 0f)
21228 {
21229 alpha += 6;
21230 velocity *= 0.5f;
21231 }
21232 else if (this.ai[0] > 5f)
21233 {
21234 velocity.Y += 0.1f;
21235 velocity.X *= 1.025f;
21236 alpha -= 23;
21237 scale = 0.8f * (255f - (float)alpha) / 255f;
21238 if (alpha < 0)
21239 {
21240 alpha = 0;
21241 }
21242 }
21243 if (alpha >= 255 && this.ai[0] > 5f)
21244 {
21245 Kill();
21246 return;
21247 }
21248 }
21249 else
21250 {
21251 this.ai[0] += 1f;
21252 if (this.ai[0] > 5f)
21253 {
21254 this.ai[0] = 5f;
21255 if (velocity.Y == 0f && velocity.X != 0f)
21256 {
21257 velocity.X *= 0.97f;
21258 if ((double)velocity.X > -0.01 && (double)velocity.X < 0.01)
21259 {
21260 velocity.X = 0f;
21261 netUpdate = true;
21262 }
21263 }
21264 velocity.Y += 0.2f;
21265 }
21266 rotation += velocity.X * 0.1f;
21267 }
21268 if (type == 538)
21269 {
21270 if (localAI[1] == 0f)
21271 {
21272 localAI[1] = 1f;
21273 SoundEngine.PlaySound(4, (int)base.position.X, (int)base.position.Y, 7);
21274 }
21275 if (velocity.Y < 0f && this.ai[0] < 60f)
21276 {
21277 if (Main.rand.Next(4) == 0)
21278 {
21279 int num165 = Dust.NewDust(base.position, width, height, 180, 0f, 0f, 100);
21280 Main.dust[num165].position = base.Center;
21281 Dust dust2 = Main.dust[num165];
21282 dust2.scale += (float)Main.rand.Next(50) * 0.01f;
21283 Main.dust[num165].noGravity = true;
21284 Main.dust[num165].velocity.Y -= 2f;
21285 }
21286 if (Main.rand.Next(6) == 0)
21287 {
21288 int num166 = Dust.NewDust(base.position, width, height, 176, 0f, 0f, 100);
21289 Main.dust[num166].position = base.Center;
21290 Dust dust2 = Main.dust[num166];
21291 dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f;
21292 Main.dust[num166].noGravity = true;
21293 dust2 = Main.dust[num166];
21294 dust2.velocity *= 0.1f;
21295 }
21296 }
21297 }
21298 if (type == 450)
21299 {
21300 if (this.ai[1] == 0f)
21301 {
21302 this.ai[1] = 1f;
21304 }
21305 if (Main.rand.Next(2) == 0)
21306 {
21307 int num167 = Dust.NewDust(base.position, width, height, 228, 0f, 0f, 100);
21308 Main.dust[num167].position.X -= 2f;
21309 Main.dust[num167].position.Y += 2f;
21310 Dust dust2 = Main.dust[num167];
21311 dust2.scale += (float)Main.rand.Next(50) * 0.01f;
21312 Main.dust[num167].noGravity = true;
21313 Main.dust[num167].velocity.Y -= 2f;
21314 }
21315 if (Main.rand.Next(4) == 0)
21316 {
21317 int num168 = Dust.NewDust(base.position, width, height, 228, 0f, 0f, 100);
21318 Main.dust[num168].position.X -= 2f;
21319 Main.dust[num168].position.Y += 2f;
21320 Dust dust2 = Main.dust[num168];
21321 dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f;
21322 Main.dust[num168].noGravity = true;
21323 dust2 = Main.dust[num168];
21324 dust2.velocity *= 0.1f;
21325 }
21326 if (++frameCounter >= 3)
21327 {
21328 frameCounter = 0;
21329 if (++frame >= 5)
21330 {
21331 frame = 0;
21332 }
21333 }
21334 if ((double)velocity.Y < 0.25 && (double)velocity.Y > 0.15)
21335 {
21336 velocity.X *= 0.8f;
21337 }
21338 rotation = (0f - velocity.X) * 0.05f;
21339 }
21340 if (type == 480)
21341 {
21342 alpha = 255;
21343 int num169 = Dust.NewDust(base.position, width, height, 75, 0f, 0f, 100);
21344 Main.dust[num169].position.X -= 2f;
21345 Main.dust[num169].position.Y += 2f;
21346 Dust dust2 = Main.dust[num169];
21347 dust2.scale += (float)Main.rand.Next(50) * 0.01f;
21348 Main.dust[num169].noGravity = true;
21349 Main.dust[num169].velocity.Y -= 2f;
21350 if (Main.rand.Next(2) == 0)
21351 {
21352 int num170 = Dust.NewDust(base.position, width, height, 75, 0f, 0f, 100);
21353 Main.dust[num170].position.X -= 2f;
21354 Main.dust[num170].position.Y += 2f;
21355 dust2 = Main.dust[num170];
21356 dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f;
21357 Main.dust[num170].noGravity = true;
21358 dust2 = Main.dust[num170];
21359 dust2.velocity *= 0.1f;
21360 }
21361 }
21362 if (type >= 326 && type <= 328)
21363 {
21364 if (wet)
21365 {
21366 Kill();
21367 }
21368 if (this.ai[1] == 0f && type >= 326 && type <= 328)
21369 {
21370 this.ai[1] = 1f;
21372 }
21373 if (Main.rand.Next(3) != 0)
21374 {
21375 Dust dust10 = Dust.NewDustDirect(base.position, width, height, 6);
21376 dust10.velocity.Y -= 2f;
21377 dust10.noGravity = true;
21378 Dust dust2 = dust10;
21379 dust2.scale += Main.rand.NextFloat() * 0.8f + 0.3f;
21380 dust2 = dust10;
21381 dust2.velocity += velocity * 1f;
21382 }
21383 if ((double)velocity.Y < 0.25 && (double)velocity.Y > 0.15)
21384 {
21385 velocity.X *= 0.8f;
21386 }
21387 rotation = (0f - velocity.X) * 0.05f;
21388 }
21389 if (type >= 400 && type <= 402)
21390 {
21391 if (wet)
21392 {
21393 Kill();
21394 }
21395 if (this.ai[1] == 0f && type >= 326 && type <= 328)
21396 {
21397 this.ai[1] = 1f;
21399 }
21400 int num171 = Dust.NewDust(base.position, width, height, 6, 0f, 0f, 100);
21401 Main.dust[num171].position.X -= 2f;
21402 Main.dust[num171].position.Y += 2f;
21403 Dust dust2 = Main.dust[num171];
21404 dust2.scale += (float)Main.rand.Next(50) * 0.01f;
21405 Main.dust[num171].noGravity = true;
21406 Main.dust[num171].velocity.Y -= 2f;
21407 if (Main.rand.Next(2) == 0)
21408 {
21409 int num172 = Dust.NewDust(base.position, width, height, 6, 0f, 0f, 100);
21410 Main.dust[num172].position.X -= 2f;
21411 Main.dust[num172].position.Y += 2f;
21412 dust2 = Main.dust[num172];
21413 dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f;
21414 Main.dust[num172].noGravity = true;
21415 dust2 = Main.dust[num172];
21416 dust2.velocity *= 0.1f;
21417 }
21418 if ((double)velocity.Y < 0.25 && (double)velocity.Y > 0.15)
21419 {
21420 velocity.X *= 0.8f;
21421 }
21422 rotation = (0f - velocity.X) * 0.05f;
21423 }
21424 if (velocity.Y > 16f)
21425 {
21426 velocity.Y = 16f;
21427 }
21428 }
21429 else if (aiStyle == 15)
21430 {
21431 AI_015_Flails();
21432 }
21433 else if (aiStyle == 16)
21434 {
21435 AI_016();
21436 }
21437 else if (aiStyle == 17)
21438 {
21439 if (velocity.Y == 0f)
21440 {
21441 velocity.X *= 0.98f;
21442 }
21443 rotation += velocity.X * 0.1f;
21444 velocity.Y += 0.2f;
21445 if (Main.getGoodWorld && Math.Abs(velocity.X) + Math.Abs(velocity.Y) < 1f)
21446 {
21447 damage = 0;
21448 knockBack = 0f;
21449 }
21450 if (owner != Main.myPlayer)
21451 {
21452 return;
21453 }
21454 int num173 = (int)((base.position.X + (float)(width / 2)) / 16f);
21455 int num174 = (int)((base.position.Y + (float)height - 4f) / 16f);
21456 if (Main.tile[num173, num174] == null)
21457 {
21458 return;
21459 }
21460 int style = 0;
21461 if (type >= 201 && type <= 205)
21462 {
21463 style = type - 200;
21464 }
21465 if (type >= 527 && type <= 531)
21466 {
21467 style = type - 527 + 6;
21468 }
21469 bool flag7 = false;
21470 TileObject objectData = default(TileObject);
21471 if (TileObject.CanPlace(num173, num174, 85, style, direction, out objectData))
21472 {
21473 flag7 = TileObject.Place(objectData);
21474 }
21475 if (flag7)
21476 {
21477 NetMessage.SendObjectPlacement(-1, num173, num174, objectData.type, objectData.style, objectData.alternate, objectData.random, direction);
21478 SoundEngine.PlaySound(0, num173 * 16, num174 * 16);
21479 int num175 = Sign.ReadSign(num173, num174);
21480 if (num175 >= 0)
21481 {
21482 Sign.TextSign(num175, miscText);
21483 NetMessage.SendData(47, -1, -1, null, num175, 0f, (int)(byte)new BitsByte(b1: true));
21484 }
21485 Kill();
21486 }
21487 }
21488 else if (aiStyle == 18)
21489 {
21490 if (this.ai[1] == 0f && type == 44)
21491 {
21492 this.ai[1] = 1f;
21494 }
21495 if (type == 263 || type == 274)
21496 {
21497 if (type == 274 && velocity.X < 0f)
21498 {
21499 spriteDirection = -1;
21500 }
21501 rotation += (float)direction * 0.05f;
21502 rotation += (float)direction * 0.5f * ((float)timeLeft / 180f);
21503 if (type == 274)
21504 {
21505 velocity *= 0.96f;
21506 }
21507 else
21508 {
21509 velocity *= 0.95f;
21510 }
21511 return;
21512 }
21513 rotation += (float)direction * 0.8f;
21514 this.ai[0] += 1f;
21515 if (!(this.ai[0] < 30f))
21516 {
21517 if (this.ai[0] < 100f)
21518 {
21519 velocity *= 1.06f;
21520 }
21521 else
21522 {
21523 this.ai[0] = 200f;
21524 }
21525 }
21526 for (int num176 = 0; num176 < 2; num176++)
21527 {
21528 int num177 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 27, 0f, 0f, 100);
21529 Main.dust[num177].noGravity = true;
21530 }
21531 }
21532 else if (aiStyle == 19)
21533 {
21534 AI_019_Spears();
21535 }
21536 else if (aiStyle == 20)
21537 {
21538 timeLeft = 60;
21539 if (type == 252)
21540 {
21541 frameCounter++;
21542 if (frameCounter >= 4)
21543 {
21544 frameCounter = 0;
21545 frame++;
21546 }
21547 if (frame > 3)
21548 {
21549 frame = 0;
21550 }
21551 }
21552 if (type == 509)
21553 {
21554 frameCounter++;
21555 if (frameCounter >= 2)
21556 {
21557 frameCounter = 0;
21558 frame++;
21559 }
21560 if (frame > 1)
21561 {
21562 frame = 0;
21563 }
21564 }
21565 if (soundDelay <= 0)
21566 {
21568 soundDelay = 30;
21569 }
21570 Vector2 vector21 = Main.player[owner].RotatedRelativePoint(Main.player[owner].MountedCenter);
21571 if (Main.myPlayer == owner)
21572 {
21573 if (Main.player[owner].channel)
21574 {
21575 float num178 = Main.player[owner].inventory[Main.player[owner].selectedItem].shootSpeed * scale;
21577 float num179 = (float)Main.mouseX + Main.screenPosition.X - vector22.X;
21578 float num180 = (float)Main.mouseY + Main.screenPosition.Y - vector22.Y;
21579 if (Main.player[owner].gravDir == -1f)
21580 {
21581 num180 = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector22.Y;
21582 }
21583 float num181 = (float)Math.Sqrt(num179 * num179 + num180 * num180);
21584 num181 = (float)Math.Sqrt(num179 * num179 + num180 * num180);
21585 num181 = num178 / num181;
21586 num179 *= num181;
21587 num180 *= num181;
21588 if (num179 != velocity.X || num180 != velocity.Y)
21589 {
21590 netUpdate = true;
21591 }
21592 velocity.X = num179;
21593 velocity.Y = num180;
21594 }
21595 else
21596 {
21597 Kill();
21598 }
21599 }
21600 if (velocity.X > 0f)
21601 {
21602 Main.player[owner].ChangeDir(1);
21603 }
21604 else if (velocity.X < 0f)
21605 {
21606 Main.player[owner].ChangeDir(-1);
21607 }
21609 Main.player[owner].ChangeDir(direction);
21610 Main.player[owner].heldProj = whoAmI;
21611 Main.player[owner].SetDummyItemTime(2);
21612 base.position.X = vector21.X - (float)(width / 2);
21613 base.position.Y = vector21.Y - (float)(height / 2);
21614 rotation = (float)(Math.Atan2(velocity.Y, velocity.X) + 1.5700000524520874);
21615 if (Main.player[owner].direction == 1)
21616 {
21617 Main.player[owner].itemRotation = (float)Math.Atan2(velocity.Y * (float)direction, velocity.X * (float)direction);
21618 }
21619 else
21620 {
21621 Main.player[owner].itemRotation = (float)Math.Atan2(velocity.Y * (float)direction, velocity.X * (float)direction);
21622 }
21623 velocity.X *= 1f + (float)Main.rand.Next(-3, 4) * 0.01f;
21624 if (Main.rand.Next(6) == 0)
21625 {
21626 int num182 = Dust.NewDust(base.position + velocity * Main.rand.Next(6, 10) * 0.1f, width, height, 31, 0f, 0f, 80, default(Color), 1.4f);
21627 Main.dust[num182].position.X -= 4f;
21628 Main.dust[num182].noGravity = true;
21629 Dust dust2 = Main.dust[num182];
21630 dust2.velocity *= 0.2f;
21631 Main.dust[num182].velocity.Y = (float)(-Main.rand.Next(7, 13)) * 0.15f;
21632 }
21633 }
21634 else if (aiStyle == 21)
21635 {
21636 rotation = velocity.X * 0.1f;
21638 if (Main.rand.Next(3) == 0)
21639 {
21640 int num183 = Dust.NewDust(base.position, width, height, 27, 0f, 0f, 80);
21641 Main.dust[num183].noGravity = true;
21642 Dust dust2 = Main.dust[num183];
21643 dust2.velocity *= 0.2f;
21644 }
21645 if (this.ai[1] == 1f)
21646 {
21647 this.ai[1] = 0f;
21648 Main.musicPitch = this.ai[0];
21650 }
21651 }
21652 else if (aiStyle == 22)
21653 {
21654 if (velocity.X == 0f && velocity.Y == 0f)
21655 {
21656 alpha = 255;
21657 }
21658 Dust dust2;
21659 if (this.ai[1] < 0f)
21660 {
21661 if (timeLeft > 60)
21662 {
21663 timeLeft = 60;
21664 }
21665 if (velocity.X > 0f)
21666 {
21667 rotation += 0.3f;
21668 }
21669 else
21670 {
21671 rotation -= 0.3f;
21672 }
21673 int num184 = (int)(base.position.X / 16f) - 1;
21674 int num185 = (int)((base.position.X + (float)width) / 16f) + 2;
21675 int num186 = (int)(base.position.Y / 16f) - 1;
21676 int num187 = (int)((base.position.Y + (float)height) / 16f) + 2;
21677 if (num184 < 0)
21678 {
21679 num184 = 0;
21680 }
21681 if (num185 > Main.maxTilesX)
21682 {
21683 num185 = Main.maxTilesX;
21684 }
21685 if (num186 < 0)
21686 {
21687 num186 = 0;
21688 }
21689 if (num187 > Main.maxTilesY)
21690 {
21691 num187 = Main.maxTilesY;
21692 }
21693 int num188 = (int)base.position.X + 4;
21694 int num189 = (int)base.position.Y + 4;
21695 Vector2 vector23 = default(Vector2);
21696 for (int num190 = num184; num190 < num185; num190++)
21697 {
21698 for (int num191 = num186; num191 < num187; num191++)
21699 {
21700 if (Main.tile[num190, num191] != null && Main.tile[num190, num191].active() && Main.tile[num190, num191].type != 127 && Main.tileSolid[Main.tile[num190, num191].type] && !Main.tileSolidTop[Main.tile[num190, num191].type])
21701 {
21702 vector23.X = num190 * 16;
21703 vector23.Y = num191 * 16;
21704 if ((float)(num188 + 8) > vector23.X && (float)num188 < vector23.X + 16f && (float)(num189 + 8) > vector23.Y && (float)num189 < vector23.Y + 16f)
21705 {
21706 Kill();
21707 }
21708 }
21709 }
21710 }
21711 int num192 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 67);
21712 Main.dust[num192].noGravity = true;
21713 dust2 = Main.dust[num192];
21714 dust2.velocity *= 0.3f;
21715 return;
21716 }
21717 if (this.ai[0] < 0f)
21718 {
21719 if (this.ai[0] == -1f)
21720 {
21721 for (int num193 = 0; num193 < 10; num193++)
21722 {
21723 int num194 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 67, 0f, 0f, 0, default(Color), 1.1f);
21724 Main.dust[num194].noGravity = true;
21725 dust2 = Main.dust[num194];
21726 dust2.velocity *= 1.3f;
21727 }
21728 }
21729 else if (Main.rand.Next(30) == 0)
21730 {
21731 int num195 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 67, 0f, 0f, 100);
21732 dust2 = Main.dust[num195];
21733 dust2.velocity *= 0.2f;
21734 }
21735 int num196 = (int)base.position.X / 16;
21736 int num197 = (int)base.position.Y / 16;
21737 if (Main.tile[num196, num197] == null || !Main.tile[num196, num197].active())
21738 {
21739 Kill();
21740 }
21741 this.ai[0] -= 1f;
21742 if (this.ai[0] <= -900f && (Main.myPlayer == owner || Main.netMode == 2) && Main.tile[num196, num197].active() && Main.tile[num196, num197].type == 127)
21743 {
21744 WorldGen.KillTile(num196, num197);
21745 if (Main.netMode == 1)
21746 {
21747 NetMessage.SendData(17, -1, -1, null, 0, num196, num197);
21748 }
21749 Kill();
21750 }
21751 return;
21752 }
21753 int num198 = (int)(base.position.X / 16f) - 1;
21754 int num199 = (int)((base.position.X + (float)width) / 16f) + 2;
21755 int num200 = (int)(base.position.Y / 16f) - 1;
21756 int num201 = (int)((base.position.Y + (float)height) / 16f) + 2;
21757 if (num198 < 0)
21758 {
21759 num198 = 0;
21760 }
21761 if (num199 > Main.maxTilesX)
21762 {
21763 num199 = Main.maxTilesX;
21764 }
21765 if (num200 < 0)
21766 {
21767 num200 = 0;
21768 }
21769 if (num201 > Main.maxTilesY)
21770 {
21771 num201 = Main.maxTilesY;
21772 }
21773 int num202 = (int)base.position.X + 4;
21774 int num203 = (int)base.position.Y + 4;
21775 Vector2 vector24 = default(Vector2);
21776 for (int num204 = num198; num204 < num199; num204++)
21777 {
21778 for (int num205 = num200; num205 < num201; num205++)
21779 {
21780 if (Main.tile[num204, num205] != null && Main.tile[num204, num205].nactive() && Main.tile[num204, num205].type != 127 && Main.tileSolid[Main.tile[num204, num205].type] && !Main.tileSolidTop[Main.tile[num204, num205].type])
21781 {
21782 vector24.X = num204 * 16;
21783 vector24.Y = num205 * 16;
21784 if ((float)(num202 + 8) > vector24.X && (float)num202 < vector24.X + 16f && (float)(num203 + 8) > vector24.Y && (float)num203 < vector24.Y + 16f)
21785 {
21786 Kill();
21787 }
21788 }
21789 }
21790 }
21791 if (lavaWet)
21792 {
21793 Kill();
21794 }
21795 int num206 = (int)(base.Center.X / 16f);
21796 int num207 = (int)(base.Center.Y / 16f);
21797 if (WorldGen.InWorld(num206, num207) && Main.tile[num206, num207] != null && Main.tile[num206, num207].liquid > 0 && Main.tile[num206, num207].shimmer())
21798 {
21799 Kill();
21800 }
21801 if (!active)
21802 {
21803 return;
21804 }
21805 int num208 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 67);
21806 Main.dust[num208].noGravity = true;
21807 dust2 = Main.dust[num208];
21808 dust2.velocity *= 0.3f;
21809 int num209 = (int)this.ai[0];
21810 int num210 = (int)this.ai[1];
21811 if (WorldGen.InWorld(num209, num210) && WorldGen.SolidTile(num209, num210))
21812 {
21813 if (Math.Abs(velocity.X) > Math.Abs(velocity.Y))
21814 {
21815 if (base.Center.Y < (float)(num210 * 16 + 8) && WorldGen.InWorld(num209, num210 - 1) && !WorldGen.SolidTile(num209, num210 - 1))
21816 {
21817 num210--;
21818 }
21819 else if (WorldGen.InWorld(num209, num210 + 1) && !WorldGen.SolidTile(num209, num210 + 1))
21820 {
21821 num210++;
21822 }
21823 else if (WorldGen.InWorld(num209, num210 - 1) && !WorldGen.SolidTile(num209, num210 - 1))
21824 {
21825 num210--;
21826 }
21827 else if (base.Center.X < (float)(num209 * 16 + 8) && WorldGen.InWorld(num209 - 1, num210) && !WorldGen.SolidTile(num209 - 1, num210))
21828 {
21829 num209--;
21830 }
21831 else if (WorldGen.InWorld(num209 + 1, num210) && !WorldGen.SolidTile(num209 + 1, num210))
21832 {
21833 num209++;
21834 }
21835 else if (WorldGen.InWorld(num209 - 1, num210) && !WorldGen.SolidTile(num209 - 1, num210))
21836 {
21837 num209--;
21838 }
21839 }
21840 else if (base.Center.X < (float)(num209 * 16 + 8) && WorldGen.InWorld(num209 - 1, num210) && !WorldGen.SolidTile(num209 - 1, num210))
21841 {
21842 num209--;
21843 }
21844 else if (WorldGen.InWorld(num209 + 1, num210) && !WorldGen.SolidTile(num209 + 1, num210))
21845 {
21846 num209++;
21847 }
21848 else if (WorldGen.InWorld(num209 - 1, num210) && !WorldGen.SolidTile(num209 - 1, num210))
21849 {
21850 num209--;
21851 }
21852 else if (base.Center.Y < (float)(num210 * 16 + 8) && WorldGen.InWorld(num209, num210 - 1) && !WorldGen.SolidTile(num209, num210 - 1))
21853 {
21854 num210--;
21855 }
21856 else if (WorldGen.InWorld(num209, num210 + 1) && !WorldGen.SolidTile(num209, num210 + 1))
21857 {
21858 num210++;
21859 }
21860 else if (WorldGen.InWorld(num209, num210 - 1) && !WorldGen.SolidTile(num209, num210 - 1))
21861 {
21862 num210--;
21863 }
21864 }
21865 if (velocity.X > 0f)
21866 {
21867 rotation += 0.3f;
21868 }
21869 else
21870 {
21871 rotation -= 0.3f;
21872 }
21873 if (Main.myPlayer != owner)
21874 {
21875 return;
21876 }
21877 int num211 = (int)((base.position.X + (float)(width / 2)) / 16f);
21878 int num212 = (int)((base.position.Y + (float)(height / 2)) / 16f);
21879 bool flag8 = false;
21880 if (num211 == num209 && num212 == num210)
21881 {
21882 flag8 = true;
21883 }
21884 if (((velocity.X <= 0f && num211 <= num209) || (velocity.X >= 0f && num211 >= num209)) && ((velocity.Y <= 0f && num212 <= num210) || (velocity.Y >= 0f && num212 >= num210)))
21885 {
21886 flag8 = true;
21887 }
21888 if (!flag8)
21889 {
21890 return;
21891 }
21892 if (WorldGen.PlaceTile(num209, num210, 127, mute: false, forced: false, owner))
21893 {
21894 if (Main.netMode == 1)
21895 {
21896 NetMessage.SendData(17, -1, -1, null, 1, num209, num210, 127f);
21897 }
21898 damage = 0;
21899 this.ai[0] = -1f;
21900 velocity *= 0f;
21901 alpha = 255;
21902 base.position.X = num209 * 16;
21903 base.position.Y = num210 * 16;
21904 netUpdate = true;
21905 }
21906 else
21907 {
21908 this.ai[1] = -1f;
21909 }
21910 }
21911 else if (aiStyle == 23)
21912 {
21913 if (type == 188)
21914 {
21915 if (this.ai[0] < 8f)
21916 {
21917 this.ai[0] = 8f;
21918 }
21919 localAI[0]++;
21920 }
21921 if (timeLeft > 60)
21922 {
21923 timeLeft = 60;
21924 }
21925 if (this.ai[0] > 7f)
21926 {
21927 float num213 = 1f;
21928 if (this.ai[0] == 8f)
21929 {
21930 num213 = 0.25f;
21931 }
21932 else if (this.ai[0] == 9f)
21933 {
21934 num213 = 0.5f;
21935 }
21936 else if (this.ai[0] == 10f)
21937 {
21938 num213 = 0.75f;
21939 }
21940 this.ai[0] += 1f;
21941 int num214 = 6;
21942 if (type == 101)
21943 {
21944 num214 = 75;
21945 }
21946 if (num214 == 6 || Main.rand.Next(2) == 0)
21947 {
21948 for (int num215 = 0; num215 < 1; num215++)
21949 {
21950 int num216 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, num214, velocity.X * 0.2f, velocity.Y * 0.2f, 100);
21951 Dust dust2;
21952 if (Main.rand.Next(3) != 0 || (num214 == 75 && Main.rand.Next(3) == 0))
21953 {
21954 Main.dust[num216].noGravity = true;
21955 dust2 = Main.dust[num216];
21956 dust2.scale *= 3f;
21957 Main.dust[num216].velocity.X *= 2f;
21958 Main.dust[num216].velocity.Y *= 2f;
21959 }
21960 if (type == 188)
21961 {
21962 dust2 = Main.dust[num216];
21963 dust2.scale *= 1.25f;
21964 }
21965 else
21966 {
21967 dust2 = Main.dust[num216];
21968 dust2.scale *= 1.5f;
21969 }
21970 Main.dust[num216].velocity.X *= 1.2f;
21971 Main.dust[num216].velocity.Y *= 1.2f;
21972 dust2 = Main.dust[num216];
21973 dust2.scale *= num213;
21974 if (num214 == 75)
21975 {
21976 dust2 = Main.dust[num216];
21977 dust2.velocity += velocity;
21978 if (!Main.dust[num216].noGravity)
21979 {
21980 dust2 = Main.dust[num216];
21981 dust2.velocity *= 0.5f;
21982 }
21983 }
21984 }
21985 }
21986 }
21987 else
21988 {
21989 this.ai[0] += 1f;
21990 }
21991 rotation += 0.3f * (float)direction;
21992 }
21993 else if (aiStyle == 24)
21994 {
21995 light = scale * 0.5f;
21996 rotation += velocity.X * 0.2f;
21997 this.ai[1] += 1f;
21998 if (type == 94)
21999 {
22000 if (Main.rand.Next(4) == 0)
22001 {
22002 int num217 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 70);
22003 Main.dust[num217].noGravity = true;
22004 Dust dust2 = Main.dust[num217];
22005 dust2.velocity *= 0.5f;
22006 dust2 = Main.dust[num217];
22007 dust2.scale *= 0.9f;
22008 }
22009 velocity *= 0.985f;
22010 if (this.ai[1] > 130f)
22011 {
22012 scale -= 0.05f;
22013 if ((double)scale <= 0.2)
22014 {
22015 scale = 0.2f;
22016 Kill();
22017 }
22018 }
22019 return;
22020 }
22021 velocity *= 0.96f;
22022 if (this.ai[1] > 15f)
22023 {
22024 scale -= 0.05f;
22025 if ((double)scale <= 0.2)
22026 {
22027 scale = 0.2f;
22028 Kill();
22029 }
22030 }
22031 }
22032 else if (aiStyle == 25)
22033 {
22034 if (type == 1013)
22035 {
22036 localAI[0]++;
22037 }
22038 if (type == 1014)
22039 {
22040 frame = Main.tileFrame[665];
22041 }
22042 if (this.ai[0] != 0f && velocity.Y <= 0f && velocity.X == 0f)
22043 {
22044 float num218 = 0.5f;
22045 int i2 = (int)((base.position.X - 8f) / 16f);
22046 int num219 = (int)(base.position.Y / 16f);
22047 bool flag9 = false;
22048 bool flag10 = false;
22049 if (WorldGen.SolidTile(i2, num219) || WorldGen.SolidTile(i2, num219 + 1))
22050 {
22051 flag9 = true;
22052 }
22053 i2 = (int)((base.position.X + (float)width + 8f) / 16f);
22054 if (WorldGen.SolidTile(i2, num219) || WorldGen.SolidTile(i2, num219 + 1))
22055 {
22056 flag10 = true;
22057 }
22058 if (flag9)
22059 {
22060 velocity.X = num218;
22061 }
22062 else if (flag10)
22063 {
22064 velocity.X = 0f - num218;
22065 }
22066 else
22067 {
22068 i2 = (int)((base.position.X - 8f - 16f) / 16f);
22069 num219 = (int)(base.position.Y / 16f);
22070 flag9 = false;
22071 flag10 = false;
22072 if (WorldGen.SolidTile(i2, num219) || WorldGen.SolidTile(i2, num219 + 1))
22073 {
22074 flag9 = true;
22075 }
22076 i2 = (int)((base.position.X + (float)width + 8f + 16f) / 16f);
22077 if (WorldGen.SolidTile(i2, num219) || WorldGen.SolidTile(i2, num219 + 1))
22078 {
22079 flag10 = true;
22080 }
22081 if (flag9)
22082 {
22083 velocity.X = num218;
22084 }
22085 else if (flag10)
22086 {
22087 velocity.X = 0f - num218;
22088 }
22089 else
22090 {
22091 i2 = (int)((base.position.X - 8f - 32f) / 16f);
22092 num219 = (int)(base.position.Y / 16f);
22093 flag9 = false;
22094 flag10 = false;
22095 if (WorldGen.SolidTile(i2, num219) || WorldGen.SolidTile(i2, num219 + 1))
22096 {
22097 flag9 = true;
22098 }
22099 i2 = (int)((base.position.X + (float)width + 8f + 32f) / 16f);
22100 if (WorldGen.SolidTile(i2, num219) || WorldGen.SolidTile(i2, num219 + 1))
22101 {
22102 flag10 = true;
22103 }
22104 if (!flag9 && !flag10)
22105 {
22106 if ((int)(base.Center.X / 16f) % 2 == 0)
22107 {
22108 flag9 = true;
22109 }
22110 else
22111 {
22112 flag10 = true;
22113 }
22114 }
22115 if (flag9)
22116 {
22117 velocity.X = num218;
22118 }
22119 else if (flag10)
22120 {
22121 velocity.X = 0f - num218;
22122 }
22123 }
22124 }
22125 }
22126 rotation += velocity.X * 0.06f;
22127 this.ai[0] = 1f;
22128 if (velocity.Y > 16f)
22129 {
22130 velocity.Y = 16f;
22131 }
22132 if (type == 1021)
22133 {
22134 if (Math.Abs(velocity.Y) <= 1f)
22135 {
22136 if (velocity.X > 0f && (double)velocity.X < 3.5)
22137 {
22138 velocity.X += 0.025f;
22139 }
22140 if (velocity.X < 0f && (double)velocity.X > -3.5)
22141 {
22142 velocity.X -= 0.025f;
22143 }
22144 }
22145 }
22146 else if (velocity.Y <= 6f)
22147 {
22148 if (velocity.X > 0f && velocity.X < 7f)
22149 {
22150 velocity.X += 0.05f;
22151 }
22152 if (velocity.X < 0f && velocity.X > -7f)
22153 {
22154 velocity.X -= 0.05f;
22155 }
22156 }
22157 if (type == 1021)
22158 {
22159 velocity.Y += 0.06f;
22160 }
22161 else
22162 {
22163 velocity.Y += 0.3f;
22164 }
22165 if (type == 655 && wet)
22166 {
22167 Kill();
22168 }
22169 }
22170 else if (aiStyle == 26)
22171 {
22172 AI_026();
22173 }
22174 else if (aiStyle == 27)
22175 {
22176 if (type == 115)
22177 {
22178 this.ai[0] += 1f;
22179 if (this.ai[0] < 30f)
22180 {
22181 velocity *= 1.125f;
22182 }
22183 }
22184 if (type == 115 && localAI[1] < 5f)
22185 {
22186 localAI[1] = 5f;
22187 for (int num220 = 5; num220 < 25; num220++)
22188 {
22189 float num221 = velocity.X * (30f / (float)num220);
22190 float num222 = velocity.Y * (30f / (float)num220);
22191 num221 *= 80f;
22192 num222 *= 80f;
22193 int num223 = Dust.NewDust(new Vector2(base.position.X - num221, base.position.Y - num222), 8, 8, 27, oldVelocity.X, oldVelocity.Y, 100, default(Color), 0.9f);
22194 Dust dust2 = Main.dust[num223];
22195 dust2.velocity *= 0.25f;
22196 dust2 = Main.dust[num223];
22197 dust2.velocity -= velocity * 5f;
22198 }
22199 }
22200 if (localAI[1] > 7f && type == 173)
22201 {
22202 int num224 = Main.rand.Next(3);
22203 int num225 = Dust.NewDust(new Vector2(base.position.X - velocity.X * 4f + 2f, base.position.Y + 2f - velocity.Y * 4f), 8, 8, num224 switch
22204 {
22205 0 => 15,
22206 1 => 57,
22207 _ => 58,
22208 }, 0f, 0f, 100, default(Color), 1.25f);
22209 Dust dust2 = Main.dust[num225];
22210 dust2.velocity *= 0.1f;
22211 }
22212 if (localAI[1] > 7f && type == 132)
22213 {
22214 int num226 = Dust.NewDust(new Vector2(base.position.X - velocity.X * 4f + 2f, base.position.Y + 2f - velocity.Y * 4f), 8, 8, 107, oldVelocity.X, oldVelocity.Y, 100, default(Color), 1.25f);
22215 Dust dust2 = Main.dust[num226];
22216 dust2.velocity *= -0.25f;
22217 num226 = Dust.NewDust(new Vector2(base.position.X - velocity.X * 4f + 2f, base.position.Y + 2f - velocity.Y * 4f), 8, 8, 107, oldVelocity.X, oldVelocity.Y, 100, default(Color), 1.25f);
22218 dust2 = Main.dust[num226];
22219 dust2.velocity *= -0.25f;
22220 dust2 = Main.dust[num226];
22221 dust2.position -= velocity * 0.5f;
22222 }
22223 if (localAI[1] < 15f)
22224 {
22225 localAI[1] += 1f;
22226 }
22227 else
22228 {
22229 if (type == 114 || type == 115)
22230 {
22231 int num227 = Dust.NewDust(new Vector2(base.position.X, base.position.Y + 4f), 8, 8, 27, oldVelocity.X, oldVelocity.Y, 100, default(Color), 0.6f);
22232 Dust dust2 = Main.dust[num227];
22233 dust2.velocity *= -0.25f;
22234 }
22235 else if (type == 116)
22236 {
22237 int num228 = Dust.NewDust(new Vector2(base.position.X - velocity.X * 5f + 2f, base.position.Y + 2f - velocity.Y * 5f), 8, 8, 64, oldVelocity.X, oldVelocity.Y, 100, default(Color), 1.5f);
22238 Dust dust2 = Main.dust[num228];
22239 dust2.velocity *= -0.25f;
22240 Main.dust[num228].noGravity = true;
22241 }
22242 if (localAI[0] == 0f)
22243 {
22244 scale -= 0.02f;
22245 alpha += 30;
22246 if (alpha >= 250)
22247 {
22248 alpha = 255;
22249 localAI[0] = 1f;
22250 }
22251 }
22252 else if (localAI[0] == 1f)
22253 {
22254 scale += 0.02f;
22255 alpha -= 30;
22256 if (alpha <= 0)
22257 {
22258 alpha = 0;
22259 localAI[0] = 0f;
22260 }
22261 }
22262 }
22263 if (this.ai[1] == 0f)
22264 {
22265 this.ai[1] = 1f;
22266 if (type == 132)
22267 {
22269 }
22270 else
22271 {
22273 }
22274 }
22275 if (type == 157)
22276 {
22277 rotation += (float)direction * 0.4f;
22279 }
22280 else
22281 {
22282 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 0.785f;
22283 }
22284 if (velocity.Y > 16f)
22285 {
22286 velocity.Y = 16f;
22287 }
22288 }
22289 else if (aiStyle == 28)
22290 {
22291 if (type == 967)
22292 {
22293 localAI[0]++;
22294 if (localAI[0] >= 5f && timeLeft % 3 == 0)
22295 {
22296 localAI[0] = 5f;
22297 int num229 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 219, velocity.X, velocity.Y, 0, default(Color), 0.35f + (float)Main.rand.Next(-5, 5) * 0.01f);
22298 Main.dust[num229].noGravity = true;
22299 Main.dust[num229].velocity = velocity * 1.5f;
22300 }
22301 if (++frameCounter > 6)
22302 {
22303 frameCounter = 0;
22304 frame++;
22305 if (frame >= Main.projFrames[type])
22306 {
22307 frame = 0;
22308 }
22309 }
22310 }
22311 if (type == 177)
22312 {
22313 for (int num230 = 0; num230 < 3; num230++)
22314 {
22315 int num231 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 137, velocity.X, velocity.Y, Main.rand.Next(0, 101), default(Color), 1f + (float)Main.rand.Next(-20, 40) * 0.01f);
22316 Main.dust[num231].noGravity = true;
22317 Dust dust2 = Main.dust[num231];
22318 dust2.velocity *= 0.3f;
22319 }
22320 }
22321 if (type == 118)
22322 {
22323 for (int num232 = 0; num232 < 2; num232++)
22324 {
22325 int num233 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 92, velocity.X, velocity.Y, 50, default(Color), 1.2f);
22326 Main.dust[num233].noGravity = true;
22327 Dust dust2 = Main.dust[num233];
22328 dust2.velocity *= 0.3f;
22329 }
22330 }
22331 if (type == 119 || type == 128 || type == 359)
22332 {
22333 for (int num234 = 0; num234 < 3; num234++)
22334 {
22335 int num235 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 92, velocity.X, velocity.Y, 50, default(Color), 1.2f);
22336 Main.dust[num235].noGravity = true;
22337 Dust dust2 = Main.dust[num235];
22338 dust2.velocity *= 0.3f;
22339 }
22340 }
22341 if (type == 309)
22342 {
22343 for (int num236 = 0; num236 < 3; num236++)
22344 {
22345 int num237 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 185, velocity.X, velocity.Y, 50, default(Color), 1.2f);
22346 Main.dust[num237].noGravity = true;
22347 Dust dust2 = Main.dust[num237];
22348 dust2.velocity *= 0.3f;
22349 }
22350 }
22351 if (type == 129)
22352 {
22353 for (int num238 = 0; num238 < 6; num238++)
22354 {
22355 int num239 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 106, velocity.X, velocity.Y, 100);
22356 Main.dust[num239].noGravity = true;
22357 Dust dust2 = Main.dust[num239];
22358 dust2.velocity *= 0.1f + (float)Main.rand.Next(4) * 0.1f;
22359 dust2 = Main.dust[num239];
22360 dust2.scale *= 1f + (float)Main.rand.Next(5) * 0.1f;
22361 }
22362 }
22363 if (this.ai[1] != 0f)
22364 {
22365 return;
22366 }
22367 this.ai[1] = 1f;
22368 if (type == 967)
22369 {
22370 for (int num240 = 0; num240 < 10; num240++)
22371 {
22372 int num241 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 219, velocity.X, velocity.Y, 0, default(Color), 0.4f + (float)Main.rand.Next(-20, 40) * 0.01f);
22373 Main.dust[num241].noGravity = true;
22374 Main.dust[num241].velocity = (velocity * 0.5f).RotatedByRandom(0.5);
22375 }
22377 }
22378 else
22379 {
22381 }
22382 }
22383 else if (aiStyle == 29)
22384 {
22385 if (type == 619)
22386 {
22387 int num242 = (int)this.ai[0];
22388 for (int num243 = 0; num243 < 3; num243++)
22389 {
22390 int num244 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 254, velocity.X, velocity.Y, num242, default(Color), 1.2f);
22391 Main.dust[num244].position = (Main.dust[num244].position + base.Center) / 2f;
22392 Main.dust[num244].noGravity = true;
22393 Dust dust2 = Main.dust[num244];
22394 dust2.velocity *= 0.5f;
22395 }
22396 for (int num245 = 0; num245 < 2; num245++)
22397 {
22398 int num244 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 255, velocity.X, velocity.Y, num242, default(Color), 0.4f);
22399 switch (num245)
22400 {
22401 case 0:
22402 Main.dust[num244].position = (Main.dust[num244].position + base.Center * 5f) / 6f;
22403 break;
22404 case 1:
22405 Main.dust[num244].position = (Main.dust[num244].position + (base.Center + velocity / 2f) * 5f) / 6f;
22406 break;
22407 }
22408 Dust dust2 = Main.dust[num244];
22409 dust2.velocity *= 0.1f;
22410 Main.dust[num244].noGravity = true;
22411 Main.dust[num244].fadeIn = 1f;
22412 }
22413 }
22414 else if (type == 620)
22415 {
22416 int num246 = (int)this.ai[0];
22417 this.ai[1] += 1f;
22418 float num247 = (60f - this.ai[1]) / 60f;
22419 if (this.ai[1] > 40f)
22420 {
22421 Kill();
22422 }
22423 velocity.Y += 0.2f;
22424 if (velocity.Y > 18f)
22425 {
22426 velocity.Y = 18f;
22427 }
22428 velocity.X *= 0.98f;
22429 for (int num248 = 0; num248 < 2; num248++)
22430 {
22431 int num249 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, num246, velocity.X, velocity.Y, 50, default(Color), 1.1f);
22432 Main.dust[num249].position = (Main.dust[num249].position + base.Center) / 2f;
22433 Main.dust[num249].noGravity = true;
22434 Dust dust2 = Main.dust[num249];
22435 dust2.velocity *= 0.3f;
22436 dust2 = Main.dust[num249];
22437 dust2.scale *= num247;
22438 }
22439 for (int num250 = 0; num250 < 1; num250++)
22440 {
22441 int num249 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, num246, velocity.X, velocity.Y, 50, default(Color), 0.6f);
22442 Main.dust[num249].position = (Main.dust[num249].position + base.Center * 5f) / 6f;
22443 Dust dust2 = Main.dust[num249];
22444 dust2.velocity *= 0.1f;
22445 Main.dust[num249].noGravity = true;
22446 Main.dust[num249].fadeIn = 0.9f * num247;
22447 dust2 = Main.dust[num249];
22448 dust2.scale *= num247;
22449 }
22450 }
22451 else if (type == 521)
22452 {
22453 for (int num251 = 0; num251 < 3; num251++)
22454 {
22455 int num252 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 254, velocity.X, velocity.Y, 50, default(Color), 1.2f);
22456 Main.dust[num252].position = (Main.dust[num252].position + base.Center) / 2f;
22457 Main.dust[num252].noGravity = true;
22458 Dust dust2 = Main.dust[num252];
22459 dust2.velocity *= 0.5f;
22460 }
22461 for (int num253 = 0; num253 < 2; num253++)
22462 {
22463 int num252 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 255, velocity.X, velocity.Y, 50, default(Color), 0.4f);
22464 switch (num253)
22465 {
22466 case 0:
22467 Main.dust[num252].position = (Main.dust[num252].position + base.Center * 5f) / 6f;
22468 break;
22469 case 1:
22470 Main.dust[num252].position = (Main.dust[num252].position + (base.Center + velocity / 2f) * 5f) / 6f;
22471 break;
22472 }
22473 Dust dust2 = Main.dust[num252];
22474 dust2.velocity *= 0.1f;
22475 Main.dust[num252].noGravity = true;
22476 Main.dust[num252].fadeIn = 1f;
22477 }
22478 }
22479 else if (type == 522)
22480 {
22481 this.ai[1] += 1f;
22482 float num254 = (60f - this.ai[1]) / 60f;
22483 if (this.ai[1] > 40f)
22484 {
22485 Kill();
22486 }
22487 velocity.Y += 0.2f;
22488 if (velocity.Y > 18f)
22489 {
22490 velocity.Y = 18f;
22491 }
22492 velocity.X *= 0.98f;
22493 for (int num255 = 0; num255 < 2; num255++)
22494 {
22495 int num256 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 254, velocity.X, velocity.Y, 50, default(Color), 1.1f);
22496 Main.dust[num256].position = (Main.dust[num256].position + base.Center) / 2f;
22497 Main.dust[num256].noGravity = true;
22498 Dust dust2 = Main.dust[num256];
22499 dust2.velocity *= 0.3f;
22500 dust2 = Main.dust[num256];
22501 dust2.scale *= num254;
22502 }
22503 for (int num257 = 0; num257 < 1; num257++)
22504 {
22505 int num256 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 255, velocity.X, velocity.Y, 50, default(Color), 0.6f);
22506 Main.dust[num256].position = (Main.dust[num256].position + base.Center * 5f) / 6f;
22507 Dust dust2 = Main.dust[num256];
22508 dust2.velocity *= 0.1f;
22509 Main.dust[num256].noGravity = true;
22510 Main.dust[num256].fadeIn = 0.9f * num254;
22511 dust2 = Main.dust[num256];
22512 dust2.scale *= num254;
22513 }
22514 }
22515 else if (type == 731)
22516 {
22517 if (++frameCounter >= 4)
22518 {
22519 frameCounter = 0;
22520 if (++frame >= Main.projFrames[type])
22521 {
22522 frame = 0;
22523 }
22524 }
22525 alpha -= 15;
22526 if (alpha < 0)
22527 {
22528 alpha = 0;
22529 }
22530 this.ai[0]++;
22531 if ((int)this.ai[0] % 2 != 0 && Main.rand.Next(4) == 0)
22532 {
22533 this.ai[0]++;
22534 }
22535 float num258 = 5f;
22536 switch ((int)this.ai[0])
22537 {
22538 case 10:
22539 velocity.Y -= num258;
22540 break;
22541 case 12:
22542 velocity.Y += num258;
22543 break;
22544 case 18:
22545 velocity.Y += num258;
22546 break;
22547 case 20:
22548 velocity.Y -= num258;
22549 this.ai[0] = 0f;
22550 break;
22551 }
22552 if (Main.rand.Next(3) == 0)
22553 {
22554 Dust dust11 = Dust.NewDustDirect(base.position, width, height, 226, velocity.X, velocity.Y, 50, default(Color), 0.4f);
22555 dust11.noGravity = true;
22556 dust11.velocity = dust11.velocity * 0f + velocity * 0.5f;
22557 if (Main.rand.Next(3) != 0)
22558 {
22559 Dust dust2 = dust11;
22560 dust2.velocity *= 1.4f;
22561 }
22562 }
22563 Lighting.AddLight(base.Center, 0.2f, 0.5f, 0.7f);
22564 }
22565 else
22566 {
22567 int num259 = type - 121 + 86;
22568 if (type == 597)
22569 {
22570 num259 = 262;
22571 }
22572 for (int num260 = 0; num260 < 2; num260++)
22573 {
22574 int num261 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, num259, velocity.X, velocity.Y, 50, default(Color), 1.2f);
22575 Main.dust[num261].noGravity = true;
22576 Dust dust2 = Main.dust[num261];
22577 dust2.velocity *= 0.3f;
22578 }
22579 if (this.ai[1] == 0f)
22580 {
22581 this.ai[1] = 1f;
22583 }
22584 }
22585 }
22586 else if (aiStyle == 30)
22587 {
22588 if (type == 907)
22589 {
22590 float num262 = 100f;
22591 float num263 = num262 - 50f;
22592 if (Main.rand.Next(Math.Max(4, 8 - (int)velocity.Length())) == 0)
22593 {
22594 int num264 = 5;
22595 int num265 = Dust.NewDust(base.position + new Vector2(num264, num264), width - num264 * 2, height - num264 * 2, 43, 0f, 0f, 254, new Color(255, 255, 0));
22596 Main.dust[num265].velocity = velocity * 0.75f;
22597 }
22598 if (this.ai[0] > num263)
22599 {
22600 velocity *= 0.9f;
22601 rotation *= 0.9f;
22602 }
22603 else
22604 {
22605 rotation += 0.2f;
22606 if (rotation > (float)Math.PI * 2f)
22607 {
22608 rotation -= (float)Math.PI * 2f;
22609 }
22610 }
22611 float num266 = this.ai[0];
22612 this.ai[0]++;
22613 if (Main.myPlayer == owner && this.ai[0] < num263 && this.ai[0] % 10f == 0f)
22614 {
22615 float num267 = (float)Math.PI / 2f * (float)((this.ai[0] % 20f != 0f) ? 1 : (-1));
22616 num267 *= (float)((whoAmI % 2 != 0) ? 1 : (-1));
22617 num267 += (float)Main.rand.Next(-5, 5) * MathHelper.Lerp(0.2f, 0.03f, this.ai[0] / num263);
22618 Vector2 v3 = velocity.RotatedBy(num267);
22619 v3 = v3.SafeNormalize(Vector2.Zero);
22620 v3 *= Math.Max(2.5f, (num263 - this.ai[0]) / num263 * (7f + (-2f + (float)Main.rand.Next(2) * 2f)));
22621 int num268 = NewProjectile(GetProjectileSource_FromThis(), base.Center, v3, 335, damage, knockBack * 0.25f, owner, 0f, Main.rand.Next(4));
22622 }
22623 if (num266 <= num263 && this.ai[0] > num263)
22624 {
22625 netUpdate = true;
22626 }
22627 if (this.ai[0] > num262)
22628 {
22629 Kill();
22630 }
22631 }
22632 else if (type == 335)
22633 {
22634 int num269 = (frame = (int)this.ai[1]);
22635 if (this.ai[0] < 0f)
22636 {
22637 velocity.Y += 0.25f;
22638 if (velocity.Y > 14f)
22639 {
22640 velocity.Y = 14f;
22641 }
22642 }
22643 else
22644 {
22645 if (Main.rand.Next(Math.Max(4, 8 - (int)velocity.Length())) == 0)
22646 {
22648 switch (num269)
22649 {
22650 case 0:
22651 newColor = new Color(255, 100, 100);
22652 break;
22653 case 1:
22654 newColor = new Color(100, 255, 100);
22655 break;
22656 case 2:
22657 newColor = new Color(100, 100, 255);
22658 break;
22659 case 3:
22660 newColor = new Color(255, 255, 100);
22661 break;
22662 }
22663 int num270 = 5;
22664 int num271 = Dust.NewDust(base.position + new Vector2(num270, num270), width - num270 * 2, height - num270 * 2, 43, 0f, 0f, 254, newColor);
22665 Main.dust[num271].velocity = velocity * 0.75f;
22666 }
22667 velocity *= 0.95f;
22668 }
22669 if (this.ai[0] >= 0f && velocity.Length() < 0.25f)
22670 {
22671 if (velocity != Vector2.Zero)
22672 {
22674 if (Main.netMode != 1)
22675 {
22676 this.ai[0] = 50f;
22677 netUpdate = true;
22678 }
22679 }
22680 this.ai[0]--;
22681 }
22682 localAI[0]++;
22683 rotation = (float)Math.Sin(localAI[0] / 10f);
22684 }
22685 else
22686 {
22687 velocity *= 0.8f;
22688 rotation += 0.2f;
22689 alpha += 4;
22690 if (alpha >= 255)
22691 {
22692 Kill();
22693 }
22694 }
22695 }
22696 else if (aiStyle == 31)
22697 {
22698 bool flag11 = this.ai[1] == 1f;
22699 short num272 = 110;
22700 int num273 = 0;
22701 switch (type)
22702 {
22703 default:
22704 num272 = 110;
22705 num273 = 0;
22706 break;
22707 case 147:
22708 num272 = 112;
22709 num273 = 1;
22710 break;
22711 case 146:
22712 num272 = 111;
22713 num273 = 2;
22714 break;
22715 case 148:
22716 num272 = 113;
22717 num273 = 3;
22718 break;
22719 case 149:
22720 num272 = 114;
22721 num273 = 4;
22722 break;
22723 case 1015:
22724 num272 = 311;
22725 num273 = 5;
22726 break;
22727 case 1016:
22728 num272 = 312;
22729 num273 = 6;
22730 break;
22731 case 1017:
22732 num272 = 313;
22733 num273 = 7;
22734 break;
22735 }
22736 if (owner == Main.myPlayer)
22737 {
22738 int size = 2;
22739 if (flag11)
22740 {
22741 size = 3;
22742 }
22743 Point point = base.Center.ToTileCoordinates();
22744 WorldGen.Convert(point.X, point.Y, num273, size);
22745 }
22746 if (timeLeft > 133)
22747 {
22748 timeLeft = 133;
22749 }
22750 int num274 = 7;
22751 if (flag11)
22752 {
22753 num274 = 3;
22754 }
22755 if (this.ai[0] > (float)num274)
22756 {
22757 float num275 = 1f;
22758 if (this.ai[0] == (float)(num274 + 1))
22759 {
22760 num275 = 0.2f;
22761 }
22762 else if (this.ai[0] == (float)(num274 + 2))
22763 {
22764 num275 = 0.4f;
22765 }
22766 else if (this.ai[0] == (float)(num274 + 3))
22767 {
22768 num275 = 0.6f;
22769 }
22770 else if (this.ai[0] == (float)(num274 + 4))
22771 {
22772 num275 = 0.8f;
22773 }
22774 int num276 = 0;
22775 if (flag11)
22776 {
22777 num275 *= 1.2f;
22778 num276 = (int)(12f * num275);
22779 }
22780 this.ai[0]++;
22781 for (int num277 = 0; num277 < 1; num277++)
22782 {
22783 int num278 = Dust.NewDust(new Vector2(base.position.X - (float)num276, base.position.Y - (float)num276), width + num276 * 2, height + num276 * 2, num272, velocity.X * 0.2f, velocity.Y * 0.2f, 100);
22784 Main.dust[num278].noGravity = true;
22785 Dust dust2 = Main.dust[num278];
22786 dust2.scale *= 1.75f;
22787 Main.dust[num278].velocity.X *= 2f;
22788 Main.dust[num278].velocity.Y *= 2f;
22789 dust2 = Main.dust[num278];
22790 dust2.scale *= num275;
22791 }
22792 }
22793 else
22794 {
22795 this.ai[0]++;
22796 }
22797 rotation += 0.3f * (float)direction;
22798 }
22799 else if (aiStyle == 32)
22800 {
22801 timeLeft = 10;
22802 this.ai[0] += 1f;
22803 if (this.ai[0] >= 20f)
22804 {
22805 this.ai[0] = 18f;
22806 Rectangle rectangle3 = new Rectangle((int)base.position.X, (int)base.position.Y, width, height);
22807 for (int num279 = 0; num279 < 255; num279++)
22808 {
22809 Entity entity = Main.player[num279];
22810 if (entity.active && rectangle3.Intersects(entity.Hitbox))
22811 {
22812 this.ai[0] = 0f;
22813 velocity.Y = -4.5f;
22814 if (velocity.X > 2f)
22815 {
22816 velocity.X = 2f;
22817 }
22818 if (velocity.X < -2f)
22819 {
22820 velocity.X = -2f;
22821 }
22822 velocity.X = (velocity.X + (float)entity.direction * 1.75f) / 2f;
22823 velocity.X += entity.velocity.X * 3f;
22824 velocity.Y += entity.velocity.Y;
22825 if (velocity.X > 6f)
22826 {
22827 velocity.X = 6f;
22828 }
22829 if (velocity.X < -6f)
22830 {
22831 velocity.X = -6f;
22832 }
22833 if (velocity.Length() > 16f)
22834 {
22835 velocity = velocity.SafeNormalize(Vector2.Zero) * 16f;
22836 }
22837 netUpdate = true;
22838 this.ai[1] += 1f;
22839 }
22840 }
22841 for (int num280 = 0; num280 < 1000; num280++)
22842 {
22843 if (num280 == whoAmI)
22844 {
22845 continue;
22846 }
22847 Entity entity = Main.projectile[num280];
22848 if (entity.active && rectangle3.Intersects(entity.Hitbox))
22849 {
22850 this.ai[0] = 0f;
22851 velocity.Y = -4.5f;
22852 if (velocity.X > 2f)
22853 {
22854 velocity.X = 2f;
22855 }
22856 if (velocity.X < -2f)
22857 {
22858 velocity.X = -2f;
22859 }
22860 velocity.X = (velocity.X + (float)entity.direction * 1.75f) / 2f;
22861 velocity.X += entity.velocity.X * 3f;
22862 velocity.Y += entity.velocity.Y;
22863 if (velocity.X > 6f)
22864 {
22865 velocity.X = 6f;
22866 }
22867 if (velocity.X < -6f)
22868 {
22869 velocity.X = -6f;
22870 }
22871 if (velocity.Length() > 16f)
22872 {
22873 velocity = velocity.SafeNormalize(Vector2.Zero) * 16f;
22874 }
22875 netUpdate = true;
22876 this.ai[1] += 1f;
22877 }
22878 }
22879 }
22880 if (velocity.X == 0f && velocity.Y == 0f)
22881 {
22882 Kill();
22883 }
22884 rotation += 0.02f * velocity.X;
22885 if (velocity.Y == 0f)
22886 {
22887 velocity.X *= 0.98f;
22888 }
22889 else if (wet)
22890 {
22891 velocity.X *= 0.99f;
22892 }
22893 else
22894 {
22895 velocity.X *= 0.995f;
22896 }
22897 if ((double)velocity.X > -0.03 && (double)velocity.X < 0.03)
22898 {
22899 velocity.X = 0f;
22900 }
22901 if (wet)
22902 {
22903 this.ai[1] = 0f;
22904 if (velocity.Y > 0f)
22905 {
22906 velocity.Y *= 0.95f;
22907 }
22908 velocity.Y -= 0.1f;
22909 if (velocity.Y < -4f)
22910 {
22911 velocity.Y = -4f;
22912 }
22913 if (velocity.X == 0f)
22914 {
22915 Kill();
22916 }
22917 }
22918 else
22919 {
22920 velocity.Y += 0.1f;
22921 }
22922 if (velocity.Y > 10f)
22923 {
22924 velocity.Y = 10f;
22925 }
22926 }
22927 else if (aiStyle == 33)
22928 {
22929 if (alpha > 0)
22930 {
22931 alpha -= 50;
22932 if (alpha < 0)
22933 {
22934 alpha = 0;
22935 }
22936 }
22937 float num281 = 4f;
22938 float num282 = this.ai[0];
22939 float num283 = this.ai[1];
22940 if (num282 == 0f && num283 == 0f)
22941 {
22942 num282 = 1f;
22943 }
22944 float num284 = (float)Math.Sqrt(num282 * num282 + num283 * num283);
22945 num284 = num281 / num284;
22946 num282 *= num284;
22947 num283 *= num284;
22948 if (alpha < 70)
22949 {
22950 short num285 = 127;
22951 switch (type)
22952 {
22953 case 163:
22954 num285 = 127;
22955 break;
22956 case 310:
22957 num285 = 187;
22958 break;
22959 case 1008:
22960 num285 = 169;
22961 break;
22962 case 1009:
22963 num285 = 75;
22964 break;
22965 case 1010:
22966 num285 = 66;
22967 break;
22968 case 1011:
22969 num285 = 310;
22970 break;
22971 }
22972 int num286 = Dust.NewDust(new Vector2(base.position.X, base.position.Y - 2f), 6, 6, num285, velocity.X, velocity.Y, 100, default(Color), 1.6f);
22973 Main.dust[num286].noGravity = true;
22974 Main.dust[num286].position.X -= num282 * 1f;
22975 Main.dust[num286].position.Y -= num283 * 1f;
22976 Main.dust[num286].velocity.X -= num282;
22977 Main.dust[num286].velocity.Y -= num283;
22978 if (type == 1010)
22979 {
22980 Main.dust[num286].color = Main.hslToRgb(Main.GlobalTimeWrappedHourly * 0.6f % 1f, 1f, 0.5f);
22981 Dust dust2 = Main.dust[num286];
22982 dust2.scale *= 0.5f;
22983 dust2 = Main.dust[num286];
22984 dust2.velocity *= 0.75f;
22985 }
22986 }
22987 if (localAI[0] == 0f)
22988 {
22989 this.ai[0] = velocity.X;
22990 this.ai[1] = velocity.Y;
22991 localAI[1] += 1f;
22992 if (localAI[1] >= 30f)
22993 {
22994 velocity.Y += 0.09f;
22995 localAI[1] = 30f;
22996 }
22997 }
22998 else
22999 {
23000 if (!Collision.SolidCollision(base.position, width, height))
23001 {
23002 localAI[0] = 0f;
23003 localAI[1] = 30f;
23004 }
23005 if (type == 1008 && Main.netMode != 2)
23006 {
23007 int num287 = 30;
23008 if ((base.Center - Main.player[Main.myPlayer].Center).Length() < (float)(Main.screenWidth + num287 * 16))
23009 {
23010 Main.instance.SpelunkerProjectileHelper.AddSpotToCheck(base.Center);
23011 }
23012 }
23013 damage = 0;
23014 }
23015 if (velocity.Y > 16f)
23016 {
23017 velocity.Y = 16f;
23018 }
23019 rotation = (float)Math.Atan2(this.ai[1], this.ai[0]) + 1.57f;
23020 }
23021 else if (aiStyle == 34)
23022 {
23023 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
23024 if (this.ai[1] == 1f)
23025 {
23026 this.ai[0]++;
23027 if (this.ai[0] == 1f)
23028 {
23029 for (int num288 = 0; num288 < 8; num288++)
23030 {
23031 int num289 = Dust.NewDust(base.position, width, height, 6, 0f, 0f, 100, default(Color), 1.8f);
23032 Main.dust[num289].noGravity = true;
23033 Dust dust2 = Main.dust[num289];
23034 dust2.velocity *= 3f;
23035 Main.dust[num289].fadeIn = 0.5f;
23036 dust2 = Main.dust[num289];
23037 dust2.position += velocity / 2f;
23038 dust2 = Main.dust[num289];
23039 dust2.velocity += velocity / 4f + Main.player[owner].velocity * 0.1f;
23040 }
23041 }
23042 if (this.ai[0] > 2f)
23043 {
23044 int num290 = Dust.NewDust(new Vector2(base.position.X + 2f, base.position.Y + 20f), 8, 8, 6, velocity.X, velocity.Y, 100, default(Color), 1.2f);
23045 Main.dust[num290].noGravity = true;
23046 Dust dust2 = Main.dust[num290];
23047 dust2.velocity *= 0.2f;
23048 Main.dust[num290].position = Main.dust[num290].position.RotatedBy(rotation, base.Center);
23049 num290 = Dust.NewDust(new Vector2(base.position.X + 2f, base.position.Y + 15f), 8, 8, 6, velocity.X, velocity.Y, 100, default(Color), 1.2f);
23050 Main.dust[num290].noGravity = true;
23051 dust2 = Main.dust[num290];
23052 dust2.velocity *= 0.2f;
23053 Main.dust[num290].position = Main.dust[num290].position.RotatedBy(rotation, base.Center);
23054 num290 = Dust.NewDust(new Vector2(base.position.X + 2f, base.position.Y + 10f), 8, 8, 6, velocity.X, velocity.Y, 100, default(Color), 1.2f);
23055 Main.dust[num290].noGravity = true;
23056 dust2 = Main.dust[num290];
23057 dust2.velocity *= 0.2f;
23058 Main.dust[num290].position = Main.dust[num290].position.RotatedBy(rotation, base.Center);
23059 }
23060 }
23061 else if (type >= 415 && type <= 418)
23062 {
23063 this.ai[0]++;
23064 if (this.ai[0] > 4f)
23065 {
23066 int num291 = Dust.NewDust(new Vector2(base.position.X + 2f, base.position.Y + 20f), 8, 8, 6, velocity.X, velocity.Y, 100, default(Color), 1.2f);
23067 Main.dust[num291].noGravity = true;
23068 Dust dust2 = Main.dust[num291];
23069 dust2.velocity *= 0.2f;
23070 Main.dust[num291].position = Main.dust[num291].position.RotatedBy(rotation, base.Center);
23071 }
23072 }
23073 else
23074 {
23075 int num292 = Dust.NewDust(new Vector2(base.position.X + 2f, base.position.Y + 20f), 8, 8, 6, velocity.X, velocity.Y, 100, default(Color), 1.2f);
23076 Main.dust[num292].noGravity = true;
23077 Dust dust2 = Main.dust[num292];
23078 dust2.velocity *= 0.2f;
23079 Main.dust[num292].position = Main.dust[num292].position.RotatedBy(rotation, base.Center);
23080 }
23081 }
23082 else if (aiStyle == 35)
23083 {
23084 this.ai[0] += 1f;
23085 if (this.ai[0] > 30f)
23086 {
23087 velocity.Y += 0.2f;
23088 velocity.X *= 0.985f;
23089 if (velocity.Y > 14f)
23090 {
23091 velocity.Y = 14f;
23092 }
23093 }
23094 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * (float)direction * 0.02f;
23095 if (owner != Main.myPlayer)
23096 {
23097 return;
23098 }
23099 Vector2 vector25 = Collision.TileCollision(base.position, velocity, width, height, fallThrough: true, fall2: true);
23100 bool flag12 = false;
23101 if (vector25 != velocity)
23102 {
23103 flag12 = true;
23104 }
23105 else
23106 {
23107 int num293 = (int)(base.Center.X + velocity.X) / 16;
23108 int num294 = (int)(base.Center.Y + velocity.Y) / 16;
23109 if (Main.tile[num293, num294] != null && Main.tile[num293, num294].active() && Main.tile[num293, num294].bottomSlope())
23110 {
23111 flag12 = true;
23112 base.position.Y = num294 * 16 + 16 + 8;
23113 base.position.X = num293 * 16 + 8;
23114 }
23115 }
23116 if (!flag12)
23117 {
23118 return;
23119 }
23120 int num295 = 213;
23121 if (type == 475)
23122 {
23123 num295 = 353;
23124 }
23125 if (type == 506)
23126 {
23127 num295 = 366;
23128 }
23129 if (type == 505)
23130 {
23131 num295 = 365;
23132 }
23133 int num296 = (int)(base.position.X + (float)(width / 2)) / 16;
23134 int num297 = (int)(base.position.Y + (float)(height / 2)) / 16;
23135 base.position += vector25;
23136 int num298 = 10;
23137 if (Main.tile[num296, num297] == null)
23138 {
23139 return;
23140 }
23141 for (; WorldGen.IsRope(num296, num297); num297++)
23142 {
23143 }
23144 bool flag13 = false;
23145 while (num298 > 0)
23146 {
23147 bool flag14 = false;
23148 if (Main.tile[num296, num297] == null)
23149 {
23150 break;
23151 }
23152 if (Main.tile[num296, num297].active())
23153 {
23154 if (Main.tile[num296, num297].type == 314 || TileID.Sets.Platforms[Main.tile[num296, num297].type])
23155 {
23156 flag13 = !flag13;
23157 }
23158 else if (Main.tileCut[Main.tile[num296, num297].type] || Main.tile[num296, num297].type == 165)
23159 {
23160 flag13 = false;
23161 WorldGen.KillTile(num296, num297);
23162 NetMessage.SendData(17, -1, -1, null, 0, num296, num297);
23163 }
23164 }
23165 if (!Main.tile[num296, num297].active())
23166 {
23167 flag13 = false;
23168 flag14 = true;
23169 WorldGen.PlaceTile(num296, num297, num295);
23170 NetMessage.SendData(17, -1, -1, null, 1, num296, num297, num295);
23171 this.ai[1] += 1f;
23172 }
23173 else if (!flag13)
23174 {
23175 num298 = 0;
23176 }
23177 if (flag14)
23178 {
23179 num298--;
23180 }
23181 num297++;
23182 }
23183 Kill();
23184 }
23185 else if (aiStyle == 36)
23186 {
23187 if (type != 307 && wet && !honeyWet && !shimmerWet)
23188 {
23189 Kill();
23190 }
23191 if (alpha > 0)
23192 {
23193 alpha -= 50;
23194 }
23195 else
23196 {
23197 extraUpdates = 0;
23198 }
23199 if (alpha < 0)
23200 {
23201 alpha = 0;
23202 }
23203 if (type == 307)
23204 {
23205 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
23206 frameCounter++;
23207 if (frameCounter >= 6)
23208 {
23209 frame++;
23210 frameCounter = 0;
23211 }
23212 if (frame >= 2)
23213 {
23214 frame = 0;
23215 }
23216 for (int num299 = 0; num299 < 3; num299++)
23217 {
23218 float num300 = velocity.X / 3f * (float)num299;
23219 float num301 = velocity.Y / 3f * (float)num299;
23220 int num302 = Dust.NewDust(base.position, width, height, 184);
23221 Main.dust[num302].position.X = base.Center.X - num300;
23222 Main.dust[num302].position.Y = base.Center.Y - num301;
23223 Dust dust2 = Main.dust[num302];
23224 dust2.velocity *= 0f;
23225 Main.dust[num302].scale = 0.5f;
23226 }
23227 }
23228 else
23229 {
23230 if (type == 316)
23231 {
23232 if (velocity.X > 0f)
23233 {
23234 spriteDirection = -1;
23235 }
23236 else if (velocity.X < 0f)
23237 {
23238 spriteDirection = 1;
23239 }
23240 }
23241 else if (velocity.X > 0f)
23242 {
23243 spriteDirection = 1;
23244 }
23245 else if (velocity.X < 0f)
23246 {
23247 spriteDirection = -1;
23248 }
23249 rotation = velocity.X * 0.1f;
23250 frameCounter++;
23251 if (frameCounter >= 3)
23252 {
23253 frame++;
23254 frameCounter = 0;
23255 }
23256 if (frame >= 3)
23257 {
23258 frame = 0;
23259 }
23260 }
23261 float num303 = base.position.X;
23262 float num304 = base.position.Y;
23263 float num305 = 100000f;
23264 bool flag15 = false;
23265 this.ai[0] += 1f;
23266 if (this.ai[0] > 30f)
23267 {
23268 this.ai[0] = 30f;
23269 for (int num306 = 0; num306 < 200; num306++)
23270 {
23271 if (Main.npc[num306].CanBeChasedBy(this) && (!Main.npc[num306].wet || Main.npc[num306].type == 370 || type == 307))
23272 {
23273 float num307 = Main.npc[num306].position.X + (float)(Main.npc[num306].width / 2);
23274 float num308 = Main.npc[num306].position.Y + (float)(Main.npc[num306].height / 2);
23275 float num309 = Math.Abs(base.position.X + (float)(width / 2) - num307) + Math.Abs(base.position.Y + (float)(height / 2) - num308);
23276 if (num309 < 800f && num309 < num305 && Collision.CanHit(base.position, width, height, Main.npc[num306].position, Main.npc[num306].width, Main.npc[num306].height))
23277 {
23278 num305 = num309;
23279 num303 = num307;
23280 num304 = num308;
23281 flag15 = true;
23282 }
23283 }
23284 }
23285 }
23286 if (!flag15)
23287 {
23288 num303 = base.position.X + (float)(width / 2) + velocity.X * 100f;
23289 num304 = base.position.Y + (float)(height / 2) + velocity.Y * 100f;
23290 }
23291 else if (type == 307)
23292 {
23293 friendly = true;
23294 }
23295 float num310 = 6f;
23296 float num311 = 0.1f;
23297 if (type == 189)
23298 {
23299 num310 = 9f;
23300 num311 = 0.2f;
23301 }
23302 if (type == 307)
23303 {
23304 num310 = 13f;
23305 num311 = 0.35f;
23306 }
23307 if (type == 316)
23308 {
23309 if (flag15)
23310 {
23311 num310 = 13f;
23312 num311 = 0.325f;
23313 }
23314 else
23315 {
23316 num310 = 10f;
23317 num311 = 0.25f;
23318 }
23319 }
23320 if (type == 566)
23321 {
23322 num310 = 6.8f;
23323 num311 = 0.14f;
23324 }
23325 Vector2 vector26 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
23326 float num312 = num303 - vector26.X;
23327 float num313 = num304 - vector26.Y;
23328 float num314 = (float)Math.Sqrt(num312 * num312 + num313 * num313);
23329 float num315 = num314;
23330 num314 = num310 / num314;
23331 num312 *= num314;
23332 num313 *= num314;
23333 if (velocity.X < num312)
23334 {
23335 velocity.X += num311;
23336 if (velocity.X < 0f && num312 > 0f)
23337 {
23338 velocity.X += num311 * 2f;
23339 }
23340 }
23341 else if (velocity.X > num312)
23342 {
23343 velocity.X -= num311;
23344 if (velocity.X > 0f && num312 < 0f)
23345 {
23346 velocity.X -= num311 * 2f;
23347 }
23348 }
23349 if (velocity.Y < num313)
23350 {
23351 velocity.Y += num311;
23352 if (velocity.Y < 0f && num313 > 0f)
23353 {
23354 velocity.Y += num311 * 2f;
23355 }
23356 }
23357 else if (velocity.Y > num313)
23358 {
23359 velocity.Y -= num311;
23360 if (velocity.Y > 0f && num313 < 0f)
23361 {
23362 velocity.Y -= num311 * 2f;
23363 }
23364 }
23365 }
23366 else if (aiStyle == 37)
23367 {
23368 if (this.ai[1] == 0f)
23369 {
23370 this.ai[1] = 1f;
23371 localAI[0] = base.Center.X - velocity.X * 1.5f;
23372 localAI[1] = base.Center.Y - velocity.Y * 1.5f;
23373 }
23374 Vector2 vector27 = new Vector2(localAI[0], localAI[1]);
23375 rotation = (base.Center - vector27).ToRotation() - (float)Math.PI / 2f;
23376 if (this.ai[0] == 0f)
23377 {
23378 if (Collision.SolidCollision(base.position, width, height))
23379 {
23380 velocity *= -1f;
23381 this.ai[0] += 1f;
23382 return;
23383 }
23384 float num316 = Vector2.Distance(base.Center, vector27);
23385 if (num316 > 300f)
23386 {
23387 velocity *= -1f;
23388 this.ai[0] += 1f;
23389 }
23390 }
23391 else if (Collision.SolidCollision(base.position, width, height) || Vector2.Distance(base.Center, vector27) < velocity.Length())
23392 {
23393 Kill();
23394 }
23395 }
23396 else if (aiStyle == 38)
23397 {
23398 this.ai[0] += 1f;
23399 if (this.ai[0] >= 6f)
23400 {
23401 this.ai[0] = 0f;
23403 if (Main.myPlayer == owner)
23404 {
23406 }
23407 }
23408 }
23409 else if (aiStyle == 39)
23410 {
23411 alpha -= 50;
23412 if (alpha < 0)
23413 {
23414 alpha = 0;
23415 }
23416 if (!active || !Main.player[owner].active || Main.player[owner].dead || Vector2.Distance(Main.player[owner].Center, base.Center) > 2000f)
23417 {
23418 Kill();
23419 return;
23420 }
23421 if (active && alpha == 0)
23422 {
23423 Main.player[owner].SetDummyItemTime(5);
23424 if (base.Center.X > Main.player[owner].Center.X)
23425 {
23426 Main.player[owner].ChangeDir(1);
23427 }
23428 else
23429 {
23430 Main.player[owner].ChangeDir(-1);
23431 }
23432 }
23433 Vector2 center = base.Center;
23434 float num317 = Main.player[owner].Center.X - center.X;
23435 float num318 = Main.player[owner].Center.Y - center.Y;
23436 float num319 = (float)Math.Sqrt(num317 * num317 + num318 * num318);
23437 if (!Main.player[owner].channel && active && alpha == 0)
23438 {
23439 this.ai[0] = 1f;
23440 this.ai[1] = -1f;
23441 }
23442 if (this.ai[1] > 0f && num319 > 1500f)
23443 {
23444 this.ai[1] = 0f;
23445 this.ai[0] = 1f;
23446 }
23447 if (this.ai[1] > 0f)
23448 {
23449 tileCollide = false;
23450 int num320 = (int)this.ai[1] - 1;
23451 if (Main.npc[num320].active && Main.npc[num320].life > 0)
23452 {
23453 float num321 = 16f;
23454 center = base.Center;
23455 num317 = Main.npc[num320].Center.X - center.X;
23456 num318 = Main.npc[num320].Center.Y - center.Y;
23457 num319 = (float)Math.Sqrt(num317 * num317 + num318 * num318);
23458 if (num319 < num321)
23459 {
23460 velocity.X = num317;
23461 velocity.Y = num318;
23462 if (num319 > num321 / 3f)
23463 {
23464 if (velocity.X < 0f)
23465 {
23466 spriteDirection = -1;
23467 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
23468 }
23469 else
23470 {
23471 spriteDirection = 1;
23472 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
23473 }
23474 if (type == 190)
23475 {
23476 velocity.X = 0f;
23477 velocity.Y = 0f;
23478 }
23479 }
23480 }
23481 else
23482 {
23483 if (num319 == 0f)
23484 {
23485 num319 = 0.0001f;
23486 }
23487 num319 = num321 / num319;
23488 num317 *= num319;
23489 num318 *= num319;
23490 velocity.X = num317;
23491 velocity.Y = num318;
23492 if (velocity.X < 0f)
23493 {
23494 spriteDirection = -1;
23495 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
23496 }
23497 else
23498 {
23499 spriteDirection = 1;
23500 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
23501 }
23502 }
23503 if (type == 190)
23504 {
23505 base.position += Main.npc[num320].velocity;
23506 for (int num322 = 0; num322 < 1000; num322++)
23507 {
23508 if (num322 != whoAmI && Main.projectile[num322].active && Main.projectile[num322].owner == owner && Main.projectile[num322].type == 190 && Vector2.Distance(base.Center, Main.projectile[num322].Center) < 8f)
23509 {
23510 if (base.position.X < Main.projectile[num322].position.X)
23511 {
23512 velocity.X -= 4f;
23513 }
23514 else
23515 {
23516 velocity.X += 4f;
23517 }
23518 if (base.position.Y < Main.projectile[num322].position.Y)
23519 {
23520 velocity.Y -= 4f;
23521 }
23522 else
23523 {
23524 velocity.Y += 4f;
23525 }
23526 }
23527 }
23528 }
23529 if (Main.myPlayer == owner)
23530 {
23531 float num323 = this.ai[0];
23532 this.ai[0] = 1f;
23533 if (num323 != this.ai[0])
23534 {
23535 netUpdate = true;
23536 }
23537 }
23538 }
23539 else if (Main.myPlayer == owner)
23540 {
23541 float num324 = this.ai[1];
23542 this.ai[1] = 0f;
23543 if (num324 != this.ai[1])
23544 {
23545 netUpdate = true;
23546 }
23547 float num325 = base.position.X;
23548 float num326 = base.position.Y;
23549 float num327 = 3000f;
23550 int num328 = -1;
23551 for (int num329 = 0; num329 < 200; num329++)
23552 {
23553 if (Main.npc[num329].CanBeChasedBy(this))
23554 {
23555 float x = Main.npc[num329].Center.X;
23556 float y = Main.npc[num329].Center.Y;
23557 float num330 = Math.Abs(base.Center.X - x) + Math.Abs(base.Center.Y - y);
23558 if (num330 < num327 && Collision.CanHit(base.position, width, height, Main.npc[num329].position, Main.npc[num329].width, Main.npc[num329].height))
23559 {
23560 num327 = num330;
23561 num325 = x;
23562 num326 = y;
23563 num328 = num329;
23564 }
23565 }
23566 }
23567 if (num328 >= 0)
23568 {
23569 float num331 = 16f;
23570 center = base.Center;
23571 num317 = num325 - center.X;
23572 num318 = num326 - center.Y;
23573 num319 = (float)Math.Sqrt(num317 * num317 + num318 * num318);
23574 if (num319 == 0f)
23575 {
23576 num319 = 0.0001f;
23577 }
23578 num319 = num331 / num319;
23579 num317 *= num319;
23580 num318 *= num319;
23581 velocity.X = num317;
23582 velocity.Y = num318;
23583 this.ai[0] = 0f;
23584 this.ai[1] = num328 + 1;
23585 netUpdate = true;
23586 }
23587 }
23588 }
23589 else if (this.ai[0] == 0f)
23590 {
23591 if (Main.myPlayer == owner && num319 > 700f)
23592 {
23593 this.ai[0] = 1f;
23594 netUpdate = true;
23595 }
23596 if (velocity.X < 0f)
23597 {
23598 spriteDirection = -1;
23599 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
23600 }
23601 else
23602 {
23603 spriteDirection = 1;
23604 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
23605 }
23606 }
23607 else if (this.ai[0] == 1f)
23608 {
23609 tileCollide = false;
23610 if (velocity.X < 0f)
23611 {
23612 spriteDirection = 1;
23613 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
23614 }
23615 else
23616 {
23617 spriteDirection = -1;
23618 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
23619 }
23620 if (velocity.X < 0f)
23621 {
23622 spriteDirection = -1;
23623 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
23624 }
23625 else
23626 {
23627 spriteDirection = 1;
23628 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
23629 }
23630 float num332 = 20f;
23631 if (Main.myPlayer == owner && num319 < 70f)
23632 {
23633 Kill();
23634 }
23635 num319 = num332 / num319;
23636 num317 *= num319;
23637 num318 *= num319;
23638 velocity.X = num317;
23639 velocity.Y = num318;
23640 if (type == 190)
23641 {
23642 base.position += Main.player[owner].velocity;
23643 }
23644 }
23645 frameCounter++;
23646 if (frameCounter >= 4)
23647 {
23648 frame++;
23649 frameCounter = 0;
23650 }
23651 if (frame >= 4)
23652 {
23653 frame = 0;
23654 }
23655 }
23656 else if (aiStyle == 40)
23657 {
23658 localAI[0] += 1f;
23659 if (localAI[0] > 3f)
23660 {
23661 localAI[0] = 100f;
23662 alpha -= 50;
23663 if (alpha < 0)
23664 {
23665 alpha = 0;
23666 }
23667 }
23668 frameCounter++;
23669 if (frameCounter >= 3)
23670 {
23671 frame++;
23672 frameCounter = 0;
23673 }
23674 if (frame >= 5)
23675 {
23676 frame = 0;
23677 }
23678 velocity.X += this.ai[0];
23679 velocity.Y += this.ai[1];
23680 localAI[1] += 1f;
23681 if (localAI[1] == 50f)
23682 {
23683 localAI[1] = 51f;
23684 this.ai[0] = (float)Main.rand.Next(-100, 101) * 6E-05f;
23685 this.ai[1] = (float)Main.rand.Next(-100, 101) * 6E-05f;
23686 }
23687 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) > 16f)
23688 {
23689 velocity.X *= 0.95f;
23690 velocity.Y *= 0.95f;
23691 }
23692 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < 12f)
23693 {
23694 velocity.X *= 1.05f;
23695 velocity.Y *= 1.05f;
23696 }
23697 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 3.14f;
23698 }
23699 else if (aiStyle == 41)
23700 {
23701 if (localAI[0] == 0f)
23702 {
23703 localAI[0] = 1f;
23704 frame = Main.rand.Next(3);
23705 }
23706 rotation += velocity.X * 0.01f;
23707 }
23708 else if (aiStyle == 42)
23709 {
23710 if (!Main.player[owner].crystalLeaf)
23711 {
23712 Kill();
23713 return;
23714 }
23715 base.position.X = Main.player[owner].Center.X - (float)(width / 2);
23716 base.position.Y = Main.player[owner].Center.Y - (float)(height / 2) + Main.player[owner].gfxOffY - 60f;
23717 if (Main.player[owner].gravDir == -1f)
23718 {
23719 base.position.Y += 120f;
23720 rotation = 3.14f;
23721 }
23722 else
23723 {
23724 rotation = 0f;
23725 }
23726 base.position.X = (int)base.position.X;
23727 base.position.Y = (int)base.position.Y;
23728 float num333 = (float)(int)Main.mouseTextColor / 200f - 0.35f;
23729 num333 *= 0.2f;
23730 scale = num333 + 0.95f;
23731 if (owner != Main.myPlayer || Main.player[owner].crystalLeafCooldown != 0)
23732 {
23733 return;
23734 }
23735 float x2 = base.position.X;
23736 float y2 = base.position.Y;
23737 float num334 = 700f;
23738 NPC nPC = null;
23739 for (int num335 = 0; num335 < 200; num335++)
23740 {
23741 if (Main.npc[num335].CanBeChasedBy(this))
23742 {
23743 float num336 = Main.npc[num335].position.X + (float)(Main.npc[num335].width / 2);
23744 float num337 = Main.npc[num335].position.Y + (float)(Main.npc[num335].height / 2);
23745 float num338 = Math.Abs(base.position.X + (float)(width / 2) - num336) + Math.Abs(base.position.Y + (float)(height / 2) - num337);
23746 if (num338 < num334 && Collision.CanHit(base.position, width, height, Main.npc[num335].position, Main.npc[num335].width, Main.npc[num335].height))
23747 {
23748 num334 = num338;
23749 nPC = Main.npc[num335];
23750 }
23751 }
23752 }
23753 if (nPC != null)
23754 {
23755 float num339 = 12f;
23756 Vector2 vector28 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
23757 float num340 = x2 - vector28.X;
23758 float num341 = y2 - vector28.Y;
23759 float num342 = (float)Math.Sqrt(num340 * num340 + num341 * num341);
23760 float num343 = num342;
23761 num342 = num339 / num342;
23762 num340 *= num342;
23763 num341 *= num342;
23764 int num344 = 180;
23765 Utils.ChaseResults chaseResults = Utils.GetChaseResults(base.Center, num339 * (float)num344, nPC.Center, nPC.velocity);
23766 if (chaseResults.InterceptionHappens && chaseResults.InterceptionTime <= 180f)
23767 {
23768 Vector2 vector29 = chaseResults.ChaserVelocity / num344;
23769 num340 = vector29.X;
23770 num341 = vector29.Y;
23771 }
23772 NewProjectile(GetProjectileSource_FromThis(), base.Center.X - 4f, base.Center.Y, num340, num341, 227, Player.crystalLeafDamage, Player.crystalLeafKB, owner);
23773 Main.player[owner].crystalLeafCooldown = 40;
23774 }
23775 }
23776 else if (aiStyle == 43)
23777 {
23778 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 3.14f;
23779 if (soundDelay == 0 && type == 227)
23780 {
23781 soundDelay = -1;
23782 SoundEngine.PlaySound(6, (int)base.position.X, (int)base.position.Y);
23783 for (int num345 = 0; num345 < 8; num345++)
23784 {
23785 int num346 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 157);
23786 Main.dust[num346].noGravity = true;
23787 Dust dust2 = Main.dust[num346];
23788 dust2.velocity *= 3f;
23789 Main.dust[num346].scale = 1.5f;
23790 dust2 = Main.dust[num346];
23791 dust2.velocity += velocity * Main.rand.NextFloat();
23792 }
23793 }
23794 float num347 = 1f - (float)timeLeft / 180f;
23795 float num348 = ((num347 * -6f * 0.85f + 0.33f) % 1f + 1f) % 1f;
23796 Color value3 = Main.hslToRgb(num348, 1f, 0.5f);
23797 value3 = Color.Lerp(value3, Color.Red, Utils.Remap(num348, 0.33f, 0.7f, 0f, 1f));
23798 value3 = Color.Lerp(value3, Color.Lerp(Color.LimeGreen, Color.Gold, 0.3f), (float)(int)value3.R / 255f * 1f);
23799 if (frameCounter++ >= 1)
23800 {
23801 frameCounter = 0;
23803 {
23804 PositionInWorld = base.Center,
23805 MovementVector = velocity,
23806 UniqueInfoPiece = (byte)(Main.rgbToHsl(value3).X * 255f)
23807 });
23808 }
23809 Lighting.AddLight(base.Center, new Vector3(0.05f, 0.2f, 0.1f) * 1.5f);
23810 if (Main.rand.Next(5) == 0)
23811 {
23812 Dust dust12 = Dust.NewDustDirect(new Vector2(base.position.X, base.position.Y), width, height, 63);
23813 dust12.noGravity = true;
23814 Dust dust2 = dust12;
23815 dust2.velocity *= 0.1f;
23816 dust12.scale = 1.5f;
23817 dust2 = dust12;
23818 dust2.velocity += velocity * Main.rand.NextFloat();
23819 dust12.color = value3;
23820 dust12.color.A /= 4;
23821 dust12.alpha = 100;
23822 dust12.noLight = true;
23823 }
23824 }
23825 else if (aiStyle == 44)
23826 {
23827 int num349 = 6;
23828 if (type == 228)
23829 {
23830 velocity *= 0.96f;
23831 alpha += 2;
23832 if (alpha > 200)
23833 {
23834 Kill();
23835 }
23836 }
23837 else if (type == 732)
23838 {
23839 num349 = 3;
23840 alpha += 20;
23841 if (alpha > 255)
23842 {
23843 Kill();
23844 }
23845 if (Main.rand.Next(5) == 0)
23846 {
23847 Dust dust13 = Dust.NewDustDirect(base.position, width, height, 226, 0f, 0f, 150, default(Color), 0.8f);
23848 dust13.noGravity = true;
23849 Dust dust2 = dust13;
23850 dust2.velocity *= 1.2f;
23851 }
23852 rotation = velocity.ToRotation();
23853 Lighting.AddLight(base.Center, 0.3f, 0.6f, 0.8f);
23854 }
23855 else if (type == 229)
23856 {
23857 if (this.ai[0] == 0f)
23858 {
23860 }
23861 this.ai[0] += 1f;
23862 if (this.ai[0] > 20f)
23863 {
23864 velocity.Y += 0.3f;
23865 velocity.X *= 0.98f;
23866 }
23867 }
23868 if (++frameCounter >= num349)
23869 {
23870 frameCounter = 0;
23871 if (++frame >= Main.projFrames[type])
23872 {
23873 frame = 0;
23874 }
23875 }
23876 }
23877 else if (aiStyle == 45)
23878 {
23879 if (type == 237 || type == 243)
23880 {
23881 float num350 = this.ai[0];
23882 float num351 = this.ai[1];
23883 if (num350 != 0f && num351 != 0f)
23884 {
23885 bool flag16 = false;
23886 bool flag17 = false;
23887 if (velocity.X == 0f || (velocity.X < 0f && base.Center.X < num350) || (velocity.X > 0f && base.Center.X > num350))
23888 {
23889 velocity.X = 0f;
23890 flag16 = true;
23891 }
23892 if (velocity.Y == 0f || (velocity.Y < 0f && base.Center.Y < num351) || (velocity.Y > 0f && base.Center.Y > num351))
23893 {
23894 velocity.Y = 0f;
23895 flag17 = true;
23896 }
23897 if (owner == Main.myPlayer && flag16 && flag17)
23898 {
23899 Kill();
23900 }
23901 }
23902 rotation += velocity.X * 0.02f;
23903 frameCounter++;
23904 if (frameCounter > 4)
23905 {
23906 frameCounter = 0;
23907 frame++;
23908 if (frame > 3)
23909 {
23910 frame = 0;
23911 }
23912 }
23913 }
23914 else if (type == 238 || type == 244)
23915 {
23916 bool flag18 = true;
23917 int num352 = (int)base.Center.X;
23918 int num353 = (int)(base.position.Y + (float)height);
23919 if (Collision.SolidTiles(new Vector2(num352, num353), 2, 20))
23920 {
23921 flag18 = false;
23922 }
23923 frameCounter++;
23924 if (frameCounter > 8)
23925 {
23926 frameCounter = 0;
23927 frame++;
23928 if ((!flag18 && frame > 2) || frame > 5)
23929 {
23930 frame = 0;
23931 }
23932 }
23933 this.ai[1] += 1f;
23934 if (type == 244 && this.ai[1] >= 18000f)
23935 {
23936 alpha += 5;
23937 if (alpha > 255)
23938 {
23939 alpha = 255;
23940 Kill();
23941 }
23942 }
23943 else if (type == 238 && this.ai[1] >= 18000f)
23944 {
23945 alpha += 5;
23946 if (alpha > 255)
23947 {
23948 alpha = 255;
23949 Kill();
23950 }
23951 }
23952 else if (flag18)
23953 {
23954 this.ai[0] += 1f;
23955 if (type == 244)
23956 {
23957 if (this.ai[0] > 10f)
23958 {
23959 this.ai[0] = 0f;
23960 if (owner == Main.myPlayer)
23961 {
23962 num352 += Main.rand.Next(-14, 15);
23964 }
23965 }
23966 }
23967 else if (this.ai[0] > 8f)
23968 {
23969 this.ai[0] = 0f;
23970 if (owner == Main.myPlayer)
23971 {
23972 num352 += Main.rand.Next(-14, 15);
23974 }
23975 }
23976 }
23977 localAI[0] += 1f;
23978 if (!(localAI[0] >= 10f))
23979 {
23980 return;
23981 }
23982 localAI[0] = 0f;
23983 int num354 = 0;
23984 int num355 = 0;
23985 float num356 = 0f;
23986 int num357 = type;
23987 for (int num358 = 0; num358 < 1000; num358++)
23988 {
23989 if (Main.projectile[num358].active && Main.projectile[num358].owner == owner && Main.projectile[num358].type == num357 && Main.projectile[num358].ai[1] < 18000f)
23990 {
23991 num354++;
23992 if (Main.projectile[num358].ai[1] > num356)
23993 {
23994 num355 = num358;
23995 num356 = Main.projectile[num358].ai[1];
23996 }
23997 }
23998 }
23999 if (type == 244)
24000 {
24001 if (num354 > 1)
24002 {
24003 Main.projectile[num355].netUpdate = true;
24004 Main.projectile[num355].ai[1] = 18000f;
24005 }
24006 }
24007 else if (num354 > 2)
24008 {
24009 Main.projectile[num355].netUpdate = true;
24010 Main.projectile[num355].ai[1] = 18000f;
24011 }
24012 }
24013 else if (type == 239 || type == 245 || type == 264)
24014 {
24015 int num359 = (int)(base.Center.X / 16f);
24016 int num360 = (int)((base.position.Y + (float)height) / 16f);
24017 if (WorldGen.InWorld(num359, num360) && Main.tile[num359, num360] != null && Main.tile[num359, num360].liquid == byte.MaxValue && Main.tile[num359, num360].shimmer() && velocity.Y > 0f)
24018 {
24019 velocity.Y *= -1f;
24020 netUpdate = true;
24021 }
24022 if (type == 239)
24023 {
24024 alpha = 50;
24025 }
24026 else if (type == 245)
24027 {
24028 alpha = 100;
24029 }
24030 else if (type == 264)
24031 {
24032 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
24033 }
24034 }
24035 }
24036 else if (aiStyle == 46)
24037 {
24038 int num361 = (int)(base.Center.X / 16f);
24039 int num362 = (int)(base.Center.Y / 16f);
24040 if (WorldGen.InWorld(num361, num362) && Main.tile[num361, num362] != null && Main.tile[num361, num362].liquid > 0 && Main.tile[num361, num362].shimmer())
24041 {
24042 Kill();
24043 }
24044 int num363 = 2400;
24045 if (type == 250)
24046 {
24047 Point point2 = base.Center.ToTileCoordinates();
24048 if (!WorldGen.InWorld(point2.X, point2.Y, 2) || Main.tile[point2.X, point2.Y] == null)
24049 {
24050 Kill();
24051 return;
24052 }
24053 if (owner == Main.myPlayer)
24054 {
24055 localAI[0] += 1f;
24056 if (localAI[0] > 4f)
24057 {
24058 localAI[0] = 3f;
24059 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, velocity.X * 0.001f, velocity.Y * 0.001f, 251, damage, knockBack, owner);
24060 }
24061 if (timeLeft > num363)
24062 {
24063 timeLeft = num363;
24064 }
24065 }
24066 float num364 = 1f;
24067 if (velocity.Y < 0f)
24068 {
24069 num364 -= velocity.Y / 3f;
24070 }
24071 this.ai[0] += num364;
24072 if (this.ai[0] > 30f)
24073 {
24074 velocity.Y += 0.5f;
24075 if (velocity.Y > 0f)
24076 {
24077 velocity.X *= 0.95f;
24078 }
24079 else
24080 {
24081 velocity.X *= 1.05f;
24082 }
24083 }
24084 float x3 = velocity.X;
24085 float y3 = velocity.Y;
24086 float num365 = (float)Math.Sqrt(x3 * x3 + y3 * y3);
24087 num365 = 15.95f * scale / num365;
24088 x3 *= num365;
24089 y3 *= num365;
24090 velocity.X = x3;
24091 velocity.Y = y3;
24092 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
24093 return;
24094 }
24095 if (localAI[0] == 0f)
24096 {
24097 if (velocity.X > 0f)
24098 {
24099 spriteDirection = -1;
24100 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
24101 }
24102 else
24103 {
24104 spriteDirection = 1;
24105 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
24106 }
24107 localAI[0] = 1f;
24108 timeLeft = num363;
24109 }
24110 velocity.X *= 0.98f;
24111 velocity.Y *= 0.98f;
24112 if (rotation == 0f)
24113 {
24114 alpha = 255;
24115 }
24116 else if (timeLeft < 10)
24117 {
24118 alpha = 255 - (int)(255f * (float)timeLeft / 10f);
24119 }
24120 else if (timeLeft > num363 - 10)
24121 {
24122 int num366 = num363 - timeLeft;
24123 alpha = 255 - (int)(255f * (float)num366 / 10f);
24124 }
24125 else
24126 {
24127 alpha = 0;
24128 }
24129 }
24130 else if (aiStyle == 47)
24131 {
24133 }
24134 else if (aiStyle == 48)
24135 {
24136 if (type == 255)
24137 {
24138 for (int num367 = 0; num367 < 4; num367++)
24139 {
24140 Vector2 vector30 = base.position;
24141 vector30 -= velocity * ((float)num367 * 0.25f);
24142 alpha = 255;
24143 int num368 = Dust.NewDust(vector30, 1, 1, 160);
24144 Main.dust[num368].position = vector30;
24145 Main.dust[num368].position.X += width / 2;
24146 Main.dust[num368].position.Y += height / 2;
24147 Main.dust[num368].scale = (float)Main.rand.Next(70, 110) * 0.013f;
24148 Dust dust2 = Main.dust[num368];
24149 dust2.velocity *= 0.2f;
24150 }
24151 return;
24152 }
24153 if (type == 433)
24154 {
24155 for (int num369 = 0; num369 < 2; num369++)
24156 {
24157 Vector2 vector31 = base.position;
24158 vector31 -= velocity * ((float)num369 * 0.25f);
24159 alpha = 255;
24160 int num370 = Dust.NewDust(vector31, 1, 1, 160);
24161 Main.dust[num370].position = vector31;
24162 Main.dust[num370].position.X += width / 2;
24163 Main.dust[num370].position.Y += height / 2;
24164 if (Main.rand.Next(2) == 0)
24165 {
24166 Main.dust[num370].color = Color.LimeGreen;
24167 }
24168 else
24169 {
24170 Main.dust[num370].color = Color.CornflowerBlue;
24171 }
24172 Main.dust[num370].scale = (float)Main.rand.Next(70, 110) * 0.013f;
24173 Dust dust2 = Main.dust[num370];
24174 dust2.velocity *= 0.2f;
24175 }
24176 return;
24177 }
24178 if (type == 290)
24179 {
24180 if (localAI[0] == 0f)
24181 {
24183 }
24184 localAI[0] += 1f;
24185 if (localAI[0] > 3f)
24186 {
24187 for (int num371 = 0; num371 < 3; num371++)
24188 {
24189 Vector2 vector32 = base.position;
24190 vector32 -= velocity * ((float)num371 * 0.3334f);
24191 alpha = 255;
24192 int num372 = Dust.NewDust(vector32, 1, 1, 173);
24193 Main.dust[num372].position = vector32;
24194 Main.dust[num372].scale = (float)Main.rand.Next(70, 110) * 0.013f;
24195 Dust dust2 = Main.dust[num372];
24196 dust2.velocity *= 0.2f;
24197 }
24198 }
24199 return;
24200 }
24201 if (type == 294)
24202 {
24203 localAI[0] += 1f;
24204 if (localAI[0] > 9f)
24205 {
24206 for (int num373 = 0; num373 < 4; num373++)
24207 {
24208 Vector2 vector33 = base.position;
24209 vector33 -= velocity * ((float)num373 * 0.25f);
24210 alpha = 255;
24211 int num374 = Dust.NewDust(vector33, 1, 1, 173);
24212 Main.dust[num374].position = vector33;
24213 Main.dust[num374].scale = (float)Main.rand.Next(70, 110) * 0.013f;
24214 Dust dust2 = Main.dust[num374];
24215 dust2.velocity *= 0.2f;
24216 }
24217 }
24218 return;
24219 }
24220 localAI[0] += 1f;
24221 if (localAI[0] > 3f)
24222 {
24223 for (int num375 = 0; num375 < 4; num375++)
24224 {
24225 Vector2 vector34 = base.position;
24226 vector34 -= velocity * ((float)num375 * 0.25f);
24227 alpha = 255;
24228 int num376 = Dust.NewDust(vector34, 1, 1, 162);
24229 Main.dust[num376].position = vector34;
24230 Main.dust[num376].position.X += width / 2;
24231 Main.dust[num376].position.Y += height / 2;
24232 Main.dust[num376].scale = (float)Main.rand.Next(70, 110) * 0.013f;
24233 Dust dust2 = Main.dust[num376];
24234 dust2.velocity *= 0.2f;
24235 }
24236 }
24237 }
24238 else if (aiStyle == 49)
24239 {
24240 if (this.ai[0] == -2f)
24241 {
24242 hostile = true;
24243 Kill();
24244 return;
24245 }
24246 if (this.ai[0] == -3f)
24247 {
24248 Kill();
24249 return;
24250 }
24251 if (soundDelay == 0)
24252 {
24253 soundDelay = 3000;
24255 }
24256 if (this.ai[0] >= 0f)
24257 {
24258 if (velocity.X > 0f)
24259 {
24260 direction = 1;
24261 }
24262 else if (velocity.X < 0f)
24263 {
24264 direction = -1;
24265 }
24267 this.ai[0] += 1f;
24268 rotation += velocity.X * 0.05f + (float)direction * 0.05f;
24269 if (this.ai[0] >= 18f)
24270 {
24271 velocity.Y += 0.28f;
24272 velocity.X *= 0.99f;
24273 }
24274 if ((double)velocity.Y > 15.9)
24275 {
24276 velocity.Y = 15.9f;
24277 }
24278 if (!(this.ai[0] > 2f))
24279 {
24280 return;
24281 }
24282 alpha = 0;
24283 if (this.ai[0] == 3f)
24284 {
24285 for (int num377 = 0; num377 < 10; num377++)
24286 {
24287 int num378 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
24288 Dust dust2 = Main.dust[num378];
24289 dust2.velocity *= 0.5f;
24290 dust2 = Main.dust[num378];
24291 dust2.velocity += velocity * 0.1f;
24292 }
24293 for (int num379 = 0; num379 < 5; num379++)
24294 {
24295 int num380 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2f);
24296 Main.dust[num380].noGravity = true;
24297 Dust dust2 = Main.dust[num380];
24298 dust2.velocity *= 3f;
24299 dust2 = Main.dust[num380];
24300 dust2.velocity += velocity * 0.2f;
24301 num380 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100);
24302 dust2 = Main.dust[num380];
24303 dust2.velocity *= 2f;
24304 dust2 = Main.dust[num380];
24305 dust2.velocity += velocity * 0.3f;
24306 }
24307 for (int num381 = 0; num381 < 1; num381++)
24308 {
24309 int num382 = Gore.NewGore(new Vector2(base.position.X - 10f, base.position.Y - 10f), default(Vector2), Main.rand.Next(61, 64));
24310 Gore gore = Main.gore[num382];
24311 gore.position += velocity * 1.25f;
24312 Main.gore[num382].scale = 1.5f;
24313 gore = Main.gore[num382];
24314 gore.velocity += velocity * 0.5f;
24315 gore = Main.gore[num382];
24316 gore.velocity *= 0.02f;
24317 }
24318 }
24319 }
24320 else if (this.ai[0] == -1f)
24321 {
24322 rotation = 0f;
24323 velocity.X *= 0.95f;
24324 velocity.Y += 0.2f;
24325 }
24326 }
24327 else if (aiStyle == 50)
24328 {
24329 if (type == 291)
24330 {
24331 if (localAI[0] == 0f)
24332 {
24334 localAI[0] += 1f;
24335 }
24336 bool flag19 = false;
24337 bool flag20 = false;
24338 if (velocity.X < 0f && base.position.X < this.ai[0])
24339 {
24340 flag19 = true;
24341 }
24342 if (velocity.X > 0f && base.position.X > this.ai[0])
24343 {
24344 flag19 = true;
24345 }
24346 if (velocity.Y < 0f && base.position.Y < this.ai[1])
24347 {
24348 flag20 = true;
24349 }
24350 if (velocity.Y > 0f && base.position.Y > this.ai[1])
24351 {
24352 flag20 = true;
24353 }
24354 if (flag19 && flag20)
24355 {
24356 Kill();
24357 }
24358 for (int num383 = 0; num383 < 10; num383++)
24359 {
24360 int num384 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 174, 0f, 0f, 100, default(Color), 1.2f);
24361 Main.dust[num384].noGravity = true;
24362 Dust dust2 = Main.dust[num384];
24363 dust2.velocity *= 0.5f;
24364 dust2 = Main.dust[num384];
24365 dust2.velocity += velocity * 0.1f;
24366 }
24367 return;
24368 }
24369 if (type == 295)
24370 {
24371 for (int num385 = 0; num385 < 8; num385++)
24372 {
24373 int num386 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 174, 0f, 0f, 100, default(Color), 1.2f);
24374 Main.dust[num386].noGravity = true;
24375 Dust dust2 = Main.dust[num386];
24376 dust2.velocity *= 0.5f;
24377 dust2 = Main.dust[num386];
24378 dust2.velocity += velocity * 0.1f;
24379 }
24380 return;
24381 }
24382 if (localAI[0] == 0f)
24383 {
24385 localAI[0] += 1f;
24386 }
24387 this.ai[0] += 1f;
24388 if (type == 296)
24389 {
24390 this.ai[0] += 3f;
24391 }
24392 float num387 = 25f;
24393 if (this.ai[0] > 540f)
24394 {
24395 num387 -= (this.ai[0] - 180f) / 2f;
24396 }
24397 if (num387 <= 0f)
24398 {
24399 num387 = 0f;
24400 Kill();
24401 }
24402 if (type == 296)
24403 {
24404 num387 *= 0.7f;
24405 }
24406 for (int num388 = 0; (float)num388 < num387; num388++)
24407 {
24408 float num389 = Main.rand.Next(-10, 11);
24409 float num390 = Main.rand.Next(-10, 11);
24410 float num391 = Main.rand.Next(3, 9);
24411 float num392 = (float)Math.Sqrt(num389 * num389 + num390 * num390);
24412 num392 = num391 / num392;
24413 num389 *= num392;
24414 num390 *= num392;
24415 int num393 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 174, 0f, 0f, 100, default(Color), 1.5f);
24416 Main.dust[num393].noGravity = true;
24417 Main.dust[num393].position.X = base.Center.X;
24418 Main.dust[num393].position.Y = base.Center.Y;
24419 Main.dust[num393].position.X += Main.rand.Next(-10, 11);
24420 Main.dust[num393].position.Y += Main.rand.Next(-10, 11);
24421 Main.dust[num393].velocity.X = num389;
24422 Main.dust[num393].velocity.Y = num390;
24423 }
24424 }
24425 else if (aiStyle == 51)
24426 {
24427 if (type == 297)
24428 {
24429 localAI[0] += 1f;
24430 if (localAI[0] > 4f)
24431 {
24432 for (int num394 = 0; num394 < 5; num394++)
24433 {
24434 int num395 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 175, 0f, 0f, 100, default(Color), 2f);
24435 Main.dust[num395].noGravity = true;
24436 Dust dust2 = Main.dust[num395];
24437 dust2.velocity *= 0f;
24438 }
24439 }
24440 }
24441 else
24442 {
24443 if (localAI[0] == 0f)
24444 {
24446 localAI[0] += 1f;
24447 }
24448 for (int num396 = 0; num396 < 9; num396++)
24449 {
24450 int num397 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 175, 0f, 0f, 100, default(Color), 1.3f);
24451 Main.dust[num397].noGravity = true;
24452 Dust dust2 = Main.dust[num397];
24453 dust2.velocity *= 0f;
24454 }
24455 }
24456 float num398 = base.Center.X;
24457 float num399 = base.Center.Y;
24458 float num400 = 400f;
24459 bool flag21 = false;
24460 int num401 = 0;
24461 if (type == 297)
24462 {
24463 for (int num402 = 0; num402 < 200; num402++)
24464 {
24465 if (Main.npc[num402].CanBeChasedBy(this) && Distance(Main.npc[num402].Center) < num400 && Collision.CanHit(base.Center, 1, 1, Main.npc[num402].Center, 1, 1))
24466 {
24467 float num403 = Main.npc[num402].position.X + (float)(Main.npc[num402].width / 2);
24468 float num404 = Main.npc[num402].position.Y + (float)(Main.npc[num402].height / 2);
24469 float num405 = Math.Abs(base.position.X + (float)(width / 2) - num403) + Math.Abs(base.position.Y + (float)(height / 2) - num404);
24470 if (num405 < num400)
24471 {
24472 num400 = num405;
24473 num398 = num403;
24474 num399 = num404;
24475 flag21 = true;
24476 num401 = num402;
24477 }
24478 }
24479 }
24480 }
24481 else
24482 {
24483 num400 = 200f;
24484 for (int num406 = 0; num406 < 255; num406++)
24485 {
24486 if (Main.player[num406].active && !Main.player[num406].dead)
24487 {
24488 float num407 = Main.player[num406].position.X + (float)(Main.player[num406].width / 2);
24489 float num408 = Main.player[num406].position.Y + (float)(Main.player[num406].height / 2);
24490 float num409 = Math.Abs(base.position.X + (float)(width / 2) - num407) + Math.Abs(base.position.Y + (float)(height / 2) - num408);
24491 if (num409 < num400)
24492 {
24493 num400 = num409;
24494 num398 = num407;
24495 num399 = num408;
24496 flag21 = true;
24497 num401 = num406;
24498 }
24499 }
24500 }
24501 }
24502 if (flag21)
24503 {
24504 float num410 = 3f;
24505 if (type == 297)
24506 {
24507 num410 = 6f;
24508 }
24509 Vector2 vector35 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
24510 float num411 = num398 - vector35.X;
24511 float num412 = num399 - vector35.Y;
24512 float num413 = (float)Math.Sqrt(num411 * num411 + num412 * num412);
24513 float num414 = num413;
24514 num413 = num410 / num413;
24515 num411 *= num413;
24516 num412 *= num413;
24517 if (type == 297)
24518 {
24519 velocity.X = (velocity.X * 20f + num411) / 21f;
24520 velocity.Y = (velocity.Y * 20f + num412) / 21f;
24521 }
24522 else
24523 {
24524 velocity.X = (velocity.X * 100f + num411) / 101f;
24525 velocity.Y = (velocity.Y * 100f + num412) / 101f;
24526 }
24527 }
24528 }
24529 else if (aiStyle == 52)
24530 {
24531 int num415 = (int)this.ai[0];
24532 float num416 = 4f;
24533 Vector2 vector36 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
24534 float num417 = Main.player[num415].Center.X - vector36.X;
24535 float num418 = Main.player[num415].Center.Y - vector36.Y;
24536 float num419 = (float)Math.Sqrt(num417 * num417 + num418 * num418);
24537 float num420 = num419;
24538 if (num419 < 50f && base.position.X < Main.player[num415].position.X + (float)Main.player[num415].width && base.position.X + (float)width > Main.player[num415].position.X && base.position.Y < Main.player[num415].position.Y + (float)Main.player[num415].height && base.position.Y + (float)height > Main.player[num415].position.Y)
24539 {
24540 if (owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech)
24541 {
24542 int num421 = (int)this.ai[1];
24543 Main.player[num415].HealEffect(num421, broadcast: false);
24544 Player player3 = Main.player[num415];
24545 player3.statLife += num421;
24546 if (Main.player[num415].statLife > Main.player[num415].statLifeMax2)
24547 {
24548 Main.player[num415].statLife = Main.player[num415].statLifeMax2;
24549 }
24550 NetMessage.SendData(66, -1, -1, null, num415, num421);
24551 }
24552 Kill();
24553 }
24554 num419 = num416 / num419;
24555 num417 *= num419;
24556 num418 *= num419;
24557 velocity.X = (velocity.X * 15f + num417) / 16f;
24558 velocity.Y = (velocity.Y * 15f + num418) / 16f;
24559 if (type == 305)
24560 {
24561 for (int num422 = 0; num422 < 3; num422++)
24562 {
24563 float num423 = velocity.X * 0.334f * (float)num422;
24564 float num424 = (0f - velocity.Y * 0.334f) * (float)num422;
24565 int num425 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 183, 0f, 0f, 100, default(Color), 1.1f);
24566 Main.dust[num425].noGravity = true;
24567 Dust dust2 = Main.dust[num425];
24568 dust2.velocity *= 0f;
24569 Main.dust[num425].position.X -= num423;
24570 Main.dust[num425].position.Y -= num424;
24571 }
24572 }
24573 else
24574 {
24575 for (int num426 = 0; num426 < 5; num426++)
24576 {
24577 float num427 = velocity.X * 0.2f * (float)num426;
24578 float num428 = (0f - velocity.Y * 0.2f) * (float)num426;
24579 int num429 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 175, 0f, 0f, 100, default(Color), 1.3f);
24580 Main.dust[num429].noGravity = true;
24581 Dust dust2 = Main.dust[num429];
24582 dust2.velocity *= 0f;
24583 Main.dust[num429].position.X -= num427;
24584 Main.dust[num429].position.Y -= num428;
24585 }
24586 }
24587 }
24588 else if (aiStyle == 53)
24589 {
24590 if (localAI[0] == 0f)
24591 {
24592 localAI[1] = 1f;
24593 localAI[0] = 1f;
24594 this.ai[0] = 120f;
24595 int num430 = 80;
24597 if (type == 308)
24598 {
24599 for (int num431 = 0; num431 < num430; num431++)
24600 {
24601 int num432 = Dust.NewDust(new Vector2(base.position.X, base.position.Y + 16f), width, height - 16, 185);
24602 Dust dust2 = Main.dust[num432];
24603 dust2.velocity *= 2f;
24604 Main.dust[num432].noGravity = true;
24605 dust2 = Main.dust[num432];
24606 dust2.scale *= 1.15f;
24607 }
24608 }
24609 if (type == 377)
24610 {
24611 frame = 4;
24612 num430 = 40;
24613 for (int num433 = 0; num433 < num430; num433++)
24614 {
24615 int num434 = Dust.NewDust(base.position + Vector2.UnitY * 16f, width, height - 16, 171, 0f, 0f, 100);
24616 Main.dust[num434].scale = (float)Main.rand.Next(1, 10) * 0.1f;
24617 Main.dust[num434].noGravity = true;
24618 Main.dust[num434].fadeIn = 1.5f;
24619 Dust dust2 = Main.dust[num434];
24620 dust2.velocity *= 0.75f;
24621 }
24622 }
24623 if (type == 966)
24624 {
24625 this.ai[1] = -1f;
24626 frame = 0;
24627 num430 = 30;
24628 int num435 = 25;
24629 int num436 = 30;
24630 for (int num437 = 0; num437 < num430; num437++)
24631 {
24632 int num438 = Dust.NewDust(base.Center - new Vector2(num435, num436), num435 * 2, num436 * 2, 219);
24633 Dust dust2 = Main.dust[num438];
24634 dust2.velocity *= 2f;
24635 Main.dust[num438].noGravity = true;
24636 dust2 = Main.dust[num438];
24637 dust2.scale *= 0.5f;
24638 }
24639 }
24640 }
24641 velocity.X = 0f;
24642 velocity.Y += 0.2f;
24643 if (velocity.Y > 16f)
24644 {
24645 velocity.Y = 16f;
24646 }
24647 bool flag22 = false;
24648 float num439 = base.Center.X;
24649 float num440 = base.Center.Y;
24650 float num441 = 1000f;
24651 int num442 = -1;
24653 if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(this))
24654 {
24655 float num443 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2);
24656 float num444 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2);
24657 float num445 = Math.Abs(base.position.X + (float)(width / 2) - num443) + Math.Abs(base.position.Y + (float)(height / 2) - num444);
24658 if (num445 < num441 && Collision.CanHit(base.position, width, height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height))
24659 {
24660 num441 = num445;
24661 num439 = num443;
24662 num440 = num444;
24663 flag22 = true;
24665 }
24666 }
24667 if (!flag22)
24668 {
24669 for (int num446 = 0; num446 < 200; num446++)
24670 {
24671 if (Main.npc[num446].CanBeChasedBy(this))
24672 {
24673 float num447 = Main.npc[num446].position.X + (float)(Main.npc[num446].width / 2);
24674 float num448 = Main.npc[num446].position.Y + (float)(Main.npc[num446].height / 2);
24675 float num449 = Math.Abs(base.position.X + (float)(width / 2) - num447) + Math.Abs(base.position.Y + (float)(height / 2) - num448);
24676 if (num449 < num441 && Collision.CanHit(base.position, width, height, Main.npc[num446].position, Main.npc[num446].width, Main.npc[num446].height))
24677 {
24678 num441 = num449;
24679 num439 = num447;
24680 num440 = num448;
24681 flag22 = true;
24682 num442 = Main.npc[num446].whoAmI;
24683 }
24684 }
24685 }
24686 }
24687 if (flag22)
24688 {
24689 if (type == 966 && this.ai[1] != (float)num442)
24690 {
24691 this.ai[1] = num442;
24692 netUpdate = true;
24693 }
24694 float num450 = num439;
24695 float num451 = num440;
24696 num439 -= base.Center.X;
24697 num440 -= base.Center.Y;
24698 int num452 = 0;
24699 if (type != 966)
24700 {
24701 if (frameCounter > 0)
24702 {
24703 frameCounter--;
24704 }
24705 if (frameCounter <= 0)
24706 {
24707 int num453 = spriteDirection;
24708 if (num439 < 0f)
24709 {
24710 spriteDirection = -1;
24711 }
24712 else
24713 {
24714 spriteDirection = 1;
24715 }
24716 num452 = ((!(num440 > 0f)) ? ((Math.Abs(num440) > Math.Abs(num439) * 3f) ? 4 : ((Math.Abs(num440) > Math.Abs(num439) * 2f) ? 3 : ((!(Math.Abs(num439) > Math.Abs(num440) * 3f)) ? ((Math.Abs(num439) > Math.Abs(num440) * 2f) ? 1 : 2) : 0))) : 0);
24717 int num454 = frame;
24718 if (type == 308)
24719 {
24720 frame = num452 * 2;
24721 }
24722 else if (type == 377)
24723 {
24724 frame = num452;
24725 }
24726 if (this.ai[0] > 40f && localAI[1] == 0f && type == 308)
24727 {
24728 frame++;
24729 }
24730 if (num454 != frame || num453 != spriteDirection)
24731 {
24732 frameCounter = 8;
24733 if (this.ai[0] <= 0f)
24734 {
24735 frameCounter = 4;
24736 }
24737 }
24738 }
24739 }
24740 if (this.ai[0] <= 0f)
24741 {
24742 float num455 = 60f;
24743 if (type == 966)
24744 {
24745 num455 = 90f;
24746 }
24747 localAI[1] = 0f;
24748 this.ai[0] = num455;
24749 netUpdate = true;
24750 if (Main.myPlayer == owner)
24751 {
24752 float num456 = 6f;
24753 int num457 = 309;
24754 if (type == 308)
24755 {
24756 num457 = 309;
24757 num456 = 9f;
24758 }
24759 if (type == 377)
24760 {
24761 num457 = 378;
24762 num456 = 9f;
24763 }
24764 if (type == 966)
24765 {
24766 num457 = 967;
24767 num456 = 12.5f;
24768 }
24769 Vector2 vector37 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
24770 if (type == 966)
24771 {
24772 vector37.Y -= 16f;
24773 }
24774 else
24775 {
24776 switch (num452)
24777 {
24778 case 0:
24779 vector37.Y += 12f;
24780 vector37.X += 24 * spriteDirection;
24781 break;
24782 case 1:
24783 vector37.Y += 0f;
24784 vector37.X += 24 * spriteDirection;
24785 break;
24786 case 2:
24787 vector37.Y -= 2f;
24788 vector37.X += 24 * spriteDirection;
24789 break;
24790 case 3:
24791 vector37.Y -= 6f;
24792 vector37.X += 14 * spriteDirection;
24793 break;
24794 case 4:
24795 vector37.Y -= 14f;
24796 vector37.X += 2 * spriteDirection;
24797 break;
24798 }
24799 }
24800 if (type != 966 && spriteDirection < 0)
24801 {
24802 vector37.X += 10f;
24803 }
24804 float num458 = num450 - vector37.X;
24805 float num459 = num451 - vector37.Y;
24806 float num460 = (float)Math.Sqrt(num458 * num458 + num459 * num459);
24807 float num461 = num460;
24808 num460 = num456 / num460;
24809 num458 *= num460;
24810 num459 *= num460;
24811 int num462 = damage;
24813 }
24814 }
24815 }
24816 else
24817 {
24818 if (type == 966 && this.ai[1] != -1f)
24819 {
24820 this.ai[1] = -1f;
24821 netUpdate = true;
24822 }
24823 if (type != 966 && this.ai[0] <= 60f && (frame == 1 || frame == 3 || frame == 5 || frame == 7 || frame == 9))
24824 {
24825 frame--;
24826 }
24827 }
24828 if (this.ai[0] > 0f)
24829 {
24830 this.ai[0] -= 1f;
24831 }
24832 }
24833 else if (aiStyle == 54)
24834 {
24835 if (type == 317)
24836 {
24837 if (Main.player[Main.myPlayer].dead)
24838 {
24839 Main.player[Main.myPlayer].raven = false;
24840 }
24841 if (Main.player[Main.myPlayer].raven)
24842 {
24843 timeLeft = 2;
24844 }
24845 }
24846 for (int num464 = 0; num464 < 1000; num464++)
24847 {
24848 if (num464 != whoAmI && Main.projectile[num464].active && Main.projectile[num464].owner == owner && Main.projectile[num464].type == type && Math.Abs(base.position.X - Main.projectile[num464].position.X) + Math.Abs(base.position.Y - Main.projectile[num464].position.Y) < (float)width)
24849 {
24850 if (base.position.X < Main.projectile[num464].position.X)
24851 {
24852 velocity.X -= 0.05f;
24853 }
24854 else
24855 {
24856 velocity.X += 0.05f;
24857 }
24858 if (base.position.Y < Main.projectile[num464].position.Y)
24859 {
24860 velocity.Y -= 0.05f;
24861 }
24862 else
24863 {
24864 velocity.Y += 0.05f;
24865 }
24866 }
24867 }
24868 float num465 = base.position.X;
24869 float num466 = base.position.Y;
24870 float num467 = 900f;
24871 bool flag23 = false;
24872 int num468 = 500;
24873 if (this.ai[1] != 0f || friendly)
24874 {
24875 num468 = 1400;
24876 }
24877 if (Math.Abs(base.Center.X - Main.player[owner].Center.X) + Math.Abs(base.Center.Y - Main.player[owner].Center.Y) > (float)num468)
24878 {
24879 this.ai[0] = 1f;
24880 }
24881 if (this.ai[0] == 0f)
24882 {
24883 tileCollide = true;
24885 if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(this))
24886 {
24887 float num469 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2);
24888 float num470 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2);
24889 float num471 = Math.Abs(base.position.X + (float)(width / 2) - num469) + Math.Abs(base.position.Y + (float)(height / 2) - num470);
24890 if (num471 < num467 && Collision.CanHit(base.position, width, height, ownerMinionAttackTargetNPC2.position, ownerMinionAttackTargetNPC2.width, ownerMinionAttackTargetNPC2.height))
24891 {
24892 num467 = num471;
24893 num465 = num469;
24894 num466 = num470;
24895 flag23 = true;
24896 }
24897 }
24898 if (!flag23)
24899 {
24900 for (int num472 = 0; num472 < 200; num472++)
24901 {
24902 if (Main.npc[num472].CanBeChasedBy(this))
24903 {
24904 float num473 = Main.npc[num472].position.X + (float)(Main.npc[num472].width / 2);
24905 float num474 = Main.npc[num472].position.Y + (float)(Main.npc[num472].height / 2);
24906 float num475 = Math.Abs(base.position.X + (float)(width / 2) - num473) + Math.Abs(base.position.Y + (float)(height / 2) - num474);
24907 if (num475 < num467 && Collision.CanHit(base.position, width, height, Main.npc[num472].position, Main.npc[num472].width, Main.npc[num472].height))
24908 {
24909 num467 = num475;
24910 num465 = num473;
24911 num466 = num474;
24912 flag23 = true;
24913 }
24914 }
24915 }
24916 }
24917 }
24918 else
24919 {
24920 tileCollide = false;
24921 }
24922 if (!flag23)
24923 {
24924 friendly = true;
24925 float num476 = 8f;
24926 if (this.ai[0] == 1f)
24927 {
24928 num476 = 12f;
24929 }
24930 Vector2 vector38 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
24931 float num477 = Main.player[owner].Center.X - vector38.X;
24932 float num478 = Main.player[owner].Center.Y - vector38.Y - 60f;
24933 float num479 = (float)Math.Sqrt(num477 * num477 + num478 * num478);
24934 float num480 = num479;
24935 if (num479 < 100f && this.ai[0] == 1f && !Collision.SolidCollision(base.position, width, height))
24936 {
24937 this.ai[0] = 0f;
24938 }
24939 if (num479 > 2000f)
24940 {
24941 base.position.X = Main.player[owner].Center.X - (float)(width / 2);
24942 base.position.Y = Main.player[owner].Center.Y - (float)(width / 2);
24943 }
24944 if (type == 317 && num479 > 100f)
24945 {
24946 num476 = 12f;
24947 if (this.ai[0] == 1f)
24948 {
24949 num476 = 15f;
24950 }
24951 }
24952 if (num479 > 70f)
24953 {
24954 num479 = num476 / num479;
24955 num477 *= num479;
24956 num478 *= num479;
24957 velocity.X = (velocity.X * 20f + num477) / 21f;
24958 velocity.Y = (velocity.Y * 20f + num478) / 21f;
24959 }
24960 else
24961 {
24962 if (velocity.X == 0f && velocity.Y == 0f)
24963 {
24964 velocity.X = -0.15f;
24965 velocity.Y = -0.05f;
24966 }
24967 velocity *= 1.01f;
24968 }
24969 friendly = false;
24970 rotation = velocity.X * 0.05f;
24971 frameCounter++;
24972 if (frameCounter >= 4)
24973 {
24974 frameCounter = 0;
24975 frame++;
24976 }
24977 if (frame > 3)
24978 {
24979 frame = 0;
24980 }
24981 if ((double)Math.Abs(velocity.X) > 0.2)
24982 {
24984 }
24985 return;
24986 }
24987 if (this.ai[1] == -1f)
24988 {
24989 this.ai[1] = 17f;
24990 }
24991 if (this.ai[1] > 0f)
24992 {
24993 this.ai[1] -= 1f;
24994 }
24995 if (this.ai[1] == 0f)
24996 {
24997 friendly = true;
24998 float num481 = 16f;
24999 Vector2 vector39 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
25000 float num482 = num465 - vector39.X;
25001 float num483 = num466 - vector39.Y;
25002 float num484 = (float)Math.Sqrt(num482 * num482 + num483 * num483);
25003 float num485 = num484;
25004 if (num484 < 100f)
25005 {
25006 num481 = 10f;
25007 }
25008 num484 = num481 / num484;
25009 num482 *= num484;
25010 num483 *= num484;
25011 velocity.X = (velocity.X * 14f + num482) / 15f;
25012 velocity.Y = (velocity.Y * 14f + num483) / 15f;
25013 }
25014 else
25015 {
25016 friendly = false;
25017 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < 10f)
25018 {
25019 velocity *= 1.05f;
25020 }
25021 }
25022 rotation = velocity.X * 0.05f;
25023 frameCounter++;
25024 if (frameCounter >= 4)
25025 {
25026 frameCounter = 0;
25027 frame++;
25028 }
25029 if (frame < 4)
25030 {
25031 frame = 4;
25032 }
25033 if (frame > 7)
25034 {
25035 frame = 4;
25036 }
25037 if ((double)Math.Abs(velocity.X) > 0.2)
25038 {
25040 }
25041 }
25042 else if (aiStyle == 55)
25043 {
25044 frameCounter++;
25045 if (frameCounter > 0)
25046 {
25047 frame++;
25048 frameCounter = 0;
25049 if (frame > 2)
25050 {
25051 frame = 0;
25052 }
25053 }
25054 if (velocity.X < 0f)
25055 {
25056 spriteDirection = -1;
25057 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
25058 }
25059 else
25060 {
25061 spriteDirection = 1;
25062 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
25063 }
25064 if (this.ai[0] >= 0f && this.ai[0] < 200f)
25065 {
25066 int num486 = (int)this.ai[0];
25067 NPC nPC2 = Main.npc[num486];
25068 if (nPC2.CanBeChasedBy(this) && !NPCID.Sets.CountsAsCritter[nPC2.type])
25069 {
25070 float num487 = 8f;
25071 Vector2 center2 = base.Center;
25072 float num488 = nPC2.Center.X - center2.X;
25073 float num489 = nPC2.Center.Y - center2.Y;
25074 float num490 = (float)Math.Sqrt(num488 * num488 + num489 * num489);
25075 float num491 = num490;
25076 num490 = num487 / num490;
25077 num488 *= num490;
25078 num489 *= num490;
25079 velocity.X = (velocity.X * 14f + num488) / 15f;
25080 velocity.Y = (velocity.Y * 14f + num489) / 15f;
25081 }
25082 else
25083 {
25084 float num492 = 1000f;
25085 for (int num493 = 0; num493 < 200; num493++)
25086 {
25087 NPC nPC3 = Main.npc[num493];
25088 if (nPC3.CanBeChasedBy(this) && !NPCID.Sets.CountsAsCritter[nPC3.type])
25089 {
25090 float x4 = nPC3.Center.X;
25091 float y4 = nPC3.Center.Y;
25092 float num494 = Math.Abs(base.Center.X - x4) + Math.Abs(base.Center.Y - y4);
25093 if (num494 < num492 && Collision.CanHit(base.position, width, height, nPC3.position, nPC3.width, nPC3.height))
25094 {
25095 num492 = num494;
25096 this.ai[0] = num493;
25097 }
25098 }
25099 }
25100 }
25101 int num495 = 8;
25102 int num496 = Dust.NewDust(new Vector2(base.position.X + (float)num495, base.position.Y + (float)num495), width - num495 * 2, height - num495 * 2, 6);
25103 Dust dust2 = Main.dust[num496];
25104 dust2.velocity *= 0.5f;
25105 dust2 = Main.dust[num496];
25106 dust2.velocity += velocity * 0.5f;
25107 Main.dust[num496].noGravity = true;
25108 Main.dust[num496].noLight = true;
25109 Main.dust[num496].scale = 1.4f;
25110 }
25111 else
25112 {
25113 Kill();
25114 }
25115 }
25116 else if (aiStyle == 56)
25117 {
25118 if (localAI[0] == 0f)
25119 {
25120 localAI[0] = 1f;
25121 rotation = this.ai[0];
25122 spriteDirection = -(int)this.ai[1];
25123 }
25124 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < 16f)
25125 {
25126 velocity *= 1.05f;
25127 }
25128 if (velocity.X < 0f)
25129 {
25130 direction = -1;
25131 }
25132 else
25133 {
25134 direction = 1;
25135 }
25136 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.025f * (float)direction;
25137 }
25138 else if (aiStyle == 57)
25139 {
25140 this.ai[0] += 1f;
25141 if (this.ai[0] > 30f)
25142 {
25143 this.ai[0] = 30f;
25144 velocity.Y += 0.25f;
25145 if (velocity.Y > 16f)
25146 {
25147 velocity.Y = 16f;
25148 }
25149 velocity.X *= 0.995f;
25150 }
25151 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
25152 alpha -= 50;
25153 if (alpha < 0)
25154 {
25155 alpha = 0;
25156 }
25157 if (owner == Main.myPlayer)
25158 {
25159 if (localAI[1] == 0f)
25160 {
25161 localAI[1] = Main.rand.Next(7);
25162 }
25163 localAI[0]++;
25164 int num497 = 8;
25165 if (localAI[1] > 0f)
25166 {
25167 num497 += (int)localAI[1];
25168 }
25169 if (localAI[0] >= (float)num497)
25170 {
25171 localAI[0] = 0f;
25172 localAI[1] = -1f;
25173 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, 0f, 0f, 344, (int)((float)damage * 0.7f), knockBack * 0.55f, owner, 0f, Main.rand.Next(3));
25174 }
25175 }
25176 }
25177 else if (aiStyle == 58)
25178 {
25179 alpha -= 50;
25180 if (alpha < 0)
25181 {
25182 alpha = 0;
25183 }
25184 if (this.ai[0] == 0f)
25185 {
25186 frame = 0;
25187 this.ai[1] += 1f;
25188 if (this.ai[1] > 30f)
25189 {
25190 velocity.Y += 0.1f;
25191 }
25192 if (velocity.Y >= 0f)
25193 {
25194 this.ai[0] = 1f;
25195 }
25196 }
25197 if (this.ai[0] == 1f)
25198 {
25199 frame = 1;
25200 velocity.Y += 0.1f;
25201 if (velocity.Y > 3f)
25202 {
25203 velocity.Y = 3f;
25204 }
25205 velocity.X *= 0.99f;
25206 }
25207 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
25208 }
25209 else if (aiStyle == 59)
25210 {
25211 this.ai[1] += 1f;
25212 if (this.ai[1] >= 60f)
25213 {
25214 friendly = true;
25215 int num498 = (int)this.ai[0];
25216 if (Main.myPlayer == owner && (num498 == -1 || !Main.npc[num498].CanBeChasedBy(this)))
25217 {
25218 num498 = -1;
25219 int[] array = new int[200];
25220 int num499 = 0;
25221 for (int num500 = 0; num500 < 200; num500++)
25222 {
25223 if (Main.npc[num500].CanBeChasedBy(this))
25224 {
25225 float num501 = Math.Abs(Main.npc[num500].position.X + (float)(Main.npc[num500].width / 2) - base.position.X + (float)(width / 2)) + Math.Abs(Main.npc[num500].position.Y + (float)(Main.npc[num500].height / 2) - base.position.Y + (float)(height / 2));
25226 if (num501 < 800f)
25227 {
25228 array[num499] = num500;
25229 num499++;
25230 }
25231 }
25232 }
25233 if (num499 == 0)
25234 {
25235 Kill();
25236 return;
25237 }
25238 num498 = array[Main.rand.Next(num499)];
25239 this.ai[0] = num498;
25240 netUpdate = true;
25241 }
25242 if (num498 != -1)
25243 {
25244 float num502 = 4f;
25245 Vector2 vector40 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
25246 float num503 = Main.npc[num498].Center.X - vector40.X;
25247 float num504 = Main.npc[num498].Center.Y - vector40.Y;
25248 float num505 = (float)Math.Sqrt(num503 * num503 + num504 * num504);
25249 float num506 = num505;
25250 num505 = num502 / num505;
25251 num503 *= num505;
25252 num504 *= num505;
25253 int num507 = 30;
25254 velocity.X = (velocity.X * (float)(num507 - 1) + num503) / (float)num507;
25255 velocity.Y = (velocity.Y * (float)(num507 - 1) + num504) / (float)num507;
25256 }
25257 }
25258 for (int num508 = 0; num508 < 5; num508++)
25259 {
25260 float num509 = velocity.X * 0.2f * (float)num508;
25261 float num510 = (0f - velocity.Y * 0.2f) * (float)num508;
25262 int num511 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 175, 0f, 0f, 100, default(Color), 1.3f);
25263 Main.dust[num511].noGravity = true;
25264 Dust dust2 = Main.dust[num511];
25265 dust2.velocity *= 0f;
25266 Main.dust[num511].position.X -= num509;
25267 Main.dust[num511].position.Y -= num510;
25268 }
25269 }
25270 else if (aiStyle == 60)
25271 {
25272 scale -= 0.015f;
25273 if (scale <= 0f)
25274 {
25275 velocity *= 5f;
25277 Kill();
25278 }
25279 if (this.ai[0] > 3f)
25280 {
25281 int num512 = 103;
25282 if (type == 406)
25283 {
25284 num512 = 137;
25285 }
25286 if (owner == Main.myPlayer)
25287 {
25288 Rectangle rectangle4 = new Rectangle((int)base.position.X, (int)base.position.Y, width, height);
25289 for (int num513 = 0; num513 < 200; num513++)
25290 {
25291 if (Main.npc[num513].active && !Main.npc[num513].dontTakeDamage && Main.npc[num513].lifeMax > 1)
25292 {
25293 Rectangle value4 = new Rectangle((int)Main.npc[num513].position.X, (int)Main.npc[num513].position.Y, Main.npc[num513].width, Main.npc[num513].height);
25294 if (rectangle4.Intersects(value4))
25295 {
25296 Main.npc[num513].AddBuff(num512, 1500);
25297 Kill();
25298 }
25299 }
25300 }
25301 for (int num514 = 0; num514 < 255; num514++)
25302 {
25303 if (num514 != owner && Main.player[num514].active && !Main.player[num514].dead)
25304 {
25305 Rectangle value5 = new Rectangle((int)Main.player[num514].position.X, (int)Main.player[num514].position.Y, Main.player[num514].width, Main.player[num514].height);
25306 if (rectangle4.Intersects(value5))
25307 {
25308 Main.player[num514].AddBuff(num512, 1500, quiet: false);
25309 Kill();
25310 }
25311 }
25312 }
25313 }
25314 this.ai[0] += this.ai[1];
25315 if (this.ai[0] > 30f)
25316 {
25317 velocity.Y += 0.1f;
25318 }
25319 if (type == 358)
25320 {
25321 for (int num515 = 0; num515 < 1; num515++)
25322 {
25323 for (int num516 = 0; num516 < 6; num516++)
25324 {
25325 float num517 = velocity.X / 6f * (float)num516;
25326 float num518 = velocity.Y / 6f * (float)num516;
25327 int num519 = 6;
25328 int num520 = Dust.NewDust(new Vector2(base.position.X + (float)num519, base.position.Y + (float)num519), width - num519 * 2, height - num519 * 2, 211, 0f, 0f, 75, default(Color), 1.2f);
25329 Dust dust2;
25330 if (Main.rand.Next(2) == 0)
25331 {
25332 dust2 = Main.dust[num520];
25333 dust2.alpha += 25;
25334 }
25335 if (Main.rand.Next(2) == 0)
25336 {
25337 dust2 = Main.dust[num520];
25338 dust2.alpha += 25;
25339 }
25340 if (Main.rand.Next(2) == 0)
25341 {
25342 dust2 = Main.dust[num520];
25343 dust2.alpha += 25;
25344 }
25345 Main.dust[num520].noGravity = true;
25346 dust2 = Main.dust[num520];
25347 dust2.velocity *= 0.3f;
25348 dust2 = Main.dust[num520];
25349 dust2.velocity += velocity * 0.5f;
25350 Main.dust[num520].position = base.Center;
25351 Main.dust[num520].position.X -= num517;
25352 Main.dust[num520].position.Y -= num518;
25353 dust2 = Main.dust[num520];
25354 dust2.velocity *= 0.2f;
25355 }
25356 if (Main.rand.Next(4) == 0)
25357 {
25358 int num521 = 6;
25359 int num522 = Dust.NewDust(new Vector2(base.position.X + (float)num521, base.position.Y + (float)num521), width - num521 * 2, height - num521 * 2, 211, 0f, 0f, 75, default(Color), 0.65f);
25360 Dust dust2 = Main.dust[num522];
25361 dust2.velocity *= 0.5f;
25362 dust2 = Main.dust[num522];
25363 dust2.velocity += velocity * 0.5f;
25364 }
25365 }
25366 }
25367 if (type != 406)
25368 {
25369 return;
25370 }
25371 int num523 = 175;
25372 Color newColor2 = new Color(0, 80, 255, 100);
25373 for (int num524 = 0; num524 < 6; num524++)
25374 {
25376 int num525 = 6;
25377 int num526 = Dust.NewDust(base.position + Vector2.One * 6f, width - num525 * 2, height - num525 * 2, 4, 0f, 0f, num523, newColor2, 1.2f);
25378 Dust dust2;
25379 if (Main.rand.Next(2) == 0)
25380 {
25381 dust2 = Main.dust[num526];
25382 dust2.alpha += 25;
25383 }
25384 if (Main.rand.Next(2) == 0)
25385 {
25386 dust2 = Main.dust[num526];
25387 dust2.alpha += 25;
25388 }
25389 if (Main.rand.Next(2) == 0)
25390 {
25391 dust2 = Main.dust[num526];
25392 dust2.alpha += 25;
25393 }
25394 Main.dust[num526].noGravity = true;
25395 dust2 = Main.dust[num526];
25396 dust2.velocity *= 0.3f;
25397 dust2 = Main.dust[num526];
25398 dust2.velocity += velocity * 0.5f;
25399 Main.dust[num526].position = base.Center;
25400 Main.dust[num526].position.X -= vector41.X;
25401 Main.dust[num526].position.Y -= vector41.Y;
25402 dust2 = Main.dust[num526];
25403 dust2.velocity *= 0.2f;
25404 }
25405 if (Main.rand.Next(4) == 0)
25406 {
25407 int num527 = 6;
25408 int num528 = Dust.NewDust(base.position + Vector2.One * 6f, width - num527 * 2, height - num527 * 2, 4, 0f, 0f, num523, newColor2, 1.2f);
25409 Dust dust2 = Main.dust[num528];
25410 dust2.velocity *= 0.5f;
25411 dust2 = Main.dust[num528];
25412 dust2.velocity += velocity * 0.5f;
25413 }
25414 }
25415 else
25416 {
25417 this.ai[0] += 1f;
25418 }
25419 }
25420 else if (aiStyle == 61)
25421 {
25423 }
25424 else if (aiStyle == 62)
25425 {
25426 AI_062();
25427 }
25428 else if (aiStyle == 63)
25429 {
25430 if (!Main.player[owner].active)
25431 {
25432 active = false;
25433 return;
25434 }
25435 Vector2 center3 = base.position;
25436 bool flag24 = false;
25437 float num529 = 2000f;
25438 for (int num530 = 0; num530 < 200; num530++)
25439 {
25440 NPC nPC4 = Main.npc[num530];
25441 if (nPC4.CanBeChasedBy(this))
25442 {
25443 float num531 = Vector2.Distance(nPC4.Center, base.Center);
25444 if (!(num531 >= num529) && Collision.CanHit(base.position, width, height, nPC4.position, nPC4.width, nPC4.height))
25445 {
25446 num529 = num531;
25447 center3 = nPC4.Center;
25448 flag24 = true;
25449 }
25450 }
25451 }
25452 if (!flag24)
25453 {
25454 velocity.X *= 0.95f;
25455 }
25456 else
25457 {
25458 float num532 = 5f;
25459 float num533 = 0.08f;
25460 if (velocity.Y == 0f)
25461 {
25462 bool flag25 = false;
25463 if (base.Center.Y - 50f > center3.Y)
25464 {
25465 flag25 = true;
25466 }
25467 if (flag25)
25468 {
25469 velocity.Y = -6f;
25470 }
25471 }
25472 else
25473 {
25474 num532 = 8f;
25475 num533 = 0.12f;
25476 }
25477 velocity.X += (float)Math.Sign(center3.X - base.Center.X) * num533;
25478 if (velocity.X < 0f - num532)
25479 {
25480 velocity.X = 0f - num532;
25481 }
25482 if (velocity.X > num532)
25483 {
25484 velocity.X = num532;
25485 }
25486 }
25487 float num534 = 0f;
25488 Collision.StepUp(ref base.position, ref velocity, width, height, ref num534, ref gfxOffY);
25489 if (velocity.Y != 0f)
25490 {
25491 frame = 3;
25492 }
25493 else
25494 {
25495 if (Math.Abs(velocity.X) > 0.2f)
25496 {
25497 frameCounter++;
25498 }
25499 if (frameCounter >= 9)
25500 {
25501 frameCounter = 0;
25502 }
25503 if (frameCounter >= 6)
25504 {
25505 frame = 2;
25506 }
25507 else if (frameCounter >= 3)
25508 {
25509 frame = 1;
25510 }
25511 else
25512 {
25513 frame = 0;
25514 }
25515 }
25516 if (velocity.X != 0f)
25517 {
25519 }
25521 velocity.Y += 0.2f;
25522 if (velocity.Y > 16f)
25523 {
25524 velocity.Y = 16f;
25525 }
25526 }
25527 else if (aiStyle == 64)
25528 {
25529 int num535 = 10;
25530 int num536 = 15;
25531 float num537 = 1f;
25532 int num538 = 150;
25533 int num539 = 42;
25534 if (type == 386)
25535 {
25536 num535 = 16;
25537 num536 = 16;
25538 num537 = 1.5f;
25539 }
25540 if (velocity.X != 0f)
25541 {
25543 }
25544 frameCounter++;
25545 if (frameCounter > 2)
25546 {
25547 frame++;
25548 frameCounter = 0;
25549 }
25550 if (frame >= 6)
25551 {
25552 frame = 0;
25553 }
25554 if (localAI[0] == 0f && Main.myPlayer == owner)
25555 {
25556 localAI[0] = 1f;
25557 base.position.X += width / 2;
25558 base.position.Y += height / 2;
25559 scale = ((float)(num535 + num536) - this.ai[1]) * num537 / (float)(num536 + num535);
25560 width = (int)((float)num538 * scale);
25561 height = (int)((float)num539 * scale);
25562 base.position.X -= width / 2;
25563 base.position.Y -= height / 2;
25564 netUpdate = true;
25565 }
25566 if (this.ai[1] != -1f)
25567 {
25568 scale = ((float)(num535 + num536) - this.ai[1]) * num537 / (float)(num536 + num535);
25569 width = (int)((float)num538 * scale);
25570 height = (int)((float)num539 * scale);
25571 }
25572 if (!Collision.SolidCollision(base.position, width, height))
25573 {
25574 alpha -= 30;
25575 if (alpha < 60)
25576 {
25577 alpha = 60;
25578 }
25579 if (type == 386 && alpha < 100)
25580 {
25581 alpha = 100;
25582 }
25583 }
25584 else
25585 {
25586 alpha += 30;
25587 if (alpha > 150)
25588 {
25589 alpha = 150;
25590 }
25591 }
25592 if (this.ai[0] > 0f)
25593 {
25594 this.ai[0]--;
25595 }
25596 if (this.ai[0] == 1f && this.ai[1] > 0f && owner == Main.myPlayer)
25597 {
25598 netUpdate = true;
25599 Vector2 center4 = base.Center;
25600 center4.Y -= (float)num539 * scale / 2f;
25601 float num540 = ((float)(num535 + num536) - this.ai[1] + 1f) * num537 / (float)(num536 + num535);
25602 center4.Y -= (float)num539 * num540 / 2f;
25603 center4.Y += 2f;
25605 int num541 = 4;
25606 if (type == 386)
25607 {
25608 num541 = 2;
25609 }
25610 if ((int)this.ai[1] % num541 == 0 && this.ai[1] != 0f)
25611 {
25612 int num542 = 372;
25613 if (type == 386)
25614 {
25615 num542 = 373;
25616 }
25617 int num543 = NPC.NewNPC(GetNPCSource_FromThis(), (int)center4.X, (int)center4.Y, num542);
25618 Main.npc[num543].velocity = velocity;
25619 Main.npc[num543].netUpdate = true;
25620 if (type == 386)
25621 {
25622 Main.npc[num543].ai[2] = width;
25623 Main.npc[num543].ai[3] = -1.5f;
25624 }
25625 }
25626 }
25627 if (this.ai[0] <= 0f)
25628 {
25629 float num544 = (float)Math.PI / 30f;
25630 float num545 = (float)width / 5f;
25631 if (type == 386)
25632 {
25633 num545 *= 2f;
25634 }
25635 float num546 = (float)(Math.Cos(num544 * (0f - this.ai[0])) - 0.5) * num545;
25636 base.position.X -= num546 * (float)(-direction);
25637 this.ai[0]--;
25638 num546 = (float)(Math.Cos(num544 * (0f - this.ai[0])) - 0.5) * num545;
25639 base.position.X += num546 * (float)(-direction);
25640 }
25641 }
25642 else if (aiStyle == 65)
25643 {
25644 if (this.ai[1] > 0f)
25645 {
25646 int num547 = (int)this.ai[1] - 1;
25647 if (num547 < 255)
25648 {
25649 localAI[0]++;
25650 if (localAI[0] > 10f)
25651 {
25652 int num548 = 6;
25653 for (int num549 = 0; num549 < num548; num549++)
25654 {
25655 Vector2 spinningpoint = Vector2.Normalize(velocity) * new Vector2((float)width / 2f, height) * 0.75f;
25656 spinningpoint = spinningpoint.RotatedBy((double)(num549 - (num548 / 2 - 1)) * Math.PI / (double)num548) + base.Center;
25657 Vector2 vector42 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - (float)Math.PI / 2f).ToRotationVector2() * Main.rand.Next(3, 8);
25658 int num550 = Dust.NewDust(spinningpoint + vector42, 0, 0, 172, vector42.X * 2f, vector42.Y * 2f, 100, default(Color), 1.4f);
25659 Main.dust[num550].noGravity = true;
25660 Main.dust[num550].noLight = true;
25661 Dust dust2 = Main.dust[num550];
25662 dust2.velocity /= 4f;
25663 dust2 = Main.dust[num550];
25664 dust2.velocity -= velocity;
25665 }
25666 alpha -= 5;
25667 if (alpha < 100)
25668 {
25669 alpha = 100;
25670 }
25671 rotation += velocity.X * 0.1f;
25672 frame = (int)(localAI[0] / 3f) % 3;
25673 }
25674 Vector2 value6 = Main.player[num547].Center - base.Center;
25675 float num551 = 4f;
25676 if (this.ai[2] == 1f)
25677 {
25678 num551 += 12f;
25679 }
25680 num551 += localAI[0] / 20f;
25682 if (value6.Length() < 50f)
25683 {
25684 Kill();
25685 }
25686 }
25687 }
25688 else
25689 {
25690 float num552 = (float)Math.PI / 15f;
25691 float num553 = 4f;
25692 float num554 = (float)(Math.Cos(num552 * this.ai[0]) - 0.5) * num553;
25693 velocity.Y -= num554;
25694 this.ai[0]++;
25695 num554 = (float)(Math.Cos(num552 * this.ai[0]) - 0.5) * num553;
25696 velocity.Y += num554;
25697 localAI[0]++;
25698 if (localAI[0] > 10f)
25699 {
25700 alpha -= 5;
25701 if (alpha < 100)
25702 {
25703 alpha = 100;
25704 }
25705 rotation += velocity.X * 0.1f;
25706 frame = (int)(localAI[0] / 3f) % 3;
25707 }
25708 }
25709 if (wet)
25710 {
25711 base.position.Y -= 16f;
25712 Kill();
25713 }
25714 }
25715 else if (aiStyle == 66)
25716 {
25717 float num555 = 0f;
25718 float num556 = 0f;
25719 float num557 = 0f;
25720 float num558 = 0f;
25721 bool flag26 = type == 387 || type == 388;
25722 if (flag26)
25723 {
25724 num555 = 2000f;
25725 num556 = 800f;
25726 num557 = 1200f;
25727 num558 = 150f;
25728 if (Main.player[owner].dead)
25729 {
25730 Main.player[owner].twinsMinion = false;
25731 }
25732 if (Main.player[owner].twinsMinion)
25733 {
25734 timeLeft = 2;
25735 }
25736 }
25737 if (type == 533)
25738 {
25739 num555 = 2000f;
25740 num556 = 900f;
25741 num557 = 1500f;
25742 num558 = 450f;
25743 if (Main.player[owner].dead)
25744 {
25745 Main.player[owner].DeadlySphereMinion = false;
25746 }
25747 if (Main.player[owner].DeadlySphereMinion)
25748 {
25749 timeLeft = 2;
25750 }
25751 localAI[2] = Utils.Clamp(localAI[2] - 1f, 0f, 60f);
25752 }
25753 float num559 = 0.05f;
25754 for (int num560 = 0; num560 < 1000; num560++)
25755 {
25756 bool flag27 = (Main.projectile[num560].type == 387 || Main.projectile[num560].type == 388) && (type == 387 || type == 388);
25757 if (!flag27)
25758 {
25759 flag27 = type == 533 && Main.projectile[num560].type == 533;
25760 }
25761 if (num560 != whoAmI && Main.projectile[num560].active && Main.projectile[num560].owner == owner && flag27 && Math.Abs(base.position.X - Main.projectile[num560].position.X) + Math.Abs(base.position.Y - Main.projectile[num560].position.Y) < (float)width)
25762 {
25763 if (base.position.X < Main.projectile[num560].position.X)
25764 {
25765 velocity.X -= num559;
25766 }
25767 else
25768 {
25769 velocity.X += num559;
25770 }
25771 if (base.position.Y < Main.projectile[num560].position.Y)
25772 {
25773 velocity.Y -= num559;
25774 }
25775 else
25776 {
25777 velocity.Y += num559;
25778 }
25779 }
25780 }
25781 if (type == 533)
25782 {
25783 if ((int)this.ai[0] % 3 != 2)
25784 {
25785 Lighting.AddLight(base.Center, 0.8f, 0.3f, 0.1f);
25786 }
25787 else
25788 {
25789 Lighting.AddLight(base.Center, 0.3f, 0.5f, 0.7f);
25790 }
25791 }
25792 bool flag28 = false;
25793 if (this.ai[0] == 2f && type == 388)
25794 {
25795 this.ai[1]++;
25796 extraUpdates = 1;
25797 rotation = velocity.ToRotation() + (float)Math.PI;
25798 frameCounter++;
25799 if (frameCounter > 1)
25800 {
25801 frame++;
25802 frameCounter = 0;
25803 }
25804 if (frame > 2)
25805 {
25806 frame = 0;
25807 }
25808 if (this.ai[1] > 40f)
25809 {
25810 this.ai[1] = 1f;
25811 this.ai[0] = 0f;
25812 extraUpdates = 0;
25813 numUpdates = 0;
25814 netUpdate = true;
25815 }
25816 else
25817 {
25818 flag28 = true;
25819 }
25820 }
25821 if (type == 533 && this.ai[0] >= 3f && this.ai[0] <= 5f)
25822 {
25823 int num561 = 2;
25824 flag28 = true;
25825 velocity *= 0.9f;
25826 this.ai[1]++;
25827 int num562 = (int)this.ai[1] / num561 + (int)(this.ai[0] - 3f) * 8;
25828 if (num562 < 4)
25829 {
25830 frame = 17 + num562;
25831 }
25832 else if (num562 < 5)
25833 {
25834 frame = 0;
25835 }
25836 else if (num562 < 8)
25837 {
25838 frame = 1 + num562 - 5;
25839 }
25840 else if (num562 < 11)
25841 {
25842 frame = 11 - num562;
25843 }
25844 else if (num562 < 12)
25845 {
25846 frame = 0;
25847 }
25848 else if (num562 < 16)
25849 {
25850 frame = num562 - 2;
25851 }
25852 else if (num562 < 20)
25853 {
25854 frame = 29 - num562;
25855 }
25856 else if (num562 < 21)
25857 {
25858 frame = 0;
25859 }
25860 else
25861 {
25862 frame = num562 - 4;
25863 }
25864 if (this.ai[1] > (float)(num561 * 8))
25865 {
25866 this.ai[0] -= 3f;
25867 this.ai[1] = 0f;
25868 }
25869 }
25870 if (type == 533 && this.ai[0] >= 6f && this.ai[0] <= 8f)
25871 {
25872 this.ai[1]++;
25873 MaxUpdates = 2;
25874 if (this.ai[0] == 7f)
25875 {
25876 rotation = velocity.ToRotation() + (float)Math.PI;
25877 }
25878 else
25879 {
25880 rotation += (float)Math.PI / 6f;
25881 }
25882 int num563 = 0;
25883 switch ((int)this.ai[0])
25884 {
25885 case 6:
25886 frame = 5;
25887 num563 = 40;
25888 break;
25889 case 7:
25890 frame = 13;
25891 num563 = 30;
25892 break;
25893 case 8:
25894 frame = 17;
25895 num563 = 30;
25896 break;
25897 }
25898 if (this.ai[1] > (float)num563)
25899 {
25900 this.ai[1] = 1f;
25901 this.ai[0] -= 6f;
25902 localAI[0]++;
25903 extraUpdates = 0;
25904 numUpdates = 0;
25905 netUpdate = true;
25906 }
25907 else
25908 {
25909 flag28 = true;
25910 }
25911 if (this.ai[0] == 8f)
25912 {
25913 for (int num564 = 0; num564 < 4; num564++)
25914 {
25915 int num565 = Utils.SelectRandom<int>(Main.rand, 226, 228, 75);
25916 int num566 = Dust.NewDust(base.Center, 0, 0, num565);
25917 Dust dust14 = Main.dust[num566];
25918 Vector2 vector43 = Vector2.One.RotatedBy((float)num564 * ((float)Math.PI / 2f)).RotatedBy(rotation);
25919 dust14.position = base.Center + vector43 * 10f;
25920 dust14.velocity = vector43 * 1f;
25921 dust14.scale = 0.6f + Main.rand.NextFloat() * 0.5f;
25922 dust14.noGravity = true;
25923 }
25924 }
25925 }
25926 if (flag28)
25927 {
25928 return;
25929 }
25930 Vector2 center5 = base.position;
25932 bool flag29 = false;
25933 if (this.ai[0] != 1f && flag26)
25934 {
25935 tileCollide = true;
25936 }
25937 if (type == 533 && this.ai[0] < 9f)
25938 {
25939 tileCollide = true;
25940 }
25941 if (tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)base.Center.X / 16, (int)base.Center.Y / 16)))
25942 {
25943 tileCollide = false;
25944 }
25946 if (ownerMinionAttackTargetNPC3 != null && ownerMinionAttackTargetNPC3.CanBeChasedBy(this))
25947 {
25948 float num567 = Vector2.Distance(ownerMinionAttackTargetNPC3.Center, base.Center);
25949 float num568 = num555 * 3f;
25950 if (num567 < num568 && !flag29 && Collision.CanHitLine(base.position, width, height, ownerMinionAttackTargetNPC3.position, ownerMinionAttackTargetNPC3.width, ownerMinionAttackTargetNPC3.height))
25951 {
25952 num555 = num567;
25954 flag29 = true;
25955 }
25956 }
25957 if (!flag29)
25958 {
25959 for (int num569 = 0; num569 < 200; num569++)
25960 {
25961 NPC nPC5 = Main.npc[num569];
25962 if (nPC5.CanBeChasedBy(this))
25963 {
25964 float num570 = Vector2.Distance(nPC5.Center, base.Center);
25965 if (!(num570 >= num555) && Collision.CanHitLine(base.position, width, height, nPC5.position, nPC5.width, nPC5.height))
25966 {
25967 num555 = num570;
25968 center5 = nPC5.Center;
25969 zero = nPC5.velocity;
25970 flag29 = true;
25971 }
25972 }
25973 }
25974 }
25975 float num571 = num556;
25976 if (flag29)
25977 {
25978 num571 = num557;
25979 }
25980 Player player4 = Main.player[owner];
25981 if (Vector2.Distance(player4.Center, base.Center) > num571)
25982 {
25983 if (flag26)
25984 {
25985 this.ai[0] = 1f;
25986 }
25987 if (type == 533 && this.ai[0] < 9f)
25988 {
25989 this.ai[0] += 3 * (3 - (int)(this.ai[0] / 3f));
25990 }
25991 tileCollide = false;
25992 netUpdate = true;
25993 }
25994 if (flag26 && flag29 && this.ai[0] == 0f)
25995 {
25996 Vector2 vector44 = center5 - base.Center;
25997 float num572 = vector44.Length();
25998 vector44.Normalize();
25999 if (num572 > 200f)
26000 {
26001 float num573 = 6f;
26002 if (type == 388)
26003 {
26004 num573 = 14f;
26005 }
26006 vector44 *= num573;
26007 velocity = (velocity * 40f + vector44) / 41f;
26008 }
26009 else
26010 {
26011 float num574 = 4f;
26012 vector44 *= 0f - num574;
26013 velocity = (velocity * 40f + vector44) / 41f;
26014 }
26015 }
26016 else
26017 {
26018 bool flag30 = false;
26019 if (!flag30 && flag26)
26020 {
26021 flag30 = this.ai[0] == 1f;
26022 }
26023 if (!flag30 && type == 533)
26024 {
26025 flag30 = this.ai[0] >= 9f;
26026 }
26027 float num575 = 6f;
26028 float num576 = 40f;
26029 if (type == 533)
26030 {
26031 num575 = 12f;
26032 }
26033 if (flag30)
26034 {
26035 num575 = 15f;
26036 }
26037 Vector2 center6 = base.Center;
26038 Vector2 vector45 = player4.Center - center6 + new Vector2(0f, -60f);
26039 float num577 = vector45.Length();
26040 float num578 = num577;
26041 if (num577 > 200f && num575 < 8f)
26042 {
26043 num575 = 8f;
26044 }
26045 if (num575 < Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y))
26046 {
26047 num576 = 30f;
26048 num575 = Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y);
26049 if (num577 > 200f)
26050 {
26051 num576 = 20f;
26052 num575 += 4f;
26053 }
26054 else if (num577 > 100f)
26055 {
26056 num575 += 3f;
26057 }
26058 }
26059 if (flag30 && num577 > 300f)
26060 {
26061 num575 += 6f;
26062 num576 -= 10f;
26063 }
26064 if (num577 < num558 && flag30 && !Collision.SolidCollision(base.position, width, height))
26065 {
26066 if (type == 387 || type == 388)
26067 {
26068 this.ai[0] = 0f;
26069 }
26070 if (type == 533)
26071 {
26072 this.ai[0] -= 9f;
26073 }
26074 netUpdate = true;
26075 }
26076 if (num577 > 2000f)
26077 {
26078 base.position.X = Main.player[owner].Center.X - (float)(width / 2);
26079 base.position.Y = Main.player[owner].Center.Y - (float)(height / 2);
26080 netUpdate = true;
26081 }
26082 if (num577 > 70f)
26083 {
26085 vector45.Normalize();
26086 vector45 *= num575;
26087 velocity = (velocity * num576 + vector45) / (num576 + 1f);
26088 }
26089 else if (velocity.X == 0f && velocity.Y == 0f)
26090 {
26091 velocity.X = -0.15f;
26092 velocity.Y = -0.05f;
26093 }
26094 if (velocity.Length() > num575)
26095 {
26096 velocity *= 0.95f;
26097 }
26098 }
26099 if (type == 388)
26100 {
26101 rotation = velocity.ToRotation() + (float)Math.PI;
26102 }
26103 if (type == 387)
26104 {
26105 if (this.ai[0] != 1f && flag29)
26106 {
26107 rotation = (center5 - base.Center).ToRotation() + (float)Math.PI;
26108 }
26109 else
26110 {
26111 rotation = velocity.ToRotation() + (float)Math.PI;
26112 }
26113 }
26114 if (type == 533 && (this.ai[0] < 3f || this.ai[0] >= 9f))
26115 {
26116 rotation += velocity.X * 0.04f;
26117 }
26118 if (type == 388 || type == 387)
26119 {
26120 frameCounter++;
26121 if (frameCounter > 3)
26122 {
26123 frame++;
26124 frameCounter = 0;
26125 }
26126 if (frame > 2)
26127 {
26128 frame = 0;
26129 }
26130 }
26131 else if (type == 533)
26132 {
26133 if (this.ai[0] < 3f || this.ai[0] >= 9f)
26134 {
26135 frameCounter++;
26136 if (frameCounter >= 24)
26137 {
26138 frameCounter = 0;
26139 }
26140 int num579 = frameCounter / 4;
26141 frame = 4 + num579;
26142 switch ((int)this.ai[0])
26143 {
26144 case 0:
26145 case 9:
26146 frame = 4 + num579;
26147 break;
26148 case 1:
26149 case 10:
26150 num579 = frameCounter / 8;
26151 frame = 14 + num579;
26152 break;
26153 case 2:
26154 case 11:
26155 num579 = frameCounter / 3;
26156 if (num579 >= 4)
26157 {
26158 num579 -= 4;
26159 }
26160 frame = 17 + num579;
26161 break;
26162 }
26163 }
26164 if (this.ai[0] == 2f && Main.rand.Next(2) == 0)
26165 {
26166 for (int num580 = 0; num580 < 4; num580++)
26167 {
26168 if (Main.rand.Next(2) != 0)
26169 {
26170 int num581 = Utils.SelectRandom<int>(Main.rand, 226, 228, 75);
26171 int num582 = Dust.NewDust(base.Center, 0, 0, num581);
26172 Dust dust15 = Main.dust[num582];
26173 Vector2 vector47 = Vector2.One.RotatedBy((float)num580 * ((float)Math.PI / 2f)).RotatedBy(rotation);
26174 dust15.position = base.Center + vector47 * 10f;
26175 dust15.velocity = vector47 * 1f;
26176 dust15.scale = 0.3f + Main.rand.NextFloat() * 0.5f;
26177 dust15.noGravity = true;
26178 dust15.customData = this;
26179 dust15.noLight = true;
26180 }
26181 }
26182 }
26183 }
26184 if (this.ai[1] > 0f && flag26)
26185 {
26186 this.ai[1] += Main.rand.Next(1, 4);
26187 }
26188 if (this.ai[1] > 90f && type == 387)
26189 {
26190 this.ai[1] = 0f;
26191 netUpdate = true;
26192 }
26193 if (this.ai[1] > 40f && type == 388)
26194 {
26195 this.ai[1] = 0f;
26196 netUpdate = true;
26197 }
26198 if (this.ai[1] > 0f && type == 533)
26199 {
26200 this.ai[1]++;
26201 int num583 = 10;
26202 if (this.ai[1] > (float)num583)
26203 {
26204 this.ai[1] = 0f;
26205 netUpdate = true;
26206 }
26207 }
26208 if (this.ai[0] == 0f && flag26)
26209 {
26210 if (type == 387)
26211 {
26212 float num584 = 8f;
26213 int num585 = 389;
26214 if (flag29 && this.ai[1] == 0f)
26215 {
26216 this.ai[1]++;
26217 if (Main.myPlayer == owner && Collision.CanHitLine(base.position, width, height, center5, 0, 0))
26218 {
26219 Vector2 vector48 = center5 - base.Center;
26220 vector48.Normalize();
26221 vector48 *= num584;
26222 int num586 = NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector48.X, vector48.Y, num585, (int)((float)damage * 1.15f), 0f, Main.myPlayer);
26223 Main.projectile[num586].timeLeft = 300;
26224 netUpdate = true;
26225 }
26226 }
26227 }
26228 if (type == 388 && this.ai[1] == 0f && flag29 && num555 < 500f)
26229 {
26230 this.ai[1]++;
26231 if (Main.myPlayer == owner)
26232 {
26233 this.ai[0] = 2f;
26234 Vector2 v4 = center5 - base.Center;
26235 v4 = v4.SafeNormalize(velocity);
26236 float num587 = 8f;
26237 velocity = v4 * num587;
26239 netUpdate = true;
26240 }
26241 }
26242 }
26243 else
26244 {
26245 if (type != 533 || !(this.ai[0] < 9f))
26246 {
26247 return;
26248 }
26249 int num588 = 0;
26250 num588 = 800;
26251 if (!(this.ai[1] == 0f && flag29) || !(num555 < (float)num588))
26252 {
26253 return;
26254 }
26255 this.ai[1]++;
26256 if (Main.myPlayer != owner)
26257 {
26258 return;
26259 }
26260 if (localAI[0] >= 3f)
26261 {
26262 this.ai[0] += 4f;
26263 if (this.ai[0] == 6f)
26264 {
26265 this.ai[0] = 3f;
26266 }
26267 localAI[0] = 0f;
26268 }
26269 else
26270 {
26271 this.ai[0] += 6f;
26272 Vector2 v5 = center5 - base.Center;
26273 v5 = v5.SafeNormalize(Vector2.Zero);
26274 float num589 = ((this.ai[0] == 8f) ? 12f : 10f);
26275 velocity = v5 * num589;
26277 netUpdate = true;
26278 }
26279 }
26280 }
26281 else if (aiStyle == 67)
26282 {
26284 }
26285 else if (aiStyle == 68)
26286 {
26287 rotation += 0.25f * (float)direction;
26288 bool flag31 = type == 399;
26289 bool flag32 = type == 669;
26290 this.ai[0] += 1f;
26291 if (this.ai[0] >= 3f)
26292 {
26293 alpha -= 40;
26294 if (alpha < 0)
26295 {
26296 alpha = 0;
26297 }
26298 }
26299 if (this.ai[0] >= 15f)
26300 {
26301 velocity.Y += 0.2f;
26302 if (velocity.Y > 16f)
26303 {
26304 velocity.Y = 16f;
26305 }
26306 velocity.X *= 0.99f;
26307 }
26308 if (alpha == 0)
26309 {
26310 if (flag31)
26311 {
26312 Vector2 spinningpoint2 = new Vector2(4f, -8f);
26313 float num590 = rotation;
26314 if (direction == -1)
26315 {
26316 spinningpoint2.X = -4f;
26317 }
26319 for (int num591 = 0; num591 < 1; num591++)
26320 {
26321 int num592 = Dust.NewDust(base.Center + spinningpoint2 - Vector2.One * 5f, 4, 4, 6);
26322 Main.dust[num592].scale = 1.5f;
26323 Main.dust[num592].noGravity = true;
26324 Main.dust[num592].velocity = Main.dust[num592].velocity * 0.25f + Vector2.Normalize(spinningpoint2) * 1f;
26325 Main.dust[num592].velocity = Main.dust[num592].velocity.RotatedBy(-(float)Math.PI / 2f * (float)direction);
26326 }
26327 }
26328 if (flag32)
26329 {
26330 for (int num593 = 0; num593 < 2; num593++)
26331 {
26332 Vector2 spinningpoint3 = new Vector2(MathHelper.Lerp(-8f, 8f, Main.rand.NextFloat()), -4f);
26333 float num594 = rotation;
26335 int num595 = Dust.NewDust(base.Center + spinningpoint3 - Vector2.One * 5f, 4, 4, 4);
26336 Main.dust[num595].scale = 0.8f - Main.rand.NextFloat() * 0.2f;
26337 Main.dust[num595].velocity = Main.dust[num595].velocity * 0.25f + Vector2.Normalize(spinningpoint3) * 1f;
26338 Main.dust[num595].velocity = Main.dust[num595].velocity.RotatedBy(-(float)Math.PI / 2f * (float)direction);
26339 Main.dust[num595].color = Utils.SelectRandom<Color>(Main.rand, new Color(255, 255, 255, 110), new Color(245, 200, 30, 110));
26340 }
26341 }
26342 }
26344 if (timeLeft <= 3)
26345 {
26346 tileCollide = false;
26347 alpha = 255;
26348 base.position.X += width / 2;
26349 base.position.Y += height / 2;
26350 width = 80;
26351 height = 80;
26352 base.position.X -= width / 2;
26353 base.position.Y -= height / 2;
26354 knockBack = 8f;
26355 }
26356 if (wet && timeLeft > 3)
26357 {
26358 timeLeft = 3;
26359 }
26360 }
26361 else if (aiStyle == 69)
26362 {
26363 Vector2 vector49 = Main.player[owner].Center - base.Center;
26364 rotation = vector49.ToRotation() - 1.57f;
26365 if (Main.player[owner].dead)
26366 {
26367 Kill();
26368 return;
26369 }
26370 Main.player[owner].SetDummyItemTime(10);
26371 _ = vector49.X;
26372 _ = 0f;
26373 if (vector49.X < 0f)
26374 {
26375 Main.player[owner].ChangeDir(1);
26376 direction = 1;
26377 }
26378 else
26379 {
26380 Main.player[owner].ChangeDir(-1);
26381 direction = -1;
26382 }
26383 Main.player[owner].itemRotation = (vector49 * -1f * direction).ToRotation();
26384 spriteDirection = ((!(vector49.X > 0f)) ? 1 : (-1));
26385 if (this.ai[0] == 0f && vector49.Length() > 400f)
26386 {
26387 this.ai[0] = 1f;
26388 }
26389 if (this.ai[0] == 1f || this.ai[0] == 2f)
26390 {
26391 float num596 = vector49.Length();
26392 if (num596 > 1500f)
26393 {
26394 Kill();
26395 return;
26396 }
26397 if (num596 > 600f)
26398 {
26399 this.ai[0] = 2f;
26400 }
26401 tileCollide = false;
26402 float num597 = 20f;
26403 if (this.ai[0] == 2f)
26404 {
26405 num597 = 40f;
26406 }
26408 if (vector49.Length() < num597)
26409 {
26410 Kill();
26411 return;
26412 }
26413 }
26414 this.ai[1]++;
26415 if (this.ai[1] > 5f)
26416 {
26417 alpha = 0;
26418 }
26419 if ((int)this.ai[1] % 4 == 0 && owner == Main.myPlayer)
26420 {
26422 spinningpoint4.Normalize();
26423 spinningpoint4 *= (float)Main.rand.Next(45, 65) * 0.1f;
26424 spinningpoint4 = spinningpoint4.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866);
26426 }
26427 }
26428 else if (aiStyle == 70)
26429 {
26430 if (this.ai[0] == 0f)
26431 {
26432 float num598 = 650f;
26433 int num599 = -1;
26434 for (int num600 = 0; num600 < 200; num600++)
26435 {
26436 NPC nPC6 = Main.npc[num600];
26437 float num601 = (nPC6.Center - base.Center).Length();
26438 if (!(num601 >= num598) && nPC6.CanBeChasedBy(this) && Collision.CanHit(base.position, width, height, nPC6.position, nPC6.width, nPC6.height))
26439 {
26440 num599 = num600;
26441 num598 = num601;
26442 }
26443 }
26444 this.ai[0] = num599 + 1;
26445 if (this.ai[0] == 0f)
26446 {
26447 this.ai[0] = -15f;
26448 }
26449 if (this.ai[0] > 0f)
26450 {
26451 float num602 = (float)Main.rand.Next(35, 75) / 30f;
26452 velocity = (velocity * 20f + Vector2.Normalize(Main.npc[(int)this.ai[0] - 1].Center - base.Center + new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101))) * num602) / 21f;
26453 netUpdate = true;
26454 }
26455 }
26456 else if (this.ai[0] > 0f)
26457 {
26458 Vector2 vector50 = Vector2.Normalize(Main.npc[(int)this.ai[0] - 1].Center - base.Center);
26459 velocity = (velocity * 40f + vector50 * 12f) / 41f;
26460 }
26461 else
26462 {
26463 this.ai[0]++;
26464 alpha -= 25;
26465 if (alpha < 50)
26466 {
26467 alpha = 50;
26468 }
26469 velocity *= 0.95f;
26470 }
26471 if (this.ai[1] == 0f)
26472 {
26473 this.ai[1] = (float)Main.rand.Next(80, 121) / 100f;
26474 netUpdate = true;
26475 }
26476 scale = this.ai[1];
26477 }
26478 else if (aiStyle == 71)
26479 {
26480 localAI[1]++;
26481 if (localAI[1] > 10f && Main.rand.Next(3) == 0)
26482 {
26483 int num603 = 6;
26484 for (int num604 = 0; num604 < num603; num604++)
26485 {
26487 spinningpoint5 = spinningpoint5.RotatedBy((double)(num604 - (num603 / 2 - 1)) * Math.PI / (double)num603) + base.Center;
26488 Vector2 vector51 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - (float)Math.PI / 2f).ToRotationVector2() * Main.rand.Next(3, 8);
26489 int num605 = Dust.NewDust(spinningpoint5 + vector51, 0, 0, 217, vector51.X * 2f, vector51.Y * 2f, 100, default(Color), 1.4f);
26490 Main.dust[num605].noGravity = true;
26491 Main.dust[num605].noLight = true;
26492 Dust dust2 = Main.dust[num605];
26493 dust2.velocity /= 4f;
26494 dust2 = Main.dust[num605];
26495 dust2.velocity -= velocity;
26496 }
26497 alpha -= 5;
26498 if (alpha < 50)
26499 {
26500 alpha = 50;
26501 }
26502 rotation += velocity.X * 0.1f;
26503 frame = (int)(localAI[1] / 3f) % 3;
26504 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.1f, 0.4f, 0.6f);
26505 }
26506 int num606 = -1;
26507 Vector2 vector52 = base.Center;
26508 float num607 = 500f;
26509 if (localAI[0] > 0f)
26510 {
26511 localAI[0]--;
26512 }
26513 if (this.ai[0] == 0f && localAI[0] == 0f)
26514 {
26515 for (int num608 = 0; num608 < 200; num608++)
26516 {
26517 NPC nPC7 = Main.npc[num608];
26518 if (nPC7.CanBeChasedBy(this) && (this.ai[0] == 0f || this.ai[0] == (float)(num608 + 1)))
26519 {
26520 Vector2 center7 = nPC7.Center;
26522 if (num609 < num607 && Collision.CanHit(base.position, width, height, nPC7.position, nPC7.width, nPC7.height))
26523 {
26524 num607 = num609;
26525 vector52 = center7;
26526 num606 = num608;
26527 }
26528 }
26529 }
26530 if (num606 >= 0)
26531 {
26532 this.ai[0] = num606 + 1;
26533 netUpdate = true;
26534 }
26535 num606 = -1;
26536 }
26537 if (localAI[0] == 0f && this.ai[0] == 0f)
26538 {
26539 localAI[0] = 30f;
26540 }
26541 bool flag33 = false;
26542 if (this.ai[0] != 0f)
26543 {
26544 int num610 = (int)(this.ai[0] - 1f);
26545 if (Main.npc[num610].active && !Main.npc[num610].dontTakeDamage && Main.npc[num610].immune[owner] == 0)
26546 {
26547 float num611 = Main.npc[num610].position.X + (float)(Main.npc[num610].width / 2);
26548 float num612 = Main.npc[num610].position.Y + (float)(Main.npc[num610].height / 2);
26549 float num613 = Math.Abs(base.position.X + (float)(width / 2) - num611) + Math.Abs(base.position.Y + (float)(height / 2) - num612);
26550 if (num613 < 1000f)
26551 {
26552 flag33 = true;
26553 vector52 = Main.npc[num610].Center;
26554 }
26555 }
26556 else
26557 {
26558 this.ai[0] = 0f;
26559 flag33 = false;
26560 netUpdate = true;
26561 }
26562 }
26563 if (flag33)
26564 {
26565 Vector2 v6 = vector52 - base.Center;
26566 float num614 = velocity.ToRotation();
26567 float num615 = v6.ToRotation();
26568 double num616 = num615 - num614;
26569 if (num616 > Math.PI)
26570 {
26571 num616 -= Math.PI * 2.0;
26572 }
26573 if (num616 < -Math.PI)
26574 {
26575 num616 += Math.PI * 2.0;
26576 }
26577 velocity = velocity.RotatedBy(num616 * 0.10000000149011612);
26578 }
26579 float num617 = velocity.Length();
26581 velocity *= num617 + 0.0025f;
26582 }
26583 else if (aiStyle == 72)
26584 {
26585 localAI[0]++;
26586 if (localAI[0] > 3f)
26587 {
26588 alpha -= 25;
26589 if (alpha < 50)
26590 {
26591 alpha = 50;
26592 }
26593 }
26594 velocity *= 0.96f;
26595 if (this.ai[1] == 0f)
26596 {
26597 this.ai[1] = (float)Main.rand.Next(60, 121) / 100f;
26598 netUpdate = true;
26599 }
26600 scale = this.ai[1];
26601 base.position = base.Center;
26602 int num618 = 14;
26603 int num619 = 14;
26604 width = (int)((float)num618 * this.ai[1]);
26605 height = (int)((float)num619 * this.ai[1]);
26606 base.position -= new Vector2(width / 2, height / 2);
26607 }
26608 else if (aiStyle == 73)
26609 {
26610 int num620 = (int)this.ai[0];
26611 int num621 = (int)this.ai[1];
26612 Tile tile2 = Main.tile[num620, num621];
26613 if (tile2 == null || !tile2.active() || tile2.type != 338)
26614 {
26615 Kill();
26616 return;
26617 }
26618 float num622 = 2f;
26619 float num623 = (float)timeLeft / 60f;
26620 if (num623 < 1f)
26621 {
26622 num622 *= num623;
26623 }
26624 if (type == 419)
26625 {
26626 for (int num624 = 0; num624 < 2; num624++)
26627 {
26628 Vector2 spinningpoint6 = new Vector2(0f, 0f - num622);
26629 spinningpoint6 *= 0.85f + (float)Main.rand.NextDouble() * 0.2f;
26630 spinningpoint6 = spinningpoint6.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866);
26631 int num625 = Dust.NewDust(base.position, width, height, 222, 0f, 0f, 100);
26632 Dust dust16 = Main.dust[num625];
26633 dust16.scale = 1f + (float)Main.rand.NextDouble() * 0.3f;
26634 Dust dust2 = dust16;
26635 dust2.velocity *= 0.5f;
26636 if (dust16.velocity.Y > 0f)
26637 {
26638 dust16.velocity.Y *= -1f;
26639 }
26640 dust2 = dust16;
26641 dust2.position -= new Vector2(2 + Main.rand.Next(-2, 3), 0f);
26642 dust2 = dust16;
26643 dust2.velocity += spinningpoint6;
26644 dust16.scale = 0.6f;
26645 dust16.fadeIn = dust16.scale + 0.2f;
26646 dust16.velocity.Y *= 2f;
26647 }
26648 }
26649 if (type == 420)
26650 {
26651 for (int num626 = 0; num626 < 2; num626++)
26652 {
26653 Vector2 spinningpoint7 = new Vector2(0f, 0f - num622);
26654 spinningpoint7 *= 0.85f + (float)Main.rand.NextDouble() * 0.2f;
26655 spinningpoint7 = spinningpoint7.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866);
26656 int num627 = 219;
26657 if (Main.rand.Next(5) == 0)
26658 {
26659 num627 = 222;
26660 }
26661 int num628 = Dust.NewDust(base.position, width, height, num627, 0f, 0f, 100);
26662 Dust dust17 = Main.dust[num628];
26663 dust17.scale = 1f + (float)Main.rand.NextDouble() * 0.3f;
26664 Dust dust2 = dust17;
26665 dust2.velocity *= 0.5f;
26666 if (dust17.velocity.Y > 0f)
26667 {
26668 dust17.velocity.Y *= -1f;
26669 }
26670 dust2 = dust17;
26671 dust2.position -= new Vector2(2 + Main.rand.Next(-2, 3), 0f);
26672 dust2 = dust17;
26673 dust2.velocity += spinningpoint7;
26674 dust17.velocity.X *= 0.5f;
26675 dust17.scale = 0.6f;
26676 dust17.fadeIn = dust17.scale + 0.2f;
26677 dust17.velocity.Y *= 2f;
26678 }
26679 }
26680 if (type == 421)
26681 {
26682 for (int num629 = 0; num629 < 2; num629++)
26683 {
26684 Vector2 spinningpoint8 = new Vector2(0f, 0f - num622);
26685 spinningpoint8 *= 0.85f + (float)Main.rand.NextDouble() * 0.2f;
26686 spinningpoint8 = spinningpoint8.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.7853981852531433);
26687 int num630 = Dust.NewDust(base.position, width, height, 221, 0f, 0f, 100);
26688 Dust dust18 = Main.dust[num630];
26689 dust18.scale = 1f + (float)Main.rand.NextDouble() * 0.3f;
26690 Dust dust2 = dust18;
26691 dust2.velocity *= 0.1f;
26692 if (dust18.velocity.Y > 0f)
26693 {
26694 dust18.velocity.Y *= -1f;
26695 }
26696 dust2 = dust18;
26697 dust2.position -= new Vector2(2 + Main.rand.Next(-2, 3), 0f);
26698 dust2 = dust18;
26699 dust2.velocity += spinningpoint8;
26700 dust18.scale = 0.6f;
26701 dust18.fadeIn = dust18.scale + 0.2f;
26702 dust18.velocity.Y *= 2.5f;
26703 }
26704 if (timeLeft % 10 == 0)
26705 {
26706 float num631 = 0.85f + (float)Main.rand.NextDouble() * 0.2f;
26707 for (int num632 = 0; num632 < 9; num632++)
26708 {
26709 Vector2 vector53 = new Vector2((float)(num632 - 4) / 5f, (0f - num622) * num631);
26710 int num633 = Dust.NewDust(base.position, width, height, 222, 0f, 0f, 100);
26711 Dust dust19 = Main.dust[num633];
26712 dust19.scale = 0.7f + (float)Main.rand.NextDouble() * 0.3f;
26713 Dust dust2 = dust19;
26714 dust2.velocity *= 0f;
26715 if (dust19.velocity.Y > 0f)
26716 {
26717 dust19.velocity.Y *= -1f;
26718 }
26719 dust2 = dust19;
26720 dust2.position -= new Vector2(2 + Main.rand.Next(-2, 3), 0f);
26721 dust2 = dust19;
26722 dust2.velocity += vector53;
26723 dust19.scale = 0.6f;
26724 dust19.fadeIn = dust19.scale + 0.2f;
26725 dust19.velocity.Y *= 2f;
26726 }
26727 }
26728 }
26729 if (type != 422)
26730 {
26731 return;
26732 }
26733 for (int num634 = 0; num634 < 2; num634++)
26734 {
26735 Vector2 spinningpoint9 = new Vector2(0f, 0f - num622);
26736 spinningpoint9 *= 0.85f + (float)Main.rand.NextDouble() * 0.2f;
26737 spinningpoint9 = spinningpoint9.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866);
26738 int num635 = Dust.NewDust(base.position, width, height, 219 + Main.rand.Next(5), 0f, 0f, 100);
26739 Dust dust20 = Main.dust[num635];
26740 dust20.scale = 1f + (float)Main.rand.NextDouble() * 0.3f;
26741 Dust dust2 = dust20;
26742 dust2.velocity *= 0.5f;
26743 if (dust20.velocity.Y > 0f)
26744 {
26745 dust20.velocity.Y *= -1f;
26746 }
26747 dust2 = dust20;
26748 dust2.position -= new Vector2(2 + Main.rand.Next(-2, 3), 0f);
26749 dust2 = dust20;
26750 dust2.velocity += spinningpoint9;
26751 dust20.scale = 0.6f;
26752 dust20.fadeIn = dust20.scale + 0.2f;
26753 dust20.velocity.Y *= 2f;
26754 }
26755 }
26756 else if (aiStyle == 74)
26757 {
26758 if (extraUpdates == 1)
26759 {
26760 localAI[0] *= localAI[1];
26761 localAI[1] -= 0.001f;
26762 if ((double)localAI[0] < 0.01)
26763 {
26764 Kill();
26765 }
26766 }
26767 }
26768 else if (aiStyle == 75)
26769 {
26770 AI_075();
26771 }
26772 else if (aiStyle == 76)
26773 {
26774 Player player5 = Main.player[owner];
26775 player5.heldProj = whoAmI;
26776 if (type == 441)
26777 {
26778 if (player5.mount.Type != 9)
26779 {
26780 Kill();
26781 return;
26782 }
26783 }
26784 else if (type == 453 && player5.mount.Type != 8)
26785 {
26786 Kill();
26787 return;
26788 }
26789 if (Main.myPlayer == owner)
26790 {
26791 base.position.X = Main.screenPosition.X + (float)Main.mouseX;
26792 base.position.Y = Main.screenPosition.Y + (float)Main.mouseY;
26793 if (this.ai[0] != base.position.X - player5.position.X || this.ai[1] != base.position.Y - player5.position.Y)
26794 {
26795 netUpdate = true;
26796 }
26797 this.ai[0] = base.position.X - player5.position.X;
26798 this.ai[1] = base.position.Y - player5.position.Y;
26799 player5.mount.AimAbility(player5, base.position);
26800 if (!player5.channel)
26801 {
26802 player5.mount.UseAbility(player5, base.position, toggleOn: false);
26803 Kill();
26804 }
26805 return;
26806 }
26807 base.position.X = player5.position.X + this.ai[0];
26808 base.position.Y = player5.position.Y + this.ai[1];
26809 if (type == 441)
26810 {
26811 if (!player5.mount.AbilityCharging)
26812 {
26813 player5.mount.StartAbilityCharge(player5);
26814 }
26815 }
26816 else if (type == 453 && !player5.mount.AbilityActive)
26817 {
26818 player5.mount.UseAbility(player5, base.position, toggleOn: false);
26819 }
26820 player5.mount.AimAbility(player5, base.position);
26821 }
26822 else if (aiStyle == 77)
26823 {
26826 if (activeSound != null)
26827 {
26828 if (activeSound.Volume == 0f)
26829 {
26830 activeSound.Stop();
26831 float[] array2 = localAI;
26833 array2[0] = ((SlotId)(ref invalid)).ToFloat();
26834 }
26835 activeSound.Volume = Math.Max(0f, activeSound.Volume - 0.05f);
26836 }
26837 else
26838 {
26839 float[] array3 = localAI;
26841 array3[0] = ((SlotId)(ref invalid)).ToFloat();
26842 }
26843 if (this.ai[1] == 1f)
26844 {
26845 friendly = false;
26846 if (alpha < 255)
26847 {
26848 alpha += 51;
26849 }
26850 if (alpha >= 255)
26851 {
26852 alpha = 255;
26853 Kill();
26854 return;
26855 }
26856 }
26857 else
26858 {
26859 if (alpha > 0)
26860 {
26861 alpha -= 50;
26862 }
26863 if (alpha < 0)
26864 {
26865 alpha = 0;
26866 }
26867 }
26868 float num636 = 30f;
26869 float num637 = num636 * 4f;
26870 this.ai[0]++;
26871 if (this.ai[0] > num637)
26872 {
26873 this.ai[0] = 0f;
26874 }
26875 Vector2 vector54 = -Vector2.UnitY.RotatedBy((float)Math.PI * 2f * this.ai[0] / num636);
26876 float val = 0.75f + vector54.Y * 0.25f;
26877 float val2 = 0.8f - vector54.Y * 0.2f;
26878 float num638 = Math.Max(val, val2);
26879 base.position += new Vector2(width, height) / 2f;
26880 width = (height = (int)(80f * num638));
26881 base.position -= new Vector2(width, height) / 2f;
26882 frameCounter++;
26883 if (frameCounter >= 3)
26884 {
26885 frameCounter = 0;
26886 frame++;
26887 if (frame >= 4)
26888 {
26889 frame = 0;
26890 }
26891 }
26892 for (int num639 = 0; num639 < 1; num639++)
26893 {
26894 float num640 = 55f * num638;
26895 float num641 = 11f * num638;
26896 float num642 = 0.5f;
26897 int num643 = Dust.NewDust(base.position, width, height, 226, 0f, 0f, 100, default(Color), 0.5f);
26898 Main.dust[num643].noGravity = true;
26899 Dust dust2 = Main.dust[num643];
26900 dust2.velocity *= 2f;
26901 Main.dust[num643].position = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * (num641 + num642 * (float)Main.rand.NextDouble() * num640) + base.Center;
26902 Main.dust[num643].velocity = Main.dust[num643].velocity / 2f + Vector2.Normalize(Main.dust[num643].position - base.Center);
26903 if (Main.rand.Next(2) == 0)
26904 {
26905 num643 = Dust.NewDust(base.position, width, height, 226, 0f, 0f, 100, default(Color), 0.9f);
26906 Main.dust[num643].noGravity = true;
26907 dust2 = Main.dust[num643];
26908 dust2.velocity *= 1.2f;
26909 Main.dust[num643].position = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * (num641 + num642 * (float)Main.rand.NextDouble() * num640) + base.Center;
26910 Main.dust[num643].velocity = Main.dust[num643].velocity / 2f + Vector2.Normalize(Main.dust[num643].position - base.Center);
26911 }
26912 if (Main.rand.Next(4) == 0)
26913 {
26914 num643 = Dust.NewDust(base.position, width, height, 226, 0f, 0f, 100, default(Color), 0.7f);
26915 Main.dust[num643].noGravity = true;
26916 dust2 = Main.dust[num643];
26917 dust2.velocity *= 1.2f;
26918 Main.dust[num643].position = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * (num641 + num642 * (float)Main.rand.NextDouble() * num640) + base.Center;
26919 Main.dust[num643].velocity = Main.dust[num643].velocity / 2f + Vector2.Normalize(Main.dust[num643].position - base.Center);
26920 }
26921 }
26922 }
26923 else if (aiStyle == 78)
26924 {
26925 if (alpha > 0)
26926 {
26927 alpha -= 30;
26928 }
26929 if (alpha < 0)
26930 {
26931 alpha = 0;
26932 }
26933 Vector2 v7 = this.ai[0].ToRotationVector2();
26934 float num644 = velocity.ToRotation();
26935 float num645 = v7.ToRotation();
26936 double num646 = num645 - num644;
26937 if (num646 > Math.PI)
26938 {
26939 num646 -= Math.PI * 2.0;
26940 }
26941 if (num646 < -Math.PI)
26942 {
26943 num646 += Math.PI * 2.0;
26944 }
26945 velocity = velocity.RotatedBy(num646 * 0.05000000074505806);
26946 velocity *= 0.96f;
26947 rotation = velocity.ToRotation() - (float)Math.PI / 2f;
26948 if (Main.myPlayer == owner && timeLeft > 60)
26949 {
26950 timeLeft = 60;
26951 }
26952 }
26953 else if (aiStyle == 79)
26954 {
26955 bool flag34 = true;
26956 int num647 = (int)this.ai[0] - 1;
26957 if (type == 447 && (this.ai[0] == 0f || ((!Main.npc[num647].active || Main.npc[num647].type != 392) && (!Main.npc[num647].active || Main.npc[num647].type != 395 || !(Main.npc[num647].ai[3] % 120f >= 60f) || Main.npc[num647].ai[0] != 2f))))
26958 {
26959 flag34 = false;
26960 }
26961 if (!flag34)
26962 {
26963 Kill();
26964 return;
26965 }
26966 NPC nPC8 = Main.npc[num647];
26967 float num648 = nPC8.Center.Y + 46f;
26968 float num649 = num648;
26969 if (type == 447)
26970 {
26971 int target = nPC8.target;
26972 if (nPC8.type == 392)
26973 {
26974 target = Main.npc[(int)nPC8.ai[0]].target;
26975 }
26976 Player player6 = Main.player[target];
26977 if (player6 != null && player6.active && !player6.dead)
26978 {
26979 num649 = player6.Bottom.Y;
26980 }
26981 }
26982 num649 /= 16f;
26983 int num650 = (int)nPC8.Center.X / 16;
26984 int num651 = (int)num648 / 16;
26985 int num652 = 0;
26986 if ((float)num651 >= num649 && Main.tile[num650, num651].nactive() && Main.tileSolid[Main.tile[num650, num651].type] && !Main.tileSolidTop[Main.tile[num650, num651].type])
26987 {
26988 num652 = 1;
26989 }
26990 else
26991 {
26992 for (; num652 < 150 && num651 + num652 < Main.maxTilesY; num652++)
26993 {
26994 int num653 = num651 + num652;
26995 if ((float)num653 >= num649 && Main.tile[num650, num653].nactive() && Main.tileSolid[Main.tile[num650, num653].type] && !Main.tileSolidTop[Main.tile[num650, num653].type])
26996 {
26997 num652--;
26998 break;
26999 }
27000 }
27001 }
27002 base.position.X = nPC8.Center.X - (float)(width / 2);
27003 base.position.Y = num648;
27004 height = (num652 + 1) * 16;
27005 int num654 = (int)base.position.Y + height;
27006 if (Main.tile[num650, num654 / 16].nactive() && Main.tileSolid[Main.tile[num650, num654 / 16].type] && !Main.tileSolidTop[Main.tile[num650, num654 / 16].type])
27007 {
27008 int num655 = num654 % 16;
27009 height -= num655 - 2;
27010 }
27011 if (type == 447)
27012 {
27013 for (int num656 = 0; num656 < 2; num656++)
27014 {
27015 int num657 = Dust.NewDust(new Vector2(base.position.X, base.position.Y + (float)height - 16f), width, 16, 228);
27016 Main.dust[num657].noGravity = true;
27017 Dust dust2 = Main.dust[num657];
27018 dust2.velocity *= 0.5f;
27019 Main.dust[num657].velocity.X -= (float)num656 - nPC8.velocity.X * 2f / 3f;
27020 Main.dust[num657].scale = 2.8f;
27021 }
27022 if (Main.rand.Next(5) == 0)
27023 {
27024 int num658 = Dust.NewDust(new Vector2(base.position.X + (float)(width / 2) - (float)(width / 2 * Math.Sign(nPC8.velocity.X)) - 4f, base.position.Y + (float)height - 16f), 4, 16, 31, 0f, 0f, 100, default(Color), 1.5f);
27025 Dust dust2 = Main.dust[num658];
27026 dust2.velocity *= 0.5f;
27027 Main.dust[num658].velocity.X -= nPC8.velocity.X / 2f;
27028 Main.dust[num658].velocity.Y = 0f - Math.Abs(Main.dust[num658].velocity.Y);
27029 }
27030 }
27031 if (type == 447 && ++frameCounter >= 5)
27032 {
27033 frameCounter = 0;
27034 if (++frame >= 4)
27035 {
27036 frame = 0;
27037 }
27038 }
27039 }
27040 else if (aiStyle == 80)
27041 {
27042 if (this.ai[0] == 0f && this.ai[1] > 0f)
27043 {
27044 this.ai[1]--;
27045 }
27046 else if (this.ai[0] == 0f && this.ai[1] == 0f)
27047 {
27048 this.ai[0] = 1f;
27049 this.ai[1] = (int)Player.FindClosest(base.position, width, height);
27050 netUpdate = true;
27051 float num659 = velocity.Length();
27053 for (int num660 = 0; num660 < 8; num660++)
27054 {
27055 Vector2 spinningpoint10 = Vector2.UnitX * -8f;
27056 spinningpoint10 += -Vector2.UnitY.RotatedBy((float)num660 * (float)Math.PI / 4f) * new Vector2(2f, 8f);
27057 spinningpoint10 = spinningpoint10.RotatedBy(rotation - (float)Math.PI / 2f);
27058 int num661 = Dust.NewDust(base.Center, 0, 0, 228);
27059 Main.dust[num661].scale = 1.5f;
27060 Main.dust[num661].noGravity = true;
27061 Main.dust[num661].position = base.Center + spinningpoint10;
27062 Main.dust[num661].velocity = velocity * 0f;
27063 }
27064 }
27065 else if (this.ai[0] == 1f)
27066 {
27067 tileCollide = true;
27068 localAI[1]++;
27069 float num662 = 180f;
27070 float num663 = 0f;
27071 float num664 = 30f;
27072 if (localAI[1] == num662)
27073 {
27074 Kill();
27075 return;
27076 }
27077 if (localAI[1] >= num663 && localAI[1] < num663 + num664)
27078 {
27079 Vector2 v8 = Main.player[(int)this.ai[1]].Center - base.Center;
27080 float num665 = velocity.ToRotation();
27081 float num666 = v8.ToRotation();
27082 double num667 = num666 - num665;
27083 if (num667 > Math.PI)
27084 {
27085 num667 -= Math.PI * 2.0;
27086 }
27087 if (num667 < -Math.PI)
27088 {
27089 num667 += Math.PI * 2.0;
27090 }
27091 velocity = velocity.RotatedBy(num667 * 0.20000000298023224);
27092 }
27093 if (localAI[1] % 5f == 0f)
27094 {
27095 for (int num668 = 0; num668 < 4; num668++)
27096 {
27097 Vector2 spinningpoint11 = Vector2.UnitX * -8f;
27098 spinningpoint11 += -Vector2.UnitY.RotatedBy((float)num668 * (float)Math.PI / 4f) * new Vector2(2f, 4f);
27099 spinningpoint11 = spinningpoint11.RotatedBy(rotation - (float)Math.PI / 2f);
27100 int num669 = Dust.NewDust(base.Center, 0, 0, 228);
27101 Main.dust[num669].scale = 1.5f;
27102 Main.dust[num669].noGravity = true;
27103 Main.dust[num669].position = base.Center + spinningpoint11;
27104 Main.dust[num669].velocity = velocity * 0f;
27105 }
27106 }
27107 }
27108 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
27109 if (++frameCounter >= 3)
27110 {
27111 frameCounter = 0;
27112 if (++frame >= 3)
27113 {
27114 frame = 0;
27115 }
27116 }
27117 for (int num670 = 0; (float)num670 < 1f + this.ai[0]; num670++)
27118 {
27119 Vector2 vector55 = Vector2.UnitY.RotatedBy(rotation) * 8f * (num670 + 1);
27120 int num671 = Dust.NewDust(base.Center, 0, 0, 228);
27121 Main.dust[num671].position = base.Center + vector55;
27122 Main.dust[num671].scale = 1f;
27123 Main.dust[num671].noGravity = true;
27124 }
27125 for (int num672 = 0; num672 < 255; num672++)
27126 {
27127 Player player7 = Main.player[num672];
27128 if (player7.active && !player7.dead && Vector2.Distance(player7.Center, base.Center) <= 42f)
27129 {
27130 Kill();
27131 break;
27132 }
27133 }
27134 }
27135 else if (aiStyle == 81)
27136 {
27137 int num673 = penetrate;
27138 if (this.ai[0] == 0f)
27139 {
27140 tileCollide = true;
27141 localAI[0]++;
27142 if (localAI[0] > 7f)
27143 {
27144 int num674 = Utils.SelectRandom<int>(Main.rand, 226, 229);
27145 Vector2 center8 = base.Center;
27146 Vector2 spinningpoint12 = new Vector2(-16f, 16f);
27147 float num675 = 1f;
27148 spinningpoint12 += new Vector2(-16f, 16f);
27150 int num676 = 4;
27151 int num677 = Dust.NewDust(center8 + spinningpoint12 + Vector2.One * -num676, num676 * 2, num676 * 2, num674, 0f, 0f, 100, default(Color), num675);
27152 Dust dust2 = Main.dust[num677];
27153 dust2.velocity *= 0.1f;
27154 if (Main.rand.Next(6) != 0)
27155 {
27156 Main.dust[num677].noGravity = true;
27157 }
27158 }
27159 float num678 = 0.01f;
27160 int num679 = 5;
27161 int num680 = num679 * 15;
27162 int num681 = 0;
27163 if (localAI[0] > 7f)
27164 {
27165 if (localAI[1] == 0f)
27166 {
27167 scale -= num678;
27168 alpha += num679;
27169 if (alpha > num680)
27170 {
27171 alpha = num680;
27172 localAI[1] = 1f;
27173 }
27174 }
27175 else if (localAI[1] == 1f)
27176 {
27177 scale += num678;
27178 alpha -= num679;
27179 if (alpha <= num681)
27180 {
27181 alpha = num681;
27182 localAI[1] = 0f;
27183 }
27184 }
27185 }
27186 rotation = velocity.ToRotation() + (float)Math.PI / 4f;
27187 }
27188 else if (this.ai[0] >= 1f && this.ai[0] < (float)(1 + num673))
27189 {
27190 tileCollide = false;
27191 alpha += 15;
27192 velocity *= 0.98f;
27193 localAI[0] = 0f;
27194 int num682 = -1;
27195 Vector2 vector56 = base.Center;
27196 float num683 = 250f;
27197 for (int num684 = 0; num684 < 200; num684++)
27198 {
27199 NPC nPC9 = Main.npc[num684];
27200 if (nPC9.CanBeChasedBy(this))
27201 {
27202 Vector2 center9 = nPC9.Center;
27203 float num685 = Vector2.Distance(center9, base.Center);
27204 if (num685 < num683)
27205 {
27206 num683 = num685;
27207 vector56 = center9;
27208 num682 = num684;
27209 }
27210 }
27211 }
27212 if (alpha >= 255)
27213 {
27214 if (this.ai[0] == 1f)
27215 {
27216 Kill();
27217 return;
27218 }
27219 if (num682 >= 0)
27220 {
27221 netUpdate = true;
27222 this.ai[0] += num673;
27223 base.position = vector56 + ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * 100f - new Vector2(width, height) / 2f;
27224 velocity = Vector2.Normalize(vector56 - base.Center) * 15f;
27225 rotation = velocity.ToRotation() + (float)Math.PI / 4f;
27226 }
27227 else
27228 {
27229 Kill();
27230 }
27231 }
27232 if (active && num682 >= 0)
27233 {
27234 base.position += Main.npc[num682].velocity;
27235 }
27236 if (Main.rand.Next(3) == 0)
27237 {
27238 int num686 = Utils.SelectRandom<int>(Main.rand, 226, 229);
27239 Vector2 center10 = base.Center;
27240 Vector2 vector57 = new Vector2(-16f, 16f);
27242 float num687 = 0.6f;
27243 vector57 += new Vector2(-16f, 16f);
27244 vector57 = vector57.RotatedBy(rotation);
27245 int num688 = 4;
27246 int num689 = Dust.NewDust(center10 + vector57 + Vector2.One * -num688, num688 * 2, num688 * 2, num686, 0f, 0f, 100, default(Color), num687);
27247 Dust dust2 = Main.dust[num689];
27248 dust2.velocity *= 0.1f;
27249 Main.dust[num689].noGravity = true;
27250 }
27251 }
27252 else if (this.ai[0] >= (float)(1 + num673) && this.ai[0] < (float)(1 + num673 * 2))
27253 {
27254 scale = 0.9f;
27255 tileCollide = false;
27256 rotation = velocity.ToRotation() + (float)Math.PI / 4f;
27257 this.ai[1]++;
27258 if (this.ai[1] >= 15f)
27259 {
27260 alpha += 51;
27261 velocity *= 0.8f;
27262 if (alpha >= 255)
27263 {
27264 Kill();
27265 }
27266 }
27267 else
27268 {
27269 alpha -= 125;
27270 if (alpha < 0)
27271 {
27272 alpha = 0;
27273 }
27274 velocity *= 0.98f;
27275 }
27276 localAI[0]++;
27277 int num690 = -1;
27278 Vector2 center11 = base.Center;
27279 float num691 = 250f;
27280 for (int num692 = 0; num692 < 200; num692++)
27281 {
27282 NPC nPC10 = Main.npc[num692];
27283 if (nPC10.CanBeChasedBy(this))
27284 {
27285 Vector2 center12 = nPC10.Center;
27286 float num693 = Vector2.Distance(center12, base.Center);
27287 if (num693 < num691)
27288 {
27289 num691 = num693;
27291 num690 = num692;
27292 }
27293 }
27294 }
27295 if (num690 >= 0)
27296 {
27297 base.position += Main.npc[num690].velocity;
27298 }
27299 int num694 = Utils.SelectRandom<int>(Main.rand, 226, 229);
27300 Vector2 center13 = base.Center;
27301 Vector2 spinningpoint13 = new Vector2(-16f, 16f);
27302 float num695 = 0.6f;
27303 spinningpoint13 += new Vector2(-16f, 16f);
27305 int num696 = 4;
27306 int num697 = Dust.NewDust(center13 + spinningpoint13 + Vector2.One * -num696, num696 * 2, num696 * 2, num694, 0f, 0f, 100, default(Color), num695);
27307 Dust dust2 = Main.dust[num697];
27308 dust2.velocity *= 0.1f;
27309 Main.dust[num697].noGravity = true;
27310 }
27311 float num698 = (float)alpha / 255f;
27312 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.3f * num698, 0.4f * num698, 1f * num698);
27313 }
27314 else if (aiStyle == 82)
27315 {
27316 alpha -= 40;
27317 if (alpha < 0)
27318 {
27319 alpha = 0;
27320 }
27321 if (this.ai[0] == 0f)
27322 {
27323 localAI[0]++;
27324 if (localAI[0] >= 45f)
27325 {
27326 localAI[0] = 0f;
27327 this.ai[0] = 1f;
27328 this.ai[1] = 0f - this.ai[1];
27329 netUpdate = true;
27330 }
27331 velocity.X = velocity.RotatedBy(this.ai[1]).X;
27332 velocity.X = MathHelper.Clamp(velocity.X, -6f, 6f);
27333 velocity.Y -= 0.08f;
27334 if (velocity.Y > 0f)
27335 {
27336 velocity.Y -= 0.2f;
27337 }
27338 if (velocity.Y < -7f)
27339 {
27340 velocity.Y = -7f;
27341 }
27342 }
27343 else if (this.ai[0] == 1f)
27344 {
27345 localAI[0]++;
27346 if (localAI[0] >= 90f)
27347 {
27348 localAI[0] = 0f;
27349 this.ai[0] = 2f;
27350 this.ai[1] = (int)Player.FindClosest(base.position, width, height);
27351 netUpdate = true;
27352 }
27353 velocity.X = velocity.RotatedBy(this.ai[1]).X;
27354 velocity.X = MathHelper.Clamp(velocity.X, -6f, 6f);
27355 velocity.Y -= 0.08f;
27356 if (velocity.Y > 0f)
27357 {
27358 velocity.Y -= 0.2f;
27359 }
27360 if (velocity.Y < -7f)
27361 {
27362 velocity.Y = -7f;
27363 }
27364 }
27365 else if (this.ai[0] == 2f)
27366 {
27367 Vector2 value7 = Main.player[(int)this.ai[1]].Center - base.Center;
27368 if (value7.Length() < 30f)
27369 {
27370 Kill();
27371 return;
27372 }
27373 value7.Normalize();
27374 value7 *= 14f;
27375 value7 = Vector2.Lerp(velocity, value7, 0.6f);
27376 if (value7.Y < 6f)
27377 {
27378 value7.Y = 6f;
27379 }
27380 float num699 = 0.4f;
27381 if (velocity.X < value7.X)
27382 {
27383 velocity.X += num699;
27384 if (velocity.X < 0f && value7.X > 0f)
27385 {
27386 velocity.X += num699;
27387 }
27388 }
27389 else if (velocity.X > value7.X)
27390 {
27391 velocity.X -= num699;
27392 if (velocity.X > 0f && value7.X < 0f)
27393 {
27394 velocity.X -= num699;
27395 }
27396 }
27397 if (velocity.Y < value7.Y)
27398 {
27399 velocity.Y += num699;
27400 if (velocity.Y < 0f && value7.Y > 0f)
27401 {
27402 velocity.Y += num699;
27403 }
27404 }
27405 else if (velocity.Y > value7.Y)
27406 {
27407 velocity.Y -= num699;
27408 if (velocity.Y > 0f && value7.Y < 0f)
27409 {
27410 velocity.Y -= num699;
27411 }
27412 }
27413 }
27414 if (alpha < 40)
27415 {
27416 int num700 = Dust.NewDust(base.Center - Vector2.One * 5f, 10, 10, 229, (0f - velocity.X) / 3f, (0f - velocity.Y) / 3f, 150, Color.Transparent, 1.2f);
27417 Main.dust[num700].noGravity = true;
27418 }
27419 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
27420 }
27421 else if (aiStyle == 83)
27422 {
27423 if (alpha > 200)
27424 {
27425 alpha = 200;
27426 }
27427 alpha -= 5;
27428 if (alpha < 0)
27429 {
27430 alpha = 0;
27431 }
27432 float num701 = (float)alpha / 255f;
27433 scale = 1f - num701;
27434 if (this.ai[0] >= 0f)
27435 {
27436 this.ai[0]++;
27437 }
27438 if (this.ai[0] == -1f)
27439 {
27440 frame = 1;
27441 extraUpdates = 1;
27442 }
27443 else if (this.ai[0] < 30f)
27444 {
27445 base.position = Main.npc[(int)this.ai[1]].Center - new Vector2(width, height) / 2f - velocity;
27446 }
27447 else
27448 {
27449 velocity *= 0.96f;
27450 if (++frameCounter >= 6)
27451 {
27452 frameCounter = 0;
27453 if (++frame >= 2)
27454 {
27455 frame = 0;
27456 }
27457 }
27458 }
27459 if (alpha >= 40)
27460 {
27461 return;
27462 }
27463 for (int num702 = 0; num702 < 2; num702++)
27464 {
27465 float num703 = (float)Main.rand.NextDouble() * 1f - 0.5f;
27466 if (num703 < -0.5f)
27467 {
27468 num703 = -0.5f;
27469 }
27470 if (num703 > 0.5f)
27471 {
27472 num703 = 0.5f;
27473 }
27474 Vector2 vector58 = new Vector2((float)(-width) * 0.65f * scale, 0f).RotatedBy(num703 * ((float)Math.PI * 2f)).RotatedBy(velocity.ToRotation());
27475 int num704 = Dust.NewDust(base.Center - Vector2.One * 5f, 10, 10, 229, (0f - velocity.X) / 3f, (0f - velocity.Y) / 3f, 150, Color.Transparent, 0.7f);
27476 Main.dust[num704].velocity = Vector2.Zero;
27477 Main.dust[num704].position = base.Center + vector58;
27478 Main.dust[num704].noGravity = true;
27479 }
27480 }
27481 else if (aiStyle == 84)
27482 {
27483 Vector2? vector59 = null;
27484 if (velocity.HasNaNs() || velocity == Vector2.Zero)
27485 {
27487 }
27488 if (type == 455 && Main.npc[(int)this.ai[1]].active && Main.npc[(int)this.ai[1]].type == 396)
27489 {
27490 if (Main.npc[(int)this.ai[1]].ai[0] == -2f)
27491 {
27492 Kill();
27493 return;
27494 }
27495 Vector2 vector60 = Utils.Vector2FromElipse(elipseSizes: new Vector2(27f, 59f) * Main.npc[(int)this.ai[1]].localAI[1], angleVector: Main.npc[(int)this.ai[1]].localAI[0].ToRotationVector2());
27496 base.position = Main.npc[(int)this.ai[1]].Center + vector60 - new Vector2(width, height) / 2f;
27497 }
27498 else if (type == 455 && Main.npc[(int)this.ai[1]].active && Main.npc[(int)this.ai[1]].type == 400)
27499 {
27500 Vector2 vector61 = Utils.Vector2FromElipse(elipseSizes: new Vector2(30f, 30f) * Main.npc[(int)this.ai[1]].localAI[1], angleVector: Main.npc[(int)this.ai[1]].localAI[0].ToRotationVector2());
27501 base.position = Main.npc[(int)this.ai[1]].Center + vector61 - new Vector2(width, height) / 2f;
27502 }
27503 else if (type == 537 && Main.npc[(int)this.ai[1]].active && Main.npc[(int)this.ai[1]].type == 411)
27504 {
27505 Vector2 vector62 = new Vector2(Main.npc[(int)this.ai[1]].direction * 6, -4f);
27506 base.position = Main.npc[(int)this.ai[1]].Center + vector62 - base.Size / 2f + new Vector2(0f, 0f - Main.npc[(int)this.ai[1]].gfxOffY);
27507 }
27508 else if (type == 461 && Main.projectile[(int)this.ai[1]].active && Main.projectile[(int)this.ai[1]].type == 460)
27509 {
27510 Vector2 vector63 = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity);
27511 base.position = Main.projectile[(int)this.ai[1]].Center + vector63 * 16f - new Vector2(width, height) / 2f + new Vector2(0f, 0f - Main.projectile[(int)this.ai[1]].gfxOffY);
27512 velocity = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity);
27513 }
27514 else if (type == 642 && Main.projectile[(int)this.ai[1]].active && Main.projectile[(int)this.ai[1]].type == 641)
27515 {
27516 Projectile projectile = Main.projectile[(int)this.ai[1]];
27517 base.Center = projectile.Center;
27518 Vector2 vector64 = this.ai[0].ToRotationVector2().RotatedBy((float)(-projectile.direction) * ((float)Math.PI / 3f) / 50f);
27519 this.ai[0] = vector64.ToRotation();
27521 }
27522 else
27523 {
27524 if (type != 632 || !Main.projectile[(int)this.ai[1]].active || Main.projectile[(int)this.ai[1]].type != 633)
27525 {
27526 Kill();
27527 return;
27528 }
27529 float num705 = (float)(int)this.ai[0] - 2.5f;
27530 Vector2 vector65 = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity);
27531 Projectile projectile2 = Main.projectile[(int)this.ai[1]];
27532 float num706 = num705 * ((float)Math.PI / 6f);
27533 float num707 = 20f;
27535 float num708 = 1f;
27536 float num709 = 15f;
27537 float num710 = -2f;
27538 if (projectile2.ai[0] < 180f)
27539 {
27540 num708 = 1f - projectile2.ai[0] / 180f;
27541 num709 = 20f - projectile2.ai[0] / 180f * 14f;
27542 if (projectile2.ai[0] < 120f)
27543 {
27544 num707 = 20f - 4f * (projectile2.ai[0] / 120f);
27545 Opacity = projectile2.ai[0] / 120f * 0.4f;
27546 }
27547 else
27548 {
27549 num707 = 16f - 10f * ((projectile2.ai[0] - 120f) / 60f);
27550 Opacity = 0.4f + (projectile2.ai[0] - 120f) / 60f * 0.6f;
27551 }
27552 num710 = -22f + projectile2.ai[0] / 180f * 20f;
27553 }
27554 else
27555 {
27556 num708 = 0f;
27557 num707 = 1.75f;
27558 num709 = 6f;
27559 Opacity = 1f;
27560 num710 = -2f;
27561 }
27562 float num711 = (projectile2.ai[0] + num705 * num707) / (num707 * 6f) * ((float)Math.PI * 2f);
27563 num706 = Vector2.UnitY.RotatedBy(num711).Y * ((float)Math.PI / 6f) * num708;
27564 zero2 = (Vector2.UnitY.RotatedBy(num711) * new Vector2(4f, num709)).RotatedBy(projectile2.velocity.ToRotation());
27565 base.position = projectile2.Center + vector65 * 16f - base.Size / 2f + new Vector2(0f, 0f - Main.projectile[(int)this.ai[1]].gfxOffY);
27566 base.position += projectile2.velocity.ToRotation().ToRotationVector2() * num710;
27567 base.position += zero2;
27568 velocity = Vector2.Normalize(projectile2.velocity).RotatedBy(num706);
27569 scale = 1.4f * (1f - num708);
27570 damage = projectile2.damage;
27571 if (projectile2.ai[0] >= 180f)
27572 {
27573 damage *= 3;
27574 vector59 = projectile2.Center;
27575 }
27576 if (!Collision.CanHitLine(Main.player[owner].Center, 0, 0, projectile2.Center, 0, 0))
27577 {
27578 vector59 = Main.player[owner].Center;
27579 }
27580 friendly = projectile2.ai[0] > 30f;
27581 }
27582 if (velocity.HasNaNs() || velocity == Vector2.Zero)
27583 {
27585 }
27586 if (type == 461)
27587 {
27588 this.ai[0]++;
27589 if (this.ai[0] >= 300f)
27590 {
27591 Kill();
27592 return;
27593 }
27594 scale = (float)Math.Sin(this.ai[0] * (float)Math.PI / 300f) * 10f;
27595 if (scale > 1f)
27596 {
27597 scale = 1f;
27598 }
27599 }
27600 if (type == 455)
27601 {
27602 if (localAI[0] == 0f)
27603 {
27604 SoundEngine.PlaySound(29, (int)base.position.X, (int)base.position.Y, 104);
27605 }
27606 float num712 = 1f;
27607 if (Main.npc[(int)this.ai[1]].type == 400)
27608 {
27609 num712 = 0.4f;
27610 }
27611 localAI[0]++;
27612 if (localAI[0] >= 180f)
27613 {
27614 Kill();
27615 return;
27616 }
27617 scale = (float)Math.Sin(localAI[0] * (float)Math.PI / 180f) * 10f * num712;
27618 if (scale > num712)
27619 {
27620 scale = num712;
27621 }
27622 }
27623 if (type == 642)
27624 {
27625 float num713 = 1f;
27626 localAI[0]++;
27627 if (localAI[0] >= 50f)
27628 {
27629 Kill();
27630 return;
27631 }
27632 scale = (float)Math.Sin(localAI[0] * (float)Math.PI / 50f) * 10f * num713;
27633 if (scale > num713)
27634 {
27635 scale = num713;
27636 }
27637 }
27638 if (type == 537)
27639 {
27640 float num714 = 0.8f;
27641 localAI[0]++;
27642 if (localAI[0] >= 90f)
27643 {
27644 Kill();
27645 return;
27646 }
27647 scale = (float)Math.Sin(localAI[0] * (float)Math.PI / 90f) * 10f * num714;
27648 if (scale > num714)
27649 {
27650 scale = num714;
27651 }
27652 }
27653 float num715 = velocity.ToRotation();
27654 if (type == 455)
27655 {
27656 num715 += this.ai[0];
27657 }
27658 rotation = num715 - (float)Math.PI / 2f;
27659 velocity = num715.ToRotationVector2();
27660 float num716 = 0f;
27661 float num717 = 0f;
27662 Vector2 samplingPoint = base.Center;
27663 if (vector59.HasValue)
27664 {
27665 samplingPoint = vector59.Value;
27666 }
27667 if (type == 455)
27668 {
27669 num716 = 3f;
27670 num717 = width;
27671 }
27672 else if (type == 461)
27673 {
27674 num716 = 2f;
27675 num717 = 0f;
27676 }
27677 else if (type == 642)
27678 {
27679 num716 = 2f;
27680 num717 = 0f;
27681 }
27682 else if (type == 632)
27683 {
27684 num716 = 2f;
27685 num717 = 0f;
27686 }
27687 else if (type == 537)
27688 {
27689 num716 = 2f;
27690 num717 = 0f;
27691 }
27692 float[] array4 = new float[(int)num716];
27693 Collision.LaserScan(samplingPoint, velocity, num717 * scale, 2400f, array4);
27694 float num718 = 0f;
27695 for (int num719 = 0; num719 < array4.Length; num719++)
27696 {
27697 num718 += array4[num719];
27698 }
27699 num718 /= num716;
27700 float amount = 0.5f;
27701 if (type == 455)
27702 {
27703 NPC nPC11 = Main.npc[(int)this.ai[1]];
27704 if (nPC11.type == 396)
27705 {
27706 Player player8 = Main.player[nPC11.target];
27707 if (!Collision.CanHitLine(nPC11.position, nPC11.width, nPC11.height, player8.position, player8.width, player8.height))
27708 {
27709 num718 = Math.Min(2400f, Vector2.Distance(nPC11.Center, player8.Center) + 150f);
27710 amount = 0.75f;
27711 }
27712 }
27713 }
27714 if (type == 632)
27715 {
27716 amount = 0.75f;
27717 }
27719 if (type == 455)
27720 {
27721 Vector2 vector66 = base.Center + velocity * (localAI[1] - 14f);
27722 for (int num720 = 0; num720 < 2; num720++)
27723 {
27724 float num721 = velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
27725 float num722 = (float)Main.rand.NextDouble() * 2f + 2f;
27726 Vector2 vector67 = new Vector2((float)Math.Cos(num721) * num722, (float)Math.Sin(num721) * num722);
27727 int num723 = Dust.NewDust(vector66, 0, 0, 229, vector67.X, vector67.Y);
27728 Main.dust[num723].noGravity = true;
27729 Main.dust[num723].scale = 1.7f;
27730 }
27731 if (Main.rand.Next(5) == 0)
27732 {
27733 Vector2 vector68 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
27734 int num724 = Dust.NewDust(vector66 + vector68 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
27735 Dust dust2 = Main.dust[num724];
27736 dust2.velocity *= 0.5f;
27737 Main.dust[num724].velocity.Y = 0f - Math.Abs(Main.dust[num724].velocity.Y);
27738 }
27739 DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f);
27740 Utils.PlotTileLine(base.Center, base.Center + velocity * localAI[1], (float)width * scale, DelegateMethods.CastLight);
27741 }
27742 else if (type == 642)
27743 {
27744 Vector2 vector69 = base.Center + velocity * (localAI[1] - 14f);
27745 for (int num725 = 0; num725 < 2; num725++)
27746 {
27747 float num726 = velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
27748 float num727 = (float)Main.rand.NextDouble() * 2f + 2f;
27749 Vector2 vector70 = new Vector2((float)Math.Cos(num726) * num727, (float)Math.Sin(num726) * num727);
27750 int num728 = Dust.NewDust(vector69, 0, 0, 229, vector70.X, vector70.Y);
27751 Main.dust[num728].noGravity = true;
27752 Main.dust[num728].scale = 1.7f;
27753 }
27754 if (Main.rand.Next(5) == 0)
27755 {
27756 Vector2 vector71 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
27757 int num729 = Dust.NewDust(vector69 + vector71 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
27758 Dust dust2 = Main.dust[num729];
27759 dust2.velocity *= 0.5f;
27760 Main.dust[num729].velocity.Y = 0f - Math.Abs(Main.dust[num729].velocity.Y);
27761 }
27762 DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f);
27763 Utils.PlotTileLine(base.Center, base.Center + velocity * localAI[1], (float)width * scale, DelegateMethods.CastLight);
27764 }
27765 if (type == 461)
27766 {
27767 Vector2 vector72 = base.Center + velocity * (localAI[1] - 8f);
27768 for (int num730 = 0; num730 < 2; num730++)
27769 {
27770 float num731 = velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
27771 float num732 = (float)Main.rand.NextDouble() * 0.8f + 1f;
27772 Vector2 vector73 = new Vector2((float)Math.Cos(num731) * num732, (float)Math.Sin(num731) * num732);
27773 int num733 = Dust.NewDust(vector72, 0, 0, 226, vector73.X, vector73.Y);
27774 Main.dust[num733].noGravity = true;
27775 Main.dust[num733].scale = 1.2f;
27776 }
27777 if (Main.rand.Next(5) == 0)
27778 {
27779 Vector2 vector74 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
27780 int num734 = Dust.NewDust(vector72 + vector74 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
27781 Dust dust2 = Main.dust[num734];
27782 dust2.velocity *= 0.5f;
27783 Main.dust[num734].velocity.Y = 0f - Math.Abs(Main.dust[num734].velocity.Y);
27784 }
27785 DelegateMethods.v3_1 = new Vector3(0.4f, 0.85f, 0.9f);
27786 Utils.PlotTileLine(base.Center, base.Center + velocity * localAI[1], (float)width * scale, DelegateMethods.CastLight);
27787 }
27788 if (type == 537)
27789 {
27790 float num735 = MathHelper.Clamp(MathHelper.Lerp(0f, 1f, localAI[0] / 30f), 0f, 1f);
27791 Vector2 vector75 = base.Center + velocity * (localAI[1] - 8f);
27792 int num736 = (int)(2f * num735);
27793 if (num736 > 0)
27794 {
27795 for (int num737 = 0; num737 < num736; num737++)
27796 {
27797 float num738 = velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
27798 float num739 = (float)Main.rand.NextDouble() * 0.8f + 1f;
27799 Vector2 vector76 = new Vector2((float)Math.Cos(num738) * num739, (float)Math.Sin(num738) * num739);
27800 int num740 = Dust.NewDust(vector75, 0, 0, 226, vector76.X, vector76.Y);
27801 Main.dust[num740].noGravity = true;
27802 Main.dust[num740].scale = 1.2f;
27803 }
27804 }
27805 int maxValue2 = 5 + (int)((1f - num735) * 5f);
27806 if (Main.rand.Next(maxValue2) == 0)
27807 {
27808 Vector2 vector77 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
27809 int num741 = Dust.NewDust(vector75 + vector77 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
27810 Dust dust2 = Main.dust[num741];
27811 dust2.velocity *= 0.5f;
27812 Main.dust[num741].velocity.Y = 0f - Math.Abs(Main.dust[num741].velocity.Y);
27813 }
27814 DelegateMethods.v3_1 = new Vector3(0.4f, 0.85f, 0.9f);
27815 Utils.PlotTileLine(base.Center, base.Center + velocity * localAI[1], (float)width * scale, DelegateMethods.CastLight);
27816 }
27817 if (type != 632 || !(Math.Abs(localAI[1] - num718) < 100f) || !(scale > 0.15f))
27818 {
27819 return;
27820 }
27821 float laserLuminance = 0.5f;
27822 float laserAlphaMultiplier = 0f;
27824 Color color = Main.hslToRgb(lastPrismHue, 1f, laserLuminance);
27825 color.A = (byte)((float)(int)color.A * laserAlphaMultiplier);
27826 Color color2 = color;
27827 Vector2 vector78 = base.Center + velocity * (localAI[1] - 14.5f * scale);
27828 float x5 = Main.rgbToHsl(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)).X;
27829 for (int num742 = 0; num742 < 2; num742++)
27830 {
27831 float num743 = velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
27832 float num744 = (float)Main.rand.NextDouble() * 0.8f + 1f;
27833 Vector2 vector79 = new Vector2((float)Math.Cos(num743) * num744, (float)Math.Sin(num743) * num744);
27834 int num745 = Dust.NewDust(vector78, 0, 0, 267, vector79.X, vector79.Y);
27835 Main.dust[num745].color = color;
27836 Main.dust[num745].scale = 1.2f;
27837 if (scale > 1f)
27838 {
27839 Dust dust2 = Main.dust[num745];
27840 dust2.velocity *= scale;
27841 dust2 = Main.dust[num745];
27842 dust2.scale *= scale;
27843 }
27844 Main.dust[num745].noGravity = true;
27845 if (scale != 1.4f && num745 != 6000)
27846 {
27847 Dust dust21 = Dust.CloneDust(num745);
27848 dust21.color = Color.White;
27849 Dust dust2 = dust21;
27850 dust2.scale /= 2f;
27851 }
27852 float hue = (x5 + Main.rand.NextFloat() * 0.4f) % 1f;
27853 Main.dust[num745].color = Color.Lerp(color, Main.hslToRgb(hue, 1f, 0.75f), scale / 1.4f);
27854 }
27855 if (Main.rand.Next(5) == 0)
27856 {
27857 Vector2 vector80 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
27858 int num746 = Dust.NewDust(vector78 + vector80 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
27859 Dust dust2 = Main.dust[num746];
27860 dust2.velocity *= 0.5f;
27861 Main.dust[num746].velocity.Y = 0f - Math.Abs(Main.dust[num746].velocity.Y);
27862 }
27863 DelegateMethods.v3_1 = color.ToVector3() * 0.3f;
27864 float value8 = 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 20f);
27865 Vector2 size2 = new Vector2(velocity.Length() * localAI[1], (float)width * scale);
27866 float num747 = velocity.ToRotation();
27867 if (Main.netMode != 2)
27868 {
27869 ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(base.position + new Vector2(size2.X * 0.5f, 0f).RotatedBy(num747), new Color(0.5f, 0.1f * (float)Math.Sign(value8) + 0.5f, 0f, 1f) * Math.Abs(value8), size2, RippleShape.Square, num747);
27870 }
27871 Utils.PlotTileLine(base.Center, base.Center + velocity * localAI[1], (float)width * scale, DelegateMethods.CastLight);
27872 }
27873 else if (aiStyle == 85)
27874 {
27875 Vector2 vector81 = new Vector2(0f, 216f);
27876 alpha -= 15;
27877 if (alpha < 0)
27878 {
27879 alpha = 0;
27880 }
27881 int num748 = (int)Math.Abs(this.ai[0]) - 1;
27882 int num749 = (int)this.ai[1];
27883 if (!Main.npc[num748].active || Main.npc[num748].type != 396)
27884 {
27885 Kill();
27886 return;
27887 }
27888 localAI[0]++;
27889 if (localAI[0] >= 330f && this.ai[0] > 0f && Main.netMode != 1)
27890 {
27891 this.ai[0] *= -1f;
27892 netUpdate = true;
27893 }
27894 if (Main.netMode != 1 && this.ai[0] > 0f && (!Main.player[(int)this.ai[1]].active || Main.player[(int)this.ai[1]].dead))
27895 {
27896 this.ai[0] *= -1f;
27897 netUpdate = true;
27898 }
27899 rotation = (Main.npc[(int)Math.Abs(this.ai[0]) - 1].Center - Main.player[(int)this.ai[1]].Center + vector81).ToRotation() + (float)Math.PI / 2f;
27900 if (this.ai[0] > 0f)
27901 {
27902 Vector2 value9 = Main.player[(int)this.ai[1]].Center - base.Center;
27903 if (value9.X != 0f || value9.Y != 0f)
27904 {
27905 velocity = Vector2.Normalize(value9) * Math.Min(16f, value9.Length());
27906 }
27907 else
27908 {
27910 }
27911 if (value9.Length() < 20f && localAI[1] == 0f)
27912 {
27913 localAI[1] = 1f;
27914 int timeToAdd = 840;
27915 if (Main.expertMode)
27916 {
27917 timeToAdd = 960;
27918 }
27919 if (!Main.player[num749].creativeGodMode)
27920 {
27921 Main.player[num749].AddBuff(145, timeToAdd);
27922 }
27923 }
27924 }
27925 else
27926 {
27927 Vector2 value10 = Main.npc[(int)Math.Abs(this.ai[0]) - 1].Center - base.Center + vector81;
27928 if (value10.X != 0f || value10.Y != 0f)
27929 {
27930 velocity = Vector2.Normalize(value10) * Math.Min(16f, value10.Length());
27931 }
27932 else
27933 {
27935 }
27936 if (value10.Length() < 20f)
27937 {
27938 Kill();
27939 }
27940 }
27941 }
27942 else if (aiStyle == 86)
27943 {
27944 if (localAI[1] == 0f)
27945 {
27946 localAI[1] = 1f;
27948 }
27949 this.ai[0]++;
27950 if (this.ai[1] == 1f)
27951 {
27952 if (this.ai[0] >= 130f)
27953 {
27954 alpha += 10;
27955 }
27956 else
27957 {
27958 alpha -= 10;
27959 }
27960 if (alpha < 0)
27961 {
27962 alpha = 0;
27963 }
27964 if (alpha > 255)
27965 {
27966 alpha = 255;
27967 }
27968 if (this.ai[0] >= 150f)
27969 {
27970 Kill();
27971 return;
27972 }
27973 if (this.ai[0] % 30f == 0f && Main.netMode != 1)
27974 {
27975 Vector2 vector82 = rotation.ToRotationVector2();
27977 }
27978 rotation += (float)Math.PI / 30f;
27979 Lighting.AddLight(base.Center, 0.3f, 0.75f, 0.9f);
27980 return;
27981 }
27982 base.position -= velocity;
27983 if (this.ai[0] >= 40f)
27984 {
27985 alpha += 3;
27986 }
27987 else
27988 {
27989 alpha -= 40;
27990 }
27991 if (alpha < 0)
27992 {
27993 alpha = 0;
27994 }
27995 if (alpha > 255)
27996 {
27997 alpha = 255;
27998 }
27999 if (this.ai[0] >= 45f)
28000 {
28001 Kill();
28002 return;
28003 }
28004 Vector2 vector83 = new Vector2(0f, -720f).RotatedBy(velocity.ToRotation());
28005 float num750 = this.ai[0] % 45f / 45f;
28007 for (int num751 = 0; num751 < 6; num751++)
28008 {
28009 Vector2 vector84 = base.Center + spinningpoint14.RotatedBy((float)num751 * ((float)Math.PI * 2f) / 6f);
28010 Lighting.AddLight(vector84, 0.3f, 0.75f, 0.9f);
28011 for (int num752 = 0; num752 < 2; num752++)
28012 {
28013 int num753 = Dust.NewDust(vector84 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent);
28014 Main.dust[num753].noGravity = true;
28015 }
28016 }
28017 }
28018 else if (aiStyle == 87)
28019 {
28020 base.position.Y = this.ai[0];
28021 height = (int)this.ai[1];
28022 if (base.Center.X > Main.player[owner].Center.X)
28023 {
28024 direction = 1;
28025 }
28026 else
28027 {
28028 direction = -1;
28029 }
28030 velocity.X = (float)direction * 1E-06f;
28031 if (owner == Main.myPlayer)
28032 {
28033 for (int num754 = 0; num754 < 1000; num754++)
28034 {
28035 if (Main.projectile[num754].active && num754 != whoAmI && Main.projectile[num754].type == type && Main.projectile[num754].owner == owner && Main.projectile[num754].timeLeft > timeLeft)
28036 {
28037 Kill();
28038 return;
28039 }
28040 }
28041 }
28042 float num755 = (float)(width * height) * 0.0045f;
28043 for (int num756 = 0; (float)num756 < num755; num756++)
28044 {
28045 int num757 = Dust.NewDust(base.position, width, height, 75, 0f, 0f, 100);
28046 Main.dust[num757].noGravity = true;
28047 Dust dust2 = Main.dust[num757];
28048 dust2.velocity *= 0.5f;
28049 Main.dust[num757].velocity.Y -= 0.5f;
28050 Main.dust[num757].scale = 1.4f;
28051 Main.dust[num757].position.X += 6f;
28052 Main.dust[num757].position.Y -= 2f;
28053 }
28054 }
28055 else if (aiStyle == 88)
28056 {
28057 if (type == 465)
28058 {
28059 if (localAI[1] == 0f)
28060 {
28062 localAI[1] = 1f;
28063 }
28064 if (this.ai[0] < 180f)
28065 {
28066 alpha -= 5;
28067 if (alpha < 0)
28068 {
28069 alpha = 0;
28070 }
28071 }
28072 else
28073 {
28074 alpha += 5;
28075 if (alpha > 255)
28076 {
28077 alpha = 255;
28078 Kill();
28079 return;
28080 }
28081 }
28082 this.ai[0]++;
28083 if (this.ai[0] % 30f == 0f && this.ai[0] < 180f && Main.netMode != 1)
28084 {
28085 int[] array5 = new int[5];
28086 Vector2[] array6 = new Vector2[5];
28087 int num758 = 0;
28088 float num759 = 2000f;
28089 for (int num760 = 0; num760 < 255; num760++)
28090 {
28091 if (!Main.player[num760].active || Main.player[num760].dead)
28092 {
28093 continue;
28094 }
28095 Vector2 center14 = Main.player[num760].Center;
28096 float num761 = Vector2.Distance(center14, base.Center);
28097 if (num761 < num759 && Collision.CanHit(base.Center, 1, 1, center14, 1, 1))
28098 {
28099 array5[num758] = num760;
28101 int num38 = num758 + 1;
28102 num758 = num38;
28103 if (num38 >= array6.Length)
28104 {
28105 break;
28106 }
28107 }
28108 }
28109 for (int num762 = 0; num762 < num758; num762++)
28110 {
28111 Vector2 vector85 = array6[num762] - base.Center;
28112 float ai = Main.rand.Next(100);
28113 Vector2 vector86 = Vector2.Normalize(vector85.RotatedByRandom(0.7853981852531433)) * 7f;
28114 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector86.X, vector86.Y, 466, damage, 0f, Main.myPlayer, vector85.ToRotation(), ai);
28115 }
28116 }
28117 Lighting.AddLight(base.Center, 0.4f, 0.85f, 0.9f);
28118 if (++frameCounter >= 4)
28119 {
28120 frameCounter = 0;
28121 if (++frame >= Main.projFrames[type])
28122 {
28123 frame = 0;
28124 }
28125 }
28126 if (alpha >= 150 || !(this.ai[0] < 180f))
28127 {
28128 return;
28129 }
28130 for (int num763 = 0; num763 < 1; num763++)
28131 {
28132 float num764 = (float)Main.rand.NextDouble() * 1f - 0.5f;
28133 if (num764 < -0.5f)
28134 {
28135 num764 = -0.5f;
28136 }
28137 if (num764 > 0.5f)
28138 {
28139 num764 = 0.5f;
28140 }
28141 Vector2 vector87 = new Vector2((float)(-width) * 0.2f * scale, 0f).RotatedBy(num764 * ((float)Math.PI * 2f)).RotatedBy(velocity.ToRotation());
28142 int num765 = Dust.NewDust(base.Center - Vector2.One * 5f, 10, 10, 226, (0f - velocity.X) / 3f, (0f - velocity.Y) / 3f, 150, Color.Transparent, 0.7f);
28143 Main.dust[num765].position = base.Center + vector87;
28144 Main.dust[num765].velocity = Vector2.Normalize(Main.dust[num765].position - base.Center) * 2f;
28145 Main.dust[num765].noGravity = true;
28146 }
28147 for (int num766 = 0; num766 < 1; num766++)
28148 {
28149 float num767 = (float)Main.rand.NextDouble() * 1f - 0.5f;
28150 if (num767 < -0.5f)
28151 {
28152 num767 = -0.5f;
28153 }
28154 if (num767 > 0.5f)
28155 {
28156 num767 = 0.5f;
28157 }
28158 Vector2 vector88 = new Vector2((float)(-width) * 0.6f * scale, 0f).RotatedBy(num767 * ((float)Math.PI * 2f)).RotatedBy(velocity.ToRotation());
28159 int num768 = Dust.NewDust(base.Center - Vector2.One * 5f, 10, 10, 226, (0f - velocity.X) / 3f, (0f - velocity.Y) / 3f, 150, Color.Transparent, 0.7f);
28160 Main.dust[num768].velocity = Vector2.Zero;
28161 Main.dust[num768].position = base.Center + vector88;
28162 Main.dust[num768].noGravity = true;
28163 }
28164 }
28165 else if (type == 466)
28166 {
28167 frameCounter++;
28168 Lighting.AddLight(base.Center, 0.3f, 0.45f, 0.5f);
28169 if (velocity == Vector2.Zero)
28170 {
28171 if (frameCounter >= extraUpdates * 2)
28172 {
28173 frameCounter = 0;
28174 bool flag35 = true;
28175 for (int num769 = 1; num769 < oldPos.Length; num769++)
28176 {
28177 if (oldPos[num769] != oldPos[0])
28178 {
28179 flag35 = false;
28180 }
28181 }
28182 if (flag35)
28183 {
28184 Kill();
28185 return;
28186 }
28187 }
28188 if (Main.rand.Next(extraUpdates) == 0)
28189 {
28190 for (int num770 = 0; num770 < 2; num770++)
28191 {
28192 float num771 = rotation + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
28193 float num772 = (float)Main.rand.NextDouble() * 0.8f + 1f;
28194 Vector2 vector89 = new Vector2((float)Math.Cos(num771) * num772, (float)Math.Sin(num771) * num772);
28195 int num773 = Dust.NewDust(base.Center, 0, 0, 226, vector89.X, vector89.Y);
28196 Main.dust[num773].noGravity = true;
28197 Main.dust[num773].scale = 1.2f;
28198 }
28199 if (Main.rand.Next(5) == 0)
28200 {
28201 Vector2 vector90 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
28202 int num774 = Dust.NewDust(base.Center + vector90 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
28203 Dust dust2 = Main.dust[num774];
28204 dust2.velocity *= 0.5f;
28205 Main.dust[num774].velocity.Y = 0f - Math.Abs(Main.dust[num774].velocity.Y);
28206 }
28207 }
28208 }
28209 else
28210 {
28211 if (frameCounter < extraUpdates * 2)
28212 {
28213 return;
28214 }
28215 frameCounter = 0;
28216 float num775 = velocity.Length();
28217 UnifiedRandom unifiedRandom = new UnifiedRandom((int)this.ai[1]);
28218 int num776 = 0;
28220 while (true)
28221 {
28222 int num777 = unifiedRandom.Next();
28223 this.ai[1] = num777;
28224 num777 %= 100;
28225 float f = (float)num777 / 100f * ((float)Math.PI * 2f);
28226 Vector2 vector91 = f.ToRotationVector2();
28227 if (vector91.Y > 0f)
28228 {
28229 vector91.Y *= -1f;
28230 }
28231 bool flag36 = false;
28232 if (vector91.Y > -0.02f)
28233 {
28234 flag36 = true;
28235 }
28236 if (vector91.X * (float)(extraUpdates + 1) * 2f * num775 + localAI[0] > 40f)
28237 {
28238 flag36 = true;
28239 }
28240 if (vector91.X * (float)(extraUpdates + 1) * 2f * num775 + localAI[0] < -40f)
28241 {
28242 flag36 = true;
28243 }
28244 if (flag36)
28245 {
28246 if (num776++ >= 100)
28247 {
28249 localAI[1] = 1f;
28250 break;
28251 }
28252 continue;
28253 }
28255 break;
28256 }
28257 if (velocity != Vector2.Zero)
28258 {
28259 localAI[0] += spinningpoint15.X * (float)(extraUpdates + 1) * 2f * num775;
28260 velocity = spinningpoint15.RotatedBy(this.ai[0] + (float)Math.PI / 2f) * num775;
28261 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
28262 }
28263 }
28264 }
28265 else
28266 {
28267 if (type != 580)
28268 {
28269 return;
28270 }
28271 if (localAI[1] == 0f && this.ai[0] >= 900f)
28272 {
28273 this.ai[0] -= 1000f;
28274 localAI[1] = -1f;
28275 }
28276 frameCounter++;
28277 Lighting.AddLight(base.Center, 0.3f, 0.45f, 0.5f);
28278 if (velocity == Vector2.Zero)
28279 {
28280 if (frameCounter >= extraUpdates * 2)
28281 {
28282 frameCounter = 0;
28283 bool flag37 = true;
28284 for (int num778 = 1; num778 < oldPos.Length; num778++)
28285 {
28286 if (oldPos[num778] != oldPos[0])
28287 {
28288 flag37 = false;
28289 }
28290 }
28291 if (flag37)
28292 {
28293 Kill();
28294 return;
28295 }
28296 }
28297 if (Main.rand.Next(extraUpdates) == 0 && (velocity != Vector2.Zero || Main.rand.Next((localAI[1] == 2f) ? 2 : 6) == 0))
28298 {
28299 for (int num779 = 0; num779 < 2; num779++)
28300 {
28301 float num780 = rotation + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
28302 float num781 = (float)Main.rand.NextDouble() * 0.8f + 1f;
28303 Vector2 vector92 = new Vector2((float)Math.Cos(num780) * num781, (float)Math.Sin(num780) * num781);
28304 int num782 = Dust.NewDust(base.Center, 0, 0, 226, vector92.X, vector92.Y);
28305 Main.dust[num782].noGravity = true;
28306 Main.dust[num782].scale = 1.2f;
28307 }
28308 if (Main.rand.Next(5) == 0)
28309 {
28310 Vector2 vector93 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
28311 int num783 = Dust.NewDust(base.Center + vector93 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
28312 Dust dust2 = Main.dust[num783];
28313 dust2.velocity *= 0.5f;
28314 Main.dust[num783].velocity.Y = 0f - Math.Abs(Main.dust[num783].velocity.Y);
28315 }
28316 }
28317 }
28318 else
28319 {
28320 if (frameCounter < extraUpdates * 2)
28321 {
28322 return;
28323 }
28324 frameCounter = 0;
28325 float num784 = velocity.Length();
28326 UnifiedRandom unifiedRandom2 = new UnifiedRandom((int)this.ai[1]);
28327 int num785 = 0;
28329 while (true)
28330 {
28331 int num786 = unifiedRandom2.Next();
28332 this.ai[1] = num786;
28333 num786 %= 100;
28334 float f2 = (float)num786 / 100f * ((float)Math.PI * 2f);
28335 Vector2 vector94 = f2.ToRotationVector2();
28336 if (vector94.Y > 0f)
28337 {
28338 vector94.Y *= -1f;
28339 }
28340 bool flag38 = false;
28341 if (vector94.Y > -0.02f)
28342 {
28343 flag38 = true;
28344 }
28345 if (vector94.X * (float)(extraUpdates + 1) * 2f * num784 + localAI[0] > 40f)
28346 {
28347 flag38 = true;
28348 }
28349 if (vector94.X * (float)(extraUpdates + 1) * 2f * num784 + localAI[0] < -40f)
28350 {
28351 flag38 = true;
28352 }
28353 if (flag38)
28354 {
28355 if (num785++ >= 100)
28356 {
28358 if (localAI[1] < 1f)
28359 {
28360 localAI[1] += 2f;
28361 }
28362 break;
28363 }
28364 continue;
28365 }
28367 break;
28368 }
28369 if (!(velocity != Vector2.Zero))
28370 {
28371 return;
28372 }
28373 localAI[0] += spinningpoint16.X * (float)(extraUpdates + 1) * 2f * num784;
28374 velocity = spinningpoint16.RotatedBy(this.ai[0] + (float)Math.PI / 2f) * num784;
28375 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
28376 if (Main.rand.Next(4) == 0 && Main.netMode != 1 && localAI[1] == 0f)
28377 {
28378 float num787 = (float)Main.rand.Next(-3, 4) * ((float)Math.PI / 3f) / 3f;
28379 Vector2 vector95 = this.ai[0].ToRotationVector2().RotatedBy(num787) * velocity.Length();
28380 if (!Collision.CanHitLine(base.Center, 0, 0, base.Center + vector95 * 50f, 0, 0))
28381 {
28382 NewProjectile(GetProjectileSource_FromThis(), base.Center.X - vector95.X, base.Center.Y - vector95.Y, vector95.X, vector95.Y, type, damage, knockBack, owner, vector95.ToRotation() + 1000f, this.ai[1]);
28383 }
28384 }
28385 }
28386 }
28387 }
28388 else if (aiStyle == 89)
28389 {
28390 if (this.ai[1] == -1f)
28391 {
28392 alpha += 12;
28393 }
28394 else if (this.ai[0] < 300f)
28395 {
28396 alpha -= 5;
28397 }
28398 else
28399 {
28400 alpha += 12;
28401 }
28402 if (alpha < 0)
28403 {
28404 alpha = 0;
28405 }
28406 if (alpha > 255)
28407 {
28408 alpha = 255;
28409 }
28410 scale = 1f - (float)alpha / 255f;
28411 scale *= 0.6f;
28412 rotation += (float)Math.PI / 210f;
28413 if (localAI[1] == 0f)
28414 {
28415 localAI[1] = 1f;
28417 }
28418 if (alpha == 0)
28419 {
28420 for (int num788 = 0; num788 < 2; num788++)
28421 {
28422 float num789 = Main.rand.Next(2, 4);
28423 float num790 = scale;
28424 if (num788 == 1)
28425 {
28426 num790 *= 0.42f;
28427 num789 *= -0.75f;
28428 }
28429 Vector2 vector96 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
28430 vector96.Normalize();
28431 int num791 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 228, 0f, 0f, 100, default(Color), 2f);
28432 Main.dust[num791].noGravity = true;
28433 Main.dust[num791].noLight = true;
28434 Main.dust[num791].position = base.Center + vector96 * 204f * num790;
28435 if (Main.rand.Next(8) == 0)
28436 {
28437 Main.dust[num791].velocity = vector96 * (0f - num789) * 2f;
28438 Dust dust2 = Main.dust[num791];
28439 dust2.scale += 0.5f;
28440 }
28441 else
28442 {
28443 Main.dust[num791].velocity = vector96 * (0f - num789);
28444 }
28445 }
28446 }
28447 this.ai[0]++;
28448 if (this.ai[0] >= 60f)
28449 {
28450 int num792 = (int)(this.ai[0] - 0f) / 60;
28451 float num793 = scale * 0.4f;
28452 for (int num794 = 0; num794 < 1; num794++)
28453 {
28454 float num795 = Main.rand.Next(1, 3);
28455 Vector2 vector97 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
28456 vector97.Normalize();
28457 int num796 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 228, 0f, 0f, 100, default(Color), 2f);
28458 Main.dust[num796].noGravity = true;
28459 Main.dust[num796].noLight = true;
28460 Main.dust[num796].position = base.Center;
28461 if (Main.rand.Next(2) == 0)
28462 {
28463 Main.dust[num796].velocity = vector97 * num795 * 2f;
28464 Dust dust2 = Main.dust[num796];
28465 dust2.scale += 0.5f;
28466 }
28467 else
28468 {
28469 Main.dust[num796].velocity = vector97 * num795;
28470 }
28471 Main.dust[num796].fadeIn = 2f;
28472 }
28473 }
28474 if (this.ai[0] == 300f && this.ai[1] != -1f && Main.netMode != 1)
28475 {
28476 if (!NPC.AnyNPCs(454))
28477 {
28478 this.ai[1] = NPC.NewNPC(GetNPCSource_FromThis(), (int)base.Center.X, (int)base.Center.Y, 454);
28479 }
28480 else
28481 {
28482 this.ai[1] = NPC.NewNPC(GetNPCSource_FromThis(), (int)base.Center.X, (int)base.Center.Y, 521);
28483 }
28484 }
28485 else if (this.ai[0] == 320f)
28486 {
28487 Kill();
28488 return;
28489 }
28490 bool flag39 = false;
28491 if (this.ai[1] == -1f)
28492 {
28493 if (alpha == 255)
28494 {
28495 flag39 = true;
28496 }
28497 }
28498 else
28499 {
28500 flag39 = !(this.ai[1] >= 0f) || !Main.npc[(int)this.ai[1]].active;
28501 if ((flag39 || Main.npc[(int)this.ai[1]].type != 439) && (flag39 || Main.npc[(int)this.ai[1]].type != 454) && (flag39 || Main.npc[(int)this.ai[1]].type != 521))
28502 {
28503 flag39 = true;
28504 }
28505 }
28506 if (flag39)
28507 {
28508 Kill();
28509 }
28510 else
28511 {
28512 Lighting.AddLight(base.Center, 1.1f, 0.9f, 0.4f);
28513 }
28514 }
28515 else if (aiStyle == 90)
28516 {
28517 if (Main.player[owner].dead)
28518 {
28519 Kill();
28520 }
28521 if (Main.player[owner].magicLantern)
28522 {
28523 timeLeft = 2;
28524 }
28525 if (tileCollide)
28526 {
28527 if (!Collision.CanHit(base.position, width, height, Main.player[owner].Center, 1, 1))
28528 {
28529 tileCollide = false;
28530 }
28531 else if (!Collision.SolidCollision(base.position, width, height) && Collision.CanHitLine(base.position, width, height, Main.player[owner].Center, 1, 1))
28532 {
28533 tileCollide = true;
28534 }
28535 }
28536 direction = Main.player[owner].direction;
28538 Lighting.AddLight(base.position, 0.35f, 0.35f, 0.1f);
28539 localAI[0] += 1f;
28540 if (localAI[0] >= 10f)
28541 {
28542 localAI[0] = 0f;
28543 int num797 = 17;
28544 if ((base.Center - Main.player[Main.myPlayer].Center).Length() < (float)(Main.screenWidth + num797 * 16))
28545 {
28546 int num798 = (int)base.Center.X / 16;
28547 int num799 = (int)base.Center.Y / 16;
28548 for (int num800 = num798 - num797; num800 <= num798 + num797; num800++)
28549 {
28550 for (int num801 = num799 - num797; num801 <= num799 + num797; num801++)
28551 {
28552 if (Main.rand.Next(4) == 0 && new Vector2(num798 - num800, num799 - num801).Length() < (float)num797 && num800 > 0 && num800 < Main.maxTilesX - 1 && num801 > 0 && num801 < Main.maxTilesY - 1 && Main.tile[num800, num801] != null && Main.tile[num800, num801].active() && Main.IsTileSpelunkable(Main.tile[num800, num801]))
28553 {
28554 int num802 = Dust.NewDust(new Vector2(num800 * 16, num801 * 16), 16, 16, 204, 0f, 0f, 150, default(Color), 0.3f);
28555 Main.dust[num802].fadeIn = 0.75f;
28556 Dust dust2 = Main.dust[num802];
28557 dust2.velocity *= 0.1f;
28558 Main.dust[num802].noLight = true;
28559 }
28560 }
28561 }
28562 }
28563 }
28564 Vector2 vector98 = Main.player[owner].Center - base.Center;
28565 vector98.X += 40 * direction;
28566 vector98.Y -= 40f;
28567 float num803 = vector98.Length();
28568 if (num803 > 1000f)
28569 {
28570 base.Center = Main.player[owner].Center;
28571 }
28572 float num804 = 3f;
28573 float num805 = 4f;
28574 if (num803 > 200f)
28575 {
28576 num805 += (num803 - 200f) * 0.1f;
28577 tileCollide = false;
28578 }
28579 if (num803 < num805)
28580 {
28581 velocity *= 0.25f;
28582 num805 = num803;
28583 }
28584 if (vector98.X != 0f || vector98.Y != 0f)
28585 {
28586 vector98.Normalize();
28587 vector98 *= num805;
28588 }
28589 velocity = (velocity * (num804 - 1f) + vector98) / num804;
28590 if (velocity.Length() > 6f)
28591 {
28592 float num806 = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
28593 if ((double)Math.Abs(rotation - num806) >= 3.14)
28594 {
28595 if (num806 < rotation)
28596 {
28597 rotation -= 6.28f;
28598 }
28599 else
28600 {
28601 rotation += 6.28f;
28602 }
28603 }
28604 rotation = (rotation * 4f + num806) / 5f;
28605 frameCounter++;
28606 if (frameCounter > 4)
28607 {
28608 frameCounter = 0;
28609 frame++;
28610 if (frame > 7)
28611 {
28612 frame = 4;
28613 }
28614 }
28615 if (frame < 4)
28616 {
28617 frame = 7;
28618 }
28619 return;
28620 }
28621 if ((double)rotation > 3.14)
28622 {
28623 rotation -= 6.28f;
28624 }
28625 if ((double)rotation > -0.01 && (double)rotation < 0.01)
28626 {
28627 rotation = 0f;
28628 }
28629 else
28630 {
28631 rotation *= 0.9f;
28632 }
28633 frameCounter++;
28634 if (frameCounter > 6)
28635 {
28636 frameCounter = 0;
28637 frame++;
28638 if (frame > 3)
28639 {
28640 frame = 0;
28641 }
28642 }
28643 }
28644 else if (aiStyle == 91)
28645 {
28646 Vector2 center15 = base.Center;
28647 scale = 1f - localAI[0];
28648 width = (int)(20f * scale);
28649 height = width;
28650 base.position.X = center15.X - (float)(width / 2);
28651 base.position.Y = center15.Y - (float)(height / 2);
28652 if ((double)localAI[0] < 0.1)
28653 {
28654 localAI[0] += 0.01f;
28655 }
28656 else
28657 {
28658 localAI[0] += 0.025f;
28659 }
28660 if (localAI[0] >= 0.95f)
28661 {
28662 Kill();
28663 }
28664 velocity.X += this.ai[0] * 1.5f;
28665 velocity.Y += this.ai[1] * 1.5f;
28666 if (velocity.Length() > 16f)
28667 {
28669 velocity *= 16f;
28670 }
28671 this.ai[0] *= 1.05f;
28672 this.ai[1] *= 1.05f;
28673 if (scale < 1f)
28674 {
28675 for (int num807 = 0; (float)num807 < scale * 10f; num807++)
28676 {
28677 int num808 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 27, velocity.X, velocity.Y, 100, default(Color), 1.1f);
28678 Main.dust[num808].position = (Main.dust[num808].position + base.Center) / 2f;
28679 Main.dust[num808].noGravity = true;
28680 Dust dust2 = Main.dust[num808];
28681 dust2.velocity *= 0.1f;
28682 dust2 = Main.dust[num808];
28683 dust2.velocity -= velocity * (1.3f - scale);
28684 Main.dust[num808].fadeIn = 100 + owner;
28685 dust2 = Main.dust[num808];
28686 dust2.scale += scale * 0.75f;
28687 }
28688 }
28689 }
28690 else if (aiStyle == 92)
28691 {
28692 bool flag40 = type == 1007;
28693 bool flag41 = type >= 511 && type <= 513;
28694 tileCollide = false;
28695 if (Main.netMode != 1 && flag40 && localAI[0] == 0f)
28696 {
28697 if (direction == 0)
28698 {
28699 direction = 1;
28700 }
28702 {
28703 PositionInWorld = base.Center,
28704 MovementVector = Vector2.Zero
28705 });
28706 }
28707 this.ai[0] += 1f;
28708 if (this.ai[1] >= 1f)
28709 {
28710 this.ai[0] += 2f;
28711 }
28712 float num809 = 260f;
28713 if (flag40)
28714 {
28715 num809 = 80f;
28716 }
28717 if (this.ai[0] > num809)
28718 {
28719 Kill();
28720 this.ai[0] = num809;
28721 return;
28722 }
28723 float fromValue = this.ai[0] / num809;
28724 if (flag40)
28725 {
28726 scale = Utils.Remap(fromValue, 0f, 0.95f, 1f, 6f);
28727 Vector2 center16 = base.Center;
28728 width = (int)(50f * scale);
28729 height = (int)(50f * scale);
28730 base.Center = center16;
28731 Opacity = MathHelper.Clamp(Utils.Remap(fromValue, 0f, 0.25f, 0f, 1f) * Utils.Remap(fromValue, 0.75f, 1f, 1f, 0f), 0f, 1f) * 0.85f;
28732 }
28733 else
28734 {
28735 Opacity = Utils.Remap(fromValue, 0f, 0.3f, 0f, 1f) * Utils.Remap(fromValue, 0.3f, 1f, 1f, 0f) * 0.7f;
28736 }
28737 localAI[0] += direction;
28738 rotation = (float)whoAmI * 0.4002029f + localAI[0] * ((float)Math.PI * 2f) / 480f;
28739 if (flag40)
28740 {
28742 }
28743 else
28744 {
28745 velocity *= 0.96f;
28746 }
28747 if (flag41)
28748 {
28749 Rectangle rectangle5 = new Rectangle((int)base.position.X, (int)base.position.Y, width, height);
28750 for (int num810 = 0; num810 < 1000; num810++)
28751 {
28752 if (num810 == whoAmI)
28753 {
28754 continue;
28755 }
28756 Projectile projectile3 = Main.projectile[num810];
28757 if (!projectile3.active || projectile3.type < 511 || projectile3.type > 513)
28758 {
28759 continue;
28760 }
28761 Rectangle value11 = new Rectangle((int)projectile3.position.X, (int)projectile3.position.Y, projectile3.width, projectile3.height);
28762 if (!rectangle5.Intersects(value11))
28763 {
28764 continue;
28765 }
28766 Vector2 vector99 = projectile3.Center - base.Center;
28767 if (vector99 == Vector2.Zero)
28768 {
28769 if (num810 < whoAmI)
28770 {
28771 vector99.X = -1f;
28772 vector99.Y = 1f;
28773 }
28774 else
28775 {
28776 vector99.X = 1f;
28777 vector99.Y = -1f;
28778 }
28779 }
28780 Vector2 vector100 = vector99.SafeNormalize(Vector2.UnitX) * 0.005f;
28782 projectile3.velocity = Vector2.Lerp(projectile3.velocity, projectile3.velocity + vector100, 0.6f);
28783 }
28784 }
28785 Vector2 vector101 = velocity.SafeNormalize(Vector2.Zero);
28786 Vector2 pos = base.Center + vector101 * 16f;
28787 if (!flag40 && Collision.IsWorldPointSolid(pos, treatPlatformsAsNonSolid: true))
28788 {
28790 }
28791 if (!flag40)
28792 {
28793 return;
28794 }
28795 int num811 = 20;
28796 int num812 = 2940;
28797 float num813 = MathHelper.Clamp(Utils.Remap(fromValue, 0f, 0.2f, 0f, 1f), 0f, 1f) * 180f;
28798 if (localAI[1] > 0f)
28799 {
28800 localAI[1]--;
28801 }
28802 if (!(localAI[1] <= 0f))
28803 {
28804 return;
28805 }
28806 localAI[1] = 15f;
28807 if (Main.netMode != 2)
28808 {
28809 Player localPlayer = Main.LocalPlayer;
28810 if (localPlayer.active && !localPlayer.DeadOrGhost && localPlayer.Center.Distance(base.Center) <= num813)
28811 {
28812 localPlayer.AddBuff(num811, num812);
28813 }
28814 }
28815 if (Main.netMode == 1)
28816 {
28817 return;
28818 }
28819 for (int num814 = 0; num814 < 200; num814++)
28820 {
28821 NPC nPC12 = Main.npc[num814];
28822 if (nPC12.active && !nPC12.buffImmune[num811] && nPC12.Center.Distance(base.Center) <= num813)
28823 {
28824 nPC12.AddBuff(num811, num812);
28825 }
28826 }
28827 }
28828 else if (aiStyle == 93)
28829 {
28830 if (alpha > 0)
28831 {
28832 alpha -= 25;
28833 if (alpha <= 0)
28834 {
28835 alpha = 0;
28836 }
28837 }
28838 if (velocity.Y > 18f)
28839 {
28840 velocity.Y = 18f;
28841 }
28842 if (this.ai[0] == 0f)
28843 {
28844 this.ai[1] += 1f;
28845 if (this.ai[1] > 20f)
28846 {
28847 velocity.Y += 0.1f;
28848 velocity.X *= 0.992f;
28849 }
28850 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
28851 return;
28852 }
28853 tileCollide = false;
28854 if (this.ai[0] == 1f)
28855 {
28856 tileCollide = false;
28857 velocity *= 0.6f;
28858 }
28859 else
28860 {
28861 tileCollide = false;
28862 int num815 = (int)(0f - this.ai[0]);
28863 num815--;
28864 base.position = Main.npc[num815].Center - velocity;
28865 base.position.X -= width / 2;
28866 base.position.Y -= height / 2;
28867 if (!Main.npc[num815].active || Main.npc[num815].life < 0)
28868 {
28869 tileCollide = true;
28870 this.ai[0] = 0f;
28871 this.ai[1] = 20f;
28872 velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
28874 velocity *= 6f;
28875 netUpdate = true;
28876 }
28877 else if (velocity.Length() > (float)((Main.npc[num815].width + Main.npc[num815].height) / 3))
28878 {
28879 velocity *= 0.99f;
28880 }
28881 }
28882 if (this.ai[0] != 0f)
28883 {
28884 this.ai[1] += 1f;
28885 if (this.ai[1] > 90f)
28886 {
28887 Kill();
28888 }
28889 }
28890 }
28891 else if (aiStyle == 94)
28892 {
28893 if (++frameCounter >= 4)
28894 {
28895 frameCounter = 0;
28896 if (++frame >= Main.projFrames[type])
28897 {
28898 frame = 0;
28899 }
28900 }
28901 this.ai[0]++;
28902 if (this.ai[0] <= 40f)
28903 {
28904 alpha -= 5;
28905 if (alpha < 0)
28906 {
28907 alpha = 0;
28908 }
28909 velocity *= 0.85f;
28910 if (this.ai[0] == 40f)
28911 {
28912 netUpdate = true;
28913 switch (Main.rand.Next(3))
28914 {
28915 case 0:
28916 this.ai[1] = 10f;
28917 break;
28918 case 1:
28919 this.ai[1] = 15f;
28920 break;
28921 case 2:
28922 this.ai[1] = 30f;
28923 break;
28924 }
28925 }
28926 }
28927 else if (this.ai[0] <= 60f)
28928 {
28930 if (this.ai[0] == 60f)
28931 {
28932 netUpdate = true;
28933 }
28934 }
28935 else if (this.ai[0] <= 210f)
28936 {
28937 if (Main.netMode != 1 && (localAI[0] += 1f) >= this.ai[1])
28938 {
28939 localAI[0] = 0f;
28940 int num816 = Item.NewItem(GetItemSource_FromThis(), (int)base.Center.X, (int)base.Center.Y, 0, 0, 73);
28941 Main.item[num816].velocity = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * new Vector2(3f, 2f) * (Main.rand.NextFloat() * 0.5f + 0.5f) - Vector2.UnitY * 1f;
28942 }
28943 if (this.ai[0] == 210f)
28944 {
28945 netUpdate = true;
28946 }
28947 }
28948 else
28949 {
28950 scale -= 1f / 30f;
28951 alpha += 15;
28952 if (this.ai[0] == 239f)
28953 {
28954 netUpdate = true;
28955 }
28956 if (this.ai[0] == 240f)
28957 {
28958 Kill();
28959 }
28960 }
28961 if (alpha < 90 && Main.rand.Next(3) == 0)
28962 {
28963 Vector2 vector102 = new Vector2(width, height) * scale * 0.85f;
28964 vector102 /= 2f;
28965 Vector2 vector103 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * vector102;
28966 int num817 = Dust.NewDust(base.Center + vector103, 0, 0, 246);
28967 Main.dust[num817].position = base.Center + vector103;
28968 Main.dust[num817].velocity = Vector2.Zero;
28969 }
28970 float num818 = 0.8f;
28971 float num819 = 0.70980394f;
28972 float num820 = 24f / 85f;
28973 Lighting.AddLight(base.Center, num818 * 0.3f, num819 * 0.3f, num820 * 0.3f);
28974 }
28975 else if (aiStyle == 95)
28976 {
28977 if (localAI[0] > 2f)
28978 {
28979 alpha -= 20;
28980 if (alpha < 100)
28981 {
28982 alpha = 100;
28983 }
28984 }
28985 else
28986 {
28987 localAI[0] += 1f;
28988 }
28989 if (this.ai[0] > 30f)
28990 {
28991 if (velocity.Y > -8f)
28992 {
28993 velocity.Y -= 0.05f;
28994 }
28995 velocity.X *= 0.98f;
28996 }
28997 else
28998 {
28999 this.ai[0] += 1f;
29000 }
29001 rotation = velocity.X * 0.1f;
29002 if (wet)
29003 {
29004 if (velocity.Y > 0f)
29005 {
29006 velocity.Y *= 0.98f;
29007 }
29008 if (velocity.Y > -8f)
29009 {
29010 velocity.Y -= 0.2f;
29011 }
29012 velocity.X *= 0.94f;
29013 }
29014 }
29015 else if (aiStyle == 96)
29016 {
29017 this.ai[0] += 0.6f;
29018 if (this.ai[0] > 500f)
29019 {
29020 Kill();
29021 }
29022 for (int num821 = 0; num821 < 2; num821++)
29023 {
29024 if (Main.rand.Next(3) != 0)
29025 {
29026 int num822 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 170, 0f, 0f, 100);
29027 Main.dust[num822].position = (Main.dust[num822].position + base.Center) / 2f;
29028 Main.dust[num822].noGravity = true;
29029 Dust dust2 = Main.dust[num822];
29030 dust2.velocity *= 0.1f;
29031 if (num821 == 1)
29032 {
29033 dust2 = Main.dust[num822];
29034 dust2.position += velocity / 2f;
29035 }
29036 float num823 = (800f - this.ai[0]) / 800f;
29037 dust2 = Main.dust[num822];
29038 dust2.scale *= num823 + 0.1f;
29039 }
29040 }
29041 velocity.Y += 0.008f;
29042 }
29043 else if (aiStyle == 97)
29044 {
29045 frameCounter++;
29046 float num824 = 4f;
29047 if ((float)frameCounter < num824 * 1f)
29048 {
29049 frame = 0;
29050 }
29051 else if ((float)frameCounter < num824 * 2f)
29052 {
29053 frame = 1;
29054 }
29055 else if ((float)frameCounter < num824 * 3f)
29056 {
29057 frame = 2;
29058 }
29059 else if ((float)frameCounter < num824 * 4f)
29060 {
29061 frame = 3;
29062 }
29063 else if ((float)frameCounter < num824 * 5f)
29064 {
29065 frame = 4;
29066 }
29067 else if ((float)frameCounter < num824 * 6f)
29068 {
29069 frame = 3;
29070 }
29071 else if ((float)frameCounter < num824 * 7f)
29072 {
29073 frame = 2;
29074 }
29075 else if ((float)frameCounter < num824 * 8f)
29076 {
29077 frame = 1;
29078 }
29079 else
29080 {
29081 frameCounter = 0;
29082 frame = 0;
29083 }
29084 Main.CurrentFrameFlags.HadAnActiveInteractibleProjectile = true;
29085 if (owner == Main.myPlayer)
29086 {
29087 for (int num825 = 0; num825 < 1000; num825++)
29088 {
29089 if (num825 != whoAmI && Main.projectile[num825].active && Main.projectile[num825].owner == owner && Main.projectile[num825].type == type)
29090 {
29091 if (timeLeft >= Main.projectile[num825].timeLeft)
29092 {
29093 Main.projectile[num825].Kill();
29094 }
29095 else
29096 {
29097 Kill();
29098 }
29099 }
29100 }
29101 }
29102 if (this.ai[0] == 0f)
29103 {
29104 if ((double)velocity.Length() < 0.1)
29105 {
29106 velocity.X = 0f;
29107 velocity.Y = 0f;
29108 this.ai[0] = 1f;
29109 this.ai[1] = 45f;
29110 return;
29111 }
29112 velocity *= 0.94f;
29113 if (velocity.X < 0f)
29114 {
29115 direction = -1;
29116 }
29117 else
29118 {
29119 direction = 1;
29120 }
29122 return;
29123 }
29124 if (Main.player[owner].Center.X < base.Center.X)
29125 {
29126 direction = -1;
29127 }
29128 else
29129 {
29130 direction = 1;
29131 }
29133 this.ai[1] += 1f;
29134 float num826 = 0.005f;
29135 if (this.ai[1] > 0f)
29136 {
29137 velocity.Y -= num826;
29138 }
29139 else
29140 {
29141 velocity.Y += num826;
29142 }
29143 if (this.ai[1] >= 90f)
29144 {
29145 this.ai[1] *= -1f;
29146 }
29147 }
29148 else if (aiStyle == 98)
29149 {
29150 Vector2 vector104 = new Vector2(this.ai[0], this.ai[1]);
29151 Vector2 value12 = vector104 - base.Center;
29152 if (value12.Length() < velocity.Length())
29153 {
29154 Kill();
29155 return;
29156 }
29157 value12.Normalize();
29158 value12 *= 15f;
29160 for (int num827 = 0; num827 < 2; num827++)
29161 {
29162 int num828 = Dust.NewDust(base.Center, 0, 0, 228, 0f, 0f, 100);
29163 Main.dust[num828].noGravity = true;
29164 Dust dust2 = Main.dust[num828];
29165 dust2.position += new Vector2(4f);
29166 dust2 = Main.dust[num828];
29167 dust2.scale += Main.rand.NextFloat() * 1f;
29168 }
29169 }
29170 else if (aiStyle == 99 && type >= 556 && type <= 561)
29171 {
29172 AI_099_1();
29173 }
29174 else if (aiStyle == 99)
29175 {
29176 AI_099_2();
29177 }
29178 else if (aiStyle == 100)
29179 {
29180 AI_100_Medusa();
29181 }
29182 else if (aiStyle == 101)
29183 {
29184 float num829 = 20f;
29185 localAI[0]++;
29186 alpha = (int)MathHelper.Lerp(0f, 255f, localAI[0] / num829);
29187 int num830 = (int)this.ai[0];
29188 int num831 = -1;
29189 int num832 = -1;
29190 switch (type)
29191 {
29192 case 536:
29193 num831 = 535;
29194 num832 = 0;
29195 break;
29196 case 591:
29197 num832 = 1;
29198 break;
29199 }
29200 switch (num832)
29201 {
29202 case 1:
29203 if (localAI[0] >= num829 || num830 < 0 || num830 > 255 || !Main.player[num830].active || Main.player[num830].dead)
29204 {
29205 Kill();
29206 return;
29207 }
29208 if (type == 591)
29209 {
29210 base.position -= velocity;
29211 base.position += Main.player[owner].position - Main.player[owner].oldPosition;
29212 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
29213 if (Math.Sign(velocity.X) != Math.Sign(Main.player[num830].velocity.X) && Main.player[num830].velocity.X != 0f)
29214 {
29215 Kill();
29216 return;
29217 }
29218 }
29219 else
29220 {
29221 base.Center = Main.player[num830].Center - velocity;
29222 }
29223 break;
29224 case 0:
29225 if (localAI[0] >= num829 || num830 < 0 || num830 > 1000 || !Main.projectile[num830].active || Main.projectile[num830].type != num831)
29226 {
29227 Kill();
29228 return;
29229 }
29230 base.Center = Main.projectile[num830].Center - velocity;
29231 break;
29232 }
29233 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
29234 }
29235 else if (aiStyle == 102)
29236 {
29237 int num833 = 0;
29238 float num834 = 0f;
29239 float x6 = 0f;
29240 float y5 = 0f;
29241 int num835 = -1;
29242 int num836 = 0;
29243 float num837 = 0f;
29244 bool flag42 = true;
29245 bool flag43 = false;
29246 bool flag44 = false;
29247 switch (type)
29248 {
29249 case 539:
29250 num833 = 407;
29251 num834 = 210f;
29252 x6 = 0.15f;
29253 y5 = 0.075f;
29254 num837 = 16f;
29255 break;
29256 case 573:
29257 num833 = 424;
29258 num834 = 90f;
29259 num837 = 20f;
29260 flag42 = false;
29261 flag43 = true;
29262 break;
29263 case 574:
29264 num833 = 420;
29265 num834 = 180f;
29266 x6 = 0.15f;
29267 y5 = 0.075f;
29268 num837 = 8f;
29269 flag42 = false;
29270 num835 = 576;
29271 num836 = 65;
29272 if (Main.expertMode)
29273 {
29274 num836 = 50;
29275 }
29276 flag44 = true;
29277 break;
29278 }
29279 if (flag44)
29280 {
29281 int num838 = (int)this.ai[1];
29282 if (!Main.npc[num838].active || Main.npc[num838].type != num833)
29283 {
29284 Kill();
29285 return;
29286 }
29287 timeLeft = 2;
29288 }
29289 this.ai[0]++;
29290 if (this.ai[0] < num834)
29291 {
29292 bool flag45 = true;
29293 int num839 = (int)this.ai[1];
29294 if (Main.npc[num839].active && Main.npc[num839].type == num833)
29295 {
29296 if (!flag43 && Main.npc[num839].oldPos[1] != Vector2.Zero)
29297 {
29298 base.position += Main.npc[num839].position - Main.npc[num839].oldPos[1];
29299 }
29300 }
29301 else
29302 {
29303 this.ai[0] = num834;
29304 flag45 = false;
29305 }
29306 if (flag45 && !flag43)
29307 {
29308 velocity += new Vector2(Math.Sign(Main.npc[num839].Center.X - base.Center.X), Math.Sign(Main.npc[num839].Center.Y - base.Center.Y)) * new Vector2(x6, y5);
29309 if (velocity.Length() > 6f)
29310 {
29311 velocity *= 6f / velocity.Length();
29312 }
29313 }
29314 if (type == 539)
29315 {
29316 if (Main.rand.Next(12) == 0)
29317 {
29318 int num840 = Dust.NewDust(base.Center, 8, 8, 180);
29319 Main.dust[num840].position = base.Center;
29320 Dust dust2 = Main.dust[num840];
29321 dust2.velocity *= 0.2f;
29322 Main.dust[num840].noGravity = true;
29323 }
29324 if (++frameCounter >= 4)
29325 {
29326 frameCounter = 0;
29327 if (++frame >= Main.projFrames[type])
29328 {
29329 frame = 0;
29330 }
29331 }
29332 rotation = velocity.X * 0.1f;
29333 }
29334 if (type == 573)
29335 {
29336 if (Main.rand.Next(2) == 0)
29337 {
29338 int num841 = Dust.NewDust(base.Center, 8, 8, 242);
29339 Main.dust[num841].position = base.Center;
29340 Main.dust[num841].velocity = velocity;
29341 Main.dust[num841].noGravity = true;
29342 Main.dust[num841].scale = 1.5f;
29343 }
29344 alpha = 255;
29345 }
29346 if (type == 574)
29347 {
29348 if (Main.rand.Next(10) == 0)
29349 {
29350 int num842 = Dust.NewDust(base.Center, 8, 8, 242);
29351 Main.dust[num842].position = base.Center;
29352 Main.dust[num842].velocity = velocity;
29353 Main.dust[num842].noGravity = true;
29354 Main.dust[num842].scale = 1.5f;
29355 }
29356 if (flag45)
29357 {
29358 int target2 = Main.npc[num839].target;
29359 float num843 = velocity.ToRotation();
29360 if (Collision.CanHitLine(base.Center, 0, 0, Main.player[target2].Center, 0, 0))
29361 {
29362 num843 = DirectionTo(Main.player[target2].Center).ToRotation();
29363 }
29364 rotation = rotation.AngleLerp(num843 + (float)Math.PI / 2f, 0.2f);
29365 }
29366 frame = 1;
29367 }
29368 }
29369 if (this.ai[0] == num834)
29370 {
29371 bool flag46 = true;
29372 int num844 = -1;
29373 if (!flag42)
29374 {
29375 int num845 = (int)this.ai[1];
29376 if (Main.npc[num845].active && Main.npc[num845].type == num833)
29377 {
29378 num844 = Main.npc[num845].target;
29379 }
29380 else
29381 {
29382 flag46 = false;
29383 }
29384 }
29385 else
29386 {
29387 flag46 = false;
29388 }
29389 if (!flag46)
29390 {
29391 num844 = Player.FindClosest(base.position, width, height);
29392 }
29393 Vector2 value13 = Main.player[num844].Center - base.Center;
29394 value13.X += Main.rand.Next(-50, 51);
29395 value13.Y += Main.rand.Next(-50, 51);
29396 value13.X *= (float)Main.rand.Next(80, 121) * 0.01f;
29397 value13.Y *= (float)Main.rand.Next(80, 121) * 0.01f;
29399 if (vector105.HasNaNs())
29400 {
29402 }
29403 if (num835 == -1)
29404 {
29406 netUpdate = true;
29407 }
29408 else
29409 {
29410 if (Main.netMode != 1 && Collision.CanHitLine(base.Center, 0, 0, Main.player[num844].Center, 0, 0))
29411 {
29412 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector105.X * num837, vector105.Y * num837, num835, num836, 1f, Main.myPlayer);
29413 }
29414 this.ai[0] = 0f;
29415 }
29416 }
29417 if (!(this.ai[0] >= num834))
29418 {
29419 return;
29420 }
29421 rotation = rotation.AngleLerp(velocity.ToRotation() + (float)Math.PI / 2f, 0.4f);
29422 if (type == 539)
29423 {
29424 if (++frameCounter >= 2)
29425 {
29426 frameCounter = 0;
29427 if (++frame >= Main.projFrames[type])
29428 {
29429 frame = 0;
29430 }
29431 }
29432 if (Main.rand.Next(2) == 0)
29433 {
29434 int num846 = Dust.NewDust(base.position, width, height, 180, 0f, 0f, 100);
29435 Dust dust2 = Main.dust[num846];
29436 dust2.scale += (float)Main.rand.Next(50) * 0.01f;
29437 Main.dust[num846].noGravity = true;
29438 dust2 = Main.dust[num846];
29439 dust2.velocity *= 0.1f;
29440 Main.dust[num846].fadeIn = Main.rand.NextFloat() * 1.5f;
29441 }
29442 if (Main.rand.Next(3) == 0)
29443 {
29444 int num847 = Dust.NewDust(base.position, width, height, 176, 0f, 0f, 100);
29445 Dust dust2 = Main.dust[num847];
29446 dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f;
29447 Main.dust[num847].noGravity = true;
29448 dust2 = Main.dust[num847];
29449 dust2.velocity *= 0.1f;
29450 Main.dust[num847].fadeIn = Main.rand.NextFloat() * 1.5f;
29451 }
29452 }
29453 if (type == 573)
29454 {
29455 if (Main.rand.Next(4) == 0)
29456 {
29457 int num848 = Dust.NewDust(base.Center, 8, 8, 242);
29458 Main.dust[num848].position = base.Center;
29459 Dust dust2 = Main.dust[num848];
29460 dust2.velocity *= 0.2f;
29461 Main.dust[num848].noGravity = true;
29462 Main.dust[num848].scale = 1.5f;
29463 }
29464 alpha = 0;
29465 }
29466 }
29467 else if (aiStyle == 103)
29468 {
29469 scale = this.ai[1];
29470 this.ai[0]++;
29471 if (this.ai[0] >= 30f)
29472 {
29473 alpha += 25;
29474 if (alpha >= 250)
29475 {
29476 Kill();
29477 }
29478 }
29479 else
29480 {
29481 if (!(this.ai[0] >= 0f))
29482 {
29483 return;
29484 }
29485 alpha -= 25;
29486 if (alpha < 0)
29487 {
29488 alpha = 0;
29489 if (localAI[1] == 0f && Main.netMode != 1 && localAI[0] != 0f)
29490 {
29491 localAI[1] = 1f;
29492 NPC.NewNPC(GetNPCSource_FromThis(), (int)base.Center.X, (int)base.Bottom.Y, (int)localAI[0]);
29493 }
29494 }
29495 }
29496 }
29497 else if (aiStyle == 104)
29498 {
29499 if (this.ai[0] == 1f)
29500 {
29501 scale *= 0.995f;
29502 alpha += 3;
29503 if (alpha >= 250)
29504 {
29505 Kill();
29506 }
29507 }
29508 else
29509 {
29510 scale *= 1.01f;
29511 alpha -= 7;
29512 if (alpha < 0)
29513 {
29514 alpha = 0;
29515 this.ai[0] = 1f;
29516 }
29517 }
29518 frameCounter++;
29519 if (frameCounter > 6)
29520 {
29521 frameCounter = 0;
29522 frame++;
29523 if (frame > 3)
29524 {
29525 frame = 0;
29526 }
29527 }
29528 velocity.Y -= 0.03f;
29529 velocity.X *= 0.97f;
29530 }
29531 else if (aiStyle == 105)
29532 {
29533 float num849 = 1f - (float)alpha / 255f;
29534 num849 *= scale;
29535 Lighting.AddLight(base.Center, 0.2f * num849, 0.275f * num849, 0.075f * num849);
29536 localAI[0] += 1f;
29537 if (localAI[0] >= 90f)
29538 {
29539 localAI[0] *= -1f;
29540 }
29541 if (localAI[0] >= 0f)
29542 {
29543 scale += 0.003f;
29544 }
29545 else
29546 {
29547 scale -= 0.003f;
29548 }
29549 rotation += 0.0025f * scale;
29550 float num850 = 1f;
29551 float num851 = 1f;
29552 if (identity % 6 == 0)
29553 {
29554 num851 *= -1f;
29555 }
29556 if (identity % 6 == 1)
29557 {
29558 num850 *= -1f;
29559 }
29560 if (identity % 6 == 2)
29561 {
29562 num851 *= -1f;
29563 num850 *= -1f;
29564 }
29565 if (identity % 6 == 3)
29566 {
29567 num851 = 0f;
29568 }
29569 if (identity % 6 == 4)
29570 {
29571 num850 = 0f;
29572 }
29573 localAI[1] += 1f;
29574 if (localAI[1] > 60f)
29575 {
29576 localAI[1] = -180f;
29577 }
29578 if (localAI[1] >= -60f)
29579 {
29580 velocity.X += 0.002f * num851;
29581 velocity.Y += 0.002f * num850;
29582 }
29583 else
29584 {
29585 velocity.X -= 0.002f * num851;
29586 velocity.Y -= 0.002f * num850;
29587 }
29588 this.ai[0] += 1f;
29589 if (this.ai[0] > 5400f)
29590 {
29591 damage = 0;
29592 this.ai[1] = 1f;
29593 if (alpha < 255)
29594 {
29595 alpha += 5;
29596 if (alpha > 255)
29597 {
29598 alpha = 255;
29599 }
29600 }
29601 else if (owner == Main.myPlayer)
29602 {
29603 Kill();
29604 }
29605 }
29606 else
29607 {
29608 float num852 = (base.Center - Main.player[owner].Center).Length() / 100f;
29609 if (num852 > 4f)
29610 {
29611 num852 *= 1.1f;
29612 }
29613 if (num852 > 5f)
29614 {
29615 num852 *= 1.2f;
29616 }
29617 if (num852 > 6f)
29618 {
29619 num852 *= 1.3f;
29620 }
29621 if (num852 > 7f)
29622 {
29623 num852 *= 1.4f;
29624 }
29625 if (num852 > 8f)
29626 {
29627 num852 *= 1.5f;
29628 }
29629 if (num852 > 9f)
29630 {
29631 num852 *= 1.6f;
29632 }
29633 if (num852 > 10f)
29634 {
29635 num852 *= 1.7f;
29636 }
29637 if (!Main.player[owner].sporeSac)
29638 {
29639 num852 += 100f;
29640 }
29641 this.ai[0] += num852;
29642 if (alpha > 50)
29643 {
29644 alpha -= 10;
29645 if (alpha < 50)
29646 {
29647 alpha = 50;
29648 }
29649 }
29650 }
29651 bool flag47 = false;
29652 Vector2 vector106 = new Vector2(0f, 0f);
29653 float num853 = 340f;
29654 for (int num854 = 0; num854 < 200; num854++)
29655 {
29656 if (Main.npc[num854].CanBeChasedBy(this))
29657 {
29658 float num855 = Main.npc[num854].position.X + (float)(Main.npc[num854].width / 2);
29659 float num856 = Main.npc[num854].position.Y + (float)(Main.npc[num854].height / 2);
29660 float num857 = Math.Abs(base.position.X + (float)(width / 2) - num855) + Math.Abs(base.position.Y + (float)(height / 2) - num856);
29661 if (num857 < num853)
29662 {
29663 num853 = num857;
29664 vector106 = Main.npc[num854].Center;
29665 flag47 = true;
29666 }
29667 }
29668 }
29669 if (flag47)
29670 {
29671 Vector2 vector107 = vector106 - base.Center;
29672 vector107.Normalize();
29673 vector107 *= 4f;
29674 velocity = (velocity * 40f + vector107) / 41f;
29675 }
29676 else if ((double)velocity.Length() > 0.2)
29677 {
29678 velocity *= 0.98f;
29679 }
29680 }
29681 else if (aiStyle == 106)
29682 {
29683 rotation += velocity.X * 0.02f;
29684 if (velocity.X < 0f)
29685 {
29686 rotation -= Math.Abs(velocity.Y) * 0.02f;
29687 }
29688 else
29689 {
29690 rotation += Math.Abs(velocity.Y) * 0.02f;
29691 }
29692 velocity *= 0.98f;
29693 this.ai[0] += 1f;
29694 if (this.ai[0] >= 60f)
29695 {
29696 if (alpha < 255)
29697 {
29698 alpha += 5;
29699 if (alpha > 255)
29700 {
29701 alpha = 255;
29702 }
29703 }
29704 else if (owner == Main.myPlayer)
29705 {
29706 Kill();
29707 }
29708 }
29709 else if (alpha > 80)
29710 {
29711 alpha -= 30;
29712 if (alpha < 80)
29713 {
29714 alpha = 80;
29715 }
29716 }
29717 }
29718 else if (aiStyle == 107)
29719 {
29720 float num858 = 10f;
29721 float num859 = 5f;
29722 float num860 = 40f;
29723 if (type == 575)
29724 {
29725 if (timeLeft > 30 && alpha > 0)
29726 {
29727 alpha -= 25;
29728 }
29729 if (timeLeft > 30 && alpha < 128 && Collision.SolidCollision(base.position, width, height))
29730 {
29731 alpha = 128;
29732 }
29733 if (alpha < 0)
29734 {
29735 alpha = 0;
29736 }
29737 if (++frameCounter > 4)
29738 {
29739 frameCounter = 0;
29740 if (++frame >= 4)
29741 {
29742 frame = 0;
29743 }
29744 }
29745 Lighting.AddLight(base.Center, 0.5f, 0.1f, 0.3f);
29746 }
29747 else if (type == 596)
29748 {
29749 num858 = 10f;
29750 num859 = 7.5f;
29751 if (timeLeft > 30 && alpha > 0)
29752 {
29753 alpha -= 25;
29754 }
29755 if (timeLeft > 30 && alpha < 128 && Collision.SolidCollision(base.position, width, height))
29756 {
29757 alpha = 128;
29758 }
29759 if (alpha < 0)
29760 {
29761 alpha = 0;
29762 }
29763 if (++frameCounter > 4)
29764 {
29765 frameCounter = 0;
29766 if (++frame >= 4)
29767 {
29768 frame = 0;
29769 }
29770 }
29771 float num861 = 0.5f;
29772 if (timeLeft < 120)
29773 {
29774 num861 = 1.1f;
29775 }
29776 if (timeLeft < 60)
29777 {
29778 num861 = 1.6f;
29779 }
29780 this.ai[1]++;
29781 float num862 = this.ai[1] / 180f * ((float)Math.PI * 2f);
29782 for (float num863 = 0f; num863 < 3f; num863++)
29783 {
29784 if (Main.rand.Next(3) != 0)
29785 {
29786 return;
29787 }
29788 Dust dust22 = Main.dust[Dust.NewDust(base.Center, 0, 0, 27, 0f, -2f)];
29789 dust22.position = base.Center + Vector2.UnitY.RotatedBy(num863 * ((float)Math.PI * 2f) / 3f + this.ai[1]) * 10f;
29790 dust22.noGravity = true;
29791 dust22.velocity = DirectionFrom(dust22.position);
29792 dust22.scale = num861;
29793 dust22.fadeIn = 0.5f;
29794 dust22.alpha = 200;
29795 }
29796 if (timeLeft < 4)
29797 {
29798 int num864 = 30;
29799 if (Main.expertMode)
29800 {
29801 num864 = 22;
29802 }
29803 base.position = base.Center;
29804 width = (height = 60);
29805 base.Center = base.position;
29806 damage = num864;
29807 for (int num865 = 0; num865 < 10; num865++)
29808 {
29809 Dust dust22 = Main.dust[Dust.NewDust(base.position, width, height, Utils.SelectRandom<int>(Main.rand, 27, 6), 0f, -2f)];
29810 dust22.noGravity = true;
29811 if (dust22.position != base.Center)
29812 {
29813 dust22.velocity = DirectionTo(dust22.position) * 3f;
29814 }
29815 }
29816 }
29817 }
29818 int num866 = (int)this.ai[0];
29819 if (num866 >= 0 && Main.player[num866].active && !Main.player[num866].dead)
29820 {
29821 if (Distance(Main.player[num866].Center) > num860)
29822 {
29823 Vector2 vector108 = DirectionTo(Main.player[num866].Center);
29824 if (vector108.HasNaNs())
29825 {
29827 }
29828 velocity = (velocity * (num858 - 1f) + vector108 * num859) / num858;
29829 }
29830 }
29831 else
29832 {
29833 if (timeLeft > 30)
29834 {
29835 timeLeft = 30;
29836 }
29837 if (this.ai[0] != -1f)
29838 {
29839 this.ai[0] = -1f;
29840 netUpdate = true;
29841 }
29842 }
29843 }
29844 else if (aiStyle == 108)
29845 {
29846 bool flag48 = type == 579 || type == 578;
29847 if (flag48 && this.ai[1] == 1f && Main.netMode != 2)
29848 {
29849 this.ai[1] = 0f;
29850 for (int num867 = 0; num867 < 25; num867++)
29851 {
29852 int num868 = Utils.SelectRandom<int>(Main.rand, 229, 229, 161);
29853 Dust dust23 = Main.dust[Dust.NewDust(base.position, width, height, num868)];
29854 dust23.noGravity = true;
29855 dust23.scale = 1.75f + Main.rand.NextFloat() * 1.25f;
29856 dust23.fadeIn = 0.25f;
29857 Dust dust2 = dust23;
29858 dust2.velocity *= 3.5f + Main.rand.NextFloat() * 0.5f;
29859 dust23.noLight = true;
29860 }
29861 }
29862 if (flag48 && localAI[1] == 0f)
29863 {
29864 localAI[1] = 1f;
29866 }
29867 if (type == 578 && localAI[0] == 0f)
29868 {
29869 localAI[0] = 1f;
29870 int num869 = Player.FindClosest(base.Center, 0, 0);
29871 Vector2 vector109 = Main.player[num869].Center - base.Center;
29872 if (vector109 == Vector2.Zero)
29873 {
29875 }
29876 this.ai[1] = vector109.ToRotation();
29877 netUpdate = true;
29878 }
29879 this.ai[0]++;
29880 if (this.ai[0] <= 50f)
29881 {
29882 if (type == 579)
29883 {
29884 if (Main.rand.Next(4) == 0)
29885 {
29886 Vector2 vector110 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
29887 Dust dust24 = Main.dust[Dust.NewDust(base.Center - vector110 * 30f, 0, 0, 229)];
29888 dust24.noGravity = true;
29889 dust24.position = base.Center - vector110 * Main.rand.Next(10, 21);
29890 dust24.velocity = vector110.RotatedBy(1.5707963705062866) * 4f;
29891 dust24.scale = 0.5f + Main.rand.NextFloat();
29892 dust24.fadeIn = 0.5f;
29893 }
29894 if (Main.rand.Next(4) == 0)
29895 {
29896 Vector2 vector111 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
29897 Dust dust25 = Main.dust[Dust.NewDust(base.Center - vector111 * 30f, 0, 0, 240)];
29898 dust25.noGravity = true;
29899 dust25.position = base.Center - vector111 * 30f;
29900 dust25.velocity = vector111.RotatedBy(-1.5707963705062866) * 2f;
29901 dust25.scale = 0.5f + Main.rand.NextFloat();
29902 dust25.fadeIn = 0.5f;
29903 }
29904 }
29905 if (type == 578 && Main.rand.Next(2) == 0)
29906 {
29907 Vector2 vector112 = this.ai[1].ToRotationVector2();
29908 Vector2 vector113 = vector112.RotatedBy(1.5707963705062866) * (Main.rand.Next(2) == 0).ToDirectionInt() * Main.rand.Next(10, 21);
29909 Vector2 vector114 = vector112 * Main.rand.Next(-80, 81);
29911 vector115 /= 10f;
29912 int num870 = 229;
29913 Dust dust26 = Main.dust[Dust.NewDust(base.Center, 0, 0, num870)];
29914 dust26.noGravity = true;
29915 dust26.position = base.Center + vector113;
29916 dust26.velocity = vector115;
29917 dust26.scale = 0.5f + Main.rand.NextFloat();
29918 dust26.fadeIn = 0.5f;
29919 vector114 = vector112 * Main.rand.Next(40, 121);
29920 vector115 = vector114 - vector113 / 2f;
29921 vector115 /= 10f;
29922 dust26 = Main.dust[Dust.NewDust(base.Center, 0, 0, num870)];
29923 dust26.noGravity = true;
29924 dust26.position = base.Center + vector113 / 2f;
29925 dust26.velocity = vector115;
29926 dust26.scale = 1f + Main.rand.NextFloat();
29927 }
29928 if (type == 813)
29929 {
29930 if (Main.rand.Next(4) == 0)
29931 {
29932 Vector2 vector116 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
29933 Dust dust27 = Main.dust[Dust.NewDust(base.Center - vector116 * 30f, 0, 0, 5)];
29934 dust27.noGravity = true;
29935 dust27.position = base.Center - vector116 * Main.rand.Next(10, 21);
29936 dust27.velocity = vector116.RotatedBy(1.5707963705062866) * 4f;
29937 dust27.scale = 0.5f + Main.rand.NextFloat();
29938 dust27.fadeIn = 0.5f;
29939 }
29940 if (Main.rand.Next(4) == 0)
29941 {
29942 Vector2 vector117 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
29943 Dust dust28 = Main.dust[Dust.NewDust(base.Center - vector117 * 30f, 0, 0, 240)];
29944 dust28.noGravity = true;
29945 dust28.position = base.Center - vector117 * 30f;
29946 dust28.velocity = vector117.RotatedBy(-1.5707963705062866) * 2f;
29947 dust28.scale = 0.5f + Main.rand.NextFloat();
29948 dust28.fadeIn = 0.5f;
29949 }
29950 }
29951 }
29952 else if (this.ai[0] <= 90f)
29953 {
29954 if (this.ai[0] == 90f)
29955 {
29956 if (flag48)
29957 {
29959 }
29960 else
29961 {
29963 }
29964 }
29965 scale = (this.ai[0] - 50f) / 40f;
29966 alpha = 255 - (int)(255f * scale);
29967 rotation -= (float)Math.PI / 20f;
29968 if (type == 579)
29969 {
29970 if (Main.rand.Next(2) == 0)
29971 {
29972 Vector2 vector118 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
29973 Dust dust29 = Main.dust[Dust.NewDust(base.Center - vector118 * 30f, 0, 0, 229)];
29974 dust29.noGravity = true;
29975 dust29.position = base.Center - vector118 * Main.rand.Next(10, 21);
29976 dust29.velocity = vector118.RotatedBy(1.5707963705062866) * 6f;
29977 dust29.scale = 0.5f + Main.rand.NextFloat();
29978 dust29.fadeIn = 0.5f;
29979 dust29.customData = base.Center;
29980 }
29981 if (Main.rand.Next(2) == 0)
29982 {
29983 Vector2 vector119 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
29984 Dust dust30 = Main.dust[Dust.NewDust(base.Center - vector119 * 30f, 0, 0, 240)];
29985 dust30.noGravity = true;
29986 dust30.position = base.Center - vector119 * 30f;
29987 dust30.velocity = vector119.RotatedBy(-1.5707963705062866) * 3f;
29988 dust30.scale = 0.5f + Main.rand.NextFloat();
29989 dust30.fadeIn = 0.5f;
29990 dust30.customData = base.Center;
29991 }
29992 }
29993 if (type == 578)
29994 {
29995 Vector2 vector120 = this.ai[1].ToRotationVector2();
29996 Vector2 vector121 = vector120.RotatedBy(1.5707963705062866) * (Main.rand.Next(2) == 0).ToDirectionInt() * Main.rand.Next(10, 21);
29997 vector120 *= (float)Main.rand.Next(-80, 81);
29999 vector122 /= 10f;
30000 int num871 = Utils.SelectRandom<int>(Main.rand, 229, 229);
30001 Dust dust31 = Main.dust[Dust.NewDust(base.Center, 0, 0, num871)];
30002 dust31.noGravity = true;
30003 dust31.position = base.Center + vector121;
30004 dust31.velocity = vector122;
30005 dust31.scale = 0.5f + Main.rand.NextFloat();
30006 dust31.fadeIn = 0.5f;
30007 if (this.ai[0] == 90f && Main.netMode != 1)
30008 {
30009 Vector2 vector123 = this.ai[1].ToRotationVector2() * 8f;
30010 float ai2 = Main.rand.Next(80);
30011 NewProjectile(GetProjectileSource_FromThis(), base.Center.X - vector123.X, base.Center.Y - vector123.Y, vector123.X, vector123.Y, 580, 50, 1f, Main.myPlayer, this.ai[1], ai2);
30012 }
30013 }
30014 else if (type == 579)
30015 {
30016 if (this.ai[0] == 90f && Main.netMode != 1)
30017 {
30018 this.ai[1] = 1f;
30019 netUpdate = true;
30020 for (int num872 = 0; num872 < 2; num872++)
30021 {
30022 int num873 = NPC.NewNPC(GetNPCSource_FromThis(), (int)base.Center.X, (int)base.Center.Y, 427, whoAmI);
30023 Main.npc[num873].velocity = -Vector2.UnitY.RotatedByRandom(6.2831854820251465) * Main.rand.Next(4, 9) - Vector2.UnitY * 2f;
30024 Main.npc[num873].netUpdate = true;
30025 }
30026 }
30027 }
30028 else if (type == 813)
30029 {
30030 if (Main.rand.Next(2) == 0)
30031 {
30032 Vector2 vector124 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
30033 Dust dust32 = Main.dust[Dust.NewDust(base.Center - vector124 * 30f, 0, 0, 5)];
30034 dust32.noGravity = true;
30035 dust32.position = base.Center - vector124 * Main.rand.Next(10, 21);
30036 dust32.velocity = vector124.RotatedBy(1.5707963705062866) * 6f;
30037 dust32.scale = 0.5f + Main.rand.NextFloat();
30038 dust32.fadeIn = 0.5f;
30039 dust32.customData = base.Center;
30040 }
30041 if (Main.rand.Next(2) == 0)
30042 {
30043 Vector2 vector125 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
30044 Dust dust33 = Main.dust[Dust.NewDust(base.Center - vector125 * 30f, 0, 0, 240)];
30045 dust33.noGravity = true;
30046 dust33.position = base.Center - vector125 * 30f;
30047 dust33.velocity = vector125.RotatedBy(-1.5707963705062866) * 3f;
30048 dust33.scale = 0.5f + Main.rand.NextFloat();
30049 dust33.fadeIn = 0.5f;
30050 dust33.customData = base.Center;
30051 }
30052 if (this.ai[0] == 90f && Main.netMode != 1)
30053 {
30054 int num874 = NPC.NewNPC(GetNPCSource_FromThis(), (int)base.Center.X, (int)base.Center.Y, 619, whoAmI);
30055 Main.npc[num874].netUpdate = true;
30056 }
30057 }
30058 }
30059 else if (this.ai[0] <= 120f)
30060 {
30061 scale = 1f;
30062 alpha = 0;
30063 rotation -= (float)Math.PI / 60f;
30064 if (type == 813)
30065 {
30066 if (Main.rand.Next(2) == 0)
30067 {
30068 Vector2 vector126 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
30069 Dust dust34 = Main.dust[Dust.NewDust(base.Center - vector126 * 30f, 0, 0, 5)];
30070 dust34.noGravity = true;
30071 dust34.position = base.Center - vector126 * Main.rand.Next(10, 21);
30072 dust34.velocity = vector126.RotatedBy(1.5707963705062866) * 6f;
30073 dust34.scale = 0.5f + Main.rand.NextFloat();
30074 dust34.fadeIn = 0.5f;
30075 dust34.customData = base.Center;
30076 }
30077 else
30078 {
30079 Vector2 vector127 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
30080 Dust dust35 = Main.dust[Dust.NewDust(base.Center - vector127 * 30f, 0, 0, 240)];
30081 dust35.noGravity = true;
30082 dust35.position = base.Center - vector127 * 30f;
30083 dust35.velocity = vector127.RotatedBy(-1.5707963705062866) * 3f;
30084 dust35.scale = 0.5f + Main.rand.NextFloat();
30085 dust35.fadeIn = 0.5f;
30086 dust35.customData = base.Center;
30087 }
30088 }
30089 else if (Main.rand.Next(2) == 0)
30090 {
30091 Vector2 vector128 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
30092 Dust dust36 = Main.dust[Dust.NewDust(base.Center - vector128 * 30f, 0, 0, 229)];
30093 dust36.noGravity = true;
30094 dust36.position = base.Center - vector128 * Main.rand.Next(10, 21);
30095 dust36.velocity = vector128.RotatedBy(1.5707963705062866) * 6f;
30096 dust36.scale = 0.5f + Main.rand.NextFloat();
30097 dust36.fadeIn = 0.5f;
30098 dust36.customData = base.Center;
30099 }
30100 else
30101 {
30102 Vector2 vector129 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
30103 Dust dust37 = Main.dust[Dust.NewDust(base.Center - vector129 * 30f, 0, 0, 240)];
30104 dust37.noGravity = true;
30105 dust37.position = base.Center - vector129 * 30f;
30106 dust37.velocity = vector129.RotatedBy(-1.5707963705062866) * 3f;
30107 dust37.scale = 0.5f + Main.rand.NextFloat();
30108 dust37.fadeIn = 0.5f;
30109 dust37.customData = base.Center;
30110 }
30111 }
30112 else
30113 {
30114 scale = 1f - (this.ai[0] - 120f) / 60f;
30115 alpha = 255 - (int)(255f * scale);
30116 rotation -= (float)Math.PI / 30f;
30117 if (alpha >= 255)
30118 {
30119 Kill();
30120 }
30121 if (type == 813)
30122 {
30123 for (int num875 = 0; num875 < 2; num875++)
30124 {
30125 switch (Main.rand.Next(3))
30126 {
30127 case 0:
30128 {
30129 Vector2 vector131 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * scale;
30130 Dust dust39 = Main.dust[Dust.NewDust(base.Center - vector131 * 30f, 0, 0, 5)];
30131 dust39.noGravity = true;
30132 dust39.position = base.Center - vector131 * Main.rand.Next(10, 21);
30133 dust39.velocity = vector131.RotatedBy(1.5707963705062866) * 6f;
30134 dust39.scale = 0.5f + Main.rand.NextFloat();
30135 dust39.fadeIn = 0.5f;
30136 dust39.customData = base.Center;
30137 break;
30138 }
30139 case 1:
30140 {
30141 Vector2 vector130 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * scale;
30142 Dust dust38 = Main.dust[Dust.NewDust(base.Center - vector130 * 30f, 0, 0, 240)];
30143 dust38.noGravity = true;
30144 dust38.position = base.Center - vector130 * 30f;
30145 dust38.velocity = vector130.RotatedBy(-1.5707963705062866) * 3f;
30146 dust38.scale = 0.5f + Main.rand.NextFloat();
30147 dust38.fadeIn = 0.5f;
30148 dust38.customData = base.Center;
30149 break;
30150 }
30151 }
30152 }
30153 }
30154 else
30155 {
30156 for (int num876 = 0; num876 < 2; num876++)
30157 {
30158 switch (Main.rand.Next(3))
30159 {
30160 case 0:
30161 {
30162 Vector2 vector133 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * scale;
30163 Dust dust41 = Main.dust[Dust.NewDust(base.Center - vector133 * 30f, 0, 0, 229)];
30164 dust41.noGravity = true;
30165 dust41.position = base.Center - vector133 * Main.rand.Next(10, 21);
30166 dust41.velocity = vector133.RotatedBy(1.5707963705062866) * 6f;
30167 dust41.scale = 0.5f + Main.rand.NextFloat();
30168 dust41.fadeIn = 0.5f;
30169 dust41.customData = base.Center;
30170 break;
30171 }
30172 case 1:
30173 {
30174 Vector2 vector132 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * scale;
30175 Dust dust40 = Main.dust[Dust.NewDust(base.Center - vector132 * 30f, 0, 0, 240)];
30176 dust40.noGravity = true;
30177 dust40.position = base.Center - vector132 * 30f;
30178 dust40.velocity = vector132.RotatedBy(-1.5707963705062866) * 3f;
30179 dust40.scale = 0.5f + Main.rand.NextFloat();
30180 dust40.fadeIn = 0.5f;
30181 dust40.customData = base.Center;
30182 break;
30183 }
30184 }
30185 }
30186 }
30187 }
30188 if (type == 813 && Main.rand.NextFloat() < Opacity)
30189 {
30190 Dust dust42 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(3f, 20f), 90);
30191 dust42.velocity = Vector2.UnitY;
30192 dust42.noGravity = true;
30193 dust42.scale = scale;
30194 }
30195 }
30196 else if (aiStyle == 109)
30197 {
30198 if (localAI[1] == 0f)
30199 {
30200 localAI[1] = velocity.Length();
30201 }
30202 if (this.ai[0] == 0f)
30203 {
30204 localAI[0]++;
30205 if (localAI[0] > 30f)
30206 {
30207 this.ai[0] = 1f;
30208 localAI[0] = 0f;
30209 return;
30210 }
30211 }
30212 else if (this.ai[0] == 1f)
30213 {
30215 if (type != 582 || !Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].type != 124)
30216 {
30217 Kill();
30218 return;
30219 }
30220 NPC.lazyNPCOwnedProjectileSearchArray[(int)this.ai[1]] = whoAmI;
30221 zero3 = Main.npc[(int)this.ai[1]].Center;
30222 tileCollide = false;
30223 float num877 = localAI[1];
30224 Vector2 value14 = zero3 - base.Center;
30225 if (value14.Length() < num877)
30226 {
30227 Kill();
30228 return;
30229 }
30230 value14.Normalize();
30231 value14 *= num877;
30233 }
30234 rotation += (float)Math.PI / 10f;
30235 }
30236 else if (aiStyle == 110)
30237 {
30238 if (localAI[1] == 0f)
30239 {
30240 localAI[1] = velocity.Length();
30241 }
30243 if (Main.npc[(int)this.ai[0]].active && Main.npc[(int)this.ai[0]].townNPC)
30244 {
30245 zero4 = Main.npc[(int)this.ai[0]].Center;
30246 float num878 = localAI[1];
30247 Vector2 value15 = zero4 - base.Center;
30248 if (value15.Length() < num878 || base.Hitbox.Intersects(Main.npc[(int)this.ai[0]].Hitbox))
30249 {
30250 Kill();
30251 int num879 = Main.npc[(int)this.ai[0]].lifeMax - Main.npc[(int)this.ai[0]].life;
30252 if (num879 > 20)
30253 {
30254 num879 = 20;
30255 }
30256 if (num879 > 0)
30257 {
30258 NPC nPC13 = Main.npc[(int)this.ai[0]];
30259 nPC13.life += num879;
30260 Main.npc[(int)this.ai[0]].HealEffect(num879);
30261 }
30262 }
30263 else
30264 {
30265 value15.Normalize();
30266 value15 *= num878;
30267 if (value15.Y < velocity.Y)
30268 {
30269 value15.Y = velocity.Y;
30270 }
30271 value15.Y += 1f;
30273 rotation += velocity.X * 0.05f;
30274 }
30275 }
30276 else
30277 {
30278 Kill();
30279 }
30280 }
30281 else if (aiStyle == 111)
30282 {
30284 }
30285 else if (aiStyle == 112)
30286 {
30287 if (type == 836)
30288 {
30289 if (localAI[0] == 0f)
30290 {
30291 localAI[0] = 1f;
30292 for (int num880 = 0; num880 < 3; num880++)
30293 {
30294 int num881 = Dust.NewDust(base.position, width, height, 31, 0f, 0f, 50, Color.White, 1.2f);
30295 Dust dust2 = Main.dust[num881];
30296 dust2.velocity *= 0.3f;
30297 Main.dust[num881].noGravity = true;
30298 }
30299 }
30300 if (++frameCounter >= 6)
30301 {
30302 frameCounter = 0;
30303 if (++frame >= 4)
30304 {
30305 frame = 0;
30306 }
30307 }
30308 Player player9 = Main.player[(int)this.ai[1]];
30309 bool flag49 = player9.active && !player9.dead && Vector2.Distance(player9.Center, base.Center) < 800f;
30310 int num882 = (spriteDirection = ((Main.WindForVisuals > 0f) ? 1 : (-1)));
30311 direction = ((player9.Center.X > base.Center.X) ? 1 : (-1));
30312 bool flag50 = num882 != direction;
30313 float num883 = 2.5f;
30314 float num884 = 2f;
30315 if (flag50)
30316 {
30317 num883 = 1.5f;
30318 num884 = 1f;
30319 }
30320 if (flag49)
30321 {
30322 if (!flag50)
30323 {
30324 float num885 = player9.Center.X - base.Center.X;
30325 velocity.X += 0.05f * (float)direction * (0.6f + Math.Abs(Main.WindForVisuals));
30326 if (velocity.X > num883)
30327 {
30328 velocity.X -= 0.1f;
30329 }
30330 if (velocity.X < 0f - num883)
30331 {
30332 velocity.X += 0.1f;
30333 }
30334 }
30335 if (player9.Top.Y >= base.Center.Y || flag50)
30336 {
30337 velocity.Y += 0.05f;
30338 if (velocity.Y > num883)
30339 {
30340 velocity.Y -= 0.1f;
30341 }
30342 }
30343 else if (player9.Top.Y < base.Center.Y)
30344 {
30345 velocity.Y -= 0.1f;
30346 if (velocity.Y < 0f - num884)
30347 {
30348 velocity.Y += 0.2f;
30349 }
30350 }
30351 }
30352 else
30353 {
30354 velocity.Y += 0.2f;
30355 if (velocity.Y < 0f - num884)
30356 {
30357 velocity.Y += 0.2f;
30358 }
30359 if (velocity.Y > num884)
30360 {
30361 velocity.Y -= 0.2f;
30362 }
30363 }
30364 rotation = velocity.X * 0.125f;
30365 }
30366 if (type == 590)
30367 {
30368 if (++frameCounter >= 4)
30369 {
30370 int num886 = 0;
30371 int num887 = 3;
30372 if (this.ai[2] == 1f)
30373 {
30374 num886 = 3;
30375 num887 = 6;
30376 }
30377 frameCounter = 0;
30378 if (++frame >= num887)
30379 {
30380 frame = num886;
30381 }
30382 }
30383 if (alpha > 0)
30384 {
30385 alpha -= 15;
30386 }
30387 if (alpha < 0)
30388 {
30389 alpha = 0;
30390 }
30391 if (alpha == 0)
30392 {
30393 float num888 = (float)Main.rand.Next(28, 42) * 0.005f;
30394 num888 += (float)(270 - Main.mouseTextColor) / 500f;
30395 float num889 = 0.1f;
30396 float num890 = 0.3f + num888 / 2f;
30397 float num891 = 0.6f + num888;
30398 float num892 = 0.35f;
30399 num889 *= num892;
30400 num890 *= num892;
30401 num891 *= num892;
30402 Lighting.AddLight(base.Center, num889, num890, num891);
30403 }
30404 velocity = new Vector2(0f, (float)Math.Sin((float)Math.PI * 2f * this.ai[0] / 180f) * 0.15f);
30405 this.ai[0]++;
30406 if (this.ai[0] >= 180f)
30407 {
30408 this.ai[0] = 0f;
30409 }
30410 }
30411 if (type != 644)
30412 {
30413 return;
30414 }
30415 Color newColor3 = Main.hslToRgb(this.ai[0], 1f, 0.5f);
30416 int num893 = (int)this.ai[1];
30417 if (num893 < 0 || num893 >= 1000 || (!Main.projectile[num893].active && Main.projectile[num893].type != 643))
30418 {
30419 this.ai[1] = -1f;
30420 }
30421 else
30422 {
30423 DelegateMethods.v3_1 = newColor3.ToVector3() * 0.5f;
30424 Utils.PlotTileLine(base.Center, Main.projectile[num893].Center, 8f, DelegateMethods.CastLight);
30425 }
30426 if (localAI[0] == 0f)
30427 {
30428 localAI[0] = Main.rand.NextFloat() * 0.8f + 0.8f;
30429 direction = ((Main.rand.Next(2) > 0) ? 1 : (-1));
30430 }
30431 rotation = localAI[1] / 40f * ((float)Math.PI * 2f) * (float)direction;
30432 if (alpha > 0)
30433 {
30434 alpha -= 8;
30435 }
30436 if (alpha < 0)
30437 {
30438 alpha = 0;
30439 }
30440 if (alpha == 0)
30441 {
30442 Lighting.AddLight(base.Center, newColor3.ToVector3() * 0.5f);
30443 }
30444 for (int num894 = 0; num894 < 2; num894++)
30445 {
30446 if (Main.rand.Next(10) == 0)
30447 {
30448 Vector2 vector134 = Vector2.UnitY.RotatedBy((float)num894 * (float)Math.PI).RotatedBy(rotation);
30449 Dust dust43 = Main.dust[Dust.NewDust(base.Center, 0, 0, 267, 0f, 0f, 225, newColor3, 1.5f)];
30450 dust43.noGravity = true;
30451 dust43.noLight = true;
30452 dust43.scale = Opacity * localAI[0];
30453 dust43.position = base.Center;
30454 dust43.velocity = vector134 * 2.5f;
30455 }
30456 }
30457 for (int num895 = 0; num895 < 2; num895++)
30458 {
30459 if (Main.rand.Next(10) == 0)
30460 {
30461 Vector2 vector135 = Vector2.UnitY.RotatedBy((float)num895 * (float)Math.PI);
30462 Dust dust44 = Main.dust[Dust.NewDust(base.Center, 0, 0, 267, 0f, 0f, 225, newColor3, 1.5f)];
30463 dust44.noGravity = true;
30464 dust44.noLight = true;
30465 dust44.scale = Opacity * localAI[0];
30466 dust44.position = base.Center;
30467 dust44.velocity = vector135 * 2.5f;
30468 }
30469 }
30470 if (Main.rand.Next(10) == 0)
30471 {
30472 float num896 = 1f + Main.rand.NextFloat() * 2f;
30473 float fadeIn = 1f + Main.rand.NextFloat();
30474 float num897 = 1f + Main.rand.NextFloat();
30475 Vector2 vector136 = Utils.RandomVector2(Main.rand, -1f, 1f);
30476 if (vector136 != Vector2.Zero)
30477 {
30478 vector136.Normalize();
30479 }
30480 vector136 *= 20f + Main.rand.NextFloat() * 100f;
30481 Vector2 vec = base.Center + vector136;
30482 Point point3 = vec.ToTileCoordinates();
30483 bool flag51 = true;
30484 if (!WorldGen.InWorld(point3.X, point3.Y))
30485 {
30486 flag51 = false;
30487 }
30488 if (flag51 && WorldGen.SolidTile(point3.X, point3.Y))
30489 {
30490 flag51 = false;
30491 }
30492 if (flag51)
30493 {
30494 Dust dust45 = Main.dust[Dust.NewDust(vec, 0, 0, 267, 0f, 0f, 127, newColor3)];
30495 dust45.noGravity = true;
30496 dust45.position = vec;
30497 dust45.velocity = -Vector2.UnitY * num896 * (Main.rand.NextFloat() * 0.9f + 1.6f);
30498 dust45.fadeIn = fadeIn;
30499 dust45.scale = num897;
30500 dust45.noLight = true;
30501 if (dust45.dustIndex != 6000)
30502 {
30503 Dust dust46 = Dust.CloneDust(dust45);
30504 Dust dust2 = dust46;
30505 dust2.scale *= 0.65f;
30506 dust2 = dust46;
30507 dust2.fadeIn *= 0.65f;
30508 dust46.color = new Color(255, 255, 255, 255);
30509 }
30510 }
30511 }
30512 scale = Opacity / 2f * localAI[0];
30514 localAI[1]++;
30515 if (localAI[1] >= 60f)
30516 {
30517 Kill();
30518 }
30519 if (localAI[1] == 30f)
30520 {
30522 if (Main.myPlayer == owner)
30523 {
30524 friendly = true;
30525 int num898 = width;
30526 int num899 = height;
30527 int num900 = penetrate;
30528 base.position = base.Center;
30529 width = (height = 60);
30530 base.Center = base.position;
30531 penetrate = -1;
30532 maxPenetrate = -1;
30533 Damage();
30534 penetrate = num900;
30535 base.position = base.Center;
30536 width = num898;
30537 height = num899;
30538 base.Center = base.position;
30539 friendly = false;
30540 }
30541 }
30542 }
30543 else if (aiStyle == 113)
30544 {
30545 int num901 = 25;
30546 if (type == 614)
30547 {
30548 num901 = 63;
30549 }
30550 if (alpha > 0)
30551 {
30552 alpha -= num901;
30553 }
30554 if (alpha < 0)
30555 {
30556 alpha = 0;
30557 }
30558 if (this.ai[0] == 0f)
30559 {
30560 if (type == 614)
30561 {
30562 int num902 = (int)this.ai[1];
30563 if (!Main.npc[num902].CanBeChasedBy(this))
30564 {
30565 Kill();
30566 return;
30567 }
30568 float num903 = velocity.ToRotation();
30569 Vector2 vector137 = Main.npc[num902].Center - base.Center;
30570 if (vector137 != Vector2.Zero)
30571 {
30572 vector137.Normalize();
30573 vector137 *= 14f;
30574 }
30575 float num904 = 5f;
30576 velocity = (velocity * (num904 - 1f) + vector137) / num904;
30577 }
30578 else
30579 {
30580 this.ai[1]++;
30581 if (this.ai[1] >= 45f)
30582 {
30583 float num905 = 0.98f;
30584 float num906 = 0.35f;
30585 if (type == 636)
30586 {
30587 num905 = 0.995f;
30588 num906 = 0.15f;
30589 }
30590 this.ai[1] = 45f;
30591 velocity.X *= num905;
30592 velocity.Y += num906;
30593 }
30594 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
30595 }
30596 }
30597 if (this.ai[0] == 1f)
30598 {
30599 Vector2 center17 = base.Center;
30600 ignoreWater = true;
30601 tileCollide = false;
30602 int num907 = 15;
30603 if (type == 636)
30604 {
30605 num907 = 5 * MaxUpdates;
30606 }
30607 if (type == 971)
30608 {
30609 num907 = 9 * MaxUpdates;
30610 }
30611 if (type == 975)
30612 {
30613 num907 = 9 * MaxUpdates;
30614 }
30615 bool flag52 = false;
30616 bool flag53 = false;
30617 localAI[0]++;
30618 if (localAI[0] % 30f == 0f)
30619 {
30620 flag53 = true;
30621 }
30622 int num908 = (int)this.ai[1];
30623 if (localAI[0] >= (float)(60 * num907))
30624 {
30625 flag52 = true;
30626 }
30627 else if (num908 < 0 || num908 >= 200)
30628 {
30629 flag52 = true;
30630 }
30631 else if (Main.npc[num908].active && !Main.npc[num908].dontTakeDamage)
30632 {
30633 base.Center = Main.npc[num908].Center - velocity * 2f;
30634 gfxOffY = Main.npc[num908].gfxOffY;
30635 if (flag53)
30636 {
30637 Main.npc[num908].HitEffect(0, 1.0);
30638 }
30639 }
30640 else
30641 {
30642 flag52 = true;
30643 }
30644 if (flag52)
30645 {
30646 Kill();
30647 }
30648 if (!flag52 && type == 971)
30649 {
30650 if (num908 > 0 && num908 < 200 && timeLeft % 2 == 0)
30651 {
30652 Vector2 vector138 = center17 - velocity.SafeNormalize(Vector2.Zero) * 8f;
30653 Vector2 value16 = Main.npc[num908].velocity + new Vector2(Main.rand.NextFloatDirection() * 0.35f, 2.5f);
30654 Dust dust47 = Dust.NewDustPerfect(vector138, 4, value16, 0, new Color(120, 50, 120), 0.65f);
30655 dust47.fadeIn = 0.25f;
30656 dust47.noGravity = true;
30657 }
30658 if (localAI[1] == 0f)
30659 {
30660 localAI[1] = 1f;
30661 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
30662 }
30663 }
30664 if (!flag52 && type == 975)
30665 {
30666 if (num908 > 0 && num908 < 200 && timeLeft % 2 == 0)
30667 {
30669 Vector2 vector140 = velocity.SafeNormalize(Vector2.Zero) * -7f + velocity.SafeNormalize(Vector2.Zero).RotatedByRandom(0.19634954631328583);
30670 Dust dust48 = Dust.NewDustPerfect(vector139, 5, Vector2.Zero, 0, default(Color), 1.5f);
30671 dust48.scale = 1.1f;
30672 dust48.velocity = vector140 * 0.85f + new Vector2(0f, 0.85f);
30673 Vector2 spinningpoint17 = dust48.velocity;
30674 dust48.velocity = spinningpoint17.RotatedBy((float)Math.PI * 2f * Main.rand.NextFloatDirection() * 0.025f);
30675 dust48 = Dust.CloneDust(dust48.dustIndex);
30676 dust48.velocity = spinningpoint17.RotatedBy((float)Math.PI * 2f * Main.rand.NextFloatDirection() * 0.025f);
30677 Dust dust2 = dust48;
30678 dust2.position += dust48.velocity;
30679 if (Main.rand.Next(3) == 0)
30680 {
30681 dust48 = Dust.CloneDust(dust48.dustIndex);
30682 dust48.velocity = dust48.velocity.RotatedByRandom(0.39269909262657166) * 0.9f;
30683 }
30684 }
30685 if (localAI[1] == 0f)
30686 {
30687 localAI[1] = 1f;
30688 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
30690 for (int num909 = 0; num909 < 10; num909++)
30691 {
30692 Vector2 vector142 = Main.rand.NextVector2CircularEdge(4f, 4f);
30693 Dust dust49 = Dust.NewDustPerfect(vector141, 5, Vector2.Zero, 0, default(Color), 1.5f);
30694 dust49.scale = 1.5f;
30695 dust49.velocity = vector142;
30696 dust49.noGravity = true;
30697 }
30698 }
30699 }
30700 }
30701 if (type == 614)
30702 {
30703 Lighting.AddLight(base.Center, 0.2f, 0.6f, 0.7f);
30704 }
30705 if (type == 636)
30706 {
30707 Lighting.AddLight(base.Center, 0.8f, 0.7f, 0.4f);
30708 }
30709 }
30710 else if (aiStyle == 114)
30711 {
30712 if (Main.netMode == 2 && localAI[0] == 0f)
30713 {
30715 localAI[0] = 1f;
30716 }
30717 timeLeft = 3;
30718 bool flag54 = false;
30719 if (owner != 255 && (!Main.player[owner].active || Main.player[owner].dead || Distance(Main.player[owner].Center) > 12800f))
30720 {
30721 flag54 = true;
30722 }
30723 if (!flag54 && !WorldGen.InWorld((int)base.Center.X / 16, (int)base.Center.Y / 16, Lighting.OffScreenTiles))
30724 {
30725 flag54 = true;
30726 }
30727 if (!flag54 && !PortalHelper.SupportedTilesAreFine(base.Center, this.ai[0]))
30728 {
30729 flag54 = true;
30730 }
30731 if (flag54)
30732 {
30733 Kill();
30734 return;
30735 }
30737 alpha -= 25;
30738 if (alpha < 0)
30739 {
30740 alpha = 0;
30741 }
30742 if (alpha == 0)
30743 {
30744 Lighting.AddLight(base.Center + velocity * 3f, portalColor.ToVector3() * 0.5f);
30745 }
30746 if (++frameCounter >= 6)
30747 {
30748 frameCounter = 0;
30749 if (++frame >= Main.projFrames[type])
30750 {
30751 frame = 0;
30752 }
30753 }
30754 rotation = this.ai[0] - (float)Math.PI / 2f;
30755 }
30756 else if (aiStyle == 115)
30757 {
30758 Lighting.AddLight(base.Center, new Vector3(0.075f, 0.3f, 0.15f));
30759 velocity *= 0.985f;
30760 rotation += velocity.X * 0.2f;
30761 if (velocity.X > 0f)
30762 {
30763 rotation += 0.08f;
30764 }
30765 else
30766 {
30767 rotation -= 0.08f;
30768 }
30769 this.ai[1] += 1f;
30770 if (this.ai[1] > 30f)
30771 {
30772 alpha += 10;
30773 if (alpha >= 255)
30774 {
30775 alpha = 255;
30776 Kill();
30777 }
30778 }
30779 }
30780 else if (aiStyle == 116)
30781 {
30782 if (localAI[0] == 0f)
30783 {
30784 rotation = this.ai[1];
30785 localAI[0] = 1f;
30786 }
30787 Player player10 = Main.player[owner];
30788 if (player10.setSolar)
30789 {
30790 timeLeft = 2;
30791 }
30792 float angle = (float)player10.miscCounter / 300f * ((float)Math.PI * 4f) + this.ai[1];
30794 rotation = rotation.AngleLerp(angle, 0.05f);
30795 alpha -= 15;
30796 if (alpha < 0)
30797 {
30798 alpha = 0;
30799 }
30800 velocity = rotation.ToRotationVector2() * 100f - player10.velocity;
30801 base.Center = player10.Center - velocity;
30802 }
30803 else if (aiStyle == 117)
30804 {
30805 this.ai[1] += 0.01f;
30806 scale = this.ai[1];
30807 this.ai[0]++;
30808 if (this.ai[0] >= (float)(3 * Main.projFrames[type]))
30809 {
30810 Kill();
30811 return;
30812 }
30813 if (++frameCounter >= 3)
30814 {
30815 frameCounter = 0;
30816 if (++frame >= Main.projFrames[type])
30817 {
30818 hide = true;
30819 }
30820 }
30821 alpha -= 63;
30822 if (alpha < 0)
30823 {
30824 alpha = 0;
30825 }
30826 bool flag55 = type == 612 || type == 953 || type == 978;
30827 bool flag56 = type == 624;
30828 if (flag55)
30829 {
30830 Lighting.AddLight(base.Center, 0.9f, 0.8f, 0.6f);
30831 }
30832 if (this.ai[0] != 1f)
30833 {
30834 return;
30835 }
30836 base.position = base.Center;
30837 width = (height = (int)(52f * scale));
30838 base.Center = base.position;
30839 Damage();
30840 if (flag55)
30841 {
30843 for (int num910 = 0; num910 < 4; num910++)
30844 {
30845 int num911 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
30846 Main.dust[num911].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
30847 }
30848 for (int num912 = 0; num912 < 10; num912++)
30849 {
30850 int num913 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 200, default(Color), 2.7f);
30851 Main.dust[num913].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
30852 Main.dust[num913].noGravity = true;
30853 Dust dust2 = Main.dust[num913];
30854 dust2.velocity *= 3f;
30855 num913 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
30856 Main.dust[num913].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
30857 dust2 = Main.dust[num913];
30858 dust2.velocity *= 2f;
30859 Main.dust[num913].noGravity = true;
30860 Main.dust[num913].fadeIn = 2.5f;
30861 }
30862 for (int num914 = 0; num914 < 5; num914++)
30863 {
30864 int num915 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 0, default(Color), 2.7f);
30865 Main.dust[num915].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
30866 Main.dust[num915].noGravity = true;
30867 Dust dust2 = Main.dust[num915];
30868 dust2.velocity *= 3f;
30869 }
30870 for (int num916 = 0; num916 < 10; num916++)
30871 {
30872 int num917 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
30873 Main.dust[num917].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
30874 Main.dust[num917].noGravity = true;
30875 Dust dust2 = Main.dust[num917];
30876 dust2.velocity *= 3f;
30877 }
30878 }
30879 if (!flag56)
30880 {
30881 return;
30882 }
30884 for (int num918 = 0; num918 < 20; num918++)
30885 {
30886 int num919 = Dust.NewDust(base.position, width, height, 135, 0f, 0f, 100, default(Color), 1.5f);
30887 Main.dust[num919].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
30888 Dust dust2 = Main.dust[num919];
30889 dust2.velocity *= 2f;
30890 Main.dust[num919].noGravity = true;
30891 Main.dust[num919].fadeIn = 2.5f;
30892 Main.dust[num919].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cPet, Main.player[owner]);
30893 }
30894 for (int num920 = 0; num920 < 15; num920++)
30895 {
30896 int num921 = Dust.NewDust(base.position, width, height, 135, 0f, 0f, 0, default(Color), 2.7f);
30897 Main.dust[num921].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
30898 Main.dust[num921].noGravity = true;
30899 Dust dust2 = Main.dust[num921];
30900 dust2.velocity *= 3f;
30901 Main.dust[num921].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cPet, Main.player[owner]);
30902 }
30903 float num922 = (float)Main.rand.NextDouble() * ((float)Math.PI * 2f);
30904 float num923 = (float)Main.rand.NextDouble() * ((float)Math.PI * 2f);
30905 float num924 = (float)Main.rand.NextDouble() * ((float)Math.PI * 2f);
30906 float num925 = 7f + (float)Main.rand.NextDouble() * 7f;
30907 float num926 = 7f + (float)Main.rand.NextDouble() * 7f;
30908 float num927 = 7f + (float)Main.rand.NextDouble() * 7f;
30909 float num928 = num925;
30910 if (num926 > num928)
30911 {
30912 num928 = num926;
30913 }
30914 if (num927 > num928)
30915 {
30916 num928 = num927;
30917 }
30918 for (int num929 = 0; num929 < 200; num929++)
30919 {
30920 int num930 = 135;
30921 float num931 = num928;
30922 if (num929 > 50)
30923 {
30924 num931 = num926;
30925 }
30926 if (num929 > 100)
30927 {
30928 num931 = num925;
30929 }
30930 if (num929 > 150)
30931 {
30932 num931 = num927;
30933 }
30934 int num932 = Dust.NewDust(base.position, 6, 6, num930, 0f, 0f, 100);
30935 Vector2 vector143 = Main.dust[num932].velocity;
30936 Main.dust[num932].position = base.Center;
30937 vector143.Normalize();
30938 vector143 *= num931;
30939 if (num929 > 150)
30940 {
30941 vector143.Y *= 0.5f;
30942 vector143 = vector143.RotatedBy(num924);
30943 }
30944 else if (num929 > 100)
30945 {
30946 vector143.X *= 0.5f;
30947 vector143 = vector143.RotatedBy(num922);
30948 }
30949 else if (num929 > 50)
30950 {
30951 vector143.Y *= 0.5f;
30952 vector143 = vector143.RotatedBy(num923);
30953 }
30954 Dust dust2 = Main.dust[num932];
30955 dust2.velocity *= 0.2f;
30956 dust2 = Main.dust[num932];
30957 dust2.velocity += vector143;
30958 Main.dust[num932].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cPet, Main.player[owner]);
30959 if (num929 <= 200)
30960 {
30961 Main.dust[num932].scale = 2f;
30962 Main.dust[num932].noGravity = true;
30963 Main.dust[num932].fadeIn = Main.rand.NextFloat() * 2f;
30964 if (Main.rand.Next(4) == 0)
30965 {
30966 Main.dust[num932].fadeIn = 2.5f;
30967 }
30968 Main.dust[num932].noLight = true;
30969 if (num929 < 100)
30970 {
30971 dust2 = Main.dust[num932];
30972 dust2.position += Main.dust[num932].velocity * 20f;
30973 dust2 = Main.dust[num932];
30974 dust2.velocity *= -1f;
30975 }
30976 }
30977 }
30978 }
30979 else if (aiStyle == 118)
30980 {
30981 this.ai[0]++;
30982 int num933 = 0;
30983 if (velocity.Length() <= 4f)
30984 {
30985 num933 = 1;
30986 }
30987 alpha -= 15;
30988 if (alpha < 0)
30989 {
30990 alpha = 0;
30991 }
30992 switch (num933)
30993 {
30994 case 0:
30995 rotation -= (float)Math.PI / 30f;
30996 if (Main.rand.Next(3) == 0)
30997 {
30998 if (Main.rand.Next(2) == 0)
30999 {
31000 Vector2 vector149 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
31001 Dust dust52 = Main.dust[Dust.NewDust(base.Center - vector149 * 30f, 0, 0, Utils.SelectRandom<int>(Main.rand, 86, 90))];
31002 dust52.noGravity = true;
31003 dust52.position = base.Center - vector149 * Main.rand.Next(10, 21);
31004 dust52.velocity = vector149.RotatedBy(1.5707963705062866) * 6f;
31005 dust52.scale = 0.5f + Main.rand.NextFloat();
31006 dust52.fadeIn = 0.5f;
31007 dust52.customData = this;
31008 }
31009 else
31010 {
31011 Vector2 vector150 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
31012 Dust dust53 = Main.dust[Dust.NewDust(base.Center - vector150 * 30f, 0, 0, 240)];
31013 dust53.noGravity = true;
31014 dust53.position = base.Center - vector150 * 30f;
31015 dust53.velocity = vector150.RotatedBy(-1.5707963705062866) * 3f;
31016 dust53.scale = 0.5f + Main.rand.NextFloat();
31017 dust53.fadeIn = 0.5f;
31018 dust53.customData = this;
31019 }
31020 }
31021 if (this.ai[0] >= 30f)
31022 {
31023 velocity *= 0.98f;
31024 scale += 0.0074468083f;
31025 if (scale > 1.3f)
31026 {
31027 scale = 1.3f;
31028 }
31029 rotation -= (float)Math.PI / 180f;
31030 }
31031 if (velocity.Length() < 4.1f)
31032 {
31034 velocity *= 4f;
31035 this.ai[0] = 0f;
31036 }
31037 break;
31038 case 1:
31039 {
31040 rotation -= (float)Math.PI / 30f;
31041 for (int num934 = 0; num934 < 1; num934++)
31042 {
31043 if (Main.rand.Next(2) == 0)
31044 {
31045 Vector2 vector144 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
31046 Dust dust50 = Main.dust[Dust.NewDust(base.Center - vector144 * 30f, 0, 0, 86)];
31047 dust50.noGravity = true;
31048 dust50.position = base.Center - vector144 * Main.rand.Next(10, 21);
31049 dust50.velocity = vector144.RotatedBy(1.5707963705062866) * 6f;
31050 dust50.scale = 0.9f + Main.rand.NextFloat();
31051 dust50.fadeIn = 0.5f;
31052 dust50.customData = this;
31053 vector144 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
31054 dust50 = Main.dust[Dust.NewDust(base.Center - vector144 * 30f, 0, 0, 90)];
31055 dust50.noGravity = true;
31056 dust50.position = base.Center - vector144 * Main.rand.Next(10, 21);
31057 dust50.velocity = vector144.RotatedBy(1.5707963705062866) * 6f;
31058 dust50.scale = 0.9f + Main.rand.NextFloat();
31059 dust50.fadeIn = 0.5f;
31060 dust50.customData = this;
31061 dust50.color = Color.Crimson;
31062 }
31063 else
31064 {
31065 Vector2 vector145 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
31066 Dust dust51 = Main.dust[Dust.NewDust(base.Center - vector145 * 30f, 0, 0, 240)];
31067 dust51.noGravity = true;
31068 dust51.position = base.Center - vector145 * Main.rand.Next(20, 31);
31069 dust51.velocity = vector145.RotatedBy(-1.5707963705062866) * 5f;
31070 dust51.scale = 0.9f + Main.rand.NextFloat();
31071 dust51.fadeIn = 0.5f;
31072 dust51.customData = this;
31073 }
31074 }
31075 if (this.ai[0] % 30f == 0f && this.ai[0] < 241f && Main.myPlayer == owner)
31076 {
31077 Vector2 vector146 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * 12f;
31078 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector146.X, vector146.Y, 618, damage / 2, 0f, owner, 0f, whoAmI);
31079 }
31080 Vector2 vector147 = base.Center;
31081 float num935 = 800f;
31082 bool flag57 = false;
31083 int num936 = 0;
31084 if (this.ai[1] == 0f)
31085 {
31086 for (int num937 = 0; num937 < 200; num937++)
31087 {
31088 if (Main.npc[num937].CanBeChasedBy(this))
31089 {
31090 Vector2 center18 = Main.npc[num937].Center;
31091 if (Distance(center18) < num935 && Collision.CanHit(new Vector2(base.position.X + (float)(width / 2), base.position.Y + (float)(height / 2)), 1, 1, Main.npc[num937].position, Main.npc[num937].width, Main.npc[num937].height))
31092 {
31095 flag57 = true;
31096 num936 = num937;
31097 }
31098 }
31099 }
31100 if (flag57)
31101 {
31102 if (this.ai[1] != (float)(num936 + 1))
31103 {
31104 netUpdate = true;
31105 }
31106 this.ai[1] = num936 + 1;
31107 }
31108 flag57 = false;
31109 }
31110 if (this.ai[1] != 0f)
31111 {
31112 int num938 = (int)(this.ai[1] - 1f);
31113 if (Main.npc[num938].active && Main.npc[num938].CanBeChasedBy(this, ignoreDontTakeDamage: true) && Distance(Main.npc[num938].Center) < 1000f)
31114 {
31115 flag57 = true;
31116 vector147 = Main.npc[num938].Center;
31117 }
31118 }
31119 if (!friendly)
31120 {
31121 flag57 = false;
31122 }
31123 if (flag57)
31124 {
31125 float num939 = 4f;
31126 int num940 = 8;
31127 Vector2 vector148 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
31128 float num941 = vector147.X - vector148.X;
31129 float num942 = vector147.Y - vector148.Y;
31130 float num943 = (float)Math.Sqrt(num941 * num941 + num942 * num942);
31131 float num944 = num943;
31132 num943 = num939 / num943;
31133 num941 *= num943;
31134 num942 *= num943;
31135 velocity.X = (velocity.X * (float)(num940 - 1) + num941) / (float)num940;
31136 velocity.Y = (velocity.Y * (float)(num940 - 1) + num942) / (float)num940;
31137 }
31138 break;
31139 }
31140 }
31141 if (alpha < 150)
31142 {
31143 Lighting.AddLight(base.Center, 0.7f, 0.2f, 0.6f);
31144 }
31145 if (this.ai[0] >= 600f)
31146 {
31147 Kill();
31148 }
31149 }
31150 else if (aiStyle == 119)
31151 {
31152 int num945 = 0;
31153 float num946 = 0f;
31154 float x7 = 0f;
31155 float y6 = 0f;
31156 bool flag58 = false;
31157 bool flag59 = false;
31158 int num38 = type;
31159 if (num38 == 618)
31160 {
31161 num945 = 617;
31162 num946 = 420f;
31163 x7 = 0.15f;
31164 y6 = 0.15f;
31165 }
31166 if (flag59)
31167 {
31168 int num947 = (int)this.ai[1];
31169 if (!Main.projectile[num947].active || Main.projectile[num947].type != num945)
31170 {
31171 Kill();
31172 return;
31173 }
31174 timeLeft = 2;
31175 }
31176 this.ai[0]++;
31177 if (!(this.ai[0] < num946))
31178 {
31179 return;
31180 }
31181 bool flag60 = true;
31182 int num948 = (int)this.ai[1];
31183 if (Main.projectile[num948].active && Main.projectile[num948].type == num945)
31184 {
31185 if (!flag58 && Main.projectile[num948].oldPos[1] != Vector2.Zero)
31186 {
31187 base.position += Main.projectile[num948].position - Main.projectile[num948].oldPos[1];
31188 }
31189 if (base.Center.HasNaNs())
31190 {
31191 Kill();
31192 return;
31193 }
31194 }
31195 else
31196 {
31197 this.ai[0] = num946;
31198 flag60 = false;
31199 Kill();
31200 }
31201 if (flag60 && !flag58)
31202 {
31203 velocity += new Vector2(Math.Sign(Main.projectile[num948].Center.X - base.Center.X), Math.Sign(Main.projectile[num948].Center.Y - base.Center.Y)) * new Vector2(x7, y6);
31204 if (velocity.Length() > 6f)
31205 {
31206 velocity *= 6f / velocity.Length();
31207 }
31208 }
31209 if (type == 618)
31210 {
31211 if (Main.rand.Next(2) == 0)
31212 {
31213 int num949 = Dust.NewDust(base.Center, 8, 8, 86);
31214 Main.dust[num949].position = base.Center;
31215 Main.dust[num949].velocity = velocity;
31216 Main.dust[num949].noGravity = true;
31217 Main.dust[num949].scale = 1.5f;
31218 if (flag60)
31219 {
31220 Main.dust[num949].customData = Main.projectile[(int)this.ai[1]];
31221 }
31222 }
31223 alpha = 255;
31224 }
31225 else
31226 {
31227 Kill();
31228 }
31229 }
31230 else if (aiStyle == 120)
31231 {
31233 }
31234 else if (aiStyle == 121)
31235 {
31237 }
31238 else if (aiStyle == 122)
31239 {
31240 int num950 = (int)this.ai[0];
31241 bool flag61 = false;
31242 if (num950 == -1 || !Main.npc[num950].active)
31243 {
31244 flag61 = true;
31245 }
31246 if (flag61)
31247 {
31248 if (type == 629)
31249 {
31250 Kill();
31251 return;
31252 }
31253 if (type == 631 && this.ai[0] != -1f)
31254 {
31255 this.ai[0] = -1f;
31256 netUpdate = true;
31257 }
31258 }
31259 if (!flag61 && base.Hitbox.Intersects(Main.npc[num950].Hitbox))
31260 {
31261 Kill();
31262 if (type == 631)
31263 {
31264 localAI[1] = 1f;
31265 Damage();
31266 }
31267 return;
31268 }
31269 if (type == 629)
31270 {
31271 Vector2 value17 = Main.npc[num950].Center - base.Center;
31273 Dust.QuickDust(base.Center, Color.Red);
31274 }
31275 if (type != 631)
31276 {
31277 return;
31278 }
31279 if (this.ai[1] > 0f)
31280 {
31281 this.ai[1]--;
31283 return;
31284 }
31285 if (flag61)
31286 {
31287 if (velocity == Vector2.Zero)
31288 {
31289 Kill();
31290 }
31291 tileCollide = true;
31292 alpha += 10;
31293 if (alpha > 255)
31294 {
31295 Kill();
31296 }
31297 }
31298 else
31299 {
31300 Vector2 value18 = Main.npc[num950].Center - base.Center;
31302 alpha -= 15;
31303 if (alpha < 0)
31304 {
31305 alpha = 0;
31306 }
31307 }
31308 rotation = velocity.ToRotation() - (float)Math.PI / 2f;
31309 }
31310 else if (aiStyle == 123)
31311 {
31312 bool flag62 = type == 641;
31313 bool flag63 = type == 643;
31314 float num951 = 1000f;
31316 if (flag62)
31317 {
31318 alpha -= 5;
31319 if (alpha < 0)
31320 {
31321 alpha = 0;
31322 }
31323 if (direction == 0)
31324 {
31325 direction = Main.player[owner].direction;
31326 }
31327 rotation -= (float)direction * ((float)Math.PI * 2f) / 120f;
31328 scale = Opacity;
31329 Lighting.AddLight(base.Center, new Vector3(0.3f, 0.9f, 0.7f) * Opacity);
31330 if (Main.rand.Next(2) == 0)
31331 {
31332 Vector2 vector151 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
31333 Dust dust54 = Main.dust[Dust.NewDust(base.Center - vector151 * 30f, 0, 0, 229)];
31334 dust54.noGravity = true;
31335 dust54.position = base.Center - vector151 * Main.rand.Next(10, 21);
31336 dust54.velocity = vector151.RotatedBy(1.5707963705062866) * 6f;
31337 dust54.scale = 0.5f + Main.rand.NextFloat();
31338 dust54.fadeIn = 0.5f;
31339 dust54.customData = base.Center;
31340 }
31341 if (Main.rand.Next(2) == 0)
31342 {
31343 Vector2 vector152 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
31344 Dust dust55 = Main.dust[Dust.NewDust(base.Center - vector152 * 30f, 0, 0, 240)];
31345 dust55.noGravity = true;
31346 dust55.position = base.Center - vector152 * 30f;
31347 dust55.velocity = vector152.RotatedBy(-1.5707963705062866) * 3f;
31348 dust55.scale = 0.5f + Main.rand.NextFloat();
31349 dust55.fadeIn = 0.5f;
31350 dust55.customData = base.Center;
31351 }
31352 if (this.ai[0] < 0f)
31353 {
31354 Vector2 center19 = base.Center;
31355 int num952 = Dust.NewDust(center19 - Vector2.One * 8f, 16, 16, 229, velocity.X / 2f, velocity.Y / 2f);
31356 Dust dust2 = Main.dust[num952];
31357 dust2.velocity *= 2f;
31358 Main.dust[num952].noGravity = true;
31359 Main.dust[num952].scale = Utils.SelectRandom<float>(Main.rand, 0.8f, 1.65f);
31360 Main.dust[num952].customData = this;
31361 }
31362 }
31363 if (flag63)
31364 {
31365 alpha -= 5;
31366 if (alpha < 0)
31367 {
31368 alpha = 0;
31369 }
31370 if (direction == 0)
31371 {
31372 direction = Main.player[owner].direction;
31373 }
31374 if (++frameCounter >= 3)
31375 {
31376 frameCounter = 0;
31377 if (++frame >= Main.projFrames[type])
31378 {
31379 frame = 0;
31380 }
31381 }
31382 if (alpha == 0 && Main.rand.Next(15) == 0)
31383 {
31384 Dust dust56 = Main.dust[Dust.NewDust(base.Top, 0, 0, 261, 0f, 0f, 100)];
31385 dust56.velocity.X = 0f;
31386 dust56.noGravity = true;
31387 dust56.fadeIn = 1f;
31388 dust56.position = base.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f);
31389 dust56.scale = 0.5f;
31390 }
31391 localAI[0]++;
31392 if (localAI[0] >= 60f)
31393 {
31394 localAI[0] = 0f;
31395 }
31396 }
31397 if (this.ai[0] < 0f)
31398 {
31399 this.ai[0]++;
31400 if (flag62)
31401 {
31402 this.ai[1] -= (float)direction * ((float)Math.PI / 8f) / 50f;
31403 }
31404 }
31405 if (this.ai[0] == 0f)
31406 {
31407 int num953 = -1;
31408 float num954 = num951;
31410 if (ownerMinionAttackTargetNPC4 != null && ownerMinionAttackTargetNPC4.CanBeChasedBy(this))
31411 {
31413 if (num955 < num954 && Collision.CanHitLine(base.Center, 0, 0, ownerMinionAttackTargetNPC4.Center, 0, 0))
31414 {
31415 num954 = num955;
31417 }
31418 }
31419 if (num953 < 0)
31420 {
31421 for (int num956 = 0; num956 < 200; num956++)
31422 {
31423 NPC nPC14 = Main.npc[num956];
31424 if (nPC14.CanBeChasedBy(this))
31425 {
31426 float num957 = Distance(nPC14.Center);
31427 if (num957 < num954 && Collision.CanHitLine(base.Center, 0, 0, nPC14.Center, 0, 0))
31428 {
31429 num954 = num957;
31430 num953 = num956;
31431 }
31432 }
31433 }
31434 }
31435 if (num953 != -1)
31436 {
31437 this.ai[0] = 1f;
31438 this.ai[1] = num953;
31439 netUpdate = true;
31440 return;
31441 }
31442 }
31443 if (!(this.ai[0] > 0f))
31444 {
31445 return;
31446 }
31447 int num958 = (int)this.ai[1];
31448 if (!Main.npc[num958].CanBeChasedBy(this))
31449 {
31450 this.ai[0] = 0f;
31451 this.ai[1] = 0f;
31452 netUpdate = true;
31453 return;
31454 }
31455 this.ai[0]++;
31456 float num959 = 30f;
31457 if (flag62)
31458 {
31459 num959 = 10f;
31460 }
31461 if (flag63)
31462 {
31463 num959 = 5f;
31464 }
31465 if (!(this.ai[0] >= num959))
31466 {
31467 return;
31468 }
31469 Vector2 vector153 = DirectionTo(Main.npc[num958].Center);
31470 if (vector153.HasNaNs())
31471 {
31473 }
31474 float num960 = vector153.ToRotation();
31475 int num961 = ((vector153.X > 0f) ? 1 : (-1));
31476 if (flag62)
31477 {
31478 direction = num961;
31479 this.ai[0] = -20f;
31480 this.ai[1] = num960 + (float)num961 * (float)Math.PI / 6f;
31481 netUpdate = true;
31482 if (owner == Main.myPlayer)
31483 {
31484 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector153.X, vector153.Y, 642, damage, knockBack, owner, this.ai[1], whoAmI);
31485 }
31486 }
31487 if (!flag63)
31488 {
31489 return;
31490 }
31491 direction = num961;
31492 this.ai[0] = -20f;
31493 netUpdate = true;
31494 if (owner != Main.myPlayer)
31495 {
31496 return;
31497 }
31498 NPC nPC15 = Main.npc[num958];
31499 Vector2 vector154 = nPC15.position + nPC15.Size * Utils.RandomVector2(Main.rand, 0f, 1f) - base.Center;
31500 for (int num962 = 0; num962 < 3; num962++)
31501 {
31502 Vector2 other = base.Center + vector154;
31503 Vector2 vector155 = nPC15.velocity * 30f;
31504 other += vector155;
31505 float num963 = MathHelper.Lerp(0.1f, 0.75f, Utils.GetLerpValue(800f, 200f, Distance(other)));
31506 if (num962 > 0)
31507 {
31508 other = base.Center + vector154.RotatedByRandom(0.7853981852531433) * (Main.rand.NextFloat() * num963 + 0.5f);
31509 }
31510 float x8 = Main.rgbToHsl(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)).X;
31512 }
31513 }
31514 else if (aiStyle == 124)
31515 {
31516 bool flag64 = type == 650;
31517 Player player11 = Main.player[owner];
31518 if (player11.dead)
31519 {
31520 Kill();
31521 return;
31522 }
31523 if (type == 650 && player11.suspiciouslookingTentacle)
31524 {
31525 timeLeft = 2;
31526 }
31527 if (type == 882 && player11.petFlagEyeOfCthulhuPet)
31528 {
31529 timeLeft = 2;
31530 }
31531 if (type == 888 && player11.petFlagTwinsPet)
31532 {
31533 timeLeft = 2;
31534 }
31535 if (type == 895 && player11.petFlagFairyQueenPet)
31536 {
31537 timeLeft = 2;
31538 }
31539 if (type == 896 && player11.petFlagPumpkingPet)
31540 {
31541 timeLeft = 2;
31542 }
31543 if (type == 898 && player11.petFlagIceQueenPet)
31544 {
31545 timeLeft = 2;
31546 }
31547 if (type == 957 && player11.petFlagGlommerPet)
31548 {
31549 timeLeft = 2;
31550 }
31551 direction = (spriteDirection = player11.direction);
31552 if (type == 650)
31553 {
31554 Vector3 v3_ = new Vector3(0.5f, 0.9f, 1f) * 2f;
31555 DelegateMethods.v3_1 = v3_;
31556 Utils.PlotTileLine(base.Center, base.Center + velocity * 6f, 20f, DelegateMethods.CastLightOpen);
31557 Utils.PlotTileLine(base.Left, base.Right, 20f, DelegateMethods.CastLightOpen);
31558 Utils.PlotTileLine(player11.Center, player11.Center + player11.velocity * 6f, 40f, DelegateMethods.CastLightOpen);
31559 Utils.PlotTileLine(player11.Left, player11.Right, 40f, DelegateMethods.CastLightOpen);
31560 }
31561 if (type == 895)
31562 {
31563 Vector3 vector156 = new Vector3(1f, 0.6f, 1f) * 1.5f;
31564 DelegateMethods.v3_1 = vector156 * 0.75f;
31565 Utils.PlotTileLine(player11.Center, player11.Center + player11.velocity * 6f, 40f, DelegateMethods.CastLightOpen);
31566 Utils.PlotTileLine(player11.Left, player11.Right, 40f, DelegateMethods.CastLightOpen);
31567 DelegateMethods.v3_1 = vector156 * 1.5f;
31568 Utils.PlotTileLine(base.Center, base.Center + velocity * 6f, 30f, DelegateMethods.CastLightOpen);
31569 Utils.PlotTileLine(base.Left, base.Right, 20f, DelegateMethods.CastLightOpen);
31570 }
31571 if (type == 896)
31572 {
31573 Vector3 vector157 = new Vector3(1f, 0.7f, 0.05f) * 1.5f;
31574 DelegateMethods.v3_1 = vector157 * 0.75f;
31575 Utils.PlotTileLine(player11.Center, player11.Center + player11.velocity * 6f, 40f, DelegateMethods.CastLightOpen);
31576 Utils.PlotTileLine(player11.Left, player11.Right, 40f, DelegateMethods.CastLightOpen);
31577 DelegateMethods.v3_1 = vector157 * 1.5f;
31578 Utils.PlotTileLine(base.Center, base.Center + velocity * 6f, 30f, DelegateMethods.CastLightOpen);
31579 Utils.PlotTileLine(base.Left, base.Right, 20f, DelegateMethods.CastLightOpen);
31580 }
31581 float num964 = 30f;
31582 float y7 = -20f;
31583 int num965 = player11.direction;
31584 if (type == 882 && player11.ownedProjectileCounts[650] > 0)
31585 {
31586 num965 *= -1;
31587 }
31588 if (type == 888)
31589 {
31590 num964 = 30f;
31591 y7 = -50f;
31592 if (player11.ownedProjectileCounts[650] > 0)
31593 {
31594 y7 = -70f;
31595 }
31596 }
31597 if (type == 895)
31598 {
31599 num964 = -36f;
31600 y7 = -50f;
31601 }
31602 if (type == 896)
31603 {
31604 num964 = 30f;
31605 y7 = -60f;
31606 if (player11.ownedProjectileCounts[888] > 0)
31607 {
31608 num964 = -30f;
31609 }
31610 }
31611 if (type == 898)
31612 {
31613 num964 = -30f;
31614 y7 = -50f;
31615 if (player11.ownedProjectileCounts[895] > 0)
31616 {
31617 num964 = 30f;
31618 }
31619 }
31620 if (type == 957)
31621 {
31622 num964 = -40f;
31623 y7 = -40f;
31624 if (player11.ownedProjectileCounts[895] > 0)
31625 {
31626 num964 = 40f;
31627 }
31628 }
31629 Vector2 vector158 = new Vector2((float)num965 * num964, y7);
31630 Vector2 vector159 = player11.MountedCenter + vector158;
31631 float num966 = Vector2.Distance(base.Center, vector159);
31632 if (num966 > 1000f)
31633 {
31634 base.Center = player11.Center + vector158;
31635 }
31636 Vector2 vector160 = vector159 - base.Center;
31637 float num967 = 4f;
31638 if (num966 < num967)
31639 {
31640 velocity *= 0.25f;
31641 }
31642 if (vector160 != Vector2.Zero)
31643 {
31644 if (vector160.Length() < num967)
31645 {
31647 }
31648 else
31649 {
31650 velocity = vector160 * 0.1f;
31651 }
31652 }
31653 if (num966 > 50f && (type == 895 || type == 898 || type == 957))
31654 {
31655 direction = (spriteDirection = 1);
31656 if (velocity.X < 0f)
31657 {
31658 direction = (spriteDirection = -1);
31659 }
31660 }
31661 if (velocity.Length() > 6f)
31662 {
31663 if (type == 650)
31664 {
31665 float num968 = velocity.ToRotation() + (float)Math.PI / 2f;
31666 if (Math.Abs(rotation - num968) >= (float)Math.PI)
31667 {
31668 if (num968 < rotation)
31669 {
31670 rotation -= (float)Math.PI * 2f;
31671 }
31672 else
31673 {
31674 rotation += (float)Math.PI * 2f;
31675 }
31676 }
31677 float num969 = 12f;
31678 rotation = (rotation * (num969 - 1f) + num968) / num969;
31679 if (++frameCounter >= 4)
31680 {
31681 frameCounter = 0;
31682 if (++frame >= Main.projFrames[type])
31683 {
31684 frame = 0;
31685 }
31686 }
31687 }
31688 else if (type == 882)
31689 {
31690 rotation = velocity.X * 0.125f;
31691 if (++frameCounter >= 3)
31692 {
31693 frameCounter = 0;
31694 if (frame < 6)
31695 {
31696 frame = 6;
31697 }
31698 else
31699 {
31700 frame++;
31701 if (frame > 15)
31702 {
31703 frame = 10;
31704 }
31705 }
31706 }
31707 }
31708 else if (type == 888)
31709 {
31710 float num970 = velocity.ToRotation() + (float)Math.PI / 2f;
31711 if (Math.Abs(rotation - num970) >= (float)Math.PI)
31712 {
31713 if (num970 < rotation)
31714 {
31715 rotation -= (float)Math.PI * 2f;
31716 }
31717 else
31718 {
31719 rotation += (float)Math.PI * 2f;
31720 }
31721 }
31722 float num971 = 12f;
31723 rotation = (rotation * (num971 - 1f) + num970) / num971;
31724 if (++frameCounter >= 3)
31725 {
31726 frameCounter = 0;
31727 if (frame < 6)
31728 {
31729 frame = 6;
31730 }
31731 else
31732 {
31733 frame++;
31734 if (frame > 17)
31735 {
31736 frame = 6;
31737 }
31738 }
31739 }
31740 }
31741 else if (type == 895)
31742 {
31743 float num972 = velocity.X * 0.1f;
31744 if (Math.Abs(rotation - num972) >= (float)Math.PI)
31745 {
31746 if (num972 < rotation)
31747 {
31748 rotation -= (float)Math.PI * 2f;
31749 }
31750 else
31751 {
31752 rotation += (float)Math.PI * 2f;
31753 }
31754 }
31755 float num973 = 12f;
31756 rotation = (rotation * (num973 - 1f) + num972) / num973;
31757 if (++frameCounter >= 3)
31758 {
31759 frameCounter = 0;
31760 frame++;
31761 if (frame >= Main.projFrames[type])
31762 {
31763 frame = 0;
31764 }
31765 }
31766 if (frameCounter == 0)
31767 {
31768 int num974 = Dust.NewDust(base.position, width, height, 242, 0f, 0f, 50, default(Color), 2f);
31769 Main.dust[num974].noGravity = true;
31770 }
31771 }
31772 else if (type == 896)
31773 {
31774 float num975 = velocity.ToRotation() + (float)Math.PI / 2f;
31775 if (Math.Abs(rotation - num975) >= (float)Math.PI)
31776 {
31777 if (num975 < rotation)
31778 {
31779 rotation -= (float)Math.PI * 2f;
31780 }
31781 else
31782 {
31783 rotation += (float)Math.PI * 2f;
31784 }
31785 }
31786 float num976 = 12f;
31787 rotation = (rotation * (num976 - 1f) + num975) / num976;
31788 if (++frameCounter >= 4)
31789 {
31790 frameCounter = 0;
31791 if (frame < 8)
31792 {
31793 frame = 8;
31794 }
31795 else
31796 {
31797 frame++;
31798 if (frame >= Main.projFrames[type])
31799 {
31800 frame = 8;
31801 }
31802 }
31803 }
31804 }
31805 else if (type == 898)
31806 {
31807 float num977 = velocity.X * 0.1f;
31808 if (Math.Abs(rotation - num977) >= (float)Math.PI)
31809 {
31810 if (num977 < rotation)
31811 {
31812 rotation -= (float)Math.PI * 2f;
31813 }
31814 else
31815 {
31816 rotation += (float)Math.PI * 2f;
31817 }
31818 }
31819 float num978 = 12f;
31820 rotation = (rotation * (num978 - 1f) + num977) / num978;
31821 if (++frameCounter >= 3)
31822 {
31823 frameCounter = 0;
31824 frame++;
31825 if (frame >= Main.projFrames[type])
31826 {
31827 frame = 0;
31828 }
31829 }
31830 if (frameCounter == 0)
31831 {
31832 int num979 = Dust.NewDust(base.position, width, height, 80, 0f, 0f, 50);
31833 Main.dust[num979].noGravity = true;
31834 }
31835 }
31836 else if (type == 957)
31837 {
31838 float num980 = velocity.X * 0.05f;
31839 if (Math.Abs(rotation - num980) >= (float)Math.PI)
31840 {
31841 if (num980 < rotation)
31842 {
31843 rotation -= (float)Math.PI * 2f;
31844 }
31845 else
31846 {
31847 rotation += (float)Math.PI * 2f;
31848 }
31849 }
31850 float num981 = 12f;
31851 rotation = (rotation * (num981 - 1f) + num980) / num981;
31852 if (++frameCounter >= 4)
31853 {
31854 frameCounter = 0;
31855 frame++;
31856 if (frame >= Main.projFrames[type] * 2)
31857 {
31858 frame = 0;
31859 }
31860 }
31861 }
31862 }
31863 else if (type == 650)
31864 {
31865 if (rotation > (float)Math.PI)
31866 {
31867 rotation -= (float)Math.PI * 2f;
31868 }
31869 if (rotation > -0.005f && rotation < 0.005f)
31870 {
31871 rotation = 0f;
31872 }
31873 else
31874 {
31875 rotation *= 0.96f;
31876 }
31877 if (++frameCounter >= 6)
31878 {
31879 frameCounter = 0;
31880 if (++frame >= Main.projFrames[type])
31881 {
31882 frame = 0;
31883 }
31884 }
31885 }
31886 else if (type == 882)
31887 {
31888 rotation = velocity.X * 0.125f;
31889 if (++frameCounter >= 5)
31890 {
31891 frameCounter = 0;
31892 frame++;
31893 if (frame == 6 || frame >= Main.projFrames[type])
31894 {
31895 frame = 0;
31896 }
31897 }
31898 }
31899 else if (type == 888)
31900 {
31901 if (rotation > (float)Math.PI)
31902 {
31903 rotation -= (float)Math.PI * 2f;
31904 }
31905 if (rotation > -0.005f && rotation < 0.005f)
31906 {
31907 rotation = 0f;
31908 }
31909 else
31910 {
31911 rotation *= 0.96f;
31912 }
31913 if (++frameCounter >= 5)
31914 {
31915 frameCounter = 0;
31916 frame++;
31917 if (frame == 6 || frame >= 18)
31918 {
31919 frame = 0;
31920 }
31921 }
31922 }
31923 else if (type == 895)
31924 {
31925 if (rotation > (float)Math.PI)
31926 {
31927 rotation -= (float)Math.PI * 2f;
31928 }
31929 if (rotation > -0.005f && rotation < 0.005f)
31930 {
31931 rotation = 0f;
31932 }
31933 else
31934 {
31935 rotation *= 0.96f;
31936 }
31937 if (++frameCounter >= 5)
31938 {
31939 frameCounter = 0;
31940 frame++;
31941 if (frame >= Main.projFrames[type])
31942 {
31943 frame = 0;
31944 }
31945 }
31946 }
31947 else if (type == 896)
31948 {
31949 if (rotation > (float)Math.PI)
31950 {
31951 rotation -= (float)Math.PI * 2f;
31952 }
31953 if (rotation > -0.005f && rotation < 0.005f)
31954 {
31955 rotation = 0f;
31956 }
31957 else
31958 {
31959 rotation *= 0.96f;
31960 }
31961 if (++frameCounter >= 5)
31962 {
31963 frameCounter = 0;
31964 frame++;
31965 if (frame == 8 || frame >= Main.projFrames[type])
31966 {
31967 frame = 0;
31968 if (Main.rand.Next(15) == 0)
31969 {
31970 frame = 8;
31971 }
31972 }
31973 }
31974 }
31975 else if (type == 898)
31976 {
31977 if (rotation > (float)Math.PI)
31978 {
31979 rotation -= (float)Math.PI * 2f;
31980 }
31981 if (rotation > -0.005f && rotation < 0.005f)
31982 {
31983 rotation = 0f;
31984 }
31985 else
31986 {
31987 rotation *= 0.96f;
31988 }
31989 if (++frameCounter >= 5)
31990 {
31991 frameCounter = 0;
31992 frame++;
31993 if (frame >= Main.projFrames[type])
31994 {
31995 frame = 0;
31996 }
31997 }
31998 }
31999 else if (type == 957)
32000 {
32001 int num982 = Main.projFrames[type];
32002 if (rotation > (float)Math.PI)
32003 {
32004 rotation -= (float)Math.PI * 2f;
32005 }
32006 if (rotation > -0.005f && rotation < 0.005f)
32007 {
32008 rotation = 0f;
32009 }
32010 else
32011 {
32012 rotation *= 0.96f;
32013 }
32014 if (velocity.Length() <= 0.01f)
32015 {
32016 bool flag65 = true;
32017 int num983 = (int)base.Center.X / 16;
32018 int num984 = (int)base.Center.Y / 16;
32019 int num985 = 4;
32020 for (int num986 = 0; num986 < num985 + 1; num986++)
32021 {
32022 if (num983 < 0 || num983 >= Main.maxTilesX || num984 < 0 || num984 >= Main.maxTilesY)
32023 {
32024 flag65 = false;
32025 break;
32026 }
32027 bool flag66 = WorldGen.SolidTileAllowBottomSlope(num983, num984);
32028 if ((num986 == num985 && !flag66) || (num986 < num985 && flag66))
32029 {
32030 flag65 = false;
32031 break;
32032 }
32033 num984++;
32034 }
32035 if (flag65)
32036 {
32037 localAI[0]--;
32038 if (localAI[0] <= 0f)
32039 {
32040 localAI[0] = 0f;
32041 if (frame < num982 * 2)
32042 {
32043 frame = num982 * 2;
32044 }
32045 int num987 = 3;
32046 if (frame <= 30 && frame <= 33)
32047 {
32048 num987 = 2;
32049 }
32050 if (++frameCounter >= num987)
32051 {
32052 frameCounter = 0;
32053 frame++;
32054 if (frame >= num982 * 3)
32055 {
32056 localAI[0] = 200 + Main.rand.Next(150);
32057 frame = 0;
32058 }
32059 if (frame == 32)
32060 {
32062 }
32063 }
32064 }
32065 else if (++frameCounter >= 4)
32066 {
32067 frameCounter = 0;
32068 frame++;
32069 if (frame >= num982 * 2)
32070 {
32071 frame = 0;
32072 }
32073 }
32074 }
32075 else
32076 {
32077 localAI[0] = 300f;
32078 if (++frameCounter >= 4)
32079 {
32080 frameCounter = 0;
32081 frame++;
32082 if (frame >= num982 * 2)
32083 {
32084 frame = 0;
32085 }
32086 }
32087 }
32088 }
32089 else
32090 {
32091 localAI[0] = 300f;
32092 if (++frameCounter >= 4)
32093 {
32094 frameCounter = 0;
32095 frame++;
32096 if (frame >= num982 * 2)
32097 {
32098 frame = 0;
32099 }
32100 }
32101 }
32102 }
32103 if (flag64 && this.ai[0] > 0f && (this.ai[0] += 1f) >= 60f)
32104 {
32105 this.ai[0] = 0f;
32106 this.ai[1] = 0f;
32107 }
32108 if (flag64 && Main.rand.Next(15) == 0)
32109 {
32110 int num988 = -1;
32111 int num989 = -1;
32112 float num990 = -1f;
32113 int num991 = 17;
32114 if ((base.Center - player11.Center).Length() < (float)Main.screenWidth)
32115 {
32116 int num992 = (int)base.Center.X / 16;
32117 int num993 = (int)base.Center.Y / 16;
32118 num992 = (int)MathHelper.Clamp(num992, num991 + 1, Main.maxTilesX - num991 - 1);
32119 num993 = (int)MathHelper.Clamp(num993, num991 + 1, Main.maxTilesY - num991 - 1);
32120 for (int num994 = num992 - num991; num994 <= num992 + num991; num994++)
32121 {
32122 for (int num995 = num993 - num991; num995 <= num993 + num991; num995++)
32123 {
32124 int num996 = Main.rand.Next(8);
32125 if (num996 < 4 && new Vector2(num992 - num994, num993 - num995).Length() < (float)num991 && Main.tile[num994, num995] != null && Main.tile[num994, num995].active() && Main.IsTileSpelunkable(Main.tile[num994, num995]))
32126 {
32127 float num997 = Distance(new Vector2(num994 * 16 + 8, num995 * 16 + 8));
32128 if (num997 < num990 || num990 == -1f)
32129 {
32130 num990 = num997;
32131 num988 = num994;
32132 num989 = num995;
32133 this.ai[0] = 1f;
32134 this.ai[1] = AngleTo(new Vector2(num994 * 16 + 8, num995 * 16 + 8));
32135 }
32136 if (num996 < 2)
32137 {
32138 int num998 = Dust.NewDust(new Vector2(num994 * 16, num995 * 16), 16, 16, 204, 0f, 0f, 150, default(Color), 0.3f);
32139 Main.dust[num998].fadeIn = 0.75f;
32140 Dust dust2 = Main.dust[num998];
32141 dust2.velocity *= 0.1f;
32142 }
32143 }
32144 }
32145 }
32146 }
32147 }
32148 if (!flag64)
32149 {
32150 return;
32151 }
32152 float f3 = localAI[0] % ((float)Math.PI * 2f) - (float)Math.PI;
32153 float num999 = (float)Math.IEEERemainder(localAI[1], 1.0);
32154 if (num999 < 0f)
32155 {
32156 num999 += 1f;
32157 }
32158 float num1000 = (float)Math.Floor(localAI[1]);
32159 float max = 0.999f;
32160 float num1001 = 0f;
32161 int num1002 = 0;
32162 float amount2 = 0.1f;
32163 bool flag67 = player11.velocity.Length() > 3f;
32164 int num1003 = -1;
32165 int num1004 = -1;
32166 float num1005 = 300f;
32167 float num1006 = 500f;
32168 for (int num1007 = 0; num1007 < 200; num1007++)
32169 {
32170 NPC nPC16 = Main.npc[num1007];
32171 if (!nPC16.active || !nPC16.chaseable || nPC16.dontTakeDamage || nPC16.immortal)
32172 {
32173 continue;
32174 }
32175 float num1008 = Distance(nPC16.Center);
32176 if (nPC16.friendly || nPC16.lifeMax <= 5)
32177 {
32178 if (num1008 < num1005 && !flag67)
32179 {
32180 num1005 = num1008;
32181 num1004 = num1007;
32182 }
32183 }
32184 else if (num1008 < num1006)
32185 {
32186 num1006 = num1008;
32187 num1003 = num1007;
32188 }
32189 }
32190 if (flag67)
32191 {
32192 num1001 = AngleTo(base.Center + player11.velocity);
32193 num1002 = 1;
32194 num999 = MathHelper.Clamp(num999 + 0.05f, 0f, max);
32195 num1000 += (float)Math.Sign(-10f - num1000);
32196 }
32197 else if (num1003 != -1)
32198 {
32199 num1001 = AngleTo(Main.npc[num1003].Center);
32200 num1002 = 2;
32201 num999 = MathHelper.Clamp(num999 + 0.05f, 0f, max);
32202 num1000 += (float)Math.Sign(-12f - num1000);
32203 }
32204 else if (num1004 != -1)
32205 {
32206 num1001 = AngleTo(Main.npc[num1004].Center);
32207 num1002 = 3;
32208 num999 = MathHelper.Clamp(num999 + 0.05f, 0f, max);
32209 num1000 += (float)Math.Sign(6f - num1000);
32210 }
32211 else if (this.ai[0] > 0f)
32212 {
32213 num1001 = this.ai[1];
32214 num999 = MathHelper.Clamp(num999 + (float)Math.Sign(0.75f - num999) * 0.05f, 0f, max);
32215 num1002 = 4;
32216 num1000 += (float)Math.Sign(10f - num1000);
32217 if (Main.rand.Next(10) == 0)
32218 {
32219 int num1009 = Dust.NewDust(base.Center + f3.ToRotationVector2() * 6f * num999 - Vector2.One * 4f, 8, 8, 204, 0f, 0f, 150, default(Color), 0.3f);
32220 Main.dust[num1009].fadeIn = 0.75f;
32221 Dust dust2 = Main.dust[num1009];
32222 dust2.velocity *= 0.1f;
32223 }
32224 }
32225 else
32226 {
32227 num1001 = ((player11.direction == 1) ? 0f : 3.1416028f);
32228 num999 = MathHelper.Clamp(num999 + (float)Math.Sign(0.75f - num999) * 0.05f, 0f, max);
32229 num1000 += (float)Math.Sign(0f - num1000);
32230 amount2 = 0.12f;
32231 }
32232 Vector2 value19 = num1001.ToRotationVector2();
32233 num1001 = Vector2.Lerp(f3.ToRotationVector2(), value19, amount2).ToRotation();
32234 localAI[0] = num1001 + (float)num1002 * ((float)Math.PI * 2f) + (float)Math.PI;
32235 localAI[1] = num1000 + num999;
32236 }
32237 else if (aiStyle == 125)
32238 {
32239 Player player12 = Main.player[owner];
32240 if (Main.myPlayer == owner)
32241 {
32242 if (localAI[1] > 0f)
32243 {
32244 localAI[1]--;
32245 }
32246 if (player12.noItems || player12.CCed || player12.dead)
32247 {
32248 Kill();
32249 }
32250 else if (Main.mouseRight && Main.mouseRightRelease)
32251 {
32252 Kill();
32253 player12.mouseInterface = true;
32254 Main.blockMouse = true;
32255 }
32256 else if (!player12.channel)
32257 {
32258 if (localAI[0] == 0f)
32259 {
32260 localAI[0] = 1f;
32261 }
32262 Kill();
32263 }
32264 else if (localAI[1] == 0f)
32265 {
32266 Vector2 vector161 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY);
32267 if (player12.gravDir == -1f)
32268 {
32269 vector161.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y;
32270 }
32271 if (vector161 != base.Center)
32272 {
32273 netUpdate = true;
32274 base.Center = vector161;
32275 localAI[1] = 1f;
32276 }
32277 if (this.ai[0] == 0f && this.ai[1] == 0f)
32278 {
32279 this.ai[0] = (int)base.Center.X / 16;
32280 this.ai[1] = (int)base.Center.Y / 16;
32281 netUpdate = true;
32283 }
32284 }
32286 Point point4 = new Vector2(this.ai[0], this.ai[1]).ToPoint();
32287 Point point5 = base.Center.ToTileCoordinates();
32288 int num1010 = Math.Abs(point4.X - point5.X);
32289 int num1011 = Math.Abs(point4.Y - point5.Y);
32290 int num1012 = Math.Sign(point5.X - point4.X);
32291 int num1013 = Math.Sign(point5.Y - point4.Y);
32292 Point point6 = default(Point);
32293 bool flag68 = false;
32294 bool flag69 = player12.direction == 1;
32295 int num1014;
32296 int num1015;
32297 int num1016;
32298 if (flag69)
32299 {
32300 point6.X = point4.X;
32301 num1014 = point4.Y;
32302 num1015 = point5.Y;
32303 num1016 = num1013;
32304 }
32305 else
32306 {
32307 point6.Y = point4.Y;
32308 num1014 = point4.X;
32309 num1015 = point5.X;
32310 num1016 = num1012;
32311 }
32312 for (int num1017 = num1014; num1017 != num1015; num1017 += num1016)
32313 {
32314 if (flag68)
32315 {
32316 break;
32317 }
32318 if (flag69)
32319 {
32320 point6.Y = num1017;
32321 }
32322 else
32323 {
32324 point6.X = num1017;
32325 }
32326 if (WorldGen.InWorld(point6.X, point6.Y, 1))
32327 {
32328 Tile tile3 = Main.tile[point6.X, point6.Y];
32329 }
32330 }
32331 if (flag69)
32332 {
32333 point6.Y = point5.Y;
32334 num1014 = point4.X;
32335 num1015 = point5.X;
32336 num1016 = num1012;
32337 }
32338 else
32339 {
32340 point6.X = point5.X;
32341 num1014 = point4.Y;
32342 num1015 = point5.Y;
32343 num1016 = num1013;
32344 }
32345 for (int num1018 = num1014; num1018 != num1015; num1018 += num1016)
32346 {
32347 if (flag68)
32348 {
32349 break;
32350 }
32351 if (!flag69)
32352 {
32353 point6.Y = num1018;
32354 }
32355 else
32356 {
32357 point6.X = num1018;
32358 }
32359 if (WorldGen.InWorld(point6.X, point6.Y, 1))
32360 {
32361 Tile tile3 = Main.tile[point6.X, point6.Y];
32362 }
32363 }
32364 }
32365 int num1019 = Math.Sign(player12.velocity.X);
32366 if (num1019 != 0)
32367 {
32368 player12.ChangeDir(num1019);
32369 }
32370 player12.heldProj = whoAmI;
32371 player12.SetDummyItemTime(2);
32372 player12.itemRotation = 0f;
32373 }
32374 else if (aiStyle == 126)
32375 {
32376 int num1020 = Math.Sign(velocity.Y);
32377 int num1021 = ((num1020 != -1) ? 1 : 0);
32378 if (this.ai[0] == 0f)
32379 {
32380 if (!Collision.SolidCollision(base.position + new Vector2(0f, (num1020 == -1) ? (height - 48) : 0), width, 48) && !Collision.WetCollision(base.position + new Vector2(0f, (num1020 == -1) ? (height - 20) : 0), width, 20))
32381 {
32382 velocity = new Vector2(0f, (float)Math.Sign(velocity.Y) * 0.001f);
32383 this.ai[0] = 1f;
32384 this.ai[1] = 0f;
32385 timeLeft = 60;
32386 }
32387 this.ai[1]++;
32388 if (this.ai[1] >= 60f)
32389 {
32390 Kill();
32391 }
32392 for (int num1022 = 0; num1022 < 3; num1022++)
32393 {
32394 int num1023 = Dust.NewDust(base.position, width, height, 31, 0f, 0f, 100);
32395 Main.dust[num1023].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
32396 Main.dust[num1023].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f;
32397 Main.dust[num1023].noGravity = true;
32398 Main.dust[num1023].position = base.Center + new Vector2(0f, -height / 2).RotatedBy(rotation) * 1.1f;
32399 }
32400 }
32401 if (this.ai[0] != 1f)
32402 {
32403 return;
32404 }
32405 velocity = new Vector2(0f, (float)Math.Sign(velocity.Y) * 0.001f);
32406 if (num1020 != 0)
32407 {
32408 int num1024 = 16;
32409 int num1025 = 320;
32410 if (type == 670)
32411 {
32412 num1025 -= (int)Math.Abs(localAI[1]) * 64;
32413 }
32414 for (; num1024 < num1025 && !Collision.SolidCollision(base.position + new Vector2(0f, (num1020 == -1) ? (height - num1024 - 16) : 0), width, num1024 + 16); num1024 += 16)
32415 {
32416 }
32417 if (num1020 == -1)
32418 {
32419 base.position.Y += height;
32420 height = num1024;
32421 base.position.Y -= num1024;
32422 }
32423 else
32424 {
32425 height = num1024;
32426 }
32427 }
32428 this.ai[1]++;
32429 if (type == 670 && owner == Main.myPlayer && this.ai[1] == 12f && localAI[1] < 3f && localAI[1] > -3f)
32430 {
32431 if (localAI[1] == 0f)
32432 {
32434 Main.projectile[num1026].localAI[1] = localAI[1] - 1f;
32436 Main.projectile[num1026].localAI[1] = localAI[1] + 1f;
32437 }
32438 else
32439 {
32440 int num1027 = Math.Sign(localAI[1]);
32442 Main.projectile[num1028].localAI[1] = localAI[1] + (float)num1027;
32443 }
32444 }
32445 if (this.ai[1] >= 60f)
32446 {
32447 Kill();
32448 }
32449 if (localAI[0] == 0f)
32450 {
32451 localAI[0] = 1f;
32452 for (int num1029 = 0; (float)num1029 < 60f; num1029++)
32453 {
32454 int num1030 = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
32455 int num1031 = Dust.NewDust(base.position, width, height, num1030, 0f, -2.5f * (float)(-num1020));
32456 Main.dust[num1031].alpha = 200;
32457 Dust dust2 = Main.dust[num1031];
32458 dust2.velocity *= new Vector2(0.3f, 2f);
32459 Main.dust[num1031].velocity.Y += 2 * num1020;
32460 dust2 = Main.dust[num1031];
32461 dust2.scale += Main.rand.NextFloat();
32462 Main.dust[num1031].position = new Vector2(base.Center.X, base.Center.Y + (float)height * 0.5f * (float)(-num1020));
32463 Main.dust[num1031].customData = num1021;
32464 if (num1020 == -1 && Main.rand.Next(4) != 0)
32465 {
32466 Main.dust[num1031].velocity.Y -= 0.2f;
32467 }
32468 }
32470 }
32471 if (num1020 == 1)
32472 {
32473 for (int num1032 = 0; (float)num1032 < 9f; num1032++)
32474 {
32475 int num1033 = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
32476 int num1034 = Dust.NewDust(base.position, width, height, num1033, 0f, -2.5f * (float)(-num1020));
32477 Main.dust[num1034].alpha = 200;
32478 Dust dust2 = Main.dust[num1034];
32479 dust2.velocity *= new Vector2(0.3f, 2f);
32480 Main.dust[num1034].velocity.Y += 2 * num1020;
32481 dust2 = Main.dust[num1034];
32482 dust2.scale += Main.rand.NextFloat();
32483 Main.dust[num1034].position = new Vector2(base.Center.X, base.Center.Y + (float)height * 0.5f * (float)(-num1020));
32484 Main.dust[num1034].customData = num1021;
32485 if (num1020 == -1 && Main.rand.Next(4) != 0)
32486 {
32487 Main.dust[num1034].velocity.Y -= 0.2f;
32488 }
32489 }
32490 }
32491 int num1035 = (int)(this.ai[1] / 60f * (float)height) * 3;
32492 if (num1035 > height)
32493 {
32494 num1035 = height;
32495 }
32496 Vector2 vector162 = base.position + ((num1020 == -1) ? new Vector2(0f, height - num1035) : Vector2.Zero);
32497 Vector2 vector163 = base.position + ((num1020 == -1) ? new Vector2(0f, height) : Vector2.Zero);
32498 for (int num1036 = 0; (float)num1036 < 6f; num1036++)
32499 {
32500 if (Main.rand.Next(3) < 2)
32501 {
32502 int num1037 = Dust.NewDust(vector162, width, num1035, 6, 0f, 0f, 90, default(Color), 2.5f);
32503 Main.dust[num1037].noGravity = true;
32504 Main.dust[num1037].fadeIn = 1f;
32505 if (Main.dust[num1037].velocity.Y > 0f)
32506 {
32507 Main.dust[num1037].velocity.Y *= -1f;
32508 }
32509 if (Main.rand.Next(6) < 3)
32510 {
32511 Main.dust[num1037].position.Y = MathHelper.Lerp(Main.dust[num1037].position.Y, vector163.Y, 0.5f);
32512 Dust dust2 = Main.dust[num1037];
32513 dust2.velocity *= 5f;
32514 Main.dust[num1037].velocity.Y -= 3f;
32515 Main.dust[num1037].position.X = base.Center.X;
32516 Main.dust[num1037].noGravity = false;
32517 Main.dust[num1037].noLight = true;
32518 Main.dust[num1037].fadeIn = 0.4f;
32519 dust2 = Main.dust[num1037];
32520 dust2.scale *= 0.3f;
32521 }
32522 else
32523 {
32524 Main.dust[num1037].velocity = DirectionFrom(Main.dust[num1037].position) * Main.dust[num1037].velocity.Length() * 0.25f;
32525 }
32526 Main.dust[num1037].velocity.Y *= -num1020;
32527 Main.dust[num1037].customData = num1021;
32528 }
32529 }
32530 for (int num1038 = 0; (float)num1038 < 6f; num1038++)
32531 {
32532 if (!(Main.rand.NextFloat() < 0.5f))
32533 {
32534 int num1039 = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
32535 int num1040 = Dust.NewDust(vector162, width, num1035, num1039, 0f, -2.5f * (float)(-num1020));
32536 Main.dust[num1040].alpha = 200;
32537 Dust dust2 = Main.dust[num1040];
32538 dust2.velocity *= new Vector2(0.6f, 1.5f);
32539 dust2 = Main.dust[num1040];
32540 dust2.scale += Main.rand.NextFloat();
32541 if (num1020 == -1 && Main.rand.Next(4) != 0)
32542 {
32543 Main.dust[num1040].velocity.Y -= 0.2f;
32544 }
32545 Main.dust[num1040].customData = num1021;
32546 }
32547 }
32548 }
32549 else if (aiStyle == 127)
32550 {
32551 float num1041 = 900f;
32552 if (type == 657)
32553 {
32554 num1041 = 300f;
32555 }
32556 if (soundDelay == 0)
32557 {
32558 soundDelay = -1;
32560 }
32561 this.ai[0]++;
32562 if (this.ai[0] >= num1041)
32563 {
32564 Kill();
32565 }
32566 if (type == 656 && localAI[0] >= 30f)
32567 {
32568 damage = 0;
32569 if (this.ai[0] < num1041 - 120f)
32570 {
32571 float num1042 = this.ai[0] % 60f;
32572 this.ai[0] = num1041 - 120f + num1042;
32573 netUpdate = true;
32574 }
32575 }
32576 float num1043 = 15f;
32577 float num1044 = 15f;
32578 Point point7 = base.Center.ToTileCoordinates();
32579 Collision.ExpandVertically(point7.X, point7.Y, out var topY, out var bottomY, (int)num1043, (int)num1044);
32580 topY++;
32581 bottomY--;
32582 Vector2 value20 = new Vector2(point7.X, topY) * 16f + new Vector2(8f);
32583 Vector2 value21 = new Vector2(point7.X, bottomY) * 16f + new Vector2(8f);
32585 Vector2 vector165 = new Vector2(0f, value21.Y - value20.Y);
32586 vector165.X = vector165.Y * 0.2f;
32587 width = (int)(vector165.X * 0.65f);
32588 height = (int)vector165.Y;
32589 base.Center = vector164;
32590 if (type == 656 && owner == Main.myPlayer)
32591 {
32592 bool flag70 = false;
32593 Vector2 center20 = Main.player[owner].Center;
32594 Vector2 top = Main.player[owner].Top;
32595 for (float num1045 = 0f; num1045 < 1f; num1045 += 0.05f)
32596 {
32598 if (Collision.CanHitLine(position, 0, 0, center20, 0, 0) || Collision.CanHitLine(position, 0, 0, top, 0, 0))
32599 {
32600 flag70 = true;
32601 break;
32602 }
32603 }
32604 if (!flag70 && this.ai[0] < num1041 - 120f)
32605 {
32606 float num1046 = this.ai[0] % 60f;
32607 this.ai[0] = num1041 - 120f + num1046;
32608 netUpdate = true;
32609 }
32610 }
32611 if (!(this.ai[0] < num1041 - 120f))
32612 {
32613 return;
32614 }
32615 for (int num1047 = 0; num1047 < 1; num1047++)
32616 {
32617 float value22 = -0.5f;
32618 float value23 = 0.9f;
32619 float amount3 = Main.rand.NextFloat();
32620 Vector2 vector166 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value22, value23, amount3));
32621 vector166.X *= MathHelper.Lerp(2.2f, 0.6f, amount3);
32622 vector166.X *= -1f;
32623 Vector2 vector167 = new Vector2(6f, 10f);
32625 Dust dust57 = Main.dust[Dust.NewDust(vector168, 0, 0, 269)];
32626 dust57.position = vector168;
32627 dust57.customData = vector164 + vector167;
32628 dust57.fadeIn = 1f;
32629 dust57.scale = 0.3f;
32630 if (vector166.X > -1.2f)
32631 {
32632 dust57.velocity.X = 1f + Main.rand.NextFloat();
32633 }
32634 dust57.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f;
32635 }
32636 }
32637 else if (aiStyle == 128)
32638 {
32639 Color newColor4 = new Color(255, 255, 255);
32640 if (soundDelay == 0)
32641 {
32642 soundDelay = -1;
32644 }
32645 if (localAI[1] < 30f)
32646 {
32647 for (int num1048 = 0; num1048 < 1; num1048++)
32648 {
32649 float value24 = -0.5f;
32650 float value25 = 0.9f;
32651 float amount4 = Main.rand.NextFloat();
32652 Vector2 vector169 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value24, value25, amount4));
32653 vector169.X *= MathHelper.Lerp(2.2f, 0.6f, amount4);
32654 vector169.X *= -1f;
32655 Vector2 vector170 = new Vector2(2f, 10f);
32656 Vector2 vector171 = base.Center + new Vector2(60f, 200f) * vector169 * 0.5f + vector170;
32657 Dust dust58 = Main.dust[Dust.NewDust(vector171, 0, 0, 269)];
32658 dust58.position = vector171;
32659 dust58.customData = base.Center + vector170;
32660 dust58.fadeIn = 1f;
32661 dust58.scale = 0.3f;
32662 if (vector169.X > -1.2f)
32663 {
32664 dust58.velocity.X = 1f + Main.rand.NextFloat();
32665 }
32666 dust58.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f;
32667 }
32668 }
32669 if (localAI[0] == 0f)
32670 {
32671 localAI[0] = 0.8f;
32672 direction = 1;
32673 Point point8 = base.Center.ToTileCoordinates();
32674 base.Center = new Vector2(point8.X * 16 + 8, point8.Y * 16 + 8);
32675 }
32676 rotation = localAI[1] / 40f * ((float)Math.PI * 2f) * (float)direction;
32677 if (localAI[1] < 33f)
32678 {
32679 if (alpha > 0)
32680 {
32681 alpha -= 8;
32682 }
32683 if (alpha < 0)
32684 {
32685 alpha = 0;
32686 }
32687 }
32688 if (localAI[1] > 103f)
32689 {
32690 if (alpha < 255)
32691 {
32692 alpha += 16;
32693 }
32694 if (alpha > 255)
32695 {
32696 alpha = 255;
32697 }
32698 }
32699 if (alpha == 0)
32700 {
32701 Lighting.AddLight(base.Center, newColor4.ToVector3() * 0.5f);
32702 }
32703 for (int num1049 = 0; num1049 < 2; num1049++)
32704 {
32705 if (Main.rand.Next(10) == 0)
32706 {
32707 Vector2 vector172 = Vector2.UnitY.RotatedBy((float)num1049 * (float)Math.PI).RotatedBy(rotation);
32708 Dust dust59 = Main.dust[Dust.NewDust(base.Center, 0, 0, 267, 0f, 0f, 225, newColor4, 1.5f)];
32709 dust59.noGravity = true;
32710 dust59.noLight = true;
32711 dust59.scale = Opacity * localAI[0];
32712 dust59.position = base.Center;
32713 dust59.velocity = vector172 * 2.5f;
32714 }
32715 }
32716 for (int num1050 = 0; num1050 < 2; num1050++)
32717 {
32718 if (Main.rand.Next(10) == 0)
32719 {
32720 Vector2 vector173 = Vector2.UnitY.RotatedBy((float)num1050 * (float)Math.PI);
32721 Dust dust60 = Main.dust[Dust.NewDust(base.Center, 0, 0, 267, 0f, 0f, 225, newColor4, 1.5f)];
32722 dust60.noGravity = true;
32723 dust60.noLight = true;
32724 dust60.scale = Opacity * localAI[0];
32725 dust60.position = base.Center;
32726 dust60.velocity = vector173 * 2.5f;
32727 }
32728 }
32729 if (localAI[1] < 33f || localAI[1] > 87f)
32730 {
32731 scale = Opacity / 2f * localAI[0];
32732 }
32734 localAI[1]++;
32735 if (localAI[1] == 60f && owner == Main.myPlayer)
32736 {
32737 int num1051 = 30;
32738 if (Main.expertMode)
32739 {
32740 num1051 = 22;
32741 }
32743 }
32744 if (localAI[1] >= 120f)
32745 {
32746 Kill();
32747 }
32748 }
32749 else if (aiStyle == 129)
32750 {
32751 float num1052 = 10f;
32752 float num1053 = 5f;
32753 float num1054 = 40f;
32754 int num1055 = 300;
32755 int num1056 = 180;
32756 if (type == 659)
32757 {
32758 num1055 = 420;
32759 num1056 = 240;
32760 num1052 = 3f;
32761 num1053 = 7.5f;
32762 num1054 = 1f;
32763 if (localAI[0] > 0f)
32764 {
32765 localAI[0]--;
32766 }
32767 if (localAI[0] == 0f && this.ai[0] < 0f && owner == Main.myPlayer)
32768 {
32769 localAI[0] = 5f;
32770 for (int num1057 = 0; num1057 < 200; num1057++)
32771 {
32772 NPC nPC17 = Main.npc[num1057];
32773 if (nPC17.CanBeChasedBy(this))
32774 {
32775 bool flag71 = this.ai[0] < 0f || Main.npc[(int)this.ai[0]].Distance(base.Center) > nPC17.Distance(base.Center);
32776 if ((flag71 & (nPC17.Distance(base.Center) < 400f)) && (Collision.CanHitLine(base.Center, 0, 0, nPC17.Center, 0, 0) || Collision.CanHitLine(base.Center, 0, 0, nPC17.Top, 0, 0)))
32777 {
32778 this.ai[0] = num1057;
32779 }
32780 }
32781 }
32782 if (this.ai[0] >= 0f)
32783 {
32784 timeLeft = num1055;
32785 netUpdate = true;
32786 }
32787 }
32788 if (timeLeft > 30 && alpha > 0)
32789 {
32790 alpha -= 12;
32791 }
32792 if (timeLeft > 30 && alpha < 128 && Collision.SolidCollision(base.position, width, height))
32793 {
32794 alpha = 128;
32795 }
32796 if (alpha < 0)
32797 {
32798 alpha = 0;
32799 }
32800 if (++frameCounter > 4)
32801 {
32802 frameCounter = 0;
32803 if (++frame >= 4)
32804 {
32805 frame = 0;
32806 }
32807 }
32808 float num1058 = 0.5f;
32809 if (timeLeft < 120)
32810 {
32811 num1058 = 1.1f;
32812 }
32813 if (timeLeft < 60)
32814 {
32815 num1058 = 1.6f;
32816 }
32817 this.ai[1]++;
32818 float num1059 = this.ai[1] / 180f * ((float)Math.PI * 2f);
32819 for (float num1060 = 0f; num1060 < 3f; num1060++)
32820 {
32821 if (Main.rand.Next(3) == 0)
32822 {
32823 Dust dust61 = Main.dust[Dust.NewDust(base.Center, 0, 0, 27, 0f, -2f)];
32824 dust61.position = base.Center + Vector2.UnitY.RotatedBy(num1060 * ((float)Math.PI * 2f) / 3f + this.ai[1]) * 10f;
32825 dust61.noGravity = true;
32826 dust61.velocity = DirectionFrom(dust61.position);
32827 dust61.scale = num1058;
32828 dust61.fadeIn = 0.5f;
32829 dust61.alpha = 200;
32830 }
32831 }
32832 }
32833 if (timeLeft > 2 && Collision.SolidCollision(base.position, width, height))
32834 {
32835 timeLeft = 2;
32836 }
32837 int num1061 = (int)this.ai[0];
32838 if (num1061 >= 0 && Main.npc[num1061].active)
32839 {
32840 if (Distance(Main.npc[num1061].Center) > num1054)
32841 {
32842 Vector2 vector174 = DirectionTo(Main.npc[num1061].Center);
32843 if (vector174.HasNaNs())
32844 {
32846 }
32847 velocity = (velocity * (num1052 - 1f) + vector174 * num1053) / num1052;
32848 }
32849 return;
32850 }
32851 if (this.ai[0] == -1f && timeLeft > 5)
32852 {
32853 timeLeft = 5;
32854 }
32855 if (this.ai[0] == -2f && timeLeft > num1056)
32856 {
32857 timeLeft = num1056;
32858 }
32859 if (this.ai[0] >= 0f)
32860 {
32861 this.ai[0] = -1f;
32862 netUpdate = true;
32863 }
32864 }
32865 else if (aiStyle == 130)
32866 {
32868 }
32869 else if (aiStyle == 131)
32870 {
32872 }
32873 else if (aiStyle == 132)
32874 {
32875 if (localAI[1] == 0f)
32876 {
32877 if (localAI[0] == 0f)
32878 {
32880 }
32881 if (localAI[0] == 105f)
32882 {
32883 for (int num1062 = 0; num1062 < 20; num1062++)
32884 {
32885 float num1063 = (float)num1062 / 20f;
32886 Vector2 vector175 = new Vector2(Main.rand.NextFloat() * 10f, 0f).RotatedBy(num1063 * -(float)Math.PI + Main.rand.NextFloat() * 0.1f - 0.05f);
32887 Gore gore2 = Gore.NewGoreDirect(base.Center + vector175 * 3f, vector175, Utils.SelectRandom<int>(Main.rand, 1027, 1028, 1029, 1030));
32888 if (gore2.velocity.Y > 0f)
32889 {
32890 Gore gore = gore2;
32891 gore.velocity *= -0.5f;
32892 }
32893 if (gore2.velocity.Y < -5f)
32894 {
32895 gore2.velocity.Y *= 0.8f;
32896 }
32897 gore2.velocity.Y *= 1.1f;
32898 gore2.velocity.X *= 0.88f;
32899 }
32900 }
32901 if (!Main.dedServ)
32902 {
32903 if (!Filters.Scene["CrystalDestructionVortex"].IsActive())
32904 {
32905 Filters.Scene.Activate("CrystalDestructionVortex", default(Vector2));
32906 }
32907 if (!Filters.Scene["CrystalDestructionColor"].IsActive())
32908 {
32909 Filters.Scene.Activate("CrystalDestructionColor", default(Vector2));
32910 }
32911 float num1064 = Math.Min(1f, localAI[0] / 120f);
32912 Filters.Scene["CrystalDestructionColor"].GetShader().UseIntensity(num1064);
32913 Filters.Scene["CrystalDestructionVortex"].GetShader().UseIntensity(num1064 * 2f).UseProgress(0f)
32914 .UseTargetPosition(base.Center);
32915 }
32916 if (localAI[0] == 120f)
32917 {
32918 localAI[0] = 0f;
32919 localAI[1]++;
32920 }
32921 }
32922 else if (localAI[1] == 1f)
32923 {
32924 if (!Main.dedServ)
32925 {
32926 float num1065 = localAI[0] / 300f;
32927 float num1066 = Math.Min(1f, localAI[0] / 150f);
32928 velocity.Y = num1066 * -0.25f;
32929 if (!Filters.Scene["CrystalDestructionVortex"].IsActive())
32930 {
32931 Filters.Scene.Activate("CrystalDestructionVortex", default(Vector2));
32932 }
32933 if (!Filters.Scene["CrystalDestructionColor"].IsActive())
32934 {
32935 Filters.Scene.Activate("CrystalDestructionColor", default(Vector2));
32936 }
32937 num1066 = 1f;
32938 Filters.Scene["CrystalDestructionColor"].GetShader().UseIntensity(num1066);
32939 Filters.Scene["CrystalDestructionVortex"].GetShader().UseIntensity(num1066 * 2f).UseProgress(0f)
32940 .UseTargetPosition(base.Center);
32941 }
32942 if (localAI[0] == 300f)
32943 {
32944 localAI[0] = 0f;
32945 localAI[1]++;
32946 }
32947 }
32948 else if (localAI[1] == 2f)
32949 {
32950 float num1067 = localAI[0] / 300f;
32951 if (Main.netMode != 2)
32952 {
32953 Filters.Scene["CrystalDestructionVortex"].GetShader().UseIntensity(2f).UseProgress(num1067 * 30f);
32954 }
32955 velocity.Y -= 1f;
32956 if (localAI[0] == 60f)
32957 {
32958 localAI[0] = 0f;
32959 localAI[1]++;
32960 }
32961 }
32962 else if (localAI[1] == 3f)
32963 {
32964 if (!Main.dedServ)
32965 {
32966 Filters.Scene.Deactivate("CrystalDestructionVortex");
32967 Filters.Scene.Deactivate("CrystalDestructionColor");
32968 }
32969 Kill();
32970 }
32971 if (localAI[1] >= 1f)
32972 {
32973 for (int num1068 = 0; num1068 < 1 + (int)(0f - velocity.Y); num1068++)
32974 {
32975 if (Main.rand.Next(2) == 0)
32976 {
32977 float num1069 = Main.rand.NextFloat() * (0f - velocity.Y);
32978 Vector2 vector176 = new Vector2(Main.rand.NextFloat() * 0.1f - 0.05f, 0f);
32979 vector176.X += (float)Math.Sin((double)((base.position.Y + num1069) * 0.01f) + 6.2831854820251465 * ((double)Main.rand.Next(3) / 3.0)) * 0.5f;
32980 vector176.X = MathHelper.Lerp(Main.rand.NextFloat() - 0.5f, vector176.X, MathHelper.Clamp(0f - velocity.Y, 0f, 1f));
32981 vector176.Y = 0.5f - Math.Abs(vector176.X);
32982 vector176 *= new Vector2(100f, 50f);
32983 vector176.Y += num1069;
32984 Vector2 vector177 = base.Center + vector176;
32985 Dust dust62 = Dust.NewDustPerfect(vector177, 27, Vector2.Zero, 0, Color.White * 0.1f, 1.1f);
32986 dust62.velocity.Y = Main.rand.NextFloat() * 2f;
32987 dust62.fadeIn = 0.1f;
32988 }
32989 }
32990 }
32991 localAI[0]++;
32992 }
32993 else if (aiStyle == 133)
32994 {
32995 if (type == 673)
32996 {
32997 if (this.ai[0] == 70f)
32998 {
33000 }
33001 this.ai[0]++;
33002 float opacity = 0f;
33003 if (this.ai[0] < 20f)
33004 {
33005 opacity = Utils.GetLerpValue(0f, 20f, this.ai[0], clamped: true);
33006 }
33007 else if (this.ai[0] < 60f)
33008 {
33009 opacity = 1f;
33010 }
33011 else if (this.ai[0] < 80f)
33012 {
33013 opacity = Utils.GetLerpValue(80f, 60f, this.ai[0], clamped: true);
33014 }
33015 else
33016 {
33017 Kill();
33018 }
33019 Opacity = opacity;
33020 _ = owner;
33021 _ = Main.myPlayer;
33022 }
33023 if (type != 674)
33024 {
33025 return;
33026 }
33027 if (this.ai[0] == 0f)
33028 {
33030 }
33031 this.ai[0]++;
33032 if (!(this.ai[0] >= 40f))
33033 {
33034 return;
33035 }
33036 for (int num1070 = 0; num1070 < 200; num1070++)
33037 {
33038 NPC nPC18 = Main.npc[num1070];
33039 if (nPC18.active && nPC18.damage >= 1 && nPC18.lifeMax >= 30 && !(Distance(nPC18.Center) > 1000f) && nPC18.type != 564 && nPC18.type != 565)
33040 {
33041 int num1071 = 500;
33042 int num1072 = nPC18.lifeMax - nPC18.life;
33043 if (num1071 > num1072)
33044 {
33045 num1071 = num1072;
33046 }
33047 if (num1071 > 0)
33048 {
33049 NPC nPC13 = nPC18;
33050 nPC13.life += num1071;
33051 nPC18.HealEffect(num1071);
33052 nPC18.netUpdate = true;
33053 }
33054 }
33055 }
33056 Kill();
33057 }
33058 else if (aiStyle == 134)
33059 {
33061 }
33062 else if (aiStyle == 135)
33063 {
33065 }
33066 else if (aiStyle == 136)
33067 {
33069 }
33070 else if (aiStyle == 137)
33071 {
33073 }
33074 else if (aiStyle == 138)
33075 {
33077 }
33078 else if (aiStyle == 139)
33079 {
33081 }
33082 else if (aiStyle == 140)
33083 {
33085 }
33086 else if (aiStyle == 141)
33087 {
33089 }
33090 else if (aiStyle == 142)
33091 {
33093 }
33094 else if (aiStyle == 143)
33095 {
33097 }
33098 else if (aiStyle == 144)
33099 {
33100 AI_144_DD2Pet();
33101 }
33102 else if (aiStyle == 145)
33103 {
33105 }
33106 else if (aiStyle == 146)
33107 {
33109 }
33110 else if (aiStyle == 147)
33111 {
33113 }
33114 else if (aiStyle == 148)
33115 {
33117 }
33118 else if (aiStyle == 149)
33119 {
33121 }
33122 else if (aiStyle == 150)
33123 {
33125 }
33126 else if (aiStyle == 151)
33127 {
33129 }
33130 else if (aiStyle == 152)
33131 {
33133 }
33134 else if (aiStyle == 153)
33135 {
33137 }
33138 else if (aiStyle == 154)
33139 {
33141 }
33142 else if (aiStyle == 155)
33143 {
33145 }
33146 else if (aiStyle == 156)
33147 {
33149 }
33150 else if (aiStyle == 157)
33151 {
33153 }
33154 else if (aiStyle == 158)
33155 {
33157 }
33158 else if (aiStyle == 159)
33159 {
33161 }
33162 else if (aiStyle == 160)
33163 {
33164 AI_160_Kites();
33165 }
33166 else if (aiStyle == 161)
33167 {
33169 }
33170 else if (aiStyle == 162)
33171 {
33173 }
33174 else if (aiStyle == 163)
33175 {
33176 AI_163_Chum();
33177 }
33178 else if (aiStyle == 164)
33179 {
33181 }
33182 else if (aiStyle == 165)
33183 {
33184 AI_165_Whip();
33185 }
33186 else if (aiStyle == 166)
33187 {
33188 AI_166_Dove();
33189 }
33190 else if (aiStyle == 167)
33191 {
33193 }
33194 else if (aiStyle == 168)
33195 {
33197 }
33198 else if (aiStyle == 169)
33199 {
33201 }
33202 else if (aiStyle == 170)
33203 {
33205 }
33206 else if (aiStyle == 171)
33207 {
33209 }
33210 else if (aiStyle == 172)
33211 {
33213 }
33214 else if (aiStyle == 173)
33215 {
33217 }
33218 else if (aiStyle == 174)
33219 {
33221 }
33222 else if (aiStyle == 175)
33223 {
33225 }
33226 else if (aiStyle == 176)
33227 {
33229 }
33230 else if (aiStyle == 177)
33231 {
33233 }
33234 else if (aiStyle == 178)
33235 {
33237 }
33238 else if (aiStyle == 179)
33239 {
33241 }
33242 else if (aiStyle == 180)
33243 {
33245 }
33246 else if (aiStyle == 181)
33247 {
33249 }
33250 else if (aiStyle == 182)
33251 {
33253 }
33254 else if (aiStyle == 183)
33255 {
33257 }
33258 else if (aiStyle == 184)
33259 {
33261 }
33262 else if (aiStyle == 185)
33263 {
33265 }
33266 else if (aiStyle == 186)
33267 {
33269 }
33270 else if (aiStyle == 187)
33271 {
33273 }
33274 else if (aiStyle == 188)
33275 {
33277 }
33278 else if (aiStyle == 189)
33279 {
33281 }
33282 else if (aiStyle == 190)
33283 {
33285 }
33286 else if (aiStyle == 191)
33287 {
33289 }
33290 else if (aiStyle == 192)
33291 {
33293 }
33294 else if (aiStyle == 193)
33295 {
33297 }
33298 else if (aiStyle == 194)
33299 {
33301 }
33302 else if (aiStyle == 195)
33303 {
33305 }
33306 }
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static float WrapAngle(float angle)
Definition MathHelper.cs:87
static float Clamp(float value, float min, float max)
Definition MathHelper.cs:46
static double Cos(double d)
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static double Atan2(double y, double x)
static double Sqrt(double d)
static double IEEERemainder(double x, double y)
Definition Math.cs:679
static double Abs(double value)
static double Sin(double a)
const double PI
Definition Math.cs:16
static double Floor(double d)
static int Sign(decimal value)
Definition Math.cs:1202
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static SlotId PlayTrackedSound(SoundStyle style, Vector2 position)
static void PlaySound(int type, Vector2 position, int style=1)
static ActiveSound GetActiveSound(SlotId id)
Vector2 DirectionFrom(Vector2 Source)
Definition Entity.cs:202
float AngleTo(Vector2 Destination)
Definition Entity.cs:177
bool honeyWet
Definition Entity.cs:34
Vector2 Center
Definition Entity.cs:43
bool shimmerWet
Definition Entity.cs:32
Vector2 velocity
Definition Entity.cs:16
float Distance(Vector2 Other)
Definition Entity.cs:187
Vector2 position
Definition Entity.cs:14
Vector2 oldVelocity
Definition Entity.cs:20
Vector2 DirectionTo(Vector2 Destination)
Definition Entity.cs:197
static void BroadcastParticleSpawn(ParticleOrchestraType type, ParticleOrchestraSettings settings)
static void RequestParticleSpawn(bool clientOnly, ParticleOrchestraType type, ParticleOrchestraSettings settings, int? overrideInvokingPlayerIndex=null)
static Color GetPortalColor(int colorIndex)
static void SyncPortalSections(Vector2 portalPosition, int fluff)
static bool SupportedTilesAreFine(Vector2 portalCenter, float portalAngle)
static FilterManager Scene
Definition Filters.cs:5
static ArmorShaderDataSet Armor
Definition GameShaders.cs:7
static bool[] CountsAsCritter
Definition NPCID.cs:4202
static readonly LegacySoundStyle Item120
Definition SoundID.cs:654
static readonly LegacySoundStyle Item101
Definition SoundID.cs:616
static readonly LegacySoundStyle Item14
Definition SoundID.cs:442
static readonly LegacySoundStyle Item34
Definition SoundID.cs:482
static readonly LegacySoundStyle DD2_DarkMageHealImpact
Definition SoundID.cs:822
static readonly LegacySoundStyle Item7
Definition SoundID.cs:428
static readonly LegacySoundStyle Item113
Definition SoundID.cs:640
static readonly LegacySoundStyle DD2_SkeletonSummoned
Definition SoundID.cs:898
static readonly LegacySoundStyle Item28
Definition SoundID.cs:470
static readonly LegacySoundStyle Item117
Definition SoundID.cs:648
static readonly LegacySoundStyle Item17
Definition SoundID.cs:448
static readonly LegacySoundStyle Item22
Definition SoundID.cs:458
static readonly LegacySoundStyle Item82
Definition SoundID.cs:578
static readonly LegacySoundStyle Item1
Definition SoundID.cs:416
static readonly LegacySoundStyle Item9
Definition SoundID.cs:432
static readonly LegacySoundStyle GlommerBounce
Definition SoundID.cs:984
static readonly LegacySoundStyle Item13
Definition SoundID.cs:440
static readonly LegacySoundStyle Item123
Definition SoundID.cs:660
static readonly LegacySoundStyle Item8
Definition SoundID.cs:430
static readonly LegacySoundStyle Item26
Definition SoundID.cs:466
static readonly LegacySoundStyle Item121
Definition SoundID.cs:656
static readonly LegacySoundStyle Item46
Definition SoundID.cs:506
static readonly LegacySoundStyle Item60
Definition SoundID.cs:534
static readonly LegacySoundStyle Item20
Definition SoundID.cs:454
static readonly LegacySoundStyle Item74
Definition SoundID.cs:562
static readonly LegacySoundStyle DD2_DefeatScene
Definition SoundID.cs:926
static bool[] CommonSapling
Definition TileID.cs:103
static bool[] Platforms
Definition TileID.cs:163
static readonly ushort Count
Definition TileID.cs:1698
void AI_173_HallowBossRainbowTrail()
void DoRainbowCrystalStaffExplosion()
void AI_180_FairyQueenSunDance()
IEntitySource GetProjectileSource_FromThis()
int FindTargetWithLineOfSight(float maxRange=800f)
void AI_066_TryInterceptingTarget(Vector2 targetDir, Vector2 targetVelocity, float speed)
float GetLastPrismHue(float laserIndex, ref float laserLuminance, ref float laserAlphaMultiplier)
void AI_139_ExplosiveTrapExplosion()
void AI_141_MonkStaffT1Explosion()
void AI_181_FairyQueenRangedItemShot()
void AI_175_TitaniumStormShards()
void AI_172_HallowBossRainbowPelletStorm()
IEntitySource GetNPCSource_FromThis()
bool Colliding(Rectangle myRect, Rectangle targetRect)
IEntitySource GetItemSource_FromThis()
void AI_171_HallowBossRainbowStreak()
static int NewProjectile(IEntitySource spawnSource, Vector2 position, Vector2 velocity, int Type, int Damage, float KnockBack, int Owner=-1, float ai0=0f, float ai1=0f, float ai2=0f)
static Color CornflowerBlue
Definition Color.cs:112
static Color Transparent
Definition Color.cs:76
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491
static float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91
static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:227
static readonly SlotId Invalid
Definition SlotId.cs:5
static SlotId FromFloat(float value)
Definition SlotId.cs:80

References System.Math.Abs(), Terraria.Entity.active, Terraria.Projectile.AI_001(), Terraria.Projectile.aiStyle, Terraria.Projectile.alpha, System.Math.Atan2(), Terraria.Collision.CanHit(), Terraria.Projectile.Colliding(), Terraria.Projectile.damage, Terraria.Entity.direction, Terraria.Entity.Distance(), Microsoft.Xna.Framework.Vector2.Distance(), Terraria.Main.dust, Terraria.Projectile.FindTargetWithLineOfSight(), Terraria.Projectile.frame, Terraria.Projectile.frameCounter, Terraria.Main.gore, Terraria.Entity.height, Terraria.ID.SoundID.Item1, Terraria.ID.SoundID.Item14, Terraria.ID.SoundID.Item7, Terraria.Projectile.Kill(), Terraria.Projectile.knockBack, Terraria.Projectile.localAI, System.Math.Max(), System.Math.Min(), Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Projectile.netUpdate, Terraria.Dust.NewDust(), Terraria.Gore.NewGore(), Terraria.Main.npc, Terraria.Projectile.owner, System.Math.PI, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.projFrames, Terraria.Main.rand, Terraria.Utils.Remap(), Terraria.Projectile.rotation, Terraria.Projectile.soundDelay, Terraria.Projectile.spriteDirection, System.Math.Sqrt(), Terraria.Projectile.tileCollide, Terraria.Projectile.type, System.value, Terraria.Dust.velocity, Terraria.Entity.velocity, Terraria.Entity.whoAmI, Terraria.Entity.width, Terraria.Main.windPhysics, Terraria.Main.windPhysicsStrength, Microsoft.Xna.Framework.Vector2.X, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.Projectile.Update().