Ejemplo n.º 1
0
        private static void onDraw(EventArgs args)
        {
            Utility.DrawCircle(player.Position, player.AttackRange + player.BoundingRadius, Color.Green);

            Drawing.DrawText(100, 100, Color.Red, " " + CurrentMode + " : " + HealthDeath.damagerSources.Count);

            //  foreach (var towTar in HealthDeath.activeTowerTargets)
            //   {
            //     Utility.DrawCircle(towTar.Value.target.Position, 50, Color.DarkViolet);
            // }

            //return;
            foreach (var enemy in ObjectManager.Get <Obj_AI_Base>().Where(ene => ene != null && ene.IsValidTarget(1000) && ene.IsEnemy && ene.Distance(player, true) < 1000 * 1000))
            {
                //var timeToHit = timeTillDamageOn(enemy);

                //var pOut = Drawing.WorldToScreen(enemy.Position);

                // Drawing.DrawText(pOut.X,pOut.Y,Color.Red,"name: "+enemy.SkinName);
                var hp2 = HealthPrediction.LaneClearHealthPrediction(enemy, (int)((player.AttackDelay * 1000) * 2.3f),
                                                                     menu.Item("farmDelay").GetValue <Slider>().Value);
                var hp = HealthDeath.getLaneClearPred(enemy, (int)((player.AttackDelay * 1000) * 2.2f));
                if (hp <= getRealAADmg(enemy) && hp > 0)
                {
                    Render.Circle.DrawCircle(enemy.Position, 56, Color.Green);
                }
            }
        }
