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

◆ AI_134_Ballista_FindTarget()

int Terraria.Projectile.AI_134_Ballista_FindTarget ( float shot_range,
float deadBottomAngle,
Vector2 shootingSpot )
inlineprivate

Definition at line 75257 of file Projectile.cs.

75258 {
75259 //IL_00e6: Unknown result type (might be due to invalid IL or missing references)
75260 //IL_00e9: Unknown result type (might be due to invalid IL or missing references)
75261 //IL_00fc: Unknown result type (might be due to invalid IL or missing references)
75262 //IL_0101: Unknown result type (might be due to invalid IL or missing references)
75263 //IL_0102: Unknown result type (might be due to invalid IL or missing references)
75264 //IL_0107: Unknown result type (might be due to invalid IL or missing references)
75265 //IL_010c: Unknown result type (might be due to invalid IL or missing references)
75266 //IL_0111: Unknown result type (might be due to invalid IL or missing references)
75267 //IL_0113: Unknown result type (might be due to invalid IL or missing references)
75268 //IL_011f: Unknown result type (might be due to invalid IL or missing references)
75269 //IL_0030: Unknown result type (might be due to invalid IL or missing references)
75270 //IL_0032: Unknown result type (might be due to invalid IL or missing references)
75271 //IL_012f: Unknown result type (might be due to invalid IL or missing references)
75272 //IL_0042: Unknown result type (might be due to invalid IL or missing references)
75273 //IL_0047: Unknown result type (might be due to invalid IL or missing references)
75274 //IL_0048: Unknown result type (might be due to invalid IL or missing references)
75275 //IL_004d: Unknown result type (might be due to invalid IL or missing references)
75276 //IL_0052: Unknown result type (might be due to invalid IL or missing references)
75277 //IL_0057: Unknown result type (might be due to invalid IL or missing references)
75278 //IL_0059: Unknown result type (might be due to invalid IL or missing references)
75279 //IL_0065: Unknown result type (might be due to invalid IL or missing references)
75280 //IL_0157: Unknown result type (might be due to invalid IL or missing references)
75281 //IL_015c: Unknown result type (might be due to invalid IL or missing references)
75282 //IL_0143: Unknown result type (might be due to invalid IL or missing references)
75283 //IL_014b: Unknown result type (might be due to invalid IL or missing references)
75284 //IL_0075: Unknown result type (might be due to invalid IL or missing references)
75285 //IL_009c: Unknown result type (might be due to invalid IL or missing references)
75286 //IL_00a0: Unknown result type (might be due to invalid IL or missing references)
75287 //IL_0088: Unknown result type (might be due to invalid IL or missing references)
75288 //IL_0090: Unknown result type (might be due to invalid IL or missing references)
75289 int num = -1;
75291 if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(this))
75292 {
75293 for (int i = 0; i < 1; i++)
75294 {
75295 if (!ownerMinionAttackTargetNPC.CanBeChasedBy(this))
75296 {
75297 continue;
75298 }
75299 float num2 = Vector2.Distance(shootingSpot, ownerMinionAttackTargetNPC.Center);
75300 if (!(num2 > shot_range))
75301 {
75302 Vector2 vector = (ownerMinionAttackTargetNPC.Center - shootingSpot).SafeNormalize(Vector2.UnitY);
75303 if ((!(Math.Abs(vector.X) < Math.Abs(vector.Y) * deadBottomAngle) || !(vector.Y > 0f)) && (num == -1 || num2 < Vector2.Distance(shootingSpot, Main.npc[num].Center)) && Collision.CanHitLine(shootingSpot, 0, 0, ownerMinionAttackTargetNPC.Center, 0, 0))
75304 {
75306 }
75307 }
75308 }
75309 if (num != -1)
75310 {
75311 return num;
75312 }
75313 }
75314 for (int j = 0; j < 200; j++)
75315 {
75316 NPC nPC = Main.npc[j];
75317 if (!nPC.CanBeChasedBy(this))
75318 {
75319 continue;
75320 }
75321 float num3 = Vector2.Distance(shootingSpot, nPC.Center);
75322 if (!(num3 > shot_range))
75323 {
75324 Vector2 vector2 = (nPC.Center - shootingSpot).SafeNormalize(Vector2.UnitY);
75325 if ((!(Math.Abs(vector2.X) < Math.Abs(vector2.Y) * deadBottomAngle) || !(vector2.Y > 0f)) && (num == -1 || num3 < Vector2.Distance(shootingSpot, Main.npc[num].Center)) && Collision.CanHitLine(shootingSpot, 0, 0, nPC.Center, 0, 0))
75326 {
75327 num = j;
75328 }
75329 }
75330 }
75331 return num;
75332 }

References Terraria.Collision.CanHitLine(), and Terraria.Main.npc.

+ Here is the call graph for this function: