Interface IModifierFormula
This is used by the IEconomyService to apply numeric logic against groups of IModifier objects.
Given a target IModifiable this formula returns a value that represents the amount that all referenced IModifierData
objects grouped by IModifierGroupData resolve down to. As of 1.0, IModifierFormulas are binded as singletons
so there is the assumption only one instance of a type of IModifierFormula and IModifierFormulaData is available.
The above formula would replace "base" with baseAmount. It would also collect all IModifierData objects that target the referenced
IModifierGroupData ids and resolve those amounts down to a single value per IModifierGroupData. Those values are
injected in place of the ids. The result is a completely numeric formula that can then be parsed by the IModifierFormulaParser.
Inherited Members
Namespace: IdleKit.Framework
Assembly: cs.temp.dll.dll
Syntax
public interface IModifierFormula : IEntity, IInjectable
Properties
affectedModifierGroups
Returns an array of IModifierGroupData that are referenced in the modifierFormulaData
Declaration
IModifierGroupData[] affectedModifierGroups { get; }
Property Value
Type | Description |
---|---|
IModifierGroupData[] |
modifierFormulaData
The associated IModifierFormulaData. This contains the actual formula.
Declaration
IModifierFormulaData modifierFormulaData { get; }
Property Value
Type | Description |
---|---|
IModifierFormulaData |
Methods
AffectModifiableType(Type)
Whether or not the IModifiable's type is included the formula's targetModifiableTypes
Declaration
bool AffectModifiableType(Type modifiableType)
Parameters
Type | Name | Description |
---|---|---|
Type | modifiableType | The type of IModifiable that is affected or not |
Returns
Type | Description |
---|---|
Boolean |
Apply(IModifier[], Double, Int32)
Given a base amount and any required additional levels, returns a single amount based on the logic of the formula.
Declaration
double Apply(IModifier[] modifiers, double baseAmount, int additionalLevels)
Parameters
Type | Name | Description |
---|---|---|
IModifier[] | modifiers | The IModifier objects that affect the IModifiable |
Double | baseAmount | The base amount to use in the formula |
Int32 | additionalLevels | Any additional levels to take into account when calculating the formulas result |
Returns
Type | Description |
---|---|
Double |
IncludeModifier(IModifier)
Whether or not the IModifier's IModifierDatas include IModifierGroupData that is in the formula's affectedModifierGroupss
Declaration
bool IncludeModifier(IModifier modifier)
Parameters
Type | Name | Description |
---|---|---|
IModifier | modifier | The IModifier that is included or not |
Returns
Type | Description |
---|---|
Boolean |