Module items

Source
Expand description

Native functions for the per-attribute item value calculation slots — cases.rs::try_finalize_item via run_expression::<i64> with scope Item / Random / AttributesQuantity).

Each fn computes one attribute’s value, referenced from the attribute’s calculation_behavior. The production Random is fresh entropy (GameRng::from_entropy in cases.rs).

All formula primitives live in crate::mechanics::balance. Each fn maps to exactly one of the 16 attributes (keyed by attribute uuid):

uuid suffixattributenative fn
a3d34c967544Healthattr_health
a3d484fc9321Armorattr_armor
a3d5ae6a6d85Damageattr_damage
a3d6986afce1Crit_Chanceattr_crit_chance
d17688fe8796Crit_Damageattr_crit_damage
b7a9f4076158Evasionattr_evasion
9bc89817cd0cSpeedattr_speed
58be88146385HP_Regenattr_hp_regen
0533377e501cMulti_Castattr_multi_cast
b5389ac4560bCounter_Attackattr_counter_attack
68dc4f9806b8Damage_Receivedattr_zero (empty)
5041af05d473Braveryattr_bravery
cb869d6d3f95Guileattr_guile
4469382ee36cBlockattr_block
9bfc229665c3Bonus_Healthattr_zero (0)
f5461b96d9ffBonus_damageattr_zero (0)

Structs§

ChestItemChooseCtx
Inputs for the chest item-choose override (code-dispatched).
ItemAttributeCtx
Inputs available to an item-attribute native fn — mirrors the three consts the cases.rs::try_finalize_item caller pushes (Item, Random, AttributesQuantity), plus the config / content lookups the balance primitives need.
ItemExperienceCtx
Inputs for the item-experience calculation (code-dispatched).
ItemPriceCtx
Inputs for the item sell-price / experience calculations (code-dispatched from item finalization).

Functions§

attr_armor
Armor (...a3d484fc9321):
attr_block
Block (...4469382ee36c):
attr_bravery
Bravery (...5041af05d473):
attr_counter_attack
Counter_Attack (...b5389ac4560b):
attr_crit_chance
Crit_Chance (...a3d6986afce1):
attr_crit_damage
Crit_Damage (...d17688fe8796):
attr_damage
Damage (...a3d5ae6a6d85):
attr_evasion
Evasion (...b7a9f4076158):
attr_guile
Guile (...cb869d6d3f95):
attr_health
Health (...a3d34c967544):
attr_hp_regen
HP_Regen (...58be88146385):
attr_multi_cast
Multi_Cast (...0533377e501c):
attr_speed
Speed (...9bc89817cd0c):
attr_zero
Trivial slots: Damage_Received (empty script), Bonus_Health (0), 0 as i64.
chest_item_choose
Chest item override: the mimic item by next_mimic_item_code, else the per-slot fallback for the first unequipped slot of the current inventory level, else None (roll by weights).
item_experience_eff_item
Item experience: floor(balance::eff_item * 100).
item_price
Sell price of an item, from its effectiveness eff via balance::sell_price (Phase 2: sub-linear in eff so gold income grows ~linearly with item level — model’s linear-income assumption — letting the geometric chest-upgrade cost bind instead of being swamped by surplus; early low-eff sales stay ≈ the legacy eff·100).
register
Register this category’s native fns into the registry (Expression category — scalar i64 slots, same as item_experience).

Type Aliases§

ItemAttributeFn
Signature of an item-attribute native fn. Returns the attribute value (i64), matching run_expression::<i64> (the value is later narrowed to