public Unit GetTarget()
        {
            try
            {
                switch (Mode)
                {
                case OrbwalkingMode.Pushing:
                    var barracks =
                        ObjectManager.GetEntitiesFast <Building>()
                        .FirstOrDefault(unit => unit.IsValid && unit.Team != Owner.Team && !(unit is Tower) && Owner.IsValidOrbwalkingTarget(unit));

                    if (barracks != null)
                    {
                        return(barracks);
                    }

                    var jungleMob =
                        CreepManager.GetCreepManager().GetCreeps.FirstOrDefault(
                            unit => unit.IsValid && unit.IsNeutral && Owner.IsValidOrbwalkingTarget(unit));

                    if (jungleMob != null)
                    {
                        return(jungleMob);
                    }

                    var creep =
                        CreepManager.GetCreepManager().GetCreeps.Where(
                            unit =>
                            unit.IsValid && unit.Team != Owner.Team && (Owner.IsValidOrbwalkingTarget(unit) || Owner.Distance2D(unit) <= 500)).OrderBy(x => x.Health).FirstOrDefault();

                    if (creep != null)
                    {
                        return(creep);
                    }

                    var tower =
                        ObjectManager.GetEntitiesFast <Tower>()
                        .FirstOrDefault(unit => unit.IsValid && unit.Team != Owner.Team && Owner.IsValidOrbwalkingTarget(unit));

                    if (tower != null)
                    {
                        return(tower);
                    }
                    break;

                case OrbwalkingMode.Combo:
                    return(Core.Target);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            return(null);
        }
Example #2
0
 private void MidasChecker()
 {
     if (!Me.IsAlive || Me.IsInvisible())
     {
         return;
     }
     if (Midas != null && Midas.CanBeCasted() && !_sleeper.Sleeping)
     {
         var creep =
             CreepManager.GetCreepManager()
             .GetCreeps.Where(x => x.IsValid && x.Team != Me.Team && Midas.CanHit(x) && !x.IsAncient)
             .OrderByDescending(x => x.Health).FirstOrDefault();
         if (creep != null)
         {
             Midas.UseAbility(creep);
             _sleeper.Sleep(500);
         }
     }
 }
        public override void Execute()
        {
            if (Core.TempestHero != null && Core.TempestHero.IsAlive)
            {
                if (Core.TempestHero.Orbwalker.GetTarget() == null)
                {
                    ClosestLane = GetClosestLane();
                    var lastPoint = ClosestLane.Points[ClosestLane.Points.Count - 1];
                    ClosestLane.ClosestPosition =
                        ClosestLane.Points.Where(
                            x =>
                            x.Distance2D(lastPoint) < Core.TempestHero.Hero.Position.Distance2D(lastPoint) - 300)
                        .OrderBy(CheckForDist)
                        .FirstOrDefault();

                    if (ClosestLane.ClosestPosition != null && !ClosestLane.ClosestPosition.IsZero)
                    {
                        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() && !_sleeper.Sleeping)
                            {
                                var temp = ClosestLane.Points.ToList();
                                temp.Reverse();
                                var enemyCreeps =
                                    CreepManager.GetCreepManager()
                                    .GetCreeps.Where(x => x.Team != ObjectManager.LocalHero.Team);
                                Creep creepForTravels = null;

                                foreach (var v in temp)
                                {
                                    creepForTravels = CreepManager.GetCreepManager()
                                                      .GetCreeps.FirstOrDefault(
                                        y =>
                                        y.IsValid && y.HealthPercent() > 0.75 && v.IsInRange(y.Position, 1500) &&
                                        y.Team == ObjectManager.LocalHero.Team &&
                                        enemyCreeps.Any(z => z.IsInRange(y, 1500)));
                                    if (creepForTravels != null)
                                    {
                                        break;
                                    }
                                }
                                if (creepForTravels != null && creepForTravels.Distance2D(Core.TempestHero.Hero) > 1500)
                                {
                                    travels.UseAbility(creepForTravels);
                                    _sleeper.Sleep(500);
                                }
                            }
                        }
                        if (_sleeper.Sleeping)
                        {
                            return;
                        }
                        _sleeper.Sleep(250);
                        Core.TempestHero.Hero.Move(ClosestLane.ClosestPosition);
                        ClosestPosition = ClosestLane.ClosestPosition;
                    }
                }
                else if (!_sleeper.Sleeping)
                {
                    if (Core.TempestHero.Spark.CanBeCasted())
                    {
                        Core.TempestHero.Spark.UseAbility(Core.TempestHero.Orbwalker.GetTarget().Position);
                        _sleeper.Sleep(500);
                    }

                    var mjol = Core.TempestHero.Hero.GetItemById(ItemId.item_mjollnir);
                    if (mjol != null && mjol.CanBeCasted())
                    {
                        var allyCreep =
                            CreepManager.GetCreepManager()
                            .GetCreeps
                            .FirstOrDefault(
                                x =>
                                x.Team == ObjectManager.LocalHero.Team &&
                                x.IsInRange(Core.TempestHero.Hero, 500) && x.HealthPercent() <= 0.92 && x.IsMelee);
                        if (allyCreep != null)
                        {
                            mjol.UseAbility(allyCreep);
                            _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 => 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;
                    }
                }
            }
        }