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

◆ AI_062()

void Terraria.Projectile.AI_062 ( )
inlineprivate

Definition at line 54501 of file Projectile.cs.

54502 {
54503 float num = 0f;
54504 float num2 = 0f;
54505 float num3 = 20f;
54506 float num4 = 40f;
54507 float num5 = 0.69f;
54508 if (type == 963)
54509 {
54510 if (Main.player[owner].dead)
54511 {
54512 Main.player[owner].abigailMinion = false;
54513 }
54514 if (Main.player[owner].abigailMinion)
54515 {
54516 timeLeft = 2;
54517 }
54518 originalDamage = Main.player[owner].highestAbigailCounterOriginalDamage;
54519 num2 = Main.player[owner].ownedProjectileCounts[970] - 1;
54520 num3 = Math.Max(4f, 18f - num2 * 1.75f);
54521 num = 1.4f;
54522 num4 = Math.Max(5f, num4 - num2 * 4f);
54523 num5 = Math.Min(1f, num5 + num2 * 0.03f);
54524 }
54525 if (type == 423)
54526 {
54527 num4 = 5f;
54528 }
54529 if (type == 373)
54530 {
54531 if (Main.player[owner].dead)
54532 {
54533 Main.player[owner].hornetMinion = false;
54534 }
54535 if (Main.player[owner].hornetMinion)
54536 {
54537 timeLeft = 2;
54538 }
54539 }
54540 if (type == 375)
54541 {
54542 if (Main.player[owner].dead)
54543 {
54544 Main.player[owner].impMinion = false;
54545 }
54546 if (Main.player[owner].impMinion)
54547 {
54548 timeLeft = 2;
54549 }
54550 }
54551 if (type == 407)
54552 {
54553 if (Main.player[owner].dead)
54554 {
54555 Main.player[owner].sharknadoMinion = false;
54556 }
54557 if (Main.player[owner].sharknadoMinion)
54558 {
54559 timeLeft = 2;
54560 }
54561 }
54562 if (type == 423)
54563 {
54564 if (Main.player[owner].dead)
54565 {
54566 Main.player[owner].UFOMinion = false;
54567 }
54568 if (Main.player[owner].UFOMinion)
54569 {
54570 timeLeft = 2;
54571 }
54572 }
54573 if (type == 613)
54574 {
54575 if (Main.player[owner].dead)
54576 {
54577 Main.player[owner].stardustMinion = false;
54578 }
54579 if (Main.player[owner].stardustMinion)
54580 {
54581 timeLeft = 2;
54582 }
54583 Lighting.AddLight(base.Center, 0.2f, 0.6f, 0.7f);
54584 if (localAI[1] > 0f)
54585 {
54586 localAI[1] -= 1f;
54587 }
54588 }
54589 if (type == 423)
54590 {
54591 if (ai[0] == 2f)
54592 {
54593 ai[1] -= 1f;
54594 tileCollide = false;
54595 if (ai[1] > 3f)
54596 {
54597 int num6 = Dust.NewDust(base.Center, 0, 0, 220 + Main.rand.Next(2), velocity.X, velocity.Y, 100);
54598 Main.dust[num6].scale = 0.5f + (float)Main.rand.NextDouble() * 0.3f;
54599 Main.dust[num6].velocity /= 2.5f;
54600 Main.dust[num6].noGravity = true;
54601 Main.dust[num6].noLight = true;
54602 Main.dust[num6].frame.Y = 80;
54603 }
54604 if (ai[1] != 0f)
54605 {
54606 return;
54607 }
54608 ai[1] = 30f;
54609 ai[0] = 0f;
54610 velocity /= 5f;
54611 velocity.Y = 0f;
54612 extraUpdates = 0;
54613 numUpdates = 0;
54614 netUpdate = true;
54615 extraUpdates = 0;
54616 numUpdates = 0;
54617 }
54618 if (extraUpdates > 1)
54619 {
54620 extraUpdates = 0;
54621 }
54622 if (numUpdates > 1)
54623 {
54624 numUpdates = 0;
54625 }
54626 }
54627 if (type == 613)
54628 {
54629 if (ai[0] == 2f)
54630 {
54631 ai[1] -= 1f;
54632 tileCollide = false;
54633 if (ai[1] > 3f)
54634 {
54635 if (numUpdates < 20)
54636 {
54637 for (int i = 0; i < 3; i++)
54638 {
54639 Dust obj = Main.dust[Dust.NewDust(position, width, height, 229)];
54640 obj.noGravity = true;
54641 obj.position = base.Center;
54642 obj.velocity *= 3f;
54643 obj.velocity += velocity * 3f;
54644 obj.fadeIn = 1f;
54645 }
54646 }
54647 float num7 = 2f - (float)numUpdates / 30f;
54648 if (scale > 0f)
54649 {
54650 float num8 = 2f;
54651 for (int j = 0; (float)j < num8; j++)
54652 {
54653 Dust obj2 = Main.dust[Dust.NewDust(position, width, height, 229)];
54654 obj2.noGravity = true;
54655 obj2.position = base.Center + Vector2.UnitY.RotatedBy((float)numUpdates * ((float)Math.PI / 30f) + (float)whoAmI * ((float)Math.PI / 4f) + (float)Math.PI / 2f) * (height / 2) - velocity * ((float)j / num8);
54656 obj2.velocity = velocity / 3f;
54657 obj2.fadeIn = num7 / 2f;
54658 obj2.scale = num7;
54659 }
54660 }
54661 }
54662 if (ai[1] != 0f)
54663 {
54664 return;
54665 }
54666 ai[1] = 30f;
54667 ai[0] = 0f;
54668 velocity /= 5f;
54669 velocity.Y = 0f;
54670 extraUpdates = 0;
54671 numUpdates = 0;
54672 netUpdate = true;
54673 float num9 = 15f;
54674 for (int k = 0; (float)k < num9; k++)
54675 {
54676 Dust dust = Main.dust[Dust.NewDust(position, width, height, 229)];
54677 dust.noGravity = true;
54678 dust.position = base.Center - velocity * 5f;
54679 dust.velocity *= 3f;
54680 dust.velocity += velocity * 3f;
54681 dust.fadeIn = 1f;
54682 if (Main.rand.Next(3) != 0)
54683 {
54684 dust.fadeIn = 2f;
54685 dust.scale = 2f;
54686 dust.velocity /= 8f;
54687 }
54688 }
54689 for (int l = 0; (float)l < num9; l++)
54690 {
54691 Dust dust2 = Main.dust[Dust.NewDust(position, width, height, 229)];
54692 dust2.noGravity = true;
54693 dust2.position = base.Center;
54694 dust2.velocity *= 3f;
54695 dust2.velocity += velocity * 3f;
54696 dust2.fadeIn = 1f;
54697 if (Main.rand.Next(3) != 0)
54698 {
54699 dust2.fadeIn = 2f;
54700 dust2.scale = 2f;
54701 dust2.velocity /= 8f;
54702 }
54703 }
54704 extraUpdates = 0;
54705 numUpdates = 0;
54706 }
54707 if (extraUpdates > 1)
54708 {
54709 extraUpdates = 0;
54710 }
54711 if (numUpdates > 1)
54712 {
54713 numUpdates = 0;
54714 }
54715 }
54716 if (type == 423 && localAI[0] > 0f)
54717 {
54718 localAI[0] -= 1f;
54719 }
54720 if (type == 613 && localAI[0] > 0f)
54721 {
54722 localAI[0] -= 1f;
54723 }
54724 float num10 = 0.05f;
54725 float num11 = width;
54726 if (type == 407)
54727 {
54728 num10 = 0.1f;
54729 num11 *= 2f;
54730 }
54731 for (int m = 0; m < 1000; m++)
54732 {
54733 if (m != whoAmI && Main.projectile[m].active && Main.projectile[m].owner == owner && Main.projectile[m].type == type && Math.Abs(position.X - Main.projectile[m].position.X) + Math.Abs(position.Y - Main.projectile[m].position.Y) < num11)
54734 {
54735 if (position.X < Main.projectile[m].position.X)
54736 {
54737 velocity.X -= num10;
54738 }
54739 else
54740 {
54741 velocity.X += num10;
54742 }
54743 if (position.Y < Main.projectile[m].position.Y)
54744 {
54745 velocity.Y -= num10;
54746 }
54747 else
54748 {
54749 velocity.Y += num10;
54750 }
54751 }
54752 }
54754 float num12 = 400f;
54755 if (type == 423)
54756 {
54757 num12 = 300f;
54758 }
54759 if (type == 613)
54760 {
54761 num12 = 300f;
54762 }
54763 num12 = 2000f;
54764 if (type == 963)
54765 {
54766 num12 = 700f;
54767 }
54768 bool flag = false;
54769 int num13 = -1;
54770 tileCollide = true;
54771 if (type == 963)
54772 {
54773 tileCollide = false;
54774 }
54775 if (type == 407)
54776 {
54777 tileCollide = false;
54778 if (Collision.SolidCollision(position, width, height))
54779 {
54780 alpha += 20;
54781 if (alpha > 150)
54782 {
54783 alpha = 150;
54784 }
54785 }
54786 else
54787 {
54788 alpha -= 50;
54789 if (alpha < 60)
54790 {
54791 alpha = 60;
54792 }
54793 }
54794 }
54795 if (type == 407 || type == 613 || type == 423)
54796 {
54797 Vector2 center = Main.player[owner].Center;
54798 Vector2 vector2 = new Vector2(0.5f);
54799 if (type == 423)
54800 {
54801 vector2.Y = 0f;
54802 }
54804 if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(this))
54805 {
54806 Vector2 vector3 = ownerMinionAttackTargetNPC.position + ownerMinionAttackTargetNPC.Size * vector2;
54807 float num14 = num12 * 3f;
54809 if (num15 < num14 && !flag && Collision.CanHitLine(position, width, height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height))
54810 {
54811 num12 = num15;
54812 vector = vector3;
54813 flag = true;
54815 }
54816 }
54817 if (!flag)
54818 {
54819 for (int n = 0; n < 200; n++)
54820 {
54821 NPC nPC = Main.npc[n];
54822 if (nPC.CanBeChasedBy(this))
54823 {
54824 Vector2 vector4 = nPC.position + nPC.Size * vector2;
54826 if (!(num16 >= num12) && Collision.CanHitLine(position, width, height, nPC.position, nPC.width, nPC.height))
54827 {
54828 num12 = num16;
54829 vector = vector4;
54830 flag = true;
54831 num13 = n;
54832 }
54833 }
54834 }
54835 }
54836 }
54837 else
54838 {
54840 if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(this))
54841 {
54842 float num17 = Vector2.Distance(ownerMinionAttackTargetNPC2.Center, base.Center);
54843 float num18 = num12 * 3f;
54844 if (num17 < num18 && !flag)
54845 {
54846 bool flag2 = false;
54847 if ((type != 963) ? Collision.CanHitLine(position, width, height, ownerMinionAttackTargetNPC2.position, ownerMinionAttackTargetNPC2.width, ownerMinionAttackTargetNPC2.height) : Collision.CanHit(base.Center, 1, 1, ownerMinionAttackTargetNPC2.Center, 1, 1))
54848 {
54849 num12 = num17;
54851 flag = true;
54853 }
54854 }
54855 }
54856 if (!flag)
54857 {
54858 for (int num19 = 0; num19 < 200; num19++)
54859 {
54860 NPC nPC2 = Main.npc[num19];
54861 if (!nPC2.CanBeChasedBy(this))
54862 {
54863 continue;
54864 }
54865 float num20 = Vector2.Distance(nPC2.Center, base.Center);
54866 if (!(num20 >= num12))
54867 {
54868 bool flag3 = false;
54869 if ((type != 963) ? Collision.CanHitLine(position, width, height, nPC2.position, nPC2.width, nPC2.height) : Collision.CanHit(base.Center, 1, 1, nPC2.Center, 1, 1))
54870 {
54871 num12 = num20;
54872 vector = nPC2.Center;
54873 flag = true;
54874 num13 = num19;
54875 }
54876 }
54877 }
54878 }
54879 }
54880 int num21 = 500;
54881 if (type == 963)
54882 {
54883 num21 = 800;
54884 }
54885 if (flag)
54886 {
54887 num21 = 1000;
54888 }
54889 if (flag && type == 423)
54890 {
54891 num21 = 1200;
54892 }
54893 if (flag && type == 613)
54894 {
54895 num21 = 1350;
54896 }
54897 Player player = Main.player[owner];
54898 if (Vector2.Distance(player.Center, base.Center) > (float)num21)
54899 {
54900 ai[0] = 1f;
54901 netUpdate = true;
54902 }
54903 if (ai[0] == 1f)
54904 {
54905 tileCollide = false;
54906 }
54907 bool flag4 = false;
54908 if (type == 963)
54909 {
54910 flag4 = true;
54911 }
54912 if (flag4)
54913 {
54914 if (ai[0] <= 1f && localAI[1] <= 0f)
54915 {
54916 localAI[1] = -1f;
54917 }
54918 else
54919 {
54920 localAI[1] = Utils.Clamp(localAI[1] + 0.05f, 0f, 1f);
54921 if (localAI[1] == 1f)
54922 {
54923 localAI[1] = -1f;
54924 }
54925 }
54926 }
54927 if (type == 963 && velocity.Length() > 0.1f && Main.rand.Next(1500) == 0)
54928 {
54930 }
54931 bool flag5 = false;
54932 if (type == 423 || type == 407)
54933 {
54934 flag5 = true;
54935 }
54936 if (ai[0] >= 2f)
54937 {
54938 if (ai[0] == 2f && type == 963)
54939 {
54941 }
54942 ai[0] += 1f;
54943 if (flag4)
54944 {
54945 localAI[1] = ai[0] / num4;
54946 }
54947 if (!flag)
54948 {
54949 ai[0] += 1f;
54950 }
54951 if (ai[0] > num4)
54952 {
54953 ai[0] = 0f;
54954 netUpdate = true;
54955 if (flag && type == 963 && (vector - base.Center).Length() < 50f)
54956 {
54957 ai[0] = 2f;
54958 }
54959 }
54960 velocity *= num5;
54961 }
54962 else if (flag && (flag5 || ai[0] == 0f))
54963 {
54964 Vector2 v = vector - base.Center;
54965 float num22 = v.Length();
54966 v = v.SafeNormalize(Vector2.Zero);
54967 if (type == 423)
54968 {
54969 v = vector - Vector2.UnitY * 80f;
54970 int num23 = (int)v.Y / 16;
54971 if (num23 < 0)
54972 {
54973 num23 = 0;
54974 }
54975 Tile tile = Main.tile[(int)v.X / 16, num23];
54976 if (tile != null && tile.active() && Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type])
54977 {
54978 v += Vector2.UnitY * 16f;
54979 tile = Main.tile[(int)v.X / 16, (int)v.Y / 16];
54980 if (tile != null && tile.active() && Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type])
54981 {
54982 v += Vector2.UnitY * 16f;
54983 }
54984 }
54985 v -= base.Center;
54986 num22 = v.Length();
54987 v = v.SafeNormalize(Vector2.Zero);
54988 if (num22 > 300f && num22 <= 800f && localAI[0] == 0f)
54989 {
54990 ai[0] = 2f;
54991 ai[1] = (int)(num22 / 10f);
54992 extraUpdates = (int)ai[1];
54993 velocity = v * 10f;
54994 localAI[0] = 60f;
54995 return;
54996 }
54997 }
54998 if (type == 613)
54999 {
55000 v = vector;
55001 Vector2 vector5 = base.Center - v;
55002 if (vector5 == Vector2.Zero)
55003 {
55005 }
55006 vector5 = vector5.SafeNormalize(Vector2.Zero);
55007 v += vector5 * 60f;
55008 int num24 = (int)v.Y / 16;
55009 if (num24 < 0)
55010 {
55011 num24 = 0;
55012 }
55013 Tile tile2 = Main.tile[(int)v.X / 16, num24];
55014 if (tile2 != null && tile2.active() && Main.tileSolid[tile2.type] && !Main.tileSolidTop[tile2.type])
55015 {
55016 v += Vector2.UnitY * 16f;
55017 tile2 = Main.tile[(int)v.X / 16, (int)v.Y / 16];
55018 if (tile2 != null && tile2.active() && Main.tileSolid[tile2.type] && !Main.tileSolidTop[tile2.type])
55019 {
55020 v += Vector2.UnitY * 16f;
55021 }
55022 }
55023 v -= base.Center;
55024 num22 = v.Length();
55025 v = v.SafeNormalize(Vector2.Zero);
55026 if (num22 > 400f && num22 <= 800f && localAI[0] == 0f)
55027 {
55028 ai[0] = 2f;
55029 ai[1] = (int)(num22 / 10f);
55030 extraUpdates = (int)ai[1];
55031 velocity = v * 10f;
55032 localAI[0] = 60f;
55033 return;
55034 }
55035 }
55036 if (type == 407)
55037 {
55038 if (num22 > 400f)
55039 {
55040 float num25 = 3f;
55041 v *= num25;
55042 velocity = (velocity * 20f + v) / 21f;
55043 }
55044 else
55045 {
55046 velocity *= 0.96f;
55047 }
55048 }
55049 if (num22 > 200f)
55050 {
55051 float num26 = 6f + num2 * num;
55052 v *= num26;
55053 float num27 = num3 * 2f;
55054 velocity.X = (velocity.X * num27 + v.X) / (num27 + 1f);
55055 velocity.Y = (velocity.Y * num27 + v.Y) / (num27 + 1f);
55056 }
55057 else if (type == 963)
55058 {
55059 if (num22 < 50f)
55060 {
55061 velocity *= 0.5f;
55062 ai[0] = 2f;
55063 netUpdate = true;
55064 }
55065 else
55066 {
55067 float num28 = 4f + num2 * num;
55068 v *= num28;
55069 velocity = (velocity * num3 + v) / (num3 + 1f);
55070 }
55071 }
55072 else if (type == 423 || type == 613)
55073 {
55074 if (num22 > 70f && num22 < 130f)
55075 {
55076 float num29 = 7f;
55077 if (num22 < 100f)
55078 {
55079 num29 = -3f;
55080 }
55081 v *= num29;
55082 velocity = (velocity * 20f + v) / 21f;
55083 if (Math.Abs(v.X) > Math.Abs(v.Y))
55084 {
55085 velocity.X = (velocity.X * 10f + v.X) / 11f;
55086 }
55087 }
55088 else
55089 {
55090 velocity *= 0.97f;
55091 }
55092 }
55093 else if (type == 375)
55094 {
55095 if (num22 < 150f)
55096 {
55097 float num30 = 4f;
55098 v *= 0f - num30;
55099 velocity.X = (velocity.X * 40f + v.X) / 41f;
55100 velocity.Y = (velocity.Y * 40f + v.Y) / 41f;
55101 }
55102 else
55103 {
55104 velocity *= 0.97f;
55105 }
55106 }
55107 else if (velocity.Y > -1f)
55108 {
55109 velocity.Y -= 0.1f;
55110 }
55111 }
55112 else
55113 {
55114 if (type != 963 && !Collision.CanHitLine(base.Center, 1, 1, Main.player[owner].Center, 1, 1))
55115 {
55116 ai[0] = 1f;
55117 }
55118 float num31 = 6f;
55119 if (ai[0] == 1f)
55120 {
55121 num31 = 15f;
55122 }
55123 if (type == 407)
55124 {
55125 num31 = 9f;
55126 }
55127 if (type == 963)
55128 {
55129 num31 *= 0.8f;
55130 }
55131 Vector2 center2 = base.Center;
55132 Vector2 v2 = player.Center - center2 + new Vector2(0f, -60f);
55133 if (type == 407)
55134 {
55135 v2 += new Vector2(0f, 40f);
55136 }
55137 if (type == 963)
55138 {
55139 v2 += new Vector2(-40 * Main.player[owner].direction, 40f);
55140 }
55141 if (type == 375)
55142 {
55143 ai[1] = 80f;
55144 netUpdate = true;
55145 v2 = player.Center - center2;
55146 int num32 = 1;
55147 for (int num33 = 0; num33 < whoAmI; num33++)
55148 {
55149 if (Main.projectile[num33].active && Main.projectile[num33].owner == owner && Main.projectile[num33].type == type)
55150 {
55151 num32++;
55152 }
55153 }
55154 v2.X -= 10 * Main.player[owner].direction;
55155 v2.X -= num32 * 40 * Main.player[owner].direction;
55156 v2.Y -= 10f;
55157 }
55158 float num34 = v2.Length();
55159 if (num34 > 200f && num31 < 9f)
55160 {
55161 num31 = 9f;
55162 }
55163 if ((type == 423 || type == 407) && num34 > 300f && num31 < 12f)
55164 {
55165 num31 = 12f;
55166 }
55167 if (type == 375)
55168 {
55169 num31 = (int)((double)num31 * 0.75);
55170 }
55171 if (num34 < 100f && ai[0] == 1f && !Collision.SolidCollision(position, width, height))
55172 {
55173 ai[0] = 0f;
55174 netUpdate = true;
55175 }
55176 if (num34 > 2000f)
55177 {
55178 position.X = Main.player[owner].Center.X - (float)(width / 2);
55179 position.Y = Main.player[owner].Center.Y - (float)(width / 2);
55180 }
55181 if (type == 375 || type == 963)
55182 {
55183 if (num34 > 10f)
55184 {
55185 v2 = v2.SafeNormalize(Vector2.Zero);
55186 if (num34 < 50f)
55187 {
55188 num31 /= 2f;
55189 }
55190 v2 *= num31;
55191 velocity = (velocity * 20f + v2) / 21f;
55192 }
55193 else
55194 {
55195 direction = Main.player[owner].direction;
55196 velocity *= 0.9f;
55197 }
55198 }
55199 else if (type == 407)
55200 {
55201 if (Math.Abs(v2.X) > 40f || Math.Abs(v2.Y) > 10f)
55202 {
55203 v2 = v2.SafeNormalize(Vector2.Zero);
55204 v2 *= num31;
55205 v2 *= new Vector2(1.25f, 0.65f);
55206 velocity = (velocity * 20f + v2) / 21f;
55207 }
55208 else
55209 {
55210 if (velocity.X == 0f && velocity.Y == 0f)
55211 {
55212 velocity.X = -0.15f;
55213 velocity.Y = -0.05f;
55214 }
55215 velocity *= 1.01f;
55216 }
55217 }
55218 else if (num34 > 70f)
55219 {
55220 v2 = v2.SafeNormalize(Vector2.Zero);
55221 v2 *= num31;
55222 velocity = (velocity * 20f + v2) / 21f;
55223 }
55224 else
55225 {
55226 if (velocity.X == 0f && velocity.Y == 0f)
55227 {
55228 velocity.X = -0.15f;
55229 velocity.Y = -0.05f;
55230 }
55231 velocity *= 1.01f;
55232 }
55233 if (num34 > 250f && (type == 423 || type == 407))
55234 {
55235 float x = Main.player[owner].velocity.X;
55236 float y = Main.player[owner].velocity.Y;
55237 if ((velocity.X < 0f && x >= 0f) || (velocity.X >= 0f && x < 0f))
55238 {
55239 velocity.X *= 0.95f;
55240 }
55241 else
55242 {
55243 velocity.X += x * 0.125f;
55244 }
55245 if ((velocity.Y < 0f && y >= 0f) || (velocity.Y >= 0f && y < 0f))
55246 {
55247 velocity.Y *= 0.95f;
55248 }
55249 else
55250 {
55251 velocity.Y += y * 0.125f;
55252 }
55253 if (velocity.Length() > num31)
55254 {
55255 velocity = velocity.SafeNormalize(Vector2.Zero) * num31;
55256 }
55257 }
55258 }
55259 rotation = velocity.X * 0.05f;
55260 frameCounter++;
55261 if (type == 373)
55262 {
55263 if (frameCounter > 1)
55264 {
55265 frame++;
55266 frameCounter = 0;
55267 }
55268 if (frame > 2)
55269 {
55270 frame = 0;
55271 }
55272 }
55273 if (type == 963)
55274 {
55275 if (ai[0] >= 2f)
55276 {
55277 int num35 = 12;
55278 if (frame < 8)
55279 {
55280 frameCounter = 0;
55281 }
55282 frameCounter++;
55284 if (frame > 6)
55285 {
55286 frameCounter = 0;
55287 frame = 5;
55288 }
55289 switch (frame)
55290 {
55291 case 0:
55292 case 1:
55293 case 2:
55294 frame = 8 + frame;
55295 break;
55296 case 3:
55297 case 5:
55298 case 7:
55299 frame = 11;
55300 break;
55301 default:
55302 frame = 12;
55303 break;
55304 }
55305 if (Main.rand.Next(2) == 0)
55306 {
55307 float num36 = 1.1f + Main.rand.NextFloat() * 0.3f;
55308 float num37 = 1.4f + Main.rand.NextFloat() * 0.4f;
55309 Vector2 vector6 = Main.rand.NextVector2CircularEdge((float)width * num36, (0f - (float)height) * 0.25f * num36);
55310 float num38 = vector6.ToRotation() + (float)Math.PI / 2f;
55311 int num39 = Dust.NewDust(base.Bottom + vector6, 1, 1, 303, 0f, 0f, 50, Color.GhostWhite, num37);
55312 Main.dust[num39].velocity = vector6 * 0.0125f + new Vector2(1f, 0f).RotatedBy(num38, Vector2.Zero);
55313 Main.dust[num39].noGravity = true;
55314 }
55315 }
55316 else
55317 {
55318 if (frame > 7)
55319 {
55320 frame = 0;
55321 frameCounter = 0;
55322 }
55323 if (frameCounter > 6)
55324 {
55325 frameCounter = 0;
55326 frame++;
55327 if (frame > 7)
55328 {
55329 frame = 0;
55330 }
55331 }
55332 }
55333 }
55334 if (type == 375)
55335 {
55336 if (frameCounter >= 16)
55337 {
55338 frameCounter = 0;
55339 }
55340 frame = frameCounter / 4;
55341 if (ai[1] > 0f && ai[1] < 16f)
55342 {
55343 frame += 4;
55344 }
55345 if (Main.rand.Next(6) == 0)
55346 {
55347 int num40 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2f);
55348 Main.dust[num40].velocity *= 0.3f;
55349 Main.dust[num40].noGravity = true;
55350 Main.dust[num40].noLight = true;
55351 }
55352 }
55353 if (type == 407)
55354 {
55355 int num41 = 2;
55356 if (frameCounter >= 6 * num41)
55357 {
55358 frameCounter = 0;
55359 }
55361 if (Main.rand.Next(5) == 0)
55362 {
55363 int num42 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 217, 0f, 0f, 100, default(Color), 2f);
55364 Main.dust[num42].velocity *= 0.3f;
55365 Main.dust[num42].noGravity = true;
55366 Main.dust[num42].noLight = true;
55367 }
55368 }
55369 if (type == 423 || type == 613)
55370 {
55371 int num43 = 3;
55372 if (frameCounter >= 4 * num43)
55373 {
55374 frameCounter = 0;
55375 }
55377 }
55378 if (velocity.X > 0f)
55379 {
55380 spriteDirection = (direction = -1);
55381 }
55382 else if (velocity.X < 0f)
55383 {
55384 spriteDirection = (direction = 1);
55385 }
55386 if (type == 963)
55387 {
55388 spriteDirection = (direction *= -1);
55389 if (!flag && Math.Abs(velocity.X) < 0.1f)
55390 {
55391 spriteDirection = ((Main.player[owner].Center.X > base.Center.X) ? 1 : (-1));
55392 }
55393 }
55394 if (type == 373)
55395 {
55396 if (ai[1] > 0f)
55397 {
55398 ai[1] += Main.rand.Next(1, 4);
55399 }
55400 int num44 = 90;
55401 if (Main.player[owner].strongBees)
55402 {
55403 num44 = 70;
55404 }
55405 if (ai[1] > (float)num44)
55406 {
55407 ai[1] = 0f;
55408 netUpdate = true;
55409 }
55410 }
55411 else if (type == 375)
55412 {
55413 if (ai[1] > 0f)
55414 {
55415 ai[1] += 1f;
55416 if (Main.rand.Next(3) == 0)
55417 {
55418 ai[1] += 1f;
55419 }
55420 }
55421 if (ai[1] > 90f)
55422 {
55423 ai[1] = 0f;
55424 netUpdate = true;
55425 }
55426 }
55427 else if (type == 407)
55428 {
55429 if (ai[1] > 0f)
55430 {
55431 ai[1] += 1f;
55432 if (Main.rand.Next(3) != 0)
55433 {
55434 ai[1] += 1f;
55435 }
55436 }
55437 if (ai[1] > 50f)
55438 {
55439 ai[1] = 0f;
55440 netUpdate = true;
55441 }
55442 }
55443 else if (type == 423)
55444 {
55445 if (ai[1] > 0f)
55446 {
55447 ai[1] += 1f;
55448 if (Main.rand.Next(3) != 0)
55449 {
55450 ai[1] += 1f;
55451 }
55452 }
55453 if (ai[1] > 40f)
55454 {
55455 ai[1] = 0f;
55456 netUpdate = true;
55457 }
55458 }
55459 else if (type == 613)
55460 {
55461 if (ai[1] > 0f)
55462 {
55463 ai[1] += 1f;
55464 if (Main.rand.Next(3) != 0)
55465 {
55466 ai[1] += 1f;
55467 }
55468 }
55469 if (ai[1] > 60f)
55470 {
55471 ai[1] = 0f;
55472 netUpdate = true;
55473 }
55474 }
55475 if (!flag5 && ai[0] != 0f)
55476 {
55477 return;
55478 }
55479 float num45 = 0f;
55480 int num46 = 0;
55481 if (type == 373)
55482 {
55483 num45 = 10f;
55484 num46 = 374;
55485 }
55486 else if (type == 375)
55487 {
55488 num45 = 11f;
55489 num46 = 376;
55490 }
55491 else if (type == 407)
55492 {
55493 num45 = 20f;
55494 num46 = 408;
55495 }
55496 else if (type == 423)
55497 {
55498 num45 = 4f;
55499 num46 = 433;
55500 }
55501 else if (type == 613)
55502 {
55503 num45 = 14f;
55504 num46 = 614;
55505 }
55506 if (!flag)
55507 {
55508 return;
55509 }
55510 if (type == 375)
55511 {
55512 if ((vector - base.Center).X > 0f)
55513 {
55514 spriteDirection = (direction = -1);
55515 }
55516 else if ((vector - base.Center).X < 0f)
55517 {
55518 spriteDirection = (direction = 1);
55519 }
55520 }
55521 if (type == 407 && Collision.SolidCollision(position, width, height))
55522 {
55523 return;
55524 }
55525 if (type == 423)
55526 {
55527 if (Math.Abs((vector - base.Center).ToRotation() - (float)Math.PI / 2f) > (float)Math.PI / 4f)
55528 {
55529 velocity += (vector - base.Center - Vector2.UnitY * 80f).SafeNormalize(Vector2.Zero);
55530 }
55531 if (!((vector - base.Center).Length() > 400f) && ai[1] == 0f)
55532 {
55533 ai[1] += 1f;
55534 if (Main.myPlayer == owner)
55535 {
55536 Vector2 v3 = vector - base.Center;
55537 v3 = v3.SafeNormalize(Vector2.Zero);
55538 v3 *= num45;
55539 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, v3.X, v3.Y, num46, damage, knockBack, Main.myPlayer);
55540 netUpdate = true;
55541 }
55542 }
55543 }
55544 else if (ai[1] == 0f && type == 613)
55545 {
55546 if ((vector - base.Center).Length() > 500f || ai[1] != 0f)
55547 {
55548 return;
55549 }
55550 ai[1] += 1f;
55551 if (Main.myPlayer == owner)
55552 {
55553 Vector2 v4 = vector - base.Center;
55554 v4 = v4.SafeNormalize(Vector2.Zero);
55555 v4 *= num45;
55556 int num47 = NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, v4.X, v4.Y, num46, damage, knockBack, Main.myPlayer, 0f, num13);
55557 Main.projectile[num47].timeLeft = 300;
55558 Main.projectile[num47].netUpdate = true;
55559 velocity -= v4 / 3f;
55560 netUpdate = true;
55561 }
55562 for (int num48 = 0; num48 < 5; num48++)
55563 {
55564 int num49 = width / 4;
55565 _ = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * Main.rand.Next(24, 41) / 8f;
55566 int num50 = Dust.NewDust(base.Center - Vector2.One * num49, num49 * 2, num49 * 2, 88);
55567 Dust dust3 = Main.dust[num50];
55568 Vector2 vector7 = (dust3.position - base.Center).SafeNormalize(Vector2.Zero);
55569 dust3.position = base.Center + vector7 * num49 * scale - new Vector2(4f);
55570 if (num48 < 30)
55571 {
55572 dust3.velocity = vector7 * dust3.velocity.Length() * 2f;
55573 }
55574 else
55575 {
55576 dust3.velocity = 2f * vector7 * Main.rand.Next(45, 91) / 10f;
55577 }
55578 dust3.noGravity = true;
55579 dust3.scale = 0.7f + Main.rand.NextFloat();
55580 }
55581 }
55582 else if (ai[1] == 0f)
55583 {
55584 Vector2 v5 = vector - base.Center;
55585 ai[1] += 1f;
55586 if (Main.myPlayer == owner)
55587 {
55588 v5 = v5.SafeNormalize(Vector2.Zero);
55589 v5 *= num45;
55590 int num51 = NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, v5.X, v5.Y, num46, damage, knockBack, Main.myPlayer);
55591 Main.projectile[num51].timeLeft = 300;
55592 Main.projectile[num51].netUpdate = true;
55593 netUpdate = true;
55594 }
55595 }
55596 }
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static double Abs(double value)
const double PI
Definition Math.cs:16
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static void PlaySound(int type, Vector2 position, int style=1)
Vector2 Center
Definition Entity.cs:43
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
static readonly LegacySoundStyle AbigailCry
Definition SoundID.cs:978
static readonly LegacySoundStyle AbigailAttack
Definition SoundID.cs:980
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 float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91

References Terraria.ID.SoundID.AbigailAttack, Terraria.ID.SoundID.AbigailCry, System.Math.Abs(), Terraria.Tile.active(), Terraria.Lighting.AddLight(), Terraria.Collision.CanHit(), Terraria.Collision.CanHitLine(), Terraria.Entity.Center, Microsoft.Xna.Framework.Vector2.Distance(), Terraria.Main.dust, Microsoft.Xna.Framework.Color.GhostWhite, Microsoft.Xna.Framework.Vector2.Length(), System.Math.Max(), System.Math.Min(), Terraria.Main.myPlayer, Terraria.Dust.NewDust(), Terraria.Main.npc, System.obj, Microsoft.Xna.Framework.Vector2.One, System.Math.PI, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.projectile, Terraria.Main.rand, Terraria.Collision.SolidCollision(), Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, System.type, Terraria.Tile.type, Microsoft.Xna.Framework.Vector2.UnitY, Microsoft.Xna.Framework.Vector2.X, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector2.Zero.