Exemplo n.º 1
0
        public Shop stockShop()
        {
            var club1       = new Weapon("Knobbly Branch", 2, 3, 1);
            var sword1      = new Weapon("Squire's Sword", 3, 4, 2);
            var axe1        = new Weapon("Woodcutter's Axe", 4, 5, 3);
            var club2       = new Weapon("Knight's Mace", 5, 6, 2);
            var sword2      = new Weapon("Knight's Blade", 6, 7, 5);
            var axe2        = new Weapon("Executioner's Axe", 6, 8, 6);
            var weaponStock = new List <Weapon>();

            weaponStock.Add(club1);
            weaponStock.Add(sword1);
            weaponStock.Add(axe1);
            weaponStock.Add(club2);
            weaponStock.Add(sword2);
            weaponStock.Add(axe2);
            var armor1     = new Armor("Leather Armor", 5, 7, 5);
            var armor2     = new Armor("Studded Leather Armor", 7, 10, 5);
            var armor3     = new Armor("Chain Armor", 10, 15, 12);
            var armorStock = new List <Armor>();

            armorStock.Add(armor1);
            armorStock.Add(armor2);
            armorStock.Add(armor3);
            var potion1     = new Potion("Healing Potion", 5, 3, 1);
            var potion2     = new Potion("Greater Healing Potion", 10, 6, 3);
            var potion3     = new Potion("Superior Healing Potion", 15, 8, 5);
            var potionStock = new List <Potion>();

            potionStock.Add(potion1);
            potionStock.Add(potion2);
            potionStock.Add(potion3);
            var shopFront = new Shop(armorStock, weaponStock, potionStock, this, hero);

            return(shopFront);
        }
Exemplo n.º 2
0
        public void AddPotions(string name, int originalValue, int resellValue, int hp)
        {
            var potion = new Potion(name, hp, originalValue, resellValue);

            this.Potions.Add(potion);
        }
Exemplo n.º 3
0
        private void ExecuteSell()
        {
            var pick = "";

            if (this.Hero.WeaponsBag.Count == 0 && this.Hero.ArmorsBag.Count == 0 && this.Hero.PotionBag.Count == 0)
            {
                Console.WriteLine("\nThere are currently no items in your bags that you can sell at this time.");
                Console.WriteLine("\nPress any key to go back to the shop menu");
                Console.ReadKey();
                Console.Clear();
                this.ShopMenu();
            }

            do
            {
                Console.WriteLine($"\nWhich item would you like to sell?");
                Console.WriteLine($"Type E if you do not wish to purch anything at this time.");
                pick = Console.ReadLine();
            } while (pick.Length <= 0);

            var weapon = new Weapon();
            var armor  = new Armor();
            var potion = new Potion();

            switch (pick.Substring(0, 1).ToLower())
            {
            case "w":

                if (WeaponCatalog.TryGetValue(pick.Substring(0, 2), out weapon))
                {
                    Hero.WeaponsBag.Remove(weapon);
                    this.WeaponList.Add(weapon);
                    Hero.Gold += weapon.ResellValue;

                    Console.WriteLine($"Hero just sold {weapon.Name}, for {weapon.ResellValue}!");
                    Console.WriteLine($"Hero now has {Hero.Gold}!  Time to go shopping!");
                }
                else
                {
                    Console.WriteLine($"Item {pick} does not exist...");
                }

                break;

            case "a":

                if (ArmorCatalog.TryGetValue(pick.Substring(0, 2), out armor))
                {
                    Hero.ArmorsBag.Remove(armor);
                    this.ArmorList.Add(armor);
                    Hero.Gold += armor.ResellValue;

                    Console.WriteLine($"Hero just sold {armor.Name}, for {armor.ResellValue}!");
                    Console.WriteLine($"Hero now has {Hero.Gold}!  Time to go shopping!");
                }
                else
                {
                    Console.WriteLine($"Item {pick} does not exist...");
                }

                break;

            case "p":

                if (PotionCatalog.TryGetValue(pick.Substring(0, 2), out potion))
                {
                    Hero.PotionBag.Remove(potion);
                    this.PotionList.Add(potion);
                    Hero.Gold += potion.ResellValue;

                    Console.WriteLine($"Hero just sold {potion.Name}, for {potion.ResellValue}!");
                    Console.WriteLine($"Hero now has {Hero.Gold}!  Time to go shopping!");
                }
                else
                {
                    Console.WriteLine($"Item {pick} does not exist...");
                }

                break;

            case "e":
                Console.Clear();
                this.ShopMenu();
                break;

            default:
                Console.WriteLine($"Item {pick} does not exist...");
                break;
            }
        }
