Example #1
0
 public Game()
 {
     Hero = new Hero();
 }
Example #2
0
 public Fight(Hero game, AchievementList achieve)
 {
     Hero           = game;
     Achievements   = achieve;
     CurrentMonster = MonsterPicker.GetMonster();
 }
Example #3
0
        private static void ShopInput(Hero hero)
        {
            var shopMainInput = "0";

            while (shopMainInput != "3")
            {
                DrawShop(hero);

                shopMainInput = Console.ReadLine();

                if (shopMainInput == "1")
                {
                    // Buying an item..
                    var shopInput = "";

                    if (ShopItems.Any())
                    {
                        Console.Clear();
                        UI.DefaultBoxes.DrawInventory(hero, UI.Grid.Left);
                        UI.DefaultBoxes.DrawStore(ShopItems, UI.Grid.Right);
                        UI.DefaultBoxes.DrawOptions(new List <string>
                        {
                            "Please choose an item #",
                            "Press enter to exit..",
                        }, UI.Grid.Center);

                        shopInput = Console.ReadLine();
                        if (shopInput == "")
                        {
                            continue;
                        }
                        else
                        {
                            int.TryParse(shopInput, out int shopInputConverted);
                            // Input validation, cannot be 0
                            if (shopInputConverted > 0)
                            {
                                // If the item is purchased, return true.
                                if (BuyItem(shopInputConverted, hero))
                                {
                                    UI.Draw.PrintToOutput(new List <string>
                                    {
                                        "Item purchased!",
                                        "Press any button to return to shop..."
                                    });
                                }
                                else
                                {
                                    UI.Draw.PrintToOutput(new List <string>
                                    {
                                        "Not enough gold!",
                                        "Press any button to return to shop..."
                                    });
                                }
                            }
                            else
                            {
                                UI.Draw.PrintToOutput(new List <string>
                                {
                                    "Input value was either 0 or less",
                                    "Press any button to return to shop..."
                                });
                            }
                            Console.ReadLine();
                        }
                    }
                    else
                    {
                        UI.Draw.PrintToOutput(new List <string> {
                            "There's no Items to buy, check again later.", "Press any button to return to shop..."
                        });
                        Console.ReadLine();
                        break;
                    }
                }
                else if (shopMainInput == "2")
                {
                    // Buying an item..
                    var sellInput = "";

                    if (hero.Bag.Any())
                    {
                        Console.Clear();
                        UI.DefaultBoxes.DrawInventory(hero, UI.Grid.Left, true);
                        UI.DefaultBoxes.DrawStore(ShopItems, UI.Grid.Right);
                        UI.DefaultBoxes.DrawOptions(new List <string>
                        {
                            "Please choose an item #",
                            "Press enter to exit..",
                        }, UI.Grid.Center);

                        sellInput = Console.ReadLine();
                        if (sellInput == "")
                        {
                            continue;
                        }
                        else
                        {
                            int.TryParse(sellInput, out int sellInputIndex);
                            // Input validation, cannot be 0
                            if (sellInputIndex > 0)
                            {
                                PlayerSellItem(sellInputIndex, hero);
                                UI.Draw.PrintToOutput(new List <string>
                                {
                                    "Item sold!",
                                    "Press any button to return to shop..."
                                });
                            }
                            else
                            {
                                UI.Draw.PrintToOutput(new List <string>
                                {
                                    "Input value was either 0 or less",
                                    "Press any button to return to shop..."
                                });
                            }
                            Console.ReadLine();
                        }
                    }
                    else
                    {
                        UI.Draw.PrintToOutput(new List <string> {
                            "You have no Items to sell, earn gold to buy some!", "Press any button to return to shop..."
                        });
                        Console.ReadLine();
                        break;
                    }
                }
            }
            Console.Clear();
        }
        public bool Check(Hero hero)
        {
            var killHistory = hero.GetKillHistory();

            return(killHistory.Any());
        }
Example #5
0
 public static void CreateShop(Hero hero)
 {
     DrawShop(hero);
     ShopInput(hero);
 }