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

◆ AI_016()

void Terraria.Projectile.AI_016 ( )
inlineprivate

Definition at line 38764 of file Projectile.cs.

38765 {
38766 if (wet && (type == 799 || type == 800 || type == 801 || type == 810 || type == 906 || type == 784 || type == 785 || type == 786 || type == 805 || type == 903 || type == 787 || type == 788 || type == 789 || type == 806 || type == 904 || type == 790 || type == 791 || type == 792 || type == 807 || type == 905))
38767 {
38768 timeLeft = 1;
38769 }
38770 if (type == 108 || type == 164 || type == 1002)
38771 {
38772 ai[0] += 1f;
38773 if (ai[0] > 3f)
38774 {
38775 Kill();
38776 }
38777 }
38778 if (type == 102)
38779 {
38780 int num = (int)(base.Center.X / 16f);
38781 int num2 = (int)(base.Center.Y / 16f);
38782 if (WorldGen.InWorld(num, num2))
38783 {
38784 Tile tile = Main.tile[num, num2];
38785 if (tile != null && tile.active() && (TileID.Sets.Platforms[tile.type] || tile.type == 380))
38786 {
38787 Kill();
38788 return;
38789 }
38790 }
38791 }
38792 if (type == 75)
38793 {
38794 if (localAI[0] == 0f)
38795 {
38796 localAI[0] = 1f;
38797 SoundEngine.PlaySound(66, (int)position.X, (int)position.Y);
38798 }
38799 for (int i = 0; i < 255; i++)
38800 {
38801 if (Main.player[i].active && !Main.player[i].dead && !Main.player[i].ghost && (base.Center - Main.player[i].Center).Length() < 40f)
38802 {
38803 Kill();
38804 return;
38805 }
38806 }
38807 }
38808 bool flag = false;
38809 if (type == 37 || type == 397 || type == 470 || type == 519 || type == 773 || type == 911)
38810 {
38811 try
38812 {
38813 int num3 = (int)(position.X / 16f) - 1;
38814 int num4 = (int)((position.X + (float)width) / 16f) + 2;
38815 int num5 = (int)(position.Y / 16f) - 1;
38816 int num6 = (int)((position.Y + (float)height) / 16f) + 2;
38817 if (num3 < 0)
38818 {
38819 num3 = 0;
38820 }
38821 if (num4 > Main.maxTilesX)
38822 {
38823 num4 = Main.maxTilesX;
38824 }
38825 if (num5 < 0)
38826 {
38827 num5 = 0;
38828 }
38829 if (num6 > Main.maxTilesY)
38830 {
38831 num6 = Main.maxTilesY;
38832 }
38833 Vector2 vector = default(Vector2);
38834 for (int j = num3; j < num4; j++)
38835 {
38836 for (int k = num5; k < num6; k++)
38837 {
38838 if (Main.tile[j, k] == null || !Main.tile[j, k].nactive() || !Main.tileSolid[Main.tile[j, k].type] || Main.tileSolidTop[Main.tile[j, k].type])
38839 {
38840 continue;
38841 }
38842 vector.X = j * 16;
38843 vector.Y = k * 16;
38844 if (!(position.X + (float)width - 4f > vector.X) || !(position.X + 4f < vector.X + 16f) || !(position.Y + (float)height - 4f > vector.Y) || !(position.Y + 4f < vector.Y + 16f))
38845 {
38846 continue;
38847 }
38848 if (type == 911 && owner == Main.myPlayer && localAI[0] == 0f)
38849 {
38850 float num7 = 12f;
38851 Vector2 value = vector + new Vector2(8f, 8f);
38852 if (Vector2.Distance(base.Center, value) < num7)
38853 {
38854 base.Center += velocity.SafeNormalize(Vector2.Zero) * -4f;
38855 }
38856 localAI[0] = 1f;
38857 netUpdate = true;
38858 }
38859 velocity.X = 0f;
38860 velocity.Y = -0.2f;
38861 flag = true;
38862 }
38863 }
38864 }
38865 catch
38866 {
38867 }
38868 }
38869 if (flag && type == 911)
38870 {
38871 Point p = base.Center.ToTileCoordinates();
38872 if (WorldGen.SolidOrSlopedTile(Framing.GetTileSafely(p.X, p.Y)))
38873 {
38874 Vector2 v = p.ToWorldCoordinates() - base.Center;
38875 base.Center += v.SafeNormalize(Vector2.Zero) * -4f;
38876 }
38877 }
38878 if (flag && type == 773)
38879 {
38880 Player player = Main.player[owner];
38881 Vector2 v2 = DirectionTo(player.Center).SafeNormalize(Vector2.UnitX * player.direction);
38882 float num8 = rotation;
38883 float num9 = v2.ToRotation() + (float)Math.PI / 2f;
38884 rotation = rotation.AngleLerp(num9, 0.2f);
38885 rotation = rotation.AngleTowards(num9, 0.05f);
38886 Vector2 vector2 = (rotation - (float)Math.PI / 2f).ToRotationVector2();
38887 if (Main.rand.Next(3) == 0)
38888 {
38889 Dust dust = Dust.NewDustPerfect(base.Center + vector2 * 10f, 59, vector2 * 2f + Main.rand.NextVector2Circular(0.25f, 0.25f), 0, default(Color), 2f);
38890 dust.noGravity = true;
38891 if (Main.rand.Next(3) == 0)
38892 {
38893 dust.velocity *= 1.5f;
38894 dust.noGravity = false;
38895 dust.scale /= 2f;
38896 }
38897 }
38898 if (Main.rand.Next(3) == 0)
38899 {
38901 Dust.NewDustPerfect(base.Center + vector2 * -10f, 59, scarabBombDigDirectionSnap.ToVector2() * 1.5f, 0, default(Color), 2f).noGravity = true;
38902 }
38903 if (Main.rand.Next(15) == 0)
38904 {
38905 Dust dust2 = Dust.NewDustPerfect(base.Center + vector2 * 10f, 88, vector2 * 3f + Main.rand.NextVector2Circular(0.25f, 0.25f), 0, default(Color), 2f);
38906 dust2.noGravity = true;
38907 if (Main.rand.Next(3) == 0)
38908 {
38909 dust2.velocity *= 1.5f;
38910 }
38911 }
38912 bool flag2 = Main.rand.Next(30) == 0;
38913 if (num8 != rotation && Main.rand.Next(40) == 0)
38914 {
38915 flag2 = true;
38916 }
38917 if (flag2)
38918 {
38919 float num10 = (float)Math.PI * 2f * Main.rand.NextFloat();
38920 for (float num11 = 0f; num11 < 1f; num11 += 1f / 7f)
38921 {
38922 Vector2 spinningpoint = (num11 * ((float)Math.PI * 2f) + num10).ToRotationVector2();
38923 spinningpoint *= new Vector2(1f, 0.3f);
38924 spinningpoint = spinningpoint.RotatedBy(num9);
38925 Dust dust3 = Dust.NewDustPerfect(base.Center + spinningpoint + vector2 * 8f, 59, vector2 * 3f + spinningpoint);
38926 dust3.noGravity = true;
38927 dust3.fadeIn = 1.6f;
38928 }
38929 }
38930 if (++frameCounter >= 3)
38931 {
38932 frameCounter = 0;
38933 if (++frame >= 4)
38934 {
38935 frame = 0;
38936 }
38937 }
38938 }
38939 if (type == 519)
38940 {
38941 localAI[1] += 1f;
38942 float num12 = 180f - localAI[1];
38943 if (num12 < 0f)
38944 {
38945 num12 = 0f;
38946 }
38947 frameCounter++;
38948 if (num12 < 15f)
38949 {
38950 frameCounter++;
38951 }
38952 if ((float)frameCounter >= (num12 / 10f + 6f) / 2f)
38953 {
38954 frame++;
38955 frameCounter = 0;
38956 if (frame >= Main.projFrames[type])
38957 {
38958 frame = 0;
38959 }
38960 }
38961 }
38962 if (type == 681 && localAI[1] == 0f)
38963 {
38964 localAI[1] = 1f;
38965 }
38966 int num13 = 6;
38967 if (type == 776 || type == 780 || type == 803 || type == 804)
38968 {
38969 num13 = 228;
38970 }
38971 else if (type == 784 || type == 805)
38972 {
38973 num13 = ((Main.rand.Next(3) == 0) ? 6 : Dust.dustWater());
38974 }
38975 else if (type == 787 || type == 806)
38976 {
38977 num13 = ((Main.rand.Next(3) == 0) ? 6 : 35);
38978 }
38979 else if (type == 790 || type == 807)
38980 {
38981 num13 = ((Main.rand.Next(3) == 0) ? 6 : 152);
38982 }
38983 if (type == 102)
38984 {
38985 if (velocity.Y > 10f)
38986 {
38987 velocity.Y = 10f;
38988 }
38989 if (localAI[0] == 0f)
38990 {
38991 localAI[0] = 1f;
38993 }
38994 frameCounter++;
38995 if (frameCounter > 3)
38996 {
38997 frame++;
38998 frameCounter = 0;
38999 }
39000 if (frame > 1)
39001 {
39002 frame = 0;
39003 }
39004 if (velocity.Y == 0f)
39005 {
39006 position.X += width / 2;
39007 position.Y += height / 2;
39008 width = 128;
39009 height = 128;
39010 position.X -= width / 2;
39011 position.Y -= height / 2;
39012 damage = 40;
39013 knockBack = 8f;
39014 timeLeft = 3;
39015 netUpdate = true;
39016 }
39017 }
39018 if (type == 303 && timeLeft <= 3 && hostile)
39019 {
39020 position.X += width / 2;
39021 position.Y += height / 2;
39022 width = 128;
39023 height = 128;
39024 position.X -= width / 2;
39025 position.Y -= height / 2;
39026 }
39027 if (owner == Main.myPlayer && timeLeft <= 3)
39028 {
39030 }
39031 else
39032 {
39033 if (type != 30 && type != 75 && type != 517 && type != 681 && type != 588 && type != 397 && type != 108 && type != 1002 && type != 133 && type != 134 && type != 135 && type != 136 && type != 137 && type != 138 && type != 139 && type != 140 && type != 141 && type != 142 && type != 143 && type != 144 && type != 164 && type != 303 && type != 338 && type != 339 && type != 340 && type != 341 && (type < 776 || type > 801) && (type < 803 || type > 810) && type != 862 && type != 863 && type != 930)
39034 {
39035 damage = 0;
39036 }
39037 if (type == 338 || type == 339 || type == 340 || type == 341 || type == 803 || type == 804 || type == 808 || type == 809 || type == 810 || type == 805 || type == 806 || type == 807 || type == 930)
39038 {
39039 localAI[1] += 1f;
39040 if (localAI[1] > 6f)
39041 {
39042 alpha = 0;
39043 }
39044 else
39045 {
39046 alpha = (int)(255f - 42f * localAI[1]) + 100;
39047 if (alpha > 255)
39048 {
39049 alpha = 255;
39050 }
39051 }
39052 for (int l = 0; l < 2; l++)
39053 {
39054 float num14 = 0f;
39055 float num15 = 0f;
39056 if (l == 1)
39057 {
39058 num14 = velocity.X * 0.5f;
39059 num15 = velocity.Y * 0.5f;
39060 }
39061 if (!(localAI[1] > 9f))
39062 {
39063 continue;
39064 }
39065 if (Main.rand.Next(2) == 0)
39066 {
39067 int num16 = Dust.NewDust(new Vector2(position.X + 3f + num14, position.Y + 3f + num15) - velocity * 0.5f, width - 8, height - 8, num13, 0f, 0f, 100);
39068 Main.dust[num16].scale *= 1.4f + (float)Main.rand.Next(10) * 0.1f;
39069 Main.dust[num16].velocity *= 0.2f;
39070 Main.dust[num16].noGravity = true;
39071 if (Main.dust[num16].type == 152)
39072 {
39073 Main.dust[num16].scale *= 0.5f;
39074 Main.dust[num16].velocity += velocity * 0.1f;
39075 }
39076 else if (Main.dust[num16].type == 35)
39077 {
39078 Main.dust[num16].scale *= 0.5f;
39079 Main.dust[num16].velocity += velocity * 0.1f;
39080 }
39081 else if (Main.dust[num16].type == Dust.dustWater())
39082 {
39083 Main.dust[num16].scale *= 0.65f;
39084 Main.dust[num16].velocity += velocity * 0.1f;
39085 }
39086 if (type == 808 || type == 809)
39087 {
39088 Dust dust4 = Main.dust[num16];
39089 if (dust4.dustIndex != 6000)
39090 {
39091 dust4 = Dust.NewDustPerfect(dust4.position, dust4.type, dust4.velocity, dust4.alpha, dust4.color, dust4.scale + 0.5f);
39092 dust4.velocity = Main.rand.NextVector2Circular(3f, 3f);
39093 dust4.noGravity = true;
39094 }
39095 if (dust4.dustIndex != 6000)
39096 {
39097 dust4 = Dust.NewDustPerfect(dust4.position, dust4.type, dust4.velocity, dust4.alpha, dust4.color, dust4.scale + 0.5f);
39098 dust4.velocity = ((float)Math.PI * 2f * ((float)timeLeft / 20f)).ToRotationVector2() * 3f;
39099 dust4.noGravity = true;
39100 }
39101 }
39102 }
39103 if (Main.rand.Next(2) == 0)
39104 {
39105 int num17 = Dust.NewDust(new Vector2(position.X + 3f + num14, position.Y + 3f + num15) - velocity * 0.5f, width - 8, height - 8, 31, 0f, 0f, 100, default(Color), 0.5f);
39106 Main.dust[num17].fadeIn = 0.5f + (float)Main.rand.Next(5) * 0.1f;
39107 Main.dust[num17].velocity *= 0.05f;
39108 }
39109 }
39110 float x = position.X;
39111 float y = position.Y;
39112 float num18 = 600f;
39113 if (type == 930)
39114 {
39115 num18 = 650f;
39116 }
39117 bool flag3 = false;
39118 ai[0] += 1f;
39119 if (ai[0] > 30f)
39120 {
39121 ai[0] = 30f;
39122 for (int m = 0; m < 200; m++)
39123 {
39124 if (Main.npc[m].CanBeChasedBy(this))
39125 {
39126 float num19 = Main.npc[m].position.X + (float)(Main.npc[m].width / 2);
39127 float num20 = Main.npc[m].position.Y + (float)(Main.npc[m].height / 2);
39128 float num21 = Math.Abs(position.X + (float)(width / 2) - num19) + Math.Abs(position.Y + (float)(height / 2) - num20);
39129 if (num21 < num18 && Collision.CanHit(position, width, height, Main.npc[m].position, Main.npc[m].width, Main.npc[m].height))
39130 {
39131 num18 = num21;
39132 x = num19;
39133 y = num20;
39134 flag3 = true;
39135 }
39136 }
39137 }
39138 }
39139 if (!flag3)
39140 {
39141 x = position.X + (float)(width / 2) + velocity.X * 100f;
39142 y = position.Y + (float)(height / 2) + velocity.Y * 100f;
39143 }
39144 float num22 = 16f;
39145 if (type == 930)
39146 {
39147 num22 = 12f;
39148 }
39149 Vector2 value2 = (new Vector2(x, y) - base.Center).SafeNormalize(-Vector2.UnitY) * num22;
39150 velocity = Vector2.Lerp(velocity, value2, 1f / 12f);
39151 }
39152 else if (type == 134 || type == 137 || type == 140 || type == 143 || type == 303 || type == 776 || type == 780 || type == 793 || type == 796 || type == 799 || type == 784 || type == 787 || type == 790)
39153 {
39154 if (Math.Abs(velocity.X) >= 8f || Math.Abs(velocity.Y) >= 8f)
39155 {
39156 for (int n = 0; n < 2; n++)
39157 {
39158 float num23 = 0f;
39159 float num24 = 0f;
39160 if (n == 1)
39161 {
39162 num23 = velocity.X * 0.5f;
39163 num24 = velocity.Y * 0.5f;
39164 }
39165 int num25 = Dust.NewDust(new Vector2(position.X + 3f + num23, position.Y + 3f + num24) - velocity * 0.5f, width - 8, height - 8, num13, 0f, 0f, 100);
39166 Main.dust[num25].scale *= 2f + (float)Main.rand.Next(10) * 0.1f;
39167 Main.dust[num25].velocity *= 0.2f;
39168 Main.dust[num25].noGravity = true;
39169 if (Main.dust[num25].type == 152)
39170 {
39171 Main.dust[num25].scale *= 0.5f;
39172 Main.dust[num25].velocity += velocity * 0.1f;
39173 }
39174 else if (Main.dust[num25].type == 35)
39175 {
39176 Main.dust[num25].scale *= 0.5f;
39177 Main.dust[num25].velocity += velocity * 0.1f;
39178 }
39179 else if (Main.dust[num25].type == Dust.dustWater())
39180 {
39181 Main.dust[num25].scale *= 0.65f;
39182 Main.dust[num25].velocity += velocity * 0.1f;
39183 }
39184 if (type == 793 || type == 796)
39185 {
39186 Dust dust5 = Main.dust[num25];
39187 if (dust5.dustIndex != 6000)
39188 {
39189 dust5 = Dust.NewDustPerfect(dust5.position, dust5.type, dust5.velocity, dust5.alpha, dust5.color, dust5.scale);
39190 dust5.velocity = Main.rand.NextVector2Circular(3f, 3f);
39191 dust5.noGravity = true;
39192 }
39193 if (dust5.dustIndex != 6000)
39194 {
39195 dust5 = Dust.NewDustPerfect(dust5.position, dust5.type, dust5.velocity, dust5.alpha, dust5.color, dust5.scale);
39196 dust5.velocity = ((float)Math.PI * 2f * ((float)timeLeft / 20f)).ToRotationVector2() * 3f;
39197 dust5.noGravity = true;
39198 }
39199 }
39200 num25 = Dust.NewDust(new Vector2(position.X + 3f + num23, position.Y + 3f + num24) - velocity * 0.5f, width - 8, height - 8, 31, 0f, 0f, 100, default(Color), 0.5f);
39201 Main.dust[num25].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f;
39202 Main.dust[num25].velocity *= 0.05f;
39203 }
39204 }
39205 if (Math.Abs(velocity.X) < 15f && Math.Abs(velocity.Y) < 15f)
39206 {
39207 velocity *= 1.1f;
39208 }
39209 }
39210 else if (type == 133 || type == 136 || type == 139 || type == 142 || type == 777 || type == 781 || type == 794 || type == 797 || type == 800 || type == 785 || type == 788 || type == 791)
39211 {
39212 int num26 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100);
39213 Main.dust[num26].scale *= 1f + (float)Main.rand.Next(10) * 0.1f;
39214 Main.dust[num26].velocity *= 0.2f;
39215 Main.dust[num26].noGravity = true;
39216 }
39217 else if (type == 135 || type == 138 || type == 141 || type == 144 || type == 778 || type == 782 || type == 795 || type == 798 || type == 801 || type == 786 || type == 789 || type == 792)
39218 {
39219 if ((double)velocity.X > -0.2 && (double)velocity.X < 0.2 && (double)velocity.Y > -0.2 && (double)velocity.Y < 0.2)
39220 {
39221 alpha += 2;
39222 if (alpha > 200)
39223 {
39224 alpha = 200;
39225 }
39226 }
39227 else
39228 {
39229 alpha = 0;
39230 int num27 = Dust.NewDust(new Vector2(position.X + 3f, position.Y + 3f) - velocity * 0.5f, width - 8, height - 8, 31, 0f, 0f, 100);
39231 Main.dust[num27].scale *= 1.6f + (float)Main.rand.Next(5) * 0.1f;
39232 Main.dust[num27].velocity *= 0.05f;
39233 Main.dust[num27].noGravity = true;
39234 }
39235 }
39236 else if (type == 779 || type == 783 || type == 862 || type == 863)
39237 {
39238 if (Main.rand.Next(25) == 0)
39239 {
39240 Dust dust6 = Dust.NewDustDirect(position, width, height, 228, (0f - velocity.X) / 10f, (0f - velocity.Y) / 10f, 100);
39241 dust6.noGravity = true;
39242 dust6.velocity *= 0f;
39243 dust6.scale = 1.3f;
39244 }
39245 if (Main.rand.Next(5) == 0)
39246 {
39247 Dust dust7 = Dust.NewDustDirect(position, width, height, 31, (0f - velocity.X) / 10f, (0f - velocity.Y) / 10f, 100);
39248 dust7.noGravity = true;
39249 dust7.velocity *= 0f;
39250 dust7.scale = 1.3f;
39251 }
39252 if (frameCounter == 0)
39253 {
39254 frameCounter = 1;
39255 frame = Main.rand.Next(4);
39256 }
39257 }
39258 else if (type != 30 && type != 517 && type != 681 && type != 397 && type != 519 && type != 588 && type != 779 && type != 783 && type != 862 && type != 863 && Main.rand.Next(2) == 0)
39259 {
39260 int num28 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100);
39261 Main.dust[num28].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
39262 Main.dust[num28].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f;
39263 Main.dust[num28].noGravity = true;
39264 Main.dust[num28].position = base.Center + new Vector2(0f, -height / 2).RotatedBy(rotation) * 1.1f;
39265 int num29 = 6;
39266 if (type == 773)
39267 {
39268 num29 = 59;
39269 }
39270 if (type == 903)
39271 {
39272 num29 = Dust.dustWater();
39273 }
39274 if (type == 904)
39275 {
39276 num29 = 35;
39277 }
39278 if (type == 905)
39279 {
39280 num29 = 152;
39281 }
39282 if (type == 910 || type == 911)
39283 {
39284 num29 = 0;
39285 }
39286 Dust dust8 = Dust.NewDustDirect(position, width, height, num29, 0f, 0f, 100);
39287 dust8.scale = 1f + (float)Main.rand.Next(5) * 0.1f;
39288 dust8.noGravity = true;
39289 dust8.position = base.Center + new Vector2(0f, -height / 2 - 6).RotatedBy(rotation) * 1.1f;
39290 }
39291 else if (type == 681)
39292 {
39293 Dust dust9 = Dust.NewDustDirect(position, width, height, 6, 0f, 0f, 100);
39294 dust9.scale = 1f + (float)Main.rand.Next(5) * 0.1f;
39295 dust9.noGravity = true;
39296 dust9.position = base.Center + new Vector2(6 * Math.Sign(velocity.X), -height / 2 - 6).RotatedBy(rotation) * 1.1f;
39297 }
39298 }
39299 ai[0] += 1f;
39300 if (type == 338 || type == 339 || type == 340 || type == 341 || type == 803 || type == 804 || type == 808 || type == 809 || type == 810 || type == 805 || type == 806 || type == 807 || type == 930)
39301 {
39302 if (velocity.X < 0f)
39303 {
39304 spriteDirection = -1;
39305 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X) - 1.57f;
39306 }
39307 else
39308 {
39309 spriteDirection = 1;
39310 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
39311 }
39312 }
39313 else if (type == 134 || type == 137 || type == 140 || type == 143 || type == 303 || type == 776 || type == 780 || type == 793 || type == 796 || type == 799 || type == 784 || type == 787 || type == 790)
39314 {
39315 if (velocity != Vector2.Zero)
39316 {
39317 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
39318 }
39319 }
39320 else if (type == 135 || type == 138 || type == 141 || type == 144 || type == 778 || type == 782 || type == 795 || type == 798 || type == 801 || type == 786 || type == 789 || type == 792)
39321 {
39322 velocity.Y += 0.2f;
39323 velocity *= 0.97f;
39324 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
39325 {
39326 velocity.X = 0f;
39327 }
39328 if ((double)velocity.Y > -0.1 && (double)velocity.Y < 0.1)
39329 {
39330 velocity.Y = 0f;
39331 }
39332 }
39333 else if (type == 133 || type == 136 || type == 139 || type == 142 || type == 777 || type == 781 || type == 794 || type == 797 || type == 800 || type == 785 || type == 788 || type == 791)
39334 {
39335 if (ai[0] > 15f)
39336 {
39337 if (velocity.Y == 0f)
39338 {
39339 velocity.X *= 0.95f;
39340 }
39341 velocity.Y += 0.2f;
39342 }
39343 }
39344 else if (((type == 30 || type == 397 || type == 517 || type == 681 || type == 588 || type == 779 || type == 783 || type == 862 || type == 863) && ai[0] > 10f) || (type != 30 && type != 397 && type != 517 && type != 588 && type != 779 && type != 783 && type != 862 && type != 863 && ai[0] > 5f))
39345 {
39346 ai[0] = 10f;
39347 if (velocity.Y == 0f && velocity.X != 0f)
39348 {
39349 velocity.X *= 0.97f;
39350 if (type == 29 || type == 470 || type == 637)
39351 {
39352 velocity.X *= 0.99f;
39353 }
39354 if ((double)velocity.X > -0.01 && (double)velocity.X < 0.01)
39355 {
39356 velocity.X = 0f;
39357 netUpdate = true;
39358 }
39359 }
39360 velocity.Y += 0.2f;
39361 if (type == 911)
39362 {
39363 velocity.X = MathHelper.Clamp(velocity.X, -8f, 8f);
39364 velocity.Y = MathHelper.Clamp(velocity.Y, -8f, 8f);
39365 }
39366 }
39367 if (type == 519)
39368 {
39369 rotation += velocity.X * 0.06f;
39370 }
39371 else if (type != 134 && type != 137 && type != 140 && type != 143 && type != 303 && (type < 338 || type > 341) && type != 776 && type != 780 && type != 793 && type != 796 && type != 799 && type != 784 && type != 787 && type != 790 && type != 803 && type != 804 && type != 808 && type != 809 && type != 810 && type != 805 && type != 806 && type != 807 && type != 930)
39372 {
39373 rotation += velocity.X * 0.1f;
39374 }
39375 }
static float Clamp(float value, float min, float max)
Definition MathHelper.cs:46
static double Atan2(double y, double x)
static double Abs(double value)
const double PI
Definition Math.cs:16
static int Sign(decimal value)
Definition Math.cs:1202
static void PlaySound(int type, Vector2 position, int style=1)
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
Vector2 DirectionTo(Vector2 Destination)
Definition Entity.cs:197
static readonly LegacySoundStyle Item10
Definition SoundID.cs:434
static bool[] Platforms
Definition TileID.cs:163
Point GetScarabBombDigDirectionSnap8()
static float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91
static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:227

