当前位置: 首页>>代码示例>>C#>>正文


C# GameState.GetHunterFromInt方法代码示例

本文整理汇总了C#中FuryOfDracula.GameLogic.GameState.GetHunterFromInt方法的典型用法代码示例。如果您正苦于以下问题:C# GameState.GetHunterFromInt方法的具体用法?C# GameState.GetHunterFromInt怎么用?C# GameState.GetHunterFromInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FuryOfDracula.GameLogic.GameState的用法示例。


在下文中一共展示了GameState.GetHunterFromInt方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UseItem

 /// <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:
//.........这里部分代码省略.........
开发者ID:UncleGus,项目名称:dracula,代码行数:101,代码来源:Program.cs

示例2: DrawCard

 /// <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");
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:56,代码来源:Program.cs

示例3: TradeCardsBetweenHunters

        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))
//.........这里部分代码省略.........
开发者ID:UncleGus,项目名称:dracula,代码行数:101,代码来源:Program.cs

示例4: UseHolyWaterAtHospital

 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);
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:37,代码来源:Program.cs

示例5: SetupGroup

 /// <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);
//.........这里部分代码省略.........
开发者ID:UncleGus,项目名称:dracula,代码行数:101,代码来源:Program.cs

示例6: SpendResolve

 /// <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);
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:68,代码来源:Program.cs

示例7: RestHunter

 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);
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:38,代码来源:Program.cs

示例8: RetrieveCardFromDiscard

        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);
        }
开发者ID:UncleGus,项目名称:dracula,代码行数:90,代码来源:Program.cs

示例9: DiscardCard

        /// <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);
        }
开发者ID:UncleGus,项目名称:dracula,代码行数:74,代码来源:Program.cs

示例10: PlayEvent

 /// <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;
     }
//.........这里部分代码省略.........
开发者ID:UncleGus,项目名称:dracula,代码行数:101,代码来源:Program.cs

示例11: MoveHunter

 /// <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;
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:90,代码来源:Program.cs

示例12: HandleEncountersInFrontOfHunter

 /// <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;
         }
     }
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:60,代码来源:Program.cs

示例13: CatchTrain

 /// <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());
     }
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:46,代码来源:Program.cs


注:本文中的FuryOfDracula.GameLogic.GameState.GetHunterFromInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。