Module behaviors

Source
Expand description

The name-addressed registry of native behavior functions — every config script slot dispatches to a function registered here.

§Model

Every script slot in the game config is one BehaviorKind. A category fixes the typed input scope and return type the slot expects. A config field referencing a script names a function of the matching category; the config-validator step asserts the name exists and the category matches (see validate::validate_game_config_refs).

Only config-dispatched behaviors live here. Behaviors whose name is hardcoded in Rust (character/item power, fast-equip, opponent generation, item price, …) are plain functions on their modules, called directly.

Modules§

arena
Arena rating-change behaviors (code-dispatched by the matchmaking / fight-result paths).
combat
Combat behaviors: ability/projectile casts, fight start, and effect ticks.
fast_equip
Native functions for the ability_ids category (run_abilities_ids_script) fast_equip_abilities_script does (copy Abilities, sort by balance::ability_damage descending with a floored comparator, take the top Slots) and then call the already-native crate::mechanics::balance::ability_damage_from_id for the core damage formula, so this fn only handles the copy/sort/take marshalling.
fixtures
Test-fixture behaviors quarantine.
items
Native functions for the per-attribute item value calculation slots — cases.rs::try_finalize_item via run_expression::<i64> with scope Item / Random / AttributesQuantity).
opponents
Native port of the opponent_generation category — the single bots_settings.bots_generation_script run via [crate::BehaviorRegistry::generate_opponent] to build a PvP bot from an expected arena rating.
power
Native functions for the power categories (character_power, item_power, …). These handle the loadout marshalling and then call the crate::mechanics::balance logic for the core power formula.
quests
Quest behaviors: progress rules, loop-task pacing, and offer triggers.
rewards
Reward behaviors for bundle currency steps. Fixed reward lists live in the config (BundleRawStep::currencies, CurrencyBranchStep, QuestsProgressionPointSettings::reward); the only computed reward is the AFK accrual.
ui_values
Native function for the description_values category — computes the values for an ability’s description_values_script.
validate
Deploy-time validation of every script-ref field in the game config.
vassals
Vassal behaviors: task/link reward stubs, task loyalty, and link loyalty decay.

Structs§

BehaviorCatalog
Exported catalog shape (behavior_catalog.json). Snapshot-tested in CI.
BehaviorMeta
Catalog metadata for one registered native script function. This is what the admin renders as a dropdown option for a script_ref field, and what the validator checks config references against.
BehaviorRegistry
The name-addressed registry of config-dispatched native fns, keyed by (category, name). Built once via build_registry.

Enums§

BehaviorKind
One config-dispatched script slot. A category fixes the slot’s typed input/output contract.

Functions§

build_registry
Build the full registry: every config-dispatched category submodule registers its functions.