EffectDamageReduction(int, int, int)

Create a Damage Reduction effect.

effect EffectDamageReduction(
    int nAmount,
    int nDamagePower,
    int nLimit = 0
);

Parameters

nAmount

The amount of damage reduction

nDamagePower

The amount of damage to reduce by as defined in the DAMAGE_POWER_* constants group.

nLimit

How much damage the effect can absorb before disappearing. Set to zero for infinite (Default: 0)


Description

Returns a new effect object that when applied to the target will lower the amount of damage they take. This effect can be dispersed after a set amount of damage has been soaked or it can be infinite.

Damage reduction is specfically to stop Physical damage - anything that isn't Piercing, bludgeoning or Slashing damage will not be counted with this effect.

For instance, if we have put on 10/+5 damage reduction, with a limit of 100 damage until it collapses, we will recieve 10 less damage from pysical attacks (or none at all if it is 10 or under) and that amount will be removed, until it is gone. In this example, if I keep hitting for 1 damage, with a +1 sword, it would do nothing until I had hit 101 times - the 100th time would mean it collapses, and the next one does damage. If I hit with a +5 sword however, I'd do damage every time (and the barrier would stay up).

Damage reduction doesn't stack, and only the highest that can stop the possible damage will apply - having some 10/+10, 5/+15, and 50/+1, and you are hit with a +4 weapon will reduce it by 10, not 15 or 25.

The limit of nAmount and nLimit (Apart from 0, unlimited) is unknown.

The target this effect is applied to must be a creature for it to work. This effect cannot be applied instantly, only temporarily or permanently.



Remarks

The description sums up how it works, for anyone who doesn't know. The limit, if reached in the same time as an attack, will reduce it by the amount left (EG: we have 5 left on a 10/+5 damage reduction, and are hit for 15 damage, it'd remove 5 of it and do 10 damage, and the reduction collapses).

This is useful for stoneskin type effects, or those which stop all weapon damage. To stop elemental damage, there are other functions. Elemental damage is never prone to any kind of Damge Power rating.

Effect functions are Constructors, which are special methods that help construct effect "objects". You can declare and link effects, and apply them using an ApplyEffectToObject() Command. Once applied, each effect can be got seperately via. looping valid effects on the target (GetFirst/NextEffect()). See the Effect Tutorial for more details.


Version

1.62

Example

// Sample code for applying unlimited 10/+4 damage reduction
// to a target

void main()
{
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;

    // Create the effect to apply
    effect eReduction = EffectDamageReduction(10, DAMAGE_POWER_PLUS_FOUR);

    // Create the visual portion of the effect. This is instantly
    // applied and not persistant with wether or not we have the
    // above effect.
    effect eVis = EffectVisualEffect(VFX_IMP_SUPER_HEROISM);

    // Apply the visual effect to the target
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    // Apply the effect to the object   
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eReduction, oTarget);
}

See Also

functions: EffectDamageResistance
categories: Combat Functions | Effects Functions
constants: DAMAGE_POWER_* Constants


 author: John Shuell, editor: Jasperre, additional contributor(s): Jasperre