Module ui_values

Source
Expand description

Native function for the description_values category — computes the values for an ability’s description_values_script.

Follows the power reference shape: a typed *Ctx, a *Fn alias, a native impl, and a register.

§What these scripts compute

Each ability’s description_values_script (in overlord/admin/config/scripts/content.templates.abilities.*) is one of two shapes:

  1. Content-driven — import content, fetch the ability info, then push one or more derived fields: Each push is either floor(ability_info.<field> * 100) (a f64floor → pushed as f64) or a bare ability_info.<field> (an integer field like projectiles, pushed via the push(i64) overload as value as f64).

  2. Literal — no content dependency, just integer literals:

The native port reads the script source (the only way to know the field order and the literal values — they live in the source, not in any typed scope value), parses the canonical statement family, and reproduces the same Vec<f64>. It dispatches the ability info through crate::mechanics::content::ability_info so a discrepancy points at the per-ability composition, not at this glue.

Any script shape this parser does not cover returns Err, surfacing the uncovered script rather than silently mis-evaluating it.

Structs§

DescriptionValuesCtx
Inputs available to a description_values native fn — the same two inputs constant and the script source), plus the config / content lookups content::ability_info needs. The scope_setter for this slot is the identity closure (compute_description_values_for_ability), so there are no other scope variables to mirror.
TalentDescriptionValuesCtx
Inputs available to a talent_description_values native fn — the same two TalentLevel constant and the script source (the multipliers N live in the source text). The scope_setter for this slot is the identity closure (compute_description_values_for_talent), so there are no other scope variables to mirror.

Functions§

description_values
Native port of run_description_values_calculate for the ability f64 fields push directly; bare integer fields and integer literals push value as f64.
talent_description_values
Native port of run_talent_description_values_calculate for the canonical each push contributes (TalentLevel * N) as f64, in source order.

Type Aliases§

DescriptionValuesFn
Signature of a description_values native fn. Free fn (no captured state) so it is Copy; runtime context arrives via DescriptionValuesCtx.
TalentDescriptionValuesFn
Signature of a talent_description_values native fn. Free fn (no captured state) so it is Copy; runtime context arrives via TalentDescriptionValuesCtx.