public static DiaObject GetBestUnitForCluster(IEnumerable <DiaObject> units, CombatContext context, ClusterType type, float clusterRange) { var firstOrDefault = units.Where(u => u.IsValid).Select(u => new { Unit = u, Count = EvaluateClusterSize(u.Position, context.UnitPositions, type, clusterRange) }).OrderByDescending(e => e.Count).FirstOrDefault(); if (firstOrDefault != null) { return (firstOrDefault.Unit); } return(null); }
public static int GetFacingCount(float range, float angle, CombatContext context) { using ( new PerformanceLogger(BelphegorSettings.Instance.Debug.IsDebugClusterLoggingActive, "GetFacingCount")) { if (BelphegorSettings.Instance.EnableClusterCounts) { return (context.UnitPositions.CachedPositions.Count( p => ZetaDia.Me.Position.Distance(p.Position) <= range && ZetaDia.Me.IsFacing(p.Position, angle))); } return(-1); } }
public static int GetClusterCount(DiaUnit target, CombatContext context, ClusterType type, float clusterRange) { using (new PerformanceLogger(BelphegorSettings.Instance.Debug.IsDebugClusterLoggingActive, "GetClusterCount")) { int count; if (BelphegorSettings.Instance.EnableClusterCounts) { count = EvaluateClusterSize(target.Position, context.UnitPositions, type, clusterRange); } else { count = -1; } return(count); } }
public static Vector3 GetBestPositionForClusters(CombatContext context, float clusterRange) { using ( new PerformanceLogger(BelphegorSettings.Instance.Debug.IsDebugClusterLoggingActive, "GetBestPositionForClusters")) { return (context.UnitPositions.CachedPositions.Select( p => new { p.Position, Count = EvaluateClusterSize(p.Position, context.UnitPositions, clusterRange) }) .OrderByDescending(e => e.Count) .Select(e => e.Position) .FirstOrDefault()); } }
private static Vector3 GenerateTargetPoint(CombatContext context) { IEnumerable <Vector3> points = context.AoePositions.Nodes.SelectMany( p => p.Position.GeneratePossibleTargetPoints(context, p.Radius + 2, BelphegorSettings.Instance.Avoidance. IsLocalPathingForPointGenerationActive)).Union( context.PlayerPosition.GeneratePossibleTargetPoints(context, 30f, BelphegorSettings.Instance.Avoidance. IsLocalPathingForPointGenerationActive)). Where(p => !p.IsCollidingWithAoe(context)); if (BelphegorSettings.Instance.Avoidance.IsNearestTargetPointEvaluationActive) { return(points.OrderBy(p => p.DistanceSqr(context.PlayerPosition)).FirstOrDefault()); } return(points.FirstOrDefault()); }
public static DiaObject GetBestUnitForCluster(CombatContext context, float clusterRange) { using ( new PerformanceLogger(BelphegorSettings.Instance.Debug.IsDebugClusterLoggingActive, "GetBestUnitForCluster")) { var firstOrDefault = context.CachedUnits.Where(u => u.IsValid) .Select( u => new { Unit = u, Count = EvaluateClusterSize(u.Position, context.UnitPositions, clusterRange) }) .OrderByDescending(e => e.Count) .FirstOrDefault(); return(firstOrDefault != null ? firstOrDefault.Unit : null); } }
internal static bool IsCollidingWithAoe(this Vector3 position, CombatContext context) { return(context.AoePositions.Nodes.Any(p => p.Position.DistanceSqr(position) <= p.Radius * p.Radius)); }
/// <summary> /// Counts how many minions you got summoned. /// </summary> /// <param name="context"></param> /// <param name="pet">Type of Pet</param> /// <returns></returns> public static int PetCount(CombatContext context, Pet pet) { return(GetMinions(context, pet).Count()); }
/// <summary> /// Determins if you have a pet summoned by you /// </summary> /// <param name="context"></param> /// <param name="pet">Type of Pet</param> /// <returns></returns> public static bool HasPet(CombatContext context, Pet pet) { return(GetMinions(context, pet).Any()); }
public static Vector3 GetBestPositionForClusters(CombatContext context, ClusterType type, float clusterRange) { return(context.UnitPositions.CachedPositions.Select(p => new { Position = p.Position, Count = EvaluateClusterSize(p.Position, context.UnitPositions, type, clusterRange) }).OrderByDescending(e => e.Count).Select(e => e.Position).FirstOrDefault()); }
public static bool IsEliteInRange(float range, CombatContext context) { return(context.CachedUnits.Any(u => (u).IsElite(range))); }