Esempio n. 1
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);
            }
        }
Esempio n. 2
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            if (!MyHero.IsSilenced())
            {
                if (_daggerAbility.CanBeCasted(target) && _daggerAbility.CanHit(target))
                {
                    _daggerAbility.UseAbility(target);
                    Log.Debug($"using dagger!");
                    await Await.Delay(GetAbilityDelay(target, _daggerAbility), tk);
                }

                if (_blinkAbility.CanBeCasted(target) && _blinkAbility.CanHit(target))
                {
                    _blinkAbility.UseAbility(target);
                    Log.Debug($"using blink!");
                    await Await.Delay(GetAbilityDelay(target, _blinkAbility), 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();
                Log.Debug($"orbwalking");
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 3
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);
            }
        }
Esempio n. 4
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            await UseItems(target, tk);

            // make him disabled
            await DisableEnemy(target, tk);

            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
                Log.Debug($"orbwalking");
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 5
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            await HasNoLinkens(target, tk);
            await UseItems(target, tk);
            await DisableEnemy(target, tk);

            if (!MyHero.IsSilenced())
            {
                if (_wAbility.CanBeCasted(target) && _wAbility.CanHit(target))
                {
                    Log.Debug($"use Q");
                    _wAbility.UseAbility(target);
                    await Await.Delay(GetAbilityDelay(target, _qAbility), tk);
                }

                if (_qAbility.CanBeCasted(target) && _qAbility.CanHit(target))
                {
                    Log.Debug($"use Q");
                    _qAbility.UseAbility(target);
                    await Await.Delay(GetAbilityDelay(target, _qAbility), tk);
                }
            }


            // 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);
            }
        }
Esempio n. 6
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();
            }
        }
Esempio n. 7
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            await HasNoLinkens(target, tk);


            var eulsModifier = target.FindModifier("modifier_eul_cyclone");

            if ((_stunAbility.CanBeCasted(target) || eulsModifier != null && _stunAbility.CanBeCasted()) &&
                _stunAbility.CanHit(target))
            {
                var stunCastpoint = _stunAbility.FindCastPoint();
                var delay         = _stunAbility.GetAbilityData("delay");

                if (eulsModifier != null)
                {
                    Log.Debug($"has euls {eulsModifier.RemainingTime}");
                    if (!MyHero.IsSilenced() && eulsModifier.RemainingTime < stunCastpoint + delay)
                    {
                        Log.Debug($"using stun on cycloned target");
                        _stunAbility.UseAbility(target.NetworkPosition);
                        await Await.Delay(GetAbilityDelay(target, _stunAbility) + 250, tk);
                    }
                }
                else
                {
                    var disabled = 0.0f;
                    if (!MyHero.IsSilenced() && target.IsRooted(out disabled) || target.IsStunned(out disabled))
                    {
                        var time = disabled - stunCastpoint - delay;
                        if (time >= 0)
                        {
                            Log.Debug($"using stun on disabled target {time}");
                            _stunAbility.UseAbility(target.NetworkPosition);
                            await Await.Delay(GetAbilityDelay(target, _stunAbility) + 250, tk);
                        }
                        else
                        {
                            var predictedPos = Prediction.Prediction.PredictPosition(target, (int)time * -1000);

                            Log.Debug($"using stun on disabled target {time} with predicted pos {predictedPos}");
                            _stunAbility.UseAbility(predictedPos);
                            await Await.Delay(GetAbilityDelay(target, _stunAbility) + 250, tk);
                        }
                    }
                    else
                    {
                        var euls = MyHero.GetItemById(ItemId.item_cyclone);
                        if (euls != null && euls.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: 250, maximumRange: euls.GetCastRange()))
                            {
                                Log.Debug($"return because of blink and euls ready");
                                return;
                            }
                            Log.Debug($"ELSE");
                        }


                        var predictedPos = Prediction.Prediction.PredictPosition(target,
                                                                                 (int)((stunCastpoint + delay) * 1000), true);
                        if (!MyHero.IsSilenced() && predictedPos != Vector3.Zero)
                        {
                            Log.Debug($"using stun on target with predicted pos {predictedPos}");
                            _stunAbility.UseAbility(predictedPos);
                            await Await.Delay(GetAbilityDelay(target, _stunAbility) + 250, tk);
                        }
                        else
                        {
                            Log.Debug($"Not using stun due to enemy turning or silenced!");
                        }
                    }
                }
            }

            await UseItems(target, tk);

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

            if (!MyHero.IsSilenced())
            {
                if (!_ultAbility.IsToggled && _ultAbility.CanBeCasted(target) && _ultAbility.CanHit(target))
                {
                    Log.Debug($"using ult");
                    _ultAbility.ToggleAbility();
                    await Await.Delay((int)(_ultAbility.FindCastPoint() * 1000.0 + Game.Ping), tk);
                }

                if (_edictAbility.CanBeCasted(target) && _edictAbility.CanHit(target))
                {
                    Log.Debug($"using edict");
                    _edictAbility.UseAbility();
                    await Await.Delay((int)(_edictAbility.FindCastPoint() * 1000.0 + Game.Ping), tk);
                }

                if (_lightningAbility.CanBeCasted(target) && _lightningAbility.CanHit(target))
                {
                    Log.Debug($"using lightning");
                    _lightningAbility.UseAbility(target);
                    await Await.Delay(GetAbilityDelay(target, _lightningAbility), tk);
                }
            }

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

            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
                Log.Debug($"orbwalking");
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 8
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);
            }
        }
