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
| Name | Description | |
|---|---|---|
struct | EQUIP_EFFECT | One effect of an item while equipped: its kind (EQUIP_EFFECT_KIND) and amount. |
struct | ITEM_DEFINITION | An item's definition: its price, type, who can equip it, its bonuses and unleash, its effects and the action it is used for. |
Macros
| Name | Description | |
|---|---|---|
#define | EQUIP_CHARACTER (character) (1 << (character)) | The equipMask bit of character (ISAAC to PIERS): gmItemCanUnitEquip reads the bit of the unit's character. |
#define | EQUIP_ALL_CHARACTERS 0xff | Every one of the eight characters' bits. |
#define | ITEM_USE_FREE 0 | What using an item costs (ITEM_DEFINITION's useType). |
#define | ITEM_USE_CONSUMED 1 | one is used up |
#define | ITEM_USE_MAY_BREAK 2 | may break when used |
#define | ITEM_USE_TEACHES | |
#define | ITEM_USE_EMPTIES 4 | Hermes' Water leaves an Empty Bottle |
#define | EQUIP_EFFECT_SLOTS 4 | How many effects an item has while equipped (ITEM_DEFINITION.effects). |
#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. |
Enumerations
| Name | Description | |
|---|---|---|
enum | INVENTORY_ENCODING { INVENTORY_ITEM_ID_MASK, INVENTORY_EQUIPPED, INVENTORY_BROKEN … } | An inventory entry's parts, and a unit's slot count. |
enum | INVENTORY_REMOVE_RESULT { INVENTORY_REMOVE_EMPTY_SLOT, INVENTORY_REMOVE_ONE, INVENTORY … } | What gmInventoryRemove and gmInventoryDiscard return. |
enum | ITEM_FLAGS { ITEM_CURSED, ITEM_CANNOT_UNEQUIP, ITEM_RARE, ITEM_INDISPENSA … } | The bits of ITEM_DEFINITION.flags. |
enum | EQUIPMENT_GROUP { EQUIPMENT_GROUP_NONE, EQUIPMENT_GROUP_WEAPON, EQUIPMENT_GROU … } | What gmItemGetEquipmentGroup sorts an item into. |
enum | INVENTORY_REFUSAL { INVENTORY_REFUSE_CANNOT_UNEQUIP, INVENTORY_REFUSE_INDISPENSA … } | Why gmInventoryCheckDiscard or gmInventoryCheckUnequip refuses an item, as bits; 0 when it may go. |
enum | ITEM_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). |
enum | EQUIP_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
| Name | Description | |
|---|---|---|
ITEM_DEFINITION * | gmItemGetDefinitionStub (Sint32 item) | Returns an item's definition. |
Sint32 | gmEquipmentRollUnleashStub (struct UNIT *unit) | Rolls whether a character's weapon unleashes, 5 percent a point of its chance. |
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). |
Sint32 | gmRareItemStockAdjust (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.
| Enumerator | Value | Description |
|---|---|---|
INVENTORY_ITEM_ID_MASK | 0x1ff | |
INVENTORY_EQUIPPED | 0x200 | |
INVENTORY_BROKEN | 0x400 | |
INVENTORY_ENTRY_MASK | 0x7ff | The item id with its broken and equipped bits, all but the quantity. |
INVENTORY_QUANTITY_SHIFT | 11 | The quantity field holds the count less one; a stack (ITEM_STACKABLE) grows to INVENTORY_STACK_MAX (gmInventoryAddItem). |
INVENTORY_QUANTITY_STEP | 1 << INVENTORY_QUANTITY_SHIFT | One more in the |
INVENTORY_QUANTITY_MASK | 0xf800 | stack. |
INVENTORY_SLOTS | 15 | UNIT.inventory's entries. |
INVENTORY_STACK_MAX | 30 | The 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.
| Enumerator | Value | Description |
|---|---|---|
INVENTORY_REMOVE_EMPTY_SLOT | -1 | nothing was there to take |
INVENTORY_REMOVE_ONE | 1 | the stack is one smaller |
INVENTORY_REMOVE_LAST | 2 | The 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.
| Enumerator | Value | Description |
|---|---|---|
ITEM_CURSED | 0x01 | Equipping it curses the wearer (UNIT.curse). |
ITEM_CANNOT_UNEQUIP | 0x02 | Once equipped it cannot be taken off, or dropped while worn. |
ITEM_RARE | 0x04 | A rare item: the rare weapons and armor, keys and the other one-of-a-kind items carry it. |
ITEM_INDISPENSABLE | 0x08 | An important item: never dropped, and worth nothing to a shop. |
ITEM_STACKABLE | 0x10 | Kept in one inventory entry with a quantity. |
ITEM_NOT_TRANSFERRED | 0x20 | Left 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.
| Enumerator | Value | Description |
|---|---|---|
EQUIPMENT_GROUP_NONE | 0 | Anything not a weapon or armor, rings included. |
EQUIPMENT_GROUP_WEAPON | 1 | |
EQUIPMENT_GROUP_ARMOR | 2 |
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.
| Enumerator | Value | Description |
|---|---|---|
INVENTORY_REFUSE_CANNOT_UNEQUIP | 1 | Equipped and ITEM_CANNOT_UNEQUIP: "You can't remove it!" |
INVENTORY_REFUSE_INDISPENSABLE | 2 | ITEM_INDISPENSABLE: "You can't drop it!" |
INVENTORY_REFUSE_EMPTY | 8 | the 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.
| Enumerator | Value | Description |
|---|---|---|
ITEM_TYPE_NONE | 0 | Not equipment: Herb, the keys, unused rows. |
ITEM_TYPE_WEAPON | 1 | Swords, axes, maces, rods and staffs. |
ITEM_TYPE_ARMOR | 2 | Armor, clothes and robes. |
ITEM_TYPE_SHIELD | 3 | Shields, gloves and armlets. |
ITEM_TYPE_HELM | 4 | Helms, caps, crowns and circlets. |
ITEM_TYPE_BOOTS | 5 | Hyper Boots to Turtle Boots and the greaves. |
ITEM_TYPE_PSYNERGY | 6 | The items that teach Psynergy while held: Orb of Force to Teleport Lapis. |
ITEM_TYPE_TRIDENT | 7 | The Trident alone: "A weapon with a unique purpose". |
ITEM_TYPE_RING | 8 | Adept Ring to War Ring. |
ITEM_TYPE_SHIRT | 9 | Mythril Shirt to Divine Camisole. |
ITEM_TYPE_CLASS_CHANGE | 10 | Mysterious Card, Trainer's Whip and Tomegathericon: "Equip to change your class". |
ITEM_TYPE_ELEMENTAL_STAR | 11 | The 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.
| Enumerator | Value | Description |
|---|---|---|
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_POWER | Element 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 | Percent added to the weapon's unleash. | |
EQUIP_EFFECT_ADD_COUNTERSTRIKE_RATE | Nothing 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_ACTIONS | More actions each turn. | |
EQUIP_EFFECT_LURE | Sets 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.