Example #1
0
        public static Vector3 MysticFlarePrediction(this MysticFlare mysticFlare, Unit target)
        {
            var dubleMysticFlare = false;
            var owner            = mysticFlare.Owner;

            if (mysticFlare.Owner.HasAghanimsScepter())
            {
                var localHero = EntityManager.LocalHero;
                dubleMysticFlare = EntityManager.GetEntities <Hero>().Count(x => !x.IsAlly(localHero) && !x.IsIllusion && x.IsVisible && x.IsAlive && x.Distance2D(target) <= 700) <= 1;
            }

            var input = new PredictionInput
            {
                Owner  = owner,
                Delay  = mysticFlare.CastPoint + mysticFlare.ActivationDelay,
                Range  = mysticFlare.CastRange,
                Radius = mysticFlare.Radius,
            };

            var output       = PredictionManager.GetPrediction(input.WithTarget(target));
            var castPosition = output.CastPosition;

            Vector3 position;

            if (target.NetworkActivity != NetworkActivity.Move || target.IsStunned() || target.IsRooted())
            {
                position = castPosition;
            }
            else
            {
                position = castPosition + (100 * target.Direction2D().ToVector3());
            }

            return(dubleMysticFlare ? castPosition + (175 * target.Direction2D().ToVector3()) : position);
        }
Example #2
0
        public Vector3 GetPrediction(Unit target)
        {
            var input = new PredictionInput
            {
                Owner = this.Owner,
                Range = 2000,
                Speed = this.Speed,
            };

            input = input.WithTarget(target);

            return(PredictionManager.GetPrediction(input).UnitPosition);
        }
Example #3
0
        public override bool UseAbility(Unit target)
        {
            if (!CanBeCasted() || target.IsMagicImmune())
            {
                return(false);
            }

            var rudePrediction = target.IsMoving ? target.InFront(target.Speed) : target.Position;

            float range = this.Range;
            float speed = this.Speed;

            bool willGetStoneBuff = (Owner.Spellbook.Spell4.CurrentCharges > 0 ||
                                     StoneExtensions.FirstUnitBetween(Owner.Position, rudePrediction, StoneExtensions.StoneName, 250, 400) != null);

            if (willGetStoneBuff)
            {
                range += 750;
                speed += 800;
            }

            if (range < Owner.Distance2D(target))
            {
                return(false);
            }

            var input = new PredictionInput
            {
                Delay  = Owner.TurnTime(rudePrediction) + 0.6f, // 0.6f is "cast point"
                Range  = range,
                Speed  = speed,
                Radius = this.Radius,
                Owner  = this.Owner
            };

            input = input.WithTarget(target);

            var predictionPoint = PredictionManager.GetPrediction(input).CastPosition;



            Base.Cast(predictionPoint);

            RollUsed?.Invoke(this, new RollUsedEventArgs(input, predictionPoint));

            return(true);
        }
Example #4
0
        public virtual PredictionInput GetPredictionInput(params Unit[] targets)
        {
            var input = new PredictionInput
            {
                Owner                   = Owner as Hero, // TODO
                AreaOfEffect            = HasAreaOfEffect,
                CollisionTypes          = CollisionTypes,
                Delay                   = CastPoint + ActivationDelay,
                Speed                   = Speed,
                Range                   = CastRange,
                Radius                  = Radius,
                PredictionSkillshotType = PredictionSkillshotType
            };

            if (HasAreaOfEffect)
            {
                input.AreaOfEffectTargets = targets;
            }

            return(input.WithTarget(targets.First()));
        }
Example #5
0
        public virtual PredictionInput GetPredictionInput(params Unit[] targets)
        {
            var input = new PredictionInput
            {
                Owner                   = this.Owner,
                AreaOfEffect            = this.HasAreaOfEffect,
                CollisionTypes          = this.CollisionTypes,
                Delay                   = this.CastPoint + this.ActivationDelay,
                Speed                   = this.Speed,
                Range                   = this.CastRange,
                Radius                  = this.Radius,
                PredictionSkillshotType = this.PredictionSkillshotType
            };

            if (this.HasAreaOfEffect)
            {
                input.AreaOfEffectTargets = targets;
            }

            return(input.WithTarget(targets.First()));
        }
Example #6
0
        private void OrderManager_OrderAdding(OrderAddingEventArgs e)
        {
            if (e.Order.Ability != Context.Dawnbreaker.Hammer)
            {
                return;
            }

            var Target = EntityManager.GetEntities <Hero>().Where(x => x.Position.Distance2D(GameManager.MousePosition) < 200 &&
                                                                  x.IsAlive &&
                                                                  x.IsEnemy(Context.Dawnbreaker.LocalHero) &&
                                                                  !x.IsIllusion).OrderBy(y => y.Position.Distance2D(GameManager.MousePosition));

            if (Target == null || Target.Count() == 0)
            {
                return;
            }

            var input = new PredictionInput
            {
                Owner = Context.Dawnbreaker.LocalHero,
                Speed = 1200,
                Delay = 0.6f,
                PredictionSkillshotType = PredictionSkillshotType.SkillshotLine
            };

            var range = HammerCastRange();

            input = input.WithTarget(Target.FirstOrDefault());

            var predictPos = PredictionManager.GetPrediction(input).CastPosition;
            var pos        = Context.Dawnbreaker.LocalHero.Distance2D(predictPos);
            var predict    = Context.Dawnbreaker.LocalHero.Position.Extend(predictPos, pos * 1.75f > range ? range : pos * 1.75f);

            Context.Dawnbreaker.Hammer.Cast(predict, false, true);

            UpdateManager.BeginInvoke((int)(Context.Dawnbreaker.LocalHero.Position.Distance2D(predict) > 800 ? Context.Dawnbreaker.LocalHero.Position.Distance2D(predict) : 800), () =>
            {
                Context.Dawnbreaker.Converge.Cast();
            });
        }
