Example #1
0
        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);
        }
Example #2
0
 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);
     }
 }
Example #3
0
        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);
            }
        }
Example #4
0
 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());
     }
 }
Example #5
0
        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());
        }
Example #6
0
 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);
     }
 }
Example #7
0
 internal static bool IsCollidingWithAoe(this Vector3 position, CombatContext context)
 {
     return(context.AoePositions.Nodes.Any(p => p.Position.DistanceSqr(position) <= p.Radius * p.Radius));
 }
Example #8
0
 /// <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());
 }
Example #9
0
 /// <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());
 }
Example #10
0
 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());
 }
Example #11
0
 public static bool IsEliteInRange(float range, CombatContext context)
 {
     return(context.CachedUnits.Any(u => (u).IsElite(range)));
 }