public void equipArmor(Armor armor) { for (int i = 0; i < armor.EquipableIn.Count; i++) { switch (armor.EquipableIn[i]) { case Slots.Head: helmet = (Armor)armor; break; case Slots.Chest: chestPlate = (Armor)armor; break; case Slots.Legs: grieves = (Armor)armor; break; } } }
public Armor removeArmor(Armor type) { Armor removedArmor = null; for (int i = 0; i < type.EquipableIn.Count; i++) { switch (type.EquipableIn[i]) { case Slots.Head: removedArmor = helmet; helmet = null; break; case Slots.Legs: removedArmor = grieves; grieves = null; break; case Slots.Chest: removedArmor = chestPlate; chestPlate = null; break; } } return removedArmor; }
public bool isArmorEquipable(Armor armor, Classes heroRole, int level) { bool result = false; string logInfo = "You can't equip this armor"; if (armor != null) { logInfo = "Your class cannot equip this item."; bool equipable = false; for (int i = 0; i < armor.UsedBy.Count && !equipable; i++) { equipable = (armor.UsedBy[i] == heroRole); } result = (equipable && armor.LevelReq <= level); if (!result && equipable) { logInfo = "You aren't a high enough level to equip this piece of armor."; } } if (!result) { Engine.Engine.Log(logInfo); } return result; }