コード例 #1
0
ファイル: QProvider.cs プロジェクト: eWzrd/EloBuddy
        public static bool IsNotIntoEnemies2(this Vector2 position)
        {
            var enemyPoints = DashHelper.GetEnemyPoints();

            if (enemyPoints.ToList().Contains(position) &&
                !enemyPoints.Contains(Variables._Player.ServerPosition.To2D()))
            {
                return(false);
            }

            var closeEnemies =
                EntityManager.Heroes.Enemies.FindAll(
                    en =>
                    en.IsValidTarget(1500f) &&
                    !(en.Distance(Variables._Player.ServerPosition) < en.AttackRange + 65f));

            if (!closeEnemies.All(enemy => position.CountEnemiesInRange(enemy.AttackRange) <= 1))
            {
                return(false);
            }

            return(true);
        }
コード例 #2
0
ファイル: QProvider.cs プロジェクト: eWzrd/EloBuddy
        /// <summary>
        /// Gets the Lucian E Position position using a patented logic!
        /// </summary>
        /// <returns></returns>
        public Vector3 GetQPosition()
        {
            #region The Required Variables

            var positions             = DashHelper.GetRotatedQPositions();
            var enemyPositions        = DashHelper.GetEnemyPoints();
            var safePositions         = positions.Where(pos => !enemyPositions.Contains(pos.To2D())).ToList();
            var BestPosition          = Variables._Player.ServerPosition.Extend(Game.CursorPos, 300f);
            var AverageDistanceWeight = .60f;
            var ClosestDistanceWeight = .40f;

            var bestWeightedAvg = 0f;

            var highHealthEnemiesNear =
                EntityManager.Heroes.Enemies.Where(m => !m.IsMelee && m.IsValidTarget(1300f) && m.HealthPercent > 7).ToList()
            ;

            var alliesNear = EntityManager.Heroes.Allies.Count(ally => !ally.IsMe && ally.IsValidTarget(1500f, false));

            var enemiesNear =
                EntityManager.Heroes.Enemies.Where(
                    m => m.IsValidTarget(Variables._Player.GetAutoAttackRange(m) + 300f + 65f)).ToList();

            #endregion

            #region 1 Enemy around only Defensive

            if (Variables._Player.CountEnemiesInRange(1500f) <= 1 && MenuManager.ComboMenu["Qmode2"].Cast <ComboBox>().CurrentValue == 1)
            {
                //Logic for 1 enemy near
                var backwardsPosition =
                    (Variables._Player.ServerPosition.To2D() + 300f * Variables._Player.Direction.To2D()).To3D();

                if (!other.UnderEnemyTower((Vector2)backwardsPosition))
                {
                    return(backwardsPosition);
                }
            }

            #endregion

            if (
                enemiesNear.Any(
                    t =>
                    t.Health + 15 <
                    ObjectManager.Player.GetAutoAttackDamage(t) * 2 + Variables._Player.GetSpellDamage(t, SpellSlot.Q) &&
                    t.Distance(ObjectManager.Player) < Variables._Player.GetAutoAttackRange(t) + 80f))
            {
                var QPosition =
                    ObjectManager.Player.ServerPosition.Extend(
                        enemiesNear.OrderBy(t => t.Health).First().ServerPosition, 300f);

                if (!other.UnderEnemyTower(QPosition))
                {
                    return((Vector3)QPosition);
                }
            }

            #region 1 Enemy around only Aggressive

            if (Variables._Player.CountEnemiesInRange(1500f) <= 1 && MenuManager.ComboMenu["Qmode2"].Cast <ComboBox>().CurrentValue == 0)
            {
                //Logic for 1 enemy near
                var position = (Vector3)Variables._Player.ServerPosition.Extend(Game.CursorPos, 300f);
                return(position.To2D().IsSafeEx() ? position : Vector3.Zero);
            }

            #endregion

            #region Alone, 2 Enemies, 1 Killable

            if (enemiesNear.Count() <= 2)
            {
                if (
                    enemiesNear.Any(
                        t =>
                        t.Health + 15 <
                        Variables._Player.GetAutoAttackDamage(t) +
                        Variables._Player.GetSpellDamage(t, SpellSlot.Q) &&
                        t.Distance(Variables._Player) < Variables._Player.GetAutoAttackRange(t) + 80f))
                {
                    var QPosition =
                        Variables._Player.ServerPosition.Extend(
                            highHealthEnemiesNear.OrderBy(t => t.Health).FirstOrDefault().ServerPosition, 300f);

                    if (!other.UnderEnemyTower(QPosition))
                    {
                        return((Vector3)QPosition);
                    }
                }
            }

            #endregion

            #region Alone, 2 Enemies, None Killable

            if (alliesNear == 0 && highHealthEnemiesNear.Count() <= 2)
            {
                //Logic for 2 enemies Near and alone

                //If there is a killable enemy among those.
                var backwardsPosition =
                    (Variables._Player.ServerPosition.To2D() + 300f * Variables._Player.Direction.To2D()).To3D();

                if (!other.UnderEnemyTower((Vector2)backwardsPosition))
                {
                    // return backwardsPosition;
                }
            }

            #endregion

            #region Already in an enemy's attack range.

            var closeNonMeleeEnemy =
                DashHelper.GetClosestEnemy((Vector3)Variables._Player.ServerPosition.Extend(Game.CursorPos, 300f));

            if (closeNonMeleeEnemy != null &&
                Variables._Player.Distance(closeNonMeleeEnemy) <= closeNonMeleeEnemy.AttackRange - 85 &&
                !closeNonMeleeEnemy.IsMelee)
            {
                return(Variables._Player.ServerPosition.Extend(Game.CursorPos, 300f).IsSafeEx()
                    ? Variables._Player.ServerPosition.Extend(Game.CursorPos, 300f).To3D()
                    : Vector3.Zero);
            }

            #endregion

            #region Logic for multiple enemies / allies around.

            foreach (var position in safePositions)
            {
                var enemy = DashHelper.GetClosestEnemy(position);
                if (!enemy.IsValidTarget())
                {
                    continue;
                }

                var avgDist = DashHelper.GetAvgDistance(position);

                if (avgDist > -1)
                {
                    var closestDist = Variables._Player.ServerPosition.Distance(enemy.ServerPosition);
                    var weightedAvg = closestDist * ClosestDistanceWeight + avgDist * AverageDistanceWeight;
                    if (weightedAvg > bestWeightedAvg && position.To2D().IsSafeEx())
                    {
                        bestWeightedAvg = weightedAvg;
                        BestPosition    = position.To2D();
                    }
                }
            }

            #endregion

            var endPosition = (BestPosition.To3D().IsSafe()) ? BestPosition.To3D() : Vector3.Zero;

            #region Couldn't find a suitable position, tumble to nearest ally logic

            if (endPosition == Vector3.Zero)
            {
                //Try to find another suitable position. This usually means we are already near too much enemies turrets so just gtfo and tumble
                //to the closest ally ordered by most health.
                var alliesClose =
                    EntityManager.Heroes.Allies.Where(ally => !ally.IsMe && ally.IsValidTarget(1500, false)).ToList();
                if (alliesClose.Any() && enemiesNear.Any())
                {
                    var closestMostHealth =
                        alliesClose.OrderBy(m => m.Distance(Variables._Player))
                        .ThenByDescending(m => m.Health)
                        .FirstOrDefault();

                    if (closestMostHealth != null
                        &&
                        closestMostHealth.Distance(
                            enemiesNear.OrderBy(m => m.Distance(Variables._Player)).FirstOrDefault())
                        >
                        Variables._Player.Distance(
                            enemiesNear.OrderBy(m => m.Distance(Variables._Player)).FirstOrDefault()))
                    {
                        var tempPosition = Variables._Player.ServerPosition.Extend(closestMostHealth.ServerPosition,
                                                                                   300f);
                        if (tempPosition.IsSafeEx())
                        {
                            endPosition = tempPosition.To3D();
                        }
                    }
                }
            }

            #endregion

            #region Couldn't even tumble to ally, just go to mouse

            if (endPosition == Vector3.Zero)
            {
                var mousePosition = Variables._Player.ServerPosition.Extend(Game.CursorPos, 300f);
                if (mousePosition.To3D().IsSafe())
                {
                    endPosition = mousePosition.To3D();
                }
            }

            #endregion

            return(endPosition);
        }