The scripting command RndDamage has the opcode (0x21).
- Byte - Type
- Byte - Max
Displays the graphic and plays the sound effect for the respective damage type. The elemental damage (fire, elec, cold, and poison) can be negated by party resistance, and all but type 0x0 get a "saving throw" to avoid some (or all) of the damage. The exact method of calculating the damage needs to be completed.
TODO: Fill in the four remaining types, figure out the exact algorithm used for calculating damage.