From 395c03621f9c5bba63404df6a26dddbc29eed5a6 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Thu, 30 Jul 2026 17:05:42 +0200 Subject: [PATCH] Better thresholds --- Cargo.toml | 2 +- crates/make/src/makepdf.rs | 2 +- crates/monsters/src/monster_export.rs | 2 +- crates/monsters/src/monster_structs.rs | 73 +------------------------- helper_config.toml | 2 +- ravenous_databases | 2 +- 6 files changed, 7 insertions(+), 76 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 81e5c28..57f9fd1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ resolver = "3" # edition = "2024" # license = "MIT OR Apache-2.0" [workspace.package] -version = "0.3.29" +version = "0.3.30" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/make/src/makepdf.rs b/crates/make/src/makepdf.rs index af25c72..7b20069 100644 --- a/crates/make/src/makepdf.rs +++ b/crates/make/src/makepdf.rs @@ -62,7 +62,7 @@ pub fn make_pdf(args: &MakeConfig, _config: &Config) -> Result<()> { Some(MakeTargets::Clean) => make_clean(args), None => { let file = make_file(args); - launch_subprocess(args, file).unwrap(); + launch_subprocess(args, file).context("Launching PdfLatex")?; } } Ok(()) diff --git a/crates/monsters/src/monster_export.rs b/crates/monsters/src/monster_export.rs index 1be5960..0f0e527 100644 --- a/crates/monsters/src/monster_export.rs +++ b/crates/monsters/src/monster_export.rs @@ -29,7 +29,7 @@ macro_rules! template_load { } handlebars_helper!(plus: |x:i64 ,y:Option| x+y.unwrap_or(0)); -handlebars_helper!(threshold_bonus: |x:i64| format!("{:+}",x-8)); +handlebars_helper!(threshold_bonus: |threshold:i64, size:i64| format!("{:+}{:+}",threshold-6-size,size)); fn load_templates(config: &Config) -> Result> { let mut templates = Handlebars::new(); diff --git a/crates/monsters/src/monster_structs.rs b/crates/monsters/src/monster_structs.rs index 0d60aba..ecde404 100644 --- a/crates/monsters/src/monster_structs.rs +++ b/crates/monsters/src/monster_structs.rs @@ -295,77 +295,6 @@ pub struct GroupedResists { inner: IndexMap>>, } -// / Counts how many items in `list` have a **Some** value for the given `field`. -// / -// / # Example -// / ``` -// / let pierced = count_present!(part_list, piercing); -// / ``` -// macro_rules! count_present { -// ($list:expr, $field:ident) => { -// // We keep everything inside its own block so that it behaves like a single expression. -// let $field = $list -// .body_parts -// .iter() -// .filter(|v| v.$field.is_some()) -// .count(); -// }; -// } -// impl GroupedResists { -// pub fn from_list_body_parts(part_list: CreatureListBodyParts) -> Self { -// let mut inner: IndexMap>> = IndexMap::new(); -// count_present!(part_list, slash); -// count_present!(part_list, blunt); -// count_present!(part_list, piercing); -// count_present!(part_list, celestial); -// count_present!(part_list, fire); -// count_present!(part_list, magma); -// count_present!(part_list, earth); -// count_present!(part_list, wood); -// count_present!(part_list, abyssal); -// count_present!(part_list, wind); -// count_present!(part_list, water); -// count_present!(part_list, ice); -// count_present!(part_list, thunder); -// if slash > 0 { -// for part in part_list.body_parts { -// let key = &part.body_part_name; -// if let Some(values) = inner.get_mut(key) { -// let value = part_list.get(key).to_owned(); -// values.push(value); -// } -// println!("{}", part.body_part_name); -// println!("{}", slash); -// } -// } -// // for elt in &[ -// // "slash", -// // "blunt", -// // "piercing", -// // "celestial", -// // "fire", -// // "magma", -// // "earth", -// // "wood", -// // "abyssal", -// // "wind", -// // "water", -// // "ice", -// // "thunder", -// // ] {} -// // if slash > 0 { // inner.insert( -// // "slash".to_string(), -// // part_list -// // .body_parts -// // .iter() -// // .map(|v| v.slash.clone()) -// // .collect(), -// // ); -// // } -// Self { inner } -// } -// } - #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, FieldsAsSlice)] /// All creature stats used in combat calculations. pub struct CreatureStats { @@ -400,6 +329,8 @@ pub struct CreatureStats { #[INTEGER] pub resistance_transcendentale: i64, #[INTEGER] + pub size_bonus_to_hit: i64, + #[INTEGER] pub mvt_walk: i64, #[INTEGER] pub mvt_trot: i64, diff --git a/helper_config.toml b/helper_config.toml index 2d348b5..3223e42 100644 --- a/helper_config.toml +++ b/helper_config.toml @@ -211,7 +211,7 @@ master_part = ''' \hline {{#with stats as |s|}} {{#each ../body_parts.body_parts}} -\SetCell{font=\footnotesize} {{{body_part_name}}} & ${{{threshold_p1}}} ${\tiny ({{{threshold_bonus threshold_p1~}}}) } & ${{{plus s.strength protection_p1}}}[{{{protection_p1}}}]$ & \SetCell{r,f}\tiny ${{{integrity_p1}}} $ & \SetCell{r,f}\tiny ${{{life_points_p1}}} $ & ${{{threshold_p2}}} ${\tiny ({{{threshold_bonus threshold_p1~}}}) } & ${{{plus s.strength protection_p1}}}[{{{protection_p1}}}]$ & \SetCell{r,f}\tiny ${{{integrity_p2}}} $ & \SetCell{r,f}\tiny ${{{life_points_p2}}} $\\ +\SetCell{font=\footnotesize} {{{body_part_name}}} & ${{{threshold_p1}}} ${\tiny ({{{threshold_bonus threshold_p1 ../../stats/size_bonus_to_hit~}}}) } & ${{{plus s.strength protection_p1}}}[{{{protection_p1}}}]$ & \SetCell{r,f}\tiny ${{{integrity_p1}}} $ & \SetCell{r,f}\tiny ${{{life_points_p1}}} $ & ${{{threshold_p2}}} ${\tiny ({{{threshold_bonus threshold_p1 ../../stats/size_bonus_to_hit~}}}) } & ${{{plus s.strength protection_p1}}}[{{{protection_p1}}}]$ & \SetCell{r,f}\tiny ${{{integrity_p2}}} $ & \SetCell{r,f}\tiny ${{{life_points_p2}}} $\\ {{/each}} {{/with}} {{#if data.annotations_master}} diff --git a/ravenous_databases b/ravenous_databases index 0d07e36..61b5983 160000 --- a/ravenous_databases +++ b/ravenous_databases @@ -1 +1 @@ -Subproject commit 0d07e369f808e7eca4585b3ae9ce498269cf4f9b +Subproject commit 61b59832a66e73cc0fd1dc8bb881b18d33a34c7e -- 2.45.1