Example #7
0
        private async Task ExecuteAsync(CancellationToken token)
        {
            try
            {
                if (Game.IsPaused || !Owner.IsValid || !Owner.IsAlive || Owner.IsStunned() || Owner.IsInvisible())
                {
                    return;
                }

                if (Menu.AutoComboWhenComboItem && Menu.ComboKeyItem)
                {
                    return;
                }

                if (Menu.AutoOwnerMinHealthItem > ((float)Owner.Health / Owner.MaximumHealth) * 100)
                {
                    return;
                }

                var target = EntityManager <Hero> .Entities.Where(x =>
                                                                  x.IsValid &&
                                                                  x.IsVisible &&
                                                                  x.IsAlive &&
                                                                  !x.IsIllusion &&
                                                                  x.IsEnemy(Owner) &&
                                                                  Extensions.Active(x)).OrderBy(x => x.Distance2D(Owner)).FirstOrDefault();

                if (target == null)
                {
                    return;
                }

                if (!Extensions.Cancel(target) || Extensions.ComboBreaker(target, false))
                {
                    return;
                }

                if (Menu.BladeMailItem && target.HasModifier("modifier_item_blade_mail_reflect"))
                {
                    return;
                }

                if (target.IsBlockingAbilities())
                {
                    Config.LinkenBreaker.Handler.RunAsync();
                    return;
                }

                var stunDebuff = target.Modifiers.FirstOrDefault(x => x.IsStunDebuff);
                var hexDebuff  = target.Modifiers.FirstOrDefault(x => x.Name == "modifier_sheepstick_debuff");

                // Hex
                var hex = Main.Hex;
                if (hex != null &&
                    Menu.AutoItemToggler.Value.IsEnabled(hex.ToString()) &&
                    hex.CanBeCasted &&
                    hex.CanHit(target) &&
                    (stunDebuff == null || !stunDebuff.IsValid || stunDebuff.RemainingTime <= 0.3f) &&
                    (hexDebuff == null || !hexDebuff.IsValid || hexDebuff.RemainingTime <= 0.3f))
                {
                    hex.UseAbility(target);
                    await Await.Delay(hex.GetCastDelay(target), token);
                }

                // Orchid
                var orchid = Main.Orchid;
                if (orchid != null &&
                    Menu.AutoItemToggler.Value.IsEnabled(orchid.ToString()) &&
                    orchid.CanBeCasted &&
                    orchid.CanHit(target))
                {
                    orchid.UseAbility(target);
                    await Await.Delay(orchid.GetCastDelay(target), token);
                }

                // Bloodthorn
                var bloodthorn = Main.Bloodthorn;
                if (bloodthorn != null &&
                    Menu.AutoItemToggler.Value.IsEnabled(bloodthorn.ToString()) &&
                    bloodthorn.CanBeCasted &&
                    bloodthorn.CanHit(target))
                {
                    bloodthorn.UseAbility(target);
                    await Await.Delay(bloodthorn.GetCastDelay(target), token);
                }

                // Mystic Flare
                var mysticFlare = Main.MysticFlare;
                if (Menu.AutoAbilityToggler.Value.IsEnabled(mysticFlare.ToString()) &&
                    Menu.AutoMinHealthToUltItem <= ((float)target.Health / target.MaximumHealth) * 100 &&
                    mysticFlare.CanBeCasted &&
                    mysticFlare.CanHit(target))
                {
                    var enemies = EntityManager <Hero> .Entities.Where(x =>
                                                                       x.IsVisible &&
                                                                       x.IsAlive &&
                                                                       x.IsValid &&
                                                                       !x.IsIllusion &&
                                                                       x.IsEnemy(Owner) &&
                                                                       x.Distance2D(Owner) <= mysticFlare.CastRange).ToList();

                    var dubleMysticFlare = Owner.HasAghanimsScepter() && enemies.Count() == 1;
                    var input            = new PredictionInput
                    {
                        Owner  = Owner,
                        Range  = mysticFlare.CastRange,
                        Radius = dubleMysticFlare ? -250 : -100
                    };

                    var output = Prediction.GetPrediction(input.WithTarget(target));

                    mysticFlare.UseAbility(output.CastPosition);
                    await Await.Delay(mysticFlare.GetCastDelay(output.CastPosition), token);
                }

                // Nullifier
                var nullifier = Main.Nullifier;
                if (nullifier != null &&
                    Menu.ItemToggler.Value.IsEnabled(nullifier.ToString()) &&
                    nullifier.CanBeCasted &&
                    nullifier.CanHit(target) &&
                    (stunDebuff == null || !stunDebuff.IsValid || stunDebuff.RemainingTime <= 0.5f) &&
                    (hexDebuff == null || !hexDebuff.IsValid || hexDebuff.RemainingTime <= 0.5f))
                {
                    nullifier.UseAbility(target);
                    await Await.Delay(nullifier.GetCastDelay(target), token);
                }

                // RodofAtos
                var rodofAtos = Main.RodofAtos;
                if (rodofAtos != null &&
                    Menu.AutoItemToggler.Value.IsEnabled(rodofAtos.ToString()) &&
                    rodofAtos.CanBeCasted &&
                    rodofAtos.CanHit(target) &&
                    !target.Modifiers.Any(x => x.IsValid && x.Name == "modifier_rod_of_atos_debuff" && x.RemainingTime > 0.5f) &&
                    (stunDebuff == null || !stunDebuff.IsValid || stunDebuff.RemainingTime <= 0.5f))
                {
                    rodofAtos.UseAbility(target);
                    await Await.Delay(rodofAtos.GetCastDelay(target), token);
                }

                // AncientSeal
                var ancientSeal = Main.AncientSeal;
                if (Menu.AutoAbilityToggler.Value.IsEnabled(ancientSeal.ToString()) &&
                    ancientSeal.CanBeCasted &&
                    ancientSeal.CanHit(target))
                {
                    ancientSeal.UseAbility(target);
                    await Await.Delay(ancientSeal.GetCastDelay(target), token);

                    return;
                }

                // Veil
                var veil = Main.Veil;
                if (veil != null &&
                    Menu.AutoItemToggler.Value.IsEnabled(veil.ToString()) &&
                    veil.CanBeCasted &&
                    veil.CanHit(target))
                {
                    veil.UseAbility(target.Position);
                    await Await.Delay(veil.GetCastDelay(target.Position), token);
                }

                // Ethereal
                var ethereal = Main.Ethereal;
                if (ethereal != null &&
                    Menu.AutoItemToggler.Value.IsEnabled(ethereal.ToString()) &&
                    ethereal.CanBeCasted &&
                    ethereal.CanHit(target))
                {
                    ethereal.UseAbility(target);
                    MultiSleeper.Sleep(ethereal.GetHitTime(target), "ethereal");
                    await Await.Delay(ethereal.GetCastDelay(target), token);
                }

                // Shivas
                var shivas = Main.Shivas;
                if (shivas != null &&
                    Menu.AutoItemToggler.Value.IsEnabled(shivas.ToString()) &&
                    shivas.CanBeCasted &&
                    shivas.CanHit(target))
                {
                    shivas.UseAbility();
                    await Await.Delay(shivas.GetCastDelay(), token);
                }

                if (!MultiSleeper.Sleeping("ethereal") || target.IsEthereal())
                {
                    // ConcussiveShot
                    var concussiveShot = Main.ConcussiveShot;
                    if (Menu.AutoAbilityToggler.Value.IsEnabled(concussiveShot.ToString()) &&
                        Extensions.ConcussiveShotTarget(target, concussiveShot.TargetHit) &&
                        concussiveShot.CanBeCasted &&
                        Owner.Distance2D(target) < Menu.ConcussiveShotUseRadiusItem - Owner.HullRadius)
                    {
                        concussiveShot.UseAbility();
                        await Await.Delay(concussiveShot.GetCastDelay(), token);
                    }

                    // ArcaneBolt
                    var arcaneBolt = Main.ArcaneBolt;
                    if (Menu.AutoAbilityToggler.Value.IsEnabled(arcaneBolt.ToString()) &&
                        arcaneBolt.CanBeCasted &&
                        arcaneBolt.CanHit(target))
                    {
                        arcaneBolt.UseAbility(target);

                        UpdateManager.BeginInvoke(() =>
                        {
                            MultiSleeper.Sleep(arcaneBolt.GetHitTime(target) - (arcaneBolt.GetCastDelay(target) + 350), $"arcanebolt_{ target.Name }");
                        },
                                                  arcaneBolt.GetCastDelay(target) + 50);

                        await Await.Delay(arcaneBolt.GetCastDelay(target), token);

                        return;
                    }

                    // Dagon
                    var dagon = Main.Dagon;
                    if (dagon != null &&
                        Menu.AutoItemToggler.Value.IsEnabled("item_dagon_5") &&
                        dagon.CanBeCasted &&
                        dagon.CanHit(target))
                    {
                        dagon.UseAbility(target);
                        await Await.Delay(dagon.GetCastDelay(target), token);

                        return;
                    }
                }
            }
            catch (TaskCanceledException)
            {
                // canceled
            }
            catch (Exception e)
            {
                Main.Log.Error(e);
            }
        }
