protected override void Flee() { if (Menu.Item(Menu.Name + ".flee.e").GetValue <bool>() && E.IsReady()) { var enemy = GameObjects.EnemyHeroes.Where(e => e.IsValidTarget() && !Utils.IsSlowed(e) && !Utils.IsImmobile(e)) .OrderBy(e => e.Distance(Player)) .FirstOrDefault(); if (enemy != null) { Casting.SkillShot(enemy, E, HitChance.High); } } }
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)); } }