More cleanup on the scenarii impls
This commit is contained in:
parent
f726b7ce15
commit
8a2114da74
|
|
@ -1,23 +0,0 @@
|
|||
# TO-Impl List
|
||||
- Initial Object Representation
|
||||
- Final Object Representation
|
||||
|
||||
|
||||
# Workflow
|
||||
A B C
|
||||
Database -> <Structs> -> <Weapons> -> Balancing data
|
||||
-> Exported data
|
||||
|
||||
# Description
|
||||
- A : Use structs defines in weaponry_structs
|
||||
: impl From<ForeignType> for all weapon parts
|
||||
- B : Every part can be converted to a weapon(ish)
|
||||
: Use the correct solver to add all parts
|
||||
- C1 : Use the traits to generate the tex data
|
||||
|
||||
|
||||
# Strategy
|
||||
Since the structs will become more than just weapons but will become craft afterwards, polymorphism is the key
|
||||
|
||||
The creation algorithm will pick a Strategy depending on the user's choice and build a final weapon depending on it
|
||||
The creation will implement an iterator to go with itertools / rayon ?
|
||||
|
|
@ -160,10 +160,15 @@ pub trait ToAnalysis {
|
|||
where
|
||||
T: FnMut(&Self::InnerData, &Self::InnerData) -> std::cmp::Ordering;
|
||||
|
||||
/// Apply a filter to the inner data
|
||||
///
|
||||
/// Careful this filter will consume the original data to avoir reallocating
|
||||
fn inner_filter<T>(self, closure: T) -> Self
|
||||
where
|
||||
T: FnMut(&Self::InnerData) -> bool;
|
||||
|
||||
/// Write as html
|
||||
fn write_html(&self, path: &str) -> Result<(), FatalEquipementError>;
|
||||
|
||||
// TODO: Add sorting methods as no analysis can be done without filtering and sorting
|
||||
}
|
||||
|
||||
/// A generic database+connection, handling all the deserialization of the inner types
|
||||
|
|
|
|||
|
|
@ -85,6 +85,15 @@ impl ToAnalysis for RefinedEquipementList {
|
|||
self.inner.sort_by(closure)
|
||||
}
|
||||
|
||||
fn inner_filter<T>(self, closure: T) -> Self
|
||||
where
|
||||
T: FnMut(&RefinedEquipement) -> bool,
|
||||
{
|
||||
Self {
|
||||
inner: self.inner.into_iter().filter(closure).collect::<Vec<_>>(),
|
||||
}
|
||||
}
|
||||
|
||||
// TODO[3]: Consider wether the naming should be a parameter,
|
||||
// or a config should be given or if the scenario should be fed again the Refined and ...
|
||||
fn write_html(&self, save_path: &str) -> Result<(), FatalEquipementError> {
|
||||
|
|
@ -93,10 +102,6 @@ impl ToAnalysis for RefinedEquipementList {
|
|||
|
||||
let initial_chart: Chart = initial_chart("Damage for all cross-gen products");
|
||||
|
||||
// TODO[!]: Add sorting
|
||||
// data.inner
|
||||
// .sort_by(|a, b| a.advanced.dps_safe.total_cmp(&b.advanced.dps_safe));
|
||||
|
||||
add_field_to_chart!(
|
||||
self,
|
||||
initial_chart,
|
||||
|
|
@ -133,8 +138,7 @@ impl From<InitialEquipementList> for RefinedEquipementList {
|
|||
}
|
||||
}
|
||||
|
||||
// #[cfg(test)]
|
||||
// Used in exemples
|
||||
// #[cfg(test)] // Used in exemples
|
||||
impl Default for RefinedEquipementList {
|
||||
fn default() -> Self {
|
||||
let eq = InitialEquipementList::from_vectored(vec![Equipement::default(); 10]);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ pub struct CrossRecipeScenario {
|
|||
impl CrossRecipeScenario {
|
||||
/// Automatically deserialize into an equipement
|
||||
// TODO: Add to trait
|
||||
// TODO: Add an optionnal filter
|
||||
// TODO: Add an optionnal initial filter ?
|
||||
fn deserde_into_equipement<T>(
|
||||
&self,
|
||||
name: &str,
|
||||
|
|
|
|||
Loading…
Reference in New Issue