Skip to Content
The Alchemy Project

include/game/item.h

Items: their definitions, types, flags and effects.

Included by menu_tables.c, ability_staging.h, battle_unit.h, game.h, inventory.h and shop.h.

Structures

NameDescription
structEQUIP_EFFECTOne effect of an item while equipped: its kind (EQUIP_EFFECT_KIND) and amount.
structITEM_DEFINITIONAn item's definition: its price, type, who can equip it, its bonuses and unleash, its effects and the action it is used for.

Macros

NameDescription
#defineITEM_USE_FREE 0What using an item costs (ITEM_DEFINITION's useType).
#defineITEM_USE_CONSUMED 1one is used up
#defineITEM_USE_MAY_BREAK 2breaks one time in eight
#defineITEM_USE_TEACHES
#defineITEM_USE_EMPTIES 4Hermes' Water leaves an Empty Bottle
#defineEQUIP_EFFECT_SLOTS 4How many effects an item has while equipped (ITEM_DEFINITION.effects).
#defineSTAT_SCALE_ONE 10A multiplier of 10 tenths, which keeps a stat as it is: the classes' stats (CLASS_DEFINITION) and the EQUIP_EFFECT_SCALE_ effects are in tenths.
#defineEQUIP_CHARACTER (character) (1 << (character))The equipMask bit of character (ISAAC to PIERS): gmItemCanUnitEquip reads bit unit->id of the mask.
#defineEQUIP_ALL_CHARACTERS 0xffEvery one of the eight characters' bits.

Enumerations

NameDescription
enumINVENTORY_ENCODING { INVENTORY_ITEM_ID_MASK, INVENTORY_EQUIPPED, INVENTORY_BROKEN … }An inventory entry's parts, and a unit's slot count: bits 15 to 11 hold the quantity, 10 the broken mark, 9 the equipped mark and 8 to 0 the item id.
enumINVENTORY_REMOVE_RESULT { INVENTORY_REMOVE_EMPTY_SLOT, INVENTORY_REMOVE_ONE, INVENTORY … }What gmInventoryRemove and gmInventoryDiscard return.
enumINVENTORY_EQUIP_RESULT { INVENTORY_EQUIP_DONE, INVENTORY_EQUIP_REFUSED, INVENTORY_EQU … }What gmInventoryEquip returns.
enumINVENTORY_DISCARD_CHECK { INVENTORY_DISCARD_ALLOWED, INVENTORY_DISCARD_EMPTY_SLOT, INV … }What gmInventoryCheckDiscard returns: whether an item may be dropped or sold, and why not.
enumITEM_FLAGS { ITEM_CURSED, ITEM_CANNOT_UNEQUIP, ITEM_RARE, ITEM_INDISPENSA … }The bits of ITEM_DEFINITION.flags.
enumEQUIPMENT_GROUP { EQUIPMENT_GROUP_NONE, EQUIPMENT_GROUP_WEAPON, EQUIPMENT_GROU … }What kind of thing an item is (gmItemGetEquipmentGroup), which picks the comparison a shop shows.
enumITEM_TYPE { ITEM_TYPE_NONE, ITEM_TYPE_WEAPON, ITEM_TYPE_ARMOR, ITEM_TYPE … }An item's type (ITEM_DEFINITION's type, item_table.c's type field).
enumEQUIP_EFFECT_KIND { EQUIP_EFFECT_NONE, EQUIP_EFFECT_ADD_HP, EQUIP_EFFECT_ADD_HP_ … }What an effect of an equipped item does (EQUIP_EFFECT.kind); the Item screen names each by MsgEquipEffectName + kind ("Max HP", "Luck").

Description

Items: their definitions, types, flags and effects.

Macros in detail

ITEM_USE_FREE

#define ITEM_USE_FREE 0

What using an item costs (ITEM_DEFINITION's useType).

nothing: it is kept, as equipment is

Referenced by btActionRunBuild() and mnItemMenuDrawItemDetails().

Definition at line 81 of file item.h.

ITEM_USE_CONSUMED

#define ITEM_USE_CONSUMED 1

one is used up

Referenced by btAIChooseAction(), btStagingRunItem(), fdUseItem(), ItemDefinitionTable, mnItemMenuDrawItemDetails(), mnItemUse() and scGomaCaveEntranceGiveShamansRod().

Definition at line 82 of file item.h.

ITEM_USE_MAY_BREAK

#define ITEM_USE_MAY_BREAK 2

breaks one time in eight

Referenced by btActionRunBuild(), btStagingRunItem(), ItemDefinitionTable, mnItemMenuDrawItemDetails(), mnItemMenuTryBreak() and mnShopRepairItem().

Definition at line 83 of file item.h.

ITEM_USE_TEACHES

#define ITEM_USE_TEACHES

Referenced by gmUnitRefreshPsynergy(), ItemDefinitionTable, mnItemCheckBattleUse(), mnItemClassifyUseMode() and mnItemMenuDrawItemDetails().

Definition at line 84 of file item.h.

ITEM_USE_EMPTIES

#define ITEM_USE_EMPTIES 4

Hermes' Water leaves an Empty Bottle

Referenced by btStagingRunItem(), ItemDefinitionTable, mnItemMenuDrawItemDetails() and mnItemUse().

Definition at line 87 of file item.h.

EQUIP_EFFECT_SLOTS

#define EQUIP_EFFECT_SLOTS 4

How many effects an item has while equipped (ITEM_DEFINITION.effects).

Referenced by gmEquipmentGetUnleashRateBonus(), gmFlagRefreshLureCap(), gmUnitCalculate() and mnItemMenuDrawItemDetails().

Definition at line 120 of file item.h.

STAT_SCALE_ONE

#define STAT_SCALE_ONE 10

A multiplier of 10 tenths, which keeps a stat as it is: the classes' stats (CLASS_DEFINITION) and the EQUIP_EFFECT_SCALE_ effects are in tenths.

Referenced by gmUnitCalculate() and mnItemMenuDrawItemDetails().

Definition at line 123 of file item.h.

EQUIP_CHARACTER

#define EQUIP_CHARACTER(character) (1 << (character))

The equipMask bit of character (ISAAC to PIERS): gmItemCanUnitEquip reads bit unit->id of the mask.

Referenced by ItemDefinitionTable.

Definition at line 187 of file item.h.

EQUIP_ALL_CHARACTERS

#define EQUIP_ALL_CHARACTERS 0xff

Every one of the eight characters' bits.

Referenced by ItemDefinitionTable.

Definition at line 189 of file item.h.

Enumerations in detail

INVENTORY_ENCODING

enum INVENTORY_ENCODING

An inventory entry's parts, and a unit's slot count: bits 15 to 11 hold the quantity, 10 the broken mark, 9 the equipped mark and 8 to 0 the item id.

EnumeratorValueDescription
INVENTORY_ITEM_ID_MASK0x1ff
INVENTORY_EQUIPPED0x200
INVENTORY_BROKEN0x400
INVENTORY_ENTRY_MASK0x7ffThe item id with its broken and equipped bits, all but the quantity.
INVENTORY_QUANTITY_SHIFT11The quantity field holds the count less one; a stack (ITEM_STACKABLE) grows to INVENTORY_STACK_MAX (gmInventoryAddItem).
INVENTORY_QUANTITY_STEP1 << INVENTORY_QUANTITY_SHIFTOne more in the
INVENTORY_QUANTITY_MASK0xf800stack.
INVENTORY_SLOTS15UNIT.inventory's entries.
INVENTORY_STACK_MAX30The most items a stack holds.

Definition at line 14 of file item.h.

INVENTORY_REMOVE_RESULT

enum INVENTORY_REMOVE_RESULT

What gmInventoryRemove and gmInventoryDiscard return.

EnumeratorValueDescription
INVENTORY_REMOVE_EMPTY_SLOT-1nothing was there to take
INVENTORY_REMOVE_ONE1the stack is one smaller
INVENTORY_REMOVE_LAST2the last one left its slot, and the slots after it moved up

Definition at line 34 of file item.h.

INVENTORY_EQUIP_RESULT

enum INVENTORY_EQUIP_RESULT

What gmInventoryEquip returns.

EnumeratorValueDescription
INVENTORY_EQUIP_DONE0equipped, or it was already
INVENTORY_EQUIP_REFUSED-1the character cannot equip it
INVENTORY_EQUIP_STUCK-2the item it would replace is cursed on (ITEM_CANNOT_UNEQUIP)

Definition at line 43 of file item.h.

INVENTORY_DISCARD_CHECK

enum INVENTORY_DISCARD_CHECK

What gmInventoryCheckDiscard returns: whether an item may be dropped or sold, and why not.

EnumeratorValueDescription
INVENTORY_DISCARD_ALLOWED0
INVENTORY_DISCARD_EMPTY_SLOT-1
INVENTORY_DISCARD_STUCK-3Equipped and cursed on: the shop shows "Can't remove."
INVENTORY_DISCARD_INDISPENSABLE-4An important item (ITEM_INDISPENSABLE): the shop shows "Can't drop."

Definition at line 53 of file item.h.

ITEM_FLAGS

enum ITEM_FLAGS

The bits of ITEM_DEFINITION.flags.

EnumeratorValueDescription
ITEM_CURSED1Equipping it curses the wearer (UNIT.curse).
ITEM_CANNOT_UNEQUIP2Once equipped it cannot be taken off, or dropped while worn.
ITEM_RARE4A rare item: "A rare item" on the Item screen, the shop's MsgRareSellOffer, and second rank among the spoils (btSpoilsRankItem).
ITEM_INDISPENSABLE8"An important item" on the Item screen: never dropped, worth nothing to a shop (mnShopSalePrice), and first among a battle's drops kept.
ITEM_STACKABLE16Kept in one inventory entry with a quantity.

Definition at line 64 of file item.h.

EQUIPMENT_GROUP

enum EQUIPMENT_GROUP

What kind of thing an item is (gmItemGetEquipmentGroup), which picks the comparison a shop shows.

EnumeratorValueDescription
EQUIPMENT_GROUP_NONE0anything not a weapon or armor, rings
EQUIPMENT_GROUP_WEAPON1included
EQUIPMENT_GROUP_ARMOR2Armor, shields, helms, boots and shirts.

Definition at line 91 of file item.h.

ITEM_TYPE

enum ITEM_TYPE

An item's type (ITEM_DEFINITION's type, item_table.c's type field). A unit equips one item of each type, except Psynergy items.

EnumeratorValueDescription
ITEM_TYPE_NONE0not equipment: Herb, Game Ticket, the keys, unused rows
ITEM_TYPE_WEAPON1swords, axes, maces, rods and staffs
ITEM_TYPE_ARMOR2armor, clothes and robes
ITEM_TYPE_SHIELD3shields, gloves and armlets
ITEM_TYPE_HELM4helms, caps, crowns and circlets
ITEM_TYPE_BOOTS5Hyper Boots to Turtle Boots
ITEM_TYPE_PSYNERGY6items that teach Psynergy while held: Orb of Force to Catch Beads
ITEM_TYPE_UNUSED7no row of item_table.c has it; listed as equipment
ITEM_TYPE_RING8Adept Ring to Cleric's Ring
ITEM_TYPE_SHIRT9Mythril Shirt, Silk Shirt, Running Shirt

Definition at line 102 of file item.h.

EQUIP_EFFECT_KIND

enum EQUIP_EFFECT_KIND

What an effect of an equipped item does (EQUIP_EFFECT.kind); the Item screen names each by MsgEquipEffectName + kind ("Max HP", "Luck").

EnumeratorValueDescription
EQUIP_EFFECT_NONE
EQUIP_EFFECT_ADD_HP
EQUIP_EFFECT_ADD_HP_REGEN
EQUIP_EFFECT_ADD_PP
EQUIP_EFFECT_ADD_PP_REGEN
EQUIP_EFFECT_ADD_AGILITY
EQUIP_EFFECT_ADD_LUCK
EQUIP_EFFECT_SCALE_HP
EQUIP_EFFECT_SCALE_HP_REGEN
EQUIP_EFFECT_SCALE_PP
EQUIP_EFFECT_SCALE_PP_REGEN
EQUIP_EFFECT_SCALE_ATTACK
EQUIP_EFFECT_SCALE_DEFENSE
EQUIP_EFFECT_SCALE_AGILITY
EQUIP_EFFECT_SCALE_LUCK
EQUIP_EFFECT_ADD_VENUS_POWERElement power and resistance, in the element order Venus, Mercury, Mars, Jupiter.
EQUIP_EFFECT_ADD_MERCURY_POWER
EQUIP_EFFECT_ADD_MARS_POWER
EQUIP_EFFECT_ADD_JUPITER_POWER
EQUIP_EFFECT_ADD_VENUS_RESIST
EQUIP_EFFECT_ADD_MERCURY_RESIST
EQUIP_EFFECT_ADD_MARS_RESIST
EQUIP_EFFECT_ADD_JUPITER_RESIST
EQUIP_EFFECT_ADD_UNLEASH_CHANCE"Critical Hits increase": each point adds a percent to the weapon's unleash chance and half a percent to a plain attack's chance of a critical hit.
EQUIP_EFFECT_ADD_COUNTERSTRIKE_RATESummed by gmUnitCalculate into equipBonus[1]; no item of item_table.c has it, the item menu draws no line for it, and nothing reads the total.
EQUIP_EFFECT_CURSE_REMOVABLE"The curse can be removed": sets CURSE_REMOVABLE, which lifts CURSE_BOUND.
EQUIP_EFFECT_ADD_ACTIONSmore actions each turn
EQUIP_EFFECT_LUREsets FLAG_LURE_CAP while worn: encounters come faster

Definition at line 127 of file item.h.