public static IEnumerable <Obj_AI_Hero> GetTargets(float range,
                                                           DamageType damageType = DamageType.True,
                                                           bool ignoreShields    = true,
                                                           Vector3 from          = default(Vector3),
                                                           IEnumerable <Obj_AI_Hero> ignoredChampions = null)
        {
            try
            {
                Weights.Range = Math.Max(range, Weights.Range);

                var selectedTarget = Selected.GetTarget(range, damageType, ignoreShields, from);
                if (selectedTarget != null)
                {
                    return(new List <Obj_AI_Hero> {
                        selectedTarget
                    });
                }

                range = Mode == TargetSelectorModeType.Weights && ForceFocus ? Weights.Range : range;

                var targets =
                    Humanizer.FilterTargets(Targets.Items, from, range)
                    .Where(
                        h => ignoredChampions == null || ignoredChampions.All(i => i.NetworkId != h.Hero.NetworkId))
                    .Where(h => IsValidTarget(h.Hero, range, damageType, ignoreShields, from))
                    .ToList();

                if (targets.Count > 0)
                {
                    var t = GetOrderedChampions(targets).ToList();
                    if (t.Count > 0)
                    {
                        if (Selected.Target != null && Focus && t.Count > 1)
                        {
                            t = t.OrderByDescending(x => x.Hero.NetworkId.Equals(Selected.Target.NetworkId)).ToList();
                        }
                        return(t.Select(h => h.Hero).ToList());
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return(new List <Obj_AI_Hero>());
        }
예제 #2
0
        public static IEnumerable <Obj_AI_Hero> GetTargets(float range,
                                                           DamageType damageType = DamageType.True,
                                                           bool ignoreShields    = true,
                                                           Vector3 from          = default(Vector3),
                                                           IEnumerable <Obj_AI_Hero> ignoreChampions = null)
        {
            Weights.Range = Math.Max(range, Weights.Range);

            var selectedTarget = Selected.GetTarget(range, damageType, ignoreShields, from);

            if (selectedTarget != null)
            {
                return(new List <Obj_AI_Hero> {
                    selectedTarget
                });
            }

            range = Modes.Current.Mode == Mode.Weights && Selected.Focus.Enabled && Selected.Focus.Force
                ? Weights.Range
                : range;

            var targets =
                Humanizer.FilterTargets(Targets.Items)
                .Where(h => ignoreChampions == null || ignoreChampions.All(i => i.NetworkId != h.Hero.NetworkId))
                .Where(h => Utils.IsValidTarget(h.Hero, range, damageType, ignoreShields, from))
                .ToList();

            if (targets.Count > 0)
            {
                var t = Modes.GetOrderedChampions(targets).ToList();
                if (t.Count > 0)
                {
                    if (Selected.Target != null && Selected.Focus.Enabled && t.Count > 1)
                    {
                        t = t.OrderByDescending(x => x.Hero.NetworkId.Equals(Selected.Target.NetworkId)).ToList();
                    }
                    return(t.Select(h => h.Hero).ToList());
                }
            }
            return(new List <Obj_AI_Hero>());
        }