Ejemplo n.º 1
0
 /// <summary>
 /// Resolves the Telegraph Ahead Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayTelegraphAhead(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     foreach (var loc in game.Map.LocationsConnectedByRoadTo(game.Hunters[(int)hunterPlayingEvent].CurrentLocation))
     {
         if (DraculaIsPlayingSensationalistPressToPreventRevealingLocation(game, loc, logic))
         {
             Console.WriteLine("Dracula prevented a location from being revealed");
         }
         else
         {
             int position = game.Dracula.RevealCardInTrailWithLocation(loc);
             if (position > -1)
             {
                 Console.WriteLine("{0} revealed", loc.Name());
                 logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, loc, position);
             }
             else
             {
                 position = game.Dracula.RevealCardInCatacombsWithLocation(loc);
                 if (position > -1)
                 {
                     Console.WriteLine("{0} revealed", loc.Name());
                     logic.EliminateTrailsThatContainLocation(game, loc);
                 }
                 else
                 {
                     logic.EliminateTrailsThatContainLocation(game, loc);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Resolves the Hired Scouts Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayHiredScouts(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     Console.WriteLine("Name the first city");
     var firstLocationToReveal = Location.Nowhere;
     while (firstLocationToReveal == Location.Nowhere || (game.Map.TypeOfLocation(firstLocationToReveal) != LocationType.SmallCity && game.Map.TypeOfLocation(firstLocationToReveal) != LocationType.LargeCity))
     {
         firstLocationToReveal = Enumerations.GetLocationFromString(Console.ReadLine());
     }
     var secondLocationToReveal = Location.Nowhere;
     Console.WriteLine("Name the second city");
     secondLocationToReveal = Location.Nowhere;
     while (secondLocationToReveal == Location.Nowhere || (game.Map.TypeOfLocation(secondLocationToReveal) != LocationType.SmallCity && game.Map.TypeOfLocation(secondLocationToReveal) != LocationType.LargeCity))
     {
         secondLocationToReveal = Enumerations.GetLocationFromString(Console.ReadLine());
     }
     if (DraculaIsPlayingSensationalistPressToPreventRevealingLocation(game, firstLocationToReveal, logic))
     {
         Console.WriteLine("Dracula prevented a location from being revealed");
         logic.EliminateTrailsThatDoNotContainLocation(game, firstLocationToReveal);
     }
     else
     {
         var trailIndex = game.Dracula.RevealCardInTrailWithLocation(firstLocationToReveal);
         if (trailIndex > -1)
         {
             Console.WriteLine("{0} revealed", firstLocationToReveal.Name());
             logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, firstLocationToReveal, trailIndex);
             trailIndex = -2;
         }
         else
         {
             trailIndex = game.Dracula.RevealCardInCatacombsWithLocation(firstLocationToReveal);
         }
         if (trailIndex > -1)
         {
             Console.WriteLine("{0} revealed", firstLocationToReveal.Name());
             logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, firstLocationToReveal, trailIndex);
             game.Dracula.RevealEncountersAtPositionInTrail(trailIndex);
             DrawGameState(game);
         }
         else if (trailIndex == -1)
         {
             Console.WriteLine("{0} is not in Dracula's trail or Catacombs", firstLocationToReveal.Name());
             logic.EliminateTrailsThatContainLocation(game, firstLocationToReveal);
         }
     }
     if (DraculaIsPlayingSensationalistPressToPreventRevealingLocation(game, secondLocationToReveal, logic))
     {
         Console.WriteLine("Dracula prevented a location from being revealed");
         logic.EliminateTrailsThatDoNotContainLocation(game, secondLocationToReveal);
     }
     else
     {
         var trailIndex = game.Dracula.RevealCardInTrailWithLocation(secondLocationToReveal);
         if (trailIndex > -1)
         {
             Console.WriteLine("{0} revealed", secondLocationToReveal.Name());
             logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, secondLocationToReveal, trailIndex);
             trailIndex = -2;
         }
         else
         {
             trailIndex = game.Dracula.RevealCardInCatacombsWithLocation(secondLocationToReveal);
         }
         if (trailIndex > -1)
         {
             Console.WriteLine("{0} revealed", secondLocationToReveal.Name());
             logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, secondLocationToReveal, trailIndex);
             game.Dracula.RevealEncountersAtPositionInTrail(trailIndex);
             DrawGameState(game);
         }
         else if (trailIndex == -1)
         {
             Console.WriteLine("{0} is not in Dracula's trail or Catacombs", secondLocationToReveal.Name());
             logic.EliminateTrailsThatContainLocation(game, secondLocationToReveal);
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Resolves the Stormy Seas Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayStormySeas(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     Console.WriteLine("Where is {0} playing Stormy Seas?", hunterPlayingEvent.Name());
     var stormySeasLocation = Location.Nowhere;
     while (stormySeasLocation == Location.Nowhere ||
            game.Map.TypeOfLocation(stormySeasLocation) != LocationType.Sea)
     {
         stormySeasLocation = Enumerations.GetLocationFromString(Console.ReadLine());
     }
     game.StormySeasLocation = stormySeasLocation;
     game.StormySeasRounds = 2;
     if (stormySeasLocation == game.Dracula.CurrentLocation)
     {
         Console.WriteLine("Dracula was in {0}", stormySeasLocation.Name());
         int position = game.Dracula.RevealCardInTrailWithLocation(stormySeasLocation);
         logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, stormySeasLocation, position);
         var destination = logic.ChoosePortToGoToAfterStormySeas(game);
         if (destination == Location.Nowhere)
         {
             Console.WriteLine("Dracula cannot make a legal move");
             game.Dracula.TakePunishmentForCheating(game);
             return;
         }
         int doubleBackSlot;
         var cardDroppedOffTrail = game.Dracula.MoveTo(destination, Power.None, out doubleBackSlot);
         logic.AddDisembarkedCardToAllPossibleTrails(game);
         if (doubleBackSlot > -1)
         {
             Console.WriteLine("Dracula Doubled Back to the location in slot {0}", doubleBackSlot + 1);
         }
         var cardsDroppedOffTrail = new List<DraculaCardSlot>();
         if (cardDroppedOffTrail != null)
         {
             cardsDroppedOffTrail.Add(cardDroppedOffTrail);
         }
         if (DraculaIsPlayingSensationalistPressToPreventRevealingLocation(game, destination, logic))
         {
             Console.WriteLine("Dracula prevented a location from being revealed");
         }
         else
         {
             game.Dracula.RevealCardInTrailWithLocation(destination);
             logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, destination, 0);
         }
         DealWithDroppedOffCardSlots(game, cardsDroppedOffTrail, logic);
         CheckForJonathanHarker(game, logic);
     }
     else
     {
         logic.EliminateTrailsThatContainLocation(game, stormySeasLocation);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Handles the entirety of a Hunter's move, including search, Encounters, combat etc.
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterIndex">The index of the Hunter (and group) to move</param>
 /// <param name="destination">The destination of the move</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void HandleMoveOperation(GameState game, string destination, string hunterIndex,
     DecisionMaker logic)
 {
     var hunterMoved = Hunter.Nobody;
     Location originatingLocation;
     var trailIndex = MoveHunter(game, hunterIndex, destination, out hunterMoved, out originatingLocation, logic);
     if (DraculaIsPlayingCustomsSearch(game, hunterMoved, originatingLocation, logic))
     {
         foreach (var h in game.Hunters[(int)hunterMoved].HuntersInGroup)
         {
             Console.WriteLine("{0} must discard all Items", h.Name());
             while (game.Hunters[(int)h].ItemCount > 0)
             {
                 DiscardUnknownItemFromHunter(game, game.Hunters[(int)h]);
             }
         }
     }
     if (trailIndex > -1 && game.Map.TypeOfLocation(game.Dracula.Trail[trailIndex].DraculaCards.First().Location) != LocationType.Sea)
     {
         game.Dracula.RevealCardAtPosition(trailIndex);
         logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, game.Dracula.Trail[trailIndex].DraculaCards.First().Location, trailIndex);
         game.Dracula.RevealEncountersAtPositionInTrail(trailIndex);
         DraculaCardSlot slotBeingRevealed;
         if (trailIndex < 6)
         {
             slotBeingRevealed = game.Dracula.Trail[trailIndex];
         }
         else
         {
             slotBeingRevealed = game.Dracula.Catacombs[trailIndex - 6];
         }
         if (slotBeingRevealed.DraculaCards.First().Location == game.Dracula.LocationWhereHideWasUsed)
         {
             var positionRevealed = game.Dracula.RevealHideCard();
             logic.EliminateTrailsThatDoNotContainHideAtPosition(game, positionRevealed);
             game.Dracula.RevealEncountersAtPositionInTrail(positionRevealed);
         }
         if (slotBeingRevealed.DraculaCards.First().Location == game.Dracula.CurrentLocation)
         {
             Console.WriteLine("Dracula is here!");
         }
         else
         {
             Console.WriteLine("Dracula has been here");
         }
         DrawGameState(game);
         var encounterTilesToResolve = new List<EncounterTile>();
         foreach (var enc in slotBeingRevealed.EncounterTiles)
         {
             encounterTilesToResolve.Add(enc);
         }
         var hunterCanContinueToResolveEncounters = true;
         while (encounterTilesToResolve.Count() > 0 && hunterCanContinueToResolveEncounters)
         {
             var encounterTileBeingResolved = logic.ChooseEncounterToResolveOnSearchingHunter(game,
                 encounterTilesToResolve, hunterMoved);
             hunterCanContinueToResolveEncounters = ResolveEncounterTile(game, encounterTileBeingResolved,
                 game.Hunters[(int)hunterMoved].HuntersInGroup, logic, trailIndex);
             encounterTilesToResolve.Remove(encounterTileBeingResolved);
         }
         if (game.Hunters[(int)hunterMoved].CurrentLocation == game.Dracula.LocationWhereHideWasUsed)
         {
             foreach (var enc in game.Dracula.slotWhereHideCardIs().EncounterTiles)
             {
                 encounterTilesToResolve.Add(enc);
             }
         }
         while (encounterTilesToResolve.Count() > 0 && hunterCanContinueToResolveEncounters)
         {
             var encounterTileBeingResolved = logic.ChooseEncounterToResolveOnSearchingHunter(game,
                 encounterTilesToResolve, hunterMoved);
             hunterCanContinueToResolveEncounters = ResolveEncounterTile(game, encounterTileBeingResolved,
                 game.Hunters[(int)hunterMoved].HuntersInGroup, logic, game.Dracula.PositionWhereHideCardIs());
             encounterTilesToResolve.Remove(encounterTileBeingResolved);
         }
         if (slotBeingRevealed.DraculaCards.First().Location == game.Dracula.CurrentLocation &&
             hunterCanContinueToResolveEncounters)
         {
             Console.WriteLine("Entering combat with Dracula");
             if (DraculaIsPlayingWildHorses(game, logic))
             {
                 Console.WriteLine("The Wild Horses carry you away");
                 HandleMoveOperation(game, ((int)hunterMoved).ToString(),
                     logic.ChooseDestinationForWildHorses(game).Name(), logic);
             }
             else
             {
                 var huntersAttacking = new List<HunterPlayer>();
                 foreach (var h in game.Hunters[(int)hunterMoved].HuntersInGroup)
                 {
                     huntersAttacking.Add(game.Hunters[(int)h]);
                 }
                 ResolveCombat(game, huntersAttacking, Opponent.Dracula, logic);
                 CheckForHunterDeath(game);
             }
         }
     }
     else
     {
         logic.EliminateTrailsThatContainLocation(game, game.Hunters[(int)hunterMoved].CurrentLocation);
     }
 }