示例#1
0
        public static AIHeroClient GetTarget(float range,
                                             TargetSelector2.DamageType damageType,
                                             bool ignoreShield = true,
                                             IEnumerable <AIHeroClient> ignoredChamps = null,
                                             Vector3?rangeCheckFrom = null)
        {
            if (_lastTarget == null || !_lastTarget.IsValidTarget() || _lastDamageType != damageType)
            {
                var newTarget = TargetSelector2.GetTarget(range, damageType, ignoreShield, ignoredChamps, rangeCheckFrom);

                _lastTarget     = newTarget;
                _lastDamageType = damageType;

                return(newTarget);
            }

            if (_lastTarget.IsValidTarget(range) && damageType == _lastDamageType)
            {
                return(_lastTarget);
            }

            var newTarget2 = TargetSelector2.GetTarget(range, damageType, ignoreShield, ignoredChamps, rangeCheckFrom);

            _lastTarget     = newTarget2;
            _lastDamageType = damageType;

            return(newTarget2);
        }
示例#2
0
        public Spell2(SpellSlot slot,
            float range = float.MaxValue,
            TargetSelector2.DamageType damageType = TargetSelector2.DamageType.Physical)
        {
            Slot = slot;
            Range = range;
            DamageType = damageType;

            // Default values
            MinHitChance = HitChance.VeryHigh;
        }
