Exemple #1
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            await HasNoLinkens(target, tk);
            await UseItems(target, tk);

            if (await DisableEnemy(target, tk) == DisabledState.UsedAbilityToDisable)
            {
                Log.Debug($"disabled!");
            }

            if (!MyHero.IsSilenced())
            {
                if (_stormboltAbility.IsAbilityEnabled() && _stormboltAbility.CanBeCasted(target) && _stormboltAbility.CanHit(target))
                {
                    _stormboltAbility.UseAbility(target);
                    Log.Debug($"stormbolt used");
                    await Await.Delay((int)(_stormboltAbility.FindCastPoint() * 1000.0 + Game.Ping), tk);
                }

                if (MyHero.Distance2D(target) <= 400)
                {
                    if (_warcryAbility.IsAbilityEnabled() && _warcryAbility.CanBeCasted())
                    {
                        _warcryAbility.UseAbility();
                        Log.Debug($"warcry used");
                        await Await.Delay(100, tk);
                    }

                    if (_ultAbility.IsAbilityEnabled() && _ultAbility.CanBeCasted())
                    {
                        Log.Debug($"use ult");
                        _ultAbility.UseAbility();
                        await Await.Delay(100, tk);
                    }
                }
            }

            // check if we are near the enemy
            if (!await MoveOrBlinkToEnemy(target, tk))
            {
                Log.Debug($"return because of blink");
                return;
            }
            //cast mom if all of our skills are on cooldown
            var mom = MyHero.GetItemById(ItemId.item_mask_of_madness);

            if (mom != null && mom.IsAbilityEnabled() && MyHero.CanAttack() && !_stormboltAbility.CanBeCasted() &&
                !_warcryAbility.CanBeCasted() && !_ultAbility.CanBeCasted() && mom.CanBeCasted())
            {
                Log.Debug($"Use mom");
                mom.UseAbility();
                await Await.Delay(250, tk);
            }

            if (ZaioMenu.ShouldUseOrbwalker && !target.IsStunned())
            {
                Orbwalk();
            }
        }
Exemple #2
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            if (!MyHero.IsSilenced() && _jumpAbility.CanBeCasted(target))
            {
                var radius = _jumpAbility.GetAbilityData("pounce_radius");
                var range  = _jumpAbility.GetAbilityData("pounce_distance");
                var time   = MyHero.Distance2D(target) / _jumpAbility.GetAbilityData("pounce_speed");
                var pos    = Prediction.Prediction.PredictPosition(target, (int)(time * 1000.0f), true);
                var rec    = new Geometry.Polygon.Rectangle(MyHero.NetworkPosition, MyHero.InFront(range), radius);
                if (pos != Vector3.Zero && pos.Distance2D(MyHero) <= range && rec.IsInside(pos))
                {
                    Log.Debug($"using jump");
                    _jumpAbility.UseAbility();
                    await Await.Delay((int)(_jumpAbility.FindCastPoint() * 1000.0f + Game.Ping), tk);
                }
            }
            if (!MyHero.IsSilenced() && _purgeAbility.CanBeCasted(target) && _purgeAbility.CanHit(target) ||
                MyHero.IsRooted())
            {
                Log.Debug($"using Q");
                _purgeAbility.UseAbility();
                await Await.Delay((int)(_purgeAbility.FindCastPoint() * 1000.0f + Game.Ping), tk);
            }

            await HasNoLinkens(target, tk);
            await UseItems(target, tk);

            // make him disabled
            if (await DisableEnemy(target, tk) == DisabledState.UsedAbilityToDisable)
            {
                Log.Debug($"disabled!");
                // return;
            }

            // check if we are near the enemy
            if (!await MoveOrBlinkToEnemy(target, tk))
            {
                Log.Debug($"return because of blink");
                return;
            }

            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Exemple #3
0
        private float GetPowerShotProp(Unit target)
        {
            var damage = (float)_powerShotAbility.GetDamage(_powerShotAbility.Level - 1);

            damage *= GetSpellAmp();

            var speed  = _powerShotAbility.GetAbilityData("arrow_speed");
            var time   = (float)(1.0f + MyHero.Distance2D(target) / speed + _powerShotAbility.FindCastPoint());
            var health = (target.Health + target.HealthRegeneration * time) * (1.0f + target.MagicResistance()) * 1.1f;

            // todo: calc from monkey ms/travel speed?
            Log.Debug($"health {health} | {target.HealthRegeneration * time}");
            var result = (health / damage) * 10.0f;

            result = (int)result / 10.0f;
            return(result); // Math.Min(1.0f, result);
        }