Esempio n. 9
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            if (MyHero.IsChanneling() || MyHero.HasModifier("modifier_pudge_dismember"))
            {
                if (!MyHero.IsSilenced() && _rotAbility.CanBeCasted(target) && !_rotAbility.IsToggled &&
                    _rotAbility.CanHit(target))
                {
                    _rotAbility.ToggleAbility();
                    await Await.Delay(100, tk);
                }
                return;
            }

            if (_hasHookModifier || target.HasModifier("modifier_pudge_meat_hook"))
            {
                if (!MyHero.IsSilenced() && _rotAbility.CanBeCasted() && !_rotAbility.IsToggled)
                {
                    _rotAbility.ToggleAbility();
                    await Await.Delay(ItemDelay, tk);
                }
                if (await HasNoLinkens(target, tk) && _ultAbility.CanBeCasted(target))
                {
                    if (!MyHero.IsSilenced() && _ultAbility.CanHit(target))
                    {
                        _ultAbility.UseAbility(target);
                        await Await.Delay(GetAbilityDelay(target, _ultAbility) + 250, tk);
                    }
                    else if (ShouldStopOnHook)
                    {
                        MyHero.Hold();
                    }
                }
                return;
            }

            if (!MyHero.IsSilenced())
            {
                if (_rotAbility.CanBeCasted(target) && !_rotAbility.IsToggled && _rotAbility.CanHit(target))
                {
                    _rotAbility.ToggleAbility();
                    await Await.Delay(100, tk);
                }

                if (_ultAbility.CanBeCasted(target) && _ultAbility.CanHit(target) && await HasNoLinkens(target, tk))
                {
                    if (_ultAbility.CanHit(target))
                    {
                        _ultAbility.UseAbility(target);
                        await Await.Delay(GetAbilityDelay(target, _ultAbility) + 250, tk);

                        return;
                    }
                }

                if (_hookAbility.CanBeCasted(target) && _hookAbility.CanHit(target))
                {
                    var speed  = _hookAbility.GetAbilityData("hook_speed");
                    var radius = _hookAbility.GetAbilityData("hook_width") * 2;


                    var time         = target.Distance2D(MyHero) / speed * 1000.0f;
                    var predictedPos = Prediction.Prediction.PredictPosition(target, (int)time, true);
                    if (predictedPos != Vector3.Zero)
                    {
                        var rec = new Geometry.Polygon.Rectangle(MyHero.NetworkPosition, predictedPos, radius);

                        // test for enemies in range
                        var isUnitBlocking = ObjectManager.GetEntitiesParallel <Unit>()
                                             .Any(
                            x =>
                            x.IsValid && x != target && x.IsAlive && x != MyHero &&
                            x.IsSpawned && x.IsRealUnit() && !x.IsIllusion &&
                            x.Distance2D(target) >= radius &&
                            rec.IsInside(x.NetworkPosition));
                        if (!isUnitBlocking)
                        {
                            Log.Debug($"using hook");
                            _hookAbility.UseAbility(predictedPos);
                            await Await.Delay(GetAbilityDelay(predictedPos, _hookAbility), tk);

                            return;
                        }
                        if (ShouldCircleHook)
                        {
                            //MyHero.Hold();
                            var dir       = (Game.MousePosition - target.NetworkPosition).Normalized();
                            var distance  = (target.NetworkPosition - MyHero.NetworkPosition).Length();
                            var targetPos = target.NetworkPosition + dir * distance;
                            MyHero.Move(Prediction.Prediction.PredictMyRoute(MyHero, 500, targetPos).Last());
                            return;
                        }
                    }
                }
            }

            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);
            }
        }
