Module power

Source
Expand description

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.

Reference category for the rollout: every other category follows the same shape — a typed *Ctx, a *Fn alias, native impls, and a register.

Structs§

CharacterPowerCtx
character_power_calculate_script sees (CharacterState) plus the config / content lookups the balance module carries.
ItemPowerCtx
item_power_calculate_script sees in the production path: the owning CharacterState and the candidate Item, plus the config / content lookups the balance module carries.
PartyPowerAdjustCtx
Inputs available to a party_power_adjust native fn — the same scope the member’s CharacterState (the slot’s two set_const bindings in run_party_power_adjust).

Functions§

character_power
Native port of character_power_calculate_script (the CharacterState branch): keep equipped inventory items, then call balance::character_power.
item_power
Native port of item_power_calculate_script: power of the equipped loadout with the candidate item minus the power without any item of the same type.
power_adjust
Native port of the shipped power_adjust_script: clamp the party member’s power into [floor(0.5 * player), floor(1.1 * player)].

Type Aliases§

CharacterPowerFn
Signature of a character_power native fn. Free fn (no captured state) so it is Copy and trivially stored in the registry; runtime context arrives via CharacterPowerCtx.
ItemPowerFn
Signature of an item_power native fn. Free fn (no captured state) so it is Copy and trivially stored in the registry; runtime context arrives via ItemPowerCtx.
PartyPowerAdjustFn
Signature of a party_power_adjust native fn. Free fn (no captured state) so it is Copy and trivially stored in the registry; runtime context arrives via PartyPowerAdjustCtx.