Skip to content

Modifier

IModifier, IModifierDataCollection

IModifier is extended by an Entity that can modify the values of other entities, specifically IModifiables. A Modifier (e.g. IUpgradeableCurrency) must have a IModifierDataCollection in its static data (e.g. IUpgradeableCurrencyData), which contains a list of IModifierData. There are currently three types of IModifiers in IdleKit:

  • Upgradeable Currency Modifier: modifier associated with an IUpgradeableCurrency (e.g. Character cards and Generator cards in TPB). These modifiers remain the same throughout the game and are adjustable in IUpgradeableCurrencyData.

  • Generator Unit Target Modifier: modifier associated with generator payout by increasing the generator units of an IGeneratorEntity (e.g. buying Customers in TPB). These modifiers can be different on different Stages and are adjustable in IGeneratorBalanceData.

  • Boost Modifier: modifier associated with an IBoost (e.g. video ads in TPB). These modifiers remain the same throughout the game and are adjustable in IBoostData.

IModifiable, IModifiableData

IModifiable is extended by an Entity that can be modified by IModifiers. A Modifiable (e.g. IGeneratorEntity) must contain static data that implements IModifiableData (e.g. IGeneratorData). There are three types of IModifiables currently in IdleKit:

  • Collector - payout and speed can be modified
  • Generator - generator unit cost, payout, and speed can be modified
  • Stage - ascension power can be modified

IModifierData

An IModifierDataCollection stores a list of IModifierData. Each IModifierData stores an array of amounts that can be applied based on the level of the IModifier. It also stores the targeted IModifierGroupData id, which determines when and how the modifier is applied.

IModifierGroupData

Each IModifierData contains an IModifierGroupData, which is a reusable object that contains logic on how IModifierData is applied to a value. It contains the mathematical operation (addition or multiplication) that is applied to all the associated IModifier.

Tip

For example, consider an IModifier that has an IModifierDataCollection, which contains a list of IModifierData that all target the same IModifierGroupData. If the operation of the IModifierGroupData is "+", the amounts of each IModifierData in the collection is summed up. This modified value is then used by the IModifierFormula.

IModifierFormula, IModifierFormulaData

IModifierFormula is used to apply numeric logic to groups of IModifier. IModifierFormulaData contains the affected IModifiable types, as well as the actual formula that indicates which mathematical operations are applied to the value from each IModifierGroupData.

There are currently six IModifierFormulas in IdleKit:

  • AscensionPowerModifierFormula - ModifierFormula that affects the AscensionPower on IStage
  • CollectorPayoutModifierFormula - ModifierFormula that affects the Payout of ICollectorEntity
  • CollectorSpeedModifierFormula - ModifierFormula that affects the Speed of ICollectorEntity
  • GeneratorPayoutModifierFormula - ModifierFormula that affects the Payout of IGeneratorEntity
  • GeneratorSpeedModifierFormula - ModifierFormula that affects the Speed of IGeneratorEntity
  • GeneratorUnitCostModifierFormula - ModifierFormula that affects the Unit Cost of IGeneratorEntity
IModifierFormulaData.formula = "base * 4 + ( modifierGroupId1 * modifierGroupId2 )"

Tip

The above formula first replaces "base" with a base amount. Then, it collects all IModifierData entities 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, and the result is a completely numeric formula that can be parsed by IModifierFormulaParser.

Relationships

modifier_relationships

Tip

See ModifierService for more information on how it manages and applies logic on Modifier and Modifiable entities.