Cookbook
Build Successful The Ravenous rulebook, changelog, player books, master handbook, and balance reports were built successfully.
Ravenous/ravenous_typst/pipeline/head This commit looks good Details

This commit is contained in:
Dandaedre 2026-08-25 19:32:53 +02:00
parent 75bb5caeda
commit 7204c67454
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
2 changed files with 175 additions and 30 deletions

View File

@ -25,3 +25,4 @@
#recipe("forge", "brise-montagne")
#recipe("forge", "cuirasse-des-brumes")
#recipe("forge", "rempart-vagabond")
#pagebreak()

View File

@ -5,6 +5,7 @@
// single source of truth for costs, difficulty, toxicity, and effects.
#import "core/macros.typ" as macros
#import "theme/variables.typ": theme
#import "theme/symbols.typ" as symbols
#import "/chapters/craft/forge-data.typ": equipments
#let ddlvl = macros.ddlvl
@ -322,49 +323,192 @@
#let forge-stat-labels = (
("damage", "Dég."),
("p_damage", "+/réuss."),
("rmax", "R. max"),
("armor_break", "Brise"),
("rmax", [@rl_rmax:short]),
("armor_break", [@rl_arbreak:short]),
("armor_pierce", "Perce"),
("antimaterial", "Anti-mat."),
("protection", "Prot."),
("integrity", "Int."),
("protection", [@rl_protection:short]),
("integrity", [@rl_integrite:short]),
("dodge", "Esq."),
("parry", "Par."),
("speed", "Vit."),
("stealth", "Disc."),
("precision", "Préc."),
("precision", [@rl_precision:short]),
("agility_bonus", "Agi."),
("range", "Portée"),
("action_cost", "Actions"),
("torque_two_handed", "Torque 2M"),
("torque_one_handed", "Torque 1M"),
("reload_cost", "Recharge"),
("action_cost", "A"),
("torque_two_handed", [@ca_torque:short 2]),
("torque_one_handed", [@ca_torque:short 1]),
("reload_cost", [@rl_reload:short]),
)
#let shown-stat(value) = if value == none or value == "null" { [—] } else { value }
#let forge-stat-line(stats) = block(
width: 100%,
inset: (x: 4pt, y: 3.5pt),
fill: theme.parchment-dark,
stroke: 0.45pt + theme.border,
radius: 3pt,
)[
#for pair in forge-stat-labels {
#let signed-stat(value) = if value > 0 { "+" + str(value) } else { str(value) }
#let forge-stat-header(body) = {
show box: it => symbols.try-re-colorize(it, theme.muted)
text(size: 5.5pt, weight: "semibold", fill: theme.muted, body)
}
#let forge-stat-summary(stats, delta: false) = {
let visible = forge-stat-labels.filter(pair => {
let value = stats.at(pair.at(0), default: none)
box(
inset: (x: 4pt, y: 2pt),
fill: theme.parchment-light,
stroke: 0.35pt + theme.border,
radius: 8pt,
)[
#text(size: 5.8pt, fill: theme.muted)[#pair.at(1)]
#h(0.25em)
#text(size: 7pt, weight: "bold")[#shown-stat(value)]
]
h(2.5pt)
value != none and value != "null" and value != 0
})
if visible.len() == 0 {
[—]
} else {
for (index, pair) in visible.enumerate() {
let value = stats.at(pair.at(0))
if index > 0 { h(0.55em) }
text(size: 5.7pt, fill: theme.muted)[#pair.at(1)]
h(0.2em)
text(size: 6.7pt, weight: "bold")[
#if delta and type(value) != str { signed-stat(value) } else { value }
]
}
}
]
}
#let forge-stat-line(ingredients) = {
let base = (:)
for field in forge-stat-fields {
base.insert(field, ingredients.equipment.at(field, default: none))
}
let material-items = ingredients.components.filter(item => item.stage == "Matériau")
let material-rows = ()
for item in material-items {
let modifiers = item.stat-modifiers
// Fer amplifies every material which directly increases weapon damage.
if item.name == "Fer" and material-items.any(other => (
other.name != "Fer" and other.stat-modifiers.at("damage", default: 0) > 0
)) {
modifiers.insert("damage", modifiers.at("damage", default: 0) + 1)
}
material-rows.push((name: item.name, stats: modifiers, delta: true))
}
let rows = (
(name: "Base", stats: base, delta: false),
..material-rows,
(name: "Final", stats: ingredients.stats, delta: false),
)
let damage-visible = rows.any(row => (
row.stats.at("damage", default: 0) != 0
or row.stats.at("p_damage", default: 0) != 0
))
let visible-fields = forge-stat-labels.filter(pair => {
let field = pair.at(0)
if field == "damage" or field == "p_damage" {
damage-visible
} else if field == "action_cost" {
rows.any(row => {
let value = row.stats.at(field, default: none)
value != none and value != "null" and value > 1
})
} else { rows.any(row => {
let value = row.stats.at(pair.at(0), default: none)
value != none and value != "null" and value != 0
}) }
})
let shown-cell(value, field, delta: false) = if (
field == "damage" or field == "p_damage"
) {
let numeric = if value == none or value == "null" { 0 } else { value }
let shown = if delta or field == "p_damage" {
signed-stat(numeric)
} else {
str(numeric)
}
if field == "damage" { shown + "/" } else { shown }
} else if (
value == none or value == "null" or value == 0
) {
[]
} else if delta and type(value) != str {
signed-stat(value)
} else if (
field in ("parry", "dodge", "integrity", "speed", "stealth", "precision")
and type(value) != str
and value > 0
) {
"+" + str(value)
} else {
value
}
let paired-stat(value, delta: false) = {
let numeric = if value == none or value == "null" { 0 } else { value }
if numeric >= 0 { "+" + str(numeric) } else { str(numeric) }
}
let row-cells(row) = {
let is-final = row.name == "Final"
let row-fill = if is-final { theme.ink } else { theme.ink.transparentize(28%) }
let row-weight = if is-final { "bold" } else { "regular" }
let cells = (
text(
size: 6.1pt,
weight: if is-final { "bold" } else { "semibold" },
fill: if is-final { theme.heading } else { theme.dark-gold.transparentize(30%) },
)[#row.name],
)
for pair in visible-fields {
let field = pair.at(0)
if field == "damage" {
let damage = row.stats.at("damage", default: 0)
let per-success = row.stats.at("p_damage", default: 0)
let left = if row.delta { paired-stat(damage, delta: true) } else { str(damage) }
cells.push(table.cell(colspan: 2, align: right + horizon)[
#text(size: 6.1pt, weight: row-weight, fill: row-fill)[#left/#paired-stat(per-success)]
])
} else if field != "p_damage" {
cells.push(text(size: 6.1pt, weight: row-weight, fill: row-fill)[
#shown-cell(
row.stats.at(field, default: none),
field,
delta: row.delta,
)
])
}
}
cells
}
let header-cells = ()
for pair in visible-fields {
let field = pair.at(0)
if field == "damage" {
header-cells.push(table.cell(colspan: 2, align: center)[
#forge-stat-header([Dég.])
])
} else if field != "p_damage" {
header-cells.push(forge-stat-header(pair.at(1)))
}
}
align(center)[
#box(
inset: (x: 4pt, y: 3.5pt),
fill: theme.parchment-dark,
stroke: 0.45pt + theme.border,
radius: 3pt,
)[
#table(
columns: (auto,) + visible-fields.map(_ => auto),
align: (left + horizon,) + visible-fields.map(_ => right + horizon),
column-gutter: 3pt,
stroke: none,
fill: none,
inset: (x: 2pt, y: 1.5pt),
table.header(
[ ],
..header-cells,
),
..rows.map(row-cells).flatten(),
)
]
]
}
#let ingredient-name(item) = text(
size: 6.6pt,
@ -437,7 +581,7 @@
)
#if craft == "Forge" {
v(4pt)
forge-stat-line(ingredients.stats)
forge-stat-line(ingredients)
}
#v(5pt)
#text(size: 6.6pt, weight: "bold", fill: theme.dark-gold)[Ingrédients et effets]