예제 #1
0
파일: Orbwalker.cs 프로젝트: toannatkm0/LOZ
 /// <summary>
 ///     Forces the orbwalker to move to that point while orbwalking (Game.CursorPos by default).
 /// </summary>
 public void SetOrbwalkingPoint(Vector3 point)
 {
     if (point.IsZero)
     {
         return;
     }
     if (!_forcedPosition.IsZero)
     {
         if (Environment.TickCount - _forcedPositionTick > 1500)
         {
             _forcedPosition = Vector3.Zero;
         }
         if (ObjectManager.Player.Distance(_forcedPosition) < 150)
         {
             _forcedPosition = Vector3.Zero;
         }
         else
         {
             return;
         }
     }
     if (Program.Map == Utility.Map.MapType.SummonersRift &&
         ObjectManager.Player.HealthPercent < Program.Config.Item("recallhp").GetValue <Slider>().Value)
     {
         ActiveMode       = OrbwalkingMode.Combo;
         _orbwalkingPoint = HeadQuarters.AllyHQ.Position.RandomizePosition();
         return;
     }
     _orbwalkingPoint = point;
     ActiveMode       = OrbwalkingMode.LaneClear;
 }
예제 #2
0
파일: Zyra.cs 프로젝트: wade1990/PortAIO
        /// <summary>
        ///     seeds handler
        /// </summary>
        /// <param name="cMode">your current orbwalker mode</param>
        /// <param name="spell">spell where its coming from.</param>
        /// <param name="pos">pos where it should be casted.</param>
        public static void HandleW(OrbwalkingMode cMode, string spell, Vector2 pos)
        {
            if (Utilities.W.Level == 0)
            {
                return;
            }

            if ((cMode == OrbwalkingMode.LaneClear) && Utilities.MainMenu["W"]["FarmW"])
            {
                if ((spell == "Q") && pos.IsValid() && !pos.IsUnderEnemyTurret())
                {
                    DelayAction.Add(10, () => { Utilities.W.Cast(pos); });
                }
            }
            else if ((cMode == OrbwalkingMode.Combo) && Utilities.MainMenu["W"]["ComboW"])
            {
                if ((spell == "Q") && pos.IsValid() && !pos.IsUnderEnemyTurret())
                {
                    DelayAction.Add(10, () =>
                    {
                        Utilities.W.Cast(pos);
                        if (Utilities.W.IsReady())
                        {
                            Utilities.W.Cast(pos);
                        }
                    });
                }
            }
        }
예제 #3
0
        public void HandleCards(OrbwalkingMode orbMode, bool urgent)
        {
            var counth = GameObjects.EnemyHeroes.Count(x => GameObjects.Player.Distance(x) <= SpellW.Range + 200);

            var countm = GameObjects.EnemyMinions.Count(y => GameObjects.Player.Distance(y) <= SpellW.Range + 200) +
                         GameObjects.EnemyTurrets.Count(t => GameObjects.Player.Distance(t) <= SpellW.Range + 200);

            var    countj = GameObjects.Jungle.Count(z => GameObjects.Player.Distance(z) <= SpellW.Range + 200);
            string name   = ObjectManager.Player.Spellbook.GetSpell(SpellSlot.W).Name;

            if (urgent && orbMode == OrbwalkingMode.Combo)
            {
                InstaPickCardOnUlt();
                return;
            }

            if (orbMode == OrbwalkingMode.Combo && IsOn(orbMode) && (counth > 0 || name != "PickACard"))
            {
                PickCard(GetActiveCardCombo());
            }
            else if ((orbMode == OrbwalkingMode.Hybrid || orbMode == OrbwalkingMode.LaneClear) && IsOn(orbMode) &&
                     (countj > 0 || countm > 0))
            {
                PickCard(GetActiveCardFarm());
            }
            else if (orbMode == OrbwalkingMode.LastHit && IsOn(orbMode) && countm > 0)
            {
                PickCard(GetActiveCardFarm());
            }
        }
예제 #4
0
파일: Karthus.cs 프로젝트: wade1990/PortAIO
        /// <summary>
        ///     The current EState handler for Karthus. Auto ON/OFF
        /// </summary>
        /// <param name="mymode">The parameter which defines in what mode you currently are.</param>
        /// <param name="ty">Only necessary if you are in the farming mode.</param>
        private static void EState(OrbwalkingMode mymode, IEnumerable <Obj_AI_Base> ty = null)
        {
            if (!Utilities.E.IsReady() || Core.IsInPassiveForm())
            {
                return;
            }

            switch (mymode)
            {
            case OrbwalkingMode.LaneClear:
                if (ty != null)
                {
                    var objAiBases = ty as IList <Obj_AI_Base> ?? ty.ToList();
                    if ((objAiBases.Any() &&
                         objAiBases.Count(x => x.Health < Utilities.E.GetDamage(x) * 3 && x.IsValidTarget(Utilities.E.Range)) >= 2) ||
                        objAiBases.Count(x => x.IsValidTarget(Utilities.E.Range)) >= 5)
                    {
                        if (!Utilities.Player.HasBuff("KarthusDefile"))
                        {
                            Utilities.E.Cast();
                        }
                    }
                    else
                    {
                        if (Utilities.Player.HasBuff("KarthusDefile"))
                        {
                            Utilities.E.Cast();
                        }
                    }
                }
                break;

            case OrbwalkingMode.Combo:
                if (Utilities.Player.CountEnemyHeroesInRange(Utilities.E.Range) >= 1)
                {
                    if (!Utilities.Player.HasBuff("KarthusDefile"))
                    {
                        Utilities.E.Cast();
                    }
                }
                else
                {
                    if (Utilities.Player.HasBuff("KarthusDefile") && Utilities.MainMenu["E"]["ToggleE"])
                    {
                        Utilities.E.Cast();
                    }
                }
                break;

            default:
                if (Utilities.Player.HasBuff("KarthusDefile") && Utilities.MainMenu["E"]["ToggleE"])
                {
                    Utilities.E.Cast();
                }
                break;
            }
        }
예제 #5
0
        private void OnOnIngameUpdate(EventArgs args)
        {
            Mode = OrbwalkingMode.Idle;

            if (Game.IsPaused || Game.IsChatOpen)
            {
                return;
            }
            if (Members.Menu.Item("Combo.key").GetValue <KeyBind>().Active)
            {
                Mode = OrbwalkingMode.Combo;
            }
            else if (Mode == OrbwalkingMode.Idle)
            {
                EffectManager.Remove("attackTarget" + Owner.Handle);
                return;
            }
            if (TurnEndTime > Game.RawGameTime)
            {
                return;
            }
            var target = GetTarget();

            if ((target == null || !CanAttack(target)) && CanMove())
            {
                if (Move(Game.MousePosition))
                {
                    return;
                }
            }

            if (target != null && CanAttack(target))
            {
                LastTarget = target;
                var meld = ObjectManager.LocalHero.GetAbilityById(AbilityId.templar_assassin_meld);
                if (AbilityExtensions.CanBeCasted(meld) && !_sleeper.Sleeping)
                {
                    meld.UseAbility();
                    _sleeper.Sleep(300);
                }
                Attack(target);
            }
            if (LastTarget != null && LastTarget.IsValid && LastTarget.IsAlive)
            {
                EffectManager.DrawRange(LastTarget, "attackTarget" + Owner.Handle, 60, Color.Red);
            }
            else
            {
                EffectManager.Remove("attackTarget" + Owner.Handle);
            }
        }
예제 #6
0
 public static void WalkToPoint(this Vector3 point, OrbwalkingMode mode, bool forceIssueOrder = false)
 {
     if (Environment.TickCount - _humanizer > Random.GetRandomInteger(350, 800))
     {
         _humanizer = Environment.TickCount;
         // another lane
         if (point.Distance(ObjectManager.Player.Position) > 800 || forceIssueOrder)
         {
             EloBuddy.Player.IssueOrder(GameObjectOrder.MoveTo, point, false);
             Variables.Orbwalker.ActiveMode = OrbwalkingMode.None;
             // skip from triggering the orbwalker too
             return;
         }
         Variables.Orbwalker.ForceOrbwalkPoint = point;
         Variables.Orbwalker.ActiveMode        = mode;
     }
 }
예제 #7
0
 public static void WalkToPoint(this Vector3 point, OrbwalkingMode mode, bool forceIssueOrder = false)
 {
     if (Environment.TickCount - _humanizer > Random.GetRandomInteger(350, 800))
     {
         _humanizer = Environment.TickCount;
         // another lane
         if (point.Distance(ObjectManager.Player.Position) > 800 || forceIssueOrder)
         {
             ObjectManager.Player.IssueOrder(GameObjectOrder.MoveTo, point, false);
             Variables.Orbwalker.ActiveMode = OrbwalkingMode.None;
             // skip from triggering the orbwalker too
             return;
         }
         Variables.Orbwalker.ForceOrbwalkingPoint = point;
         Variables.Orbwalker.ActiveMode = mode;
     }
 }
