Skip to content

Commit

Permalink
Fix a bug that causes tutorial upgrades to appear in late game
Browse files Browse the repository at this point in the history
  • Loading branch information
necrashter committed Dec 8, 2023
1 parent 83eb68c commit 22e6e2a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>()
.choose_multiple_weighted(&mut thread_rng(), self.slots, |&kind| {
upgrade_list[kind].weight
Expand Down

0 comments on commit 22e6e2a

Please sign in to comment.