Example #1
0
        public virtual bool CanBeCasted(Unit target)
        {
            if (target == null || !target.IsValid || !Menu.IsEnabled(target.StoredName()))
            {
                return(false);
            }

            if (!target.IsAlive || !target.IsVisible || UnitExtensions.IsMagicImmune(target) ||
                EntityExtensions.Distance2D(target, Manager.MyHero.Position) > GetCastRange() || target.IsInvul() ||
                target.IsReflectingAbilities())
            {
                return(false);
            }

            if (!Menu.BreakLinkens && UnitExtensions.IsLinkensProtected(target))
            {
                return(false);
            }

            if (!Menu.HexStack && target.IsReallyHexed())
            {
                return(false);
            }

            if (!Menu.SilenceStack && UnitExtensions.IsSilenced(target) && !target.IsReallyHexed())
            {
                return(false);
            }

            if (!Menu.RootStack && UnitExtensions.IsRooted(target))
            {
                return(false);
            }

            if (!Menu.StunStack && UnitExtensions.IsStunned(target))
            {
                return(false);
            }

            if (!Menu.DisarmStack && UnitExtensions.IsDisarmed(target) && !target.IsReallyHexed())
            {
                return(false);
            }

            return(true);
        }
Example #2
0
        public override void Execute()
        {
            if (Core.TempestHero != null && Core.TempestHero.Hero.IsAlive)
            {
                if (UnitExtensions.HasModifier(Core.TempestHero.Hero, "modifier_teleporting"))
                {
                    return;
                }
                if (UnitExtensions.IsChanneling(Core.TempestHero.Hero))
                {
                    return;
                }
                if (_sleeper.Sleeping)
                {
                    return;
                }
                _sleeper.Sleep(150);
                var currentLane = GetLane(Core.TempestHero.Hero);
                CurrentLane = currentLane;
                var target = Core.TempestHero.Orbwalker.GetTarget();
                if (target == null || target.Position.IsZero || !target.IsAlive)
                {
                    var path      = FindOrGetNeededPath(Core.TempestHero.Hero);
                    var lastPoint = path[path.Count - 1];
                    var closest   = path.Where(
                        x =>
                        x.Distance2D(lastPoint) < Core.TempestHero.Hero.Position.Distance2D(lastPoint) - 300)
                                    .OrderBy(pos => CheckForDist(pos, Core.TempestHero.Hero))
                                    .FirstOrDefault();
                    Core.TempestHero.Hero.Move(closest);
                    Status = "Moving";
                    if (MenuManager.UseTravels)
                    {
                        var travels = Core.TempestHero.Hero.GetItemById(AbilityId.item_travel_boots) ??
                                      Core.TempestHero.Hero.GetItemById(AbilityId.item_travel_boots_2);
                        if (travels != null && travels.CanBeCasted())
                        {
                            Status = "Moving [?TP]";
                            var temp = path.ToList();
                            temp.Reverse();
                            if (MenuManager.CheckForCreeps)
                            {
                                var enemyCreeps =
                                    EntityManager <Creep> .Entities.Where(
                                        x =>
                                        x.IsValid && x.IsVisible && x.IsAlive &&
                                        x.Team != ObjectManager.LocalHero.Team &&
                                        Map.GetLane(x) == currentLane);

                                Creep creepForTravels = null;

                                var allyCreeps =
                                    EntityManager <Creep> .Entities.Where(
                                        allyCreep => allyCreep.IsValid && allyCreep.IsAlive &&
                                        allyCreep.Team == ObjectManager.LocalHero.Team &&
                                        Map.GetLane(allyCreep) == currentLane &&
                                        allyCreep.HealthPercent() > 0.75).ToList();

                                foreach (var point in temp)
                                {
                                    creepForTravels = allyCreeps.FirstOrDefault(
                                        allyCreep =>
                                        point.IsInRange(allyCreep.Position, 1500) &&
                                        enemyCreeps.Any(z => z.IsInRange(allyCreep, 1500)));
                                    if (creepForTravels != null)
                                    {
                                        break;
                                    }
                                }

                                if (creepForTravels != null && creepForTravels.Distance2D(Core.TempestHero.Hero) > 1500)
                                {
                                    var point     = path[path.Count - 1];
                                    var distance1 = point.Distance2D(creepForTravels);
                                    var distance2 = point.Distance2D(Core.TempestHero.Hero);

                                    if (distance1 < distance2 || Map.GetLane(Core.TempestHero.Hero) != currentLane)
                                    {
                                        travels.UseAbility(creepForTravels);
                                        Status = "Doing Tp";
                                        _sleeper.Sleep(1000);
                                        return;
                                    }
                                }
                            }
                            else
                            {
                                var finalPos = temp.First();
                                var ally     =
                                    EntityManager <Creep> .Entities.Where(
                                        allyCreep => allyCreep.IsValid && allyCreep.IsAlive &&
                                        allyCreep.Team == ObjectManager.LocalHero.Team &&
                                        Map.GetLane(allyCreep) == currentLane &&
                                        allyCreep.HealthPercent() > 0.75)
                                    .OrderBy(y => EntityExtensions.Distance2D(y, finalPos))
                                    .FirstOrDefault();

                                var allyTwr =
                                    EntityManager <Tower> .Entities.Where(
                                        allyCreep => allyCreep.IsValid && allyCreep.IsAlive &&
                                        allyCreep.Team == ObjectManager.LocalHero.Team &&
                                        Map.GetLane(allyCreep) == currentLane &&
                                        allyCreep.HealthPercent() > 0.1)
                                    .OrderBy(y => EntityExtensions.Distance2D(y, finalPos))
                                    .FirstOrDefault();

                                Unit tpTarget = null;
                                if (ally != null && allyTwr != null)
                                {
                                    var dist1 = finalPos.Distance2D(ally);
                                    var dist2 = finalPos.Distance2D(allyTwr);

                                    if (dist1 > dist2)
                                    {
                                        tpTarget = allyTwr;
                                    }
                                    else
                                    {
                                        tpTarget = ally;
                                    }
                                }

                                if (tpTarget != null && tpTarget.Distance2D(Core.TempestHero.Hero) > 1500)
                                {
                                    var point     = path[path.Count - 1];
                                    var distance1 = point.Distance2D(tpTarget);
                                    var distance2 = point.Distance2D(Core.TempestHero.Hero);

                                    if (distance1 < distance2 || Map.GetLane(Core.TempestHero.Hero) != currentLane)
                                    {
                                        travels.UseAbility(tpTarget.Position);
                                        _sleeper.Sleep(1000);
                                        Status = "Doing Tp";
                                        return;
                                    }
                                }
                            }
                        }
                    }

                    try
                    {
                        foreach (var illusion in IllusionManager.GetIllusions)
                        {
                            illusion.Hero.Move(closest);
                        }
                        foreach (var necro in NecronomiconManager.GetNecronomicons)
                        {
                            necro.Necr.Move(closest);
                        }
                    }
                    catch (Exception e)
                    {
                        Printer.Both("kek " + e.Message);
                    }
                }
                else
                {
                    Status = $"Pushing{(target is Tower ? " Tower" : "")}";
                    if (Core.TempestHero.Spark.CanBeCasted())
                    {
                        Printer.Log(
                            $"[AutoPushing][Spark][{target.Name} ({target.NetworkName})]->{target.Position.PrintVector()}",
                            true);
                        if (!target.Position.IsZero)
                        {
                            Core.TempestHero.Spark.UseAbility(target.Position);
                            Status = "Casting spark";
                            _sleeper.Sleep(500);
                            return;
                        }
                    }

                    var itemForPushing = Core.TempestHero.Hero.GetItemById(ItemId.item_mjollnir);
                    if (itemForPushing != null && itemForPushing.CanBeCasted())
                    {
                        var allyCreep =
                            EntityManager <Creep> .Entities
                            .FirstOrDefault(
                                x =>
                                x.IsAlive && x.Team == ObjectManager.LocalHero.Team &&
                                x.IsInRange(Core.TempestHero.Hero, 500) && x.HealthPercent() <= 0.92 &&
                                x.IsMelee);

                        if (allyCreep != null)
                        {
                            itemForPushing.UseAbility(allyCreep);
                            _sleeper.Sleep(500);
                        }
                    }

                    itemForPushing = Core.TempestHero.Hero.GetItemById(ItemId.item_manta);

                    if (itemForPushing != null && itemForPushing.CanBeCasted())
                    {
                        itemForPushing.UseAbility();
                        _sleeper.Sleep(500);
                    }

                    itemForPushing = Core.TempestHero.Hero.GetItemById(ItemId.item_necronomicon) ??
                                     Core.TempestHero.Hero.GetItemById(ItemId.item_necronomicon_2) ??
                                     Core.TempestHero.Hero.GetItemById(ItemId.item_necronomicon_3);
                    if (itemForPushing != null && itemForPushing.CanBeCasted())
                    {
                        itemForPushing.UseAbility();
                        _sleeper.Sleep(500);
                    }

                    if (Core.TempestHero.Orbwalker.GetTarget() is Tower)
                    {
                        var field = Core.TempestHero.MagneticField;
                        if (field.CanBeCasted())
                        {
                            var pos =
                                (Core.TempestHero.Orbwalker.GetTarget().NetworkPosition -
                                 Core.TempestHero.Hero.NetworkPosition).Normalized();
                            pos *= 280 + 150;
                            pos  = Core.TempestHero.Orbwalker.GetTarget().NetworkPosition - pos;
                            field.UseAbility(pos);
                            _sleeper.Sleep(1000);
                        }
                    }
                }

                if (MenuManager.AutoPushingTargetting)
                {
                    var enemyHero =
                        Heroes.GetByTeam(ObjectManager.LocalHero.GetEnemyTeam())
                        .FirstOrDefault(
                            x => x.IsVisible && x.IsAlive && x.IsInRange(Core.TempestHero.Hero,
                                                                         MenuManager
                                                                         .AutoPushingTargettingRange) /*Core.TempestHero.Hero.IsValidOrbwalkingTarget(x)*/);
                    if (enemyHero != null)
                    {
                        //OrderManager.ChangeOrder(OrderManager.Orders.SparkSpamTempest);
                        Core.Target = enemyHero;
                        MenuManager.TempestCombo.SetValue(new KeyBind(MenuManager.TempestCombo.GetValue <KeyBind>().Key,
                                                                      KeyBindType.Toggle, true));
                        Core.Target = enemyHero;
                        ParticleManager?.Remove("targetting_range");
                    }
                    else
                    {
                        if (MenuManager.DrawTargettingRange)
                        {
                            ParticleManager.DrawRange(Core.TempestHero.Hero, "targetting_range",
                                                      MenuManager.AutoPushingTargettingRange, Color.White);
                        }
                    }
                }
            }
            else
            {
                Status = "Tempest is dead";
                var illusions = IllusionManager.GetIllusions.Where(x => x.Orbwalker.GetTarget() == null).ToList();
                var necros    = NecronomiconManager.GetNecronomicons.Where(x => x.Orbwalker.GetTarget() == null).ToList();
                var any       = illusions.Any() || necros.Any();
                if (any)
                {
                    foreach (var illusion in illusions)
                    {
                        var path      = FindOrGetNeededPath(illusion.Hero);
                        var lastPoint = path[path.Count - 1];
                        var closest   = path.Where(
                            x =>
                            x.Distance2D(lastPoint) <
                            Core.TempestHero.Hero.Position.Distance2D(lastPoint) - 300)
                                        .OrderBy(pos => CheckForDist(pos, Core.TempestHero.Hero))
                                        .FirstOrDefault();
                        illusion.Hero.Move(closest);
                    }

                    foreach (var necro in necros)
                    {
                        var path      = FindOrGetNeededPath(necro.Necr);
                        var lastPoint = path[path.Count - 1];
                        var closest   = path.Where(
                            x =>
                            x.Distance2D(lastPoint) <
                            Core.TempestHero.Hero.Position.Distance2D(lastPoint) - 300)
                                        .OrderBy(pos => CheckForDist(pos, Core.TempestHero.Hero))
                                        .FirstOrDefault();
                        necro.Necr.Move(closest);
                    }

                    _sleeper.Sleep(500);
                }
            }
        }
