183 lines
5.8 KiB
Plaintext
183 lines
5.8 KiB
Plaintext
// Audit area attacks that do not declare defensive thresholds through the
|
||
// canonical `aoe_thresholds` macro.
|
||
#import "../generation/radar_graphs.typ": school-sources
|
||
#import "../generation/creature-data.typ": master-creatures
|
||
#import "origin_metrics.typ": origin-sources
|
||
#import "../theme/tables.typ" as tables
|
||
#import "report_style.typ": report-theme
|
||
|
||
#let has-aoe-thresholds(value) = lower(str(value)).contains("#aoe_thresholds")
|
||
|
||
#let aoe-signals(value) = {
|
||
let text = lower(str(value))
|
||
let signals = ()
|
||
if (text.contains("aire d'effet") or text.contains("aire d’effet")) and not (
|
||
text.contains("si cette attaque était une aire d'effet")
|
||
or text.contains("si cette attaque était une aire d’effet")
|
||
) {
|
||
signals.push("aire d’effet")
|
||
}
|
||
if text.match(regex("(^|[^a-z])aoe([^a-z]|$)")) != none {
|
||
signals.push("AOE")
|
||
}
|
||
if text.contains("zone d'effet") or text.contains("zone d’effet") {
|
||
signals.push("zone d’effet")
|
||
}
|
||
if text.match(regex("(^|[^a-zàâçéèêëîïôûùüÿñæœ])c[oô]ne([^a-zàâçéèêëîïôûùüÿñæœ]|$)")) != none and (
|
||
text.contains("attaque") or text.contains("dégât") or text.contains("inflige") or text.contains("souffle")
|
||
) {
|
||
signals.push("cône")
|
||
}
|
||
let damage = "(?:d[eé]g[aâ]t|inflige|explos)"
|
||
let area = "(?:zone|rayon)"
|
||
if text.match(regex(damage + ".{0,60}" + area)) != none or text.match(regex(
|
||
area + ".{0,60}" + damage,
|
||
)) != none {
|
||
signals.push("zone offensive")
|
||
}
|
||
signals.dedup()
|
||
}
|
||
|
||
#let school-aoe-threshold-issues = {
|
||
let issues = ()
|
||
for (school, source) in school-sources {
|
||
let rows = csv(source, delimiter: "\t")
|
||
let tier = none
|
||
let effect-column = none
|
||
for row in rows {
|
||
if row.len() == 0 { continue }
|
||
let first = row.first().trim()
|
||
if first.starts-with("Tier ") {
|
||
tier = first.replace(regex("\D"), "")
|
||
} else if first == "Technique" {
|
||
effect-column = row.position(cell => cell.trim() == "Effet")
|
||
} else if first != "" and effect-column != none and effect-column < row.len() {
|
||
let effect = row.at(effect-column)
|
||
let signals = aoe-signals(effect)
|
||
if signals.len() > 0 and not has-aoe-thresholds(effect) {
|
||
issues.push((
|
||
owner: school.replace("-", " "),
|
||
tier: if tier == none { "—" } else { tier },
|
||
ability: first,
|
||
signals: signals,
|
||
))
|
||
}
|
||
}
|
||
}
|
||
}
|
||
issues
|
||
}
|
||
|
||
#let creature-aoe-threshold-issues = {
|
||
let issues = ()
|
||
for creature in master-creatures {
|
||
for phase in creature.phases {
|
||
for group in phase.groups {
|
||
for attack in group.attacks {
|
||
let effect = str(attack.effects)
|
||
let signals = aoe-signals(effect)
|
||
if attack.type in ("AOE", "WID") { signals.push("type " + attack.type) }
|
||
signals = signals.dedup()
|
||
if signals.len() > 0 and not has-aoe-thresholds(effect) {
|
||
issues.push((
|
||
owner: creature.name,
|
||
tier: phase.name,
|
||
ability: attack.name,
|
||
signals: signals,
|
||
))
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
issues
|
||
}
|
||
|
||
#let origin-aoe-threshold-issues = {
|
||
let issues = ()
|
||
for source in origin-sources {
|
||
let origin = yaml(source.source)
|
||
for stage in origin.stades {
|
||
for ability in stage.abilities {
|
||
if ability.type != "named" { continue }
|
||
let effect = ability.at("description", default: "")
|
||
let signals = aoe-signals(effect)
|
||
let lowered = lower(effect)
|
||
if lowered.match(regex("inflige.{0,120}(?:zone|rayon)")) != none or lowered.match(regex(
|
||
"(?:zone|rayon).{0,120}inflige",
|
||
)) != none {
|
||
signals.push("zone offensive")
|
||
signals = signals.dedup()
|
||
}
|
||
if signals.len() > 0 and not has-aoe-thresholds(effect) {
|
||
issues.push((
|
||
owner: origin.name,
|
||
tier: str(stage.number),
|
||
ability: ability.at("name", default: "Capacité sans nom"),
|
||
signals: signals,
|
||
))
|
||
}
|
||
}
|
||
}
|
||
}
|
||
issues
|
||
}
|
||
|
||
#let issue-table(issues, second-heading) = if issues.len() == 0 {
|
||
text(fill: report-theme.muted-ink)[Aucune aire d’effet sans macro détectée.]
|
||
} else {
|
||
let review-label = box(
|
||
inset: (x: 2.5pt, y: 0.65pt),
|
||
radius: 2.5pt,
|
||
fill: report-theme.chart-1.transparentize(82%),
|
||
stroke: 0.4pt + report-theme.chart-1,
|
||
text(
|
||
size: 6pt,
|
||
weight: "bold",
|
||
fill: report-theme.chart-1.darken(14%),
|
||
)[À vérifier],
|
||
)
|
||
let rows = ()
|
||
for issue in issues {
|
||
rows += (
|
||
review-label,
|
||
issue.owner,
|
||
issue.tier,
|
||
issue.ability,
|
||
issue.signals.join(", "),
|
||
)
|
||
}
|
||
tables.set-table-style(
|
||
table(
|
||
columns: (0.65fr, 1.15fr, 0.75fr, 1.35fr, 1.25fr),
|
||
align: (center, left, left, left, left),
|
||
table.header([Statut], [Profil], second-heading, [Capacité], [Détection]),
|
||
..rows,
|
||
),
|
||
table-theme: "steingrund",
|
||
text-size: 7.2pt,
|
||
)
|
||
}
|
||
|
||
#let school-aoe-threshold-audit() = {
|
||
heading(level: 2)[Audit des seuils d’aire d’effet]
|
||
[Techniques susceptibles de produire une aire d’effet mais ne contenant pas
|
||
`#aoe_thresholds(...)`. Cette liste est heuristique et doit être relue.]
|
||
issue-table(school-aoe-threshold-issues, [Tier])
|
||
}
|
||
|
||
#let creature-aoe-threshold-audit() = {
|
||
heading(level: 1)[Audit des seuils d’aire d’effet]
|
||
[Attaques de type `AOE` ou `WID`, ou dont l’effet décrit une zone offensive,
|
||
sans appel à `#aoe_thresholds(...)`.]
|
||
issue-table(creature-aoe-threshold-issues, [Phase])
|
||
}
|
||
|
||
#let origin-aoe-threshold-audit() = {
|
||
heading(level: 2)[Origines — Audit des seuils d’aire d’effet]
|
||
[Capacités actives susceptibles de produire une aire d’effet sans appel à
|
||
`#aoe_thresholds(...)`. Les passifs qui modifient seulement une aire existante
|
||
sont exclus.]
|
||
issue-table(origin-aoe-threshold-issues, [Stade])
|
||
}
|