InFront() public static method

Returns vector in facing direction of given unit with given distance
public static InFront ( Unit unit, float distance ) : System.Vector3
unit Unit /// The unit. ///
distance float /// The distance. ///
return System.Vector3
示例#1
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();
            }
        }
示例#2
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);
        }