Пример #1
0
        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.None)
                    {
                        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.Self:
                                    localItem.Item.Cast(ObjectManager.Player);
                                    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));
            }
        }
Пример #2
0
        protected override void Combo()
        {
            var q = Menu.Item(Menu.Name + ".combo.q").GetValue <bool>();
            var w = Menu.Item(Menu.Name + ".combo.w").GetValue <bool>();

            if (w && W.IsReady())
            {
                var target = TargetSelector.GetTarget(W, false);
                if (target != null)
                {
                    var best = GetBestCard(target, "combo");
                    if (best.Any())
                    {
                        Cards.Select(best);
                    }
                }
            }
            if (q && Q.IsReady())
            {
                var target         = TargetSelector.GetTarget(Q);
                var goldCardTarget = _wTarget != null && _wTarget.IsValidTarget(Q.Range) && _wTargetEndTime > Game.Time;
                if (goldCardTarget)
                {
                    target = _wTarget;
                }
                if (target == null || target.Distance(Player) < Player.BoundingRadius && !Utils.IsImmobile(target))
                {
                    return;
                }
                if (!goldCardTarget && (Cards.Has() || HasEBuff()) &&
                    GameObjects.EnemyHeroes.Any(e => Orbwalking.InAutoAttackRange(e) && e.IsValidTarget()) ||
                    Cards.Has(CardColor.Gold))
                {
                    return;
                }
                if (goldCardTarget)
                {
                    if (target.Distance(Player) > 250 && !Utils.IsImmobile(target))
                    {
                        return;
                    }
                    var best = BestQPosition(
                        target, GameObjects.EnemyHeroes.Select(e => e as Obj_AI_Base).ToList(), Q.GetHitChance("combo"));
                    if (!best.Item2.Equals(Vector3.Zero) && best.Item1 >= 1)
                    {
                        Q.Cast(best.Item2);
                        _wTarget        = null;
                        _wTargetEndTime = 0;
                    }
                }
                else if (Utils.IsImmobile(target) || (W.Instance.CooldownExpires - Game.Time) >= 2 || W.Level == 0)
                {
                    var best = BestQPosition(
                        target, GameObjects.EnemyHeroes.Select(e => e as Obj_AI_Base).ToList(), Q.GetHitChance("combo"));
                    if (!best.Item2.Equals(Vector3.Zero) && best.Item1 >= 1)
                    {
                        Q.Cast(best.Item2);
                    }
                }
            }
        }