diff --git a/BaseClasses.py b/BaseClasses.py index d05b5519..05c1351d 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -145,6 +145,9 @@ class World(object): ret.clear_cached_unreachable() return ret + def get_items(self): + return [loc.item for loc in self.get_filled_locations()] + self.itempool + def find_items(self, item): return [location for location in self.get_locations() if location.item is not None and location.item.name == item] diff --git a/Dungeons.py b/Dungeons.py index 4652373b..58f94f20 100644 --- a/Dungeons.py +++ b/Dungeons.py @@ -103,6 +103,8 @@ def fill_dungeons(world): world.state.clear_cached_unreachable() +def get_dungeon_item_pool(world): + return [item for dungeon in world.dungeons for item in dungeon.all_items if item.key or world.place_dungeon_items] def fill_dungeons_restrictive(world, shuffled_locations): all_state_base = world.get_all_state() @@ -112,7 +114,16 @@ def fill_dungeons_restrictive(world, shuffled_locations): skull_woods_big_chest.event = True shuffled_locations.remove(skull_woods_big_chest) - dungeon_items = [item for dungeon in world.dungeons for item in dungeon.all_items if item.key or world.place_dungeon_items] + if world.keysanity: + #in keysanity dungeon items are distributed as part of the normal item pool + for item in world.get_items(): + if item.key: + item.advancement = True + elif item.map or item.compass: + item.priority = True + return + + dungeon_items = get_dungeon_item_pool(world) # sort in the order Big Key, Small Key, Other before placing dungeon items sort_order = {"BigKey": 3, "SmallKey": 2} diff --git a/ItemList.py b/ItemList.py index 784a51e0..10880d7a 100644 --- a/ItemList.py +++ b/ItemList.py @@ -3,6 +3,7 @@ import random from Items import ItemFactory from Fill import fill_restrictive +from Dungeons import get_dungeon_item_pool #This file sets the item pools for various modes. Timed modes and triforce hunt are enforced first, and then extra items are specified per mode to fill in the remaining space. #Some basic items that various modes require are placed here, including pendants and crystals. Medallion requirements for the two relevant entrances are also decided. @@ -203,6 +204,9 @@ def generate_itempool(world): if treasure_hunt_icon is not None: world.treasure_hunt_icon = treasure_hunt_icon + if world.keysanity: + world.itempool.extend(get_dungeon_item_pool(world)) + # shuffle medallions mm_medallion = ['Ether', 'Quake', 'Bombos'][random.randint(0, 2)] tr_medallion = ['Ether', 'Quake', 'Bombos'][random.randint(0, 2)] diff --git a/Main.py b/Main.py index 03e172ac..6b897367 100644 --- a/Main.py +++ b/Main.py @@ -178,7 +178,7 @@ def create_playthrough(world): raise RuntimeError('Cannot beat game. Something went terribly wrong here!') # get locations containing progress items - prog_locations = [location for location in world.get_locations() if location.item is not None and (location.item.advancement or (location.item.key and world.keysanity))] + prog_locations = [location for location in world.get_filled_locations() if location.item.advancement] collection_spheres = [] state = CollectionState(world)