コード例 #1
0
        /// <summary>
        /// Return the Attacking turret.
        /// </summary>
        /// <param name="minion"></param>
        /// <returns></returns>
        public static AIBaseClient GetAggroTurret(AIMinionClient minion)
        {
            var ActiveTurret = ActiveAttacks.Values
                               .FirstOrDefault(m => (m.Source is AITurretClient) && m.Target.NetworkId == minion.NetworkId);

            return(ActiveTurret != null ? ActiveTurret.Source : null);
        }
コード例 #2
0
        /// <summary>
        ///     Gets the minion type.
        /// </summary>
        /// <param name="minion">
        ///     The minion.
        /// </param>
        /// <returns>
        ///     The <see cref="MinionTypes" />
        /// </returns>
        public static MinionTypes GetMinionType(this AIMinionClient minion)
        {
            var baseCharacterName = minion.CharacterName;

            if (NormalMinionList.Any(n => baseCharacterName.Equals(n)))
            {
                return(MinionTypes.Normal
                       | (minion.CharacterName.Contains("Melee") ? MinionTypes.Melee : MinionTypes.Ranged));
            }

            if (SiegeMinionList.Any(n => baseCharacterName.Equals(n)))
            {
                return(MinionTypes.Siege | MinionTypes.Ranged);
            }

            if (SuperMinionList.Any(n => baseCharacterName.Equals(n)))
            {
                return(MinionTypes.Super | MinionTypes.Melee);
            }

            if (WardList.Any(n => baseCharacterName.Equals(n)))
            {
                return(MinionTypes.Ward);
            }

            return(MinionTypes.Unknown);
        }
コード例 #3
0
        /// <summary>
        ///     Return the Attacking turret.
        /// </summary>
        /// <param name="minion">
        ///     The minion.
        /// </param>
        /// <returns>
        ///     The <see cref="bool" />
        /// </returns>
        public static AIBaseClient GetAggroTurret(AIMinionClient minion)
        {
            var activeTurret =
                ActiveAttacks.Values.FirstOrDefault(m => m.Source is AITurretClient && m.Target.Compare(minion));

            return(activeTurret?.Source);
        }
コード例 #4
0
        /// <summary>
        ///     Return the starttick of the attacking turret.
        /// </summary>
        /// <param name="minion">
        ///     The minion.
        /// </param>
        /// <returns>
        ///     The <see cref="bool" />
        /// </returns>
        public static int TurretAggroStartTick(AIMinionClient minion)
        {
            var activeTurret =
                ActiveAttacks.Values.FirstOrDefault(m => m.Source is AITurretClient && m.Target.Compare(minion));

            return(activeTurret?.StartTick ?? 0);
        }
コード例 #5
0
 public Daggers(AIMinionClient dagger, int timecreate)
 {
     Position   = dagger.Position;
     CreateTime = timecreate;
     Dagger     = dagger;
     uid        = dagger.NetworkId;
 }
コード例 #6
0
 private static void AddMinionObject(AIMinionClient minion)
 {
     if (minion.MaxHealth >= 225)
     {
         if (minion.Team == GameObjectTeam.Neutral)
         {
             MinionsListNeutral.Add(minion);
         }
         else if (minion.MaxMana == 0 && minion.MaxHealth >= 300)
         {
             if (minion.Team == GameObjectTeam.Unknown)
             {
                 return;
             }
             else if (minion.Team != ObjectManager.Player.Team)
             {
                 MinionsListEnemy.Add(minion);
             }
             else if (minion.Team == ObjectManager.Player.Team)
             {
                 MinionsListAlly.Add(minion);
             }
         }
     }
 }
コード例 #7
0
 public static int KillableMinionsCount(AIMinionClient minions)
 {
     return(GameObjects.EnemyMinions.Count(x => x.IsValidTarget(RocketRange) &&
                                           x.Distance(minions) <= 150 &&
                                           RocketRange >= x.Health -
                                           Player.CalculateDamage(x, DamageType.Physical, 1)));
 }
コード例 #8
0
        /// <summary>
        /// Return the starttick of the attacking turret.
        /// </summary>
        /// <param name="minion"></param>
        /// <returns></returns>
        public static int TurretAggroStartTick(AIMinionClient minion)
        {
            var ActiveTurret = ActiveAttacks.Values
                               .FirstOrDefault(m => (m.Source is AITurretClient) && m.Target.NetworkId == minion.NetworkId);

            return(ActiveTurret != null ? ActiveTurret.StartTick : 0);
        }
コード例 #9
0
ファイル: Extension.cs プロジェクト: EweEweUWU/Ensoulsharp
 public static bool IsMinionCondemnable(AIMinionClient minion)
 {
     return(GameObjects.JungleLarge.Any(x => minion.NetworkId == x.NetworkId) &&
            NavMesh.GetCollisionFlags(
                minion.Position.ToVector2().Extend(GameObjects.Player.Position.ToVector2(), -400)
                .ToVector3())
            .HasFlag(CollisionFlags.Wall) ||
            NavMesh.GetCollisionFlags(minion.Position.ToVector2().Extend(
                                          GameObjects.Player.Position.ToVector2(), -200).ToVector3()).HasFlag(CollisionFlags.Wall));
 }
