コード例 #1
0
        public static void Shop()
        {
            bool input = true;

            Console.Clear();
            if (Player.coins == 0)
            {
                Console.WriteLine("Welcome to the shop! Sorry traveler, it seem you have no coins!");
                Console.WriteLine("Coins: " + Player.coins);
                Console.ReadKey();
                //Combat(true, "", 0, 0);
                Exploration.Explore(true, "", 0);
            }
            else
            {
                while (input)
                {
                    Console.Clear();
                    Console.WriteLine("Welcome to the shop! Safest shop in the land!\n");
                    Console.WriteLine("==============================");
                    Console.WriteLine("1. Potions: " + TheShop.potions + " for 5 coins");
                    Console.WriteLine("2. Shield: " + TheShop.shield + " for 10 coins");
                    Console.WriteLine("3. Weapon Upgrade: " + TheShop.weaponUpgrade + " for 20 coins\n\n");
                    Console.WriteLine("   Your balance = " + Player.coins);
                    Console.WriteLine("==============================");
                    Console.WriteLine("\nHere is my inventory. Select an item you would like! You can also continue if you would like.\n");
                    Console.WriteLine("Type 'CONTINUE' to continue your journey");

                    string playerInput = Console.ReadLine();

                    if (playerInput.ToUpper() == "1" || playerInput.ToUpper() == "POTIONS")
                    {
                        if (Player.coins >= 5)
                        {
                            Player.coins    = Player.coins - 5;
                            TheShop.potions = TheShop.potions - 1;
                            currentPlayer.potions++;
                            Console.WriteLine("Potion added!");
                            Console.ReadKey();
                            Console.Clear();
                            Shop();
                        }
                        else if (Player.coins < 5)
                        {
                            Console.WriteLine("Insufficient Funds");
                            Console.ReadKey();
                            Console.Clear();
                            Shop();
                        }
                        if (TheShop.potions == 0)
                        {
                            Console.WriteLine("Out of potions!");
                            Console.ReadKey();
                            Console.Clear();
                            Shop();
                        }
                    }
                    else if (playerInput.ToUpper() == "3" || playerInput.ToUpper() == "WEAPON UPGRADE")
                    {
                        if (Player.coins >= 20)
                        {
                            Player.coins          = Player.coins - 20;
                            TheShop.weaponUpgrade = TheShop.weaponUpgrade - 1;
                            currentPlayer.damage += 2;
                            Console.WriteLine("Damage Increased!");
                            Console.ReadKey();
                            Console.Clear();
                            Shop();
                        }
                        else if (Player.coins < 20)
                        {
                            Console.WriteLine("Insufficient Funds");
                            Console.ReadKey();
                            Console.Clear();
                            Shop();
                        }
                        if (TheShop.weaponUpgrade == 0)
                        {
                            Console.WriteLine("Out of upgrades!");
                            Console.ReadKey();
                            Console.Clear();
                            Shop();
                        }
                    }
                    else if (playerInput.ToUpper() == "2" || playerInput.ToUpper() == "SHIELD")
                    {
                        if (Player.coins >= 10)
                        {
                            currentPlayer.armorValue = currentPlayer.armorValue + 5;
                            Console.WriteLine("Armor value upgraded! Armor: " + currentPlayer.armorValue);
                            TheShop.shield--;
                            Player.coins = Player.coins - 10;
                            Console.ReadKey();
                            Console.Clear();
                            Shop();
                        }
                        else if (Player.coins < 10)
                        {
                            Console.WriteLine("Insufficient Funds");
                            Console.ReadKey();
                            Console.Clear();
                            Shop();
                        }
                        if (TheShop.shield == 0)
                        {
                            Console.WriteLine("Out of shields!");
                            Console.ReadKey();
                            Console.Clear();
                            Shop();
                        }
                    }
                    else if (playerInput.ToUpper() == "CONTINUE")
                    {
                        Console.Clear();
                        input = false;
                        Exploration.Explore(true, "", 0);
                        // Combat(true, "", 0, 0);
                    }
                }
            }
        }
