Пример #1
0
        /// <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
        }
Пример #2
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);
            }
Пример #3
0
        /// <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
        }