示例#1
0
        internal static void UseAutoSharpARAMPositioning()
        {
            var farthestAlly =
                Heroes.AllyHeroes.Where(a => !a.IsMe && !a.IsDead && a.HealthPercent > 10 && !a.InFountain()).OrderByDescending(h => h.Distance(HeadQuarters.AllyHQ)).FirstOrDefault();

            if (farthestAlly == null || farthestAlly.InFountain())
            {
                var minion =
                    Minions.AllyMinions.OrderByDescending(t => t.Distance(HeadQuarters.AllyHQ)).FirstOrDefault();
                if (minion != null)
                {
                    RandomlyChosenMove = minion.Position.RandomizePosition();
                }
                else
                {
                    var turret = Wizard.GetFarthestAllyTurret();
                    if (turret != null)
                    {
                        RandomlyChosenMove = turret.Position;
                    }
                }
                return;
            }

            if (Heroes.Player.IsMelee)
            {
                RandomlyChosenMove = farthestAlly.ServerPosition.Randomize(-150, 150);
            }

            ValidPossibleMoves.Add(farthestAlly.Position.RandomizePosition());
            //initialize the vectorlist with a position known to exist,
            //so it doesn't follow the mouse anymore

            var team = Heroes.AllyHeroes.Where(h => !h.IsMe && !h.IsDead && h.Distance(farthestAlly) < 500 && h.Position.CountEnemiesInRange(550) <= h.Position.CountAlliesInRange(550)).ToList();

            var teamPoly = team.Select(hero => new Geometry.Circle(hero.Position.To2D(), 200).ToPolygon()).ToList();

            foreach (var hp in teamPoly)
            {
                foreach (var point in hp.Points)
                {
                    var v3 = point.To3D();
                    if (!NavMesh.GetCollisionFlags(point).HasFlag(CollisionFlags.Wall) &&
                        Heroes.EnemyHeroes.Count(e => e.Distance(v3) < 300) <
                        Heroes.AllyHeroes.Count(e => e.Distance(v3) <= 300))
                    {
                        ValidPossibleMoves.Add(v3);
                    }
                }
            }
            if (Heroes.Player.CountEnemiesInRange(700) != 0)
            {
                var hero = Heroes.EnemyHeroes.OrderBy(h => h.Distance(Heroes.Player)).FirstOrDefault();
                if (hero != null)
                {
                    var PRADAPos = hero.GetPRADAPos();
                    RandomlyChosenMove = PRADAPos != Vector3.Zero
                        ? PRADAPos
                        : ValidPossibleMoves.OrderBy(v => v.Distance(HeadQuarters.AllyHQ.Position)).FirstOrDefault();
                    return;
                }
            }
            RandomlyChosenMove =
                ValidPossibleMoves.OrderBy(v => v.Distance(HeadQuarters.AllyHQ.Position)).FirstOrDefault();
        }