示例#1
0
        public static void doLastHit(Obj_AI_Hero target)
        {
            var minions = MinionManager.GetMinions(ObjectManager.Player.ServerPosition, Q.Range + 50);

            foreach (var minion in minions.Where(minion => minion.IsValidTarget(Q.Range)))
            {
                if (Player.Distance(minion) < Orbwalking.GetRealAutoAttackRange(minion) && minion.Health < Player.GetAutoAttackDamage(minion))
                {
                    return;
                }
                if (YasuoSharp.Config.Item("useElh").GetValue <bool>() && minion.Health < Player.GetSpellDamage(minion, E.Slot))
                {
                    useENormal(minion);
                }

                if (YasuoSharp.Config.Item("useQlh").GetValue <bool>() && !isQEmpovered() && HealthPrediction.LaneClearHealthPrediction(minion, (int)(getNewQSpeed() * 1000)) < Player.GetSpellDamage(minion, Q.Slot))
                {
                    if (!(target != null && isQEmpovered() && Player.Distance(target) < 1050))
                    {
                        if (canCastFarQ())
                        {
                            Q.Cast(minion);
                        }
                    }
                }
            }
        }
示例#2
0
        public static Obj_AI_Base GetPossibleTarget()
        {
            if (ForcedTarget != null)
            {
                if (InAutoAttackRange(ForcedTarget))
                {
                    return(ForcedTarget);
                }

                ForcedTarget = null;
            }

            Obj_AI_Base tempTarget = null;

            if (Menu.Item("lxOrbwalker_Misc_Priority_Unit").GetValue <StringList>().SelectedIndex == 1 &&
                (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear))
            {
                tempTarget = GetBestHeroTarget();
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

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

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

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

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

            if (CurrentMode != Mode.LaneClear || ShouldWait())
            {
                return(null);
            }
            maxhealth = new float[] { 0 };
            foreach (var minion in from minion in ObjectManager.Get <Obj_AI_Minion>()
                     .Where(minion => minion.IsValidTarget(GetAutoAttackRange(MyHero, minion)))
                     let predHealth = HealthPrediction.LaneClearHealthPrediction(minion, (int)((MyHero.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay())
                                      where predHealth >=
                                      2 * GetAADamage(minion) ||
                                      Math.Abs(predHealth - minion.Health) < float.Epsilon
                                      where minion.Health >= maxhealth[0] || Math.Abs(maxhealth[0] - float.MaxValue) < float.Epsilon
                                      select minion)
            {
                tempTarget   = minion;
                maxhealth[0] = minion.MaxHealth;
            }
            return(tempTarget);
        }
示例#3
0
        //public static void SetAttack(bool Value)
        //{
        //    Attack = Value;
        //}

        //public static void SetMovement(bool Value)
        //{
        //    Move = Value;
        //}

        private static bool ShouldWait()
        {
            return(ObjectManager.Get <Obj_AI_Minion>().Any(i => InAutoAttackRange(i) && i.Team != GameObjectTeam.Neutral && HealthPrediction.LaneClearHealthPrediction(i, (int)(Player.AttackDelay * 1000 * ClearWaitTime), GetCurrentFarmDelay) <= (Player.ChampionName == "Azir" ? GetAzirWDamage(i) : Player.GetAutoAttackDamage(i, true))));
        }
示例#4
0
文件: LXOrbwalker.cs 项目: xioa123/CN
        public static Obj_AI_Base GetPossibleTarget()
        {
            if (ObjectManager.Get <Obj_Building>()
                .Any(
                    obj =>
                    obj.Position.Distance(MyHero.Position) <= GetAutoAttackRange() + obj.BoundingRadius / 2 && obj.IsTargetable &&
                    obj.Name.StartsWith("HQ_")))
            {
                return(null);
            }

            if (ForcedTarget != null)
            {
                if (InAutoAttackRange(ForcedTarget))
                {
                    return(ForcedTarget);
                }
                ForcedTarget = null;
            }

            Obj_AI_Base tempTarget = null;

            if (Menu.Item("lxOrbwalker_Misc_Priority_Unit").GetValue <StringList>().SelectedIndex == 1 &&
                (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear))
            {
                tempTarget = GetBestHeroTarget();
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            if (CurrentMode == Mode.Harass || CurrentMode == Mode.Lasthit || CurrentMode == Mode.LaneClear || CurrentMode == Mode.LaneFreeze)
            {
                if (MyHero.ChampionName == "Azir")
                {
                    foreach (
                        var minion in
                        from minion in
                        ObjectManager.Get <Obj_AI_Minion>().Where(minion => minion.IsValidTarget() && InSoldierAttackRange(minion))
                        let t = (int)(MyHero.AttackCastDelay * 1000) - 100 + Game.Ping / 2 +
                                1000 * (int)MyHero.Distance(minion) / (int)MyProjectileSpeed()
                                let predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay(-125))
                                                 where minion.Team != GameObjectTeam.Neutral && predHealth > 0 &&
                                                 predHealth <= GetAzirAASandwarriorDamage(minion)
                                                 select minion)
                    {
                        return(minion);
                    }
                }

                foreach (
                    var minion in
                    from minion in
                    ObjectManager.Get <Obj_AI_Minion>().Where(minion => minion.IsValidTarget() && InAutoAttackRange(minion))
                    let t = (int)(MyHero.AttackCastDelay * 1000) - 100 + Game.Ping / 2 +
                            1000 * (int)MyHero.Distance(minion) / (int)MyProjectileSpeed()
                            let predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay())
                                             where minion.Team != GameObjectTeam.Neutral && predHealth > 0 &&
                                             predHealth <= MyHero.GetAutoAttackDamage(minion, true)
                                             select minion)
                {
                    return(minion);
                }
            }

            if (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear || CurrentMode == Mode.LaneFreeze)
            {
                foreach (
                    var turret in
                    ObjectManager.Get <Obj_AI_Turret>().Where(turret => turret.IsValidTarget(GetAutoAttackRange(MyHero, turret))))
                {
                    return(turret);
                }
                if (
                    ObjectManager.Get <Obj_Building>()
                    .Any(
                        obj =>
                        obj.Position.Distance(MyHero.Position) <= GetAutoAttackRange() + obj.BoundingRadius / 2 && obj.IsTargetable &&
                        (obj.Name.StartsWith("Barracks_") || obj.Name.StartsWith("HQ_"))))
                {
                    return(null);
                }
            }

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

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

                maxhealth = new float[] { 0 };
                var maxhealth2 = maxhealth;
                foreach (var minion in ObjectManager.Get <Obj_AI_Minion>().Where(minion => minion.IsValidTarget(GetAutoAttackRange(MyHero, minion)) && minion.Team == GameObjectTeam.Neutral).Where(minion => minion.MaxHealth >= maxhealth2[0] || Math.Abs(maxhealth2[0] - float.MaxValue) < float.Epsilon))
                {
                    tempTarget   = minion;
                    maxhealth[0] = minion.MaxHealth;
                }
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            if (CurrentMode != Mode.LaneClear || ShouldWait())
            {
                //ResetAutoAttackTimer();
                return(null);
            }

            if (MyHero.ChampionName == "Azir")
            {
                maxhealth = new float[] { 0 };
                foreach (var minion in from minion in ObjectManager.Get <Obj_AI_Minion>()
                         .Where(minion => minion.IsValidTarget() && InSoldierAttackRange(minion))
                         let predHealth = HealthPrediction.LaneClearHealthPrediction(minion, (int)((MyHero.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay(-125))
                                          where predHealth >=
                                          GetAzirAASandwarriorDamage(minion) + MyHero.GetAutoAttackDamage(minion, true) ||
                                          Math.Abs(predHealth - minion.Health) < float.Epsilon
                                          where minion.Health >= maxhealth[0] || Math.Abs(maxhealth[0] - float.MaxValue) < float.Epsilon
                                          select minion)
                {
                    tempTarget   = minion;
                    maxhealth[0] = minion.MaxHealth;
                }
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

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

            return(null);
        }
示例#5
0
            /// <summary>
            /// Gets the target.
            /// </summary>
            /// <returns>AttackableUnit.</returns>
            public virtual AttackableUnit GetTarget()
            {
                AttackableUnit result = null;

                if ((ActiveMode == OrbwalkingMode.Mixed || ActiveMode == OrbwalkingMode.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 == OrbwalkingMode.LaneClear || (ActiveMode == OrbwalkingMode.Mixed && _config.Item("LWH").GetValue <bool>()) ||
                    ActiveMode == OrbwalkingMode.LastHit)
                {
                    var MinionList =
                        ObjectManager.Get <Obj_AI_Minion>()
                        .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 == OrbwalkingMode.LaneClear && (!_config.Item("FocusMinionsOverTurrets").GetValue <KeyBind>().Active || !MinionManager.GetMinions(ObjectManager.Player.Position, GetRealAutoAttackRange(ObjectManager.Player)).Any()))
                {
                    /* turrets */
                    foreach (var turret in
                             ObjectManager.Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                    {
                        return(turret);
                    }

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

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

                /*Champions*/
                if (ActiveMode != OrbwalkingMode.LastHit && !Player.HasBuff("MonkeyKingSpinToWin"))
                {
                    var target = TargetSelector.GetTarget(-1, TargetSelector.DamageType.Physical);
                    if (target.IsValidTarget() && InAutoAttackRange(target))
                    {
                        return(target);
                    }
                }

                /*Jungle minions*/
                if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed)
                {
                    var jminions =
                        ObjectManager.Get <Obj_AI_Minion>()
                        .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 == OrbwalkingMode.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 <Obj_AI_Minion>()
                                  .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 = (Obj_AI_Minion)result;
                        }
                    }
                }

                return(result);
            }
示例#6
0
        public override void ExecuteLane()
        {
            if (!Q.IsReady())
            {
                return;
            }

            if (!GetValue <bool>("Lane.UseQ") && !GetValue <bool>("Lane.UseQ.AARange") && !GetValue <bool>("Lane.UseQ.HeatlhPrediction"))
            {
                return;
            }

            var vMinions = MinionManager.GetMinions(ObjectManager.Player.Position, Q.Range);

            if (GetValue <bool>("Lane.UseQ"))
            {
                foreach (var minions in
                         vMinions.Where(
                             minions => minions.Health < ObjectManager.Player.GetSpellDamage(minions, SpellSlot.Q)))
                {
                    var qP  = Q.GetPrediction(minions);
                    var hit = qP.CastPosition.Extend(ObjectManager.Player.Position, -140);
                    if (qP.Hitchance >= HitChance.High)
                    {
                        Q.Cast(hit);
                    }
                }
            }

            if (GetValue <bool>("Lane.UseQ.AARange"))
            {
                foreach (var minions in
                         vMinions.Where(
                             minions =>
                             minions.Health < ObjectManager.Player.GetSpellDamage(minions, SpellSlot.Q) &&
                             !minions.IsValidTarget(Orbwalking.GetRealAutoAttackRange(null) + 65)))
                {
                    var qP  = Q.GetPrediction(minions);
                    var hit = qP.CastPosition.Extend(ObjectManager.Player.Position, -140);
                    if (qP.Hitchance >= HitChance.High)
                    {
                        Q.Cast(hit);
                    }
                }
            }

            if (GetValue <bool>("Lane.Q.HeatlhPrediction"))
            {
                foreach (var n in vMinions)
                {
                    var minion =
                        MinionManager.GetMinions(Q.Range)
                        .Where(
                            m =>
                            Q.GetDamage(m) > m.Health ||
                            HealthPrediction.LaneClearHealthPrediction(
                                m, (int)(ObjectManager.Player.AttackDelay * 1000), (int)(Q.Delay * 1000)) >
                            ObjectManager.Player.GetAutoAttackDamage(m) * 1.5f)
                        .OrderBy(m => !Orbwalking.InAutoAttackRange(m))
                        .ThenBy(m => m.Health)
                        .FirstOrDefault();
                    if (minion != null)
                    {
                        Q.Cast(minion);
                        if (Q.GetDamage(minion) > minion.Health)
                        {
                            _lastFarmQKill = minion.NetworkId;
                        }
                    }
                }
            }
        }
示例#7
0
            public virtual AttackableUnit GetTarget()
            {
                AttackableUnit result = null;

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

                /*Killable Minion*/
                if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed ||
                    ActiveMode == OrbwalkingMode.LastHit)
                {
                    foreach (var minion in
                             ObjectManager.Get <Obj_AI_Minion>()
                             .Where(
                                 minion =>
                                 minion.IsValidTarget() && InAutoAttackRange(minion) &&
                                 minion.Health <
                                 Player.GetAutoAttackDamage2(minion, true) * 2)
                             ) //좀 병신같았던 Farm 수정. 이전엔 패시브 고려안해서 패시브 데미지 때문에 미니언 버리는 경우도 많았음.
                    {
                        var t = (int)(Player.AttackCastDelay * 1000) - 100 + Game.Ping / 2 +
                                1000 * (int)Player.Distance(minion, false) / (int)GetMyProjectileSpeed();
                        var predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay);

                        if (minion.Team != GameObjectTeam.Neutral && MinionManager.IsMinion(minion, true))
                        {
                            if (predHealth <= 0)
                            {
                                FireOnNonKillableMinion(minion);
                            }

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

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

                /* turrets / inhibitors / nexus */
                if (ActiveMode == OrbwalkingMode.LaneClear)
                {
                    /* turrets */
                    foreach (var turret in
                             ObjectManager.Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                    {
                        return(turret);
                    }

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

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

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

                /*Jungle minions*/
                if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed)
                {
                    result =
                        ObjectManager.Get <Obj_AI_Minion>()
                        .Where(
                            mob =>
                            mob.IsValidTarget() && InAutoAttackRange(mob) && mob.Team == GameObjectTeam.Neutral)
                        .MaxOrDefault(mob => mob.MaxHealth);
                    if (result != null)
                    {
                        return(result);
                    }
                }

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

                        result = (from minion in
                                  ObjectManager.Get <Obj_AI_Minion>()
                                  .Where(minion => minion.IsValidTarget() && InAutoAttackRange(minion))
                                  let predHealth =
                                      HealthPrediction.LaneClearHealthPrediction(
                                          minion, (int)((Player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay)
                                      where
                                      predHealth >= 2 * Player.GetAutoAttackDamage2(minion) ||
                                      Math.Abs(predHealth - minion.Health) < float.Epsilon
                                      select minion).MaxOrDefault(m => m.Health);

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

                return(result);
            }
示例#8
0
文件: Program.cs 项目: xy593239347/CN
        public static void WaveClear()
        {
            var MinionList = MinionManager.GetMinions(Player.Position, Q.Range, MinionTypes.All, MinionTeam.Enemy, MinionOrderTypes.Health)
                             .Where(x => !MinionListToIgnore.Contains(x.NetworkId)).ToList();

            var JungleList = MinionManager.GetMinions(Player.Position, Q.Range, MinionTypes.All, MinionTeam.Neutral, MinionOrderTypes.MaxHealth);

            var useQ          = Config.Item("UseQLaneClear").GetValue <bool>();
            var useW          = Config.Item("UseWLaneClear").GetValue <bool>();
            var useE          = Config.Item("UseELaneClear").GetValue <bool>();
            var ManaLaneClear = Config.Item("ManaLaneClear").GetValue <Slider>().Value;
            var packetCast    = Config.Item("PacketCast").GetValue <bool>();

            if (Q.IsReady() && useQ && Player.GetManaPerc() > ManaLaneClear)
            {
                var queryJungle = JungleList.Where(x => x.IsValidTarget(Q.Range));
                if (queryJungle.Count() > 0)
                {
                    var mob = queryJungle.First();
                    Q.CastOnUnit(mob, packetCast);
                }

                var queryMinion = MinionList.Where(x => x.IsValidTarget(Q.Range) && HealthPrediction.LaneClearHealthPrediction(x, (int)Q.Delay * 1000) < Player.GetSpellDamage(x, SpellSlot.Q) * 0.9);
                if (queryMinion.Count() > 0)
                {
                    var mob = queryMinion.First();
                    Q.CastOnUnit(mob, packetCast);
                    MinionListToIgnore.Add(mob.NetworkId);
                    MinionList.Remove(mob);
                }
            }

            if (W.IsReady() && useW && Player.GetManaPerc() > ManaLaneClear)
            {
                var queryJungle = JungleList.Where(x => x.IsValidTarget(W.Range));
                if (queryJungle.Count() > 0)
                {
                    var mob = queryJungle.First();
                    W.CastOnUnit(mob, packetCast);
                }

                var query = MinionList.Where(x => x.IsValidTarget(W.Range) && HealthPrediction.LaneClearHealthPrediction(x, (int)W.Delay * 1000) < Player.GetSpellDamage(x, SpellSlot.W) * 0.9);
                if (query.Count() > 0)
                {
                    var mob = query.First();
                    W.CastOnUnit(mob, packetCast);
                    MinionListToIgnore.Add(mob.NetworkId);
                    MinionList.Remove(mob);
                }
            }

            if (E.IsReady() && useE && Player.GetManaPerc() > ManaLaneClear)
            {
                var queryJungle = JungleList.Where(x => x.IsValidTarget(E.Range));
                if (queryJungle.Count() > 0)
                {
                    var mob = queryJungle.First();
                    E.CastOnUnit(mob, packetCast);
                }

                var query = MinionList.Where(x => x.IsValidTarget(E.Range) && HealthPrediction.LaneClearHealthPrediction(x, (int)E.Delay * 1000) < Player.GetSpellDamage(x, SpellSlot.E) * 0.9);
                if (query.Count() > 0)
                {
                    var mob = query.First();
                    E.CastOnUnit(mob, packetCast);
                    MinionListToIgnore.Add(mob.NetworkId);
                    MinionList.Remove(mob);
                }
            }
        }
示例#9
0
        public static Obj_AI_Base GetPossibleTarget()
        {
            Obj_AI_Base tempTarget = null;

            if (PUC.Menu.Item("orb_Priority").GetValue <StringList>().SelectedIndex == 1 &&
                (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear))
            {
                tempTarget = TargetSelector.GetAATarget();
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            if (CurrentMode == Mode.Harass || CurrentMode == Mode.Lasthit || CurrentMode == Mode.LaneClear)
            {
                foreach (var minion in from minion in ObjectManager.Get <Obj_AI_Minion>().Where(minion => minion.IsValidTarget(GetAutoAttackRangeto(minion)) && minion.Health > 0)
                         let time = (int)(Player.AttackCastDelay * 1000) + Game.Ping / 2 - 100 +
                                    (int)(1000 * Player.Distance(minion) / (Player.ChampionName == "Thresh" ? Player.BasicAttack.MissileSpeed :(Player.IsMelee() ? float.MaxValue : Player.BasicAttack.MissileSpeed)))
                                    let predHealth = HealthPrediction.GetHealthPrediction(minion, time, GetFarmDelay)
                                                     where minion.Team != GameObjectTeam.Neutral &&
                                                     predHealth > 0 &&
                                                     predHealth <= Player.GetAutoAttackDamage(minion, true)
                                                     select minion)
                {
                    return(minion);
                }
            }

            if (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear)
            {
                foreach (var turret in ObjectManager.Get <Obj_AI_Turret>().Where(turret => turret.IsValidTarget(GetAutoAttackRangeto(turret))))
                {
                    return(turret);
                }
            }

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

            float[] maxhealth;
            if (CurrentMode == Mode.LaneClear || CurrentMode == Mode.Harass)
            {
                maxhealth = new float[] { 0 };
                var maxhealth1 = maxhealth;
                foreach (var minion in ObjectManager.Get <Obj_AI_Minion>().Where(minion => minion.IsValidTarget(GetAutoAttackRangeto(minion)) && minion.Team == GameObjectTeam.Neutral).Where(minion => minion.MaxHealth >= maxhealth1[0] || Math.Abs(maxhealth1[0] - float.MaxValue) < float.Epsilon))
                {
                    tempTarget   = minion;
                    maxhealth[0] = minion.MaxHealth;
                }
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            if (CurrentMode != Mode.LaneClear || ShouldWait())
            {
                return(null);
            }
            maxhealth = new float[] { 0 };
            foreach (var minion in from minion in ObjectManager.Get <Obj_AI_Minion>()
                     .Where(minion => minion.IsValidTarget(GetAutoAttackRangeto(minion))) let predHealth = HealthPrediction.LaneClearHealthPrediction(
                         minion, (int)((Player.AttackDelay * 1000) * LaneClearWaitTimeMod), GetFarmDelay) where predHealth >=
                                                                                                           2 *
                                                                                                           Player.GetAutoAttackDamage(minion, true) ||
                                                                                                           Math.Abs(predHealth - minion.Health) < float.Epsilon where minion.Health >= maxhealth[0] || Math.Abs(maxhealth[0] - float.MaxValue) < float.Epsilon select minion)
            {
                tempTarget   = minion;
                maxhealth[0] = minion.MaxHealth;
            }
            return(tempTarget);
        }
示例#10
0
        public static AttackableUnit GetTarget()
        {
            AttackableUnit result = null;

            if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.None)
            {
                return(null);
            }
            /*Killable Minion*/
            if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear || Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Mixed ||
                Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LastHit)
            {
                foreach (var minion in
                         ObjectManager.Get <Obj_AI_Minion>()
                         .Where(
                             minion =>
                             minion.IsValidTarget() && Orbwalker.InAutoAttackRange(minion) &&
                             minion.Health <
                             2 *
                             (RealAutoAttack(minion)))
                         )
                {
                    var t = (int)(Player.AttackCastDelay * 1000) - 100 + Game.Ping / 2 +
                            1000 * (int)Player.Distance(minion) / (int)Orbwalking.GetMyProjectileSpeed();
                    var predHealth = HealthPrediction.GetHealthPrediction(minion, t, Program.Config.Item("FarmDelay").GetValue <Slider>().Value);

                    if (minion.Team != GameObjectTeam.Neutral && MinionManager.IsMinion(minion, true))
                    {
                        if (predHealth > 0 && predHealth <= RealAutoAttack(minion))
                        {
                            return(minion);
                        }
                    }
                }
            }

            /* turrets / inhibitors / nexus */
            if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear)
            {
                /* turrets */
                foreach (var turret in
                         ObjectManager.Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && Orbwalker.InAutoAttackRange(t)))
                {
                    return(turret);
                }

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

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

            /*Champions*/
            if (Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.LastHit)
            {
                var target = TargetSelector.GetTarget(-1, TargetSelector.DamageType.Physical);
                if (target.IsValidTarget())
                {
                    return(target);
                }
            }

            /*Jungle minions*/
            if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear || Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Mixed)
            {
                result =
                    ObjectManager.Get <Obj_AI_Minion>()
                    .Where(
                        mob =>
                        mob.IsValidTarget() && Orbwalker.InAutoAttackRange(mob) && mob.Team == GameObjectTeam.Neutral)
                    .MaxOrDefault(mob => mob.MaxHealth);
                if (result != null)
                {
                    return(result);
                }
            }

            /*Lane Clear minions*/
            if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear)
            {
                if (!ShouldWait())
                {
                    if (_prevMinion.IsValidTarget() && Orbwalker.InAutoAttackRange(_prevMinion))
                    {
                        var predHealth = HealthPrediction.LaneClearHealthPrediction(
                            _prevMinion, (int)((Player.AttackDelay * 1000) * 2f), Program.Config.Item("FarmDelay").GetValue <Slider>().Value);
                        if (predHealth >= 2 * RealAutoAttack(_prevMinion) ||
                            Math.Abs(predHealth - _prevMinion.Health) < float.Epsilon)
                        {
                            return(_prevMinion);
                        }
                    }

                    result = (from minion in
                              ObjectManager.Get <Obj_AI_Minion>()
                              .Where(minion => minion.IsValidTarget() && Orbwalker.InAutoAttackRange(minion))
                              let predHealth =
                                  HealthPrediction.LaneClearHealthPrediction(
                                      minion, (int)((Player.AttackDelay * 1000) * 2f), Program.Config.Item("FarmDelay").GetValue <Slider>().Value)
                                  where
                                  predHealth >= 2 * RealAutoAttack(minion) ||
                                  Math.Abs(predHealth - minion.Health) < float.Epsilon
                                  select minion).MaxOrDefault(m => m.Health);

                    if (result != null)
                    {
                        _prevMinion = (Obj_AI_Minion)result;
                    }
                }
            }
            return(null);
        }
示例#11
0
 private void Cast_Q(bool mode)
 {
     if (!Q.IsReady() || _passiveUp || Environment.TickCount - _passivTimer < 250)
     {
         return;
     }
     if (mode)
     {
         var target = SimpleTs.GetTarget(Q.Range, SimpleTs.DamageType.Physical);
         //if (xSLxOrbwalker.InAutoAttackRange(target))
         //	return;
         if (target != null)
         {
             _passivTimer = Environment.TickCount;
             Q.CastOnUnit(target, UsePackets());
             return;
         }
         target = SimpleTs.GetTarget(QMaxRange, SimpleTs.DamageType.Physical);
         if (target == null)
         {
             return;
         }
         foreach (var obj in ObjectManager.Get <Obj_AI_Base>().Where(obj => obj.IsValidTarget(Q.Range) && (obj.ServerPosition.To2D().Distance(MyHero.ServerPosition.To2D(), Q.GetPrediction(target).UnitPosition.To2D(), true) < 50)))
         {
             //if(xSLxOrbwalker.InAutoAttackRange(obj))
             //	return;
             _passivTimer = Environment.TickCount;
             Q.CastOnUnit(obj, UsePackets());
             return;
         }
     }
     else
     {
         var allMinions = MinionManager.GetMinions(ObjectManager.Player.Position, Q.Range, MinionTypes.All, MinionTeam.NotAlly);
         var minion     = allMinions.FirstOrDefault(minionn => minionn.Distance(MyHero) <= Q.Range && HealthPrediction.LaneClearHealthPrediction(minionn, 500) > 0);
         if (minion == null)
         {
             return;
         }
         _passivTimer = Environment.TickCount;
         Q.CastOnUnit(minion, UsePackets());
     }
 }
示例#12
0
        public static AttackableUnit GetClearMinionsAndBuildings()
        {
            AttackableUnit result = null;
            /*Killable Minion*/

            var MinionList = new List <Obj_AI_Minion>();

            MinionList.AddRange(Soldiers.soldierattackminions);
            MinionList.AddRange(Soldiers.autoattackminions);
            MinionList = MinionList
                         .OrderByDescending(minion => minion.CharData.BaseSkinName.Contains("Siege"))
                         .ThenBy(minion => minion.CharData.BaseSkinName.Contains("Super"))
                         .ThenBy(minion => minion.Health)
                         .ThenByDescending(minion => minion.MaxHealth).ToList();
            if (Program._orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear || Program._orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Mixed ||
                Program._orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LastHit)
            {
                foreach (var minion in Soldiers.autoattackminions)
                {
                    //var t = 0;
                    var t          = (int)(Player.AttackCastDelay * 1000) - 100 + Game.Ping / 2;
                    var predHealth = HealthPrediction.GetHealthPrediction(minion, t, 0);

                    if (minion.Team != GameObjectTeam.Neutral)
                    {
                        if (predHealth > 0 && predHealth <= Player.GetAutoAttackDamage(minion, true))
                        {
                            return(minion);
                        }
                    }
                }
                foreach (var minions in Soldiers.splashautoattackminions)
                {
                    var t = 0;// (int)(Player.AttackCastDelay * 1000) - 200 + Game.Ping;
                    var MainMinionPredHealth = HealthPrediction.GetHealthPrediction(minions.MainMinion, t, 0);
                    if (minions.MainMinion.Team != GameObjectTeam.Neutral)
                    {
                        if (MainMinionPredHealth > 0 && MainMinionPredHealth <= Program.Wdamage(minions.MainMinion))
                        {
                            return(minions.MainMinion);
                        }
                    }
                    foreach (var minion in minions.SplashAutoAttackMinions)
                    {
                        var predHealth = HealthPrediction.GetHealthPrediction(minion, t, 0);
                        if (minion.Team != GameObjectTeam.Neutral)
                        {
                            if (minion.Health > 0 && minion.Health <= Program.Wdamage(minion))
                            {
                                return(minions.MainMinion);
                            }
                        }
                    }
                }
            }
            if (Program._orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear)
            {
                /* turrets */
                foreach (var turret in
                         ObjectManager.Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && Orbwalking.InAutoAttackRange(t)))
                {
                    return(turret);
                }

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

                /* nexus */
                foreach (var nexus in
                         ObjectManager.Get <Obj_HQ>().Where(t => t.IsValidTarget() && Orbwalking.InAutoAttackRange(t)))
                {
                    return(nexus);
                }
            }
            /*Champions*/
            if (Program._orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.LastHit)
            {
                if (Soldiers.enemies.Any())
                {
                    var target = Soldiers.enemies.OrderByDescending(x => x.Health).LastOrDefault();
                    if (target.IsValidTarget())
                    {
                        return(target);
                    }
                }
                if (Soldiers.splashautoattackchampions.Any())
                {
                    var splashAutoAttackChampion = Soldiers.splashautoattackchampions
                                                   .OrderByDescending(x => x.SplashAutoAttackChampions.MinOrDefault(y => y.Health).Health).LastOrDefault();
                    if (splashAutoAttackChampion != null)
                    {
                        var target = splashAutoAttackChampion.MainMinion;
                        if (target.IsValidTarget())
                        {
                            return(target);
                        }
                    }
                }
                if (!Soldiers.enemies.Any() && !Soldiers.splashautoattackchampions.Any())
                {
                    var target = Program._orbwalker.GetTarget();
                    if (target.IsValidTarget() && !target.IsZombie && target is Obj_AI_Hero)
                    {
                        return(target);
                    }
                }
            }
            /*Jungle minions*/
            if (Program._orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear || Program._orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Mixed)
            {
                result =
                    MinionList
                    .Where(
                        mob =>
                        mob.IsValidTarget() && mob.Team == GameObjectTeam.Neutral && mob.CharData.BaseSkinName != "gangplankbarrel")
                    .MaxOrDefault(mob => mob.MaxHealth);
                if (result != null)
                {
                    return(result);
                }
            }


            /*Lane Clear minions*/
            if (Program._orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear)
            {
                if (!ShouldWait())
                {
                    var t              = 0;
                    var t2             = (int)Player.AttackDelay * 1000;
                    var arrangedsplash =
                        Soldiers.splashautoattackminions.OrderByDescending(x => x.SplashAutoAttackMinions.Count());
                    foreach (var minions in arrangedsplash)
                    {
                        var damage     = Program.Wdamage(minions.MainMinion);
                        var allminions = new List <Obj_AI_Minion>();
                        allminions.Add(minions.MainMinion);
                        allminions.AddRange(minions.SplashAutoAttackMinions);
                        if (
                            allminions.All(
                                x =>
                                HealthPrediction.LaneClearHealthPrediction(x, t + t2, 0) >= damage * 2 ||
                                Math.Abs(HealthPrediction.LaneClearHealthPrediction(x, t + t2, 0) - x.Health) <=
                                float.Epsilon))
                        {
                            return(minions.MainMinion);
                        }
                    }
                    var arrangedattack = Soldiers.autoattackminions
                                         .OrderByDescending(minion => minion.CharData.BaseSkinName.Contains("Siege"))
                                         .ThenBy(minion => minion.CharData.BaseSkinName.Contains("Super"))
                                         .ThenBy(minion => minion.Health)
                                         .ThenByDescending(minion => minion.MaxHealth).ToList();
                    foreach (var minion in arrangedattack)
                    {
                        var predHealth = HealthPrediction.LaneClearHealthPrediction(minion, t + t2, 0);
                        if (predHealth >= Player.GetAutoAttackDamage(minion) * 2 || Math.Abs(predHealth - minion.Health) < float.Epsilon)
                        {
                            return(minion);
                        }
                    }
                }
            }
            return(result);
        }
示例#13
0
        public static void WaveClear()
        {
            var useQ = Config.Item("UseQLaneClear").GetValue <bool>();
            var useW = Config.Item("UseWLaneClear").GetValue <bool>();
            var useE = Config.Item("UseELaneClear").GetValue <bool>();
            var UseELastHitLaneClear = Config.Item("UseELastHitLaneClear").GetValue <bool>();
            var packetCast           = Config.Item("PacketCast").GetValue <bool>();
            var LaneClearMinMana     = Config.Item("LaneClearMinMana").GetValue <Slider>().Value;

            if (Q.IsReady() && useQ && Player.GetManaPerc() >= LaneClearMinMana)
            {
                var allMinionsQ            = MinionManager.GetMinions(Player.Position, Q.Range + Q.Width, MinionTypes.All, MinionTeam.Enemy, MinionOrderTypes.Health).ToList();
                var allMinionsQNonPoisoned = allMinionsQ.Where(x => !x.HasBuffOfType(BuffType.Poison)).ToList();

                if (allMinionsQNonPoisoned.Count > 0)
                {
                    var farmNonPoisoned = Q.GetCircularFarmLocation(allMinionsQNonPoisoned, Q.Width * 0.8f);
                    if (farmNonPoisoned.MinionsHit >= 3)
                    {
                        Q.Cast(farmNonPoisoned.Position, packetCast);
                        dtLastQCast = DateTime.Now;
                        return;
                    }
                }

                if (allMinionsQ.Count > 0)
                {
                    var farmAll = Q.GetCircularFarmLocation(allMinionsQ, Q.Width * 0.8f);
                    if (farmAll.MinionsHit >= 2 || allMinionsQ.Count == 1)
                    {
                        Q.Cast(farmAll.Position, packetCast);
                        dtLastQCast = DateTime.Now;
                        return;
                    }
                }
            }

            if (W.IsReady() && useW && Player.GetManaPerc() >= LaneClearMinMana && DateTime.Now > dtLastQCast.AddMilliseconds(Q.Delay * 1000))
            {
                var allMinionsW            = MinionManager.GetMinions(Player.ServerPosition, W.Range + W.Width, MinionTypes.All).ToList();
                var allMinionsWNonPoisoned = allMinionsW.Where(x => !x.HasBuffOfType(BuffType.Poison)).ToList();

                if (allMinionsWNonPoisoned.Count > 0)
                {
                    var farmNonPoisoned = W.GetCircularFarmLocation(allMinionsWNonPoisoned, W.Width * 0.8f);
                    if (farmNonPoisoned.MinionsHit >= 3)
                    {
                        W.Cast(farmNonPoisoned.Position, packetCast);
                        return;
                    }
                }

                if (allMinionsW.Count > 0)
                {
                    var farmAll = W.GetCircularFarmLocation(allMinionsW, W.Width * 0.8f);
                    if (farmAll.MinionsHit >= 2 || allMinionsW.Count == 1)
                    {
                        W.Cast(farmAll.Position, packetCast);
                        return;
                    }
                }
            }

            if (E.IsReady() && useE)
            {
                MinionList = MinionManager.GetMinions(Player.ServerPosition, E.Range, MinionTypes.All, MinionTeam.Enemy, MinionOrderTypes.Health);

                foreach (var minion in MinionList.Where(x => x.HasBuffOfType(BuffType.Poison)).ToList())
                {
                    var buffEndTime = GetPoisonBuffEndTime(minion);

                    if (buffEndTime > (Game.Time + E.Delay))
                    {
                        if (UseELastHitLaneClear)
                        {
                            if (Player.GetSpellDamage(minion, SpellSlot.E) * 0.9d > HealthPrediction.LaneClearHealthPrediction(minion, (int)E.Delay * 1000))
                            {
                                CastE(minion);
                            }
                        }
                        else if (Player.GetManaPerc() >= LaneClearMinMana)
                        {
                            CastE(minion);
                        }
                    }
                }
            }
        }
示例#14
0
        public static Obj_AI_Base GetPossibleTarget()
        {
            if (ForcedTarget != null)
            {
                if (InAutoAttackRange(ForcedTarget))
                {
                    return(ForcedTarget);
                }
                ForcedTarget = null;
            }


            Obj_AI_Base tempTarget = null;

            if (getBoxItem(menuMisc, "orb_Misc_Priority_Unit") == 1 &&
                (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear))
            {
                tempTarget = GetBestHeroTarget();
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            if (CurrentMode == Mode.Harass || CurrentMode == Mode.Lasthit || CurrentMode == Mode.LaneClear || CurrentMode == Mode.LaneFreeze)
            {
                if (MyHero.ChampionName == "Azir")
                {
                    foreach (
                        var minion in
                        from minion in
                        ObjectManager.Get <Obj_AI_Minion>().Where(minion => minion.LSIsValidTarget() && minion.Name != "Beacon" && InSoldierAttackRange(minion))
                        let t = (int)(MyHero.AttackCastDelay * 1000) - 100 + Game.Ping / 2 +
                                1000 * (int)MyHero.LSDistance(minion) / (int)MyProjectileSpeed()
                                let predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay(-125))
                                                 where minion.Team != GameObjectTeam.Neutral && predHealth > 0 &&
                                                 predHealth <= GetAzirAASandwarriorDamage(minion)
                                                 select minion)
                    {
                        return(minion);
                    }
                }

                foreach (
                    var minion in
                    from minion in
                    ObjectManager.Get <Obj_AI_Minion>().Where(minion => minion.LSIsValidTarget() && minion.Name != "Beacon" && InAutoAttackRange(minion))
                    let t = (int)(MyHero.AttackCastDelay * 1000) - 100 + Game.Ping / 2 +
                            1000 * (int)MyHero.LSDistance(minion) / (int)MyProjectileSpeed()
                            let predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay())
                                             where minion.Team != GameObjectTeam.Neutral && predHealth > 0 &&
                                             predHealth <= MyHero.LSGetAutoAttackDamage(minion, true)
                                             select minion)
                {
                    return(minion);
                }
            }

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

            if (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear || CurrentMode == Mode.LaneFreeze)
            {
                foreach (
                    var turret in
                    ObjectManager.Get <Obj_AI_Turret>().Where(turret => turret.LSIsValidTarget(GetAutoAttackRange(MyHero, turret))))
                {
                    return(turret);
                }
            }

            float[] maxhealth;
            if (CurrentMode == Mode.LaneClear || CurrentMode == Mode.Harass || CurrentMode == Mode.LaneFreeze)
            {
                if (MyHero.ChampionName == "Azir")
                {
                    maxhealth = new float[] { 0 };
                    var maxhealth1 = maxhealth;
                    foreach (
                        var minion in
                        ObjectManager.Get <Obj_AI_Minion>()
                        .Where(minion => InSoldierAttackRange(minion) && minion.Name != "Beacon" && minion.LSIsValidTarget() && minion.Team == GameObjectTeam.Neutral)
                        .Where(minion => minion.MaxHealth >= maxhealth1[0] || Math.Abs(maxhealth1[0] - float.MaxValue) < float.Epsilon))
                    {
                        tempTarget   = minion;
                        maxhealth[0] = minion.MaxHealth;
                    }
                    if (tempTarget != null)
                    {
                        return(tempTarget);
                    }
                }

                maxhealth = new float[] { 0 };
                var maxhealth2 = maxhealth;
                foreach (var minion in ObjectManager.Get <Obj_AI_Minion>().Where(minion => minion.LSIsValidTarget(GetAutoAttackRange(MyHero, minion)) && minion.Name != "Beacon" && minion.Team == GameObjectTeam.Neutral).Where(minion => minion.MaxHealth >= maxhealth2[0] || Math.Abs(maxhealth2[0] - float.MaxValue) < float.Epsilon))
                {
                    tempTarget   = minion;
                    maxhealth[0] = minion.MaxHealth;
                }
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            if (CurrentMode != Mode.LaneClear || EloBuddy.SDK.Orbwalker.ShouldWait)
            {
                //ResetAutoAttackTimer();
                return(null);
            }

            if (MyHero.ChampionName == "Azir")
            {
                maxhealth = new float[] { 0 };
                float[] maxhealth1 = maxhealth;
                foreach (var minion in from minion in ObjectManager.Get <Obj_AI_Minion>()
                         .Where(minion => minion.LSIsValidTarget() && minion.Name != "Beacon" && InSoldierAttackRange(minion))
                         let predHealth = HealthPrediction.LaneClearHealthPrediction(minion, (int)((MyHero.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay(-125))
                                          where predHealth >=
                                          GetAzirAASandwarriorDamage(minion) + MyHero.LSGetAutoAttackDamage(minion, true) ||
                                          Math.Abs(predHealth - minion.Health) < float.Epsilon
                                          where minion.Health >= maxhealth1[0] || Math.Abs(maxhealth1[0] - float.MaxValue) < float.Epsilon
                                          select minion)
                {
                    tempTarget   = minion;
                    maxhealth[0] = minion.MaxHealth;
                }
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            maxhealth = new float[] { 0 };
            foreach (var minion in from minion in ObjectManager.Get <Obj_AI_Minion>()
                     .Where(minion => minion.LSIsValidTarget(GetAutoAttackRange(MyHero, minion)) && minion.Name != "Beacon")
                     let predHealth = HealthPrediction.LaneClearHealthPrediction(minion, (int)((MyHero.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay())
                                      where predHealth >=
                                      2 * MyHero.LSGetAutoAttackDamage(minion, true) ||
                                      Math.Abs(predHealth - minion.Health) < float.Epsilon
                                      where minion.Health >= maxhealth[0] || Math.Abs(maxhealth[0] - float.MaxValue) < float.Epsilon
                                      select minion)
            {
                tempTarget   = minion;
                maxhealth[0] = minion.MaxHealth;
            }
            if (tempTarget != null)
            {
                return(tempTarget);
            }

            return(null);
        }
示例#15
0
            public virtual AttackableUnit GetTarget()
            {
                AttackableUnit result = null;

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

                /*Killable Minion*/
                if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed ||
                    ActiveMode == OrbwalkingMode.LastHit)
                {
                    var minionList =
                        MinionManager.GetMinions(Player.Position, float.MaxValue)
                        .Where(
                            minion =>
                            InAutoAttackRange(minion) &&
                            minion.Health <
                            2 *
                            (ObjectManager.Player.BaseAttackDamage + ObjectManager.Player.FlatPhysicalDamageMod))
                        .OrderByDescending(m => m.MaxHealth);

                    foreach (var minion in minionList)
                    {
                        var t = (int)(_player.AttackCastDelay * 1000) - 100 + Game.Ping / 2 +
                                1000 * (int)_player.Distance(minion) / (int)GetMyProjectileSpeed();
                        var predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay);
                        if (predHealth <= 0)
                        {
                            FireOnNonKillableMinion(minion);
                        }

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

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

                /* turrets / inhibitors / nexus */
                if (ActiveMode == OrbwalkingMode.LaneClear)
                {
                    /* turrets */
                    foreach (var turret in
                             GameObjects.EnemyTurrets.Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                    {
                        return(turret);
                    }

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

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

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

                /*Jungle minions*/
                if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed)
                {
                    result =
                        MinionManager.GetMinions(Player.Position, float.MaxValue, MinionTypes.All, MinionTeam.Neutral)
                        .Where(InAutoAttackRange)
                        .MaxOrDefault(mob => mob.MaxHealth);

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

                /*Lane Clear minions*/
                if (ActiveMode == OrbwalkingMode.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
                                  MinionManager.GetMinions(Player.Position, float.MaxValue).Where(InAutoAttackRange)
                                  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 => m.Health);

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

                return(result);
            }
示例#16
0
        private static AttackableUnit GetBestMinion(bool lastHitOnly)
        {
            AttackableUnit tempTarget = null;
            var            enemies    = ObjectManager.Get <Obj_AI_Minion>().Where(x => x.IsValidTarget() && x.Name != "Beacon" && InAutoAttackRange(x)).ToList();

            foreach (var minion in from minion in enemies
                     let t = ProjectTime(minion)
                             let predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay())
                                              where minion.Team != GameObjectTeam.Neutral && predHealth > 0 &&
                                              (predHealth <= Player.GetAutoAttackDamage(minion, true))
                                              select minion)
            {
                return(minion);
            }

            if (_menu.Item("NewMode").GetValue <bool>())
            {
                var turret =
                    ObjectManager.Get <Obj_AI_Turret>()
                    .Where(x => x.IsValid && x.IsAlly)
                    .OrderBy(x => Player.Distance(x))
                    .FirstOrDefault();

                if (turret != null && lastHitOnly)
                {
                    foreach (var minion in enemies.Where(x => turret.Distance(x.ServerPosition) < 1000).OrderBy(x => x.Distance(turret)))
                    {
                        var playerProjectile = ProjectTime(minion);
                        var predHealth       = HealthPrediction.GetHealthPrediction(minion, playerProjectile, FarmDelay());
                        var turretProjectile = turret.AttackCastDelay * 1000 + turret.Distance(minion) / turret.BasicAttack.MissileSpeed * 1000;

                        if (predHealth < 0 || playerProjectile * 1.8 > turretProjectile)
                        {
                            continue;
                        }

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

            if (lastHitOnly)
            {
                return(null);
            }

            if (ShouldWait())
            {
                return(null);
            }

            //LANE CLEAR
            var maxhealth = new float[] { 0 };

            foreach (var minion in from minion in ObjectManager.Get <Obj_AI_Minion>()
                     .Where(minion => minion.IsValidTarget(GetAutoAttackRange(Player, minion)) && minion.Name != "Beacon")
                     let predHealth = HealthPrediction.LaneClearHealthPrediction(minion, (int)((Player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay())
                                      where predHealth >=
                                      2 * Player.GetAutoAttackDamage(minion, true) ||
                                      Math.Abs(predHealth - minion.Health) < float.Epsilon
                                      where minion.Health >= maxhealth[0] || Math.Abs(maxhealth[0] - float.MaxValue) < float.Epsilon
                                      select minion)
            {
                tempTarget   = minion;
                maxhealth[0] = minion.MaxHealth;
            }

            return(tempTarget);
        }
示例#17
0
                public Obj_AI_Base GetTarget()
                {
                    Obj_AI_Base result = null;

                    float[] r = { float.MaxValue };
                    if ((ActiveMode == OrbwalkingMode.Mixed || ActiveMode == OrbwalkingMode.LaneClear) && !_config.Item("PriorizeFarm").GetValue <bool>())
                    {
                        var target = SimpleTs.GetTarget(-1, SimpleTs.DamageType.Physical) ?? GetSoldierTargetHero();
                        if (target != null)
                        {
                            return(target);
                        }
                    }

                    if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed ||
                        ActiveMode == OrbwalkingMode.LastHit)
                    {
                        foreach (var minion in from minion in ObjectManager.Get <Obj_AI_Minion>().Where(minion => minion.IsValidTarget(GetRealAutoAttackRange(minion)) && minion.Health > 0)
                                 let time = (int)(Player.AttackCastDelay * 1000) + Game.Ping / 2 - 100 +
                                            (int)(1000 * Player.Distance(minion) / (Player.IsMelee() ? float.MaxValue : Player.BasicAttack.MissileSpeed))
                                            let predHealth = HealthPrediction.GetHealthPrediction(minion, time, 125)
                                                             where minion.Team != GameObjectTeam.Neutral &&
                                                             predHealth > 0 &&
                                                             predHealth <= Player.GetAutoAttackDamage(minion, true)
                                                             select minion)
                        {
                            return(minion);
                        }
                    }
                    //Forced target
                    if (_forcedTarget != null && _forcedTarget.IsValidTarget() &&
                        (InAutoAttackRange(_forcedTarget) || InSoldierAttackRange(_forcedTarget)))
                    {
                        return(_forcedTarget);
                    }
                    /*Champions*/
                    if (ActiveMode != OrbwalkingMode.LastHit)
                    {
                        var target = SimpleTs.GetTarget(-1, SimpleTs.DamageType.Physical) ?? GetSoldierTargetHero();
                        if (target != null)
                        {
                            return(target);
                        }
                    }
                    /*Jungle minions*/
                    if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed)
                    {
                        foreach (var mob in
                                 ObjectManager.Get <Obj_AI_Minion>()
                                 .Where(
                                     mob =>
                                     mob.IsValidTarget() && (InAutoAttackRange(mob) || InSoldierAttackRange(mob)) && mob.Team == GameObjectTeam.Neutral)
                                 .Where(mob => mob.MaxHealth >= r[0] || Math.Abs(r[0] - float.MaxValue) < float.Epsilon))
                        {
                            result = mob;
                            r[0]   = mob.MaxHealth;
                        }
                    }
                    if (result != null)
                    {
                        return(result);
                    }
                    /*Lane Clear minions*/
                    r[0] = float.MaxValue;
                    if (ActiveMode == OrbwalkingMode.LaneClear)
                    {
                        var maxhealth = new float[] { 0 };
                        foreach (var minion in from minion in ObjectManager.Get <Obj_AI_Minion>()
                                 .Where(minion => minion.IsValidTarget(GetRealAutoAttackRange(minion)))
                                 let predHealth = HealthPrediction.LaneClearHealthPrediction(
                                     minion, (int)((Player.AttackDelay * 1000) * LaneClearWaitTimeMod), 125)
                                                  where predHealth >=
                                                  2 *
                                                  Player.GetAutoAttackDamage(minion, true) ||
                                                  Math.Abs(predHealth - minion.Health) < float.Epsilon
                                                  where minion.Health >= maxhealth[0] || Math.Abs(maxhealth[0] - float.MaxValue) < float.Epsilon
                                                  select minion)
                        {
                            result       = minion;
                            maxhealth[0] = minion.MaxHealth;
                        }
                        return(result);
                    }
                    /*turrets*/
                    if (ActiveMode != OrbwalkingMode.LaneClear)
                    {
                        return(result);
                    }
                    foreach (var turret in
                             ObjectManager.Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                    {
                        return(turret);
                    }
                    return(result);
                }
示例#18
0
 public bool ShouldWait()
 {
     return(Get <Obj_AI_Minion>().Any(minion => minion.IsValidTarget() && minion.Team != GameObjectTeam.Neutral && InAutoAttackRange(minion) && MinionManager.IsMinion(minion) && HealthPrediction.LaneClearHealthPrediction(minion, (int)(player.AttackDelay * 1000 * LaneClearWaitTimeMod), FarmDelay) <= player.GetAutoAttackDamage(minion)));
 }
示例#19
0
        public override void ExecuteLaneClear()
        {
            int laneQValue = GetValue <StringList>("Lane.UseQ").SelectedIndex;

            if (laneQValue != 0)
            {
                var minion = Q.GetLineCollisionMinions(laneQValue);
                if (minion != null)
                {
                    Q.CastOnUnit(minion);
                }
                var allMinions = MinionManager.GetMinions(ObjectManager.Player.Position, Q.Range, MinionTypes.All, MinionTeam.NotAlly);
                minion = allMinions.FirstOrDefault(minionn => minionn.Distance(ObjectManager.Player.Position) <= Q.Range && HealthPrediction.LaneClearHealthPrediction(minionn, (int)Q.Delay * 2) > 0);
                if (minion != null)
                {
                    Q.CastOnUnit(minion);
                }
            }

            int laneWValue = GetValue <StringList>("Lane.UseW").SelectedIndex;

            if (laneWValue != 0 && E.IsReady())
            {
                Vector2 minions = W.GetLineFarmMinions(laneWValue);
                if (minions != Vector2.Zero)
                {
                    W.Cast(minions);
                }
            }
        }
示例#20
0
            public virtual AttackableUnit GetTarget()
            {
                AttackableUnit result = null;

                var mode = ActiveMode;

                if ((mode == OrbwalkingMode.Mixed || mode == OrbwalkingMode.LaneClear) && !Menu.Item("PriorizeFarm").GetValue <bool>())
                {
                    var target = TargetSelector.GetTarget(-1, TargetSelector.DamageType.Physical);

                    if (target != null && InAutoAttackRange(target))
                    {
                        return(target);
                    }
                }

                var attackGankPlankBarrels = Menu.Item("AttackGPBarrel").GetValue <StringList>().SelectedIndex;

                if (attackGankPlankBarrels != 2 && (attackGankPlankBarrels == 0 || (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Mixed || mode == OrbwalkingMode.LastHit || mode == OrbwalkingMode.Freeze)))
                {
                    var enemyGangPlank = HeroManager.Enemies.FirstOrDefault(e => e.ChampionName.Equals("gangplank", StringComparison.InvariantCultureIgnoreCase));

                    if (enemyGangPlank != null)
                    {
                        var barrels = Get <Obj_AI_Minion>().Where(minion => minion.Team == GameObjectTeam.Neutral && minion.CharData.BaseSkinName == "gangplankbarrel" && minion.IsHPBarRendered && minion.IsValidTarget() && InAutoAttackRange(minion));

                        var objAiMinions = barrels as Obj_AI_Minion[] ?? barrels.ToArray();

                        foreach (var barrel in objAiMinions)
                        {
                            if (barrel.Health <= 1f)
                            {
                                return(barrel);
                            }

                            var t          = (int)(player.AttackCastDelay * 1000) + Game.Ping / 2 + 1000 * (int)Math.Max(0, player.Distance(barrel) - player.BoundingRadius) / (int)GetMyProjectileSpeed();
                            var barrelBuff = barrel.Buffs.FirstOrDefault(b => b.Name.Equals("gangplankebarrelactive", StringComparison.InvariantCultureIgnoreCase));

                            if (barrelBuff != null && barrel.Health <= 2f)
                            {
                                var healthDecayRate     = enemyGangPlank.Level >= 13 ? 0.5f : (enemyGangPlank.Level >= 7 ? 1f : 2f);
                                var nextHealthDecayTime = Game.Time < barrelBuff.StartTime + healthDecayRate ? barrelBuff.StartTime + healthDecayRate : barrelBuff.StartTime + healthDecayRate * 2;

                                if (nextHealthDecayTime <= Game.Time + t / 1000f)
                                {
                                    return(barrel);
                                }
                            }
                        }

                        if (objAiMinions.Any())
                        {
                            return(null);
                        }
                    }
                }

                if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Mixed || mode == OrbwalkingMode.LastHit || mode == OrbwalkingMode.Freeze)
                {
                    var MinionList = Get <Obj_AI_Minion>()
                                     .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)GetMyProjectileSpeed();

                        if (mode == OrbwalkingMode.Freeze)
                        {
                            t += 200 + Game.Ping / 2;
                        }

                        var predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay);

                        if (minion.Team != GameObjectTeam.Neutral && ShouldAttackMinion(minion))
                        {
                            var damage   = player.GetAutoAttackDamage(minion, true);
                            var killable = predHealth <= damage;

                            if (mode == OrbwalkingMode.Freeze)
                            {
                                if (minion.Health < 50 || predHealth <= 50)
                                {
                                    return(minion);
                                }
                            }
                            else
                            {
                                if (predHealth <= 0)
                                {
                                    FireOnNonKillableMinion(minion);
                                }

                                if (killable)
                                {
                                    return(minion);
                                }
                            }
                        }
                    }
                }

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

                if (mode == OrbwalkingMode.LaneClear && (!Menu.Item("FocusMinionsOverTurrets").GetValue <KeyBind>().Active || !MinionManager.GetMinions(ObjectManager.Player.Position, GetRealAutoAttackRange(ObjectManager.Player)).Any()))
                {
                    foreach (var turret in Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                    {
                        return(turret);
                    }

                    foreach (var turret in Get <Obj_BarracksDampener>().Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                    {
                        return(turret);
                    }

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

                if (mode != OrbwalkingMode.LastHit)
                {
                    if (mode != OrbwalkingMode.LaneClear || !ShouldWait())
                    {
                        var target = TargetSelector.GetTarget(-1, TargetSelector.DamageType.Physical);

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

                if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Mixed)
                {
                    var jminions = Get <Obj_AI_Minion>().Where(mob => mob.IsValidTarget() && mob.Team == GameObjectTeam.Neutral && InAutoAttackRange(mob) && mob.CharData.BaseSkinName != "gangplankbarrel" && mob.Name != "WardCorpse");

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

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

                if (mode == OrbwalkingMode.LaneClear || mode == OrbwalkingMode.Mixed || mode == OrbwalkingMode.LastHit || mode == OrbwalkingMode.Freeze)
                {
                    var closestTower = Get <Obj_AI_Turret>().MinOrDefault(t => t.IsAlly && !t.IsDead ? player.Distance(t, true) : float.MaxValue);

                    if (closestTower != null && player.Distance(closestTower, true) < 1500 * 1500)
                    {
                        Obj_AI_Minion farmUnderTurretMinion = null;
                        Obj_AI_Minion noneKillableMinion    = null;

                        var minions = MinionManager.GetMinions(player.Position, player.AttackRange + 200)
                                      .Where(minion => InAutoAttackRange(minion) && closestTower.Distance(minion, true) < 900 * 900)
                                      .OrderByDescending(minion => minion.CharData.BaseSkinName.Contains("Siege"))
                                      .ThenBy(minion => minion.CharData.BaseSkinName.Contains("Super"))
                                      .ThenByDescending(minion => minion.MaxHealth)
                                      .ThenByDescending(minion => minion.Health);

                        if (minions.Any())
                        {
                            var turretMinion = minions.FirstOrDefault(minion => minion is Obj_AI_Minion && HealthPrediction.HasTurretAggro((Obj_AI_Minion)minion));

                            if (turretMinion != null)
                            {
                                var hpLeftBeforeDie   = 0;
                                var hpLeft            = 0;
                                var turretAttackCount = 0;
                                var turretStarTick    = HealthPrediction.TurretAggroStartTick(turretMinion as Obj_AI_Minion);
                                var turretLandTick    = turretStarTick + (int)(closestTower.AttackCastDelay * 1000) + 1000 * Math.Max(0, (int)(turretMinion.Distance(closestTower) - closestTower.BoundingRadius)) / (int)(closestTower.BasicAttack.MissileSpeed + 70);

                                for (float i = turretLandTick + 50; i < turretLandTick + 10 * closestTower.AttackDelay * 1000 + 50; i = i + closestTower.AttackDelay * 1000)
                                {
                                    var time   = (int)i - Utils.GameTimeTickCount + Game.Ping / 2;
                                    var predHP = (int)HealthPrediction.LaneClearHealthPrediction(turretMinion, time > 0 ? time : 0);

                                    if (predHP > 0)
                                    {
                                        hpLeft             = predHP;
                                        turretAttackCount += 1;

                                        continue;
                                    }

                                    hpLeftBeforeDie = hpLeft;
                                    hpLeft          = 0;

                                    break;
                                }

                                if (hpLeft == 0 && turretAttackCount != 0 && hpLeftBeforeDie != 0)
                                {
                                    var damage               = (int)player.GetAutoAttackDamage(turretMinion, true);
                                    var hits                 = hpLeftBeforeDie / damage;
                                    var timeBeforeDie        = turretLandTick + (turretAttackCount + 1) * (int)(closestTower.AttackDelay * 1000) - Utils.GameTimeTickCount;
                                    var timeUntilAttackReady = LastAATick + (int)(player.AttackDelay * 1000) > Utils.GameTimeTickCount + Game.Ping / 2 + 25 ? LastAATick + (int)(player.AttackDelay * 1000) - (Utils.GameTimeTickCount + Game.Ping / 2 + 25) : 0;
                                    var timeToLandAttack     = player.IsMelee ? player.AttackCastDelay * 1000 : player.AttackCastDelay * 1000 + 1000 * Math.Max(0, turretMinion.Distance(player) - player.BoundingRadius) / player.BasicAttack.MissileSpeed;

                                    if (hits >= 1 && hits * player.AttackDelay * 1000 + timeUntilAttackReady + timeToLandAttack < timeBeforeDie)
                                    {
                                        farmUnderTurretMinion = turretMinion as Obj_AI_Minion;
                                    }
                                    else if (hits >= 1 && hits * player.AttackDelay * 1000 + timeUntilAttackReady + timeToLandAttack > timeBeforeDie)
                                    {
                                        noneKillableMinion = turretMinion as Obj_AI_Minion;
                                    }
                                }
                                else if (hpLeft == 0 && turretAttackCount == 0 && hpLeftBeforeDie == 0)
                                {
                                    noneKillableMinion = turretMinion as Obj_AI_Minion;
                                }

                                if (ShouldWaitUnderTurret(noneKillableMinion))
                                {
                                    return(null);
                                }

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

                                foreach (var minion in minions.Where(x => x.NetworkId != turretMinion.NetworkId && x is Obj_AI_Minion && !HealthPrediction.HasMinionAggro((Obj_AI_Minion)x)))
                                {
                                    var playerDamage = (int)player.GetAutoAttackDamage(minion);
                                    var turretDamage = (int)closestTower.GetAutoAttackDamage(minion, true);
                                    var leftHP       = (int)minion.Health % turretDamage;

                                    if (leftHP > playerDamage)
                                    {
                                        return(minion);
                                    }
                                }

                                var lastminion = minions.LastOrDefault(x => x.NetworkId != turretMinion.NetworkId && x is Obj_AI_Minion && !HealthPrediction.HasMinionAggro((Obj_AI_Minion)x));

                                if (lastminion != null && minions.Count() >= 2)
                                {
                                    if (1f / player.AttackDelay >= 1f && (int)(turretAttackCount * closestTower.AttackDelay / player.AttackDelay) * player.GetAutoAttackDamage(lastminion) > lastminion.Health)
                                    {
                                        return(lastminion);
                                    }

                                    if (minions.Count() >= 5 && 1f / player.AttackDelay >= 1.2)
                                    {
                                        return(lastminion);
                                    }
                                }
                            }
                            else
                            {
                                if (ShouldWaitUnderTurret(noneKillableMinion))
                                {
                                    return(null);
                                }

                                foreach (
                                    var minion in
                                    minions.Where(
                                        x =>
                                        x is Obj_AI_Minion &&
                                        !HealthPrediction.HasMinionAggro((Obj_AI_Minion)x)))
                                {
                                    {
                                        var playerDamage = (int)player.GetAutoAttackDamage(minion);
                                        var turretDamage = (int)closestTower.GetAutoAttackDamage(minion, true);
                                        var leftHP       = (int)minion.Health % turretDamage;
                                        if (leftHP > playerDamage)
                                        {
                                            return(minion);
                                        }
                                    }
                                }

                                var lastminion =
                                    minions.LastOrDefault(
                                        x =>
                                        x is Obj_AI_Minion &&
                                        !HealthPrediction.HasMinionAggro((Obj_AI_Minion)x));

                                if (lastminion == null || minions.Count() < 2)
                                {
                                    return(null);
                                }

                                if (minions.Count() >= 5 && 1f / player.AttackDelay >= 1.2)
                                {
                                    return(lastminion);
                                }
                            }
                            return(null);
                        }
                    }
                }

                if (mode == OrbwalkingMode.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 = Get <Obj_AI_Minion>()
                                 .Where(
                            minion =>
                            minion.IsValidTarget() && InAutoAttackRange(minion) && ShouldAttackMinion(minion))
                                 .Select(
                            minion =>
                            new
                        {
                            minion,
                            predHealth =
                                HealthPrediction.LaneClearHealthPrediction(minion,
                                                                           (int)(player.AttackDelay * 1000 * LaneClearWaitTimeMod), FarmDelay)
                        })
                                 .Where(
                            t =>
                            t.predHealth >= 2 * player.GetAutoAttackDamage(t.minion) ||
                            Math.Abs(t.predHealth - t.minion.Health) < float.Epsilon)
                                 .Select(t => t.minion).MaxOrDefault(m => !MinionManager.IsMinion(m, true) ? float.MaxValue : m.Health);

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

                return(result);
            }
示例#21
0
文件: Lucian.cs 项目: yunnnn1/Yunnnn
        private void Farm()
        {
            if (!HasMana("LaneClear"))
            {
                return;
            }

            var useQ = menu.Item("UseQFarm", true).GetValue <bool>();
            var useW = menu.Item("UseWFarm", true).GetValue <bool>();

            if (useQ)
            {
                var allMinions = MinionManager.GetMinions(ObjectManager.Player.Position, Q.Range, MinionTypes.All, MinionTeam.NotAlly);
                var minion     = allMinions.FirstOrDefault(minionn => minionn.Distance(Player) <= Q.Range && HealthPrediction.LaneClearHealthPrediction(minionn, 500) > 0);
                if (minion == null)
                {
                    return;
                }

                Q.CastOnUnit(minion);
            }
            if (useW)
            {
                var allMinionE = MinionManager.GetMinions(Player.ServerPosition, W.Range, MinionTypes.All, MinionTeam.NotAlly);

                if (allMinionE.Count > 1)
                {
                    var pred = W.GetCircularFarmLocation(allMinionE);

                    W.Cast(pred.Position);
                }
            }
        }
示例#22
0
        private static Obj_AI_Base GetPossibleTarget()
        {
            if (ForcedTarget != null && ForcedTarget.IsValidTarget() && InAutoAttackRange(ForcedTarget))
            {
                return(ForcedTarget);
            }
            Obj_AI_Base Target = null;

            if (Config.Item("OW_Misc_PriorityUnit").GetValue <StringList>().SelectedIndex == 1 && (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear))
            {
                Target = GetBestHeroTarget();
                if (Target != null)
                {
                    return(Target);
                }
            }
            if (CurrentMode == Mode.Harass || CurrentMode == Mode.LastHit || CurrentMode == Mode.LaneClear || CurrentMode == Mode.LaneFreeze)
            {
                foreach (var Obj in ObjectManager.Get <Obj_AI_Minion>().Where(i => i.IsValidTarget() && i.Name != "Beacon" && Player.ChampionName == "Azir" ? InSoldierAttackRange(i) : InAutoAttackRange(i) && i.Team != GameObjectTeam.Neutral))
                {
                    var Time   = (int)(Player.AttackCastDelay * 1000 - 100 + Game.Ping / 2 + 1000 * Player.Distance(Obj) / MyProjectileSpeed());
                    var predHp = HealthPrediction.GetHealthPrediction(Obj, Time, FarmDelay(Player.ChampionName == "Azir" ? -125 : 0));
                    if (predHp > 0 && predHp <= (Player.ChampionName == "Azir" ? GetAzirAASandwarriorDamage(Obj) : Player.GetAutoAttackDamage(Obj, true)))
                    {
                        return(Obj);
                    }
                }
            }
            if (CurrentMode != Mode.LastHit)
            {
                Target = GetBestHeroTarget();
                if (Target != null)
                {
                    return(Target);
                }
            }
            if (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear || CurrentMode == Mode.LaneFreeze)
            {
                foreach (var Obj in ObjectManager.Get <Obj_AI_Turret>().Where(i => i.IsValidTarget() && InAutoAttackRange(i)))
                {
                    return(Obj);
                }
            }
            var maxHp = float.MaxValue;

            if (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear || CurrentMode == Mode.LaneFreeze)
            {
                foreach (var Obj in ObjectManager.Get <Obj_AI_Minion>().Where(i => i.IsValidTarget() && i.Name != "Beacon" && Player.ChampionName == "Azir" ? InSoldierAttackRange(i) : InAutoAttackRange(i) && i.Team == GameObjectTeam.Neutral && (i.MaxHealth >= maxHp || Math.Abs(maxHp - float.MaxValue) < float.Epsilon)))
                {
                    Target = Obj;
                    maxHp  = Obj.MaxHealth;
                }
                if (Target != null)
                {
                    return(Target);
                }
            }
            if (CurrentMode == Mode.LaneClear && !ShouldWait())
            {
                foreach (var Obj in ObjectManager.Get <Obj_AI_Minion>().Where(i => i.IsValidTarget() && i.Name != "Beacon" && Player.ChampionName == "Azir" ? InSoldierAttackRange(i) : InAutoAttackRange(i)))
                {
                    var predHp = HealthPrediction.LaneClearHealthPrediction(Obj, (int)(Player.AttackDelay * 1000 * ClearWaitTimeMod), FarmDelay(Player.ChampionName == "Azir" ? -125 : 0));
                    if (predHp >= (Player.ChampionName == "Azir" ? GetAzirAASandwarriorDamage(Obj) + Player.GetAutoAttackDamage(Obj) : Player.GetAutoAttackDamage(Obj, true) * 2) || Math.Abs(predHp - Obj.Health) < float.Epsilon)
                    {
                        if (Obj.Health >= maxHp || Math.Abs(maxHp - float.MaxValue) < float.Epsilon)
                        {
                            Target = Obj;
                            maxHp  = Obj.Health;
                        }
                    }
                }
                if (Target != null)
                {
                    return(Target);
                }
            }
            return(null);
        }
示例#23
0
                public Obj_AI_Base GetTarget()
                {
                    Obj_AI_Base result = null;

                    float[] r = { float.MaxValue };
                    if ((ActiveMode == OrbwalkingMode.Mixed || ActiveMode == OrbwalkingMode.LaneClear) && !_config.Item("PriorizeFarm").GetValue <bool>())
                    {
                        var target = SimpleTs.GetTarget(-1, SimpleTs.DamageType.Physical) ?? GetSoldierTargetHero();
                        if (target != null)
                        {
                            return(target);
                        }
                    }

                    if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed ||
                        ActiveMode == OrbwalkingMode.LastHit)
                    {
                        foreach (var minion in
                                 ObjectManager.Get <Obj_AI_Minion>()
                                 .Where(minion => minion.IsValidTarget() && (InAutoAttackRange(minion) || InSoldierAttackRange(minion))))
                        {
                            var t = (int)(_player.AttackCastDelay * 1000) - 100 + Game.Ping / 2 +
                                    1000 * (int)_player.Distance(minion) / (int)GetMyProjectileSpeed();
                            var predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay);
                            if (minion.Team != GameObjectTeam.Neutral && predHealth > 0 &&
                                predHealth <=
                                DamageLib.CalcPhysicalMinionDmg(
                                    _player.BaseAttackDamage + _player.FlatPhysicalDamageMod, minion, true) - 1 +
                                Math.Max(0, GetAutoAttackPassiveDamage(minion) - 10))
                            {
                                return(minion);
                            }
                        }
                    }
                    //Forced target
                    if (_forcedTarget != null && _forcedTarget.IsValidTarget() &&
                        (InAutoAttackRange(_forcedTarget) || InSoldierAttackRange(_forcedTarget)))
                    {
                        return(_forcedTarget);
                    }
                    /*Champions*/
                    if (ActiveMode != OrbwalkingMode.LastHit)
                    {
                        var target = SimpleTs.GetTarget(-1, SimpleTs.DamageType.Physical) ?? GetSoldierTargetHero();
                        if (target != null)
                        {
                            return(target);
                        }
                    }
                    /*Jungle minions*/
                    if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed)
                    {
                        foreach (var mob in
                                 ObjectManager.Get <Obj_AI_Minion>()
                                 .Where(
                                     mob =>
                                     mob.IsValidTarget() && (InAutoAttackRange(mob) || InSoldierAttackRange(mob)) && mob.Team == GameObjectTeam.Neutral)
                                 .Where(mob => mob.MaxHealth >= r[0] || Math.Abs(r[0] - float.MaxValue) < float.Epsilon))
                        {
                            result = mob;
                            r[0]   = mob.MaxHealth;
                        }
                    }
                    if (result != null)
                    {
                        return(result);
                    }
                    /*Lane Clear minions*/
                    r[0] = float.MaxValue;
                    if (ActiveMode == OrbwalkingMode.LaneClear)
                    {
                        if (!ShouldWait())
                        {
                            if (_prevMinion != null && _prevMinion.IsValidTarget() && (InAutoAttackRange(_prevMinion) || InSoldierAttackRange(_prevMinion)))
                            {
                                var predHealth = HealthPrediction.LaneClearHealthPrediction(
                                    _prevMinion, (int)((_player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay);
                                if (predHealth >=
                                    2 *
                                    DamageLib.CalcPhysicalMinionDmg(
                                        _player.BaseAttackDamage + _player.FlatPhysicalDamageMod, _prevMinion, true) - 1 +
                                    Math.Max(0, GetAutoAttackPassiveDamage(_prevMinion) - 10) ||
                                    Math.Abs(predHealth - _prevMinion.Health) < float.Epsilon)
                                {
                                    return(_prevMinion);
                                }
                            }
                            foreach (var minion in from minion in ObjectManager.Get <Obj_AI_Minion>()
                                     .Where(minion => minion.IsValidTarget() && (InAutoAttackRange(minion) || InSoldierAttackRange(minion)))
                                     let predHealth = HealthPrediction.LaneClearHealthPrediction(
                                         minion, (int)((_player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay)
                                                      where predHealth >=
                                                      2 *
                                                      DamageLib.CalcPhysicalMinionDmg(
                                         _player.BaseAttackDamage + _player.FlatPhysicalDamageMod, minion, true) - 1 +
                                                      Math.Max(0, GetAutoAttackPassiveDamage(minion) - 10) ||
                                                      Math.Abs(predHealth - minion.Health) < float.Epsilon
                                                      where minion.Health >= r[0] || Math.Abs(r[0] - float.MaxValue) < float.Epsilon
                                                      select minion)
                            {
                                result      = minion;
                                r[0]        = minion.Health;
                                _prevMinion = minion;
                            }
                        }
                    }
                    /*turrets*/
                    if (ActiveMode != OrbwalkingMode.LaneClear)
                    {
                        return(result);
                    }
                    foreach (var turret in
                             ObjectManager.Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                    {
                        return(turret);
                    }
                    return(result);
                }
示例#24
0
 private static bool ShouldWait()
 {
     return(ObjectManager.Get <Obj_AI_Minion>().Any(i => i.IsValidTarget() && i.Team != GameObjectTeam.Neutral && Player.ChampionName == "Azir" ? InSoldierAttackRange(i) : InAutoAttackRange(i) && HealthPrediction.LaneClearHealthPrediction(i, (int)(Player.AttackDelay * 1000 * ClearWaitTimeMod), FarmDelay()) <= Player.GetAutoAttackDamage(i)));
 }
示例#25
0
文件: OrbWalker.cs 项目: xioa123/CN
        public static AttackableUnit GetPossibleTarget()
        {
            if (ForcedTarget != null)
            {
                if (InAutoAttackRange(ForcedTarget))
                {
                    return(ForcedTarget);
                }
                ForcedTarget = null;
            }


            AttackableUnit tempTarget = null;

            if (Menu.Item("orb_Misc_Priority_Unit").GetValue <StringList>().SelectedIndex == 1 &&
                (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear))
            {
                tempTarget = GetBestHeroTarget();
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            //last hit
            if (CurrentMode == Mode.Harass || CurrentMode == Mode.Lasthit || CurrentMode == Mode.LaneClear || CurrentMode == Mode.LaneFreeze)
            {
                if (MyHero.ChampionName == "Azir" && Soilders.Count > 0)
                {
                    var minions = MinionManager.GetMinions(ObjectManager.Player.ServerPosition, 800, MinionTypes.All, MinionTeam.NotAlly);
                    foreach (var minion in from minion in minions.Where(minion => minion.IsValidTarget() && minion.Name != "Beacon" && InSoldierAttackRange(minion))
                             let t = (int)(MyHero.AttackCastDelay * 1000) - 100 + Game.Ping / 2 + 1000 * (int)MyHero.Distance(minion) / (int)MyProjectileSpeed()
                                     let predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay())
                                                      where minion.Team != GameObjectTeam.Neutral && predHealth > 0 &&
                                                      predHealth <= GetAzirAaSandwarriorDamage(minion)
                                                      select minion)
                    {
                        return(minion);
                    }
                }

                foreach (
                    var minion in
                    from minion in
                    ObjectManager.Get <Obj_AI_Minion>().Where(minion => minion.IsValidTarget() && minion.Name != "Beacon" && InAutoAttackRange(minion))
                    let t = (int)(MyHero.AttackCastDelay * 1000) - 100 + Game.Ping / 2 +
                            1000 * (int)MyHero.Distance(minion) / (int)MyProjectileSpeed()
                            let predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay())
                                             where minion.Team != GameObjectTeam.Neutral && predHealth > 0 &&
                                             predHealth <= MyHero.GetAutoAttackDamage(minion, true)
                                             select minion)
                {
                    return(minion);
                }
            }

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

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

            //jungle
            float[] maxhealth;
            if (CurrentMode == Mode.LaneClear || CurrentMode == Mode.Harass || CurrentMode == Mode.LaneFreeze)
            {
                if (MyHero.ChampionName == "Azir" && Soilders.Count > 0)
                {
                    maxhealth = new float[] { 0 };
                    var maxhealth1 = maxhealth;
                    var minions    = MinionManager.GetMinions(ObjectManager.Player.ServerPosition, 800, MinionTypes.All, MinionTeam.Neutral);
                    foreach (
                        var minion in
                        minions
                        .Where(minion => InSoldierAttackRange(minion) && minion.Name != "Beacon" && minion.IsValidTarget())
                        .Where(minion => minion.MaxHealth >= maxhealth1[0] || Math.Abs(maxhealth1[0] - float.MaxValue) < float.Epsilon))
                    {
                        tempTarget   = minion;
                        maxhealth[0] = minion.MaxHealth;
                    }
                    if (tempTarget != null)
                    {
                        return(tempTarget);
                    }
                }

                maxhealth = new float[] { 0 };
                var maxhealth2 = maxhealth;
                foreach (var minion in ObjectManager.Get <Obj_AI_Minion>().Where(minion => minion.IsValidTarget(GetAutoAttackRange(MyHero, minion)) && minion.Name != "Beacon" && minion.Team == GameObjectTeam.Neutral).Where(minion => minion.MaxHealth >= maxhealth2[0] || Math.Abs(maxhealth2[0] - float.MaxValue) < float.Epsilon))
                {
                    tempTarget   = minion;
                    maxhealth[0] = minion.MaxHealth;
                }
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            //LANE CLEAR
            if (CurrentMode != Mode.LaneClear || ShouldWait())
            {
                //ResetAutoAttackTimer();
                return(null);
            }

            if (MyHero.ChampionName == "Azir" && Soilders.Count > 0)
            {
                maxhealth = new float[] { 0 };
                float[] maxhealth1 = maxhealth;
                var     minions    = MinionManager.GetMinions(ObjectManager.Player.ServerPosition, 800, MinionTypes.All, MinionTeam.NotAlly);
                foreach (var minion in from minion in minions
                         .Where(minion => minion.IsValidTarget() && minion.Name != "Beacon" && InSoldierAttackRange(minion))
                         let predHealth = HealthPrediction.LaneClearHealthPrediction(minion, (int)((MyHero.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay())
                                          where predHealth >=
                                          GetAzirAaSandwarriorDamage(minion) + MyHero.GetAutoAttackDamage(minion, true) ||
                                          Math.Abs(predHealth - minion.Health) < float.Epsilon
                                          where minion.Health >= maxhealth1[0] || Math.Abs(maxhealth1[0] - float.MaxValue) < float.Epsilon
                                          select minion)
                {
                    tempTarget   = minion;
                    maxhealth[0] = minion.MaxHealth;
                }
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }
            else
            {
                maxhealth = new float[] { 0 };
                foreach (var minion in from minion in ObjectManager.Get <Obj_AI_Minion>()
                         .Where(minion => minion.IsValidTarget(GetAutoAttackRange(MyHero, minion)) && minion.Name != "Beacon")
                         let predHealth = HealthPrediction.LaneClearHealthPrediction(minion, (int)((MyHero.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay())
                                          where predHealth >=
                                          2 * MyHero.GetAutoAttackDamage(minion, true) ||
                                          Math.Abs(predHealth - minion.Health) < float.Epsilon
                                          where minion.Health >= maxhealth[0] || Math.Abs(maxhealth[0] - float.MaxValue) < float.Epsilon
                                          select minion)
                {
                    tempTarget   = minion;
                    maxhealth[0] = minion.MaxHealth;
                }
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            return(null);
        }
示例#26
0
        private void Cast_Q()
        {
            if (!Q.IsReady())
            {
                return;
            }

            if (xSLxOrbwalker.CurrentMode == xSLxOrbwalker.Mode.Combo || xSLxOrbwalker.CurrentMode == xSLxOrbwalker.Mode.Harass)
            {
                if (!Q.IsReady() || (!ManaManagerAllowCast() && xSLxOrbwalker.CurrentMode == xSLxOrbwalker.Mode.Combo))
                {
                    return;
                }
                var target = SimpleTs.GetTarget(Q.Range, SimpleTs.DamageType.Magical);
                if (target != null)
                {
                    Q.CastOnUnit(target, UsePackets());
                    return;
                }
            }
            if (xSLxOrbwalker.CurrentMode == xSLxOrbwalker.Mode.Harass && Menu.Item("Q_Lasthit_Harass").GetValue <bool>())
            {
                if (GetPassiveStacks() == 4 && !Menu.Item("Q_Lasthit_Harass_stun").GetValue <bool>())
                {
                    return;
                }
                var allMinions =
                    MinionManager.GetMinions(MyHero.ServerPosition, Q.Range, MinionTypes.All, MinionTeam.NotAlly).ToList();
                var minionLastHit =
                    allMinions.Where(
                        x =>
                        HealthPrediction.LaneClearHealthPrediction(x, (int)Q.Delay) < MyHero.GetSpellDamage(x, SpellSlot.Q) * 0.8)
                    .OrderBy(x => x.Health);

                if (!minionLastHit.Any())
                {
                    return;
                }
                var unit = minionLastHit.First();
                Q.CastOnUnit(unit, UsePackets());
            }

            if (xSLxOrbwalker.CurrentMode == xSLxOrbwalker.Mode.Lasthit && Menu.Item("Q_Lasthit_Lasthit").GetValue <bool>())
            {
                if (GetPassiveStacks() == 4 && !Menu.Item("Q_Lasthit_Lasthit_stun").GetValue <bool>())
                {
                    return;
                }
                var allMinions =
                    MinionManager.GetMinions(MyHero.ServerPosition, Q.Range, MinionTypes.All, MinionTeam.NotAlly).ToList();
                var minionLastHit = allMinions.Where(x => HealthPrediction.LaneClearHealthPrediction(x, (int)Q.Delay) < MyHero.GetSpellDamage(x, SpellSlot.Q) * 0.8).OrderBy(x => x.Health);


                if (!minionLastHit.Any())
                {
                    return;
                }
                var unit = minionLastHit.First();
                Q.CastOnUnit(unit, UsePackets());
            }

            if (xSLxOrbwalker.CurrentMode == xSLxOrbwalker.Mode.LaneClear)
            {
                var allMinions    = MinionManager.GetMinions(MyHero.ServerPosition, Q.Range, MinionTypes.All, MinionTeam.NotAlly).ToList();
                var minionLastHit =
                    allMinions.Where(
                        x =>
                        HealthPrediction.LaneClearHealthPrediction(x, (int)Q.Delay) < MyHero.GetSpellDamage(x, SpellSlot.Q) * 0.8)
                    .OrderBy(x => x.Health);

                if (!minionLastHit.Any())
                {
                    return;
                }
                var unit = minionLastHit.First();
                Q.CastOnUnit(unit, UsePackets());
            }
        }
示例#27
0
 private void OnOrbwalkingBeforeAttack(Orbwalking.BeforeAttackEventArgs args)
 {
     try
     {
         if (HasQBuff())
         {
             if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo)
             {
                 if ((_rObject == null || !_rObject.IsValid) && R.IsReady() && UltimateManager.Combo() &&
                     R.Instance.Name.Equals("ViktorChaosStorm", StringComparison.OrdinalIgnoreCase) &&
                     GameObjects.EnemyHeroes.Any(Orbwalking.InAutoAttackRange) &&
                     (RLogicDuel(true, Menu.Item(Menu.Name + ".combo.e").GetValue <bool>() && E.IsReady(), true) ||
                      GameObjects.EnemyHeroes.Where(e => e.IsValidTarget(R.Range + R.Width))
                      .Any(
                          e =>
                          RLogic(
                              e, Menu.Item(Menu.Name + ".ultimate.combo.min").GetValue <Slider>().Value,
                              Menu.Item(Menu.Name + ".combo.q").GetValue <bool>() && Q.IsReady(),
                              Menu.Item(Menu.Name + ".combo.e").GetValue <bool>() && E.IsReady(), true))))
                 {
                     args.Process = false;
                     return;
                 }
             }
             if (!(args.Target is Obj_AI_Hero))
             {
                 var targets = TargetSelector.GetTargets(Player.AttackRange + Player.BoundingRadius * 3f);
                 if (targets != null && targets.Any())
                 {
                     var hero = targets.FirstOrDefault(Orbwalking.InAutoAttackRange);
                     if (hero != null)
                     {
                         Orbwalker.ForceTarget(hero);
                         args.Process = false;
                     }
                     else if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Mixed)
                     {
                         if (
                             targets.Any(
                                 t =>
                                 t.Distance(Player) <
                                 (Player.BoundingRadius + t.BoundingRadius + Player.AttackRange) *
                                 (IsSpellUpgraded(Q) ? 1.4f : 1.2f)))
                         {
                             args.Process = false;
                         }
                     }
                 }
             }
         }
         else
         {
             if ((args.Target is Obj_AI_Hero) &&
                 (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo ||
                  Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Mixed) &&
                 (Q.IsReady() && Player.Mana >= Q.Instance.ManaCost ||
                  E.IsReady() && Player.Mana >= E.Instance.ManaCost))
             {
                 args.Process = false;
             }
         }
         if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LastHit ||
             Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear)
         {
             var minion = args.Target as Obj_AI_Minion;
             if (minion != null &&
                 HealthPrediction.LaneClearHealthPrediction(
                     minion, (int)(Player.AttackDelay * 1000), Game.Ping / 2) <
                 Player.GetAutoAttackDamage(minion))
             {
                 _lastBeforeFarmTarget = minion;
             }
             if (_lastQKillableTarget != null && _lastQKillableTarget.NetworkId == args.Target.NetworkId)
             {
                 args.Process = false;
             }
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
 private void Cast_Q(bool mode)
 {
     if (!Q.IsReady() || !_canUseSpells)
     {
         return;
     }
     if (mode)
     {
         var target = SimpleTs.GetTarget(Q.Range, SimpleTs.DamageType.Physical);
         if (target != null)
         {
             if ((target.IsValidTarget(Q.Range)))
             {
                 Q.Cast(target, UsePackets());
                 UsedSkill();
                 return;
             }
         }
         target = SimpleTs.GetTarget(Q2.Range, SimpleTs.DamageType.Physical);
         if (target == null)
         {
             return;
         }
         if ((!target.IsValidTarget(Q2.Range)) || !_canUseSpells || !Q.IsReady())
         {
             return;
         }
         var qCollision = Q2.GetPrediction(target).CollisionObjects;
         foreach (var qCollisionChar in qCollision.Where(qCollisionChar => qCollisionChar.IsValidTarget(Q.Range)))
         {
             Q.Cast(qCollisionChar, UsePackets());
             UsedSkill();
         }
     }
     else
     {
         var allMinions = MinionManager.GetMinions(ObjectManager.Player.Position, Q.Range, MinionTypes.All, MinionTeam.NotAlly);
         var minion     = allMinions.FirstOrDefault(minionn => minionn.Distance(MyHero) <= Q.Range && HealthPrediction.LaneClearHealthPrediction(minionn, 500) > 0);
         if (minion == null)
         {
             return;
         }
         _passivTimer = Environment.TickCount;
         Q.CastOnUnit(minion, UsePackets());
     }
 }
示例#29
0
        private static AttackableUnit GetPossibleTarget()
        {
            AttackableUnit Target = null;

            if (Config.Item("OW_Misc_PriorityUnit").GetValue <StringList>().SelectedIndex == 1 && (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear))
            {
                Target = GetBestHeroTarget();
                if (Target.IsValidTarget())
                {
                    return(Target);
                }
            }
            if (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear || CurrentMode == Mode.LastHit)
            {
                foreach (var Obj in ObjectManager.Get <Obj_AI_Minion>().Where(i => InAutoAttackRange(i) && i.Team != GameObjectTeam.Neutral && MinionManager.IsMinion(i, true)))
                {
                    var Time   = (int)(Player.AttackCastDelay * 1000 - 100 + Game.Ping / 2 + 1000 * Player.Distance((AttackableUnit)Obj) / (Player.IsMelee() ? float.MaxValue : Player.BasicAttack.MissileSpeed));
                    var HpPred = HealthPrediction.GetHealthPrediction(Obj, Time, GetCurrentFarmDelay);
                    if (HpPred <= 0)
                    {
                        FireOnNonKillableMinion(Obj);
                    }
                    if (HpPred > 0 && HpPred <= (Player.ChampionName == "Azir" ? GetAzirWDamage(Obj) : Player.GetAutoAttackDamage(Obj, true)))
                    {
                        return(Obj);
                    }
                }
            }
            if (InAutoAttackRange(ForcedTarget))
            {
                return(ForcedTarget);
            }
            if (CurrentMode == Mode.LaneClear)
            {
                foreach (var Obj in ObjectManager.Get <Obj_AI_Turret>().Where(i => InAutoAttackRange(i)))
                {
                    return(Obj);
                }
                foreach (var Obj in ObjectManager.Get <Obj_BarracksDampener>().Where(i => InAutoAttackRange(i)))
                {
                    return(Obj);
                }
                foreach (var Obj in ObjectManager.Get <Obj_HQ>().Where(i => InAutoAttackRange(i)))
                {
                    return(Obj);
                }
            }
            if (CurrentMode != Mode.LastHit)
            {
                Target = GetBestHeroTarget();
                if (Target.IsValidTarget())
                {
                    return(Target);
                }
            }
            if (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear)
            {
                Target = ObjectManager.Get <Obj_AI_Minion>().Where(i => InAutoAttackRange(i) && i.Team == GameObjectTeam.Neutral).MaxOrDefault(i => i.MaxHealth);
                if (Target != null)
                {
                    return(Target);
                }
            }
            if (CurrentMode == Mode.LaneClear && !ShouldWait())
            {
                if (InAutoAttackRange(PrevMinion))
                {
                    var HpPred = HealthPrediction.LaneClearHealthPrediction(PrevMinion, (int)(Player.AttackDelay * 1000 * ClearWaitTime), GetCurrentFarmDelay);
                    if (HpPred >= 2 * (Player.ChampionName == "Azir" ? GetAzirWDamage(PrevMinion) : Player.GetAutoAttackDamage(PrevMinion, true)) || Math.Abs(HpPred - PrevMinion.Health) < float.Epsilon)
                    {
                        return(PrevMinion);
                    }
                }
                Target = (from Obj in ObjectManager.Get <Obj_AI_Minion>().Where(i => InAutoAttackRange(i))
                          let HpPred = HealthPrediction.LaneClearHealthPrediction(Obj, (int)(Player.AttackDelay * 1000 * ClearWaitTime), GetCurrentFarmDelay)
                                       where HpPred >= 2 * (Player.ChampionName == "Azir" ? GetAzirWDamage(Obj) : Player.GetAutoAttackDamage(Obj, true)) || Math.Abs(HpPred - Obj.Health) < float.Epsilon
                                       select Obj).MaxOrDefault(i => i.Health);
                if (Target != null)
                {
                    PrevMinion = (Obj_AI_Minion)Target;
                }
            }
            return(Target);
        }
示例#30
0
        public static AttackableUnit GetPossibleTarget(bool onlyChamps = false)
        {
            if (ForcedTarget != null)
            {
                if (InAutoAttackRange(ForcedTarget))
                {
                    return(ForcedTarget);
                }
                ForcedTarget = null;
            }
            var camp = GetBestHeroTarget();

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

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


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

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

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

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

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

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

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

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

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

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