Exemple #4
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            if (!await MoveOrBlinkToEnemy(target, tk)) //We want to initiate with blink first
            {
                return;
            }
            await HasNoLinkens(target, tk);
            await UseItems(target, tk); //then use items to maximize ulti damage
            await DisableEnemy(target, tk);

            if (!MyHero.IsSilenced())
            {
                if (MyHero.Distance2D(target) <= _pulseAbility.GetAbilityData("area_of_effect"))
                {
                    if (_pulseAbility.CanBeCasted() && _pulseAbility.CanHit(target) && MyHero.Mana - _pulseAbility.ManaCost >= _ultAbility.ManaCost)
                    {
                        Log.Debug($"using pulse to deal damage target");
                        _pulseAbility.UseAbility();
                        await Await.Delay(100, tk);
                    }
                }

                if (_ultAbility.CanBeCasted(target) && _ultAbility.CanHit(target) && await HasNoLinkens(target, tk))
                {
                    var damage = _ultAbility.GetAbilityData("damage_per_health");
                    damage *= GetSpellAmp();
                    if (_ultAbility.CanHit(target) && (((target.MaximumHealth - target.Health) * damage) * (1 - target.MagicDamageResist)) >= target.Health) //Don't waste ulti if target is can't be killed by ulti
                    {
                        Log.Debug($"using ulti to kill enemy. {damage} > {target.Health}");
                        _ultAbility.UseAbility(target);
                        await Await.Delay(GetAbilityDelay(target, _ultAbility) + 250, tk);
                    }
                }
            }


            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Exemple #5
0
        private static void ComboInAction(Hero target)
        {
            if (!Spell4.CanBeCasted() || Spell4.Level == 0 || !Utils.SleepCheck(Spell2.StoredName()))
            {
                return;
            }

            var neededMana = MyHero.Mana - Spell4.ManaCost;

            var allitems = MyHero.Inventory.Items.Where(x => x.CanBeCasted() && x.ManaCost <= neededMana);

            var isInvise = MyHero.IsInvisible();

            var inventory =
                allitems.Where(x => Utils.SleepCheck(x.Name + MyHero.Handle)).ToList();
            var underLink = target.IsLinkensProtected();
            var distance  = MyHero.Distance2D(target) - MyHero.HullRadius - target.HullRadius;

            if (underLink)
            {
                var linkerItems = inventory.Where(x => x.CanHit(target) && ItemsLinker.Keys.Contains(x.Name)).OrderByDescending(y => ItemsLinker[y.StoredName()]);
                foreach (var item in linkerItems)
                {
                    item.UseAbility(target);
                    Utils.Sleep(250, item.Name + MyHero.Handle);
                }
                if (linkerItems.Any(x => Utils.SleepCheck(x.Name + MyHero.Handle)))
                {
                    return;
                }
            }
            var items =
                inventory.Where(
                    x =>
                    Items.Keys.Contains(x.Name) &&
                    ((x.CastRange == 0 && distance <= 800) ||
                     x.CastRange >= distance)).OrderByDescending(y => Items[y.StoredName()]);

            if (Dagger != null && Dagger.CanBeCasted() && !isInvise && Utils.SleepCheck("dagger") && distance <= 1200 && distance > 150)
            {
                if (UseHeal())
                {
                    return;
                }
                var point = new Vector3(
                    (float)(target.Position.X - 20 * Math.Cos(MyHero.FindAngleBetween(target.Position, true))),
                    (float)(target.Position.Y - 20 * Math.Sin(MyHero.FindAngleBetween(target.Position, true))),
                    0);
                Dagger.UseAbility(point);
                Utils.Sleep(500, "dagger");
            }
            else if (Utils.SleepCheck("attack_cd"))
            {
                Utils.Sleep(500, "attack_cd");
                MyHero.Attack(target);
            }
            if (Bkb != null && Menu.Item("enabledAbilities").GetValue <AbilityToggler>().IsEnabled(Bkb.StoredName()) &&
                Bkb.CanBeCasted() && Utils.SleepCheck(Bkb.StoredName()) && Spell4.CanHit(target))
            {
                Bkb.UseAbility();
                Utils.Sleep(500, Bkb.StoredName());
            }
            foreach (var item in items)
            {
                if (item.StoredName() == "item_armlet")
                {
                    if (!MyHero.HasModifier("modifier_item_armlet_unholy_strength"))
                    {
                        item.ToggleAbility();
                        Utils.Sleep(500, item.Name + MyHero.Handle);
                    }
                    continue;
                }
                if (item.IsAbilityBehavior(AbilityBehavior.NoTarget))
                {
                    item.UseAbility();
                }
                if (item.IsAbilityBehavior(AbilityBehavior.UnitTarget))
                {
                    if (item.TargetTeamType == TargetTeamType.Enemy || item.TargetTeamType == TargetTeamType.All)
                    {
                        item.UseAbility(target);
                    }
                    else
                    {
                        item.UseAbility(MyHero);
                    }
                }
                Utils.Sleep(500, item.Name + MyHero.Handle);
            }
            if (isInvise && Utils.SleepCheck("attack_cd_2"))
            {
                MyHero.Attack(target);
                Utils.Sleep(500 + Game.Ping, "attack_cd_2");
            }
            else if (Utils.SleepCheck("ult"))
            {
                if (distance <= 200 /*Spell4.CanHit(target)*/)
                {
                    UseHeal();
                    //if (items.Any(x => Utils.SleepCheck(x.Name + MyHero.Handle))) return;
                    Utils.Sleep(100 + Game.Ping, "ult");
                    Spell4.UseAbility(target);
                }
            }
        }
