Ejemplo n.º 1
0
        public async Task <bool> CreateStone(Vector3 targetPos, CancellationToken arg)
        {
            var myPos         = Owner.NetworkPosition;
            var remnantCaller = Main.StoneCaller;

            if (IsAbilityEnable(remnantCaller) && AbilityExtensions.CanBeCasted(remnantCaller))
            {
                if (Main.Owner.IsMoving)
                {
                    Main.Owner.Stop();
                    await Task.Delay(1, arg);

                    myPos = Main.Owner.NetworkPosition;
                }
                var pos = (myPos - targetPos).Normalized();
                pos *= 100;
                pos  = myPos - pos;
                remnantCaller.UseAbility(pos);
                await Await.Delay(GetDelay, arg);

                Main.Owner.Stop(true);
                var extra = UnitExtensions.GetTurnTime(Owner, _target.NetworkPosition) * 1000;
                await Await.Delay((int)(GetDelay + extra), arg);

                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
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);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void OnOnIngameUpdate(EventArgs args)
        {
            Mode = OrbwalkingMode.Idle;

            if (Game.IsPaused || Game.IsChatOpen)
            {
                return;
            }
            if (Members.Menu.Item("Combo.key").GetValue <KeyBind>().Active)
            {
                Mode = OrbwalkingMode.Combo;
            }
            else if (Mode == OrbwalkingMode.Idle)
            {
                EffectManager.Remove("attackTarget" + Owner.Handle);
                return;
            }
            if (TurnEndTime > Game.RawGameTime)
            {
                return;
            }
            var target = GetTarget();

            if ((target == null || !CanAttack(target)) && CanMove())
            {
                if (Move(Game.MousePosition))
                {
                    return;
                }
            }

            if (target != null && CanAttack(target))
            {
                LastTarget = target;
                var meld = ObjectManager.LocalHero.GetAbilityById(AbilityId.templar_assassin_meld);
                if (AbilityExtensions.CanBeCasted(meld) && !_sleeper.Sleeping)
                {
                    meld.UseAbility();
                    _sleeper.Sleep(300);
                }
                Attack(target);
            }
            if (LastTarget != null && LastTarget.IsValid && LastTarget.IsAlive)
            {
                EffectManager.DrawRange(LastTarget, "attackTarget" + Owner.Handle, 60, Color.Red);
            }
            else
            {
                EffectManager.Remove("attackTarget" + Owner.Handle);
            }
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        public async Task <bool> CreateStoneOnTarget(Vector3 targetPos, CancellationToken arg)
        {
            var remnantCaller = Main.StoneCaller;

            if (AbilityExtensions.CanBeCasted(remnantCaller))
            {
                remnantCaller.UseAbility(targetPos);
                await Await.Delay(1, arg);

                Main.Owner.Stop();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 6
0
        private void OnPounce()
        {
            if (Pounce.Level <= 0)
            {
                return;
            }

            if (DrawPouncePosition == true)
            {
                var          pounceCastPos = UnitExtensions.InFront(Owner, PounceDistance + PounceRadius);
                var          red           = new Vector3(255, 0, 0);
                var          green         = new Vector3(0, 255, 0);
                const string file          = "materials/ensage_ui/particles/rectangle.vpcf";
                particle.AddOrUpdate(Owner, $"DrawLine_{1}", file, ParticleAttachment.AbsOrigin, RestartType.None, 1, this.Owner.InFront(0), 2, pounceCastPos,
                                     3, new Vector3(95, 100, 0), 4, red);

                var targets = EntityManager <Hero> .Entities.FirstOrDefault(
                    x => x.IsAlive && x.Team != this.Owner.Team &&
                    x.Distance2D(this.Owner) < 1500 && !x.IsIllusion);

                if (targets != null && AbilityExtensions.CanBeCasted(this.Pounce) && this.Pounce != null &&
                    !UnitExtensions.IsMagicImmune(targets) && !targets.IsInvulnerable())
                {
                    var vectorOfMovement = new Vector2((float)Math.Cos(targets.RotationRad) * targets.MovementSpeed, (float)Math.Sin(targets.RotationRad) * targets.MovementSpeed);
                    var hitPosition      = Intercepts(targets.Position, vectorOfMovement, this.Owner.Position, 933.33f);
                    var hitPosMod        = hitPosition + new Vector3(vectorOfMovement.X * (TimeToTurn(this.Owner, hitPosition)), vectorOfMovement.Y * (TimeToTurn(this.Owner, hitPosition)), 0);
                    var hitPosMod2       = hitPosition + new Vector3(vectorOfMovement.X * (TimeToTurn(this.Owner, hitPosMod)), vectorOfMovement.Y * (TimeToTurn(this.Owner, hitPosMod)), 0);

                    if (this.Owner.Distance2D(hitPosMod2) > ((PounceDistance + PounceRadius) + targets.HullRadius))
                    {
                        return;
                    }

                    if (IsFacing(this.Owner, targets))
                    {
                        particle.AddOrUpdate(Owner, $"DrawLine_{1}", file, ParticleAttachment.AbsOrigin, RestartType.None, 1, this.Owner.InFront(0), 2, pounceCastPos,
                                             3, new Vector3(95, 100, 0), 4, green);
                    }
                }
            }
            else
            {
                particle.Remove($"DrawLine_{1}");
            }
        }
Ejemplo n.º 7
0
        private void LowHP()
        {
            var Familiars =
                EntityManager <Unit> .Entities.Where(
                    x =>
                    x.IsValid &&
                    x.IsAlive &&
                    x.IsControllable &&
                    x.Team == Context.Owner.Team &&
                    x.Name.Contains("npc_dota_visage_familiar")).ToArray();

            foreach (var Familiar in Familiars)
            {
                var FamiliarsStoneForm = Familiar.GetAbilityById(AbilityId.visage_summon_familiars_stone_form);

                if (Familiar.Health * 100 / Familiar.MaximumHealth <= Config.FamiliarsLowHPItem.Value &&
                    AbilityExtensions.CanBeCasted(FamiliarsStoneForm))
                {
                    FamiliarsStoneForm.UseAbility();
                }
            }
        }
Ejemplo n.º 8
0
        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();
        }
Ejemplo n.º 9
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();
        }
Ejemplo n.º 10
0
        public override async Task ExecuteAsync(CancellationToken token)
        {
            if (_target == null || !_target.IsValid || !_target.IsAlive)
            {
                if (!Main.Context.TargetSelector.IsActive)
                {
                    Main.Context.TargetSelector.Activate();
                }
                _target = Main.Context.TargetSelector.Active.GetTargets().FirstOrDefault() as Hero;
                if (_target != null)
                {
                    Log.Info("target detected");
                    if (Main.Context.TargetSelector.IsActive)
                    {
                        Main.Context.TargetSelector.Deactivate();
                    }
                }
                else
                {
                    Log.Info("Cant find target");
                }
            }
            if (_target != null)
            {
                if (Owner.CanCastAbilities())
                {
                    var  grip     = Main.Grip;
                    var  roll     = Main.Boulder;
                    var  push     = Main.Smash;
                    var  ultimate = Main.Magnetize;
                    Unit stone    = null;
                    if (IsAbilityEnable(push) && AbilityExtensions.CanBeCasted(push) &&
                        AbilityExtensions.CanHit(push, _target))
                    {
                        stone = Main.StoneManager.FindStone(Owner.NetworkPosition, 160f);
                        if (stone == null)
                        {
                            /*var turnTime = UnitExtensions.GetTurnTime(Owner,
                             *  _target.NetworkPosition) * 1000 + Game.Ping;*/
                            await CreateStone(_target.NetworkPosition, token);

                            //Game.PrintMessage($"{turnTime}");
                            //await Await.Delay((int) turnTime, token);
                            //await Await.Delay(GetDelay, token);
                            stone = Main.StoneManager.FindStone(Owner.NetworkPosition, 160f);
                            Log.Info($"({GetDelay}) stone -> {stone != null}");
                        }
                        if (stone != null)
                        {
                            if (Main.Config.EnablePrediction)
                            {
                                if (!AbilityExtensions.CastSkillShot(push, _target))
                                {
                                    Log.Error("Smash can't be casted due cant hit with prediction");
                                    return;
                                }
                            }
                            else
                            {
                                push.UseAbility(_target.NetworkPosition);
                                Log.Info("Push");
                            }
                            await Await.Delay(GetDelay, token);
                        }
                    }

                    if (IsAbilityEnable(grip) && AbilityExtensions.CanBeCasted(grip) &&
                        AbilityExtensions.CanHit(grip, _target))
                    {
                        if (stone != null)
                        {
                            await StoneTracker(stone, token);

                            stone = Main.StoneManager.FindStone(_target.NetworkPosition, 180);
                            if (stone == null)
                            {
                                Log.Info("Stone == null (1)");
                                await CreateStone(_target.NetworkPosition, token);

                                stone = Main.StoneManager.FindStone(_target.NetworkPosition, 180);
                                Log.Info($"Stone -> {stone == null} (1)");
                            }
                            Log.Info("Grip");
                            grip.UseAbility(stone == null ? _target.NetworkPosition : stone.NetworkPosition);
                            await Await.Delay(GetDelay, token);
                        }
                        else
                        {
                            Log.Error("stone == null");
                            var created = await CreateStoneOnTarget(_target.NetworkPosition, token);

                            if (created)
                            {
                                grip.UseAbility(_target.NetworkPosition);
                                Log.Info("grip");
                            }
                            else
                            {
                                Log.Info("cant create new stone for grip");
                            }
                        }
                    }

                    if (IsAbilityEnable(roll) && AbilityExtensions.CanBeCasted(roll) &&
                        AbilityExtensions.CanHit(roll, _target))
                    {
                        if (stone == null)
                        {
                            if (!Main.StoneManager.AnyStoneInRange(Owner.NetworkPosition, 180))
                            {
                                await CreateStone(_target.NetworkPosition, token);

                                roll.UseAbility(_target.NetworkPosition);
                                Log.Info("new stone for rolling");
                            }
                        }
                        roll.UseAbility(_target.NetworkPosition);
                        Log.Info("roll");

                        await Await.Delay(GetDelay, token);
                    }

                    if (IsAbilityEnable(ultimate) && AbilityExtensions.CanBeCasted(ultimate) &&
                        AbilityExtensions.CanHit(ultimate, _target))
                    {
                        ultimate.UseAbility();
                        Log.Info("ultimate");
                        await Await.Delay(GetDelay, token);
                    }
                }
                if (UnitExtensions.CanUseItems(Owner))
                {
                    await UseItems(token);
                }
                if (_target.IsAttackImmune() || _target.IsInvulnerable())
                {
                    Orbwalker.Move(Game.MousePosition);
                }
                else
                {
                    Orbwalker.OrbwalkTo(_target);
                }
            }
            else
            {
                Orbwalker.Move(Game.MousePosition);
            }
        }
Ejemplo n.º 11
0
        public override async Task ExecuteAsync(CancellationToken token)
        {
            if (!await ShouldExecute(token))
            {
                return;
            }

            if (Owner.HasModifier(Juggernaut.Omnislash.ModifierName) && this.CurrentTarget.IsEthereal())
            {
                var nullifier = Juggernaut.Nullifier;
                if (nullifier != null && nullifier.CanBeCasted && nullifier.CanHit(this.CurrentTarget))
                {
                    nullifier.UseAbility(this.CurrentTarget);
                    await Task.Delay(nullifier.GetCastDelay(), token);
                }
                await Task.Delay(125, token);
            }

            var blink = Juggernaut.BlinkDagger;

            if (blink != null)
            {
                MaxTargetRange = blink.CastRange * 1.5f;
            }

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

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

            var isInvis = this.Owner.IsInvisible();

            var sBlade = this.Juggernaut.ShadowBlade;
            var sEdge  = this.Juggernaut.SilverEdge;

            if (!isInvis && sBlade?.CanBeCasted == true || sEdge?.CanBeCasted == true &&
                this.Owner.Distance2D(this.CurrentTarget) < 2000 &&
                this.Juggernaut.InvisHeroes.Value.IsEnabled(CurrentTarget.Name))
            {
                sBlade?.UseAbility();
                sEdge?.UseAbility();
            }


            if (isInvis && this.CurrentTarget != null && this.Owner.CanAttack() &&
                this.CurrentTarget.Distance2D(this.Owner) <= this.Owner.AttackRange)
            {
                this.Owner.Attack(this.CurrentTarget);
                await Task.Delay((int)(UnitExtensions.AttackBackswing(this.Owner) + Game.Ping), token);
            }

            var linkens = this.CurrentTarget.IsLinkensProtected();

            await BreakLinken(token);

            var omni           = Juggernaut.Omnislash;
            var swift          = Juggernaut.SwiftSlash;
            var healthPercent  = Owner.HealthPercent();
            var targetDistance = Owner.Distance2D(this.CurrentTarget);
            var attackRange    = Owner.AttackRange(this.CurrentTarget);

            if (omni != null && !isInvis && !this.CurrentTarget.IsIllusion && omni.CanBeCasted &&
                omni.CanHit(this.CurrentTarget))
            {
                var useOmni = healthPercent < 0.15f;
                if (!useOmni)
                {
                    if (targetDistance > attackRange * 1.4f &&
                        Owner.MovementSpeed < this.CurrentTarget.MovementSpeed * 1.2f ||
                        this.CurrentTarget.Health > omni.GetTickDamage(this.CurrentTarget) && this.Juggernaut.OmniHeroes.Value.IsEnabled(this.CurrentTarget.Name))
                    {
                        var unitsClose = EntityManager <Unit> .Entities.Where(
                            x => x.IsVisible &&
                            x.IsAlive &&
                            x != this.CurrentTarget &&
                            Owner.IsEnemy(x) &&
                            (x.IsIllusion || !(x is Hero)) &&
                            !(x is Building) &&
                            x.IsRealUnit() &&
                            x.Distance2D(this.CurrentTarget) <= omni.Radius)
                                         .ToList();

                        var abilityLevel = omni.Ability.Level - 1;

                        if (unitsClose.Count > 0 && unitsClose.Count <= abilityLevel)
                        {
                            var close = unitsClose;
                            foreach (var unit in close)
                            {
                                var close1        = unitsClose;
                                var unitsInRadius = EntityManager <Unit> .Entities.Where(
                                    x => !close1.Contains(x) &&
                                    x.IsVisible &&
                                    x.IsAlive &&
                                    x != this.CurrentTarget &&
                                    Owner.IsEnemy(x) &&
                                    (x.IsIllusion || !(x is Hero)) &&
                                    !(x is Building) &&
                                    x.IsRealUnit() &&
                                    x.Distance2D(unit) < omni.Radius);

                                unitsClose = unitsClose.Concat(unitsInRadius).ToList();

                                if (unitsClose.Count > abilityLevel)
                                {
                                    break;
                                }
                            }
                        }

                        useOmni = unitsClose.Count <= abilityLevel;
                    }
                }

                if (useOmni)
                {
                    Unit omniTarget;
                    if (this.CurrentTarget.IsReflectingAbilities())
                    {
                        omniTarget = EntityManager <Unit>
                                     .Entities.Where(
                            x => x.IsVisible &&
                            x.IsAlive &&
                            Owner.IsEnemy(x) &&
                            !(x is Building) &&
                            x.IsRealUnit() &&
                            !x.IsReflectingAbilities() &&
                            x.Distance2D(Owner) < omni.CastRange)
                                     .OrderBy(x => x.Distance2D(this.CurrentTarget))
                                     .FirstOrDefault();
                    }
                    else
                    {
                        omniTarget = this.CurrentTarget;
                    }

                    if (omniTarget != null)
                    {
                        omni.UseAbility(omniTarget);
                        await Task.Delay(omni.GetCastDelay(omniTarget), token);
                    }
                }
            }

            if (swift != null && !isInvis && !this.CurrentTarget.IsIllusion && AbilityExtensions.CanBeCasted(swift) &&
                swift.CanHit(this.CurrentTarget) && !this.CurrentTarget.IsReflectingAbilities())
            {
                if (swift.UseAbility(this.CurrentTarget))
                {
                    await Task.Delay(omni.GetCastDelay(this.CurrentTarget), token);
                }
            }

            var bladeFury = Juggernaut.BladeFury;

            if (blink != null && !this.CurrentTarget.IsIllusion && blink.CanBeCasted &&
                blink.CanHit(this.CurrentTarget) && this.Juggernaut.BladeFuryOnCombo)
            {
                var useBlink = omni != null && omni.CanBeCasted && !omni.CanHit(this.CurrentTarget);
                if (!useBlink)
                {
                    if (targetDistance > 600)
                    {
                        var enemyCount = EntityManager <Hero> .Entities.Count(
                            x => x.IsAlive &&
                            x.IsVisible &&
                            x != this.CurrentTarget &&
                            Owner.IsEnemy(x) &&
                            !x.IsIllusion &&
                            x.Distance2D(this.CurrentTarget) < 800);

                        useBlink = enemyCount <= 1 || bladeFury != null && bladeFury.CanBeCasted;
                    }
                }

                if (useBlink)
                {
                    var blinkPos = this.CurrentTarget.IsMoving
                        ? this.CurrentTarget.InFront(75)
                        : this.CurrentTarget.Position;
                    blink.UseAbility(blinkPos);
                    await Task.Delay(blink.GetCastDelay(blinkPos), token);
                }
            }

            var mom      = this.Juggernaut.Mom;
            var cantCast = this.Owner.HasModifier(this.Juggernaut.Omnislash.ModifierName);

            if (mom != null && mom.CanBeCasted && cantCast)
            {
                mom.UseAbility();
                await Task.Delay(mom.GetCastDelay(), token);
            }

            var solarCrest = this.Juggernaut.SolarCrest;

            if (solarCrest != null && solarCrest.CanBeCasted && solarCrest.CanHit(this.CurrentTarget))
            {
                solarCrest.UseAbility(this.CurrentTarget);
                await Task.Delay(solarCrest.GetCastDelay(), token);
            }

            var bloodthorn = this.Juggernaut.BloodThorn;

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

            var orchid = this.Juggernaut.Orchid;

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

            var healingWard = Juggernaut.HealingWardAbility;

            if (healingWard != null && !isInvis && healingWard.CanBeCasted)
            {
                var recentDmgPercent = (float)Juggernaut.Owner.RecentDamage / Juggernaut.Owner.MaximumHealth;

                if (healthPercent < 0.35f || recentDmgPercent > 0.2)
                {
                    healingWard.UseAbility(Owner.Position);
                    await Task.Delay(healingWard.GetCastDelay(Owner.Position), token);
                }
            }

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

            var manta = Juggernaut.Manta;

            if (manta != null && manta.CanBeCasted && !isInvis &&
                (targetDistance < attackRange * 1.3f && Juggernaut.MantaHeroes.Value.IsEnabled(this.CurrentTarget.Name) ||
                 Owner.IsSilenced() || Owner.IsRooted()))
            {
                var isSilenced = Owner.IsSilenced();
                manta.UseAbility();
                await Task.Delay(manta.GetCastDelay(), token);

                if (isSilenced)
                {
                    return;
                }
            }

            var mjollnir = Juggernaut.Mjollnir;

            if (mjollnir != null && mjollnir.CanBeCasted && !isInvis && mjollnir.CanHit(this.CurrentTarget))
            {
                mjollnir.UseAbility(Owner);
                await Task.Delay(mjollnir.GetCastDelay(), token);
            }

            var diffusal = Juggernaut.DiffusalBlade;

            if (diffusal != null && !linkens && !this.CurrentTarget.IsIllusion && diffusal.CanBeCasted && !isInvis &&
                diffusal.CanHit(this.CurrentTarget) &&
                Juggernaut.DiffusalHeroes.Value.IsEnabled(this.CurrentTarget.Name))
            {
                diffusal.UseAbility(CurrentTarget);
                await Task.Delay(diffusal.GetCastDelay(), token);
            }

            var nullfier = Juggernaut.Nullifier;

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

            if (bladeFury != null && bladeFury.CanBeCasted && !isInvis && bladeFury.CanHit(CurrentTarget) && this.Juggernaut.BladeFuryOnCombo)
            {
                var enemyCount = EntityManager <Hero> .Entities.Count(
                    x => x.IsAlive &&
                    x.IsVisible &&
                    x != this.CurrentTarget &&
                    this.Owner.IsEnemy(x) &&
                    !x.IsIllusion &&
                    x.Distance2D(this.CurrentTarget) < 800);

                if (enemyCount > 1 ||
                    !this.CurrentTarget.IsIllusion &&
                    bladeFury.GetTickDamage(this.CurrentTarget) >
                    Owner.GetAttackDamage(this.CurrentTarget) * bladeFury.TickRate &&
                    bladeFury.GetTotalDamage(this.CurrentTarget) >= 0.5f * this.CurrentTarget.Health)
                {
                    bladeFury.UseAbility();
                    await Task.Delay(bladeFury.GetCastDelay(), token);
                }
            }

            if (this.Juggernaut.BladeFuryOnlyChase && this.Owner.HasModifier(bladeFury.ModifierName))
            {
                this.Owner.Move(this.CurrentTarget.InFront(20));
            }
            else
            {
                this.OrbwalkToTarget();
            }
        }
Ejemplo n.º 12
0
        private async Task ExecuteAsync(CancellationToken token)
        {
            try
            {
                if (Game.IsPaused)
                {
                    return;
                }

                Hero target = null;

                if (Config.FamiliarsLock)
                {
                    target = Config.FamiliarTarget;
                }
                else
                {
                    target = Config.Target;
                }

                foreach (var unit in Main.Updater.AllOtherUnits)
                {
                    var ability1 = unit.Ability;
                    var ability2 = unit.Ability2;
                    if (target != null)
                    {
                        if (!target.IsInvulnerable() && !target.IsAttackImmune() && !target.IsMagicImmune() &&
                            ((ability1 != null && AbilityExtensions.CanBeCasted(ability1)) || (ability2 != null && AbilityExtensions.CanBeCasted(ability2))))
                        {
                            //Main.Log.Debug($"null? {ability1 != null}");
                            //Main.Log.Debug($"CanBeCasted? {AbilityExtensions.CanBeCasted(ability1)}");
                            //Main.Log.Debug($"TargetTeamType? {ability1?.TargetTeamType.ToString()}");
                            //Main.Log.Debug($"Distance2D? {unit.Unit.Distance2D(target) <= ability1?.CastRange}");
                            //Main.Log.Debug($"cast range {AbilityExtensions.GetRadius(ability1)}");

                            //Main.Log.Debug($"AbilityBehavior? {ability1?.AbilityBehavior.ToString()}");
                            //Main.Log.Debug($"AbilityBehavior? {ability1?.AbilityBehavior == AbilityBehavior.UnitTarget}");

                            if (ability1 != null &&
                                AbilityExtensions.CanBeCasted(ability1) &&
                                AbilityExtensions.CanHit(ability1, target) &&
                                (ability1.TargetTeamType == TargetTeamType.Enemy ||
                                 ability1.TargetTeamType == TargetTeamType.None) &&
                                (unit.Unit.Distance2D(target) <= ability1.CastRange - 70 ||
                                 unit.Unit.Distance2D(target) <= AbilityExtensions.GetRadius(ability1) - 70))
                            {
                                if (ability1.AbilityBehavior.HasFlag(AbilityBehavior.NoTarget))
                                {
                                    ability1.UseAbility();
                                    await Task.Delay(250, token);
                                }
                                else if (ability1.AbilityBehavior.HasFlag(AbilityBehavior.UnitTarget))
                                {
                                    ability1.UseAbility(target);
                                    await Task.Delay(250, token);
                                }
                                else if (ability1.AbilityBehavior.HasFlag(AbilityBehavior.Point))
                                {
                                    ability1.UseAbility(target.Position);
                                    await Task.Delay(250, token);
                                }
                            }
                            else if (ability1 != null &&
                                     AbilityExtensions.CanBeCasted(ability1) &&
                                     ability1.TargetTeamType == TargetTeamType.Allied &&
                                     unit.Unit.Distance2D(this.Owner) <= ability1.CastRange)
                            {
                                ability1.UseAbility(this.Owner);
                                await Task.Delay(250, token);
                            }

                            if (ability2 != null &&
                                AbilityExtensions.CanBeCasted(ability2) &&
                                AbilityExtensions.CanHit(ability2, target) &&
                                (ability2.TargetTeamType == TargetTeamType.Enemy ||
                                 ability2.TargetTeamType == TargetTeamType.None) &&
                                (unit.Unit.Distance2D(target) <= ability2.CastRange - 70 ||
                                 unit.Unit.Distance2D(target) <= AbilityExtensions.GetRadius(ability2) - 70))
                            {
                                if (ability2.AbilityBehavior.HasFlag(AbilityBehavior.NoTarget))
                                {
                                    ability2.UseAbility();
                                    await Task.Delay(250, token);
                                }
                                else if (ability2.AbilityBehavior.HasFlag(AbilityBehavior.UnitTarget))
                                {
                                    ability2.UseAbility(target);
                                    await Task.Delay(250, token);
                                }
                                else if (ability2.AbilityBehavior.HasFlag(AbilityBehavior.Point))
                                {
                                    ability2.UseAbility(target.Position);
                                    await Task.Delay(250, token);
                                }
                            }
                            else if (ability2 != null &&
                                     AbilityExtensions.CanBeCasted(ability2) &&
                                     ability2.TargetTeamType == TargetTeamType.Allied &&
                                     unit.Unit.Distance2D(this.Owner) <= ability2.CastRange)
                            {
                                ability2.UseAbility(this.Owner);
                                await Task.Delay(250, token);
                            }
                            unit.FamiliarMovementManager.Move(target.InFront(50));
                        }

                        if (target.IsInvulnerable() || target.IsAttackImmune())
                        {
                            unit.FamiliarMovementManager.Orbwalk(null);
                        }

                        else if (target.IsMagicImmune() ||
                                 (!AbilityExtensions.CanBeCasted(ability1) || !AbilityExtensions.CanBeCasted(ability2)))
                        {
                            unit.FamiliarMovementManager.Orbwalk(target);
                        }
                    }
                    else
                    {
                        if (this.Config.FamiliarMenu.GetValue <bool>("Follow Mouse"))
                        {
                            unit.FamiliarMovementManager.Orbwalk(null);
                        }
                        else
                        {
                            unit.Unit.Follow(this.Owner);
                            await Task.Delay(350, token);
                        }
                    }
                }
            }
            catch (TaskCanceledException)
            {
                // ignore
            }
            catch (Exception e)
            {
                Main.Log.Error(e);
            }
        }
Ejemplo n.º 13
0
        public void Familiars(Hero Target)
        {
            var Familiars =
                EntityManager <Unit> .Entities.Where(
                    x =>
                    x.IsValid &&
                    x.IsAlive &&
                    x.IsControllable &&
                    x.Team == Context.Owner.Team &&
                    (x.Name.Contains("npc_dota_visage_familiar") ||
                     x.Name.Contains("npc_dota_necronomicon_warrior") ||
                     x.Name.Contains("npc_dota_necronomicon_archer"))).ToArray();

            foreach (var Familiar in Familiars)
            {
                if (Target != null)
                {
                    var StunDebuff         = Target.Modifiers.FirstOrDefault(x => x.IsStunDebuff);
                    var HexDebuff          = Target.Modifiers.FirstOrDefault(x => x.IsDebuff && x.Name == "modifier_sheepstick_debuff");
                    var FamiliarsStoneForm = Familiar.GetAbilityById(AbilityId.visage_summon_familiars_stone_form);
                    var ManaBurn           = Familiar.GetAbilityById(AbilityId.necronomicon_archer_mana_burn);

                    // FamiliarsStoneForm
                    if (FamiliarsStoneForm != null &&
                        Config.AbilityToggler.Value.IsEnabled(FamiliarsStoneForm.Name) &&
                        AbilityExtensions.CanBeCasted(FamiliarsStoneForm) &&
                        Familiar.Distance2D(Target) <= 100 &&
                        (StunDebuff == null || StunDebuff.RemainingTime <= 0.5) &&
                        (HexDebuff == null || HexDebuff.RemainingTime <= 0.5) &&
                        !FamiliarsSleeper.Sleeping)
                    {
                        FamiliarsStoneForm.UseAbility();
                        FamiliarsSleeper.Sleep(FamiliarsStoneForm.GetAbilitySpecialData("stun_duration") * 1000 - 200);
                    }

                    // Necronomicon Mana Burn
                    if (ManaBurn != null &&
                        AbilityExtensions.CanBeCasted(ManaBurn))
                    {
                        ManaBurn.UseAbility(Target);
                    }

                    if (Target == null || Target.IsAttackImmune() || Target.IsInvulnerable())
                    {
                        if (Utils.SleepCheck($"IsAttack{Familiar.Handle}"))
                        {
                            Familiar.Move(Target.Position);
                            Utils.Sleep(200, $"IsAttack{Familiar.Handle}");
                        }
                    }
                    else
                    if (Target != null &&
                        !AbilityExtensions.CanBeCasted(FamiliarsStoneForm) ||
                        ((StunDebuff != null && StunDebuff.RemainingTime >= 0.5) ||
                         (HexDebuff != null && HexDebuff.RemainingTime >= 0.5)))
                    {
                        Familiar.Attack(Target);
                    }
                    else if (Utils.SleepCheck($"Target{Familiar.Handle}"))
                    {
                        Familiar.Move(Target.Position);
                        Utils.Sleep(200, $"Target{Familiar.Handle}");
                    }
                }
                else if (Utils.SleepCheck($"Move{Familiar.Handle}"))
                {
                    Familiar.Move(Game.MousePosition);
                    Utils.Sleep(200, $"Move{Familiar.Handle}");
                }
            }
        }