# GAE/Effects

## < GAE

275pages on
this wiki

Effects are added bonuses that can be added to attacks, allowing the unit to cause an extra effect with an attack. For example, it may "poison" the opponent and slowly drain their HP, or you could slow a unit by reducing its move speed, etc.

## UsageEdit

Effects are embedded in the <skill> tag of the unit's XML. At this time, only attack skills and emanations (described in the next section) are supported, but a new "cast spell" skill type will be later added to allow effects to be put on friendly units.

## XML definitionEdit

More XML elements are planned, but are not yet implemented and thus, excluded from this page.

<effects>
<effect name="effect_name" bias="detrimental" stacking="overwrite" target="any" chance="100.0" duration="8" image="images/icon.bmp" damage-type="piercing">
<affect value="tag" />
<static-modifiers>
<hp-regeneration value="-50"/>
</static-modifiers>
<multipliers>
<sight value="0.2"/>
</multipliers>
<flags/>
<recourse-effects/>
</effect>
</effects>

## ElementsEdit

### effectEdit

There is one effect tag per individual effect on the attack (if multiple are added), all which are children of the main effects tag. There are a number of attributes, with the name, bias, stacking, and duration being required, and the rest being optional. Having multiple effect tags to allow an attack to have more than one effect, though they must have unique names.

Attribute Required? Description
name required Unique name of the effect.
image optional Path to an image used to display the effect (image not yet implimented, but effect name is).
bias required Primarily used by AI and must be either detrimental, neutral or beneficial.
stacking required Defines behavior when an additional effect of the same type hits the unit. Must be one of stack (the new effect is added in addition to the old one), extend (the duration of the original effect is extended), overwrite (the old effect is replaced with the new effect) or reject (the new effect is ignored).
target optional What units are affected by the effect. Must be one of ally, foe, pet, master or all. Default value is all.
chance optional The percent chance that the effect will be applied to the target. The default is 100%.
duration required The number of seconds the effect will last. Ignored if the flag "permanent" is specified.
damage-type optional When hp-regeneration is negative, this value (if present) is used to determine the appropriate multiplier to use for the target's armor. This is the data specified in <damage-multipliers> section of the techtree.xml file.

### affectEdit

If limiting the effect to units with certain tags, simply specify the tag here. If not limiting, exclude this entire element. The value is the name of the tag to limit to.

### static-modifiersEdit

Static multipliers increase or decrease stats by a set amount. All child tags will have a value attribute which denotes how much it should be increased or decreased by.

Value Description
<max-hp> Modifies the maximum HP.
<hp-regeneration> Modifies the HP regeneration rate.
<max-ep> Modifies the maximum EP.
<ep-regeneration> Modifies the EP regeneration rate.
<sight> Modifies the unit's sight.
<armor> Modifies the unit's armor strength.
<attack-strength> Modifies the unit's attack strength.
<attack-range> Modifies the unit's attack ragen.
<attack-speed> Modifies the unit's attack speed.
<move-speed> Modifies the speed the unit moves at.
<production-speed> Modifies the production speed (speed of creating units or morphing).
<repair-speed> Modifies the speed of the repair skill.
<harvest-speed> Modifies the speed of the harvest skill.
<effect-strength> Modifies the strength of effects.

### multipliersEdit

Similar to static modifiers above, and using the same children nodes, multipliers instead multiply the stat by their amount, with the default being 1. So if a multiplier is 2, they'll have that stat double, if it's 0.5, it'll be halved, and so forth.

### flagsEdit

Flags effect various aspects of the "effect". Each nested element has no attributes or children.

Element Description
<effects-ally /> Will effect allies. This is also turned on when target="allies" or "both".
<effects-foes /> Will effect allies. This is also turned on when target="foes" or "both".
<pets-only /> Will only effect the pets of the caster. This causes effects-ally, effects-foes, not-effects-normal-units and effects-buildings to be ignored.
<master-only /> Will only effect the master of the caster (eg, the pet is the caster). This causes effects-ally, effects-foes, not-effects-normal-units and effects-buildings to be ignored.
<scale-splash-strength /> Scale the strength of the effect with the same formula used to determine splash damage. The further from the apex of the target, the weaker the effect will be. By default, all units within the splash radius of a skill with an effect are effected equally. The formula used is: $\frac{1}{\left(\text{Distance from target} + 1\right)}$
<ends-with-source /> The effect will end if the unit who caused the effect dies.
<recourse-ends-with-root /> Causes the recourse effect to end when the root (primary) effect ends, regardless the duration. Applies only to recourse effects.
<allow-negative-speed /> Adding negative values to the static-modifiers for move-speed can cause a unit to travel away from their destination, although they are facing their destination. While this is probably undesirable, this flag will allow it to happen anyway. The default behavior brings the unit's effective speed to zero if it would otherwise become negative.
<tick-immediately /> Causes HP and EP regeneration to take immediate effect as if tick() had been called. This can be used for effects that should immediately heal or damage units and is mostly useful for zero duration effects, causing it to take immediate effect and then terminate. Using this flag with a zero duration will render all other modifiers in the effect, other than HP & EP regeneration to become useless although sound and particle effects will still be played/rendered.
<permanent /> The effect has an infinite duration.