コード例 #10
0
ファイル: Program.cs プロジェクト: EweEweUWU/EnsoulSharp-1
        private static void PanicClear()
        {
            AIMinionClient minion = Get <AIMinionClient>().Where(x => x.GetMinionType() != MinionTypes.JunglePlant && x.GetMinionType() != MinionTypes.Ward && x.Team != Player.Team && !x.IsDead && x.IsValid && x.Distance(Player) < Player.AttackRange).OrderBy(x => x.Health).FirstOrDefault();

            if (minion == null)
            {
                return;
            }

            Orbwalker.ForceTarget = minion;
        }
コード例 #11
0
ファイル: Kennen.cs プロジェクト: xeni884/Ensoulsharp.Sayuto
 private void Orbwalker_OnAttack(Object sender, OrbwalkerActionArgs args)
 {
     if (args.Type == OrbwalkerType.OnAttack)
     {
         if (args.Sender.IsMe && args.Target is AIMinionClient)
         {
             LastAttackedminiMinion     = (AIMinionClient)args.Target;
             LastAttackedminiMinionTime = Variables.GameTimeTickCount;
         }
     }
 }
コード例 #12
0
ファイル: Program.cs プロジェクト: Toyota7/EnsoulSharp
        static void Lasthit()
        {
            if (!Q.IsReady() || !lasthit.check("LHQ"))
            {
                return;
            }

            var minions = GameObjects.EnemyMinions.Where(x => x.IsValidTarget(Q.Range - 10) && x.IsMinion());//.OrderByDescending(x => x.Health);

            if (minions != null)
            {
                AIMinionClient besttarget = null;
                foreach (var minion in minions.Where(x => !x.IsDead && x.Health < QDamage(x) - 10 && Q.GetHealthPrediction(x) > 10))
                {
                    var Qpred = Q.GetPrediction(minion);

                    var collisions = Qpred.CollisionObjects.ToList();

                    if (collisions.Count() > 0 && !lasthit.check("LHQD"))
                    {
                        break;
                    }

                    else if (collisions.Count() <= 1 && minion.GetMinionType() == MinionTypes.Siege)
                    {
                        besttarget = minion;
                        break;
                    }
                    else if (collisions.Count() == 1 && collisions[0].Health < QDamage(collisions[0]) - 10 && Q.GetHealthPrediction(collisions[0]) > 0 &&
                             !(minion.GetMinionType() == MinionTypes.Siege && HealthPrediction.GetPrediction(minion, (int)(Q.CooldownTime * 1100)) <= 0))
                    {
                        besttarget = minion;
                        break;
                    }
                    else if (collisions.Count() > 1 && collisions[0].Health < QDamage(collisions[0]) - 10 && collisions[1].Health < QDamage(collisions[1]) - 10 &&
                             Q.GetHealthPrediction(collisions[0]) > 0 && Q.GetHealthPrediction(collisions[1]) > 0)
                    {
                        besttarget = minion;
                        break;
                    }
                    else if (collisions.Count() < 2)
                    {
                        besttarget = minion;
                    }
                }

                if (besttarget != null && Q.CanCast(besttarget) && Q.GetHealthPrediction(besttarget) > 10)
                {
                    //if (HealthPrediction.HasTurretAggro(besttarget) && )
                    Q.Cast(Q.GetPrediction(besttarget).CastPosition);
                }
            }
        }
コード例 #13
0
 /// <summary>
 ///     Determines if the orbwalker should wait before attacking a minion under turret.
 /// </summary>
 /// <param name="noneKillableMinion">
 ///     The non killable minion.
 /// </param>
 /// <returns>
 ///     The <see cref="bool" />.
 /// </returns>
 public bool ShouldWaitUnderTurret(AIMinionClient noneKillableMinion = null)
 {
     return
         (this.GetEnemyMinions()
          .Any(
              m =>
              (noneKillableMinion == null || noneKillableMinion.NetworkId != m.NetworkId) && m.IsValidTarget() &&
              m.InAutoAttackRange() &&
              Health.GetPrediction(
                  m,
                  (int)((GameObjects.Player.AttackDelay * 1000) + m.GetTimeToHit()),
                  this.FarmDelay,
                  HealthPredictionType.Simulated) < GameObjects.Player.GetAutoAttackDamage(m)));
 }
コード例 #14
0
        public static void Obj_OnCreate(GameObject sender, EventArgs args)
        {
            if (!(sender is AIMinionClient))
            {
                return;
            }

            if (sender.Name == "AzirSoldier" && sender.IsAlly)
            {
                AIMinionClient soldier = (AIMinionClient)sender;
                if (soldier.CharacterName == "AzirSoldier")
                {
                    Soilders.Add(soldier);
                }
            }
        }
