451 lines
14 KiB
Plaintext
451 lines
14 KiB
Plaintext
// Presentation layer for generated weapon balancing metrics.
|
||
#import "@preview/primaviz:0.6.0": (
|
||
grouped-bar-chart, grouped-stacked-bar-chart, horizontal-bar-chart,
|
||
)
|
||
#import "weapon_metrics.typ": *
|
||
#import "report_style.typ": chart-theme, metric-card, rounded
|
||
#import "../theme/tables.typ" as tables
|
||
#import "weapon_armor_breakpoints.typ": armor-commitment-analysis
|
||
#import "report_config.typ": armor-settings, weapon-settings
|
||
|
||
#let low-scenario = commitment-pools.find(item => item.key == "low")
|
||
#let mid-scenario = commitment-pools.find(item => item.key == "mid")
|
||
#let full-scenario = commitment-pools.find(item => item.key == "full")
|
||
|
||
#let weapon-series(key) = weapon-natures.map(nature => (
|
||
name: weapon-nature-labels.at(nature),
|
||
values: weapon-shapes.map(shape => all-weapon-metrics
|
||
.find(item => (
|
||
item.shape == shape and item.nature-key == nature
|
||
))
|
||
.at(key)),
|
||
))
|
||
|
||
#let weapon-value-matrix(key, digits: 1) = {
|
||
let rows = ()
|
||
for shape in weapon-shapes {
|
||
rows.push(shape)
|
||
for nature in weapon-natures {
|
||
rows.push(rounded(
|
||
all-weapon-metrics
|
||
.find(item => (
|
||
item.shape == shape and item.nature-key == nature
|
||
))
|
||
.at(key),
|
||
digits: digits,
|
||
))
|
||
}
|
||
}
|
||
tables.set-table-style(
|
||
table(
|
||
columns: (1.3fr,) + (0.8fr,) * weapon-natures.len(),
|
||
align: (left,) + (right,) * weapon-natures.len(),
|
||
table.header([Forme], ..weapon-natures.map(
|
||
nature => [#weapon-nature-labels.at(nature)],
|
||
)),
|
||
..rows,
|
||
),
|
||
table-theme: "steingrund",
|
||
text-size: 7.5pt,
|
||
)
|
||
}
|
||
|
||
#let expected-damage-cell(item, commitment-key) = {
|
||
let result = item.commitments.at(commitment-key)
|
||
[#rounded(result.best, digits: 2) #text(
|
||
size: 6pt,
|
||
fill: luma(90),
|
||
)[#result.strategy dés]]
|
||
}
|
||
|
||
#let standard-commitment-stacked-groups = weapon-natures.map(nature => {
|
||
let values = weapon-shapes.map(shape => all-weapon-metrics.find(item => (
|
||
item.shape == shape and item.nature-key == nature
|
||
)))
|
||
(
|
||
name: weapon-nature-labels.at(nature) + " (2 actions)",
|
||
segments: (
|
||
(
|
||
name: str(low-scenario.dice) + " dés",
|
||
values: values.map(item => item.commitments.low.best),
|
||
),
|
||
(
|
||
name: "Gain " + str(low-scenario.dice) + "→" + str(mid-scenario.dice),
|
||
values: values.map(item => (
|
||
item.commitments.mid.best - item.commitments.low.best
|
||
)),
|
||
),
|
||
(
|
||
name: "Gain " + str(mid-scenario.dice) + "→" + str(full-scenario.dice),
|
||
values: values.map(item => (
|
||
item.commitments.full.best - item.commitments.mid.best
|
||
)),
|
||
),
|
||
),
|
||
)
|
||
})
|
||
|
||
// Local comparison only: give the 2A Super-lourd a four-action window, hence
|
||
// exactly two attacks, and optimally split each configured die pool between them.
|
||
#let super-heavy-four-action-damage(item, scenario) = {
|
||
commitment-analysis(
|
||
item.base-damage,
|
||
item.p-damage,
|
||
item.rmax,
|
||
1,
|
||
scenario.dice,
|
||
item.success-probability,
|
||
)
|
||
.split
|
||
.damage
|
||
}
|
||
|
||
#let super-heavy-four-action-values = weapon-shapes.map(shape => (
|
||
all-weapon-metrics.find(item => (
|
||
item.shape == shape and item.nature-key == "SuperHeavy"
|
||
))
|
||
))
|
||
#let super-heavy-four-action-low = super-heavy-four-action-values.map(item => (
|
||
super-heavy-four-action-damage(item, low-scenario)
|
||
))
|
||
#let super-heavy-four-action-mid = super-heavy-four-action-values.map(item => (
|
||
super-heavy-four-action-damage(item, mid-scenario)
|
||
))
|
||
#let super-heavy-four-action-full = super-heavy-four-action-values.map(item => (
|
||
super-heavy-four-action-damage(item, full-scenario)
|
||
))
|
||
#let commitment-stacked-groups = (
|
||
standard-commitment-stacked-groups
|
||
+ (
|
||
(
|
||
name: "Super-lourd (4 actions)",
|
||
segments: (
|
||
(
|
||
name: str(low-scenario.dice) + " dés",
|
||
values: super-heavy-four-action-low,
|
||
),
|
||
(
|
||
name: "Gain "
|
||
+ str(low-scenario.dice)
|
||
+ "→"
|
||
+ str(mid-scenario.dice),
|
||
values: (
|
||
range(weapon-shapes.len()).map(index => (
|
||
super-heavy-four-action-mid.at(index)
|
||
- super-heavy-four-action-low.at(index)
|
||
))
|
||
),
|
||
),
|
||
(
|
||
name: "Gain "
|
||
+ str(mid-scenario.dice)
|
||
+ "→"
|
||
+ str(full-scenario.dice),
|
||
values: (
|
||
range(weapon-shapes.len()).map(index => (
|
||
super-heavy-four-action-full.at(index)
|
||
- super-heavy-four-action-mid.at(index)
|
||
))
|
||
),
|
||
),
|
||
),
|
||
),
|
||
)
|
||
)
|
||
|
||
#let weapon-analysis-report() = {
|
||
pagebreak()
|
||
heading(level: 2)[Artisanat — Équilibre des armes]
|
||
|
||
let max-ranked = ranked-weapons("max-damage")
|
||
let action-ranked = ranked-weapons("damage-per-action")
|
||
let break-ranked = ranked-weapons("armor-break")
|
||
|
||
grid(
|
||
columns: (1fr,) * 4,
|
||
column-gutter: 8pt,
|
||
metric-card("Armes générées", all-weapon-metrics.len()),
|
||
metric-card("Dégâts max. moyens", rounded(
|
||
weapon-average("max-damage"),
|
||
digits: 1,
|
||
)),
|
||
metric-card("Dégâts/action moyens", rounded(
|
||
weapon-average("damage-per-action"),
|
||
digits: 1,
|
||
)),
|
||
metric-card("Brise-armure moyen", rounded(
|
||
weapon-average("armor-break"),
|
||
digits: 1,
|
||
)),
|
||
)
|
||
|
||
[Les dégâts à $n$ réussites valent `Dégâts + (n − 1) × Dégâts/réussite`.
|
||
Les dégâts maximaux utilisent `R.Max`; les dégâts par action divisent ce
|
||
résultat par le coût d’action généré de l’arme.]
|
||
|
||
heading(level: 3)[Dégâts probabilistes sur 2 actions]
|
||
[Chaque dé réussit avec une probabilité de
|
||
`(Précision naturelle + modificateur) / faces`, soit
|
||
`(#natural-precision + Précision) / #precision-die-sides`. Les
|
||
espérances ci-dessous utilisent la distribution binomiale exacte et plafonnent
|
||
les dégâts à `R.Max`. Pour une arme à 1A, toutes les répartitions possibles du
|
||
pool entre deux attaques sont comparées à une attaque unique; la meilleure
|
||
option est affichée. Une arme à 2A conserve nécessairement le pool entier.]
|
||
|
||
let expectation-rows = all-weapon-metrics.map(item => (
|
||
item.name,
|
||
str(item.effective-precision),
|
||
str(calc.round(item.success-probability * 100)) + "%",
|
||
expected-damage-cell(item, "low"),
|
||
expected-damage-cell(item, "mid"),
|
||
expected-damage-cell(item, "full"),
|
||
))
|
||
tables.set-table-style(
|
||
table(
|
||
columns: (1.5fr, 0.52fr, 0.62fr, 0.85fr, 0.85fr, 0.85fr),
|
||
align: (left,) + (right,) * 5,
|
||
table.header(
|
||
[Arme],
|
||
[Préc.],
|
||
[Chance/dé],
|
||
[#low-scenario.label · #low-scenario.dice dés],
|
||
[#mid-scenario.label · #mid-scenario.dice dés],
|
||
[#full-scenario.label · #full-scenario.dice dés],
|
||
),
|
||
..expectation-rows.flatten(),
|
||
),
|
||
table-theme: "steingrund",
|
||
text-size: 7.2pt,
|
||
)
|
||
|
||
heading(level: 3)[Dégâts maximaux par forme et poids]
|
||
grouped-bar-chart(
|
||
(labels: weapon-shapes, series: weapon-series("max-damage")),
|
||
width: 100%,
|
||
height: 205pt,
|
||
y-label: [Dégâts à R.Max],
|
||
theme: chart-theme,
|
||
)
|
||
weapon-value-matrix("max-damage", digits: 0)
|
||
|
||
heading(level: 3)[Dégâts maximaux par action]
|
||
grouped-bar-chart(
|
||
(labels: weapon-shapes, series: weapon-series("damage-per-action")),
|
||
width: 100%,
|
||
height: 205pt,
|
||
y-label: [Dégâts / action],
|
||
theme: chart-theme,
|
||
)
|
||
weapon-value-matrix("damage-per-action", digits: 1)
|
||
|
||
heading(
|
||
level: 3,
|
||
)[Dégâts attendus à #low-scenario.dice, #mid-scenario.dice et #full-scenario.dice dés — #weapon-settings.action_budget actions]
|
||
[Pour chaque forme, les quatre premières barres (léger, moyen, lourd et
|
||
super-lourd) utilisent le budget normal de deux actions. La cinquième,
|
||
*Super-lourd (4 actions)*, est une comparaison hypothétique limitée à ce
|
||
graphique: elle effectue exactement deux attaques de 2A et répartit le pool de
|
||
dés entre elles de la manière la plus favorable. L’empilement est cumulatif:
|
||
le premier segment donne les dégâts
|
||
à #low-scenario.dice dés, puis les gains supplémentaires jusqu’à
|
||
#mid-scenario.dice et #full-scenario.dice dés. Le sommet est donc l’espérance
|
||
réelle à #full-scenario.dice dés.]
|
||
align(center)[
|
||
#text(size: 7pt, weight: "bold")[Ordre des barres :]
|
||
#text(
|
||
size: 7pt,
|
||
)[ Léger (2 actions) · Moyen (2 actions) · Lourd (2 actions) ·
|
||
Super-lourd (2 actions) · Super-lourd (4 actions, 2 attaques)]
|
||
]
|
||
grouped-stacked-bar-chart(
|
||
(labels: weapon-shapes, groups: commitment-stacked-groups),
|
||
width: 100%,
|
||
height: 230pt,
|
||
y-label: [Dégâts attendus],
|
||
theme: chart-theme,
|
||
)
|
||
|
||
heading(
|
||
level: 3,
|
||
)[Plan de bataille — Sélection des armes sur #weapon-settings.action_budget actions]
|
||
let low-leader = all-weapon-metrics
|
||
.sorted(
|
||
key: item => -item.commitments.low.best,
|
||
)
|
||
.first()
|
||
let full-leader = all-weapon-metrics
|
||
.sorted(
|
||
key: item => -item.commitments.full.best,
|
||
)
|
||
.first()
|
||
let armor-protection = armor-settings.utilization_protection
|
||
let armor-dice = armor-settings.utilization_dice
|
||
let armor-leader = all-weapon-metrics
|
||
.map(item => (
|
||
item: item,
|
||
value: armor-commitment-analysis(
|
||
item,
|
||
armor-dice,
|
||
armor-protection,
|
||
).destruction,
|
||
))
|
||
.sorted(key: result => -result.value)
|
||
.first()
|
||
let scaling-leader = all-weapon-metrics
|
||
.map(item => (
|
||
item: item,
|
||
gain: item.commitments.full.best - item.commitments.low.best,
|
||
))
|
||
.sorted(key: result => -result.gain)
|
||
.first()
|
||
grid(
|
||
columns: (1fr, 1fr),
|
||
column-gutter: 12pt,
|
||
row-gutter: 12pt,
|
||
metric-card(
|
||
"Faible engagement",
|
||
low-leader.name,
|
||
note: [#rounded(low-leader.commitments.low.best, digits: 2) dégâts à #low-scenario.dice dés],
|
||
),
|
||
metric-card(
|
||
"Engagement total",
|
||
full-leader.name,
|
||
note: [#rounded(full-leader.commitments.full.best, digits: 2) dégâts à #full-scenario.dice dés],
|
||
),
|
||
|
||
metric-card(
|
||
"Destruction d’armure",
|
||
armor-leader.item.name,
|
||
note: [#rounded(armor-leader.value, digits: 2) armure contre P#armor-protection à #armor-dice dés],
|
||
),
|
||
metric-card(
|
||
"Meilleure montée en puissance",
|
||
scaling-leader.item.name,
|
||
note: [+#rounded(scaling-leader.gain, digits: 2) dégâts entre #low-scenario.dice et #full-scenario.dice dés],
|
||
),
|
||
)
|
||
|
||
heading(level: 3)[Classements offensifs]
|
||
grid(
|
||
columns: (1fr, 1fr, 1fr),
|
||
column-gutter: 10pt,
|
||
horizontal-bar-chart(
|
||
(
|
||
labels: max-ranked.slice(0, 8).map(item => item.name),
|
||
values: max-ranked.slice(0, 8).map(item => item.max-damage),
|
||
),
|
||
width: 100%,
|
||
height: 210pt,
|
||
title: [Dégâts maximaux],
|
||
show-values: true,
|
||
theme: chart-theme,
|
||
),
|
||
horizontal-bar-chart(
|
||
(
|
||
labels: action-ranked.slice(0, 8).map(item => item.name),
|
||
values: action-ranked.slice(0, 8).map(item => item.damage-per-action),
|
||
),
|
||
width: 100%,
|
||
height: 210pt,
|
||
title: [Dégâts par action],
|
||
show-values: true,
|
||
theme: chart-theme,
|
||
),
|
||
horizontal-bar-chart(
|
||
(
|
||
labels: break-ranked.slice(0, 8).map(item => item.name),
|
||
values: break-ranked.slice(0, 8).map(item => item.armor-break),
|
||
),
|
||
width: 100%,
|
||
height: 210pt,
|
||
title: [Brise-armure],
|
||
show-values: true,
|
||
theme: chart-theme,
|
||
),
|
||
)
|
||
|
||
heading(
|
||
level: 3,
|
||
)[Tableau d’équilibrage — Espérances sur #weapon-settings.action_budget actions]
|
||
let rows = all-weapon-metrics.map(item => (
|
||
item.name,
|
||
str(item.base-damage),
|
||
if item.p-damage >= 0 { "+" + str(item.p-damage) } else {
|
||
str(item.p-damage)
|
||
},
|
||
str(item.rmax),
|
||
str(item.max-damage),
|
||
str(item.armor-break),
|
||
str(item.actions) + "A",
|
||
rounded(item.damage-per-action, digits: 1),
|
||
rounded(item.commitments.low.best, digits: 2),
|
||
rounded(item.commitments.mid.best, digits: 2),
|
||
rounded(item.commitments.full.best, digits: 2),
|
||
))
|
||
tables.set-table-style(
|
||
table(
|
||
columns: (
|
||
1.55fr,
|
||
0.46fr,
|
||
0.42fr,
|
||
0.48fr,
|
||
0.62fr,
|
||
0.52fr,
|
||
0.48fr,
|
||
0.62fr,
|
||
0.62fr,
|
||
0.62fr,
|
||
0.62fr,
|
||
),
|
||
align: (left,) + (right,) * 10,
|
||
table.header(
|
||
[Arme],
|
||
[Dég.],
|
||
[+],
|
||
[R.Max],
|
||
[Dég. max],
|
||
[Brise],
|
||
[Actions],
|
||
[Dég./A],
|
||
[E·#low-scenario.dice d],
|
||
[E·#mid-scenario.dice d],
|
||
[E·#full-scenario.dice d],
|
||
),
|
||
..rows.flatten(),
|
||
),
|
||
table-theme: "steingrund",
|
||
text-size: 6.5pt,
|
||
)
|
||
|
||
heading(level: 3)[Courbes de dégâts par réussite]
|
||
let curve-rows = ()
|
||
let max-successes = all-weapon-metrics.map(item => item.rmax).sorted().last()
|
||
for item in all-weapon-metrics {
|
||
curve-rows.push(item.name)
|
||
for successes in range(1, max-successes + 1) {
|
||
if successes <= item.rmax {
|
||
curve-rows.push(str(damage-at-successes(
|
||
item.base-damage,
|
||
item.p-damage,
|
||
successes,
|
||
)))
|
||
} else {
|
||
curve-rows.push(text(size: 6pt, smallcaps[(capped)]))
|
||
}
|
||
}
|
||
}
|
||
tables.set-table-style(
|
||
table(
|
||
columns: (1.65fr,) + (0.65fr,) * max-successes,
|
||
align: (left,) + (right,) * max-successes,
|
||
table.header(
|
||
[Arme],
|
||
..range(1, max-successes + 1).map(successes => [#successes réuss.]),
|
||
),
|
||
..curve-rows,
|
||
),
|
||
table-theme: "steingrund",
|
||
text-size: 7pt,
|
||
)
|
||
}
|