Skip to Content
The Alchemy Project

include/game/item.h

Items: their definitions, types, flags and effects.

Included by battle_internal.h, field_engine_internal.h, menu_internal.h, menu_tables.c, shop_internal.h, window_internal.h, battle_unit.h, game.h and inventory.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
#defineEQUIP_CHARACTER (character) (1 << (character))The equipMask bit of character (ISAAC to PIERS): gmItemCanUnitEquip reads the bit of the unit's character.
#defineEQUIP_ALL_CHARACTERS 0xffEvery one of the eight characters' bits.
#defineITEM_USE_FREE 0What using an item costs (ITEM_DEFINITION's useType).
#defineITEM_USE_CONSUMED 1one is used up
#defineITEM_USE_MAY_BREAK 2may break when used
#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.

Enumerations

NameDescription
enumINVENTORY_ENCODING { INVENTORY_ITEM_ID_MASK, INVENTORY_EQUIPPED, INVENTORY_BROKEN … }An inventory entry's parts, and a unit's slot count.
enumINVENTORY_REMOVE_RESULT { INVENTORY_REMOVE_EMPTY_SLOT, INVENTORY_REMOVE_ONE, INVENTORY … }What gmInventoryRemove and gmInventoryDiscard return.
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 gmItemGetEquipmentGroup sorts an item into.
enumINVENTORY_REFUSAL { INVENTORY_REFUSE_CANNOT_UNEQUIP, INVENTORY_REFUSE_INDISPENSA … }Why gmInventoryCheckDiscard or gmInventoryCheckUnequip refuses an item, as bits; 0 when it may go.
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 equipped item does for its wearer (EQUIP_EFFECT.kind): adds to a stat or to an element's power or resistance, scales a stat in tenths, or one of a few effects of its own.

Functions

NameDescription
ITEM_DEFINITION *gmItemGetDefinitionStub (Sint32 item)Returns an item's definition.
Sint32gmEquipmentRollUnleashStub (struct UNIT *unit)Rolls whether a character's weapon unleashes, 5 percent a point of its chance.
Sint32gmItemCanUnitEquipStub (Sint32 unitId, Sint32 item)Returns whether the character's class may equip the item, 0 for any unit past the eight characters (gmItemCanUnitEquip).
Sint32gmRareItemStockAdjust (Sint32 counter, Sint32 delta)Adds delta to a rare item counter and returns its new count.

Description

Items: their definitions, types, flags and effects.

Macros in detail

EQUIP_CHARACTER

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

The equipMask bit of character (ISAAC to PIERS): gmItemCanUnitEquip reads the bit of the unit's character.

Referenced by ItemDefinitionTable.

Definition at line 44 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 46 of file item.h.

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 mnItemMenuDrawItemDetailsWithCount().

Definition at line 67 of file item.h.

ITEM_USE_CONSUMED

#define ITEM_USE_CONSUMED 1

one is used up

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

Definition at line 68 of file item.h.

ITEM_USE_MAY_BREAK

#define ITEM_USE_MAY_BREAK 2

may break when used

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

Definition at line 69 of file item.h.

ITEM_USE_TEACHES

#define ITEM_USE_TEACHES

Referenced by gmUnitRebuildPsynergyList(), ItemDefinitionTable, mnItemCheckBattleUse(), mnItemClassifyUseMode() and mnItemMenuDrawItemDetailsWithCount().

Definition at line 70 of file item.h.

ITEM_USE_EMPTIES

#define ITEM_USE_EMPTIES 4

Hermes' Water leaves an Empty Bottle

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

Definition at line 73 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 mnItemMenuDrawItemDetailsWithCount().

Definition at line 122 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 mnItemMenuDrawItemDetailsWithCount().

Definition at line 125 of file item.h.

Enumerations in detail

INVENTORY_ENCODING

enum INVENTORY_ENCODING

An inventory entry's parts, and a unit's slot count. An entry is a halfword: the item id in bits 0 to 8, then the equipped bit, the broken bit, and the quantity in bits 11 to 15.

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.

ITEM_FLAGS

enum ITEM_FLAGS

The bits of ITEM_DEFINITION.flags.

EnumeratorValueDescription
ITEM_CURSED0x01Equipping it curses the wearer (UNIT.curse).
ITEM_CANNOT_UNEQUIP0x02Once equipped it cannot be taken off, or dropped while worn.
ITEM_RARE0x04A rare item: the rare weapons and armor, keys and the other one-of-a-kind items carry it.
ITEM_INDISPENSABLE0x08An important item: never dropped, and worth nothing to a shop.
ITEM_STACKABLE0x10Kept in one inventory entry with a quantity.
ITEM_NOT_TRANSFERRED0x20Left behind when The Broken Seal's data is transferred (gmDataTransferApply): the Elemental Stars and their bags, and that game's errands, from the Healing Fungus to the Lil' Turtle.

Definition at line 49 of file item.h.

EQUIPMENT_GROUP

enum EQUIPMENT_GROUP

What gmItemGetEquipmentGroup sorts an item into.

EnumeratorValueDescription
EQUIPMENT_GROUP_NONE0Anything not a weapon or armor, rings included.
EQUIPMENT_GROUP_WEAPON1
EQUIPMENT_GROUP_ARMOR2

Definition at line 76 of file item.h.

INVENTORY_REFUSAL

enum INVENTORY_REFUSAL

Why gmInventoryCheckDiscard or gmInventoryCheckUnequip refuses an item, as bits; 0 when it may go.

EnumeratorValueDescription
INVENTORY_REFUSE_CANNOT_UNEQUIP1Equipped and ITEM_CANNOT_UNEQUIP: "You can't remove it!"
INVENTORY_REFUSE_INDISPENSABLE2ITEM_INDISPENSABLE: "You can't drop it!"
INVENTORY_REFUSE_EMPTY8the slot holds no item

Definition at line 86 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, 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 and the greaves.
ITEM_TYPE_PSYNERGY6The items that teach Psynergy while held: Orb of Force to Teleport Lapis.
ITEM_TYPE_TRIDENT7The Trident alone: "A weapon with a unique purpose".
ITEM_TYPE_RING8Adept Ring to War Ring.
ITEM_TYPE_SHIRT9Mythril Shirt to Divine Camisole.
ITEM_TYPE_CLASS_CHANGE10Mysterious Card, Trainer's Whip and Tomegathericon: "Equip to change your class".
ITEM_TYPE_ELEMENTAL_STAR11The four Elemental Stars and the Mythril Bags that hold them; the item menu treats them as it does items that are not equipment.

Definition at line 97 of file item.h.

EQUIP_EFFECT_KIND

enum EQUIP_EFFECT_KIND

What an equipped item does for its wearer (EQUIP_EFFECT.kind): adds to a stat or to an element's power or resistance, scales a stat in tenths, or one of a few effects of its own.

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_CHANCEPercent added to the weapon's unleash.
EQUIP_EFFECT_ADD_COUNTERSTRIKE_RATENothing sums or reads it: gmUnitCalculate has no case for it.
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 130 of file item.h.

Functions in detail

gmItemGetDefinitionStub

ITEM_DEFINITION *gmItemGetDefinitionStub(Sint32 item)

Returns an item's definition.

Referenced by btActionRunBuild(), btAIChooseAction(), btSpoilsRankItem(), btStagingRunItem(), fdItemMatchesFilter(), fdPartyInventoryGiveItem(), fdUseItem(), mnBattleCollectPartyCommands(), mnBattleItemMenuRun(), mnBattleStatusScreenRun(), mnIconDrawItem(), mnItemCheckBattleUse(), mnItemClassifyUseMode(), mnItemIconCompose(), mnItemMenuArrangeCategoryItemIcons(), mnItemMenuBuildCommands(), mnItemMenuConfirmDrop(), mnItemMenuDrawEquippedItemNames(), mnItemMenuDrawEquipPreview(), mnItemMenuDrawItemDetailsWithCount(), mnItemMenuRunCommands(), mnItemMenuSort(), mnItemMenuTryBreak(), mnItemPlayUseSound(), mnItemUse(), mnSanctumApplyService(), mnShopBuyDone(), mnShopConfirmEquip(), mnShopDrawEquipComparison(), mnShopDrawStock(), mnShopRepairItem(), mnShopRepairPrice(), mnShopSalePrice(), mnShopSelectBuy(), mnShopSelectBuyCount(), mnShopSelectSellCount(), mnShopSellItem(), mnShopSellOld(), mnStatusPanelDraw() and mnStatusScreenShowEquipmentRow().

Definition at line 224 of file item.h.

gmEquipmentRollUnleashStub

Sint32 gmEquipmentRollUnleashStub(struct UNIT *unit)

Rolls whether a character's weapon unleashes, 5 percent a point of its chance.

Referenced by btActionRunBuild().

Definition at line 228 of file item.h.

gmItemCanUnitEquipStub

Sint32 gmItemCanUnitEquipStub(Sint32 unitId, Sint32 item)

Returns whether the character's class may equip the item, 0 for any unit past the eight characters (gmItemCanUnitEquip).

Referenced by mnEquipmentMenuUpdateCompatibilityIndicators(), mnItemCheckBattleUse(), mnItemClassifyUseMode(), mnItemMenuBuildCommands(), mnItemMenuRunList(), mnShopConfirmEquip(), mnShopDrawEquipComparison() and mnStatusPanelDraw().

Definition at line 231 of file item.h.