Function socketed_stat_bonuses

Source
pub fn socketed_stat_bonuses(
    config: &GameConfig,
    inventory: &StoneInventory,
) -> Vec<(AttributeId, i64)>
Expand description

Every passive stat the character’s socketed stones grant, as (attribute, value) pairs ready to fold into an attribute delta map.

Three properties of this function are the whole feature, and each has a test in tests/test_stone_stats.rs:

  • an unsocketed stone contributes nothing — a stone is paid for by putting it in a slot, not by owning it;
  • active_side is never read, so a slot’s Real and Fantasy effect stones both contribute at all times and a flip cannot move stats or Power;
  • a stone’s upgrade level scales its stats (configs::stones::StoneStat::value_at_level), the same shape effect_magnitude uses.

Locked sockets need no check here: StoneInventory::insert refuses a locked socket, so a socketed stone is by construction in an open one.

A stone whose template is missing from the config (content pulled from under a live inventory) is skipped and logged, never fatal — same rule as crate::game_config_helpers::GameConfigLookup::trigger_stone_template.