예제 #8
0
        public void HandleQ(OrbwalkingMode orbMode)
        {
            if (orbMode == OrbwalkingMode.Combo && IsOn(orbMode))
            {
                var heroes = Variables.TargetSelector.GetTargets(SpellQ.Range, DamageType.Magical, false);
                foreach (var hero in heroes)
                {
                    if (SpellQ.IsReady() && SpellQ.IsInRange(hero))
                    {
                        var pred = SpellQ.GetPrediction(hero).CastPosition;
                        SpellQ.Cast(pred);
                    }
                }
            }
            else if ((orbMode == OrbwalkingMode.Hybrid || orbMode == OrbwalkingMode.LaneClear) && IsOn(orbMode))
            {
                var minions = GameObjects.EnemyMinions.Where(m => SpellQ.IsInRange(m)).ToList();
                var farmloc = SpellQ.GetLineFarmLocation(minions);

                var minionsN = GameObjects.Jungle.Where(m => SpellQ.IsInRange(m)).ToList();
                var farmlocN = SpellQ.GetLineFarmLocation(minionsN);

                if (farmloc.MinionsHit >= 3)
                {
                    SpellQ.Cast(farmloc.Position);
                }

                if (farmlocN.MinionsHit >= 1)
                {
                    SpellQ.Cast(farmlocN.Position);
                }
            }
            else if (orbMode == OrbwalkingMode.LastHit && IsOn(orbMode))
            {
                var minions = GameObjects.EnemyMinions.Where(m => SpellQ.IsInRange(m)).ToList();
                var farmloc = SpellQ.GetLineFarmLocation(minions);

                if (farmloc.MinionsHit >= 3)
                {
                    SpellQ.Cast(farmloc.Position);
                }
            }
        }
예제 #9
0
        public bool IsOn(OrbwalkingMode orbMode)
        {
            switch (orbMode)
            {
            case OrbwalkingMode.Combo:
                return(MenuTwisted.MainMenu["Q"]["ComboQ"]);

            case OrbwalkingMode.LastHit:
                return(MenuTwisted.MainMenu["Q"]["LastQ"]);

            case OrbwalkingMode.Hybrid:
                return(MenuTwisted.MainMenu["Q"]["HybridQ"]);

            case OrbwalkingMode.LaneClear:
                return(MenuTwisted.MainMenu["Q"]["FarmQ"]);
            }

            return(false);
        }
예제 #10
0
파일: Zyra.cs 프로젝트: wade1990/PortAIO
        /// <summary>
        ///     Handling casting the ultimate
        /// </summary>
        /// <param name="cMode">your current orbwalker mode</param>
        public static void HandleR(OrbwalkingMode cMode)
        {
            if ((cMode == OrbwalkingMode.Combo) && Utilities.MainMenu["R"]["ComboR"])
            {
                var heroes = GameObjects.EnemyHeroes.Where(x => x.IsValidTarget(Utilities.R.Range)).ToList();

                if (!heroes.Any())
                {
                    return;
                }

                if (heroes.Count == 1)
                {
                    heroes = heroes.Where(x => x.Health < Core.CustomRDamage()).ToList();
                }

                var pos = Core.GetBestRPos(heroes);

                if (pos != Vector2.Zero)
                {
                    Utilities.R.Cast(pos);
                }
            }
        }
예제 #11
0
파일: Zyra.cs 프로젝트: wade1990/PortAIO
        /// <summary>
        ///     binding
        /// </summary>
        /// <param name="cMode">your current orbwalker mode</param>
        public static void HandleE(OrbwalkingMode cMode)
        {
            if ((cMode == OrbwalkingMode.LaneClear) && Utilities.MainMenu["E"]["FarmE"])
            {
                var minions =
                    GameObjects.EnemyMinions.Where(x => x.IsValid && (x.DistanceToPlayer() < Utilities.E.Range))
                    .ToList();

                if (!minions.Any())
                {
                    return;
                }

                var loc = Core.GetBestEPos(minions);

                if (loc.IsValid() && minions.Any(x => !x.IsDead))
                {
                    Utilities.E.Cast(loc);
                }
            }
            else if ((cMode == OrbwalkingMode.LastHit) && Utilities.MainMenu["E"]["LastE"])
            {
                var minions =
                    GameObjects.EnemyMinions.Where(
                        x =>
                        x.IsValid && (x.DistanceToPlayer() < Utilities.E.Range) &&
                        (x.Health < Core.CustomEDamage())).ToList();

                if (!minions.Any())
                {
                    return;
                }

                var loc = Core.GetBestEPos(minions);

                if (loc.IsValid() && minions.Any(x => !x.IsDead))
                {
                    Utilities.E.Cast(loc);
                }
            }
            else if ((cMode == OrbwalkingMode.Hybrid) && Utilities.MainMenu["E"]["LastE"])
            {
                var minions =
                    GameObjects.EnemyMinions.Where(
                        x =>
                        x.IsValid && (x.DistanceToPlayer() < Utilities.E.Range) &&
                        (x.Health < Core.CustomEDamage())).ToList();

                if (!minions.Any())
                {
                    return;
                }

                var loc = Core.GetBestEPos(minions);

                if (loc.IsValid() && minions.Any(x => !x.IsDead))
                {
                    Utilities.E.Cast(loc);
                }
            }
            else if ((cMode == OrbwalkingMode.Combo) && Utilities.MainMenu["E"]["ComboE"])
            {
                var heroes =
                    GameObjects.EnemyHeroes.Where(x => x.IsValid && (x.DistanceToPlayer() < Utilities.E.Range)).ToList();

                if (!heroes.Any())
                {
                    return;
                }

                var loc = Core.GetBestEPos(null, heroes);

                if (loc.IsValid())
                {
                    Utilities.E.Cast(loc);
                }
            }
        }
예제 #12
0
        /// <summary>
        ///     Returns possible minions based on settings.
        /// </summary>
        /// <param name="mode">
        ///     The requested mode
        /// </param>
        /// <returns>
        ///     The <see cref="List{Obj_AI_Minion}" />.
        /// </returns>
        private List<Obj_AI_Minion> GetMinions(OrbwalkingMode mode)
        {
            var minions = mode != OrbwalkingMode.Combo;
            var attackWards = getCheckBoxItem(misc, "AttackWards");
            var attackClones = getCheckBoxItem(misc, "AttackPetsnTraps");
            var attackSpecialMinions = getCheckBoxItem(misc, "AttackPetsnTraps");
            var prioritizeWards = getCheckBoxItem(misc, "prioritizeWards");
            var prioritizeSpecialMinions = getCheckBoxItem(misc, "prioritizeSpecialMinions");
            var minionList = new List<Obj_AI_Minion>();
            var specialList = new List<Obj_AI_Minion>();
            var cloneList = new List<Obj_AI_Minion>();
            var wardList = new List<Obj_AI_Minion>();
            foreach (var minion in EntityManager.MinionsAndMonsters.EnemyMinions.Where(m => IsValidUnit(m) && !m.IsDead && m.IsVisible && m.IsHPBarRendered && m.Distance(Player) < Player.AttackRange))
            {
                var baseName = minion.CharData.BaseSkinName.ToLower();
                if (minions && minion.IsMinion())
                {
                    minionList.Add(minion);
                }
                else if (attackSpecialMinions && this.specialMinions.Any(s => s.Equals(baseName)))
                {
                    specialList.Add(minion);
                }
                else if (attackClones && this.clones.Any(c => c.Equals(baseName)))
                {
                    cloneList.Add(minion);
                }
            }

            if (minions)
            {
                minionList = OrderEnemyMinions(minionList);
                minionList.AddRange(
                    OrderJungleMinions(
                        EntityManager.MinionsAndMonsters.Monsters.Where(
                            j => IsValidUnit(j) && !j.CharData.BaseSkinName.Equals("gangplankbarrel") && !j.IsDead && j.IsVisible && j.IsHPBarRendered && j.IsHPBarRendered && j.Distance(Player) < Player.AttackRange).ToList()));
            }

            if (attackWards)
            {
                wardList.AddRange(GameObjects.EnemyWards.Where(w => IsValidUnit(w) && !w.IsDead && w.IsVisible && w.IsHPBarRendered && w.Distance(Player) < Player.AttackRange));
            }

            var finalMinionList = new List<Obj_AI_Minion>();
            if (attackWards && prioritizeWards && attackSpecialMinions && prioritizeSpecialMinions)
            {
                finalMinionList.AddRange(wardList);
                finalMinionList.AddRange(specialList);
                finalMinionList.AddRange(minionList);
            }
            else if ((!attackWards || !prioritizeWards) && attackSpecialMinions && prioritizeSpecialMinions)
            {
                finalMinionList.AddRange(specialList);
                finalMinionList.AddRange(minionList);
                finalMinionList.AddRange(wardList);
            }
            else if (attackWards && prioritizeWards)
            {
                finalMinionList.AddRange(wardList);
                finalMinionList.AddRange(minionList);
                finalMinionList.AddRange(specialList);
            }
            else
            {
                finalMinionList.AddRange(minionList);
                finalMinionList.AddRange(specialList);
                finalMinionList.AddRange(wardList);
            }

            if (getCheckBoxItem(misc, "AttackBarrel"))
            {
                finalMinionList.AddRange(
                    GameObjects.Jungle.Where(
                        j => IsValidUnit(j) && j.Health <= 1 && !j.IsDead && j.IsVisible && j.IsHPBarRendered && j.CharData.BaseSkinName.Equals("gangplankbarrel") && j.Distance(Player) < Player.AttackRange)
                        .ToList());
            }

            if (attackClones)
            {
                finalMinionList.AddRange(cloneList);
            }

            return finalMinionList.Where(m => !this.ignoreMinions.Any(b => b.Equals(m.CharData.BaseSkinName)) && !m.IsDead && m.IsVisible && m.IsHPBarRendered).ToList();
        }
