EffectAttackDecrease(int, int)

Create an Attack Decrease effect.

int EffectAttackDecrease(
    int nPenalty,
    int nModifierType = ATTACK_BONUS_MISC
);

Parameters

nPenalty

nModifierType

ATTACK_BONUS_* (Default: ATTACK_BONUS_MISC)


Description

Returns a new effect object that when applied to a creature, will decrease their attack bonus in their main hand, off hand or both hands by a certain amount.

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.

The limit of nValue is unknown.



Remarks

Attack Decreases do stack, and so you can get negative to hits even if you have a normally positive base attack bonus.

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 5 attack penalty to a target

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

    // Create the effect to apply
    effect eAttackDecrease = EffectAttackDecrease(5);

    // 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_REDUCE_ABILITY_SCORE);

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

See Also

functions: EffectAbilityDecrease | EffectAbilityIncrease | EffectACDecrease | EffectACIncrease | EffectAppear | EffectAttackIncrease | EffectDamageDecrease | EffectDamageIncrease | EffectLinkEffects | EffectModifyAttacks
categories: Effects Functions
constants: ATTACK_BONUS_* Constants


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