protected override void OnPostUpdate() { if (Q.IsReady()) { var target = GameObjects.EnemyHeroes.OrderBy(e => e.Distance(Player)) .Where(e => Q.IsInRange(e)) .FirstOrDefault(t => HeroListManager.Check("q-immobile", t) && Utils.IsImmobile(t)); if (target != null) { Q.Cast(target.Position); } } }
private void OnEnemyTargetCast(object sender, TargetCastArgs args) { try { if (Menu.Item(Menu.Name + ".shield.enabled").GetValue <bool>() && args.Target.IsMe && ManaManager.Check("shield")) { if (args.Type == SpellDataTargetType.SelfAoe) { E.Cast(); } if (args.Type == SpellDataTargetType.Unit && args.Target != null && args.Target.IsMe) { var delay = (int)(Utils.SpellArrivalTime(args.Sender, Player, args.Delay, args.Speed, true)) * 1000; var ping = Game.Ping / 2000; if (delay - 200 - ping > 0) { Utility.DelayAction.Add( delay - 100 - ping, delegate { if (E.IsReady()) { E.Cast(); } }); } else if (E.IsReady()) { E.Cast(); } } } } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }
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)); } }
private void OnCorePostUpdate(EventArgs args) { try { if (Q.IsReady()) { var target = GameObjects.EnemyHeroes.OrderBy(e => e.Distance(Player)) .Where(e => Q.IsInRange(e)) .FirstOrDefault(t => HeroListManager.Check("q-stunned", t) && Utils.IsStunned(t)); if (target != null) { Q.Cast(target.Position); } } } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }