Better thresholds #173

Merged
Dandaedre merged 1 commits from database_monsters into main 2026-07-30 17:06:10 +02:00
6 changed files with 7 additions and 76 deletions

View File

@ -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

View File

@ -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(())

View File

@ -29,7 +29,7 @@ macro_rules! template_load {
}
handlebars_helper!(plus: |x:i64 ,y:Option<i64>| 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<Handlebars<'_>> {
let mut templates = Handlebars::new();

View File

@ -295,77 +295,6 @@ pub struct GroupedResists {
inner: IndexMap<String, Vec<Option<String>>>,
}
// / 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<String, Vec<Option<String>>> = 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,

View File

@ -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}}

@ -1 +1 @@
Subproject commit 0d07e369f808e7eca4585b3ae9ce498269cf4f9b
Subproject commit 61b59832a66e73cc0fd1dc8bb881b18d33a34c7e