Exemple #6
0
        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);
            }
        }
Exemple #7
0
        protected override async Task <bool> Killsteal()
        {
            if (await base.Killsteal())
            {
                return(true);
            }

            if (MyHero.IsSilenced() || MyHero.IsChanneling() || Target != null)
            {
                return(false);
            }

            if (_powerShotAbility.IsKillstealAbilityEnabled() && _powerShotAbility.CanBeCasted())
            {
                var damage = (float)_powerShotAbility.GetDamage(_powerShotAbility.Level - 1);
                damage *= GetSpellAmp();

                var speed           = _powerShotAbility.GetAbilityData("arrow_speed");
                var range           = _powerShotAbility.GetAbilityData("arrow_range");
                var width           = _powerShotAbility.GetAbilityData("arrow_width");
                var damageReduction = _powerShotAbility.GetAbilityData("damage_reduction"); // 0.2

                var enemies =
                    ObjectManager.GetEntitiesParallel <Hero>()
                    .Where(
                        x =>
                        x.IsAlive && x.Team != MyHero.Team && !x.IsIllusion &&
                        _powerShotAbility.CanBeCasted(x) &&
                        _powerShotAbility.CanHit(x) && !x.IsMagicImmune() &&
                        x.Health < damage * (1 - x.MagicResistance()) && !x.CantBeAttacked() &&
                        !x.CantBeKilled());
                foreach (var enemy in enemies)
                {
                    var time         = enemy.Distance2D(MyHero) / speed * 1000.0f;
                    var predictedPos = Prediction.Prediction.PredictPosition(enemy, (int)time, true);
                    if (predictedPos == Vector3.Zero || MyHero.Distance2D(predictedPos) >= range)
                    {
                        continue;
                    }
                    // check for reduction
                    var rec = new Geometry.Polygon.Rectangle(MyHero.NetworkPosition, predictedPos, width);

                    // test for enemies in range
                    var unitsHit = ObjectManager.GetEntitiesParallel <Unit>()
                                   .Count(
                        x =>
                        x.IsValid && x != enemy && x.IsAlive && !(x is Building) && x != MyHero && x.Team != MyHero.Team &&
                        x.IsSpawned && x.IsRealUnit() &&
                        rec.IsInside(x.NetworkPosition));

                    var newDamage = damage * (unitsHit > 0 ? Math.Pow(1 - damageReduction, unitsHit) : 1.0f);
                    if (enemy.Health >= newDamage * (1 - enemy.MagicResistance()))
                    {
                        Log.Debug($"not using powershot killsteal because too many units hit before ({unitsHit}) - {newDamage * (1 - enemy.MagicResistance())}");
                        continue;
                    }
                    var powerShotProp = GetPowerShotProp(enemy);
                    if (powerShotProp > 1.0f)
                    {
                        Log.Debug($"powershot prop too high {powerShotProp}");
                    }
                    else
                    {
                        time        += (1000.0f * powerShotProp);
                        predictedPos = Prediction.Prediction.PredictPosition(enemy, (int)time, true);

                        Log.Debug(
                            $"use killsteal powershot because enough damage {enemy.Health} <= {damage * (1 - enemy.MagicResistance())} prop {powerShotProp}");
                        _powerShotAbility.UseAbility(predictedPos);
                        await Await.Delay(GetAbilityDelay(enemy, _powerShotAbility) + (int)time);

                        MyHero.Stop();
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemple #8
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            if (!MyHero.IsInvisible())
            {
                var shadowBlade = MyHero.GetItemById(ItemId.item_invis_sword) ??
                                  MyHero.GetItemById(ItemId.item_silver_edge);
                var distance  = MyHero.Distance2D(target);
                var rangeMode = !_toggleAbility.IsToggled;
                if (shadowBlade != null && shadowBlade.IsAbilityEnabled() && shadowBlade.CanBeCasted() && !MyHero.IsVisibleToEnemies &&
                    distance < MyHero.MovementSpeed * 7)
                {
                    if (rangeMode && !MyHero.IsSilenced())
                    {
                        Log.Debug($"toggling to melee for extra move speed");
                        _toggleAbility.ToggleAbility();
                        await Await.Delay(GetAbilityDelay(target, _toggleAbility), tk);
                    }
                    Log.Debug($"using invis");
                    shadowBlade.UseAbility();
                    var fadeTime = shadowBlade.GetAbilityData("windwalk_fade_time") * 2 * 1000;     // 0.3
                    await Await.Delay((int)fadeTime, tk);
                }
            }


            if (!MyHero.IsSilenced() && !MyHero.IsInvisible())
            {
                if (!_toggleAbility.IsToggled && _rangedAbility.IsAbilityEnabled() && _rangedAbility.CanBeCasted(target) && _rangedAbility.CanHit(target) &&
                    !MyHero.IsInvisible())
                {
                    Log.Debug(
                        $"using slow so we won't get kited in melee");
                    _rangedAbility.UseAbility(target.NetworkPosition);
                    await Await.Delay(GetAbilityDelay(target, _rangedAbility), tk);

                    //return;
                }

                else if (_toggleAbility.IsToggled && _toggleAbility.IsAbilityEnabled() && _rangedAbility.CanBeCasted(target) && _rangedAbility.CanHit(target))
                {
                    Log.Debug($"toggling so we can use slow");
                    _toggleAbility.ToggleAbility();
                    await Await.Delay(GetAbilityDelay(target, _toggleAbility), tk);

                    return;
                }

                if (_meleeAbility.IsAbilityEnabled() && _toggleAbility.IsToggled && _meleeAbility.CanBeCasted(target) && _meleeAbility.CanHit(target) &&
                    !MyHero.IsInvisible())
                {
                    Log.Debug(
                        $"using melee axe");
                    _meleeAbility.UseAbility();
                    await Await.Delay(GetAbilityDelay(target, _meleeAbility), tk);

                    //return;
                }

                else if (_toggleAbility.IsAbilityEnabled() && !_toggleAbility.IsToggled && _meleeAbility.CanBeCasted(target) && _meleeAbility.CanHit(target))
                {
                    Log.Debug($"toggling so we can use melee axe");
                    _toggleAbility.ToggleAbility();
                    await Await.Delay(GetAbilityDelay(target, _toggleAbility), tk);

                    return;
                }

                if (_toggleAbility.IsAbilityEnabled() && target.HasModifier("modifier_troll_warlord_whirling_axes_slow") && !_toggleAbility.IsToggled &&
                    _toggleAbility.CanBeCasted())
                {
                    Log.Debug($"toggling so we can hit bashes");
                    _toggleAbility.ToggleAbility();
                    await Await.Delay(GetAbilityDelay(target, _toggleAbility), tk);

                    return;
                }

                if (_ultAbility.IsAbilityEnabled() && _ultAbility.CanBeCasted() && target.Distance2D(MyHero) <= 300)
                {
                    Log.Debug($"use ult");
                    _ultAbility.UseAbility();
                    await Await.Delay(100, tk);
                }
            }

            // make him disabled
            if (await DisableEnemy(target, tk) == DisabledState.UsedAbilityToDisable)
            {
                Log.Debug($"disabled!");
                // return;
            }

            await UseItems(target, tk);

            // check if we are near the enemy
            if (!await MoveOrBlinkToEnemy(target, tk))
            {
                Log.Debug($"return because of blink");
                return;
            }

            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
            }
        }
Exemple #9
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            var eulsModifier = target.FindModifier("modifier_eul_cyclone");

            if (eulsModifier == null && _ultAbility.CanBeCasted(target) && !MyHero.IsVisibleToEnemies ||
                eulsModifier != null && _ultAbility.CanBeCasted())
            {
                if (MyHero.IsInvisible() || eulsModifier != null)
                {
                    // Log.Debug($"using invis ult on enemy");
                    var distance = target.Distance2D(MyHero);
                    if (_ultAbility.IsInAbilityPhase)
                    {
                        if (distance > 400)
                        {
                            Log.Debug($"stopping ult since enemy too far!");
                            MyHero.Stop();
                            await Await.Delay(100, tk);
                        }
                        else
                        {
                            Log.Debug($"dist{distance}");
                            return;
                        }
                    }
                    if (distance > 50)
                    {
                        Log.Debug($"approaching target {distance}");
                        MyHero.Move(target.NetworkPosition);
                    }
                    else if (eulsModifier == null || eulsModifier.RemainingTime < _ultAbility.FindCastPoint())
                    {
                        Log.Debug($"{_ultAbility.IsInAbilityPhase}");
                        if (!MyHero.IsSilenced() && !_ultAbility.IsInAbilityPhase)
                        {
                            Log.Debug($"using ult on {target.Name}");
                            _ultAbility.UseAbility();
                            await Await.Delay(250, tk);
                        }
                    }
                    return;
                }
                else
                {
                    var shadowBlade = MyHero.GetItemById(ItemId.item_invis_sword) ??
                                      MyHero.GetItemById(ItemId.item_silver_edge);
                    var distance = MyHero.Distance2D(target);
                    if (shadowBlade != null && shadowBlade.CanBeCasted() && distance < 6000)
                    {
                        Log.Debug($"using invis");
                        shadowBlade.UseAbility();
                        await Await.Delay(500, tk);

                        return;
                    }
                }
            }

            var euls = MyHero.GetItemById(ItemId.item_cyclone);

            if (euls != null && euls.CanBeCasted(target) && _ultAbility.CanBeCasted(target))
            {
                if (euls.CanHit(target))
                {
                    Log.Debug($"using euls to disable enemy before stun");
                    euls.UseAbility(target);
                    await Await.Delay(125, tk);

                    return;
                }
                // check if we are near the enemy
                if (!await MoveOrBlinkToEnemy(target, tk, minimumRange: 0.1f, maximumRange: euls.GetCastRange()))
                {
                    Log.Debug($"return because of blink and euls ready");
                    return;
                }
            }


            await HasNoLinkens(target, tk);
            await UseItems(target, tk);

            if (!MyHero.IsSilenced())
            {
                foreach (var razeAbility in _razeAbilities)
                {
                    await UseRazeOnTarget(target, razeAbility);
                }
            }

            // make him disabled
            if (await DisableEnemy(target, tk) == DisabledState.UsedAbilityToDisable)
            {
                Log.Debug($"disabled!");
                // return;
            }

            // check if we are near the enemy
            if (!await MoveOrBlinkToEnemy(target, tk))
            {
                Log.Debug($"return because of blink");
                return;
            }


            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Exemple #10
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            if (MyHero.HasModifier("modifier_spirit_breaker_charge_of_darkness"))
            {
                if (!MyHero.IsInvisible())
                {
                    var shadowBlade = MyHero.GetItemById(ItemId.item_invis_sword) ??
                                      MyHero.GetItemById(ItemId.item_silver_edge);
                    var distance = MyHero.Distance2D(target);
                    if (shadowBlade != null && shadowBlade.IsAbilityEnabled() && shadowBlade.CanBeCasted() && !MyHero.IsVisibleToEnemies &&
                        distance > 1200 && distance < 6000)
                    {
                        Log.Debug($"using invis");
                        shadowBlade.UseAbility();
                        var fadeTime = shadowBlade.GetAbilityData("windwalk_fade_time") * 2 * 1000; // 0.3
                        await Await.Delay((int)fadeTime, tk);
                    }
                }
                return;
            }
            // check if we are near the enemy
            if (!await MoveOrBlinkToEnemy(target, tk))
            {
                if (!MyHero.IsSilenced() && _chargeAbility.IsAbilityEnabled() && _chargeAbility.CanBeCasted())
                {
                    Log.Debug($"charging enemy since too far");
                    _chargeAbility.UseAbility(target);
                    await Await.Delay(GetAbilityDelay(target, _chargeAbility) + 250, tk);
                }

                return;
            }
            await HasNoLinkens(target, tk);
            await UseItems(target, tk);

            // make him disabled
            if (await DisableEnemy(target, tk, _ultAbility.CanBeCasted(target) ? GetAbilityDelay(target, _ultAbility) : 0) ==
                DisabledState.UsedAbilityToDisable)
            {
                Log.Debug($"disabled enemy");
                //return;
            }

            var armlet = MyHero.GetItemById(ItemId.item_armlet);

            if (armlet != null && armlet.IsAbilityEnabled() && !armlet.IsToggled)
            {
                Log.Debug($"toggling armlet");
                armlet.ToggleAbility();
            }

            if (!MyHero.IsSilenced() && _ultAbility.IsAbilityEnabled() && _ultAbility.CanBeCasted() && _ultAbility.CanHit(target))
            {
                Log.Debug($"using ult on target");
                _ultAbility.UseAbility(target);
                await Await.Delay(GetAbilityDelay(target, _ultAbility), tk);
            }

            var mask = MyHero.GetItemById(ItemId.item_mask_of_madness);

            if (mask != null && mask.IsAbilityEnabled() && mask.CanBeCasted() && _ultAbility.Cooldown > 0)
            {
                Log.Debug($"using mask");
                mask.UseAbility();
            }

            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
            }
        }