コード例 #15
0
ファイル: Base.cs プロジェクト: sadnecc/EnsoulSharp-2
    public static bool UnderAllyTurret(this AIMinionClient target)
    {
        if (target == null)
        {
            return(false);
        }
        var turret = GameObjects.AllyTurrets.OrderBy(x => x.Distance(target.Position)).FirstOrDefault();

        if (turret != null)
        {
            return(target.Distance(turret.Position) < turret.AttackRange);
        }
        else
        {
            return(false);
        }
    }
コード例 #16
0
        /// <summary>
        ///     Get the minion jungle type.
        /// </summary>
        /// <param name="minion">
        ///     The minion
        /// </param>
        /// <returns>
        ///     The <see cref="JungleType" />
        /// </returns>
        public static JungleType GetJungleType(this AIMinionClient minion)
        {
            if (SmallNameRegex.Any(regex => Regex.IsMatch(minion.CharacterName, regex)))
            {
                return(JungleType.Small);
            }

            if (LargeNameRegex.Any(regex => Regex.IsMatch(minion.CharacterName, regex)))
            {
                return(JungleType.Large);
            }

            if (LegendaryNameRegex.Any(regex => Regex.IsMatch(minion.CharacterName, regex)))
            {
                return(JungleType.Legendary);
            }

            return(JungleType.Unknown);
        }
コード例 #17
0
        private static AIMinionClient EClient()
        {
            var            Ec  = ObjectManager.Get <AIMinionClient>().Where(i => i.Position.IsValid() && i.Name == "TestCubeRender");
            AIMinionClient Get = null;

            foreach (var hmm in Ec)
            {
                Get = hmm;
                return(hmm);
            }

            if (Get != null)
            {
                return(Get);
            }
            else
            {
                return(null);
            }
        }
