コード例 #1
0
ファイル: Program.cs プロジェクト: UncleGus/dracula
 /// <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);
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: UncleGus/dracula
 /// <summary>
 /// Resolves a Hunter using the Holy Water Item or the Holy Water font at St. Joseph & St. Mary
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterReceivingHolyWater">The Hunter receiving the Holy Water effect</param>
 private static void UseHolyWaterOnHunter(GameState game, Hunter hunterReceivingHolyWater)
 {
     if (hunterReceivingHolyWater == Hunter.MinaHarker)
     {
         Console.WriteLine("Mina's bite cannot be cured");
         return;
     }
     Console.WriteLine("Roll a die and enter the result");
     var dieRoll = 0;
     while (dieRoll == 0)
     {
         if (int.TryParse(Console.ReadLine(), out dieRoll))
         {
             if (dieRoll < 1 || dieRoll > 7)
             {
                 dieRoll = 0;
             }
         }
     }
     switch (dieRoll)
     {
         case 1:
             Console.WriteLine("{0} loses 2 health", hunterReceivingHolyWater.Name());
             game.Hunters[(int)hunterReceivingHolyWater].AdjustHealth(-2);
             CheckForHunterDeath(game); break;
         case 2:
         case 3:
         case 4:
             Console.WriteLine("Nothing happens"); break;
         case 5:
         case 6:
             Console.WriteLine("{0} is cured of a Bite", hunterReceivingHolyWater.Name());
             game.Hunters[(int)hunterReceivingHolyWater].AdjustBites(-1); break;
     }
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: UncleGus/dracula
 /// <summary>
 /// Handles the Sense of Emergency card or Resolve ability
 /// </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 PlaySenseOfEmergency(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     if (game.Hunters[(int)hunterPlayingEvent].Health <= 6 - game.Vampires)
     {
         Console.WriteLine("{0} does not have enough health", hunterPlayingEvent.Name());
         return;
     }
     Console.WriteLine("{0} loses {1} health", hunterPlayingEvent.Name(), 6 - game.Vampires);
     game.Hunters[(int)hunterPlayingEvent].AdjustHealth(game.Vampires - 6);
     Console.WriteLine("Where is {0} moving?");
     var destination = Location.Nowhere;
     while (destination == Location.Nowhere)
     {
         destination = Enumerations.GetLocationFromString(Console.ReadLine());
     }
     HandleMoveOperation(game, ((int)hunterPlayingEvent).ToString(), destination.Name(), logic);
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: UncleGus/dracula
 /// <summary>
 /// Spends a point of Resolve using the Inner Strength ability
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterSpendingResolve">The Hunter spending the resolve and being healed</param>
 private static void PlayInnerStrength(GameState game, Hunter hunterSpendingResolve)
 {
     game.Hunters[(int)hunterSpendingResolve].AdjustHealth(4);
     Console.WriteLine("{0} now has {1} health", hunterSpendingResolve.Name(), game.Hunters[(int)hunterSpendingResolve].Health);
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: UncleGus/dracula
 /// <summary>
 /// Resolves the Excellent Weather Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 private static void PlayExcellentWeather(GameState game, Hunter hunterPlayingEvent)
 {
     Console.WriteLine("{0} may make up to four sea moves this turng", hunterPlayingEvent.Name());
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: UncleGus/dracula
 /// <summary>
 /// Resolves the Chartered Carriage 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 PlayCharteredCarriage(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     if (DraculaIsPlayingFalseTipoffToCancelCharteredCarriage(game, logic))
     {
         Console.WriteLine("Chartered Carriage cancelled");
         return;
     }
     Console.WriteLine("{0} catches a fast train this turn", hunterPlayingEvent.Name());
 }
コード例 #7
0
ファイル: Program.cs プロジェクト: UncleGus/dracula
 /// <summary>
 /// Determines if a Hunter is playing Great Strength to cancel a Bite
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="bittenHunter">The Hunter receiving a bite</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if the Hunter successfully plays Great Strength</returns>
 private static bool HunterPlayingGreatStrengthToCancelBite(GameState game, Hunter bittenHunter,
     DecisionMaker logic)
 {
     Console.WriteLine("Will {0} play a Great Strength to cancel the Bite?", bittenHunter.Name());
     var input = "";
     do
     {
         input = Console.ReadLine();
     } while (!"yes".StartsWith(input.ToLower()) && !"no".StartsWith(input.ToLower()));
     if ("yes".StartsWith(input.ToLower()))
     {
         game.Hunters[(int)bittenHunter].DiscardEvent(game, Event.GreatStrength);
         if (!DraculaIsPlayingDevilishPowerToCancelEvent(game, Event.GreatStrength, Event.GreatStrength, logic, game.Hunters[(int)bittenHunter]))
         {
             Console.WriteLine("Bite effect cancelled");
             return true;
         }
         Console.WriteLine("Great Strength cancelled");
         return false;
     }
     return false;
 }