From 27debbf153ffab83c0d1c9f131da1ad5401634fb Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sat, 18 Jul 2026 01:03:49 +0200 Subject: [PATCH] Added some (too basic) logic on print --- crates/monsters/src/monster_database.rs | 12 +++++-- crates/monsters/src/monster_export.rs | 8 +++-- crates/monsters/src/monster_structs.rs | 9 ++++++ .../equipement_advanced_repr.rs | 2 +- helper_config.toml | 32 +++++++++++-------- ravenous_databases | 2 +- 6 files changed, 43 insertions(+), 22 deletions(-) diff --git a/crates/monsters/src/monster_database.rs b/crates/monsters/src/monster_database.rs index 88e3bda..dd5787a 100644 --- a/crates/monsters/src/monster_database.rs +++ b/crates/monsters/src/monster_database.rs @@ -23,9 +23,15 @@ macro_rules! fetch_from { }}; } +/// Fetch all data from the database +// TODO: WARN the master filter is hardcoded here pub(crate) fn fetch_all_data(connection: Connection) -> Result, anyhow::Error> { - let list_creatures = - generic_deserialize::(&connection, "creature", None, Some("id"))?; + let list_creatures = generic_deserialize::( + &connection, + "creature", + Some("show_to_master=1"), + Some("id"), + )?; let mut finished_creatures = Vec::new(); for creature in list_creatures.iter() { // println!("Working on {}@{}", creature.id, creature.name); @@ -34,7 +40,7 @@ pub(crate) fn fetch_all_data(connection: Connection) -> Result, connection, creature, "creature_abilities", - Some("phase, attack_group") + Some("phase, attack_group, ordering") ); let creature_resistances = fetch_from!( CreatureBodyPart, diff --git a/crates/monsters/src/monster_export.rs b/crates/monsters/src/monster_export.rs index 29efbc7..c69cabb 100644 --- a/crates/monsters/src/monster_export.rs +++ b/crates/monsters/src/monster_export.rs @@ -71,7 +71,9 @@ pub fn generate_monsters_tex( let mut master_out = String::new(); for creature in &all_monsters { - println!(" > {}", creature.name); + // if !creature.data.show_to_master.is_none_or(|v| v == 0) { + // println!(" > {}", creature.name); + // }; write!(player_out, "{}", templates.render("intro", &creature.data)?)?; write!(master_out, "{}", templates.render("intro", &creature.data)?)?; write!( @@ -178,7 +180,7 @@ impl MonsterAllAttacks { if group.is_some() { let group_attack = MonsterFullAttack { attacklist: atk.iter().map(|&v| v.clone()).collect(), - // color: atk.first().unwrap().short_name.clone(), + // color: atk.first().unwrap().attack_type.clone(), size: atk.len() + 1, description: atk.first().unwrap().effects.clone(), }; @@ -228,7 +230,7 @@ impl MonsterAllAttacks { .monster .color_table .inner - .get(&attack.attacklist[0].short_name) + .get(&attack.attacklist[0].attack_type) .unwrap_or(&config.monster.default_color), }; write!(out, "{}", templates.render("attack_color", &color)?)?; diff --git a/crates/monsters/src/monster_structs.rs b/crates/monsters/src/monster_structs.rs index b8212f8..e4c4068 100644 --- a/crates/monsters/src/monster_structs.rs +++ b/crates/monsters/src/monster_structs.rs @@ -93,6 +93,12 @@ pub struct CreatureData { /// The graph of intents (image) #[TEXT] pub intent_graph: String, + /// Wether to show it to players + #[INTEGER] + pub show_to_master: Option, + /// Wether to show it to masters + #[INTEGER] + pub show_to_players: Option, } /// A helper wrapper around all rewards @@ -157,6 +163,9 @@ pub struct MonsterSingleAttack { /// Ability “type” as a trigram #[TEXT] pub attack_type: String, + /// Prerequisite necessesary for the attack to resolve. + #[INTEGER] + pub prerequisites: Option, /// How the ability targets opponents (e.g. “single”, “area” …). #[TEXT] pub targetting: Option, diff --git a/crates/weaponry/src/weaponry_structs/equipement_advanced_repr.rs b/crates/weaponry/src/weaponry_structs/equipement_advanced_repr.rs index 131de13..ba185c3 100644 --- a/crates/weaponry/src/weaponry_structs/equipement_advanced_repr.rs +++ b/crates/weaponry/src/weaponry_structs/equipement_advanced_repr.rs @@ -82,7 +82,7 @@ impl ToAnalysis for RefinedEquipementList { // DONE: While a custom config would allow some personalisation, there is no reason to beleive a more meaningfull name would be choosen fn write_html(&self, save_path: &str) -> Result<(), FatalEquipementError> { - let mut renderer = charming::HtmlRenderer::new("Ravenous Bob", 4000, 2000) + let mut renderer = charming::HtmlRenderer::new("Ravenous Bob", 1920, 900) .theme(charming::theme::Theme::Dark); let initial_chart = self.make_regular_graph(); diff --git a/helper_config.toml b/helper_config.toml index 6113ed8..4fe4f44 100644 --- a/helper_config.toml +++ b/helper_config.toml @@ -256,14 +256,14 @@ init_end= ''' attacks_intro= ''' {\scriptsize \begin{tblr}{ - colspec={X[0.05] X[4,l] X[1,c] X[1,c] X[0.3,c] X[0.3,c] X[0.3,c] X[0.3,c] X[0.3,c] X[2,r] X[2,c] X[0.3,c] X[0.3,c]}, + colspec={X[0.05] X[3,l] X[1,c] X[1,c] X[0.3,c] X[0.3,c] X[0.3,c] X[0.3,c] X[0.3,c] X[2,r] X[4,c] X[0.3,c] X[0.3,c]}, hspan=minimal, colsep=2pt, row{2}={font=\tiny}, } & & & & & \SetCell[c=2]{c} Coûts & & & \SetCell[c=2]{c} Dégâts & & & \SetCell[c=2]{c} Seuils & \\ \cline{6-7} \cline{9-10} \cline{12-13} -& \SetCell{c} & {ID} & {Type} & \rb{Ciblage} & \rb{Fatigue} & \rb{Action} & \rb{Élément} & \rb{Fatigue} & \SetCell{c} \rb{Normaux} & {Effets} & \rb{Parade} & \rb{Esquive} \\ +& \SetCell{c} & {Type} & {Préquis} & \rb{Ciblage} & \rb{Fatigue} & \rb{Action} & \rb{Élément} & \rb{Fatigue} & \SetCell{c} \rb{Normaux} & {Effets} & \rb{Parade} & \rb{Esquive} \\ \SetHline{1-13}{solid} ''' phase_row= ''' @@ -273,7 +273,8 @@ phase_row= ''' attack_before_repeat=' \hline' attack_color='\SetCell[r={{size}}]{bg={{color}}}' # Very ugly hack, going to bed -attack_repeatable_row= ''' & {{name}} & {{short_name}} & {{atk_type}} & {{targetting}} & {{cost_fatigue}} & {{cost_action}} & {{element}} & {{damage_fatigue}} &{{damage_regular}} & {{effects}} & {{threshold_parry}} & {{threshold_dodge}} \\ +# 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}} & {{atk_type}} & {{prerequisites}} & {{targetting}} & {{cost_fatigue}} & {{cost_action}} & {{element}} & {{damage_fatigue}} &{{damage_regular}} & {{effects}} & {{threshold_parry}} & {{threshold_dodge}} \\ ''' attack_info_row='''& \SetCell[c=12]{j} {{description}} & & & & & & & & & & \\ \hline @@ -299,27 +300,30 @@ Plan de combat & Graphique d'intentions \\ \pagebreak ''' color_table=''' -THB: ravred ATK: ravred MVT: ravblu -DEF: ravgre -REV: ravyel +DEF: ravgrn +PAS: ravgrnL +REV: ravgrn +CLM: ravgrnD TRA: ravora +ASE: ravred STA: ravwhi CMB: ravred -ASE: ravred -TBU: ravred -TBZ: ravred +FLR: ravred +GRB: ravred +TBU: ravredD +TSH: ravredD +TBZ: ravredD CLV: ravred AOE: ravred WID: ravred -WIP: ravred +WIP: ravredD SZO: ravwhi SIT: ravwhi -HRG: ravpur SRG: ravpur -CLM: ravyel -GRB: ravred -TSH: ravred +HRG: ravpur +BAD: ravora +BIS: ravredD ''' default_color='' diff --git a/ravenous_databases b/ravenous_databases index 440b8da..8928f53 160000 --- a/ravenous_databases +++ b/ravenous_databases @@ -1 +1 @@ -Subproject commit 440b8dad8361811e14419ac19a90bc7b003ba3e0 +Subproject commit 8928f53a3d02d9fe618ee03166e417a408f1fc52 -- 2.45.1