public static Armor LoadArmor(int id) { ArmorList armors = Load <ArmorList>("Armor"); Armor armor = armors.Armors.Find((x) => x.ID == id); return(armor); }
public void RemoveArmor(Armor armor) { if (armor != null) { ArmorList.Remove(armor); } throw new NullReferenceException("Armor is not filled out"); }
public void CreaturePicksUpArmor(Entities entity, Armor armor) { if (!ArmorList.Contains(armor)) { return; } entity.EquipArmor(armor); }
public void HumanPickUpsArmor(HumanPlayer Player, Armor armor) { if (!ArmorList.Contains(armor)) { return; } Player.EquipArmor(armor); }
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; } }
public void ListArmors() { Console.WriteLine("Armors:"); var count = 1; foreach (var armor in ArmorList.OrderBy(a => a.OriginalValue)) { Console.WriteLine($"a{count}. {armor.Name} - Original Value: {armor.OriginalValue}, Resell Value: {armor.ResellValue}"); ItemCatalog.Add($"a{count}", armor); count++; } Console.WriteLine(); }
private void ShowArmor() { var count = 1; ArmorCatalog.Clear(); Console.WriteLine("*** Armor List ***"); Console.WriteLine($"# Armor Name D OV SV"); foreach (var armor in ArmorList.OrderBy(x => x.Name)) { Console.WriteLine($"a{count}. {armor.Name, -20} {armor.Defense, 3} {armor.OriginalValue, 4:C0} {armor.ResellValue, 4:C0}"); ArmorCatalog.Add($"a{count}", armor); count++; } }
public ArmorJson SearchArmorID(string id) { return(ArmorList.Find((obj) => obj.id.Equals(id))); }
public void AddArmortoWorld(ArmorType armorType, string armorname, double defense, int positionX, int positionY) { ArmorList.Add(ArmorFactory.getTypeOfArmor(armorType, armorname, defense, positionX, positionY)); }
private void LoadArmor() { ArmorList.Add(new Armor("Wooden Suit", 3, 10, 2)); ArmorList.Add(new Armor("Metal Suit", 7, 20, 5)); }
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; } }
public void AddArmor(string name, int armor) { ArmorList.Add(new Armor(name, armor)); }