Radar graphs

This commit is contained in:
Dandaedre 2026-08-20 16:55:10 +02:00
parent 0590035a53
commit 282b44dce0
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
13 changed files with 178 additions and 24 deletions

View File

@ -1,11 +1,11 @@
#import "/setup/setup.typ": ddlvl, gls, school_presentation, st, theme
#import "/setup/setup.typ": ddlvl, gls, radar-graph, school_presentation, st, theme
//----- Artilleur -----
#school_presentation((
title: "Artilleur",
illustration: "/images/schools/artilleur.jpg",
radar: "/images/icons/nodata.png",
radar: radar-graph("artilleur"),
description: [
Extrêmement individualiste, l'artilleur cherche à dominer le combat et en dicter
le rythme. Capable d'une très grande quantité de dégâts, il est extrêmement

View File

@ -1,8 +1,8 @@
#import "/setup/setup.typ": gls, gls-description, school_presentation
#import "/setup/setup.typ": gls, gls-description, radar-graph, school_presentation
#school_presentation((
title: "Einerjar",
illustration: "/images/schools/einerjar.jpg",
radar: "/images/icons/nodata.png",
radar: radar-graph("einerjar"),
description: [
Doté d'une grande subtilité dans ses mécaniques tout comme ses attributions,
l'Einherjar a pour rôle d'agresser une cible jusqu'à ce que mort s'ensuive.

View File

@ -1,9 +1,9 @@
#import "/setup/setup.typ": gls, gls-description, school_presentation
#import "/setup/setup.typ": gls, gls-description, radar-graph, school_presentation
// Above average skill ceiling & low skill floor, low survivability, low CC & Qol, difficult but straightforward gameplay
#school_presentation((
title: "Franc Tirreur",
illustration: "/images/schools/franc_tireur.jpg",
radar: "/images/icons/nodata.png",
radar: radar-graph("franc-tireur"),
description: [
Excellant dans l'art d'infliger des dégâts à longue distance, le franc-tireur possède une grande capacité utilitaire.
Ce soutien a longue distance lui permet d'apporter l'aide nécessaire à son équipe au moment critique tout en restant relativement hors d'atteinte.

View File

@ -1,10 +1,10 @@
#import "/setup/setup.typ": gls, gls-description, ravhelp, school_presentation
#import "/setup/setup.typ": gls, gls-description, radar-graph, ravhelp, school_presentation
// High skill ceiling, low skill floor, average survivability, very low CC, high QoL, non-straightforward gameplay
#school_presentation((
title: "Guerrier Mage",
illustration: "/images/schools/guerrier_mage.jpg",
radar: "/images/icons/nodata.png",
radar: radar-graph("guerrier-mage"),
description: [
Guerrier élémentaire, le Guerrier Mage excelle dans l'art d'infuser ses
attaques de forces élémentaires. Capable d'infliger une grande quantité

View File

@ -1,8 +1,8 @@
#import "/setup/setup.typ": school_presentation
#import "/setup/setup.typ": radar-graph, school_presentation
#school_presentation((
title: "Spécialiste des Armes Lourdes",
illustration: "/images/schools/specialiste_armes_lourdes.jpg",
radar: "/images/icons/nodata.png",
radar: radar-graph("heavy-weapon-specialist"),
description: [
Excelle à infliger de lourds dégâts et à incapaciter ses cibles.

View File

@ -1,9 +1,9 @@
#import "/setup/setup.typ": gls, gls-description, school_presentation
#import "/setup/setup.typ": gls, gls-description, radar-graph, school_presentation
// High skill ceiling, average survivability, average CC, high QoL, counter-intuitive gameplay
#school_presentation((
title: "Lancier",
illustration: "/images/schools/lancier.png",
radar: "/images/icons/nodata.png",
radar: radar-graph("lancier"),
description: [
Maîtres dans les arts du combat aérien, les lanciers sont implacables guerriers,
capables de maintenir une cible sous un déluge d'attaques sans jamais sembler s'immobiliser.

View File

@ -1,10 +1,10 @@
#import "/setup/setup.typ": gls, gls-description, ravhelp, school_presentation
#import "/setup/setup.typ": gls, gls-description, radar-graph, ravhelp, school_presentation
// Very high skill ceiling, skill ceiling mostly in choices outside of fight, high survivability, low CC, high QoL, non-straightforward self-imposed gameplay
#school_presentation((
title: "Mage Bestial",
illustration: "/images/schools/mage_bestial.jpg",
radar: "/images/icons/nodata.png",
radar: radar-graph("mage-bestial"),
description: [
Capables de prendre une partie de l'apparence et les capacités des enfants
des calamités, les Mages Bestiaux cumulent au fil de leur évolution un

View File

@ -1,9 +1,9 @@
#import "/setup/setup.typ": gls, gls-description, school_presentation
#import "/setup/setup.typ": gls, gls-description, radar-graph, school_presentation
// High skill ceiling, skill floor medium, high survivability, low CC, very high QoL, straightforward-ish gameplay
#school_presentation((
title: "Maître-Lames",
illustration: "/images/schools/maitre_lames.jpg",
radar: "/images/icons/nodata.png",
radar: radar-graph("maitre-lames"),
description: [
Autant aptes dans leurs capacités offensives que défensives,
les maîtres-lames sont capables d'imposer leur tempo sur le champ de bataille.

View File

@ -1,9 +1,9 @@
#import "/setup/setup.typ": gls, gls-description, school_presentation
#import "/setup/setup.typ": gls, gls-description, radar-graph, school_presentation
// Low skill ceiling & very low skill floor, extremely high survivability, average QoL & CC, straightforward gameplay
#school_presentation((
title: "Protecteur",
illustration: "/images/schools/protecteur.jpg",
radar: "/images/icons/nodata.png",
radar: radar-graph("protecteur"),
description: [
Rempart inflexible, capable d'encaisser sans broncher les éléments les plus destructeurs,
le protecteur excelle dans l'art de la survie face aux créatures les plus agressives.

View File

@ -1,9 +1,9 @@
#import "/setup/setup.typ": gls, gls-description, ravhelp, school_presentation
#import "/setup/setup.typ": gls, gls-description, radar-graph, ravhelp, school_presentation
// Very high skill ceiling, very low survivability, low CC & QoL, non-straightforward non-linear proactive gameplay
#school_presentation((
title: "Sangremage",
illustration: "/images/schools/sangremage.jpg",
radar: "/images/icons/nodata.png",
radar: radar-graph("sangremage"),
description: [
Puissant mage élémentaire, il puise sa force dans les pactes abyssaux passés
dans le sang. Conjurant de puissants effets de Sangressance dans une

View File

@ -0,0 +1,148 @@
// Aggregate the balancing columns from every school TSV and render comparable
// radar charts. Axis totals are normalized against the highest class total for
// that axis across the complete `school-sources` collection.
#import "../theme/variables.typ": theme
#import "@preview/primaviz:0.6.0": radar-chart
// Selected TSV fields and their reader-facing labels. Add, remove, reorder, or
// rename axes here. `aliases` handles known variations in source headers.
#let radar-fields = (
(field: "Support", display: "Support", aliases: ()),
(field: "Dégats", display: "Dégâts", aliases: ("Dégâts",)),
(field: "Survivabilité", display: "Survie", aliases: ()),
(field: "Mobilité", display: "Mobilité", aliases: ()),
(field: "C.C", display: "Contrôle", aliases: ()),
(field: "Altérations", display: "Altérations", aliases: ()),
(field: "QoL", display: "Confort", aliases: ()),
(field: "AB", display: "Brise-armure", aliases: ()),
(field: "Compléxité", display: "Complexité", aliases: ("Complexité", "Compl")),
)
// Canonical public class names and their data sources.
#let school-sources = (
artilleur: "/data/src/schools/artilleur.tsv",
einerjar: "/data/src/schools/einerjar.tsv",
franc-tireur: "/data/src/schools/franc_tirreur.tsv",
guerrier-mage: "/data/src/schools/guerrier_mage.tsv",
heavy-weapon-specialist: "/data/src/schools/heavy_weapon_specialist.tsv",
lancier: "/data/src/schools/lancier.tsv",
mage-bestial: "/data/src/schools/mage_bestial.tsv",
maitre-lames: "/data/src/schools/maitre_lames.tsv",
protecteur: "/data/src/schools/protecteur.tsv",
sangremage: "/data/src/schools/sangremage.tsv",
)
#let class-aliases = (
franc-tirreur: "franc-tireur",
specialiste-armes-lourdes: "heavy-weapon-specialist",
)
#let canonical-class-name(name) = {
let normalized = lower(name).replace("_", "-").replace(" ", "-")
class-aliases.at(normalized, default: normalized)
}
#let numeric-cell(value) = {
let value = value.trim()
if value.match(regex("^-?(?:\d+(?:\.\d+)?|\.\d+)$")) != none {
float(value)
} else {
none
}
}
#let field-index(header, field) = {
let names = (field.field,) + field.aliases
for name in names {
let index = header.position(value => value.trim() == name)
if index != none { return index }
}
panic(
"Radar field `" + field.field + "` was not found in TSV header: "
+ header.join(", "),
)
}
// Return the raw summed balancing totals for one TSV source.
// Blank and symbolic annotations such as `A`, `M`, or `1/X` are ignored.
#let balancing-totals(source, fields: radar-fields) = {
let rows = csv(source, delimiter: "\t")
let header-index = rows.position(row => "Technique" in row)
if header-index == none {
panic("No technique header found in `" + str(source) + "`")
}
let header = rows.at(header-index)
let indices = fields.map(field => field-index(header, field))
let totals = fields.map(_ => 0.0)
for row in rows.slice(header-index + 1) {
for (axis, column) in indices.enumerate() {
if column < row.len() {
let value = numeric-cell(row.at(column))
if value != none { totals.at(axis) += value }
}
}
}
totals
}
// Return raw totals for every configured class, keyed by canonical class name.
#let all-balancing-totals(fields: radar-fields) = {
let totals = (:)
for (name, source) in school-sources {
totals.insert(name, balancing-totals(source, fields: fields))
}
totals
}
#let axis-maxima(totals, axis-count) = {
range(axis-count).map(axis => {
let maximum = 0.0
for (_, values) in totals {
maximum = calc.max(maximum, values.at(axis))
}
maximum
})
}
// Render a class radar graph. `fields` can override `radar-fields` for a
// one-off graph while keeping the same field/display/aliases structure.
#let radar-graph(class-name, fields: radar-fields, size: 170pt) = {
let name = canonical-class-name(class-name)
if name not in school-sources {
panic(
"Unknown radar class `" + class-name + "`. Available classes: "
+ school-sources.keys().join(", "),
)
}
let source = school-sources.at(name)
let all-totals = all-balancing-totals(fields: fields)
let values = all-totals.at(name)
let maxima = axis-maxima(all-totals, fields.len())
let normalized = values.enumerate().map(((axis, value)) => {
let maximum = maxima.at(axis)
if maximum == 0 { 0 } else { value / maximum * 100 }
})
radar-chart(
(
labels: fields.map(field => field.display),
series: ((name: name, values: normalized),),
),
size: size,
axis-max-value: 100,
show-legend: false,
show-value-labels: false,
fill-opacity: 24%,
theme: (
palette: (theme.blood,),
text-color: theme.ink,
border-color: theme.border,
background: none,
show-grid: true,
base-size: 6pt,
base-gap: 4pt,
),
)
}

View File

@ -388,10 +388,11 @@
)[
#align(center)[
#spacers.fantasy-section("PROFIL", theme-name: "warm")[
#image(
class_info.radar,
width: 82%,
)
#if type(class_info.radar) == str {
image(class_info.radar, width: 82%)
} else {
class_info.radar
}
]
]
]

View File

@ -8,6 +8,7 @@
#import "theme/symbols.typ" as symbols
#import "theme/tables.typ" as st
#import "generation/csv-table.typ" as csv_import
#import "generation/radar_graphs.typ" as radar
//----- Re-expose shared project data -----
#let ravenous = ravenous
@ -22,6 +23,10 @@
#let hunbal = hunbal
#let bigscope = macros.bigscope
#let csv-table = csv_import.csv-table
#let radar-fields = radar.radar-fields
#let radar-graph = radar.radar-graph
#let balancing-totals = radar.balancing-totals
#let all-balancing-totals = radar.all-balancing-totals
#let kw(c) = [* #c *]
//----- Public template for class presentations -----