diff --git a/worlds/hk/Options.py b/worlds/hk/Options.py index 1885632f7805..4ad940c33822 100644 --- a/worlds/hk/Options.py +++ b/worlds/hk/Options.py @@ -403,6 +403,16 @@ class Goal(Choice): default = 0 +class GrubHuntGoal(NamedRange): + """The amount of grubs required to finish Grub Hunt. + On 'All' any grubs from item links replacements etc. will be counted""" + display_name = "Grub Hunt Goal" + range_start = 1 + range_end = 46 + special_range_names = {"all": 0} + default = 46 + + class WhitePalace(Choice): """ Whether or not to include White Palace or not. Note: Even if excluded, the King Fragment check may still be @@ -517,7 +527,7 @@ class CostSanityHybridChance(Range): **{ option.__name__: option for option in ( - StartLocation, Goal, WhitePalace, ExtraPlatforms, AddUnshuffledLocations, StartingGeo, + StartLocation, Goal, GrubHuntGoal, WhitePalace, ExtraPlatforms, AddUnshuffledLocations, StartingGeo, DeathLink, DeathLinkShade, DeathLinkBreaksFragileCharms, MinimumGeoPrice, MaximumGeoPrice, MinimumGrubPrice, MaximumGrubPrice, diff --git a/worlds/hk/__init__.py b/worlds/hk/__init__.py index 938e3eaee04a..e8c9f830ad6f 100644 --- a/worlds/hk/__init__.py +++ b/worlds/hk/__init__.py @@ -444,7 +444,11 @@ 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: - pass # will set in pre_fill() + 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) else: # Any goal world.completion_condition[player] = lambda state: state._hk_can_beat_thk(player) or state._hk_can_beat_radiance(player) @@ -452,7 +456,7 @@ def set_rules(self): set_rules(self) def pre_fill(self): - if self.options.Goal == "grub_hunt": + if self.options.Goal == "grub_hunt" and self.grub_count == 0: from collections import Counter relevant_groups = self.multiworld.get_player_groups(self.player) grub_player_count = Counter()