コード例 #1
0
        protected override async Task KillStealAsync(CancellationToken token)
        {
            if (Game.IsPaused || !this.Owner.IsAlive || !AbilityExtensions.CanBeCasted(this.Blast))
            {
                await Task.Delay(125, token);

                return;
            }

            var damageBlast = Blast.GetAbilitySpecialData("blast_damage");

            damageBlast *= Ensage.SDK.Extensions.UnitExtensions.GetSpellAmplification(this.Owner);

            bool comboMana = Blast.GetManaCost(Blast.Level - 1) + Decrepify.GetManaCost(Decrepify.Level - 1) <
                             Owner.Mana;

            var decrepifyKillable =
                EntityManager <Hero> .Entities.FirstOrDefault(
                    x =>
                    x.IsAlive && x.Team != this.Owner.Team && !x.IsIllusion &&
                    x.Health < damageBlast *(1 - x.MagicDamageResist) &&
                    Blast != null && Blast.IsValid && x.Distance2D(this.Owner) <= 900 &&
                    Ensage.Common.Extensions.AbilityExtensions.CanBeCasted(Decrepify, x) && Ensage.Common.Extensions.AbilityExtensions.CanBeCasted(Blast, x) &&
                    !UnitExtensions.IsMagicImmune(x) && comboMana);

            var blastKillable =
                EntityManager <Hero> .Entities.FirstOrDefault(
                    x =>
                    x.IsAlive && x.Team != this.Owner.Team && !x.IsIllusion &&
                    x.Health < damageBlast *(1 - x.MagicDamageResist) &&
                    Ensage.Common.Extensions.AbilityExtensions.CanBeCasted(Blast, x) && !UnitExtensions.IsMagicImmune(x) && Blast.CanHit(x) &&
                    Ensage.SDK.Extensions.EntityExtensions.Distance2D(Owner, x.NetworkPosition) <= 800);

            if (!UnitExtensions.IsChanneling(this.Owner))
            {
                if (decrepifyKillable != null)
                {
                    if (Decrepify.UseAbility(decrepifyKillable))
                    {
                        await this.AwaitKillstealDelay((int)AbilityExtensions.GetCastDelay(this.Decrepify, this.Owner, decrepifyKillable, true), token); // decrepify
                    }

                    if (Blast.CanHit(decrepifyKillable))
                    {
                        if (Blast.UseAbility(decrepifyKillable))
                        {
                            await this.AwaitKillstealDelay((int)AbilityExtensions.GetCastDelay(this.Blast, this.Owner, decrepifyKillable, true), token);
                        }
                    }
                }

                if (blastKillable != null)
                {
                    if (Blast.UseAbility(blastKillable.NetworkPosition))
                    {
                        await this.AwaitKillstealDelay((int)AbilityExtensions.GetCastDelay(this.Blast, this.Owner, blastKillable, true), token);
                    }
                }
            }
        }
コード例 #2
0
        protected override async Task KillStealAsync(CancellationToken token)
        {
            if (Game.IsPaused || !this.Owner.IsAlive || !AbilityExtensions.CanBeCasted(this.SpectralDagger))
            {
                await Task.Delay(125, token);

                return;
            }

            var killstealTarget = EntityManager <Hero> .Entities.FirstOrDefault(
                x => x.IsAlive && x.Team != this.Owner.Team && AbilityExtensions.CanBeCasted(this.SpectralDagger) &&
                AbilityExtensions.CanHit(this.SpectralDagger, x) &&
                !x.IsIllusion &&
                x.Health < SpectralDaggerDamage(this.SpectralDagger.Level - 1, x));

            var hauntIllusions = EntityManager <Unit> .Entities.Where(x => x.Name == this.Owner.Name && x.IsAlive && x.IsIllusion && !x.IsInvulnerable() &&
                                                                      x.IsAlly(this.Owner) && x.HasModifier("modifier_spectre_haunt")).ToList();

            if (killstealTarget != null)
            {
                if (hauntIllusions.Count != 0)
                {
                    if (Reality.UseAbility(killstealTarget.NetworkPosition))
                    {
                        var castDelay = AbilityExtensions.GetCastDelay(this.Reality, this.Owner, killstealTarget);
                        await this.AwaitKillstealDelay((int)castDelay + 20, token);
                    }
                }
                else if (AbilityExtensions.CanBeCasted(this.Haunt) && KillstealWithUlti && this.Owner.Distance2D(killstealTarget) > this.SpectralDagger.CastRange)
                {
                    if (this.Haunt.UseAbility())
                    {
                        var castDelay = AbilityExtensions.GetCastDelay(this.Haunt, this.Owner, killstealTarget);
                        await this.AwaitKillstealDelay((int)castDelay + 20, token);

                        this.Reality.UseAbility(killstealTarget.NetworkPosition);
                    }
                }

                if (killstealTarget.Distance2D(this.Owner) <= this.SpectralDagger.CastRange)
                {
                    if (this.SpectralDagger.UseAbility(killstealTarget))
                    {
                        var castDelay = AbilityExtensions.GetCastDelay(this.SpectralDagger, this.Owner, killstealTarget);
                        await this.AwaitKillstealDelay((int)castDelay, token);
                    }
                }
            }

            await Task.Delay(125, token);
        }
