//populating the attack item list. //Constructor for inventory public Inventory() { _weaponList[0] = new AttackItem("Dagger", 10, 3); _weaponList[1] = new AttackItem("Sword", 15, 7); _weaponList[2] = new AttackItem("Scepter", 8, 8); _weaponList[3] = new AttackItem("Bow", 22, 12); _armorList[0] = new DefenseItem("Leather", 25, 5); _armorList[1] = new DefenseItem("Chain Mail", 35, 15); _armorList[2] = new DefenseItem("Plate", 50, 25); _armorList[3] = new DefenseItem("Robes", 0, 1); }
public void EquipWeapon(AttackItem newWeapon) { if (_weapon) { _currentWeight += newWeapon.weight; if (_currentWeight < _maxWeight) { _damage = newWeapon.Damage; Console.WriteLine("You have Equipped a " + newWeapon.name + "."); Console.WriteLine("Damage: " + newWeapon.Damage); Console.WriteLine("Weight: " + _currentWeight); _weapon = true; _currentWeapon = newWeapon; } else { _currentWeight -= newWeapon.weight; Console.WriteLine("That item is too heavy."); _weapon = false; } } else { _currentWeight += newWeapon.weight; if (_currentWeight < _maxWeight) { _damage = newWeapon.Damage; Console.WriteLine("You have Equipped a " + newWeapon.name + "."); Console.WriteLine("Damage: " + newWeapon.Damage); Console.WriteLine("Weight: " + _currentWeight); _weapon = true; _currentWeapon = newWeapon; } else { _currentWeight -= newWeapon.weight; Console.WriteLine("That item is too heavy."); _weapon = false; } } }
public void UnequipWeapon(AttackItem weapon) { //You cannot unequip your hands; _damage = 5; _currentWeight -= weapon.weight; }