コード例 #18
0
        /// <summary>
        ///     Gets the target.
        /// </summary>
        /// <param name="mode">
        ///     The mode.
        /// </param>
        /// <returns>
        ///     Returns the filtered target.
        /// </returns>
        public AttackableUnit GetTarget(OrbwalkingMode mode)
        {
            if ((mode == OrbwalkingMode.Hybrid || mode == OrbwalkingMode.LaneClear) &&
                !this.orbwalker.Menu["advanced"]["prioritizeFarm"].GetValue <MenuBool>().Value)
            {
                var target = Variables.TargetSelector.GetTarget(-1f, DamageType.Physical);
                if (target != null && target.InAutoAttackRange())
                {
                    return(target);
                }
            }

            var minions = new List <AIMinionClient>();

            if (mode != OrbwalkingMode.None)
            {
                minions = this.GetMinions(mode);
            }

            // Killable Minion
            if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Hybrid || mode == OrbwalkingMode.LastHit)
            {
                foreach (var minion in minions.OrderBy(m => m.Health))
                {
                    if (minion.IsHPBarRendered && minion.Health < GameObjects.Player.GetAutoAttackDamage(minion))
                    {
                        return(minion);
                    }
                    if (minion.MaxHealth <= 10)
                    {
                        if (minion.Health <= 1)
                        {
                            return(minion);
                        }
                    }
                    else
                    {
                        var predHealth = Health.GetPrediction(minion, (int)minion.GetTimeToHit(), this.FarmDelay);
                        if (predHealth <= 0)
                        {
                            this.orbwalker.InvokeAction(
                                new OrbwalkingActionArgs
                            {
                                Position = minion.Position, Target = minion, Process = true,
                                Type     = OrbwalkingType.NonKillableMinion
                            });
                        }

                        if (predHealth > 0 && predHealth < GameObjects.Player.GetAutoAttackDamage(minion))
                        {
                            return(minion);
                        }
                    }
                }
            }

            // Forced Target
            if (this.ForceTarget.IsValidTarget() && this.ForceTarget.InAutoAttackRange())
            {
                return(this.ForceTarget);
            }

            // Turrets | Inhibitors | Nexus
            if (mode == OrbwalkingMode.LaneClear &&
                (!this.orbwalker.Menu["advanced"]["prioritizeMinions"].GetValue <MenuBool>().Value || !minions.Any()))
            {
                foreach (var turret in GameObjects.EnemyTurrets.Where(t => t.IsValidTarget() && t.InAutoAttackRange()))
                {
                    return(turret);
                }

                foreach (var inhib in
                         GameObjects.EnemyInhibitors.Where(i => i.IsValidTarget() && i.InAutoAttackRange()))
                {
                    return(inhib);
                }

                if (GameObjects.EnemyNexus != null && GameObjects.EnemyNexus.IsValidTarget() &&
                    GameObjects.EnemyNexus.InAutoAttackRange())
                {
                    return(GameObjects.EnemyNexus);
                }
            }

            // Champions
            if (mode != OrbwalkingMode.LastHit)
            {
                var target = Variables.TargetSelector.GetTarget(-1f, DamageType.Physical);
                if (target.IsValidTarget() && target.InAutoAttackRange())
                {
                    return(target);
                }
            }

            // Jungle Minions
            if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Hybrid)
            {
                var minion = minions.FirstOrDefault(m => m.Team == GameObjectTeam.Neutral);
                if (minion != null)
                {
                    return(minion);
                }
            }

            // Under-Turret Farming
            if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Hybrid || mode == OrbwalkingMode.LastHit)
            {
                AIMinionClient farmUnderTurretMinion = null;
                AIMinionClient noneKillableMinion    = null;

                // return all the minions under turret
                var turretMinions = minions.Where(m => m.IsMinion() && m.Position.IsUnderAllyTurret()).ToList();
                if (turretMinions.Any())
                {
                    // get the turret aggro minion
                    var turretMinion = turretMinions.FirstOrDefault(Health.HasTurretAggro);
                    if (turretMinion != null)
                    {
                        var hpLeftBeforeDie   = 0;
                        var hpLeft            = 0;
                        var turretAttackCount = 0;
                        var turret            = Health.GetAggroTurret(turretMinion);
                        if (turret != null)
                        {
                            var turretStarTick = Health.TurretAggroStartTick(turretMinion);

                            // from healthprediction (blame Lizzaran)
                            var turretLandTick = turretStarTick + (int)(turret.AttackCastDelay * 1000)
                                                 + (1000
                                                    * Math.Max(
                                                        0,
                                                        (int)(turretMinion.Distance(turret) - turret.BoundingRadius))
                                                    / (int)(turret.BasicAttack.MissileSpeed + 70));

                            // calculate the HP before try to balance it
                            for (float i = turretLandTick + 50;
                                 i < turretLandTick + (3 * turret.AttackDelay * 1000) + 50;
                                 i = i + (turret.AttackDelay * 1000))
                            {
                                var time   = (int)i - Variables.TickCount + (Game.Ping / 2);
                                var predHp =
                                    (int)
                                    Health.GetPrediction(
                                        turretMinion,
                                        time > 0 ? time : 0,
                                        70,
                                        HealthPredictionType.Simulated);
                                if (predHp > 0)
                                {
                                    hpLeft             = predHp;
                                    turretAttackCount += 1;
                                    continue;
                                }

                                hpLeftBeforeDie = hpLeft;
                                hpLeft          = 0;
                                break;
                            }

                            // calculate the hits is needed and possibilty to balance
                            if (hpLeft == 0 && turretAttackCount != 0 && hpLeftBeforeDie != 0)
                            {
                                var damage        = (int)GameObjects.Player.GetAutoAttackDamage(turretMinion);
                                var hits          = hpLeftBeforeDie / damage;
                                var timeBeforeDie = turretLandTick
                                                    + ((turretAttackCount + 1) * (int)(turret.AttackDelay * 1000))
                                                    - Variables.TickCount;
                                var timeUntilAttackReady = this.orbwalker.LastAutoAttackTick
                                                           + (int)(GameObjects.Player.AttackDelay * 1000)
                                                           > (Variables.TickCount + (Game.Ping / 2) + 25)
                                                               ? this.orbwalker.LastAutoAttackTick
                                                           + (int)(GameObjects.Player.AttackDelay * 1000)
                                                           - (Variables.TickCount + (Game.Ping / 2) + 25)
                                                               : 0;
                                var timeToLandAttack = turretMinion.GetTimeToHit();
                                if (hits >= 1 &&
                                    (hits * GameObjects.Player.AttackDelay * 1000) + timeUntilAttackReady
                                    + timeToLandAttack < timeBeforeDie)
                                {
                                    farmUnderTurretMinion = turretMinion;
                                }
                                else if (hits >= 1 &&
                                         (hits * GameObjects.Player.AttackDelay * 1000) + timeUntilAttackReady
                                         + timeToLandAttack > timeBeforeDie)
                                {
                                    noneKillableMinion = turretMinion;
                                }
                            }
                            else if (hpLeft == 0 && turretAttackCount == 0 && hpLeftBeforeDie == 0)
                            {
                                noneKillableMinion = turretMinion;
                            }

                            // should wait before attacking a minion.
                            if (this.ShouldWaitUnderTurret(noneKillableMinion))
                            {
                                return(null);
                            }

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

                            // balance other minions
                            return
                                ((from minion in
                                  turretMinions.Where(
                                      x => x.NetworkId != turretMinion.NetworkId && !Health.HasMinionAggro(x))
                                  where
                                  (int)minion.Health % (int)turret.GetAutoAttackDamage(minion)
                                  > (int)GameObjects.Player.GetAutoAttackDamage(minion)
                                  select minion).FirstOrDefault());
                        }
                    }
                    else
                    {
                        if (this.ShouldWaitUnderTurret())
                        {
                            return(null);
                        }

                        // balance other minions
                        return((from minion in turretMinions.Where(x => !Health.HasMinionAggro(x))
                                let turret =
                                    GameObjects.AllyTurrets.FirstOrDefault(
                                        x => x.IsValidTarget(950f, false, minion.Position))
                                    where
                                    turret != null &&
                                    (int)minion.Health % (int)turret.GetAutoAttackDamage(minion)
                                    > (int)GameObjects.Player.GetAutoAttackDamage(minion)
                                    select minion).FirstOrDefault());
                    }

                    return(null);
                }
            }

            // Lane Clear Minions
            if (mode == OrbwalkingMode.LaneClear)
            {
                if (!this.ShouldWait())
                {
                    if (this.LaneClearMinion.IsValidTarget() && this.LaneClearMinion.InAutoAttackRange())
                    {
                        if (this.LaneClearMinion.MaxHealth <= 10)
                        {
                            return(this.LaneClearMinion);
                        }

                        var predHealth = Health.GetPrediction(
                            this.LaneClearMinion,
                            (int)(GameObjects.Player.AttackDelay * 1000 * LaneClearWaitTime),
                            this.FarmDelay,
                            HealthPredictionType.Simulated);
                        if (predHealth >= 2 * GameObjects.Player.GetAutoAttackDamage(this.LaneClearMinion) ||
                            Math.Abs(predHealth - this.LaneClearMinion.Health) < float.Epsilon)
                        {
                            return(this.LaneClearMinion);
                        }
                    }

                    foreach (var minion in minions.Where(m => m.Team != GameObjectTeam.Neutral))
                    {
                        if (minion.MaxHealth <= 10)
                        {
                            this.LaneClearMinion = minion;
                            return(minion);
                        }

                        var predHealth = Health.GetPrediction(
                            minion,
                            (int)(GameObjects.Player.AttackDelay * 1000 * LaneClearWaitTime),
                            this.FarmDelay,
                            HealthPredictionType.Simulated);
                        if (predHealth >= 2 * GameObjects.Player.GetAutoAttackDamage(minion) ||
                            Math.Abs(predHealth - minion.Health) < float.Epsilon)
                        {
                            this.LaneClearMinion = minion;
                            return(minion);
                        }
                    }
                }
            }

            // Special Minions if no enemy is near
            if (mode == OrbwalkingMode.Combo)
            {
                if (minions.Any() && !GameObjects.EnemyHeroes.Any(e => e.IsValidTarget(e.GetRealAutoAttackRange() * 2f)))
                {
                    return(minions.FirstOrDefault());
                }
            }

            return(null);
        }