Esempio n. 10
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            if (!MyHero.IsSilenced())
            {
                if (_silenceAbility.CanBeCasted(target) && _silenceAbility.CanHit(target))
                {
                    Log.Debug($"use e");
                    _silenceAbility.UseAbility(target);
                    await Await.Delay(GetAbilityDelay(target, _silenceAbility), tk);
                }
                if (_slowAbility.CanBeCasted(target) && _slowAbility.CanHit(target))
                {
                    Log.Debug($"use W");
                    _slowAbility.UseAbility();
                    await Await.Delay(100, tk);
                }
            }

            // check if we are near the enemy
            if (!await MoveOrBlinkToEnemy(target, tk, minimumRange: 200, maximumRange: 700))
            {
                return;
            }
            await HasNoLinkens(target, tk);
            await UseItems(target, tk);
            await DisableEnemy(target, tk);

            if (!MyHero.IsSilenced())
            {
                if (_qAbility.CanBeCasted(target) && _qAbility.CanHit(target))
                {
                    Log.Debug($"use Q");
                    _qAbility.UseAbility(target);
                    await Await.Delay(GetAbilityDelay(target, _qAbility), tk);
                }
                if (_silenceAbility.CanBeCasted(target) && _silenceAbility.CanHit(target))
                {
                    Log.Debug($"use e");
                    _silenceAbility.UseAbility(target);
                    await Await.Delay(GetAbilityDelay(target, _silenceAbility), tk);
                }

                if (_ultAbility.CanBeCasted(target) && _ultAbility.CanHit(target) &&
                    (target.IsRooted() || target.MovementSpeed < 200 || !target.IsMoving))
                {
                    Log.Debug($"use ult {target.IsRooted()} | {target.IsMoving} | {target.MovementSpeed}");
                    var castPoint = (float)_ultAbility.FindCastPoint();
                    var pos       = Prediction.Prediction.PredictPosition(target, (int)(castPoint * target.MovementSpeed));
                    _ultAbility.UseAbility(pos);
                    await Await.Delay(GetAbilityDelay(pos, _ultAbility), tk);
                }
            }

            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 11
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            _ultAbility = MyHero.Spellbook.SpellR;
            if (!MyHero.IsSilenced() && _ultAbility.CanBeCasted(target) && _ultAbility.CanHit(target) &&
                await HasNoLinkens(target, tk))
            {
                var threshold =
                    _ultAbility.GetAbilityData(MyHero.HasItem(ClassID.CDOTA_Item_UltimateScepter)
                        ? "kill_threshold_scepter"
                        : "kill_threshold");
                if (target.Health < threshold)
                {
                    Log.Debug($"using ult {target.Health} < {threshold}");
                    _ultAbility.UseAbility(target);
                    await Await.Delay(GetAbilityDelay(target, _ultAbility), 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;
            }

            _callAbility = MyHero.Spellbook.SpellQ;
            if (!MyHero.IsSilenced() && _callAbility.CanBeCasted(target))
            {
                var delay  = _callAbility.FindCastPoint() * 1000 + Game.Ping;
                var radius = _callAbility.GetAbilityData("radius");
                if (Prediction.Prediction.PredictPosition(target, (int)delay).Distance2D(MyHero) <= radius)
                {
                    var bladeMail = MyHero.GetItemById(ItemId.item_blade_mail);
                    if (bladeMail != null && bladeMail.CanBeCasted())
                    {
                        Log.Debug($"using blademail before call");
                        bladeMail.UseAbility();
                        await Await.Delay(ItemDelay, tk);
                    }

                    var lotus = MyHero.GetItemById(ItemId.item_lotus_orb);
                    if (lotus != null && lotus.CanBeCasted())
                    {
                        Log.Debug($"using lotus orb before call");
                        lotus.UseAbility(MyHero);
                        await Await.Delay(ItemDelay, tk);
                    }

                    var mjollnir = MyHero.GetItemById(ItemId.item_mjollnir);
                    if (mjollnir != null && mjollnir.CanBeCasted())
                    {
                        Log.Debug($"using mjollnir before call");
                        mjollnir.UseAbility(MyHero);
                        await Await.Delay(ItemDelay, tk);
                    }
                    var useCall = true;
                    if (target.HasModifier("modifier_legion_commander_duel") || target.PhysicalResistance() == 1.0f)
                    {
                        useCall =
                            ObjectManager.GetEntitiesParallel <Hero>()
                            .Any(
                                x =>
                                x.IsValid && x.IsAlive && !x.IsIllusion && x.Team != MyHero.Team &&
                                x != target && x.Distance2D(MyHero) <= radius);
                    }
                    if (useCall)
                    {
                        Log.Debug($"using call");
                        _callAbility.UseAbility();
                        await Await.Delay((int)(_callAbility.FindCastPoint() * 1000.0 + Game.Ping), tk);
                    }
                }
            }

            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 12
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.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.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.IsToggled)
            {
                Log.Debug($"toggling armlet");
                armlet.ToggleAbility();
            }

            if (!MyHero.IsSilenced() && _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.CanBeCasted() && _ultAbility.Cooldown > 0)
            {
                Log.Debug($"using mask");
                mask.UseAbility();
            }

            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 13
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            await UseItems(target, tk);

            if (!MyHero.IsSilenced() && _ultAbility.CanBeCasted(target) && _ultAbility.CanHit(target) &&
                await HasNoLinkens(target, tk))
            {
                var damage =
                    _ultAbility.GetAbilityData(MyHero.HasItem(ClassID.CDOTA_Item_UltimateScepter)
                        ? "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)
                {
                    var hex = MyHero.Spellbook.SpellW;
                    maxRange = Math.Max(maxRange, hex.CastRange);
                    if (hex.CanBeCasted(target))
                    {
                        if (hex.CanHit(target))
                        {
                            Log.Debug($"use hex {duration}");
                            hex.UseAbility(target);
                            await Await.Delay(GetAbilityDelay(target, hex), tk);

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

                    maxRange = Math.Max(maxRange, _stunAbility.CastRange);
                    if (_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.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.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();
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 14
0
File: Tiny.cs Progetto: Mej0/a
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            await HasNoLinkens(target, tk);
            await UseItems(target, tk);

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

            var manta = MyHero.GetItemById(ItemId.item_manta);

            if (manta != null && manta.IsAbilityEnabled() && manta.CanBeCasted() && MyHero.IsSilenced())
            {
                Log.Debug($"use manta 1 because silenced");
                manta.UseAbility();
                await Await.Delay(125, tk);

                manta = null;
            }

            if (!MyHero.IsSilenced())
            {
                // test if toss/av combo is working
                if (_tossAbility.IsAbilityEnabled() && _tossAbility.CanBeCasted(target) && _tossAbility.CanHit(target))
                {
                    Log.Debug($"use toss");
                    var grab        = _tossAbility.GetAbilityData("grab_radius");
                    var closestUnit =
                        ObjectManager.GetEntitiesFast <Unit>()
                        .Where(
                            x =>
                            x != MyHero && x.IsAlive && x.Distance2D(MyHero) <= grab && x.IsRealUnit())
                        .OrderBy(x => x.Distance2D(MyHero))
                        .FirstOrDefault();
                    Log.Debug($"Closest unit for toss: {closestUnit?.Name}");
                    if (closestUnit == target)
                    {
                        _tossAbility.UseAbility(target);
                        Log.Debug($"use toss!!");
                        await Await.Delay(100, tk);
                    }
                }
                if (_avalancheAbility.IsAbilityEnabled() && _avalancheAbility.CanBeCasted(target) && _avalancheAbility.CanHit(target))
                {
                    Log.Debug($"use avalanche");
                    _avalancheAbility.UseAbility(target.NetworkPosition);
                    await Await.Delay(100, tk);
                }
            }

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

            if (manta != null && manta.IsAbilityEnabled() && manta.CanBeCasted())
            {
                Log.Debug($"Use manta");
                manta.UseAbility();
                await Await.Delay(250, tk);
            }

            var hasModifier = target.HasModifier("modifier_tiny_toss");

            if (ZaioMenu.ShouldUseOrbwalker && !hasModifier)
            {
                Orbwalk();
            }
            else if (hasModifier)
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 15
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            if (MyHero.HasModifier("modifier_legion_commander_duel"))
            {
                return;
            }
            // maybe got some pre damage
            if (!MyHero.IsSilenced() && _oddsAbility.CanBeCasted(target) && MyHero.Mana > 300 &&
                _oddsAbility.CanHit(target))
            {
                var radius  = _oddsAbility.GetAbilityData("radius");
                var targets =
                    ObjectManager.GetEntitiesParallel <Unit>()
                    .Where(
                        x =>
                        x.IsAlive && x.Team != MyHero.Team && x != target && !x.IsMagicImmune() &&
                        x.IsRealUnit() &&
                        x.Distance2D(target) <= radius);
                var heroes = targets.Where(x => x is Hero);
                if (heroes.Any() || targets.Count() >= 5)
                {
                    Log.Debug($"Using Q with {heroes.Count()} heroes and {targets.Count()} targets");

                    var predictedPos = Prediction.Prediction.PredictPosition(target,
                                                                             (int)(_oddsAbility.FindCastPoint() * 1000.0));
                    _oddsAbility.UseAbility(predictedPos);
                    await Await.Delay(GetAbilityDelay(target, _oddsAbility), tk);
                }
                else
                {
                    Log.Debug($"NOT using Q sionce only {heroes.Count()} heroes and {targets.Count()} targets");
                }
            }

            await UseItems(target, tk);

            // press the attack for teh damage
            if (IsInRange(_duelAbility.GetCastRange()))
            {
                var enemyHealth = (float)target.Health / target.MaximumHealth;
                if (!MyHero.IsSilenced() && !MyHero.HasModifier("modifier_press_the_attack") && enemyHealth > 0.33f)
                {
                    if (_pressTheAttackAbility.CanBeCasted())
                    {
                        _pressTheAttackAbility.UseAbility(MyHero);
                        await Await.Delay((int)(_pressTheAttackAbility.FindCastPoint() * 1000.0 + Game.Ping), tk);
                    }
                }
                var armlet = MyHero.GetItemById(ItemId.item_armlet);
                if (armlet != null && !armlet.IsToggled)
                {
                    Log.Debug($"toggling armlet");
                    armlet.ToggleAbility();
                }
            }
            // check if we are near the enemy
            if (!await MoveOrBlinkToEnemy(target, tk))
            {
                return;
            }
            // make him disabled
            if (await DisableEnemy(target, tk) == DisabledState.UsedAbilityToDisable)
            {
                Log.Debug($"disabled!");
                // return;
            }

            // test if ulti is good
            if (!MyHero.IsSilenced() && _duelAbility.CanBeCasted(target) && await HasNoLinkens(target, tk))
            {
                var bladeMail = MyHero.GetItemById(ItemId.item_blade_mail);
                if (bladeMail != null && bladeMail.CanBeCasted())
                {
                    Log.Debug($"using blademail");
                    bladeMail.UseAbility();
                    await Await.Delay(ItemDelay, tk);
                }

                var lotus = MyHero.GetItemById(ItemId.item_lotus_orb);
                if (lotus != null && lotus.CanBeCasted())
                {
                    Log.Debug($"using lotus orb before call");
                    lotus.UseAbility(MyHero);
                    await Await.Delay(ItemDelay, tk);
                }

                var mjollnir = MyHero.GetItemById(ItemId.item_mjollnir);
                if (mjollnir != null && mjollnir.CanBeCasted())
                {
                    Log.Debug($"using mjollnir before call");
                    mjollnir.UseAbility(MyHero);
                    await Await.Delay(ItemDelay, tk);
                }

                Log.Debug($"using duel");
                _duelAbility.UseAbility(target);
                await Await.Delay(GetAbilityDelay(target, _duelAbility), tk);

                return;
            }
            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 16
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            await HasNoLinkens(target, tk);

            if (!MyHero.IsSilenced())
            {
                var eulsModifier = target.FindModifier("modifier_eul_cyclone");
                if ((_stunAbility.CanBeCasted(target) || eulsModifier != null && _stunAbility.CanBeCasted()) &&
                    _stunAbility.CanHit(target))
                {
                    var stunCastpoint = _stunAbility.FindCastPoint();
                    var delay         = _stunAbility.GetAbilityData("path_delay");

                    if (eulsModifier != null)
                    {
                        Log.Debug($"has euls {eulsModifier.RemainingTime}");
                        if (eulsModifier.RemainingTime < stunCastpoint + delay)
                        {
                            Log.Debug($"using stun on cycloned target");
                            _stunAbility.UseAbility(target.NetworkPosition);
                            await Await.Delay(GetAbilityDelay(target, _stunAbility), tk);
                        }
                    }
                    else
                    {
                        var disabled = 0.0f;
                        if (target.IsRooted(out disabled) || target.IsStunned(out disabled))
                        {
                            var time = disabled - stunCastpoint - delay;
                            if (time >= 0)
                            {
                                Log.Debug($"using stun on disabled target {time}");
                                _stunAbility.UseAbility(target.NetworkPosition);
                                await Await.Delay(GetAbilityDelay(target, _stunAbility), tk);
                            }
                            else
                            {
                                var predictedPos = Prediction.Prediction.PredictPosition(target, (int)time * -1000);

                                Log.Debug($"using stun on disabled target {time} with predicted pos {predictedPos}");
                                _stunAbility.UseAbility(predictedPos);
                                await Await.Delay(GetAbilityDelay(target, _stunAbility), tk);
                            }
                        }
                        else
                        {
                            var euls = MyHero.GetItemById(ItemId.item_cyclone);
                            if (euls != null && euls.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: 250, maximumRange: euls.GetCastRange()))
                                {
                                    Log.Debug($"return because of blink");
                                    return;
                                }
                            }


                            var predictedPos = Prediction.Prediction.PredictPosition(target,
                                                                                     (int)((stunCastpoint + delay) * 1000));

                            Log.Debug($"using stun on target with predicted pos {predictedPos}");
                            _stunAbility.UseAbility(predictedPos);
                            await Await.Delay(GetAbilityDelay(target, _stunAbility), tk);
                        }
                    }
                }
            }

            await UseItems(target, tk);

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

            if (!MyHero.IsSilenced())
            {
                if (_ultAbility.CanBeCasted(target) && _ultAbility.CanHit(target))
                {
                    if (target.IsStunned() || target.IsRooted())
                    {
                        Log.Debug($"using ult because target is stunned");
                        _ultAbility.UseAbility(target.NetworkPosition);
                        await Await.Delay(GetAbilityDelay(target, _ultAbility) + 250, tk);
                    }
                    else
                    {
                        var predictedPos = Prediction.Prediction.PredictPosition(target,
                                                                                 (int)(_ultAbility.FindCastPoint() * 1000.0));
                        var radius = _ultAbility.GetAbilityData("path_radius");

                        var dir = predictedPos - MyHero.NetworkPosition;
                        dir.Normalize();
                        dir *=
                            _ultAbility.GetAbilityData(MyHero.HasItem(ClassID.CDOTA_Item_UltimateScepter)
                                ? "cast_range_scepter"
                                : "cast_range");

                        var rec = new Geometry.Polygon.Rectangle(MyHero.NetworkPosition, MyHero.NetworkPosition + dir,
                                                                 radius);
                        var hasMoreEnemies =
                            ObjectManager.GetEntitiesParallel <Hero>()
                            .Any(
                                x =>
                                x.IsValid && x != target && x.IsAlive && !x.IsMagicImmune() &&
                                x.Team != MyHero.Team && rec.IsInside(x.NetworkPosition));
                        if (hasMoreEnemies)
                        {
                            Log.Debug($"using ult because more enemies");
                            _ultAbility.UseAbility(predictedPos);
                            await Await.Delay(GetAbilityDelay(target, _ultAbility) + 250, tk);
                        }
                    }
                }

                if (_dualAbility.CanBeCasted(target) && _dualAbility.CanHit(target))
                {
                    Log.Debug($"using Q");
                    _dualAbility.UseAbility(target.NetworkPosition);
                    await Await.Delay(GetAbilityDelay(target, _dualAbility), tk);
                }

                if (_orbAbility.CanBeCasted(target) && _orbAbility.CanHit(target))
                {
                    Log.Debug($"using orb");
                    _orbAbility.UseAbility(target);
                    await Await.Delay(GetAbilityDelay(target, _orbAbility), tk);
                }
            }

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

            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
                Log.Debug($"orbwalking");
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 17
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            var ult = MyHero.Spellbook.SpellR;

            if (!MyHero.IsSilenced() && ult.CanBeCasted(target) && ult.CanHit(target))
            {
                var speed  = ult.GetAbilityData("speed");
                var radius = ult.GetAbilityData("latch_radius") * 2;


                var time         = target.Distance2D(MyHero) / speed * 1000.0f;
                var predictedPos = Prediction.Prediction.PredictPosition(target, (int)time, true);
                if (predictedPos != Vector3.Zero)
                {
                    var rec = new Geometry.Polygon.Rectangle(MyHero.NetworkPosition, predictedPos, radius);

                    // test for enemies in range
                    var isUnitBlocking = ObjectManager.GetEntitiesParallel <Unit>()
                                         .Any(
                        x =>
                        x.IsValid && x != target && x.IsAlive && x != MyHero &&
                        x.IsSpawned && x.IsRealUnit() &&
                        x.Distance2D(target) >= radius &&
                        rec.IsInside(x.NetworkPosition));
                    if (!isUnitBlocking)
                    {
                        Log.Debug($"use ult");
                        ult.UseAbility(predictedPos);
                        await Await.Delay(GetAbilityDelay(target, ult), tk);
                    }
                    else if (ShouldCircleHook)
                    {
                        //MyHero.Hold();
                        var dir       = (Game.MousePosition - target.NetworkPosition).Normalized();
                        var distance  = (target.NetworkPosition - MyHero.NetworkPosition).Length();
                        var targetPos = target.NetworkPosition + dir * distance;
                        MyHero.Move(Prediction.Prediction.PredictMyRoute(MyHero, 500, targetPos).Last());
                        return;
                    }
                }
            }

            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 (!MyHero.IsSilenced())
            {
                var cogs = MyHero.Spellbook.SpellW;
                if (cogs.CanBeCasted())
                {
                    var radius = cogs.GetAbilityData("cogs_radius");
                    if (target.Distance2D(MyHero) <= radius)
                    {
                        Log.Debug($"use cogs");
                        cogs.UseAbility();
                        await Await.Delay((int)(cogs.FindCastPoint() * 1000.0 + 125 + Game.Ping), tk);

                        var bladeMail = MyHero.GetItemById(ItemId.item_blade_mail);
                        if (bladeMail != null && bladeMail.CanBeCasted())
                        {
                            Log.Debug($"using blademail");
                            bladeMail.UseAbility();
                            await Await.Delay(ItemDelay, tk);
                        }
                    }
                }

                var q = MyHero.Spellbook.SpellQ;
                if (q.CanBeCasted(target))
                {
                    Log.Debug($"use Q");
                    q.UseAbility();
                    await Await.Delay((int)(q.FindCastPoint() * 1000.0 + Game.Ping), tk);
                }

                var flare = MyHero.Spellbook.SpellQ;
                if (flare.CanBeCasted(target))
                {
                    var speed = flare.GetAbilityData("speed");
                    var time  = target.Distance2D(MyHero) / speed * 1000.0f;

                    var predictedPos = Prediction.Prediction.PredictPosition(target, (int)time);

                    Log.Debug($"use flare");
                    flare.UseAbility(predictedPos);
                    await Await.Delay(GetAbilityDelay(target, flare), tk);
                }
            }

            await HasNoLinkens(target, tk);

            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 18
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            // overpower for teh damage
            if (IsInRange(MyHero.AttackRange) && !MyHero.HasModifier("modifier_ursa_overpower"))
            {
                if (!MyHero.IsSilenced() && _overpowerAbility.CanBeCasted())
                {
                    _overpowerAbility.UseAbility();
                    await Await.Delay((int)(_overpowerAbility.FindCastPoint() * 1000.0 + 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;
            }
            if (!(target.IsHexed() || target.IsStunned()) && !target.IsMagicImmune())
            {
                var healthPercentage = (float)target.Health / target.MaximumHealth;
                if (healthPercentage > 0.5)
                {
                    if (!MyHero.IsSilenced() && _earthshockAbility.CanBeCasted(target) &&
                        _earthshockAbility.CanHit(target))
                    {
                        _earthshockAbility.UseAbility();
                        await Await.Delay((int)(_earthshockAbility.FindCastPoint() * 1000.0 + Game.Ping), tk);
                    }
                }
            }
            // check if we are near the enemy
            if (!await MoveOrBlinkToEnemy(target, tk))
            {
                return;
            }
            // test if ulti is good
            if (_ultAbility.CanBeCasted())
            {
                var enemies =
                    ObjectManager.GetEntitiesFast <Hero>()
                    .Where(
                        x =>
                        x.IsAlive && x.Team != MyHero.Team && x != target &&
                        x.Distance2D(MyHero) < 600);
                bool?hasEnemies = enemies.Any();
                if (MyHero.IsStunned() || hasEnemies == true || (float)MyHero.Health / MyHero.MaximumHealth <= 0.25f)
                {
                    _ultAbility.UseAbility();
                    await Await.Delay(125, tk);
                }
            }

            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 19
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            if (
                MyHero.HasModifiers(new[]
            {
                "modifier_ember_spirit_sleight_of_fist_caster",
                "modifier_ember_spirit_fire_remnant"
            }, false))
            {
                Log.Debug($"in sleight mode");
                if (!MyHero.IsSilenced() && _stunAbility.CanBeCasted(target) && _stunAbility.CanHit(target) &&
                    !target.IsMagicImmune())
                {
                    Log.Debug($"use our Q because we are using W or ult and are near the target!");
                    _stunAbility.UseAbility();
                    await Await.Delay(125, tk);
                }
                return;
            }
            await HasNoLinkens(target, tk);
            await UseItems(target, tk);

            // make him disabled
            if (await DisableEnemy(target, tk) == DisabledState.UsedAbilityToDisable)
            {
                Log.Debug($"disabled!");
                // return;
            }
            if (!MyHero.IsSilenced())
            {
                _sleightAbility = MyHero.GetAbilityById(AbilityId.ember_spirit_sleight_of_fist);
                if (_sleightAbility.CanBeCasted(target) && _sleightAbility.CanHit(target))
                {
                    Log.Debug($"using sleigth");
                    _sleightAbility.UseAbility(target.NetworkPosition);
                    await Await.Delay(1, tk);

                    return;
                }

                if (_stunAbility.CanBeCasted(target) && _stunAbility.CanHit(target))
                {
                    Log.Debug($"use our Q");
                    _stunAbility.UseAbility();
                    await Await.Delay(125, tk);
                }

                var distance = _ultAbility.CastRange;
                if (_shieldAbility.CanBeCasted())
                {
                    var hasEnemies = ObjectManager.GetEntitiesParallel <Hero>()
                                     .Any(
                        x =>
                        x.IsValid && x.IsAlive && x.Team != MyHero.Team &&
                        (_ultAbility.CanBeCasted() && x.Distance2D(MyHero) < distance ||
                         !_ultAbility.CanBeCasted() && x.Distance2D(MyHero) < 800));
                    if (hasEnemies)
                    {
                        _shieldAbility.UseAbility();
                        await Await.Delay(125, tk);
                    }
                }

                if (!IsInRange(MyHero.AttackRange * 2.0f) && !target.IsMagicImmune())
                {
                    if (_ultAbility.CanBeCasted() && _ultActivateAbility.CanBeCasted() &&
                        (MinimumRemnants == 0 || MinimumRemnants < CurrentRemnants))
                    {
                        var castPoint    = _ultAbility.FindCastPoint();
                        var speed        = MyHero.MovementSpeed * (_ultAbility.GetAbilityData("speed_multiplier") / 100);
                        var time         = (castPoint + target.Distance2D(MyHero) / speed) * 1000.0f;
                        var predictedPos = Prediction.Prediction.PredictPosition(target, (int)time);

                        // test if we already got a remnant near the enemy
                        var radius  = _ultAbility.GetAbilityData("radius");
                        var remnant = Remnants.FirstOrDefault(unit => unit.Distance2D(target) < radius);
                        if (remnant == null)
                        {
                            Log.Debug($"placing remnant first to approach!");
                            _ultAbility.UseAbility(predictedPos);
                            await Await.Delay((int)(time + Game.Ping), tk);
                        }
                        else
                        {
                            Log.Debug($"already got a remnant near the enemy PogChamp to approach!");
                        }
                        _ultActivateAbility.UseAbility(predictedPos);
                        await Await.Delay(100, tk);

                        return;
                    }
                }
            }

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

            if (!MyHero.IsSilenced())
            {
                if (_shieldAbility.CanBeCasted())
                {
                    _shieldAbility.UseAbility();
                    await Await.Delay(125, tk);
                }

                if (_ultAbility.CanBeCasted(target) && _ultActivateAbility.CanBeCasted() && _ultAbility.CanHit(target) &&
                    !target.IsMagicImmune() &&
                    (MinimumRemnants == 0 || MinimumRemnants < CurrentRemnants))
                {
                    var damage = _ultAbility.GetAbilityData("damage");
                    damage *= GetSpellAmp();
                    if (target.Health < damage * (1 - target.MagicResistance()))
                    {
                        var castPoint    = _ultAbility.FindCastPoint();
                        var speed        = MyHero.MovementSpeed * (_ultAbility.GetAbilityData("speed_multiplier") / 100);
                        var time         = (castPoint + target.Distance2D(MyHero) / speed) * 1000.0f;
                        var predictedPos = Prediction.Prediction.PredictPosition(target, (int)time);

                        // test if we already got a remnant near the enemy
                        var radius  = _ultAbility.GetAbilityData("radius");
                        var remnant = Remnants.FirstOrDefault(unit => unit.Distance2D(target) < radius);
                        if (remnant == null)
                        {
                            Log.Debug($"placing remnant first to kill!");
                            _ultAbility.UseAbility(predictedPos);
                            await Await.Delay((int)(time + Game.Ping), tk);
                        }
                        else
                        {
                            Log.Debug($"already got a remnant near the enemy PogChamp to kill!");
                        }
                        _ultActivateAbility.UseAbility(predictedPos);
                        await Await.Delay(1, tk);

                        return;
                    }
                }
            }
            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
                Log.Debug($"orbwalking");
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 20
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            if (!MyHero.IsSilenced())
            {
                if (_nukeAbility.CanBeCasted(target) && _nukeAbility.CanHit(target))
                {
                    _nukeAbility.UseAbility(target);
                    Log.Debug($"using lucent beam!");
                    await Await.Delay(GetAbilityDelay(target, _nukeAbility), tk);
                }

                if (_aoeAbility.CanBeCasted() && _aoeAbility.CanHit(target))
                {
                    var hasScepter = MyHero.HasItem(ClassID.CDOTA_Item_UltimateScepter);
                    var radius     = _aoeAbility.GetAbilityData("search_radius");

                    var enemiesNearCount =
                        ObjectManager.GetEntitiesParallel <Hero>()
                        .Count(
                            x =>
                            x.IsValid && x != target && x.IsAlive && x.Team != MyHero.Team &&
                            !x.IsIllusion && x.Distance2D(target) <= radius);
                    if (!hasScepter)
                    {
                        if (enemiesNearCount >= EnemyCountForUlt)
                        {
                            Log.Debug($"using ult since more enemies here");

                            _aoeAbility.UseAbility();
                            await Await.Delay((int)(_aoeAbility.FindCastPoint() * 1000.0 + Game.Ping), tk);
                        }
                    }
                    if (hasScepter)
                    {
                        if (enemiesNearCount >= EnemyCountForUlt)
                        {
                            Log.Debug($"using ult since more enemies here");
                            _aoeAbility.UseAbility(MyHero);
                            await Await.Delay((int)(_aoeAbility.FindCastPoint() * 1000.0 + Game.Ping), 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();
                    Log.Debug($"orbwalking");
                }
                else
                {
                    MyHero.Attack(target);
                    await Await.Delay(125, tk);
                }
            }
        }
Esempio n. 21
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.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.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 && _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 (_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.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 (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.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();
                Log.Debug($"orbwalking");
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 22
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.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.CanBeCasted())
                    {
                        _warcryAbility.UseAbility();
                        Log.Debug($"warcry used");
                        await Await.Delay(100, tk);
                    }

                    if (_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 && 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();
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 23
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);
            }
        }
Esempio n. 24
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            if (!MyHero.IsSilenced())
            {
                if (_ultAbility.CanBeCasted(target) && _ultAbility.CanHit(target) && !IsEnemyNear() &&
                    !MyHero.IsInvisible())
                {
                    var hasAgha = MyHero.HasItem(ClassID.CDOTA_Item_UltimateScepter);
                    if (hasAgha)
                    {
                        var critBonus = _ultAbility.GetAbilityData("scepter_crit_bonus"); // 280
                        var damage    = critBonus / 100.0f * (MyHero.MinimumDamage + MyHero.BonusDamage);

                        if (target.Health < damage * (1 - target.PhysicalResistance()) || target.IsStunned() ||
                            target.IsHexed())
                        {
                            Log.Debug(
                                $"use agha ult, damage {target.Health} <= {damage * (1 - target.PhysicalResistance())} ");
                            _ultAbility.UseAbility(target.NetworkPosition);
                            await Await.Delay(GetAbilityDelay(target, _ultAbility), tk);

                            return;
                        }
                    }
                    else if (!target.IsLinkensProtected() || target.MagicResistance() == 1.0f)
                    {
                        var damage = (float)_ultAbility.GetDamage(_ultAbility.Level - 1);
                        damage *= GetSpellAmp();

                        if (target.Health < damage * (1 - target.MagicResistance()) || target.IsStunned() ||
                            target.IsHexed())
                        {
                            Log.Debug(
                                $"use ult, damage {target.Health} <= {damage * (1 - target.MagicResistance())} ");
                            _ultAbility.UseAbility(target);
                            await Await.Delay(GetAbilityDelay(target, _ultAbility), tk);

                            return;
                        }
                    }
                }

                if (_shrapnelAbility.CanBeCasted(target) && _shrapnelAbility.CanHit(target))
                {
                    var castPoint = _shrapnelAbility.FindCastPoint() * 1000.0f;
                    var delay     = _shrapnelAbility.GetAbilityData("damage_delay") * 1000.0f;
                    var pos       = Prediction.Prediction.PredictPosition(target, (int)(castPoint + delay + Game.Ping));
                    if (!IsUnderShrapnel(pos))
                    {
                        _shrapnelInfo.Add(new ShrapnelInfo(pos, Game.RawGameTime));
                        _shrapnelAbility.UseAbility(pos);
                        Log.Debug($"using shrapnel!");
                        await Await.Delay(GetAbilityDelay(pos, _shrapnelAbility), 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();
                Log.Debug($"orbwalking");
            }
            else
            {
                MyHero.Attack(target);
                await Await.Delay(125, tk);
            }
        }
Esempio n. 25
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);
            }
        }
Esempio n. 26
0
        protected override async Task <bool> Killsteal()
        {
            if (await base.Killsteal())
            {
                return(true);
            }

            if (MyHero.IsSilenced())
            {
                return(false);
            }

            float _qAutoDamage = this._qAbility.GetAbilityData("static_remnant_damage") + this._eAbility.GetDamage(_eAbility.Level - 1);

            _qAutoDamage += (MyHero.MinimumDamage + MyHero.BonusDamage);
            _qAutoDamage *= GetSpellAmp();

            float _eAutoDamage = this._eAbility.GetDamage(_eAbility.Level - 1);

            _eAutoDamage += (MyHero.MinimumDamage + MyHero.BonusDamage);
            _eAutoDamage *= GetSpellAmp();

            var qAutokillableTar =
                ObjectManager.GetEntitiesParallel <Hero>()
                .FirstOrDefault(
                    x =>
                    x.IsAlive && x.Team != this.MyHero.Team && !x.IsIllusion &&
                    this._qAbility.CanBeCasted() && this._qAbility.CanHit(x) &&
                    x.Health < (_qAutoDamage * (1 - x.MagicResistance())) &&
                    !x.IsMagicImmune() && !x.CantBeKilled() && !x.CantBeAttacked() &&
                    x.Distance2D(this.MyHero) <= 235);

            var AutokillableTar =
                ObjectManager.GetEntitiesParallel <Hero>()
                .FirstOrDefault(
                    x =>
                    x.IsAlive && x.Team != this.MyHero.Team && !x.IsIllusion &&
                    x.Health < _eAutoDamage * (1 - x.MagicResistance()) &&
                    !x.IsMagicImmune() && !x.CantBeKilled() && !x.CantBeAttacked() &&
                    x.Distance2D(this.MyHero) <= 480);


            if (this.MyHero.HasModifier("modifier_storm_spirit_overload") && AutokillableTar != null)
            {
                MyHero.Attack(AutokillableTar);
                Await.Block("zaioAutoAttack", StormAuto);
            }

            if (this._qAbility.IsKillstealAbilityEnabled() && this._qAbility.CanBeCasted() && !MyHero.HasModifier("modifier_storm_spirit_overload"))
            {
                if (AutokillableTar != null && _qAbility.CanBeCasted())
                {
                    Log.Debug($"Killing with auto {MyHero.HasModifier("modifier_storm_spirit_overload")}");
                    _qAbility.UseAbility();
                    await Await.Delay(300);

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

                if (qAutokillableTar != null && _qAbility.CanBeCasted())
                {
                    Log.Debug($"Killing with q and auto");
                    _qAbility.UseAbility();
                    await Await.Delay(300);

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

            if (this._ultAbility.IsKillstealAbilityEnabled() && this._ultAbility.CanBeCasted() && !MyHero.HasModifier("modifier_storm_spirit_overload"))
            {
                if (AutokillableTar != null && _ultAbility.CanBeCasted() && !_qAbility.CanBeCasted())
                {
                    var moves = C**k.InFront(AutokillableTar, 100);
                    Log.Debug($"Killable with auto, q not available");
                    _ultAbility.UseAbility(moves);
                    await Await.Delay((int)((_ultAbility.FindCastPoint() + MyHero.GetTurnTime(moves)) * 2500 + Game.Ping));

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



            return(false);
        }
Esempio n. 27
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);
                }
            }
        }
Esempio n. 28
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            if (
                MyHero.HasModifiers(
                    new[] { "modifier_monkey_king_tree_dance_hidden", "modifier_monkey_king_tree_dance_activity" }, false))
            {
                if (MyHero.IsSilenced())
                {
                    return;
                }

                if (_springAbility.IsChanneling)
                {
                    if (_lastEPosition != Vector3.Zero)
                    {
                        var radius     = _springAbility.GetAbilityData("impact_radius");
                        var prediction = Prediction.Prediction.PredictPosition(target,
                                                                               (int)(1.5f * target.MovementSpeed));
                        var dist = prediction.Distance2D(_lastEPosition);
                        Log.Debug($"damage known pos: {GetEDamage(_springAbility, target)} with dist {dist}");
                        if (dist >= radius)
                        {
                            if (_springEarlyAbility.CanBeCasted())
                            {
                                _lastEPosition = Vector3.Zero;
                                _springEarlyAbility.UseAbility();
                                Log.Debug($"jumping early because enemy is escaping our target location!");
                                await Await.Delay(125, tk);
                            }
                        }
                    }
                    else
                    {
                        Log.Debug($"damage: {GetEDamage(_springAbility, target)}");
                    }
                }
                else if (_springAbility.CanBeCasted(target) && _springAbility.CanHit(target))
                {
                    var prop         = GetNeededEProp(_springAbility, target);
                    var castPoint    = _springAbility.FindCastPoint() * 1000;
                    var predictedPos = Prediction.Prediction.PredictPosition(target,
                                                                             (int)(castPoint + prop * _springAbility.ChannelTime() * 1000.0f));
                    _springAbility.UseAbility(predictedPos);
                    _lastEPosition = predictedPos;
                    Log.Debug($"Using E with prop {prop} to {predictedPos}");
                    await Await.Delay(GetAbilityDelay(predictedPos, _springAbility), tk);
                }

                return;
            }

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

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

            if (!MyHero.IsSilenced())
            {
                if (_stunAbility.CanBeCasted(target) && _stunAbility.CanHit(target))
                {
                    if (IsBuffed || GetQDamage(_stunAbility, target) > target.Health)
                    {
                        var castPoint    = _stunAbility.FindCastPoint() * 1000;
                        var predictedPos = Prediction.Prediction.PredictPosition(target, (int)castPoint);
                        _stunAbility.UseAbility(predictedPos);
                        await Await.Delay(GetAbilityDelay(predictedPos, _stunAbility), tk);
                    }
                }

                if (_ultAbility.CanBeCasted() && _ultAbility.CanHit(target))
                {
                    var radius           = _ultAbility.GetAbilityData("leadership_radius");
                    var enemiesNearCount =
                        ObjectManager.GetEntitiesParallel <Hero>()
                        .Count(
                            x =>
                            x.IsValid && x != target && x.IsAlive && x.Team != MyHero.Team &&
                            !x.IsIllusion && x.Distance2D(target) <= radius);
                    if (enemiesNearCount >= EnemyCountForUlt)
                    {
                        Log.Debug($"using ult since more enemies here");
                        _ultAbility.UseAbility(target.NetworkPosition);
                        await Await.Delay(GetAbilityDelay(target.NetworkPosition, _ultAbility), tk);
                    }
                }
            }

            // 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);
            }
        }