Data/Accumulators/Effect Amount

## Effect Amount

### Description

Very powerfule accumulator that allows us reading effect amounts during effect tree. Note that a very similar exists within trigger system (Effect History Entry Amount, as well as Triggering Effect Amount).

Most important rule is: **Total** flag has to be enabled for all subtypes **but** Damage Inherited type.

* Usually, you can monitor the actual accumulated amount value for most accumulators. This one however, seems to be only temporary and limited to the effect tree. One method to check what was calculated is probably to end the effect chain with a modify unit effect boosting vitals according to accumulated value. Otherwise, text tags cannot trace what was registered.

## Field Categories

### Amount Type

#### 1) Damaged

Stores total amount of damage dealt untill that point in effect tree. For example if you have an ability with a set effect that has a damage effect that does 10 damage, and after that a modify unit effect with an accumulator inside the vital (health) field (eg impact unit set to caster). The caster will get healed for 10 hp. If there are 2 damage effects before the modify effect, then it will be 20 hp healed. Please note this amount is the "real inflicted" amount, so if target has damage reduction it will be reduced (i.e. 10 damage attempted onto target with 50% reduction will heal caster only 5 hp). Note this accumulator doesn't work with damage response behavior like DamageInherited type.

#### 2) Damage Inherited

As the name suggests, the damage amount you've inherited. You can inherit damage amount in 2 ways:

First way is with damage response behavior. On first page you have field called Handled Value, that will decide what type of amount will be transfered to HandledEffect. Absorbed - Amount that behavior absored (via modify fraction, amount etc). Original - As name suggests, amount before being modified by damage response(s). Remaining - amount after being modified by damage responses. Note you may have to set Priority field to <0 is order for remaining to work. Note that if Handled Effect (tree) contains Damage effect, it will automatically read this amount, without putting in the accumulator in Amount field.

Second way is with `Damage Inherit Effect` field in Damage effect. Note, unlike `Damaged` amount, this will use original (attempted damage).

#### 3) Splashed

Same as Damaged, but only reads if amount is Kind Splash.

#### 4) Killed

Amount of units killed up to that point in effect tree. Only works on enemy units.

#### 5) Found

This one is triggered by search effects. Total amount of units found by search effects until that point in effect tree. This one requires some setup: The search effects **MUST** have any effect in their AreaArray field (it can be a dummy one if all you care about is how much units search found).

Another thing worth pointing out is to not put this accumulator inside effect of the search itself, you may have unexpected results: For first unit found accumulator will have value 1. For 2nd 2 etc.. so if ur goal is to do something to every target based on how much total units search (would) find it won't work like that.

#### 6) Life/Shields/Energy Leeched

Amount of specific vital type leeched up until that point in effect tree (Leech fraction field in damage effect).

#### 7) Healed

Amount healed up until that point in effect tree. Healing is either Create Healer effect or Modify Unit with IsHeal flag. This may seem useless at first, but have in mind heal amount can be changed with heal taken/dealt multipliers, which this accumulator will take into account.

#### 8) Life/Shields/Energy Gained

Amount of specific vital type gained up until that point in effect tree. Unlike Leeched or Healed this isn't limited to any specific effect, but any amount of vitals thats gained in tree (so leeched, healed, modified etc will all be calculated if they increase vitals).

#### 9) Life/Shields/Energy Changed

Similar to Gained, but also accounts lost vitals. Lets take a similar example from Damaged. Ability calls a set: Damage effect that does 100 damage and has life leech fraction set to 1, after which there is modify unit effect to heal caster for accumulated amount. Caster will be healed for 300 hp (100 from leech, while accumulator will read 200 [100 hp caster gained from leech, and 100 hp target lost from damage], which is 300 total).

Absorbed subtype is completely unknown. Dodged I'm assuming would count how many times you've dodged/evaded in effect tree, but it doesn't seem to work.

### Example

These examples assume you know how damage, modify unit, and search area effects function. This is an example for DamageInherited subtype.

* Damage reflect type ability. Create the behavior in the similar way described above. For a damage reflect ability we will want to use either Original or Remaining amount based on how we want to balance the game. On Combat tab, put the Chance to 1. Now create a Damage type effect (adjust kind, attribute factors etc as you wish). Put this effect in Handled Effect in the damage response. Thats it! No triggers required.

* Heal nearby allies, for x% of damage taken. Lets try to create a slightly more complicated ability. Create a Damage Response behavior, Search Area effect, and a Modify Unit effect. Setup search area so that its handled effect is the modify unit effect. In the modify unit effect open vitals - life - change - accumulator field and place the effect amount accumulator in. Place the search effect in the Handled Effect in the behavior. Everything is ready, now we just need to adjust the % of damage we want to heal our allies. This can be done in many ways, but in this case lets use the knowledge of how accumulators are added to eachother -- We need a Constant type accumulator, with Application Rule set to Multiply. Now go back to modify unit effect and open up the accumulators again, and **under** the already placed one, put the constant accumulator. This will multiply them together, and we can now heal allies for X% of damage taken.