コード例 #2
0
        public static void plainsAdventure(bool encounter)
        {
            bool input = true;

            if (encounter)
            {
                Console.Clear();
                Console.WriteLine("You begin travelling through a large plains area");
                string[] randomContext = { "camp", "watchtower", "field" };
                string   r             = randomContext[rnd.Next(0, 3)];
                Console.WriteLine("While traveling through this expanse of land, you see a " + r + " in the distance\n");
                Console.ReadKey();

                while (input)
                {
                    Console.WriteLine("Continue searching?(Y/N)");
                    string playerInput = Console.ReadLine();
                    Console.Clear();
                    if (playerInput.ToUpper() == "Y")
                    {
                        input = false;
                        Console.WriteLine("\nYou decide to investigate the " + r + ", only to find out it was an elaborate trap! You are ambushed.");
                        Console.ReadKey();
                        Encounter.Combat(true, "", 0, 0);
                    }
                    else if (playerInput.ToUpper() == "N")
                    {
                        input = false;
                        bool transitionCheck = true;
                        if (transitionCheck)
                        {
                            Console.WriteLine("You hastily make your way though the plains");
                            Console.WriteLine("Would you like to CONTINUE exploring or head to the SHOP?");
                            if (playerInput.ToUpper() == "CONTINUE")
                            {
                                transitionCheck = false;
                                Exploration.Explore(true, "", 0);
                            }
                            else if (playerInput.ToUpper() == "SHOP")
                            {
                                transitionCheck = false;
                                MainGame.Shop();
                            }
                        }
                    }
                }
            }
            else
            {
                Console.Clear();
                Console.WriteLine("You begin travelling through a large plains area");
                string[] randomContext = { "camp", "watchtower", "field" };
                string   r             = randomContext[rnd.Next(0, 3)];
                Console.WriteLine("While traveling through this expanse of land, you see a " + r + " in the distance\n");
                Console.ReadKey();

                while (input)
                {
                    Console.WriteLine("Continue searching?(Y/N)");
                    string playerInput = Console.ReadLine();
                    Console.Clear();

                    if (playerInput.ToUpper() == "Y")
                    {
                        input = false;
                        Console.WriteLine("In the " + r + " you find a chest full of loot!");
                        int randomCoin = rnd.Next(10, 21);
                        Player.coins += randomCoin;
                        Console.WriteLine("You found " + randomCoin + " coins in the chest!");
                        Console.ReadKey();
                        //restock shop
                        TheShop.potions = 5;
                        TheShop.shield  = 1;
                        MainGame.Shop();
                    }
                    else if (playerInput.ToUpper() == "N")
                    {
                        input = false;
                        Console.WriteLine("You make your way through the plains, returning to the shop");
                        Console.ReadKey();
                        MainGame.Shop();
                    }
                }
            }
        }
コード例 #3
0
        public static void dungeonAdventure(bool encounter)
        {
            bool input = true;

            if (encounter)
            {
                Console.Clear();
                Console.WriteLine("You enter a dark and ominous dungeon");
                string[] randomContext = { "temple", "prison", "mineshaft" };
                string   r             = randomContext[rnd.Next(0, 3)];
                Console.WriteLine("From the looks of it, it appears this dungeon was used as a " + r + " long before you discovered it\n");
                Console.ReadKey();

                while (input)
                {
                    Console.WriteLine("Continue searching?(Y/N)");
                    string playerInput = Console.ReadLine();
                    Console.Clear();
                    if (playerInput.ToUpper() == "Y")
                    {
                        //input = false;
                        Console.WriteLine("\nWhile looking for valuables you alert yourself to whomever dwells in this " + r);
                        Console.ReadKey();
                        Encounter.Combat(true, "", 0, 0);
                    }
                    else if (playerInput.ToUpper() == "N")
                    {
                        //input = false;
                        bool transitionCheck = true;
                        if (transitionCheck)
                        {
                            Console.WriteLine("You exit the dungeon");
                            Console.WriteLine("Would you like to CONTINUE exploring or head to the SHOP?");
                            if (playerInput.ToUpper() == "CONTINUE")
                            {
                                transitionCheck = false;
                                Exploration.Explore(true, "", 0);
                            }
                            else if (playerInput.ToUpper() == "SHOP")
                            {
                                transitionCheck = false;
                                MainGame.Shop();
                            }
                        }
                    }
                }
            }
            else
            {
                Console.Clear();
                Console.WriteLine("You enter a dark and ominous dungeon");
                string[] randomContext = { "temple", "prison", "mineshaft" };
                string   r             = randomContext[rnd.Next(0, 3)];
                Console.WriteLine("From the looks of it, it appears this dungeon was used as a " + r + " long before you discovered it\n");
                Console.ReadKey();

                while (input)
                {
                    Console.WriteLine("Continue searching?(Y/N)");
                    string playerInput = Console.ReadLine();
                    Console.Clear();

                    if (playerInput.ToUpper() == "Y")
                    {
                        input = false;
                        Console.WriteLine("While exploring the ruins of what remaind of this " + r + " you came across a chest");
                        int randomCoin = rnd.Next(10, 21);
                        Player.coins += randomCoin;
                        Console.WriteLine("You found " + randomCoin + " coins in the chest!");
                        Console.ReadKey();
                        //restock shop
                        TheShop.potions = 5;
                        TheShop.shield  = 1;
                        MainGame.Shop();
                    }
                    else if (playerInput.ToUpper() == "N")
                    {
                        input = false;
                        Console.WriteLine("You exit the dungeon, making your way back to a shop");
                        Console.ReadKey();
                        MainGame.Shop();
                    }
                }
            }
        }
