コード例 #1
0
        private static void onDraw(EventArgs args)
        {
            Utility.DrawCircle(player.Position, player.AttackRange + player.BoundingRadius, Color.Green);

            // Drawing.DrawText(100, 100, Color.Red, " " + attPrec + " : " + canAttackAfter() + " : "+total);
            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 hp = HealthDeath.getLastHitPredPeriodic(enemy, (int)timeToHit);
                if (hp <= getRealAADmg(enemy) && hp > 0)
                {
                    Render.Circle.DrawCircle(enemy.Position, 56, Color.Green);
                }
            }
        }
コード例 #2
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 = HealthPrediction.LaneClearHealthPrediction(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)
                    {
                        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)
            {
                /* 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 && !ShouldWait())
                {
                    best = enemiesAround
                           .OrderByDescending(targ => targ.Health + (enemyInAzirRange(targ)?1000:0)).FirstOrDefault();
                }
            }


            return(best);
        }
コード例 #3
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);
        }