EffectDamageImmunityIncrease(int, int)

Creates a Damage Immunity Increase effect

effect EffectDamageImmunityIncrease(
    int nDamageType,
    int nPercentImmunity
);

Parameters

nDamageType

DAMAGE_TYPE_*

nPercentImmunity

The percent amount to raise the targets immunity by.


Description

Returns a new effect object that when applied to a target will raise the amount of immunity the target has against damage when it is done to them by a certain type defined in the DAMAGE_TYPE constants group.

This effect means a nPercentImmunity of 50% to fire damage translates to half damage from any fire attacks - if we take 50 fire damage normally, this means we only take 25.

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

This will decrease damage done to the target if it had no immunity to start with - noting that all increases and decreases of immunity to damage will stack (on hides, items, from effects or whaever) and the maximum is going to be 100% vunrability (decrease immunity, double damage) or 100% immunity (increased immunity, no damage).

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 a bonus 50% fire immunity to a 
// target (thus, they'll take 50% less damage from fire attacks)

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

    // Create the effect to apply
    effect eDamageImmunityIncrease = EffectDamageImmunityIncrease(DAMAGE_TYPE_FIRE, 50);

    // 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, eDamageImmunityIncrease, oTarget);
}

See Also

functions: EffectDamageImmunityDecrease
categories: Effects Functions
constants: DAMAGE_TYPE_* Constants


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