Пример #1
0
        /// <summary>
        ///     Gets the best valid enemy hero target in the game inside a determined range.
        /// </summary>
        public static AIHeroClient GetBestEnemyHeroTargetInRange(float range)
        {
            /*
             * var selectedTarget = TargetSelector.GetSelectedTarget();
             * if (selectedTarget != null &&
             * selectedTarget.IsValidTarget(range))
             * {
             * return selectedTarget;
             * }*/

            var orbTarget = Orbwalker.GetOrbwalkingTarget() as AIHeroClient;

            if (orbTarget != null &&
                orbTarget.IsValidTarget(range))
            {
                return(orbTarget);
            }

            var tsTarget = TargetSelector.LastTarget;

            if (tsTarget != null &&
                tsTarget.IsValidTarget(range))
            {
                return(tsTarget);
            }

            var lastTarget = ObjectCache.EnemyHeroes.FirstOrDefault(t =>
                                                                    t.IsValidTarget(range) && !t.IsZombie() && !Invulnerable.Check(t));

            if (lastTarget != null)
            {
                return(lastTarget);
            }

            return(null);
        }
Пример #2
0
        /// <summary>
        ///     Gets the best valid enemy hero target in the game inside a determined range.
        /// </summary>
        public static Obj_AI_Hero GetBestEnemyHeroTargetInRange(float range)
        {
            var selectedTarget = TargetSelector.GetSelectedTarget();

            if (selectedTarget != null &&
                selectedTarget.IsValidTarget(range))
            {
                return(selectedTarget);
            }

            var orbTarget = ImplementationClass.IOrbwalker.GetOrbwalkingTarget();

            if (orbTarget is Obj_AI_Hero hero &&
                orbTarget.IsValidTarget(range))
            {
                return(hero);
            }

            var tsTarget = ImplementationClass.ITargetSelector.GetTarget(range);

            if (tsTarget != null)
            {
                return(tsTarget);
            }

            var lastTarget = GameObjects.EnemyHeroes.FirstOrDefault(t => t.IsValidTarget(range) && !t.IsZombie() && !Invulnerable.Check(t));

            // ReSharper disable once ConvertIfStatementToReturnStatement
            if (lastTarget != null)
            {
                return(lastTarget);
            }

            return(null);
        }