Skip to main content

Damage to a monster

Combat · Saving throws · MonsterDamageFlags · MonsterImmunityFlags

In brief​

Damage to a monster is first rolled, from the weapon or from the spell or attack that deals it. It then goes through a series of reductions: the monster's saving throw, two immunities aimed mainly at weapons, the monster's evasion against magic, and its immunities to some kinds of damage. What remains, if positive, is taken from the monster's hit points.

How the damage is reduced​

The calculation receives the kinds of damage dealt (MonsterDamageFlags), a saving-throw category and a saving-throw effect, and tests the monster type's immunities (MonsterImmunityFlags):1

if MONSTER_DAMAGE_WEAPON:
damage = weapon damage (below)
else:
damage = roll(count, sides, bonus)
if category != 5 and the monster saves: # category 5 never saves
effect 0 or 1: damage / 2; effect 3: 0; other effects: unchanged
if MONSTER_DAMAGE_WEAPON and MONSTER_DAMAGE_FLYING_OBJECT and the item is not a missile:
damage = 1
if MONSTER_DAMAGE_WEAPON and MONSTER_IMMUNE_WEAPON_HALVED and not (class byte & CHARACTER_CLASS_CLERIC):
damage = damage / 2
if MONSTER_IMMUNE_WEAPON_REDUCED:
with MONSTER_DAMAGE_WEAPON: value < 3: damage / 4; value 3: damage / 2;
if the result is 0: damage = value
otherwise: damage / 2
if MONSTER_DAMAGE_MAGIC and 1d100 < the type's evasion: damage = 0
for each pair (MAGIC, IMMUNE_MAGIC), (ELECTRICITY, IMMUNE_ELECTRICITY), (UNKNOWN_0080, IMMUNE_UNKNOWN_0400),
(FIRE, IMMUNE_FIRE), (COLD, IMMUNE_COLD), (UNKNOWN_0400, IMMUNE_UNKNOWN_0040):
if the damage has the kind and the type the immunity: damage = 0

Divisions are arithmetic shifts. The damage is applied only when it is positive. A missile is an item of the thrown-weapon or launcher kind (ITEM_KIND_THROWN, ITEM_KIND_LAUNCHER). The monster's saving throw is described under a monster's saving throw. The evasion is a value of the monster type, read as signed; see the monsters' other values. The class byte tested for MONSTER_IMMUNE_WEAPON_HALVED is read at the wrong entry; see monster immunities.

Weapon damage​

An item type carries two damage profiles. The weapon damage is the attacker's strength damage modifier (for melee blows), plus the dice of the second profile against a monster type marked MONSTER_CAP_LARGE and of the first profile otherwise, plus the item's value; without an item, 1d2. The result is at least 0. The bonus of the first profile is added in both cases; see damage profiles.2

Kinds that never occur​

Two kinds of damage, MONSTER_DAMAGE_UNKNOWN_0080 and MONSTER_DAMAGE_UNKNOWN_0400, are cancelled by two immunities in the calculation above, but no blow, missile, spell or other source in the game produces them, so these two immunities never cancel anything. Three immunity bits are never tested at all; see monster immunities.3

Sources​

Locations refer to the game executable reference; comparative sources are listed in the technical references.

Footnotes​

  1. The monster damage calculation, the saving throw and damage reduction and the combat tables. Comparative source: REF-SCUMM-013, calcMonsterDamage and trySavingThrow. ↩

  2. Item damage dice and roll dice. ↩

  3. Every call of the monster damage calculation and of monster damage with a saving throw, the initial definition table and the combat tables. ↩