Ejemplo n.º 1
0
            public override void useSpell()
            {
                if (!spell.IsReady() || lastCast + 700 > DeathWalker.now)
                {
                    return;
                }
                lastCast = DeathWalker.now;

                if (spell.Instance.Name.ToLower().Equals("snowballfollowupcast"))
                {
                    if (snowed != null)
                    {
                        if (MapControl.safeGap(snowed))
                        {
                            spell.Cast();
                            Aggresivity.addAgresiveMove(new AgresiveMove(100, 2500, true));
                        }
                    }
                }
                else
                {
                    var tar = ARAMTargetSelector.getBestTarget(spell.Range);
                    if (tar != null)
                    {
                        spell.Cast(tar);
                        snowed = tar;
                    }
                }
            }
Ejemplo n.º 2
0
        public static void updateArmaPlay()
        {
            try
            {
                if (!haveSeenMinion)
                {
                    haveSeenMinion =
                        ObjectManager.Get <Obj_AI_Minion>().Any(min => min.IsTargetable && min.IsHPBarRendered && min.IsAlly && min.Health > 50) ||
                        ARAMDetFull.gameStart + 44 * 1000 < ARAMDetFull.now;
                }

                if (!haveSeenMinion)
                {
                    return;
                }

                try
                {
                    AutoLevelChamp.LevelUpOff();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }

                if ((player.InShop() || player.IsDead))
                {
                    buyItems();
                }

                if (champ != null)
                {
                    champ.alwaysCheck();
                }

                setRambo();

                if (player.IsDead || player.IsChannelingImportantSpell())
                {
                    return;
                }

                var fightLevel = MapControl.fightLevel();
                MapControl.updateReaches();

                var closestEnemy = EloBuddy.SDK.EntityManager.Heroes.Enemies.Where(ene => !ene.IsDead && ene.IsTargetable && ene.IsHPBarRendered && !ARAMTargetSelector.IsInvulnerable(ene)).OrderBy(ene => player.Position.Distance(ene.Position, true)).FirstOrDefault();
                if (closestEnemy != null && ramboMode)
                {
                    DeathWalker.deathWalk(closestEnemy.Position, true);
                    return;
                }

                if (fightLevel != 0)
                {
                    Aggresivity.addAgresiveMove(new AgresiveMove(40 * fightLevel, 2000, true, true));
                }

                agrobalance = Aggresivity.getAgroBalance();

                balance  = (ARAMTargetSelector.IsInvulnerable(player) || player.IsZombie) ? 250 : MapControl.balanceAroundPointAdvanced(player.Position.To2D(), 250 - agrobalance * 5) + agrobalance;
                inDanger = balance < 0;

                if (champ != null)
                {
                    try
                    {
                        if (player.GetEnemiesInRange(ARAMSimulator.farmRange).Count(ene => !ene.IsDead && !ene.IsZombie) != 0)
                        {
                            champ.killSteal();
                        }
                        else
                        {
                            champ.farm();
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                }

                if (!Sector.inTowerRange(player.Position.To2D()) || towerAttackedAlly || player.HealthPercent < 25)
                {
                    try
                    {
                        ItemHandler.useItems();
                        sSpells.useSumoners();
                        if (champ != null)
                        {
                            champ.useSpells();
                        }
                        else
                        {
                            MapControl.myControler.useSpells();
                            if (player.MaxMana < 350 || player.ManaPercent > 50)
                            {
                                MapControl.myControler.useSpellsOnMinions();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                }

                deepestAlly = EloBuddy.SDK.EntityManager.Heroes.Allies.OrderBy(al => toNex.Position.Distance(al.Position, true)).FirstOrDefault();

                var lookRange = player.AttackRange + ((player.IsMelee) ? 260 : 155);
                var easyKill  =
                    EloBuddy.SDK.EntityManager.Heroes.Enemies.FirstOrDefault(ene => ene != null && !ene.IsZombie && !ene.IsDead && ene.Distance(player, true) < lookRange * lookRange &&
                                                                             !ARAMTargetSelector.IsInvulnerable(ene) && ene.Health / 1.5 < player.GetAutoAttackDamage(ene) && ene.IsHPBarRendered);

                if (easyKill != null && easyKill.IsValidTarget())
                {
                    Aggresivity.addAgresiveMove(new AgresiveMove(45, 1500, true));
                    DeathWalker.deathWalk(easyKill.Position.To2D().Extend(player.Position.To2D(), player.AttackRange * 0.7f).To3D(), true);
                }


                if (balance < 0)
                {
                    DeathWalker.deathWalk(player.Position.To2D().Extend(fromNex.Position.To2D(), 632).To3D(), true);
                }

                if ((!player.IsMelee || fightLevel < 2) && EloBuddy.SDK.EntityManager.Heroes.Enemies.Any(h => !h.IsDead) && moveToRelicIfForHeal())
                {
                    return;
                }

                if (!player.UnderTurret(true))
                {
                    towerAttackedMe   = false;
                    towerAttackedAlly = false;
                }

                if (towerAttackedMe)
                {
                    DeathWalker.CustomOrbwalkMode = false;
                    DeathWalker.deathWalk(player.Position.To2D().Extend(fromNex.Position.To2D(), 600).To3D(), true);
                    return;
                }

                awayTo = eAwayFromTo();
                if (awayTo.IsValid() && awayTo.X != 0)
                {
                    DeathWalker.CustomOrbwalkMode = false;
                    if (champ != null)
                    {
                        champ.kiteBack(awayTo);
                    }
                    DeathWalker.deathWalk(awayTo.To3D(), true);
                    return;
                }
                else
                {
                    var closestObj =
                        EloBuddy.SDK.EntityManager.Turrets.Enemies.Where(
                            obj => obj.IsValidTarget(700) && !obj.IsDead && !obj.IsInvulnerable && obj.IsTargetable)
                        .OrderBy(obj => obj.Position.Distance(player.Position, true)).FirstOrDefault();

                    if (closestObj != null && (!(closestObj is Obj_AI_Turret) || Sector.towerContainsAlly((Obj_AI_Turret)closestObj)))
                    {
                        DeathWalker.deathWalk(
                            closestObj.Position.Extend(player.Position, player.AttackRange * 0.6f), true);
                        return;
                    }

                    if (player.IsMelee)
                    {
                        var safeMeleeEnem = ARAMTargetSelector.getSafeMeleeTarget();
                        if (safeMeleeEnem != null && safeMeleeEnem.IsValidTarget())
                        {
                            DeathWalker.deathWalk(safeMeleeEnem.Position.Extend(safeMeleeEnem.Direction, player.AttackRange * 0.3f), true);
                            return;
                        }
                    }
                    var fightOn = MapControl.fightIsOn();
                    if (fightOn != null && MapControl.balanceAroundPointAdvanced(fightOn.Position.To2D(), 280, 450) > (-130) && fightOn.Distance(player, true) < 2500 * 2500 && (!player.IsMelee() || !Sector.inTowerRange(fightOn.Position.To2D())))
                    {
                        Aggresivity.addAgresiveMove(new AgresiveMove(40 * MapControl.fightLevel(), 2000, true, true));
                        DeathWalker.deathWalk(fightOn.Position.Extend(player.Position, player.AttackRange * 0.8f), true);
                    }
                    else
                    {
                        if (!inDanger)
                        {
                            Sector orbSector  = null;
                            Sector prevSector = null;
                            foreach (var sector in sectors)
                            {
                                sector.update();
                                int sectorCheck = 1150 - MapControl.fearDistance;
                                if (sector.containsEnemyChamp && sector.enemyChampIn.Distance(player, true) < sectorCheck * sectorCheck)
                                {
                                    orbSector = sector;
                                    break;
                                }
                                if (sector.dangerPolig)
                                {
                                    break;
                                }
                                if (sector.containsEnemy && !sector.containsAlly)
                                {
                                    break;
                                }
                                orbSector = sector;
                                if (sector.containsEnemy && sector.containsAlly)
                                {
                                    break;
                                }
                                prevSector = sector;
                            }
                            if (orbSector == null)
                            {
                                return;
                            }
                            DeathWalker.deathWalk(orbSector.getRandomPointIn().To3D(), false, true);
                        }
                        else
                        {
                            DeathWalker.deathWalk(player.Position.To2D().Extend(fromNex.Position.To2D(), 600).To3D(), false);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 3
0
        public static void updateArmaPlay()
        {
            if (!haveSeenMinion)
            {
                haveSeenMinion =
                    ObjectManager.Get <Obj_AI_Minion>().Any(min => min.IsTargetable && min.IsAlly && min.Health > 50) ||
                    ARAMDetFull.gameStart + 44 * 1000 < ARAMDetFull.now;
            }
            if (!haveSeenMinion)
            {
                return;
            }
            try
            {
                AutoLevelChamp.LevelUpOff();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            if ((player.InShop() || player.IsDead) /* && nextItem != null && nextItem.goldReach <= player.Gold*/)
            {
                buyItems();
            }
            if (champ != null)
            {
                champ.alwaysCheck();
            }

            setRambo();
            if (player.IsDead || (player.IsChannelingImportantSpell() && player.ChampionName != "Varus"))
            {
                champ?.castingImportantSpell();
                return;
            }

            var fightLevel = MapControl.fightLevel();

            MapControl.updateReaches();

            var closestEnemy = HeroManager.Enemies.Where(ene => !ene.IsDead && ene.IsTargetable && !ARAMTargetSelector.IsInvulnerable(ene)).OrderBy(ene => player.Position.Distance(ene.Position, true)).FirstOrDefault();

            if (closestEnemy != null && ramboMode)
            {
                DeathWalker.deathWalk(closestEnemy.Position, true);
                return;
            }

            if (fightLevel != 0)
            {
                Aggresivity.addAgresiveMove(new AgresiveMove(40 * fightLevel, 2000, true, true));
            }

            agrobalance = Aggresivity.getAgroBalance();

            balance  = (ARAMTargetSelector.IsInvulnerable(player) || player.IsZombie) ? 250 : MapControl.balanceAroundPointAdvanced(player.Position.To2D(), 250 - agrobalance * 5) + agrobalance;
            inDanger = balance < 0;

            if (Game.MapId == GameMapId.SummonersRift)
            {
                if (player.IsRecalling() || needRecall && lastRecall + 1000 > DeathWalker.now)
                {
                    return;
                }
                if (player.InFountain() && player.HealthPercent < 90)
                {
                    player.IssueOrder(GameObjectOrder.Stop, player);
                    return;
                }
                if (player.HealthPercent > 85 && (player.MaxMana < 450 || player.ManaPercent > 85))
                {
                    needRecall = false;
                }
                if ((((player.HealthPercent < 32 || (player.MaxMana > 450 && player.ManaPercent < 5)) && player.CountEnemiesInRange(1000) == 0) || needRecall) && balance > 5)
                {
                    if (lastRecall + 9000 < DeathWalker.now)
                    {
                        needRecall = true;
                        var recall = new Spell(SpellSlot.Recall);
                        recall.Cast();
                        lastRecall = DeathWalker.now;
                        return;
                    }
                }
                if (needRecall)
                {
                    player.IssueOrder(GameObjectOrder.MoveTo, fromNex.Position.Randomize(534, 1005));
                    return;
                }
            }

            if (champ != null)
            {
                try
                {
                    if (player.GetEnemiesInRange(ARAMSimulator.farmRange).Count(ene => !ene.IsDead && !ene.IsZombie) != 0)
                    {
                        champ.killSteal();
                    }
                    else
                    {
                        champ.farm();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
            }

            if (!Sector.inTowerRange(player.Position.To2D()) || towerAttackedAlly || player.HealthPercent < 25)
            {
                try
                {
                    ItemHandler.useItems();
                    sSpells.useSumoners();
                    if (champ != null)
                    {
                        champ.useSpells();
                    }
                    else
                    {
                        MapControl.myControler.useSpells();
                        if (player.MaxMana < 280 || player.ManaPercent > 50)
                        {
                            MapControl.myControler.useSpellsOnMinions();
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
            }

            deepestAlly = HeroManager.Allies.OrderBy(al => toNex.Position.Distance(al.Position, true)).FirstOrDefault();
            var lookRange = player.AttackRange + ((player.IsMelee) ? 260 : 155);
            var easyKill  =
                HeroManager.Enemies.FirstOrDefault(ene => ene != null && !ene.IsZombie && !ene.IsDead && ene.Distance(player, true) < lookRange * lookRange &&
                                                   !ARAMTargetSelector.IsInvulnerable(ene) && ene.Health / 1.5 < player.GetAutoAttackDamage(ene));

            if (easyKill != null)
            {
                Aggresivity.addAgresiveMove(new AgresiveMove(45, 1500, true));
                //Console.WriteLine("go get easy");
                DeathWalker.deathWalk(easyKill.Position.To2D().Extend(player.Position.To2D(), player.AttackRange * 0.7f).To3D(), true);
            }


            if (balance < 0)
            {
                DeathWalker.deathWalk(player.Position.To2D().Extend(fromNex.Position.To2D(), 632).To3D(), true);
            }

            if ((!player.IsMelee || fightLevel < 2) && HeroManager.Enemies.Any(h => !h.IsDead) && moveToRelicIfForHeal())
            {
                return;
            }

            if (!player.UnderTurret(true))
            {
                towerAttackedMe   = false;
                towerAttackedAlly = false;
            }

            if (towerAttackedMe)
            {
                DeathWalker.CustomOrbwalkMode = false;
                // Game.PrintChat("ouch tower!");
                DeathWalker.deathWalk(player.Position.To2D().Extend(fromNex.Position.To2D(), 600).To3D(), true);
                return;
            }

            awayTo = eAwayFromTo();
            if (balance < 70 && awayTo.IsValid() && awayTo.X != 0)
            {
                DeathWalker.CustomOrbwalkMode = false;
                if (champ != null)
                {
                    champ.kiteBack(awayTo);
                }
                DeathWalker.deathWalk(awayTo.To3D(), true);
                return;
            }
            else
            {
                var closestObj =
                    DeathWalker.EnemyObjectives.Where(
                        obj => obj.IsValidTarget(700) && !obj.IsDead && !obj.IsInvulnerable)
                    .OrderBy(obj => obj.Position.Distance(player.Position, true)).FirstOrDefault();
                if (closestObj != null && (!(closestObj is Obj_AI_Turret) || Sector.towerContainsAlly((Obj_AI_Turret)closestObj)))
                {
                    DeathWalker.deathWalk(
                        closestObj.Position.Extend(player.Position, player.AttackRange * 0.6f), true);
                    return;
                }

                if (player.IsMelee)
                {
                    var safeMeleeEnem = ARAMTargetSelector.getSafeMeleeTarget();
                    if (safeMeleeEnem != null)
                    {
                        DeathWalker.deathWalk(
                            safeMeleeEnem.Position.Extend(safeMeleeEnem.Direction, player.AttackRange * 0.3f), true);
                        return;
                    }
                }
                var fightOn = MapControl.fightIsOn();
                if (fightOn != null && MapControl.balanceAroundPointAdvanced(fightOn.Position.To2D(), 280, 450) > (-130) && fightOn.Distance(player, true) < 2500 * 2500 && (!player.IsMelee() || !Sector.inTowerRange(fightOn.Position.To2D())))
                {
                    Aggresivity.addAgresiveMove(new AgresiveMove(40 * MapControl.fightLevel(), 3000, true, true));
                    DeathWalker.deathWalk(fightOn.Position.Extend(player.Position, player.AttackRange * 0.6f), true);
                }
                else
                {/*
                  * if (player.HealthPercent < 69 && moveToRelicIfForHeal())
                  * {
                  *     return;
                  * }*/
                    if (!inDanger)
                    {
                        Sector orbSector  = null;
                        Sector prevSector = null;
                        foreach (var sector in sectors)
                        {
                            sector.update();
                            int sectorCheck = 1150 - MapControl.fearDistance;
                            if (sector.containsEnemyChamp && sector.enemyChampIn.Distance(player, true) < sectorCheck * sectorCheck)
                            {
                                orbSector = sector;
                                break;
                            }
                            if (sector.dangerPolig)
                            {
                                break;
                            }
                            //  if (!player.IsMelee)
                            // {
                            if (sector.containsEnemy && !sector.containsAlly)
                            {
                                break;
                            }
                            // }
                            // else
                            //  {
                            //     if (prevSector != null && sector.containsEnemy && !prevSector.containsAlly  && !sector.containsAlly)
                            //         break;
                            //  }
                            orbSector = sector;
                            if (sector.containsEnemy && sector.containsAlly)
                            {
                                break;
                            }
                            prevSector = sector;
                        }
                        if (orbSector == null)
                        {
                            return;
                        }
                        DeathWalker.deathWalk(orbSector.getRandomPointIn().To3D(), false, true);
                    }
                    else
                    {
                        DeathWalker.deathWalk(player.Position.To2D().Extend(fromNex.Position.To2D(), 333).To3D(), false);
                    }
                }
            }



            /*foreach (var ally in MapControl.ally_champions)
             * {
             *  if (ally.hero.Distance(player) < 800 && MapControl.myControler != null)
             *      MapControl.myControler.useNonSkillshots(ally.hero);
             * }*/
        }
Ejemplo n.º 4
0
        public void update()
        {
            enemyChampIn       = null;
            enemyTowerIn       = null;
            containsAlly       = false;
            containsAllyMinion = false;
            containsEnemy      = false;
            dangerPolig        = false;
            containsAllyChamp  = false;
            containsEnemyChamp = false;
            enem = null;
            int dangLVL = 0;

            foreach (var obj in ObjectManager.Get <AttackableUnit>())
            {
                if (obj.IsDead || obj.Health == 0 || !obj.IsValid || !obj.IsVisible || obj.IsInvulnerable || obj.IsMe)
                {
                    continue;
                }

                if ((!containsAlly || !containsAllyMinion) && obj.IsAlly && !obj.IsDead)
                {
                    if (polig.pointInside(obj.Position.To2D()))
                    {
                        containsAlly = true;
                        if (obj is Obj_AI_Minion)
                        {
                            containsAllyMinion = true;
                        }
                    }
                }

                if (!containsEnemy && obj.IsEnemy && obj is Obj_AI_Minion && !MapControl.fightIsClose() && !ARAMTargetSelector.IsInvulnerable(ObjectManager.Player) && !Aggresivity.getIgnoreMinions())
                {
                    if (!obj.IsDead && ((Obj_AI_Minion)obj).SkinName != "GangplankBarrel" && obj.Health > 0 && obj.IsValidTarget() && polig.pointInside(obj.Position.To2D()))
                    {
                        containsEnemy = true;
                        enem          = obj;
                    }
                }
                if (containsEnemy && containsAlly)
                {
                    break;
                }
            }

            foreach (var en_chemp in MapControl.enemy_champions)
            {
                en_chemp.getReach();
                //Console.WriteLine(en_chemp.reach);
                if (!en_chemp.hero.IsDead && (en_chemp.hero.IsVisible || ARAMSimulator.deepestAlly.IsMe || NavMesh.GetCollisionFlags(en_chemp.hero.Position) == CollisionFlags.Grass) && (sectorInside(en_chemp.hero.Position.To2D(), en_chemp.hero.AttackRange + 120) ||
                                                                                                                                                                                          sectorInside(en_chemp.hero.Position.To2D(), en_chemp.reach)))
                {
                    dangLVL++;
                    containsEnemyChamp = true;
                    if (enemyChampIn == null || (enemyChampIn.Health > en_chemp.hero.Health && !enemyChampIn.IsZombie && !ARAMTargetSelector.IsInvulnerable(enemyChampIn)))
                    {
                        enemyChampIn = en_chemp.hero;
                    }
                }
            }

            foreach (var al_chemp in MapControl.ally_champions)
            {
                if (al_chemp.hero.IsValidTarget() && !al_chemp.hero.IsDead && polig.pointInside(al_chemp.hero.Position.To2D()))
                {
                    dangLVL--;
                    containsAllyChamp = true;
                }
            }
            if (dangLVL > 0)
            {
                dangerPolig = true;
            }

            foreach (var turret in ObjectManager.Get <Obj_AI_Turret>())
            {
                if (turret.IsEnemy && !turret.IsDead && turret.IsValid && sectorInside(turret.Position.To2D(), 1050))
                {
                    if (polig.pointInside(turret.Position.To2D()))
                    {
                        enemyTowerIn = turret;
                        dangerPolig  = true;
                        break;
                    }

                    if (!towerContainsAlly(turret))
                    {
                        dangerPolig = true;
                        break;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public static AttackableUnit GetPossibleTarget(bool onlyChamps = false)
        {
            if (ForcedTarget != null)
            {
                if (InAutoAttackRange(ForcedTarget))
                {
                    return(ForcedTarget);
                }
                ForcedTarget = null;
            }
            var camp = GetBestHeroTarget();

            if (camp != null)
            {
                return(camp);
            }
            CurrentMode = (Aggresivity.getIgnoreMinions() || onlyChamps) ? Mode.Lasthit : Mode.LaneClear;
            Obj_AI_Base tempTarget = null;

            //Well fuk it we need win the game not kda!!!
            /*turrets*/
            if (CurrentMode == Mode.LaneClear || CurrentMode == Mode.Lasthit || true)
            {
                foreach (var turret in
                         EnemyTowers.Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                {
                    return(turret);
                }
            }


            /*inhibitor*/
            if (CurrentMode == Mode.LaneClear || CurrentMode == Mode.Lasthit || true)
            {
                foreach (var turret in
                         EnemyBarracs
                         .Where(t => t.IsValidTarget() && !t.IsInvulnerable && InAutoAttackRange(t)))
                {
                    return(turret);
                }
            }

            /*nexus*/
            if (CurrentMode == Mode.LaneClear || CurrentMode == Mode.Lasthit || true)
            {
                foreach (var nexus in
                         EnemyHQ
                         .Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                {
                    return(nexus);
                }
            }

            if ((CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear))
            {
                tempTarget = GetBestHeroTarget();
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            if (ARAMSimulator.towerAttackedMe)
            {
                return(null);
            }
            /* dont aa if enemy close */
            var closestenemy =
                HeroManager.Enemies.Where(ene => !ene.IsDead)
                .OrderBy(ene => ene.Distance(MyHero, true))
                .FirstOrDefault();
            var aaRangeext = GetAutoAttackRange(MyHero, closestenemy) + 120;

            if (closestenemy != null && closestenemy.Distance(MyHero, true) < aaRangeext * aaRangeext)
            {
                return(null);
            }
            enemiesMinionsAround = ObjectManager.Get <Obj_AI_Base>()
                                   .Where(targ => targ.IsValidTarget(farmRange) && !targ.IsDead && targ.IsTargetable && targ.IsEnemy).ToList();

            if (CurrentMode == Mode.Harass || CurrentMode == Mode.Lasthit || CurrentMode == Mode.LaneClear || CurrentMode == Mode.LaneFreeze)
            {
                foreach (
                    var minion in
                    from minion in
                    enemiesMinionsAround.Where(minion => minion != null && minion.IsValidTarget() && InAutoAttackRange(minion))
                    let t = (int)(MyHero.AttackCastDelay * 1000) - 100 + Game.Ping / 2 +
                            1000 * (int)MyHero.Distance(minion) / (int)MyProjectileSpeed()
                            let predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay())
                                             where minion != null && minion.Team != GameObjectTeam.Neutral && predHealth > 0 && minion.SkinName != "GangplankBarrel" &&
                                             predHealth <= MyHero.GetAutoAttackDamage(minion, true)
                                             select minion)
                {
                    return(minion);
                }
            }

            if (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear || CurrentMode == Mode.LaneFreeze)
            {
                foreach (
                    var turret in
                    EnemyTowers.Where(turret => turret.IsValidTarget(GetAutoAttackRange(MyHero, turret))))
                {
                    return(turret);
                }
            }

            if (CurrentMode != Mode.Lasthit)
            {
                tempTarget = GetBestHeroTarget();
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            float[] maxhealth;
            if (CurrentMode == Mode.LaneClear || CurrentMode == Mode.Harass || CurrentMode == Mode.LaneFreeze)
            {
                maxhealth = new float[] { 0 };
                var maxhealth1 = maxhealth;
                foreach (var minion in enemiesMinionsAround.Where(minion => minion.IsValidTarget(GetAutoAttackRange(MyHero, minion)) && minion.SkinName != "GangplankBarrel" && minion.Team == GameObjectTeam.Neutral).Where(minion => minion.MaxHealth >= maxhealth1[0] || Math.Abs(maxhealth1[0] - float.MaxValue) < float.Epsilon))
                {
                    tempTarget   = minion;
                    maxhealth[0] = minion.MaxHealth;
                }
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            if (CurrentMode != Mode.LaneClear || ShouldWait())
            {
                return(null);
            }
            maxhealth = new float[] { 0 };
            foreach (var minion in from minion in enemiesMinionsAround
                     .Where(minion => minion != null && minion.IsValidTarget(GetAutoAttackRange(MyHero, minion)) && minion.SkinName != "GangplankBarrel")
                     let predHealth = HealthPrediction.LaneClearHealthPrediction(minion, (int)((MyHero.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay())
                                      where predHealth >=
                                      2 * MyHero.GetAutoAttackDamage(minion, true) ||
                                      Math.Abs(predHealth - minion.Health) < float.Epsilon
                                      where minion.Health >= maxhealth[0] || Math.Abs(maxhealth[0] - float.MaxValue) < float.Epsilon
                                      select minion)
            {
                tempTarget   = minion;
                maxhealth[0] = minion.MaxHealth;
            }
            return(tempTarget);
        }