Пример #1
0
        public void CheckOut(string itemDictNum)
        {
            switch (itemDictNum.Substring(0, 1))
            {
            case "a":
                var armor = (Armor)ItemCatalog[itemDictNum];

                if (Hero.Gold >= armor.OriginalValue)
                {
                    Hero.Gold -= armor.OriginalValue;
                    ArmorList.Remove(armor);
                    Hero.ArmorsBag.Add(armor);
                    Console.WriteLine($"You bought a {armor.Name} for {armor.OriginalValue} gold");
                    Start();
                }
                else
                {
                    Console.WriteLine($"You do not have enough gold to purchase {armor.Name}");
                    Start();
                }
                break;

            case "p":
                var potion3 = (Potion)ItemCatalog[itemDictNum];
                if (Hero.Gold >= potion3.OriginalValue)
                {
                    Hero.Gold -= potion3.OriginalValue;
                    PotionsList.Remove(potion3);
                    Hero.PotionsBag.Add(potion3);
                    Console.WriteLine($"You bought a {potion3.Name} for {potion3.OriginalValue} gold");
                    Start();
                }
                else
                {
                    Console.WriteLine($"You do not have enough gold to purchase {potion3.Name}");
                    Start();
                }
                break;

            case "w":
                var weapon = (Weapon)ItemCatalog[itemDictNum];
                if (Hero.Gold >= weapon.OriginalValue)
                {
                    Hero.Gold -= weapon.OriginalValue;
                    WeaponsList.Remove(weapon);
                    Hero.WeaponsBag.Add(weapon);
                    Console.WriteLine($"You bought a {weapon.Name} for {weapon.OriginalValue} gold");
                    Start();
                }
                else
                {
                    Console.WriteLine($"You do not have enough gold to purchase {weapon.Name}");
                    Start();
                }
                break;
            }
        }
Пример #2
0
 public void RemoveWeaponFromWorld(Weapon weapon)
 {
     WeaponsList.Remove(weapon);
 }