Exemplo n.º 4
0
        private void ExecutePuchase()
        {
            var pick = "";

            do
            {
                Console.WriteLine($"\nWhich item would you like to purchase?");
                Console.WriteLine($"Type E if you do not wish to purch anything at this time.");
                pick = Console.ReadLine();
            } while (pick.Length <= 0);

            var weapon = new Weapon();
            var armor  = new Armor();
            var potion = new Potion();

            switch (pick.Substring(0, 1).ToLower())
            {
            case "w":

                if (WeaponCatalog.TryGetValue(pick.Substring(0, 2), out weapon))
                {
                    if (Hero.Gold >= weapon.OriginalValue)
                    {
                        Hero.Gold -= weapon.OriginalValue;
                        Hero.WeaponsBag.Add(weapon);
                        WeaponList.Remove(weapon);
                        Console.WriteLine($"Hero just purchased {weapon.Name}!");
                    }
                    else
                    {
                        Console.WriteLine($"You do not have enough Gold to purchase {weapon.Name}");
                        Console.WriteLine($"{weapon.Name} costs {weapon.OriginalValue}, you only have {Hero.Gold -4:C0}");
                    }
                }
                else
                {
                    Console.WriteLine($"Item {pick} does not exist...");
                }

                break;

            case "a":

                if (ArmorCatalog.TryGetValue(pick.Substring(0, 2), out armor))
                {
                    if (Hero.Gold >= armor.OriginalValue)
                    {
                        Hero.Gold -= armor.OriginalValue;
                        Hero.ArmorsBag.Add(armor);
                        ArmorList.Remove(armor);
                        Console.WriteLine($"Hero just purchased {armor.Name}!");
                    }
                    else
                    {
                        Console.WriteLine($"You do not have enough Gold to purchase {armor.Name}");
                        Console.WriteLine($"{armor.Name} costs {armor.OriginalValue}, you only have {Hero.Gold -4:C0}");
                    }
                }
                else
                {
                    Console.WriteLine($"Item {pick} does not exist...");
                }

                break;

            case "p":

                if (PotionCatalog.TryGetValue(pick.Substring(0, 2), out potion))
                {
                    if (Hero.Gold >= potion.OriginalValue)
                    {
                        Hero.Gold -= potion.OriginalValue;
                        Hero.PotionBag.Add(potion);
                        PotionList.Remove(potion);
                        Console.WriteLine($"Hero just purchased {potion.Name}!");
                    }
                    else
                    {
                        Console.WriteLine($"You do not have enough Gold to purchase {potion.Name}");
                        Console.WriteLine($"{potion.Name} costs {potion.OriginalValue}, you only have {Hero.Gold - 4:C0}");
                    }
                }
                else
                {
                    Console.WriteLine($"Item {pick} does not exist...");
                }

                break;

            case "e":
                Console.Clear();
                this.ShopMenu();
                break;

            default:
                Console.WriteLine($"Item {pick} does not exist...");
                break;
            }
        }
Exemplo n.º 5
0
        public void AddPotions(string name, int number, int originalValue, int resellValue, int strength)
        {
            var potions = new Potion(name, number, strength, originalValue, resellValue);

            this.Potions.Add(potions);
        }