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

◆ AI_156_TryAttackingNPCs()

int Terraria.Projectile.AI_156_TryAttackingNPCs ( List< int > blackListedTargets,
bool skipBodyCheck = false )
inlineprivate

Definition at line 54579 of file Projectile.cs.

54580 {
54581 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
54582 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
54583 //IL_004b: Unknown result type (might be due to invalid IL or missing references)
54584 //IL_00a4: Unknown result type (might be due to invalid IL or missing references)
54585 Vector2 center = Main.player[owner].Center;
54586 int result = -1;
54587 float num = -1f;
54589 if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(this))
54590 {
54591 bool flag = true;
54593 {
54594 flag = false;
54595 }
54596 if (ownerMinionAttackTargetNPC.Distance(center) > 1000f)
54597 {
54598 flag = false;
54599 }
54601 {
54602 flag = false;
54603 }
54604 if (flag)
54605 {
54606 return ownerMinionAttackTargetNPC.whoAmI;
54607 }
54608 }
54609 for (int i = 0; i < 200; i++)
54610 {
54611 NPC nPC = Main.npc[i];
54612 if (nPC.CanBeChasedBy(this) && (nPC.boss || !blackListedTargets.Contains(i)))
54613 {
54614 float num2 = nPC.Distance(center);
54615 if (!(num2 > 1000f) && (!(num2 > num) || num == -1f) && (skipBodyCheck || CanHitWithOwnBody(nPC)))
54616 {
54617 num = num2;
54618 result = i;
54619 }
54620 }
54621 }
54622 return result;
54623 }
int owner
The index of the player who owns this projectile. In Multiplayer, Clients "own" projectiles that they...
bool CanHitWithOwnBody(Entity ent)

References Terraria.Main.npc, and Terraria.Main.player.