Example #3
0
        public override async Task ExecuteAsync(CancellationToken token)
        {
            if (!config.Enabled)
            {
                return;
            }

            var target = targetSelector.Active.GetTargets().FirstOrDefault();

            if (target == null)
            {
                Orbwalker.OrbwalkTo(null);
                return;
            }

            if (!Owner.CanCast())
            {
                return;
            }

            var posForHitChance     = target.BasePredict(450 + Game.Ping);
            var distanceToHitChance = EntityExtensions.Distance2D(Owner, posForHitChance);
            var blink      = Owner.GetItemById(AbilityId.item_blink);
            var force      = Owner.GetItemById(AbilityId.item_force_staff);
            var blinkReady = blink != null && blink.CanBeCasted() && config.UseItemsInit.Value.IsEnabled(blink.Name);
            var forceReady = force != null && force.CanBeCasted() && config.UseItemsInit.Value.IsEnabled(force.Name);

            if (config.EnabledForcePlusBlink && forceReady && blinkReady)
            {
                if (distanceToHitChance < 1900 && distanceToHitChance > 1200 && Q.CanBeCasted())
                {
                    await TurnTo(posForHitChance, token);

                    if (Vector3Extensions.Distance(UnitExtensions.InFront(Owner, 600), posForHitChance) < 1200)
                    {
                        force.UseAbility(Owner);
                        await Task.Delay(10, token);
                    }
                }
            }

            if (blinkReady)
            {
                if (distanceToHitChance < 1200 && !Q.CanHit(target) && Q.CanBeCasted())
                {
                    blink.UseAbility(posForHitChance);
                    await Task.Delay(10, token);
                }
            }

            if (forceReady)
            {
                if (distanceToHitChance < 750 && !Q.CanHit(target) && Q.CanBeCasted())
                {
                    await TurnTo(posForHitChance, token);

                    if (Vector3Extensions.Distance(UnitExtensions.InFront(Owner, 600), posForHitChance) < 260)
                    {
                        force.UseAbility(Owner);
                        await Task.Delay(10, token);
                    }
                }
            }

            await Kill(token);

            if (Q.CanBeCasted())
            {
                if (Q.CanHit(target) && !target.HasModifiers(cuntCullModifiers, false))
                {
                    Q.UseAbility();
                    await Task.Delay((int)(Q.FindCastPoint() * 1000 + Game.Ping), token);
                }

                Orbwalker.Move(posForHitChance);
            }
            else
            {
                Orbwalker.OrbwalkTo(target);
            }

            await UseItems(target, token);
        }