diff --git a/crates/make/src/makepdf_structs.rs b/crates/make/src/makepdf_structs.rs index 0ed16f2..f11bc83 100644 --- a/crates/make/src/makepdf_structs.rs +++ b/crates/make/src/makepdf_structs.rs @@ -242,11 +242,11 @@ pub(super) enum LineType { NoGlossaryFile(String), #[regex( - r" ?\)? VerboseLevel::Critical, LineType::PackageWarningPrs(_) => VerboseLevel::Critical, LineType::NoGlossary => VerboseLevel::Warning, - LineType::Fontawesome => VerboseLevel::Info, + LineType::FontAwesome => VerboseLevel::Info, LineType::NoGlossaryFile(_) => VerboseLevel::Warning, } } diff --git a/crates/monsters/src/monster_export.rs b/crates/monsters/src/monster_export.rs index d6d6697..cc1ae60 100644 --- a/crates/monsters/src/monster_export.rs +++ b/crates/monsters/src/monster_export.rs @@ -193,13 +193,12 @@ impl MonsterAllAttacks { // Ungroup them to have nice bundles for (group, atk) in grouped_attacks { if group.is_some() { + let monster_first_atk = atk.first().unwrap(); let group_attack = MonsterFullAttack { attacklist: atk.iter().map(|&v| v.clone()).collect(), // color: atk.first().unwrap().attack_type.clone(), - size: atk.len() + 1, - description_final: atk - .first() - .unwrap() + size: atk.len() + number_of_description(monster_first_atk), + description_final: monster_first_atk .description_all .clone() .unwrap_or_default(), @@ -214,7 +213,7 @@ impl MonsterAllAttacks { .unwrap() .push(MonsterFullAttack { attacklist: vec![single_atk.clone()], - size: 2, + size: 1 + number_of_description(&single_atk), description_final: single_atk .description_all .clone() @@ -227,6 +226,15 @@ impl MonsterAllAttacks { Self { phases } } } + +/// The number of description fields +fn number_of_description(monster_first_atk: &&MonsterSingleAttack) -> usize { + if monster_first_atk.description_all.is_some() { + 1 + } else { + 0 + } +} #[derive(Serialize)] struct Coloring<'a> { color: &'a str, diff --git a/crates/monsters/src/monster_structs.rs b/crates/monsters/src/monster_structs.rs index 742a4ee..740386d 100644 --- a/crates/monsters/src/monster_structs.rs +++ b/crates/monsters/src/monster_structs.rs @@ -62,40 +62,40 @@ pub struct CreatureData { pub danger_level: i64, /// Type of habitat #[TEXT] - pub habitat: String, + pub habitat: Option, /// Wether a dismorphism exists #[TEXT] - pub dysmorphism: String, + pub dysmorphism: Option, /// Monster size #[TEXT] pub size: Option, /// Generic color describing the creature #[TEXT] - pub colors: String, + pub colors: Option, /// Default reaction to human presence #[TEXT] - pub default_human_reaction: String, + pub default_human_reaction: Option, /// Known variants #[TEXT] - pub variants: String, + pub variants: Option, /// General habits #[TEXT] - pub habits: String, + pub habits: Option, /// Generic creature description #[TEXT] - pub description: String, + pub description: Option, /// Annotations #[TEXT] - pub annotations: String, + pub annotations: Option, /// Annotations GM #[TEXT] pub annotations_master: Option, /// The battle plan of the creature #[TEXT] - pub battle_plan: String, + pub battle_plan: Option, /// The graph of intents (image) #[TEXT] - pub intent_graph: String, + pub intent_graph: Option, /// Wether to show it to players #[INTEGER] pub show_to_master: Option, diff --git a/helper_config.toml b/helper_config.toml index b7d6259..27fc509 100644 --- a/helper_config.toml +++ b/helper_config.toml @@ -154,20 +154,20 @@ intro = '''\begin{tblr}{ cell{1}{1}={c=2}{c}, } -\includegraphics[height=5cm]{ {{{image}}} } & \\ +{{#if image}}\includegraphics[height=5cm]{ {{{image}}} } & \\{{/if}} & \\ Nom & {{{name}}} \\ -Dénomination & {{{denomination}}} \\ -Calamité & {{{calamity}}} \\ -Niveau de danger (HSE) & {{{danger_level}}} \\ +{{#if denomination}}Dénomination & {{{denomination}}} \\ {{/if}} +{{#if calamity}}Calamité & {{{calamity}}} \\ {{/if}} +{{#if danger_level}}Niveau de danger (HSE) & {{{danger_level}}} \\ {{/if}} & \\ -Habitat & \SetCell{font=\footnotesize} {{{habitat}}} \\ -Dysmorphisme & \SetCell{font=\footnotesize} {{{dysmorphism}}} \\ -Couleurs & \SetCell{font=\footnotesize} {{{colors}}} \\ -Réaction à l'homme & \SetCell{font=\footnotesize} {{{default_human_reaction}}} \\ -Variantes & \SetCell{font=\footnotesize} {{{variants}}}\\ -Taille & \SetCell{font=\footnotesize} {{{size}}}\\ -Mœurs & \SetCell{font=\footnotesize} {{{habits}}} \\ +{{#if habitat}}Habitat & \SetCell{font=\footnotesize} {{{habitat}}} \\ {{/if}} +{{#if dysmorphism}}Dysmorphisme & \SetCell{font=\footnotesize} {{{dysmorphism}}} \\ {{/if}} +{{#if colors}}Couleurs & \SetCell{font=\footnotesize} {{{colors}}} \\ {{/if}} +{{#if default_human_reaction}}Réaction à l'homme & \SetCell{font=\footnotesize} {{{default_human_reaction}}} \\ {{/if}} +{{#if variants}}Variantes & \SetCell{font=\footnotesize} {{{variants}}}\\ {{/if}} +{{#if size}}Taille & \SetCell{font=\footnotesize} {{{size}}}\\ {{/if}} +{{#if habits}}Mœurs & \SetCell{font=\footnotesize} {{{habits}}} \\ {{/if}} \end{tblr} \vfill \begin{tblr}{ @@ -175,10 +175,10 @@ Mœurs & \SetCell{font=\footnotesize} {{{habits}}} \\ hline{2,4,6}, row{2,4,6}={font=\footnotesize} } -\textbf{Description} \\ -{{{description}}} \\ -\textbf{Annotations} \\ -{{{annotations}}} \\ +{{#if description}}\textbf{Description} \\ +{{{description}}} \\ {{/if}} +{{#if annotations}}\textbf{Annotations} \\ +{{{annotations}}} \\ {{/if}} \textbf{Récompenses} \\ \end{tblr} \begin{tblr}{ @@ -217,8 +217,9 @@ body_parts_intro=''' body_parts_row=''' \SetCell{font=\footnotesize} {{{body_part_name }}} & ${{{threshold_p1 }}} $ & ${{{protection_p1}}} {{{protection_total_p1 }}} $ & \SetCell{r,f}\tiny ${{{integrity_p1}}} $ & \SetCell{r,f}\tiny ${{{life_points_p1}}} $ & ${{{threshold_p2}}} $ & ${{{protection_p2}}} {{{protection_total_p2}}} $ & \SetCell{r,f}\tiny ${{{integrity_p2}}} $ & \SetCell{r,f}\tiny ${{{life_points_p2}}} $\\ ''' -body_parts_end= ''' \hline -\SetCell[c=9]{j,h} {\textbf{Notes} \\ {{{annotations_master}}}}\\ +body_parts_end= ''' +{{#if annotations_master}} \hline +\SetCell[c=9]{j,h} {\textbf{Notes} \\ {{{annotations_master}}}}\\ {{/if}} \hline \end{tblr}''' resists_intro=''' \begin{center} @@ -227,7 +228,6 @@ resists_intro=''' \begin{center} rowspec={Q[c,f] Q[c,m] Q[c] Q[c] Q[c] Q[c] Q[c] Q[c] Q[c] Q[c] Q[c]}, row{3-11}={font=\tiny}, } -% & & & & & & & \small{*} & & & & \small{*} & \small{*} & \\ & & & & & & & & & & & & & \\ \SetCell{c} Res & \slash & \pierce & \blunt & \symceleste & \symfire & \symearth & \symwood & \symmagma & \symabyss & \symwater & \symwind & \symice & \symthunder \\ \hline @@ -274,12 +274,17 @@ phase_row= ''' \SetCell[c=13]{white} {{{phase_name}}} & & & & & & & & & & \\ ''' -attack_before_repeat=' \hline' -attack_color='\SetCell[r={{{size}}}]{bg={{{color}}}}' # Very ugly hack, going to bed -# attack_repeatable_row= ''' & {{{name}}} & {{{short_name}}} & {{{prerequisites}}} & {{{atk_type}}} & {{{targetting}}} & {{{cost_fatigue}}} & {{{cost_action}}} & {{{element}}} & {{{damage_fatigue}}} &{{{damage_regular}}} & {{{effects}}} & {{{threshold_parry}}} & {{{threshold_dodge}}} \\ -attack_repeatable_row= ''' & {{{name}}} & {{{attack_type}}} & {{{prerequisites}}} & {{{targetting}}} & {{{cost_fatigue}}} & {{{cost_action}}} & {{{element}}} & {{{damage_fatigue}}} &{{{damage_regular}}} {{{success}}}& {{{effects}}} & {{{threshold_parry}}} & {{{threshold_dodge}}} \\ +attack_before_repeat=''' \hline ''' -attack_info_row='''& \SetCell[c=12]{j} {{{description_final}}} & & & & & & & & & & \\ +attack_color=''' +\SetCell[r={{{size}}}]{bg={{{color}}}}''' # Very ugly hack, going to bed +# attack_repeatable_row= ''' & {{{name}}} & {{{short_name}}} & {{{prerequisites}}} & {{{atk_type}}} & {{{targetting}}} & {{{cost_fatigue}}} & {{{cost_action}}} & {{{element}}} & {{{damage_fatigue}}} &{{{damage_regular}}} & {{{effects}}} & {{{threshold_parry}}} & {{{threshold_dodge}}} \\ +attack_repeatable_row= ''' + & {{{name}}} & {{{attack_type}}} & {{{prerequisites}}} & {{{targetting}}} & {{{cost_fatigue}}} & {{{cost_action}}} & {{{element}}} & {{{damage_fatigue}}} &{{{damage_regular}}} {{{success}}}& {{{effects}}} & {{{threshold_parry}}} & {{{threshold_dodge}}} \\ +''' +# attack_info_row='''& \SetCell[c=12]{j} {{{description_final}}} & & & & & & & & & & \\ +attack_info_row=''' +{{#if description_final}}& \SetCell[c=12]{j} {{{description_final}}} & & & & & & & & & & \\ {{/if}} \hline ''' attacks_end= ''' \end{tblr} @@ -290,14 +295,13 @@ attacks_end= ''' \end{tblr} intent_table=''' \pagebreak \begin{tblr}{ - colspec={X[7] X[3]}, + colspec={X[7] {{#if intent_graph}}|X[3] {{/if}} }, rowspec={X[c] X[j,h,8cm]}, - vline{2}, hline{2}, row{2}={font=\footnotesize}, } -Plan de combat & Graphique d'intentions \\ -{{{battle_plan}}} & {{{intent_graph}}} \\ +Plan de combat {{#if intent_graph}}& Graphique d'intentions \\ {{/if}} +{{{battle_plan}}} {{#if intent_graph}}& {{{intent_graph}}} \\ {{/if}} \end{tblr} \vfill \pagebreak