Exemple #11
0
Fichier : Lion.cs Projet : Mej0/a
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            await UseItems(target, tk);

            if (_ultAbility.IsAbilityEnabled() && !MyHero.IsSilenced() && _ultAbility.CanBeCasted(target) && _ultAbility.CanHit(target) &&
                await HasNoLinkens(target, tk))
            {
                var damage =
                    _ultAbility.GetAbilityData(MyHero.HasItem(ItemId.item_ultimate_scepter)
                        ? "damage_scepter"
                        : "damage");
                if (target.Health <= damage * (1.0f - target.MagicResistance()))
                {
                    Log.Debug(
                        $"use ult because enough damage {target.Health} <= {damage * (1.0f - target.MagicResistance())} ");
                    _ultAbility.UseAbility(target);
                    await Await.Delay(GetAbilityDelay(target, _ultAbility), tk);
                }
            }

            // make him disabled
            if (await DisableEnemy(target, tk) == DisabledState.UsedAbilityToDisable)
            {
                Log.Debug($"disabled!");
                // return;
            }
            float maxRange = 500;

            if (!MyHero.IsSilenced())
            {
                float duration;
                if (!(target.IsHexed(out duration) || target.IsStunned(out duration)) || duration < 1.2)
                {
                    maxRange = Math.Max(maxRange, _hexAbility.CastRange);
                    if (_hexAbility.IsAbilityEnabled() && _hexAbility.CanBeCasted(target))
                    {
                        if (_hexAbility.CanHit(target))
                        {
                            Log.Debug($"use hex {duration}");
                            _hexAbility.UseAbility(target);
                            await Await.Delay(GetAbilityDelay(target, _hexAbility), tk);

                            return;
                        }
                        if (!await MoveOrBlinkToEnemy(target, tk, minimumRange: 250, maximumRange: _hexAbility.GetCastRange()))
                        {
                            Log.Debug($"return because of blink and hex ready");
                            return;
                        }
                    }

                    maxRange = Math.Max(maxRange, _stunAbility.CastRange);
                    if (_stunAbility.IsAbilityEnabled() && _stunAbility.CanBeCasted(target))
                    {
                        if (_stunAbility.CanHit(target))
                        {
                            var castPoint = _stunAbility.FindCastPoint();
                            var speed     = _stunAbility.GetAbilityData("speed");
                            var time      = (castPoint + target.Distance2D(MyHero) / speed) * 1000.0f;

                            var predictedPos = Prediction.Prediction.PredictPosition(target, (int)time);
                            if (MyHero.Distance2D(predictedPos) <= _stunAbility.GetCastRange())
                            {
                                Log.Debug($"use stun {duration} | {time}");
                                _stunAbility.UseAbility(predictedPos);
                                await Await.Delay(GetAbilityDelay(predictedPos, _stunAbility), tk);

                                return;
                            }
                        }
                        else
                        {
                            if (!await MoveOrBlinkToEnemy(target, tk, minimumRange: 250, maximumRange: _stunAbility.GetCastRange()))
                            {
                                Log.Debug($"return because of blink and stun ready");
                                return;
                            }
                        }
                    }
                }

                if (_ultAbility.IsAbilityEnabled() && _ultAbility.CanBeCasted(target) && _ultAbility.CanHit(target) && await HasNoLinkens(target, tk))
                {
                    if (target.IsHexed() || target.IsStunned() ||
                        (float)target.Health / target.MaximumHealth * (1.0f + target.MagicResistance()) < 0.5f)
                    {
                        Log.Debug($"use ult");
                        _ultAbility.UseAbility(target);
                        await Await.Delay(GetAbilityDelay(target, _ultAbility), tk);
                    }
                }

                if (_manaAbility.IsAbilityEnabled() && _manaAbility.CanBeCasted())
                {
                    var illusion =
                        ObjectManager.GetEntitiesFast <Unit>()
                        .FirstOrDefault(
                            x =>
                            x.IsAlive && x.IsIllusion && x.Team != MyHero.Team &&
                            x.Distance2D(MyHero) <= _manaAbility.CastRange);
                    if (illusion != null)
                    {
                        Log.Debug($"use mana leech on illusion");
                        _manaAbility.UseAbility(illusion);
                        await Await.Delay(GetAbilityDelay(illusion, _manaAbility), tk);
                    }
                }
            }

            // check if we are near the enemy
            if (!await MoveOrBlinkToEnemy(target, tk, minimumRange: 200, maximumRange: maxRange))
            {
                Log.Debug($"return because of blink");
                return;
            }

            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
            }
        }
