From b335ba201905dae04431f11dfea51fd79cb88ac2 Mon Sep 17 00:00:00 2001 From: qwint Date: Sat, 4 May 2024 15:56:55 -0500 Subject: [PATCH] updates to grub hunt goal based on review --- worlds/hk/Options.py | 2 +- worlds/hk/__init__.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/worlds/hk/Options.py b/worlds/hk/Options.py index 4ad940c33822..1a1587107a66 100644 --- a/worlds/hk/Options.py +++ b/worlds/hk/Options.py @@ -409,7 +409,7 @@ class GrubHuntGoal(NamedRange): display_name = "Grub Hunt Goal" range_start = 1 range_end = 46 - special_range_names = {"all": 0} + special_range_names = {"all": -1} default = 46 diff --git a/worlds/hk/__init__.py b/worlds/hk/__init__.py index 17999aea831b..b55327bf92f0 100644 --- a/worlds/hk/__init__.py +++ b/worlds/hk/__init__.py @@ -444,11 +444,7 @@ def set_rules(self): elif goal == Goal.option_godhome_flower: world.completion_condition[player] = lambda state: state.count("Godhome_Flower_Quest", player) elif goal == Goal.option_grub_hunt: - if self.options.GrubHuntGoal == "all": - pass # will set in pre_fill() - else: - self.grub_count = self.options.GrubHuntGoal.value - world.completion_condition[player] = lambda state: state.has("Grub", player, self.grub_count) + pass # will set in pre_fill() else: # Any goal world.completion_condition[player] = lambda state: state._hk_can_beat_thk(player) or state._hk_can_beat_radiance(player) @@ -456,7 +452,8 @@ def set_rules(self): set_rules(self) def pre_fill(self): - if self.options.Goal == "grub_hunt" and self.grub_count == 0: + grub_hunt_goal = self.options.GrubHuntGoal + if grub_hunt_goal == grub_hunt_goal.special_range_names["all"]: from collections import Counter relevant_groups = self.multiworld.get_player_groups(self.player) grub_player_count = Counter() @@ -472,6 +469,9 @@ def pre_fill(self): self.multiworld.completion_condition[self.player] = lambda state, g=grub_player_count: \ all([state.has("Grub", player, count) for player, count in g.items()]) + else: + self.grub_count = grub_hunt_goal.value + world.completion_condition[player] = lambda state: state.has("Grub", player, self.grub_count) def fill_slot_data(self): slot_data = {} @@ -510,7 +510,7 @@ def fill_slot_data(self): slot_data["notch_costs"] = self.charm_costs - slot_data["GrubCount"] = self.grub_count + slot_data["grub_count"] = self.grub_count return slot_data