コード例 #4
0
        public static void villageAdventure(bool encounter)
        {
            bool input = true;

            if (encounter)
            {
                Console.Clear();
                Console.WriteLine("A village catches your eye in the distance. You decide to head over and attempt to explore it");
                string[] randomContext = { "farming community", "raider stronghold", "ruin" };
                string   r             = randomContext[rnd.Next(0, 3)];
                Console.WriteLine("Upon closer investigation, you discover that this village is a " + r + "\n");
                Console.ReadKey();

                while (input)
                {
                    Console.WriteLine("Continue searching?(Y/N)");
                    string playerInput = Console.ReadLine();
                    Console.Clear();
                    if (playerInput.ToUpper() == "Y")
                    {
                        input = false;
                        Console.WriteLine("\nAs you continue to search this " + r + " its inhabitants leap out and attack");
                        Console.ReadKey();
                        Encounter.Combat(true, "", 0, 0);
                    }
                    else if (playerInput.ToUpper() == "N")
                    {
                        input = false;
                        bool transitionCheck = true;
                        if (transitionCheck)
                        {
                            Console.WriteLine("You exit the dungeon");
                            Console.WriteLine("Would you like to CONTINUE exploring or head to the SHOP?");
                            if (playerInput.ToUpper() == "CONTINUE")
                            {
                                transitionCheck = false;
                                Exploration.Explore(true, "", 0);
                            }
                            else if (playerInput.ToUpper() == "SHOP")
                            {
                                transitionCheck = false;
                                MainGame.Shop();
                            }
                        }
                    }
                }
            }
            else
            {
                Console.Clear();
                Console.WriteLine("A village catches your eye in the distance. You decide to head over and attempt to explore it");
                string[] randomContext = { "farming community", "raider stronghold", "ruin" };
                string   r             = randomContext[rnd.Next(0, 3)];
                Console.WriteLine("Upon closer investigation, you discover that this village is a " + r + "\n");
                Console.ReadKey();

                while (input)
                {
                    Console.WriteLine("Continue searching?(Y/N)");
                    string playerInput = Console.ReadLine();
                    Console.Clear();

                    if (playerInput.ToUpper() == "Y")
                    {
                        input = false;
                        Console.WriteLine("While exploring the village some inhabitants approach you");
                        int randomCoin = rnd.Next(10, 21);
                        Player.coins += randomCoin;
                        Console.WriteLine("They give you " + randomCoin + " coins!");
                        Console.WriteLine("\nInhabitant: Most people come here to attack, we're glad you came with friendly intentions! " +
                                          "Thank you " + MainGame.currentPlayer.name + ".");
                        string attackInput = Console.ReadLine();
                        if (attackInput.ToUpper() == "ATTACK")
                        {
                            Encounter.Combat(false, "Villager", 1, 6);
                        }
                        else
                        {
                            // Console.ReadKey();
                            //restock shop
                            TheShop.potions = 5;
                            TheShop.shield  = 1;
                            MainGame.Shop();
                        }
                    }
                    else if (playerInput.ToUpper() == "N")
                    {
                        input = false;
                        bool transitionCheck = true;
                        if (transitionCheck)
                        {
                            Console.WriteLine("You depart from the village");
                            Console.WriteLine("Would you like to CONTINUE exploring or head to the SHOP?");
                            if (playerInput.ToUpper() == "CONTINUE")
                            {
                                transitionCheck = false;
                                Exploration.Explore(true, "", 0);
                            }
                            else if (playerInput.ToUpper() == "SHOP")
                            {
                                transitionCheck = false;
                                MainGame.Shop();
                            }
                        }
                    }
                }
            }
        }