Data/Effects/Create Healer

## Create Healer

### Description

Creates a healer on target unit that restores a portion of vital at a cost to the caster

### Hints

* There is a bug where Veterancy with Heal Dealt / Taken Multiplier set will not combine numeric modifications. Thus, the amount will need to be set for each "level"
* Calculations: Recharge Vital Rate \* (Caster - Heal Dealt Multipliers \* Target - Heal Taken Multipliers) + Vital \* 1/(Repair Time \* Time Factor)
* It appears there is a bug where the in-game calculation rate is slightly off, however the above calculation appears to be accurate enough for predictive healing.
* The effect needs to be channelled to use more than a single tick
* Unlike Create Persistent, a target that becomes invalid (hidden, in transport, invulnerable, etc) will not interrupt a "Channeled" flag. This effect requires a proper validator.
* Buff behavior granting "Heal Dealt Multipliers" DO NOT grant additional healing per tick, they only increase the rate at which the healing is done. Ex: 2 units are healing. One of them has the + Heal Dealt buff while the other not: The buffed one will heal faster, the other one will finish later, but still heal same amount in the end.

## Example Usage

### Medic Heal

Medivac's Heal uses a channeled ability to constantly trigger the create healer effect.

* You often see "No Markers" on the effect, this prevents multiple healers from casting on the same target. In the Effect-Target abilitiy, "Markers are used" field is unchecked for approach because, it was desired that all healers attempt to engage the target for an heal, but then, only one of them succeeds.

### Guide for starters

All things being equal, this ability basically drains 1 energy for 1 life (common example for this wiki). The ticks (period durations) represent at which rate the vitals are exchanged, but it is mainly implicit of a 1 second game time trade. Since each tick is 0.0625 by default, we can see a gradual effect of the heal being done, but it is still equivalent to a 1 second exchange of 1 vital for 1 vital. If you should increase the tick to 1 second for example, the result will still be the same, but instead of seing it gradual, you will see a vital trade every 1 second. Same goes for greater periods, and since these are period duration, nothing is exchanged until the period is completed, so interrupting the effect doesn't give a partial exchange.

* **Recharge vital rate** and **Recharge Vital fraction** never mean how much more healing you can deal, they only mean how faster/slower the heal is going to happen. Knowing that, the only way to technically say that you give a greater heal for a lesser amount, would be to decrease the **Drain Cost Factor**. Now if you do, of course that drained vital will trade slower, which is why you can hit back the Recharge Vital fields to increase the rate.
* Of course, if this effect is inflenced by a launch or impact unit carrying a buff behavior with Heal Taken / Heal Dealt with the fraction amount being increased, only the rates are affected, not the amount heal provided for a relative drained vital amount (they will heal the impact unit faster, but so will the vital be drained off the launch unit). However, if the **Drain Cost Factor** is set to 0, this is oddly false and becomes an increased healing quantity over the same 1 game second (illusive based on how these fields work).
* In this wiki page, we will assume that the Launch Unit is the caster for the given examples. Think of each field like we're talking about a SCV healing anything (They call it repair, but it's still an "Heal" effect).

## Fields Description

### Effect: Damage Modifier Source

* Unknown - Presumed to control which unit is the factor for Behavior's "Heal Dealt/Taken" Multipliers.

### Effect - Drain Resource Cost Factor

Multiplier of the target's cost in resource that is taken off healer's resources.

* Used by SCVS.
* If a supply depots costs 100 minerals to build, 100 minerals will be drained for a full repair. Scvs use 0.25 cost factors, so it only costs 25 minerals to fully repair it.

### Effect - Drain Vital

* The type of vital drained from the caster to heal the target (Life, Shield or Energy).

### Effect - Drain Vital Cost Factor

Flat amount of the drained vital that is taken off per tick. Tick here means 1 vital.

* Remember: it's always headed to grant 1 vital per tick. Putting 0.5 in the field for example, means that 0.5 vital grants 1 vital, so: spending 1 vital grants 2 vital.
* This field is the only method to "increase" the heal amount. Putting a smaller amount still means 1 recharged vital, but for a lesser cost.

### Effect - Expire Effect

* Effect that is cast if the healer lasts through it's entire duration

### Effect - Final Effect

* Effect that is cast when the healer is removed

### Effect - Flags

* **Channeled:** Provides Channel, binding the Caster to this ability/weapon while the channel is going. If the channel stage can be interrupted, taking any other action will interrupt this channel.
* **Channeling:** Sets up to destroy this effect if any Parent effect (Create Persistent/Create Healer) or parent buff behavior with "Channeled" flag on should stop providing channel. In the absence of any Channeled parent, this flag being enabled will instantly destroy the effect at its creation. Using this flag in pair with the "Channeled" flag above is pointless, as an interrupted Channeled effect still gets to be destroyed anyway, ending with the same result. This flag is usually best used on a child Persistent effect to clear up left overs that would last longer than then the Channel providing source, exempting the necessity of setting addtional data for clearing it.
* **Continue When Full:** Determines whether the Create Healer effect will continue if the healed vital is full.
* **Keep Marker After Heal:**
* **Suppress Energy Regen:** Unit's under this effect don't regenerate energy.
* **Suppress Life Regen:** Unit's under this effect don't regenerate life.
* **Suppress Shields Regen:** Unit's under this effect don't regenerate shields.