コード例 #19
0
ファイル: Program.cs プロジェクト: Toyota7/EnsoulSharp
        private static void QStack()
        {
            if (!Q.IsReady() || Orbwalker.ActiveMode.Equals(OrbwalkerMode.Combo) || myhero.IsRecalling())
            {
                return;
            }

            var minions = GameObjects.EnemyMinions.Where(x => x.IsValidTarget(Q.Range - 10) && x.IsMinion()).OrderByDescending(x => x.Health);

            if (minions != null)
            {
                if (comb(laneclear, "QSTACKMODE") == 0)
                {
                    AIMinionClient besttarget = null;
                    foreach (var minion in minions.Where(x => !x.IsDead && x.Health < QDamage(x) - 10 && Q.GetHealthPrediction(x) > 10))
                    {
                        var Qpred = Q.GetPrediction(minion);

                        var collisions = Qpred.CollisionObjects.ToList();

                        if (collisions.Count() > 0 && !laneclear.check("QSTACKDOUBLE"))
                        {
                            break;
                        }

                        else if (collisions.Count() <= 1 && minion.GetMinionType() == MinionTypes.Siege)
                        {
                            besttarget = minion;
                            break;
                        }
                        else if (collisions.Count() == 1 && collisions[0].Health < QDamage(collisions[0]) - 10 && Q.GetHealthPrediction(collisions[0]) > 0)
                        {
                            besttarget = minion;
                            break;
                        }
                        else if (collisions.Count() > 1 && collisions[0].Health < QDamage(collisions[0]) - 10 && collisions[1].Health < QDamage(collisions[1]) - 10 &&
                                 Q.GetHealthPrediction(collisions[0]) > 0 && Q.GetHealthPrediction(collisions[1]) > 0)
                        {
                            besttarget = minion;
                            break;
                        }
                        else if (collisions.Count() < 2)
                        {
                            besttarget = minion;
                        }
                    }

                    if (besttarget != null && Q.CanCast(besttarget) && Q.GetHealthPrediction(besttarget) > 10)
                    {
                        Q.Cast(Q.GetPrediction(besttarget).CastPosition);
                    }
                }
                else
                {
                    var pred = Q.GetLineFarmLocation(minions.ToList());

                    if (pred.MinionsHit > 0)
                    {
                        Q.Cast(pred.Position);
                    }
                }
            }
        }
コード例 #20
0
 public static int qtt(this AIMinionClient target)                                                //returns Q travel time to target in milliseconds
 {
     return(target == null ? 0 : (int)Math.Floor(target.DistanceToPlayer() / 1.392f) + 250 + 10); //plus cast delay,plus 10 for safety
 }