Example #8
0
        public override async Task ExecuteAsync(CancellationToken token)
        {
            var target = Config.UpdateMode.Target;

            if (target == null || Menu.BladeMailItem && target.HasModifier("modifier_item_blade_mail_reflect"))
            {
                Orbwalker.Move(Game.MousePosition);
                return;
            }

            // Blink
            var blink = Abilities.Blink;

            if (blink != null &&
                Menu.ItemToggler.Value.IsEnabled(blink.ToString()) &&
                Owner.Distance2D(Game.MousePosition) > Menu.BlinkActivationItem &&
                Owner.Distance2D(target) > 600 &&
                blink.CanBeCasted)
            {
                var blinkPos = target.Position.Extend(Game.MousePosition, Menu.BlinkDistanceEnemyItem);
                if (Owner.Distance2D(blinkPos) < blink.CastRange)
                {
                    blink.UseAbility(blinkPos);
                    await Await.Delay(blink.GetCastDelay(blinkPos), token);
                }
            }

            if (Extensions.Cancel(target) && StartCombo(target))
            {
                if (!target.IsBlockingAbilities())
                {
                    var comboBreaker = Extensions.ComboBreaker(target);
                    var stunDebuff   = target.Modifiers.FirstOrDefault(x => x.IsStunDebuff);
                    var hexDebuff    = target.Modifiers.FirstOrDefault(x => x.Name == "modifier_sheepstick_debuff");

                    // Hex
                    var hex = Abilities.Hex;
                    if (hex != null &&
                        Menu.ItemToggler.Value.IsEnabled(hex.ToString()) &&
                        hex.CanBeCasted &&
                        hex.CanHit(target) &&
                        !comboBreaker &&
                        (stunDebuff == null || !stunDebuff.IsValid || stunDebuff.RemainingTime <= 0.3f) &&
                        (hexDebuff == null || !hexDebuff.IsValid || hexDebuff.RemainingTime <= 0.3f))
                    {
                        hex.UseAbility(target);
                        await Await.Delay(hex.GetCastDelay(target), token);
                    }

                    // Orchid
                    var orchid = Abilities.Orchid;
                    if (orchid != null &&
                        Menu.ItemToggler.Value.IsEnabled(orchid.ToString()) &&
                        orchid.CanBeCasted &&
                        orchid.CanHit(target) &&
                        !comboBreaker)
                    {
                        orchid.UseAbility(target);
                        await Await.Delay(orchid.GetCastDelay(target), token);
                    }

                    // Bloodthorn
                    var bloodthorn = Abilities.Bloodthorn;
                    if (bloodthorn != null &&
                        Menu.ItemToggler.Value.IsEnabled(bloodthorn.ToString()) &&
                        bloodthorn.CanBeCasted &&
                        bloodthorn.CanHit(target) &&
                        !comboBreaker)
                    {
                        bloodthorn.UseAbility(target);
                        await Await.Delay(bloodthorn.GetCastDelay(target), token);
                    }

                    // MysticFlare
                    var mysticFlare = Abilities.MysticFlare;
                    if (Menu.AbilityToggler.Value.IsEnabled(mysticFlare.ToString()) &&
                        Menu.MinHealthToUltItem <= ((float)target.Health / target.MaximumHealth) * 100 &&
                        mysticFlare.CanBeCasted &&
                        mysticFlare.CanHit(target) &&
                        !comboBreaker &&
                        (BadUlt(target) || Extensions.Active(target)))
                    {
                        var enemies = EntityManager <Hero> .Entities.Where(x =>
                                                                           x.IsValid &&
                                                                           x.IsVisible &&
                                                                           x.IsAlive &&
                                                                           !x.IsIllusion &&
                                                                           x.IsEnemy(Owner) &&
                                                                           x.Distance2D(Owner) <= mysticFlare.CastRange).ToList();

                        var dubleMysticFlare = Owner.HasAghanimsScepter() && enemies.Count() == 1;
                        var input            = new PredictionInput
                        {
                            Owner  = Owner,
                            Range  = mysticFlare.CastRange,
                            Radius = dubleMysticFlare ? -250 : -100
                        };

                        var output = Prediction.GetPrediction(input.WithTarget(target));

                        mysticFlare.UseAbility(output.CastPosition);
                        await Await.Delay(mysticFlare.GetCastDelay(output.CastPosition), token);
                    }

                    // Nullifier
                    var nullifier = Abilities.Nullifier;
                    if (nullifier != null &&
                        Menu.ItemToggler.Value.IsEnabled(nullifier.ToString()) &&
                        nullifier.CanBeCasted &&
                        nullifier.CanHit(target) &&
                        !comboBreaker &&
                        (stunDebuff == null || !stunDebuff.IsValid || stunDebuff.RemainingTime <= 0.5f) &&
                        (hexDebuff == null || !hexDebuff.IsValid || hexDebuff.RemainingTime <= 0.5f))
                    {
                        nullifier.UseAbility(target);
                        await Await.Delay(nullifier.GetCastDelay(target), token);
                    }

                    // RodofAtos
                    var atosDebuff = target.Modifiers.Any(x => x.IsValid && x.Name == "modifier_rod_of_atos_debuff" && x.RemainingTime > 0.5f);
                    var rodofAtos  = Abilities.RodofAtos;
                    if (rodofAtos != null &&
                        Menu.ItemToggler.Value.IsEnabled(rodofAtos.ToString()) &&
                        rodofAtos.CanBeCasted &&
                        rodofAtos.CanHit(target) &&
                        !atosDebuff &&
                        (stunDebuff == null || !stunDebuff.IsValid || stunDebuff.RemainingTime <= 0.5f))
                    {
                        rodofAtos.UseAbility(target);
                        await Await.Delay(rodofAtos.GetCastDelay(target), token);
                    }

                    // AncientSeal
                    var ancientSeal = Abilities.AncientSeal;
                    if (Menu.AbilityToggler.Value.IsEnabled(ancientSeal.ToString()) &&
                        ancientSeal.CanBeCasted &&
                        ancientSeal.CanHit(target) &&
                        !comboBreaker)
                    {
                        ancientSeal.UseAbility(target);
                        await Await.Delay(ancientSeal.GetCastDelay(target), token);

                        return;
                    }

                    // Veil
                    var veil = Abilities.Veil;
                    if (veil != null &&
                        Menu.ItemToggler.Value.IsEnabled(veil.ToString()) &&
                        veil.CanBeCasted &&
                        veil.CanHit(target))
                    {
                        veil.UseAbility(target.Position);
                        await Await.Delay(veil.GetCastDelay(target.Position), token);
                    }

                    // Ethereal
                    var ethereal = Abilities.Ethereal;
                    if (ethereal != null &&
                        Menu.ItemToggler.Value.IsEnabled(ethereal.ToString()) &&
                        ethereal.CanBeCasted &&
                        ethereal.CanHit(target) &&
                        !comboBreaker)
                    {
                        ethereal.UseAbility(target);
                        MultiSleeper.Sleep(ethereal.GetHitTime(target), "ethereal");
                        await Await.Delay(ethereal.GetCastDelay(target), token);
                    }

                    // Shivas
                    var shivas = Abilities.Shivas;
                    if (shivas != null &&
                        Menu.ItemToggler.Value.IsEnabled(shivas.ToString()) &&
                        shivas.CanBeCasted &&
                        shivas.CanHit(target))
                    {
                        shivas.UseAbility();
                        await Await.Delay(shivas.GetCastDelay(), token);
                    }

                    if (!MultiSleeper.Sleeping("ethereal") || target.IsEthereal())
                    {
                        // ConcussiveShot
                        var concussiveShot = Abilities.ConcussiveShot;
                        if (Menu.AbilityToggler.Value.IsEnabled(concussiveShot.ToString()) &&
                            Extensions.ConcussiveShotTarget(target, concussiveShot.TargetHit) &&
                            concussiveShot.CanBeCasted &&
                            concussiveShot.CanHit(target))
                        {
                            concussiveShot.UseAbility();
                            await Await.Delay(concussiveShot.GetCastDelay(), token);
                        }

                        // ArcaneBolt
                        var arcaneBolt = Abilities.ArcaneBolt;
                        if (Menu.AbilityToggler.Value.IsEnabled(arcaneBolt.ToString()) &&
                            arcaneBolt.CanBeCasted &&
                            arcaneBolt.CanHit(target))
                        {
                            arcaneBolt.UseAbility(target);

                            UpdateManager.BeginInvoke(() =>
                            {
                                MultiSleeper.Sleep(arcaneBolt.GetHitTime(target) - (arcaneBolt.GetCastDelay(target) + 350), $"arcanebolt_{ target.Name }");
                            },
                                                      arcaneBolt.GetCastDelay(target) + 50);

                            await Await.Delay(arcaneBolt.GetCastDelay(target), token);

                            return;
                        }

                        // Dagon
                        var dagon = Abilities.Dagon;
                        if (dagon != null &&
                            Menu.ItemToggler.Value.IsEnabled("item_dagon_5") &&
                            dagon.CanBeCasted &&
                            dagon.CanHit(target) &&
                            !comboBreaker)
                        {
                            dagon.UseAbility(target);
                            await Await.Delay(dagon.GetCastDelay(target), token);

                            return;
                        }
                    }

                    // UrnOfShadows
                    var urnOfShadows = Abilities.UrnOfShadows;
                    if (urnOfShadows != null &&
                        Menu.ItemToggler.Value.IsEnabled(urnOfShadows.ToString()) &&
                        urnOfShadows.CanBeCasted &&
                        urnOfShadows.CanHit(target) &&
                        !comboBreaker)
                    {
                        urnOfShadows.UseAbility(target);
                        await Await.Delay(urnOfShadows.GetCastDelay(target), token);
                    }

                    // SpiritVessel
                    var spiritVessel = Abilities.SpiritVessel;
                    if (spiritVessel != null &&
                        Menu.ItemToggler.Value.IsEnabled(spiritVessel.ToString()) &&
                        spiritVessel.CanBeCasted &&
                        spiritVessel.CanHit(target) &&
                        !comboBreaker)
                    {
                        spiritVessel.UseAbility(target);
                        await Await.Delay(spiritVessel.GetCastDelay(target), token);
                    }
                }
                else
                {
                    Config.LinkenBreaker.Handler.RunAsync();
                }
            }

            if (target.IsInvulnerable() || target.IsAttackImmune())
            {
                Orbwalker.Move(Game.MousePosition);
            }
            else
            {
                if (Menu.OrbwalkerItem.Value.SelectedValue.Contains("Default"))
                {
                    Orbwalker.OrbwalkTo(target);
                }
                else if (Menu.OrbwalkerItem.Value.SelectedValue.Contains("Distance"))
                {
                    var ownerDis = Math.Min(Owner.Distance2D(Game.MousePosition), 230);
                    var ownerPos = Owner.Position.Extend(Game.MousePosition, ownerDis);
                    var pos      = target.Position.Extend(ownerPos, Menu.MinDisInOrbwalkItem);

                    Orbwalker.OrbwalkingPoint = pos;
                    Orbwalker.OrbwalkTo(target);
                    Orbwalker.OrbwalkingPoint = Vector3.Zero;
                }
                else if (Menu.OrbwalkerItem.Value.SelectedValue.Contains("Free"))
                {
                    if (Owner.Distance2D(target) < Owner.AttackRange(target) && target.Distance2D(Game.MousePosition) < Owner.AttackRange(target))
                    {
                        Orbwalker.OrbwalkTo(target);
                    }
                    else
                    {
                        Orbwalker.Move(Game.MousePosition);
                    }
                }
                else if (Menu.OrbwalkerItem.Value.SelectedValue.Contains("Only Attack"))
                {
                    Orbwalker.Attack(target);
                }
                else if (Menu.OrbwalkerItem.Value.SelectedValue.Contains("No Move"))
                {
                    if (Owner.Distance2D(target) < Owner.AttackRange(target))
                    {
                        Orbwalker.Attack(target);
                    }
                }
            }
        }
