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

◆ AI_123_Deerclops_TryMakingSpike_FindBestY()

int Terraria.NPC.AI_123_Deerclops_TryMakingSpike_FindBestY ( ref Point sourceTileCoords,
int x )
inlineprivate

Definition at line 45076 of file NPC.cs.

45077 {
45078 //IL_001c: Unknown result type (might be due to invalid IL or missing references)
45079 //IL_0021: Unknown result type (might be due to invalid IL or missing references)
45080 //IL_0026: Unknown result type (might be due to invalid IL or missing references)
45081 //IL_003e: Unknown result type (might be due to invalid IL or missing references)
45082 //IL_007e: Unknown result type (might be due to invalid IL or missing references)
45083 //IL_008d: Unknown result type (might be due to invalid IL or missing references)
45084 //IL_0092: Unknown result type (might be due to invalid IL or missing references)
45085 int num = sourceTileCoords.Y;
45087 if (!targetData.Invalid)
45088 {
45089 Rectangle hitbox = targetData.Hitbox;
45090 Vector2 vector = default(Vector2);
45091 ((Vector2)(ref vector))._002Ector((float)((Rectangle)(ref hitbox)).Center.X, (float)((Rectangle)(ref hitbox)).Bottom);
45092 int num7 = (int)(vector.Y / 16f);
45093 int num2 = Math.Sign(num7 - num);
45094 int num3 = num7 + num2 * 15;
45095 int? num4 = null;
45096 float num5 = float.PositiveInfinity;
45097 for (int i = num; i != num3; i += num2)
45098 {
45099 if (WorldGen.ActiveAndWalkableTile(x, i))
45100 {
45101 float num6 = Utils.ToWorldCoordinates(new Point(x, i), 8f, 8f).Distance(vector);
45102 if (!num4.HasValue || !(num6 >= num5))
45103 {
45104 num4 = i;
45105 num5 = num6;
45106 }
45107 }
45108 }
45109 if (num4.HasValue)
45110 {
45111 num = num4.Value;
45112 }
45113 }
45114 for (int j = 0; j < 20; j++)
45115 {
45116 if (num < 10)
45117 {
45118 break;
45119 }
45120 if (!WorldGen.SolidTile(x, num))
45121 {
45122 break;
45123 }
45124 num--;
45125 }
45126 for (int k = 0; k < 20; k++)
45127 {
45128 if (num > Main.maxTilesY - 10)
45129 {
45130 break;
45131 }
45132 if (WorldGen.ActiveAndWalkableTile(x, num))
45133 {
45134 break;
45135 }
45136 num++;
45137 }
45138 return num;
45139 }
Vector2 Center
Definition Entity.cs:70
Vector2 Bottom
Definition Entity.cs:170
float Distance(Vector2 Other)
Definition Entity.cs:275
NPCAimedTarget GetTargetData(bool ignorePlayerTankPets=true)
Definition NPC.cs:1668

References Terraria.WorldGen.ActiveAndWalkableTile(), Terraria.Entity.Bottom, Terraria.Entity.Center, Terraria.Entity.Distance(), Terraria.NPC.GetTargetData(), Terraria.Main.maxTilesY, Terraria.WorldGen.SolidTile(), and Terraria.Utils.ToWorldCoordinates().

Referenced by Terraria.NPC.AI_123_Deerclops_TryMakingSpike().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: