diff --git a/BaseClasses.py b/BaseClasses.py index 4691ef4b..a82f3093 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -1662,18 +1662,21 @@ class Entrance(object): self.temp_path = [] def can_reach(self, state): - # Destination Pickup OW Only No Ledges Can S&Q Allow Mirror - multi_step_locations = { 'Pyramid Crack': ('Big Bomb', True, True, False, True), - 'Missing Smith': ('Frog', True, False, True, True), - 'Middle Aged Man': ('Dark Blacksmith Ruins', True, False, True, True), - 'Old Man Drop Off': ('Lost Old Man', True, False, False, False), - 'Revealing Light': ('Suspicious Maiden', False, False, False, False) + # Destination Pickup OW Only No Ledges Can S&Q Allow Mirror + multi_step_locations = { 'Pyramid Crack': ('Big Bomb', True, True, False, True), + 'Missing Smith': ('Frog', True, False, True, True), + 'Middle Aged Man': ('Dark Blacksmith Ruins', True, False, True, True), + 'Dark Palace Button':('Kiki', True, False, False, False), + 'Old Man Drop Off': ('Lost Old Man', True, False, False, False), + 'Revealing Light': ('Suspicious Maiden', False, False, False, False) } if self.name in multi_step_locations: if self not in state.path: world = self.parent_region.world multi_step_loc = multi_step_locations[self.name] + if world.shuffle_followers[self.player]: + multi_step_loc = (multi_step_loc[0], self.name == 'Pyramid Crack', multi_step_loc[2], True, True) step_location = world.get_location(multi_step_loc[0], self.player) if step_location.can_reach(state) and self.can_reach_thru(state, step_location, multi_step_loc[1], multi_step_loc[2], multi_step_loc[3], multi_step_loc[4]) and self.access_rule(state): if not self in state.path: @@ -2952,7 +2955,7 @@ class Spoiler(object): self.settings = {} - self.suppress_spoiler_locations = ['Big Bomb', 'Frog', 'Dark Blacksmith Ruins', 'Middle Aged Man', 'Lost Old Man', 'Old Man Drop Off'] + self.suppress_spoiler_locations = ['Lost Old Man', 'Big Bomb', 'Frog', 'Dark Blacksmith Ruins', 'Middle Aged Man', 'Kiki'] def set_overworld(self, entrance, exit, direction, player): if self.world.players == 1: @@ -3018,6 +3021,7 @@ class Spoiler(object): 'ow_whirlpool': self.world.owWhirlpoolShuffle, 'ow_fluteshuffle': self.world.owFluteShuffle, 'bonk_drops': self.world.shuffle_bonk_drops, + 'shuffle_followers': self.world.shuffle_followers, 'shuffle': self.world.shuffle, 'shuffleganon': self.world.shuffle_ganon, 'shufflelinks': self.world.shufflelinks, @@ -3259,6 +3263,7 @@ class Spoiler(object): outfile.write('\n') outfile.write('Shopsanity:'.ljust(line_width) + '%s\n' % yn(self.metadata['shopsanity'][player])) outfile.write('Bonk Drops:'.ljust(line_width) + '%s\n' % yn(self.metadata['bonk_drops'][player])) + outfile.write('Followers:'.ljust(line_width) + '%s\n' % yn(self.metadata['shuffle_followers'][player])) outfile.write('Pottery Mode:'.ljust(line_width) + '%s\n' % self.metadata['pottery'][player]) outfile.write('Pot Shuffle (Legacy):'.ljust(line_width) + '%s\n' % yn(self.metadata['potshuffle'][player])) outfile.write('Enemy Drop Shuffle:'.ljust(line_width) + '%s\n' % self.metadata['dropshuffle'][player]) @@ -3670,7 +3675,7 @@ boss_mode = {"none": 0, "simple": 1, "full": 2, "chaos": 3, 'random': 3, 'unique or_mode = {"vanilla": 0, "parallel": 1, "full": 2} orcrossed_mode = {"none": 0, "polar": 1, "grouped": 2, "unrestricted": 4} -# byte 12: KMB? FF?? (keep similar, mixed/tile flip, bonk drops, flute spots) +# byte 12: KMBQ FF?? (keep similar, mixed/tile flip, bonk drops, follower quests, flute spots) flutespot_mode = {"vanilla": 0, "balanced": 1, "random": 2} # byte 13: FBBB TTPP (flute_mode, bow_mode, take_any, prize shuffle) @@ -3737,7 +3742,8 @@ class Settings(object): | (0x08 if w.owWhirlpoolShuffle[p] else 0) | orcrossed_mode[w.owCrossed[p]], (0x80 if w.owKeepSimilar[p] else 0) | (0x40 if w.owMixed[p] else 0) - | (0x20 if w.shuffle_bonk_drops[p] else 0) | (flutespot_mode[w.owFluteShuffle[p]] << 4), + | (0x20 if w.shuffle_bonk_drops[p] else 0) | (0x10 if w.shuffle_followers[p] else 0) + | (flutespot_mode[w.owFluteShuffle[p]] << 4), (flute_mode[w.flute_mode[p]] << 7 | bow_mode[w.bow_mode[p]] << 4 | take_any_mode[w.take_any[p]] << 2 | prizeshuffle_mode[w.prizeshuffle[p]]), @@ -3822,6 +3828,7 @@ class Settings(object): args.ow_keepsimilar[p] = True if settings[12] & 0x80 else False args.ow_mixed[p] = True if settings[12] & 0x40 else False args.bonk_drops[p] = True if settings[12] & 0x20 else False + args.shuffle_followers[p] = True if settings[12] & 0x10 else False args.ow_fluteshuffle[p] = r(flutespot_mode)[(settings[12] & 0x0C) >> 2] if len(settings) > 13: diff --git a/CLI.py b/CLI.py index 8fc7263e..c6ae7d9f 100644 --- a/CLI.py +++ b/CLI.py @@ -132,7 +132,7 @@ def parse_cli(argv, no_defaults=False): for name in ['logic', 'mode', 'swords', 'goal', 'difficulty', 'item_functionality', 'ow_shuffle', 'ow_terrain', 'ow_crossed', 'ow_keepsimilar', 'ow_mixed', 'ow_whirlpool', 'ow_fluteshuffle', - 'flute_mode', 'bow_mode', 'take_any', 'boots_hint', + 'flute_mode', 'bow_mode', 'take_any', 'boots_hint', 'shuffle_followers', 'shuffle', 'door_shuffle', 'intensity', 'crystals_ganon', 'crystals_gt', 'openpyramid', 'mapshuffle', 'compassshuffle', 'keyshuffle', 'bigkeyshuffle', 'prizeshuffle', 'startinventory', 'usestartinventory', 'bombbag', 'shuffleganon', 'overworld_map', 'restrict_boss_items', @@ -200,6 +200,7 @@ def parse_settings(): "ow_mixed": False, "ow_whirlpool": False, "ow_fluteshuffle": "vanilla", + "shuffle_followers": False, "bonk_drops": False, "shuffle": "vanilla", "shufflelinks": False, diff --git a/Doors.py b/Doors.py index af83f6fc..aa55cf0c 100644 --- a/Doors.py +++ b/Doors.py @@ -1301,7 +1301,7 @@ def create_doors(world, player): world.get_door('Swamp Drain Right Switch', player).event('Swamp Drain') world.get_door('Swamp Flooded Room Ladder', player).event('Swamp Drain') - if world.mode[player] == 'standard': + if world.mode[player] == 'standard' and 'Zelda Herself' not in [i.name for i in world.precollected_items if i.player == player]: world.get_door('Hyrule Castle Throne Room Tapestry', player).event('Zelda Pickup') world.get_door('Hyrule Castle Tapestry Backwards', player).event('Zelda Pickup') diff --git a/DungeonGenerator.py b/DungeonGenerator.py index f8297aff..d5c65621 100644 --- a/DungeonGenerator.py +++ b/DungeonGenerator.py @@ -602,7 +602,8 @@ def determine_paths_for_dungeon(world, player, all_regions, name): paths.append(boss) if 'Thieves Boss' in all_r_names: paths.append('Thieves Boss') - if world.get_dungeon("Thieves Town", player).boss.enemizer_name == 'Blind': + if world.get_dungeon("Thieves Town", player).boss.enemizer_name == 'Blind' \ + and not world.shuffle_followers[player]: paths.append(('Thieves Blind\'s Cell', 'Thieves Boss')) for drop_check in drop_path_checks: if drop_check in all_r_names: @@ -1324,7 +1325,8 @@ def create_dungeon_builders(all_sectors, connections_tuple, world, player, dunge for r_name in ['Hyrule Dungeon Cellblock', 'Sanctuary', 'Hyrule Castle Throne Room']: # need to deliver zelda assign_sector(find_sector(r_name, candidate_sectors), current_dungeon, candidate_sectors, global_pole) - if key == 'Thieves Town' and world.get_dungeon("Thieves Town", player).boss.enemizer_name == 'Blind': + if key == 'Thieves Town' and (world.get_dungeon("Thieves Town", player).boss.enemizer_name == 'Blind' + and not world.shuffle_followers[player]): assign_sector(find_sector("Thieves Blind's Cell", candidate_sectors), current_dungeon, candidate_sectors, global_pole) entrances_map, potentials, connections = connections_tuple diff --git a/InitialSram.py b/InitialSram.py index 0aa25bc2..f360236a 100644 --- a/InitialSram.py +++ b/InitialSram.py @@ -128,6 +128,25 @@ class InitialSram: else: self.set_progress_indicator(0x03) + if startingstate.has('Zelda Herself', player): + self._initial_sram_bytes[0x3CC] = 0x01 + elif startingstate.has('Escort Old Man', player): + self._initial_sram_bytes[0x3CC] = 0x04 + elif startingstate.has('Maiden Rescued', player): + self._initial_sram_bytes[0x3CC] = 0x06 + elif startingstate.has('Get Frog', player): + self._initial_sram_bytes[0x3CC] = 0x07 + elif startingstate.has('Sign Vandalized', player): + self._initial_sram_bytes[0x3CC] = 0x09 + elif startingstate.has('Pick Up Kiki', player): + self._initial_sram_bytes[0x3CC] = 0x0A + elif startingstate.has('Pick Up Purple Chest', player): + self._initial_sram_bytes[0x3CC] = 0x0C + elif startingstate.has('Pick Up Big Bomb', player): + self._initial_sram_bytes[0x3CC] = 0x0D + if self._initial_sram_bytes[0x3CC] > 0x01 and world.mode[player] == 'standard': + self._initial_sram_bytes[0x3D3] = 0x80 + for item in world.precollected_items: if item.player != player: continue @@ -138,7 +157,9 @@ class InitialSram: 'Mirror Shield', 'Red Shield', 'Blue Shield', 'Progressive Shield', 'Red Mail', 'Blue Mail', 'Progressive Armor', 'Magic Upgrade (1/4)', 'Magic Upgrade (1/2)', - 'Return Old Man', 'Beat Agahnim 1']: + 'Return Old Man', 'Beat Agahnim 1', 'Zelda Herself', 'Escort Old Man', + 'Maiden Rescued', 'Get Frog', 'Sign Vandalized', 'Pick Up Kiki', + 'Pick Up Purple Chest', 'Pick Up Big Bomb']: continue set_table = {'Book of Mudora': (0x34E, 1), 'Hammer': (0x34B, 1), 'Bug Catching Net': (0x34D, 1), 'Hookshot': (0x342, 1), 'Magic Mirror': (0x353, 2), diff --git a/ItemList.py b/ItemList.py index 45c1df2d..e690d83a 100644 --- a/ItemList.py +++ b/ItemList.py @@ -129,6 +129,40 @@ difficulties = { ), } + +follower_quests = { + 'Zelda Pickup': ['Zelda Herself', 'Zelda Drop Off', 'Zelda Delivered'], + 'Lost Old Man': ['Escort Old Man', 'Old Man Drop Off', 'Return Old Man'], + 'Locksmith': ['Sign Vandalized', None, None], + 'Kiki': ['Pick Up Kiki', 'Kiki Assistance', 'Dark Palace Opened'], + 'Suspicious Maiden': ['Maiden Rescued', 'Revealing Light', 'Maiden Unmasked'], + 'Frog': ['Get Frog', 'Missing Smith', 'Return Smith'], + 'Dark Blacksmith Ruins': ['Pick Up Purple Chest', 'Middle Aged Man', 'Deliver Purple Chest'], + 'Big Bomb': ['Pick Up Big Bomb', 'Pyramid Crack', 'Detonate Big Bomb'], +} + +follower_locations = { + 'Zelda Pickup': 0x1802C0, + 'Lost Old Man': 0x1802C3, + 'Suspicious Maiden': 0x1802C6, + 'Frog': 0x1802C9, + 'Locksmith': 0x1802CC, + 'Kiki': 0x1802CF, + 'Dark Blacksmith Ruins': 0x1802D2, + 'Big Bomb': 0x1802D5, +} + +follower_pickups = { + 'Zelda Herself': 0x01, + 'Escort Old Man': 0x04, + 'Maiden Rescued': 0x06, + 'Get Frog': 0x07, + 'Sign Vandalized': 0x09, + 'Pick Up Kiki': 0x0A, + 'Pick Up Purple Chest': 0x0C, + 'Pick Up Big Bomb': 0x0D, +} + # Translate between Mike's label array and YAML/JSON keys def get_custom_array_key(item): label_switcher = { @@ -194,17 +228,10 @@ def generate_itempool(world, player): if world.timer in ['ohko', 'timed-ohko']: world.can_take_damage = False - def set_event_item(location_name, item_name=None): - location = world.get_location(location_name, player) - if item_name: - world.push_item(location, ItemFactory(item_name, player), False) - location.event = True - location.locked = True - if world.goal[player] in ['pedestal', 'triforcehunt']: - set_event_item('Ganon', 'Nothing') + set_event_item(world, player, 'Ganon', 'Nothing') else: - set_event_item('Ganon', 'Triforce') + set_event_item(world, player, 'Ganon', 'Triforce') if world.goal[player] in ['triforcehunt', 'trinity']: region = world.get_region('Hyrule Castle Courtyard', player) @@ -241,12 +268,17 @@ def generate_itempool(world, player): old_man.skip = True for loc, item in location_events.items(): - if item: - set_event_item(loc, item) - + if loc in follower_quests and world.shuffle_followers[player]: + item = None + set_event_item(world, player, loc, item) + + zelda_pickup, zelda_dropoff = None, None if world.mode[player] == 'standard': - set_event_item('Zelda Pickup', 'Zelda Herself') - set_event_item('Zelda Drop Off', 'Zelda Delivered') + if not world.shuffle_followers[player]: + zelda_pickup = 'Zelda Herself' + zelda_dropoff = 'Zelda Delivered' + set_event_item(world, player, 'Zelda Pickup', zelda_pickup) + set_event_item(world, player, 'Zelda Drop Off', zelda_dropoff) # set up item pool skip_pool_adjustments = False @@ -1642,6 +1674,50 @@ def fill_specific_items(world): world.item_pool_config.verify_target += len(placement['locations']) +def set_event_item(world, player, location_name, item_name=None): + location = world.get_location(location_name, player) + if item_name: + world.push_item(location, ItemFactory(item_name, player), False) + location.event = True + if location_name not in follower_quests or not world.shuffle_followers[player]: + location.locked = True + + +def shuffle_event_items(world, player): + if (world.shuffle_followers[player]): + available_quests = follower_quests.copy() + available_pickups = [quests[0] for quests in available_quests.values()] + + for loc_name in follower_quests.keys(): + loc = world.get_location(loc_name, player) + if loc.item: + set_event_item(world, player, loc_name) + available_quests.pop(loc_name) + available_pickups.remove(loc.item.name) + + + if world.mode[player] == 'standard': + if 'Zelda Herself' in available_pickups: + zelda_pickup = available_quests.pop('Zelda Pickup')[0] + available_pickups.remove(zelda_pickup) + set_event_item(world, player, 'Zelda Pickup', zelda_pickup) + + random.shuffle(available_pickups) + + restricted_pickups = { 'Get Frog': 'Dark Blacksmith Ruins'} + for pickup in restricted_pickups: + restricted_quests = [q for q in available_quests.keys() if q not in restricted_pickups[pickup]] + random.shuffle(restricted_quests) + quest = restricted_quests.pop() + available_quests.pop(quest) + available_pickups.remove(pickup) + set_event_item(world, player, quest, pickup) + + for pickup in available_pickups: + quest, _ = available_quests.popitem() + set_event_item(world, player, quest, pickup) + + def get_item_and_event_flag(item, world, player, dungeon_pool, prize_set, prize_pool): item_parts = item.split('#') item_player = player if len(item_parts) < 2 else int(item_parts[1]) diff --git a/Items.py b/Items.py index 5b24b17a..ec6a18b8 100644 --- a/Items.py +++ b/Items.py @@ -180,6 +180,8 @@ item_table = {'Bow': (True, False, None, 0x0B, 200, 'Bow!\nJoin the archer class 'Beat Boss': (True, False, 'Event', 999, None, None, None, None, None, None, None, None), 'Beat Agahnim 1': (True, False, 'Event', 999, None, None, None, None, None, None, None, None), 'Beat Agahnim 2': (True, False, 'Event', 999, None, None, None, None, None, None, None, None), + 'Pick Up Kiki': (True, False, 'Event', 999, None, None, None, None, None, None, None, None), + 'Dark Palace Opened': (True, False, 'Event', 999, None, None, None, None, None, None, None, None), 'Get Frog': (True, False, 'Event', 999, None, None, None, None, None, None, None, None), 'Return Smith': (True, False, 'Event', 999, None, None, None, None, None, None, None, None), 'Pick Up Purple Chest': (True, False, 'Event', 999, None, None, None, None, None, None, None, None), @@ -198,6 +200,7 @@ item_table = {'Bow': (True, False, None, 0x0B, 200, 'Bow!\nJoin the archer class 'Hidden Pits': (True, False, 'Event', 999, None, None, None, None, None, None, None, None), 'Zelda Herself': (True, False, 'Event', 999, None, None, None, None, None, None, None, None), 'Zelda Delivered': (True, False, 'Event', 999, None, None, None, None, None, None, None, None), + 'Sign Vandalized': (True, False, 'Event', 999, None, None, None, None, None, None, None, None), 'Escort Old Man': (True, False, 'Event', 999, None, None, None, None, None, None, None, None), 'Return Old Man': (True, False, 'Event', 999, None, None, None, None, None, None, None, None), 'Farmable Bombs': (True, False, 'Event', 999, None, None, None, None, None, None, None, None), diff --git a/Main.py b/Main.py index f668e853..6029ee30 100644 --- a/Main.py +++ b/Main.py @@ -27,7 +27,7 @@ from Dungeons import create_dungeons from Fill import distribute_items_restrictive, promote_dungeon_items, fill_dungeons_restrictive, ensure_good_items from Fill import dungeon_tracking from Fill import sell_potions, sell_keys, balance_multiworld_progression, balance_money_progression, lock_shop_locations, set_prize_drops -from ItemList import generate_itempool, difficulties, fill_prizes, customize_shops, fill_specific_items, create_farm_locations +from ItemList import generate_itempool, difficulties, fill_prizes, customize_shops, fill_specific_items, create_farm_locations, shuffle_event_items, follower_pickups from UnderworldGlitchRules import connect_hmg_entrances_regions, create_hmg_entrances_regions from Utils import output_path, parse_player_names @@ -35,6 +35,7 @@ from source.item.District import init_districts from source.item.FillUtil import create_item_pool_config, massage_item_pool, district_item_pool_config, verify_item_pool_config from source.overworld.EntranceShuffle2 import link_entrances_new from source.tools.BPS import create_bps_from_data +from source.tools.GraphExporter import GephiStreamer from source.classes.CustomSettings import CustomSettings from source.enemizer.DamageTables import DamageTable from source.enemizer.Enemizer import randomize_enemies @@ -244,6 +245,7 @@ def main(args, seed=None, fish=None): sell_keys(world, player) else: lock_shop_locations(world, player) + shuffle_event_items(world, player) massage_item_pool(world) logger.info(world.fish.translate("cli", "cli", "placing.dungeon.prizes")) @@ -476,6 +478,7 @@ def init_world(args, fish): world.owKeepSimilar = args.ow_keepsimilar.copy() world.owWhirlpoolShuffle = args.ow_whirlpool.copy() world.owFluteShuffle = args.ow_fluteshuffle.copy() + world.shuffle_followers = args.shuffle_followers.copy() world.shuffle_bonk_drops = args.bonk_drops.copy() world.open_pyramid = args.openpyramid.copy() world.boss_shuffle = args.shufflebosses.copy() @@ -530,6 +533,7 @@ def set_starting_inventory(world, args): if world.customizer and world.customizer.get_start_inventory(): for p, inv_list in world.customizer.get_start_inventory().items(): if inv_list: + follower_added = False for inv_item in inv_list: name = inv_item.strip() if inv_item == 'RandomWeapon': @@ -543,7 +547,13 @@ def set_starting_inventory(world, args): item = ItemFactory(e, p) if item: world.push_precollected(item) + elif inv_item == 'RandomFollower': + name = random.choice([f for f in follower_pickups if f != 'Zelda Herself' or world.mode[p] == 'standard']) name = name if name != 'Ocarina' or world.flute_mode[p] != 'active' else 'Ocarina (Activated)' + if name in follower_pickups: + if not world.shuffle_followers[p] or follower_added: + continue + follower_added = True item = ItemFactory(name, p) if item: world.push_precollected(item) @@ -591,6 +601,7 @@ def copy_world(world): ret.owKeepSimilar = world.owKeepSimilar.copy() ret.owWhirlpoolShuffle = world.owWhirlpoolShuffle.copy() ret.owFluteShuffle = world.owFluteShuffle.copy() + ret.shuffle_followers = world.shuffle_followers.copy() ret.shuffle_bonk_drops = world.shuffle_bonk_drops.copy() ret.open_pyramid = world.open_pyramid.copy() ret.shufflelinks = world.shufflelinks.copy() @@ -811,6 +822,7 @@ def copy_world_premature(world, player): ret.owKeepSimilar = world.owKeepSimilar.copy() ret.owWhirlpoolShuffle = world.owWhirlpoolShuffle.copy() ret.owFluteShuffle = world.owFluteShuffle.copy() + ret.shuffle_followers = world.shuffle_followers.copy() ret.shuffle_bonk_drops = world.shuffle_bonk_drops.copy() ret.open_pyramid = world.open_pyramid.copy() ret.shufflelinks = world.shufflelinks.copy() diff --git a/OWEdges.py b/OWEdges.py index ef9c9182..645e05ad 100644 --- a/OWEdges.py +++ b/OWEdges.py @@ -1241,6 +1241,7 @@ OWTileRegions = bidict({ 'Broken Bridge Water': 0x5d, 'Palace of Darkness Area': 0x5e, + 'Dark Palace Button': 0x5e, 'Hammer Pegs Area': 0x62, 'Hammer Pegs Entry': 0x62, @@ -1580,6 +1581,7 @@ OWExitTypes = { 'Middle Aged Man', 'Desert Pass Ladder (South)', 'Desert Pass Ladder (North)', + 'Kiki Assistance', 'GT Approach', 'GT Leave', ], diff --git a/OverworldShuffle.py b/OverworldShuffle.py index 6934829e..6118b731 100644 --- a/OverworldShuffle.py +++ b/OverworldShuffle.py @@ -1833,6 +1833,7 @@ mandatory_connections = [ ('Broken Bridge Water Drop', 'Broken Bridge Water'), #flippers ('Broken Bridge Northeast Water Drop', 'Broken Bridge Water'), #flippers ('Broken Bridge West Water Drop', 'Broken Bridge Water'), #flippers + ('Kiki Assistance', 'Dark Palace Button'), ('Peg Area Rocks (West)', 'Hammer Pegs Area'), #mitts ('Peg Area Rocks (East)', 'Hammer Pegs Entry'), #mitts ('Dig Game To Ledge Drop', 'Dig Game Ledge'), #mitts diff --git a/README.md b/README.md index 707b7b75..f5c6572a 100644 --- a/README.md +++ b/README.md @@ -234,6 +234,27 @@ New flute spots are chosen at random, with restrictions that limit the promixity New flute spots are chosen at random with minimum bias. +## Follower Shuffle (--shuffle_followers) + +This shuffles the follower companions throughout the world. Here is a full list of followers in the game: + +- Princess Zelda +- Old Man +- Blind Maiden +- Frog/Blacksmith +- Locksmith (Guy who unlocks Purple Chest) +- Kiki the Monkey +- Purple Chest +- Super Bomb + +When followers are shuffled, you must still fulfill the original requirements of the follower location. For example, if the Super Bomb Shop now contains the Frog, you must have crystals 5 and 6 and 100 rupees to unlock the Frog. It is also important to note that Purple Chest still needs to be delivered to the usual spot. Also, since it isn't useful normally, many people might not know that the Locksmith (the Purple Chest unlocking guy) can follow you, you must remove his sign to get him to follow. + +Most of the limitations of followers in the vanilla game have been lifted for this shuffle to work. For instance, you are able to mirror, flute, die, collect a crystal, and save/quit in most situations and still retain the follower. You are also able to enter caves/dungeons and complete dig game while you have a follower. + +In the scenario where you are forced down a narrow path and a follower is in your way and you already have a different follower. Running into that follower will switch the followers rather than overwriting, this gives you the opportunity to proceed with either one of the followers. Note that if you leave the screen, you lose this option to switch and you will need to go back to the original place you found the first follower. + +Optionally, thru the customizer, you can add a follower to your starting inventory, and you will be given that follower and it will stay with you until you complete their quest. + ## Bonk Drop Shuffle (--bonk_drops) This adds 42 new item locations to the game. These bonk locations are limited to the ones that drop a static item in the vanilla game. @@ -403,6 +424,12 @@ This gives each OW tile a random chance to be flipped to the opposite world For randomizing the flute spots around the overworld +``` +--shuffle_followers +``` + +This shuffles the follower companion locations, ie. Purple Chest, Old Man, etc. + ``` --bonk_drops ``` diff --git a/Regions.py b/Regions.py index 7068f0f6..d539cb86 100644 --- a/Regions.py +++ b/Regions.py @@ -133,7 +133,7 @@ def create_regions(world, player): create_lw_region(player, 'Ice Cave Area', None, ['Ice Rod Cave', 'Good Bee Cave', '20 Rupee Cave', 'Ice Cave Water Drop', 'Ice Cave SE']), create_lw_region(player, 'Ice Cave Water', None, ['Ice Cave Pier', 'Ice Cave SW'], 'Light World', Terrain.Water), create_lw_region(player, 'Desert Pass Area', ['Middle Aged Man'], ['Desert Fairy', '50 Rupee Cave', 'Middle Aged Man', 'Desert Pass Ladder (South)', 'Desert Pass Rocks (North)', 'Desert Pass WS', 'Desert Pass EC']), - create_lw_region(player, 'Middle Aged Man', ['Purple Chest'], None), + create_lw_region(player, 'Middle Aged Man', ['Purple Chest', 'Locksmith'], None), create_lw_region(player, 'Desert Pass Southeast', None, ['Desert Pass Rocks (South)', 'Desert Pass ES']), create_lw_region(player, 'Desert Pass Ledge', None, ['Desert Pass Ladder (North)', 'Desert Pass Ledge Drop', 'Desert Pass WC']), create_lw_region(player, 'Dam Area', ['Sunken Treasure'], ['Dam', 'Dam WC', 'Dam WS', 'Dam NC', 'Dam EC']), @@ -197,7 +197,8 @@ def create_regions(world, player): create_dw_region(player, 'Broken Bridge Northeast', None, ['Broken Bridge Hammer Rock (North)', 'Broken Bridge Hookshot Gap', 'Broken Bridge Northeast Water Drop', 'Broken Bridge NE']), create_dw_region(player, 'Broken Bridge West', None, ['Broken Bridge West Water Drop', 'Broken Bridge NW']), create_dw_region(player, 'Broken Bridge Water', None, ['Broken Bridge NC'], 'Dark World', Terrain.Water), - create_dw_region(player, 'Palace of Darkness Area', None, ['Palace of Darkness Hint', 'Palace of Darkness', 'Palace of Darkness SW', 'Palace of Darkness SE']), + create_dw_region(player, 'Palace of Darkness Area', ['Kiki'], ['Palace of Darkness Hint', 'Palace of Darkness', 'Kiki Assistance', 'Palace of Darkness SW', 'Palace of Darkness SE']), + create_dw_region(player, 'Dark Palace Button', ['Kiki Assistance'], None), create_dw_region(player, 'Darkness Cliff', None, ['Dark Dunes Cliff Ledge Drop', 'Hammer Bridge North Cliff Ledge Drop', 'Dark Tree Line Cliff Ledge Drop', 'Palace of Darkness Cliff Ledge Drop']), create_dw_region(player, 'Hammer Pegs Area', ['Dark Blacksmith Ruins'], ['Hammer Peg Cave', 'Peg Area Rocks (East)']), create_dw_region(player, 'Hammer Pegs Entry', None, ['Peg Area Rocks (West)', 'Hammer Pegs WS']), @@ -436,7 +437,6 @@ def create_dungeon_regions(world, player): create_dungeon_region(player, 'Hyrule Dungeon Staircase', 'Hyrule Castle', None, ['Hyrule Dungeon Staircase Up Stairs', 'Hyrule Dungeon Staircase Down Stairs']), create_dungeon_region(player, 'Hyrule Dungeon Cellblock', 'Hyrule Castle', ['Hyrule Castle - Big Key Drop'], ['Hyrule Dungeon Cellblock Up Stairs', 'Hyrule Dungeon Cellblock Door']), create_dungeon_region(player, 'Hyrule Dungeon Cell', 'Hyrule Castle', - ["Hyrule Castle - Zelda's Chest"] if not std_flag else ["Hyrule Castle - Zelda's Chest", 'Zelda Pickup'], ['Hyrule Dungeon Cell Exit']), @@ -1255,7 +1255,9 @@ def adjust_locations(world, player): location.type = LocationType.Logical location.real = False if l not in ['Ganon', 'Agahnim 1', 'Agahnim 2']: - location.skip = True + from ItemList import follower_quests + if not world.shuffle_followers[player] or l not in follower_quests: + location.skip = True def valid_pot_location(pot, pot_set, world, player): @@ -1413,9 +1415,12 @@ location_events = { 'Ice Palace - Boss Kill': 'Beat Boss', 'Misery Mire - Boss Kill': 'Beat Boss', 'Turtle Rock - Boss Kill': 'Beat Boss', + 'Locksmith': 'Sign Vandalized', 'Lost Old Man': 'Escort Old Man', 'Old Man Drop Off': 'Return Old Man', 'Floodgate': 'Open Floodgate', + 'Kiki': 'Pick Up Kiki', + 'Kiki Assistance': 'Dark Palace Opened', 'Big Bomb': 'Pick Up Big Bomb', 'Pyramid Crack': 'Detonate Big Bomb', 'Frog': 'Get Frog', @@ -1671,9 +1676,12 @@ location_table = {'Mushroom': (0x180013, 0x186df8, False, 'in the woods'), 'Ice Palace - Boss Kill': (None, None, False, None), 'Misery Mire - Boss Kill': (None, None, False, None), 'Turtle Rock - Boss Kill': (None, None, False, None), + 'Locksmith': (None, None, False, None), 'Lost Old Man': (None, None, False, None), 'Old Man Drop Off': (None, None, False, None), 'Floodgate': (None, None, False, None), + 'Kiki': (None, None, False, None), + 'Kiki Assistance': (None, None, False, None), 'Frog': (None, None, False, None), 'Missing Smith': (None, None, False, None), 'Dark Blacksmith Ruins': (None, None, False, None), diff --git a/Rom.py b/Rom.py index abea18f4..c102dfec 100644 --- a/Rom.py +++ b/Rom.py @@ -43,7 +43,7 @@ from source.enemizer.Enemizer import write_enemy_shuffle_settings JAP10HASH = '03a63945398191337e896e5771f77173' -RANDOMIZERBASEHASH = '80e0a4f8bd5cc6f83ac9f7f46c01bf4f' +RANDOMIZERBASEHASH = '7ce0f9fc9db08644ff77fb41993d9e34' class JsonRom(object): @@ -638,10 +638,6 @@ def patch_rom(world, rom, player, team, is_mystery=False): write_int16(rom, 0x150002, owMode) write_int16(rom, 0x150004, owFlags) - from OverworldShuffle import can_reach_smith - if not can_reach_smith(world, player): - rom.write_byte(0x180043, 0x01) # patch for deleting smith on S+Q - # patch entrance/exits/holes for region in world.regions: for exit in region.exits: @@ -1545,9 +1541,44 @@ def patch_rom(world, rom, player, team, is_mystery=False): rom.write_byte(snes_to_pc(0x0DB810), 0x8A) # allows heart pieces to travel across water # rom.write_byte(snes_to_pc(0x0DB730), 0x08) # allows chickens to travel across water - # allow smith into multi-entrance caves in appropriate shuffles - if world.shuffle[player] in ['restricted', 'simple', 'full', 'lite', 'lean', 'district', 'swapped', 'crossed', 'insanity']: - rom.write_byte(0x18004C, 0x01) + + if world.shuffle_followers[player]: + from ItemList import follower_locations, follower_pickups + + for loc_name, address in follower_locations.items(): + loc = world.get_location(loc_name, player) + rom.write_byte(address, follower_pickups[loc.item.name]) + + rom.write_byte(0x18004C, 0x02) # enable follower shuffle + rom.write_byte(snes_to_pc(0x1BBD3A), 0x80) # allow all followers thru entrances + rom.write_bytes(snes_to_pc(0x1DFC70), [0xEA, 0xEA]) # allow followers at dig game + rom.write_byte(snes_to_pc(0x02823B), 0x80) # allow super bomb indoors + rom.write_byte(snes_to_pc(0x0283FB), 0x80) # allow maiden to go outside + rom.write_bytes(snes_to_pc(0x02D6F2), [0xEA, 0xEA]) # disable old man checkpoint + rom.write_byte(snes_to_pc(0x05DEFA), 0xAF) # no follower despawn at uncle + rom.write_byte(snes_to_pc(0x05DF3C), 0xAF) # no follower despawn at uncle + rom.write_bytes(snes_to_pc(0x079448), [0xEA, 0xEA]) # dont draw super bomb while falling into holes + rom.write_byte(snes_to_pc(0x079595), 0x80) # allow super bomb to follow into OW holes + rom.write_bytes(snes_to_pc(0x07A132), [0xEA, 0xEA]) # allow bomb use with super bomb + rom.write_byte(snes_to_pc(0x07A4B4), 0x80) # allow ether use with super bomb + rom.write_byte(snes_to_pc(0x07A589), 0x80) # allow bombos use with super bomb + rom.write_byte(snes_to_pc(0x07A66B), 0x80) # allow quake use with super bomb + rom.write_byte(snes_to_pc(0x07A919), 0x80) # disable kiki dialogue during mirror + rom.write_byte(snes_to_pc(0x07AAC5), 0xAF) # keep all followers after mirroring + rom.write_byte(snes_to_pc(0x08DED6), 0x80) # allow locksmith to follow with flute + rom.write_bytes(snes_to_pc(0x09A045), [0xEA, 0xEA]) # allow super bomb to follow into UW holes + rom.write_byte(snes_to_pc(0x09ACDF), 0x6B) # allow kiki/locksmith to follow after screen transition + + if world.enemy_shuffle[player] != 'none': + # informs zelda and maiden to draw over gfx slots that are guaranteed unused + rom.write_bytes(0x1802C1, world.data_tables[player].room_headers[0x80].free_gfx[0:2]) + rom.write_bytes(0x1802C7, world.data_tables[player].room_headers[0x45].free_gfx[0:2]) + else: + from OverworldShuffle import can_reach_smith + if not can_reach_smith(world, player): + rom.write_byte(0x180043, 0x01) # patch for deleting smith on S+Q + if world.shuffle[player] in ['restricted', 'simple', 'full', 'lite', 'lean', 'district', 'swapped', 'crossed', 'insanity']: + rom.write_byte(0x18004C, 0x01) # allow smith into multi-entrance caves in appropriate shuffles # set correct flag for hera basement item hera_basement = world.get_location('Tower of Hera - Basement Cage', player) diff --git a/Rules.py b/Rules.py index 29c95a9b..68dfda95 100644 --- a/Rules.py +++ b/Rules.py @@ -252,6 +252,7 @@ def global_rules(world, player): set_rule(world.get_location('Zora\'s Ledge', player), lambda state: state.has('Flippers', player)) set_rule(world.get_location('Flute Spot', player), lambda state: state.has('Shovel', player)) set_rule(world.get_location('Bombos Tablet', player), lambda state: state.has('Book of Mudora', player) and state.has_beam_sword(player)) + set_rule(world.get_location('Kiki Assistance', player), lambda state: state.has('Pick Up Kiki', player)) # Can S&Q with chest set_rule(world.get_location('Middle Aged Man', player), lambda state: state.has('Pick Up Purple Chest', player)) # Can S&Q with chest set_rule(world.get_location('Purple Chest', player), lambda state: state.has('Deliver Purple Chest', player)) # Can S&Q with chest set_rule(world.get_location('Sunken Treasure', player), lambda state: state.has('Open Floodgate', player)) @@ -406,6 +407,7 @@ def global_rules(world, player): set_rule(world.get_entrance('Bonk Fairy (Dark)', player), lambda state: state.has_Boots(player)) set_rule(world.get_entrance('Dark Lake Hylia Ledge Spike Cave', player), lambda state: state.can_lift_rocks(player)) + set_rule(world.get_entrance('Palace of Darkness', player), lambda state: state.has('Dark Palace Opened', player)) set_rule(world.get_entrance('Skull Woods Final Section', player), lambda state: state.has('Fire Rod', player)) set_rule(world.get_entrance('Misery Mire', player), lambda state: state.has_sword(player) and state.has_misery_mire_medallion(player)) # sword required to cast magic (!) set_rule(world.get_entrance('Turtle Rock', player), lambda state: state.has('Turtle Opened', player)) @@ -1128,6 +1130,8 @@ def ow_bunny_rules(world, player): add_bunny_rule(world.get_location('Maze Race', player), player) add_bunny_rule(world.get_location('Flute Spot', player), player) add_bunny_rule(world.get_location('Catfish', player), player) + add_bunny_rule(world.get_location('Kiki', player), player) + add_bunny_rule(world.get_location('Locksmith', player), player) # entrances add_bunny_rule(world.get_entrance('Lost Woods Hideout Drop', player), player) @@ -1148,7 +1152,6 @@ def ow_bunny_rules(world, player): add_bunny_rule(world.get_entrance('Skull Woods Final Section', player), player) # bunny cannot use fire rod add_bunny_rule(world.get_entrance('Hookshot Cave', player), player) add_bunny_rule(world.get_entrance('Thieves Town', player), player) # bunny cannot pull - add_bunny_rule(world.get_entrance('Palace of Darkness', player), player) # kiki needs pearl add_bunny_rule(world.get_entrance('Hammer Peg Cave', player), player) add_bunny_rule(world.get_entrance('Bonk Fairy (Dark)', player), player) add_bunny_rule(world.get_entrance('Misery Mire', player), player) @@ -1639,7 +1642,6 @@ def standard_rules(world, player): else: add_rule(loc, lambda state: standard_escape_rule(state)) - set_rule(world.get_location('Zelda Pickup', player), lambda state: state.has('Big Key (Escape)', player)) set_rule(world.get_entrance('Hyrule Castle Tapestry Backwards', player), lambda state: state.has('Zelda Herself', player)) def check_rule_list(state, r_list): @@ -1702,7 +1704,7 @@ def set_bunny_rules(world, player, inverted): bunny_accessible_locations = ['Link\'s Uncle', 'Sahasrahla', 'Sick Kid', 'Lost Woods Hideout', 'Lumberjack Tree', 'Checkerboard Cave', 'Potion Shop', 'Spectacle Rock Cave', 'Pyramid', 'Old Man', 'Hype Cave - Generous Guy', 'Peg Cave', 'Bumper Cave Ledge', 'Dark Blacksmith Ruins', - 'Spectacle Rock', 'Bombos Tablet', 'Ether Tablet', 'Purple Chest', 'Blacksmith', + 'Spectacle Rock', 'Bombos Tablet', 'Ether Tablet', 'Kiki Assistance', 'Purple Chest', 'Blacksmith', 'Missing Smith', 'Master Sword Pedestal', 'Bottle Merchant', 'Sunken Treasure', 'Desert Ledge', 'Pyramid Crack', 'Big Bomb', 'Stumpy', 'Lost Old Man', 'Old Man Drop Off', 'Murahdahla', 'Kakariko Shop - Left', 'Kakariko Shop - Middle', 'Kakariko Shop - Right', diff --git a/data/base2current.bps b/data/base2current.bps index db46c22a..84b14dd6 100644 Binary files a/data/base2current.bps and b/data/base2current.bps differ diff --git a/docs/Customizer.md b/docs/Customizer.md index e7c5738c..c184aae3 100644 --- a/docs/Customizer.md +++ b/docs/Customizer.md @@ -294,6 +294,16 @@ There are some additional non-standard keywords available that can be added as s * `RandomWeapon` - This grants the player with the same random weapon options that Uncle gives in standard starts, including ammo for that weapon. * `Beat Agahnim 1` - This enables post-Agahnim world state by default and flags Agahnim 1 as defeated. * `Return Old Man` - This enables the Mountain Cave starting location by default. This also removes one item location from the game. +* Followers - These are the companions that can follow Link until you complete their quest. These can only be added if you have `Follower Shuffle` enabled. If standard start is enabled, a follower will only start following after the escape has been completed, unless it is set to start with Zelda. + * `Zelda Herself` + * `Escort Old Man` + * `Maiden Rescued` + * `Get Frog` + * `Sign Vandalized` (Locksmith) + * `Pick Up Kiki` + * `Pick Up Purple Chest` + * `Pick Up Big Bomb` + * `RandomFollower` - This will pick any of the above as a random follower to start ##### Known Issue diff --git a/docs/customizer_example.yaml b/docs/customizer_example.yaml index 882a9e63..5390eeb3 100644 --- a/docs/customizer_example.yaml +++ b/docs/customizer_example.yaml @@ -17,6 +17,7 @@ settings: pseudoboots: true pottery: keys shopsanity: true + shuffle_followers: true shuffle: crossed shufflelinks: true ow_shuffle: parallel diff --git a/resources/app/cli/args.json b/resources/app/cli/args.json index 8b9fa77c..d042d93b 100644 --- a/resources/app/cli/args.json +++ b/resources/app/cli/args.json @@ -87,6 +87,10 @@ "expert" ] }, + "shuffle_followers": { + "action": "store_true", + "type": "bool" + }, "shopsanity": { "action": "store_true", "type": "bool" diff --git a/resources/app/cli/lang/en.json b/resources/app/cli/lang/en.json index 2bf10795..44835df1 100644 --- a/resources/app/cli/lang/en.json +++ b/resources/app/cli/lang/en.json @@ -263,6 +263,9 @@ "ow_whirlpool": [ "Whirlpools will be shuffled and paired together." ], + "shuffle_followers": [ + "Followers like Purple Chest and Old Man are shuffled." + ], "bonk_drops": [ "Bonk drops from trees, rocks, and statues are shuffled with the item pool." ], diff --git a/resources/app/gui/lang/en.json b/resources/app/gui/lang/en.json index 8affe105..8632601f 100644 --- a/resources/app/gui/lang/en.json +++ b/resources/app/gui/lang/en.json @@ -283,8 +283,7 @@ "randomizer.generation.rom.dialog.allfiles": "All Files", "randomizer.item.hints": "Hints", - "randomizer.item.race": "Generate \"Race\" ROM", - "randomizer.item.retro": "Retro mode", + "randomizer.item.race": "Race", "randomizer.item.pseudoboots": "Pseudoboots", "randomizer.item.collection_rate": "Display Collection Rate", "randomizer.item.mirrorscroll": "Mirror Scroll", @@ -371,6 +370,8 @@ "randomizer.item.timer.ohko": "OHKO", "randomizer.item.timer.timed-countdown": "Timed Countdown", + "randomizer.item.followers": "Followers", + "randomizer.item.shopsanity": "Shopsanity", "randomizer.item.bonk_drops": "Bonk Drops", diff --git a/resources/app/gui/randomize/item/widgets.json b/resources/app/gui/randomize/item/widgets.json index 402fde7c..8729e33a 100644 --- a/resources/app/gui/randomize/item/widgets.json +++ b/resources/app/gui/randomize/item/widgets.json @@ -124,6 +124,10 @@ "bonk_drops": { "type": "checkbox", "default": false + }, + "followers": { + "type": "checkbox", + "default": false } }, "leftPoolFrame": { diff --git a/source/classes/CustomSettings.py b/source/classes/CustomSettings.py index dfc734e5..539b9c06 100644 --- a/source/classes/CustomSettings.py +++ b/source/classes/CustomSettings.py @@ -100,6 +100,7 @@ class CustomSettings(object): args.ow_mixed[p] = get_setting(settings['ow_mixed'], args.ow_mixed[p]) args.ow_whirlpool[p] = get_setting(settings['ow_whirlpool'], args.ow_whirlpool[p]) args.ow_fluteshuffle[p] = get_setting(settings['ow_fluteshuffle'], args.ow_fluteshuffle[p]) + args.shuffle_followers[p] = get_setting(settings['shuffle_followers'], args.shuffle_followers[p]) args.bonk_drops[p] = get_setting(settings['bonk_drops'], args.bonk_drops[p]) args.shuffle[p] = get_setting(settings['shuffle'], args.shuffle[p]) args.door_shuffle[p] = get_setting(settings['door_shuffle'], args.door_shuffle[p]) @@ -348,6 +349,7 @@ class CustomSettings(object): settings_dict[p]['ow_mixed'] = world.owMixed[p] settings_dict[p]['ow_whirlpool'] = world.owWhirlpoolShuffle[p] settings_dict[p]['ow_fluteshuffle'] = world.owFluteShuffle[p] + settings_dict[p]['shuffle_followers'] = world.shuffle_followers[p] settings_dict[p]['bonk_drops'] = world.shuffle_bonk_drops[p] settings_dict[p]['shuffle'] = world.shuffle[p] settings_dict[p]['door_shuffle'] = world.doorShuffle[p] diff --git a/source/classes/constants.py b/source/classes/constants.py index 7ceb16e3..c8e017ef 100644 --- a/source/classes/constants.py +++ b/source/classes/constants.py @@ -74,6 +74,7 @@ SETTINGSTOPROCESS = { "restrict_boss_items": "restrict_boss_items", "itemfunction": "item_functionality", "timer": "timer", + "followers": "shuffle_followers", "shopsanity": "shopsanity", "bonk_drops": "bonk_drops", diff --git a/source/dungeon/DungeonStitcher.py b/source/dungeon/DungeonStitcher.py index b521bfcd..29a2c32f 100644 --- a/source/dungeon/DungeonStitcher.py +++ b/source/dungeon/DungeonStitcher.py @@ -349,7 +349,8 @@ def determine_paths_for_dungeon(world, player, all_regions, name): paths.append(boss) if 'Thieves Boss' in all_r_names: paths.append('Thieves Boss') - if world.get_dungeon("Thieves Town", player).boss.enemizer_name == 'Blind': + if world.get_dungeon("Thieves Town", player).boss.enemizer_name == 'Blind' \ + and not world.shuffle_followers[player]: paths.append(('Thieves Blind\'s Cell', 'Thieves Boss')) for drop_check in drop_path_checks: if drop_check in all_r_names: diff --git a/source/dungeon/RoomHeader.py b/source/dungeon/RoomHeader.py index 5dc0bef7..72fdc351 100644 --- a/source/dungeon/RoomHeader.py +++ b/source/dungeon/RoomHeader.py @@ -315,6 +315,7 @@ class RoomHeader: self.byte_0 = byte_array[0] # bg2, collision, lights out self.sprite_sheet = byte_array[3] # sprite gfx # self.effect = byte_array[4] + self.free_gfx = [] def write_to_rom(self, rom, base_address): room_offest = self.room_id*14 diff --git a/source/enemizer/Bossmizer.py b/source/enemizer/Bossmizer.py index 85b8a3c2..204d64b2 100644 --- a/source/enemizer/Bossmizer.py +++ b/source/enemizer/Bossmizer.py @@ -178,8 +178,9 @@ def boss_writes(world, player, rom): remove_shell_from_boss_room(data_tables, dungeon.name, level, 0xF95) if boss.name != 'Blind' and dungeon.name == 'Thieves Town' and level is None: rom.write_byte(snes_to_pc(0x368101), 1) # set blind boss door flag - # maiden is deleted - del data_tables.uw_enemy_table.room_map[0x45][0] + if not world.shuffle_followers[player]: + # maiden is deleted + del data_tables.uw_enemy_table.room_map[0x45][0] if not arrghus_can_swim and water_tiles_on: remove_water_tiles(data_tables) diff --git a/source/enemizer/Enemizer.py b/source/enemizer/Enemizer.py index 90c7ef34..f4e89207 100644 --- a/source/enemizer/Enemizer.py +++ b/source/enemizer/Enemizer.py @@ -3,7 +3,7 @@ from Utils import snes_to_pc from source.dungeon.EnemyList import SpriteType, EnemySprite, sprite_translation from source.dungeon.RoomList import Room010C -from source.enemizer.SpriteSheets import sub_group_choices +from source.enemizer.SpriteSheets import sub_group_choices, sheets_with_free_gfx from source.enemizer.SpriteSheets import randomize_underworld_sprite_sheets, randomize_overworld_sprite_sheets from source.enemizer.TilePattern import tile_patterns @@ -314,6 +314,21 @@ def randomize_underworld_rooms(data_tables, world, player, custom_uw): done = False while not done: chosen_sheet = random.choice(candidate_sheets) + if world.shuffle_followers[player] and room_id in [0x80, 0x45]: + initial_chosen = chosen_sheet + while True: + candidate_sheets.remove(chosen_sheet) + free_gfx = next((sheets_with_free_gfx[s] for s in chosen_sheet.sub_groups if s in sheets_with_free_gfx), None) + if free_gfx: + data_tables.room_headers[room_id].free_gfx = free_gfx + break + elif len(candidate_sheets): + chosen_sheet = random.choice(candidate_sheets) + else: + chosen_sheet = initial_chosen + # TODO: This shouldn't happen for the current use case + # May need to limit the candidate_sprites below if needing gfx slots + break data_tables.room_headers[room_id].sprite_sheet = chosen_sheet.id - 0x40 candidate_sprites = get_possible_enemy_sprites(room_id, chosen_sheet, uw_candidates, data_tables) randomized = True diff --git a/source/enemizer/SpriteSheets.py b/source/enemizer/SpriteSheets.py index 3dd8cb29..5d3558a4 100644 --- a/source/enemizer/SpriteSheets.py +++ b/source/enemizer/SpriteSheets.py @@ -476,6 +476,34 @@ required_boss_sheets = {EnemySprite.ArmosKnight: 9, EnemySprite.Lanmolas: 11, En EnemySprite.Blind: 32, EnemySprite.Kholdstare: 22, EnemySprite.Vitreous: 22, EnemySprite.TrinexxRockHead: 23} +sheets_with_free_gfx = { + # intended for identifying gfx slots on each sheet that are unused during general enemization + # (ie. Catfish gfx unused when used elsewhere other than the usual Catfish screen) + # TODO: Could also provide sprite ID/s of replaced gfx slots indicated to be used as verification + 0x0E: [0x08, 0x0C], + 0x10: [0xCC, 0xCE, 0xEC, 0xEE], + 0x11: [0xEA, 0xEC, 0xEE], + 0x12: [0x88, 0x8A, 0xAA, 0x8C, 0xAC, 0x8E, 0xAE], + 0x13: [0xA2, 0xA4], + 0x14: [0xC0, 0xC2, 0xC4, 0xE0, 0xE2], + 0x15: [0xC8, 0xEE], + 0x18: [0x86, 0x8C, 0x8E], + 0x19: [0xCE, 0xEC, 0xEE], + 0x1C: [0xA0, 0xAC, 0xAE], + 0x22: [0x8C, 0x8E, 0xAA, 0xAC, 0xAE], + 0x24: [0xAC, 0xAE], + 0x26: [0xA6, 0xA8, 0xAA, 0xAC, 0xAE], + 0x27: [0x84, 0xA4], + 0x29: [0x82, 0x84], + 0x2A: [0x80, 0x82, 0x84, 0x86, 0x88], + 0x2E: [0x80, 0x82, 0x84, 0x86, 0x88], + 0x2F: [0x2C, 0x0A, 0x0C, 0x0E, 0x2E, 0x24], + 0x36: [0xE7, 0xE9, 0xEB, 0xED, 0xC7, 0xC9, 0xCB, 0xCD], + 0x48: [0x2B, 0x2D], + 0x52: [0xE8, 0xC6, 0xC8, 0xCE, 0xEE, 0xCA, 0xCC, 0xEA], + 0x53: [0xE8, 0xEA, 0xCA, 0xCC, 0xC6, 0xC8] +} + class SpriteSheet: def __init__(self, id, default_sub_groups): diff --git a/source/tools/MysteryUtils.py b/source/tools/MysteryUtils.py index 93a92164..73d600e2 100644 --- a/source/tools/MysteryUtils.py +++ b/source/tools/MysteryUtils.py @@ -131,6 +131,7 @@ def roll_settings(weights): ret.ow_whirlpool = get_choice_bool('whirlpool_shuffle') overworld_flute = get_choice('flute_shuffle') ret.ow_fluteshuffle = overworld_flute if overworld_flute != 'none' else 'vanilla' + ret.shuffle_followers = get_choice_bool('shuffle_followers') ret.bonk_drops = get_choice_bool('bonk_drops') entrance_shuffle = get_choice('entrance_shuffle') ret.shuffle = entrance_shuffle if entrance_shuffle != 'none' else 'vanilla'