Example #9
0
        private async Task ExecuteAsync(CancellationToken token)
        {
            try
            {
                if (Game.IsPaused || !owner.IsValid || !owner.IsAlive || owner.IsStunned())
                {
                    return;
                }

                var heroes = EntityManager <Hero> .Entities.Where(x => x.IsValidTarget());

                foreach (var target in heroes)
                {
                    if (killStealSettingsMenu.UseBasicAttackItem.Value && this.orbwalker.CanAttack(target) && this.owner.IsInAttackRange(target) && (int)target.Health - (int)DamageCalculationHelper.GetAttackDamage(target) <= 0)
                    {
                        this.orbwalker.Attack(target);
                        return;
                    }

                    var iceShards = abilities.IceShards;
                    if (killStealSettingsMenu.KillStealAbilitiesItem.Value.IsEnabled(iceShards.Ability.Name) &&
                        target.IsValidTarget() &&
                        iceShards.CanBeCasted &&
                        iceShards.CanHit(target) &&
                        (int)target.Health - iceShards.GetDamage(target) <= 0)
                    {
                        var predictionInput = new PredictionInput
                        {
                            Owner  = this.owner,
                            Delay  = iceShards.CastPoint + iceShards.ActivationDelay,
                            Range  = iceShards.CastRange,
                            Radius = iceShards.Radius,
                        };

                        var predictionOutput = prediction.GetPrediction(predictionInput.WithTarget(target));
                        var castPosition     = predictionOutput.CastPosition;

                        Vector3 position;
                        if (target.NetworkActivity == NetworkActivity.Move)
                        {
                            var castRange = iceShards.CastRange - 200;

                            var distance = Vector2.Distance(owner.NetworkPosition.To2D(), castPosition.To2D() + target.Direction2D(target.MovementSpeed));
                            var time     = (distance / iceShards.Speed);

                            position = castPosition + target.Direction2D(time < 1 ? 75 + target.MovementSpeed * time : (target.MovementSpeed) * time).ToVector3();
                            if (this.owner.NetworkPosition.Distance(position) < castRange)
                            {
                                iceShards.UseAbility(position);
                                await Task.Delay(iceShards.GetCastDelay(position), token);
                            }
                        }
                    }

                    var walrusKick = abilities.WalrusKick;
                    if (killStealSettingsMenu.KillStealAbilitiesItem.Value.IsEnabled(walrusKick.Ability.Name) &&
                        !walrusKick.Ability.IsHidden &&
                        walrusKick.CanBeCasted &&
                        walrusKick.CanHit(target) &&
                        (int)target.Health - (int)walrusKick.GetDamage(target) <= 0)
                    {
                        if (owner.Animation.Name.Contains("cast"))
                        {
                            owner.Stop();
                        }

                        walrusKick.UseAbility(target);
                        await Task.Delay(walrusKick.GetCastDelay(target), token);
                    }

                    var walrusPunch = abilities.WalrusPunch;
                    if (killStealSettingsMenu.KillStealAbilitiesItem.Value.IsEnabled(walrusPunch.Ability.Name) &&
                        target.IsValidTarget() &&
                        walrusPunch.CanBeCasted &&
                        walrusPunch.CanHit(target) &&
                        (int)target.Health - walrusPunch.GetDamage(target) <= 0)
                    {
                        if (owner.Animation.Name.Contains("cast"))
                        {
                            owner.Stop();
                        }

                        walrusPunch.UseAbility(target);
                        await Task.Delay(walrusPunch.GetCastDelay(target), token);
                    }
                }
            }
            catch (TaskCanceledException)
            {
            }
            catch (Exception ex)
            {
                LogService.Log(LogType.Error, ex);
            }
        }
        private void OnUpdate()
        {
            var heroes = EntityManager <Hero> .Entities.Where(x => x.IsValid && !x.IsIllusion).ToList();

            DamageList.Clear();

            foreach (var target in heroes.Where(x => x.IsAlive && x.IsEnemy(Owner)).ToList())
            {
                List <BaseAbility> abilities = new List <BaseAbility>();

                var damageOdds      = 0.0f;
                var readyDamageOdds = 0.0f;
                var totalDamageOdds = 0.0f;

                if (target.IsVisible)
                {
                    // Veil
                    var veil = Main.Veil;
                    if (veil != null && veil.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(veil.ToString()))
                    {
                        abilities.Add(veil);
                    }

                    // Ethereal
                    var ethereal = Main.Ethereal;
                    if (ethereal != null && ethereal.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(ethereal.ToString()))
                    {
                        abilities.Add(ethereal);
                    }

                    // Shivas
                    var shivas = Main.Shivas;
                    if (shivas != null && shivas.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(shivas.ToString()))
                    {
                        abilities.Add(shivas);
                    }

                    // Dagon
                    var dagon = Main.Dagon;
                    if (dagon != null && dagon.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled("item_dagon_5"))
                    {
                        abilities.Add(dagon);
                    }

                    // Overwhelming Odds
                    var overwhelmingOdds = Main.OverwhelmingOdds;
                    if (overwhelmingOdds.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(overwhelmingOdds.ToString()))
                    {
                        var input = new PredictionInput
                        {
                            Owner                   = Owner,
                            AreaOfEffect            = overwhelmingOdds.HasAreaOfEffect,
                            AreaOfEffectTargets     = UpdateMode.OverwhelmingOddsUnits,
                            CollisionTypes          = overwhelmingOdds.CollisionTypes,
                            Delay                   = overwhelmingOdds.CastPoint + overwhelmingOdds.ActivationDelay,
                            Speed                   = overwhelmingOdds.Speed,
                            Range                   = float.MaxValue,
                            Radius                  = overwhelmingOdds.Radius,
                            PredictionSkillshotType = overwhelmingOdds.PredictionSkillshotType
                        };

                        var castPosition = overwhelmingOdds.GetPredictionOutput(input.WithTarget(target)).CastPosition;
                        var damageUnits  = overwhelmingOdds.GetDamage(castPosition, target);

                        if (overwhelmingOdds.IsReady && !Owner.IsStunned() && !Owner.IsMuted() && !Owner.IsSilenced())
                        {
                            if (Owner.Distance2D(castPosition) <= overwhelmingOdds.CastRange)
                            {
                                damageOdds += damageUnits;
                            }

                            readyDamageOdds += damageUnits;
                        }

                        totalDamageOdds += damageUnits;
                    }
                }

                var damageCalculation = new Combo(abilities.ToArray());
                var damageReduction   = -DamageReduction(target, heroes);
                var damageBlock       = MagicalDamageBlock(target, heroes);

                var livingArmor = LivingArmor(target, heroes, damageCalculation.Abilities);
                var damage      = DamageHelpers.GetSpellDamage((damageCalculation.GetDamage(target) + damageOdds) + damageBlock, 0, damageReduction) - livingArmor;
                var readyDamage = DamageHelpers.GetSpellDamage((damageCalculation.GetDamage(target, true, false) + readyDamageOdds) + damageBlock, 0, damageReduction) - livingArmor;
                var totalDamage = DamageHelpers.GetSpellDamage((damageCalculation.GetDamage(target, false, false) + totalDamageOdds) + damageBlock, 0, damageReduction) - livingArmor;

                if (target.IsInvulnerable() || target.HasAnyModifiers(BlockModifiers))
                {
                    damage      = 0.0f;
                    readyDamage = 0.0f;
                }

                DamageList.Add(new Damage(target, damage, readyDamage, totalDamage, target.Health));
            }
        }
Example #11
0
        private async Task ExecuteAsync(CancellationToken token)
        {
            try
            {
                if (Game.IsPaused || !Owner.IsValid || !Owner.IsAlive || Owner.IsStunned())
                {
                    return;
                }

                if (Menu.AutoKillWhenComboItem && Menu.ComboKeyItem)
                {
                    return;
                }

                var damageCalculation = DamageCalculation.DamageList.Where(x => (x.GetHealth - x.GetDamage) / x.GetTarget.MaximumHealth <= 0.0f).ToList();
                Damage = damageCalculation.OrderByDescending(x => x.GetHealth).OrderByDescending(x => x.GetTarget.Player.Kills).FirstOrDefault();

                if (Damage == null)
                {
                    return;
                }

                if (!UpdateHandler.IsEnabled)
                {
                    UpdateHandler.IsEnabled = true;
                }

                var target = Damage.GetTarget;

                if (!Cancel(target) || Extensions.ComboBreaker(target, false))
                {
                    return;
                }

                if (!target.IsBlockingAbilities())
                {
                    // Veil
                    var veil = Main.Veil;
                    if (veil != null &&
                        Menu.AutoKillStealToggler.Value.IsEnabled(veil.ToString()) &&
                        veil.CanBeCasted &&
                        veil.CanHit(target))
                    {
                        veil.UseAbility(target.Position);
                        await Task.Delay(veil.GetCastDelay(target.Position), token);
                    }

                    // Ethereal
                    var ethereal = Main.Ethereal;
                    if (ethereal != null &&
                        Menu.AutoKillStealToggler.Value.IsEnabled(ethereal.ToString()) &&
                        ethereal.CanBeCasted &&
                        ethereal.CanHit(target))
                    {
                        ethereal.UseAbility(target);
                        MultiSleeper.Sleep(ethereal.GetHitTime(target), "ethereal");
                        await Task.Delay(ethereal.GetCastDelay(target), token);
                    }

                    // Shivas
                    var shivas = Main.Shivas;
                    if (shivas != null &&
                        Menu.AutoKillStealToggler.Value.IsEnabled(shivas.ToString()) &&
                        shivas.CanBeCasted &&
                        shivas.CanHit(target))
                    {
                        shivas.UseAbility();
                        await Task.Delay(shivas.GetCastDelay(), token);
                    }

                    if (!MultiSleeper.Sleeping("ethereal") || target.IsEthereal())
                    {
                        // Dagon
                        var dagon = Main.Dagon;
                        if (dagon != null &&
                            Menu.AutoKillStealToggler.Value.IsEnabled("item_dagon_5") &&
                            dagon.CanBeCasted &&
                            dagon.CanHit(target))
                        {
                            dagon.UseAbility(target);
                            await Task.Delay(dagon.GetCastDelay(target), token);
                        }
                    }
                }
                else
                {
                    LinkenBreaker.Handler.RunAsync();
                }

                if (!MultiSleeper.Sleeping("ethereal") || target.IsEthereal())
                {
                    // Overwhelming Odds
                    var overwhelmingOdds = Main.OverwhelmingOdds;
                    if (Menu.AutoKillStealToggler.Value.IsEnabled(overwhelmingOdds.ToString()) && overwhelmingOdds.CanBeCasted)
                    {
                        var input = new PredictionInput
                        {
                            Owner                   = Owner,
                            AreaOfEffect            = overwhelmingOdds.HasAreaOfEffect,
                            AreaOfEffectTargets     = UpdateMode.OverwhelmingOddsUnits,
                            CollisionTypes          = overwhelmingOdds.CollisionTypes,
                            Delay                   = overwhelmingOdds.CastPoint + overwhelmingOdds.ActivationDelay,
                            Speed                   = overwhelmingOdds.Speed,
                            Range                   = overwhelmingOdds.CastRange,
                            Radius                  = overwhelmingOdds.Radius,
                            PredictionSkillshotType = overwhelmingOdds.PredictionSkillshotType
                        };

                        var castPosition = overwhelmingOdds.GetPredictionOutput(input.WithTarget(target)).CastPosition;
                        if (Owner.Distance2D(castPosition) <= overwhelmingOdds.CastRange)
                        {
                            overwhelmingOdds.UseAbility(castPosition);
                            await Task.Delay(overwhelmingOdds.GetCastDelay(castPosition), token);
                        }
                    }
                }
            }
            catch (TaskCanceledException)
            {
                // canceled
            }
            catch (Exception e)
            {
                Main.Log.Error(e);
            }
        }
