Data/Accumulators

## Accumulators

### Description

Accumulators are a new feature that allows map makers to create formulas in data fields based on various input parameters.

Think of them like permanent add-ons that modifies the numeric values of various effect based on various conditions.

### Example

An ability’s damage can be set to:

* The caster’s life + the caster’s Intelligence attribute \* 2 – 75 + the target’s missing life - , and if the caster had a banana, then + (2 \* the damage absorbed by the caster’s damage shield).
* Of course, damage formulas in real games are not necessarily so complicated. This is just an example to showcase what accumulators can do.

* Accumulators can take Unit Custom Values and User Data as parameters.
* Accumulators not only support formulas but also user-defined tables. When combined with validators, accumulators can also be used to provide case switch functionality.
* For example, when an accumulator is used in a behavior that has varying levels and can be cast by multiple players, the accumulator will calculate the result on a per-player basis.
* Accumulators are very versatile and can be used in many places. Examples include Damage, Healing Rate, Life Regen, Damage Reduction, Ability Cost, Armor Bonus, Actor Batch Count, Persist Count, Behavior Count, Behavior Duration, Damage Fraction, Attack Speed, Movement Speed, Vital Regen, Behavior Chance, Vital Modification, etc.
* For buff behaviors using accumulators on their own fields, favor "Source" location on the accumulator itself if that buff is given by an ability (or whatever casts it at a target). It seems that "Target" location does not work as for pin pointing the right location.

## Accumulator Types

* Abil Level
* Arithmetic
* Attribute Points
* Behavior
* Cargo
* Constant
* Distance Accumulator
* Effect Amount
* Switch
* Tracked Unit Count Accumulator
* Unit Custom Value
* User Data
* Vital Accumulator
* Veterancy Level

## Common Fields

### Application Rule

Operator of how the amount imputed in the accumulator will modify the modifiable values.

#### Example use:

1. Let's pretend we want to use an accumulator on a damage effect, on its amount field. The current damage amount shall be the "modifiable value".
2. According to which accumulator type we're using, the amount imputed is often refered as "ratio", "scale", etc. We'll call this value X.
3. We will talk about the best condition when the accumulator can grant the full value of its application. For example, using a Vital Accumulator with a relative type will add only but a portion of the calculated amount if the vital that is checked if not fully replenished. Each application rule will do the math and will fully grant what it is supposed to give in its best condition situation.

* **Add:** Adds a flat amount of the X.
* **Additive Multiply:** Multiplies the modifiable value by X, and adds the result as an addition to the modifiable value.
* **Multiply:** Multiplies the modifiable value by X as the end result. It goes to sense that an accumulator in its worst condition can result with a small modified amount then the default one.

### Constant

Most accumulators have a field that modifies the intensity of the accumulator.

* It can be named Scale, Ratio, Parameters, etc.

What must be remembered, is that this field always indicates a constant, from which the whole accumlator bases itself to modify according to its type.

### Max Accumulation Amount

The maximum amount of modification that this accumulator will change. It is not the amount of "changes" (except in the ways of Behavior Stacks Amount in which case it's true), but rather the flat total amount given by the Application rule. For example, if the accumulator should multiply the actual 10 damage of a weapon, with a limit of 80 in this field, the weapon may only go up to 90 damage total.

* Useful note: Putting the Max amount in "Negative" will redirect the modification into Negative values. For example: if you use distance accumulator for a shotgun weapon, and want to make it deal less damage the further the target is, you may use the max accumulation in negative instead.

### Min Accumulation Amount

A minimum amount that must be true in order to be applied (Unsure)