Example #1
0
 /// <summary>
 /// Checks if a card drawn by Dracula can be played immediately and resolves it if so
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="eventPlayedByDracula">The Event to assess</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayImmediatelyDraculaCard(GameState game, Event eventPlayedByDracula, DecisionMaker logic)
 {
     switch (eventPlayedByDracula)
     {
         case Event.NightVisit:
             PlayNightVisit(game, logic); break;
         case Event.VampiricInfluence:
             PlayVampiricInfluence(game, logic); break;
         case Event.Evasion:
             PlayEvasion(game, logic); break;
         case Event.QuinceyPMorris:
         case Event.ImmanuelHildesheim:
         case Event.DraculasBrides:
             PlayDraculaAlly(game, eventPlayedByDracula, logic); break;
         default:
             Console.WriteLine("Dracula drew an Event card into his hand"); break;
     }
 }
Example #2
0
 /// <summary>
 /// Determines if Dracula is playing Seduction at the start of an Encounter
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if Dracula successfully plays Seduction</returns>
 private static bool DraculaIsPlayingSeduction(GameState game, DecisionMaker logic)
 {
     if (logic.ChooseToPlaySeduction(game))
     {
         Console.WriteLine("Dracula is playing Seduction");
         game.Dracula.DiscardEvent(Event.Seduction, game.EventDiscard);
         if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.Seduction, Event.Seduction, logic) > 0)
         {
             Console.WriteLine("Seduction cancelled");
             return false;
         }
         return true;
     }
     return false;
 }
Example #3
0
 /// <summary>
 /// Determines if Dracula is playing Trap against a Hunter at the start of a combat
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="huntersInvolved">The list of Hunters involved in the combat</param>
 /// <param name="opponent">The Opponent</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if Dracula successfully plays Trap</returns>
 private static bool DraculaIsPlayingTrap(GameState game, List<HunterPlayer> huntersInvolved, Opponent opponent,
     DecisionMaker logic)
 {
     if (logic.ChooseToPlayTrap(game, huntersInvolved, opponent))
     {
         Console.WriteLine("Dracula is playing Trap");
         game.Dracula.DiscardEvent(Event.Trap, game.EventDiscard);
         if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.Trap, Event.Trap, logic) > 0)
         {
             Console.WriteLine("Trap cancelled");
             return false;
         }
         return true;
     }
     return false;
 }
Example #4
0
 /// <summary>
 /// Determines if Dracula is playing Customs Search on a Hunter
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterMoved">The Hunter who moved</param>
 /// <param name="origin">The original Location</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if Dracula successfully plays Customs Search</returns>
 private static bool DraculaIsPlayingCustomsSearch(GameState game, Hunter hunterMoved, Location origin,
     DecisionMaker logic)
 {
     if (logic.ChooseToPlayCustomsSearch(game, hunterMoved, origin))
     {
         Console.WriteLine("Dracula is playing Customs Search");
         game.Dracula.DiscardEvent(Event.CustomsSearch, game.EventDiscard);
         if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.CustomsSearch, Event.CustomsSearch, logic) > 0)
         {
             Console.WriteLine("Customs Search cancelled");
             return false;
         }
         return true;
     }
     return false;
 }
Example #5
0
 /// <summary>
 /// Checks to see if Dracula is playing False Tip-off when a Hunter attempts to catch a train by rolling the die
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if Dracula successfully plays False Tip-off</returns>
 private static bool DraculaIsPlayingFalseTipoffToDelayHunter(GameState game, DecisionMaker logic)
 {
     if (logic.ChooseToDelayHunterWithFalseTipoff(game))
     {
         Console.WriteLine("Dracula is playing False Tip-off to delay the train");
         game.Dracula.DiscardEvent(Event.FalseTipoff, game.EventDiscard);
         if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.FalseTipoff, Event.FalseTipoff, logic) > 0 ||
             HunterPlayingCharteredCarriageToCancelFalseTipOff(game, Event.FalseTipoff, Event.FalseTipoff, logic) > 0)
         {
             return false;
         }
         return true;
     }
     return false;
 }
Example #6
0
 /// <summary>
 /// Resolves an Encounter of New Vampire for a group of Hunters
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="huntersInvolved">A list of Hunters involved in the Encounter</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if the Hunters can continue resolving Encounters</returns>
 private static bool ResolveNewVampire(GameState game, List<Hunter> huntersInvolved, DecisionMaker logic,
     out bool discardNewVampire, out bool seductionPlayed)
 {
     seductionPlayed = false;
     switch (game.TimeOfDay)
     {
         case TimeOfDay.Dawn:
         case TimeOfDay.Noon:
         case TimeOfDay.Dusk:
             Console.WriteLine("New Vampire encountered during the day and disposed of");
             discardNewVampire = true;
             return true;
     }
     if (DraculaIsPlayingSeduction(game, logic))
     {
         seductionPlayed = true;
         discardNewVampire = false;
         foreach (var h in huntersInvolved)
         {
             Console.WriteLine("{0} is bitten!");
             if (!HunterPlayingGreatStrengthToCancelBite(game, h, logic))
             {
                 game.Hunters[(int)h].AdjustBites(1);
             }
         }
         if (CheckForHunterDeath(game))
         {
             return false;
         }
         return true;
     }
     Console.WriteLine("Roll a die and enter the result");
     var dieRoll = 0;
     while (dieRoll == 0)
     {
         if (!(int.TryParse(Console.ReadLine(), out dieRoll) && dieRoll > 0 && dieRoll < 7))
         {
             dieRoll = 0;
         }
     }
     switch (dieRoll)
     {
         case 1:
         case 2:
         case 3:
             Console.WriteLine("The Vampire attempts to bite you");
             var groupHasHolyItem = false;
             foreach (var h in huntersInvolved)
             {
                 Console.WriteLine("What Items does {0} have? 0= nothing, 1= Crucifix, 2= Heavenly Host",
                     h.Name());
                 var holyItem = Item.None;
                 var answer = -1;
                 while (answer == -1)
                 {
                     if (int.TryParse(Console.ReadLine(), out answer))
                     {
                         if (answer > -1 && answer < 3)
                         {
                             switch (answer)
                             {
                                 case 0:
                                     holyItem = Item.None;
                                     break;
                                 case 1:
                                     holyItem = Item.Crucifix;
                                     break;
                                 case 2:
                                     holyItem = Item.HeavenlyHost;
                                     break;
                             }
                         }
                         else
                         {
                             answer = -1;
                         }
                     }
                 }
                 if (holyItem != Item.None)
                 {
                     groupHasHolyItem = true;
                     AddItemCardToDraculaKnownCardsIfNotAlreadyKnown(game, game.Hunters[(int)h], holyItem);
                     break;
                 }
             }
             if (groupHasHolyItem)
             {
                 Console.WriteLine("Bite attempted negated by holy item");
                 discardNewVampire = true;
                 return true;
             }
             discardNewVampire = true;
             foreach (var h in huntersInvolved)
             {
                 Console.WriteLine("{0} is bitten!", h.Name());
                 if (!HunterPlayingGreatStrengthToCancelBite(game, h, logic))
                 {
                     game.Hunters[(int)h].AdjustBites(1);
                 }
             }
             if (CheckForHunterDeath(game))
             {
                 return false;
             }
             break;
         case 4:
         case 5:
         case 6:
             Console.WriteLine("The Vampire attempts to escape");
             var groupHasSharpItem = false;
             foreach (var h in huntersInvolved)
             {
                 Console.WriteLine("What Items does {0} have? 0= nothing, 1= Knife, 2= Stake", h.Name());
                 var sharpItem = Item.None;
                 var answer = -1;
                 while (answer == -1)
                 {
                     if (int.TryParse(Console.ReadLine(), out answer))
                     {
                         if (answer > -1 && answer < 3)
                         {
                             switch (answer)
                             {
                                 case 0:
                                     sharpItem = Item.None;
                                     break;
                                 case 1:
                                     sharpItem = Item.Knife;
                                     break;
                                 case 2:
                                     sharpItem = Item.Stake;
                                     break;
                             }
                         }
                         else
                         {
                             answer = -1;
                         }
                     }
                 }
                 if (sharpItem != Item.None)
                 {
                     groupHasSharpItem = true;
                     game.Hunters[(int)h].DiscardItem(game, sharpItem);
                     break;
                 }
             }
             if (groupHasSharpItem)
             {
                 Console.WriteLine("Escape attempted negated by sharp weapon");
                 discardNewVampire = true;
                 return true;
             }
             Console.WriteLine("The Vampire escapes and remains in the city");
             discardNewVampire = false;
             return true;
     }
     discardNewVampire = true;
     return true;
 }
