From bd1c07f070c5090f4b11ce72077718cf711e6700 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sat, 22 Aug 2026 01:35:48 +0200 Subject: [PATCH] Torque reporting & db --- data/src/db | 2 +- data/src/glossaries/terms.yml | 2 +- setup/analysis/defense_report.typ | 65 +++++++++++++++++++++++-------- 3 files changed, 50 insertions(+), 19 deletions(-) diff --git a/data/src/db b/data/src/db index de4fbf7..d666cdb 160000 --- a/data/src/db +++ b/data/src/db @@ -1 +1 @@ -Subproject commit de4fbf7832d468ada99c7739005de49fa591cb26 +Subproject commit d666cdbde5d13fc78d6b7dbd47209639938cc222 diff --git a/data/src/glossaries/terms.yml b/data/src/glossaries/terms.yml index 697b3db..2355628 100644 --- a/data/src/glossaries/terms.yml +++ b/data/src/glossaries/terms.yml @@ -62,7 +62,7 @@ resisted_by: Force difficulty: 1 category: "@el_blunt" - description: 'Vous ne pouvez plus utiliser d''action de mouvement tant que la source de votre immobilisation reste intacte ou que vous ayez réussi le teste de résistance.' + description: 'Vous ne pouvez plus utiliser d''action de mouvement tant que la source de votre immobilisation reste intacte ou que vous ayez réussi le teste de résistance. Si vous étes dans une action continue nécessitant de rester en mouvement (charge, vol etc..) vous cessez immédiatement votre mouvement et devenez victime des loies (cruelles) de la physique du monde.' group: Altérations - key: al_consomption diff --git a/setup/analysis/defense_report.typ b/setup/analysis/defense_report.typ index e1b6c3a..f1161c5 100644 --- a/setup/analysis/defense_report.typ +++ b/setup/analysis/defense_report.typ @@ -1,9 +1,54 @@ // Concise armor and shield comparison for the balance report. -#import "@preview/primaviz:0.6.0": line-chart +#import "@preview/cetz:0.3.4" #import "defense_metrics.typ": * -#import "report_style.typ": chart-theme +#import "report_style.typ": report-theme #import "../theme/tables.typ" as tables +#let torque-protection-xy(items, title) = { + let items = items.sorted(key: item => item.torque) + let width = 7.2 + let height = 4.1 + let x-step = 5 + let x-max = calc.ceil(calc.max(..items.map(item => item.torque)) / x-step) * x-step + let y-max = calc.max(1, calc.max(..items.map(item => item.protection))) + let x-ticks = range(0, x-max + 1, step: x-step) + let y-ticks = range(0, y-max + 1) + let point(item) = ( + item.torque / x-max * width, + item.protection / y-max * height, + ) + + block(width: 100%, breakable: false)[ + #align(center)[ + #text(size: 8pt, weight: "bold", fill: report-theme.heading)[#title] + #v(4pt) + #cetz.canvas(length: 1cm, { + import cetz.draw: * + for tick in x-ticks { + let x = tick / x-max * width + line((x, 0), (x, height), stroke: 0.35pt + report-theme.dark-gold.transparentize(65%)) + content((x, -0.2), text(size: 5.5pt, fill: report-theme.muted-ink)[#tick], anchor: "north") + } + for tick in y-ticks { + let y = tick / y-max * height + line((0, y), (width, y), stroke: 0.35pt + report-theme.dark-gold.transparentize(65%)) + content((-0.18, y), text(size: 5.5pt, fill: report-theme.muted-ink)[#tick], anchor: "east") + } + line((0, 0), (width, 0), stroke: 0.75pt + report-theme.dark-gold) + line((0, 0), (0, height), stroke: 0.75pt + report-theme.dark-gold) + for index in range(items.len() - 1) { + line(point(items.at(index)), point(items.at(index + 1)), stroke: 1.4pt + report-theme.chart-2) + } + for item in items { + circle(point(item), radius: 0.07, fill: report-theme.chart-2, stroke: 0.5pt + report-theme.parchment-light) + } + content((width / 2, -0.62), text(size: 6.5pt, fill: report-theme.ink)[Torque minimale], anchor: "north") + content((-0.72, height / 2), text(size: 6.5pt, fill: report-theme.ink)[Protection], angle: -90deg, anchor: "center") + }) + ] + ] +} + #let defense-report() = { pagebreak() heading(level: 2)[Artisanat — Armures et boucliers] @@ -18,21 +63,7 @@ column-gutter: 12pt, ..("Armors", "Shields").map(category => { let items = defensive-equipment.filter(item => item.category == category) - line-chart( - ( - labels: items.map(item => [T#item.torque]), - values: items.map(item => item.protection), - ), - width: 100%, - height: 180pt, - title: [#defense-category-labels.at(category)], - show-points: true, - line-width: 1.4pt, - point-size: 5pt, - x-label: [Torque minimale], - y-label: [Protection], - theme: chart-theme, - ) + torque-protection-xy(items, defense-category-labels.at(category)) }), )