EditorDeepModifier
This is the authoring class for creating Modifiers via the Unity Editor. Use it’s custom editor to create a wide range of Modifiers. Modifiers can be added to DeepStatsInstances and DeepModifierCollections
Modifier Overview
- Modifier Type: The type of modification to the Stat you want to make.
- Set Min / Max Values: Whether you’ll be modifying the min and max value of the Stat separately.
- Modify Value: The magnitude to apply this Modifier.
- Target Stat: Which Stat you want to modify.
- Modifier Scaling Source: Whether you want to scale the Modify Value. ‘Self’ will use a Scaler from the DeepStats with this Modifier, ‘Target’ will use a Scaler from a Target DeepStats passed in when calculating stats. You can also use both, in which case they Scalers will be added together.
- Modifier Scaler: Which Scaler value to look up.
- Clamp Scaler Range: The min and max values to clamp the Scaler to.
- The required Tags on the DeepStats instance that has this Modifier for this Modifier to apply
- The required Tags on the Target DeepStats instance passed in when calculating stats, for this Modifier to apply.
Types of Modifiers
Add
Adds a flat value to the target stat.
eg. TargetStat + 5
SumMultiply
Adds a value with all the other SumMultiply mods, before multiplying the target stat.
eg. TargetStat * (1 + mod1 + mod2 + mod3 + ...)
ProductMultiply
Multiplies the target stat by a value.
eg. TargetStat * 2
AddedAs
The base value of Dependent Stat is converted into Target Stat, and then scaled by any Sum/Product Multiplies which affect either the dependent or target Stat Types. The modifiers are combined together before applying so that the standard order of operations still applies. If a chain of AddedAs is created by converting a stat multiple times, the modifiers of any of the relevant stat types apply to the final value. eg. DependentStat * 0.5 * (1 + dependentSumMultiplies + targetSumMultiplies) * (dependentProductMultiplies * targetProductMultiplies)
ConvertedTo
ConvertedTo operates the same as AddedAs, except additionally the DependentStat will be reduced by the conversion ratio.
You cannot convert more than 100% of a Stat. If total conversion exceeds 100%, all conversion Modifiers will be scaled down equally so that the sum is 100%.
ModifiersAlsoApplyToStat
Takes the total modifications to each Target Modify Type from Dependent Stat, and accumulates them onto Target Stat.
ConvertSelfTags
Finds any Modifiers which have the Required Tags under Self and creates a copy of them with Required Tags replaced by New Tags.
For example, the Modifier below would have a second version added that requires a Player tag instead of a Minion Tag.
ConvertTargetTags
Functions the same as ConvertSelfTags, except it searches for Tags in the Target section instead.
FinalAdd, FinalSumMultiply, FinalSumMultiply
These operate the same as the non-final Modifier types, except they apply after all the previous Modifiers.
Order of operations for Stat Calculation
Stat calculations happen in the following order:
- All ‘Add’ Modifiers are summed together.
- Starting with a value of 1, all ‘SumMultiply’ Modifiers are ADDED together. The result is multiplied by the previous value.
- Starting with a value of 1, all ‘ProductMultiply’ Modifiers are MULTIPLIED together. The result is multiplied by the previous value.
- Any conversions or ‘added-as’ TO this StatType are then added.
- Any conversions FROM this StatType are removed, clamping at a maximum of 100% conversion. All conversions will be scaled down if total FROM exceeds 100%
- Raw value is now complete.
- ‘Final’ type modifiers are applied.
- Final value is now complete.