Skip to content

Commit

Permalink
Disable quality probability analysis for expert recipes & Adjust norm…
Browse files Browse the repository at this point in the history
…al recipe condition probabilities
  • Loading branch information
KonaeAkira committed Dec 29, 2024
1 parent 76db94a commit 00c7838
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion game_data/build/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn import_rlvl_records() -> Result<Vec<RecipeLevelRecord>, Box<dyn std::error::E
);
writeln!(writer, "[")?;
for record in rlvl_records.iter() {
writeln!(writer, "RecipeLevel {{ progress_div: {}, quality_div: {}, progress_mod: {}, quality_mod: {} }},", record.progress_divider, record.quality_divider, record.progress_modifier, record.quality_modifier)?;
writeln!(writer, "RecipeLevel {{ progress_div: {}, quality_div: {}, progress_mod: {}, quality_mod: {}, conditions_flag: {} }},", record.progress_divider, record.quality_divider, record.progress_modifier, record.quality_modifier, record.conditions_flag)?;
}
writeln!(writer, "]")?;
Ok(rlvl_records)
Expand Down
2 changes: 2 additions & 0 deletions game_data/build/records.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,6 @@ pub struct RecipeLevelRecord {
pub progress_modifier: u32,
#[serde(rename = "QualityModifier")]
pub quality_modifier: u32,
#[serde(rename = "ConditionsFlag")]
pub conditions_flag: u32,
}
1 change: 1 addition & 0 deletions game_data/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub struct RecipeLevel {
pub quality_div: u16,
pub progress_mod: u16,
pub quality_mod: u16,
pub conditions_flag: u16,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
Expand Down
6 changes: 3 additions & 3 deletions simulator/src/probabilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use crate::{Action, Condition, Settings, SimulationState};
const fn condition_probabilities(current_condition: Condition) -> &'static [(Condition, f32)] {
match current_condition {
Condition::Normal => &[
(Condition::Normal, 0.80),
(Condition::Good, 0.15),
(Condition::Excellent, 0.05),
(Condition::Normal, 0.86),
(Condition::Good, 0.12),
(Condition::Excellent, 0.02),
],
Condition::Good => &[(Condition::Normal, 1.00)],
Condition::Excellent => &[(Condition::Poor, 1.00)],
Expand Down
1 change: 1 addition & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ impl MacroSolverApp {
initial_quality,
target_quality,
&self.actions,
self.recipe_config.recipe.is_expert,
));
}

Expand Down
11 changes: 8 additions & 3 deletions src/widgets/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct SolutionAnalysis<'a> {
initial_quality: u16,
target_quality: u16,
actions: &'a [Action],
is_expert: bool,
}

impl<'a> SolutionAnalysis<'a> {
Expand All @@ -18,6 +19,7 @@ impl<'a> SolutionAnalysis<'a> {
initial_quality: u16,
target_quality: u16,
actions: &'a [Action],
is_expert: bool,
) -> Self {
Self {
settings: Settings {
Expand All @@ -27,6 +29,7 @@ impl<'a> SolutionAnalysis<'a> {
initial_quality,
target_quality,
actions,
is_expert,
}
}
}
Expand All @@ -48,8 +51,10 @@ impl egui::Widget for SolutionAnalysis<'_> {
ui.horizontal(|ui| {
collapsed = util::collapse_button(ui, egui::Id::new("analysis_collapsed"));
ui.label(egui::RichText::new("Analysis").strong());
if self.actions.is_empty() {
ui.label("N/A");
if self.is_expert {
ui.label("N/A (Expert recipes not supported)");
} else if self.actions.is_empty() {
ui.label("N/A (No macro to analyze)");
} else {
ui.label(format!(
"{:.2}% chance to reach target Quality ({})",
Expand All @@ -58,7 +63,7 @@ impl egui::Widget for SolutionAnalysis<'_> {
));
}
});
if collapsed {
if collapsed || self.is_expert {
return;
}
ui.separator();
Expand Down

0 comments on commit 00c7838

Please sign in to comment.