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

◆ AI_135_OgreStomp()

void Terraria.Projectile.AI_135_OgreStomp ( )
inlineprivate

Definition at line 57935 of file Projectile.cs.

57936 {
57937 float num = 40f;
57938 if (type == 922)
57939 {
57940 num = 30f;
57941 }
57942 ai[0] += 1f;
57943 if (ai[0] > 9f)
57944 {
57945 Kill();
57946 return;
57947 }
57949 position = base.Center;
57950 base.Size = new Vector2(16f, 16f) * MathHelper.Lerp(5f, num, Utils.GetLerpValue(0f, 9f, ai[0]));
57951 base.Center = position;
57952 Point point = base.TopLeft.ToTileCoordinates();
57953 Point point2 = base.BottomRight.ToTileCoordinates();
57954 int num2 = point.X / 2 + point2.X / 2;
57955 int num3 = width / 2;
57956 if ((int)ai[0] % 3 != 0)
57957 {
57958 return;
57959 }
57960 int num4 = (int)ai[0] / 3;
57961 for (int i = point.X; i <= point2.X; i++)
57962 {
57963 for (int j = point.Y; j <= point2.Y; j++)
57964 {
57965 if (Vector2.Distance(base.Center, new Vector2(i * 16, j * 16)) > (float)num3)
57966 {
57967 continue;
57968 }
57969 Tile tileSafely = Framing.GetTileSafely(i, j);
57970 if (!tileSafely.active() || !Main.tileSolid[tileSafely.type] || Main.tileSolidTop[tileSafely.type] || Main.tileFrameImportant[tileSafely.type])
57971 {
57972 continue;
57973 }
57974 Tile tileSafely2 = Framing.GetTileSafely(i, j - 1);
57975 if (tileSafely2.active() && Main.tileSolid[tileSafely2.type] && !Main.tileSolidTop[tileSafely2.type])
57976 {
57977 continue;
57978 }
57979 int num5 = WorldGen.KillTile_GetTileDustAmount(fail: true, tileSafely);
57980 for (int k = 0; k < num5; k++)
57981 {
57982 Dust obj = Main.dust[WorldGen.KillTile_MakeTileDust(i, j, tileSafely)];
57983 obj.velocity.Y -= 3f + (float)num4 * 1.5f;
57984 obj.velocity.Y *= Main.rand.NextFloat();
57985 obj.velocity.Y *= 0.75f;
57986 obj.scale += (float)num4 * 0.03f;
57987 }
57988 if (num4 >= 2)
57989 {
57990 if (type == 922)
57991 {
57992 Color newColor = NPC.AI_121_QueenSlime_GetDustColor();
57993 newColor.A = 150;
57994 for (int l = 0; l < num5 - 1; l++)
57995 {
57996 int num6 = Dust.NewDust(position, 12, 12, 4, 0f, 0f, 50, newColor, 1.5f);
57997 Main.dust[num6].velocity.Y -= 0.1f + (float)num4 * 0.5f;
57998 Main.dust[num6].velocity.Y *= Main.rand.NextFloat();
57999 Main.dust[num6].velocity.X *= Main.rand.NextFloatDirection() * 3f;
58000 Main.dust[num6].position = new Vector2(i * 16 + Main.rand.Next(16), j * 16 + Main.rand.Next(16));
58001 if (Main.rand.Next(3) != 0)
58002 {
58003 Main.dust[num6].velocity *= 0.5f;
58004 Main.dust[num6].noGravity = true;
58005 }
58006 }
58007 }
58008 else
58009 {
58010 for (int m = 0; m < num5 - 1; m++)
58011 {
58012 Dust obj2 = Main.dust[WorldGen.KillTile_MakeTileDust(i, j, tileSafely)];
58013 obj2.velocity.Y -= 1f + (float)num4;
58014 obj2.velocity.Y *= Main.rand.NextFloat();
58015 obj2.velocity.Y *= 0.75f;
58016 }
58017 }
58018 }
58019 if (num5 <= 0 || Main.rand.Next(3) == 0)
58020 {
58021 continue;
58022 }
58023 float num7 = (float)Math.Abs(num2 - i) / (num / 2f);
58024 if (type == 922)
58025 {
58026 Color newColor2 = NPC.AI_121_QueenSlime_GetDustColor();
58027 newColor2.A = 150;
58028 for (int n = 0; n < 3; n++)
58029 {
58030 int num8 = Dust.NewDust(position, width, height, 31, 0f, 0f, 50, newColor2, 2f - (float)num4 * 0.15f + num7 * 0.5f);
58031 Main.dust[num8].velocity.Y -= 0.1f + (float)num4 * 0.5f + num7 * (float)num4 * 1f;
58032 Main.dust[num8].velocity.Y *= Main.rand.NextFloat();
58033 Main.dust[num8].velocity.X *= Main.rand.NextFloatDirection() * 3f;
58034 Main.dust[num8].position = new Vector2(i * 16 + 20, j * 16 + 20);
58035 if (Main.rand.Next(3) != 0)
58036 {
58037 Main.dust[num8].velocity *= 0.5f;
58038 Main.dust[num8].noGravity = true;
58039 }
58040 }
58041 }
58042 else
58043 {
58044 Gore gore = Gore.NewGoreDirect(position, Vector2.Zero, 61 + Main.rand.Next(3), 1f - (float)num4 * 0.15f + num7 * 0.5f);
58045 gore.velocity.Y -= 0.1f + (float)num4 * 0.5f + num7 * (float)num4 * 1f;
58046 gore.velocity.Y *= Main.rand.NextFloat();
58047 gore.position = new Vector2(i * 16 + 20, j * 16 + 20);
58048 }
58049 }
58050 }
58051 }
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static double Abs(double value)
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
static float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91

References System.Math.Abs(), Terraria.NPC.AI_121_QueenSlime_GetDustColor(), Microsoft.Xna.Framework.Vector2.Distance(), Terraria.Main.dust, Terraria.Utils.GetLerpValue(), Terraria.Framing.GetTileSafely(), Terraria.WorldGen.KillTile_GetTileDustAmount(), Terraria.WorldGen.KillTile_MakeTileDust(), Microsoft.Xna.Framework.MathHelper.Lerp(), Terraria.Dust.NewDust(), Terraria.Gore.NewGoreDirect(), System.obj, Terraria.Main.rand, Terraria.Main.tileFrameImportant, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, System.type, Microsoft.Xna.Framework.Point.X, Microsoft.Xna.Framework.Point.Y, and Microsoft.Xna.Framework.Vector2.Zero.