From bea8d37a3cde8510c38956b9e7e6b5758a167c6a Mon Sep 17 00:00:00 2001 From: black-sliver <59490463+black-sliver@users.noreply.github.com> Date: Tue, 1 Nov 2022 13:14:38 +0100 Subject: [PATCH] SoE: fix false positives in early sphere collection (#1165) --- worlds/soe/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/worlds/soe/__init__.py b/worlds/soe/__init__.py index 9f250391..864d2daa 100644 --- a/worlds/soe/__init__.py +++ b/worlds/soe/__init__.py @@ -216,10 +216,16 @@ class SoEWorld(World): r.exits = [Entrance(self.player, 'New Game', r)] self.multiworld.regions += [r] + def get_sphere_index(evermizer_loc): + """Returns 0, 1 or 2 for locations in spheres 1, 2, 3+""" + if len(evermizer_loc.requires) == 1 and evermizer_loc.requires[0][1] != pyevermizer.P_WEAPON: + return 2 + return min(2, len(evermizer_loc.requires)) + # group locations into spheres (1, 2, 3+ at index 0, 1, 2) spheres: typing.Dict[int, typing.Dict[int, typing.List[SoELocation]]] = {} for loc in _locations: - spheres.setdefault(min(2, len(loc.requires)), {}).setdefault(loc.type, []).append( + spheres.setdefault(get_sphere_index(loc), {}).setdefault(loc.type, []).append( SoELocation(self.player, loc.name, self.location_name_to_id[loc.name], r, loc.difficulty > max_difficulty)) @@ -234,6 +240,7 @@ class SoEWorld(World): for typ, counts in fills.items(): count = counts[self.multiworld.difficulty[self.player].value] for location in self.multiworld.random.sample(spheres[trash_sphere][typ], count): + assert location.name != "Energy Core #285", "Error in sphere generation" location.progress_type = LocationProgressType.EXCLUDED # TODO: do we need to set an item rule?