The Damage Effect (CEffectDamage) is the primary effect type used to apply damage to a target unit or units. As such, it is one of the most commonly-used effects in almost any map featuring combat, and even in maps that don't.
- 1 Using the Damage Effect
- 2 Fields
Using the Damage Effect
The most basic function of the Damage Effect is, unsurprisingly, to deal damage. Common uses for it include:
- Dealing damage to a target.
- Dealing area of effect damage around a target.
- Instantly killing targets and hallucinations.
Because damage is such an integral feature of StarCraft II, the mechanics that govern how damage is dealt and handled are necessarily complex. In the most basic scenario, when a source applies a damage effect on a target, the target's life or shields is immediately reduced by an amount equal to the amount specified by the damage effect used. If the target's life drops below 0 as a result of the damage, it will die and the source will receive credit for the kill.
In practice, many more factors come into play between the application of the damage effect and the reduction of the target's life or shields. The most important of these factors are those that act to modify the amount of damage dealt. These factors can be separated into two general categories: those that are directly controlled by the damage effect itself (internal modifiers) and those controlled by external objects (external modifiers).
- Internal Modifiers
- Target Attribute Bonuses
- Shield Bonuses
- Target Vital Bonuses
- External Modifiers
- *Damage Effects can determine how much of their damage is reduced per point of armor, so this modifier is partly internal as well.
Target Attribute Bonuses
Each Damage Effect may specify its own modifiers to apply to the amount of damage dealt based on the target's attribute flags. The damage effect may specify a flat adjustment and/or a multiplier for each attribute. These modifiers can be either positive (increase the amount of damage dealt) or negative (decrease the amount of damage dealt). If the target has its attribute flag enabled for a certain attribute, then the appropriate attribute modifier will be applied. If multiple attribute modifiers apply to a single target (for example when a damage effect that does +5 vs. Mechanical and -10 vs. Massive is applied on a target that has both the Mechanical and Massive flags enabled), the damage effect resolves the situation according to what is specified in its Total field.
Shield bonus modifiers work much like attribute modifiers. The principal difference is that shield modifiers are applied when damage is dealt to shields rather than to life. Like attribute modifiers, there is both a flat modifier and a multiplier that may be adjusted independently.
Target Vital Bonuses
Target Vital Bonuses are bonuses to damage dependent on the target's vitals: life, shields, and energy. Two sets of vital bonuses are specified by Damage Effects. One set calculates bonuses based on the target's current vitals while the second set calculates bonuses based on the target's maximum vitals. For both sets, the bonus value that is specified in the Damage Effect for a certain vital will be multiplied by the target's appropriate (current or maximum) vital and the result will be added to the damage amount dealt. An example of an ability that uses target vital bonuses is the High Templar's Feedback ability, which deals damage based on the target's current energy.
A target's armor can reduce the amount of damage that is dealt to it by an amount proportional to the number of points of armor. The exact amount reduced per point of armor depends on the Armor Reduction field of the Damage Effect that is dealing the damage. In general, armor is one of the last modifiers to be applied to damage.
Behavior Damage Bonuses
A Damage Effect may have its damage modified by behaviors on its source unit. For more information on how these modifications work, visit the behaviors page.
Behavior Damage Responses
A Damage Effect may have its damage modified by damage responses specified by behaviors on either the source or the target unit. For more information on how damage responses work, visit the behaviors page.
Global Minimum Damage Cap
There exists a cap on the minimum amount of damage that must be dealt when a damage effect is applied. If, after all damage modifiers have been considered, the amount of damage dealt is reduced below this minimum value, the damage amount will automatically be increased to match the minimum value. The default minimum value is 0.5. This value can be changed in the Gameplay Data tab in the Data Editor.
There are four main damage types supported by the Data Editor:
Each Damage Effect must specify exactly one type as the type of damage that it deals. These damage types have no effect on the damage dealt by a Damage Effect by themselves but will affect how other objects respond to the damage. For example, behaviors are capable of applying separate damage modifiers for each damage type. Only Damage Effects that deal the appropriate type of damage will be affected by those modifiers. The type of damage dealt by a Damage Effect is only dependent on the type it specifies and not on the ultimate source of the damage. For example, a melee weapon can deal ranged-type damage, a single-target ability can deal splash-type damage, etc.
Damage Effects can be used to instantly kill targets, regardless of what damage modifiers would normally apply to the damage. To do this, the Kill flag must be enabled in the Damage Effect's Flags field. One example of a use for this would be to kill units with timed lives when their timers expire (e.g. Broodlings, Auto-Turrets).
A similar effect may be achieved only for targets that are Hallucinations by enabling the Kill Hallucination flag. If this flag is enabled (but not the Kill flag) the Damage Effect will instantly kill hallucinations but not normal units.
This section contains a list of all important member fields of CEffectDamage that are not inherited from CEffect.
- Area (Array)
- Exclude (Array)
- Include (Array)
- Maximum Count
- Minimum Count
- Minimum Count Error
- Search Filter
- Search Flags
- Flags (Array)
- Kill Hallucination
- Leech Fraction (Array)
- Recycle Count
- Response Flags (Array)
- Vital Bonus (Array)
- Vital Fraction Current (Array)
- Vital Fraction Maximum (Array)