protected int PowerFromEquippedWeapon() { int power = 0; Equipment eq = GetComponentInParent <Equipment>(); Equippable item = eq.GetItem(EquipSlots.Primary); if (item == null || !item.GetComponentInChildren <WeaponAbilityPower>().GetType().Equals(GetType())) { item = eq.GetItem(EquipSlots.Secondary); } if (item == null || !item.GetComponentInChildren <WeaponAbilityPower>().GetType().Equals(GetType())) { return(power); } if (item != null && item.GetComponentInChildren <WeaponAbilityPower>().GetType().Equals(GetType())) { StatModifierFeature[] features = item.GetComponentsInChildren <StatModifierFeature>(); for (int i = 0; i < features.Length; ++i) { if (features[i].type == StatTypes.MEL) { power += features[i].amount; } } } return(power); }