Ejemplo n.º 1
0
 public static List <Minion> GetNearestMinions(double range, bool friendly,
                                               GetObjectRangeMode rangeMode = GetObjectRangeMode.CenterToCenter)
 {
     return
         (Tick.World.Minions.Where(x => friendly ? x.Faction == Tick.Self.Faction : x.Faction != Tick.Self.Faction)
          .Where(x => GetDistance(x, range, rangeMode))
          .ToList());
 }
Ejemplo n.º 2
0
        public static List <Building> GetNearestBuidigs(double range, bool friendly,
                                                        GetObjectRangeMode rangeMode = GetObjectRangeMode.CenterToCenter, bool?canAttack = null)
        {
            if (friendly)
            {
                return
                    (Tick.World.Buildings.Where(
                         x => x.Faction == Tick.Self.Faction)
                     .Where(x => GetDistance(x, range, rangeMode))
                     .ToList());
            }
            else
            {
                var nonDeadTowers = EnemyBuildingsHelper.Buildings.Where(x => !x.IsDead);
                if (canAttack.HasValue)
                {
                    nonDeadTowers = nonDeadTowers.Where(x => x.CanBeDamaged == canAttack.Value);
                }

                return
                    (nonDeadTowers.Select(
                         x =>
                {
                    long id = -1;
                    var _x = x.Position.X;
                    var _y = x.Position.Y;
                    var speedX = 0;
                    var speedY = 0;
                    var angle = 0;
                    var faction = Tick.Self.Faction == Faction.Academy ? Faction.Renegades : Faction.Academy;
                    var remainingActionCooldownTicks = x.RemainingActionCooldownTicks;

                    return new Building(id, _x, _y, speedX, speedY, angle, faction, x.Radius, 0,
                                        0, new Status[0], BuildingType.GuardianTower, x.AttackRange, x.AttackRange, 0, 0,
                                        remainingActionCooldownTicks);
                })
                     .Where(x => GetDistance(x, range, rangeMode))
                     .ToList());
            }
        }
Ejemplo n.º 3
0
        private static bool GetDistance <TCircularUnit>(TCircularUnit unit, double range, GetObjectRangeMode rangeMode)
            where TCircularUnit : CircularUnit
        {
            if (rangeMode == GetObjectRangeMode.BorderToBorder)
            {
                return(Tick.Self.GetDistanceTo(unit) - unit.Radius - Tick.Self.Radius <= range);
            }
            else if (rangeMode == GetObjectRangeMode.CenterToTargetBorder)
            {
                return(Tick.Self.GetDistanceTo(unit) - unit.Radius <= range);
            }

            return(Tick.Self.GetDistanceTo(unit) <= range);
        }