Exemple #12
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            var myHeroNetworkPosition = this.MyHero.NetworkPosition;

            if (!await MoveOrBlinkToEnemy(target, tk, 480, 480))
            {
                if (!this.MyHero.IsSilenced() && this.MyHero.Distance2D(target) >= 480 && this.MyHero.Distance2D(target) <= maxYards)
                {
                    var pos = (target.NetworkPosition - myHeroNetworkPosition).Normalized();
                    pos *= 100;
                    pos  = target.NetworkPosition + pos;
                    float mana = MyHero.MaximumMana;

                    if (this._ultAbility.IsAbilityEnabled())
                    {
                        if (target.IsMoving)
                        {
                            Log.Debug($"Jumping the gun");
                            var    moves        = C**k.InFront(target, 300);
                            double consumedMana = (_ultAbility.GetAbilityData("ball_lightning_initial_mana_base") + ((_ultAbility.GetAbilityData("ball_lightning_initial_mana_percentage") / 100) * mana))
                                                  + ((MyHero.Distance2D(moves) / 100) * (((_ultAbility.GetAbilityData("ball_lightning_travel_cost_percent") / 100) * mana)));

                            Log.Debug($"{consumedMana}");

                            if (consumedMana <= MyHero.Mana && (MyHero.Mana - consumedMana >= minMana))
                            {
                                this._ultAbility.UseAbility(moves);
                                await Await.Delay((int)((_ultAbility.FindCastPoint() + MyHero.GetTurnTime(moves)) * 2250 + Game.Ping), tk);

                                MyHero.Attack(target);
                                Await.Block("zaioAutoAttack", StormAuto);
                            }
                        }

                        else
                        {
                            Log.Debug($"Jumping close but far");
                            double consumedMana = (_ultAbility.GetAbilityData("ball_lightning_initial_mana_base") + ((_ultAbility.GetAbilityData("ball_lightning_initial_mana_percentage") / 100) * mana))
                                                  + ((MyHero.Distance2D(pos) / 100) * (((_ultAbility.GetAbilityData("ball_lightning_travel_cost_percent") / 100) * mana)));
                            Log.Debug($"{consumedMana} {(MyHero.Distance2D(pos) / 100)}");
                            if (consumedMana <= MyHero.Mana && (MyHero.Mana - consumedMana >= minMana))
                            {
                                this._ultAbility.UseAbility(pos);
                                Log.Debug($"{(int)((_ultAbility.FindCastPoint() + MyHero.GetTurnTime(pos)) * 2250 + Game.Ping)}");
                                await Await.Delay((int)((_ultAbility.FindCastPoint() + MyHero.GetTurnTime(pos)) * 2250 + Game.Ping), tk);

                                MyHero.Attack(target);
                                Await.Block("zaioAutoAttack", StormAuto);
                            }
                        }
                    }
                }
                Log.Debug($"return because of blink");
                return;
            }



            await this.HasNoLinkens(target, tk);

            await this.UseItems(target, tk);

            await this.DisableEnemy(target, tk);

            if (!MyHero.IsSilenced())
            {
                bool  hasAgha = MyHero.HasItem(ClassId.CDOTA_Item_UltimateScepter);
                float qCost   = _qAbility.GetAbilityData("Mana cost");
                float wCost   = _wAbility.GetAbilityData("Mana cost");
                float myMana  = MyHero.Mana;
                float mana    = MyHero.MaximumMana;
                var   pos     = (target.NetworkPosition - myHeroNetworkPosition).Normalized();
                pos *= 100;
                pos  = target.NetworkPosition + pos;
                double consumedMana = (_ultAbility.GetAbilityData("ball_lightning_initial_mana_base") + ((_ultAbility.GetAbilityData("ball_lightning_initial_mana_percentage") / 100) * mana))
                                      + ((MyHero.Distance2D(pos) / 100) * (((_ultAbility.GetAbilityData("ball_lightning_travel_cost_percent") / 100) * mana)));

                if (_qAbility.IsAbilityEnabled() && _qAbility.CanBeCasted() &&
                    _wAbility.IsAbilityEnabled() && _wAbility.CanBeCasted() &&
                    (qCost + wCost) <= myMana && !this.MyHero.HasModifier("modifier_storm_spirit_overload") &&
                    !target.HasModifier("modifier_item_lotus_orb_active"))
                {
                    if (!hasAgha)
                    {
                        this._wAbility.UseAbility(target);
                        await Await.Delay(GetAbilityDelay(_wAbility), tk);

                        MyHero.Attack(target);
                        await Await.Delay(500);
                    }

                    else
                    {
                        this._wAbility.UseAbility();
                        await Await.Delay(GetAbilityDelay(_wAbility), tk);

                        MyHero.Attack(target);
                        await Await.Delay(500);
                    }
                }

                if (_qAbility.IsAbilityEnabled() && _qAbility.CanBeCasted() && !this.MyHero.HasModifier("modifier_storm_spirit_overload") &&
                    ((!_wAbility.CanBeCasted() && (MyHero.Mana <= _qAbility.GetAbilityData("Mana cost") + consumedMana)) || MyHero.Distance2D(target) <= _qAbility.GetAbilityData("static_remnant_radius")))
                {
                    this._qAbility.UseAbility();
                    await Await.Delay(GetAbilityDelay(_qAbility), tk);

                    MyHero.Attack(target);
                    await Await.Delay(500);
                }

                if (_ultAbility.IsAbilityEnabled() && (!_qAbility.CanBeCasted() || this.MyHero.Distance2D(target) >= _qAbility.GetAbilityData("static_remnant_radius")) && (!_wAbility.CanBeCasted(target) || MyHero.Distance2D(target) >= _wAbility.GetAbilityData("Cast range")) &&
                    this.MyHero.Distance2D(target) <= maxYards && !this.MyHero.HasModifier("modifier_storm_spirit_overload"))
                {
                    this._ultAbility.UseAbility(pos);
                    await Await.Delay(GetAbilityDelay(_ultAbility), tk);

                    MyHero.Attack(target);
                    await Await.Delay(500);
                }

                if (this.MyHero.HasModifier("modifier_storm_spirit_overload"))
                {
                    MyHero.Attack(target);
                    await Await.Delay(500);
                }
            }

            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
            }
        }
