All craft gets macros
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
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:
parent
118efc192b
commit
7195aeb720
|
|
@ -2,7 +2,7 @@ Nom de la finition, ,@ar_tier:short,@ar_end:short,@ar_cst:short,Effet
|
|||
Lanière simple,#sS,0,#ddlvl(0),#ddlvl(3),"Votre bouclier gagne @rl_mains_libres ; #change(""parry"", ""-1"")"
|
||||
Affilage,#sW#sS,0,#ddlvl(1),#ddlvl(0),"#change(""damage"", ""+1""); #change(""integrity"", ""-1"")"
|
||||
Matériaux ergonomique,#sW#sS#sA,0,#ddlvl(1),#ddlvl(3),Ajoute un ½d d'Agilité
|
||||
Matériaux souples,#sW#sS#sA,0,#ddlvl(1),#ddlvl(3),Diminue le malus de discrétion de 3
|
||||
Matériaux souples,#sW#sS#sA,0,#ddlvl(1),#ddlvl(3),"#drawback-reduction((""stealth"",), ""3"")"
|
||||
Peaufinage,#sS#sA,0,#ddlvl(1),#ddlvl(3),"#change(""protection"", ""+1""); #change(""speed"", ""-2"")"
|
||||
Renforcement,#sW#sS#sA,0,#ddlvl(1),#ddlvl(4),"#change(""integrity"", ""+1"")"
|
||||
Porte Malice,#sA,1,#ddlvl(1),#ddlvl(3),Vous disposez d'un emplacement de potion d'accès rapide
|
||||
|
|
|
|||
|
|
|
@ -1,6 +1,6 @@
|
|||
Matériau,@ar_tier:short,@ar_cst:short,@ar_lvl:short,Effets sur les Armes,Effet sur les Armures et Boucliers
|
||||
Bois,0,#ddlvl(0),#ddlvl(0),"#change(""integrity"", ""-1"") ; Réduit les malus d'Esquive et Parade de 2","Résistance (un élément) #resist(2) ; #change(""integrity"", ""-1""), #change(""protection"", ""-1"")"
|
||||
Cuir,0,#ddlvl(0),#ddlvl(0),"#change(""damage"", ""-2"") ; Reduit le malus de Discretion de 2","#change(""protection"", ""-1"") ; Reduit le malus de Discretion de 4"
|
||||
Bois,0,#ddlvl(0),#ddlvl(0),"#change(""integrity"", ""-1"") ; #drawback-reduction((""dodge"", ""parry""), ""2"")","Résistance (un élément) #resist(2) ; #change(""integrity"", ""-1""), #change(""protection"", ""-1"")"
|
||||
Cuir,0,#ddlvl(0),#ddlvl(0),"#change(""damage"", ""-2"") ; #drawback-reduction((""stealth"",), ""2"")","#change(""protection"", ""-1"") ; #drawback-reduction((""stealth"",), ""4"")"
|
||||
Acier,0,#ddlvl(3),#ddlvl(1),"#change(""integrity"", ""+1"")","#change(""integrity"", ""+1"")"
|
||||
Bronze,0,#ddlvl(4),"#ddlvl(-1)","#change(""integrity"", ""-1""), #change(""damage"", ""-1"")","#change(""integrity"", ""-1""), #change(""protection"", ""-1"")"
|
||||
Écaille,1,#ddlvl(0),#ddlvl(2),"#change(""protection"", ""+1"")","Résistance (une nature Glsphysique) #resist(1) ; #change(""torque"", ""+10"")"
|
||||
|
|
@ -8,9 +8,9 @@ Critririum,2,#ddlvl(3),#ddlvl(2),"#change(""speed"", ""+2"") ; #change(""integri
|
|||
Sylvium,2,#ddlvl(3),#ddlvl(2),"#change(""integrity"", ""+1"") ; #change(""damage"", ""-1"")","#change(""integrity"", ""+3"") ; #change(""stealth"", ""-5"")"
|
||||
Fer,2,#ddlvl(3),#ddlvl(2),"#alloy-material(kind: ""physical_damage"", effect: ""+1"") ; #change(""integrity"", ""-1"")","#alloy-material(kind: ""physical_resistance"", effect: ""+1"") ; #change(""protection"", ""-1"")"
|
||||
Criellaine,2,#ddlvl(4),#ddlvl(3),"#change(""damage"", ""+2"")",Résistance (un élément physique) #resist(1)
|
||||
Admium,2,#ddlvl(3),#ddlvl(2),"#change(""physical_damage"", ""+2"") @el_pierce",Diminue les malus d'esquive et parade de 2
|
||||
Admium,2,#ddlvl(3),#ddlvl(2),"#change(""physical_damage"", ""+2"") @el_pierce","#drawback-reduction((""dodge"", ""parry""), ""2"")"
|
||||
Mistrim,2,#ddlvl(3),#ddlvl(3),"#change(""torque"", ""-5"")","#change(""torque"", ""-5"")"
|
||||
Scintilite,2,#ddlvl(4),#ddlvl(4),Diminue le malus de vitesse de 4,Diminue le malus de vitesse de 4
|
||||
Scintilite,2,#ddlvl(4),#ddlvl(4),"#drawback-reduction((""speed"",), ""4"")","#drawback-reduction((""speed"",), ""4"")"
|
||||
Mithril,3,#ddlvl(4),#ddlvl(3),"#change(""integrity"", ""+1""), #change(""protection"", ""+2"") ; ","#change(""integrity"", ""+3""), #change(""protection"", ""+1"")"
|
||||
Odrinc,3,#ddlvl(5),#ddlvl(3),"#alloy-material(kind: ""elemental_damage"", effect: ""+1"") ; #change(""integrity"", ""-2""), #change(""damage"", ""-1"")","#alloy-material(kind: ""elemental_resistance"", effect: ""+1"") ; #change(""protection"", ""-1""), #change(""integrity"", ""-2"")"
|
||||
Herkel,3,#ddlvl(3),#ddlvl(3),"#alloy-material(kind: ""secondary_characteristic"", effect: ""+1"") ; #change(""damage"", ""-1"")","#alloy-material(kind: ""secondary_characteristic"", effect: ""+1"") ; #change(""integrity"", ""-1"")"
|
||||
|
|
|
|||
|
|
|
@ -170,12 +170,21 @@
|
|||
#let evaluate-forge-effect(kind, item, target, tier, cost, effect) = {
|
||||
// Commas inside structured macro calls are syntax, not clause separators.
|
||||
let structured-pattern = regex(
|
||||
"#(?:change\\(\"[a-z_]+\",\\s*\"[+-][0-9]+\"\\)|alloy-material\\(kind:\\s*\"[a-z_]+\",\\s*effect:\\s*\"[+x][0-9]+\"\\))",
|
||||
"#(?:change\\(\"[a-z_]+\",\\s*\"[+-][0-9]+\"\\)|alloy-material\\(kind:\\s*\"[a-z_]+\",\\s*effect:\\s*\"[+x][0-9]+\"\\)|drawback-reduction\\(\\([^)]*\\),\\s*\"[1-9][0-9]*\"\\))",
|
||||
)
|
||||
let score-structured(raw) = if raw.starts-with("#drawback-reduction") {
|
||||
let found = raw.match(regex(
|
||||
"#drawback-reduction\\(\\(([^)]*)\\),\\s*\"([1-9][0-9]*)\"\\)",
|
||||
))
|
||||
let amount = found.captures.at(1)
|
||||
found.captures.at(0).matches(regex("\"([a-z_]+)\"")).map(kind => (
|
||||
score-clause("#change(\"" + kind.captures.first() + "\", \"+" + amount + "\")")
|
||||
))
|
||||
} else { (score-clause(raw),) }
|
||||
let clauses = effect.split(";").map(segment => {
|
||||
let structured = segment.matches(structured-pattern)
|
||||
if structured.len() > 0 {
|
||||
structured.map(found => score-clause(found.text))
|
||||
structured.map(found => score-structured(found.text)).flatten()
|
||||
} else {
|
||||
segment.split(",").map(score-clause)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -525,6 +525,29 @@
|
|||
[#forge-change-labels.at(kind) #effect]
|
||||
}
|
||||
|
||||
#let drawback-reduction(drawbacks, amount) = {
|
||||
let allowed = (
|
||||
"dodge", "parry", "dodge_parry", "speed", "stealth", "precision",
|
||||
"agility", "camouflage", "aerial_speed",
|
||||
)
|
||||
if type(drawbacks) != array or drawbacks.len() == 0 {
|
||||
panic("Forge drawback reduction requires a non-empty array of drawback kinds")
|
||||
}
|
||||
for drawback in drawbacks {
|
||||
if type(drawback) != str or drawback not in allowed {
|
||||
panic("Unknown forge drawback kind `" + str(drawback) + "`")
|
||||
}
|
||||
}
|
||||
if type(amount) != str or amount.match(regex("^[1-9][0-9]*$")) == none {
|
||||
panic("Invalid forge drawback reduction `" + str(amount) + "`")
|
||||
}
|
||||
let labels = drawbacks.map(kind => forge-change-labels.at(kind))
|
||||
let joined = if labels.len() == 1 { labels.first() } else {
|
||||
labels.slice(0, labels.len() - 1).join([, ]) + [ et ] + labels.last()
|
||||
}
|
||||
[Réduit #if labels.len() == 1 { [le malus] } else { [les malus] } de #joined de #amount]
|
||||
}
|
||||
|
||||
#let forge-alloy-labels = (
|
||||
damage: [les dégâts], physical_damage: [les dégâts physiques],
|
||||
elemental_damage: [les dégâts élémentaires], protection: [la protection],
|
||||
|
|
@ -574,6 +597,7 @@
|
|||
ALing: ALing,
|
||||
AOnly: AOnly,
|
||||
change: change,
|
||||
drawback-reduction: drawback-reduction,
|
||||
alloy-material: alloy-material,
|
||||
removable: removable,
|
||||
upgradable: upgradable,
|
||||
|
|
|
|||
|
|
@ -77,13 +77,25 @@
|
|||
camouflage: (), aerial_speed: (),
|
||||
)
|
||||
|
||||
#let forge-changes(effect) = effect.matches(regex(
|
||||
#let explicit-forge-changes(effect) = effect.matches(regex(
|
||||
"#change\\(\"([a-z_]+)\",\\s*\"([+-][0-9]+)\"\\)",
|
||||
)).map(found => (
|
||||
kind: found.captures.at(0),
|
||||
delta: int(found.captures.at(1)),
|
||||
))
|
||||
|
||||
#let forge-drawback-reductions(effect) = effect.matches(regex(
|
||||
"#drawback-reduction\\(\\(([^)]*)\\),\\s*\"([1-9][0-9]*)\"\\)",
|
||||
)).map(found => {
|
||||
let amount = int(found.captures.at(1))
|
||||
found.captures.at(0).matches(regex("\"([a-z_]+)\"")).map(kind => (
|
||||
kind: kind.captures.first(),
|
||||
delta: amount,
|
||||
))
|
||||
}).flatten()
|
||||
|
||||
#let forge-changes(effect) = explicit-forge-changes(effect)
|
||||
|
||||
#let forge-stat-modifiers(effect) = {
|
||||
let result = (:)
|
||||
for change in forge-changes(effect) {
|
||||
|
|
@ -125,6 +137,7 @@
|
|||
show-in-effects: true,
|
||||
stat-modifiers: (:),
|
||||
forge-changes: (),
|
||||
drawback-reductions: (),
|
||||
alloy-modifiers: (),
|
||||
wine: 0,
|
||||
wine-cost: 0,
|
||||
|
|
@ -144,6 +157,7 @@
|
|||
show-in-effects: show-in-effects,
|
||||
stat-modifiers: stat-modifiers,
|
||||
forge-changes: forge-changes,
|
||||
drawback-reductions: drawback-reductions,
|
||||
alloy-modifiers: alloy-modifiers,
|
||||
wine: wine,
|
||||
wine-cost: wine-cost,
|
||||
|
|
@ -295,6 +309,7 @@
|
|||
raw-effect,
|
||||
stat-modifiers: forge-stat-modifiers(raw-effect),
|
||||
forge-changes: forge-changes(raw-effect),
|
||||
drawback-reductions: forge-drawback-reductions(raw-effect),
|
||||
alloy-modifiers: forge-alloy-modifiers(raw-effect),
|
||||
)
|
||||
}
|
||||
|
|
@ -313,6 +328,7 @@
|
|||
finishing: row.at(3),
|
||||
stat-modifiers: forge-stat-modifiers(raw-effect),
|
||||
forge-changes: forge-changes(raw-effect),
|
||||
drawback-reductions: forge-drawback-reductions(raw-effect),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -451,6 +467,14 @@
|
|||
stats.insert(field, current + delta)
|
||||
}
|
||||
}
|
||||
for reduction in item.drawback-reductions {
|
||||
for field in forge-change-fields.at(reduction.kind) {
|
||||
let current = stats.at(field, default: none)
|
||||
if current != none and current != "null" and current < 0 {
|
||||
stats.insert(field, current + calc.min(reduction.delta, -current))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Alloy macros amplify matching positive changes declared by materials.
|
||||
for source in result.components.filter(item => item.stage == "Matériau") {
|
||||
|
|
@ -546,9 +570,24 @@
|
|||
}
|
||||
|
||||
let material-items = ingredients.components.filter(item => item.stage == "Matériau")
|
||||
let row-state = base
|
||||
let material-rows = ()
|
||||
for item in material-items {
|
||||
let modifiers = item.stat-modifiers
|
||||
for (field, delta) in item.stat-modifiers {
|
||||
let current = row-state.at(field, default: none)
|
||||
if current != none and current != "null" { row-state.insert(field, current + delta) }
|
||||
}
|
||||
for reduction in item.drawback-reductions {
|
||||
for field in forge-change-fields.at(reduction.kind) {
|
||||
let current = row-state.at(field, default: none)
|
||||
if current != none and current != "null" and current < 0 {
|
||||
let applied = calc.min(reduction.delta, -current)
|
||||
modifiers.insert(field, modifiers.at(field, default: 0) + applied)
|
||||
row-state.insert(field, current + applied)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Attribute alloy amplification to the alloy's own row.
|
||||
for alloy in item.alloy-modifiers {
|
||||
if alloy.kind == "protection" or alloy.kind.ends-with("damage") {
|
||||
|
|
@ -570,9 +609,27 @@
|
|||
material-rows.push((name: item.name, stats: modifiers, delta: true))
|
||||
}
|
||||
|
||||
let finishing-rows = ingredients.components.filter(item => (
|
||||
item.stage == "Finition" and item.stat-modifiers.values().any(value => value != 0)
|
||||
)).map(item => (name: item.name, stats: item.stat-modifiers, delta: true))
|
||||
let finishing-rows = ()
|
||||
for item in ingredients.components.filter(item => item.stage == "Finition") {
|
||||
let modifiers = item.stat-modifiers
|
||||
for (field, delta) in item.stat-modifiers {
|
||||
let current = row-state.at(field, default: none)
|
||||
if current != none and current != "null" { row-state.insert(field, current + delta) }
|
||||
}
|
||||
for reduction in item.drawback-reductions {
|
||||
for field in forge-change-fields.at(reduction.kind) {
|
||||
let current = row-state.at(field, default: none)
|
||||
if current != none and current != "null" and current < 0 {
|
||||
let applied = calc.min(reduction.delta, -current)
|
||||
modifiers.insert(field, modifiers.at(field, default: 0) + applied)
|
||||
row-state.insert(field, current + applied)
|
||||
}
|
||||
}
|
||||
}
|
||||
if modifiers.values().any(value => value != 0) {
|
||||
finishing-rows.push((name: item.name, stats: modifiers, delta: true))
|
||||
}
|
||||
}
|
||||
|
||||
let rows = (
|
||||
(name: "Base", stats: base, delta: false),
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#let aoe_thresholds = setup.aoe_thresholds
|
||||
#let weapon-pill = setup.weapon-pill
|
||||
#let change = setup.macros.change
|
||||
#let drawback-reduction = setup.macros.drawback-reduction
|
||||
#let alloy-material = setup.macros.alloy-material
|
||||
#let removable = setup.macros.removable
|
||||
#let upgradable = setup.macros.upgradable
|
||||
|
|
|
|||
Loading…
Reference in New Issue