Esempio n. 1
0
        public void ItemsToSell()
        {
            UserItemCatalog.Clear();

            ListArmor();
            ListWeapons();
            ListPotions();
        }
Esempio n. 2
0
        public void Sell()
        {
            if (UserItemCatalog.Count == 0)
            {
                Console.WriteLine("");
                Console.WriteLine("You have no items to sell");
                Console.ReadKey();
                Shop.Menu();
            }

            var selection = "";

            while (string.IsNullOrEmpty(selection))
            {
                Console.WriteLine("");
                Console.Write("What would you like to sell? ");

                selection = Console.ReadLine();
            }

            if (!UserItemCatalog.ContainsKey(selection))
            {
                Console.WriteLine("");
                Console.WriteLine("Please provide a valid selection.");
                Sell();
            }
            //I need to know what type of object the user has selected so I will look
            //at the first letter of the key (a, w, p)

            switch (selection.Substring(0, 1))
            {
            case "a":
                var armor = (Armor)UserItemCatalog[selection];
                ArmorsBag.Remove(armor);
                Gold += armor.ResellValue;
                Shop.ArmorsList.Add(armor);
                break;

            case "w":
                var weapon = (Weapon)UserItemCatalog[selection];
                WeaponsBag.Remove(weapon);
                Gold += weapon.ResellValue;
                Shop.WeaponsList.Add(weapon);
                break;

            case "p":
                var potion = (Potion)UserItemCatalog[selection];
                PotionsBag.Remove(potion);
                Gold += potion.ResellValue;
                Shop.PotionsList.Add(potion);
                break;

            default:
                Shop.Menu();
                break;
            }
        }
Esempio n. 3
0
        public void ListWeapons()
        {
            Console.WriteLine("*****Weapons*****");
            var count = 1;

            foreach (var w in this.WeaponsBag)
            {
                Console.WriteLine($"w{count}:{w.Name}, {w.ResellValue} gold");

                UserItemCatalog.Add($"w{count}", w);
                count++;
            }
        }
Esempio n. 4
0
        public void ListPotions()
        {
            Console.WriteLine("");
            Console.WriteLine("*****Potions*****");
            var count = 1;

            foreach (var p in this.PotionsBag)
            {
                Console.WriteLine($"p{count}: {p.Name}, {p.ResellValue} gold");

                UserItemCatalog.Add($"p{count}", p);
                count++;
            }
        }
Esempio n. 5
0
        public void ListArmor()
        {
            Console.WriteLine("");
            Console.WriteLine("*****Armor*****");
            var count = 1;

            foreach (var a in this.ArmorsBag)
            {
                Console.WriteLine($"a{count}: {a.Name}, {a.ResellValue} gold");

                UserItemCatalog.Add($"a{count}", a);
                count++;
            }
        }
Esempio n. 6
0
        public void EquipPotion()
        {
            UserItemCatalog.Clear();
            Console.WriteLine("");
            Console.WriteLine("*****Potions*****");
            var count = 1;

            foreach (var potion in this.PotionsBag)
            {
                Console.WriteLine($"{count}: {potion.Name} with {potion.HP} hit points");

                UserItemCatalog.Add($"{count}", potion);
                count++;
            }

            if (UserItemCatalog.Count == 0)
            {
                Console.WriteLine("You have no potions to drink");
                Console.ReadKey();
                Shop.Menu();
            }

            var selection = "";

            while (string.IsNullOrEmpty(selection))
            {
                Console.WriteLine("");
                Console.Write("Make a selection: ");

                selection = Console.ReadLine();
            }

            var intselection = Convert.ToInt32(selection);

            if (intselection < 1 || intselection > UserItemCatalog.Count)
            {
                Console.WriteLine("Please make a valid selection");
                EquipPotion();
                Console.ReadKey();
            }
            else
            {
                var potion = (Potion)UserItemCatalog[selection];
                PotionsBag.Remove(potion);
                EquippedPotion = potion;
                CurrentHP     += potion.HP;
                Game.Main();
            }
        }
Esempio n. 7
0
        public void EquipArmor()
        {
            UserItemCatalog.Clear();
            Console.WriteLine("");
            Console.WriteLine("*****Armor*****");
            var count = 1;

            foreach (var armor in this.ArmorsBag)
            {
                Console.WriteLine($"{count}: {armor.Name} with {armor.Defense} defense");

                UserItemCatalog.Add($"{count}", armor);
                count++;
            }

            if (UserItemCatalog.Count == 0)
            {
                Console.WriteLine("You have no armor to equip");
                Console.ReadKey();
                Shop.Menu();
            }

            var selection = "";

            while (string.IsNullOrEmpty(selection))
            {
                Console.WriteLine("");
                Console.Write("Make a selection: ");

                selection = Console.ReadLine();
            }

            var intselection = Convert.ToInt32(selection);

            if (intselection < 1 || intselection > UserItemCatalog.Count)
            {
                Console.WriteLine("Please make a valid selection");
                EquipArmor();
                Console.ReadKey();
            }
            else
            {
                var armor = (Armor)UserItemCatalog[selection];
                ArmorsBag.Remove(armor);
                EquippedArmor = armor;
                Defense      += armor.Defense;
                Game.Main();
            }
        }
Esempio n. 8
0
        public void EquipWeapon()
        {
            UserItemCatalog.Clear();
            Console.WriteLine("");
            Console.WriteLine("*****Weapons*****");
            var count = 1;

            foreach (var weapon in this.WeaponsBag)
            {
                Console.WriteLine($"{count}: {weapon.Name} with {weapon.Strength} strength");

                UserItemCatalog.Add($"{count}", weapon);
                count++;
            }

            if (UserItemCatalog.Count == 0)
            {
                Console.WriteLine("You have no weapons to use");
                Console.ReadKey();
                Shop.Menu();
            }

            var selection = "";

            while (string.IsNullOrEmpty(selection))
            {
                Console.WriteLine("");
                Console.Write("Make a selection: ");

                selection = Console.ReadLine();
            }

            var intselection = Convert.ToInt32(selection);

            if (intselection < 1 || intselection > UserItemCatalog.Count)
            {
                Console.WriteLine("Please make a valid selection");
                EquipWeapon();
                Console.ReadKey();
            }
            else
            {
                var weapon = (Weapon)UserItemCatalog[selection];
                WeaponsBag.Remove(weapon);
                EquippedWeapon = weapon;
                Strength      += weapon.Strength;
                Game.Main();
            }
        }