Ejemplo n.º 2
0
        private static bool ShouldWaitAllTogether()
        {
            /* var cEnemy = getCloestEnemyChamp();
             *
             * bool enemySoonInRange = cEnemy != null &&
             *                       inAutoAttackRange(cEnemy,
             *                           LeagueSharp.Common.Prediction.GetPrediction(cEnemy,player.AttackDelay*1000).UnitPosition.To2D());
             * if (enemySoonInRange)
             *   return true;*/

            foreach (var minion in MinionManager.GetMinions(getTargetSearchDist(), MinionTypes.All))
            {
                if (minion.IsValidTarget())
                {
                    //var hpKillable = HealthDeath.getLastHitPredPeriodic(minion, timeTillDamageOn(minion));
                    // if(hpKillable<0)
                    //    continue;
                    var dmgAt = timeTillDamageOn(minion);
                    var hp    = HealthDeath.getLaneClearPred(minion, (int)((player.AttackDelay * 1000) * 1.26f));
                    if (hp <= getRealAADmg(minion))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 3
0
        private static bool ShouldWaitMinion(Obj_AI_Base minion)
        {
            var hp = HealthDeath.getLaneClearPred(minion, (int)((player.AttackDelay * 1000) * 2.26f));

            if (hp <= getRealAADmg(minion))
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 4
0
 private static bool ShouldWaitAllTogether()
 {
     foreach (var minion in MinionManager.GetMinions(getTargetSearchDist(), MinionTypes.All))
     {
         if (minion.IsValidTarget() && minion != null)
         {
             var dmgAt = timeTillDamageOn(minion);
             var hp    = HealthDeath.getLaneClearPred(minion, (int)((player.AttackDelay * 1000) * 1.26f));
             if (hp <= getRealAADmg(minion))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Ejemplo n.º 5
0
        private static bool ShouldWait()
        {
            /* var cEnemy = getCloestEnemyChamp();
             *
             * bool enemySoonInRange = cEnemy != null &&
             *                       inAutoAttackRange(cEnemy,
             *                           LeagueSharp.Common.Prediction.GetPrediction(cEnemy,player.AttackDelay*1000).UnitPosition.To2D());
             * if (enemySoonInRange)
             *   return true;*/

            foreach (var minion in enemiesAround)
            {
                if (minion.IsValidTarget())
                {
                    //var hpKillable = HealthDeath.getLastHitPredPeriodic(minion, timeTillDamageOn(minion));
                    // if(hpKillable<0)
                    //    continue;
                    var dmgAt = timeTillDamageOn(minion);
                    var hp    = HealthDeath.getLaneClearPred(minion, (int)(player.AttackDelay + dmgAt) + 250);
                    if (hp <= getRealAADmg(minion))
                    {
                        return(true);
                    }
                }
            }
            return(false);

            bool minDeadSoon =
                ObjectManager.Get <Obj_AI_Minion>()
                .Any(
                    minion =>
                    minion.IsValidTarget() && minion.Team != GameObjectTeam.Neutral &&
                    inAutoAttackRange(minion) &&
                    //HealthPrediction.LaneClearHealthPrediction(minion, (int)((player.AttackDelay * 1000) * 2.3f), menu.Item("farmDelay").GetValue<Slider>().Value) <= getRealAADmg(minion));
                    HealthDeath.getLaneClearPred(minion, (int)((player.AttackDelay * 1000) * 2.0f)) <= getRealAADmg(minion));

            return(minDeadSoon);
        }
Ejemplo n.º 6
0
        public static AttackableUnit getBestTarget(bool onlySolider = false)
        {
            bool soliderHit = false;

            if (ForcedTarget != null && !onlySolider)
            {
                if (inAutoAttackRange(ForcedTarget))
                {
                    return(ForcedTarget);
                }
                ForcedTarget = null;
            }
            if (azir)
            {
                enemiesAround = ObjectManager.Get <Obj_AI_Base>()
                                .Where(targ => targ.IsValid && inAutoAttackRange(targ) && targ.IsEnemy).ToList();
            }
            else
            {
                enemiesAround = ObjectManager.Get <Obj_AI_Base>()
                                .Where(targ => targ.IsValidTarget(getTargetSearchDist()) && targ.IsEnemy).ToList();
            }

            Obj_AI_Base best = null;

            //Lat hit
            float bestPredHp = float.MaxValue;

            if (azir)
            {
                var hero1 = GetBestHeroTarget(out soliderHit);

                if (hero1 != null && (enemyInAzirRange(hero1) || hero1 is Obj_AI_Minion) && (!onlySolider || soliderHit))
                {
                    return(hero1);
                }
            }
            if (!onlySolider)
            {
                //check motherfuckers that are attacked by tower
                if (CurrentMode == Mode.Harass || CurrentMode == Mode.Lasthit || CurrentMode == Mode.LaneClear)
                {
                    foreach (var targ in enemiesAround)
                    {
                        var towerShot = HealthDeath.attackedByTurret(targ);
                        if (towerShot == null)
                        {
                            continue;
                        }
                        var hpOnDmgPred = HealthDeath.getLaneClearPred(targ, towerShot.hitOn + 10 - now);

                        var aa = getRealAADmg(targ);
                        // Console.WriteLine("AAdmg: " + aa + " Hp after: " + hpOnDmgPred + " hit: " + (towerShot.hitOn - now));
                        if (hpOnDmgPred > aa && hpOnDmgPred <= aa * 2f)
                        {
                            //Console.WriteLine("Tower under shoting");
                            //Notifications.AddNotification("Tower shoot");
                            //2x hit tower target

                            return(targ);
                        }
                    }
                }
            }
            if (!onlySolider)
            {
                if (CurrentMode == Mode.Harass || CurrentMode == Mode.Lasthit || CurrentMode == Mode.LaneClear)
                {
                    //Last hit
                    foreach (var targ in enemiesAround.OrderByDescending(min => HealthDeath.getLastHitPred(min, timeTillDamageOn(min))))
                    {
                        var hpOnDmgPred = HealthDeath.getLastHitPredPeriodic(targ, timeTillDamageOn(targ));
                        if (hpOnDmgPred <= 0 && (lastAutoAttackUnit == null || lastAutoAttackUnit.NetworkId != targ.NetworkId))
                        {
                            FireOnUnkillable(player, targ, HealthDeath.getTimeTillDeath(targ));
                        }
                        if (hpOnDmgPred <= 0 || hpOnDmgPred > (int)getRealAADmg(targ))
                        {
                            continue;
                        }
                        var cannonBonus = (targ.SkinName == "SRU_ChaosMinionSiege") ? 100 : 0;
                        if (best == null || hpOnDmgPred - cannonBonus < bestPredHp)
                        {
                            best       = targ;
                            bestPredHp = hpOnDmgPred;
                        }
                    }
                    if (best != null)
                    {
                        return(best);
                    }
                }
            }
            var hero = GetBestHeroTarget(out soliderHit);

            if (hero != null && (!onlySolider || soliderHit))
            {
                return(hero);
            }
            if (!onlySolider)
            {
                if (ShouldWait())
                {
                    return(null);
                }
            }
            /* turrets / inhibitors / nexus */
            if (CurrentMode == Mode.LaneClear)
            {
                /* turrets */
                foreach (var turret in
                         EnemyTowers.Where(t => t.IsValidTarget() && inAutoAttackRange(t)))
                {
                    return(turret);
                }

                /* inhibitor */
                foreach (var turret in
                         EnemyBarracs.Where(t => t.IsValidTarget() && inAutoAttackRange(t)))
                {
                    return(turret);
                }

                /* nexus */
                foreach (var nexus in
                         EnemyHQ.Where(t => t.IsValidTarget() && inAutoAttackRange(t)))
                {
                    return(nexus);
                }
            }

            if (!onlySolider)
            {
                //Laneclear
                if (CurrentMode == Mode.LaneClear)
                {
                    best = enemiesAround
                           .OrderByDescending(targ => targ.Health + (enemyInAzirRange(targ)?1000:0)).FirstOrDefault();
                }
            }


            return(best);
        }
Ejemplo n.º 7
0
        public static AttackableUnit getBestTarget(bool onlySolider = false, bool targetOnlyChampions = false)
        {
            bool soliderHit = false;

            /* turrets / inhibitors / nexus */
            if (BottingMode)
            {
                /* turrets */
                foreach (var turret in
                         ObjectManager.Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && inAutoAttackRange(t) && !t.IsDead))
                {
                    return(turret);
                }

                /* inhibitor */
                foreach (var turret in
                         ObjectManager.Get <Obj_BarracksDampener>()
                         .Where(t => t.IsValidTarget() && inAutoAttackRange(t) && !t.IsDead))
                {
                    return(turret);
                }

                /* nexus */
                foreach (var nexus in
                         ObjectManager.Get <Obj_HQ>().Where(t => t.IsValidTarget() && inAutoAttackRange(t) && !t.IsDead))
                {
                    return(nexus);
                }
            }

            if (targetOnlyChampions)
            {
                return(GetBestHeroTarget(out soliderHit));
            }

            if (ForcedTarget != null && !onlySolider)
            {
                if (inAutoAttackRange(ForcedTarget) && !ForcedTarget.IsDead && ForcedTarget.IsHPBarRendered && ForcedTarget.IsVisible)
                {
                    return(ForcedTarget);
                }
                ForcedTarget = null;
            }

            if (azir)
            {
                enemiesAround = ObjectManager.Get <Obj_AI_Base>()
                                .Where(targ => targ.IsValid && inAutoAttackRange(targ) && targ.IsEnemy && targ.IsHPBarRendered).ToList();
            }
            else
            {
                enemiesAround = ObjectManager.Get <Obj_AI_Base>()
                                .Where(targ => targ.IsValidTarget(getTargetSearchDist()) && targ.IsEnemy && targ.IsHPBarRendered && targ.IsTargetable && !targ.IsDead).ToList();
            }

            Obj_AI_Base best = null;

            //Lat hit
            float bestPredHp = float.MaxValue;

            if (azir)
            {
                var hero1 = GetBestHeroTarget(out soliderHit);

                if (hero1 != null && (enemyInAzirRange(hero1) || hero1 is Obj_AI_Minion) && (!onlySolider || soliderHit))
                {
                    return(hero1);
                }
            }

            if (!onlySolider)
            {
                //check motherfuckers that are attacked by tower
                if (CurrentMode == Mode.Harass || CurrentMode == Mode.Lasthit || CurrentMode == Mode.LaneClear)
                {
                    foreach (var targ in enemiesAround)
                    {
                        var towerShot = HealthDeath.attackedByTurret(targ);
                        if (towerShot == null)
                        {
                            continue;
                        }
                        var hpOnDmgPred = HealthDeath.getLaneClearPred(targ, towerShot.hitOn + 10 - now);

                        var aa = getRealAADmg(targ);
                        if (hpOnDmgPred > aa && hpOnDmgPred <= aa * 2f)
                        {
                            return(targ);
                        }
                    }
                }
            }

            if (!onlySolider)
            {
                if (CurrentMode == Mode.Harass || CurrentMode == Mode.Lasthit || CurrentMode == Mode.LaneClear)
                {
                    //Last hit
                    foreach (var targ in enemiesAround.OrderByDescending(min => HealthDeath.getLastHitPredPeriodic(min, timeTillDamageOn(min))))
                    {
                        var hpOnDmgPred = HealthDeath.getLastHitPred(targ, timeTillDamageOn(targ));
                        if (hpOnDmgPred <= 0 && (lastAutoAttackUnit == null || lastAutoAttackUnit.NetworkId != targ.NetworkId))
                        {
                            FireOnUnkillable(player, targ, HealthDeath.getTimeTillDeath(targ));
                        }
                        if (hpOnDmgPred <= 0 || hpOnDmgPred > (int)getRealAADmg(targ))
                        {
                            continue;
                        }
                        var cannonBonus = (targ.BaseSkinName == "SRU_ChaosMinionSiege") ? 100 : 0;
                        if (best == null || hpOnDmgPred - cannonBonus < bestPredHp)
                        {
                            best       = targ;
                            bestPredHp = hpOnDmgPred;
                        }
                    }
                    if (best != null)
                    {
                        return(best);
                    }
                }
            }

            var hero = GetBestHeroTarget(out soliderHit);

            if (hero != null && (!onlySolider || soliderHit))
            {
                return(hero);
            }

            if (!onlySolider)
            {
                if (ShouldWaitAllTogether())
                {
                    return(null);
                }
            }

            /* turrets / inhibitors / nexus */
            if (CurrentMode == Mode.LaneClear)
            {
                /* turrets */
                foreach (var turret in
                         ObjectManager.Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && inAutoAttackRange(t) && !t.IsDead))
                {
                    return(turret);
                }

                /* inhibitor */
                foreach (var turret in
                         ObjectManager.Get <Obj_BarracksDampener>()
                         .Where(t => t.IsValidTarget() && inAutoAttackRange(t) && !t.IsDead))
                {
                    return(turret);
                }

                /* nexus */
                foreach (var nexus in
                         ObjectManager.Get <Obj_HQ>().Where(t => t.IsValidTarget() && inAutoAttackRange(t) && !t.IsDead))
                {
                    return(nexus);
                }
            }

            if (!onlySolider)
            {
                //Laneclear
                if (CurrentMode == Mode.LaneClear)
                {
                    best = enemiesAround.Where(min => !ShouldWaitMinion(min))
                           .OrderByDescending(targ => targ.Health + (enemyInAzirRange(targ) ? 1000 : 0)).FirstOrDefault();
                }
            }


            return(best);
        }