コード例 #3
0
ファイル: GrimstrokeCombo.cs プロジェクト: beminee/BAIO
        public override async Task ExecuteAsync(CancellationToken token)
        {
            if (!await ShouldExecute(token))
            {
                return;
            }

            var SoF = Grimstroke.StrokeOfFate;
            var Dp  = Grimstroke.DarkPortrait;

            if (SoF != null)
            {
                MaxTargetRange = SofCastRange;
            }

            if (this.CurrentTarget == null || !this.CurrentTarget.IsVisible)
            {
                Grimstroke.Context.Orbwalker.Active.OrbwalkTo(null);
                return;
            }

            if (this.CurrentTarget.IsIllusion)
            {
                OrbwalkToTarget();
                return;
            }

            var linkens = this.CurrentTarget.IsLinkensProtected();

            await BreakLinken(token);

            var phantom = Grimstroke.PhantomsEmbrace;
            var ink     = Grimstroke.InkSwell;
            var ult     = Grimstroke.Soulbind;

            var targetDistance = Owner.Distance2D(this.CurrentTarget);
            var Delay          = 1.33f; // https://dota2.gamepedia.com/Grimstroke

            var SoFSpeed = Grimstroke.StrokeOfFate.Speed;

            var castUlti = this.CurrentTarget.GetAlliesInRange <Hero>(ult.Ability.GetAbilitySpecialData("chain_latch_radius")).Count() >= 1;

            if (ult != null && AbilityExtensions.CanBeCasted(ult, this.CurrentTarget) && castUlti)
            {
                var ultModifier   = "modifier_grimstroke_soul_chain";
                var canCastMyShit = this.CurrentTarget.HasModifier(ultModifier);
                if (this.Owner.Distance2D(this.CurrentTarget) < ult.CastRange)
                {
                    this.Grimstroke.Soulbind.UseAbility(this.CurrentTarget);
                    await Task.Delay((int)AbilityExtensions.GetCastDelay(ult, this.Owner, this.CurrentTarget), token);
                }

                if (Dp != null && AbilityExtensions.CanBeCasted(Dp, this.CurrentTarget) && !linkens && canCastMyShit &&
                    this.Grimstroke.PortraitToggler.Value.IsEnabled(CurrentTarget.Name) &&
                    this.Owner.Distance2D(this.CurrentTarget) <= Dp.CastRange)
                {
                    this.Grimstroke.DarkPortrait.UseAbility(this.CurrentTarget);
                    await Task.Delay((int)AbilityExtensions.GetCastDelay(Dp, this.Owner, this.CurrentTarget), token);
                }

                if (phantom != null && AbilityExtensions.CanBeCasted(phantom, this.CurrentTarget) && !linkens && canCastMyShit &&
                    this.Owner.Distance2D(this.CurrentTarget) <= phantom.CastRange)
                {
                    this.Grimstroke.PhantomsEmbrace.UseAbility(this.CurrentTarget);
                    await Task.Delay((int)AbilityExtensions.GetCastDelay(phantom, this.Owner, this.CurrentTarget), token);
                }

                var heroWithMostBesideHim = EntityManager <Hero> .Entities.Where(a =>
                                                                                 a != null && a.Team == this.Owner.Team && a.GetEnemiesInRange <Hero>(InkSwellRadius).Count() >= 1).FirstOrDefault();

                if (ink != null && AbilityExtensions.CanBeCasted(ink) && heroWithMostBesideHim != null &&
                    this.Owner.Distance2D(heroWithMostBesideHim) <= ink.CastRange)
                {
                    this.Grimstroke.InkSwell.UseAbility(heroWithMostBesideHim);
                    await Task.Delay((int)AbilityExtensions.GetCastDelay(ink, this.Owner, heroWithMostBesideHim), token);
                }

                var bloodthorn = this.Grimstroke.BloodThorn;
                if (bloodthorn != null && bloodthorn.CanBeCasted && canCastMyShit && bloodthorn.CanHit(CurrentTarget) && !linkens)
                {
                    bloodthorn.UseAbility(this.CurrentTarget);
                    await Task.Delay(bloodthorn.GetCastDelay(), token);
                }

                var orchid = this.Grimstroke.Orchid;
                if (orchid != null && orchid.CanBeCasted && canCastMyShit && orchid.CanHit(CurrentTarget) && !linkens)
                {
                    orchid.UseAbility(this.CurrentTarget);
                    await Task.Delay(orchid.GetCastDelay(), token);
                }

                var ethereal = this.Grimstroke.EtherealBlade;
                if (ethereal != null && ethereal.CanBeCasted && canCastMyShit && ethereal.CanHit(CurrentTarget) && !linkens)
                {
                    ethereal.UseAbility(this.CurrentTarget);
                    await Task.Delay(ethereal.GetCastDelay(), token);
                }

                var dagon = Grimstroke.Dagon;
                if (dagon != null && !linkens && !this.CurrentTarget.IsIllusion && dagon.CanBeCasted && canCastMyShit &&
                    dagon.CanHit(this.CurrentTarget))
                {
                    dagon.UseAbility(this.CurrentTarget);
                    await Task.Delay(dagon.GetCastDelay(), token);
                }

                var sheepStick = this.Grimstroke.Sheepstick;
                if (sheepStick != null && sheepStick.CanBeCasted && sheepStick.CanHit(CurrentTarget) && !linkens && canCastMyShit)
                {
                    sheepStick.UseAbility(this.CurrentTarget);
                    await Task.Delay(sheepStick.GetCastDelay(), token);
                }

                var mjollnir = Grimstroke.Mjollnir;
                if (mjollnir != null && mjollnir.CanBeCasted)
                {
                    mjollnir.UseAbility(Owner);
                    await Task.Delay(mjollnir.GetCastDelay(), token);
                }

                var diffusal = Grimstroke.DiffusalBlade;
                if (diffusal != null && !linkens && !this.CurrentTarget.IsIllusion && diffusal.CanBeCasted &&
                    diffusal.CanHit(this.CurrentTarget) && canCastMyShit)
                {
                    diffusal.UseAbility(CurrentTarget);
                    await Task.Delay(diffusal.GetCastDelay(), token);
                }

                var nullfier = Grimstroke.Nullifier;
                if (nullfier != null && !linkens && !this.CurrentTarget.IsIllusion && nullfier.CanBeCasted &&
                    nullfier.CanHit(this.CurrentTarget) && canCastMyShit)
                {
                    nullfier.UseAbility(this.CurrentTarget);
                    await Task.Delay(nullfier.GetCastDelay(this.CurrentTarget), token);
                }
            }
            else
            {
                if (phantom != null && AbilityExtensions.CanBeCasted(phantom, this.CurrentTarget) && !linkens &&
                    this.Owner.Distance2D(this.CurrentTarget) <= phantom.CastRange)
                {
                    this.Grimstroke.PhantomsEmbrace.UseAbility(this.CurrentTarget);
                    await Task.Delay((int)AbilityExtensions.GetCastDelay(phantom, this.Owner, this.CurrentTarget), token);
                }

                if (Dp != null && AbilityExtensions.CanBeCasted(Dp, this.CurrentTarget) && !linkens &&
                    this.Owner.Distance2D(this.CurrentTarget) <= Dp.CastRange &&
                    this.Grimstroke.PortraitToggler.Value.IsEnabled(CurrentTarget.Name))
                {
                    this.Grimstroke.DarkPortrait.UseAbility(this.CurrentTarget);
                    await Task.Delay((int)AbilityExtensions.GetCastDelay(Dp, this.Owner, this.CurrentTarget), token);
                }

                var heroWithMostBesideHim = EntityManager <Hero> .Entities.Where(a =>
                                                                                 a != null && a.Team == this.Owner.Team && a.GetEnemiesInRange <Hero>(InkSwellRadius).Count() >= 1).FirstOrDefault();

                if (ink != null && AbilityExtensions.CanBeCasted(ink) && heroWithMostBesideHim != null &&
                    this.Owner.Distance2D(heroWithMostBesideHim) <= ink.CastRange)
                {
                    this.Grimstroke.InkSwell.UseAbility(heroWithMostBesideHim);
                    await Task.Delay((int)AbilityExtensions.GetCastDelay(ink, this.Owner, heroWithMostBesideHim), token);
                }

                var bloodthorn = this.Grimstroke.BloodThorn;
                if (bloodthorn != null && bloodthorn.CanBeCasted && bloodthorn.CanHit(CurrentTarget) && !linkens &&
                    this.Grimstroke.BloodthornOrchidHeroes.Value.IsEnabled(CurrentTarget.Name))
                {
                    bloodthorn.UseAbility(this.CurrentTarget);
                    await Task.Delay(bloodthorn.GetCastDelay(), token);
                }

                var orchid = this.Grimstroke.Orchid;
                if (orchid != null && orchid.CanBeCasted && orchid.CanHit(CurrentTarget) && !linkens &&
                    this.Grimstroke.BloodthornOrchidHeroes.Value.IsEnabled(CurrentTarget.Name))
                {
                    orchid.UseAbility(this.CurrentTarget);
                    await Task.Delay(orchid.GetCastDelay(), token);
                }

                var ethereal = this.Grimstroke.EtherealBlade;
                if (ethereal != null && ethereal.CanBeCasted && ethereal.CanHit(CurrentTarget) && !linkens)
                {
                    ethereal.UseAbility(this.CurrentTarget);
                    await Task.Delay(ethereal.GetCastDelay(), token);
                }

                var dagon = Grimstroke.Dagon;
                if (dagon != null && !linkens && !this.CurrentTarget.IsIllusion && dagon.CanBeCasted &&
                    dagon.CanHit(this.CurrentTarget))
                {
                    dagon.UseAbility(this.CurrentTarget);
                    await Task.Delay(dagon.GetCastDelay(), token);
                }

                var sheepStick = this.Grimstroke.Sheepstick;
                if (sheepStick != null && sheepStick.CanBeCasted && sheepStick.CanHit(CurrentTarget) && !linkens)
                {
                    sheepStick.UseAbility(this.CurrentTarget);
                    await Task.Delay(sheepStick.GetCastDelay(), token);
                }

                var mjollnir = Grimstroke.Mjollnir;
                if (mjollnir != null && mjollnir.CanBeCasted)
                {
                    mjollnir.UseAbility(Owner);
                    await Task.Delay(mjollnir.GetCastDelay(), token);
                }

                var diffusal = Grimstroke.DiffusalBlade;
                if (diffusal != null && !linkens && !this.CurrentTarget.IsIllusion && diffusal.CanBeCasted &&
                    diffusal.CanHit(this.CurrentTarget))
                {
                    diffusal.UseAbility(CurrentTarget);
                    await Task.Delay(diffusal.GetCastDelay(), token);
                }

                var nullfier = Grimstroke.Nullifier;
                if (nullfier != null && !linkens && !this.CurrentTarget.IsIllusion && nullfier.CanBeCasted &&
                    nullfier.CanHit(this.CurrentTarget) && this.Grimstroke.NullifierHeroes.Value.IsEnabled(CurrentTarget.Name))
                {
                    nullfier.UseAbility(this.CurrentTarget);
                    await Task.Delay(nullfier.GetCastDelay(this.CurrentTarget), token);
                }
            }

            if (SoF != null && AbilityExtensions.CanBeCasted(SoF) &&
                this.Owner.Distance2D(this.CurrentTarget) <= SofCastRange)
            {
                var sofInput  = Grimstroke.StrokeOfFate.GetPredictionInput(this.CurrentTarget);
                var sofOutput = Grimstroke.StrokeOfFate.GetPredictionOutput(sofInput);

                if (this.CanSofHit(sofOutput))
                {
                    this.sofPredictionPosition = sofOutput.CastPosition;
                    this.Grimstroke.StrokeOfFate.UseAbility(sofPredictionPosition);
                    await Task.Delay((int)Delay, token);
                }
            }

            this.OrbwalkToTarget();
        }