Example #7
0
 /// <summary>
 /// For spending a Resolve point by a Hunter
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="resolveName">A string to be converted to the ResolveAbility being used</param>
 /// <param name="hunterIndex">A string to be converted to the Hunter spending Resolve</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void SpendResolve(GameState game, string resolveName, string hunterIndex, DecisionMaker logic)
 {
     var hunterSpendingResolve = Hunter.Nobody;
     int index = -2;
     if (int.TryParse(hunterIndex, out index))
     {
         hunterSpendingResolve = game.GetHunterFromInt(index);
     }
     var line = "";
     while (hunterSpendingResolve == Hunter.Nobody && index != -1)
     {
         Console.WriteLine("Who is spending resolve? {0}= {1}, {2}= {3}, {4}= {5}, {6}= {7} (-1 to cancel)",
             (int)Hunter.LordGodalming, Hunter.LordGodalming.Name(), (int)Hunter.DrSeward,
             Hunter.DrSeward.Name(), (int)Hunter.VanHelsing, Hunter.VanHelsing.Name(), (int)Hunter.MinaHarker,
             Hunter.MinaHarker.Name());
         line = Console.ReadLine();
         if (int.TryParse(line, out index))
         {
             if (index < -1 || index > 4)
             {
                 index = -2;
             }
             if (index == -1)
             {
                 Console.WriteLine("Cancelled");
                 return;
             }
             hunterSpendingResolve = game.GetHunterFromInt(index);
             Console.WriteLine(hunterSpendingResolve.Name());
         }
         else
         {
             Console.WriteLine("I didn't understand that");
         }
     }
     var ability = Enumerations.GetResolveAbilityFromString(resolveName);
     while (ability == ResolveAbility.None && line.ToLower() != "cancel")
     {
         Console.WriteLine("What resolve ability is {0} using?", hunterSpendingResolve.Name());
         line = Console.ReadLine();
         if (line.ToLower() == "cancel")
         {
             Console.WriteLine("Cancelled");
             return;
         }
         ability = Enumerations.GetResolveAbilityFromString(line);
     }
     switch (ability)
     {
         case ResolveAbility.NewspaperReports:
             PlayNewsPaperReports(game, hunterSpendingResolve, logic);
             break;
         case ResolveAbility.InnerStrength:
             PlayInnerStrength(game, hunterSpendingResolve);
             break;
         case ResolveAbility.SenseOfEmergency:
             PlaySenseOfEmergency(game, hunterSpendingResolve, logic);
             break;
     }
     game.AdjustResolve(-1);
 }
Example #8
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);
                 }
             }
         }
     }
 }
Example #9
0
 /// <summary>
 /// Resolves the Vampire Lair Event card
 /// </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 PlayVampireLair(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     if (game.Vampires < 1)
     {
         Console.WriteLine("No Vampires to battle");
         return;
     }
     if (ResolveCombat(game, new List<HunterPlayer> { game.Hunters[(int)hunterPlayingEvent] }, Opponent.NewVampire,
         logic))
     {
         game.AdjustVampires(-1);
     }
 }
Example #10
0
 /// <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);
 }
Example #11
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);
     }
 }
Example #12
0
 /// <summary>
 /// Resolves the Night Visit Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayNightVisit(GameState game, DecisionMaker logic)
 {
     Console.WriteLine("Dracula is playing Night Visit");
     if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.NightVisit, Event.NightVisit, logic) > 0)
     {
         Console.WriteLine("Night Visit cancelled");
         return;
     }
     var bittenHunters = new List<HunterPlayer>();
     foreach (var h in game.Hunters)
     {
         if (h != null && h.BiteCount > 0)
         {
             bittenHunters.Add(h);
         }
     }
     var victim = logic.ChooseNightVisitVictim(bittenHunters);
     Console.WriteLine("{0} is visited in the night and loses 2 health", victim.Hunter.Name());
     victim.AdjustHealth(-2);
     CheckForHunterDeath(game);
 }
Example #13
0
 /// <summary>
 /// Resolves the Newspaper Reports Event 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 PlayNewsPaperReports(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     for (var i = 5; i > 0; i--)
     {
         if (game.Dracula.Trail[i] != null &&
             game.Dracula.Trail[i].DraculaCards.First().Location != Location.Nowhere &&
             game.Dracula.Trail[i].DraculaCards.First().Location != game.Dracula.CurrentLocation &&
             !game.Dracula.Trail[i].DraculaCards.First().IsRevealed)
         {
             if (DraculaIsPlayingSensationalistPressToPreventRevealingLocation(game,
                 game.Dracula.Trail[i].DraculaCards.First().Location, logic))
             {
                 Console.WriteLine("Dracula prevented a location from being revealed");
             }
             else
             {
                 game.Dracula.RevealCardAtPosition(i);
                 logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, game.Dracula.Trail[i].DraculaCards.First().Location, i);
                 break;
             }
         }
     }
 }
Example #14
0
 /// <summary>
 /// Resolves the Money Trail 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 PlayMoneyTrail(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     for (var i = 5; i > 0; i--)
     {
         if (game.Dracula.Trail[i] != null &&
             game.Map.TypeOfLocation(game.Dracula.Trail[i].DraculaCards.First().Location) == LocationType.Sea)
         {
             if (DraculaIsPlayingSensationalistPressToPreventRevealingLocation(game,
                 game.Dracula.Trail[i].DraculaCards.First().Location, logic))
             {
                 Console.WriteLine("Dracula prevented a location from being revealed");
             }
             else
             {
                 game.Dracula.RevealCardAtPosition(i);
                 logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, game.Dracula.Trail[i].DraculaCards.First().Location, i);
             }
         }
     }
 }
Example #15
0
 /// <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());
             }
         }
     }
 }
Example #16
0
 /// <summary>
 /// Resolves the Vampiric Influence Event card
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayVampiricInfluence(GameState game, DecisionMaker logic)
 {
     Console.WriteLine("Dracula played Vampiric Influence");
     var bittenHunters = new List<HunterPlayer>();
     if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.VampiricInfluence, Event.VampiricInfluence, logic) >
         0)
     {
         Console.WriteLine("Vampiric Influence cancelled");
         return;
     }
     foreach (var h in game.Hunters)
     {
         if (h != null && h.BiteCount > 0)
         {
             bittenHunters.Add(h);
         }
     }
     var victim = logic.ChooseVampiricInfluenceVictim(bittenHunters);
     Console.WriteLine(
         "Dracula is influencing {0}, who must show Dracula all of {1} cards and declare {1} next move", victim.Hunter.Name(),
         victim.Hunter == Hunter.MinaHarker ? "her" : "his");
     DraculaLooksAtAllHuntersItems(game, victim);
     DraculaLooksAtAllHuntersEvents(game, victim);
     HunterDeclaresNextMove(game, victim);
 }
Example #17
0
 /// <summary>
 /// Resolves an encounter of a Minion With Knife And Rifle for a group of Hunters
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="huntersInvolved">A list of Hunters involved in the combat</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if the Hunters can continue resolving Encounters</returns>
 private static bool ResolveMinionWithKnifeAndRifle(GameState game, List<Hunter> huntersInvolved,
     DecisionMaker logic)
 {
     var huntersInCombat = new List<HunterPlayer>();
     foreach (var h in huntersInvolved)
     {
         huntersInCombat.Add(game.Hunters[(int)h]);
     }
     var continueEncounters = ResolveCombat(game, huntersInCombat, Opponent.MinionWithKnifeAndRifle, logic);
     if (CheckForHunterDeath(game))
     {
         return false;
     }
     if (continueEncounters &&
         DraculaIsPlayingRelentlessMinion(game, huntersInvolved, Opponent.MinionWithKnifeAndRifle, logic))
     {
         return ResolveMinionWithKnifeAndRifle(game, huntersInvolved, logic);
     }
     return continueEncounters;
 }
Example #18
0
 /// <summary>
 /// Resolves an Encounter of Ambush for a group of Hunters
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="huntersInvolved">A list of Hunters involved in the Encounter</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if the Hunters can continue resolving Encounters</returns>
 private static bool ResolveAmbush(GameState game, List<Hunter> huntersInvolved, DecisionMaker logic)
 {
     game.Dracula.DrawEncounter(game.EncounterPool);
     game.Dracula.DiscardEncounterTile(game, logic.ChooseEncounterTileToDiscardFromEncounterHand(game));
     return true;
 }
Example #19
0
 /// <summary>
 /// Resolves an Encounter of Thief for a group of Hunters
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="huntersInvolved">A list of Hunters involved in the Encounter</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if the Hunters can continue resolving Encounters</returns>
 private static bool ResolveThief(GameState game, List<Hunter> huntersInvolved, DecisionMaker logic)
 {
     foreach (var h in huntersInvolved)
     {
         if (game.Hunters[(int)h].HasDogsFaceUp)
         {
             return true;
         }
     }
     foreach (var h in huntersInvolved)
     {
         var typeOfCardToDiscard = logic.ChooseToDiscardItemFromHunterInsteadOfEvent(game.Hunters[(int)h]);
         if (typeOfCardToDiscard != CardType.None)
         {
             Console.WriteLine("Dracula has decided to discard an {0} from {1}", typeOfCardToDiscard, h.Name());
         }
     }
     Console.WriteLine("Use the standard discard command to tell me what was discarded");
     return true;
 }
Example #20
0
 /// <summary>
 /// Resolves an Encounter of Assassin for a group of Hunters
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="huntersInvolved">A list of Hunters involved in the combat</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if the Hunters can continue resolving Encounters</returns>
 private static bool ResolveAssassin(GameState game, List<Hunter> huntersInvolved, DecisionMaker logic)
 {
     var huntersInCombat = new List<HunterPlayer>();
     foreach (var h in huntersInvolved)
     {
         huntersInCombat.Add(game.Hunters[(int)h]);
     }
     var continueEncounters = ResolveCombat(game, huntersInCombat, Opponent.Assassin, logic);
     if (CheckForHunterDeath(game))
     {
         return false;
     }
     return continueEncounters;
 }
Example #21
0
        /// <summary>
        /// Provides details about various aspects of the gamestate that are not otherwise displayed on the screen
        /// </summary>
        /// <param name="game">The GameState</param>
        private static void DisplayState(GameState game, string argument1, DecisionMaker logic)
        {
            Console.WriteLine("The state of the game:");
            foreach (var h in game.Hunters)
            {
                if (h != null)
                {
                    Console.WriteLine("{0} is in {1} with {2} Items and {3} Events, on {4} health with {5} bites{6}",
                        h.Hunter.Name(), h.CurrentLocation.Name(), h.ItemCount, h.EventCount, h.Health, h.BiteCount, h.HasDogsFaceUp ? " and has Dogs face up" : "");
                    if (h.EncountersInFrontOfPlayer.Any())
                    {
                        Console.Write("These Encounter tiles are in front of {0}: ", h.Hunter.Name());
                        foreach (EncounterTile enc in h.EncountersInFrontOfPlayer)
                        {
                            Console.Write("{0}, ", enc.Encounter.Name());
                        }
                        Console.WriteLine("");
                    }
                    if (h.ItemsKnownToDracula.Any() && argument1 == "debug")
                    {
                        Console.Write("These Items held by {0} are known to Dracula: ", h.Hunter.Name());
                        foreach (var i in h.ItemsKnownToDracula)
                        {
                            Console.Write("{0}, ", i.Item.Name());
                        }
                        Console.WriteLine("");
                    }
                    if (h.EventsKnownToDracula.Any() && argument1 == "debug")
                    {
                        Console.Write("These Events held by {0} are known to Dracula: ", h.Hunter.Name());
                        foreach (var e in h.EventsKnownToDracula)
                        {
                            Console.Write("{0}, ", e.Event.Name());
                        }
                        Console.WriteLine("");
                    }
                }
            }
            if (argument1 == "debug")
            {
                Console.WriteLine("Dracula is in {0} with {1} blood and has {2} Events", game.Dracula.CurrentLocation.Name(),
                    game.Dracula.Blood, game.Dracula.EventHand.Count());

                Console.Write("Dracula is holding these Encounter tiles: ");
                foreach (var enc in game.Dracula.EncounterHand)
                {
                    Console.Write("{0} ", enc.Encounter.Name());
                }
                Console.WriteLine("");
                if (game.Dracula.EventHand.Count() > 0)
                {
                    Console.Write("Dracula is holding these Event cards: ");
                    foreach (var e in game.Dracula.EventHand)
                    {
                        Console.Write("{0} ", e.Event.Name());
                    }
                }
            }
            Console.WriteLine("");
            Console.WriteLine("These Items are in the discard:");
            foreach (var i in game.ItemDiscard)
            {
                Console.WriteLine(i.Item.Name());
            }
            Console.WriteLine("These Events are in the discard:");
            foreach (var e in game.EventDiscard)
            {
                Console.WriteLine(e.Event.Name());
            }
            if (argument1 == "debug")
            {
                Console.WriteLine("There are {0} possible configurations of Dracula's trail", logic.PossibilityTree.Count());
                Console.WriteLine("Dracula could be in one of {0} possible locations", logic.NumberOfPossibleCurrentLocations);
                Console.WriteLine("Dracula's current strategy is {0}", logic.Strategy);
            }
        }
Example #22
0
        /// <summary>
        /// Resolves a combat between a group of Hunters and an Opponent
        /// </summary>
        /// <param name="game">The GameState</param>
        /// <param name="huntersInvolved">A list of HunterPlayers involved in the combat</param>
        /// <param name="opponent">The Opponent type</param>
        /// <param name="logic">The artificial intelligence component</param>
        /// <returns>True if the Hunters can continue resolving Encounters</returns>
        private static bool ResolveCombat(GameState game, List<HunterPlayer> huntersInvolved, Opponent opponent,
            DecisionMaker logic)
        {
            var roundsWithoutEscaping = 0;
            var answer = -1;
            do
            {
                Console.WriteLine(
                    "Is anyone playing an Event at the start of this combat? 0= Nobody, {0}= {1}, {2}= {3}, {4}= {5}, {6}= {7}",
                    (int)Hunter.LordGodalming, Hunter.LordGodalming.Name(), (int)Hunter.DrSeward,
                    Hunter.DrSeward.Name(), (int)Hunter.VanHelsing, Hunter.VanHelsing.Name(), (int)Hunter.MinaHarker,
                    Hunter.MinaHarker.Name());
                while (answer == -1)
                {
                    if (int.TryParse(Console.ReadLine(), out answer))
                    {
                        if (answer < 0 || answer > 4)
                        {
                            answer = -1;
                        }
                    }
                }
                if (answer > 0)
                {
                    var line = "";
                    Console.WriteLine("What Event is {0} playing? (cancel to cancel)", ((Hunter)answer).Name());
                    var eventBeingPlayed = Event.None;
                    while (eventBeingPlayed != Event.AdvancePlanning && eventBeingPlayed != Event.EscapeRoute &&
                           eventBeingPlayed != Event.HeroicLeap && line.ToLower() != "cancel")
                    {
                        line = Console.ReadLine();
                        eventBeingPlayed = Enumerations.GetEventFromString(line);
                    }
                    if (line.ToLower() == "cancel")
                    {
                        answer = -1;
                    }
                    else
                    {
                        switch (eventBeingPlayed)
                        {
                            case Event.AdvancePlanning:
                                game.Hunters[answer].DiscardEvent(game, Event.AdvancePlanning);
                                if (!DraculaIsPlayingDevilishPowerToCancelEvent(game, Event.AdvancePlanning, Event.AdvancePlanning, logic, game.Hunters[answer]))
                                {
                                    Console.WriteLine("One participant of your choice has combat rolls at +1 for this combat");
                                    CheckForCardsRevealedForBeingBitten(game);
                                }
                                else
                                {
                                    Console.WriteLine("Advance Planning cancelled");
                                    CheckForCardsRevealedForBeingBitten(game);
                                }
                                break;
                            case Event.EscapeRoute:
                                game.Hunters[answer].DiscardEvent(game, Event.EscapeRoute);
                                if (!DraculaIsPlayingDevilishPowerToCancelEvent(game, Event.EscapeRoute, Event.EscapeRoute, logic, game.Hunters[answer]))
                                {
                                    Console.WriteLine("Combat cancelled", ((Hunter)answer).Name());
                                    CheckForCardsRevealedForBeingBitten(game);
                                    return false;
                                }
                                CheckForCardsRevealedForBeingBitten(game);
                                Console.WriteLine("Escape Route cancelled"); break;
                            case Event.HeroicLeap:
                                game.Hunters[answer].DiscardEvent(game, Event.HeroicLeap);
                                if (!DraculaIsPlayingDevilishPowerToCancelEvent(game, Event.HeroicLeap, Event.HeroicLeap, logic, game.Hunters[answer]))
                                {
                                    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;
                                            }
                                        }
                                    }
                                    game.Hunters[answer].AdjustHealth(-dieRoll);
                                    game.Dracula.AdjustBlood(-dieRoll);
                                    CheckForHunterDeath(game);
                                    CheckForCardsRevealedForBeingBitten(game);
                                    return false;
                                }
                                Console.WriteLine("Heroic Leap cancelled"); break;
                                CheckForCardsRevealedForBeingBitten(game);
                        }
                    }
                    answer = -1;
                }
            } while (answer != 0);
            answer = -1;
            if (opponent == Opponent.Dracula || opponent == Opponent.NewVampire)
            {
                Console.WriteLine("Is anyone playing Garlic at the start of this combat? 0= Nobody, {0}{1}{2}{3}", huntersInvolved.Find(h => h.Hunter == Hunter.LordGodalming) == null ? "" : "1= Lord Godalming", huntersInvolved.Find(h => h.Hunter == Hunter.DrSeward) == null ? "" : "2= Dr. Seward", huntersInvolved.Find(h => h.Hunter == Hunter.VanHelsing) == null ? "" : "3= Van Helsing", huntersInvolved.Find(h => h.Hunter == Hunter.MinaHarker) == null ? "" : "4= Mina Harker");

                while (answer == -1)
                {
                    if (int.TryParse(Console.ReadLine(), out answer))
                    {
                        if (answer < 0 || answer > 4)
                        {
                            answer = -1;
                        }
                        else if (answer != 0 && huntersInvolved.Find(h => (int)h.Hunter == answer) == null)
                        {
                            answer = -1;
                        }
                    }
                    else
                    {
                        answer = -1;
                    }
                }
                if (answer > 0)
                {
                    game.Hunters[answer].DiscardItem(game, Item.Garlic);
                    CheckForCardsRevealedForBeingBitten(game);
                    roundsWithoutEscaping = 3;
                }
            }
            if (DraculaIsPlayingTrap(game, huntersInvolved, opponent, logic))
            {
                Console.WriteLine("Dracula played Trap. All of his combat rolls are at +1 for this combat");
            }
            var rageTarget = DraculaIsPlayingRageAgainstHunter(game, huntersInvolved, logic);
            if (rageTarget != Hunter.Nobody)
            {
                Console.WriteLine("Dracula played Rage against {0} and must reveal all Items", rageTarget.Name());
                DraculaLooksAtAllHuntersItems(game, game.Hunters[(int)rageTarget]);
                var itemDiscarded = logic.ChooseItemToDiscardWithRage(game, rageTarget);
                game.Hunters[(int)rageTarget].DiscardItem(game, itemDiscarded);
                Console.WriteLine("Dracula discarded {0}", itemDiscarded.Name());
                roundsWithoutEscaping = 3;
            }
            var basicHunterCombatCards = new List<ItemCard>
            {
                new ItemCard(Item.Punch),
                new ItemCard(Item.Dodge),
                new ItemCard(Item.Escape)
            };
            var enemyCombatCards = new List<EnemyCombatCard>();
            switch (opponent)
            {
                case Opponent.MinionWithKnife:
                    enemyCombatCards.Add(EnemyCombatCard.Punch);
                    enemyCombatCards.Add(EnemyCombatCard.Dodge);
                    enemyCombatCards.Add(EnemyCombatCard.Knife); break;
                case Opponent.MinionWithKnifeAndPistol:
                    enemyCombatCards.Add(EnemyCombatCard.Punch);
                    enemyCombatCards.Add(EnemyCombatCard.Dodge);
                    enemyCombatCards.Add(EnemyCombatCard.Knife);
                    enemyCombatCards.Add(EnemyCombatCard.Pistol); break;
                case Opponent.MinionWithKnifeAndRifle:
                    enemyCombatCards.Add(EnemyCombatCard.Punch);
                    enemyCombatCards.Add(EnemyCombatCard.Dodge);
                    enemyCombatCards.Add(EnemyCombatCard.Knife);
                    enemyCombatCards.Add(EnemyCombatCard.Rifle); break;
                case Opponent.Assassin:
                    enemyCombatCards.Add(EnemyCombatCard.Punch);
                    enemyCombatCards.Add(EnemyCombatCard.Dodge);
                    enemyCombatCards.Add(EnemyCombatCard.Knife);
                    enemyCombatCards.Add(EnemyCombatCard.Pistol);
                    enemyCombatCards.Add(EnemyCombatCard.Rifle); break;
                case Opponent.Dracula:
                    enemyCombatCards.Add(EnemyCombatCard.Claws);
                    enemyCombatCards.Add(EnemyCombatCard.Dodge);
                    enemyCombatCards.Add(EnemyCombatCard.EscapeMan);
                    switch (game.TimeOfDay)
                    {
                        case TimeOfDay.Twilight:
                        case TimeOfDay.Midnight:
                        case TimeOfDay.SmallHours:
                            enemyCombatCards.Add(EnemyCombatCard.EscapeBat);
                            enemyCombatCards.Add(EnemyCombatCard.EscapeMist);
                            enemyCombatCards.Add(EnemyCombatCard.Fangs);
                            enemyCombatCards.Add(EnemyCombatCard.Mesmerize);
                            enemyCombatCards.Add(EnemyCombatCard.Strength);
                            break;
                    }
                    break;
                case Opponent.NewVampire:
                    enemyCombatCards.Add(EnemyCombatCard.Claws);
                    enemyCombatCards.Add(EnemyCombatCard.Dodge);
                    switch (game.TimeOfDay)
                    {
                        case TimeOfDay.Twilight:
                        case TimeOfDay.Midnight:
                        case TimeOfDay.SmallHours:
                            enemyCombatCards.Add(EnemyCombatCard.Fangs);
                            enemyCombatCards.Add(EnemyCombatCard.Mesmerize);
                            enemyCombatCards.Add(EnemyCombatCard.Strength);
                            break;
                    }
                    break;
            }
            var firstRound = true;
            var repelled = false;
            var continueCombat = true;
            var sisterAgathaInEffect = (opponent == Opponent.Dracula && game.HunterAlly != null && game.HunterAlly.Event == Event.SisterAgatha);
            var enemyCombatCardChosen = EnemyCombatCard.None;
            var enemyTarget = Hunter.Nobody;
            while (continueCombat)
            {
                foreach (var h in huntersInvolved)
                {
                    var itemUsedByHunterLastRound = h.LastCombatCardChosen;
                    do
                    {
                        Console.WriteLine("Which combat card is {0} using this round?", h.Hunter.Name());
                        h.LastCombatCardChosen = Enumerations.GetItemFromString(Console.ReadLine());
                    } while (h.LastCombatCardChosen == Item.None);

                    if (basicHunterCombatCards.Find(card => card.Item == h.LastCombatCardChosen) == null &&
                        h.ItemsKnownToDracula.Find(item => item.Item == h.LastCombatCardChosen) == null)
                    {
                        var itemDraculaNowKnowsAbout = game.ItemDeck.Find(card => card.Item == h.LastCombatCardChosen);
                        h.ItemsKnownToDracula.Add(itemDraculaNowKnowsAbout);
                        game.ItemDeck.Remove(itemDraculaNowKnowsAbout);
                    }
                    else if (itemUsedByHunterLastRound == h.LastCombatCardChosen && basicHunterCombatCards.Find(card => card.Item == h.LastCombatCardChosen) == null)
                    {
                        var itemDraculaAlreadyKnewAbout =
                            h.ItemsKnownToDracula.Find(card => card.Item == itemUsedByHunterLastRound);
                        if (itemDraculaAlreadyKnewAbout != null)
                        {
                            h.ItemsKnownToDracula.Remove(itemDraculaAlreadyKnewAbout);
                        }
                        if (h.ItemsKnownToDracula.Find(card => card.Item == itemUsedByHunterLastRound) == null)
                        {
                            var itemDraculaNowKnowsAbout =
                                game.ItemDeck.Find(card => card.Item == h.LastCombatCardChosen);
                            h.ItemsKnownToDracula.Add(itemDraculaNowKnowsAbout);
                            game.ItemDeck.Remove(itemDraculaNowKnowsAbout);
                        }
                        h.ItemsKnownToDracula.Add(itemDraculaAlreadyKnewAbout);
                    }
                }
                enemyCombatCardChosen = logic.ChooseCombatCardAndTarget(game, huntersInvolved, enemyCombatCards,
                    firstRound, out enemyTarget, enemyCombatCardChosen, repelled, sisterAgathaInEffect,
                    roundsWithoutEscaping);
                roundsWithoutEscaping--;
                var bloodCost = false;
                if (sisterAgathaInEffect &&
                    (enemyCombatCardChosen == EnemyCombatCard.Fangs ||
                     enemyCombatCardChosen == EnemyCombatCard.EscapeBat ||
                     enemyCombatCardChosen == EnemyCombatCard.EscapeMan ||
                     enemyCombatCardChosen == EnemyCombatCard.EscapeMist))
                {
                    game.Dracula.AdjustBlood(-2);
                    bloodCost = true;
                }
                Console.WriteLine("{0} used {1} against {2}{3}", opponent.Name(), enemyCombatCardChosen.Name(),
                    enemyTarget.Name(), bloodCost ? " at a cost of 2 blood" : "");
                var line = "";
                var index = 0;
                do
                {
                    Console.WriteLine("What was the outcome? 1= Continue 2= Repel 3= Item destroyed or Event discarded 4= End");
                    line = Console.ReadLine();
                    if (int.TryParse(line, out index))
                    {
                        if (index < 1 || index > 4)
                        {
                            index = 0;
                        }
                    }
                } while (index == 0);
                switch (index)
                {
                    case 1: break;
                    case 2:
                        repelled = true; break;
                    case 3:
                        HunterPlayer hunterToDiscardCard = null;
                        if (huntersInvolved.Count == 1)
                        {
                            hunterToDiscardCard = huntersInvolved.First();
                        }
                        else
                        {
                            var hunterIndex = 0;
                            do
                            {
                                Console.Write("Whose card is being discarded? ");
                                foreach (var h in huntersInvolved)
                                {
                                    Console.Write("{0}= {1} ", (int)h.Hunter, h.Hunter.Name());
                                }
                                line = Console.ReadLine();
                                if (int.TryParse(line, out hunterIndex))
                                {
                                    foreach (var h in huntersInvolved)
                                    {
                                        if ((int)h.Hunter == hunterIndex)
                                        {
                                            hunterToDiscardCard = h;
                                            break;
                                        }
                                    }
                                }
                            } while (hunterToDiscardCard == null);
                        }
                        var itemDestroyed = Item.None;
                        var eventDiscarded = Event.None;
                        while (itemDestroyed == Item.None && eventDiscarded == Event.None)
                        {
                            Console.WriteLine("What card was discarded?");
                            line = Console.ReadLine();
                            itemDestroyed = Enumerations.GetItemFromString(line);
                            eventDiscarded = Enumerations.GetEventFromString(line);
                        }
                        if (itemDestroyed != Item.None)
                        {
                            hunterToDiscardCard.DiscardItem(game, itemDestroyed);
                        }
                        else if (eventDiscarded != Event.None)
                        {
                            hunterToDiscardCard.DiscardEvent(game, eventDiscarded);
                        }
                        break;
                    case 4:
                        continueCombat = false; break;
                }
                firstRound = false;
            }
            var health = -1;
            foreach (var h in huntersInvolved)
            {
                Console.WriteLine("How much health does {0} have now?", h.Hunter.Name());
                do
                {
                    if (int.TryParse(Console.ReadLine(), out health))
                    {
                        health = Math.Max(0, Math.Min(h.MaxHealth, health));
                        Console.WriteLine(health);
                    }
                } while (health == -1);
                h.AdjustHealth(health - h.Health);
            }
            if (opponent == Opponent.Dracula)
            {
                Console.WriteLine("How much blood does Dracula have now?");
                do
                {
                    if (int.TryParse(Console.ReadLine(), out health))
                    {
                        health = Math.Max(0, Math.Min(15, health));
                        Console.WriteLine(health);
                    }
                } while (health == -1);
                game.Dracula.AdjustBlood(health - game.Dracula.Blood);
            }
            Console.WriteLine("Did {0} win? (An end result is a no)", huntersInvolved.Count() > 1 ? "the Hunters" : huntersInvolved.First().Hunter.Name());
            string input;
            do
            {
                input = Console.ReadLine();
            } while (!"yes".StartsWith(input.ToLower()) && !"no".StartsWith(input.ToLower()));
            if ("yes".StartsWith(input.ToLower()))
            {
                if (opponent == Opponent.NewVampire)
                {
                    game.AdjustVampires(-1);
                }
                Console.WriteLine("Don't forget to register any cards discarded, such as Great Strength used to prevent health loss, Events due to enemy Knife wounds, Items consumed, etc.");
                return true;
            }
            if (opponent == Opponent.Dracula)
            {
                switch (enemyCombatCardChosen)
                {
                    case EnemyCombatCard.Mesmerize:
                        Console.WriteLine("{0} is bitten and must discard all Items!", enemyTarget.Name());
                        if (!HunterPlayingGreatStrengthToCancelBite(game, enemyTarget, logic))
                        {
                            game.Hunters[(int)enemyTarget].AdjustBites(1);
                        }
                        while (game.Hunters[(int)enemyTarget].ItemCount > 0)
                        {
                            var line = "";
                            var itemDiscarded = Item.None;
                            do
                            {
                                Console.WriteLine("What is the name of the Item being discarded?");
                                line = Console.ReadLine();
                                itemDiscarded = Enumerations.GetItemFromString(line);
                            } while (itemDiscarded == Item.None);
                            game.Hunters[(int)enemyTarget].DiscardItem(game, itemDiscarded);
                        }
                        CheckForHunterDeath(game); break;
                    case EnemyCombatCard.Fangs:
                        Console.WriteLine("{0} is bitten!", enemyTarget.Name());
                        if (!HunterPlayingGreatStrengthToCancelBite(game, enemyTarget, logic))
                        {
                            game.Hunters[(int)enemyTarget].AdjustBites(1);
                        }
                        CheckForHunterDeath(game);
                        goto case EnemyCombatCard.EscapeBat;
                    case EnemyCombatCard.EscapeBat:
                        Console.WriteLine("Dracula escaped in the form of a bat");
                        Location destination = logic.ChooseEscapeAsBatDestination(game);
                        game.Dracula.EscapeAsBat(game, destination);
                        logic.AddEscapeAsBatCardToAllTrails(game);
                        int position = -1;
                        if (game.HuntersAt(destination).Any() || destination == Location.CastleDracula)
                        {
                            position = game.Dracula.RevealCardInTrailWithLocation(destination);
                            logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, destination, position);
                        }
                        else
                        {
                            logic.EliminateTrailsThatHaveHuntersAtPosition(game, game.Dracula.CurrentLocationPosition);
                        }
                        break;
                }
            }
            Console.WriteLine("Don't forget to register any cards discarded, such as Great Strength used to prevent health loss or Items due to enemy Knife wounds");
            foreach (HunterPlayer h in huntersInvolved)
            {
                h.LastCombatCardChosen = Item.None;
            }
            return false;
        }
Example #23
0
 /// <summary>
 /// Determines if Dracula is playing Devilish Power to cancel an Event played by a Hunter
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="eventBeingPlayedNow">The Event being played now</param>
 /// <param name="eventInitiallyPlayed">The Event initially played at the beginning of this exchange</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if Dracula successfully plays Devilish Power</returns>
 private static bool DraculaIsPlayingDevilishPowerToCancelEvent(GameState game, Event eventBeingPlayedNow,
     Event eventInitiallyPlayed, DecisionMaker logic, HunterPlayer hunterPlayingEvent)
 {
     if (logic.ChooseToCancelEventWithDevilishPower(game, eventBeingPlayedNow, eventInitiallyPlayed, hunterPlayingEvent))
     {
         Console.WriteLine("Dracula is playing Devilish Power to cancel {0}", eventBeingPlayedNow.Name());
         game.Dracula.DiscardEvent(Event.DevilishPower, game.EventDiscard);
         if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.DevilishPower, eventInitiallyPlayed, logic) > 0)
         {
             return false;
         }
         return true;
     }
     return false;
 }
Example #24
0
 /// <summary>Checks if the sixth card in Dracula's Trail should be revealed by Jonathan Harker</summary>
 /// <param name="game">The GameState</param>
 private static void CheckForJonathanHarker(GameState game, DecisionMaker logic)
 {
     if (game.HunterAlly != null && game.HunterAlly.Event == Event.JonathanHarker && game.Dracula.Trail[5] != null)
     {
         game.Dracula.RevealCardAtPosition(5);
         if (game.Dracula.Trail[5].DraculaCards.First().Location != Location.Nowhere)
         {
             logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, game.Dracula.Trail[5].DraculaCards.First().Location, 5);
         }
     }
 }
Example #25
0
 /// <summary>
 /// Determines if Dracula is playing Rage against a Hunter at the start of a combat
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="huntersInvolved">The list of Hunters involved in the combat</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if Dracula successfully plays Rage</returns>
 private static Hunter DraculaIsPlayingRageAgainstHunter(GameState game, List<HunterPlayer> huntersInvolved,
     DecisionMaker logic)
 {
     var rageTarget = logic.ChooseToPlayRage(game, huntersInvolved);
     if (rageTarget != Hunter.Nobody)
     {
         Console.WriteLine("Dracula is playing Rage against {0}", rageTarget.Name());
         game.Dracula.DiscardEvent(Event.Rage, game.EventDiscard);
         if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.Rage, Event.Rage, logic) > 0)
         {
             Console.WriteLine("Rage cancelled");
             return Hunter.Nobody;
         }
         return rageTarget;
     }
     return Hunter.Nobody;
 }
Example #26
0
 /// <summary>
 /// Resolves an Encounter of Desecrated Soil for a group of Hunters
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="huntersInvolved">A list of Hunters involved in the Encounter</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if the Hunters can continue resolving Encounters</returns>
 private static bool ResolveDesecratedSoil(GameState game, List<Hunter> huntersInvolved, DecisionMaker logic)
 {
     Console.WriteLine("Draw an Event card. If it is a Hunter card, name it, otherwise type \"take\"");
     var line = "";
     var eventDrawn = Event.None;
     do
     {
         line = Console.ReadLine();
         eventDrawn = Enumerations.GetEventFromString(line);
     } while (eventDrawn == Event.None && !"take".StartsWith(line.ToLower()));
     if ("take".StartsWith(line.ToLower()))
     {
         var eventPlayedByDracula = game.Dracula.TakeEvent(game.EventDeck, game.EventDiscard);
         PlayImmediatelyDraculaCard(game, eventPlayedByDracula, logic);
         if (game.Dracula.EventHand.Count() > game.Dracula.EventHandSize)
         {
             Console.WriteLine("Dracula disacarded {0}", game.Dracula.DiscardEvent(logic.ChooseEventToDiscard(game), game.EventDiscard).Name());
         }
     }
     else
     {
         var eventCardDiscarded = game.EventDeck.Find(card => card.Event == eventDrawn);
         if (eventCardDiscarded != null)
         {
             Console.WriteLine("{0} discarded", eventDrawn);
             game.EventDeck.Remove(eventCardDiscarded);
             game.EventDiscard.Add(eventCardDiscarded);
         }
     }
     return true;
 }
Example #27
0
 /// <summary>
 /// Checks if Dracula is playing Sensationalist Press to prevent a Location card from being revealed
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="location">The Location being revealed</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if Dracula successfully plays Sensationalist Press</returns>
 private static bool DraculaIsPlayingSensationalistPressToPreventRevealingLocation(GameState game,
     Location location, DecisionMaker logic)
 {
     if (logic.ChooseToPlaySensationalistPress(game, location))
     {
         Console.WriteLine("Dracula is playing Sensationalist Press");
         game.Dracula.DiscardEvent(Event.SensationalistPress, game.EventDiscard);
         if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.SensationalistPress, Event.SensationalistPress, logic) > 0)
         {
             Console.WriteLine("Sensationalist Press cancelled");
             return false;
         }
         return true;
     }
     return false;
 }
Example #28
0
        /// <summary>
        /// Resolves an Encounter on a group of Hunters
        /// </summary>
        /// <param name="game">The GameState</param>
        /// <param name="encounterTileBeingResolved">The Encounter being resolved</param>
        /// <param name="trailIndex">The Index of the Trail slot (0-5), or Catacombs slot (6-8) where the Encounter is being resolved, or -1 if being resolved from Dracula's hand</param>
        /// <returns>True if the Hunters can continue resolving Encounters</returns>
        private static bool ResolveEncounterTile(GameState game, EncounterTile encounterTileBeingResolved,
            List<Hunter> huntersInvolved, DecisionMaker logic, int trailIndex)
        {
            Console.WriteLine("Resolving {0} with {1}{2}", encounterTileBeingResolved.Encounter.Name(),
                huntersInvolved.First().Name(), huntersInvolved.Count() > 1 ? " and his group" : "");
            var continueEncounters = true;
            var discardEncounterTile = true;
            foreach (var h in huntersInvolved)
            {
                Console.WriteLine("Will {0} play Secret Weapon?", h.Name());
                var line = "";
                do
                {
                    line = Console.ReadLine();
                } while (!"yes".StartsWith(line.ToLower()) && !"no".StartsWith(line.ToLower()));
                if ("yes".StartsWith(line.ToLower()))
                {
                    game.Hunters[(int)h].DiscardEvent(game, Event.SecretWeapon);
                    if (DraculaIsPlayingDevilishPowerToCancelEvent(game, Event.SecretWeapon, Event.SecretWeapon, logic, game.Hunters[(int)h]))
                    {
                        Console.WriteLine("Secret Weapon cancelled");
                    }
                    else
                    {
                        DiscardUnknownItemFromHunter(game, game.Hunters[(int)h]);
                        Console.WriteLine("What is the name of the Item being retrieved from the discard pile?");
                        var itemRetrieved = Item.None;
                        while (itemRetrieved == Item.None)
                        {
                            itemRetrieved = Enumerations.GetItemFromString(Console.ReadLine());
                        }
                        var itemCardRetrieved = game.ItemDiscard.Find(card => card.Item == itemRetrieved);
                        game.ItemDiscard.Remove(itemCardRetrieved);
                        game.Hunters[(int)h].ItemsKnownToDracula.Add(itemCardRetrieved);
                        game.Hunters[(int)h].DrawItemCard();
                    }
                }
            }

            foreach (var h in huntersInvolved)
            {
                Console.WriteLine("Will {0} play Forewarned?", h.Name());
                var line = "";
                do
                {
                    line = Console.ReadLine();
                } while (!"yes".StartsWith(line.ToLower()) && !"no".StartsWith(line.ToLower()));
                if ("yes".StartsWith(line.ToLower()))
                {
                    game.Hunters[(int)h].DiscardEvent(game, Event.Forewarned);
                    if (DraculaIsPlayingDevilishPowerToCancelEvent(game, Event.SecretWeapon, Event.SecretWeapon, logic, game.Hunters[(int)h]))
                    {
                        Console.WriteLine("Forewarned cancelled");
                    }
                    else
                    {
                        Console.WriteLine("Encounter cancelled");
                        game.EncounterPool.Add(encounterTileBeingResolved);
                        if (trailIndex > -1)
                        {
                            game.Dracula.Trail[trailIndex].EncounterTiles.Remove(encounterTileBeingResolved);
                        }
                        return true;
                    }
                }
            }

            switch (encounterTileBeingResolved.Encounter)
            {
                case Encounter.Ambush:
                    continueEncounters = ResolveAmbush(game, huntersInvolved, logic); break;
                case Encounter.Assassin:
                    continueEncounters = ResolveAssassin(game, huntersInvolved, logic); break;
                case Encounter.Bats:
                    discardEncounterTile = false;
                    game.Hunters[(int)huntersInvolved.First()].EncountersInFrontOfPlayer.Add(encounterTileBeingResolved);
                    if (trailIndex > -1)
                    {
                        game.Dracula.Trail[trailIndex].EncounterTiles.Remove(encounterTileBeingResolved);
                    }
                    else
                    {
                        game.Dracula.EncounterHand.Remove(encounterTileBeingResolved);
                    }
                    return false;
                case Encounter.DesecratedSoil:
                    continueEncounters = ResolveDesecratedSoil(game, huntersInvolved, logic); break;
                case Encounter.Fog:
                    discardEncounterTile = false;
                    game.Hunters[(int)huntersInvolved.First()].EncountersInFrontOfPlayer.Add(encounterTileBeingResolved);
                    if (trailIndex > -1)
                    {
                        game.Dracula.Trail[trailIndex].EncounterTiles.Remove(encounterTileBeingResolved);
                    }
                    else
                    {
                        game.Dracula.EncounterHand.Remove(encounterTileBeingResolved);
                    }
                    return false;
                case Encounter.MinionWithKnife:
                    continueEncounters = ResolveMinionWithKnife(game, huntersInvolved, logic); break;
                case Encounter.MinionWithKnifeAndPistol:
                    continueEncounters = ResolveMinionWithKnifeAndPistol(game, huntersInvolved, logic); break;
                case Encounter.MinionWithKnifeAndRifle:
                    continueEncounters = ResolveMinionWithKnifeAndRifle(game, huntersInvolved, logic); break;
                case Encounter.Hoax:
                    continueEncounters = ResolveHoax(game, huntersInvolved); break;
                case Encounter.Lightning:
                    continueEncounters = ResolveLightning(game, huntersInvolved); break;
                case Encounter.Peasants:
                    continueEncounters = ResolvePeasants(game, huntersInvolved); break;
                case Encounter.Plague:
                    continueEncounters = ResolvePlague(game, huntersInvolved); break;
                case Encounter.Rats:
                    continueEncounters = ResolveRats(game, huntersInvolved); break;
                case Encounter.Saboteur:
                    continueEncounters = ResolveSaboteur(game, huntersInvolved); break;
                case Encounter.Spy:
                    continueEncounters = ResolveSpy(game, huntersInvolved); break;
                case Encounter.Thief:
                    continueEncounters = ResolveThief(game, huntersInvolved, logic); break;
                case Encounter.NewVampire:
                    var seductionPlayed = false;
                    continueEncounters = ResolveNewVampire(game, huntersInvolved, logic, out discardEncounterTile,
                        out seductionPlayed);
                    if (seductionPlayed)
                    {
                        game.Dracula.EncounterHand.Add(encounterTileBeingResolved);
                        while (game.Dracula.EncounterHand.Count() > game.Dracula.EncounterHandSize)
                        {
                            game.Dracula.DiscardEncounterTile(game,
                                logic.ChooseEncounterTileToDiscardFromEncounterHand(game));
                        }
                        if (trailIndex > -1)
                        {
                            game.Dracula.Trail[trailIndex].EncounterTiles.Remove(encounterTileBeingResolved);
                        }
                        else
                        {
                            game.Dracula.EncounterHand.Remove(encounterTileBeingResolved);
                        }
                    }
                    break;
                case Encounter.Wolves:
                    continueEncounters = ResolveWolves(game, huntersInvolved); break;
                default:
                    return false;
            }
            if (discardEncounterTile)
            {
                game.EncounterPool.Add(encounterTileBeingResolved);
                if (trailIndex > -1)
                {
                    game.Dracula.Trail[trailIndex].EncounterTiles.Remove(encounterTileBeingResolved);
                }
                else
                {
                    game.Dracula.EncounterHand.Remove(encounterTileBeingResolved);
                }
            }
            return continueEncounters;
        }
Example #29
0
 /// <summary>
 /// Determines if Dracula is playing Wild Horses at the start of a combat
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if Dracula successfully plays Wild Horses</returns>
 private static bool DraculaIsPlayingWildHorses(GameState game, DecisionMaker logic)
 {
     if (logic.ChooseToPlayWildHorses(game))
     {
         Console.WriteLine("Dracula is playing Wild Horses to control your movement");
         game.Dracula.DiscardEvent(Event.WildHorses, game.EventDiscard);
         if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.WildHorses, Event.WildHorses, logic) > 0)
         {
             Console.WriteLine("Wild Horses cancelled");
             return false;
         }
         return true;
     }
     return false;
 }
Example #30
0
 /// <summary>
 /// Resolves the Hypnosis 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 PlayHypnosis(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     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:
         case 2:
             Console.WriteLine("No effect"); break;
         case 3:
         case 4:
         case 5:
         case 6:
             if (DraculaIsPlayingSensationalistPressToPreventRevealingLocation(game, game.Dracula.CurrentLocation, logic))
             {
                 Console.WriteLine("Dracula prevented a location from being revealed");
             }
             else
             {
                 game.Dracula.RevealCardInTrailWithLocation(game.Dracula.CurrentLocation);
                 logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, game.Dracula.CurrentLocation, game.Dracula.CurrentLocationPosition);
             }
             game.Dracula.RevealAllVampires();
             var power = Power.None;
             var advanceMoveLocation = logic.ChooseDestinationAndPower(game, out power);
             if (advanceMoveLocation == Location.Nowhere && power == Power.None)
             {
                 Console.WriteLine("Dracula will have no legal moves next turn");
             }
             else
             {
                 game.Dracula.AdvanceMoveLocation = advanceMoveLocation;
                 game.Dracula.AdvanceMovePower = power;
                 Console.WriteLine("Dracula's next move will be to {0}{1}", game.Dracula.AdvanceMoveLocation,
                     power == Power.None ? "" : " using " + game.Dracula.AdvanceMovePower.Name());
             }
             break;
     }
 }