References System.Math.Abs(), Terraria.Tile.active(), System.Math.Atan2(), Terraria.Collision.CanHit(), Terraria.Entity.Center, Microsoft.Xna.Framework.MathHelper.Clamp(), Terraria.Entity.direction, Microsoft.Xna.Framework.Vector2.Distance(), Terraria.Main.dust, Terraria.Dust.dustWater(), Terraria.Framing.GetTileSafely(), Terraria.WorldGen.InWorld(), Terraria.ID.SoundID.Item10, Microsoft.Xna.Framework.Vector2.Lerp(), Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.myPlayer, Terraria.Dust.NewDust(), Terraria.Dust.NewDustDirect(), Terraria.Dust.NewDustPerfect(), Terraria.Main.npc, System.Math.PI, Terraria.ID.TileID.Sets.Platforms, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.projFrames, Terraria.Main.rand, System.Math.Sign(), Terraria.WorldGen.SolidOrSlopedTile(), Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, System.type, Terraria.Tile.type, Microsoft.Xna.Framework.Vector2.UnitX, Microsoft.Xna.Framework.Vector2.UnitY, System.value, Microsoft.Xna.Framework.Point.X, Microsoft.Xna.Framework.Vector2.X, Microsoft.Xna.Framework.Point.Y, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector2.Zero.