Auto forge data
Build Successful The Ravenous rulebook was built successfully.
Ravenous/ravenous_typst/pipeline/head This commit looks good Details

This commit is contained in:
Dandaedre 2026-08-20 01:34:31 +02:00
parent 879021ca91
commit 142d736417
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
4 changed files with 242 additions and 19 deletions

View File

@ -101,6 +101,8 @@
equipment.insert("id", none)
equipment.insert("shape_id", shape.id)
equipment.insert("nature_id", nature.id)
equipment.insert("shape_name", shape.name)
equipment.insert("nature_name", nature.name)
equipment.insert("meta_category", "Equipment")
equipment.insert("name", shape.name + " " + nature.adjective)
equipment.insert("adjective", nature.adjective)

View File

@ -1,20 +1,235 @@
#import "forge-data.typ": equipments
#import "/setup/setup.typ": ddlvl, st
// This is intentionally only a diagnostic table. The forge rules live in
// `forge-data.typ`; richer category-specific rendering can be added here.
#table(
columns: 6,
table.header([Forme], [Catégorie], [Dégâts], [Précision], [Protection], [Intégrité]),
..equipments.map(item => (
[#item.name],
[#item.shape_category],
[#item.damage],
[#item.precision],
[#item.protection],
[#item.integrity],
)).flatten(),
// Temporary handling names. These are presentation/game-rule data rather than
// composition rules, so they deliberately live beside the forge table.
#let handling-by-shape = (
"Griffes": "Tranchante",
"Hast": "Hast",
"Épée": "Tranchante",
"Marteau": "Contondante",
"Hache": "Tranchante",
"Arbalète": "Distance",
"Arc": "Distance",
"Bouclier": "-",
"Armure": "-",
)
#let super-heavy-handling = (
"Griffes": "Frienzä",
"Hast": "Paysagiste",
"Épée": "Haroth",
"Marteau": "Rhödarak",
"Hache": "Kahml",
)
#let handling(item) = {
if (
item.nature_category == "SuperHeavy"
and item.shape_name in super-heavy-handling
) {
super-heavy-handling.at(item.shape_name)
} else {
handling-by-shape.at(item.shape_name, default: "-")
}
}
// The database stores a generic adjective per nature. French gender and the
// plural form of "Griffes" are presentation details, kept here with handling.
#let adjectives-by-shape = (
"Griffes": (
Light: "légères",
Medium: "moyennes",
Heavy: "lourdes",
SuperHeavy: "super-lourdes",
),
"Hast": (
Light: "léger",
Medium: "moyen",
Heavy: "lourd",
SuperHeavy: "super-lourd",
),
"Épée": (
Light: "légère",
Medium: "moyenne",
Heavy: "lourde",
SuperHeavy: "super-lourde",
),
"Marteau": (
Light: "léger",
Medium: "moyen",
Heavy: "lourd",
SuperHeavy: "super-lourd",
),
"Hache": (
Light: "légère",
Medium: "moyenne",
Heavy: "lourde",
SuperHeavy: "super-lourde",
),
"Arbalète": (
Light: "légère",
Medium: "moyenne",
Heavy: "lourde",
SuperHeavy: "super-lourde",
),
"Arc": (
Light: "léger",
Medium: "moyen",
Heavy: "lourd",
SuperHeavy: "super-lourd",
),
"Bouclier": (
Light: "léger",
Medium: "moyen",
Heavy: "lourd",
SuperHeavy: "super-lourd",
),
"Armure": (
Light: "légère",
Medium: "moyenne",
Heavy: "lourde",
SuperHeavy: "super-lourde",
),
)
#let display-name(item) = {
let adjectives = adjectives-by-shape.at(item.shape_name, default: none)
if adjectives == none {
item.name
} else {
item.shape_name + " " + adjectives.at(item.nature_category)
}
}
#let damage-symbols = (
"Slash": [@el_slash],
"Blunt": [@el_blunt],
"Pierce": [@el_pierce],
)
#let mode(mode-data) = {
let (rank, damage-type) = mode-data.pairs().first()
let symbol = damage-symbols.at(damage-type, default: [#damage-type])
if rank == "Secondary" {
[\[#symbol\]]
} else if rank == "Tertiary" {
[\[\[#symbol\]\]]
} else {
symbol
}
}
#let modes(item) = item.damage_type.map(mode).join([, ])
#let signed(value) = if value > 0 { "+" + str(value) } else { str(value) }
#let shown(value) = if value == none { [-] } else { [#value] }
#let special(item) = {
let parts = ()
if item.action_cost > 1 {
parts.push([#(str(item.action_cost) + "A")])
}
if item.reload_cost != none and item.reload_cost != "null" {
parts.push([#item.reload_cost@rl_reload])
}
if item.armor_pierce != 0 {
parts.push([Perce-armure #signed(item.armor_pierce)])
}
if item.antimaterial != 0 {
parts.push([Antimatériel #signed(item.antimaterial)])
}
if item.range > 0 {
parts.push([#item.range m])
}
if item.precision != 0 {
parts.push([@rl_precision #signed(item.precision)])
}
if item.agility_bonus != 0 {
parts.push([Agilité #signed(item.agility_bonus)])
}
parts += item.special.map(effect => [#effect])
if parts.len() == 0 { [-] } else { parts.join([, ]) }
}
// Category-specific post-treatment belongs in the helpers above. The data
// module remains responsible only for importing and composing equipment.
#page(
flipped: true,
)[
#st.set-table-style(
table-theme: "steel",
stroke: none,
table(
columns: 17,
// TODO: This might be a little too tight
// inset: (x: 2pt, y: 3pt),
align: (
left,
left,
center,
center,
center,
center,
center,
center,
center,
center,
center,
center,
center,
center,
center,
left,
center,
),
table.header(
[Forme],
[Maniement],
[Dég.],
[+],
[R.Max],
[Brise],
[Prot.],
[Int.],
[T2],
[T1],
[Modes],
[Esq.],
[Par.],
[Vit.],
[Disc.],
[Spécial],
[Diff.],
),
..equipments
.map(item => (
[#display-name(item)],
[#handling(item)],
[#item.damage],
[#item.p_damage],
[#item.rmax],
[#item.armor_break],
[#item.protection],
[#item.integrity],
shown(item.torque_two_handed),
shown(item.torque_one_handed),
[#modes(item)],
[#item.dodge],
[#item.parry],
[#item.speed],
[#item.stealth],
[#special(item)],
[#ddlvl(item.difficulty)],
))
.flatten(),
),
)
]
// \begin{landscape}\begin{center}
// \begin{longtblr}[

@ -1 +1 @@
Subproject commit c5af8a89ccb47b4a4bd57412a13bec90809fc61a
Subproject commit bcf8a9cdf8e3c43bc2cfbfbfe9f115fef0f60baa

View File

@ -1,21 +1,27 @@
#import "chapters/craft/forge-data.typ": *
#import "/chapters/craft/forge-data.typ": *
#assert.eq(equipments.len(), 36)
#let griffes-legeres = equipments.find(item => item.shape_id == 1 and item.nature_id == 33)
#let griffes-legeres = equipments.find(item => (
item.shape_id == 1 and item.nature_id == 33
))
#assert.eq(griffes-legeres.name, "Griffes légère")
#assert.eq(griffes-legeres.damage, 3)
#assert.eq(griffes-legeres.damage, 2)
#assert.eq(griffes-legeres.p_damage, 0)
#assert.eq(griffes-legeres.precision, 2)
#assert.eq(griffes-legeres.torque_one_handed, 4)
#assert.eq(griffes-legeres.torque_two_handed, none)
#let bouclier-leger = equipments.find(item => item.shape_id == 8 and item.nature_id == 90)
#let bouclier-leger = equipments.find(item => (
item.shape_id == 8 and item.nature_id == 90
))
#assert.eq(bouclier-leger.protection, 2)
#assert.eq(bouclier-leger.parry, 3)
#assert.eq(bouclier-leger.torque_one_handed, 6)
#let armure-legere = equipments.find(item => item.shape_id == 9 and item.nature_id == 39)
#let armure-legere = equipments.find(item => (
item.shape_id == 9 and item.nature_id == 39
))
#assert.eq(armure-legere.protection, 3)
#assert.eq(armure-legere.integrity, 5)
#assert.eq(armure-legere.torque_two_handed, 9)