예제 #13
0
파일: Zyra.cs 프로젝트: wade1990/PortAIO
        /// <summary>
        ///     spikes shot
        /// </summary>
        /// <param name="cMode">your current orbwalker mode</param>
        public static void HandleQ(OrbwalkingMode cMode)
        {
            if ((cMode == OrbwalkingMode.LaneClear) && Utilities.MainMenu["Q"]["FarmQ"])
            {
                var minions =
                    GameObjects.EnemyMinions.Where(x => (x.DistanceToPlayer() < Utilities.Q.Range) && x.IsValid)
                    .ToList();

                if (!minions.Any())
                {
                    return;
                }

                var farmloc = Core.GetBestQPos(minions);

                if (farmloc.IsValid())
                {
                    if (Utilities.W.IsReady())
                    {
                        HandleW(cMode, "Q", farmloc);
                    }
                    Utilities.Q.Cast(farmloc);
                }
            }
            else if ((cMode == OrbwalkingMode.LastHit) && Utilities.MainMenu["Q"]["LastQ"])
            {
                var minions =
                    GameObjects.EnemyMinions.Where(
                        x =>
                        (x.DistanceToPlayer() < Utilities.Q.Range) && x.IsValid &&
                        (x.Health < Core.CustomQDamage())).ToList();

                if (!minions.Any())
                {
                    return;
                }

                var farmloc = Core.GetBestQPos(minions);

                if (farmloc.IsValid())
                {
                    Utilities.Q.Cast(farmloc);
                }
            }
            else if ((cMode == OrbwalkingMode.Combo) && Utilities.MainMenu["Q"]["ComboQ"])
            {
                var heroes =
                    GameObjects.EnemyHeroes.Where(x => (x.DistanceToPlayer() < Utilities.Q.Range) && x.IsValid).ToList();

                if (!heroes.Any())
                {
                    return;
                }

                var loc = Core.GetBestQPos(null, heroes);

                if (loc.IsValid())
                {
                    if (Utilities.W.IsReady())
                    {
                        HandleW(Variables.Orbwalker.ActiveMode, "Q", loc);
                    }
                    Utilities.Q.Cast(loc);
                }
            }
            else if ((cMode == OrbwalkingMode.Hybrid) && Utilities.MainMenu["Q"]["HybridQ"])
            {
                var loc    = Vector2.Zero;
                var heroes =
                    GameObjects.EnemyHeroes.Where(x => (x.DistanceToPlayer() < Utilities.Q.Range) && x.IsValid).ToList();
                if (heroes.Any())
                {
                    loc = Core.GetBestQPos(null, heroes);
                }

                var minions =
                    GameObjects.EnemyMinions.Where(
                        x =>
                        (x.DistanceToPlayer() < Utilities.Q.Range) && x.IsValid &&
                        (x.Health < Core.CustomQDamage())).ToList();
                if (!minions.Any())
                {
                    return;
                }

                var farmloc = Core.GetBestQPos(minions);

                if (minions.Any() && farmloc.IsValid() && (minions.Count >= 3))
                {
                    Utilities.Q.Cast(farmloc);
                }
                else if (heroes.Any() && loc.IsValid())
                {
                    if (Utilities.W.IsReady() && Utilities.MainMenu["W"]["HybridW"])
                    {
                        HandleW(Variables.Orbwalker.ActiveMode, "Q", loc);
                    }
                    Utilities.Q.Cast(loc);
                }
            }
        }
        /// <summary>
        ///     Gets the target.
        /// </summary>
        /// <param name="mode">
        ///     The mode.
        /// </param>
        /// <returns>
        ///     Returns the filtered target.
        /// </returns>
        public AttackableUnit GetTarget(OrbwalkingMode mode)
        {
            if ((mode == OrbwalkingMode.Hybrid || mode == OrbwalkingMode.LaneClear)
                && !this.orbwalker.Menu["advanced"]["prioritizeFarm"].GetValue<MenuBool>().Value)
            {
                var target = Variables.TargetSelector.GetTarget(-1f, DamageType.Physical);
                if (target != null && target.InAutoAttackRange())
                {
                    return target;
                }
            }

            var minions = new List<Obj_AI_Minion>();
            if (mode != OrbwalkingMode.None)
            {
                minions = this.GetMinions(mode);
            }

            // Killable Minion
            if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Hybrid || mode == OrbwalkingMode.LastHit)
            {
                foreach (var minion in minions)
                {
                    var time =
                        (int)
                        ((GameObjects.Player.AttackCastDelay * 1000) - 100 + (Game.Ping / 2f)
                         + (1000 * Math.Max(0, GameObjects.Player.Distance(minion) - GameObjects.Player.BoundingRadius)
                            / GameObjects.Player.GetProjectileSpeed()));
                    if (minion.MaxHealth <= 10)
                    {
                        if (minion.Health <= 1)
                        {
                            return minion;
                        }
                    }
                    else
                    {
                        var predHealth = Health.GetPrediction(minion, time, this.FarmDelay);
                        if (predHealth <= 0)
                        {
                            this.orbwalker.InvokeAction(
                                new OrbwalkingActionArgs
                                    {
                                        Position = minion.Position, Target = minion, Process = true,
                                        Type = OrbwalkingType.NonKillableMinion
                                    });
                        }

                        if (predHealth > 0 && predHealth <= GameObjects.Player.GetAutoAttackDamage(minion))
                        {
                            return minion;
                        }
                    }
                }
            }

            // Forced Target
            if (this.ForceTarget.IsValidTarget() && this.ForceTarget.InAutoAttackRange())
            {
                return this.ForceTarget;
            }

            // Turrets | Inhibitors | Nexus
            if (mode == OrbwalkingMode.LaneClear
                && (!this.orbwalker.Menu["advanced"]["prioritizeMinions"].GetValue<MenuBool>().Value || !minions.Any()))
            {
                foreach (var turret in GameObjects.EnemyTurrets.Where(t => t.IsValidTarget() && t.InAutoAttackRange()))
                {
                    return turret;
                }

                foreach (var inhib in
                    GameObjects.EnemyInhibitors.Where(i => i.IsValidTarget() && i.InAutoAttackRange()))
                {
                    return inhib;
                }

                if (GameObjects.EnemyNexus != null && GameObjects.EnemyNexus.IsValidTarget()
                    && GameObjects.EnemyNexus.InAutoAttackRange())
                {
                    return GameObjects.EnemyNexus;
                }
            }

            // Champions
            if (mode != OrbwalkingMode.LastHit)
            {
                var target = Variables.TargetSelector.GetTarget(-1f, DamageType.Physical);
                if (target.IsValidTarget() && target.InAutoAttackRange())
                {
                    return target;
                }
            }

            // Jungle Minions
            if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Hybrid)
            {
                var minion = minions.FirstOrDefault(m => m.Team == GameObjectTeam.Neutral);
                if (minion != null)
                {
                    return minion;
                }
            }

            // Under-Turret Farming
            if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Hybrid || mode == OrbwalkingMode.LastHit)
            {
                Obj_AI_Minion farmUnderTurretMinion = null;
                Obj_AI_Minion noneKillableMinion = null;

                // return all the minions under turret
                var turretMinions = minions.Where(m => m.IsMinion() && m.Position.IsUnderAllyTurret()).ToList();
                if (turretMinions.Any())
                {
                    // get the turret aggro minion
                    var turretMinion = turretMinions.FirstOrDefault(Health.HasTurretAggro);
                    if (turretMinion != null)
                    {
                        var hpLeftBeforeDie = 0;
                        var hpLeft = 0;
                        var turretAttackCount = 0;
                        var turret = Health.GetAggroTurret(turretMinion);
                        if (turret != null)
                        {
                            var turretStarTick = Health.TurretAggroStartTick(turretMinion);

                            // from healthprediction (blame Lizzaran)
                            var turretLandTick = turretStarTick + (int)(turret.AttackCastDelay * 1000)
                                                 + (1000
                                                    * Math.Max(
                                                        0,
                                                        (int)(turretMinion.Distance(turret) - turret.BoundingRadius))
                                                    / (int)(turret.BasicAttack.MissileSpeed + 70));

                            // calculate the HP before try to balance it
                            for (float i = turretLandTick + 50;
                                 i < turretLandTick + (3 * turret.AttackDelay * 1000) + 50;
                                 i = i + (turret.AttackDelay * 1000))
                            {
                                var time = (int)i - Variables.TickCount + (Game.Ping / 2);
                                var predHp =
                                    (int)
                                    Health.GetPrediction(
                                        turretMinion,
                                        time > 0 ? time : 0,
                                        70,
                                        HealthPredictionType.Simulated);
                                if (predHp > 0)
                                {
                                    hpLeft = predHp;
                                    turretAttackCount += 1;
                                    continue;
                                }

                                hpLeftBeforeDie = hpLeft;
                                hpLeft = 0;
                                break;
                            }

                            // calculate the hits is needed and possibilty to balance
                            if (hpLeft == 0 && turretAttackCount != 0 && hpLeftBeforeDie != 0)
                            {
                                var damage = (int)GameObjects.Player.GetAutoAttackDamage(turretMinion);
                                var hits = hpLeftBeforeDie / damage;
                                var timeBeforeDie = turretLandTick
                                                    + ((turretAttackCount + 1) * (int)(turret.AttackDelay * 1000))
                                                    - Variables.TickCount;
                                var timeUntilAttackReady = this.orbwalker.LastAutoAttackTick
                                                           + (int)(GameObjects.Player.AttackDelay * 1000)
                                                           > (Variables.TickCount + (Game.Ping / 2) + 25)
                                                               ? this.orbwalker.LastAutoAttackTick
                                                                 + (int)(GameObjects.Player.AttackDelay * 1000)
                                                                 - (Variables.TickCount + (Game.Ping / 2) + 25)
                                                               : 0;
                                var timeToLandAttack = GameObjects.Player.IsMelee
                                                           ? GameObjects.Player.AttackCastDelay * 1000
                                                           : (GameObjects.Player.AttackCastDelay * 1000)
                                                             + (1000
                                                                * Math.Max(
                                                                    0,
                                                                    turretMinion.Distance(GameObjects.Player)
                                                                    - GameObjects.Player.BoundingRadius)
                                                                / GameObjects.Player.BasicAttack.MissileSpeed);
                                if (hits >= 1
                                    && (hits * GameObjects.Player.AttackDelay * 1000) + timeUntilAttackReady
                                    + timeToLandAttack < timeBeforeDie)
                                {
                                    farmUnderTurretMinion = turretMinion;
                                }
                                else if (hits >= 1
                                         && (hits * GameObjects.Player.AttackDelay * 1000) + timeUntilAttackReady
                                         + timeToLandAttack > timeBeforeDie)
                                {
                                    noneKillableMinion = turretMinion;
                                }
                            }
                            else if (hpLeft == 0 && turretAttackCount == 0 && hpLeftBeforeDie == 0)
                            {
                                noneKillableMinion = turretMinion;
                            }

                            // should wait before attacking a minion.
                            if (this.ShouldWaitUnderTurret(noneKillableMinion))
                            {
                                return null;
                            }

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

                            // balance other minions
                            return
                                (from minion in
                                     turretMinions.Where(
                                         x => x.NetworkId != turretMinion.NetworkId && !Health.HasMinionAggro(x))
                                 where
                                     (int)minion.Health % (int)turret.GetAutoAttackDamage(minion)
                                     > (int)GameObjects.Player.GetAutoAttackDamage(minion)
                                 select minion).FirstOrDefault();
                        }
                    }
                    else
                    {
                        if (this.ShouldWaitUnderTurret())
                        {
                            return null;
                        }

                        // balance other minions
                        return (from minion in turretMinions.Where(x => !Health.HasMinionAggro(x))
                                let turret =
                                    GameObjects.AllyTurrets.FirstOrDefault(
                                        x => x.IsValidTarget(950f, false, minion.Position))
                                where
                                    turret != null
                                    && (int)minion.Health % (int)turret.GetAutoAttackDamage(minion)
                                    > (int)GameObjects.Player.GetAutoAttackDamage(minion)
                                select minion).FirstOrDefault();
                    }

                    return null;
                }
            }

            // Lane Clear Minions
            if (mode == OrbwalkingMode.LaneClear)
            {
                if (!this.ShouldWait())
                {
                    if (this.LaneClearMinion.IsValidTarget() && this.LaneClearMinion.InAutoAttackRange())
                    {
                        if (this.LaneClearMinion.MaxHealth <= 10)
                        {
                            return this.LaneClearMinion;
                        }

                        var predHealth = Health.GetPrediction(
                            this.LaneClearMinion,
                            (int)(GameObjects.Player.AttackDelay * 1000 * LaneClearWaitTime),
                            this.FarmDelay,
                            HealthPredictionType.Simulated);
                        if (predHealth >= 2 * GameObjects.Player.GetAutoAttackDamage(this.LaneClearMinion)
                            || Math.Abs(predHealth - this.LaneClearMinion.Health) < float.Epsilon)
                        {
                            return this.LaneClearMinion;
                        }
                    }

                    foreach (var minion in minions.Where(m => m.Team != GameObjectTeam.Neutral))
                    {
                        if (minion.MaxHealth <= 10)
                        {
                            this.LaneClearMinion = minion;
                            return minion;
                        }

                        var predHealth = Health.GetPrediction(
                            minion,
                            (int)(GameObjects.Player.AttackDelay * 1000 * LaneClearWaitTime),
                            this.FarmDelay,
                            HealthPredictionType.Simulated);
                        if (predHealth >= 2 * GameObjects.Player.GetAutoAttackDamage(minion)
                            || Math.Abs(predHealth - minion.Health) < float.Epsilon)
                        {
                            this.LaneClearMinion = minion;
                            return minion;
                        }
                    }
                }
            }

            // Special Minions if no enemy is near
            if (mode == OrbwalkingMode.Combo)
            {
                if (minions.Any()
                    && !GameObjects.EnemyHeroes.Any(
                        e => e.IsValidTarget(GameObjects.Player.GetRealAutoAttackRange(e) * 2f)))
                {
                    return minions.FirstOrDefault();
                }
            }

            return null;
        }
        /// <summary>
        ///     Gets the target.
        /// </summary>
        /// <param name="mode">
        ///     The mode.
        /// </param>
        /// <returns>
        ///     Returns the filtered target.
        /// </returns>
        public AttackableUnit GetTarget(OrbwalkingMode mode)
        {
            if ((mode == OrbwalkingMode.Hybrid || mode == OrbwalkingMode.LaneClear) &&
                !this.orbwalker.Menu["advanced"]["prioritizeFarm"].GetValue <MenuBool>().Value)
            {
                var target = Variables.TargetSelector.GetTarget(-1f, DamageType.Physical);
                if (target != null && target.InAutoAttackRange())
                {
                    return(target);
                }
            }

            var minions = new List <AIMinionClient>();

            if (mode != OrbwalkingMode.None)
            {
                minions = this.GetMinions(mode);
            }

            // Killable Minion
            if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Hybrid || mode == OrbwalkingMode.LastHit)
            {
                foreach (var minion in minions.OrderBy(m => m.Health))
                {
                    if (minion.IsHPBarRendered && minion.Health < GameObjects.Player.GetAutoAttackDamage(minion))
                    {
                        return(minion);
                    }
                    if (minion.MaxHealth <= 10)
                    {
                        if (minion.Health <= 1)
                        {
                            return(minion);
                        }
                    }
                    else
                    {
                        var predHealth = Health.GetPrediction(minion, (int)minion.GetTimeToHit(), this.FarmDelay);
                        if (predHealth <= 0)
                        {
                            this.orbwalker.InvokeAction(
                                new OrbwalkingActionArgs
                            {
                                Position = minion.Position, Target = minion, Process = true,
                                Type     = OrbwalkingType.NonKillableMinion
                            });
                        }

                        if (predHealth > 0 && predHealth < GameObjects.Player.GetAutoAttackDamage(minion))
                        {
                            return(minion);
                        }
                    }
                }
            }

            // Forced Target
            if (this.ForceTarget.IsValidTarget() && this.ForceTarget.InAutoAttackRange())
            {
                return(this.ForceTarget);
            }

            // Turrets | Inhibitors | Nexus
            if (mode == OrbwalkingMode.LaneClear &&
                (!this.orbwalker.Menu["advanced"]["prioritizeMinions"].GetValue <MenuBool>().Value || !minions.Any()))
            {
                foreach (var turret in GameObjects.EnemyTurrets.Where(t => t.IsValidTarget() && t.InAutoAttackRange()))
                {
                    return(turret);
                }

                foreach (var inhib in
                         GameObjects.EnemyInhibitors.Where(i => i.IsValidTarget() && i.InAutoAttackRange()))
                {
                    return(inhib);
                }

                if (GameObjects.EnemyNexus != null && GameObjects.EnemyNexus.IsValidTarget() &&
                    GameObjects.EnemyNexus.InAutoAttackRange())
                {
                    return(GameObjects.EnemyNexus);
                }
            }

            // Champions
            if (mode != OrbwalkingMode.LastHit)
            {
                var target = Variables.TargetSelector.GetTarget(-1f, DamageType.Physical);
                if (target.IsValidTarget() && target.InAutoAttackRange())
                {
                    return(target);
                }
            }

            // Jungle Minions
            if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Hybrid)
            {
                var minion = minions.FirstOrDefault(m => m.Team == GameObjectTeam.Neutral);
                if (minion != null)
                {
                    return(minion);
                }
            }

            // Under-Turret Farming
            if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Hybrid || mode == OrbwalkingMode.LastHit)
            {
                AIMinionClient farmUnderTurretMinion = null;
                AIMinionClient noneKillableMinion    = null;

                // return all the minions under turret
                var turretMinions = minions.Where(m => m.IsMinion() && m.Position.IsUnderAllyTurret()).ToList();
                if (turretMinions.Any())
                {
                    // get the turret aggro minion
                    var turretMinion = turretMinions.FirstOrDefault(Health.HasTurretAggro);
                    if (turretMinion != null)
                    {
                        var hpLeftBeforeDie   = 0;
                        var hpLeft            = 0;
                        var turretAttackCount = 0;
                        var turret            = Health.GetAggroTurret(turretMinion);
                        if (turret != null)
                        {
                            var turretStarTick = Health.TurretAggroStartTick(turretMinion);

                            // from healthprediction (blame Lizzaran)
                            var turretLandTick = turretStarTick + (int)(turret.AttackCastDelay * 1000)
                                                 + (1000
                                                    * Math.Max(
                                                        0,
                                                        (int)(turretMinion.Distance(turret) - turret.BoundingRadius))
                                                    / (int)(turret.BasicAttack.MissileSpeed + 70));

                            // calculate the HP before try to balance it
                            for (float i = turretLandTick + 50;
                                 i < turretLandTick + (3 * turret.AttackDelay * 1000) + 50;
                                 i = i + (turret.AttackDelay * 1000))
                            {
                                var time   = (int)i - Variables.TickCount + (Game.Ping / 2);
                                var predHp =
                                    (int)
                                    Health.GetPrediction(
                                        turretMinion,
                                        time > 0 ? time : 0,
                                        70,
                                        HealthPredictionType.Simulated);
                                if (predHp > 0)
                                {
                                    hpLeft             = predHp;
                                    turretAttackCount += 1;
                                    continue;
                                }

                                hpLeftBeforeDie = hpLeft;
                                hpLeft          = 0;
                                break;
                            }

                            // calculate the hits is needed and possibilty to balance
                            if (hpLeft == 0 && turretAttackCount != 0 && hpLeftBeforeDie != 0)
                            {
                                var damage        = (int)GameObjects.Player.GetAutoAttackDamage(turretMinion);
                                var hits          = hpLeftBeforeDie / damage;
                                var timeBeforeDie = turretLandTick
                                                    + ((turretAttackCount + 1) * (int)(turret.AttackDelay * 1000))
                                                    - Variables.TickCount;
                                var timeUntilAttackReady = this.orbwalker.LastAutoAttackTick
                                                           + (int)(GameObjects.Player.AttackDelay * 1000)
                                                           > (Variables.TickCount + (Game.Ping / 2) + 25)
                                                               ? this.orbwalker.LastAutoAttackTick
                                                           + (int)(GameObjects.Player.AttackDelay * 1000)
                                                           - (Variables.TickCount + (Game.Ping / 2) + 25)
                                                               : 0;
                                var timeToLandAttack = turretMinion.GetTimeToHit();
                                if (hits >= 1 &&
                                    (hits * GameObjects.Player.AttackDelay * 1000) + timeUntilAttackReady
                                    + timeToLandAttack < timeBeforeDie)
                                {
                                    farmUnderTurretMinion = turretMinion;
                                }
                                else if (hits >= 1 &&
                                         (hits * GameObjects.Player.AttackDelay * 1000) + timeUntilAttackReady
                                         + timeToLandAttack > timeBeforeDie)
                                {
                                    noneKillableMinion = turretMinion;
                                }
                            }
                            else if (hpLeft == 0 && turretAttackCount == 0 && hpLeftBeforeDie == 0)
                            {
                                noneKillableMinion = turretMinion;
                            }

                            // should wait before attacking a minion.
                            if (this.ShouldWaitUnderTurret(noneKillableMinion))
                            {
                                return(null);
                            }

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

                            // balance other minions
                            return
                                ((from minion in
                                  turretMinions.Where(
                                      x => x.NetworkId != turretMinion.NetworkId && !Health.HasMinionAggro(x))
                                  where
                                  (int)minion.Health % (int)turret.GetAutoAttackDamage(minion)
                                  > (int)GameObjects.Player.GetAutoAttackDamage(minion)
                                  select minion).FirstOrDefault());
                        }
                    }
                    else
                    {
                        if (this.ShouldWaitUnderTurret())
                        {
                            return(null);
                        }

                        // balance other minions
                        return((from minion in turretMinions.Where(x => !Health.HasMinionAggro(x))
                                let turret =
                                    GameObjects.AllyTurrets.FirstOrDefault(
                                        x => x.IsValidTarget(950f, false, minion.Position))
                                    where
                                    turret != null &&
                                    (int)minion.Health % (int)turret.GetAutoAttackDamage(minion)
                                    > (int)GameObjects.Player.GetAutoAttackDamage(minion)
                                    select minion).FirstOrDefault());
                    }

                    return(null);
                }
            }

            // Lane Clear Minions
            if (mode == OrbwalkingMode.LaneClear)
            {
                if (!this.ShouldWait())
                {
                    if (this.LaneClearMinion.IsValidTarget() && this.LaneClearMinion.InAutoAttackRange())
                    {
                        if (this.LaneClearMinion.MaxHealth <= 10)
                        {
                            return(this.LaneClearMinion);
                        }

                        var predHealth = Health.GetPrediction(
                            this.LaneClearMinion,
                            (int)(GameObjects.Player.AttackDelay * 1000 * LaneClearWaitTime),
                            this.FarmDelay,
                            HealthPredictionType.Simulated);
                        if (predHealth >= 2 * GameObjects.Player.GetAutoAttackDamage(this.LaneClearMinion) ||
                            Math.Abs(predHealth - this.LaneClearMinion.Health) < float.Epsilon)
                        {
                            return(this.LaneClearMinion);
                        }
                    }

                    foreach (var minion in minions.Where(m => m.Team != GameObjectTeam.Neutral))
                    {
                        if (minion.MaxHealth <= 10)
                        {
                            this.LaneClearMinion = minion;
                            return(minion);
                        }

                        var predHealth = Health.GetPrediction(
                            minion,
                            (int)(GameObjects.Player.AttackDelay * 1000 * LaneClearWaitTime),
                            this.FarmDelay,
                            HealthPredictionType.Simulated);
                        if (predHealth >= 2 * GameObjects.Player.GetAutoAttackDamage(minion) ||
                            Math.Abs(predHealth - minion.Health) < float.Epsilon)
                        {
                            this.LaneClearMinion = minion;
                            return(minion);
                        }
                    }
                }
            }

            // Special Minions if no enemy is near
            if (mode == OrbwalkingMode.Combo)
            {
                if (minions.Any() && !GameObjects.EnemyHeroes.Any(e => e.IsValidTarget(e.GetRealAutoAttackRange() * 2f)))
                {
                    return(minions.FirstOrDefault());
                }
            }

            return(null);
        }