Example #12
0
        public override async Task ExecuteAsync(CancellationToken token)
        {
            try
            {
                var target = UpdateMode.Target;
                if (target == null || Menu.BladeMailItem && target.HasModifier("modifier_item_blade_mail_reflect"))
                {
                    Orbwalker.Move(Game.MousePosition);
                    return;
                }

                if (!Owner.IsInvisible())
                {
                    var blockingAbilities = target.IsBlockingAbilities();
                    var comboBreaker      = Extensions.ComboBreaker(target);

                    var cancelAdditionally = Extensions.CancelAdditionally(target);
                    if (Extensions.Cancel(target) && cancelAdditionally)
                    {
                        var modifiers = target.Modifiers.ToList();

                        if (!target.IsMagicImmune())
                        {
                            if (!blockingAbilities)
                            {
                                var stunDebuff = modifiers.FirstOrDefault(x => x.IsStunDebuff);
                                var hexDebuff  = modifiers.FirstOrDefault(x => x.Name == "modifier_sheepstick_debuff");

                                // Abyssal Blade
                                var abyssalBlade = Main.AbyssalBlade;
                                if (abyssalBlade != null &&
                                    Menu.ItemToggler.Value.IsEnabled(abyssalBlade.ToString()) &&
                                    abyssalBlade.CanBeCasted &&
                                    Owner.Distance2D(target) < abyssalBlade.CastRange + 60 &&
                                    !comboBreaker &&
                                    (stunDebuff == null || !stunDebuff.IsValid || stunDebuff.RemainingTime <= 0.3f) &&
                                    (hexDebuff == null || !hexDebuff.IsValid || hexDebuff.RemainingTime <= 0.3f))
                                {
                                    abyssalBlade.UseAbility(target);
                                    await Task.Delay(abyssalBlade.GetCastDelay(target), token);

                                    return;
                                }

                                // Hex
                                var hex = Main.Hex;
                                if (hex != null &&
                                    Menu.ItemToggler.Value.IsEnabled(hex.ToString()) &&
                                    hex.CanBeCasted &&
                                    hex.CanHit(target) &&
                                    !comboBreaker &&
                                    (stunDebuff == null || !stunDebuff.IsValid || stunDebuff.RemainingTime <= 0.3f) &&
                                    (hexDebuff == null || !hexDebuff.IsValid || hexDebuff.RemainingTime <= 0.3f))
                                {
                                    hex.UseAbility(target);
                                    await Task.Delay(hex.GetCastDelay(target), token);
                                }

                                // Orchid
                                var orchid = Main.Orchid;
                                if (orchid != null &&
                                    Menu.ItemToggler.Value.IsEnabled(orchid.ToString()) &&
                                    orchid.CanBeCasted &&
                                    orchid.CanHit(target) &&
                                    !comboBreaker)
                                {
                                    orchid.UseAbility(target);
                                    await Task.Delay(orchid.GetCastDelay(target), token);
                                }

                                // Bloodthorn
                                var bloodthorn = Main.Bloodthorn;
                                if (bloodthorn != null &&
                                    Menu.ItemToggler.Value.IsEnabled(bloodthorn.ToString()) &&
                                    bloodthorn.CanBeCasted &&
                                    bloodthorn.CanHit(target) &&
                                    !comboBreaker)
                                {
                                    bloodthorn.UseAbility(target);
                                    await Task.Delay(bloodthorn.GetCastDelay(target), token);
                                }

                                // Nullifier
                                var nullifier = Main.Nullifier;
                                if (nullifier != null &&
                                    Menu.ItemToggler.Value.IsEnabled(nullifier.ToString()) &&
                                    nullifier.CanBeCasted &&
                                    nullifier.CanHit(target) &&
                                    !comboBreaker &&
                                    (stunDebuff == null || !stunDebuff.IsValid || stunDebuff.RemainingTime <= 0.5f) &&
                                    (hexDebuff == null || !hexDebuff.IsValid || hexDebuff.RemainingTime <= 0.5f))
                                {
                                    nullifier.UseAbility(target);
                                    await Task.Delay(nullifier.GetCastDelay(target), token);
                                }

                                // Atos
                                var atosDebuff = modifiers.Any(x => x.Name == "modifier_rod_of_atos_debuff" && x.RemainingTime > 0.5f);
                                var atos       = Main.Atos;
                                if (atos != null &&
                                    Menu.ItemToggler.Value.IsEnabled(atos.ToString()) &&
                                    atos.CanBeCasted &&
                                    atos.CanHit(target) &&
                                    !atosDebuff &&
                                    (stunDebuff == null || !stunDebuff.IsValid || stunDebuff.RemainingTime <= 0.5f))
                                {
                                    atos.UseAbility(target);
                                    MultiSleeper.Sleep(atos.GetHitTime(target), "atos");
                                    await Task.Delay(atos.GetCastDelay(target), token);
                                }

                                // Veil
                                var veil = Main.Veil;
                                if (veil != null &&
                                    Menu.ItemToggler.Value.IsEnabled(veil.ToString()) &&
                                    veil.CanBeCasted &&
                                    veil.CanHit(target))
                                {
                                    veil.UseAbility(target.Position);
                                    await Task.Delay(veil.GetCastDelay(target.Position), token);
                                }

                                // Ethereal
                                var ethereal = Main.Ethereal;
                                if (ethereal != null &&
                                    Menu.ItemToggler.Value.IsEnabled(ethereal.ToString()) &&
                                    ethereal.CanBeCasted &&
                                    ethereal.CanHit(target) &&
                                    !comboBreaker)
                                {
                                    ethereal.UseAbility(target);
                                    MultiSleeper.Sleep(ethereal.GetHitTime(target), "ethereal");
                                    await Task.Delay(ethereal.GetCastDelay(target), token);
                                }

                                // Shivas
                                var shivas = Main.Shivas;
                                if (shivas != null &&
                                    Menu.ItemToggler.Value.IsEnabled(shivas.ToString()) &&
                                    shivas.CanBeCasted &&
                                    shivas.CanHit(target))
                                {
                                    shivas.UseAbility();
                                    await Task.Delay(shivas.GetCastDelay(), token);
                                }

                                if (!MultiSleeper.Sleeping("ethereal") || target.IsEthereal())
                                {
                                    // Dagon
                                    var dagon = Main.Dagon;
                                    if (dagon != null &&
                                        Menu.ItemToggler.Value.IsEnabled("item_dagon_5") &&
                                        dagon.CanBeCasted &&
                                        dagon.CanHit(target) &&
                                        !comboBreaker)
                                    {
                                        dagon.UseAbility(target);
                                        await Task.Delay(dagon.GetCastDelay(target), token);
                                    }
                                }

                                // Urn
                                var urn = Main.Urn;
                                if (urn != null &&
                                    Menu.ItemToggler.Value.IsEnabled(urn.ToString()) &&
                                    urn.CanBeCasted &&
                                    urn.CanHit(target) &&
                                    !comboBreaker &&
                                    !modifiers.Any(x => x.Name == urn.TargetModifierName))
                                {
                                    urn.UseAbility(target);
                                    await Task.Delay(urn.GetCastDelay(target), token);
                                }

                                // Vessel
                                var vessel = Main.Vessel;
                                if (vessel != null &&
                                    Menu.ItemToggler.Value.IsEnabled(vessel.ToString()) &&
                                    vessel.CanBeCasted &&
                                    vessel.CanHit(target) &&
                                    !comboBreaker &&
                                    !modifiers.Any(x => x.Name == vessel.TargetModifierName))
                                {
                                    vessel.UseAbility(target);
                                    await Task.Delay(vessel.GetCastDelay(target), token);
                                }
                            }
                            else
                            {
                                LinkenBreaker.Handler.RunAsync();
                            }

                            // Solar Crest
                            var solarCrest = Main.SolarCrest;
                            if (solarCrest != null &&
                                Menu.ItemToggler.Value.IsEnabled(solarCrest.ToString()) &&
                                solarCrest.CanBeCasted &&
                                solarCrest.CanHit(target))
                            {
                                solarCrest.UseAbility(target);
                                await Task.Delay(solarCrest.GetCastDelay(target), token);
                            }
                        }

                        if (!MultiSleeper.Sleeping("ethereal") || target.IsEthereal())
                        {
                            // Overwhelming Odds
                            var overwhelmingOdds = Main.OverwhelmingOdds;
                            if (Menu.AbilityToggler.Value.IsEnabled(overwhelmingOdds.ToString()) &&
                                overwhelmingOdds.CanBeCasted &&
                                !comboBreaker)
                            {
                                var heroes = EntityManager <Hero> .Entities.Where(x => x.IsValid && x.IsVisible && x.IsAlive && x.IsEnemy(Owner) && !x.IsInvulnerable()).ToArray();

                                if (heroes.All(x => x.Distance2D(Owner) < overwhelmingOdds.CastRange + 300))
                                {
                                    var input = new PredictionInput
                                    {
                                        Owner                   = Owner,
                                        AreaOfEffect            = overwhelmingOdds.HasAreaOfEffect,
                                        AreaOfEffectTargets     = heroes,
                                        CollisionTypes          = overwhelmingOdds.CollisionTypes,
                                        Delay                   = overwhelmingOdds.CastPoint + overwhelmingOdds.ActivationDelay,
                                        Speed                   = overwhelmingOdds.Speed,
                                        Range                   = overwhelmingOdds.CastRange,
                                        Radius                  = overwhelmingOdds.Radius,
                                        PredictionSkillshotType = overwhelmingOdds.PredictionSkillshotType
                                    };

                                    var castPosition = overwhelmingOdds.GetPredictionOutput(input.WithTarget(target)).CastPosition;
                                    if (Owner.Distance2D(castPosition) <= overwhelmingOdds.CastRange)
                                    {
                                        overwhelmingOdds.UseAbility(castPosition);
                                        await Task.Delay(overwhelmingOdds.GetCastDelay(castPosition), token);
                                    }
                                }
                            }
                        }
                    }

                    var blink      = Main.Blink;
                    var distance   = Owner.Distance2D(target, true);
                    var blinkReady = blink != null && Menu.ItemToggler.Value.IsEnabled(blink.ToString()) && blink.CanBeCasted;

                    if (cancelAdditionally)
                    {
                        if (distance <= (blinkReady ? blink.CastRange : 250))
                        {
                            // Press The Attack
                            var pressTheAttack      = Main.PressTheAttack;
                            var pressTheAttackReady = Menu.AbilityToggler.Value.IsEnabled(pressTheAttack.ToString()) && pressTheAttack.CanBeCasted;
                            if (pressTheAttackReady)
                            {
                                pressTheAttack.UseAbility(Owner);
                                await Task.Delay(pressTheAttack.GetCastDelay(), token);
                            }

                            // Mjollnir
                            var mjollnir      = Main.Mjollnir;
                            var mjollnirReady = mjollnir != null && Menu.ItemToggler.Value.IsEnabled(mjollnir.ToString()) && mjollnir.CanBeCasted;
                            if (mjollnirReady)
                            {
                                mjollnir.UseAbility(Owner);
                                await Task.Delay(mjollnir.GetCastDelay(), token);
                            }

                            // Armlet
                            var armlet      = Main.Armlet;
                            var armletReady = armlet != null && Menu.ItemToggler.Value.IsEnabled(armlet.ToString()) && !armlet.Enabled;
                            if (armletReady)
                            {
                                armlet.Enabled = true;
                                await Task.Delay(armlet.GetCastDelay(), token);
                            }

                            // Blade Mail
                            var bladeMail      = Main.BladeMail;
                            var bladeMailReady = bladeMail != null && Menu.ItemToggler.Value.IsEnabled(bladeMail.ToString()) && bladeMail.CanBeCasted && !comboBreaker;
                            if (bladeMailReady)
                            {
                                bladeMail.UseAbility();
                                await Task.Delay(bladeMail.GetCastDelay(), token);
                            }

                            // Satanic
                            var satanic      = Main.Satanic;
                            var satanicReady = satanic != null && Menu.ItemToggler.Value.IsEnabled(satanic.ToString()) && satanic.CanBeCasted && !comboBreaker;
                            if (satanicReady)
                            {
                                satanic.UseAbility();
                                await Task.Delay(satanic.GetCastDelay(), token);
                            }

                            // Black King Bar
                            var blackKingBar      = Main.BlackKingBar;
                            var blackKingBarReady = blackKingBar != null && Menu.ItemToggler.Value.IsEnabled(blackKingBar.ToString()) && blackKingBar.CanBeCasted && !comboBreaker;
                            if (blackKingBarReady)
                            {
                                blackKingBar.UseAbility();
                                await Task.Delay(blackKingBar.GetCastDelay(), token);
                            }

                            if (pressTheAttackReady || mjollnirReady || armletReady || bladeMailReady || satanicReady || blackKingBarReady)
                            {
                                await Task.Delay(125, token);

                                return;
                            }
                        }

                        if (!blockingAbilities)
                        {
                            // Duel
                            var duel = Main.Duel;
                            if (Menu.AbilityToggler.Value.IsEnabled(duel.ToString()) &&
                                duel.CanBeCasted &&
                                Owner.Distance2D(target) < duel.CastRange + 50 &&
                                !comboBreaker)
                            {
                                duel.UseAbility(target);
                                await Task.Delay(duel.GetCastDelay(target), token);
                            }
                        }
                        else
                        {
                            LinkenBreaker.Handler.RunAsync();
                        }
                    }

                    // Blink
                    if (blinkReady && distance <= blink.CastRange && distance > 150)
                    {
                        blink.UseAbility(target.Position);
                        await Task.Delay(blink.GetCastDelay(target.Position), token);
                    }
                }

                if (target.IsInvulnerable() || target.IsAttackImmune())
                {
                    Orbwalker.Move(Game.MousePosition);
                }
                else
                {
                    if (Menu.OrbwalkerItem.Value.SelectedValue.Contains("Default"))
                    {
                        Orbwalker.OrbwalkTo(target);
                    }
                    else if (Menu.OrbwalkerItem.Value.SelectedValue.Contains("Free"))
                    {
                        var attackRange = Owner.AttackRange(target);
                        if (Owner.Distance2D(target) <= attackRange && !Menu.FullFreeModeItem || target.Distance2D(Game.MousePosition) <= attackRange)
                        {
                            Orbwalker.OrbwalkTo(target);
                        }
                        else
                        {
                            Orbwalker.Move(Game.MousePosition);
                        }
                    }
                    else if (Menu.OrbwalkerItem.Value.SelectedValue.Contains("Only Attack"))
                    {
                        Orbwalker.Attack(target);
                    }
                    else if (Menu.OrbwalkerItem.Value.SelectedValue.Contains("No Move"))
                    {
                        if (Owner.Distance2D(target) <= Owner.AttackRange(target))
                        {
                            Orbwalker.Attack(target);
                        }
                    }
                }
            }
            catch (TaskCanceledException)
            {
                // canceled
            }
            catch (Exception e)
            {
                Main.Log.Error(e);
            }
        }