示例#3
0
            public virtual AttackableUnit GetTarget()
            {
                AttackableUnit result = null;

                if ((ActiveMode == OrbwalkingMode.Mixed || ActiveMode == OrbwalkingMode.Clear) &&
                    !SubMenu["Orbwalker2"]["PriorizeFarm"].Cast <CheckBox>().CurrentValue)
                {
                    var target = TargetSelector2.GetTarget(Player.GetAutoAttackRange(), TargetSelector2.DamageType.Physical);
                    if (target != null && InAutoAttackRange(target))
                    {
                        return(target);
                    }
                }
                /*Killable Minion*/
                if (ActiveMode == OrbwalkingMode.Clear || ActiveMode == OrbwalkingMode.Mixed ||
                    ActiveMode == OrbwalkingMode.LastHit)
                {
                    var MinionList =
                        ObjectManager.Get <Obj_AI_Minion>()
                        .Where(
                            minion =>
                            minion.IsValidTarget() && InAutoAttackRange(minion))
                        .OrderByDescending(minion => minion.BaseSkinName.Contains("Siege"))
                        .ThenBy(minion => minion.BaseSkinName.Contains("Super"))
                        .ThenBy(minion => minion.Health)
                        .ThenByDescending(minion => minion.MaxHealth);

                    foreach (var minion in MinionList)
                    {
                        var t = (int)(Player.AttackCastDelay * 1000) - 100 + Game.Ping / 2 +
                                1000 * (int)Math.Max(0, Player.Distance2(minion) - Player.BoundingRadius) / (int)GetMyProjectileSpeed();
                        var predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay);

                        if (minion.Team != GameObjectTeam.Neutral && (SubMenu["Orbwalker2"]["AttackPetsnTraps"].Cast <CheckBox>().CurrentValue&& minion.BaseSkinName != "jarvanivstandard" || MinionManager.IsMinion(minion, SubMenu["Orbwalker2"]["AttackWards"].Cast <CheckBox>().CurrentValue)))
                        {
                            if (predHealth <= 0)
                            {
                                FireOnNonKillableMinion(minion);
                            }

                            if (predHealth > 0 && predHealth <= Player.GetAutoAttackDamage2(minion, true))
                            {
                                return(minion);
                            }
                        }
                    }
                }
                //Forced target
                if (_forcedTarget.IsValidTarget() && InAutoAttackRange(_forcedTarget))
                {
                    return(_forcedTarget);
                }

                /* turrets / inhibitors / nexus */
                if (ActiveMode == OrbwalkingMode.Clear)
                {
                    /* turrets */
                    foreach (var turret in
                             ObjectManager.Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                    {
                        return(turret);
                    }

                    /* inhibitor */
                    foreach (var turret in
                             ObjectManager.Get <Obj_BarracksDampener>().Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                    {
                        return(turret);
                    }

                    /* nexus */
                    foreach (var nexus in
                             ObjectManager.Get <Obj_HQ>().Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                    {
                        return(nexus);
                    }
                }

                /*Champions*/
                if (ActiveMode != OrbwalkingMode.LastHit)
                {
                    var target = TargetSelector2.GetTarget(Player.GetAutoAttackRange(), TargetSelector2.DamageType.Physical);
                    if (target.IsValidTarget() && InAutoAttackRange(target))
                    {
                        return(target);
                    }
                }

                /*Jungle minions*/
                if (ActiveMode == OrbwalkingMode.Clear || ActiveMode == OrbwalkingMode.Mixed)
                {
                    var jminions =
                        ObjectManager.Get <Obj_AI_Minion>()
                        .Where(
                            mob =>
                            mob.IsValidTarget() && mob.Team == GameObjectTeam.Neutral && InAutoAttackRange(mob) &&
                            mob.BaseSkinName != "gangplankbarrel");

                    result = SubMenu["Orbwalker2"]["Smallminionsprio"].Cast <CheckBox>().CurrentValue ? jminions.MinOrDefault(mob => mob.MaxHealth) : jminions.MaxOrDefault(mob => mob.MaxHealth);

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

                /*Lane Clear minions*/
                if (ActiveMode == OrbwalkingMode.Clear)
                {
                    if (!ShouldWait())
                    {
                        if (_prevMinion.IsValidTarget() && InAutoAttackRange(_prevMinion))
                        {
                            var predHealth = HealthPrediction.LaneClearHealthPrediction(
                                _prevMinion, (int)((Player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay);
                            if (predHealth >= 2 * Player.GetAutoAttackDamage2(_prevMinion) ||
                                Math.Abs(predHealth - _prevMinion.Health) < float.Epsilon)
                            {
                                return(_prevMinion);
                            }
                        }

                        result = (from minion in
                                  ObjectManager.Get <Obj_AI_Minion>()
                                  .Where(minion => minion.IsValidTarget() && InAutoAttackRange(minion) &&
                                         (SubMenu["Orbwalker2"]["AttackWards"].Cast <CheckBox>().CurrentValue || !MinionManager.IsWard(minion.BaseSkinName.ToLower())) &&
                                         (SubMenu["Orbwalker2"]["AttackPetsnTraps"].Cast <CheckBox>().CurrentValue&& minion.BaseSkinName != "jarvanivstandard" || MinionManager.IsMinion(minion, SubMenu["Orbwalker2"]["AttackWards"].Cast <CheckBox>().CurrentValue)) &&
                                         minion.BaseSkinName != "gangplankbarrel")
                                  let predHealth =
                                      HealthPrediction.LaneClearHealthPrediction(
                                          minion, (int)((Player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay)
                                      where
                                      predHealth >= 2 * Player.GetAutoAttackDamage2(minion) ||
                                      Math.Abs(predHealth - minion.Health) < float.Epsilon
                                      select minion).MaxOrDefault(m => !MinionManager.IsMinion(m, true) ? float.MaxValue : m.Health);

                        if (result != null)
                        {
                            _prevMinion = (Obj_AI_Minion)result;
                        }
                    }
                }

                return(result);
            }
示例#4
0
        public static AIHeroClient GetTarget(float range,
            TargetSelector2.DamageType damageType,
            bool ignoreShield = true,
            IEnumerable<AIHeroClient> ignoredChamps = null,
            Vector3? rangeCheckFrom = null)
        {
            if (_lastTarget == null || !_lastTarget.IsValidTarget() || _lastDamageType != damageType)
            {
                var newTarget = TargetSelector2.GetTarget(range, damageType, ignoreShield, ignoredChamps, rangeCheckFrom);

                _lastTarget = newTarget;
                _lastDamageType = damageType;

                return newTarget;
            }

            if (_lastTarget.IsValidTarget(range) && damageType == _lastDamageType)
            {
                return _lastTarget;
            }

            var newTarget2 = TargetSelector2.GetTarget(range, damageType, ignoreShield, ignoredChamps, rangeCheckFrom);

            _lastTarget = newTarget2;
            _lastDamageType = damageType;

            return newTarget2;
        }
示例#5
0
 /// <summary>
 ///     Returns the best target found using the current TargetSelector mode.
 ///     Please make sure to set the Spell.DamageType Property to the type of damage this spell does (if not done on
 ///     initialization).
 /// </summary>
 public AIHeroClient GetTarget(float extraRange = 0, IEnumerable <AIHeroClient> champsToIgnore = null)
 {
     return(TargetSelector2.GetTarget(Range + extraRange, DamageType, true, champsToIgnore, From));
 }
示例#6
0
 public static void AddToMenu(Menu menu)
 {
     TargetSelector2.AddToMenu(menu);
 }