public void EquipArmor(int selectedIndex) { if (ArmorsBag.Any()) { this.EquippedArmor = this.ArmorsBag[selectedIndex]; } }
public void EquipArmor() { if (ArmorsBag.Any()) { this.EquippedArmor = this.ArmorsBag[0]; } }
public void EquipArmor(int inputNumber) { if (ArmorsBag.Any()) { this.EquippedArmor = this.ArmorsBag[inputNumber]; this.TotalDefense += this.ArmorsBag[inputNumber].Defense; } }
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; } }
public void UnEquipArmor(Armor EquippedArmor) { ArmorsBag.Add(EquippedArmor); Defense -= EquippedArmor.Defense; Speed += EquippedArmor.Defense; Console.WriteLine($"You Are No Longer Wearing {EquippedArmor.Name} For + {EquippedArmor.Defense} Defense"); this.EquippedArmor = null; Console.WriteLine(); ShowInventory(); }
public void EquipArmor() { if (ArmorsBag.Any()) { this.EquippedArmor = this.ArmorsBag[0]; Console.WriteLine("Eqipped Armor: "); foreach (var ea in this.ArmorsBag) { Console.WriteLine(ea.Name + " of " + ea.Defense + " Defense"); } } }
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(); } }
public void SellBackArmor(int inputNumber) { if (ArmorsBag.Any()) { if (this.EquippedArmor != null && (this.EquippedArmor.Name == this.ArmorsBag[inputNumber].Name)) { Console.WriteLine("Item equipped, please unequip it from the inventory first and try again"); } else { this.Gold += (this.ArmorsBag[inputNumber].Price - 1); this.ArmorsBag.RemoveAt(inputNumber); } } }
public void EquipWeapon() { if (WeaponsBag.Any()) { this.EquippedWeapon = this.WeaponsBag[0]; this.Strength += EquippedWeapon.Strength; Console.WriteLine($"{this.EquippedWeapon.Name} is equiped!"); } else if (ArmorsBag.Any()) { this.EquippedArmor = this.ArmorsBag[0]; this.Defense += EquippedArmor.Defense; Console.WriteLine($"{this.EquippedArmor.Name} is equiped!"); } Console.WriteLine("Now, you become stonger!\nPress any key to return to main menu."); }
public void EquipArmor() { if (ArmorsBag.Any()) { if (ArmorsBag[0] != null) { this.EquippedArmor = this.ArmorsBag[0]; this.Defense = this.EquippedArmor.Defense + this.Defense; Console.WriteLine($"You get {this.EquippedArmor.Defense} Defense."); Console.WriteLine($"Your Strength is {this.Defense} now."); } else { this.Defense = 10; } } }
public void EquipArmor(int itemNumber) { if (ArmorsBag.Any()) { if (this.EquippedArmor == null) { this.EquippedArmor = this.ArmorsBag[itemNumber]; this.Strength = this.Strength + this.EquippedArmor.Defense; this.ArmorsBag.RemoveAt(itemNumber); } else { this.Strength = this.Strength - this.EquippedArmor.Defense; this.ArmorsBag.Add(this.EquippedArmor); this.EquippedArmor = this.ArmorsBag[itemNumber]; this.Strength = this.Strength + this.EquippedArmor.Defense; this.ArmorsBag.RemoveAt(itemNumber); } } }
public void EquipArmor(int ArmorIndex) { if (ArmorsBag.Any()) { if (this.EquippedArmor == null) { this.EquippedArmor = this.ArmorsBag[ArmorIndex]; this.Defense += this.EquippedArmor.Defense; this.ArmorsBag.RemoveAt(ArmorIndex); } else { this.Defense -= this.EquippedArmor.Defense; this.ArmorsBag.Add(this.EquippedArmor); this.EquippedArmor = this.ArmorsBag[ArmorIndex]; this.Defense += this.EquippedArmor.Defense; this.WeaponsBag.RemoveAt(ArmorIndex); } } }
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 EquipArmor(Armor armor) { if (EquippedArmor == null) { this.EquippedArmor = armor; ArmorsBag.Remove(armor); Defense += armor.Defense; Speed -= armor.Defense; Console.WriteLine($"You Are Now Wearing {armor.Name} For + {armor.OriginalValue} Defense"); Console.WriteLine(); ShowInventory(); } else { Console.WriteLine("You already have a weapon equipped."); 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(); } } }
public void EquipArmor() { if (this.EquippedArmor.Name is null) { if (ArmorsBag.Any()) { var count = 1; foreach (var a in this.ArmorsBag) { Console.WriteLine($"{count}. {a.Name} of {a.Defense} Defense"); count++; } Console.WriteLine($"Which Armor would you like to equip?"); var select = Console.ReadLine(); var bagLocation = 0; if (Int32.TryParse(select, out bagLocation)) { if (this.ArmorsBag[bagLocation - 1] != null) { this.EquippedArmor = this.ArmorsBag[bagLocation - 1]; this.ArmorsBag.Remove(this.ArmorsBag[bagLocation - 1]); this.Defense += this.EquippedArmor.Defense; } else { Console.WriteLine($"There is nothing in this part of your bag!"); Console.WriteLine("\nPress any key to continue."); Console.ReadKey(); this.HeroMenu(); } } else { Console.WriteLine($"There was an error!"); Console.WriteLine("\nPress any key to continue."); Console.ReadKey(); this.HeroMenu(); } } else { Console.WriteLine($"\nYou currently have no Armor in your inventroy\nTime to get some gold and go to the store."); Console.WriteLine("\nPress any key to continue."); Console.ReadKey(); this.HeroMenu(); } } else { Console.WriteLine($"\nYou currently have {EquippedArmor.Name} equipped and will have to remove it to equip new armor."); Console.WriteLine("\nPress any key to continue."); Console.ReadKey(); this.HeroMenu(); } }
public void ShowInventory() { int num1 = 1; int num2 = 1; var input = "0"; while (input != "9") { Console.WriteLine("***** INVENTORY ******"); Console.WriteLine("Weapons: "); foreach (var weapon in this.WeaponsBag) { Console.WriteLine(num1 + " " + weapon.Name + " of " + weapon.Strength + " Strength"); num1++; } Console.WriteLine("Armor: "); foreach (var armor in this.ArmorsBag) { Console.WriteLine(num2 + " " + armor.Name + " of " + armor.Defense + " Defense"); num2++; } ; Console.WriteLine("Shield: "); foreach (var shield in this.ShieldBag) { Console.WriteLine(num2 + " " + shield.Name + " of " + shield.Defense + " Defense"); num2++; } ; Console.WriteLine("Potions: "); foreach (var potion in this.PotionBag) { Console.WriteLine(num1 + " " + potion.Name + " of " + potion.HealthRestored + " Health"); num1++; } if (EquippedWeapon != null) { Console.WriteLine("Equipped Weapon: " + EquippedWeapon.Name); } else { Console.WriteLine("Equipped Weapon: None"); }; if (EquippedArmor != null) { Console.WriteLine("Equipped Armor: " + EquippedArmor.Name); } else { Console.WriteLine("Equipped Armor: None"); }; if (EquippedShield != null) { Console.WriteLine("Equipped Shield: " + EquippedShield.Name); } else { Console.WriteLine("Equipped Shield: None"); }; Console.WriteLine("Gold: " + Gold); Console.WriteLine("Please choose an option by entering a number."); Console.WriteLine("1. Equip Armor"); Console.WriteLine("2. Equip Weapon"); Console.WriteLine("3. UnEquip Armor"); Console.WriteLine("4. UnEquip Weapon"); Console.WriteLine("5. Heal"); Console.WriteLine("6. Sell"); Console.WriteLine("7. Equip Shield"); Console.WriteLine("8. UnEquip Shield"); Console.WriteLine("9. Return to Main Menu"); input = Console.ReadLine(); int inputNumber = Int32.Parse(input) - 1; if (input == "1") { int num3 = 1; Console.WriteLine("Please choose the armor to equip by entering a number."); foreach (var armor in this.ArmorsBag) { Console.WriteLine(num3 + " " + armor.Name + " of " + armor.Defense + " Defense"); num3++; } ; input = Console.ReadLine(); inputNumber = Int32.Parse(input) - 1; this.EquipArmor(inputNumber); } else if (input == "2") { int num4 = 1; Console.WriteLine("Please choose the weapon to equip by entering a number."); foreach (var weapon in this.WeaponsBag) { Console.WriteLine(num4 + " " + weapon.Name + " of " + weapon.Strength + " Strength"); num4++; } input = Console.ReadLine(); inputNumber = Int32.Parse(input) - 1; this.EquipWeapon(inputNumber); } else if (input == "3") { this.TotalDefense -= this.EquippedArmor.Defense; this.EquippedArmor = null; } else if (input == "4") { this.TotalStrength -= this.EquippedWeapon.Strength; this.EquippedWeapon = null; } else if (input == "8") { this.TotalDefense -= this.EquippedShield.Defense; this.EquippedShield = null; } else if (input == "5") { Console.WriteLine("Please choose the potion to heal with by entering a number."); int i; for (i = 0; i < this.PotionBag.Count(); i++) { Console.WriteLine($"{i + 1} {this.PotionBag[i].Name} of {this.PotionBag[i].HealthRestored} Health"); } input = Console.ReadLine(); inputNumber = Int32.Parse(input) - 1; this.UseHealthPotion(inputNumber); } else if (input == "6") { var inputKey = "0"; while (inputKey != "4") { Console.WriteLine("Please chose which item type to sell by entering a number."); Console.WriteLine("1. Armor"); Console.WriteLine("2. Weapon"); Console.WriteLine("3. Potion"); Console.WriteLine("4. Return"); inputKey = Console.ReadLine(); var inputNumber2 = Int32.Parse(inputKey) - 1; if (inputKey == "1") { if (ArmorsBag.Any()) { Console.WriteLine("Please choose the Armor to sell with by entering a number."); int i; for (i = 0; i < this.ArmorsBag.Count(); i++) { Console.WriteLine($"{i + 1} {this.ArmorsBag[i].Name} of {this.ArmorsBag[i].Defense} Defence for {this.ArmorsBag[i].Price - 1} Gold"); } inputKey = Console.ReadLine(); inputNumber2 = Int32.Parse(inputKey) - 1; SellBackArmor(inputNumber2); } else { Console.WriteLine("Armor Bag Empty"); } } else if (inputKey == "2") { if (WeaponsBag.Any()) { Console.WriteLine("Please choose the Weapon to sell by entering a number."); int i; for (i = 0; i < this.WeaponsBag.Count(); i++) { Console.WriteLine($"{i + 1} {this.WeaponsBag[i].Name} of {this.WeaponsBag[i].Strength} Strength, Selling Price: {this.WeaponsBag[i].Price - 1}"); } inputKey = Console.ReadLine(); inputNumber2 = Int32.Parse(inputKey) - 1; SellBackWeapon(inputNumber2); } else { Console.WriteLine("Weapon Bag Empty"); } } else if (inputKey == "3") { if (PotionBag.Any()) { Console.WriteLine("Please choose the Potion to sell by entering a number."); int i; for (i = 0; i < this.PotionBag.Count(); i++) { Console.WriteLine($"{i + 1} {this.PotionBag[i].Name} of {this.PotionBag[i].HealthRestored} Health for {this.PotionBag[i].Price - 1} Gold"); } inputKey = Console.ReadLine(); inputNumber2 = Int32.Parse(inputKey) - 1; SellBackPotion(inputNumber2); } else { Console.WriteLine("Potion Bag Empty"); } } } } if (input == "7") { int num3 = 1; Console.WriteLine("Please choose the shield to equip by entering a number."); foreach (var shield in this.ShieldBag) { Console.WriteLine(num3 + " " + shield.Name + " of " + shield.Defense + " Defense"); num3++; } ; input = Console.ReadLine(); inputNumber = Int32.Parse(input) - 1; this.EquipShield(inputNumber); } } }
public void EquipArmor(Armor armor) { this.EquippedArmor = armor; ArmorsBag.Add(armor); }