Example #13
0
        // private readonly MultiSleeper<string> _multiSleeper;

        public BombDamageManager(Updater updater)
        {
            _updater = updater;
            var me = updater._main.Me;

            DamageUpdater = UpdateManager.CreateUpdate(100, () =>
            {
                // O9K.Core.Managers.Entity.EntityManager9.EnemyHeroes
                foreach (var enemy in EntityManager.GetEntities <Hero>().Where(x =>
                                                                               x.IsValid && x.IsVisible && x.IsAlive && x.IsEnemy(me) && !x.IsIllusion))
                {
                    // var t = new O9K.Core.Entities.Heroes.Hero9(enemy);
                    var id                 = enemy.HeroId;
                    var landMineCount      = CalcLandMineCount(enemy);
                    var landMineCountMax   = CalcLandMineCount(enemy, false);
                    var removeMineCount    = CalcRemoteMineCount(enemy);
                    var removeMineCountMax = CalcRemoteMineCount(enemy, false);
                    var healthAfterSuicide = CalcHealthAfterSuicide(enemy);

                    if (DamageDictionary.TryGetValue(id, out var info))
                    {
                        info.UpdateInfo(landMineCount, landMineCountMax, removeMineCountMax, removeMineCount,
                                        healthAfterSuicide);
                    }
                    else
                    {
                        DamageDictionary.Add(id,
                                             new DamageInfo(landMineCount, landMineCountMax, removeMineCountMax, removeMineCount,
                                                            healthAfterSuicide));
                    }
                }
            });
            // var inActionSleeper = new MultiSleeper<uint>();
            UpdateManager.BeginInvoke(async() =>
            {
                while (true)
                {
                    var passedDelay = false;
                    starting:
                    var isForce = _updater.ForceStaff != null && _updater.ForceStaff.CanBeCasted();
                    var enemies = O9K.Core.Managers.Entity.EntityManager9.EnemyHeroes.OfType <Hero9>().Where(x =>
                                                                                                             x.IsValid && x.IsAlive && x.IsVisible && !x.IsIllusion && !x.IsMagicImmune && x.CanDie);
                    // var enemies = EntityManager.GetEntities<Hero>().Where(x =>
                    //     x.IsValid && x.IsVisible && x.IsAlive && x.IsEnemy(me) && !x.IsIllusion &&
                    //     !x.IsMagicImmune()/* &&
                    //     _updater._main.MenuManager.Targets.GetValue(x.HeroId)*/);
                    foreach (var enemy in enemies)
                    {
                        var handle = enemy.Handle;

                        if (MultiSleeper <uint> .Sleeping(handle))
                        {
                            continue;
                        }
                        if (enemy.HasModifier(new[]
                        {
                            "modifier_shredder_timber_chain", "modifier_storm_spirit_ball_lightning",
                            "modifier_item_aeon_disk_buff", "modifier_eul_cyclone",
                            "modifier_ember_spirit_sleight_of_fist_caster",
                            "modifier_ember_spirit_sleight_of_fist_caster_invulnerability",
                            "modifier_brewmaster_primal_split", "modifier_brewmaster_primal_split_delay",
                            "modifier_earth_spirit_rolling_boulder_caster", "modifier_morphling_waveform",
                            "modifier_phoenix_icarus_dive", "modifier_ursa_enrage"
                        }))
                        {
                            continue;
                        }
                        if (enemy.CanReincarnate && !_updater._main.MenuManager.DetonateOnAegis)
                        {
                            continue;
                        }

                        var itemBlink = enemy.Abilities.FirstOrDefault(x => x.Id == AbilityId.item_blink);
                        if (itemBlink != null)
                        {
                            if (itemBlink.Cooldown - itemBlink.RemainingCooldown <= 1 && itemBlink.Cooldown > 10)
                            {
                                continue;
                            }
                        }

                        var startManaCalc = 0f;
                        var threshold     = 0f;
                        var heroId        = enemy.Id;
                        var isDusa        = heroId == HeroId.npc_dota_hero_medusa;
                        var isAbba        = heroId == HeroId.npc_dota_hero_abaddon;
                        var health        = (float)enemy.Health;
                        if (isDusa)
                        {
                            startManaCalc = enemy.Mana;
                            var shield    = enemy.GetAbilityById(AbilityId.medusa_mana_shield);
                            if (shield.IsToggled)
                            {
                                threshold = shield.GetAbilitySpecialData("damage_per_mana");
                            }
                        }
                        else if (heroId == HeroId.npc_dota_hero_ember_spirit)
                        {
                            if (EmberShield == null)
                            {
                                EmberShield =
                                    enemy.GetAbilityById(AbilityId.ember_spirit_flame_guard);
                            }
                            if (enemy.HasModifier("modifier_ember_spirit_flame_guard"))
                            {
                                var extraLife = EmberShield.GetAbilitySpecialData("absorb_amount");
                                var talant    = enemy.GetAbilityById(AbilityId.special_bonus_unique_ember_spirit_1);
                                extraLife    += talant?.Level > 0
                                    ? talant.GetAbilitySpecialData("value")
                                    : 0;
                                health += extraLife;
                            }
                        }
                        else if (isAbba)
                        {
                        }


                        var raindrop = enemy.Abilities.FirstOrDefault(x => x.Id == AbilityId.item_infused_raindrop);
                        if (raindrop != null && raindrop.CanBeCasted())
                        {
                            var extraHealth = raindrop.BaseAbility.GetAbilitySpecialData("magic_damage_block");
                            health         += extraHealth;
                        }

                        var blockCount         = enemy.GetModifierStacks("modifier_templar_assassin_refraction_absorb");
                        var graveKeeper        = enemy.GetModifier("modifier_visage_gravekeepers_cloak");
                        var graveKeeperCount   = graveKeeper?.StackCount;
                        var aeon               = enemy.Abilities.FirstOrDefault(x => x.Id == AbilityId.item_aeon_disk);
                        var breakHealthForAeon = enemy.MaximumHealth * .7f;
                        var input              = new PredictionInput
                        {
                            Owner                   = me,
                            AreaOfEffect            = false,
                            CollisionTypes          = CollisionTypes.None,
                            Delay                   = 0.25f,
                            Speed                   = float.MaxValue,
                            Range                   = float.MaxValue,
                            Radius                  = 420,
                            PredictionSkillshotType = PredictionSkillshotType.SkillshotCircle
                        };
                        input          = input.WithTarget(enemy.BaseHero);
                        var prediction = PredictionManager.GetPrediction(input);
                        // ParticleManager.CircleParticle("123", prediction.CastPosition, 150, Color.Red);
                        var predictedPosition = prediction.CastPosition;
                        var pos     = /*_updater._main.MenuManager.UsePrediction ? predictedPosition :*/ enemy.Position;
                        var detList = new List <RemoteMine>();
                        var bombs   = updater
                                      .BombManager
                                      .RemoteMines
                                      .Where(x =>
                                             x.IsActive &&
                                             _updater._main.MenuManager.UsePrediction
                                    ? x.Position.IsInRange(pos, 420) && x.Position.IsInRange(predictedPosition, 420)
                                    : x.Position.IsInRange(pos, 420))
                                      .ToList();
                        var underStasisTrap = enemy.HasModifier("modifier_techies_stasis_trap_stunned");
                        foreach (var remoteMine in bombs.Where(x =>
                                                               x.StackerMain == null && x.Stacker.DetonateDict.TryGetValue(heroId, out var isEnable) &&
                                                               isEnable ||
                                                               x.StackerMain != null &&
                                                               x.StackerMain.Stacker.DetonateDict.TryGetValue(heroId, out var isEnable2) && isEnable2))
                        {
                            var damage = _updater._main.RemoteMine.GetDamage(remoteMine.Damage, enemy);
                            if (isDusa)
                            {
                                DamageCalcHelpers.CalcDamageForDusa(ref damage, ref startManaCalc, threshold);
                            }
                            detList.Add(remoteMine);
                            if (blockCount > 0)
                            {
                                blockCount--;
                            }
                            else if (graveKeeperCount > 0)
                            {
                                var percentBlock =
                                    (float)(enemy.GetAbilityById(AbilityId.visage_gravekeepers_cloak)
                                            .GetAbilitySpecialData("damage_reduction") *
                                            graveKeeperCount);
                                // TechiesCrappahilationPaid.Log.Warn(
                                //     $"Block:  {damage * (percentBlock / 100)}({percentBlock} %). Left blocks: {graveKeeperCount} " +
                                //     $"Damage changed: {damage} -> {damage - damage * (percentBlock / 100)}");
                                health -= damage - damage * (percentBlock / 100);
                                graveKeeperCount--;
                            }
                            else
                            {
                                health -= damage;
                            }

                            var extraDetonateTime = 0.25f * detList.Count;
                            var aeonByPass        = aeon != null && aeon.CanBeCasted() && health < breakHealthForAeon;


                            if (health + enemy.HealthRegeneration * extraDetonateTime < 0 || aeonByPass)
                            {
                                if (_updater._main.MenuManager.CameraMove)
                                {
                                    var heroPos         = enemy.Position;
                                    var consolePosition = $"{heroPos.X} {heroPos.Y}";
                                    GameManager.ExecuteCommand($"dota_camera_set_lookatpos {consolePosition}");
                                }

                                if (_updater._main.MenuManager.DelayOnDetonate.Value > 0 && !passedDelay &&
                                    !underStasisTrap)
                                {
                                    if (!MultiSleeper <string> .Sleeping("heroAfterForce" + heroId))
                                    {
                                        // TechiesCrappahilationPaid.Log.Warn(
                                        //     "delay on detonation start for " +
                                        //     _updater._main.MenuManager.DelayOnDetonate.Value.Value);
                                        await Task.Delay(_updater._main.MenuManager.DelayOnDetonate.Value);
                                        // TechiesCrappahilationPaid.Log.Warn("delay end");
                                        passedDelay = true;
                                        goto starting;
                                    }
                                }

                                await Task.Delay((int)(25 + GameManager.Ping));
                                if (_updater._main.MenuManager.DetonateAllInOnce && !aeonByPass)
                                {
                                    if (_updater._main.MenuManager.UseFocusedDetonation)
                                    {
                                        var minesToDetonate = bombs.FirstOrDefault();
                                        if (minesToDetonate != null)
                                        {
                                            _updater._main.FocusedDetonate.Cast(minesToDetonate.Position);
                                        }
                                    }
                                    else
                                    {
                                        foreach (var mine in bombs)
                                        {
                                            mine.Owner.Select(true);
                                        }

                                        await Task.Delay((int)(25 + GameManager.Ping));
                                        // OrderManager.CreateOrder(OrderType.Cast, bombs.Select(x => x.Owner), 0,
                                        //     bombs.FirstOrDefault().Owner.Spellbook.Spell1.AbilityIndex, Vector3.Zero,
                                        //     false, false, false);
                                        foreach (var mine in bombs)
                                        {
                                            mine.Owner.Spellbook.Spell1.Cast();
                                            mine.IsActive = false;
                                        }
                                    }
                                }
                                else
                                {
                                    foreach (var mine in detList)
                                    {
                                        mine.Owner.Select(true);
                                    }

                                    await Task.Delay((int)(25 + GameManager.Ping));
                                    // OrderManager.CreateOrder(OrderType.Cast, detList.Select(x => x.Owner).FirstOrDefault(), 0,
                                    //     detList.FirstOrDefault().Owner.Spellbook.Spell1.AbilityIndex, Vector3.Zero,
                                    //     false, false, false);
                                    foreach (var mine in detList)
                                    {
                                        mine.Owner.Spellbook.Spell1.Cast();
                                        mine.IsActive = false;
                                    }
                                }

                                MultiSleeper <uint> .Sleep(handle, extraDetonateTime + GameManager.Ping + 1500);


                                ////TODO: delay on detonation
                                goto EndOfActions;
                            }
                        }

                        if (isDusa)
                        {
                            startManaCalc = enemy.Mana;
                        }

                        if (isForce && _updater.ForceStaff.CanHit(enemy) && !enemy.IsRotating)
                        {
                            var isLinken = enemy.IsLinkensProtected;
                            if (isLinken && (_updater.Eul == null || !_updater.Eul.CanBeCasted()))
                            {
                                continue;
                            }

                            health            = enemy.Health;
                            var afterForcePos = enemy.BaseEntity.InFrontSuper(600);
                            foreach (var remoteMine in updater
                                     .BombManager.RemoteMines
                                     .Where(x => x.IsActive &&
                                            x.Position.IsInRange(
                                                afterForcePos,
                                                420) &&
                                            (
                                                x.StackerMain == null &&
                                                x.Stacker.DetonateDict.TryGetValue(heroId, out var isEnable) &&
                                                isEnable ||
                                                x.StackerMain != null &&
                                                x.StackerMain.Stacker.DetonateDict.TryGetValue(heroId,
                                                                                               out var isEnable2) && isEnable2
                                            )))
                            {
                                var damage = _updater._main.RemoteMine.GetDamage(remoteMine.Damage, enemy);
                                if (isDusa)
                                {
                                    DamageCalcHelpers.CalcDamageForDusa(ref damage, ref startManaCalc, threshold);
                                }
                                detList.Add(remoteMine);
                                health -= damage;
                                if (health + enemy.HealthRegeneration * 0.25f * detList.Count < 0)
                                {
                                    if (MultiSleeper <string> .Sleeping("force" + heroId))
                                    {
                                        continue;
                                    }
                                    if (isLinken)
                                    {
                                        _updater.Eul.UseAbility(enemy);
                                    }
                                    _updater.ForceStaff.UseAbility(enemy);

                                    if (enemy.CanBecomeMagicImmune && _updater.Hex != null &&
                                        _updater.Hex.CanHit(enemy) &&
                                        _updater.Hex.CanBeCasted())
                                    {
                                        _updater.Hex.UseAbility(enemy);
                                    }

                                    MultiSleeper <string> .Sleep("heroAfterForce" + heroId, 500);
                                    MultiSleeper <string> .Sleep("force" + heroId, 500);
                                }
                            }
                        }

                        EndOfActions:;
                    }

                    await Task.Delay(1);
                }
            });
        }
