static public void UpgradeShield(CharacterClass character, Shield currentShield, int shieldCraftingCost) // Done { string reRollItem = ""; if ((int)currentShield.ItemQuality < 12) { if (character.Gold >= shieldCraftingCost && character.CraftingMaterial >= shieldCraftingCost) { character.Gold -= shieldCraftingCost; character.CraftingMaterial -= shieldCraftingCost; Shield newShield = UpgradeShield(currentShield); Console.WriteLine($"Old shield \n" + currentShield); character.UserInventory.Remove(currentShield); character.AddShieldToInventory(newShield); } else { Console.WriteLine("You cannot afford that... \nCheck that you have enough gold or materials"); Console.ReadKey(); } } else { Console.WriteLine("You cannot upgrade that its fully upgraded."); Console.WriteLine("Would you like to reroll the stats for the current shield? "); Console.WriteLine("Cost: 1000g"); Console.WriteLine("1. Yes"); Console.WriteLine("2. No"); reRollItem = Console.ReadLine(); switch (reRollItem) { case "1": if (character.Gold >= 1000) { character.Gold -= 1000; Shield newShield = new Shield((int)currentShield.TypeOfShield, (int)currentShield.ItemQuality); Console.WriteLine($"Old shield \n" + currentShield); character.UserInventory.Remove(currentShield); character.AddShieldToInventory(newShield); } else { Console.WriteLine("Come Back When you can pay me.."); } break; case "2": Console.WriteLine("(The Blacksmith) -Maybe you should, never know what can happen!!!"); break; default: Console.WriteLine("(Luis) -Stop trying to ruin the game!!!"); break; } } }
public override void MonsterDied(Monster monster, CharacterClass character) { Creature temporaryCreature = (Creature)monster; Random typeOfLoot = new Random(); Console.WriteLine($"You vanquised {Name}, and looted {monster.GoldValue} Gold and {monster.ExperienceValue}xp"); Console.WriteLine($"And a random item .... "); if (typeOfLoot.Next(1, 3) == 1) { Weapon weaponLoot = RandomWeapon(QualityGenerator(monster)); character.AddWeaponToInventory(weaponLoot); } else { Shield shieldLoot = RandomShield(QualityGenerator(monster)); character.AddShieldToInventory(shieldLoot); } character.ExperienceGained(monster.ExperienceValue); character.Gold += monster.GoldValue; }
public void BuyDefensive(CharacterClass character) // Done { string buyDef = "y"; int whatShieldID; do { Console.Clear(); Console.WriteLine("This is what i have for you.."); Console.WriteLine("--------------------------------------------------------------------"); Console.WriteLine(" Shield Inventory"); Console.WriteLine("--------------------------------------------------------------------"); for (int i = 0; i < StoreShieldInventory.Count; i++) { Console.WriteLine($"Id:{i + 1}. {StoreShieldInventory[i].ItemQuality} {StoreShieldInventory[i].ShieldName}".PadRight(30) + $"Armour ({StoreShieldInventory[i].ArmourAmount})".PadRight(16) + $"Rating {StoreShieldInventory[i].BlockRating} " + $"Price: {StoreShieldInventory[i].Price}"); } Console.WriteLine(""); Console.WriteLine("0. Not Interested"); Console.WriteLine("--------------------------------------------------------------------"); character.PrintInfoForShop(); Shield currentShield = character.UserInventory.OfType <Shield>().FirstOrDefault(w => w.Equipped == true); if (currentShield != null) { Console.WriteLine("Equipped Shield"); Console.WriteLine($"{currentShield.ItemQuality} {currentShield.ShieldName} Armour: {currentShield.ArmourAmount} Rating: {currentShield.BlockRating}"); Console.WriteLine("---------------------------------------------------------"); } Console.WriteLine("What ID number would you like to purchase?"); if (int.TryParse(Console.ReadLine(), out whatShieldID)) { if (whatShieldID <= StoreShieldInventory.Count && whatShieldID > 0) { if (character.Gold > StoreShieldInventory[whatShieldID - 1].Price) { var p1 = new System.Windows.Media.MediaPlayer(); p1.Open(new System.Uri(Environment.CurrentDirectory + @"\cash.wav")); p1.Play(); Console.WriteLine("Congratulations you have bought a new Item"); Console.WriteLine($"{StoreShieldInventory[whatShieldID - 1].Price} gold has been removed.."); character.AddShieldToInventory(StoreShieldInventory[whatShieldID - 1]); character.Gold -= StoreShieldInventory[whatShieldID - 1].Price; buyDef = "n"; StoreShieldInventory.RemoveAt(whatShieldID - 1); } else { Console.WriteLine("You cannot afford this.. Maybe start out with something smaller?"); Console.ReadKey(); } } else if (whatShieldID == 0) { Console.WriteLine("Im getting really tiered of this.."); buyDef = "n"; Console.ReadKey(); } else { Console.WriteLine($"Please try a number between 1-{StoreWeaponInventory.Count} Or 0 to exit.."); Console.ReadKey(); } } else { Console.WriteLine($"I didnt understand that, Please try a number between 1-{StoreWeaponInventory.Count} Or 0 to exit.."); Console.ReadKey(); } } while (buyDef != "n"); }