Skip to main content

AddToStat

This effect allows you to add to the value of a particular stat. Even though you could always use the setStat effect instead by manually adding to the value to set, it is always recommended to use this effect for additions (or subtractions) as this will set a modifier override as opposed to a value override. Modifier overrides will act separate from value overrides and are most likely what you want.

For example, let's say that a player with intelligence = 10 equips two items. The first item adds one adds 1 to their intelligence, and the player then equips a second item that sets their intelligence to 20. There are two potential outcomes:

  1. The intelligence is 21
  2. The intelligence is 20

If you'd want the app to behave as in (1), then you'd want to use an addToStat effect for the first item, and a setStat effect for the second one. This way, the modifier (+1) will always be applied, regardless of if the stat is later modified in other ways.

If you want the app to behave as (2), then you want to use setStat (and use a max aggregation type).

Finally, remember that modifier overrides only clash with modifier overrides, and value overrides only clash with value overrides. This means that, going back to the previous example, if the player equips another item that adds a +3 to their intelligence, the first item and the last will clash, and which modifier/s prevail will depend on the aggregation type (for aggregation type max, the +3 will prevail, for min the +1, for sum we'll end up with a +4, etc). If the +1 was set with an aggregation type that is different from the one used in the effect that added the +3, then the user will be prompted to see how they want to choose to resolve the clash.

JSON Format

{
"type": "addToStat",
"stat": ...,
"meta_stat": ...,
"value": ...,
"aggregation_type": ...,
"calculated_aggregation_type": ...
}

Fields

FieldTypeRequiredDescription
calculated_aggregation_typeStatFormulaComponentTo be used when the aggregation type should be calculated in runtime. Otherwise, use aggregation_type. If aggregation_type is also defined, this property will be ignored. This stat formula must return a string value matching one of the AggregationType values.
@type string