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

◆ AI_001()

void Terraria.Projectile.AI_001 ( )
inlineprivate

Definition at line 44185 of file Projectile.cs.

44186 {
44187 //IL_21ea: Unknown result type (might be due to invalid IL or missing references)
44188 //IL_5a4d: Unknown result type (might be due to invalid IL or missing references)
44189 //IL_5967: Unknown result type (might be due to invalid IL or missing references)
44190 //IL_596c: Unknown result type (might be due to invalid IL or missing references)
44191 //IL_5a73: Unknown result type (might be due to invalid IL or missing references)
44192 //IL_5a78: Unknown result type (might be due to invalid IL or missing references)
44193 //IL_7f9f: Unknown result type (might be due to invalid IL or missing references)
44194 //IL_81c4: Unknown result type (might be due to invalid IL or missing references)
44195 if (type == 469 && wet && !honeyWet && !shimmerWet)
44196 {
44197 Kill();
44198 }
44199 if (type == 601)
44200 {
44202 Vector3 rgb = portalColor.ToVector3();
44203 rgb *= 0.5f;
44204 Lighting.AddLight(base.Center + velocity * 3f, rgb);
44205 if (alpha > 0 && alpha <= 15)
44206 {
44207 Color color = portalColor;
44208 color.A = byte.MaxValue;
44209 for (int i = 0; i < 4; i++)
44210 {
44211 Dust obj = Main.dust[Dust.NewDust(base.Center, 0, 0, 264)];
44212 obj.position = base.Center;
44213 obj.velocity = velocity * 2f + Utils.RandomVector2(Main.rand, -1f, 1f);
44214 obj.color = color;
44215 obj.scale = 1.2f;
44216 obj.noLight = true;
44217 obj.noGravity = true;
44218 obj.customData = Main.player[owner];
44219 }
44220 if (ai[0] != 0f)
44221 {
44223 }
44224 else
44225 {
44227 }
44228 }
44229 alpha -= 15;
44230 if (alpha < 0)
44231 {
44232 alpha = 0;
44233 }
44234 if (++frameCounter >= 4)
44235 {
44236 frameCounter = 0;
44237 if (++frame >= Main.projFrames[type])
44238 {
44239 frame = 0;
44240 }
44241 }
44242 if (alpha == 0)
44243 {
44245 color2.A = byte.MaxValue;
44246 Dust obj2 = Main.dust[Dust.NewDust(base.Center, 0, 0, 263)];
44247 obj2.position = base.Center;
44248 obj2.velocity = velocity / 4f;
44249 obj2.color = color2;
44250 obj2.noGravity = true;
44251 obj2.scale = 0.6f;
44252 }
44253 }
44254 if (type == 472)
44255 {
44256 int num = Dust.NewDust(position, width, height, 30);
44257 Main.dust[num].noGravity = true;
44258 Main.dust[num].velocity *= 0.25f;
44259 Main.dust[num].velocity += velocity * 0.75f;
44260 if (localAI[0] == 0f)
44261 {
44262 localAI[0] = 1f;
44264 for (int j = 0; j < 20; j++)
44265 {
44266 num = Dust.NewDust(position, width, height, 30);
44267 Main.dust[num].noGravity = true;
44268 Main.dust[num].velocity *= 0.25f;
44269 Main.dust[num].velocity += velocity;
44270 Main.dust[num].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
44271 Main.dust[num].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
44272 }
44273 }
44274 }
44275 if (type == 323)
44276 {
44277 alpha -= 50;
44278 if (alpha < 0)
44279 {
44280 alpha = 0;
44281 }
44282 }
44283 if (type == 436)
44284 {
44285 if (ai[1] == 0f)
44286 {
44287 ai[1] = 1f;
44289 }
44290 alpha -= 40;
44291 if (alpha < 0)
44292 {
44293 alpha = 0;
44294 }
44296 frameCounter++;
44297 if (frameCounter >= 3)
44298 {
44299 frame++;
44300 frameCounter = 0;
44301 if (frame >= 4)
44302 {
44303 frame = 0;
44304 }
44305 }
44306 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.3f, 1.1f, 0.5f);
44307 }
44308 if (type == 467)
44309 {
44310 if (ai[1] == 0f)
44311 {
44312 ai[1] = 1f;
44314 }
44315 else if (ai[1] == 1f && Main.netMode != 1)
44316 {
44317 int num2 = -1;
44318 float num3 = 2000f;
44319 for (int k = 0; k < 255; k++)
44320 {
44321 if (Main.player[k].active && !Main.player[k].dead)
44322 {
44323 Vector2 center = Main.player[k].Center;
44324 float num4 = Vector2.Distance(center, base.Center);
44325 if ((num4 < num3 || num2 == -1) && Collision.CanHit(base.Center, 1, 1, center, 1, 1))
44326 {
44327 num3 = num4;
44328 num2 = k;
44329 }
44330 }
44331 }
44332 if (num3 < 20f)
44333 {
44334 Kill();
44335 return;
44336 }
44337 if (num2 != -1)
44338 {
44339 ai[1] = 21f;
44340 ai[0] = num2;
44341 netUpdate = true;
44342 }
44343 }
44344 else if (ai[1] > 20f && ai[1] < 200f)
44345 {
44346 ai[1] += 1f;
44347 int num5 = (int)ai[0];
44348 if (!Main.player[num5].active || Main.player[num5].dead)
44349 {
44350 ai[1] = 1f;
44351 ai[0] = 0f;
44352 netUpdate = true;
44353 }
44354 else
44355 {
44356 float num6 = velocity.ToRotation();
44357 Vector2 vector = Main.player[num5].Center - base.Center;
44358 if (vector.Length() < 20f)
44359 {
44360 Kill();
44361 return;
44362 }
44363 float targetAngle = vector.ToRotation();
44364 if (vector == Vector2.Zero)
44365 {
44366 targetAngle = num6;
44367 }
44368 float num7 = num6.AngleLerp(targetAngle, 0.008f);
44369 velocity = new Vector2(velocity.Length(), 0f).RotatedBy(num7);
44370 }
44371 }
44372 if (ai[1] >= 1f && ai[1] < 20f)
44373 {
44374 ai[1] += 1f;
44375 if (ai[1] == 20f)
44376 {
44377 ai[1] = 1f;
44378 }
44379 }
44380 alpha -= 40;
44381 if (alpha < 0)
44382 {
44383 alpha = 0;
44384 }
44386 frameCounter++;
44387 if (frameCounter >= 3)
44388 {
44389 frame++;
44390 frameCounter = 0;
44391 if (frame >= 4)
44392 {
44393 frame = 0;
44394 }
44395 }
44396 Lighting.AddLight(base.Center, 1.1f, 0.9f, 0.4f);
44397 localAI[0] += 1f;
44398 if (localAI[0] == 12f)
44399 {
44400 localAI[0] = 0f;
44401 for (int l = 0; l < 12; l++)
44402 {
44403 Vector2 spinningpoint = Vector2.UnitX * -width / 2f;
44404 spinningpoint += -Vector2.UnitY.RotatedBy((float)l * (float)Math.PI / 6f) * new Vector2(8f, 16f);
44405 spinningpoint = spinningpoint.RotatedBy(rotation - (float)Math.PI / 2f);
44406 int num8 = Dust.NewDust(base.Center, 0, 0, 6, 0f, 0f, 160);
44407 Main.dust[num8].scale = 1.1f;
44408 Main.dust[num8].noGravity = true;
44409 Main.dust[num8].position = base.Center + spinningpoint;
44410 Main.dust[num8].velocity = velocity * 0.1f;
44411 Main.dust[num8].velocity = Vector2.Normalize(base.Center - velocity * 3f - Main.dust[num8].position) * 1.25f;
44412 }
44413 }
44414 if (Main.rand.Next(4) == 0)
44415 {
44416 for (int m = 0; m < 1; m++)
44417 {
44418 Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy(velocity.ToRotation());
44419 int num9 = Dust.NewDust(position, width, height, 31, 0f, 0f, 100);
44420 Main.dust[num9].velocity *= 0.1f;
44421 Main.dust[num9].position = base.Center + vector2 * width / 2f;
44422 Main.dust[num9].fadeIn = 0.9f;
44423 }
44424 }
44425 if (Main.rand.Next(32) == 0)
44426 {
44427 for (int n = 0; n < 1; n++)
44428 {
44429 Vector2 vector3 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy(velocity.ToRotation());
44430 int num10 = Dust.NewDust(position, width, height, 31, 0f, 0f, 155, default(Color), 0.8f);
44431 Main.dust[num10].velocity *= 0.3f;
44432 Main.dust[num10].position = base.Center + vector3 * width / 2f;
44433 if (Main.rand.Next(2) == 0)
44434 {
44435 Main.dust[num10].fadeIn = 1.4f;
44436 }
44437 }
44438 }
44439 if (Main.rand.Next(2) == 0)
44440 {
44441 for (int num11 = 0; num11 < 2; num11++)
44442 {
44443 Vector2 vector4 = -Vector2.UnitX.RotatedByRandom(0.7853981852531433).RotatedBy(velocity.ToRotation());
44444 int num12 = Dust.NewDust(position, width, height, 6, 0f, 0f, 0, default(Color), 1.2f);
44445 Main.dust[num12].velocity *= 0.3f;
44446 Main.dust[num12].noGravity = true;
44447 Main.dust[num12].position = base.Center + vector4 * width / 2f;
44448 if (Main.rand.Next(2) == 0)
44449 {
44450 Main.dust[num12].fadeIn = 1.4f;
44451 }
44452 }
44453 }
44454 }
44455 if (type == 468)
44456 {
44457 if (ai[1] == 0f)
44458 {
44459 ai[1] = 1f;
44461 }
44462 else if (ai[1] == 1f && Main.netMode != 1)
44463 {
44464 int num13 = -1;
44465 float num14 = 2000f;
44466 for (int num15 = 0; num15 < 255; num15++)
44467 {
44468 if (Main.player[num15].active && !Main.player[num15].dead)
44469 {
44470 Vector2 center2 = Main.player[num15].Center;
44471 float num16 = Vector2.Distance(center2, base.Center);
44472 if ((num16 < num14 || num13 == -1) && Collision.CanHit(base.Center, 1, 1, center2, 1, 1))
44473 {
44474 num14 = num16;
44475 num13 = num15;
44476 }
44477 }
44478 }
44479 if (num14 < 20f)
44480 {
44481 Kill();
44482 return;
44483 }
44484 if (num13 != -1)
44485 {
44486 ai[1] = 21f;
44487 ai[0] = num13;
44488 netUpdate = true;
44489 }
44490 }
44491 else if (ai[1] > 20f && ai[1] < 200f)
44492 {
44493 ai[1] += 1f;
44494 int num17 = (int)ai[0];
44495 if (!Main.player[num17].active || Main.player[num17].dead)
44496 {
44497 ai[1] = 1f;
44498 ai[0] = 0f;
44499 netUpdate = true;
44500 }
44501 else
44502 {
44503 float num18 = velocity.ToRotation();
44504 Vector2 vector5 = Main.player[num17].Center - base.Center;
44505 if (vector5.Length() < 20f)
44506 {
44507 Kill();
44508 return;
44509 }
44510 float targetAngle2 = vector5.ToRotation();
44511 if (vector5 == Vector2.Zero)
44512 {
44514 }
44515 float num19 = num18.AngleLerp(targetAngle2, 0.01f);
44516 velocity = new Vector2(velocity.Length(), 0f).RotatedBy(num19);
44517 }
44518 }
44519 if (ai[1] >= 1f && ai[1] < 20f)
44520 {
44521 ai[1] += 1f;
44522 if (ai[1] == 20f)
44523 {
44524 ai[1] = 1f;
44525 }
44526 }
44527 alpha -= 40;
44528 if (alpha < 0)
44529 {
44530 alpha = 0;
44531 }
44533 frameCounter++;
44534 if (frameCounter >= 3)
44535 {
44536 frame++;
44537 frameCounter = 0;
44538 if (frame >= 4)
44539 {
44540 frame = 0;
44541 }
44542 }
44543 Lighting.AddLight(base.Center, 0.2f, 0.1f, 0.6f);
44544 localAI[0] += 1f;
44545 if (localAI[0] == 12f)
44546 {
44547 localAI[0] = 0f;
44548 for (int num20 = 0; num20 < 12; num20++)
44549 {
44550 Vector2 spinningpoint2 = Vector2.UnitX * -width / 2f;
44551 spinningpoint2 += -Vector2.UnitY.RotatedBy((float)num20 * (float)Math.PI / 6f) * new Vector2(8f, 16f);
44552 spinningpoint2 = spinningpoint2.RotatedBy(rotation - (float)Math.PI / 2f);
44553 int num21 = Dust.NewDust(base.Center, 0, 0, 27, 0f, 0f, 160);
44554 Main.dust[num21].scale = 1.1f;
44555 Main.dust[num21].noGravity = true;
44556 Main.dust[num21].position = base.Center + spinningpoint2;
44557 Main.dust[num21].velocity = velocity * 0.1f;
44558 Main.dust[num21].velocity = Vector2.Normalize(base.Center - velocity * 3f - Main.dust[num21].position) * 1.25f;
44559 }
44560 }
44561 if (Main.rand.Next(4) == 0)
44562 {
44563 for (int num22 = 0; num22 < 1; num22++)
44564 {
44565 Vector2 vector6 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy(velocity.ToRotation());
44566 int num23 = Dust.NewDust(position, width, height, 31, 0f, 0f, 100);
44567 Main.dust[num23].velocity *= 0.1f;
44568 Main.dust[num23].position = base.Center + vector6 * width / 2f;
44569 Main.dust[num23].fadeIn = 0.9f;
44570 }
44571 }
44572 if (Main.rand.Next(32) == 0)
44573 {
44574 for (int num24 = 0; num24 < 1; num24++)
44575 {
44576 Vector2 vector7 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy(velocity.ToRotation());
44577 int num25 = Dust.NewDust(position, width, height, 31, 0f, 0f, 155, default(Color), 0.8f);
44578 Main.dust[num25].velocity *= 0.3f;
44579 Main.dust[num25].position = base.Center + vector7 * width / 2f;
44580 if (Main.rand.Next(2) == 0)
44581 {
44582 Main.dust[num25].fadeIn = 1.4f;
44583 }
44584 }
44585 }
44586 if (Main.rand.Next(2) == 0)
44587 {
44588 for (int num26 = 0; num26 < 2; num26++)
44589 {
44590 Vector2 vector8 = -Vector2.UnitX.RotatedByRandom(0.7853981852531433).RotatedBy(velocity.ToRotation());
44591 int num27 = Dust.NewDust(position, width, height, 27, 0f, 0f, 0, default(Color), 1.2f);
44592 Main.dust[num27].velocity *= 0.3f;
44593 Main.dust[num27].noGravity = true;
44594 Main.dust[num27].position = base.Center + vector8 * width / 2f;
44595 if (Main.rand.Next(2) == 0)
44596 {
44597 Main.dust[num27].fadeIn = 1.4f;
44598 }
44599 }
44600 }
44601 }
44602 if (type == 634 || type == 635)
44603 {
44604 float num28 = 5f;
44605 float num29 = 250f;
44606 float num30 = 6f;
44607 Vector2 vector9 = new Vector2(8f, 10f);
44608 float num31 = 1.2f;
44609 Vector3 rgb2 = new Vector3(0.7f, 0.1f, 0.5f);
44610 int num32 = 4 * MaxUpdates;
44611 int num33 = Utils.SelectRandom<int>(Main.rand, 242, 73, 72, 71, 255);
44612 int num34 = 255;
44613 if (type == 635)
44614 {
44615 vector9 = new Vector2(10f, 20f);
44616 num31 = 1f;
44617 num29 = 500f;
44618 num34 = 88;
44619 num32 = 3 * MaxUpdates;
44620 rgb2 = new Vector3(0.4f, 0.6f, 0.9f);
44621 num33 = Utils.SelectRandom<int>(Main.rand, 242, 59, 88);
44622 }
44623 if (ai[1] == 0f)
44624 {
44625 ai[1] = 1f;
44626 localAI[0] = -Main.rand.Next(48);
44628 }
44629 else if (ai[1] == 1f && owner == Main.myPlayer)
44630 {
44631 int num35 = -1;
44632 float num36 = num29;
44633 for (int num37 = 0; num37 < 200; num37++)
44634 {
44635 if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(this))
44636 {
44637 Vector2 center3 = Main.npc[num37].Center;
44638 float num38 = Vector2.Distance(center3, base.Center);
44639 if (num38 < num36 && num35 == -1 && Collision.CanHitLine(base.Center, 1, 1, center3, 1, 1))
44640 {
44641 num36 = num38;
44642 num35 = num37;
44643 }
44644 }
44645 }
44646 if (num36 < 20f)
44647 {
44648 Kill();
44649 return;
44650 }
44651 if (num35 != -1)
44652 {
44653 ai[1] = num28 + 1f;
44654 ai[0] = num35;
44655 netUpdate = true;
44656 }
44657 }
44658 else if (ai[1] > num28)
44659 {
44660 ai[1] += 1f;
44661 int num39 = (int)ai[0];
44662 if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(this))
44663 {
44664 ai[1] = 1f;
44665 ai[0] = 0f;
44666 netUpdate = true;
44667 }
44668 else
44669 {
44670 velocity.ToRotation();
44671 Vector2 vector10 = Main.npc[num39].Center - base.Center;
44672 if (vector10.Length() < 20f)
44673 {
44674 Kill();
44675 return;
44676 }
44677 if (vector10 != Vector2.Zero)
44678 {
44679 vector10.Normalize();
44680 vector10 *= num30;
44681 }
44682 float num40 = 30f;
44683 velocity = (velocity * (num40 - 1f) + vector10) / num40;
44684 }
44685 }
44686 if (ai[1] >= 1f && ai[1] < num28)
44687 {
44688 ai[1] += 1f;
44689 if (ai[1] == num28)
44690 {
44691 ai[1] = 1f;
44692 }
44693 }
44694 alpha -= 40;
44695 if (alpha < 0)
44696 {
44697 alpha = 0;
44698 }
44700 frameCounter++;
44701 if (frameCounter >= num32)
44702 {
44703 frame++;
44704 frameCounter = 0;
44705 if (frame >= 4)
44706 {
44707 frame = 0;
44708 }
44709 }
44710 Lighting.AddLight(base.Center, rgb2);
44711 rotation = velocity.ToRotation();
44712 localAI[0] += 1f;
44713 if (localAI[0] == 48f)
44714 {
44715 localAI[0] = 0f;
44716 }
44717 else if (alpha == 0)
44718 {
44719 for (int num41 = 0; num41 < 2; num41++)
44720 {
44721 Vector2 vector11 = Vector2.UnitX * -30f;
44722 vector11 = -Vector2.UnitY.RotatedBy(localAI[0] * ((float)Math.PI / 24f) + (float)num41 * (float)Math.PI) * vector9 - rotation.ToRotationVector2() * 10f;
44723 int num42 = Dust.NewDust(base.Center, 0, 0, num34, 0f, 0f, 160);
44724 Main.dust[num42].scale = num31;
44725 Main.dust[num42].noGravity = true;
44726 Main.dust[num42].position = base.Center + vector11 + velocity * 2f;
44727 Main.dust[num42].velocity = Vector2.Normalize(base.Center + velocity * 2f * 8f - Main.dust[num42].position) * 2f + velocity * 2f;
44728 }
44729 }
44730 if (Main.rand.Next(12) == 0)
44731 {
44732 for (int num43 = 0; num43 < 1; num43++)
44733 {
44734 Vector2 vector12 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy(velocity.ToRotation());
44735 int num44 = Dust.NewDust(position, width, height, 31, 0f, 0f, 100);
44736 Main.dust[num44].velocity *= 0.1f;
44737 Main.dust[num44].position = base.Center + vector12 * width / 2f + velocity * 2f;
44738 Main.dust[num44].fadeIn = 0.9f;
44739 }
44740 }
44741 if (Main.rand.Next(64) == 0)
44742 {
44743 for (int num45 = 0; num45 < 1; num45++)
44744 {
44745 Vector2 vector13 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy(velocity.ToRotation());
44746 int num46 = Dust.NewDust(position, width, height, 31, 0f, 0f, 155, default(Color), 0.8f);
44747 Main.dust[num46].velocity *= 0.3f;
44748 Main.dust[num46].position = base.Center + vector13 * width / 2f;
44749 if (Main.rand.Next(2) == 0)
44750 {
44751 Main.dust[num46].fadeIn = 1.4f;
44752 }
44753 }
44754 }
44755 if (Main.rand.Next(4) == 0)
44756 {
44757 for (int num47 = 0; num47 < 2; num47++)
44758 {
44759 Vector2 vector14 = -Vector2.UnitX.RotatedByRandom(0.7853981852531433).RotatedBy(velocity.ToRotation());
44760 int num48 = Dust.NewDust(position, width, height, num33, 0f, 0f, 0, default(Color), 1.2f);
44761 Main.dust[num48].velocity *= 0.3f;
44762 Main.dust[num48].noGravity = true;
44763 Main.dust[num48].position = base.Center + vector14 * width / 2f;
44764 if (Main.rand.Next(2) == 0)
44765 {
44766 Main.dust[num48].fadeIn = 1.4f;
44767 }
44768 }
44769 }
44770 if (Main.rand.Next(12) == 0 && type == 634)
44771 {
44772 Vector2 vector15 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy(velocity.ToRotation());
44773 int num49 = Dust.NewDust(position, width, height, num34, 0f, 0f, 100);
44774 Main.dust[num49].velocity *= 0.3f;
44775 Main.dust[num49].position = base.Center + vector15 * width / 2f;
44776 Main.dust[num49].fadeIn = 0.9f;
44777 Main.dust[num49].noGravity = true;
44778 }
44779 if (Main.rand.Next(3) == 0 && type == 635)
44780 {
44781 Vector2 vector16 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy(velocity.ToRotation());
44782 int num50 = Dust.NewDust(position, width, height, num34, 0f, 0f, 100);
44783 Main.dust[num50].velocity *= 0.3f;
44784 Main.dust[num50].position = base.Center + vector16 * width / 2f;
44785 Main.dust[num50].fadeIn = 1.2f;
44786 Main.dust[num50].scale = 1.5f;
44787 Main.dust[num50].noGravity = true;
44788 }
44789 }
44790 if (type == 459)
44791 {
44792 alpha -= 30;
44793 if (alpha < 0)
44794 {
44795 alpha = 0;
44796 }
44798 frameCounter++;
44799 if (frameCounter >= 3)
44800 {
44801 frame++;
44802 frameCounter = 0;
44803 if (frame >= 3)
44804 {
44805 frame = 0;
44806 }
44807 }
44808 position = base.Center;
44809 scale = ai[1];
44810 width = (height = (int)(22f * scale));
44811 base.Center = position;
44812 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.4f, 0.85f, 0.9f);
44813 int num51 = 0;
44814 if ((double)scale < 0.85)
44815 {
44816 num51 = ((Main.rand.Next(3) == 0) ? 1 : 0);
44817 }
44818 else
44819 {
44820 num51 = 1;
44821 penetrate = -1;
44822 maxPenetrate = -1;
44823 }
44824 for (int num52 = 0; num52 < num51; num52++)
44825 {
44826 int num53 = Dust.NewDust(position, width, height, 226, velocity.X);
44827 Main.dust[num53].position -= Vector2.One * 3f;
44828 Main.dust[num53].scale = 0.5f;
44829 Main.dust[num53].noGravity = true;
44830 Main.dust[num53].velocity = velocity / 3f;
44831 Main.dust[num53].alpha = 255 - (int)(255f * scale);
44832 }
44833 }
44834 if (type == 709)
44835 {
44836 alpha -= 30;
44837 if (alpha < 0)
44838 {
44839 alpha = 0;
44840 }
44842 frameCounter++;
44843 if (frameCounter >= 3)
44844 {
44845 frame++;
44846 frameCounter = 0;
44847 if (frame >= 3)
44848 {
44849 frame = 0;
44850 }
44851 }
44852 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.4f, 0.85f, 0.9f);
44853 if (ai[1] == 0f)
44854 {
44856 }
44857 ai[1] += 1f;
44858 if (ai[1] >= 30f)
44859 {
44860 Kill();
44861 return;
44862 }
44863 }
44864 if (type == 442)
44865 {
44866 frame = 0;
44867 if (alpha != 0)
44868 {
44869 localAI[0] += 1f;
44870 if (localAI[0] >= 4f)
44871 {
44872 alpha -= 90;
44873 if (alpha < 0)
44874 {
44875 alpha = 0;
44876 localAI[0] = 2f;
44877 }
44878 }
44879 }
44880 if (Vector2.Distance(base.Center, new Vector2(ai[0], ai[1]) * 16f + Vector2.One * 8f) <= 16f)
44881 {
44882 Kill();
44883 return;
44884 }
44885 if (alpha == 0)
44886 {
44887 localAI[1] += 1f;
44888 if (localAI[1] >= 120f)
44889 {
44890 Kill();
44891 return;
44892 }
44893 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.3f, 0.45f, 0.8f);
44894 localAI[0] += 1f;
44895 if (localAI[0] == 3f)
44896 {
44897 localAI[0] = 0f;
44898 for (int num54 = 0; num54 < 8; num54++)
44899 {
44900 Vector2 spinningpoint3 = Vector2.UnitX * -8f;
44901 spinningpoint3 += -Vector2.UnitY.RotatedBy((float)num54 * (float)Math.PI / 4f) * new Vector2(2f, 4f);
44902 spinningpoint3 = spinningpoint3.RotatedBy(rotation - (float)Math.PI / 2f);
44903 int num55 = Dust.NewDust(base.Center, 0, 0, 135);
44904 Main.dust[num55].scale = 1.5f;
44905 Main.dust[num55].noGravity = true;
44906 Main.dust[num55].position = base.Center + spinningpoint3;
44907 Main.dust[num55].velocity = velocity * 0.66f;
44908 }
44909 }
44910 }
44911 }
44912 if (type == 440 || type == 449 || type == 606)
44913 {
44914 if (alpha > 0)
44915 {
44916 alpha -= 25;
44917 }
44918 if (alpha < 0)
44919 {
44920 alpha = 0;
44921 }
44922 if (type == 440)
44923 {
44924 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.25f, 0.4f, 0.7f);
44925 }
44926 if (type == 449)
44927 {
44928 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.7f, 0.65f, 0.3f);
44929 }
44930 if (type == 606)
44931 {
44932 Lighting.AddLight(base.Center, 0.7f, 0.3f, 0.3f);
44933 }
44934 float num56 = 100f;
44935 float num57 = 3f;
44936 if (type == 606)
44937 {
44938 num56 = 150f;
44939 num57 = 5f;
44940 }
44941 if (ai[1] == 0f)
44942 {
44943 localAI[0] += num57;
44944 if (localAI[0] == num57 * 1f && type == 606)
44945 {
44946 for (int num58 = 0; num58 < 4; num58++)
44947 {
44948 int num59 = Dust.NewDust(base.Center - velocity / 2f, 0, 0, 182, 0f, 0f, 100, default(Color), 1.4f);
44949 Main.dust[num59].velocity *= 0.2f;
44950 Main.dust[num59].velocity += velocity / 10f;
44951 Main.dust[num59].noGravity = true;
44952 }
44953 }
44954 if (localAI[0] > num56)
44955 {
44956 localAI[0] = num56;
44957 }
44958 }
44959 else
44960 {
44961 localAI[0] -= num57;
44962 if (localAI[0] <= 0f)
44963 {
44964 Kill();
44965 return;
44966 }
44967 }
44968 }
44969 if (type == 438)
44970 {
44971 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.4f, 0.1f, 0.2f);
44972 }
44973 if (type == 593)
44974 {
44975 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.4f, 0.1f, 0.3f);
44976 if (++frameCounter >= 12)
44977 {
44978 if (++frame >= Main.projFrames[type])
44979 {
44980 frame = 0;
44981 }
44982 frameCounter = 0;
44983 }
44984 if (Main.rand.Next(2) == 0)
44985 {
44986 Vector2 vector17 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
44987 Dust obj3 = Main.dust[Dust.NewDust(base.Center - vector17 * 8f, 0, 0, 240)];
44988 obj3.noGravity = true;
44989 obj3.position = base.Center - vector17 * 8f * scale;
44990 obj3.velocity = vector17.RotatedBy(-1.5707963705062866) * 2f;
44991 obj3.velocity = Vector2.Zero;
44992 obj3.scale = 0.5f + Main.rand.NextFloat();
44993 obj3.fadeIn = 0.5f;
44994 }
44995 }
44996 if (type == 592)
44997 {
44998 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.15f, 0.15f, 0.4f);
44999 }
45000 if (type == 462)
45001 {
45002 int num60 = Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100);
45003 Main.dust[num60].noLight = true;
45004 Main.dust[num60].noGravity = true;
45005 Main.dust[num60].velocity = velocity;
45006 Main.dust[num60].position -= Vector2.One * 4f;
45007 Main.dust[num60].scale = 0.8f;
45008 if (++frameCounter >= 9)
45009 {
45010 frameCounter = 0;
45011 if (++frame >= 5)
45012 {
45013 frame = 0;
45014 }
45015 }
45016 }
45017 if (type == 437)
45018 {
45019 if (ai[1] == 0f)
45020 {
45021 ai[1] = 1f;
45023 }
45024 if (localAI[0] == 0f)
45025 {
45026 localAI[0] = 1f;
45027 for (int num61 = 0; num61 < 4; num61++)
45028 {
45029 int num62 = Dust.NewDust(position, width, height, 226, velocity.X);
45030 Main.dust[num62].position = Vector2.Lerp(Main.dust[num62].position, base.Center, 0.25f);
45031 Main.dust[num62].scale = 0.5f;
45032 Main.dust[num62].noGravity = true;
45033 Main.dust[num62].velocity /= 2f;
45034 Main.dust[num62].velocity += velocity * 0.66f;
45035 }
45036 }
45037 if (ai[0] < 16f)
45038 {
45039 for (int num63 = 0; num63 < 2; num63++)
45040 {
45041 int num64 = Dust.NewDust(position, width, height, 226, velocity.X);
45042 Main.dust[num64].position = position + new Vector2(((direction == 1) ? 1 : 0) * width, 2 + (height - 4) * num63);
45043 Main.dust[num64].scale = 0.3f;
45044 Main.dust[num64].noGravity = true;
45045 Main.dust[num64].velocity = Vector2.Zero;
45046 }
45047 }
45048 }
45049 if (type == 435)
45050 {
45051 if (ai[1] == 0f)
45052 {
45053 ai[1] = 1f;
45055 }
45056 alpha -= 40;
45057 if (alpha < 0)
45058 {
45059 alpha = 0;
45060 }
45062 frameCounter++;
45063 if (frameCounter >= 3)
45064 {
45065 frame++;
45066 frameCounter = 0;
45067 if (frame >= 4)
45068 {
45069 frame = 0;
45070 }
45071 }
45072 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.3f, 0.8f, 1.1f);
45073 }
45074 if (type == 682)
45075 {
45076 if (ai[1] == 0f)
45077 {
45078 ai[1] = 1f;
45080 for (int num65 = 0; num65 < 8; num65++)
45081 {
45082 Dust dust = Dust.NewDustDirect(position, width, height, 272);
45083 dust.velocity *= 1f;
45084 dust.velocity += velocity * 0.65f;
45085 dust.scale = 0.6f;
45086 dust.fadeIn = 0.8f;
45087 dust.noGravity = true;
45088 dust.noLight = true;
45089 dust.position += dust.velocity * 3f;
45090 }
45091 }
45092 alpha -= 40;
45093 if (alpha < 0)
45094 {
45095 alpha = 0;
45096 }
45098 frameCounter++;
45099 if (frameCounter >= 3)
45100 {
45101 frame++;
45102 frameCounter = 0;
45103 if (frame >= 4)
45104 {
45105 frame = 0;
45106 }
45107 }
45108 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.5f, 0.2f, 1.1f);
45109 }
45110 if (type == 684)
45111 {
45112 alpha -= 40;
45113 if (alpha < 0)
45114 {
45115 alpha = 0;
45116 }
45118 localAI[0] += 1f;
45119 for (int num66 = 0; num66 < 1; num66++)
45120 {
45121 Vector2 spinningpoint4 = Utils.RandomVector2(Main.rand, -0.5f, 0.5f) * new Vector2(20f, 80f);
45122 spinningpoint4 = spinningpoint4.RotatedBy(velocity.ToRotation());
45123 Dust dust2 = Dust.NewDustDirect(base.Center, 0, 0, 60);
45124 dust2.alpha = 127;
45125 dust2.fadeIn = 1.5f;
45126 dust2.scale = 1.3f;
45127 dust2.velocity *= 0.3f;
45128 dust2.position = base.Center + spinningpoint4;
45129 dust2.noGravity = true;
45130 dust2.noLight = true;
45131 dust2.color = new Color(255, 255, 255, 0);
45132 }
45133 Lighting.AddLight(base.Center, 1.1f, 0.3f, 0.4f);
45134 }
45135 if (type == 408)
45136 {
45137 alpha -= 40;
45138 if (alpha < 0)
45139 {
45140 alpha = 0;
45141 }
45143 }
45144 if (type == 282)
45145 {
45146 int num67 = Dust.NewDust(position, width, height, 171, 0f, 0f, 100);
45147 Main.dust[num67].scale = (float)Main.rand.Next(1, 10) * 0.1f;
45148 Main.dust[num67].noGravity = true;
45149 Main.dust[num67].fadeIn = 1.5f;
45150 Main.dust[num67].velocity *= 0.25f;
45151 Main.dust[num67].velocity += velocity * 0.25f;
45152 }
45153 if (type == 275 || type == 276)
45154 {
45155 frameCounter++;
45156 if (frameCounter > 1)
45157 {
45158 frameCounter = 0;
45159 frame++;
45160 if (frame > 1)
45161 {
45162 frame = 0;
45163 }
45164 }
45165 }
45166 if (type == 225 && Main.rand.Next(2) == 0)
45167 {
45168 int num68 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 40);
45169 Main.dust[num68].noGravity = true;
45170 Main.dust[num68].scale = 1.3f;
45171 Main.dust[num68].velocity *= 0.5f;
45172 }
45173 if (type == 174)
45174 {
45175 if (alpha == 0)
45176 {
45177 int num69 = Dust.NewDust(oldPosition - velocity * 3f, width, height, 76, 0f, 0f, 50);
45178 Main.dust[num69].noGravity = true;
45179 Main.dust[num69].noLight = true;
45180 Main.dust[num69].velocity *= 0.5f;
45181 }
45182 alpha -= 50;
45183 if (alpha < 0)
45184 {
45185 alpha = 0;
45186 }
45187 if (ai[1] == 0f)
45188 {
45189 ai[1] = 1f;
45191 }
45192 }
45193 else if (type == 605 || type == 920 || type == 921 || type == 926 || type == 937)
45194 {
45195 if (type == 920 && frameCounter == 0)
45196 {
45197 frameCounter = 1;
45198 frame = Main.rand.Next(3);
45199 }
45200 if (type != 920 && type != 921 && alpha == 0 && Main.rand.Next(3) == 0)
45201 {
45202 int num70 = 4;
45203 Color newColor = new Color(78, 136, 255, 150);
45204 float num71 = 1.2f;
45205 bool noGravity = true;
45206 int num72 = 0;
45207 if (type == 921)
45208 {
45209 num70 = 243;
45210 newColor = default(Color);
45211 }
45212 if (type == 926)
45213 {
45214 num70 = 4;
45215 newColor = NPC.AI_121_QueenSlime_GetDustColor();
45216 newColor.A = 150;
45217 num71 = 1.2f;
45218 num72 = 8;
45219 noGravity = Main.rand.Next(2) == 0;
45220 }
45221 if (type == 937)
45222 {
45223 num70 = 4;
45224 newColor = NPC.AI_121_QueenSlime_GetDustColor();
45225 newColor.A = 150;
45226 }
45227 int num73 = Dust.NewDust(position - new Vector2(num72, num72) + velocity, width + num72 * 2, height + num72 * 2, num70, 0f, 0f, 50, newColor, num71);
45228 Main.dust[num73].velocity *= 0.3f;
45229 Main.dust[num73].velocity += velocity * 0.3f;
45230 Main.dust[num73].noGravity = noGravity;
45231 }
45232 alpha -= 50;
45233 if (alpha < 0)
45234 {
45235 alpha = 0;
45236 }
45237 if (type != 937 && ai[1] == 0f)
45238 {
45239 ai[1] = 1f;
45240 if (type == 926)
45241 {
45243 }
45244 else
45245 {
45247 }
45248 }
45249 }
45250 else if (type == 176)
45251 {
45252 if (alpha == 0)
45253 {
45254 int num74 = Dust.NewDust(oldPosition, width, height, 22, 0f, 0f, 100, default(Color), 0.5f);
45255 Main.dust[num74].noGravity = true;
45256 Main.dust[num74].noLight = true;
45257 Main.dust[num74].velocity *= 0.15f;
45258 Main.dust[num74].fadeIn = 0.8f;
45259 }
45260 alpha -= 50;
45261 if (alpha < 0)
45262 {
45263 alpha = 0;
45264 }
45265 if (ai[1] == 0f)
45266 {
45267 ai[1] = 1f;
45269 }
45270 }
45271 if (type == 350)
45272 {
45273 alpha -= 100;
45274 if (alpha < 0)
45275 {
45276 alpha = 0;
45277 }
45278 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.9f, 0.6f, 0.2f);
45279 if (alpha == 0)
45280 {
45281 int num75 = 2;
45282 if (Main.rand.Next(3) != 0)
45283 {
45284 int num76 = Dust.NewDust(new Vector2(base.Center.X - (float)num75, base.Center.Y - (float)num75 - 2f) - velocity * 0.5f, num75 * 2, num75 * 2, 6, 0f, 0f, 100);
45285 Main.dust[num76].scale *= 1.3f + (float)Main.rand.Next(10) * 0.05f;
45286 Main.dust[num76].velocity *= 0.2f;
45287 Main.dust[num76].noGravity = true;
45288 Main.dust[num76].noLight = true;
45289 Main.dust[num76].velocity += velocity * 0.25f;
45290 }
45291 if (Main.rand.Next(4) == 0)
45292 {
45293 int num77 = (num77 = Dust.NewDust(new Vector2(base.Center.X - (float)num75, base.Center.Y - (float)num75 - 2f) - velocity * 0.5f, num75 * 2, num75 * 2, 31, 0f, 0f, 100, default(Color), 0.5f));
45294 Main.dust[num77].fadeIn = 0.6f + (float)Main.rand.Next(5) * 0.1f;
45295 Main.dust[num77].velocity *= 0.05f;
45296 Main.dust[num77].velocity += velocity * 0.25f;
45297 }
45298 }
45299 if (ai[1] == 0f)
45300 {
45301 ai[1] = 1f;
45303 }
45304 }
45305 if (type == 325)
45306 {
45307 alpha -= 100;
45308 if (alpha < 0)
45309 {
45310 alpha = 0;
45311 }
45312 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.9f, 0.6f, 0.2f);
45313 if (alpha == 0)
45314 {
45315 int num78 = 2;
45316 if (Main.rand.Next(3) != 0)
45317 {
45318 int num79 = Dust.NewDust(new Vector2(base.Center.X - (float)num78, base.Center.Y - (float)num78 - 2f) - velocity * 0.5f, num78 * 2, num78 * 2, 6, 0f, 0f, 100);
45319 Main.dust[num79].scale *= 1.2f + (float)Main.rand.Next(10) * 0.05f;
45320 Main.dust[num79].velocity *= 0.2f;
45321 Main.dust[num79].noGravity = true;
45322 Main.dust[num79].noLight = true;
45323 Main.dust[num79].velocity += velocity * 0.25f;
45324 }
45325 if (Main.rand.Next(4) == 0)
45326 {
45327 int num80 = (num80 = Dust.NewDust(new Vector2(base.Center.X - (float)num78, base.Center.Y - (float)num78 - 2f) - velocity * 0.5f, num78 * 2, num78 * 2, 31, 0f, 0f, 100, default(Color), 0.5f));
45328 Main.dust[num80].fadeIn = 0.5f + (float)Main.rand.Next(5) * 0.05f;
45329 Main.dust[num80].velocity *= 0.05f;
45330 }
45331 }
45332 if (ai[1] == 0f)
45333 {
45334 ai[1] = 1f;
45336 }
45337 }
45338 if (type == 469)
45339 {
45340 localAI[1] += 1f;
45341 if (localAI[1] > 2f)
45342 {
45343 alpha -= 50;
45344 if (alpha < 0)
45345 {
45346 alpha = 0;
45347 }
45348 }
45349 }
45350 else if (type == 83 && ai[1] == 0f)
45351 {
45352 ai[1] = 1f;
45354 }
45355 else if (type == 408 && ai[1] == 0f)
45356 {
45357 ai[1] = 1f;
45358 SoundEngine.PlaySound(4, (int)position.X, (int)position.Y, 19);
45359 }
45360 else if (type == 259 && ai[1] == 0f)
45361 {
45362 ai[1] = 1f;
45364 }
45365 else if (type == 110 && ai[1] == 0f)
45366 {
45367 ai[1] = 1f;
45369 }
45370 else if (type == 302 && ai[1] == 0f)
45371 {
45372 ai[1] = 1f;
45374 }
45375 else if (type == 438 && ai[1] == 0f)
45376 {
45377 ai[1] = 1f;
45379 }
45380 else if (type == 593 && ai[1] == 0f)
45381 {
45382 ai[1] = 1f;
45384 }
45385 else if (type == 592 && ai[1] == 0f)
45386 {
45387 ai[1] = 1f;
45389 }
45390 else if (type == 462 && ai[1] == 0f)
45391 {
45392 ai[1] = 1f;
45393 if (Main.rand.Next(2) == 0)
45394 {
45396 }
45397 else
45398 {
45400 }
45402 int num81 = Main.rand.Next(5, 10);
45403 for (int num82 = 0; num82 < num81; num82++)
45404 {
45405 int num83 = Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100);
45406 Main.dust[num83].velocity.Y -= 1f;
45407 Main.dust[num83].velocity += vector18 * 2f;
45408 Main.dust[num83].position -= Vector2.One * 4f;
45409 Main.dust[num83].noGravity = true;
45410 }
45411 }
45412 else if (type == 84 && ai[1] == 0f)
45413 {
45414 ai[1] = 1f;
45416 }
45417 else if (type == 389 && ai[1] == 0f)
45418 {
45419 ai[1] = 1f;
45421 }
45422 else if (type == 257 && ai[1] == 0f)
45423 {
45424 ai[1] = 1f;
45426 }
45427 else if (type == 100 && ai[1] == 0f)
45428 {
45429 ai[1] = 1f;
45431 }
45432 else if (type == 98 && ai[1] == 0f)
45433 {
45434 ai[1] = 1f;
45436 }
45437 else if (type == 184 && ai[1] == 0f)
45438 {
45439 ai[1] = 1f;
45441 }
45442 else if (type == 980 && ai[1] == 0f)
45443 {
45444 ai[1] = 1f;
45446 }
45447 else if (type == 195 && ai[1] == 0f)
45448 {
45449 ai[1] = 1f;
45451 }
45452 else if (type == 275 && ai[1] == 0f)
45453 {
45454 ai[1] = 1f;
45456 }
45457 else if (type == 276 && ai[1] == 0f)
45458 {
45459 ai[1] = 1f;
45461 }
45462 else if ((type == 81 || type == 82) && ai[1] == 0f)
45463 {
45465 ai[1] = 1f;
45466 }
45467 else if (type == 180 && ai[1] == 0f)
45468 {
45470 ai[1] = 1f;
45471 }
45472 else if (type == 248 && ai[1] == 0f)
45473 {
45475 ai[1] = 1f;
45476 }
45477 else if (type == 576 && ai[1] == 0f)
45478 {
45479 ai[1] = 1f;
45481 }
45482 else if (type == 577 && soundDelay == 0)
45483 {
45484 soundDelay = -1;
45486 for (int num84 = 0; num84 < 5; num84++)
45487 {
45488 Vector2 center4 = base.Center;
45489 int num85 = ((num84 != 0) ? 3 : 0);
45490 float num86 = ((num84 == 0) ? (12f + 8f * Main.rand.NextFloat()) : (12f * Main.rand.NextFloat()));
45491 Vector2 vector19 = velocity.SafeNormalize(Vector2.Zero) * num86 + Main.rand.NextVector2Circular(1f, 1f) * num85;
45492 Dust obj4 = Main.dust[Dust.NewDust(center4, 8, 8, 229, 0f, 0f, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 0.5f)];
45493 obj4.noGravity = true;
45494 obj4.velocity = vector19;
45495 obj4.position = center4;
45496 }
45497 }
45498 else if (type == 710)
45499 {
45500 alpha -= 25;
45501 if (alpha < 0)
45502 {
45503 alpha = 0;
45504 }
45505 if (Main.rand.Next(4) == 0)
45506 {
45507 int num87;
45508 if (Main.rand.Next(2) == 0)
45509 {
45510 num87 = Dust.NewDust(position, width, height, 31, 0f, 0f, 100, default(Color), 1.6f);
45511 Main.dust[num87].noGravity = true;
45512 }
45513 num87 = Dust.NewDust(position, width, height, 6, 0f, 0f, 100, default(Color), 1.2f);
45514 Main.dust[num87].noGravity = true;
45515 Main.dust[num87].velocity *= 2f;
45516 Main.dust[num87].velocity += velocity;
45517 if (ai[1] == -1f)
45518 {
45519 Main.dust[num87].fadeIn = 1.5f;
45520 }
45521 else
45522 {
45523 Main.dust[num87].fadeIn = 1.22f;
45524 }
45525 if (wet)
45526 {
45527 Kill();
45528 }
45529 }
45530 }
45531 else if (type == 639)
45532 {
45533 if (localAI[0] == 0f && localAI[1] == 0f)
45534 {
45535 localAI[0] = base.Center.X;
45536 localAI[1] = base.Center.Y;
45537 ai[0] = velocity.X;
45538 ai[1] = velocity.Y;
45539 }
45540 alpha -= 25;
45541 if (alpha < 0)
45542 {
45543 alpha = 0;
45544 }
45545 }
45546 else if (type == 640)
45547 {
45548 alpha -= 25;
45549 if (alpha < 0)
45550 {
45551 alpha = 0;
45552 }
45553 if (velocity == Vector2.Zero)
45554 {
45555 ai[0] = 0f;
45556 bool flag = true;
45557 for (int num88 = 1; num88 < oldPos.Length; num88++)
45558 {
45559 if (oldPos[num88] != oldPos[0])
45560 {
45561 flag = false;
45562 }
45563 }
45564 if (flag)
45565 {
45566 Kill();
45567 return;
45568 }
45569 if (Main.rand.Next(extraUpdates) == 0 && (velocity != Vector2.Zero || Main.rand.Next((localAI[1] == 2f) ? 2 : 6) == 0))
45570 {
45571 for (int num89 = 0; num89 < 2; num89++)
45572 {
45573 float num90 = rotation + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
45574 float num91 = (float)Main.rand.NextDouble() * 0.8f + 1f;
45575 Vector2 vector20 = new Vector2((float)Math.Cos(num90) * num91, (float)Math.Sin(num90) * num91);
45576 int num92 = Dust.NewDust(base.Center, 0, 0, 229, vector20.X, vector20.Y);
45577 Main.dust[num92].noGravity = true;
45578 Main.dust[num92].scale = 1.2f;
45579 }
45580 if (Main.rand.Next(10) == 0)
45581 {
45582 Vector2 vector21 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
45583 int num93 = Dust.NewDust(base.Center + vector21 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
45584 Main.dust[num93].velocity *= 0.5f;
45585 Main.dust[num93].velocity.Y = 0f - Math.Abs(Main.dust[num93].velocity.Y);
45586 }
45587 }
45588 }
45589 else if (numUpdates == 1)
45590 {
45591 float num94 = rotation + (float)Math.PI / 2f + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
45592 float num95 = (float)Main.rand.NextDouble() * 0.25f + 0.25f;
45593 Vector2 vector22 = new Vector2((float)Math.Cos(num94) * num95, (float)Math.Sin(num94) * num95);
45594 int num96 = Dust.NewDust(position, 0, 0, 229, vector22.X, vector22.Y);
45595 Main.dust[num96].noGravity = true;
45596 Main.dust[num96].scale = 1.2f;
45597 }
45598 }
45599 if (type == 41)
45600 {
45601 int num97 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.6f);
45602 Main.dust[num97].noGravity = true;
45603 num97 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2f);
45604 Main.dust[num97].noGravity = true;
45605 }
45606 else if (type == 55)
45607 {
45608 int num98 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 18, 0f, 0f, 0, default(Color), 0.9f);
45609 Main.dust[num98].noGravity = true;
45610 }
45611 else if (type == 719)
45612 {
45613 if (Main.rand.Next(2) == 0)
45614 {
45615 Dust.NewDustDirect(position - velocity, width, height, 147, 0f, 0f, 0, default(Color), 0.9f).noGravity = true;
45616 }
45617 if (localAI[0] == 0f)
45618 {
45619 localAI[0] = 1f;
45620 for (int num99 = 0; num99 < 20; num99++)
45621 {
45622 Dust dust3 = Dust.NewDustDirect(position - velocity, width, height, 147, 0f, 0f, 0, default(Color), 1.3f);
45623 dust3.noGravity = true;
45624 dust3.velocity += velocity * 0.75f;
45625 }
45626 for (int num100 = 0; num100 < 10; num100++)
45627 {
45628 Dust dust4 = Dust.NewDustDirect(position - velocity, width, height, 147, 0f, 0f, 0, default(Color), 1.3f);
45629 dust4.noGravity = true;
45630 dust4.velocity *= 2f;
45631 }
45632 }
45633 }
45634 else if (type == 763)
45635 {
45636 if (localAI[0] == 0f)
45637 {
45638 localAI[0] = 1f;
45639 for (int num101 = 0; num101 < 5; num101++)
45640 {
45641 Dust dust5 = Dust.NewDustDirect(position - velocity, width, height, 40, 0f, 0f, 0, default(Color), 1.1f);
45642 dust5.noGravity = true;
45643 dust5.velocity *= 1.5f;
45644 }
45645 }
45646 }
45647 else if (type == 772)
45648 {
45649 if (Main.rand.Next(7) == 0)
45650 {
45651 for (int num102 = 0; num102 < 1; num102++)
45652 {
45653 Dust dust6 = Dust.NewDustDirect(position - velocity, width, height, Main.rand.NextFromList<int>(86, 87, 88, 89, 90, 91, 138), 0f, 0f, 0, default(Color), 0.7f);
45654 dust6.noGravity = true;
45655 dust6.velocity = velocity * 0.6f;
45656 dust6.fadeIn = 0.8f;
45657 }
45658 }
45659 }
45660 else if (type == 374)
45661 {
45662 if (localAI[0] == 0f)
45663 {
45665 localAI[0] = 1f;
45666 }
45667 if (Main.rand.Next(2) == 0)
45668 {
45669 int num103 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 18, 0f, 0f, 0, default(Color), 0.9f);
45670 Main.dust[num103].noGravity = true;
45671 Main.dust[num103].velocity *= 0.5f;
45672 }
45673 }
45674 else if (type == 376)
45675 {
45676 if (localAI[0] == 0f)
45677 {
45679 }
45680 localAI[0] += 1f;
45681 if (localAI[0] > 3f)
45682 {
45683 int num104 = 1;
45684 if (localAI[0] > 5f)
45685 {
45686 num104 = 2;
45687 }
45688 for (int num105 = 0; num105 < num104; num105++)
45689 {
45690 int num106 = Dust.NewDust(new Vector2(position.X, position.Y + 2f), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
45691 Main.dust[num106].noGravity = true;
45692 Main.dust[num106].velocity.X *= 0.3f;
45693 Main.dust[num106].velocity.Y *= 0.3f;
45694 Main.dust[num106].noLight = true;
45695 }
45696 if (wet && !lavaWet)
45697 {
45698 Kill();
45699 return;
45700 }
45701 }
45702 }
45703 else if (type == 91 && Main.rand.Next(2) == 0)
45704 {
45705 int num108 = Dust.NewDust(Type: (Main.rand.Next(2) != 0) ? 58 : 15, Position: position, Width: width, Height: height, SpeedX: velocity.X * 0.25f, SpeedY: velocity.Y * 0.25f, Alpha: 150, newColor: default(Color), Scale: 0.9f);
45706 Main.dust[num108].velocity *= 0.25f;
45707 }
45708 if (type == 163 || type == 310 || type == 1008 || type == 1010 || type == 1009 || type == 1011)
45709 {
45710 if (alpha > 0)
45711 {
45712 alpha -= 25;
45713 }
45714 if (alpha < 0)
45715 {
45716 alpha = 0;
45717 }
45718 }
45719 switch (type)
45720 {
45721 case 14:
45722 case 20:
45723 case 36:
45724 case 83:
45725 case 84:
45726 case 89:
45727 case 100:
45728 case 104:
45729 case 110:
45730 case 158:
45731 case 159:
45732 case 160:
45733 case 161:
45734 case 180:
45735 case 279:
45736 case 283:
45737 case 284:
45738 case 285:
45739 case 286:
45740 case 287:
45741 case 389:
45742 if (alpha > 0)
45743 {
45744 alpha -= 15;
45745 }
45746 if (alpha < 0)
45747 {
45748 alpha = 0;
45749 }
45750 break;
45751 case 576:
45752 case 577:
45753 localAI[1] += 1f;
45754 if (localAI[1] > 2f)
45755 {
45756 if (alpha > 0)
45757 {
45758 alpha -= 15;
45759 }
45760 if (alpha < 0)
45761 {
45762 alpha = 0;
45763 }
45764 }
45765 break;
45766 }
45767 if (type == 484)
45768 {
45769 int num109 = Dust.NewDust(position, width, height, 78);
45770 Main.dust[num109].noGravity = true;
45771 Main.dust[num109].velocity *= 0.1f;
45772 Main.dust[num109].scale = 0.75f;
45773 Main.dust[num109].position = (Main.dust[num109].position + base.Center) / 2f;
45774 Main.dust[num109].position += velocity * Main.rand.Next(0, 101) * 0.01f;
45775 }
45776 if (type == 242 || type == 302 || type == 438 || type == 462 || type == 592)
45777 {
45778 float num110 = (float)Math.Sqrt(velocity.X * velocity.X + velocity.Y * velocity.Y);
45779 if (alpha > 0)
45780 {
45781 alpha -= (byte)((double)num110 * 0.9);
45782 }
45783 if (alpha < 0)
45784 {
45785 alpha = 0;
45786 }
45787 }
45788 if (type == 660)
45789 {
45790 DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f;
45791 Utils.PlotTileLine(base.Center, base.Center + velocity * 10f, 8f, DelegateMethods.CastLightOpen);
45792 if (alpha > 0)
45793 {
45795 alpha = 0;
45796 scale = 1.1f;
45797 frame = Main.rand.Next(14);
45798 float num111 = 16f;
45799 for (int num112 = 0; (float)num112 < num111; num112++)
45800 {
45801 Vector2 spinningpoint5 = Vector2.UnitX * 0f;
45802 spinningpoint5 += -Vector2.UnitY.RotatedBy((float)num112 * ((float)Math.PI * 2f / num111)) * new Vector2(1f, 4f);
45803 spinningpoint5 = spinningpoint5.RotatedBy(velocity.ToRotation());
45804 int num113 = Dust.NewDust(base.Center, 0, 0, 180);
45805 Main.dust[num113].scale = 1.5f;
45806 Main.dust[num113].noGravity = true;
45807 Main.dust[num113].position = base.Center + spinningpoint5;
45808 Main.dust[num113].velocity = velocity * 0f + spinningpoint5.SafeNormalize(Vector2.UnitY) * 1f;
45809 }
45810 }
45811 }
45812 if (type == 712)
45813 {
45814 DelegateMethods.v3_1 = new Vector3(0.4f, 0.4f, 0.4f) * 0.7f;
45815 Utils.PlotTileLine(base.Center, base.Center + velocity * 10f, 8f, DelegateMethods.CastLightOpen);
45816 if (alpha == 255)
45817 {
45818 frame = Main.rand.Next(2) * 4;
45819 }
45820 if (++frameCounter >= 4)
45821 {
45822 frameCounter = 0;
45823 frame++;
45824 if (frame == 4)
45825 {
45826 frame = 0;
45827 }
45828 if (frame >= 8)
45829 {
45830 frame = 4;
45831 }
45832 }
45833 if (alpha > 0)
45834 {
45835 alpha = 0;
45836 scale = 1.1f;
45837 frame = Main.rand.Next(14);
45838 float num114 = 4f;
45839 for (int num115 = 0; (float)num115 < num114; num115++)
45840 {
45841 Vector2 spinningpoint6 = Vector2.UnitX * 0f;
45842 spinningpoint6 += -Vector2.UnitY.RotatedBy((float)num115 * ((float)Math.PI * 2f / num114)) * new Vector2(1f, 4f);
45843 spinningpoint6 = spinningpoint6.RotatedBy(velocity.ToRotation());
45844 int num116 = Dust.NewDust(base.Center, 0, 0, 15);
45845 Main.dust[num116].scale = 1.7f;
45846 Main.dust[num116].noGravity = true;
45847 Main.dust[num116].position = base.Center + spinningpoint6 + velocity.SafeNormalize(Vector2.Zero) * 50f;
45848 Main.dust[num116].velocity = Main.dust[num116].velocity * 2f + spinningpoint6.SafeNormalize(Vector2.UnitY) * 0.3f + velocity.SafeNormalize(Vector2.Zero) * 3f;
45849 Main.dust[num116].velocity *= 0.7f;
45850 Main.dust[num116].position += Main.dust[num116].velocity * 5f;
45851 }
45852 }
45853 }
45854 if (type == 661)
45855 {
45856 if (alpha <= 0)
45857 {
45858 for (int num117 = 0; num117 < 3; num117++)
45859 {
45860 int num118 = Dust.NewDust(position, width, height, 240);
45861 Main.dust[num118].noGravity = true;
45862 Main.dust[num118].velocity *= 0.3f;
45863 Main.dust[num118].noLight = true;
45864 }
45865 }
45866 if (alpha > 0)
45867 {
45868 alpha -= 55;
45869 scale = 1.3f;
45870 if (alpha < 0)
45871 {
45872 alpha = 0;
45873 float num119 = 16f;
45874 for (int num120 = 0; (float)num120 < num119; num120++)
45875 {
45876 Vector2 spinningpoint7 = Vector2.UnitX * 0f;
45877 spinningpoint7 += -Vector2.UnitY.RotatedBy((float)num120 * ((float)Math.PI * 2f / num119)) * new Vector2(1f, 4f);
45878 spinningpoint7 = spinningpoint7.RotatedBy(velocity.ToRotation());
45879 int num121 = Dust.NewDust(base.Center, 0, 0, 62);
45880 Main.dust[num121].scale = 1.5f;
45881 Main.dust[num121].noLight = true;
45882 Main.dust[num121].noGravity = true;
45883 Main.dust[num121].position = base.Center + spinningpoint7;
45884 Main.dust[num121].velocity = Main.dust[num121].velocity * 4f + velocity * 0.3f;
45885 }
45886 }
45887 }
45888 }
45889 if (type == 706)
45890 {
45891 if (wet)
45892 {
45893 Kill();
45894 return;
45895 }
45896 SlotId val;
45897 if (localAI[1] == 0f)
45898 {
45899 float[] array = localAI;
45901 array[0] = ((SlotId)(ref val)).ToFloat();
45902 localAI[1] += 1f;
45903 for (int num122 = 0; num122 < 15; num122++)
45904 {
45905 if (Main.rand.Next(4) != 0)
45906 {
45907 Dust dust7 = Dust.NewDustDirect(base.Center - base.Size / 4f, width / 2, height / 2, Utils.SelectRandom<int>(Main.rand, 6, 31, 31));
45908 dust7.noGravity = true;
45909 dust7.velocity *= 2.3f;
45910 dust7.fadeIn = 1.5f;
45911 dust7.noLight = true;
45912 }
45913 }
45914 }
45916 if (activeSound != null)
45917 {
45918 activeSound.Position = base.Center;
45919 }
45920 else
45921 {
45922 float[] array2 = localAI;
45923 val = SlotId.Invalid;
45924 array2[0] = ((SlotId)(ref val)).ToFloat();
45925 }
45926 if (alpha <= 0)
45927 {
45928 for (int num123 = 0; num123 < 2; num123++)
45929 {
45930 if (Main.rand.Next(4) != 0)
45931 {
45932 Dust dust8 = Dust.NewDustDirect(base.Center - base.Size / 4f, width / 2, height / 2, Utils.SelectRandom<int>(Main.rand, 6, 31, 31));
45933 dust8.noGravity = true;
45934 dust8.velocity *= 2.3f;
45935 dust8.fadeIn = 1.5f;
45936 dust8.noLight = true;
45937 }
45938 }
45939 Vector2 spinningpoint8 = new Vector2(0f, (float)Math.Cos((float)frameCounter * ((float)Math.PI * 2f) / 40f - (float)Math.PI / 2f)) * 16f;
45941 Vector2 vector23 = velocity.SafeNormalize(Vector2.Zero);
45942 for (int num124 = 0; num124 < 1; num124++)
45943 {
45944 Dust dust9 = Dust.NewDustDirect(base.Center - base.Size / 4f, width / 2, height / 2, 6);
45945 dust9.noGravity = true;
45946 dust9.position = base.Center + spinningpoint8;
45947 dust9.velocity *= 0f;
45948 dust9.fadeIn = 1.4f;
45949 dust9.scale = 1.15f;
45950 dust9.noLight = true;
45951 dust9.position += velocity * 1.2f;
45952 dust9.velocity += vector23 * 2f;
45953 Dust dust10 = Dust.NewDustDirect(base.Center - base.Size / 4f, width / 2, height / 2, 6);
45954 dust10.noGravity = true;
45955 dust10.position = base.Center + spinningpoint8;
45956 dust10.velocity *= 0f;
45957 dust10.fadeIn = 1.4f;
45958 dust10.scale = 1.15f;
45959 dust10.noLight = true;
45960 dust10.position += velocity * 0.5f;
45961 dust10.position += velocity * 1.2f;
45962 dust10.velocity += vector23 * 2f;
45963 }
45964 }
45965 if (++frameCounter >= 40)
45966 {
45967 frameCounter = 0;
45968 }
45969 frame = frameCounter / 5;
45970 if (alpha > 0)
45971 {
45972 alpha -= 55;
45973 if (alpha < 0)
45974 {
45975 alpha = 0;
45976 float num125 = 16f;
45977 for (int num126 = 0; (float)num126 < num125; num126++)
45978 {
45979 Vector2 spinningpoint9 = Vector2.UnitX * 0f;
45980 spinningpoint9 += -Vector2.UnitY.RotatedBy((float)num126 * ((float)Math.PI * 2f / num125)) * new Vector2(1f, 4f);
45981 spinningpoint9 = spinningpoint9.RotatedBy(velocity.ToRotation());
45982 int num127 = Dust.NewDust(base.Center, 0, 0, 6);
45983 Main.dust[num127].scale = 1.5f;
45984 Main.dust[num127].noLight = true;
45985 Main.dust[num127].noGravity = true;
45986 Main.dust[num127].position = base.Center + spinningpoint9;
45987 Main.dust[num127].velocity = Main.dust[num127].velocity * 4f + velocity * 0.3f;
45988 }
45989 }
45990 }
45991 DelegateMethods.v3_1 = new Vector3(1f, 0.6f, 0.2f);
45992 Utils.PlotTileLine(base.Center, base.Center + velocity * 4f, 40f, DelegateMethods.CastLightOpen);
45993 }
45994 if (type == 638)
45995 {
45996 float num128 = velocity.Length();
45997 if (alpha > 0)
45998 {
45999 alpha -= (byte)((double)num128 * 0.3);
46000 }
46001 if (alpha < 0)
46002 {
46003 alpha = 0;
46004 }
46005 Rectangle hitbox = base.Hitbox;
46006 hitbox.Offset((int)velocity.X, (int)velocity.Y);
46007 bool flag2 = false;
46008 for (int num129 = 0; num129 < 200; num129++)
46009 {
46010 NPC nPC = Main.npc[num129];
46011 if (nPC.active && !nPC.dontTakeDamage && nPC.immune[owner] == 0 && localNPCImmunity[num129] == 0 && nPC.Hitbox.Intersects(hitbox) && !nPC.friendly)
46012 {
46013 flag2 = true;
46014 break;
46015 }
46016 }
46017 if (flag2)
46018 {
46019 int num130 = Main.rand.Next(15, 31);
46020 for (int num131 = 0; num131 < num130; num131++)
46021 {
46022 int num132 = Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100, default(Color), 0.8f);
46023 Main.dust[num132].velocity *= 1.6f;
46024 Main.dust[num132].velocity.Y -= 1f;
46025 Main.dust[num132].velocity += velocity;
46026 Main.dust[num132].noGravity = true;
46027 }
46028 }
46029 }
46030 if (type == 257 || type == 593)
46031 {
46032 if (alpha > 0)
46033 {
46034 alpha -= 10;
46035 }
46036 if (alpha < 0)
46037 {
46038 alpha = 0;
46039 }
46040 }
46041 if (type == 876)
46042 {
46043 if (ai[1] == 0f)
46044 {
46045 tileCollide = true;
46046 }
46047 else
46048 {
46049 tileCollide = false;
46050 }
46051 if (alpha > 0)
46052 {
46053 alpha -= 10;
46054 }
46055 if (alpha < 0)
46056 {
46057 alpha = 0;
46058 }
46059 }
46060 if (type == 88)
46061 {
46062 if (alpha > 0)
46063 {
46064 alpha -= 10;
46065 }
46066 if (alpha < 0)
46067 {
46068 alpha = 0;
46069 }
46070 }
46071 if (type == 532)
46072 {
46073 ai[0] += 1f;
46074 }
46075 bool flag3 = true;
46076 bool flag4 = false;
46077 switch (type)
46078 {
46079 case 5:
46080 case 14:
46081 case 20:
46082 case 36:
46083 case 38:
46084 case 55:
46085 case 83:
46086 case 84:
46087 case 88:
46088 case 89:
46089 case 98:
46090 case 100:
46091 case 104:
46092 case 110:
46093 case 158:
46094 case 159:
46095 case 160:
46096 case 161:
46097 case 180:
46098 case 184:
46099 case 242:
46100 case 248:
46101 case 257:
46102 case 259:
46103 case 265:
46104 case 270:
46105 case 279:
46106 case 283:
46107 case 284:
46108 case 285:
46109 case 286:
46110 case 287:
46111 case 299:
46112 case 302:
46113 case 323:
46114 case 325:
46115 case 348:
46116 case 349:
46117 case 350:
46118 case 355:
46119 case 374:
46120 case 376:
46121 case 389:
46122 case 435:
46123 case 436:
46124 case 438:
46125 case 440:
46126 case 442:
46127 case 449:
46128 case 459:
46129 case 462:
46130 case 467:
46131 case 468:
46132 case 469:
46133 case 472:
46134 case 483:
46135 case 484:
46136 case 485:
46137 case 498:
46138 case 576:
46139 case 577:
46140 case 585:
46141 case 592:
46142 case 593:
46143 case 601:
46144 case 606:
46145 case 616:
46146 case 634:
46147 case 635:
46148 case 638:
46149 case 639:
46150 case 660:
46151 case 661:
46152 case 682:
46153 case 684:
46154 case 706:
46155 case 709:
46156 case 710:
46157 case 712:
46158 case 876:
46159 case 980:
46160 case 981:
46161 flag3 = false;
46162 break;
46163 case 1006:
46164 flag4 = true;
46165 break;
46166 }
46167 if (flag3)
46168 {
46169 ai[0] += 1f;
46170 }
46171 if (type == 1006 && Main.rand.Next(8) == 0)
46172 {
46173 Dust dust11 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(4f, 4f), 306, velocity * 1.25f, 0, Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f), 1f + Main.rand.NextFloat() * 0.4f);
46174 dust11.noGravity = true;
46175 dust11.fadeIn = dust11.scale + 0.05f;
46176 Dust dust12 = Dust.CloneDust(dust11);
46177 dust12.color = Color.White;
46178 dust12.scale -= 0.3f;
46179 }
46180 if (type == 270)
46181 {
46182 int num133 = 0;
46183 num133 = Player.FindClosest(base.Center, 1, 1);
46184 ai[1] += 1f;
46185 if (ai[1] < 110f && ai[1] > 30f)
46186 {
46187 float num134 = velocity.Length();
46188 Vector2 vector24 = Main.player[num133].Center - base.Center;
46189 vector24.Normalize();
46190 vector24 *= num134;
46191 velocity = (velocity * 24f + vector24) / 25f;
46193 velocity *= num134;
46194 }
46195 if (velocity.Length() < 18f)
46196 {
46197 velocity *= 1.02f;
46198 }
46199 if (localAI[0] == 0f)
46200 {
46201 localAI[0] = 1f;
46203 for (int num135 = 0; num135 < 10; num135++)
46204 {
46205 int num136 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 5, velocity.X, velocity.Y, 0, default(Color), 2f);
46206 Main.dust[num136].noGravity = true;
46207 Main.dust[num136].velocity = base.Center - Main.dust[num136].position;
46208 Main.dust[num136].velocity.Normalize();
46209 Main.dust[num136].velocity *= -5f;
46210 Main.dust[num136].velocity += velocity / 2f;
46211 }
46212 }
46213 }
46214 if (type == 585)
46215 {
46216 if (localAI[0] == 0f)
46217 {
46218 localAI[0] = 1f;
46220 for (int num137 = 0; num137 < 3; num137++)
46221 {
46222 int num138 = Dust.NewDust(position, width, height, 27, velocity.X, velocity.Y, 0, default(Color), 2f);
46223 Main.dust[num138].noGravity = true;
46224 Main.dust[num138].velocity = base.Center - Main.dust[num138].position;
46225 Main.dust[num138].velocity.Normalize();
46226 Main.dust[num138].velocity *= -5f;
46227 Main.dust[num138].velocity += velocity / 2f;
46228 Main.dust[num138].noLight = true;
46229 }
46230 }
46231 if (alpha > 0)
46232 {
46233 alpha -= 50;
46234 }
46235 if (alpha < 0)
46236 {
46237 alpha = 0;
46238 }
46239 frameCounter++;
46240 if (frameCounter >= 12)
46241 {
46242 frameCounter = 0;
46243 }
46244 frame = frameCounter / 2;
46245 if (frame > 3)
46246 {
46247 frame = 6 - frame;
46248 }
46249 Vector3 vector25 = NPCID.Sets.MagicAuraColor[54].ToVector3();
46250 Lighting.AddLight(base.Center, vector25.X, vector25.Y, vector25.Z);
46251 if (Main.rand.Next(3) == 0)
46252 {
46253 int num139 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 27, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
46254 Main.dust[num139].position -= velocity * 2f;
46255 Main.dust[num139].noLight = true;
46256 Main.dust[num139].noGravity = true;
46257 Main.dust[num139].velocity.X *= 0.3f;
46258 Main.dust[num139].velocity.Y *= 0.3f;
46259 }
46260 }
46261 if (type == 594)
46262 {
46263 int num140 = (int)(43f - ai[1]) / 13;
46264 if (num140 < 1)
46265 {
46266 num140 = 1;
46267 }
46268 int num141 = ((ai[1] < 20f) ? 6 : 31);
46269 for (int num142 = 0; num142 < num140; num142++)
46270 {
46271 int num143 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, num141, velocity.X * 0.2f, velocity.Y * 0.2f, 0, default(Color), 2f);
46272 Main.dust[num143].position -= velocity * 2f;
46273 Main.dust[num143].noLight = true;
46274 Main.dust[num143].noGravity = true;
46275 Main.dust[num143].velocity.X *= 0.3f;
46276 Main.dust[num143].velocity.Y *= 0.3f;
46277 if (num141 == 6)
46278 {
46279 Main.dust[num143].fadeIn = Main.rand.NextFloat() * 2f;
46280 }
46281 }
46282 ai[1] += 1f;
46283 if (ai[1] > (float)(43 * MaxUpdates))
46284 {
46285 Kill();
46286 return;
46287 }
46288 }
46289 if (type == 622)
46290 {
46291 int num144 = 229;
46292 if (Main.rand.Next(3) != 0)
46293 {
46294 int num145 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, num144, velocity.X * 0.2f, velocity.Y * 0.2f, 0, default(Color), 1.2f);
46295 Main.dust[num145].position -= velocity * 2f;
46296 Main.dust[num145].noLight = true;
46297 Main.dust[num145].noGravity = true;
46298 Main.dust[num145].velocity.X *= 0.3f;
46299 Main.dust[num145].velocity.Y *= 0.3f;
46300 }
46301 ai[1] += 1f;
46302 if (ai[1] > (float)(23 * MaxUpdates))
46303 {
46304 Kill();
46305 return;
46306 }
46307 }
46308 if (type == 587)
46309 {
46310 Color newColor2 = Main.hslToRgb(ai[1], 1f, 0.5f);
46311 newColor2.A = 200;
46312 localAI[0] += 1f;
46313 if (!(localAI[0] < 2f))
46314 {
46315 if (localAI[0] == 2f)
46316 {
46318 for (int num146 = 0; num146 < 4; num146++)
46319 {
46320 int num147 = Dust.NewDust(position, width, height, 76, velocity.X, velocity.Y, 0, newColor2, 1.1f);
46321 Main.dust[num147].noGravity = true;
46322 Main.dust[num147].velocity = base.Center - Main.dust[num147].position;
46323 Main.dust[num147].velocity.Normalize();
46324 Main.dust[num147].velocity *= -3f;
46325 Main.dust[num147].velocity += velocity / 2f;
46326 }
46327 }
46328 else
46329 {
46330 frame++;
46331 if (frame > 2)
46332 {
46333 frame = 0;
46334 }
46335 for (int num148 = 0; num148 < 1; num148++)
46336 {
46337 int num149 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 76, velocity.X * 0.2f, velocity.Y * 0.2f, 0, newColor2, 0.9f);
46338 Main.dust[num149].position = base.Center;
46339 Main.dust[num149].noGravity = true;
46340 Main.dust[num149].velocity = velocity * 0.5f;
46341 }
46342 }
46343 }
46344 }
46345 if (type == 349)
46346 {
46347 frame = (int)ai[0];
46348 velocity.Y += 0.2f;
46349 if (localAI[0] == 0f || localAI[0] == 2f)
46350 {
46351 scale += 0.01f;
46352 alpha -= 50;
46353 if (alpha <= 0)
46354 {
46355 localAI[0] = 1f;
46356 alpha = 0;
46357 }
46358 }
46359 else if (localAI[0] == 1f)
46360 {
46361 scale -= 0.01f;
46362 alpha += 50;
46363 if (alpha >= 255)
46364 {
46365 localAI[0] = 2f;
46366 alpha = 255;
46367 }
46368 }
46369 }
46370 if (type == 348)
46371 {
46372 if (localAI[1] == 0f)
46373 {
46374 localAI[1] = 1f;
46376 }
46377 if (ai[0] == 0f || ai[0] == 2f)
46378 {
46379 scale += 0.01f;
46380 alpha -= 50;
46381 if (alpha <= 0)
46382 {
46383 ai[0] = 1f;
46384 alpha = 0;
46385 }
46386 }
46387 else if (ai[0] == 1f)
46388 {
46389 scale -= 0.01f;
46390 alpha += 50;
46391 if (alpha >= 255)
46392 {
46393 ai[0] = 2f;
46394 alpha = 255;
46395 }
46396 }
46397 }
46398 if (type == 572)
46399 {
46400 if (localAI[0] == 0f)
46401 {
46402 localAI[0] = 1f;
46404 }
46405 for (int num150 = 0; num150 < 2; num150++)
46406 {
46407 int num151 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 40, velocity.X, velocity.Y, 100);
46408 Main.dust[num151].velocity *= 0.5f;
46409 Main.dust[num151].velocity += velocity;
46410 Main.dust[num151].velocity *= 0.5f;
46411 Main.dust[num151].noGravity = true;
46412 Main.dust[num151].scale = 1.2f;
46413 Main.dust[num151].position = (base.Center + position) / 2f;
46414 }
46415 }
46416 if (type == 577)
46417 {
46418 Lighting.AddLight(base.Center, 0.1f, 0.3f, 0.4f);
46419 }
46420 else if (type == 576)
46421 {
46422 Lighting.AddLight(base.Center, 0.4f, 0.2f, 0.4f);
46423 for (int num152 = 0; num152 < 5; num152++)
46424 {
46425 Dust obj5 = Main.dust[Dust.NewDust(position, width, height, 242, velocity.X, velocity.Y, 100)];
46426 obj5.velocity = Vector2.Zero;
46427 obj5.position -= velocity / 5f * num152;
46428 obj5.noGravity = true;
46429 obj5.scale = 0.8f;
46430 obj5.noLight = true;
46431 }
46432 }
46433 else if (type == 581)
46434 {
46435 if (localAI[0] == 0f)
46436 {
46437 localAI[0] = 1f;
46439 }
46440 for (int num153 = 0; num153 < 2; num153++)
46441 {
46442 int num154 = Utils.SelectRandom<int>(Main.rand, 229, 161, 161);
46443 Dust obj6 = Main.dust[Dust.NewDust(position, width, height, num154, velocity.X, velocity.Y, 100)];
46444 obj6.velocity = obj6.velocity / 4f + velocity / 2f;
46445 obj6.noGravity = true;
46446 obj6.scale = 1.2f;
46447 obj6.position = base.Center;
46448 obj6.noLight = true;
46449 }
46450 }
46451 else if (type == 671)
46452 {
46453 if (localAI[0] == 0f)
46454 {
46455 localAI[0] = 1f;
46456 for (int num155 = 0; num155 < 8; num155++)
46457 {
46458 int num156 = Utils.SelectRandom<int>(Main.rand, 27, 62);
46459 Dust obj7 = Main.dust[Dust.NewDust(position, width, height, num156, velocity.X, velocity.Y, 100)];
46460 obj7.velocity = (Main.rand.NextFloatDirection() * (float)Math.PI).ToRotationVector2() * 2f + velocity.SafeNormalize(Vector2.Zero) * 3f;
46461 obj7.noGravity = true;
46462 obj7.scale = 1.5f;
46463 obj7.fadeIn = 1.2f;
46464 obj7.position = base.Center;
46465 obj7.noLight = true;
46466 }
46467 }
46468 alpha -= 20;
46469 if (alpha < 0)
46470 {
46471 alpha = 0;
46472 }
46473 for (int num157 = 0; num157 < 2; num157++)
46474 {
46475 int num158 = Utils.SelectRandom<int>(Main.rand, 27, 27, 62);
46476 Dust obj8 = Main.dust[Dust.NewDust(position, width, height, num158, velocity.X, velocity.Y, 100)];
46477 obj8.velocity = obj8.velocity / 4f + velocity / 2f;
46478 obj8.noGravity = true;
46479 obj8.scale = 1.2f;
46480 obj8.position = base.Center;
46481 obj8.noLight = true;
46482 }
46483 }
46484 else if (type == 811)
46485 {
46486 if (localAI[0] == 0f)
46487 {
46489 localAI[0] = 1f;
46490 for (int num159 = 0; num159 < 8; num159++)
46491 {
46492 Dust obj9 = Main.dust[Dust.NewDust(position, width, height, 5, velocity.X, velocity.Y, 100)];
46493 obj9.velocity = (Main.rand.NextFloatDirection() * (float)Math.PI).ToRotationVector2() * 2f + velocity.SafeNormalize(Vector2.Zero) * 3f;
46494 obj9.scale = 1.5f;
46495 obj9.fadeIn = 1.7f;
46496 obj9.position = base.Center;
46497 }
46498 }
46499 alpha -= 20;
46500 if (alpha < 0)
46501 {
46502 alpha = 0;
46503 }
46504 for (int num160 = 0; num160 < 2; num160++)
46505 {
46506 Dust obj10 = Main.dust[Dust.NewDust(position, width, height, 5, velocity.X, velocity.Y, 100)];
46507 obj10.velocity = obj10.velocity / 4f + velocity / 2f;
46508 obj10.scale = 1.2f;
46509 obj10.position = base.Center + Main.rand.NextFloat() * velocity * 2f;
46510 }
46511 }
46512 else if (type == 819)
46513 {
46514 if (localAI[0] == 0f)
46515 {
46516 localAI[0] = 1f;
46517 for (int num161 = 0; num161 < 8; num161++)
46518 {
46519 Dust obj11 = Main.dust[Dust.NewDust(position, width, height, 5, velocity.X, velocity.Y, 100)];
46520 obj11.velocity = (Main.rand.NextFloatDirection() * (float)Math.PI).ToRotationVector2() * 2f + velocity.SafeNormalize(Vector2.Zero) * 2f;
46521 obj11.scale = 0.9f;
46522 obj11.fadeIn = 1.3f;
46523 obj11.position = base.Center;
46524 }
46525 }
46526 alpha -= 20;
46527 if (alpha < 0)
46528 {
46529 alpha = 0;
46530 }
46531 for (int num162 = 1; num162 < 6; num162++)
46532 {
46533 Dust obj12 = Main.dust[Dust.NewDust(position, width, height, 5, 0f, 0f, 100)];
46534 obj12.velocity = obj12.velocity * 0.5f + velocity * 0.5f;
46535 obj12.velocity *= 0.25f;
46536 obj12.scale = 0.9f;
46537 obj12.position = base.Center - velocity * num162 / 5f;
46538 }
46539 if (Main.rand.Next(2) == 0)
46540 {
46541 Dust dust13 = Dust.NewDustPerfect(base.Center - velocity * 3f, 267, velocity * 0.5f, 0, Color.Red * (Main.rand.NextFloat() * 0.3f + 0.1f));
46542 dust13.noGravity = true;
46543 dust13.scale = 0.7f;
46544 }
46545 Lighting.AddLight(base.Center, 0.3f, 0.05f, 0.05f);
46546 }
46547 else if (type == 814)
46548 {
46549 if (localAI[0] == 0f)
46550 {
46552 localAI[0] = 1f;
46553 for (int num163 = 0; num163 < 8; num163++)
46554 {
46555 Dust obj13 = Main.dust[Dust.NewDust(position, width, height, 5, velocity.X, velocity.Y, 100)];
46556 obj13.velocity = (Main.rand.NextFloatDirection() * (float)Math.PI).ToRotationVector2() * 2f + velocity.SafeNormalize(Vector2.Zero) * 2f;
46557 obj13.scale = 0.9f;
46558 obj13.fadeIn = 1.1f;
46559 obj13.position = base.Center;
46560 }
46561 }
46562 alpha -= 20;
46563 if (alpha < 0)
46564 {
46565 alpha = 0;
46566 }
46567 for (int num164 = 0; num164 < 2; num164++)
46568 {
46569 Dust obj14 = Main.dust[Dust.NewDust(position, width, height, 5, velocity.X, velocity.Y, 100)];
46570 obj14.velocity = obj14.velocity / 4f + velocity / 2f;
46571 obj14.scale = 1.2f;
46572 obj14.position = base.Center + Main.rand.NextFloat() * velocity * 2f;
46573 }
46574 for (int num165 = 1; num165 < oldPos.Length && !(oldPos[num165] == Vector2.Zero); num165++)
46575 {
46576 if (Main.rand.Next(3) == 0)
46577 {
46578 Dust obj15 = Main.dust[Dust.NewDust(oldPos[num165], width, height, 5, velocity.X, velocity.Y, 100)];
46579 obj15.velocity = obj15.velocity / 4f + velocity / 2f;
46580 obj15.scale = 1.2f;
46581 obj15.position = oldPos[num165] + base.Size / 2f + Main.rand.NextFloat() * velocity * 2f;
46582 }
46583 }
46584 }
46585 else if (type == 675)
46586 {
46587 if (localAI[0] == 0f)
46588 {
46589 localAI[0] = 1f;
46591 }
46592 alpha -= 20;
46593 if (alpha < 0)
46594 {
46595 alpha = 0;
46596 }
46597 }
46598 else if (type == 676)
46599 {
46600 if (localAI[0] == 0f)
46601 {
46602 localAI[0] = 1f;
46604 }
46605 alpha -= 20;
46606 if (alpha < 0)
46607 {
46608 alpha = 0;
46609 }
46610 for (int num166 = 0; num166 < 2; num166++)
46611 {
46612 if (Main.rand.Next(5) != 0)
46613 {
46614 int num167 = Utils.SelectRandom<int>(Main.rand, 4, 256);
46615 Dust dust14 = Main.dust[Dust.NewDust(position, width, height, num167, velocity.X, velocity.Y, 100)];
46616 dust14.velocity = dust14.velocity / 4f + velocity / 2f;
46617 dust14.scale = 0.8f + Main.rand.NextFloat() * 0.4f;
46618 dust14.position = base.Center;
46619 dust14.position += new Vector2(width * 2, 0f).RotatedBy((float)Math.PI * 2f * Main.rand.NextFloat()) * Main.rand.NextFloat();
46620 dust14.noLight = true;
46621 if (dust14.type == 4)
46622 {
46623 dust14.color = new Color(80, 170, 40, 120);
46624 }
46625 }
46626 }
46627 }
46628 else if (type == 686)
46629 {
46630 if (localAI[0] == 0f)
46631 {
46632 localAI[0] = 1f;
46634 }
46635 if (ai[0] >= 2f)
46636 {
46637 alpha -= 25;
46638 if (alpha < 0)
46639 {
46640 alpha = 0;
46641 }
46642 }
46643 if (Main.rand.Next(4) == 0)
46644 {
46645 Dust dust15 = Dust.NewDustDirect(position, width, height, 55, 0f, 0f, 200);
46646 dust15.scale *= 0.7f;
46647 dust15.velocity += velocity * 1f;
46648 }
46649 if (Main.rand.Next(3) == 0 && oldPos[9] != Vector2.Zero)
46650 {
46651 Dust dust16 = Dust.NewDustDirect(oldPos[9], width, height, 55, 0f, 0f, 50);
46652 dust16.scale *= 0.85f;
46653 dust16.velocity += velocity * 0.85f;
46654 dust16.color = Color.Purple;
46655 }
46656 }
46657 else if (type == 711)
46658 {
46659 if (localAI[0] == 0f)
46660 {
46661 localAI[0] = 1f;
46662 for (int num168 = 0; num168 < 10; num168++)
46663 {
46664 Dust dust17 = Dust.NewDustDirect(position, width, height, 55, 0f, 0f, 200);
46665 dust17.scale *= 0.65f;
46666 dust17.velocity *= 1.5f;
46667 dust17.velocity += velocity * 0.3f;
46668 dust17.fadeIn = 0.7f;
46669 }
46670 }
46671 if (ai[0] >= 2f)
46672 {
46673 alpha -= 25;
46674 if (alpha < 0)
46675 {
46676 alpha = 0;
46677 }
46678 }
46679 if (Main.rand.Next(4) == 0)
46680 {
46681 Dust dust18 = Dust.NewDustDirect(position, width, height, 55, 0f, 0f, 200);
46682 dust18.scale *= 0.7f;
46683 dust18.velocity += velocity * 1f;
46684 }
46685 if (Main.rand.Next(3) == 0 && oldPos[9] != Vector2.Zero)
46686 {
46687 Dust dust19 = Dust.NewDustDirect(oldPos[9], width, height, 55, 0f, 0f, 50);
46688 dust19.scale *= 0.85f;
46689 dust19.velocity += velocity * 0.85f;
46690 dust19.color = Color.Purple;
46691 }
46692 }
46693 if (type == 299)
46694 {
46695 if (localAI[0] == 6f)
46696 {
46698 for (int num169 = 0; num169 < 40; num169++)
46699 {
46700 int num170 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 181, 0f, 0f, 100);
46701 Main.dust[num170].velocity *= 3f;
46702 Main.dust[num170].velocity += velocity * 0.75f;
46703 Main.dust[num170].scale *= 1.2f;
46704 Main.dust[num170].noGravity = true;
46705 }
46706 }
46707 localAI[0] += 1f;
46708 if (localAI[0] > 6f)
46709 {
46710 for (int num171 = 0; num171 < 3; num171++)
46711 {
46712 int num172 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 181, velocity.X * 0.2f, velocity.Y * 0.2f, 100);
46713 Main.dust[num172].velocity *= 0.6f;
46714 Main.dust[num172].scale *= 1.4f;
46715 Main.dust[num172].noGravity = true;
46716 }
46717 }
46718 }
46719 else if (type == 270 || type == 837)
46720 {
46721 if (type == 270)
46722 {
46723 alpha = 0;
46724 }
46725 if (alpha > 0)
46726 {
46727 alpha -= 50;
46728 }
46729 if (alpha < 0)
46730 {
46731 alpha = 0;
46732 }
46733 frame++;
46734 if (frame > 2)
46735 {
46736 frame = 0;
46737 }
46738 if (type == 270)
46739 {
46740 for (int num173 = 0; num173 < 2; num173++)
46741 {
46742 int num174 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 5, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 1.5f);
46743 Main.dust[num174].position -= velocity;
46744 Main.dust[num174].noGravity = true;
46745 Main.dust[num174].velocity.X *= 0.3f;
46746 Main.dust[num174].velocity.Y *= 0.3f;
46747 }
46748 }
46749 else
46750 {
46751 for (int num175 = 0; num175 < 2; num175++)
46752 {
46753 int num176 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
46754 Main.dust[num176].position -= velocity * 2f;
46755 Main.dust[num176].noGravity = true;
46756 Main.dust[num176].velocity.X *= 0.3f;
46757 Main.dust[num176].velocity.Y *= 0.3f;
46758 }
46759 }
46760 }
46761 if (type == 259)
46762 {
46763 if (alpha > 0)
46764 {
46765 alpha -= 10;
46766 }
46767 if (alpha < 0)
46768 {
46769 alpha = 0;
46770 }
46771 }
46772 if (type == 265)
46773 {
46774 if (alpha > 0)
46775 {
46776 alpha -= 50;
46777 }
46778 if (alpha < 0)
46779 {
46780 alpha = 0;
46781 }
46782 if (alpha == 0)
46783 {
46784 int num177 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 163, velocity.X, velocity.Y, 100, default(Color), 1.2f);
46785 Main.dust[num177].noGravity = true;
46786 Main.dust[num177].velocity *= 0.3f;
46787 Main.dust[num177].velocity -= velocity * 0.4f;
46788 }
46789 }
46790 if (type == 355)
46791 {
46792 if (alpha > 0)
46793 {
46794 alpha -= 50;
46795 }
46796 if (alpha < 0)
46797 {
46798 alpha = 0;
46799 }
46800 if (alpha == 0)
46801 {
46802 int num178 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 205, velocity.X, velocity.Y, 100, default(Color), 1.2f);
46803 Main.dust[num178].noGravity = true;
46804 Main.dust[num178].velocity *= 0.3f;
46805 Main.dust[num178].velocity -= velocity * 0.4f;
46806 }
46807 }
46808 if (type == 981 && Main.rand.Next(6) == 0)
46809 {
46810 int num179 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 279, velocity.X, velocity.Y, 100, default(Color), 1.2f);
46811 Main.dust[num179].noLightEmittence = true;
46812 Main.dust[num179].noGravity = true;
46813 Main.dust[num179].velocity *= 0.2f;
46814 }
46815 if (type == 357)
46816 {
46817 if (alpha < 170)
46818 {
46819 for (int num180 = 0; num180 < 10; num180++)
46820 {
46821 float x = position.X - velocity.X / 10f * (float)num180;
46822 float y = position.Y - velocity.Y / 10f * (float)num180;
46823 int num181 = Dust.NewDust(new Vector2(x, y), 1, 1, 206);
46824 Main.dust[num181].alpha = alpha;
46825 Main.dust[num181].position.X = x;
46826 Main.dust[num181].position.Y = y;
46827 Main.dust[num181].velocity *= 0f;
46828 Main.dust[num181].noGravity = true;
46829 }
46830 }
46831 if (alpha > 0)
46832 {
46833 alpha -= 25;
46834 }
46835 if (alpha < 0)
46836 {
46837 alpha = 0;
46838 }
46839 }
46840 else if (type == 207 || type == 837)
46841 {
46842 if (type == 207 && alpha < 170)
46843 {
46844 for (int num182 = 0; num182 < 10; num182++)
46845 {
46846 float x2 = position.X - velocity.X / 10f * (float)num182;
46847 float y2 = position.Y - velocity.Y / 10f * (float)num182;
46848 int num183 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 75);
46849 Main.dust[num183].alpha = alpha;
46850 Main.dust[num183].position.X = x2;
46851 Main.dust[num183].position.Y = y2;
46852 Main.dust[num183].velocity *= 0f;
46853 Main.dust[num183].noGravity = true;
46854 }
46855 }
46856 float num184 = (float)Math.Sqrt(velocity.X * velocity.X + velocity.Y * velocity.Y);
46857 float num185 = localAI[0];
46858 if (num185 == 0f)
46859 {
46860 localAI[0] = num184;
46861 num185 = num184;
46862 }
46863 if (alpha > 0)
46864 {
46865 alpha -= 25;
46866 }
46867 if (alpha < 0)
46868 {
46869 alpha = 0;
46870 }
46871 float num186 = position.X;
46872 float num187 = position.Y;
46873 float num188 = 300f;
46874 bool flag5 = false;
46875 int num189 = 0;
46876 if (ai[1] == 0f)
46877 {
46878 for (int num190 = 0; num190 < 200; num190++)
46879 {
46880 if (Main.npc[num190].CanBeChasedBy(this) && (ai[1] == 0f || ai[1] == (float)(num190 + 1)))
46881 {
46882 float num191 = Main.npc[num190].position.X + (float)(Main.npc[num190].width / 2);
46883 float num192 = Main.npc[num190].position.Y + (float)(Main.npc[num190].height / 2);
46884 float num193 = Math.Abs(position.X + (float)(width / 2) - num191) + Math.Abs(position.Y + (float)(height / 2) - num192);
46885 if (num193 < num188 && Collision.CanHit(new Vector2(position.X + (float)(width / 2), position.Y + (float)(height / 2)), 1, 1, Main.npc[num190].position, Main.npc[num190].width, Main.npc[num190].height))
46886 {
46887 num188 = num193;
46888 num186 = num191;
46889 num187 = num192;
46890 flag5 = true;
46891 num189 = num190;
46892 }
46893 }
46894 }
46895 if (flag5)
46896 {
46897 ai[1] = num189 + 1;
46898 }
46899 flag5 = false;
46900 }
46901 if (ai[1] > 0f)
46902 {
46903 int num194 = (int)(ai[1] - 1f);
46904 if (Main.npc[num194].active && Main.npc[num194].CanBeChasedBy(this, ignoreDontTakeDamage: true) && !Main.npc[num194].dontTakeDamage)
46905 {
46906 float num195 = Main.npc[num194].position.X + (float)(Main.npc[num194].width / 2);
46907 float num196 = Main.npc[num194].position.Y + (float)(Main.npc[num194].height / 2);
46908 if (Math.Abs(position.X + (float)(width / 2) - num195) + Math.Abs(position.Y + (float)(height / 2) - num196) < 1000f)
46909 {
46910 flag5 = true;
46911 num186 = Main.npc[num194].position.X + (float)(Main.npc[num194].width / 2);
46912 num187 = Main.npc[num194].position.Y + (float)(Main.npc[num194].height / 2);
46913 }
46914 }
46915 else
46916 {
46917 ai[1] = 0f;
46918 }
46919 }
46920 if (!friendly)
46921 {
46922 flag5 = false;
46923 }
46924 if (flag5)
46925 {
46926 float num197 = num185;
46927 Vector2 vector26 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
46928 float num198 = num186 - vector26.X;
46929 float num199 = num187 - vector26.Y;
46930 float num200 = (float)Math.Sqrt(num198 * num198 + num199 * num199);
46931 num200 = num197 / num200;
46932 num198 *= num200;
46933 num199 *= num200;
46934 int num201 = 8;
46935 if (type == 837)
46936 {
46937 num201 = 32;
46938 }
46939 velocity.X = (velocity.X * (float)(num201 - 1) + num198) / (float)num201;
46940 velocity.Y = (velocity.Y * (float)(num201 - 1) + num199) / (float)num201;
46941 }
46942 }
46943 else if (type == 81 || type == 91)
46944 {
46945 if (ai[0] >= 20f)
46946 {
46947 ai[0] = 20f;
46948 velocity.Y += 0.07f;
46949 }
46950 }
46951 else if (type == 174 || type == 605 || type == 920 || type == 921 || type == 926)
46952 {
46953 if (ai[0] >= 5f)
46954 {
46955 ai[0] = 5f;
46956 velocity.Y += 0.15f;
46957 }
46958 }
46959 else if (type == 937)
46960 {
46961 if (ai[0] >= 5f)
46962 {
46963 ai[0] = 5f;
46964 velocity.Y += 0.07f;
46965 }
46966 }
46967 else if (type == 962)
46968 {
46969 frame = (int)ai[1];
46970 if (localAI[0] == 0f)
46971 {
46972 localAI[0] = 1f;
46973 rotation = velocity.ToRotation();
46974 for (int num202 = 0; num202 < 5; num202++)
46975 {
46976 Dust dust20 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(24f, 24f), 16, velocity * MathHelper.Lerp(0.2f, 0.7f, Main.rand.NextFloat()));
46977 dust20.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
46978 dust20.scale = 0.8f + Main.rand.NextFloat() * 0.5f;
46979 }
46980 for (int num203 = 0; num203 < 5; num203++)
46981 {
46982 Dust dust21 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(24f, 24f), 16, Main.rand.NextVector2Circular(2f, 2f) + velocity * MathHelper.Lerp(0.2f, 0.5f, Main.rand.NextFloat()));
46983 dust21.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
46984 dust21.scale = 0.8f + Main.rand.NextFloat() * 0.5f;
46985 dust21.fadeIn = 1f;
46986 }
46987 }
46988 if (ai[0] >= 5f)
46989 {
46990 velocity.Y += 0.15f;
46991 }
46992 }
46993 else if (type == 337)
46994 {
46995 if (position.Y > Main.player[owner].position.Y - 300f)
46996 {
46997 tileCollide = true;
46998 }
46999 if ((double)position.Y < Main.worldSurface * 16.0)
47000 {
47001 tileCollide = true;
47002 }
47003 frame = (int)ai[1];
47004 if (Main.rand.Next(2) == 0)
47005 {
47006 int num204 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 197);
47007 Main.dust[num204].velocity *= 0.5f;
47008 Main.dust[num204].noGravity = true;
47009 }
47010 }
47011 else if (type == 645)
47012 {
47013 if (ai[1] != -1f && position.Y > ai[1])
47014 {
47015 tileCollide = true;
47016 }
47017 if (position.HasNaNs())
47018 {
47019 Kill();
47020 return;
47021 }
47022 bool num205 = WorldGen.SolidTile(Framing.GetTileSafely((int)position.X / 16, (int)position.Y / 16));
47023 Dust dust22 = Main.dust[Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229)];
47024 dust22.position = base.Center;
47025 dust22.velocity = Vector2.Zero;
47026 dust22.noGravity = true;
47027 if (num205)
47028 {
47029 dust22.noLight = true;
47030 }
47031 if (ai[1] == -1f)
47032 {
47033 ai[0] += 1f;
47035 tileCollide = false;
47036 penetrate = -1;
47037 position = base.Center;
47038 width = (height = 140);
47039 base.Center = position;
47040 alpha -= 10;
47041 if (alpha < 0)
47042 {
47043 alpha = 0;
47044 }
47045 if (++frameCounter >= MaxUpdates * 3)
47046 {
47047 frameCounter = 0;
47048 frame++;
47049 }
47050 if (ai[0] >= (float)(Main.projFrames[type] * MaxUpdates * 3))
47051 {
47052 Kill();
47053 }
47054 return;
47055 }
47056 alpha = 255;
47057 if (numUpdates == 0)
47058 {
47059 int num206 = -1;
47060 float num207 = 60f;
47061 for (int num208 = 0; num208 < 200; num208++)
47062 {
47063 NPC nPC2 = Main.npc[num208];
47064 if (nPC2.CanBeChasedBy(this))
47065 {
47066 float num209 = Distance(nPC2.Center);
47067 if (num209 < num207 && Collision.CanHitLine(base.Center, 0, 0, nPC2.Center, 0, 0))
47068 {
47069 num207 = num209;
47070 num206 = num208;
47071 }
47072 }
47073 }
47074 if (num206 != -1)
47075 {
47076 ai[0] = 0f;
47077 ai[1] = -1f;
47078 netUpdate = true;
47079 return;
47080 }
47081 }
47082 }
47083 else if (type >= 424 && type <= 426)
47084 {
47085 if (position.Y > Main.player[owner].position.Y - 300f)
47086 {
47087 tileCollide = true;
47088 }
47089 if ((double)position.Y < Main.worldSurface * 16.0)
47090 {
47091 tileCollide = true;
47092 }
47093 scale = ai[1];
47094 rotation += velocity.X * 2f;
47095 Vector2 vector27 = base.Center + Vector2.Normalize(velocity) * 10f;
47096 Dust obj16 = Main.dust[Dust.NewDust(position, width, height, 6)];
47097 obj16.position = vector27;
47098 obj16.velocity = velocity.RotatedBy(1.5707963705062866) * 0.33f + velocity / 4f;
47099 obj16.position += velocity.RotatedBy(1.5707963705062866);
47100 obj16.fadeIn = 0.5f;
47101 obj16.noGravity = true;
47102 Dust obj17 = Main.dust[Dust.NewDust(position, width, height, 6)];
47103 obj17.position = vector27;
47104 obj17.velocity = velocity.RotatedBy(-1.5707963705062866) * 0.33f + velocity / 4f;
47105 obj17.position += velocity.RotatedBy(-1.5707963705062866);
47106 obj17.fadeIn = 0.5f;
47107 obj17.noGravity = true;
47108 for (int num210 = 0; num210 < 1; num210++)
47109 {
47110 int num211 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6);
47111 Main.dust[num211].velocity *= 0.5f;
47112 Main.dust[num211].scale *= 1.3f;
47113 Main.dust[num211].fadeIn = 1f;
47114 Main.dust[num211].noGravity = true;
47115 }
47116 }
47117 else if (type == 344)
47118 {
47119 if (WorldGen.SolidTile((int)position.X / 16, (int)(position.Y + velocity.Y) / 16 + 1) || WorldGen.SolidTile((int)(position.X + (float)width) / 16, (int)(position.Y + velocity.Y) / 16 + 1))
47120 {
47121 Kill();
47122 return;
47123 }
47124 localAI[1] += 1f;
47125 if (localAI[1] > 5f)
47126 {
47127 alpha -= 50;
47128 if (alpha < 0)
47129 {
47130 alpha = 0;
47131 }
47132 }
47133 frame = (int)ai[1];
47134 if (localAI[1] >= 20f)
47135 {
47136 velocity.Y += 0.15f;
47137 velocity.X *= 0.96f;
47138 }
47139 if (localAI[1] >= 25f)
47140 {
47141 localAI[1] = 20f;
47143 float num212 = 0f;
47144 int num213 = 60;
47145 for (int num214 = 0; num214 < 1000; num214++)
47146 {
47147 Projectile projectile = Main.projectile[num214];
47148 if (projectile.whoAmI != whoAmI && projectile.active && projectile.type == type)
47149 {
47150 Vector2 vector28 = projectile.position - position;
47151 if (!(vector28.Length() > (float)num213))
47152 {
47153 num212 += 1f;
47154 float num215 = Utils.Remap(vector28.Length(), 0f, num213, 1f, 0f);
47155 zero.X += (float)(-Math.Sign(vector28.X)) * num215;
47156 }
47157 }
47158 }
47159 if (num212 > 0f)
47160 {
47162 vector29.Y = 0f;
47163 if (vector29.X == 0f)
47164 {
47165 vector29.X = 1f;
47166 }
47167 velocity += vector29 * 0.25f;
47168 }
47169 }
47170 }
47171 else if (type == 336 || type == 345)
47172 {
47173 if (type == 345 && localAI[0] == 0f)
47174 {
47175 localAI[0] = 1f;
47177 }
47178 if (ai[0] >= 50f)
47179 {
47180 ai[0] = 50f;
47181 velocity.Y += 0.5f;
47182 }
47183 }
47184 else if (type == 246)
47185 {
47186 alpha -= 20;
47187 if (alpha < 0)
47188 {
47189 alpha = 0;
47190 }
47191 if (ai[0] >= 60f)
47192 {
47193 ai[0] = 60f;
47194 velocity.Y += 0.15f;
47195 }
47196 }
47197 else if (type == 311)
47198 {
47199 if (alpha > 0)
47200 {
47201 alpha -= 50;
47202 }
47203 if (alpha < 0)
47204 {
47205 alpha = 0;
47206 }
47207 if (ai[0] >= 30f)
47208 {
47209 ai[0] = 30f;
47210 if (ai[1] == 0f)
47211 {
47212 ai[1] = 1f;
47213 }
47214 velocity.Y += 0.5f;
47215 }
47216 }
47217 else if (type == 312)
47218 {
47219 if (ai[0] >= 5f)
47220 {
47221 alpha = 0;
47222 }
47223 if (ai[0] >= 20f)
47224 {
47225 ai[0] = 30f;
47226 velocity.Y += 0.5f;
47227 }
47228 Lighting.AddLight(base.Center, 0.6f, 0.4f, 0.3f);
47229 }
47230 else if (type != 239 && type != 264)
47231 {
47232 if (type == 176)
47233 {
47234 if (ai[0] >= 15f)
47235 {
47236 ai[0] = 15f;
47237 velocity.Y += 0.05f;
47238 }
47239 }
47240 else if (type == 275 || type == 276)
47241 {
47242 if (alpha > 0)
47243 {
47244 alpha -= 30;
47245 }
47246 if (alpha < 0)
47247 {
47248 alpha = 0;
47249 }
47250 if (ai[0] >= 35f)
47251 {
47252 ai[0] = 35f;
47253 velocity.Y += 0.025f;
47254 }
47255 if (Main.expertMode)
47256 {
47257 float num216 = 18f;
47258 int num217 = Player.FindClosest(base.Center, 1, 1);
47259 Vector2 vector30 = Main.player[num217].Center - base.Center;
47260 vector30.Normalize();
47261 vector30 *= num216;
47262 int num218 = 70;
47263 velocity = (velocity * (num218 - 1) + vector30) / num218;
47264 if (velocity.Length() < 14f)
47265 {
47267 velocity *= 14f;
47268 }
47269 tileCollide = false;
47270 if (timeLeft > 180)
47271 {
47272 timeLeft = 180;
47273 }
47274 }
47275 }
47276 else if (type == 172)
47277 {
47278 if (ai[0] >= 17f)
47279 {
47280 ai[0] = 17f;
47281 velocity.Y += 0.085f;
47282 }
47283 }
47284 else if (type == 117)
47285 {
47286 if (ai[0] >= 35f)
47287 {
47288 ai[0] = 35f;
47289 velocity.Y += 0.06f;
47290 }
47291 }
47292 else if (type == 120)
47293 {
47294 int num219 = Dust.NewDust(new Vector2(position.X - velocity.X, position.Y - velocity.Y), width, height, 67, velocity.X, velocity.Y, 100, default(Color), 1.2f);
47295 Main.dust[num219].noGravity = true;
47296 Main.dust[num219].velocity *= 0.3f;
47297 if (ai[0] >= 30f)
47298 {
47299 ai[0] = 30f;
47300 velocity.Y += 0.05f;
47301 }
47302 }
47303 else if (type == 195)
47304 {
47305 int num220 = 40;
47306 if (ai[0] >= (float)num220)
47307 {
47308 ai[0] = num220;
47309 velocity.Y += 0.15f;
47310 tileCollide = true;
47311 }
47312 else
47313 {
47314 tileCollide = velocity.Y > 0f;
47315 }
47316 }
47317 else if (type == 267 || type == 477 || type == 478 || type == 479)
47318 {
47319 localAI[0] += 1f;
47320 if (localAI[0] > 3f)
47321 {
47322 alpha = 0;
47323 }
47324 if (ai[0] >= 20f)
47325 {
47326 ai[0] = 20f;
47327 if (type != 477)
47328 {
47329 velocity.Y += 0.075f;
47330 }
47331 }
47332 if (type == 479 && Main.myPlayer == owner)
47333 {
47334 if (ai[1] >= 0f)
47335 {
47336 maxPenetrate = (penetrate = -1);
47337 }
47338 else if (penetrate < 0)
47339 {
47340 maxPenetrate = (penetrate = 1);
47341 }
47342 if (ai[1] >= 0f)
47343 {
47344 ai[1] += 1f;
47345 }
47346 if (ai[1] > (float)Main.rand.Next(5, 30))
47347 {
47348 ai[1] = -1000f;
47349 float num221 = velocity.Length();
47351 vector31.Normalize();
47352 int num222 = Main.rand.Next(2, 4);
47353 if (Main.rand.Next(4) == 0)
47354 {
47355 num222++;
47356 }
47357 for (int num223 = 0; num223 < num222; num223++)
47358 {
47359 Vector2 vector32 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
47360 vector32.Normalize();
47361 vector32 += vector31 * 2f;
47362 vector32.Normalize();
47363 vector32 *= num221;
47364 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector32.X, vector32.Y, type, damage, knockBack, owner, 0f, -1000f);
47365 }
47366 }
47367 }
47368 if (type == 478 && Main.myPlayer == owner)
47369 {
47370 ai[1] += 1f;
47371 if (ai[1] > (float)Main.rand.Next(5, 20))
47372 {
47373 if (timeLeft > 40)
47374 {
47375 timeLeft -= 20;
47376 }
47377 ai[1] = 0f;
47378 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, 0f, 0f, 480, (int)((double)damage * 0.8), knockBack * 0.5f, owner);
47379 }
47380 }
47381 }
47382 else if (type == 408)
47383 {
47384 if (ai[0] >= 45f)
47385 {
47386 ai[0] = 45f;
47387 velocity.Y += 0.05f;
47388 }
47389 }
47390 else if (type == 616)
47391 {
47392 if (alpha < 170)
47393 {
47394 float num224 = 3f;
47395 for (int num225 = 0; (float)num225 < num224; num225++)
47396 {
47397 int num226 = Dust.NewDust(position, 1, 1, 229);
47398 Main.dust[num226].position = base.Center - velocity / num224 * num225;
47399 Main.dust[num226].velocity *= 0f;
47400 Main.dust[num226].noGravity = true;
47401 Main.dust[num226].alpha = 200;
47402 Main.dust[num226].scale = 0.5f;
47403 }
47404 }
47405 float num227 = (float)Math.Sqrt(velocity.X * velocity.X + velocity.Y * velocity.Y);
47406 float num228 = localAI[0];
47407 if (num228 == 0f)
47408 {
47409 localAI[0] = num227;
47410 num228 = num227;
47411 }
47412 if (alpha > 0)
47413 {
47414 alpha -= 25;
47415 }
47416 if (alpha < 0)
47417 {
47418 alpha = 0;
47419 }
47420 float num229 = position.X;
47421 float num230 = position.Y;
47422 float num231 = 800f;
47423 bool flag6 = false;
47424 int num232 = 0;
47425 ai[0] += 1f;
47426 if (ai[0] > 20f)
47427 {
47428 ai[0] -= 1f;
47429 if (ai[1] == 0f)
47430 {
47431 for (int num233 = 0; num233 < 200; num233++)
47432 {
47433 if (Main.npc[num233].CanBeChasedBy(this) && (ai[1] == 0f || ai[1] == (float)(num233 + 1)))
47434 {
47435 float num234 = Main.npc[num233].position.X + (float)(Main.npc[num233].width / 2);
47436 float num235 = Main.npc[num233].position.Y + (float)(Main.npc[num233].height / 2);
47437 float num236 = Math.Abs(position.X + (float)(width / 2) - num234) + Math.Abs(position.Y + (float)(height / 2) - num235);
47438 if (num236 < num231 && Collision.CanHit(new Vector2(position.X + (float)(width / 2), position.Y + (float)(height / 2)), 1, 1, Main.npc[num233].position, Main.npc[num233].width, Main.npc[num233].height))
47439 {
47440 num231 = num236;
47441 num229 = num234;
47442 num230 = num235;
47443 flag6 = true;
47444 num232 = num233;
47445 }
47446 }
47447 }
47448 if (flag6)
47449 {
47450 ai[1] = num232 + 1;
47451 }
47452 flag6 = false;
47453 }
47454 if (ai[1] != 0f)
47455 {
47456 int num237 = (int)(ai[1] - 1f);
47457 if (Main.npc[num237].active && Main.npc[num237].CanBeChasedBy(this, ignoreDontTakeDamage: true))
47458 {
47459 float num238 = Main.npc[num237].position.X + (float)(Main.npc[num237].width / 2);
47460 float num239 = Main.npc[num237].position.Y + (float)(Main.npc[num237].height / 2);
47461 if (Math.Abs(position.X + (float)(width / 2) - num238) + Math.Abs(position.Y + (float)(height / 2) - num239) < 1000f)
47462 {
47463 flag6 = true;
47464 num229 = Main.npc[num237].position.X + (float)(Main.npc[num237].width / 2);
47465 num230 = Main.npc[num237].position.Y + (float)(Main.npc[num237].height / 2);
47466 }
47467 }
47468 }
47469 if (!friendly)
47470 {
47471 flag6 = false;
47472 }
47473 if (flag6)
47474 {
47475 float num240 = num228;
47476 Vector2 vector33 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
47477 float num241 = num229 - vector33.X;
47478 float num242 = num230 - vector33.Y;
47479 float num243 = (float)Math.Sqrt(num241 * num241 + num242 * num242);
47480 num243 = num240 / num243;
47481 num241 *= num243;
47482 num242 *= num243;
47483 int num244 = 8;
47484 velocity.X = (velocity.X * (float)(num244 - 1) + num241) / (float)num244;
47485 velocity.Y = (velocity.Y * (float)(num244 - 1) + num242) / (float)num244;
47486 }
47487 }
47488 }
47489 else if (type == 507 || type == 508 || type == 662 || type == 680 || type == 685)
47490 {
47491 if (ai[0] > 60f)
47492 {
47493 velocity.X *= 0.98f;
47494 velocity.Y += 0.3f;
47495 }
47496 }
47497 else if (type == 495)
47498 {
47499 int num245 = Dust.NewDust(new Vector2(position.X - velocity.X, position.Y - velocity.Y), width, height, 27, velocity.X, velocity.Y, 100, default(Color), 1.2f);
47500 Main.dust[num245].noGravity = true;
47501 Main.dust[num245].velocity *= 0.3f;
47502 if (ai[0] >= 30f)
47503 {
47504 ai[0] = 30f;
47505 velocity.Y += 0.04f;
47506 }
47507 }
47508 else if (type == 498)
47509 {
47510 if (localAI[0] == 0f)
47511 {
47512 localAI[0] += 1f;
47514 }
47515 ai[0] += 1f;
47516 if (ai[0] >= 50f)
47517 {
47518 velocity.X *= 0.98f;
47519 velocity.Y += 0.15f;
47520 rotation += (float)direction * 0.5f;
47521 }
47522 else
47523 {
47524 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
47525 }
47526 }
47527 else if (type == 437)
47528 {
47529 if (ai[0] >= 12f)
47530 {
47531 if (ai[0] >= 20f)
47532 {
47533 Kill();
47534 }
47535 alpha += 30;
47536 }
47537 }
47538 else if (type != 442 && type != 634 && type != 635 && type != 675)
47539 {
47540 if (type == 686 || type == 711)
47541 {
47542 if (ai[0] >= 10f)
47543 {
47544 velocity.Y += 0.1f;
47545 }
47546 if (ai[0] >= 20f)
47547 {
47548 velocity.Y += 0.1f;
47549 }
47550 if (ai[0] > 20f)
47551 {
47552 ai[0] = 20f;
47553 }
47554 velocity.X *= 0.99f;
47555 if (velocity.Y > 32f)
47556 {
47557 velocity.Y = 32f;
47558 }
47559 }
47560 else if (type == 639)
47561 {
47562 if (timeLeft <= MaxUpdates * 45 - 14)
47563 {
47564 velocity.Y += 0.1f;
47565 }
47566 }
47567 else if (type == 710)
47568 {
47569 if (ai[0] >= 0f)
47570 {
47571 ai[0] += 1f;
47572 if (ai[0] >= 20f)
47573 {
47574 velocity.Y += 0.2f;
47575 if (velocity.Y > 0f)
47576 {
47577 velocity.X *= 0.98f;
47578 }
47579 if (velocity.Y > 12f)
47580 {
47581 velocity.Y = 12f;
47582 }
47583 }
47584 }
47585 }
47586 else if (ai[0] >= 15f)
47587 {
47588 ai[0] = 15f;
47589 if (flag4)
47590 {
47591 velocity.Y -= 0.1f;
47592 }
47593 else
47594 {
47595 velocity.Y += 0.1f;
47596 }
47597 }
47598 }
47599 }
47600 if (type == 921 || type == 926 || type == 937)
47601 {
47602 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.05f;
47603 }
47604 else if (type == 248)
47605 {
47606 if (velocity.X < 0f)
47607 {
47608 rotation -= (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.05f;
47609 }
47610 else
47611 {
47612 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.05f;
47613 }
47614 }
47615 else if (type == 270 || type == 585 || type == 601 || type == 706 || type == 837)
47616 {
47618 if (direction < 0)
47619 {
47620 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
47621 }
47622 else
47623 {
47624 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
47625 }
47626 }
47627 else if (type == 311)
47628 {
47629 if (ai[1] != 0f)
47630 {
47631 rotation += velocity.X * 0.1f + (float)Main.rand.Next(-10, 11) * 0.025f;
47632 }
47633 else
47634 {
47635 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
47636 }
47637 }
47638 else if (type == 312)
47639 {
47640 rotation += velocity.X * 0.02f;
47641 }
47642 else if (type == 675)
47643 {
47644 rotation += velocity.X * 0.03f;
47645 }
47646 else if (type != 676)
47647 {
47648 if (type == 408)
47649 {
47650 rotation = velocity.ToRotation();
47651 if (direction == -1)
47652 {
47653 rotation += (float)Math.PI;
47654 }
47655 }
47656 else if (type == 435 || type == 459 || type == 682 || type == 709)
47657 {
47658 rotation = velocity.ToRotation();
47659 if (direction == -1)
47660 {
47661 rotation += (float)Math.PI;
47662 }
47663 }
47664 else if (type == 660)
47665 {
47666 rotation = velocity.ToRotation() + (float)Math.PI / 4f;
47667 }
47668 else if (type == 662 || type == 685)
47669 {
47670 rotation = velocity.ToRotation() - (float)Math.PI - (float)Math.PI / 4f;
47671 }
47672 else if (type == 680 || type == 684 || type == 686 || type == 711 || type == 712)
47673 {
47674 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
47675 }
47676 else if (type == 436)
47677 {
47678 rotation = velocity.ToRotation();
47679 rotation += (float)Math.PI;
47680 if (direction == -1)
47681 {
47682 rotation += (float)Math.PI;
47683 }
47684 }
47685 else if (type == 469)
47686 {
47687 if (velocity.X > 0f)
47688 {
47689 spriteDirection = -1;
47690 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
47691 }
47692 else
47693 {
47694 spriteDirection = 1;
47695 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
47696 }
47697 }
47698 else if (type == 477)
47699 {
47700 if (localAI[1] < 5f)
47701 {
47702 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
47703 localAI[1] += 1f;
47704 }
47705 else
47706 {
47707 rotation = (rotation * 2f + (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f) / 3f;
47708 }
47709 }
47710 else if (type == 532)
47711 {
47712 rotation += 0.2f + Math.Abs(velocity.X) * 0.1f;
47713 }
47714 else if (type == 483)
47715 {
47716 rotation += velocity.X * 0.05f;
47717 }
47718 else if (type == 772)
47719 {
47720 rotation += (float)Math.Sign(velocity.X) * (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.05f;
47721 }
47722 else if (type == 485)
47723 {
47724 Vector2 vector34 = new Vector2(ai[0], ai[1]);
47725 velocity = (velocity * 39f + vector34) / 40f;
47726 int num246 = Dust.NewDust(position, width, height, 6);
47727 Main.dust[num246].noGravity = true;
47728 Main.dust[num246].velocity *= 0.2f;
47729 Main.dust[num246].position = (Main.dust[num246].position + base.Center) / 2f;
47730 frameCounter++;
47731 if (frameCounter >= 2)
47732 {
47733 frameCounter = 0;
47734 frame++;
47735 if (frame >= 5)
47736 {
47737 frame = 0;
47738 }
47739 }
47740 if (velocity.X < 0f)
47741 {
47742 spriteDirection = -1;
47743 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
47744 }
47745 else
47746 {
47747 spriteDirection = 1;
47748 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
47749 }
47750 }
47751 else if (type == 640)
47752 {
47753 if (velocity != Vector2.Zero)
47754 {
47755 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
47756 }
47757 }
47758 else if (type == 325)
47759 {
47760 rotation = velocity.ToRotation() - (float)Math.PI / 2f;
47761 }
47762 else if (type != 344 && type != 498)
47763 {
47764 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
47765 }
47766 }
47767 bool flag7 = true;
47768 int num247 = type;
47769 if (num247 == 577)
47770 {
47771 flag7 = false;
47772 }
47773 if (flag7)
47774 {
47775 if (flag4 && velocity.Y < -16f)
47776 {
47777 velocity.Y = -16f;
47778 }
47779 if (velocity.Y > 16f)
47780 {
47781 velocity.Y = 16f;
47782 }
47783 }
47784 }
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static double Cos(double d)
static double Atan2(double y, double x)
static double Sqrt(double d)
static double Abs(double value)
static double Sin(double a)
const double PI
Definition Math.cs:16
static int Sign(decimal value)
Definition Math.cs:1202
static SlotId PlayTrackedSound(SoundStyle style, Vector2 position)
static void PlaySound(int type, Vector2 position, int style=1)
static ActiveSound GetActiveSound(SlotId id)
Vector2 oldPosition
Definition Entity.cs:18
bool honeyWet
Definition Entity.cs:34
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
static Color GetPortalColor(int colorIndex)
static Color[] MagicAuraColor
Definition NPCID.cs:4232
static readonly LegacySoundStyle Item33
Definition SoundID.cs:480
static readonly LegacySoundStyle Item115
Definition SoundID.cs:644
static readonly LegacySoundStyle Item36
Definition SoundID.cs:486
static readonly LegacySoundStyle DD2_SkyDragonsFuryShot
Definition SoundID.cs:954
static readonly LegacySoundStyle DD2_LightningBugZap
Definition SoundID.cs:880
static readonly LegacySoundStyle DD2_DarkMageAttack
Definition SoundID.cs:816
static readonly LegacySoundStyle Item34
Definition SoundID.cs:482
static readonly LegacySoundStyle Item124
Definition SoundID.cs:662
static readonly LegacySoundStyle Item17
Definition SoundID.cs:448
static readonly LegacySoundStyle Item155
Definition SoundID.cs:724
static readonly LegacySoundStyle Item5
Definition SoundID.cs:424
static readonly LegacySoundStyle Item154
Definition SoundID.cs:722
static readonly LegacySoundStyle Item12
Definition SoundID.cs:438
static readonly LegacySoundStyle Item1
Definition SoundID.cs:416
static readonly LegacySoundStyle Item9
Definition SoundID.cs:432
static readonly LegacySoundStyle Item125
Definition SoundID.cs:664
static readonly LegacySoundStyle Item42
Definition SoundID.cs:498
static readonly LegacySoundStyle DD2_BetsyFireballShot
Definition SoundID.cs:800
static readonly LegacySoundStyle Item8
Definition SoundID.cs:430
static readonly LegacySoundStyle DD2_PhantomPhoenixShot
Definition SoundID.cs:948
static readonly LegacySoundStyle Item11
Definition SoundID.cs:436
static readonly LegacySoundStyle Item171
Definition SoundID.cs:756
static readonly LegacySoundStyle Item20
Definition SoundID.cs:454
static readonly LegacySoundStyle Item114
Definition SoundID.cs:642
IEntitySource GetProjectileSource_FromThis()
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 Transparent
Definition Color.cs:76
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.Lighting.AddLight(), Terraria.NPC.AI_121_QueenSlime_GetDustColor(), System.array, System.Math.Atan2(), Terraria.Collision.CanHit(), Terraria.Collision.CanHitLine(), Terraria.DelegateMethods.CastLightOpen(), Terraria.Dust.CloneDust(), System.Math.Cos(), Terraria.ID.SoundID.DD2_BetsyFireballShot, Terraria.ID.SoundID.DD2_DarkMageAttack, Terraria.ID.SoundID.DD2_LightningBugZap, Terraria.ID.SoundID.DD2_PhantomPhoenixShot, Terraria.ID.SoundID.DD2_SkyDragonsFuryShot, Microsoft.Xna.Framework.Vector2.Distance(), Terraria.Main.dust, Terraria.Main.expertMode, Terraria.Player.FindClosest(), ReLogic.Utilities.SlotId.FromFloat(), Terraria.Audio.SoundEngine.GetActiveSound(), Terraria.GameContent.PortalHelper.GetPortalColor(), Terraria.Framing.GetTileSafely(), Terraria.Main.hslToRgb(), ReLogic.Utilities.SlotId.Invalid, Terraria.ID.SoundID.Item1, Terraria.ID.SoundID.Item11, Terraria.ID.SoundID.Item114, Terraria.ID.SoundID.Item115, Terraria.ID.SoundID.Item12, Terraria.ID.SoundID.Item124, Terraria.ID.SoundID.Item125, Terraria.ID.SoundID.Item154, Terraria.ID.SoundID.Item155, Terraria.ID.SoundID.Item17, Terraria.ID.SoundID.Item171, Terraria.ID.SoundID.Item20, Terraria.ID.SoundID.Item33, Terraria.ID.SoundID.Item34, Terraria.ID.SoundID.Item36, Terraria.ID.SoundID.Item42, Terraria.ID.SoundID.Item5, Terraria.ID.SoundID.Item8, Terraria.ID.SoundID.Item9, Microsoft.Xna.Framework.Vector2.Length(), Microsoft.Xna.Framework.MathHelper.Lerp(), Microsoft.Xna.Framework.Vector2.Lerp(), Terraria.ID.NPCID.Sets.MagicAuraColor, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Dust.NewDust(), Terraria.Dust.NewDustDirect(), Terraria.Dust.NewDustPerfect(), Microsoft.Xna.Framework.Vector2.Normalize(), Terraria.Main.npc, System.obj, Microsoft.Xna.Framework.Vector2.One, System.Math.PI, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Audio.SoundEngine.PlayTrackedSound(), Terraria.Utils.PlotTileLine(), Terraria.Main.projectile, Terraria.Main.projFrames, Microsoft.Xna.Framework.Color.Purple, Terraria.Main.rand, Terraria.Utils.RandomVector2(), Microsoft.Xna.Framework.Color.Red, Terraria.Utils.Remap(), Microsoft.Xna.Framework.Scale, System.Math.Sign(), System.Math.Sin(), Terraria.WorldGen.SolidTile(), System.Math.Sqrt(), Microsoft.Xna.Framework.Color.Transparent, System.type, Terraria.Projectile.type, Microsoft.Xna.Framework.Vector2.UnitX, Microsoft.Xna.Framework.Vector2.UnitY, Microsoft.Xna.Framework.Color.White, Terraria.Entity.whoAmI, Terraria.Main.worldSurface, Microsoft.Xna.Framework.Vector2.X, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.Projectile.AI().