private void EffectUpdater()
        {
            if (Config.SmashRange)
            {
                ParticleManager.DrawRange(_main.Owner, "smash_range", _main.Smash.CastRange, Config.GetColor(Config.SmashRange));
            }
            else
            {
                ParticleManager.Remove("smash_range");
            }

            if (Config.GripRange)
            {
                ParticleManager.DrawRange(_main.Owner, "grip_range", _main.Grip.CastRange, Config.GetColor(Config.GripRange));
            }
            else
            {
                ParticleManager.Remove("grip_range");
            }

            if (Config.BlinkRange && _main.Blink != null)
            {
                ParticleManager.DrawRange(_main.Owner, "blink_range", _main.Blink.CastRange, Config.GetColor(Config.BlinkRange));
            }
            else
            {
                ParticleManager.Remove("blink_range");
            }
        }
示例#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);
                }
            }
        }