public void Unequip(string slot) { bool canStoreItem = !(EquipmentSlots[slot].Tags.Contains(Tags.Equipment.EmptySlot)); if (canStoreItem) { Inventory.AddItem((Item)EquipmentSlots[slot]); } switch (slot) { case Slot.MainHand: case Slot.OffHand: EquipmentSlots[slot] = ItemDAO.GenerateNewEquipmentItem(EquipmentCatalog.Hands.BareHand); if (EquipmentSlots[Slot.OffHand].IdName == EquipmentCatalog.Hands.TwoHanding) { EquipmentSlots[Slot.OffHand] = ItemDAO.GenerateNewEquipmentItem(EquipmentCatalog.Hands.BareHand); } break; case Slot.Body: EquipmentSlots[slot] = ItemDAO.GenerateNewEquipmentItem(EquipmentCatalog.Body.Naked); break; case Slot.Charm1: case Slot.Charm2: EquipmentSlots[slot] = ItemDAO.GenerateNewEquipmentItem(EquipmentCatalog.Charms.None); break; } }
public Character(string name, string gender, string professionId) : base(name) { Gender = gender; Profession = ProfessionDAO.GetProfession(professionId); if (gender != Profession.DefaultGender) { Profession.SwapDescriptions(); } BaseAttributes = new Attributes() { Base = Profession.StartingAttributes }; BaseTalents = new Talents() { Base = Profession.StartingTalents }; Health = new Health() { MaxHP = (int)Profession.StartingVitals[Vitals.HP], HPRegen = (int)Profession.StartingVitals[Vitals.HPRegen] }; Stamina = new Stamina() { MaxSP = (int)Profession.StartingVitals[Vitals.SP], SPRegen = (int)Profession.StartingVitals[Vitals.SPRegen] }; EquipmentSlots = new Dictionary <string, EquipmentItem>() { { Slot.Body, ItemDAO.GenerateNewEquipmentItem(Profession.StartingEquipment[Slot.Body]) }, { Slot.MainHand, ItemDAO.GenerateNewEquipmentItem(Profession.StartingEquipment[Slot.MainHand]) }, { Slot.OffHand, ItemDAO.GenerateNewEquipmentItem(Profession.StartingEquipment[Slot.OffHand]) }, { Slot.Charm1, ItemDAO.GenerateNewEquipmentItem(Profession.StartingEquipment[Slot.Charm1]) }, { Slot.Charm2, ItemDAO.GenerateNewEquipmentItem(Profession.StartingEquipment[Slot.Charm2]) } }; foreach (var kvp in Profession.StartingInventory) { for (int i = 0; i < kvp.Value; i++) { Inventory.AddItem(ItemDAO.GenerateNewItem(kvp.Key)); } } // Fill vitals to max after equipment bonuses are set HP = MaxHP; SP = MaxSP; }
public void ToggleTwoHanding() { var mainHandRequiresTwoHanding = EquipmentSlots[Slot.MainHand].Tags.Contains(Tags.Restrictions.MustTwoHand); if (IsTwoHanding && mainHandRequiresTwoHanding) { Unequip(Slot.MainHand); Unequip(Slot.OffHand); } else if (IsTwoHanding && !mainHandRequiresTwoHanding) { Unequip(Slot.OffHand); } else { if (EquipmentSlots[Slot.MainHand].Tags.Contains(Tags.Restrictions.CannotTwoHand)) { throw new CannotTwoHandException(); } Unequip(Slot.OffHand); EquipmentSlots[Slot.OffHand] = ItemDAO.GenerateNewEquipmentItem(EquipmentCatalog.Hands.TwoHanding); } }