weapons #52
|
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="122" height="18" role="img" aria-label="test-coverage: 19%"><title>test-coverage: 19%</title><linearGradient id="bms-c9b3e75d692af7ab" x2="0" y2="100%"><stop offset="0" stop-color="#fff" stop-opacity=".7"/><stop offset=".1" stop-color="#aaa" stop-opacity=".1"/><stop offset=".9" stop-color="#000" stop-opacity=".3"/><stop offset="1" stop-color="#000" stop-opacity=".5"/></linearGradient><clipPath id="bmr-c9b3e75d692af7ab"><rect width="122" height="18" rx="4" fill="#fff"/></clipPath><g clip-path="url(#bmr-c9b3e75d692af7ab)"><rect width="87" height="18" fill="#555"/><rect x="87" width="35" height="18" fill="#e05d44"/><rect width="122" height="18" fill="url(#bms-c9b3e75d692af7ab)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="445" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="770">test-coverage</text><text x="445" y="130" transform="scale(.1)" fill="#fff" textLength="770">test-coverage</text><text aria-hidden="true" x="1035" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="250">19%</text><text x="1035" y="130" transform="scale(.1)" fill="#fff" textLength="250">19%</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="122" height="18" role="img" aria-label="test-coverage: 17%"><title>test-coverage: 17%</title><linearGradient id="bms-986ff3b3470c1920" x2="0" y2="100%"><stop offset="0" stop-color="#fff" stop-opacity=".7"/><stop offset=".1" stop-color="#aaa" stop-opacity=".1"/><stop offset=".9" stop-color="#000" stop-opacity=".3"/><stop offset="1" stop-color="#000" stop-opacity=".5"/></linearGradient><clipPath id="bmr-986ff3b3470c1920"><rect width="122" height="18" rx="4" fill="#fff"/></clipPath><g clip-path="url(#bmr-986ff3b3470c1920)"><rect width="87" height="18" fill="#555"/><rect x="87" width="35" height="18" fill="#e05d44"/><rect width="122" height="18" fill="url(#bms-986ff3b3470c1920)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="445" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="770">test-coverage</text><text x="445" y="130" transform="scale(.1)" fill="#fff" textLength="770">test-coverage</text><text aria-hidden="true" x="1035" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="250">17%</text><text x="1035" y="130" transform="scale(.1)" fill="#fff" textLength="250">17%</text></g></svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
|
@ -14,17 +14,6 @@ fn main() {
|
|||
// println!("First entry: {:?}", initial_deserialisation.as_ref().unwrap()[0]);
|
||||
|
||||
let intermediate_deserialisation = initial_deserialisation.unwrap().into_iter().map(InnerEquipementStats::try_from).collect::<Vec<_>>();
|
||||
// let v = intermediate_deserialisation
|
||||
// .iter()
|
||||
// .scan(0, |status, eq| {
|
||||
// if eq.is_ok() {
|
||||
// *status = 1;
|
||||
// } else {
|
||||
// *status = 0;
|
||||
// }
|
||||
// Some(*status)
|
||||
// })
|
||||
// .sum::<i32>();
|
||||
let f = intermediate_deserialisation.iter().fold((0, 0), |val, res| (val.0 + res.is_ok() as usize, val.1 + 1_usize));
|
||||
// println!("Final data {:#?}", intermediate_deserialisation);
|
||||
println!("Failed to parse: {:#?}", intermediate_deserialisation.into_iter().filter_map(|v| v.err()).collect::<Vec<_>>());
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
// Workspace: weaponry
|
||||
// File: examples/typical_wl_recipe.rs
|
||||
// File: examples/usage_import_tex.rs
|
||||
//! Example of a first initialisation
|
||||
//! All this work is cursed and rushed
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
// Workspace: weaponry
|
||||
// File: examples/usage_scenario.rs
|
||||
//! Test use case of a scenario
|
||||
//!
|
||||
//!
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
// TODO : All of these should likely be in the prelude if used like this
|
||||
use weaponry::interfaces::{Reportable, Scenario, ToCSV};
|
||||
use weaponry::weaponry_structs::CrossRecipeScenario;
|
||||
use weaponry::weaponry_structs::equipement_scenario::ConfigMock;
|
||||
// use weaponry::interfaces::
|
||||
fn main() {
|
||||
let save_path = "data/first_data.csv";
|
||||
let scenarios = CrossRecipeScenario::new_with_config(ConfigMock {}).unwrap();
|
||||
let refined_list = scenarios.generate_refined_recipes().unwrap();
|
||||
println!("{}", refined_list.get_report(Some("Refined List")));
|
||||
println!("Saved initial data as {}: {:?}", save_path, refined_list.write_csv(Path::new(save_path)));
|
||||
}
|
||||
|
||||
// // Load DB
|
||||
// let db = EquipementDatabase::new("./databases/weapons.db").unwrap();
|
||||
// // Do a first deserialisation
|
||||
// let initial_deserialisation = db.serialize_vec_from_table::<DatabaseEquipementStats>("Equipements", None).unwrap();
|
||||
// // Follow up by parsing this deserialisation by a transformation into the right intermediate representation
|
||||
// let intermediate_deserialisation = initial_deserialisation.into_iter().map(InnerEquipementStats::try_from).collect::<Vec<_>>();
|
||||
|
||||
// // // Inspect the sucesses/filures
|
||||
// // let f = intermediate_deserialisation.iter().fold((0, 0), |val, res| (val.0 + res.is_ok() as usize, val.1 + 1_usize));
|
||||
// // println!("Succeded in parsing {}/{}", f.0, f.1);
|
||||
|
||||
// // println!("Final data {:#?}", intermediate_deserialisation);
|
||||
// // println!("Failed to parse: {:#?}", intermediate_deserialisation.into_iter().filter_map(|v| v.err()).collect::<Vec<_>>());
|
||||
|
|
@ -18,8 +18,8 @@ pub fn get_data<T>(
|
|||
where
|
||||
T: DeserializeOwned + more_fields::FieldsAsSlice,
|
||||
{
|
||||
let mut binding = conn.prepare(&generate_select_query::<T>(table_name, filter))?;
|
||||
let rows = binding.query([])?;
|
||||
let mut connection = conn.prepare(&generate_select_query::<T>(table_name, filter))?;
|
||||
let rows = connection.query([])?;
|
||||
serde_rusqlite::from_rows::<T>(rows)
|
||||
.enumerate()
|
||||
.map(|(row_id, result)| {
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ pub trait Reportable {
|
|||
/// Get a detailled inner status report with as many useful informations as possible
|
||||
///
|
||||
/// This report should give detailled information about the inner data, without showing the actual inner data
|
||||
fn get_report(&self) -> String;
|
||||
fn get_report(&self, title: Option<&str>) -> String;
|
||||
}
|
||||
|
||||
/// A recipe full stack scenario, from loading database through view table generation
|
||||
|
|
|
|||
|
|
@ -84,9 +84,11 @@ impl Default for RefinedEquipementList {
|
|||
}
|
||||
|
||||
/// The list of advanced stats infered from an Equipement
|
||||
// TODO: The two philosophies to drop the old inner or convert the useful fields are considered right now
|
||||
#[allow(missing_docs, clippy::missing_docs_in_private_items)]
|
||||
#[derive(Serialize)]
|
||||
pub struct AdvancedStats {
|
||||
display_name: String,
|
||||
damage_per_attack: f64,
|
||||
damage_per_turn: f64,
|
||||
damage_per_action: f64,
|
||||
|
|
@ -104,6 +106,7 @@ impl From<&InnerEquipementStats> for AdvancedStats {
|
|||
(value.damage + value.p_damage * (value.rmax.saturating_sub(1))) as f64;
|
||||
let armor_break_per_attack = (value.armor_break as f64).min(damage_per_attack);
|
||||
Self {
|
||||
display_name: value.name.join(" "),
|
||||
damage_per_attack,
|
||||
damage_per_turn: damage_per_attack * 2.,
|
||||
damage_per_action: damage_per_attack / (value.action_cost as f64),
|
||||
|
|
@ -139,7 +142,12 @@ impl Serialize for DamageMatrix {
|
|||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
serializer.serialize_str(&format!("[{:?}]", self.damage_matrix))
|
||||
// TODO: Not sure of the right way to do this
|
||||
// serializer.serialize_str(&format!("[{:?}]", self.damage_matrix))
|
||||
serializer.serialize_str(&format!(
|
||||
"{:?}",
|
||||
self.damage_matrix.iter().sum::<f64>() / self.damage_matrix.len() as f64
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ pub enum WeaponCategory {
|
|||
// TODO: This is the real initial category
|
||||
/// The list of initial weapon meta categories
|
||||
#[allow(clippy::missing_docs_in_private_items, missing_docs)]
|
||||
#[derive(Clone, Debug, PartialEq, Display, Deserialize, Serialize, strum::EnumString)]
|
||||
#[derive(Clone, Debug, Display, Deserialize, Serialize, strum::EnumString)]
|
||||
pub enum WeaponMacroCategory {
|
||||
Staves,
|
||||
Blunt,
|
||||
|
|
@ -155,11 +155,35 @@ pub enum WeaponMacroCategory {
|
|||
Armor,
|
||||
Shields,
|
||||
Exotic,
|
||||
/// A custom weapon category, only used by the target
|
||||
// TODO: Get rid of this category and make a custom category for target
|
||||
Weapons,
|
||||
/// A custom none category, used to forbid a part to be cast upon of from
|
||||
// TODO: Check the soundness of this implementation
|
||||
None,
|
||||
}
|
||||
|
||||
// TODO: This is only needed as long as we dont have a special category for the target
|
||||
impl PartialEq for WeaponMacroCategory {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(&Self::None, _) => false,
|
||||
(_, Self::None) => false,
|
||||
(&Self::Armor, &Self::Armor) => true,
|
||||
(&Self::Armor, _) => false,
|
||||
(_, &Self::Armor) => false,
|
||||
(&Self::Weapons, _) => true,
|
||||
(_, &Self::Weapons) => true,
|
||||
(&Self::Staves, &Self::Staves) => true,
|
||||
(&Self::Blunt, &Self::Blunt) => true,
|
||||
(&Self::Slash, &Self::Slash) => true,
|
||||
(&Self::Ranged, &Self::Ranged) => true,
|
||||
(&Self::Exotic, &Self::Exotic) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
// use super::*;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ impl From<EqMaterial> for Equipement {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Change this into tryfrom
|
||||
impl From<EqNature> for Equipement {
|
||||
fn from(val: EqNature) -> Self {
|
||||
Self {
|
||||
|
|
@ -42,18 +44,42 @@ impl From<EqNature> for Equipement {
|
|||
// TODO : Checks that this is exactly desired behavious
|
||||
// :Also check for Cross Weapon/Armor contamination
|
||||
// Checks that the nature is compatible with the previous iteration
|
||||
filter_function: FilterFunction::new(&|sel, lhs| match (
|
||||
&sel.target,
|
||||
&lhs.macro_category,
|
||||
) {
|
||||
(Some(a), Some(b)) => a == b,
|
||||
(None, None) => true,
|
||||
_ => false,
|
||||
filter_function: FilterFunction::new(&|sel, lhs| {
|
||||
// println!(
|
||||
// "Trying to match {:?} with {:?}. {:?} {:?}",
|
||||
// sel.name, lhs.name, sel.target, lhs.macro_category
|
||||
// );
|
||||
|
||||
match (&sel.target, &lhs.macro_category) {
|
||||
// There is a specific target and the part about to be added has a category
|
||||
(Some(a), Some(b)) => {
|
||||
// println!("{} {}", a, b);
|
||||
a == b
|
||||
}
|
||||
// There is no target and the part about to be added is generic
|
||||
// TODO: Unsound to have a generic nature, this should be caught at serialisation
|
||||
(None, _) => panic!("The EqNature about to be added cannot be generic"),
|
||||
// There is a specific target but the part about to be added is generic
|
||||
// TODO: Impossible
|
||||
(Some(_), None) => panic!("The part about to be added unto cannot be generic"),
|
||||
// // There is restriction on the target and the recipient
|
||||
// (None, Some(_)) => true,
|
||||
}
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// (Some(a), Some(b)) => {
|
||||
// println!("{} {}", a, b);
|
||||
// a == b
|
||||
// }
|
||||
// // There is no target and the part about to be added is generic
|
||||
// (None, None) => true,
|
||||
// // There is a specific target but the part about to be added is generic
|
||||
// (Some(_), None) => true,
|
||||
// // There is restriction on the target and the recipient
|
||||
// (None, Some(_)) => true,
|
||||
impl From<EqFinishing> for Equipement {
|
||||
fn from(val: EqFinishing) -> Self {
|
||||
Self {
|
||||
|
|
@ -143,21 +169,36 @@ impl Display for InnerEquipementStats {
|
|||
}
|
||||
}
|
||||
|
||||
// impl Display for InitialEquipementList {
|
||||
// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
// for v in self.ref_inner() {
|
||||
// write!(f, "{v}")?;
|
||||
// }
|
||||
// Ok(())
|
||||
// }
|
||||
// }
|
||||
|
||||
impl Reportable for InitialEquipementList {
|
||||
fn get_report(&self) -> String {
|
||||
fn get_report(&self, title: Option<&str>) -> String {
|
||||
let mut table = Table::new();
|
||||
table.apply_modifier(UTF8_ROUND_CORNERS);
|
||||
table.add_row(vec![format!("Refined Equipement List")]);
|
||||
match title {
|
||||
Some(t) => table.add_row(vec![format!("[IEL] {t}")]),
|
||||
None => table.add_row(vec![format!("Initial Equipement List")]),
|
||||
};
|
||||
table.add_row(vec![format!("Rows: {}", self.inner.len())]);
|
||||
table.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
impl Reportable for RefinedEquipementList {
|
||||
fn get_report(&self) -> String {
|
||||
fn get_report(&self, title: Option<&str>) -> String {
|
||||
let mut table = Table::new();
|
||||
table.apply_modifier(UTF8_ROUND_CORNERS);
|
||||
table.add_row(vec![format!("Refined Equipement List")]);
|
||||
match title {
|
||||
Some(t) => table.add_row(vec![format!("[REL] {t}")]),
|
||||
None => table.add_row(vec![format!("Refined Equipement List")]),
|
||||
};
|
||||
table.add_row(vec![format!("Rows: {}", self.inner.len())]);
|
||||
table.to_string()
|
||||
}
|
||||
|
|
@ -187,7 +228,7 @@ mod test {
|
|||
let eqlist = InitialEquipementList::from_vectored(vec![Equipement::default(); 10]);
|
||||
let feqlist: RefinedEquipementList = eqlist.clone().into();
|
||||
|
||||
println!("{}", feqlist.get_report());
|
||||
println!("{}", eqlist.get_report());
|
||||
println!("{}", feqlist.get_report(None));
|
||||
println!("{}", eqlist.get_report(None));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ impl TryFrom<DatabaseEquipementStats> for InnerEquipementStats {
|
|||
special: from_serde!(&value.special)?,
|
||||
action_cost: value.action_cost,
|
||||
reload_cost: from_serde!(&value.reload_cost)?,
|
||||
range: value.range,
|
||||
range: value.range as i16,
|
||||
agility_bonus: value.agility_bonus,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,51 +9,23 @@
|
|||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use crate::weaponry_structs::Equipement;
|
||||
#[allow(unused_imports)]
|
||||
use crate::interfaces::Reportable;
|
||||
use crate::weaponry_structs::InitialEquipementList;
|
||||
use crate::weaponry_structs::equipement_structs::DatabaseEquipementStats;
|
||||
use crate::weaponry_structs::equipement_structs::EqFinishing;
|
||||
use crate::weaponry_structs::equipement_structs::EqMaterial;
|
||||
use crate::weaponry_structs::equipement_structs::EqNature;
|
||||
use crate::weaponry_structs::equipement_structs::EqShape;
|
||||
use crate::weaponry_structs::equipement_structs::InnerEquipementStats;
|
||||
use crate::{
|
||||
error::{EquipementError, FatalEquipementError},
|
||||
error::EquipementError,
|
||||
interfaces::{RecipeCollection, RecipeDatabase, Scenario, ViewTable},
|
||||
weaponry_structs::equipement_structs::{EqFinishing, EqMaterial, EqNature, EqShape},
|
||||
};
|
||||
|
||||
use super::equipement_advanced_repr::RefinedEquipementList;
|
||||
use super::equipement_impl_database::EquipementDatabase;
|
||||
|
||||
/// Mock of the existing database
|
||||
pub struct DatabaseMock {}
|
||||
impl RecipeDatabase for DatabaseMock {
|
||||
fn serialize_vec_from_table<T>(
|
||||
&self,
|
||||
table: &str,
|
||||
filter: Option<&str>,
|
||||
) -> std::result::Result<Vec<T>, crate::error::FatalEquipementError> {
|
||||
let _ = table;
|
||||
let _ = filter;
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn new(origin: &str) -> Result<Self, FatalEquipementError>
|
||||
where
|
||||
Self: std::marker::Sized,
|
||||
{
|
||||
let _ = origin;
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn initialize_empty_table<T>(&self, table: &str) -> Result<(), FatalEquipementError> {
|
||||
let _ = table;
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn insert_row<T: serde::de::DeserializeOwned>(
|
||||
&self,
|
||||
row: T,
|
||||
) -> Result<(), FatalEquipementError> {
|
||||
let _ = row;
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
/// Mock config
|
||||
pub struct ConfigMock {}
|
||||
/// Mock Viewtable
|
||||
|
|
@ -74,34 +46,37 @@ impl ViewTable for ViewtableMock {
|
|||
/// A simple cross recipe scenario
|
||||
#[allow(clippy::missing_docs_in_private_items)]
|
||||
pub struct CrossRecipeScenario {
|
||||
database: DatabaseMock,
|
||||
database: EquipementDatabase,
|
||||
config: ConfigMock,
|
||||
}
|
||||
|
||||
/// Automatically deserialize into an equipement
|
||||
// TODO: This macro only exists because no blanket implementation or function does this *relatively* easy step
|
||||
// TODO: This place the place where all new impl and simplifications will be done
|
||||
// TODO: Streamline this so no macro is needed
|
||||
macro_rules! deserde_into_equipement {
|
||||
( $db:expr, $name:expr, $type:ident) => {
|
||||
InitialEquipementList::from_vectored(
|
||||
$db.serialize_vec_from_table::<DatabaseEquipementStats>(
|
||||
"Equipement",
|
||||
Some(&format!("CATEGORY == {}", $name)),
|
||||
"Equipements",
|
||||
Some(&format!("META_CATEGORY LIKE '{}'", $name)),
|
||||
// None,
|
||||
)?
|
||||
.into_iter()
|
||||
.map(|eq| {
|
||||
// TODO: This is the lamest way to init this data
|
||||
.map(|v| {
|
||||
$type {
|
||||
stats: eq.try_into().unwrap(),
|
||||
stats: InnerEquipementStats::try_from(v).unwrap(),
|
||||
}
|
||||
.into()
|
||||
})
|
||||
.collect::<Vec<Equipement>>(),
|
||||
.collect::<Vec<_>>(),
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
impl Scenario for CrossRecipeScenario {
|
||||
type DatabaseType = DatabaseMock;
|
||||
type DatabaseType = EquipementDatabase;
|
||||
type ViewTableType = ViewtableMock;
|
||||
type FinalListType = RefinedEquipementList;
|
||||
type Config = ConfigMock;
|
||||
|
|
@ -120,18 +95,33 @@ impl Scenario for CrossRecipeScenario {
|
|||
fn generate_refined_recipes(&self) -> Result<Self::FinalListType, EquipementError> {
|
||||
// TODO: Depending on config, a different filter might be given here
|
||||
let eq_shape = deserde_into_equipement!(self.database, "Shape", EqShape);
|
||||
let eq_material = deserde_into_equipement!(self.database, "Material", EqMaterial);
|
||||
let eq_material = deserde_into_equipement!(self.database, "Materials", EqMaterial);
|
||||
let eq_nature = deserde_into_equipement!(self.database, "Nature", EqNature);
|
||||
#[allow(unused_variables)]
|
||||
let eq_finishing = deserde_into_equipement!(self.database, "Finishing", EqFinishing);
|
||||
|
||||
// println!(
|
||||
// "{}\n{}\n{}\n{}",
|
||||
// eq_shape.get_report(Some("EqShape ")),
|
||||
// eq_material.get_report(Some("EqMaterials")),
|
||||
// eq_nature.get_report(Some("EqNature ")),
|
||||
// eq_finishing.get_report(Some("EqFinishing"))
|
||||
// );
|
||||
|
||||
// No op, just clarity
|
||||
// TODO: Depending on config this step might differ
|
||||
let mut f_list = eq_shape;
|
||||
// println!("{}", f_list.get_report(Some("Initial Weapons ")));
|
||||
f_list.combine_all(&eq_material);
|
||||
// println!("{}", f_list.get_report(Some("Combined with Materials")));
|
||||
f_list.combine_all(&eq_nature);
|
||||
f_list.combine_all(&eq_finishing);
|
||||
// println!("{}", f_list.get_report(Some("Combined with Natures ")));
|
||||
// f_list.combine_all(&eq_finishing);
|
||||
// println!("{}", f_list.get_report(Some("Combined with Finishing")));
|
||||
// TODO: The finishes are interesting if they are configured or at least tamed a little
|
||||
// TODO: As a high cost finish cannot hope to compete with a low one
|
||||
// TODO: and therefore need a special metric and fixed entry data to be mesured
|
||||
|
||||
// This oneline is neat
|
||||
Ok(f_list.into())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ pub struct InnerEquipementStats {
|
|||
pub(super) special: SpecialCategory,
|
||||
pub(super) action_cost: i8,
|
||||
pub(super) reload_cost: Option<i8>, // Shouldn't it be Option ?
|
||||
pub(super) range: i8, // Shoudln't it be Option ?
|
||||
pub(super) range: i16, // Shoudln't it be Option ?
|
||||
pub(super) agility_bonus: f32, // Also convert this one to HalfValue
|
||||
}
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ impl InnerEquipementStats {
|
|||
pub fn random_new() -> Self {
|
||||
Self {
|
||||
id: vec![r!() as u8],
|
||||
range: r!() - 10,
|
||||
range: (r!() - 10) as i16,
|
||||
damage: r!() - 10,
|
||||
p_damage: r!() - 10,
|
||||
protection: r!() - 10,
|
||||
|
|
@ -283,12 +283,14 @@ mod test {
|
|||
#[test]
|
||||
fn test_creating_all_equipements() {
|
||||
let shape = vec![EqShape::default().into(), EqShape::default().into()];
|
||||
let nature = vec![EqNature::default().into(), EqNature::default().into()];
|
||||
// Commented because of the generic nature and the from not a tryfrom
|
||||
// TODO: Reinstate this part
|
||||
// let nature = vec![EqNature::default().into(), EqNature::default().into()];
|
||||
let material = vec![EqMaterial::default().into(), EqMaterial::default().into()];
|
||||
let finishing = vec![EqFinishing::default().into(), EqMaterial::default().into()];
|
||||
|
||||
let mut leq = InitialEquipementList::from_vectored(shape);
|
||||
leq.combine_all(&InitialEquipementList::from_vectored(nature));
|
||||
// leq.combine_all(&InitialEquipementList::from_vectored(nature));
|
||||
leq.combine_all(&InitialEquipementList::from_vectored(material));
|
||||
leq.combine_all(&InitialEquipementList::from_vectored(finishing));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ pub mod equipement_impl_database;
|
|||
mod equipement_impl_io;
|
||||
mod equipement_impl_logic;
|
||||
mod equipement_impl_math;
|
||||
mod equipement_scenario;
|
||||
pub mod equipement_scenario;
|
||||
pub mod equipement_structs;
|
||||
mod equipement_views;
|
||||
|
||||
|
|
@ -37,3 +37,6 @@ pub use equipement_fields::PhysicalDamageType;
|
|||
pub use equipement_fields::{
|
||||
DamageMod, DamageType, NatureTarget, SpecialCategory, WeaponCategory, WeaponMacroCategory,
|
||||
};
|
||||
|
||||
// Likely ? Final Re-Exports
|
||||
pub use equipement_scenario::CrossRecipeScenario;
|
||||
|
|
|
|||
Loading…
Reference in New Issue