Function ownership_stat_mods

Source
pub fn ownership_stat_mods(
    config: &GameConfig,
    collection: &ArtifactCollection,
) -> Vec<(String, i64)>
Expand description

The ownership bonus of a whole collection, as ("<code>.mod", permyriad) pairs ready for calculate_entity_stats_with_mods.

Three rules, all of them design:

  • it sums over every owned artifact, not just the worn one — an artifact in the collection pays exactly as much as an artifact on the character;
  • each artifact pays whatever ITS OWN ownership_bonuses list says, in any set of attributes. Two artifacts naming the same attribute add up on that attribute’s key;
  • the artifact’s level scales each stat by percent + percent_per_level * (level - 1), so a duplicate that raised the level raises the bonus.

Keyed by the attribute’s CODE, because <code>.mod is what combat (fight::get_entity_stat) and the power scalar (balance::get_attr_from_attrs) compose. GameConfig::validate_artifacts refuses a bonus on an attribute nothing composes, so every pair returned here reaches a real stat.

Percentages become permyriad because that is the unit .mod is read in (+10000 == +1.0): 1% is 100. Entries that round to zero are dropped — an empty collection, or one whose artifacts pay nothing, returns nothing.