protected override void Killsteal()
 {
     if (Menu.Item(Menu.Name + ".killsteal.q").GetValue <bool>() && Q.IsReady())
     {
         var fPredEnemy =
             GameObjects.EnemyHeroes.Where(e => e.IsValidTarget(Q.Range * 1.2f) && Q.IsKillable(e))
             .Select(enemy => Q.GetPrediction(enemy, true))
             .FirstOrDefault(pred => pred.Hitchance >= HitChance.High);
         if (fPredEnemy != null && !Utils.IsWallBetween(Player.Position, fPredEnemy.CastPosition))
         {
             Q.Cast(fPredEnemy.CastPosition);
         }
     }
 }
        private void QFarmLogic(List <Obj_AI_Base> minions, int min)
        {
            try
            {
                if (!Q.IsReady() || minions.Count == 0)
                {
                    return;
                }
                var totalHits = 0;
                var castPos   = Vector3.Zero;

                var positions = (from minion in minions
                                 let pred = Q.GetPrediction(minion)
                                            where pred.Hitchance >= HitChance.Medium
                                            where !Utils.IsWallBetween(Player.Position, pred.UnitPosition)
                                            select new Tuple <Obj_AI_Base, Vector3>(minion, pred.UnitPosition)).ToList();

                if (positions.Any())
                {
                    foreach (var position in positions)
                    {
                        var rect = new Geometry.Polygon.Rectangle(
                            ObjectManager.Player.Position, ObjectManager.Player.Position.Extend(position.Item2, Q.Range),
                            Q.Width);
                        var count =
                            positions.Select(
                                position2 =>
                                new Geometry.Polygon.Circle(position2.Item2, position2.Item1.BoundingRadius * 0.9f))
                            .Count(circle => circle.Points.Any(p => rect.IsInside(p)));
                        if (count > totalHits)
                        {
                            totalHits = count;
                            castPos   = position.Item2;
                        }
                        if (totalHits == minions.Count)
                        {
                            break;
                        }
                    }
                    if (!castPos.Equals(Vector3.Zero) && totalHits >= min)
                    {
                        Q.Cast(castPos);
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
Example #3
0
        protected override void Combo()
        {
            var useQ = Menu.Item(Menu.Name + ".combo.q").GetValue <bool>() && Q.IsReady();
            var useW = Menu.Item(Menu.Name + ".combo.w").GetValue <bool>() && W.IsReady();
            var useE = Menu.Item(Menu.Name + ".combo.e").GetValue <bool>() && E.IsReady();
            var useR = _ultimate.IsActive(UltimateModeType.Combo) && R.IsReady();

            if (useR)
            {
                var target = TargetSelector.GetTarget(R.Range, R.DamageType);
                if (target != null)
                {
                    if (!RLogic(UltimateModeType.Combo, target))
                    {
                        RLogicSingle(UltimateModeType.Combo);
                    }
                }
            }
            if (useE)
            {
                var target = TargetSelector.GetTarget((E.Range + Player.AttackRange) * 0.9f, E.DamageType);
                if (target != null)
                {
                    var pos = Menu.Item(Menu.Name + ".combo.e-mode").GetValue <StringList>().SelectedIndex == 0
                        ? Utils.GetDashPosition(
                        E, target, Menu.Item(Menu.Name + ".combo.e-safety").GetValue <Slider>().Value)
                        : Player.Position.Extend(
                        Game.CursorPos, Math.Min(E.Range, Player.Position.Distance(Game.CursorPos)));
                    if (!pos.Equals(Vector3.Zero) && !pos.IsUnderTurret(false))
                    {
                        E.Cast(pos);
                    }
                }
            }
            if (useQ)
            {
                Casting.SkillShot(Q, Q.GetHitChance("combo"));
            }
            if (useW)
            {
                var target = TargetSelector.GetTarget(W);
                var best   = CPrediction.Circle(W, target, W.GetHitChance("combo"));
                if (best.TotalHits > 0 && !best.CastPosition.Equals(Vector3.Zero))
                {
                    W.Cast(best.CastPosition);
                }
            }
        }
        private void QLogic(HitChance hitChance)
        {
            var target = TargetSelector.GetTarget(Q);

            if (target != null)
            {
                var prediction = CPrediction.Line(Q, target, hitChance, false);
                if (prediction.TotalHits >= 1)
                {
                    var firstHit = prediction.Hits.OrderBy(h => h.Distance(Player)).FirstOrDefault();
                    if (firstHit != null && !Utils.IsWallBetween(Player.Position, firstHit.Position))
                    {
                        if (!GameObjects.EnemyHeroes.Any(e => e.IsValidTarget() && Orbwalking.InAutoAttackRange(e)) ||
                            IsReloading() || Q.IsKillable(target) || prediction.TotalHits >= 2)
                        {
                            Q.Cast(prediction.CastPosition);
                        }
                    }
                }
            }
        }
        protected override void Combo()
        {
            var useQ = Menu.Item(Menu.Name + ".combo.q").GetValue <bool>() && Q.IsReady();
            var useW = Menu.Item(Menu.Name + ".combo.w").GetValue <bool>() && W.IsReady();
            var useE = Menu.Item(Menu.Name + ".combo.e").GetValue <bool>() && E.IsReady();
            var useR = Ultimate.IsActive(UltimateModeType.Combo) && R.IsReady();

            if (useR)
            {
                var target = TargetSelector.GetTarget(R.Range, R.DamageType);
                if (target != null)
                {
                    if (!RLogic(UltimateModeType.Combo, target))
                    {
                        RLogicSingle(UltimateModeType.Combo);
                    }
                }
            }
            if (useE && !Player.IsWindingUp && !IsReloading())
            {
                var target = TargetSelector.GetTarget(
                    E.Range + Player.AttackRange + Player.BoundingRadius, E.DamageType);
                if (target != null)
                {
                    var pos = Menu.Item(Menu.Name + ".combo.e-mode").GetValue <StringList>().SelectedIndex == 0
                        ? Utils.GetDashPosition(
                        E, target, Menu.Item(Menu.Name + ".combo.e-safety").GetValue <Slider>().Value)
                        : Player.Position.Extend(
                        Game.CursorPos, Math.Min(E.Range, Player.Position.Distance(Game.CursorPos)));

                    if (!pos.Equals(Vector3.Zero))
                    {
                        if (GetAmmoCount() == 1 && !pos.IsUnderTurret(false) ||
                            (!GameObjects.EnemyHeroes.Any(e => e.IsValidTarget() && Orbwalking.InAutoAttackRange(e)) &&
                             GameObjects.EnemyHeroes.Any(
                                 e =>
                                 e.IsValidTarget() &&
                                 pos.Distance(e.Position) < Orbwalking.GetRealAutoAttackRange(e)) &&
                             target.Health < Player.GetAutoAttackDamage(target) * 2))
                        {
                            E.Cast(pos);
                        }
                    }
                }
            }
            if (useQ)
            {
                QLogic(Q.GetHitChance("combo"));
            }
            if (useW)
            {
                var target = TargetSelector.GetTarget(W);
                if (target != null)
                {
                    var best = CPrediction.Circle(W, target, W.GetHitChance("combo"));
                    if (best.TotalHits > 0 && !best.CastPosition.Equals(Vector3.Zero))
                    {
                        W.Cast(best.CastPosition);
                    }
                }
            }
        }
        public static void UseFleeItems()
        {
            if (_menu == null || !_menu.Item(_menu.Name + ".enabled").GetValue <bool>())
            {
                return;
            }

            try
            {
                foreach (var item in
                         Items.Where(
                             i =>
                             i.Flags.HasFlag(ItemFlags.Flee) &&
                             _menu.Item(_menu.Name + "." + i.Name + ".flee").GetValue <bool>() && i.Item.IsOwned() &&
                             i.Item.IsReady() && i.Item.IsOwned() && i.Item.IsReady() &&
                             ObjectManager.Player.CountEnemiesInRange(i.Range) >=
                             _menu.Item(_menu.Name + "." + i.Name + ".min-enemies-range").GetValue <Slider>().Value&&
                             ObjectManager.Player.HealthPercent <=
                             _menu.Item(_menu.Name + "." + i.Name + ".player-health-below").GetValue <Slider>().Value&&
                             ObjectManager.Player.HealthPercent >=
                             _menu.Item(_menu.Name + "." + i.Name + ".player-health-above").GetValue <Slider>().Value))
                {
                    if (item.CastType != CastType.Self)
                    {
                        var lItem     = item;
                        var localItem = item;
                        foreach (var enemy in
                                 GameObjects.EnemyHeroes.Where(
                                     t =>
                                     t.IsValidTarget() && !Invulnerable.Check(t) &&
                                     t.HealthPercent <=
                                     _menu.Item(_menu.Name + "." + lItem.Name + ".target-health-below")
                                     .GetValue <Slider>()
                                     .Value&&
                                     t.HealthPercent >=
                                     _menu.Item(_menu.Name + "." + lItem.Name + ".target-health-above")
                                     .GetValue <Slider>()
                                     .Value)
                                 .OrderByDescending(
                                     t =>
                                     t.Position.Distance(ObjectManager.Player.Position, true) <
                                     Math.Pow(localItem.Range, 2)))
                        {
                            if (!Utils.IsImmobile(enemy) && !Utils.IsSlowed(enemy))
                            {
                                switch (localItem.CastType)
                                {
                                case CastType.Target:
                                    localItem.Item.Cast(enemy);
                                    break;

                                case CastType.Position:
                                    var prediction = Prediction.GetPrediction(
                                        enemy, localItem.Delay, localItem.Radius, localItem.Speed);
                                    if (prediction.Hitchance >= HitChance.Medium)
                                    {
                                        localItem.Item.Cast(prediction.CastPosition);
                                    }
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        if (ObjectManager.Player.CountEnemiesInRange(item.Range) >
                            _menu.Item(_menu.Name + "." + item.Name + ".min-enemies-range").GetValue <Slider>().Value)
                        {
                            item.Item.Cast();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }