protected override async Task Execute(CancellationToken token) { var prioritizeEvade = ZaioMenu.ShouldRespectEvader; if (!ZaioMenu.ShouldLockTarget || Target == null || !Target.IsAlive) { //Log.Debug($"Find new target"); // todo: more select0rs var oldTarget = Target; switch (ZaioMenu.TargetSelectorMode) { case TargetSelectorMode.NearestToMouse: Target = TargetSelector.ClosestToMouse(MyHero); break; case TargetSelectorMode.BestAutoAttackTarget: Target = TargetSelector.BestAutoAttackTarget(MyHero); break; case TargetSelectorMode.HighestHealth: Target = TargetSelector.HighestHealthPointsTarget(MyHero, 1000); break; } if (prioritizeEvade && !Utils.SleepCheck("Evader.Avoiding")) { Log.Debug($"abort because evade2"); return; } if (oldTarget != Target) { NewTargetAcquired?.Invoke(this, new EntityEventArgs(Target)); } if (Target == null) { switch (ZaioMenu.NoTargetMode) { case NoTargetMode.Move: MyHero.Move(Game.MousePosition); break; case NoTargetMode.AttackMove: if (!MyHero.IsAttacking()) { MyHero.Attack(Game.MousePosition); } break; } await Await.Delay(125, token); return; } } if (prioritizeEvade && !Utils.SleepCheck("Evader.Avoiding")) { Log.Debug($"abort because evade3"); return; } try { await ExecuteComboAsync(Target, token); await Await.Delay(1, token); } finally { _executed = true; } }
public static void Game_OnUpdate(EventArgs args) { if (!Game.IsInGame || Game.IsPaused || Game.IsWatchingGame) { return; } me = ObjectMgr.LocalHero; if (me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Obsidian_Destroyer) { return; } if (astral == null) { astral = me.Spellbook.SpellW; } if (eclipse == null) { eclipse = me.Spellbook.SpellR; } if (bkb == null) { bkb = me.FindItem("item_black_king_bar"); } if (orb == null) { orb = me.Spellbook.Spell1; } if (hex == null) { hex = me.FindItem("item_sheepstick"); } if (orchid == null) { orchid = me.FindItem("item_orchid"); } if (shiva == null) { shiva = me.FindItem("item_shivas_guard"); } if (atos == null) { atos = me.FindItem("item_rod_of_atos"); } if (atos == null) { atos = me.FindItem("item_bloodthorn"); } if (!menuvalueSet) { menuValue = Menu.Item("Items").GetValue <AbilityToggler>(); menuvalueSet = true; } if (Combo) { var ctm = Targeting.SelectedIndex != 2 || Targeting.SelectedIndex != 1 || Targeting.SelectedIndex != 3; var hhp = Targeting.SelectedIndex != 0 || Targeting.SelectedIndex != 2 || Targeting.SelectedIndex != 3; var hi = Targeting.SelectedIndex != 1 || Targeting.SelectedIndex != 0 || Targeting.SelectedIndex != 3; var baat = Targeting.SelectedIndex != 0 || Targeting.SelectedIndex != 1 || Targeting.SelectedIndex != 2; if (ctm) { target = me.ClosestToMouseTarget(1000); } else if (hhp) { target = TargetSelector.HighestHealthPointsTarget(me, 600); } else if (hi) { target = HighestInt(me); } else if (baat) { target = me.BestAATarget(); } //orbwalk if (target != null && (!target.IsValid || !target.IsVisible || !target.IsAlive || target.Health <= 0)) { target = null; } var canCancel = Orbwalking.CanCancelAnimation(); if (canCancel) { if (target != null && !target.IsVisible && !Orbwalking.AttackOnCooldown(target)) { target = me.ClosestToMouseTarget(); } } if (target != null && target.IsAlive && !target.IsInvul() && !target.IsIllusion) { var targetDistance = me.Distance2D(target); if (me.CanAttack() && me.CanCast()) { if (orb != null && orb.IsValid && orb.CanBeCasted() && me.CanCast() && Utils.SleepCheck("orb") && !target.UnitState.HasFlag(UnitState.MagicImmune)) { orb.UseAbility(target); Utils.Sleep(50, "orb"); } } if (atos != null && atos.IsValid && atos.CanBeCasted() && Utils.SleepCheck("atos") && menuValue.IsEnabled(atos.Name)) { atos.UseAbility(target); Utils.Sleep(50 + Game.Ping, "atos"); } if (shiva != null && shiva.IsValid && shiva.CanBeCasted() && Utils.SleepCheck("shiva") && menuValue.IsEnabled(shiva.Name)) { atos.UseAbility(target); Utils.Sleep(50 + Game.Ping, "shiva"); } if (!(targetDistance <= me.AttackRange)) { return; } if (bkb != null && bkb.IsValid && bkb.CanBeCasted() && Utils.SleepCheck("bkb") && menuValue.IsEnabled(bkb.Name)) { bkb.UseAbility(); Utils.Sleep(150 + Game.Ping, "bkb"); } if (hex != null && hex.IsValid && hex.CanBeCasted() && Utils.SleepCheck("hex") && menuValue.IsEnabled(hex.Name)) { hex.CastStun(target); Utils.Sleep(250 + Game.Ping, "hex"); return; } if (orchid != null && orchid.IsValid && orchid.CanBeCasted() && Utils.SleepCheck("orchid") && menuValue.IsEnabled(orchid.Name)) { orchid.CastStun(target); Utils.Sleep(250 + Game.Ping, "orchid"); return; } if (bloodthorn != null && bloodthorn.IsValid && bloodthorn.CanBeCasted() && Utils.SleepCheck("bloodthorn") && menuValue.IsEnabled(bloodthorn.Name)) { bloodthorn.CastStun(target); Utils.Sleep(250 + Game.Ping, "bloodthorn"); return; } if (orb == null || orb.CanBeCasted() || !Utils.SleepCheck("orb") || !Menu.Item("orbwalkk").GetValue <bool>() || !(targetDistance <= me.AttackRange)) { } else { Orbwalking.Orbwalk(target); Utils.Sleep(Game.Ping + 150, "orb"); } if (me.IsAttacking() || !(targetDistance >= me.AttackRange) || !Utils.SleepCheck("follow")) { return; } me.Move(Game.MousePosition); Utils.Sleep(150 + Game.Ping, "follow"); } else if (!orb.CanBeCasted() && Utils.SleepCheck("orb") && target != null && target.UnitState.HasFlag(UnitState.MagicImmune)) { me.Attack(target); Utils.Sleep(150, "noorb"); } else { me.Move(Game.MousePosition); } } }