Filter out bow upgrades individually
Also fix these changes being applied all the time rather than just in race mode
@@ -741,24 +741,25 @@ class WWRandomizerWindow(QMainWindow):
# Race mode places required items on dungeon bosses.
should_enable_options["race_mode"] = False
- num_possible_rewards = 0
- num_possible_rewards += 8 - int(self.get_option_value("num_starting_triforce_shards"))
sword_mode = self.get_option_value("sword_mode")
+ if sword_mode == "Swordless":
+ items_to_filter_out += ["Hurricane Spin"]
+
+ if self.get_option_value("race_mode"):
+ num_possible_rewards = 8 - int(self.get_option_value("num_starting_triforce_shards"))
+
if sword_mode == "Start with Sword":
num_possible_rewards += 3
elif sword_mode == "Randomized Sword":
num_possible_rewards += 4
- elif sword_mode == "Swordless":
- items_to_filter_out += ["Hurricane Spin"]
-
- if num_possible_rewards < 4:
- items_to_filter_out += 3 * ["Progressive Bow"]
- num_possible_rewards += 3
- if num_possible_rewards < 4:
- items_to_filter_out += ["Hookshot"]
+ potential_boss_rewards = 3 * ["Progressive Bow"] + ["Hookshot"]
+ while num_possible_rewards < 4:
+ cur_reward = potential_boss_rewards.pop(0)
+ items_to_filter_out += [cur_reward]
+ num_possible_rewards += 1
self.filtered_rgear.setFilterStrings(items_to_filter_out)
@@ -766,9 +767,11 @@ class WWRandomizerWindow(QMainWindow):
randomized_gear = self.get_option_value("randomized_gear")
for item in items_to_filter_out:
- if item in starting_gear:
+ if item in randomized_gear:
+ randomized_gear.remove(item)
+ elif item in starting_gear:
starting_gear.remove(item)
- randomized_gear += [item]
+ randomized_gear += items_to_filter_out
self.set_option_value("starting_gear", starting_gear)
self.set_option_value("randomized_gear", randomized_gear)
@@ -950,7 +953,14 @@ class ModelFilterOut(QSortFilterProxyModel):
def filterAcceptsRow(self, sourceRow, sourceParent):
index0 = self.sourceModel().index(sourceRow, 0, sourceParent)
- return not self.sourceModel().data(index0) in self.filter_strings
+ data = self.sourceModel().data(index0)
+ num_occurrences = self.filter_strings.count(data)
+ for i in range(sourceRow):
+ cur_index = self.sourceModel().index(i, 0, sourceParent)
+ cur_data = self.sourceModel().data(cur_index)
+ if cur_data == data:
+ num_occurrences -= 1
+ return num_occurrences <= 0
class RandomizerProgressDialog(QProgressDialog):
def __init__(self, title, description, max_val):
