SpellsIsTarget

From NWN Lexicon
Jump to navigationJump to search


spellsIsTarget(object, int, object)

Generic reputation wrapper.

int spellsIsTarget(
    object oTarget,
    int nTargetType,    
    object oSource
);

Parameters

oTarget

The target creature.

nTargetType

SPELL_TARGET_ALLALLIES, SPELL_TARGET_STANDARDHOSTILE, or SPELL_TARGET_SELECTIVEHOSTILE.

oSource

The source creature.


Description

Generic reputation wrapper.

It performs the check to see if, based on nTargetType, it is okay to target oTarget with the spell effect.



Remarks

Returns TRUE if the spell will affect the target. It doesn't actually damage oTarget, just tests to see if the spell should do damage to them.

Always returns FALSE if oTarget is dead, regardless of nTargetType.

Valid values for nTargetType are:
  - SPELL_TARGET_ALLALLIES: All friendlies and anyone in the party.
  - SPELL_TARGET_SELECTIVEHOSTILE: Only harms enemies, ever.
  - SPELL_TARGET_STANDARDHOSTILE: This one is much more complex than the other two. Note the use of () and capital ORs and ANDs to denote nested conditions.
    * Not friendly.
    * oTarget hit themselves or their pet (familiar, summons, etc) with a spell.
    * (if oTarget is a PC OR the module flag "X0_G_ALLOWSPELLSTOHURT" is 10) AND oTarget is not friendly with oSource.
    * (not friendly AND the difficulty setting is greater than GAME_DIFFICULTY_NORMAL) AND the module switch "MODULE_SWITCH_ENABLE_NPC_AOE_HURT_ALLIES" is TRUE.

Regardless of the nTargetType setting, creatures with the same master (like a familiar or summons) will not damage each other.


Requirements

#include " x0_i0_spells "


Version

???

See Also



author: Mistress