172 lines
4.8 KiB
Plaintext
172 lines
4.8 KiB
Plaintext
// Descriptive inventory of glossary alterations and their resistance metadata.
|
|
#let glossary-sources = (
|
|
yaml("/data/src/glossaries/alterations.yaml"),
|
|
// yaml("/data/src/glossaries/rules.yaml"),
|
|
yaml("/data/src/glossaries/creature.yaml"),
|
|
)
|
|
#let element-source = yaml("/data/src/glossaries/elements.yaml")
|
|
#let glossary-index = glossary-sources.flatten() + element-source
|
|
#let alteration-source = (
|
|
glossary-sources
|
|
.flatten()
|
|
.filter(item => (
|
|
item.key.starts-with("al_") and item.group != "Types d'altérations"
|
|
))
|
|
)
|
|
|
|
#let meta-category-label(group) = (
|
|
"Altérations mineures": "Mineures",
|
|
"Altérations : Marques": "Marques",
|
|
"Altérations majeures": "Majeures",
|
|
"Altérations transcendantales": "Transcendantales",
|
|
).at(group, default: group)
|
|
|
|
#let category-label(macro) = {
|
|
if macro == none { return none }
|
|
let key = macro.trim().replace(regex("^@"), "")
|
|
let found = glossary-index.find(item => item.key == key)
|
|
if found == none { macro } else if found.at("long", default: none) != none {
|
|
found.long
|
|
} else if type(found.short) == str {
|
|
found.short
|
|
} else {
|
|
macro
|
|
}
|
|
}
|
|
|
|
#let alterations = alteration-source.map(item => {
|
|
let custom = item.at("custom", default: (:))
|
|
let category-macros = if custom.at("category", default: none) == none {
|
|
()
|
|
} else {
|
|
custom
|
|
.category
|
|
.split(",")
|
|
.map(value => value.trim())
|
|
.filter(value => value != "")
|
|
.dedup()
|
|
}
|
|
(
|
|
key: item.key,
|
|
name: item.short,
|
|
meta-category: meta-category-label(item.group),
|
|
category-macros: category-macros,
|
|
categories: category-macros.map(category-label),
|
|
resisted-by: custom.at("resisted_by", default: none),
|
|
difficulty: custom.at("difficulty", default: none),
|
|
)
|
|
})
|
|
|
|
#let configured-alterations = alterations.filter(item => (
|
|
item.resisted-by != none
|
|
))
|
|
#let unconfigured-alterations = alterations.filter(item => (
|
|
item.resisted-by == none
|
|
))
|
|
#let categorized-alterations = alterations.filter(item => (
|
|
item.categories.len() > 0
|
|
))
|
|
#let uncategorized-alterations = alterations.filter(item => (
|
|
item.categories.len() == 0
|
|
))
|
|
#let alteration-meta-categories = (
|
|
alterations.map(item => item.meta-category).dedup()
|
|
)
|
|
#let alteration-categories = (
|
|
categorized-alterations.map(item => item.categories).flatten().dedup()
|
|
)
|
|
#let characteristic-order = (
|
|
"Force",
|
|
"Agilité",
|
|
"Perception",
|
|
"Psyché",
|
|
"Volonté",
|
|
"Intelligence",
|
|
"Chance",
|
|
"Charisme",
|
|
)
|
|
#let detected-characteristics(item) = if item.resisted-by == none { () } else {
|
|
characteristic-order.filter(characteristic => (
|
|
characteristic in item.resisted-by
|
|
))
|
|
}
|
|
#let resisting-characteristics = characteristic-order.filter(characteristic => (
|
|
configured-alterations.any(item => (
|
|
characteristic in detected-characteristics(item)
|
|
))
|
|
))
|
|
#let alteration-difficulties = (
|
|
configured-alterations
|
|
.map(item => item.difficulty)
|
|
.filter(value => value != none)
|
|
.dedup()
|
|
.sorted(key: str)
|
|
)
|
|
|
|
#let meta-category-count(meta-category) = (
|
|
alterations.filter(item => item.meta-category == meta-category).len()
|
|
)
|
|
#let category-count(category) = (
|
|
categorized-alterations.filter(item => category in item.categories).len()
|
|
)
|
|
#let characteristic-count(characteristic, meta-category: none) = (
|
|
configured-alterations
|
|
.filter(item => (
|
|
characteristic in detected-characteristics(item)
|
|
and (meta-category == none or item.meta-category == meta-category)
|
|
))
|
|
.len()
|
|
)
|
|
#let difficulty-count(difficulty) = (
|
|
configured-alterations.filter(item => item.difficulty == difficulty).len()
|
|
)
|
|
|
|
#let meta-category-counts = (
|
|
alteration-meta-categories
|
|
.map(meta-category => (
|
|
label: meta-category,
|
|
count: meta-category-count(meta-category),
|
|
))
|
|
.sorted(key: item => -item.count)
|
|
)
|
|
|
|
#let category-counts = (
|
|
alteration-categories
|
|
.map(category => (
|
|
label: category,
|
|
count: category-count(category),
|
|
))
|
|
.sorted(key: item => -item.count)
|
|
)
|
|
|
|
#let characteristic-counts = (
|
|
resisting-characteristics
|
|
.map(characteristic => (
|
|
label: characteristic,
|
|
count: characteristic-count(characteristic),
|
|
))
|
|
.sorted(key: item => -item.count)
|
|
)
|
|
|
|
#let difficulty-counts = alteration-difficulties.map(difficulty => (
|
|
label: if type(difficulty) == int { "Difficulté " + str(difficulty) } else {
|
|
upper(str(difficulty))
|
|
},
|
|
count: difficulty-count(difficulty),
|
|
))
|
|
|
|
#let meta-category-leader = meta-category-counts.first()
|
|
#let category-leader = if category-counts.len() == 0 { none } else {
|
|
category-counts.first()
|
|
}
|
|
#let characteristic-leader = characteristic-counts.first()
|
|
#let represented-pairs = (
|
|
configured-alterations
|
|
.map(item => detected-characteristics(item).map(characteristic => (
|
|
item.meta-category + "/" + characteristic
|
|
)))
|
|
.flatten()
|
|
.dedup()
|
|
.len()
|
|
)
|