350 lines
6.4 KiB
Plaintext
350 lines
6.4 KiB
Plaintext
#import "../theme/variables.typ": theme
|
|
#import "../core/macros.typ" as macros
|
|
|
|
//----- CREATURE RENDERER -----
|
|
|
|
//----- STYLE CONFIGURATION -----
|
|
|
|
// Main spacing rhythm.
|
|
#let creature-spacing = (
|
|
section: 8pt,
|
|
content: 6pt,
|
|
component: 4pt,
|
|
)
|
|
|
|
// General component boxes.
|
|
#let creature-box = (
|
|
inset: 8pt,
|
|
radius: 2pt,
|
|
stroke: 0.7pt,
|
|
fill: theme.parchment-light,
|
|
border: theme.border,
|
|
)
|
|
|
|
// Fluff box.
|
|
#let creature-fluff = (
|
|
inset: (
|
|
left: 10pt,
|
|
right: 10pt,
|
|
top: 7pt,
|
|
bottom: 7pt,
|
|
),
|
|
stroke: 2pt,
|
|
accent: theme.blood,
|
|
fill: theme.parchment-light,
|
|
author-size: 9pt,
|
|
)
|
|
|
|
// Ability box.
|
|
#let creature-ability = (
|
|
inset: (
|
|
top: 4pt,
|
|
bottom: 4pt,
|
|
left: 7pt,
|
|
right: 7pt,
|
|
),
|
|
stroke: 1.5pt,
|
|
accent: theme.dark-gold,
|
|
fill: theme.parchment-light,
|
|
|
|
label-size: 9pt,
|
|
name-size: 11pt,
|
|
|
|
passive-inset: (
|
|
left: 5pt,
|
|
right: 5pt,
|
|
top: 3pt,
|
|
bottom: 3pt,
|
|
),
|
|
passive-radius: 8pt,
|
|
passive-stroke: 0.5pt,
|
|
passive-size: 8.5pt,
|
|
passive-fill: theme.parchment-dark,
|
|
)
|
|
|
|
// Stats box.
|
|
#let creature-stats = (
|
|
inset: 7pt,
|
|
radius: 2pt,
|
|
stroke: 0.5pt,
|
|
border: theme.border,
|
|
fill: theme.parchment-light,
|
|
title-size: 9pt,
|
|
)
|
|
|
|
// Stage box.
|
|
#let creature-stage = (
|
|
inset: 8pt,
|
|
radius: 2pt,
|
|
stroke: 0.7pt,
|
|
border: theme.border,
|
|
fill: theme.parchment-light,
|
|
|
|
title-size: 12pt,
|
|
symbol-size: 8pt,
|
|
symbol-gap: 4pt,
|
|
)
|
|
|
|
// Creature title.
|
|
#let creature-title = (
|
|
size: 20pt,
|
|
weight: "bold",
|
|
fill: theme.blood,
|
|
|
|
symbol-size: 8pt,
|
|
symbol-fill: theme.dark-gold,
|
|
symbol-gap: 3pt,
|
|
)
|
|
|
|
// Creature image.
|
|
#let creature-image = (
|
|
height: 50%,
|
|
stroke: 1pt,
|
|
border: theme.border,
|
|
inset: 2pt,
|
|
)
|
|
|
|
//----- STAGE NAMES -----
|
|
|
|
#let stage-name(number) = {
|
|
(
|
|
(
|
|
"Premier",
|
|
"Deuxième",
|
|
"Troisième",
|
|
"Quatrième",
|
|
"Cinquième",
|
|
"Sixième",
|
|
"Septième",
|
|
).at(number - 1)
|
|
+ " stade"
|
|
)
|
|
}
|
|
|
|
#let eval-typst(markup) = {
|
|
eval(markup, mode: "markup", scope: macros.bigscope)
|
|
}
|
|
//----- FLUFF -----
|
|
|
|
#let fluff(content, author) = {
|
|
block(
|
|
width: 100%,
|
|
inset: creature-fluff.inset,
|
|
stroke: (
|
|
left: creature-fluff.stroke + creature-fluff.accent,
|
|
),
|
|
fill: creature-fluff.fill,
|
|
)[
|
|
#emph[« #content »]
|
|
|
|
#align(right)[
|
|
#text(
|
|
size: creature-fluff.author-size,
|
|
fill: theme.muted,
|
|
)[
|
|
--- #author.
|
|
]
|
|
]
|
|
]
|
|
}
|
|
|
|
//----- ABILITY -----
|
|
|
|
#let render-ability(type, description, name: none) = {
|
|
let label = if type == "actif" {
|
|
"Actif"
|
|
} else {
|
|
"Passif"
|
|
}
|
|
|
|
block(
|
|
width: 100%,
|
|
inset: creature-ability.inset,
|
|
stroke: (
|
|
left: creature-ability.stroke + creature-ability.accent,
|
|
),
|
|
fill: creature-ability.fill,
|
|
)[
|
|
#text(
|
|
size: creature-ability.label-size,
|
|
weight: "bold",
|
|
fill: creature-ability.accent,
|
|
)[
|
|
#label
|
|
]
|
|
|
|
#if name != none [
|
|
#h(4pt)
|
|
#text(
|
|
size: creature-ability.name-size,
|
|
weight: "bold",
|
|
fill: theme.blood,
|
|
)[
|
|
#name
|
|
]
|
|
#eval-typst(description)
|
|
] else {
|
|
let passives = description.split(",")
|
|
|
|
if passives.len() > 0 {
|
|
passives
|
|
.map(passive => (
|
|
box(
|
|
inset: creature-ability.passive-inset,
|
|
radius: creature-ability.passive-radius,
|
|
stroke: (
|
|
creature-ability.passive-stroke + theme.border
|
|
),
|
|
fill: creature-ability.passive-fill,
|
|
)[
|
|
#text(
|
|
size: creature-ability.passive-size,
|
|
)[ #eval-typst(passive) ]
|
|
]
|
|
))
|
|
.join(" ")
|
|
}
|
|
}
|
|
]
|
|
}
|
|
|
|
//----- STATS -----
|
|
|
|
#let render-stats(stats) = {
|
|
if stats.max != none {
|
|
block(
|
|
width: 100%,
|
|
inset: creature-stats.inset,
|
|
radius: creature-stats.radius,
|
|
stroke: creature-stats.stroke + creature-stats.border,
|
|
fill: creature-stats.fill,
|
|
)[
|
|
#text(
|
|
size: creature-stats.title-size,
|
|
weight: "bold",
|
|
fill: theme.dark-gold,
|
|
)[
|
|
Les caractéristiques maximum à la création
|
|
]
|
|
|
|
#v(2pt)
|
|
|
|
#(
|
|
stats
|
|
.max
|
|
.pairs()
|
|
.map(((key, value)) => [
|
|
#text(weight: "bold")[#key] (#value)
|
|
])
|
|
.join([, ])
|
|
)
|
|
]
|
|
}
|
|
}
|
|
|
|
//----- STAGE -----
|
|
|
|
#let render-stage(stage) = {
|
|
block(
|
|
width: 100%,
|
|
inset: creature-stage.inset,
|
|
radius: creature-stage.radius,
|
|
stroke: creature-stage.stroke + creature-stage.border,
|
|
fill: creature-stage.fill,
|
|
)[
|
|
#align(center)[
|
|
#text(
|
|
size: creature-stage.title-size,
|
|
weight: "bold",
|
|
fill: theme.blood,
|
|
)[
|
|
#text(size: creature-stage.symbol-size)[
|
|
#theme.small-symbol
|
|
]
|
|
#h(creature-stage.symbol-gap)
|
|
#stage-name(stage.number)
|
|
#h(creature-stage.symbol-gap)
|
|
#text(size: creature-stage.symbol-size)[
|
|
#theme.small-symbol
|
|
]
|
|
]
|
|
]
|
|
|
|
#v(5pt)
|
|
|
|
#for ability-data in stage.abilities {
|
|
render-ability(
|
|
ability-data.type,
|
|
ability-data.at(
|
|
"description",
|
|
default: none,
|
|
),
|
|
name: ability-data.at(
|
|
"name",
|
|
default: none,
|
|
),
|
|
)
|
|
|
|
v(creature-spacing.component)
|
|
}
|
|
]
|
|
}
|
|
|
|
//----- CREATURE -----
|
|
|
|
#let render-creature(data) = {
|
|
show heading: it => {
|
|
align(center)[#text(
|
|
size: creature-title.size,
|
|
weight: creature-title.weight,
|
|
fill: creature-title.fill,
|
|
)[#it.body]
|
|
#v(3pt)
|
|
#text(
|
|
size: creature-title.symbol-size,
|
|
fill: creature-title.symbol-fill,
|
|
)[
|
|
#theme.section-symbol
|
|
]]
|
|
}
|
|
heading(level: 4, data.name)
|
|
v(creature-spacing.section)
|
|
if data.fluff != none [
|
|
#fluff(
|
|
data.fluff.text,
|
|
data.fluff.author,
|
|
)
|
|
#v(creature-spacing.section)
|
|
]
|
|
|
|
if data.image != none [
|
|
#align(center)[
|
|
#block(
|
|
clip: true,
|
|
stroke: creature-image.stroke + creature-image.border,
|
|
inset: creature-image.inset,
|
|
)[
|
|
#image(
|
|
data.image,
|
|
height: creature-image.height,
|
|
)
|
|
]
|
|
]
|
|
|
|
#v(creature-spacing.section)
|
|
]
|
|
|
|
data.description
|
|
v(creature-spacing.content)
|
|
|
|
if data.stats != none [
|
|
#render-stats(data.stats)
|
|
#v(creature-spacing.section)
|
|
]
|
|
|
|
for stage in data.stades [
|
|
#render-stage(stage)
|
|
#v(creature-spacing.section)
|
|
]
|
|
}
|