Exemplo n.º 1
0
        internal static List <Obj_AI_Base> GetDashObjects(IEnumerable <Obj_AI_Base> predefinedObjectList = null)
        {
            float realAArange = Orbwalking.GetRealAutoAttackRange(player);

            List <Obj_AI_Base> objects;

            if (predefinedObjectList != null)
            {
                objects = predefinedObjectList.ToList();
            }
            else
            {
                objects = ObjectManager.Get <Obj_AI_Base>().Where(o => o.IsValidTarget(realAArange)).ToList();
            }

            Vector2 apexPoint = player.ServerPosition.To2D() + (player.ServerPosition.To2D() - Game.CursorPos.To2D()).Normalized() * realAArange;

            List <Obj_AI_Base> targets = new List <Obj_AI_Base>();

            foreach (var obj in objects)
            {
                if (VectorHelper.IsLyingInCone(obj.ServerPosition.To2D(), apexPoint, player.ServerPosition.To2D(), realAArange))
                {
                    targets.Add(obj);
                }
            }

            targets.Sort((t1, t2) => t1.Distance(apexPoint, true).CompareTo(t2.Distance(apexPoint, true)));

            return(targets);
        }
Exemplo n.º 2
0
        public static List <Obj_AI_Base> GetDashObjects(IEnumerable <Obj_AI_Base> predefinedObjectList = null)
        {
            List <Obj_AI_Base> objects;

            if (predefinedObjectList != null)
            {
                objects = predefinedObjectList.ToList();
            }
            else
            {
                objects = ObjectManager.Get <Obj_AI_Base>().Where(o => o.IsValidTarget(Orbwalking.GetRealAutoAttackRange(o))).ToList();
            }

            var apexPoint = player.ServerPosition.To2D() + (player.ServerPosition.To2D() - Game.CursorPos.To2D()).Normalized() * Orbwalking.GetRealAutoAttackRange(player);

            return(objects.Where(o => VectorHelper.IsLyingInCone(o.ServerPosition.To2D(), apexPoint, player.ServerPosition.To2D(), Math.PI)).OrderBy(o => o.Distance(apexPoint, true)).ToList());
        }
Exemplo n.º 3
0
        internal static Obj_AI_Base GetDashObject()
        {
            float realAArange = Orbwalking.GetRealAutoAttackRange(player);

            var     objects   = ObjectManager.Get <Obj_AI_Base>().Where(o => o.IsValidTarget(realAArange));
            Vector2 apexPoint = player.ServerPosition.To2D() + (player.ServerPosition.To2D() - Game.CursorPos.To2D()).Normalized() * realAArange;

            Obj_AI_Base target = null;

            foreach (var obj in objects)
            {
                if (VectorHelper.IsLyingInCone(obj.ServerPosition.To2D(), apexPoint, player.ServerPosition.To2D(), realAArange))
                {
                    if (target == null || target.Distance(apexPoint, true) > obj.Distance(apexPoint, true))
                    {
                        target = obj;
                    }
                }
            }

            return(target);
        }