/// <summary> /// Adds a piece of equipment to this. /// </summary> /// <param name="inventory">The inventory to take the item from.</param> /// <param name="caster">The one equipping the equip onto this equipment.</param> /// <param name="equippableItem">The equippable item to equip.</param> public void AddEquip(Inventory inventory, BuffParams caster, EquippableItem equippableItem) { inventory.Remove(equippableItem); if (Contains(equippableItem.Type)) { RemoveEquip(inventory, equippableItem.Type); } Buff buff = equippableItem.CreateBuff(); if (buff != null) { buff.Caster = caster; itemBuffs.Add(equippableItem.Type, buff); AddBuff(buff); } equipped.Add(equippableItem.Type, equippableItem); foreach (KeyValuePair <StatType, int> pair in equippableItem.StatBonuses) { Util.Assert(StatType.ASSIGNABLES.Contains(pair.Key), "Invalid stat type on equipment."); this.statBonuses[pair.Key] += pair.Value; AddSplat(new SplatDetails(pair.Key, pair.Value, string.Empty)); } }