示例#1
0
 /// <summary>
 /// Resolves a Hunter using an Item outside of combat
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="itemName">The string to be converted to the Item being used</param>
 /// <param name="hunterIndex">The string to be converted to the Hunter using the Item</param>
 private static void UseItem(GameState game, string itemName, string hunterIndex)
 {
     var index = 0;
     var hunterUsingItem = Hunter.Nobody;
     if (int.TryParse(hunterIndex, out index))
     {
         hunterUsingItem = game.GetHunterFromInt(index);
     }
     var line = "";
     while (hunterUsingItem == Hunter.Nobody && index != -1)
     {
         Console.WriteLine("Who is using an Item? {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)
             {
                 Console.WriteLine("Cancelled");
                 return;
             }
             hunterUsingItem = game.GetHunterFromInt(index);
             Console.WriteLine(hunterUsingItem.Name());
         }
         else
         {
             Console.WriteLine("I didn't understand that");
         }
     }
     var itemBeingUsed = Enumerations.GetItemFromString(itemName);
     while (itemBeingUsed == Item.None && line.ToLower() != "cancel")
     {
         Console.WriteLine("What is the name of the Item being used?");
         line = Console.ReadLine();
         itemBeingUsed = Enumerations.GetItemFromString(line);
     }
     if (line.ToLower() == "cancel")
     {
         Console.WriteLine("Cancelled");
         return;
     }
     switch (itemBeingUsed)
     {
         case Item.Dogs:
             Console.WriteLine("Dogs is now face up in front of {0}", hunterUsingItem.Name());
             game.Hunters[(int)hunterUsingItem].SetDogsFaceUp(true);
             AddItemCardToDraculaKnownCardsIfNotAlreadyKnown(game, game.Hunters[(int)hunterUsingItem], Item.Dogs); break;
         case Item.LocalRumors:
             var trailIndex = -1;
             Console.WriteLine(
                 "In which trail position (1-6) or Catacombs position (7-9) would you like to reveal an Encounter?");
             while (trailIndex == -1)
             {
                 if (int.TryParse(Console.ReadLine(), out trailIndex))
                 {
                     if (trailIndex < 1 || trailIndex > 9)
                     {
                         trailIndex = -1;
                     }
                 }
             }
             if (trailIndex < 7)
             {
                 game.Dracula.RevealEncountersAtPositionInTrail(trailIndex - 1);
             }
             else
             {
                 if (game.Dracula.Catacombs[trailIndex - 7] != null &&
                     game.Dracula.Catacombs[trailIndex - 7].EncounterTiles.Count() > 1)
                 {
                     var encounterIndex = -1;
                     while (encounterIndex == -1)
                     {
                         Console.WriteLine("Which Encounter would you like to reveal? 1 or 2");
                         if (int.TryParse(Console.ReadLine(), out encounterIndex))
                         {
                             if (encounterIndex < 1 || encounterIndex > 2)
                             {
                                 encounterIndex = -1;
                             }
                         }
                     }
                     game.Dracula.RevealEncounterAtPositionInTrail(game, trailIndex - 1, encounterIndex - 1);
                 }
                 else
                 {
                     game.Dracula.RevealEncountersAtPositionInTrail(trailIndex - 1);
                 }
             }
             game.Hunters[(int)hunterUsingItem].DiscardItem(game, Item.LocalRumors);
             DrawGameState(game); break;
         case Item.HolyWater:
             UseHolyWaterOnHunter(game, hunterUsingItem);
             game.Hunters[(int)hunterUsingItem].DiscardItem(game, Item.HolyWater); break;
         case Item.FastHorse:
             Console.WriteLine("{0} may travel two roads this turn", hunterUsingItem.Name());
             game.Hunters[(int)hunterUsingItem].DiscardItem(game, Item.FastHorse); break;
         case Item.HeavenlyHost:
             Console.WriteLine("Heavenly Host placed in {0}",
                 game.Hunters[(int)hunterUsingItem].CurrentLocation.Name());
             PlaceHeavenlyHostIn(game, game.Hunters[(int)hunterUsingItem].CurrentLocation);
             game.Hunters[(int)hunterUsingItem].DiscardItem(game, Item.HeavenlyHost); break;
         default:
             Console.WriteLine("It is not appropriate to use {0} at this time", itemBeingUsed.Name()); break;
     }
     CheckForCardsRevealedForBeingBitten(game);
 }
示例#2
0
 /// <summary>
 /// Adds 1 to the count of cards of the given type to the given Hunter
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="cardType">Item or Event</param>
 /// <param name="hunterIndex">A string to be converted to the Hunter drawing the card</param>
 private static void DrawCard(GameState game, string cardType, string hunterIndex)
 {
     var index = 0;
     var hunterToDraw = Hunter.Nobody;
     if (int.TryParse(hunterIndex, out index))
     {
         hunterToDraw = game.GetHunterFromInt(index);
     }
     var line = "";
     while (hunterToDraw == Hunter.Nobody && index != -1)
     {
         Console.WriteLine("Who is drawing a card? {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)
             {
                 Console.WriteLine("Cancelled");
                 return;
             }
             hunterToDraw = game.GetHunterFromInt(index);
             Console.WriteLine(hunterToDraw.Name());
         }
         else
         {
             Console.WriteLine("I didn't understand that");
         }
     }
     do
     {
         switch (cardType)
         {
             case "i":
             case "item":
                 game.Hunters[index].DrawItemCard();
                 Console.WriteLine("{0} drew an Item card, up to {1}", hunterToDraw.Name(), game.Hunters[index].ItemCount); return;
             case "e":
             case "event":
                 game.Hunters[index].DrawEventCard();
                 Console.WriteLine("{0} drew an Event card, up to {1}", hunterToDraw.Name(), game.Hunters[index].EventCount); return;
             default:
                 Console.WriteLine("What type of card is {0} drawing?", hunterToDraw.Name());
                 cardType = Console.ReadLine().ToLower(); break;
         }
     } while (cardType != "cancel");
     Console.WriteLine("Cancelled");
 }
示例#3
0
        private static void TradeCardsBetweenHunters(GameState game, string firstHunterIndex, string secondHunterIndex)
        {
            var firstHunterTrading = Hunter.Nobody;
            int index = -2;
            if (int.TryParse(firstHunterIndex, out index))
            {
                firstHunterTrading = game.GetHunterFromInt(index);
            }
            var line = "";
            while (firstHunterTrading == Hunter.Nobody && index != -1)
            {
                Console.WriteLine("Who is trading? {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;
                    }
                    firstHunterTrading = game.GetHunterFromInt(index);
                    Console.WriteLine(firstHunterTrading.Name());
                }
                else
                {
                    Console.WriteLine("I didn't understand that");
                }
            }
            var secondHunterTrading = Hunter.Nobody;
            index = -2;
            if (int.TryParse(secondHunterIndex, out index))
            {
                secondHunterTrading = game.GetHunterFromInt(index);
            }
            line = "";
            while (secondHunterTrading == Hunter.Nobody && index != -1)
            {
                Console.WriteLine("Who else is trading? {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;
                    }
                    secondHunterTrading = game.GetHunterFromInt(index);
                    Console.WriteLine(secondHunterTrading.Name());
                }
                else
                {
                    Console.WriteLine("I didn't understand that");
                }
            }
            line = "";
            int answer = -1;
            while (answer < 0)
            {
                Console.WriteLine("How many Items does {0} now have?", firstHunterTrading.Name());
                Int32.TryParse(line, out answer);
            }
            game.Hunters[(int)firstHunterTrading].SetItemCount(answer);
            line = "";
            answer = -1;
            while (answer < 0)
            {
                Console.WriteLine("How many Items does {0} now have?", secondHunterTrading.Name());
                Int32.TryParse(line, out answer);
            }
            game.Hunters[(int)secondHunterTrading].SetItemCount(answer);
            var allKnownItems = new List<ItemCard>();
            allKnownItems.AddRange(game.Hunters[(int)firstHunterTrading].ItemsKnownToDracula);
            allKnownItems.AddRange(game.Hunters[(int)secondHunterTrading].ItemsKnownToDracula);
            var allPartiallyKnownItems = new List<ItemCard>();
            allPartiallyKnownItems.AddRange(game.Hunters[(int)firstHunterTrading].ItemsPartiallyKnownToDracula);
            allPartiallyKnownItems.AddRange(game.Hunters[(int)secondHunterTrading].ItemsPartiallyKnownToDracula);
            var allItemChances = new List<float>();
            allItemChances.AddRange(game.Hunters[(int)firstHunterTrading].PartiallyKnownItemChances);
            allItemChances.AddRange(game.Hunters[(int)secondHunterTrading].PartiallyKnownItemChances);
            var newAllPartiallyKnownItems = new List<ItemCard>();
            var newAllItemChances = new List<float>();
            index = -1;
            foreach (var i in allPartiallyKnownItems)
            {
                index++;
                if (!newAllPartiallyKnownItems.Any(card => card.Item == i.Item))
                {
                    float newChance = 0F;
                    for (int j = index; j < allPartiallyKnownItems.Count(); j++)
                    {
                        if (i.Item == allPartiallyKnownItems[j].Item)
                        {
                            newChance += allItemChances[j];
                        }
                    }
                    newAllPartiallyKnownItems.Add(i);
                    newAllItemChances.Add(newChance);
                }
            }
            allPartiallyKnownItems = newAllPartiallyKnownItems;
            allItemChances = newAllItemChances;

            if (game.Hunters[(int)firstHunterTrading].ItemCount == 0)
            {
                game.Hunters[(int)firstHunterTrading].ItemsKnownToDracula.Clear();
                game.Hunters[(int)firstHunterTrading].ItemsPartiallyKnownToDracula.Clear();
                game.Hunters[(int)firstHunterTrading].PartiallyKnownItemChances.Clear();
                game.Hunters[(int)secondHunterTrading].ItemsKnownToDracula = allKnownItems;
                game.Hunters[(int)secondHunterTrading].ItemsPartiallyKnownToDracula = allPartiallyKnownItems;
                game.Hunters[(int)secondHunterTrading].PartiallyKnownItemChances = allItemChances;
            }
            else if (game.Hunters[(int)secondHunterTrading].ItemCount == 0)
            {
                game.Hunters[(int)secondHunterTrading].ItemsKnownToDracula.Clear();
                game.Hunters[(int)secondHunterTrading].ItemsPartiallyKnownToDracula.Clear();
                game.Hunters[(int)secondHunterTrading].PartiallyKnownItemChances.Clear();
                game.Hunters[(int)firstHunterTrading].ItemsKnownToDracula = allKnownItems;
                game.Hunters[(int)firstHunterTrading].ItemsPartiallyKnownToDracula = allPartiallyKnownItems;
                game.Hunters[(int)firstHunterTrading].PartiallyKnownItemChances = allItemChances;
            }
            else
            {
                game.Hunters[(int)firstHunterTrading].ItemsKnownToDracula.Clear();
                game.Hunters[(int)secondHunterTrading].ItemsKnownToDracula.Clear();
                game.Hunters[(int)firstHunterTrading].ItemsPartiallyKnownToDracula.Clear();
                game.Hunters[(int)secondHunterTrading].ItemsPartiallyKnownToDracula.Clear();
                game.Hunters[(int)firstHunterTrading].ItemsPartiallyKnownToDracula.AddRange(allKnownItems);
                game.Hunters[(int)secondHunterTrading].ItemsPartiallyKnownToDracula.AddRange(allKnownItems);
                foreach (var i in allKnownItems)
                {
                    game.Hunters[(int)firstHunterTrading].PartiallyKnownItemChances.Add(0.5F);
                    game.Hunters[(int)secondHunterTrading].PartiallyKnownItemChances.Add(0.5F);
                }
                foreach (var f in allItemChances)
                {
                    game.Hunters[(int)firstHunterTrading].PartiallyKnownItemChances.Add(0.5F * f);
                    game.Hunters[(int)secondHunterTrading].PartiallyKnownItemChances.Add(0.5F * f);
                }

            }
            index = -1;
            foreach (var i in game.Hunters[(int)firstHunterTrading].ItemsPartiallyKnownToDracula)
            {
                index++;
                while (game.Hunters[(int)firstHunterTrading].PartiallyKnownItemChances[index] >= 1F)
                {
                    game.Hunters[(int)firstHunterTrading].ItemsKnownToDracula.Add(i);
                    game.Hunters[(int)firstHunterTrading].PartiallyKnownItemChances[index]--;
                }
            }
            index = -1;
            foreach (var f in game.Hunters[(int)firstHunterTrading].PartiallyKnownItemChances)
            {
                index++;
                if (f == 0)
                {
                    game.Hunters[(int)firstHunterTrading].ItemsPartiallyKnownToDracula[index] = null;
                }
            }
            game.Hunters[(int)firstHunterTrading].ItemsPartiallyKnownToDracula.RemoveAll(i => i == null);
            game.Hunters[(int)firstHunterTrading].PartiallyKnownItemChances.RemoveAll(f => f == 0);
            index = -1;
            foreach (var i in game.Hunters[(int)secondHunterTrading].ItemsPartiallyKnownToDracula)
            {
                index++;
                while (game.Hunters[(int)secondHunterTrading].PartiallyKnownItemChances[index] >= 1F)
                {
                    game.Hunters[(int)secondHunterTrading].ItemsKnownToDracula.Add(i);
                    game.Hunters[(int)secondHunterTrading].PartiallyKnownItemChances[index]--;
                }
            }
            index = -1;
            foreach (var f in game.Hunters[(int)secondHunterTrading].PartiallyKnownItemChances)
            {
                index++;
                if (f == 0)
                {
                    game.Hunters[(int)secondHunterTrading].ItemsPartiallyKnownToDracula[index] = null;
                }
            }
            game.Hunters[(int)secondHunterTrading].ItemsPartiallyKnownToDracula.RemoveAll(i => i == null);
            game.Hunters[(int)secondHunterTrading].PartiallyKnownItemChances.RemoveAll(f => f == 0);
            CheckForDiscardRequired(game);
        }
示例#4
0
 private static void UseHolyWaterAtHospital(GameState game, string hunterIndex)
 {
     var hunterUsingHolyWater = Hunter.Nobody;
     int index = -2;
     if (int.TryParse(hunterIndex, out index))
     {
         hunterUsingHolyWater = game.GetHunterFromInt(index);
     }
     var line = "";
     while (hunterUsingHolyWater == Hunter.Nobody && index != -1)
     {
         Console.WriteLine("Who is using the Holy Water font? {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;
             }
             hunterUsingHolyWater = game.GetHunterFromInt(index);
             Console.WriteLine(hunterUsingHolyWater.Name());
         }
         else
         {
             Console.WriteLine("I didn't understand that");
         }
     }
     UseHolyWaterOnHunter(game, hunterUsingHolyWater);
 }
示例#5
0
 /// <summary>
 /// Adds and removes people from the given Hunter's group
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterIndex">A string to be converted to the Hunter with whom to set up a group</param>
 private static void SetupGroup(GameState game, string hunterIndex)
 {
     var hunterFormingGroup = Hunter.Nobody;
     int index;
     if (int.TryParse(hunterIndex, out index))
     {
         hunterFormingGroup = game.GetHunterFromInt(index);
     }
     var line = "";
     while (hunterFormingGroup == Hunter.Nobody && index != -1)
     {
         Console.WriteLine(
             "Who is forming a group? {0}= {1}, {2}= {3}, {4}= {5} (Mina Harker cannot lead a group, -1 to cancel)",
             (int)Hunter.LordGodalming, Hunter.LordGodalming.Name(), (int)Hunter.DrSeward,
             Hunter.DrSeward.Name(), (int)Hunter.VanHelsing, Hunter.VanHelsing.Name());
         line = Console.ReadLine();
         if (int.TryParse(line, out index))
         {
             if (index == -1)
             {
                 Console.WriteLine("Cancelled");
                 return;
             }
             if (index == 4)
             {
                 Console.WriteLine("Mina Harker cannot lead a group, add her to someone else's group instead");
             }
             else
             {
                 hunterFormingGroup = game.GetHunterFromInt(index);
                 Console.WriteLine(hunterFormingGroup.Name());
             }
         }
         else
         {
             Console.WriteLine("I didn't understand that");
         }
     }
     while (index != -1)
     {
         Console.WriteLine("These are the people in {0}'s group:", hunterFormingGroup.Name());
         foreach (var h in game.Hunters[(int)hunterFormingGroup].HuntersInGroup)
         {
             if (h != hunterFormingGroup)
             {
                 Console.WriteLine(h.Name());
             }
         }
         var hunterToAddOrRemove = Hunter.Nobody;
         while (hunterToAddOrRemove == Hunter.Nobody && index != -1)
         {
             Console.WriteLine(
                 "Who is joining or leaving {0}'s group? {1}= {2}, {3}= {4}, {5}= {6} (Lord Godalming must lead any group he is in, -1 to cancel)",
                 hunterFormingGroup.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)
                 {
                     Console.WriteLine("Cancelled");
                     return;
                 }
                 if (index == 1)
                 {
                     Console.WriteLine("Lord Godalming must lead any group he is in");
                 }
                 else
                 {
                     hunterToAddOrRemove = game.GetHunterFromInt(index);
                     Console.WriteLine(hunterFormingGroup.Name());
                 }
             }
             else
             {
                 Console.WriteLine("I didn't understand that");
             }
         }
         if ((int)hunterToAddOrRemove < (int)hunterFormingGroup)
         {
             Console.WriteLine("{0} cannot join {1}'s group, instead add {1} to {0}'s group",
                 hunterToAddOrRemove.Name(), hunterFormingGroup.Name());
         }
         else if (hunterToAddOrRemove == hunterFormingGroup)
         {
             Console.WriteLine("{0} is already in his own group, of course!", hunterFormingGroup.Name());
         }
         else if (game.Hunters[(int)hunterFormingGroup].HuntersInGroup.Contains(hunterToAddOrRemove))
         {
             game.Hunters[(int)hunterFormingGroup].HuntersInGroup.Remove(hunterToAddOrRemove);
         }
         else
         {
             game.Hunters[(int)hunterFormingGroup].HuntersInGroup.Add(hunterToAddOrRemove);
         }
     }
 }
示例#6
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);
 }
示例#7
0
 private static void RestHunter(GameState game, string restingHunterIndex)
 {
     var hunterResting = Hunter.Nobody;
     int index = -2;
     if (int.TryParse(restingHunterIndex, out index))
     {
         hunterResting = game.GetHunterFromInt(index);
     }
     var line = "";
     while (hunterResting == Hunter.Nobody && index != -1)
     {
         Console.WriteLine("Who is resting? {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;
             }
             hunterResting = game.GetHunterFromInt(index);
             Console.WriteLine(hunterResting.Name());
         }
         else
         {
             Console.WriteLine("I didn't understand that");
         }
     }
     game.Hunters[(int)hunterResting].AdjustHealth(2);
     Console.WriteLine("{0} now has {1} health. Use the Draw, Take and Discard commands to draw the Event cards.", hunterResting, game.Hunters[(int)hunterResting].Health);
 }
示例#8
0
        private static void RetrieveCardFromDiscard(GameState game, string cardName, string hunterIndex)
        {
            var index = 0;
            var hunterToRetrieve = Hunter.Nobody;
            if (int.TryParse(hunterIndex, out index) && index > 0 && index < 5)
            {
                hunterToRetrieve = (Hunter)index;
            }
            var line = "";
            while (hunterToRetrieve == Hunter.Nobody && index != -1)
            {
                Console.WriteLine("Who is retrieving a card? {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)
                    {
                        Console.WriteLine("Cancelled");
                        return;
                    }
                    hunterToRetrieve = game.GetHunterFromInt(index);
                    Console.WriteLine(hunterToRetrieve.Name());
                }
                else
                {
                    Console.WriteLine("I didn't understand that");
                }
            }
            var itemToRetrieve = Enumerations.GetItemFromString(cardName);
            var eventToRetrieve = Enumerations.GetEventFromString(cardName);
            while (itemToRetrieve == Item.None && eventToRetrieve == Event.None && line.ToLower() != "cancel")
            {
                Console.WriteLine("What is the name of the card you are retrieving? (type cancel to cancel)");
                line = Console.ReadLine().ToLower();
                if (line.ToLower() == "cancel")
                {
                    Console.WriteLine("Cancelled");
                    return;
                }

                itemToRetrieve = Enumerations.GetItemFromString(line);
                eventToRetrieve = Enumerations.GetEventFromString(line);
                if (itemToRetrieve == Item.None && eventToRetrieve == Event.None)
                {
                    Console.WriteLine("I couldn't find any card with that name");
                }
                else if (itemToRetrieve != Item.None && eventToRetrieve != Event.None)
                {
                    Console.WriteLine("I couldn't tell if you meant an Item or an Event card");
                }
            }
            if (itemToRetrieve != Item.None)
            {
                ItemCard itemCardToRetrieve = game.ItemDiscard.Find(card => card.Item == itemToRetrieve);
                if (itemCardToRetrieve == null)
                {
                    Console.WriteLine("There are no Item cards of type {0} in the discard pile", itemToRetrieve);
                    return;
                }
                else
                {
                    game.Hunters[index].DrawItemCard();
                    game.Hunters[index].ItemsKnownToDracula.Add(itemCardToRetrieve);
                    game.ItemDiscard.Remove(itemCardToRetrieve);
                    Console.WriteLine("{0} retrieved {1}, up to {2}", hunterToRetrieve.Name(), itemToRetrieve.Name(), game.Hunters[index].ItemCount);
                }

            }
            else if (eventToRetrieve != Event.None)
            {
                EventCard eventCardToRetrieve = game.EventDiscard.Find(card => card.Event == eventToRetrieve);
                if (eventCardToRetrieve == null)
                {
                    Console.WriteLine("There are no Event cards of type {0} in the discard pile", eventToRetrieve);
                    return;
                }
                else
                {
                    game.Hunters[index].DrawEventCard();
                    game.Hunters[index].EventsKnownToDracula.Add(eventCardToRetrieve);
                    game.EventDiscard.Remove(eventCardToRetrieve);
                    Console.WriteLine("{0} retrieved {1}, up to {2}", hunterToRetrieve.Name(), eventToRetrieve.Name(), game.Hunters[index].EventCount);
                }
            }
            CheckForDiscardRequired(game);
            CheckForCardsRevealedForBeingBitten(game);
        }
示例#9
0
        /// <summary>
        /// Discards a card of a given name from the given Hunter
        /// </summary>
        /// <param name="game">The GameState</param>
        /// <param name="cardName">The name of the card (Item or Event) to discard</param>
        /// <param name="hunterIndex">A string to be converted to the Hunter discarding the card</param>
        private static void DiscardCard(GameState game, string cardName, string hunterIndex)
        {
            var index = 0;
            var hunterToDiscard = Hunter.Nobody;
            if (int.TryParse(hunterIndex, out index) && index > 0 && index < 5)
            {
                hunterToDiscard = (Hunter)index;
            }
            var line = "";
            while (hunterToDiscard == Hunter.Nobody && index != -1)
            {
                Console.WriteLine("Who is discarding a card? {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)
                    {
                        Console.WriteLine("Cancelled");
                        return;
                    }
                    hunterToDiscard = game.GetHunterFromInt(index);
                    Console.WriteLine(hunterToDiscard.Name());
                }
                else
                {
                    Console.WriteLine("I didn't understand that");
                }
            }
            var itemToDiscard = Enumerations.GetItemFromString(cardName);
            var eventToDiscard = Enumerations.GetEventFromString(cardName);
            while (itemToDiscard == Item.None && eventToDiscard == Event.None && line.ToLower() != "cancel")
            {
                Console.WriteLine("What is the name of the card you are discarding? (type cancel to cancel)");
                line = Console.ReadLine().ToLower();
                if (line.ToLower() == "cancel")
                {
                    Console.WriteLine("Cancelled");
                    return;
                }

                itemToDiscard = Enumerations.GetItemFromString(line);
                eventToDiscard = Enumerations.GetEventFromString(line);
                if (itemToDiscard == Item.None && eventToDiscard == Event.None)
                {
                    Console.WriteLine("I couldn't find any card with that name");
                }
                else if (itemToDiscard != Item.None && eventToDiscard != Event.None)
                {
                    Console.WriteLine("I couldn't tell if you meant an Item or an Event card");
                }
            }
            if (itemToDiscard != Item.None)
            {
                game.Hunters[index].DiscardItem(game, itemToDiscard);
                Console.WriteLine("{0} discarded {1}, down to {2}", hunterToDiscard.Name(), itemToDiscard.Name(),
                    game.Hunters[index].ItemCount);
            }
            else if (eventToDiscard != Event.None)
            {
                game.Hunters[index].DiscardEvent(game, eventToDiscard);
                Console.WriteLine("{0} discarded {1}, down to {2}", hunterToDiscard.Name(), eventToDiscard.Name(),
                    game.Hunters[index].EventCount);
            }
            CheckForCardsRevealedForBeingBitten(game);
        }
示例#10
0
 /// <summary>
 /// Resolves an Event card played by a Hunter
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="eventName">A string to be converted to the Event being played</param>
 /// <param name="hunterIndex">A string to be converted to the Hunter playing the Event</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayEvent(GameState game, string eventName, string hunterIndex, DecisionMaker logic)
 {
     var index = 0;
     var hunterPlayingEvent = Hunter.Nobody;
     if (int.TryParse(hunterIndex, out index))
     {
         hunterPlayingEvent = game.GetHunterFromInt(index);
     }
     var line = "";
     while (hunterPlayingEvent == Hunter.Nobody && index != -1)
     {
         Console.WriteLine("Who is playing an Event? {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)
             {
                 Console.WriteLine("Cancelled");
                 return;
             }
             hunterPlayingEvent = game.GetHunterFromInt(index);
             Console.WriteLine(hunterPlayingEvent.Name());
         }
         else
         {
             Console.WriteLine("I didn't understand that");
         }
     }
     var eventBeingPlayed = Enumerations.GetEventFromString(eventName);
     while (eventBeingPlayed == Event.None && line.ToLower() != "cancel")
     {
         Console.WriteLine("What is the name of the Event being played?");
         line = Console.ReadLine();
         eventBeingPlayed = Enumerations.GetEventFromString(line);
         Console.WriteLine(eventBeingPlayed.Name());
     }
     if (line.ToLower() == "cancel")
     {
         Console.WriteLine("Cancelled");
         return;
     }
     game.Hunters[(int)hunterPlayingEvent].DiscardEvent(game, eventBeingPlayed);
     if (DraculaIsPlayingDevilishPowerToCancelEvent(game, eventBeingPlayed, eventBeingPlayed, logic, game.Hunters[(int)hunterPlayingEvent]))
     {
         Console.WriteLine("{0} cancelled", eventBeingPlayed.Name());
         return;
     }
     switch (eventBeingPlayed)
     {
         case Event.JonathanHarker:
         case Event.RufusSmith:
         case Event.SisterAgatha:
             PlayHunterAlly(game, hunterPlayingEvent, eventBeingPlayed, logic); break;
         case Event.BloodTransfusion:
             PlayBloodTransfusion(game, hunterPlayingEvent); break;
         case Event.CharteredCarriage:
             PlayCharteredCarriage(game, hunterPlayingEvent, logic); break;
         case Event.ConsecratedGround:
             PlayConsecratedGround(game, hunterPlayingEvent, logic); break;
         case Event.ExcellentWeather:
             PlayExcellentWeather(game, hunterPlayingEvent); break;
         case Event.GoodLuck:
             PlayGoodLuck(game, hunterPlayingEvent); break;
         case Event.HiredScouts:
             PlayHiredScouts(game, hunterPlayingEvent, logic); break;
         case Event.Hypnosis:
             PlayHypnosis(game, hunterPlayingEvent, logic); break;
         case Event.LongDay:
             PlayLongDay(game, hunterPlayingEvent); break;
         case Event.MoneyTrail:
             PlayMoneyTrail(game, hunterPlayingEvent, logic); break;
         case Event.MysticResearch:
             PlayMysticResearch(game, hunterPlayingEvent); break;
         case Event.NewspaperReports:
             PlayNewsPaperReports(game, hunterPlayingEvent, logic); break;
         case Event.ReEquip:
             PlayReEquip(game, hunterPlayingEvent); break;
         case Event.SenseofEmergency:
             PlaySenseOfEmergency(game, hunterPlayingEvent, logic); break;
         case Event.StormySeas:
             PlayStormySeas(game, hunterPlayingEvent, logic); break;
         case Event.SurprisingReturn:
             PlaySurprisingReturn(game, hunterPlayingEvent); break;
         case Event.TelegraphAhead:
             PlayTelegraphAhead(game, hunterPlayingEvent, logic); break;
         case Event.VampireLair:
             PlayVampireLair(game, hunterPlayingEvent, logic); break;
         default:
             Console.WriteLine("It is not appropriate to play {0} at this time", eventBeingPlayed.Name()); break;
     }
     CheckForCardsRevealedForBeingBitten(game);
 }
示例#11
0
 /// <summary>
 /// Moves the given Hunter to the given Location, along with all Hunters in the given Hunter's group
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterIndex">A string to be converted to the Hunter discarding the card</param>
 /// <param name="location">The name of the Location to move to</param>
 /// <returns>The position of the card in Dracula's trail (0-5) or catacombs (6-8) that corresponds to the given location, or -1 if not in the trail/catacombs</returns>
 private static int MoveHunter(GameState game, string hunterIndex, string location, out Hunter hunterMoved,
     out Location originatingLocation, DecisionMaker logic)
 {
     var hunterToMove = Hunter.Nobody;
     int index;
     if (int.TryParse(hunterIndex, out index))
     {
         hunterToMove = game.GetHunterFromInt(index);
     }
     var line = "";
     while (hunterToMove == Hunter.Nobody && index != -1)
     {
         Console.WriteLine("Who is moving? {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)
             {
                 Console.WriteLine("Cancelled");
                 hunterMoved = Hunter.Nobody;
                 originatingLocation = Location.Nowhere;
                 return -1;
             }
             hunterToMove = game.GetHunterFromInt(index);
             Console.WriteLine(hunterToMove.Name());
         }
         else
         {
             Console.WriteLine("I didn't understand that");
         }
     }
     hunterMoved = (Hunter)index;
     originatingLocation = game.Hunters[(int)hunterMoved].CurrentLocation;
     Location destination;
     if (DraculaIsPlayingControlStorms(game, hunterMoved, logic))
     {
         Console.WriteLine("Dracula is controlling the ship's movement");
         destination = logic.ChoosePortToMoveHuntersToWithControlStorms(game, hunterMoved);
     }
     else
     {
         destination = Enumerations.GetLocationFromString(location);
         while (destination == Location.Nowhere && line.ToLower() != "cancel")
         {
             Console.WriteLine("Where is {0} moving? (Type cancel to cancel)", hunterToMove.Name());
             line = Console.ReadLine();
             destination = Enumerations.GetLocationFromString(line);
             Console.WriteLine(destination.Name());
         }
         if (line.ToLower() == "cancel")
         {
             Console.WriteLine("Cancelled");
             return -1;
         }
     }
     Console.Write("{0} moved from {1} to ", hunterToMove.Name(),
         game.Hunters[(int)hunterToMove].CurrentLocation.Name());
     foreach (var h in game.Hunters[(int)hunterToMove].HuntersInGroup)
     {
         game.Hunters[(int)h].MoveTo(destination);
     }
     Console.WriteLine(destination.Name() +
                       (game.Hunters[(int)hunterToMove].HuntersInGroup.Count() > 1 ? " with his group" : ""));
     for (var i = 0; i < 6; i++)
     {
         if (game.Dracula.Trail[i] != null && game.Dracula.Trail[i].DraculaCards.First().Location == destination)
         {
             return i;
         }
     }
     for (var i = 0; i < 3; i++)
     {
         if (game.Dracula.Catacombs[i] != null &&
             game.Dracula.Catacombs[i].DraculaCards.First().Location == destination)
         {
             return i + 6;
         }
     }
     return -1;
 }