Example #14
0
        public override async Task ExecuteAsync(CancellationToken token)
        {
            try
            {
                var target = targetSelector.Active.GetTargets().FirstOrDefault(x => x.IsValidTarget()) as Hero;

                if (target == null || (!comboSettingsMenu.AttackBladeMailItem && target.HasModifier("modifier_item_blade_mail_reflect")) && target.HasModifier("modifier_abaddon_borrowed_time"))
                {
                    if (Orbwalker.CanMove())
                    {
                        Orbwalker.Move(Game.MousePosition);
                    }

                    return;
                }

                if (!target.IsBlockingAbilities())
                {
                    var snowball = abilities.Snowball;
                    if (comboMenu.ComboAbilitiesItem.Value.IsEnabled(snowball.Ability.Name) && snowball.CanBeCasted && !snowball.Ability.IsHidden)
                    {
                        snowball.UseAbility(target);
                        await Task.Delay(snowball.GetCastDelay(target), token);
                    }

                    var launchSnowball = abilities.LaunchSnowball;
                    if (comboMenu.ComboAbilitiesItem.Value.IsEnabled(launchSnowball.Ability.Name) && launchSnowball.CanBeCasted && target.IsValidTarget() && !launchSnowball.Ability.IsHidden)
                    {
                        launchSnowball.UseAbility();
                        await Task.Delay(launchSnowball.GetCastDelay(), token);
                    }

                    var tagTeam = abilities.TagTeam;
                    if (comboMenu.ComboAbilitiesItem.Value.IsEnabled("tusk_frozen_sigil") && tagTeam.CanBeCasted && target.IsValidTarget() && owner.IsInAttackRange(target) && Orbwalker.CanAttack(target))
                    {
                        tagTeam.UseAbility();
                        await Task.Delay(tagTeam.GetCastDelay(), token);
                    }

                    var iceShards = abilities.IceShards;
                    if (comboMenu.ComboAbilitiesItem.Value.IsEnabled(iceShards.Ability.Name) && iceShards.CanBeCasted && target.IsValidTarget() && (!this.owner.IsInAttackRange(target) && Orbwalker.CanAttack(target)) && !this.owner.HasModifier(snowball.ModifierName) && launchSnowball.Ability.IsHidden)
                    {
                        var predictionInput = new PredictionInput
                        {
                            Owner  = this.owner,
                            Delay  = iceShards.CastPoint + iceShards.ActivationDelay,
                            Range  = iceShards.CastRange,
                            Radius = iceShards.Radius,
                        };

                        var predictionOutput = prediction.GetPrediction(predictionInput.WithTarget(target));
                        var castPosition     = predictionOutput.CastPosition;

                        Vector3 position;
                        if (target.NetworkActivity == NetworkActivity.Move)
                        {
                            var castRange                = iceShards.CastRange - 200;
                            var ownersDirection          = owner.Direction2D(castRange);
                            var targetsDirection         = target.Direction2D(castRange);
                            var targetsDirectionDistance = targetsDirection.Distance2D(ownersDirection); // Useless? Maybe? Lets just leave it there.

                            var ownersDistance = Vector3.Distance(owner.NetworkPosition,
                                                                  target.NetworkPosition + targetsDirection.ToVector3());

                            var distance = Vector2.Distance(owner.NetworkPosition.To2D(), castPosition.To2D() + target.Direction2D(target.MovementSpeed));
                            var time     = (distance / iceShards.Speed);

                            if (targetsDirectionDistance < castRange && ownersDistance > castRange)
                            {
                                position = castPosition + target.Direction2D(time < 1 ? 75 + target.MovementSpeed * time : (target.MovementSpeed) * time).ToVector3();
                                if (this.owner.NetworkPosition.Distance(position) < castRange)
                                {
                                    iceShards.UseAbility(position);
                                    await Task.Delay(iceShards.GetCastDelay(position), token);
                                }
                            }
                        }
                    }

                    var walrusPunch = abilities.WalrusPunch;
                    if (comboMenu.ComboAbilitiesItem.Value.IsEnabled(walrusPunch.Ability.Name) && walrusPunch.CanBeCasted && target.IsValidTarget())
                    {
                        walrusPunch.UseAbility(target);
                        await Task.Delay(walrusPunch.GetCastDelay(), token);
                    }
                }

                if (owner.IsInAttackRange(target) && !orbwalkerSettingsMenu.LockToTargetItem || orbwalkerSettingsMenu.LockToTargetItem)
                {
                    Orbwalker.OrbwalkTo(target);
                }
                else
                {
                    if (Orbwalker.CanMove())
                    {
                        Orbwalker.Move(Game.MousePosition);
                    }
                }
            }
            catch (TaskCanceledException)
            {
                // Ignored
            }
            catch (Exception ex)
            {
                LogService.Log(LogType.Error, ex);
            }
        }