### recourse-effectsEdit

Recourse effects are an entirely new effect that is added inside of the effect to modify the user. For example, you could have an EP draining attack that would give the foe negative EP regeneration while giving the attacking unit a positive EP regeneration.

## ExamplesEdit

### Archer exampleEdit

The below is an example of an extended attack of the archer adding a poison to the arrows which causes blindness and 50 damage per second for 8 seconds. Note that the only part of this snippet that is modified from the original is the addition of the <effects> tag.

<skill>
<type value="attack"/>
<name value="attack_skill"/>
<ep-cost value="0"/>
<speed value="50"/>
<anim-speed value="50"/>
<animation path="models/archer_attacking.g3d"/>
<sound enabled="true" start-time="0.5">
<sound-file path="sounds/archer_attack1.wav"/>
<sound-file path="sounds/archer_attack2.wav"/>
<sound-file path="sounds/archer_attack3.wav"/>
<sound-file path="sounds/archer_attack4.wav"/>
</sound>
<attack-strenght value="100"/>
<attack-var value="50"/>
<attack-range value="10"/>
<attack-type value="piercing"/>
<attack-start-time value="0.5"/>
<attack-fields>
<field value="land"/>
<field value="air"/>
</attack-fields>
<projectile value="true">
<particle value="true" path="particle_proj.xml"/>
<sound enabled="true">
<sound-file path="sounds/arrow_hit1.wav"/>
<sound-file path="sounds/arrow_hit2.wav"/>
<sound-file path="sounds/arrow_hit3.wav"/>
<sound-file path="sounds/arrow_hit4.wav"/>
<sound-file path="sounds/arrow_hit5.wav"/>
</sound>
</projectile>
<splash value="false"/>
<effects>
<effect name="blinding_poison" bias="detrimental" stacking="overwrite" target="any" chance="100.0" duration="8" image="../../../../placeholders/icon.bmp">
<static-modifiers>
<hp-regeneration value="-50"/>
</static-modifiers>
<multipliers>
<sight value="0.2"/>
</multipliers>
<flags/>
<recourse-effects/>
</effect>
</effects>
</skill>

By using the multiplier of 0.2 for sight, their sight is reduced to 20% of normal. Reducing it further may result in a sight of zero, which would make them incapable of attacking even targets directly adjacent to them.

### Archmage exampleEdit

Effects can be used on attacks with a splash effect as well, this will cause all units in the splash radius to be effected. By default, all units are effected equally, even if they are on the very edge of the splash radius. However, by adding the flag <scale-splash-strength> to the <flags> section of the effect, this behavior can be overridden causing the strength of the effect to be weaker on units further from the point of impact. The strength of the effect isn't exposed through the XML interface, but it effects all attribute modifications (both positive and negative). Below is an example a theoretical effect added to the ice attack of an archmage. Presuming that the ice is cold, let's say that this will temporarily reduce the movement and attack speed of the target. However, the effect will be relative to where they in the splash radius.

<effects>
<effect name="icy_chill" bias="detrimental" stacking="stack" target="all" chance="100.0" duration="8">
<static-modifiers>
<attack-speed value="-25"/>
<move-speed value="-30"/>
</static-modifiers>
<multipliers>
<sight value="0.0"/>
</multipliers>
<flags>
<scale-splash-strength/>
</flags>
</effect>
</effects>

You may have noticed that the "stacking" attribute of the effect tag was set to "stack" this time instead of "overwrite". This means that successive attacks which cause this effect will accumulate, increasing the total effect. Each instance of the effect has it's own timer, so they will wear off one at a time. When set to "overwrite", the previous effect is simply overwritten and the duration reset. This isn't recommended for use with apply-splash-strength however because a second effect may be weaker and overwrite a stronger one.

### Initiate exampleEdit

This example illustrates the use of a recourse effect, which will effect the user, in this case, regenerating HP and making them faster.

<effect name="burning_bastard" bias="detrimental" stacking="stack" target="any" chance="100.0" duration="8">
<static-modifiers>
<hp-regeneration value="-25"/>
</static-modifiers>
<multipliers>
<movement-speed value="2.0"/>
</multipliers>
<recourse-effects>
<effect name="pyromania" bias="beneficial" stacking="stack" target="any" chance="100.0" duration="8">
<static-modifiers>
<ep-regeneration value="25"/>
</static-modifiers>
<multipliers>
<movement-speed value="2.0"/>
</multipliers>
</effect>
</recourse-effects>
</effect>