First draft #24

Merged
Dandaedre merged 1 commits from weapons into main 2025-02-09 22:30:46 +01:00
14 changed files with 121 additions and 15 deletions

View File

@ -1,5 +1,7 @@
//! The usual cli parser shenenigans
//!
#![warn(missing_docs, clippy::missing_docs_in_private_items)]
use clap::{Args, Parser, Subcommand};
use config::{
graph::GraphConfig,
@ -43,6 +45,7 @@ pub enum Commands {
}
#[derive(Debug, Args)]
/// Genrate the config file with the specified arguments
pub struct ConfigArgs {
/// Wether to write the config to file, or just show it
#[arg(short, long, default_value_t = false)]

View File

@ -1,12 +1,13 @@
// Workspace: config
// File: config/src/graph.rs
// Graphconfig
//! The inner config for graph module
//!
use clap::Args;
use phf::phf_map;
use std::sync::LazyLock;
#[derive(Args, Debug, Clone)]
/// The configuration struct for the PdfMaker
/// The configuration struct for the Graph
pub struct GraphConfig {
/// Special target
#[arg(help = format!("The target to execute [{}]", *HELP_STR_TO_GRAPH))]

View File

@ -4,6 +4,8 @@
//!
//! Also write configs to disk
#![warn(missing_docs, clippy::missing_docs_in_private_items)]
// Internal Modules
pub mod graph;
pub mod make;

View File

@ -1,6 +1,6 @@
// Workspace: config
// File: config/src/make.rs
// Makepdf generation structs
//! Makepdf generation structs
use phf::phf_map;
use std::{collections::HashMap, fmt::Debug, sync::LazyLock};

View File

@ -2,6 +2,7 @@
//!
//!
#![warn(missing_docs, clippy::missing_docs_in_private_items)]
// Internal modules
mod graphs;
//

View File

@ -18,6 +18,8 @@
//! across different parts of the build process. It includes items such as enums, structs, and traits
//! that help in organizing and managing the various components involved in creating a PDF from LaTeX files.
//!
#![warn(missing_docs, clippy::missing_docs_in_private_items)]
// Internal modules
mod makepdf;
mod makepdf_functions;

View File

@ -10,6 +10,7 @@
//! - `stat_structs`: Defines data structures used for managing statistical weights and matrix operations.
//! - `stat_io`: Handles input/output operations, such as loading stat records from configuration files.
#![warn(missing_docs, clippy::missing_docs_in_private_items)]
// Internal modules
mod stat_algo;
mod stat_io;

View File

@ -18,6 +18,8 @@
//! The following functions are re-exported from the module `tablegen`:
//!
//! - [`table_gen`]: Handling the whole conversion and auto dispatch.
#![warn(missing_docs, clippy::missing_docs_in_private_items)]
mod table_structs;
mod table_types;
mod tablegen;

4
weaponry/src/database.rs Normal file
View File

@ -0,0 +1,4 @@
// Workspace: weaponry
// File: weaponry/src/database.rs
//! Database handiling module
//! Implements the basics deserialisation from a database to the weaponry components

3
weaponry/src/export.rs Normal file
View File

@ -0,0 +1,3 @@
// Workspace: weaponry
// File: weaponry/src/export.rs
//! Export module in charge of transforming data structure into their tex counterpart through the appropriate traits

View File

@ -0,0 +1,12 @@
// Workspace: weaponry
// File: weaponry/src/interfaces.rs
//! Interface module holding all necesary traits
//! A good amount of effort is made to keep the code polymorphic enough to allow
//! handling of the whole crafting process when the times comes
#![allow(dead_code)]
/// This element can be converted to tex
pub trait ToTex {}
/// Specify this element can be made from parts (Unsure, maybe a way to ensure Add is presend ?)
pub trait FromParts {}

View File

@ -1,14 +1,11 @@
pub fn add(left: u64, right: u64) -> u64 {
left + right
}
// Workspace: weaponry
// File: weaponry/src/lib.rs
//! Weaponry module, handling all weaponry creation and analysis
#[cfg(test)]
mod tests {
use super::*;
#![warn(missing_docs, clippy::missing_docs_in_private_items)]
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
mod database;
mod export;
mod interfaces;
mod strategy;
mod weaponry_structs;

6
weaponry/src/strategy.rs Normal file
View File

@ -0,0 +1,6 @@
// Workspace: weaponry
// File: weaponry/src/strategy.rs
//! All different algorythms and strategies to create a weapon
//!
//! These strategies can lock a parameter to allow a more fine tuned balancing
//! or balancing specifically one parameter (balancing materials, balencing finishes etc..)

View File

@ -0,0 +1,72 @@
// Workspace: weaponry
// File: weaponry/src/weaponry_structs.rs
//! All weaponry intermod structures
#![allow(dead_code)]
/// The inner statistics of the equipement, used across all parts and final weapon
#[derive(Default)]
pub struct InnerStats {}
/// The final equipement, obtained by combining all parts
pub struct Equipement {
/// The inner stats used by the equipement
stats: InnerStats,
}
/// Shape of the equipement, first mandatory part of an equipement
pub struct EqShape {
/// The inner stats of the part
stats: InnerStats,
}
/// Material used for the equipement, all equipements are crafted with 1-2 materials
pub struct EqMaterial {
/// The inner stats of the part
stats: InnerStats,
}
/// Nature of the equipement, some natures are reserved and some can be chained
///
/// Deciding on the combinaison can be tricky an will need an extra field
pub struct EqNature {
/// The inner stats of the part
stats: InnerStats,
/// Which kind of target this nature applies to
target: NatureTarget,
}
/// Finishing touches, since all of them have a cost, they are treated in a special fashion
pub struct EqFinishing {
/// The inner stats of the part
stats: InnerStats,
}
/// The kind of target this nature can apply to
pub enum NatureTarget {
/// Can apply to a weapon and is unique
WeaponUnique,
/// Can apply to a weapon and must be combined with another
WeaponCombined,
/// Can apply to an armor (all armor nature are unique)
Armor,
}
/// Weapon damage types
#[allow(clippy::missing_docs_in_private_items)]
pub enum SingleDamageType {
Blunt,
Slash,
Pierce,
}
/// Weapon damage, signifying wether the damage is pure or [secondary] or [[tertiary]]
#[allow(clippy::missing_docs_in_private_items)]
pub enum DamageMod {
Primary(SingleDamageType),
Secondary(SingleDamageType),
Tertiary(SingleDamageType),
}
/// Damage values, meant to be serialised to tex and deserialized directly from the table
pub struct DamageType(Vec<DamageMod>);