コード例 #4
0
        public override async Task ExecuteAsync(CancellationToken token)
        {
            if (!await this.ShouldExecute(token))
            {
                return;
            }

            var hauntIllusions = EntityManager <Unit> .Entities.Where(x => x.Name == this.Owner.Name && x.IsAlive && x.IsIllusion && !x.IsInvulnerable() &&
                                                                      x.IsAlly(this.Owner) && x.HasModifier("modifier_spectre_haunt"));

            MaxTargetRange = AbilityExtensions.CanBeCasted(this.Spectre.Haunt) ? float.MaxValue : 2000;

            if ((this.CurrentTarget == null) || !this.CurrentTarget.IsVisible)
            {
                this.Spectre.Context.Orbwalker.Active.OrbwalkTo(null);
                return;
            }

            if (this.CurrentTarget.IsIllusion)
            {
                this.OrbwalkToTarget();
                return;
            }

            try
            {
                var linkens = this.CurrentTarget.IsLinkensProtected();
                await BreakLinken(token);

                var spectraldagger = this.Spectre.SpectralDagger;
                if (AbilityExtensions.CanBeCasted(spectraldagger) && this.Owner.Distance2D(this.CurrentTarget) <= spectraldagger.CastRange)
                {
                    spectraldagger.UseAbility(this.CurrentTarget);
                    await Task.Delay(
                        (int)AbilityExtensions.GetCastDelay(spectraldagger, this.Owner, this.CurrentTarget), token);
                }

                var shadowstep = this.Spectre.ShadowStep;
                if (AbilityExtensions.CanBeCasted(shadowstep) &&
                    this.Owner.Distance2D(this.CurrentTarget) >= this.Spectre.MinimumUltiDistance.Value)
                {
                    shadowstep.UseAbility(this.CurrentTarget);
                    await Task.Delay((int)AbilityExtensions.GetCastDelay(shadowstep, this.Owner, this.CurrentTarget), token);

                    await Task.Delay(250, token);
                }

                var haunt = this.Spectre.Haunt;
                if (AbilityExtensions.CanBeCasted(haunt) && !AbilityExtensions.CanBeCasted(shadowstep) &&
                    !HauntIllusions.Any(x => x.Distance2D(this.CurrentTarget) <= 300) &&
                    this.Owner.Distance2D(this.CurrentTarget) >= this.Spectre.MinimumUltiDistance.Value)
                {
                    haunt.UseAbility();
                    await Task.Delay((int)AbilityExtensions.GetCastDelay(haunt, this.Owner, this.CurrentTarget), token);
                }

                var abyssal = this.Spectre.AbyssalBlade;
                if (abyssal != null && abyssal.CanBeCasted && abyssal.CanHit(CurrentTarget) && !linkens &&
                    this.Spectre.AbyssalBladeHeroes.Value.IsEnabled(CurrentTarget.Name))
                {
                    abyssal.UseAbility(CurrentTarget);
                    await Task.Delay(abyssal.GetCastDelay(), token);
                }

                var diff = this.Spectre.DiffusalBlade;
                if (diff != null && diff.CanBeCasted && diff.CanHit(CurrentTarget) && !linkens &&
                    this.Spectre.DiffusalHeroes.Value.IsEnabled(CurrentTarget.Name))
                {
                    diff.UseAbility(CurrentTarget);
                    await Task.Delay(diff.GetCastDelay(), token);
                }

                var urn = this.Spectre.Urn;
                if (urn != null && urn.CanBeCasted && urn.CanHit(CurrentTarget) && !linkens &&
                    urn.Item.CurrentCharges > 1)
                {
                    urn.UseAbility(CurrentTarget);
                    await Task.Delay(urn.GetCastDelay(), token);
                }

                var manta = this.Spectre.Manta;
                if (manta != null && manta.CanBeCasted && this.Owner.Distance2D(CurrentTarget) <= 200 &&
                    this.Spectre.MantaHeroes.Value.IsEnabled(CurrentTarget.Name))
                {
                    manta.UseAbility();
                    await Task.Delay(manta.GetCastDelay(), token);
                }

                var nullifier = this.Spectre.Nullifier;
                if (nullifier != null && nullifier.CanBeCasted && nullifier.CanHit(CurrentTarget) && !linkens &&
                    this.Spectre.NullifierHeroes.Value.IsEnabled(CurrentTarget.Name))
                {
                    nullifier.UseAbility(CurrentTarget);
                    await Task.Delay(nullifier.GetCastDelay(), token);
                }
            }
            catch (TaskCanceledException)
            {
                // ignore
            }
            catch (Exception e)
            {
                Log.Debug($"{e}");
            }
            this.OrbwalkToTarget();
        }