diff --git a/chapters/schools/artilleur.typ b/chapters/schools/artilleur.typ index 04d7409..c096613 100644 --- a/chapters/schools/artilleur.typ +++ b/chapters/schools/artilleur.typ @@ -1,6 +1,4 @@ -#import "../../setup/setup.typ": ( - ddlvl, gls, gls-description, school_presentation, theme, -) +#import "../../setup/setup.typ": ddlvl, gls, school_presentation, st, theme // ----------------------------------------------------------------------------- // Artilleur @@ -91,117 +89,276 @@ l'aptitude de ce dernier à transformer et utiliser ce qui ne serait qu'un amas d'acier pour une autre personne en une arme capable d'une immense propension à la destruction. -#table( - columns: (1.1fr, 0.8fr, 0.7fr, 0.7fr, 0.7fr, 3fr), - // stroke: none, - inset: 3pt, - align: (left, left, center, center, left), +#st.set-table-style( + table-theme: "sage", + table( + columns: (1.1fr, 0.8fr, 0.7fr, 0.7fr, 0.7fr, 3fr), + align: (left, left, center, center, center, left), + table.header([Nom], [Gain], [Type], [@ca_torque:short], [Dégâts], [Effet]), - table.header([Nom], [Gain], [Type], [@ca_torque:short], [Dégâts], [Effet]), + [Standard], + [Base], + [5/+3], + [@rl_rmax:short 4], + [20], + [ -1 recul par 10 de sur-torque. Recharge 3A. @rl_arbreak 1 ], - // Standard - [Standard], - [Base], - [5/+3], - [@rl_rmax:short 4], - [10], - [ -1 recul par 10 de sur-torque. Recharge 3A. @rl_arbreak 1], + [Standard], + [Base], + [5/+3], + [@rl_rmax:short 4], + [10], + [ -1 recul par 10 de sur-torque. Recharge 3A. @rl_arbreak 1 ], - [Compact], - [Base], - [4/+3], - [@rl_rmax:short 3], - [6], - [-2 recul, -1 de recul par 10 de sur-torque). - Précision +1. Recharge 2A.], + [Standard], + [Base], + [5/+3], + [@rl_rmax:short 4], + [10], + [ -1 recul par 10 de sur-torque. Recharge 3A. @rl_arbreak 1 ], - [Long], - [Base], - [6/+3], - [@rl_rmax:short 4], - [15], - [ Recul +1. (-1 de recul par 10 de sur-torque). - Recharge 4A. @rl_arbreak 2], + [Standard], + [Base], + [5/+3], + [@rl_rmax:short 4], + [10], + [ -1 recul par 10 de sur-torque. Recharge 3A. @rl_arbreak 1 ], - [Lourd], - [Base], - [8/+4], - [@rl_rmax:short 4], - [26], - [ Recul +4. (-1 de recul par 10 de sur-torque). - Recharge 5A. @rl_arbreak 3.], - - // Canon - table.hline(stroke: 0.5pt + luma(70%)), - - [Canon Simple], - [Canon], - [0/+1], - [@rl_rmax:short +1], - [], [], - - // table.cell( - // colspan: 6, - // align: left, - // [*Canon Double* — Chaque recharge apporte deux tirs. - // Peut être utilisé simultanément, ajoutant +4 à la précision, 3 au recul - // et surchauffe 2. Recharge +1A.], - // ), - - // // Chargeur - // table.hline(stroke: 0.5pt + luma(70%)), - - // table.cell( - // colspan: 2, - // [Chargeur Rotatif], - // ), - // table.cell( - // colspan: 2, - // [Chargeur], - // ), - // [Chaque recharge apporte six tirs, armes standard ou compact. - // Intégrité -1. Recharge +2A.], - - // table.cell( - // colspan: 2, - // [Chargeur Long], - // ), - // table.cell( - // colspan: 2, - // [Chargeur], - // ), - // [Chaque recharge apporte quatre tirs, armes standard, compacte ou longue. - // Recharge +1A.], - - // [Chargeur Unique], - // [Chargeur], - // [+1], - // [], - // [Intégrité +2. @rl_arbreak +1.], - - // // Alchimie - // table.hline(stroke: 0.5pt + luma(70%)), - - // [Munition lacérante], - // [Alchimie], - // [-1/-0], - // [], - // [Les dégâts de l'attaque deviennent Tranchant - // (donne un bonus de #ddlvl(1, plus: true) aux altérations).], - - // [Munition incapacitante], - // [Alchimie], - // [-3/-0], - // [], - // [Les dégâts de l'attaque deviennent Contondant - // (donne un bonus de #ddlvl(1, plus: true) aux altérations).], - - // [Munition Alchimique], - // [Alchimie], - // [-6/-1], - // [@rl_rmax:short -1], - // [L'arme inflige les effets d'une potion à l'impact - // (donne un bonus de #ddlvl(1, plus: true) aux altérations).], + [Standard], + [Base], + [5/+3], + [@rl_rmax:short 4], + [50], + [ -1 recul par 10 de sur-torque. Recharge 3A. @rl_arbreak 1 ], + ), ) -#v(1fr) +// #mt.styled-table( +// ( +// 1.1fr, +// 0.8fr, +// 0.7fr, +// 0.7fr, +// 0.7fr, +// 3fr, +// ), + +// align: ( +// left, +// left, +// center, +// center, +// center, +// left, +// ), +// ( +// // --------------------------------------------------------------------------- +// // Header +// // --------------------------------------------------------------------------- + +// mt.table-header([Nom]), +// mt.table-header( +// [Gain], +// align: center, +// ), +// mt.table-header( +// [Type], +// align: center, +// ), +// mt.table-header( +// [@ca_torque:short], +// align: center, +// ), +// mt.table-header( +// [Dégâts], +// align: center, +// ), +// mt.table-header([Effet]), + +// // --------------------------------------------------------------------------- +// // Standard +// // --------------------------------------------------------------------------- +// mt.table-row( +// ( +// [Standard], +// [Base], +// [5/+3], +// [@rl_rmax:short 4], +// [10], +// [ +// -1 recul par 10 de sur-torque. +// Recharge 3A. +// @rl_arbreak 1 +// ], +// ), +// index: 0, +// ), + +// mt.table-row( +// ( +// [Compact], +// [Base], +// [4/+3], +// [@rl_rmax:short 3], +// [6], +// [ +// -2 recul, -1 de recul par 10 de sur-torque). +// Précision +1. +// Recharge 2A. +// ], +// ), +// index: 1, +// ), +// mt.table-row( +// ( +// [Long], +// [Base], +// [6/+3], +// [@rl_rmax:short 4], +// [15], +// [ +// Recul +1. +// (-1 de recul par 10 de sur-torque). +// Recharge 4A. +// @rl_arbreak 2 +// ], +// ), +// index: 2, +// ), +// mt.table-row( +// ( +// [Lourd], +// [Base], +// [8/+4], +// [@rl_rmax:short 4], +// [26], +// [ +// Recul +4. +// (-1 de recul par 10 de sur-torque). +// Recharge 5A. +// @rl_arbreak 3. +// ], +// ), +// index: 3, +// ), + +// // --------------------------------------------------------------------------- +// // Canon +// // --------------------------------------------------------------------------- + +// mt.table-rule(6), +// mt.table-row( +// ( +// [Canon Simple], +// [Canon], +// [0/+1], +// [@rl_rmax:short +1], +// [], +// [], +// ), +// index: 4, +// ), +// // --------------------------------------------------------------------------- +// // Canon Double +// // --------------------------------------------------------------------------- + +// // #table-cell( +// // colspan: 6, +// // align: left, +// // )[ +// // *Canon Double* — Chaque recharge apporte deux tirs. +// // Peut être utilisé simultanément, ajoutant +4 à la précision, +// // 3 au recul et surchauffe 2. Recharge +1A. +// // ] + +// // --------------------------------------------------------------------------- +// // Chargeur +// // --------------------------------------------------------------------------- + +// // #table-rule(colspan: 6) + +// // #table-cell( +// // colspan: 2, +// // )[Chargeur Rotatif] + +// // #table-cell( +// // colspan: 2, +// // )[Chargeur] + +// // [ +// // Chaque recharge apporte six tirs, armes standard ou compact. +// // Intégrité -1. Recharge +2A. +// // ] + +// // #table-cell( +// // colspan: 2, +// // )[Chargeur Long] + +// // #table-cell( +// // colspan: 2, +// // )[Chargeur] + +// // [ +// // Chaque recharge apporte quatre tirs, armes standard, compacte ou longue. +// // Recharge +1A. +// // ] + +// // [Chargeur Unique], +// // [Chargeur], +// // [+1], +// // [], +// // [Intégrité +2. @rl_arbreak +1.], + +// // --------------------------------------------------------------------------- +// // Alchimie +// // --------------------------------------------------------------------------- + +// // #table-rule(colspan: 6) + +// // #table-row( +// // ( +// // [Munition lacérante], +// // [Alchimie], +// // [-1/-0], +// // [], +// // [], +// // [ +// // Les dégâts de l'attaque deviennent Tranchant +// // (donne un bonus de #ddlvl(1, plus: true) aux altérations). +// // ], +// // ), +// // index: 0, +// // ) + +// // #table-row( +// // ( +// // [Munition incapacitante], +// // [Alchimie], +// // [-3/-0], +// // [], +// // [], +// // [ +// // Les dégâts de l'attaque deviennent Contondant +// // (donne un bonus de #ddlvl(1, plus: true) aux altérations). +// // ], +// // ), +// // index: 1, +// // ) + +// // #table-row( +// // ( +// // [Munition Alchimique], +// // [Alchimie], +// // [-6/-1], +// // [@rl_rmax:short -1], +// // [], +// // [ +// // L'arme inflige les effets d'une potion à l'impact +// // (donne un bonus de #ddlvl(1, plus: true) aux altérations). +// // ], +// // ), +// // index: 2, +// // ) +// ), +// ) +// #v(1fr) diff --git a/setup/mod_tables.typ b/setup/mod_tables.typ index 7a35da7..85bd1a8 100644 --- a/setup/mod_tables.typ +++ b/setup/mod_tables.typ @@ -1,3 +1,8 @@ +// ============================================================================= +// DEPRECATED +// ============================================================================= + + // ============================================================================= // TABLE SYSTEM // ============================================================================= diff --git a/setup/school_model.typ b/setup/school_model.typ index 4ac5e04..1ee4fe2 100644 --- a/setup/school_model.typ +++ b/setup/school_model.typ @@ -2,42 +2,7 @@ #import "variables.typ": theme, theme-var #import "mod_tables.typ" as mt #import "macros.typ" as macros -#let table-header-fill = theme.dark-gold -#let table-header-style = ( - size: 7.2pt, - weight: "bold", - fill: theme.parchment-light, -) -#let table-cell-style = ( - size: 10pt, - fill: theme.ink, -) - -// ----- Style a small uppercase section label ----- -#let fantasy-label(body) = { - text( - size: 7.5pt, - weight: "bold", - fill: theme.dark-gold, - tracking: 0.12em, - )[ #body ] -} - -// ----- Draw a subtle thematic divider ----- -#let fantasy-rule() = { - line( - length: 100%, - stroke: 0.65pt + theme.border, - ) -} - -// ----- Display a section label followed by its content ----- -#let fantasy-section(title, body) = { - fantasy-label(title) - v(0.3em) - body -} // ============================================================================= // ----- Technique TSV importer ----- @@ -184,7 +149,6 @@ // ------------------------------------------------------------------------- // Tier title // ------------------------------------------------------------------------- - ( mt.table-title( [ @@ -221,33 +185,30 @@ // Table header // ------------------------------------------------------------------------- - mt.table-header( - [Technique], - inset-x: 4pt, + table.header( + mt.table-header( + [Technique], + inset-x: 4pt, + ), + mt.table-header( + [Niv], + inset-x: 2pt, + align: center, + ), + mt.table-header( + [Type], + inset-x: 4pt, + ), + mt.table-header( + [Coût], + inset-x: 2pt, + align: center, + ), + mt.table-header( + [Effet], + inset-x: 4pt, + ), ), - - mt.table-header( - [Niv], - inset-x: 2pt, - align: center, - ), - - mt.table-header( - [Type], - inset-x: 4pt, - ), - - mt.table-header( - [Coût], - inset-x: 2pt, - align: center, - ), - - mt.table-header( - [Effet], - inset-x: 4pt, - ), - // ------------------------------------------------------------------------- // Technique rows // ------------------------------------------------------------------------- @@ -444,7 +405,7 @@ // ----- Class introduction ----- [ - #fantasy-section("PRÉSENTATION")[ + #mt.fantasy-section("PRÉSENTATION")[ #text( size: 10.2pt, )[ #class_info.description ] @@ -458,7 +419,7 @@ // ----- Class profile and mechanics ----- // --------------------------------------------------------------------------- - fantasy-rule() + mt.fantasy-rule() v(0.7em) @@ -475,7 +436,7 @@ inset: 0.65em, )[ #align(center)[ - #fantasy-section("PROFIL")[ + #mt.fantasy-section("PROFIL")[ #image( class_info.radar, width: 82%, @@ -502,7 +463,7 @@ size: 10pt, fill: theme.gold, )[#theme-var("section-symbol")] - ][ #fantasy-label("MÉCANIQUE EXCLUSIVE") ] + ][ #mt.fantasy-label("MÉCANIQUE EXCLUSIVE") ] #v(0.4em) @@ -530,7 +491,7 @@ columns: (1fr, auto), align: horizon, )[ - #fantasy-label("DIFFICULTÉ") + #mt.fantasy-label("DIFFICULTÉ") ][ #grid( // columns: repeat(5, 0.7em), diff --git a/setup/set_tables.typ b/setup/set_tables.typ new file mode 100644 index 0000000..6a301ab --- /dev/null +++ b/setup/set_tables.typ @@ -0,0 +1,224 @@ +// ============================================================================= +// INNATE TABLE STYLE +// ============================================================================= +// +// Applies the project's theme to ordinary Typst tables: +// +// #set-table-style() +// +// After that: +// +// #table( +// columns: (...), +// [Nom], [Gain], [Type], +// [Épée], [2], [Arme], +// ) +// +// automatically receives the thematic styling. +// +// An explicit theme can also be supplied: +// +// #set-table-style(theme: theme) +// #set-table-style(theme: other-theme) +// +// ============================================================================= + +#import "variables.typ": theme +#import "themes.typ": themes + +// ============================================================================= +// CONFIGURATION +// ============================================================================= + +#let innate-table-config = ( + // Geometry + column-gutter: 0pt, + row-gutter: 0pt, + + // Body + inset-x: 4pt, + inset-y: 4pt, + body-size: 10pt, + + // Header + header-inset-x: 4pt, + header-inset-y: 3pt, + header-size: 7.2pt, + header-weight: "bold", + + // Borders + border-width: 0.3pt, + + // Zebra striping + alternating: true, +) + +#let fantasy-config = ( + // Label + label-size: 7.5pt, + label-weight: "bold", + label-tracking: 0.12em, + + // Section + section-spacing: 0.3em, + + // Rule + rule-width: 0.65pt, +) + +// ============================================================================= +// THEME RESOLUTION +// ============================================================================= + +#let resolve-table-theme(table-theme) = if table-theme == none { + theme +} else { + if table-theme in themes { + themes.at(table-theme) + } else { + theme + } +} + +// COLOURS + +#let table-header-fill(table-theme: none) = { + let t = resolve-table-theme(table-theme) + t.dark-gold +} + +#let table-header-text(table-theme: none) = { + let t = resolve-table-theme(table-theme) + t.parchment-light +} + +#let table-body-text(table-theme: none) = { + let t = resolve-table-theme(table-theme) + t.ink +} +#let table-alternating-odd(table-theme: none) = { + let t = resolve-table-theme(table-theme) + t.parchment +} +#let table-alternating-even(table-theme: none) = { + let t = resolve-table-theme(table-theme) + t.parchment-light +} + +#let table-border(table-theme: none) = { + let t = resolve-table-theme(table-theme) + t.border +} + + +// ============================================================================= +// INNATE TABLE STYLE +// ============================================================================= + +#let set-table-style( + original-table, + table-theme: none, + alternating: none, + stroke: none, + label: none, + table-headers: (0,), +) = { + let t = resolve-table-theme(table-theme) + + let alternating = if alternating == none { + innate-table-config.alternating + } else { + alternating + } + + // --------------------------------------------------------------------------- + // TABLE GEOMETRY + // --------------------------------------------------------------------------- + + set table( + column-gutter: innate-table-config.column-gutter, + row-gutter: innate-table-config.row-gutter, + + inset: ( + x: innate-table-config.inset-x, + y: innate-table-config.inset-y, + ), + + // No outer grid. + stroke: stroke, + + // ------------------------------------------------------------------------- + // Cell fills + // ------------------------------------------------------------------------- + // + // Row 0 is treated as the header. + // + // Remaining rows alternate between parchment and parchment-light. + // + fill: (x, y) => { + if y in table-headers { + table-header-fill(table-theme: table-theme) + } else if not alternating { + table-alternating-odd(table-theme: table-theme) + } else if calc.even(y) { + table-alternating-even(table-theme: table-theme) + } else { + table-alternating-odd(table-theme: table-theme) + } + }, + ) + + // --------------------------------------------------------------------------- + // BODY TEXT + // --------------------------------------------------------------------------- + + show table.cell: set text( + size: innate-table-config.body-size, + fill: table-body-text(table-theme: table-theme), + ) + + // --------------------------------------------------------------------------- + // HEADER + // --------------------------------------------------------------------------- + + show table.cell: it => { + set text( + size: innate-table-config.header-size, + weight: innate-table-config.header-weight, + fill: table-header-text(table-theme: table-theme), + ) if it.y in table-headers + if it.y in table-headers and type(it) != link { + show link: set text( + fill: table-header-text(table-theme: table-theme), + ) + it + } else { + it + } + } + + // --------------------------------------------------------------------------- + // HEADER INSET + // --------------------------------------------------------------------------- + + show table.header: it => { + table.cell( + color: white, + inset: ( + x: innate-table-config.header-inset-x, + y: innate-table-config.header-inset-y, + ), + )[it] + } + + // --------------------------------------------------------------------------- + // BODY CELL BORDERS + // --------------------------------------------------------------------------- + + set table.cell( + stroke: ( + bottom: innate-table-config.border-width + t.border, + ), + ) + original-table +} diff --git a/setup/setup.typ b/setup/setup.typ index b72305a..69c9f6c 100644 --- a/setup/setup.typ +++ b/setup/setup.typ @@ -4,6 +4,8 @@ // ----- Imports ----- #import "model.typ" as model #import "macros.typ" as macros +#import "mod_tables.typ" as mt +#import "set_tables.typ" as st // ----- Re-expose shared project data ----- #let ravenous = ravenous @@ -14,6 +16,7 @@ #let gls-description = model.gls-description #let macros = macros #let ddlvl = macros.ddlvl +#let mt = mt // ----- Public template for class presentations ----- #let school_presentation = model.school_presentation