private void Player_OnExecuteOrder(Player sender, ExecuteOrderEventArgs args) { if (args.OrderId == OrderId.AbilityTarget && args.Ability.Id == AbilityId.windrunner_focusfire && args.Entities.Contains(MyHero)) { _ultTarget = args.Target as Unit; if (!MyHero.HasModifier("modifier_windrunner_focusfire")) { _attackSpeed = UnitDatabase.GetAttackSpeed(MyHero); } } }
public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken()) { if (MyHero.IsChanneling()) { return; } await HasNoLinkens(target, tk); await UseItems(target, tk); if (await DisableEnemy(target, tk) == DisabledState.UsedAbilityToDisable) { Log.Debug($"disabled!"); } if (!MyHero.IsSilenced()) { if (_powerShotAbility.IsAbilityEnabled() && _powerShotAbility.CanBeCasted(target) && _powerShotAbility.CanHit(target)) { var speed = _powerShotAbility.GetAbilityData("arrow_speed"); var time = target.Distance2D(MyHero) / speed * 1000.0f; float disabledDuration; if (target.IsDisabled(out disabledDuration) && disabledDuration >= time + 1.0f) { _powerShotAbility.UseAbility(target.NetworkPosition); Log.Debug($"using powershot since target disabled for {disabledDuration}"); await Await.Delay(GetAbilityDelay(target, _powerShotAbility) + (int)(disabledDuration * 1000.0f), tk); MyHero.Stop(); } else { var range = _powerShotAbility.GetAbilityData("arrow_range"); var predictedPos = Prediction.Prediction.PredictPosition(target, (int)time + 1000, true); var distance = MyHero.Distance2D(predictedPos); if (predictedPos != Vector3.Zero && distance < range) { var damage = (float)_powerShotAbility.GetDamage(_powerShotAbility.Level - 1); damage *= GetSpellAmp(); if (target.Health <= damage * (1.0f - target.MagicResistance())) { var powerShotProp = GetPowerShotProp(target); time += (1000.0f * powerShotProp); predictedPos = Prediction.Prediction.PredictPosition(target, (int)time); _powerShotAbility.UseAbility(predictedPos); Log.Debug($"using powershot since target can be killed"); await Await.Delay(GetAbilityDelay(target, _powerShotAbility) + (int)time, tk); MyHero.Stop(); } else if (!_shackleAbility.CanBeCasted(target) && !MyHero.HasItem(ClassId.CDOTA_Item_BlinkDagger) && distance > MyHero.GetAttackRange() * 1.25f) { _powerShotAbility.UseAbility(predictedPos); Log.Debug($"using powershot since no blink or shackle"); await Await.Delay(GetAbilityDelay(target, _powerShotAbility) + 1000, tk); } } } } if (_shackleAbility.IsAbilityEnabled() && _shackleAbility.CanBeCasted(target)) { var shackleTarget = FindShackleTarget(target); if (shackleTarget != null) { _shackleAbility.UseAbility(shackleTarget); Log.Debug($"using shackle on {shackleTarget.Name}"); await Await.Delay(GetAbilityDelay(shackleTarget, _shackleAbility), tk); } else if (ZaioMenu.ShouldUseBlinkDagger) { // test for iron branch jump var blink = MyHero.GetItemById(ItemId.item_blink); var distance = MyHero.Distance2D(target); if (blink != null && blink.CanBeCasted()) { var ironBranch = MyHero.GetItemById(ItemId.item_branches); if (ShouldUseBranchShackle && ironBranch != null && distance >= 220 && distance <= blink.GetCastRange() - _shackleAbility.GetAbilityData("shackle_distance") / 2) { await BlinkShackleBranch(target, blink, ironBranch, tk); Log.Debug($"used ironbranch trick"); } else if (distance < blink.GetCastRange() + _shackleAbility.GetCastRange()) { // find good blink pos Log.Debug($"using blink shackle find pos"); await BlinkShackleFindPos(target, blink, tk); } } } } if (_ultAbility.IsAbilityEnabled() && (!_shackleAbility.CanBeCasted() || target.IsDisabled()) && _ultAbility.CanBeCasted(target) && _ultAbility.CanHit(target)) { if (!MyHero.HasModifier("modifier_windrunner_focusfire")) { _attackSpeed = UnitDatabase.GetAttackSpeed(MyHero); } Log.Debug($"use ult"); _ultAbility.UseAbility(target); _ultTarget = target; await Await.Delay(GetAbilityDelay(target, _ultAbility), tk); } } // check if we are near the enemy if (!_shackleAbility.CanBeCasted(target) || !_shackleAbility.IsAbilityEnabled()) { if (!await MoveOrBlinkToEnemy(target, tk)) { Log.Debug($"return because of blink"); return; } } else if (!await MoveToEnemy(target, tk)) { Log.Debug($"return because of move"); return; } var useOrbwalkerOnUlt = (!MyHero.HasModifier("modifier_windrunner_focusfire") || ShouldUseOrbwalkWhileUlt); if (ZaioMenu.ShouldUseOrbwalker && useOrbwalkerOnUlt) { Orbwalk(); } else if (!useOrbwalkerOnUlt) { MyHero.Attack(target); await Await.Delay(125, tk); } }