コード例 #21
0
ファイル: Azir.cs プロジェクト: xeni884/Ensoulsharp.Sayuto
 private static bool IsSoldier(this AIMinionClient soldier)
 {
     return(soldier.IsAlly && String.Equals(soldier.CharacterName, "azirsoldier", StringComparison.InvariantCultureIgnoreCase));
 }
コード例 #22
0
 public static bool isBigMob(this AIMinionClient mob)
 {
     return(mob != null &&
            (mob.GetJungleType() == JungleType.Large || mob.GetJungleType() == JungleType.Legendary));
 }
コード例 #23
0
 public Barrel(AIMinionClient barrel)
 {
     BarrelObjectNetworkID = (int)barrel.NetworkId;
     BarrelAttackTick      = GetBarrelAttackTick();
 }
コード例 #24
0
 /// <summary>
 /// Determines whether the specified object is a minion.
 /// </summary>
 /// <param name="minion">The minion.</param>
 /// <returns><c>true</c> if the specified minion is minion; otherwise, <c>false</c>.</returns>
 public static bool IsMinion(AIMinionClient minion)
 {
     return(minion.CharacterName.Contains("Minion"));
 }
コード例 #25
0
ファイル: Mechanics.cs プロジェクト: thienha1/EnsoulSharp
        /// <summary>
        ///     Process Karma Last Hit
        /// </summary>
        public static void ProcessLastHit()
        {
            // Minion list
            var minions = ObjectManager.Get <AIMinionClient>().Where(m => m.IsValidTarget(Instances.Range)).ToList();

            minions.RemoveAll(m => m.Distance(Instances.Player.PreviousPosition) < Instances.Player.AttackRange);

            if (minions.Count() == 0)
            {
                // If no minions, ignore.
                return;
            }

            // player local value
            var player = Instances.Player;

            // Using menu & spells a lot, copy to local value.
            var menu   = Instances.Menu;
            var spells = Instances.Spells;

            var manaPercent = player.ManaPercent;

            #region Last Hit - Q

            // If Q is ready and we enabled it inside the menu
            if (spells[SpellSlot.Q].IsReady() && menu.Item("l33t.karma.farming.lhq").GetValue <bool>() &&
                manaPercent >= menu.Item("l33t.karma.farming.lhminmpq").GetValue <Slider>().Value)
            {
                // Main minion
                AIMinionClient minion = null;

                // Search for best minion
                foreach (var m in
                         from m in minions
                         let pred = spells[SpellSlot.Q].GetPrediction(m)
                                    where pred.CollisionObjects.Count == 0
                                    select m)
                {
                    if (minion == null &&
                        Damages.GetDamage(m, SpellSlot.Q, false) >
                        HealthPrediction.GetHealthPrediction(m, (int)((player.AttackDelay * 1000) * 2)) &&
                        HealthPrediction.GetHealthPrediction(m, (int)((player.AttackDelay * 1000) * 2)) >
                        player.GetAutoAttackDamage(m))
                    {
                        minion = m;
                    }
                    else if ((minion != null) && minion.Health > m.Health)
                    {
                        minion = m;
                    }
                }

                // Check if minion is valid for range.
                if (minion != null && (minion.IsValidTarget(spells[SpellSlot.Q].Range)) &&
                    player.Distance(minion.PreviousPosition) > player.AttackRange)
                {
                    // Cast Q onto minion with prediction.
                    var pred = spells[SpellSlot.Q].GetPrediction(minion);
                    spells[SpellSlot.Q].Cast(pred.CastPosition);
                }
            }

            #endregion
        }
