Addentum(Doc) - Adds more documentation

This commit is contained in:
Dandaedre 2023-03-02 17:45:03 +01:00
parent 0c5ed39573
commit a5c196b764
5 changed files with 88 additions and 32 deletions

View File

@ -15,6 +15,7 @@
🟩 (CLI) Rework the parameters and return structs to only have one ref each 🟩 (CLI) Rework the parameters and return structs to only have one ref each
### Features ### Features
🟩 (GUI) Refactor code 🟩 (GUI) Refactor code
🟩 (GUI) Restore GUI state
# Roadmap # Roadmap
## v1.0.0 ## v1.0.0

View File

@ -99,7 +99,7 @@ impl ActionBuilder {
self self
} }
/// Makes an action add a buff for certain number of actions /// Makes an action add a buff for certain number of actions
/// The buffs available are defined in [specs.rs](xiv_csolver::specs::Buff) /// The buffs available are defined in [specs.rs](crate::specs::Buff)
/// ///
/// `` /// ``
/// (self.recipe.progress as f32 - self.progression as f32) / self.get_base_progression() as f32; /// (self.recipe.progress as f32 - self.progression as f32) / self.get_base_progression() as f32;
@ -323,7 +323,6 @@ pub struct ActionList {
// Restores item durability by 60. // Restores item durability by 60.
// pub masters_mend_2: Action, // pub masters_mend_2: Action,
/// Reduces loss of durability by 50% for the next four steps. /// Reduces loss of durability by 50% for the next four steps.
pub waste_not: Action, pub waste_not: Action,
/// Reduces loss of durability by 50% for the next eight steps. /// Reduces loss of durability by 50% for the next eight steps.
@ -337,7 +336,6 @@ pub struct ActionList {
pub great_strides: Action, pub great_strides: Action,
/// Increases efficiency of Touch actions by 50% for the next four steps. /// Increases efficiency of Touch actions by 50% for the next four steps.
pub innovation: Action, pub innovation: Action,
// Do nothing for one step. // Do nothing for one step.
//pub observe: Action, //pub observe: Action,
// Increases progress. // Increases progress.

View File

@ -250,7 +250,7 @@ use crate::{solve_craft, Recipe, Stats};
/// The values are all obtained by a `&PyAny`, wich must guaranty that several attributes are /// The values are all obtained by a `&PyAny`, wich must guaranty that several attributes are
/// accesible by `__getattr__` /// accesible by `__getattr__`
/// ///
/// ```py /// ```python
/// import xiv_craft_solver, rich /// import xiv_craft_solver, rich
/// ///
/// class FeedingClass: /// class FeedingClass:

View File

@ -4,55 +4,103 @@ use std::fmt::Debug;
use strum_macros::EnumIter; use strum_macros::EnumIter;
/// The recipe to craft /// The recipe to craft
/// On some websites the fields are instead called
/// [Progress, quality, durability, progress difficulty, quality difficulty, extra progress difficulty, extra quality difficulty]
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub struct Recipe { pub struct Recipe {
/// The craft durability (also called solidity) /// The recipe durability (also called solidity) (35, 40, 70 or 80 usually)
pub durability: u32, pub durability: u32,
/// The total recipe progress needed
pub progress: u32, pub progress: u32,
/// The total recipe quality
pub quality: u32, pub quality: u32,
/// How much the progress is hard to set,
/// it's an (hidden) extra progress multiplier,
/// inflicting a -10% to -30% to starred recipes
/// Also called `progress_difficulty`
pub progress_divider: u32, pub progress_divider: u32,
/// The same (hidden) difficulty multiplier, for quality
/// Also called `progress_difficulty`
pub quality_divider: u32, pub quality_divider: u32,
/// Modifies how much the base stats are affecting the craft progress
/// Also called `progress_extra_difficulty`
pub progress_modifier: u32, pub progress_modifier: u32,
/// Modifies how much the base stats are affectif the craft quality
/// Also called `quality_extra_difficulty`
pub quality_modifier: u32, pub quality_modifier: u32,
} }
/// The craftsman stats
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub struct Stats { pub struct Stats {
/// The craftsmanship, influences the progress
pub craftsmanship: u32, pub craftsmanship: u32,
/// The control, inluences the quality
pub control: u32, pub control: u32,
/// The amount of cp, ressource used for actions
pub max_cp: u32, pub max_cp: u32,
} }
/// The buffs available for the crafter
#[derive(Debug, Clone, Copy, PartialEq, EnumIter)] #[derive(Debug, Clone, Copy, PartialEq, EnumIter)]
pub enum Buff { pub enum Buff {
/// Gain a stack of Inner Quiet with every increase in quality, up to a maximum of 10.
/// Grants a 10% bonus to the efficiency of Touch actions for each stack.
InnerQuiet, InnerQuiet,
/// Reduces loss of durability by 50%.
WasteNot, WasteNot,
/// Increases the efficiency of next Touch action by 100%.
GreatStrides, GreatStrides,
/// Increases efficiency of Touch actions by 50%.
Innovation, Innovation,
/// Increases efficiency of Synthesis actions by 50%.
Veneration, Veneration,
/// Restores 5 points of durability after each step.
Manipulation, Manipulation,
/// Increases progress.
/// Efficiency: 300%
/// Success Rate: 100%
/// Additional Effect: Efficiency of your next Synthesis action is increased by 100%
/// Available only on the first step.
/// Additional effect is active for five steps.
MuscleMemory, MuscleMemory,
// v Hidden v // v Hidden v
/// (Hidden) Combo with Standart touch costs 18 cp.
BasicTouch, BasicTouch,
/// (Hidden) Combo with Advanced touch costs 18 cp.
StandardTouch, StandardTouch,
/// (Hidden) Do nothing for one step.
Observe, Observe,
} }
/// Keeps track of all the durations remaining on all buffs
/// Also called buff tracker in the docs
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub struct BuffState { pub struct BuffState {
/// Caps at 10 for a 100% extra efficiency in quality increase
pub inner_quiet: u8, pub inner_quiet: u8,
/// Lasts for four steps if Waste not was used, height if Waste Not II was.
pub waste_not: u8, pub waste_not: u8,
/// Effect active for three steps, dissipates after a quality action is used.
pub great_strides: u8, pub great_strides: u8,
/// Lasts four steps
pub innovation: u8, pub innovation: u8,
/// Lasts four steps.
pub veneration: u8, pub veneration: u8,
/// Lasts height steps
pub manipulation: u8, pub manipulation: u8,
/// Lasts five steps, dissipate after a progression action is used.
pub muscle_memory: u8, pub muscle_memory: u8,
/// Lasts one step
pub basic_touch: u8, pub basic_touch: u8,
/// Lasts one step
pub standard_touch: u8, pub standard_touch: u8,
/// Lasts one step
pub observe: u8, pub observe: u8,
} }
impl BuffState { impl BuffState {
/// Default state of buffs (all at zero) as per the beggining of craft
pub fn default() -> Self { pub fn default() -> Self {
Self { Self {
inner_quiet: 0, inner_quiet: 0,
@ -68,6 +116,7 @@ impl BuffState {
} }
} }
/// Remove the given buff from the buff tracker
pub fn remove(&mut self, buff: Buff) { pub fn remove(&mut self, buff: Buff) {
match buff { match buff {
Buff::InnerQuiet => self.inner_quiet = 0, Buff::InnerQuiet => self.inner_quiet = 0,
@ -83,6 +132,8 @@ impl BuffState {
} }
} }
/// Apply the given buff to the buff tracker for `value` steps
/// In the case of Inner Quiet, it inseads adds one to the stack counter
pub fn apply(&mut self, buff: Buff, value: u8) { pub fn apply(&mut self, buff: Buff, value: u8) {
match buff { match buff {
Buff::InnerQuiet => { Buff::InnerQuiet => {
@ -104,6 +155,7 @@ impl BuffState {
} }
} }
/// Tick downs the remaining duration of all buffs, if up
pub fn tick(&mut self) { pub fn tick(&mut self) {
if self.waste_not > 0 { if self.waste_not > 0 {
self.waste_not -= 1; self.waste_not -= 1;
@ -132,9 +184,14 @@ impl BuffState {
} }
} }
/// State the craft is in, used to keep track of wether the craft
/// is to be worked on, added to the success vector or discarded
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
pub enum Success { pub enum Success {
/// Pending success and therefor still ongoing
Pending, Pending,
/// Finised, not ongoing and finished without breaking (Doens't take quality into account)
Success, Success,
/// Finised because of lack of remaining durability
Failure, Failure,
} }