Exemplo n.º 1
0
        /// <summary>
        /// Creates a new PirateGameEx, initialized with a game turn state
        /// Initializes lists of game objects
        /// </summary>
        /// <param name="pirateGame">Current game turn state</param>
        public PirateGameEx(PirateGame pirateGame)
        {
            Game = pirateGame;

            // PirateEx lists
            MyPirates          = CreateExList(Game.GetAllMyPirates());
            MyLivingPirates    = CreateExList(Game.GetMyLivingPirates());
            EnemyPirates       = CreateExList(Game.GetAllEnemyPirates());
            EnemyLivingPirates = CreateExList(Game.GetEnemyLivingPirates());

            // IslandEx lists
            MyIslands      = CreateExList(Game.GetMyIslands());
            NeutralIslands = CreateExList(Game.GetNeutralIslands());
            EnemyIslands   = CreateExList(Game.GetEnemyIslands());

            // DroneEx lists
            MyLivingDrones    = CreateExList(Game.GetMyLivingDrones());
            EnemyLivingDrones = CreateExList(Game.GetEnemyLivingDrones());

            // CityEx lists
            MyCities    = CreateExList(Game.GetMyCities());
            EnemyCities = CreateExList(Game.GetEnemyCities());

            // AircraftEx lists
            MyLivingAircrafts    = CreateExList(Game.GetMyLivingAircrafts());
            EnemyLivingAircrafts = CreateExList(Game.GetEnemyLivingAircrafts());
            MyAircrafts          = ConvertList <PirateEx, AircraftEx>(MyPirates).Concat(ConvertList <DroneEx, AircraftEx>(MyLivingDrones)).ToList();
            EnemyAircrafts       = ConvertList <PirateEx, AircraftEx>(EnemyPirates).Concat(ConvertList <DroneEx, AircraftEx>(EnemyLivingDrones)).ToList();
        }
 private void PrintIDLogs()
 {
     foreach (var map in loggedIDLocations)
     {
         Print("Log for ID " + map.Key + " is @ " + map.Value);
         var enemyID = game.GetAllEnemyPirates().Where(pirate => pirate.UniqueId == map.Key).FirstOrDefault();
         if (enemyID == null)
         {
             Print("Enemy is null.");
         }
         else
         {
             Print("Current location for pirate: " + enemyID.Location);
         }
     }
 }
        override public int Cost(Chunk chunk)
        {
            PirateGame game    = Main.game;
            int        cost    = 0;
            var        pirates = game.GetAllEnemyPirates().ToList();

            if (pirateID != -1)
            {
                pirates.AddRange(game.GetAllMyPirates());
            }

            foreach (Pirate pirate in pirates.Where(e => chunk.Distance(e) < setRange + e.PushRange + e.MaxSpeed))
            {
                if (pirateID == -1 || pirate.UniqueId == pirateID)
                {
                    int range = setRange + pirate.PushRange + pirate.MaxSpeed;
                    cost += (range - chunk.Distance(pirate)) * multiplier;
                }
            }

            return(cost);
        }
Exemplo n.º 4
0
 public static List <Pirate> GetAllEnemyPiratesWithoutDecoy(this PirateGame game)
 {
     return(game.GetAllEnemyPirates().RemoveDecoyFromList());
 }