Exemplo n.º 1
0
        /// <summary>
        /// Returns if the unit will get hit by skillshots taking the path.
        /// </summary>
        public static SafePathResult IsSafePath(GamePath path,
            int timeOffset,
            int speed = -1,
            int delay = 0,
            Obj_AI_Base unit = null)
        {
            var IsSafe = true;
            var intersections = new List<FoundIntersection>();
            var intersection = new FoundIntersection();

            foreach (var skillshot in DetectedSkillshots)
            {
                if (skillshot.Evade())
                {
                    var sResult = skillshot.IsSafePath(path, timeOffset, speed, delay, unit);
                    IsSafe = (IsSafe) ? sResult.IsSafe : false;

                    if (sResult.Intersection.Valid)
                    {
                        intersections.Add(sResult.Intersection);
                    }
                }
            }

            //Return the first intersection
            if (!IsSafe)
            {
                var sortedList = intersections.OrderBy(o => o.Distance).ToList();

                return new SafePathResult(false, sortedList.Count > 0 ? sortedList[0] : intersection);
            }

            return new SafePathResult(IsSafe, intersection);
        }
Exemplo n.º 2
0
 public SafePathResult(bool isSafe, FoundIntersection intersection)
 {
     IsSafe       = isSafe;
     Intersection = intersection;
 }