コード例 #1
0
ファイル: Program.cs プロジェクト: UncleGus/dracula
 /// <summary>
 /// Handles cards dropped off the end of Dracula's Trails
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="cardsDroppedOffTrail">A List of cards that have dropped off the end of the Trail</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void DealWithDroppedOffCardSlots(GameState game, List<DraculaCardSlot> cardsDroppedOffTrail, DecisionMaker logic)
 {
     foreach (var cardDroppedOffTrail in cardsDroppedOffTrail)
     {
         if (cardDroppedOffTrail.DraculaCards.Count() > 1)
         {
             cardDroppedOffTrail.DraculaCards.Remove(cardDroppedOffTrail.DraculaCards[1]);
         }
         if (cardDroppedOffTrail.DraculaCards.First().Location == game.Dracula.LocationWhereHideWasUsed && game.Dracula.LocationWhereHideWasUsed != Location.Nowhere)
         {
             int position;
             var encountersToReturnToEncounterPool = game.Dracula.DiscardHide(out position);
             Console.WriteLine("The location where Dracula used Hide dropped off the trail, so the Hide card is also removed from the trail. It was in position {0}", position + 1);
             logic.EliminateTrailsThatDoNotContainHideAtPosition(game, position);
             foreach (var enc in encountersToReturnToEncounterPool)
             {
                 enc.IsRevealed = false;
                 game.EncounterPool.Add(enc);
             }
         }
         var index = logic.ChooseToPutDroppedOffCardInCatacombs(game, cardDroppedOffTrail);
         if (index > -1)
         {
             game.Dracula.Catacombs[index] = cardDroppedOffTrail;
             game.Dracula.PlaceEncounterTileOnCard(
                 logic.ChooseEncounterTileToPlaceOnDraculaCardSlot(game, game.Dracula.Catacombs[index]),
                 cardDroppedOffTrail);
         }
         else
         {
             cardDroppedOffTrail.DraculaCards.First().IsRevealed = false;
             while (cardDroppedOffTrail.EncounterTiles.Count() > 0)
             {
                 cardDroppedOffTrail.EncounterTiles.First().IsRevealed = false;
                 MatureEncounter(game, cardDroppedOffTrail.EncounterTiles.First(), logic);
                 cardDroppedOffTrail.EncounterTiles.Remove(cardDroppedOffTrail.EncounterTiles.First());
             }
         }
     }
 }