예제 #16
0
 internal static AttackableUnit GetTarget(OrbwalkingMode? modeArg)
 {
     var mode = modeArg ?? ActiveMode;
     if ((mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Hybrid)
         && !Program.MainMenu["Orbwalker"]["Advanced"]["PriorizeFarm"])
     {
         var target = Variables.TargetSelector.GetTarget(-1, DamageType.Physical);
         if (target != null)
         {
             return target;
         }
     }
     if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Hybrid || mode == OrbwalkingMode.LastHit)
     {
         foreach (var minion in
             GameObjects.EnemyMinions.Where(m => m.InAutoAttackRange() && Minion.IsMinion(m))
                 .OrderByDescending(m => m.GetMinionType() == MinionTypes.Siege)
                 .ThenBy(m => m.GetMinionType() == MinionTypes.Super)
                 .ThenBy(m => m.Health)
                 .ThenByDescending(m => m.MaxHealth))
         {
             var time =
                 (int)
                 (Program.Player.AttackCastDelay * 1000
                  + Math.Max(0, Program.Player.Distance(minion) - Program.Player.BoundingRadius)
                  / Program.Player.GetProjectileSpeed() * 1000 - 100 + Game.Ping / 2f);
             var healthPrediction = Health.GetPrediction(minion, time, FarmDelay);
             if (healthPrediction <= 0)
             {
                 InvokeAction(
                     new OrbwalkerActionArgs
                         {
                             Position = minion.Position, Target = minion, Process = true,
                             Type = OrbwalkingType.NonKillableMinion
                         });
             }
             if (healthPrediction > 0 && healthPrediction <= Program.Player.GetAutoAttackDamage(minion, true))
             {
                 return minion;
             }
         }
     }
     if (mode == OrbwalkingMode.LaneClear)
     {
         foreach (var turret in GameObjects.EnemyTurrets.Where(t => t.InAutoAttackRange()))
         {
             return turret;
         }
         foreach (var inhibitor in GameObjects.EnemyInhibitors.Where(i => i.InAutoAttackRange()))
         {
             return inhibitor;
         }
         if (GameObjects.EnemyNexus.InAutoAttackRange())
         {
             return GameObjects.EnemyNexus;
         }
     }
     if (mode != OrbwalkingMode.LastHit)
     {
         var target = Variables.TargetSelector.GetTarget(-1, DamageType.Physical);
         if (target != null)
         {
             return target;
         }
     }
     if (ActiveMode == OrbwalkingMode.LaneClear)
     {
         var shouldWait =
             GameObjects.EnemyMinions.Any(
                 m =>
                 m.InAutoAttackRange() && Minion.IsMinion(m)
                 && Health.GetPrediction(m, (int)(Program.Player.AttackDelay * 1000 * 2f), FarmDelay)
                 <= Program.Player.GetAutoAttackDamage(m, true));
         if (!shouldWait)
         {
             foreach (var specialMinion in
                 GameObjects.EnemyMinions.Where(
                     m => m.InAutoAttackRange() && SpecialMinions.Any(i => i.Equals(m.CharData.BaseSkinName))))
             {
                 return specialMinion;
             }
             var mob = GameObjects.JungleLegendary.FirstOrDefault(j => j.InAutoAttackRange())
                       ?? GameObjects.JungleSmall.FirstOrDefault(
                           j =>
                           j.InAutoAttackRange() && j.Name.Contains("Mini") && j.Name.Contains("SRU_Razorbeak"))
                       ?? GameObjects.JungleLarge.FirstOrDefault(j => j.InAutoAttackRange())
                       ?? GameObjects.JungleSmall.FirstOrDefault(j => j.InAutoAttackRange());
             if (mob != null)
             {
                 return mob;
             }
             foreach (var sentinel in
                 GameObjects.EnemyMinions.Where(
                     m => m.InAutoAttackRange() && m.CharData.BaseSkinName == "kalistaspawn"))
             {
                 return sentinel;
             }
             if (LastMinion.InAutoAttackRange())
             {
                 var predHealth = Health.GetPrediction(
                     LastMinion,
                     (int)(Program.Player.AttackDelay * 1000 * 2f),
                     FarmDelay);
                 if (predHealth >= 2 * Program.Player.GetAutoAttackDamage(LastMinion, true)
                     || Math.Abs(predHealth - LastMinion.Health) < float.Epsilon)
                 {
                     return LastMinion;
                 }
             }
             var minion = (from m in
                               GameObjects.EnemyMinions.Where(m => m.InAutoAttackRange() && Minion.IsMinion(m))
                           let predictedHealth =
                               Health.GetPrediction(m, (int)(Program.Player.AttackDelay * 1000 * 2f), FarmDelay)
                           where
                               predictedHealth >= 2 * Program.Player.GetAutoAttackDamage(m, true)
                               || Math.Abs(predictedHealth - m.Health) < float.Epsilon
                           select m).MaxOrDefault(m => m.Health);
             if (minion != null)
             {
                 return LastMinion = minion;
             }
             return
                 GameObjects.EnemyMinions.FirstOrDefault(
                     m =>
                     m.InAutoAttackRange()
                     && (m.CharData.BaseSkinName == "elisespiderling"
                         || m.CharData.BaseSkinName == "teemomushroom"));
         }
     }
     return null;
 }
