ravenous_typst/setup/analysis/report_config.typ

50 lines
1.8 KiB
Plaintext

// Typed accessors and validation for the balance-report YAML configuration.
#let report-config = yaml("/data/config/balance_report.yaml")
#let weapon-settings = report-config.weapons
#let sensitivity-settings = weapon-settings.sensitivity
#let armor-settings = weapon-settings.armor
#let class-weapon-settings = weapon-settings.class_weapons
#let enabled-report-chapters = report-config.chapters
#let inclusive-range(bounds) = range(bounds.min, bounds.max + 1)
#let chapter-enabled(id) = id in enabled-report-chapters
#let chapter-family-enabled(family) = enabled-report-chapters.any(id => (
id.split(".").first() == family
))
#assert(weapon-settings.die_sides > 0, message: "weapons.die_sides must be positive")
#assert(weapon-settings.action_budget == 2, message: "Only a 2-action analysis budget is currently supported")
#assert(weapon-settings.damage_scenarios.len() > 0, message: "At least one damage scenario is required")
#assert.eq(
weapon-settings.damage_scenarios.map(item => item.key).dedup().len(),
weapon-settings.damage_scenarios.len(),
message: "Damage scenario keys must be unique",
)
#for required-key in ("low", "mid", "full") {
assert(
required-key in weapon-settings.damage_scenarios.map(item => item.key),
message: "Missing required damage scenario: " + required-key,
)
}
#assert.eq(
sensitivity-settings.breakpoint_method,
"normalized_knee",
message: "Unsupported weapon sensitivity breakpoint method",
)
#assert.eq(
armor-settings.breakpoint_method,
"largest_marginal_drop",
message: "Unsupported armor breakpoint method",
)
#assert.eq(
armor-settings.protection_between_attacks,
"static",
message: "Only static protection between attacks is currently supported",
)
#assert.eq(
armor-settings.summary_protections.len(),
3,
message: "Exactly three armor summary protections are required",
)