GetIsImmune(object, int, object)
Determines whether a creature has a specific immunity.
- The creature to check immunity for.
- A IMMUNITY_TYPE_* constant. Any other number returns FALSE.
- If this is specified, then we also check for the race and alignment of oVersus. (Default: OBJECT_INVALID)
Returns TRUE if oCreature has immunity of type nImmunity versus oVersus, otherwise FALSE. If nImmunityType is < 0 or > 32 it will return FALSE.
Some immunities encompass others - such as IMMUNITY_MIND_SPELLS covering things like Stun, Daze, etc. as well (even when not from a "spell").
There is notably no IMMUNITY_TYPE_PETRIFICATION. The "immunity" to such is coded in x0_i0_spells function "spellsIsImmuneToPetrification", which is frustratingly missing some default appearances and has no setting available to set on immune creatures, although it does check for immunity to the particular spell being cast as well.
The IMMUNITY_TYPE_TRAP appears to be that it simply won't trigger traps, full stop, when clicked on / walked over. But if it does somehow get affected - eg; by an AOE trap - and a SAVING_THROW_TYPE_TRAP is used the functions WillSave, FortitudeSave and ReflexSave should return 2 (Immune).
Note IMMUNITY_TYPE_DEATH_MAGIC only applies to spell attacks; it a spell script is being fired with a particular UserType setting. Outside of spell scripts you have to test this manually to check for immunity since death effects just...work. You can bypass this immunity in spell scripts too; see EffectDeath.
In the engine the function will first iterate over the effects on the creature set by spells, and a list of effects set by items as they are equipped (including creature hides where many monster immunities go).
Then if a matching immunity is not found, it will check for these feats that have hardcoded immunities:
|FEAT_EPIC_PERFECT_HEALTH||IMMUNITY_TYPE_POISON and IMMUNITY_TYPE_DISEASE|
author: Tom Cassiotis, editor: Jasperre