Exemple #13
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            if (!MyHero.HasModifier("modifier_nyx_assassin_vendetta") && !MyHero.IsSilenced())
            {
                var manaNeeded = _stunAbility.CanBeCasted(target) ? _stunAbility.ManaCost + 100 : 0;
                if (manaNeeded <= MyHero.Mana)
                {
                    await HasNoLinkens(target, tk);
                    await UseItems(target, tk);

                    // make him disabled
                    if (await DisableEnemy(target, tk) == DisabledState.UsedAbilityToDisable)
                    {
                        Log.Debug($"disabled!");
                        // return;
                    }
                }
                if (_stunAbility.CanBeCasted(target) && _stunAbility.CanHit(target))
                {
                    var castPoint = _stunAbility.FindCastPoint();
                    var speed     = _stunAbility.GetAbilityData("speed");
                    var time      = (castPoint + target.Distance2D(MyHero) / speed) * 1000.0f;

                    var predictedPos = Prediction.Prediction.PredictPosition(target, (int)time);
                    if (MyHero.Distance2D(predictedPos) <= _stunAbility.GetCastRange())
                    {
                        _stunAbility.UseAbility(predictedPos);

                        Log.Debug($"Use stun");
                        await Await.Delay(GetAbilityDelay(predictedPos, _stunAbility), tk);
                    }
                }

                Log.Debug($"Use manaburn {_manaBurnAbility.CanBeCasted(target)} | {_manaBurnAbility.CanHit(target)}");
                if (_manaBurnAbility.CanBeCasted(target) && target.Mana > 100 && _manaBurnAbility.CanHit(target))
                {
                    _manaBurnAbility.UseAbility(target);
                    Log.Debug($"Use manaburn");
                    await Await.Delay(GetAbilityDelay(target, _manaBurnAbility), tk);
                }
            }

            // check if we are near the enemy

            if (!await MoveOrBlinkToEnemy(target, tk))
            {
                if (!MyHero.IsSilenced() && _ultAbility.CanBeCasted() &&
                    !MyHero.HasModifier("modifier_nyx_assassin_vendetta"))
                {
                    Log.Debug($"going invis boys since too far");
                    _ultAbility.UseAbility();
                    await Await.Delay(125, tk);
                }
                Log.Debug($"move or blink");
                return;
            }

            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }