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 suffix | attribute | native fn |
|---|---|---|
| a3d34c967544 | Health | attr_health |
| a3d484fc9321 | Armor | attr_armor |
| a3d5ae6a6d85 | Damage | attr_damage |
| a3d6986afce1 | Crit_Chance | attr_crit_chance |
| d17688fe8796 | Crit_Damage | attr_crit_damage |
| b7a9f4076158 | Evasion | attr_evasion |
| 9bc89817cd0c | Speed | attr_speed |
| 58be88146385 | HP_Regen | attr_hp_regen |
| 0533377e501c | Multi_Cast | attr_multi_cast |
| b5389ac4560b | Counter_Attack | attr_counter_attack |
| 68dc4f9806b8 | Damage_Received | attr_zero (empty) |
| 5041af05d473 | Bravery | attr_bravery |
| cb869d6d3f95 | Guile | attr_guile |
| 4469382ee36c | Block | attr_block |
| 9bfc229665c3 | Bonus_Health | attr_zero (0) |
| f5461b96d9ff | Bonus_damage | attr_zero (0) |
Structs§
- Chest
Item Choose Ctx - Inputs for the chest item-choose override (code-dispatched).
- Item
Attribute Ctx - Inputs available to an item-attribute native fn — mirrors the three
consts thecases.rs::try_finalize_itemcaller pushes (Item,Random,AttributesQuantity), plus the config / content lookups thebalanceprimitives need. - Item
Experience Ctx - Inputs for the item-experience calculation (code-dispatched).
- Item
Price Ctx - 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),0asi64. - 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, elseNone(roll by weights). - item_
experience_ eff_ item - Item experience:
floor(balance::eff_item * 100). - item_
price - Sell price of an item, from its effectiveness
effviabalance::sell_price(Phase 2: sub-linear ineffso 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-effsales stay ≈ the legacyeff·100). - register
- Register this category’s native fns into the registry (Expression category —
scalar
i64slots, same asitem_experience).
Type Aliases§
- Item
Attribute Fn - Signature of an item-attribute native fn. Returns the attribute value
(
i64), matchingrun_expression::<i64>(the value is later narrowed to