Example #15
0
        private void OnUpdate()
        {
            var Impale = Main.Impale;

            if (Menu.ImpaleRadiusItem && Impale.Ability.Level > 0)
            {
                Context.Particle.DrawRange(
                    Owner,
                    "Impale",
                    Impale.CastRange,
                    Impale.IsReady ? Color.Aqua : Color.Gray);
            }
            else
            {
                Context.Particle.Remove("Impale");
            }

            var ManaBurn = Main.ManaBurn;

            if (Menu.ManaBurnRadiusItem && ManaBurn.Ability.Level > 0)
            {
                Context.Particle.DrawRange(
                    Owner,
                    "ManaBurn",
                    ManaBurn.CastRange,
                    ManaBurn.IsReady ? Color.Aqua : Color.Gray);
            }
            else
            {
                Context.Particle.Remove("ManaBurn");
            }

            var Blink = Main.Blink;

            if (Menu.BlinkRadiusItem && Blink != null)
            {
                var color = Color.Red;
                if (!Blink.IsReady)
                {
                    color = Color.Gray;
                }
                else if (Impale.CanBeCasted)
                {
                    color = Color.Aqua;
                }

                Context.Particle.DrawRange(
                    Owner,
                    "Blink",
                    Blink.CastRange,
                    color);
            }
            else
            {
                Context.Particle.Remove("Blink");
            }

            if (Menu.TargetItem.Value.SelectedValue.Contains("Lock") && Context.TargetSelector.IsActive &&
                ((!Menu.ComboKeyItem && !Menu.MaxStunKeyItem) || Target == null || !Target.IsValid || !Target.IsAlive))
            {
                Target = Context.TargetSelector.Active.GetTargets().FirstOrDefault() as Hero;
            }
            else if (Menu.TargetItem.Value.SelectedValue.Contains("Default") && Context.TargetSelector.IsActive)
            {
                Target = Context.TargetSelector.Active.GetTargets().FirstOrDefault() as Hero;
            }

            if (Target != null)
            {
                var otherTarget =
                    EntityManager <Hero> .Entities.Where(x =>
                                                         x.IsValid &&
                                                         x.IsVisible &&
                                                         x.IsAlive &&
                                                         !x.IsIllusion &&
                                                         x != Target &&
                                                         x.Distance2D(Target) < Impale.Range - 100 &&
                                                         x.IsEnemy(Owner)).OrderBy(x => Target.Distance2D(x)).FirstOrDefault();

                BlinkPos  = Vector3.Zero;
                ImpalePos = Vector3.Zero;

                if (otherTarget != null)
                {
                    var input = new PredictionInput
                    {
                        Owner                   = Owner,
                        AreaOfEffect            = false,
                        CollisionTypes          = CollisionTypes.None,
                        Delay                   = Impale.CastPoint + Impale.ActivationDelay,
                        Speed                   = float.MaxValue,
                        Range                   = 0,
                        Radius                  = 0,
                        PredictionSkillshotType = PredictionSkillshotType.SkillshotCircle
                    };

                    var predictionInput = input.WithTarget(Target);

                    var OutputPrediction = Prediction.GetPrediction(predictionInput);
                    var blinkTargetPos   = OutputPrediction.CastPosition.Extend(OutputPrediction.CastPosition, Owner.Distance2D(OutputPrediction.CastPosition));

                    var Output = Impale.GetPredictionOutput(Impale.GetPredictionInput(otherTarget));
                    BlinkPos = Output.CastPosition.Extend(blinkTargetPos, Output.CastPosition.Distance2D(Target.Position) + 100);

                    var impaleTargetPos = Output.CastPosition.Extend(Output.CastPosition, Owner.Distance2D(Output.CastPosition));
                    ImpalePos = Target.Position.Extend(impaleTargetPos, Math.Min(Target.Distance2D(Output.CastPosition), Impale.Range - 100));

                    if (Menu.ImpaleLineItem)
                    {
                        Context.Particle.AddOrUpdate(
                            Owner,
                            "Line",
                            "materials/ensage_ui/particles/line.vpcf",
                            ParticleAttachment.AbsOrigin,
                            RestartType.None,
                            1,
                            BlinkPos,
                            2,
                            ImpalePos,
                            3,
                            new Vector3(255, 30, 0),
                            4,
                            Color.Red);

                        CircleParticle("BlinkCast", BlinkPos, true);
                        CircleParticle("ImpaleCast", ImpalePos, true);
                    }
                    else
                    {
                        Remover();
                    }
                }
                else
                {
                    Remover();
                }
            }
            else
            {
                Remover();
            }

            var comboKey = Menu.ComboKeyItem || Menu.MaxStunKeyItem;

            if (Target != null && (Menu.DrawOffTargetItem && !comboKey || Menu.DrawTargetItem && comboKey))
            {
                switch (Menu.TargetEffectTypeItem.Value.SelectedIndex)
                {
                case 0:
                    Context.Particle.DrawTargetLine(
                        Owner,
                        "NyxAssassinPlusTarget",
                        Target.Position,
                        comboKey
                            ? new Color(Menu.TargetRedItem, Menu.TargetGreenItem, Menu.TargetBlueItem)
                            : new Color(Menu.OffTargetRedItem, Menu.OffTargetGreenItem, Menu.OffTargetBlueItem));
                    break;

                case 1:
                    Context.Particle.DrawDangerLine(
                        Owner,
                        "NyxAssassinPlusTarget",
                        Target.Position,
                        comboKey
                            ? new Color(Menu.TargetRedItem, Menu.TargetGreenItem, Menu.TargetBlueItem)
                            : new Color(Menu.OffTargetRedItem, Menu.OffTargetGreenItem, Menu.OffTargetBlueItem));
                    break;

                default:
                    Context.Particle.AddOrUpdate(
                        Target,
                        "NyxAssassinPlusTarget",
                        Menu.Effects[Menu.TargetEffectTypeItem.Value.SelectedIndex],
                        ParticleAttachment.AbsOriginFollow,
                        RestartType.NormalRestart,
                        1,
                        comboKey
                            ? new Color(Menu.TargetRedItem, Menu.TargetGreenItem, Menu.TargetBlueItem)
                            : new Color(Menu.OffTargetRedItem, Menu.OffTargetGreenItem, Menu.OffTargetBlueItem),
                        2,
                        new Vector3(255));
                    break;
                }
            }
            else
            {
                Context.Particle.Remove("NyxAssassinPlusTarget");
            }

            if (Owner.HasAghanimsScepter())
            {
                Menu.MaxStunKeyItem.Item.SetFontColor(new Color(163, 185, 176, 255));
            }
            else
            {
                Menu.MaxStunKeyItem.Item.SetFontColor(Color.Black);
            }
        }