예제 #17
0
 /// <summary>
 ///     Orbwalk a target while moving to Position.
 /// </summary>
 public static void Orbwalk(AttackableUnit target,
     Vector3 position,
     float extraWindup = 90,
     float holdAreaRadius = 0,
     bool useFixedDistance = true,
     bool randomizeMinDistance = true,
     bool autoWindup = false,
     bool meleePrediction = true,
     OrbwalkingMode mode = OrbwalkingMode.None,
     bool comboMovement = true,
     bool clearMovement = true)
 {
     try
     {
         if (autoWindup)
         {
             extraWindup = 25 + Game.Ping * (1.4f + Player.AttackCastDelay * 2);
         }
         if (target.IsValidTarget() && CanAttack())
         {
             DisableNextAttack = false;
             FireBeforeAttack(target);
             if (!DisableNextAttack)
             {
                 if (!NoCancelChamps.Contains(Player.ChampionName))
                 {
                     LastAATick = Utils.GameTimeTickCount + Game.Ping + 100 -
                                  (int) (ObjectManager.Player.AttackCastDelay * 1000f);
                     _missileLaunched = false;
                     var d = GetRealAutoAttackRange(target) - 65;
                     if (Player.Distance(target, true) > d * d && !Player.IsMelee)
                     {
                         LastAATick = Utils.GameTimeTickCount + Game.Ping + 400 -
                                      (int) (ObjectManager.Player.AttackCastDelay * 1000f);
                     }
                 }
                 Player.IssueOrder(GameObjectOrder.AttackUnit, target);
                 _lastTarget = target;
                 return;
             }
         }
         if ((!comboMovement && mode == OrbwalkingMode.Combo) ||
             (!clearMovement && mode == OrbwalkingMode.LaneClear))
         {
             return;
         }
         if (CanMove(extraWindup))
         {
             if (player.IsMelee() && meleePrediction && target != null &&
                 target.Position.Distance(player.Position) < GetAutoAttackRange(player, target) &&
                 target is Obj_AI_Hero && Game.CursorPos.Distance(target.Position) < 150)
             {
                 Obj_AI_Hero tar = (Obj_AI_Hero) target;
                 var prediction = AutoAttack.GetPrediction((Obj_AI_Base) target);
                 var pos = prediction.UnitPosition;
                 if (player.Distance(target) > target.BoundingRadius &&
                     !CombatHelper.IsFacing((Obj_AI_Base) target, player.Position, 120f) && tar.IsMoving)
                 {
                     AutoAttack.Delay = player.BasicAttack.SpellCastTime;
                     AutoAttack.Speed = player.BasicAttack.MissileSpeed;
                     MoveTo(pos, holdAreaRadius, false, useFixedDistance, randomizeMinDistance);
                 }
             }
             else
             {
                 MoveTo(position, holdAreaRadius, false, useFixedDistance, randomizeMinDistance);
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
     }
 }
예제 #18
0
 /// <summary>
 ///     Forces the orbwalker to move to that point while orbwalking (Game.CursorPos by default).
 /// </summary>
 public void SetOrbwalkingPoint(Vector3 point)
 {
     if (point.IsZero) return;
     if (!_forcedPosition.IsZero)
     {
         if (Environment.TickCount - _forcedPositionTick > 1500) _forcedPosition = Vector3.Zero;
         if (ObjectManager.Player.Distance(_forcedPosition) < 150)
         {
             _forcedPosition = Vector3.Zero;
         }
         else
         {
             return;
         }
     }
     if (Program.Map == Utility.Map.MapType.SummonersRift &&
         ObjectManager.Player.HealthPercent < Program.Config.Item("recallhp").GetValue<Slider>().Value)
     {
         ActiveMode = OrbwalkingMode.Combo;
         _orbwalkingPoint = HeadQuarters.AllyHQ.Position.RandomizePosition();
         return;
     }
     _orbwalkingPoint = point;
     ActiveMode = OrbwalkingMode.LaneClear;
 }
예제 #19
0
 public static bool IsComboMode(this OrbwalkingMode mode)
 {
     return(mode == OrbwalkingMode.Combo || mode == OrbwalkingMode.Hybrid);
 }
        /// <summary>
        ///     Returns possible minions based on settings.
        /// </summary>
        /// <param name="mode">
        ///     The requested mode
        /// </param>
        /// <returns>
        ///     The <see cref="List{Obj_AI_Minion}" />.
        /// </returns>
        private List<Obj_AI_Minion> GetMinions(OrbwalkingMode mode)
        {
            var minions = mode != OrbwalkingMode.Combo;
            var attackWards = this.orbwalker.Menu["advanced"]["attackWards"].GetValue<MenuBool>().Value;
            var attackClones = this.orbwalker.Menu["advanced"]["attackClones"].GetValue<MenuBool>().Value;
            var attackSpecialMinions =
                this.orbwalker.Menu["advanced"]["attackSpecialMinions"].GetValue<MenuBool>().Value;
            var prioritizeWards = this.orbwalker.Menu["advanced"]["prioritizeWards"].GetValue<MenuBool>().Value;
            var prioritizeSpecialMinions =
                this.orbwalker.Menu["advanced"]["prioritizeSpecialMinions"].GetValue<MenuBool>().Value;
            var minionList = new List<Obj_AI_Minion>();
            var specialList = new List<Obj_AI_Minion>();
            var cloneList = new List<Obj_AI_Minion>();
            var wardList = new List<Obj_AI_Minion>();
            foreach (var minion in
                GameObjects.EnemyMinions.Where(m => this.IsValidUnit(m)))
            {
                var baseName = minion.CharData.BaseSkinName.ToLower();
                if (minions && minion.IsMinion())
                {
                    minionList.Add(minion);
                }
                else if (attackSpecialMinions && this.specialMinions.Any(s => s.Equals(baseName)))
                {
                    specialList.Add(minion);
                }
                else if (attackClones && this.clones.Any(c => c.Equals(baseName)))
                {
                    cloneList.Add(minion);
                }
            }

            if (minions)
            {
                minionList = OrderEnemyMinions(minionList);
                minionList.AddRange(
                    this.OrderJungleMinions(
                        GameObjects.Jungle.Where(
                            j => this.IsValidUnit(j) && !j.CharData.BaseSkinName.Equals("gangplankbarrel")).ToList()));
            }

            if (attackWards)
            {
                wardList.AddRange(GameObjects.EnemyWards.Where(w => this.IsValidUnit(w)));
            }

            var finalMinionList = new List<Obj_AI_Minion>();
            if (attackWards && prioritizeWards && attackSpecialMinions && prioritizeSpecialMinions)
            {
                finalMinionList.AddRange(wardList);
                finalMinionList.AddRange(specialList);
                finalMinionList.AddRange(minionList);
            }
            else if ((!attackWards || !prioritizeWards) && attackSpecialMinions && prioritizeSpecialMinions)
            {
                finalMinionList.AddRange(specialList);
                finalMinionList.AddRange(minionList);
                finalMinionList.AddRange(wardList);
            }
            else if (attackWards && prioritizeWards)
            {
                finalMinionList.AddRange(wardList);
                finalMinionList.AddRange(minionList);
                finalMinionList.AddRange(specialList);
            }
            else
            {
                finalMinionList.AddRange(minionList);
                finalMinionList.AddRange(specialList);
                finalMinionList.AddRange(wardList);
            }

            if (this.orbwalker.Menu["advanced"]["attackBarrels"].GetValue<MenuBool>().Value)
            {
                finalMinionList.AddRange(
                    GameObjects.Jungle.Where(
                        j => this.IsValidUnit(j) && j.Health <= 1 && j.CharData.BaseSkinName.Equals("gangplankbarrel"))
                        .ToList());
            }

            if (attackClones)
            {
                finalMinionList.AddRange(cloneList);
            }

            return finalMinionList.Where(m => !this.ignoreMinions.Any(b => b.Equals(m.CharData.BaseSkinName))).ToList();
        }
예제 #21
0
        private void OnOnIngameUpdate(EventArgs args)
        {
            Mode = OrbwalkingMode.Idle;
            if (Game.IsPaused || Game.IsChatOpen)
            {
                return;
            }
            if (Members.Menu.Item("Combo.key").GetValue <KeyBind>().Active)
            {
                Mode = OrbwalkingMode.Combo;
            }
            else if (Mode == OrbwalkingMode.Idle)
            {
                _globalTarget = null;
                EffectManager.Remove("attackTarget" + Owner.Handle);
                return;
            }
            if (TurnEndTime > Game.RawGameTime)
            {
                return;
            }
            var target = GetTarget();

            if (!UnitExtensions.HasModifier(Owner, "modifier_templar_assassin_meld"))
            {
                var tempTarget = GetTarget(false);
                if (tempTarget != null)
                {
                    var blink   = Owner.GetItemById(AbilityId.item_blink);
                    var tempPos = new Vector3();
                    if (blink != null && blink.CanBeCasted() && blink.CanHit(tempTarget, ref tempPos) &&
                        !_sleeper.Sleeping(blink))
                    {
                        blink.UseAbility(tempPos);
                        _sleeper.Sleep(300, blink);
                    }
                    if (!UnitExtensions.HasModifier(tempTarget, "modifier_templar_assassin_trap_slow"))
                    {
                        var trap = UnitExtensions.GetAbilityById(ObjectManager.LocalHero,
                                                                 AbilityId.templar_assassin_psionic_trap);
                        var trapNearTarget =
                            EntityManager <Unit> .Entities.FirstOrDefault(
                                x =>
                                x.IsValid && x.Name == "npc_dota_templar_assassin_psionic_trap" &&
                                Ensage.SDK.Extensions.EntityExtensions.Distance2D(tempTarget, x.Position) <= 400);

                        if (trapNearTarget != null)
                        {
                            if (!_sleeper.Sleeping(trap + "activate"))
                            {
                                var activator = trapNearTarget.Spellbook.Spell1;
                                if (activator.CanBeCasted())
                                {
                                    activator.UseAbility();
                                }
                                _sleeper.Sleep(300, trap + "activate");
                            }
                        }
                        else if (trap.CanBeCasted())
                        {
                            if (!_sleeper.Sleeping(trap + "place"))
                            {
                                trap.UseAbility(tempTarget.Position);
                                _sleeper.Sleep(300, trap + "place");
                            }
                        }
                    }
                }
            }
            if ((target == null || !CanAttack(target)) && CanMove())
            {
                if (Move(Game.MousePosition))
                {
                    return;
                }
            }

            if (target != null && CanAttack(target))
            {
                LastTarget = target;
                var refraction = UnitExtensions.GetAbilityById(ObjectManager.LocalHero, AbilityId.templar_assassin_refraction);
                if (refraction.CanBeCasted() && !_sleeper.Sleeping(refraction))
                {
                    refraction.UseAbility();
                    _sleeper.Sleep(300, refraction);
                }
                var meld = UnitExtensions.GetAbilityById(ObjectManager.LocalHero, AbilityId.templar_assassin_meld);
                if (meld.CanBeCasted() && !_sleeper.Sleeping(meld))
                {
                    meld.UseAbility();
                    _sleeper.Sleep(300, meld);
                }
                Attack(target);
            }
            if (LastTarget != null && LastTarget.IsValid && LastTarget.IsAlive)
            {
                EffectManager.DrawRange(LastTarget, "attackTarget" + Owner.Handle, 60, Color.Red);
            }
            else
            {
                EffectManager.Remove("attackTarget" + Owner.Handle);
            }
        }
예제 #22
0
 internal static bool GetMenuBool(OrbwalkingMode mode, SpellSlot spellSlot)
 => MainMenu[mode.ToString()][string.Concat(mode, spellSlot)];
예제 #23
0
        private void OnOnIngameUpdate(EventArgs args)
        {
            if (!MenuManager.IsEnable)
            {
                return;
            }

            Mode = OrbwalkingMode.Idle;

            var isTempest = BasicUnit as Tempest;

            if (isTempest != null && (Game.IsPaused || Game.IsChatOpen || !BasicUnit.IsAlive || !isTempest.IsValid))
            {
                return;
            }
            if (OrderManager.CurrentOrder == OrderManager.Orders.DefaultCombo ||
                (OrderManager.CurrentOrder == OrderManager.Orders.TempestCombo && (isTempest != null ||
                                                                                   !(BasicUnit is MainHero))))
            {
                if (BasicUnit.OrbwalkingBehaviour is CanUseOrbwalking)
                {
                    Mode = OrbwalkingMode.Combo;
                }
            }
            else if (OrderManager.CurrentOrder == OrderManager.Orders.AutoPushing)
            {
                Mode = OrbwalkingMode.Pushing;
                if (BasicUnit is MainHero)
                {
                    return;
                }
            }
            else if (Mode == OrbwalkingMode.Idle)
            {
                EffectManager.Remove("attackTarget" + Owner.Handle);
                return;
            }
            // turning
            if (TurnEndTime > Game.RawGameTime)
            {
                return;
            }
            var target = GetTarget();

            if ((target == null || !CanAttack(target) || UnitExtensions.IsAttackImmune(target)) && CanMove())
            {
                if (BasicUnit.OrbwalkingBehaviour is CanUseOrbwalking)
                {
                    BasicUnit.MoveAction(target);
                }
                return;
            }

            if (target != null && CanAttack(target))
            {
                LastTarget = target;
                Attack(target);
            }


            if (BasicUnit.OrbwalkingBehaviour is CanUseOrbwalking)
            {
                if (LastTarget != null && LastTarget.IsValid && LastTarget.IsAlive)
                {
                    EffectManager.DrawRange(LastTarget, "attackTarget" + Owner.Handle, 60, Color.Red);
                }
                else
                {
                    EffectManager.Remove("attackTarget" + Owner.Handle);
                }
            }
        }
예제 #24
0
 private static void AddMenuBool(Menu menu, OrbwalkingMode orbwalkingMode, SpellSlot spellSlot)
 {
     menu.Add(new MenuBool(string.Concat(orbwalkingMode, spellSlot), $"Use {spellSlot}", true));
 }
        /// <summary>
        ///     Returns possible minions based on settings.
        /// </summary>
        /// <param name="mode">
        ///     The requested mode
        /// </param>
        /// <returns>
        ///     The <see cref="List{AIMinionClient}" />.
        /// </returns>
        private List <AIMinionClient> GetMinions(OrbwalkingMode mode)
        {
            var minions              = mode != OrbwalkingMode.Combo;
            var attackWards          = this.orbwalker.Menu["advanced"]["attackWards"].GetValue <MenuBool>().Value;
            var attackClones         = this.orbwalker.Menu["advanced"]["attackClones"].GetValue <MenuBool>().Value;
            var attackSpecialMinions =
                this.orbwalker.Menu["advanced"]["attackSpecialMinions"].GetValue <MenuBool>().Value;
            var prioritizeWards          = this.orbwalker.Menu["advanced"]["prioritizeWards"].GetValue <MenuBool>().Value;
            var prioritizeSpecialMinions =
                this.orbwalker.Menu["advanced"]["prioritizeSpecialMinions"].GetValue <MenuBool>().Value;
            var minionList  = new List <AIMinionClient>();
            var specialList = new List <AIMinionClient>();
            var cloneList   = new List <AIMinionClient>();
            var wardList    = new List <AIMinionClient>();

            foreach (var minion in
                     GameObjects.EnemyMinions.Where(m => this.IsValidUnit(m)))
            {
                var baseName = minion.CharacterName.ToLower();
                if (minions && minion.IsMinion())
                {
                    minionList.Add(minion);
                }
                else if (attackSpecialMinions && this.specialMinions.Any(s => s.Equals(baseName)))
                {
                    specialList.Add(minion);
                }
                else if (attackClones && this.clones.Any(c => c.Equals(baseName)))
                {
                    cloneList.Add(minion);
                }
            }

            if (minions)
            {
                minionList = OrderEnemyMinions(minionList);
                minionList.AddRange(
                    this.OrderJungleMinions(
                        GameObjects.Jungle.Where(
                            j => this.IsValidUnit(j) && !j.CharacterName.ToLower().Equals("gangplankbarrel")).ToList()));
            }

            if (attackWards)
            {
                wardList.AddRange(GameObjects.EnemyWards.Where(w => this.IsValidUnit(w)));
            }

            var finalMinionList = new List <AIMinionClient>();

            if (attackWards && prioritizeWards && attackSpecialMinions && prioritizeSpecialMinions)
            {
                finalMinionList.AddRange(wardList);
                finalMinionList.AddRange(specialList);
                finalMinionList.AddRange(minionList);
            }
            else if (attackSpecialMinions && prioritizeSpecialMinions)
            {
                finalMinionList.AddRange(specialList);
                finalMinionList.AddRange(minionList);
                finalMinionList.AddRange(wardList);
            }
            else if (attackWards && prioritizeWards)
            {
                finalMinionList.AddRange(wardList);
                finalMinionList.AddRange(minionList);
                finalMinionList.AddRange(specialList);
            }
            else
            {
                finalMinionList.AddRange(minionList);
                finalMinionList.AddRange(specialList);
                finalMinionList.AddRange(wardList);
            }

            if (this.orbwalker.Menu["advanced"]["attackBarrels"].GetValue <MenuBool>().Value)
            {
                finalMinionList.AddRange(
                    GameObjects.Jungle.Where(
                        j => this.IsValidUnit(j) && j.Health <= 1 && j.CharacterName.ToLower().Equals("gangplankbarrel"))
                    .ToList());
            }

            if (attackClones)
            {
                finalMinionList.AddRange(cloneList);
            }

            return(finalMinionList.Where(m => !this.ignoreMinions.Any(b => b.Equals(m.CharacterName.ToLower()))).ToList());
        }
예제 #26
0
 /// <summary>
 ///     Orbwalk a target while moving to Position.
 /// </summary>
 public static void Orbwalk(AttackableUnit target,
     Vector3 position,
     float extraWindup = 90,
     float holdAreaRadius = 0,
     bool useFixedDistance = true,
     bool randomizeMinDistance = true,
     bool autoWindup = false,
     bool meleePrediction = true,
     OrbwalkingMode mode = OrbwalkingMode.None,
     bool comboMovement = true,
     bool clearMovement = true)
 {
     try
     {
         if (autoWindup)
         {
             extraWindup = 25 + Game.Ping * (1.4f + Player.AttackCastDelay * 2);
         }
         if (target.IsValidTarget() && CanAttack())
         {
             DisableNextAttack = false;
             FireBeforeAttack(target);
             if (!DisableNextAttack)
             {
                 if (!NoCancelChamps.Contains(Player.ChampionName))
                 {
                     LastAATick = Utils.GameTimeTickCount + Game.Ping + 100 -
                                  (int) (ObjectManager.Player.AttackCastDelay * 1000f);
                     _missileLaunched = false;
                     var d = GetRealAutoAttackRange(target) - 65;
                     if (Player.Distance(target, true) > d * d && !Player.IsMelee)
                     {
                         LastAATick = Utils.GameTimeTickCount + Game.Ping + 400 -
                                      (int) (ObjectManager.Player.AttackCastDelay * 1000f);
                     }
                 }
                 Player.IssueOrder(GameObjectOrder.AttackUnit, target);
                 _lastTarget = target;
                 return;
             }
         }
         if ((!comboMovement && mode == OrbwalkingMode.Combo) ||
             (!clearMovement && mode == OrbwalkingMode.LaneClear))
         {
             return;
         }
         if (CanMove(extraWindup))
         {
             if (player.IsMelee() && meleePrediction && target != null &&
                 target.Position.Distance(player.Position) < GetAutoAttackRange(player, target) &&
                 target is Obj_AI_Hero && Game.CursorPos.Distance(target.Position) < 300)
             {
                 Obj_AI_Hero tar = (Obj_AI_Hero) target;
                 var prediction = AutoAttack.GetPrediction((Obj_AI_Base) target);
                 var pos = prediction.UnitPosition;
                 if (player.Distance(target) > target.BoundingRadius &&
                     !CombatHelper.IsFacing((Obj_AI_Base) target, player.Position, 120f) && tar.IsMoving)
                 {
                     AutoAttack.Delay = player.BasicAttack.SpellCastTime;
                     AutoAttack.Speed = player.BasicAttack.MissileSpeed;
                     MoveTo(pos, holdAreaRadius, false, useFixedDistance, randomizeMinDistance);
                 }
             }
             else
             {
                 MoveTo(position, holdAreaRadius, false, useFixedDistance, randomizeMinDistance);
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
     }
 }