From 22e6e2a0405e1af7abb9f271e520abeda76ef586 Mon Sep 17 00:00:00 2001 From: necrashter Date: Fri, 8 Dec 2023 14:51:54 +0300 Subject: [PATCH] Fix a bug that causes tutorial upgrades to appear in late game --- src/upgrade.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/upgrade.rs b/src/upgrade.rs index f05e680..dcca02f 100644 --- a/src/upgrade.rs +++ b/src/upgrade.rs @@ -272,7 +272,12 @@ impl UpgradeSequence { // Then, (weighted) randomly choose from those upgrades for the available slots ALL_UPGRADE_KINDS .into_iter() - .filter(|&kind| upgrade_list[kind].is_unlocked(simulation, outline)) + .filter(|&kind| { + let upgrade = &upgrade_list[kind]; + // This prevents the tutorial upgrades from being offered when + // all other upgrades are exhausted. + upgrade.weight > 0.0 && upgrade.is_unlocked(simulation, outline) + }) .collect::>() .choose_multiple_weighted(&mut thread_rng(), self.slots, |&kind| { upgrade_list[kind].weight