Ejemplo n.º 1
0
        public void ListHeroWeapons()
        {
            HeroWeaponCatalog.Clear();
            Console.WriteLine("Weapons:");

            var WeaponCount = 1;

            foreach (var wl in this.WeaponsBag)
            {
                Console.WriteLine($"{WeaponCount}) {wl.Name} - Original Value: {wl.OriginalValue}, Resell Value: {wl.ResellValue}");
                HeroWeaponCatalog.Add($"{WeaponCount}", wl);
                WeaponCount++;
            }
            Console.WriteLine();
        }
Ejemplo n.º 2
0
        public void ShowInventory()
        {
            Console.WriteLine("*****  INVENTORY ******");

            Console.WriteLine("Weapons: ");
            foreach (var Weapon in this.WeaponsBag)
            {
                Console.WriteLine(Weapon.Name + " of " + Weapon.Strength + " Strength");
            }
            Console.WriteLine("Armors: ");
            foreach (var Armor in this.ArmorsBag)
            {
                Console.WriteLine(Armor.Name + " of " + Armor.Defense + " Defense");
            }
            Console.WriteLine("Potions: ");
            foreach (var Potion in this.PotionsBag)
            {
                Console.WriteLine(Potion.Name + " of " + Potion.HP + " HP");
            }

            Console.WriteLine("What Would You Like To Do?");
            Console.WriteLine("1.) Equip A Weapon");
            Console.WriteLine("2.) Equip An Armor");
            Console.WriteLine("3.) Drink Potion");
            Console.WriteLine("4.) Unequip A Weapon");
            Console.WriteLine("5.) Unequip A Armor");
            Console.WriteLine("6.) Continue Adventure");
            var MenuSelection = Console.ReadLine();

            if (MenuSelection == "1")
            {
                Console.WriteLine("Which Item Would You Like To Equip?");
                ListHeroWeapons();
                var WeaponSelect = "";
                WeaponSelect = Console.ReadLine();
                if (HeroWeaponCatalog.ContainsKey(WeaponSelect))
                {
                    var NewWeapon = (Weapon)HeroWeaponCatalog[WeaponSelect];
                    EquipWeapon(NewWeapon);
                }
                else if (!HeroWeaponCatalog.ContainsKey(WeaponSelect))
                {
                    Console.WriteLine("Please Enter a Valid Code.");
                    ShowInventory();
                }
            }
            else if (MenuSelection == "2")
            {
                Console.WriteLine("Which Item Would You Like To Equip?");
                ListHeroArmor();
                var ArmorSelect = "";
                ArmorSelect = Console.ReadLine();
                if (HeroArmorCatalog.ContainsKey(ArmorSelect))
                {
                    var NewArmor = (Armor)HeroArmorCatalog[ArmorSelect];
                    EquipArmor(NewArmor);
                }
                else if (!HeroArmorCatalog.ContainsKey(ArmorSelect))
                {
                    Console.WriteLine("Please Enter a Valid Code.");
                    ShowInventory();
                }
            }
            else if (MenuSelection == "3")
            {
                Console.WriteLine("Which Potion Would You Like to Drink?");
                ListHeroPotions();
                var PotionSelect = "";
                PotionSelect = Console.ReadLine();
                if (HeroPotionsCatalog.ContainsKey(PotionSelect))
                {
                    var NewPotion = (Potion)HeroPotionsCatalog[PotionSelect];
                    DrinkPotion(NewPotion);
                }
                else if (!HeroPotionsCatalog.ContainsKey(PotionSelect))
                {
                    Console.WriteLine("Please Enter a Valid Code.");
                    ShowInventory();
                }
            }
            else if (MenuSelection == "4")
            {
                if (EquippedWeapon != null)
                {
                    UnEquipWeapon(EquippedWeapon);
                }
                else if (EquippedWeapon == null)
                {
                    Console.WriteLine("You Do Not Have A Weapon Equipped");
                    this.ShowInventory();
                }
            }
            else if (MenuSelection == "5")
            {
                if (EquippedArmor != null)
                {
                    UnEquipArmor(EquippedArmor);
                }
                else if (EquippedArmor == null)
                {
                    Console.WriteLine("You Do Not Have Armor Equipped");
                    this.ShowInventory();
                }
            }
            else if (MenuSelection == "6")
            {
                Console.WriteLine();
                Console.WriteLine("What would you like to do?");
                Console.WriteLine("1. Back to Inventory.");
                Console.WriteLine("2. Continue Adventure.");
                Console.WriteLine("3. Back To Town.");

                var input = Console.ReadLine();
                if (input == "1")
                {
                    this.ShowInventory();
                }
                else if (input == "2")
                {
                    var explore = new Explore(this, Game);
                    explore.Start();
                }
                else if (input == "3")
                {
                    this.Game.Main();
                }
            }
            else
            {
                Game.Main();
            }
        }