Exemplo n.º 1
0
        // Allows the user to enter the shop
        public static void Shop()
        {
            bool exit = false;

            while (!exit)
            {
                Console.Clear();
                Console.WriteLine("Shop - see the items you can buy.\nInventory - you see what items you have in your inventory.\nBuy/Sell - buy or sell an item.\nExit - to exit the store\n\n");
                Console.WriteLine("What would you like to do buy or sell a item.");
                string message = Console.ReadLine().ToLower();
                switch (message)
                {
                case "buy":
                    ShopSystem.Buy(ref player, ref npc);
                    FileSetup.CoinWrite(coinFile, ref player);
                    Tools.Shuffle(ref player.storage);
                    Tools.ShuffleDamage(ref player);
                    Console.Clear();
                    break;

                case "sell":
                    ShopSystem.Sell(ref player, ref npc);
                    FileSetup.CoinWrite(coinFile, ref player);
                    Tools.Shuffle(ref player.storage);
                    Tools.ShuffleDamage(ref player);
                    Console.Clear();
                    break;

                case "inventory":
                    ShopSystem.Inventory(ref player);
                    Console.Clear();
                    break;

                case "shop":
                    ShopSystem.Shop(ref npc);
                    Console.Clear();
                    break;

                case "exit":
                    exit = true;
                    break;

                default:
                    Console.WriteLine("Sorry, but you typed an invalid command.");
                    break;
                }
            }
        }
Exemplo n.º 2
0
        // This will be the scene that will happen for a fight
        public static string FightScene(ref Monster monster, ref Player player)
        {
            Console.Clear();
            while (monster.health > 0)
            {
                Console.WriteLine($"Hello, {player.name} you have been caught by {monster.name} now you must fight to make it out alive.\n\n");
                Console.Write($"Actions:\nStrike - you will strike your weapon at {monster.name}.\nStatus - shows yours and {monster.name} stats.\nHeal - this will be used to heal yourself.\n" +
                              $"Eat - this will allow you to eat.\n\n\nWhat action you like to take? ");
                string message = Console.ReadLine().ToLower();
                Console.WriteLine();
                switch (message)
                {
                case "strike":
                    Strike(ref player, ref monster);
                    break;

                case "status":
                    Status(ref player, ref monster);
                    break;

                case "heal":
                    Heal(ref player);
                    break;

                case "eat":
                    Eat(ref player);
                    break;

                default:
                    Console.WriteLine("You typed an invalid action try again.");
                    break;
                }
                if (player.health <= 0)
                {
                    return("failed");
                }
                Thread.Sleep(1500);
                Console.Clear();
            }
            monster = null;
            player.level++;
            player.coins++;
            FileSetup.CoinWrite(Game.coinFile, ref player);
            FileSetup.LevelWrite(Game.levelFile, ref player);
            FileSetup.PlayerFileWrite(ref player, Game.playerFile);
            return("success");
        }