示例#12
0
 /// <summary>
 /// Resolves EncounterTiles in front of a Hunter
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterIndex">The string to be converted to a Hunter</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void HandleEncountersInFrontOfHunter(GameState game, string hunterIndex, DecisionMaker logic)
 {
     var hunterWithEncounter = Hunter.Nobody;
     int index = -2;
     if (int.TryParse(hunterIndex, out index))
     {
         hunterWithEncounter = game.GetHunterFromInt(index);
     }
     var line = "";
     while (hunterWithEncounter == Hunter.Nobody && index != -1)
     {
         Console.WriteLine("Who is resolving an Encounter in front of them? {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;
             }
             hunterWithEncounter = game.GetHunterFromInt(index);
             Console.WriteLine(hunterWithEncounter.Name());
         }
         else
         {
             Console.WriteLine("I didn't understand that");
         }
     }
     while (game.Hunters[(int)hunterWithEncounter].EncountersInFrontOfPlayer.Any())
     {
         switch (game.Hunters[(int)hunterWithEncounter].EncountersInFrontOfPlayer.First().Encounter)
         {
             case Encounter.Fog:
                 game.EncounterPool.Add(game.Hunters[(int)hunterWithEncounter].EncountersInFrontOfPlayer.First());
                 game.Hunters[(int)hunterWithEncounter].EncountersInFrontOfPlayer.Remove(game.Hunters[(int)hunterWithEncounter].EncountersInFrontOfPlayer.First());
                 Console.WriteLine("Fog tile returned to the Encounter pool");
                 break;
             case Encounter.Bats:
                 game.EncounterPool.Add(game.Hunters[(int)hunterWithEncounter].EncountersInFrontOfPlayer.First());
                 game.Hunters[(int)hunterWithEncounter].EncountersInFrontOfPlayer.Remove(game.Hunters[(int)hunterWithEncounter].EncountersInFrontOfPlayer.First());
                 Console.WriteLine("Dracula is controlling {0}'s movement", hunterWithEncounter.Name());
                 Location destination = logic.ChooseBatsDestination(game, hunterWithEncounter);
                 HandleMoveOperation(game, destination.Name(), ((int)hunterWithEncounter).ToString(), logic);
                 break;
         }
     }
 }
示例#13
0
 /// <summary>
 /// Checks if Dracula will play False Tip-off when a Hunter attempts to catch a train
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterIndex">A String to be converted into the Hunter catching the train</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void CatchTrain(GameState game, string hunterIndex, DecisionMaker logic)
 {
     var hunterCatchingTrain = Hunter.Nobody;
     int index;
     if (int.TryParse(hunterIndex, out index))
     {
         hunterCatchingTrain = game.GetHunterFromInt(index);
     }
     var line = "";
     while (hunterCatchingTrain == Hunter.Nobody && index != -1)
     {
         Console.WriteLine("Who is catching the train? {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)
             {
                 Console.WriteLine("Cancelled");
                 return;
             }
             hunterCatchingTrain = game.GetHunterFromInt(index);
             Console.WriteLine(hunterCatchingTrain.Name());
         }
         else
         {
             Console.WriteLine("I didn't understand that");
         }
     }
     if (DraculaIsPlayingFalseTipoffToDelayHunter(game, logic))
     {
         Console.WriteLine("{0} is delayed over papers", hunterCatchingTrain.Name());
     }
     else
     {
         Console.WriteLine("{0} may catch a train", hunterCatchingTrain.Name());
     }
 }