### Effect - Initial Effect

* Effect that is cast on the target when this effect is first applied.

### Effect - Period Count

* Treats the healer persistent like a normal persistent. Flags the number of "ticks" the healer should last.

### Effect - Periodic Effect

* The effect that gets executed every "tick", in addition to the vital healing.

### Effect - Periodic Period

* The duration of each periodic "tick". Setting this will override the normal healer "tick" rate.
* The normal rate of a tick is a variable fraction of game time.
* Heal rates are typically evaluated as "per game second", and spread evenly across fraction seconds, assumed to be 0.0625 seconds
* e.g. A normal healer set to heal 5 vital will heal 5 vital per game second, at a normal rate of ~ +0.3125 every 0.0625 seconds. If this field is set, the vital healed will be the full amount every periodic period, which can be faster or slower than the normal rate.

### Effect - Periodic Validator

* The validator that is checked each "period". If this fails, the effect will be canceled.

### Effect - Recharge Vital

The type of vital that is healed on the target (Life, Shield or Energy).

### Effect - Recharge Vital Fraction

How much % of the target's vital is recharged per tick. A 100% rate means that the recharged vital is instantly filled at the very first 1 second of this effect (or less if the caster's drained vital can't trade enough for it).

* The amount spent still respects 1 vital for 1 vital.
	+ Ex: A unit has 150/150 Energy, will recharge an Archon's Shield at 0/350. If the Drain cost factor is 1, and this field is set to 1 (fractional, so 100%), 150 shield will be given by the tick and the energy pool fully drained.
	+ Ex: A unit has 50/150 Energy, will recharge an Archon's Shield at 0/350. If the Drain cost factor is 1, and this field is set to 1 (fractional, so 100%), 50 shield will be given by the tick and the energy pool fully drained.
	+ Ex: A unit has 150/150 Energy, will recharge an Archon's Shield at 0/350 If the Drain cost factor is 0.33, and this field is set to 1 (fractional, so 100%), 450 shield will be given by the tick (since it stops at 350. some energy will be left. This examples says that 0.33 is spent for a single vital, so 1 drained is spent for 3 recharged vital; Only ~116 energy will be spent).
* What happens if combining this field with **Recharge Vital Rate**?
	+ Nothing, except for the rate at which the vital is healed. Both end with the same heal amount. You can stack them, it doesn't add up in the total drained vital quantity, because the effect still respects/calculates 1 drained for 1 heal (or less drained if modifying the Drain Cost Factor). The only moment at which it would sort of change anything will be when healing bigger targets. For example, if your **Recharge Vital Rate** gives 10 life, while this **Recharge Vital Fraction** field is set to 0.1 (10%), there will be a notable occurance between healing a marine and a battlecruiser. The marine will heal at the rate of the 10 life per tick, because it is faster than the 10% of its mere 40 hp. Oppsite story for the battlecruiser, which 10% of its max 550 vital represents 55 vital per tick. So yes, the way these fields interacts, is which heal rate is the fastest, which overrides one or another.

### Effect - Recharge Vital Max

The maximum amount of vital that can be healed by this effect each tick (game second).

### Effect - Recharge Vital Rate

Flat Amount of vital that can be healed to the target unit each tick (game second).

* Is usually the favored rate field for most heal effects.
* The editor field description may be misleading. Tick has nothing to do with the periodic period. It is strictly and always based on a 1 second value (altered by game time).
* Putting 50 here means that 50 vital will be recharged on the target every 1 second. (if enough vital from drain vital cost), draining the relative cost vital from the caster.

### Effect - Time Factor

* This value is multiplied by the target unit's Repair Time. If the resulting value is non-zero, then that is the amount of time it will take to heal the unit to full. If the resulting value is zero, then the target unit will be healed at a rate of Recharge Vital Rate/second.
	+ If a Supply Depot Repair time is 60 second, repairing it with this field set to 1 means that it takes nearly 60 second to heal it from 1 to 500 life.
	+ If a Supply Depot Repair time is 60 second, repairing it with this field set to 1 means that it takes nearly 30 second to heal it from 250 to 500 life.
	+ If a Supply Depot Repair time is 60 second, repairing it with this field set to 2 means that it takes nearly 120 second to heal it from 1 to 500 life.
* This value is NOT affected by Behavior's Heal Dealt / Taken Multipliers, however this value IS added to the Recharge Vital Rate/second.

### Target - Impact Unit

* The Unit getting his vital restored, receiving the effect
* Is the "Heal Taken Multiplier" from buff behaviors.

### Target - Launch Unit

* Specifies which unit spends vitals to heal the impact unit.
* Is the "Heal Dealt Multiplier" from buff behaviors.