// add modifiers for the character's attributes, strength, intellegence etc... from the equipment private void ApplyCharacterModifiers(EquipableItem item) { foreach (var mod in item.statModDict) { characterStats.playerAttributeDict[mod.Key].AddModifier(mod.Value); } }
// add base damage and defense etc.. from the item private void ApplyEquipmentStats(EquipableItem item) { foreach (var mod in item.equipmentStatDict) { characterStats.playerCombatStatDict[mod.Key].AddModifier(mod.Value); } }
private void EquipItem(EquipableItem item) { LoadEquipmentOnSlot(item, item.slotType); item.equipped = true; modHandler.ApplyEquipmentModifiers(item); characterStats.SetMaxAPFromStamina(); characterStats.SetMaxHealthFromVitality(); }
public void LoadEquipmentOnSlot(EquipableItem item, SlotType slotType) { switch (slotType) { case SlotType.amulet: if (amuletSlot.currentModel != null) { amuletSlot.UnloadEquipment(); } amuletSlot.LoadEquipmentModel(item); break; case SlotType.leftHandSlot: if (leftHandSlot.currentModel != null) { leftHandSlot.UnloadEquipment(); } leftHandSlot.LoadEquipmentModel(item); break; case SlotType.rightHandSlot: if (rightHandSlot.currentModel != null) { rightHandSlot.UnloadEquipment(); } rightHandSlot.LoadEquipmentModel(item); break; case SlotType.quiver: if (quiverSlot.currentModel != null) { quiverSlot.UnloadEquipment(); } quiverSlot.LoadEquipmentModel(item); break; default: if (playerEquipment.gender == Gender.Male) { for (int i = 0; i < item.itemMeshesMale.Count; i++) { playerEquipment.LoadEquipmentMesh(item.itemMeshesMale[i], item.itemMeshLocs[i]); } } else { for (int i = 0; i < item.itemMeshesFemale.Count; i++) { playerEquipment.LoadEquipmentMesh(item.itemMeshesFemale[i], item.itemMeshLocs[i]); } } break; } }
public void RemoveAllModifiers(EquipableItem item) { foreach (var mod in characterStats.playerAttributeDict) { mod.Value.RemoveAllModifiersFromSource(item); } foreach (var mod in characterStats.playerCombatStatDict) { mod.Value.RemoveAllModifiersFromSource(item); } }
private void ApplyEquipmentScalers(EquipableItem item) { foreach (var mod in item.scaleModDict) { float scaleFactor = characterStats.playerAttributeDict[mod.Key].Value * mod.Value; if (item._fireDamage != 0) { characterStats.fireDamage.AddModifier(new StatModifier(scaleFactor, StatModType.Flat, item)); } if (item._waterDamage != 0) { characterStats.waterDamage.AddModifier(new StatModifier(scaleFactor, StatModType.Flat, item)); } if (item._shockDamage != 0) { characterStats.shockDamage.AddModifier(new StatModifier(scaleFactor, StatModType.Flat, item)); } if (item._pierceDamage != 0) { characterStats.pierceDamage.AddModifier(new StatModifier(scaleFactor, StatModType.Flat, item)); } if (item._poisonDamage != 0) { characterStats.poisonDamage.AddModifier(new StatModifier(scaleFactor, StatModType.Flat, item)); } if (item._normalDamage != 0) { characterStats.normalDamage.AddModifier(new StatModifier(scaleFactor, StatModType.Flat, item)); } if (item._armor != 0) { characterStats.armor.AddModifier(new StatModifier(scaleFactor, StatModType.Flat, item)); } if (item._fireResistance != 0) { characterStats.fireResistance.AddModifier(new StatModifier(scaleFactor, StatModType.Flat, item)); } if (item._waterResistance != 0) { characterStats.waterResistance.AddModifier(new StatModifier(scaleFactor, StatModType.Flat, item)); } if (item._shockResistance != 0) { characterStats.shockResistance.AddModifier(new StatModifier(scaleFactor, StatModType.Flat, item)); } if (item._poisonResistance != 0) { characterStats.poisonResistance.AddModifier(new StatModifier(scaleFactor, StatModType.Flat, item)); } } }
public void UnloadEquipementOnEquipMenu(EquipableItem item, SlotType slotType) { switch (slotType) { case SlotType.helmet: EquipedHelmet.item = null; EquipedHelmet.UpdateSlot(); break; case SlotType.amulet: EquipedAmulet.item = null; EquipedAmulet.UpdateSlot(); break; case SlotType.leggings: EquipedLegging.item = null; EquipedLegging.UpdateSlot(); break; case SlotType.gloves: EquipedGloves.item = null; EquipedGloves.UpdateSlot(); break; case SlotType.boots: EquipedBoots.item = null; EquipedBoots.UpdateSlot(); break; case SlotType.torso: EquipedTorso.item = null; EquipedTorso.UpdateSlot(); break; case SlotType.leftHandSlot: EquipedLeftHand.item = null; EquipedLeftHand.UpdateSlot(); break; case SlotType.rightHandSlot: EquipedRightHand.item = null; EquipedRightHand.UpdateSlot(); break; case SlotType.quiver: EquipedRightHand.item = null; EquipedRightHand.UpdateSlot(); break; } }
public void UnloadEquipmentOnSlot(EquipableItem item, SlotType slotType) { switch (slotType) { case SlotType.leftHandSlot: if (leftHandSlot.currentModel != null) leftHandSlot.UnloadEquipment(); break; case SlotType.rightHandSlot: if (rightHandSlot.currentModel != null) rightHandSlot.UnloadEquipment(); break; case SlotType.quiver: if (quiverSlot.currentModel != null) quiverSlot.UnloadEquipment(); break; } }
public void UnloadEquipmentOnSlot(EquipableItem item, SlotType slotType) { switch (slotType) { case SlotType.amulet: if (amuletSlot.currentModel != null) { amuletSlot.UnloadEquipment(); } break; case SlotType.leftHandSlot: if (leftHandSlot.currentModel != null) { leftHandSlot.UnloadEquipment(); } break; case SlotType.rightHandSlot: if (rightHandSlot.currentModel != null) { rightHandSlot.UnloadEquipment(); } break; case SlotType.quiver: if (quiverSlot.currentModel != null) { quiverSlot.UnloadEquipment(); } break; default: foreach (meshLocation loc in item.itemMeshLocs) { playerEquipment.ResetToBaseEquipment(loc); } break; } }
public void LoadEquipmentModel(EquipableItem item) { if (item == null) { return; } GameObject equipmentModel = Instantiate(item.modelPrefab) as GameObject; if (equipmentModel != null) { if (parentOverride != null) { equipmentModel.transform.parent = parentOverride; } else { equipmentModel.transform.parent = transform; } foreach (Transform t in equipmentModel.GetComponentsInChildren <Transform>()) { t.gameObject.layer = equipmentModel.transform.parent.gameObject.layer; } equipmentModel.transform.localPosition = Vector3.zero; equipmentModel.transform.localRotation = Quaternion.identity; equipmentModel.transform.localScale = Vector3.one; if (animationHandler.tag == "Player") { equipmentModel.transform.GetChild(0).GetChild(0).localScale = Vector3.one * 100f; } } currentModel = equipmentModel; animationHandler.animator.SetBool("Equiped", true); }
public void LoadEquipementOnEquipMenu(EquipableItem item, string slotType) { switch (slotType) { case "helmetSlot": EquipedHelmet.item = item; break; case "amuletSlot": EquipedAmulet.item = item; break; case "leggingSlot": EquipedLegging.item = item; break; case "gloveSlot": EquipedGloves.item = item; break; case "bootSlot": EquipedBoots.item = item; break; case "torsoSlot": EquipedTorso.item = item; break; case "leftHandSlot": EquipedLeftHand.item = item; break; case "rightHandSlot": EquipedRightHand.item = item; break; } }
public void Use(EquipableItem item) { if (currentInventoryObject.tag == "EquipmentSlot") { equipmentSlotManager.UnloadEquipmentOnSlot(item, item.slotType); equipmentSlotManager.UnloadEquipementOnEquipMenu(item, item.slotType); item.equipped = false; modHandler.RemoveAllModifiers(item); inventoryHandler.AddItem(item); characterStats.SetMaxAPFromStamina(); characterStats.SetMaxHealthFromVitality(); } else { equipmentSlotManager.LoadEquipmentOnSlot(item, item.slotType); equipmentSlotManager.LoadEquipementOnEquipMenu(item, item.slotType); item.equipped = true; modHandler.ApplyEquipmentModifiers(item); characterStats.SetMaxAPFromStamina(); characterStats.SetMaxHealthFromVitality(); } statpreview.updateStatTexts(); }
public void ApplyEquipmentModifiers(EquipableItem item) { ApplyCharacterModifiers(item); ApplyEquipmentStats(item); ApplyEquipmentScalers(item); }
public void LoadEquipmentOnSlot(EquipableItem item, string slotType) { switch (slotType) { case "helmetSlot": if (helmetSlot.currentModel != null) { helmetSlot.UnloadEquipment(); } helmetSlot.LoadEquipmentModel(item); break; case "amuletSlot": if (amuletSlot.currentModel != null) { amuletSlot.UnloadEquipment(); } amuletSlot.LoadEquipmentModel(item); break; case "leggingSlot": if (leggingSlot.currentModel != null) { leggingSlot.UnloadEquipment(); } leggingSlot.LoadEquipmentModel(item); break; case "gloveSlot": if (gloveSlot.currentModel != null) { gloveSlot.UnloadEquipment(); } gloveSlot.LoadEquipmentModel(item); break; case "bootSlot": if (bootSlot.currentModel != null) { bootSlot.UnloadEquipment(); } bootSlot.LoadEquipmentModel(item); break; case "torsoSlot": if (torsoSlot.currentModel != null) { torsoSlot.UnloadEquipment(); } torsoSlot.LoadEquipmentModel(item); break; case "leftHandSlot": if (leftHandSlot.currentModel != null) { leftHandSlot.UnloadEquipment(); } leftHandSlot.LoadEquipmentModel(item); break; case "rightHandSlot": if (rightHandSlot.currentModel != null) { rightHandSlot.UnloadEquipment(); } rightHandSlot.LoadEquipmentModel(item); break; } }