コード例 #26
0
            /// <summary>
            /// Gets the target.
            /// </summary>
            /// <returns>AttackableUnit.</returns>
            public virtual AttackableUnit GetTarget()
            {
                AttackableUnit result = null;

                if ((ActiveMode == OrbwalkerMode.Mixed || ActiveMode == OrbwalkerMode.LaneClear) &&
                    !_config.Item("PriorizeFarm").GetValue <bool>())
                {
                    var target = TargetSelector.GetTarget(-1, TargetSelector.DamageType.Physical);
                    if (target != null && InAutoAttackRange(target))
                    {
                        return(target);
                    }
                }

                /*Killable Minion*/
                if (ActiveMode == OrbwalkerMode.LaneClear || (ActiveMode == OrbwalkerMode.Mixed && _config.Item("LWH").GetValue <bool>()) ||
                    ActiveMode == OrbwalkerMode.LastHit)
                {
                    var MinionList =
                        ObjectManager.Get <AIMinionClient>()
                        .Where(
                            minion =>
                            minion.IsValidTarget() && InAutoAttackRange(minion))
                        .OrderByDescending(minion => minion.CharData.BaseSkinName.Contains("Siege"))
                        .ThenBy(minion => minion.CharData.BaseSkinName.Contains("Super"))
                        .ThenBy(minion => minion.Health)
                        .ThenByDescending(minion => minion.MaxHealth);

                    foreach (var minion in MinionList)
                    {
                        var t = (int)(Player.AttackCastDelay * 1000) - 100 + Game.Ping / 2 +
                                1000 * (int)Math.Max(0, Player.Distance(minion) - Player.BoundingRadius) / int.MaxValue;
                        var predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay);

                        if (minion.Team != GameObjectTeam.Neutral && (_config.Item("AttackPetsnTraps").GetValue <bool>() &&
                                                                      minion.CharData.BaseSkinName != "jarvanivstandard" || MinionManager.IsMinion(minion, _config.Item("AttackWards").GetValue <bool>())))
                        {
                            if (predHealth <= 0)
                            {
                                FireOnNonKillableMinion(minion);
                            }

                            if (predHealth > 0 && predHealth <= Player.GetAutoAttackDamage(minion, true))
                            {
                                return(minion);
                            }
                        }

                        if (minion.Team == GameObjectTeam.Neutral && (_config.Item("AttackBarrel").GetValue <bool>() &&
                                                                      minion.CharData.BaseSkinName == "gangplankbarrel" && minion.IsHPBarRendered))
                        {
                            if (minion.Health < 2)
                            {
                                return(minion);
                            }
                        }
                    }
                }

                //Forced target
                if (_forcedTarget.IsValidTarget() && InAutoAttackRange(_forcedTarget))
                {
                    return(_forcedTarget);
                }

                /* turrets / inhibitors / nexus */
                if (ActiveMode == OrbwalkerMode.LaneClear && (!_config.Item("FocusMinionsOverTurrets").GetValue <KeyBind>().Active || !MinionManager.GetMinions(ObjectManager.Player.Position, GetRealAutoAttackRange(ObjectManager.Player)).Any()))
                {
                    /* turrets */
                    foreach (var turret in
                             ObjectManager.Get <AITurretClient>().Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                    {
                        return(turret);
                    }

                    /* inhibitor */
                    foreach (var turret in
                             ObjectManager.Get <BarracksDampenerClient>().Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                    {
                        return(turret);
                    }

                    /* nexus */
                    foreach (var nexus in
                             ObjectManager.Get <HQClient>().Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                    {
                        return(nexus);
                    }
                }

                /*Champions*/
                if (ActiveMode != OrbwalkerMode.LastHit && ActiveMode != OrbwalkerMode.Flee)
                {
                    var target = TargetSelector.GetTarget(-1, TargetSelector.DamageType.Physical);
                    if (target.IsValidTarget() && InAutoAttackRange(target))
                    {
                        return(target);
                    }
                }

                /*Jungle minions*/
                if (ActiveMode == OrbwalkerMode.LaneClear || ActiveMode == OrbwalkerMode.Mixed)
                {
                    var jminions =
                        ObjectManager.Get <AIMinionClient>()
                        .Where(
                            mob =>
                            mob.IsValidTarget() && mob.Team == GameObjectTeam.Neutral && this.InAutoAttackRange(mob) &&
                            mob.CharData.BaseSkinName != "gangplankbarrel");

                    result = _config.Item("Smallminionsprio").GetValue <bool>()
                                 ? jminions.MinOrDefault(mob => mob.MaxHealth)
                                 : jminions.MaxOrDefault(mob => mob.MaxHealth);

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

                /*Lane Clear minions*/
                if (ActiveMode == OrbwalkerMode.LaneClear)
                {
                    if (!ShouldWait())
                    {
                        if (_prevMinion.IsValidTarget() && InAutoAttackRange(_prevMinion))
                        {
                            var predHealth = HealthPrediction.LaneClearHealthPrediction(
                                _prevMinion, (int)((Player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay);
                            if (predHealth >= 2 * Player.GetAutoAttackDamage(_prevMinion) ||
                                Math.Abs(predHealth - _prevMinion.Health) < float.Epsilon)
                            {
                                return(_prevMinion);
                            }
                        }

                        result = (from minion in
                                  ObjectManager.Get <AIMinionClient>()
                                  .Where(minion => minion.IsValidTarget() && InAutoAttackRange(minion) &&
                                         (_config.Item("AttackWards").GetValue <bool>() || !MinionManager.IsWard(minion)) &&
                                         (_config.Item("AttackPetsnTraps").GetValue <bool>() && minion.CharData.BaseSkinName != "jarvanivstandard" || MinionManager.IsMinion(minion, _config.Item("AttackWards").GetValue <bool>())) &&
                                         minion.CharData.BaseSkinName != "gangplankbarrel")
                                  let predHealth =
                                      HealthPrediction.LaneClearHealthPrediction(
                                          minion, (int)((Player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay)
                                      where
                                      predHealth >= 2 * Player.GetAutoAttackDamage(minion) ||
                                      Math.Abs(predHealth - minion.Health) < float.Epsilon
                                      select minion).MaxOrDefault(m => !MinionManager.IsMinion(m, true) ? float.MaxValue : m.Health);

                        if (result != null)
                        {
                            _prevMinion = (AIMinionClient)result;
                        }
                    }
                }

                return(result);
            }
コード例 #27
0
 public Barrel(AIMinionClient objAiBase, int tickCount)
 {
     barrel = objAiBase;
     time   = tickCount;
 }
コード例 #28
0
 /// <summary>
 /// Determines whether the specified minion has turret aggro.
 /// </summary>
 /// <param name="minion">The minion</param>
 /// <returns></returns>
 public static bool HasTurretAggro(AIMinionClient minion)
 {
     return(ActiveAttacks.Values.Any(m => (m.Source is AITurretClient) && m.Target.NetworkId == minion.NetworkId));
 }
コード例 #29
0
 /// <summary>
 ///     Determines whether the specified minion has turret aggro.
 /// </summary>
 /// <param name="minion">The minion</param>
 /// <returns>
 ///     The <see cref="bool" />
 /// </returns>
 public static bool HasTurretAggro(AIMinionClient minion)
 {
     return(ActiveAttacks.Values.Any(m => m.Source is AITurretClient && m.Target.Compare(minion)));
 }
コード例 #30
0
ファイル: Mechanics.cs プロジェクト: thienha1/EnsoulSharp
        /// <summary>
        ///     Process Karma Lane Clear
        /// </summary>
        public static void ProcessLaneClear()
        {
            // Get minions list
            var minions = ObjectManager.Get <AIMinionClient>().Where(m => m.IsValidTarget(Instances.Range));

            if (minions.Count() == 0)
            {
                // If no minions, ignore.
                return;
            }

            // player local value
            var player = Instances.Player;

            // Using menu & spells a lot, copy to local value.
            var menu   = Instances.Menu;
            var spells = Instances.Spells;

            var manaPercent = player.ManaPercent;

            #region Lane Clear - Q

            if (spells[SpellSlot.Q].IsReady())
            {
                #region Lane Clear - R + Q

                // Check if R is ready, we allowed R+Q in menu, we have more or equal mana percent than what we placed in menu and if we have enough minions in lane.
                if (spells[SpellSlot.R].IsReady() && menu.Item("l33t.karma.farming.lcrq").GetValue <bool>() &&
                    manaPercent >= menu.Item("l33t.karma.farming.lcminmpq").GetValue <Slider>().Value&&
                    minions.Count() >= menu.Item("l33t.karma.farming.lcminminions").GetValue <Slider>().Value)
                {
                    // Best minion
                    var minion = minions.FirstOrDefault();

                    // How many targets get hit by last minion because of AoE
                    var targeted = 0;

                    // Search for minion
                    foreach (var m in minions)
                    {
                        // Find all minions that are not our minion and check how many minions would it hit.
                        var lTargeted = minions.Where(lm => lm != m).Count(om => om.Distance(m) < 250f);

                        // If more minions it would hit than our last minion, continue with prediction.
                        if (lTargeted > targeted)
                        {
                            // Prediction
                            var pred = spells[SpellSlot.R].GetPrediction(m);

                            // Check if Q doesn't hit anything in travel
                            if (pred.CollisionObjects.Count == 0)
                            {
                                // Update minion if passes checks
                                minion   = m;
                                targeted = lTargeted;
                            }
                        }
                    }

                    // If minion is valid for our range
                    if (minion != null && (minion.IsValidTarget(spells[SpellSlot.R].Range)))
                    {
                        // Prediction
                        var pred = spells[SpellSlot.R].GetPrediction(minion);

                        // Casting
                        spells[SpellSlot.R].Cast();
                        spells[SpellSlot.Q].Cast(pred.CastPosition);
                        return;
                    }
                }

                #endregion

                #region Lane Clear - Solo Q

                // Check if we allowed Q in menu and we have enough mana by what we placed inside the menu
                if (menu.Item("l33t.karma.farming.lcq").GetValue <bool>() &&
                    manaPercent >= menu.Item("l33t.karma.farming.lcminmpq").GetValue <Slider>().Value)
                {
                    // Best minion
                    AIMinionClient minion = null;

                    // Search for minion
                    foreach (var m in
                             from m in minions
                             let pred = spells[SpellSlot.Q].GetPrediction(m)
                                        where pred.CollisionObjects.Count == 0
                                        select m)
                    {
                        if (minion == null)
                        {
                            var healthPred = HealthPrediction.GetHealthPrediction(
                                m, (int)((player.AttackDelay * 1000) * 3));
                            if (healthPred < Damages.GetDamage(m, SpellSlot.Q, false) ||
                                healthPred > Damages.GetDamage(m, SpellSlot.Q, false) + player.GetAutoAttackDamage(m))
                            {
                                minion = m;
                            }
                        }
                        else if (minion.Health > m.Health)
                        {
                            minion = m;
                        }
                    }

                    // If minion is valid for our range
                    if (minion != null && (minion.IsValidTarget(spells[SpellSlot.Q].Range)) &&
                        minion.Distance(player.PreviousPosition) > player.AttackRange)
                    {
                        // Prediction
                        var pred = spells[SpellSlot.Q].GetPrediction(minion);

                        // Cast
                        spells[SpellSlot.Q].Cast(pred.CastPosition);
                    }
                }

                #endregion
            }

            #endregion
        }