Exemplo n.º 1
0
 private bool isFighterEngagedInBattle(TeamInformation ti, Fighter fi)
 {
     return ti.fighterBattleList.Keys.Contains(fi);
 }
Exemplo n.º 2
0
 private void replenishFightersAndDestroyers(Game game)
 {
     foreach (TeamInformation ti in infoOnTeams)
     {
         if (!ti.fullyAIControlled)
             continue;
         int numFightersToBuy = 0;
         int numDestroyersToBuy = 0;
         int numberOfFightersOnSpawnList = 0;
         int numberOfDestroyersOnSpawnList = 0;
         foreach (DynamicObject o in ti.spawnQueue)
             if (o is Fighter)
                 numberOfFightersOnSpawnList++;
             else if (o is Destroyer)
                 numberOfDestroyersOnSpawnList++;
         if (ti.maxFighters > ti.teamFighters.Count)
         {
             if (ti.maxDestroyers <= ti.teamDestroyers.Count)
                 numFightersToBuy = (int)Math.Min(ti.teamCredits / TradingInformation.fighterCost, ti.maxFighters - ti.teamFighters.Count - numberOfFightersOnSpawnList);
             else
             {
                 numFightersToBuy = (int)Math.Min((int)(ti.teamCredits * PERCENT_OF_CREDITS_TO_SPEND_ON_FIGHTERS_WHEN_SHORT_ON_BOTH /
                     TradingInformation.fighterCost), ti.maxFighters - ti.teamFighters.Count - numberOfFightersOnSpawnList);
                 numDestroyersToBuy = (int)Math.Min((int)(ti.teamCredits * PERCENT_OF_CREDITS_TO_SPEND_ON_DESTROYERS_WHEN_SHORT_ON_BOTH /
                     TradingInformation.destroyerCost), ti.maxDestroyers - ti.teamDestroyers.Count - numberOfDestroyersOnSpawnList);
             }
         }
         else if (ti.maxDestroyers > ti.teamDestroyers.Count)
             numDestroyersToBuy = (int)Math.Min(ti.teamCredits / TradingInformation.destroyerCost,
                 ti.maxDestroyers - ti.teamDestroyers.Count - numberOfDestroyersOnSpawnList);
         for (int i = 0; i < numDestroyersToBuy; ++i)
         {
             Destroyer d = new Destroyer(game, ti.teamId, Vector3.Zero);
             d.Initialize();
             d.LoadContent();
             ti.spawnQueue.Add(d);
             ti.teamCredits -= TradingInformation.destroyerCost;
         }
         for (int i = 0; i < numFightersToBuy; ++i)
         {
             Fighter f = new Fighter(game, ti.teamId, Vector3.Zero);
             f.Initialize();
             f.LoadContent();
             ti.spawnQueue.Add(f);
             ti.teamCredits -= TradingInformation.fighterCost;
         }
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Adds a new fighter to the spawn queue (call this when a asset aquisition is made)
 /// </summary>
 /// <param name="fi">Instance of instantiated, registered fighter</param>
 public void addNewFighterToTeam(Fighter fi)
 {
     this.spawnQueue.Add(fi);
 }