Пример #1
0
        public bool DoTurn(PirateShip ship)
        {
            // Check if halt is needed
            Asteroid[] AsteroidsInRange = Bot.Engine.AllLivingAsteroids.Where(x => Bot.Engine.GetHits(x) == 0 && Filter(x) && x.Distance(ship) - x.Size < (ship.MaxSpeed + x.EffectiveSpeed()) * DangerRange).ToArray();
            if (ship.PushReloadTurns > 0 || AsteroidsInRange.IsEmpty())
            {
                return(false);
            }
            Asteroid NearestAsteroid = AsteroidsInRange.Nearest(ship);

            if (ship.CanPush(NearestAsteroid))
            {
                return(ship.Push(NearestAsteroid, PushLocator(NearestAsteroid, ship)));
            }
            else if (!NearestAsteroid.IsHalted())
            {
                int EffectiveDistance = NearestAsteroid.Distance(ship) - NearestAsteroid.Size;
                if (EffectiveDistance < HaltingRange * (ship.MaxSpeed + NearestAsteroid.EffectiveSpeed()))
                {
                    if (EffectiveDistance < HaltingRange * NearestAsteroid.EffectiveSpeed())
                    {
                        return(ship.Sail(NearestAsteroid.Add(NearestAsteroid.Direction.Normalized().Multiply(NearestAsteroid.EffectiveSpeed() + ship.PushRange))));
                    }
                    else
                    {
                        return(true);
                    }
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
 public bool DoTurn(PirateShip ship)
 {
     foreach (PirateShip p in ship.GetPiratesInPushRange().Where(x => Filter(x)))
     {
         Mothership closestMothership = Bot.Engine.EnemyMotherships.FirstBy(x => x.Distance(p));
         bool       CanKill           = ((Location)(((Point)p).InDirection(closestMothership, ship.MaxSpeed))).DistanceFromBorder() <= ship.PushDistance;
         if (ship.CanPush(p) && CanKill)
         {
             if (ship.Push(p, p.ClosestBorder()))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
 public bool DoTurn(PirateShip ship)
 {
     if (Bot.Engine.Enemy.BotName == "25772")
     {
         if (Bot.Engine.MyCapsules[0].IsAlive() && Bot.Engine.MyCapsules[0].IsHeld() && ship.InPushRange(Bot.Engine.MyLivingCapsules[0]) && ship.IsHeavy)
         {
             ship.Push(Bot.Engine.MyLivingCapsules[0].Holder, Bot.Engine.MyMotherships[0]);
         }
         else if (ship.IsNormal)
         {
             ship.Sail(Bot.Engine.MyMotherships[0]);
         }
         return(true);
     }
     else if (Bot.Engine.Enemy.BotName == "25766")
     {
         PirateShip p       = ship;
         Capsule    capsule = Bot.Engine.MyCapsules[0];
         if (p.Id == 0)
         {
             PirateShip other = Bot.Engine.GetMyPirateById(1);
             Location   dest  = Bot.Engine.Self.Score >= 3 ? new Location(3797, 4358) : new Location(2534, 3936);
             if (!p.Sail(dest) && p.InPushRange(other))
             {
                 p.Push(other, capsule);
             }
         }
         else
         {
             PirateShip other  = Bot.Engine.GetMyPirateById(0);
             bool       IsHeld = capsule.IsAlive() && capsule.IsHeld();
             if (p.IsNormal)
             {
                 if (IsHeld)
                 {
                     ((Pirate)p).SwapStates(other);
                 }
                 else
                 {
                     p.Sail(capsule);
                 }
             }
             else
             {
                 if (IsHeld)
                 {
                     p.Sail(Bot.Engine.MyMotherships[0]);
                 }
                 else
                 {
                     ((Pirate)p).SwapStates(other);
                 }
             }
         }
         return(true);
     }
     else if (Bot.Engine.Enemy.BotName == "26069")
     {
         int id = ship.Id;
         if (id == 0 || id == 2)
         {
             bool     Sailed = ship.Sail(id == 0 ? new Location(3646, 2200) : new Location(3646, 4000));
             Location target = id == 0 ? new Location(4700, 1200) : new Location(4700, 5200);
             if (!Sailed && Bot.Engine.GetEnemyPiratesInRange(target, 500).Count >= 2)
             {
                 Asteroid a = Bot.Engine.AllAsteroids[id / 2];
                 ship.Push(a, target.Add(new Location(225, 0)));
             }
         }
         else
         {
             Squad s = Bot.Engine.GetEnemyPiratesInRange(ship, Bot.Engine.Game.StickBombRange);
             if (s.Count > 0)
             {
                 ((Pirate)ship).StickBomb(s.First());
             }
         }
         return(true);
     }
     return(false);
 }