public void UsePotion() { MakeYouStrong.Clear(); Console.WriteLine(""); Console.WriteLine("*****Potions*****"); var countPotion = 1; foreach (var p in this.PotionsBag) { Console.WriteLine($"{countPotion}: {p.Name} that will give you {p.HP} HP"); MakeYouStrong.Add($"{countPotion}", p); countPotion++; Console.WriteLine("Do you like to use Potion ? Press 1. to use"); } if (MakeYouStrong.Count == 0) { Console.WriteLine("You have no potions to drink"); ShowInventory(); } else { var selection = Console.ReadLine(); var potion = (Potion)MakeYouStrong[selection]; PotionsBag.Remove(potion); CurrentHP += potion.HP; Console.WriteLine(""); Console.WriteLine("You are successful to use Potion your HP regen some"); } }
public void EquipArmor() { if (EquippedArmor != null) { Console.WriteLine("You don't have any armor"); Console.ReadKey(); ShowInventory(); } MakeYouStrong.Clear(); Console.WriteLine(""); Console.WriteLine("*****Armor*****"); var countArmor = 1; foreach (var a in this.ArmorsBag) { Console.WriteLine($"{countArmor}: {a.Name} with {a.Defense} strength"); MakeYouStrong.Add($"{countArmor}", a); countArmor++; Console.WriteLine("Do you like to equip this armor ? Press 1. to equip"); } if (MakeYouStrong.Count == 0) { Console.WriteLine("You don't have any armor to equip"); ShowInventory(); } else { var selection = Console.ReadLine(); var armor = (Armor)MakeYouStrong[selection]; ArmorsBag.Remove(armor); EquippedArmor = armor; Defense += armor.Defense; Console.WriteLine(""); Console.WriteLine("You are successful to equip this armor"); } }
public void EquipWeapon() { if (EquippedWeapon != null) { Console.WriteLine("You're already equip a weapon"); Console.ReadKey(); ShowInventory(); } MakeYouStrong.Clear(); Console.WriteLine(""); Console.WriteLine("*****Weapons*****"); var countWeapon = 1; foreach (var w in this.WeaponsBag) { Console.WriteLine($"{countWeapon}: {w.Name} with {w.Strength} strength"); MakeYouStrong.Add($"{countWeapon}", w); countWeapon++; Console.WriteLine("Do you like to equip this weapon ? Press 1. to equip"); } if (MakeYouStrong.Count == 0) { Console.WriteLine("You don't any weapons to equip"); } else { var selection = Console.ReadLine(); var weapon = (Weapon)MakeYouStrong[selection]; WeaponsBag.Remove(weapon); EquippedWeapon = weapon; Strength += weapon.Strength; Console.WriteLine(""); Console.WriteLine("You are successful to equip this weapon"); } }