25 return (
Player player) => player.
Distance(position) <= maxDistance;
30 if (npc.
type != 211 && npc.
type != 210 && npc.
type != 222)
39 return delegate(
Player player)
42 float num = player.Center.X - npc.
Center.
X;
45 return player.active && !player.dead && num3 < 100f && num2 < maxDistanceX && ((num > 0f && windSpeedCurrent > 0f) || (num < 0f && windSpeedCurrent < 0f));
143 public TargetSearchResults(
NPC searcher,
int nearestNPCIndex,
float nearestNPCDistance,
int nearestTankIndex,
float nearestTankDistance,
float adjustedTankDistance,
TargetType tankType)
188 return SearchForTarget(
null, position, flags, playerFilter, npcFilter);
198 float num =
float.MaxValue;
199 int nearestNPCIndex = -1;
200 float num2 =
float.MaxValue;
201 float nearestTankDistance =
float.MaxValue;
202 int nearestTankIndex = -1;
206 for (
int i = 0; i < 200; i++)
209 if (nPC.
active && nPC.
whoAmI != searcher.
whoAmI && (npcFilter ==
null || npcFilter(nPC)))
222 for (
int j = 0; j < 255; j++)
225 if (!player.
active || player.
dead || player.
ghost || (playerFilter !=
null && !playerFilter(player)))
230 float num5 = num4 - (float)player.
aggro;
232 if (searcher !=
null && flag && searcher.
direction == 0)
238 nearestTankIndex = j;
240 nearestTankDistance = num4;
243 if (player.
tankPet >= 0 && !flag)
248 if (num5 < num2 && num5 < 200f &&
Collision.
CanHit(position, 0, 0, center, 0, 0))
250 nearestTankIndex = j;
252 nearestTankDistance = num4;
258 return new TargetSearchResults(searcher, nearestNPCIndex, (
float)
Math.
Sqrt(num), nearestTankIndex, nearestTankDistance, num2, tankType);
static double Sqrt(double d)
static double Abs(double value)
static bool CanHit(Entity source, Entity target)
float Distance(Vector2 Other)
static float windSpeedCurrent
static Projectile[] projectile
bool ShouldFaceTarget(ref NPCUtils.TargetSearchResults searchResults, NPCUtils.TargetType? overrideTargetType=null)
void TargetClosest(bool faceTarget=true)
bool dontTakeDamageFromHostiles
bool CanBeChasedBy(object attacker=null, bool ignoreDontTakeDamage=false)
int WhoAmIToTargettingIndex
static bool OnlyCrystal(NPC npc)
static SearchFilter< Player > DownwindFromNPC(NPC npc, float maxDistanceX)
static bool NonBeeNPCs(NPC npc)
static SearchFilter< Player > OnlyPlayersInCertainDistance(Vector2 position, float maxDistance)
static TargetSearchResults SearchForTarget(NPC searcher, Vector2 position, TargetSearchFlag flags=TargetSearchFlag.All, SearchFilter< Player > playerFilter=null, SearchFilter< NPC > npcFilter=null)
static void TargetClosestBetsy(NPC searcher, bool faceTarget=true, Vector2? checkPosition=null)
static void TargetClosestCommon(NPC searcher, bool faceTarget=true, Vector2? checkPosition=null)
static void TargetClosestOldOnesInvasion(NPC searcher, bool faceTarget=true, Vector2? checkPosition=null)
delegate void NPCTargetingMethod(NPC searcher, bool faceTarget, Vector2? checkPosition)
static void TargetClosestDownwindFromNPC(NPC searcher, float distanceMaxX, bool faceTarget=true, Vector2? checkPosition=null)
static TargetSearchResults SearchForTarget(Vector2 position, TargetSearchFlag flags=TargetSearchFlag.All, SearchFilter< Player > playerFilter=null, SearchFilter< NPC > npcFilter=null)
delegate bool SearchFilter< T >(T entity)
static void TargetClosestNonBees(NPC searcher, bool faceTarget=true, Vector2? checkPosition=null)
static TargetSearchResults SearchForTarget(NPC searcher, TargetSearchFlag flags=TargetSearchFlag.All, SearchFilter< Player > playerFilter=null, SearchFilter< NPC > npcFilter=null)
static float DistanceSquared(Vector2 value1, Vector2 value2)
static float Distance(Vector2 value1, Vector2 value2)
float _nearestTankDistance
TargetType _nearestTargetType
float _nearestNPCDistance
TargetType _nearestTankType
TargetType NearestTankType
int NearestTankOwnerIndex
float NearestTankDistance
TargetType NearestTargetType
TargetSearchResults(NPC searcher, int nearestNPCIndex, float nearestNPCDistance, int nearestTankIndex, float nearestTankDistance, float adjustedTankDistance, TargetType tankType)
float AdjustedTankDistance
float _adjustedTankDistance
Rectangle NearestTargetHitbox