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:
-
Content-driven — import
content, fetch the ability info, then push one or more derived fields: Each push is eitherfloor(ability_info.<field> * 100)(af64→floor→ pushed asf64) or a bareability_info.<field>(an integer field likeprojectiles, pushed via thepush(i64)overload asvalue as f64). -
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§
- Description
Values Ctx - Inputs available to a
description_valuesnative fn — the same two inputs constant and the script source), plus the config / content lookupscontent::ability_infoneeds. Thescope_setterfor this slot is the identity closure (compute_description_values_for_ability), so there are no other scope variables to mirror. - Talent
Description Values Ctx - Inputs available to a
talent_description_valuesnative fn — the same twoTalentLevelconstant and the script source (the multipliersNlive in the source text). Thescope_setterfor 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_calculatefor the abilityf64fields push directly; bare integer fields and integer literals pushvalue as f64. - talent_
description_ values - Native port of
run_talent_description_values_calculatefor the canonical each push contributes(TalentLevel * N) as f64, in source order.
Type Aliases§
- Description
Values Fn - Signature of a
description_valuesnative fn. Freefn(no captured state) so it isCopy; runtime context arrives viaDescriptionValuesCtx. - Talent
Description Values Fn - Signature of a
talent_description_valuesnative fn. Freefn(no captured state) so it isCopy; runtime context arrives viaTalentDescriptionValuesCtx.