public void AddShieldToInventory(Shield newShield) { Shield currentShield = UserInventory.OfType <Shield>().FirstOrDefault(w => w.Equipped == true); if (currentShield == null) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine($"you found a... "); Console.WriteLine(newShield); Console.WriteLine("Its now equiped."); Console.ForegroundColor = ConsoleColor.White; newShield.Equipped = true; BlockRating = newShield.BlockRating; UserInventory.Add(newShield); Armour = newShield.ArmourAmount; } else if (newShield.BlockRating > currentShield.BlockRating) { currentShield.Equipped = false; newShield.Equipped = true; Armour = newShield.ArmourAmount; BlockRating = newShield.BlockRating; UserInventory.Add(newShield); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine($"you found a... "); Console.WriteLine(newShield); Console.WriteLine("Its now equiped."); Console.ForegroundColor = ConsoleColor.White; } else { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("You found a.."); Console.WriteLine(newShield); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("You current one is better.. you add it to inventory.."); UserInventory.Add(newShield); } Console.ReadKey(); }
public string ClassPrintInformation() { StringBuilder sb = new StringBuilder(); sb.AppendFormat("-------------------------------------\n"); sb.AppendFormat("| Player Stats |\n"); sb.AppendFormat("-------------------------------------\n"); sb.AppendFormat($"Name {Name}\n"); sb.AppendFormat($"Level {Level} \n"); sb.AppendFormat($"Health {Health}hp\n"); sb.AppendFormat($"Tnl {ExpBar - Experience}xp\n"); sb.AppendFormat($"Gold {Gold}\n"); sb.AppendFormat($"Race {CharRace} ({CharClass})\n\n"); sb.AppendFormat($"Stats\n"); sb.AppendFormat($"Dmg {DmgLowerBound} - {DmgUpperBound}\n"); sb.AppendFormat($"Armour {Armour}\n"); sb.AppendFormat($"Strength {Strength}\n"); sb.AppendFormat($"Intelligence {Intelligence}\n"); sb.AppendFormat($"Dexterity {Dexerity}\n"); sb.AppendFormat($"Charisma {Charisma}\n"); sb.AppendFormat($"MainQuest {MainQuest}\n"); sb.AppendFormat($"Equipment\n"); var currentWeapon = UserInventory.OfType <Weapon>().FirstOrDefault(w => w.Equipped == true); var currentShield = UserInventory.OfType <Shield>().FirstOrDefault(s => s.Equipped == true); if (currentWeapon != null) { sb.AppendFormat($"Weapon {currentWeapon.ItemQuality} {currentWeapon.TypeOfWeapon}\n"); sb.AppendFormat($"Dmg ({currentWeapon.DmgLowerBound} - {currentWeapon.DmgUpperBound}) dmg\n"); } if (currentShield != null) { sb.AppendFormat($"Shield {currentShield.ItemQuality} {currentShield.ShieldName} \n"); sb.AppendFormat($"Armour {currentShield.ArmourAmount} Rating: {currentShield.BlockRating} \n"); } sb.AppendFormat("-------------------------------------\n"); return(sb.ToString()); }
public void AddWeaponToInventory(Weapon newWeapon) { Weapon currentWeapon = UserInventory.OfType <Weapon>().FirstOrDefault(w => w.Equipped == true); if (currentWeapon == null) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine($"you found a"); Console.WriteLine(newWeapon); Console.WriteLine("Its now equiped."); Console.ForegroundColor = ConsoleColor.White; newWeapon.Equipped = true; UserInventory.Add(newWeapon); SetDmg(newWeapon); } else if (newWeapon.DmgUpperBound > currentWeapon.DmgUpperBound) { currentWeapon.Equipped = false; newWeapon.Equipped = true; SetDmg(newWeapon); UserInventory.Add(newWeapon); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine($"you found a"); Console.WriteLine(newWeapon); Console.WriteLine("Its now equiped."); Console.ForegroundColor = ConsoleColor.White; } else { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("You found a.."); Console.WriteLine(newWeapon); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("You current one is better.. you add it to inventory.."); UserInventory.Add(newWeapon); } Console.ReadKey(); }