public ChainmailBikini(int level) { mArmor = 20 * (level + 1); PropertyDescriptions.Add("==Chainmail bikini=="); PropertyDescriptions.Add($"Armor +{mArmor}"); }
public Sword(int level) { mAttack = Random.Range(15, 20) * (level + 1); PropertyDescriptions.Add("==Sword=="); PropertyDescriptions.Add($"Attack +{mAttack}"); }
public Staff(int level) { mSpellDamage = Random.Range(0.2f, 0.4f) * (level + 1) + 1; PropertyDescriptions.Add("==Staff=="); PropertyDescriptions.Add($"Skill damage x{mSpellDamage:#.00}"); }
public Spear(int level) { mAttack = Random.Range(3, 7) * (level + 1); mRange = 0.5f; PropertyDescriptions.Add("==Spear=="); PropertyDescriptions.Add($"Attack +{mAttack}"); PropertyDescriptions.Add($"Attack range +{mRange}"); }
public Robe(int level) { mMaxMana = Random.Range(10, 20) * (level + 1); mManaRegen = Random.Range(0.5f, 0.7f) * (level + 1); PropertyDescriptions.Add("==Robe=="); PropertyDescriptions.Add($"Max mana +{mMaxMana}"); PropertyDescriptions.Add($"Mana regen +{mManaRegen}"); }
public Chainmail(int level) { mMaxHp = Random.Range(10, 20) * (level + 1); mArmor = Random.Range(1, 3) * (level + 1); PropertyDescriptions.Add("==Chainmail=="); PropertyDescriptions.Add($"Max health +{mMaxHp}"); PropertyDescriptions.Add($"Armor +{mArmor}"); }
public static void ReflectProperties( Type targetType, PropertyDescriptions propertyDescriptions, ItemDescriptions itemDescriptions, WoopsaConverters customValueTypeConverters = null) { PropertyInfo[] properties; if (!targetType.IsInterface) { properties = targetType.GetProperties(BindingFlags.Public | BindingFlags.Instance); } else { properties = (new Type[] { targetType }).Concat(targetType.GetInterfaces()).SelectMany(i => i.GetProperties()).ToArray(); } foreach (var propertyInfo in properties) { WoopsaValueTypeAttribute attribute = GetCustomAttribute <WoopsaValueTypeAttribute>(propertyInfo); bool isValidWoopsaProperty = false; isValidWoopsaProperty = InferWoopsaType(customValueTypeConverters, propertyInfo.PropertyType, out WoopsaValueType woopsaPropertyType, out WoopsaConverter converter); if (attribute != null) { woopsaPropertyType = attribute.ValueType; isValidWoopsaProperty = true; } if (isValidWoopsaProperty) { //This property is a C# property of a valid basic Woopsa Type, it can be published as a Woopsa property PropertyDescription newPropertyDescription = new PropertyDescription( woopsaPropertyType, propertyInfo, !propertyInfo.CanWrite || propertyInfo.GetSetMethod(false) == null, converter); propertyDescriptions.Add(newPropertyDescription); } else if (!propertyInfo.PropertyType.IsValueType) { // This property is not of a WoopsaType, if it is a reference type, assume it is an inner item ItemDescription newItem = new ItemDescription(propertyInfo); itemDescriptions.Add(newItem); } } }