Skip to main content

Item kinds

ItemKind · bits 0–6 of the 16-bit properties_raw of ItemTypeRuntime

Items · Combat · The engine in ten minutes

The kind of an item type decides what using the item does, how its name is built and whether it counts as armour. The game reads it as the low seven bits of the type's properties_raw; bit 0x80 of the same word is the item-loss mark, and its upper eight bits are never tested.1

/* What using an item does; low 7 bits of ItemTypeRuntime.properties_raw. */
typedef enum ItemKind {
ITEM_KIND_WORN = 0, /* Armour, shields, helmets, boots, bracers, cloaks, the Ring of Protection: counted by the defense. */
ITEM_KIND_MELEE = 1, /* Melee weapon; also the empty hand, item entry 0. */
ITEM_KIND_THROWN = 2, /* Thrown weapon or ammunition: daggers, darts, spears, arrows, rocks. */
ITEM_KIND_LAUNCHER = 3, /* Bows and the sling. */
ITEM_KIND_MISC = 4, /* Lock picks, amulets, quest items: no use of their own. */
ITEM_KIND_SPELLBOOK = 5, /* Opens the mage spell book. */
ITEM_KIND_HOLY_SYMBOL = 6, /* Opens the cleric spell book. */
ITEM_KIND_FOOD = 7, /* Eaten; value = food points, -1 for rotten food. */
ITEM_KIND_BONES = 8, /* Sets of bones: no use of their own. */
ITEM_KIND_MAGE_SCROLL = 9, /* Casts the spell definition numbered by the value: mage scrolls, the Fire Sphere, magic dust. */
ITEM_KIND_CLERIC_SCROLL = 10, /* The same, shown in the cleric book: cleric scrolls and one amulet. */
ITEM_KIND_TEXT = 11, /* Parchment or tome: a text, or a part of the map for values -1 to -3. */
ITEM_KIND_STONE = 12, /* Stone items: no use of their own. */
ITEM_KIND_KEY = 13, /* Keys: no use of their own. */
ITEM_KIND_POTION = 14, /* The value selects the potion, 0 to 7. */
ITEM_KIND_GEM = 15, /* Gems: no use of their own. */
ITEM_KIND_RING = 16, /* Rings other than the Ring of Protection: act while worn, by value. */
ITEM_KIND_UNKNOWN_17 = 17, /* No item type of the original data; using it does nothing. */
ITEM_KIND_WAND = 18, /* The value selects the spell; the low six bits of flags count the charges. */
ITEM_KIND_HORN = 19, /* The value, 1 to 4, selects a message and a sound. */
ITEM_KIND_LIFE_DEATH_AMULET = 20 /* Value 1: 200 points of damage to the user; any other value: Raise Dead. */
} ItemKind;

The use routine has a case for each value from 0 to 20. A larger value has no case: the item only sends the item-used block event. The item types of each kind in the original file, and the values of their items, are listed with the the item types.

Anomaly

Every routine that reads the kind masks the word with 0x7f, except a check for a holy symbol in a hand, which compares the whole word with ITEM_KIND_HOLY_SYMBOL. A holy symbol type with the item-loss bit, or any other bit, set would not be recognized there. No item type of the original data has such a bit, and nothing in the executable calls that check, so the difference has no effect in play (inferred); a faithful reimplementation compares the whole word in that check.2

Where it is used​

  • Using an item. Each kind has its own effect, listed in using items; kinds 1 to 3 are attacks.1
  • Defense. Only items of ITEM_KIND_WORN count; see what worn items change.3
  • Hands. The rule that the second hand cannot use some weapons applies to kinds 1 to 3; see two hands.4
  • Names. Kinds 0 to 3, 9, 10, 14, 16 and 18 build an identified item's name from its value; see item names.5
  • Damage. A flying weapon of kind 2 or 3 deals its full damage; another flying item deals 1; see damage to a monster.
  • Cursed hand items. Only an item of kind 1 to 3 gives a message when its curse keeps it in the hand; see moving and equipping items.6

Sources​

Locations refer to the game executable reference.

Footnotes​

  1. Use an inventory item, with its jump table on the kind, and use a weapon slot. ↩ ↩2

  2. Check for a holy symbol in a hand and the item-type records. ↩

  3. Recompute a character's defense. ↩

  4. Hand checks. ↩

  5. Print an item's name. ↩

  6. Check an item placement. ↩