Skip to content

Commit

Permalink
updates to grub hunt goal based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
qwint committed May 5, 2024
1 parent 816afce commit b335ba2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion worlds/hk/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
14 changes: 7 additions & 7 deletions worlds/hk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,19 +444,16 @@ 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)

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()
Expand All @@ -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 = {}
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit b335ba2

Please sign in to comment.