BG2: ToB Identifiers

Relates to offset 0x0020 in the CRE file format.
Used by the StateCheck(O:Object*,I:State*State) trigger.
The file is partially extensible; new states cannot be created though existing states can be combined to create shortcut states. Sum their values together to get the value of the new state. When combining with states that are themselves combinations, it is safer to use bitwise OR instead of summation.

The norm is to keep the value in hexadecimal format, so it is easier to see if it is a combination state and which other states it is made of.

In other words, STATEs are cumulative: all those STATEs that aren't a power of 2 (only one bit set) are combinations of other STATEs. In particular, you can BOR (bitwise OR) the base STATEs (i.e., all those listed at offset 0x0020 of a CRE file) to form all the others. For instance, STATE_HARMLESS is STATE_FEEBLEMINDED | STATE_CHARMED | STATE_IMMOBILE... and STATE_IMMOBILE is STATE_HELPLESS | STATE_STUNNED | STATE_SLEEPING.

0x00000000 STATE_NORMAL
0x800 STATE_DEAD
0x400 STATE_ACID_DEATH
Unknown. This state is not set by the death effect.

0x200 STATE_FLAME_DEATH
Unknown. This state is not set by the death effect. The creature seems to be shaded dark red until hit.

0x100 STATE_EXPLODING_DEATH
Unknown. This state is not set by the death effect.

0x80 STATE_STONE_DEATH
0x40 STATE_FROZEN_DEATH
0x20 STATE_HELPLESS
0x10 STATE_INVISIBLE
Unknown. This state is not set by the invisibility effect.

0x8 STATE_STUNNED
Unknown. This state is not set by the stunned effect.

0x4 STATE_PANIC
This state seems to apply only to creatures that are affected by panic inducing magic. Creatures that fail their Morale check are not in this state.

0x2 STATE_BERSERK
0x1 STATE_SLEEPING
0x1000 STATE_SILENCED
0x2000 STATE_CHARMED
0x4000 STATE_POISONED
0x8000 STATE_HASTED
0x10000 STATE_SLOWED
0x20000 STATE_INFRAVISION

0x40000 STATE_BLIND
This state indicates whether the creature is currently blinded.

0x80000 STATE_DISEASED
This state indicates whether the creature is "active" (as set by Activate/Deactivate actions).

0x100000 STATE_FEEBLEMINDED
0x200000 STATE_NONDETECTION
0x400000 STATE_IMPROVEDINVISIBILITY
0x800000 STATE_BLESS
0x1000000 STATE_CHANT
0x2000000 STATE_DRAWUPONHOLYMIGHT
0x4000000 STATE_LUCK
0x8000000 STATE_AID
0x10000000 STATE_CHANTBAD

0x20000000 STATE_BLUR
Unknown. This state is not set by the Blur effect.

0x40000000 STATE_MIRRORIMAGE
Unknown. This state is not set by the Mirror Image effect.

0x80000000 STATE_CONFUSED


Common shortcut states include:
0x00102029 STATE_HARMLESS
Feeblemind & Charmed & Helpless & Stunned & Sleeping

0x80040004 STATE_RANGED_TARGET
Blind & Confused & Panic

0x8014202D STATE_OUT_OF_ACTION
Feeblemind & Charmed & Helpless & Stunned & Sleeping & Blind & Confused & Panic

0x00400010 STATE_NOT_VISIBLE
Invisibility & Improved Invisibility

0x63C08010 STATE_ENCHANTED
Mirror Image & Chant & Haste & Aid & Improved Invisibility

0x60400010 STATE_ILLUSIONS
Invisible & Improved Invisibility & Mirror Image

0x8000380F STATE_INVALID
Confused & Charmed & Silenced & Dead & Stunned & Panic & Berserk & Sleeping