Added some (too basic) logic on print #104
|
|
@ -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<Vec<FullMonster>, anyhow::Error> {
|
||||
let list_creatures =
|
||||
generic_deserialize::<CreatureData>(&connection, "creature", None, Some("id"))?;
|
||||
let list_creatures = generic_deserialize::<CreatureData>(
|
||||
&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<Vec<FullMonster>,
|
|||
connection,
|
||||
creature,
|
||||
"creature_abilities",
|
||||
Some("phase, attack_group")
|
||||
Some("phase, attack_group, ordering")
|
||||
);
|
||||
let creature_resistances = fetch_from!(
|
||||
CreatureBodyPart,
|
||||
|
|
|
|||
|
|
@ -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)?)?;
|
||||
|
|
|
|||
|
|
@ -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<i64>,
|
||||
/// Wether to show it to masters
|
||||
#[INTEGER]
|
||||
pub show_to_players: Option<i64>,
|
||||
}
|
||||
|
||||
/// 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<String>,
|
||||
/// How the ability targets opponents (e.g. “single”, “area” …).
|
||||
#[TEXT]
|
||||
pub targetting: Option<String>,
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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=''
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 440b8dad8361811e14419ac19a90bc7b003ba3e0
|
||||
Subproject commit 8928f53a3d02d9fe618ee03166e417a408f1fc52
|
||||
Loading…
Reference in New Issue