From 302633dc733022d91873fcc3a60e15548e3be4a3 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sun, 17 Oct 2021 20:32:17 -0500 Subject: [PATCH] Added new experimental Lite+ ER mode --- BaseClasses.py | 4 +- EntranceShuffle.py | 53 +++++++++++++++++-- ItemList.py | 2 +- Rom.py | 2 +- Rules.py | 2 +- resources/app/cli/args.json | 1 + resources/app/gui/lang/en.json | 1 + .../app/gui/randomize/entrando/widgets.json | 1 + 8 files changed, 57 insertions(+), 9 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index efe3adf6..ca89ba13 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -120,7 +120,7 @@ class World(object): set_player_attr('can_access_trock_front', None) set_player_attr('can_access_trock_big_chest', None) set_player_attr('can_access_trock_middle', None) - set_player_attr('fix_fake_world', logic[player] not in ['owglitches', 'nologic'] or shuffle[player] in ['lite', 'crossed', 'insanity', 'madness_legacy']) + set_player_attr('fix_fake_world', logic[player] not in ['owglitches', 'nologic'] or shuffle[player] in ['lite', 'liteplus', 'crossed', 'insanity', 'madness_legacy']) set_player_attr('mapshuffle', False) set_player_attr('compassshuffle', False) set_player_attr('keyshuffle', False) @@ -2950,7 +2950,7 @@ class Pot(object): # byte 0: DDOO OEEE (DR, OR, ER) dr_mode = {"basic": 1, "crossed": 2, "vanilla": 0} or_mode = {"vanilla": 0, "parallel": 1, "full": 1} -er_mode = {"vanilla": 0, "simple": 1, "restricted": 2, "full": 3, "lite": 4, "crossed": 5, "insanity": 6, "dungeonsfull": 7, "dungeonssimple": 8} +er_mode = {"vanilla": 0, "simple": 1, "restricted": 2, "full": 3, "lite": 4, "liteplus": 5, "crossed": 6, "insanity": 7, "dungeonsfull": 8, "dungeonssimple": 9} # byte 1: LLLW WSSR (logic, mode, sword, retro) logic_mode = {"noglitches": 0, "minorglitches": 1, "nologic": 2, "owglitches": 3, "majorglitches": 4} diff --git a/EntranceShuffle.py b/EntranceShuffle.py index 1e9180e7..f65c55fc 100644 --- a/EntranceShuffle.py +++ b/EntranceShuffle.py @@ -413,6 +413,51 @@ def link_entrances(world, player): bomb_shop = bomb_shop_doors.pop() connect_entrance(world, bomb_shop, 'Big Bomb Shop', player) + # place remaining doors + connect_doors(world, list(entrance_pool), list(exit_pool), player) + elif world.shuffle[player] == 'liteplus': + for entrancename, exitname in default_connections + ([] if world.shopsanity[player] else default_shop_connections): + connect_logical(world, entrancename, exitname, player, False) + if invFlag: + world.get_entrance('Dark Sanctuary Hint Exit', player).connect(world.get_entrance('Dark Sanctuary Hint', player).parent_region) + + suppress_spoiler = False + + # place links house + links_house = place_links_house(world, sectors, player) + + # shuffle dungeons + #full_shuffle_dungeons(world, Dungeon_Exits, player) + skull_woods_shuffle(world, player) + + # shuffle dropdowns + scramble_holes(world, player) + + caves = list(Cave_Exits + Dungeon_Exits + Cave_Three_Exits + Old_Man_House) + + # place connectors in inaccessible regions + connector_entrances = [e for e in list(zip(*default_connector_connections))[0] + list(zip(*default_dungeon_connections))[0] if e in entrance_pool] + connect_inaccessible_regions(world, connector_entrances, [], caves, player) + + # place old man, has limited options + connector_entrances = [e for e in connector_entrances if e in entrance_pool] + place_old_man(world, list(connector_entrances), player) + + # shuffle remaining connectors + connector_entrances = [e for e in connector_entrances if e in entrance_pool] + connect_caves(world, connector_entrances, [], caves, player) + + # place blacksmith, has limited options + place_blacksmith(world, links_house, player) + + # place bomb shop, has limited options + bomb_shop_doors = list(entrance_pool) + if world.logic[player] in ['noglitches', 'minorglitches'] or (invFlag != (0x1b in world.owswaps[player][0] and world.owMixed[player])): + bomb_shop_doors = [e for e in entrance_pool if e not in ['Pyramid Fairy']] + random.shuffle(bomb_shop_doors) + bomb_shop = bomb_shop_doors.pop() + connect_entrance(world, bomb_shop, 'Big Bomb Shop', player) + # place remaining doors connect_doors(world, list(entrance_pool), list(exit_pool), player) elif world.shuffle[player] == 'crossed': @@ -959,7 +1004,7 @@ def scramble_holes(world, player): hole_targets.append(('Pyramid Exit', 'Pyramid')) # shuffle sanctuary hole in same world as other HC entrances - if world.shuffle[player] not in ['lite', 'crossed']: + if world.shuffle[player] not in ['lite', 'liteplus', 'crossed']: drop_owid_map = { # owid, is_light_world 'Lost Woods Hideout Stump': (0x00, True), 'Lumberjack Tree Cave': (0x02, True), @@ -1291,7 +1336,7 @@ def place_links_house(world, sectors, player): return entrances links_house_doors = [i for i in get_link_candidates() if i in entrance_pool] - if world.shuffle[player] == 'lite': + if world.shuffle[player] in ['lite', 'liteplus']: links_house_doors = [e for e in links_house_doors if e in list(zip(*(default_item_connections + (default_shop_connections if world.shopsanity[player] else []))))[0]] links_house = random.choice(links_house_doors) connect_two_way(world, links_house, 'Links House Exit', player) @@ -1367,7 +1412,7 @@ def place_old_man(world, pool, player): region_name = 'West Dark Death Mountain (Top)' old_man_entrances = list(build_accessible_entrance_list(world, region_name, player, [], False, True, True)) old_man_entrances = [e for e in old_man_entrances if e != 'Old Man House (Bottom)'] - if world.shuffle[player] == 'lite': + if world.shuffle[player] in ['lite', 'liteplus']: old_man_entrances = [e for e in old_man_entrances if e in pool] random.shuffle(old_man_entrances) old_man_exit = None @@ -1465,7 +1510,7 @@ def connect_inaccessible_regions(world, lw_entrances, dw_entrances, caves, playe connect_inaccessible_regions(world, lw_entrances, dw_entrances, caves, player) # connect one connector at a time to ensure multiple connectors aren't assigned to the same inaccessible set of regions - if world.shuffle[player] in ['lite', 'crossed', 'insanity']: + if world.shuffle[player] in ['lite', 'liteplus', 'crossed', 'insanity']: combined_must_exit_regions = list(must_exit_regions + otherworld_must_exit_regions) if len(combined_must_exit_regions) > 0: random.shuffle(combined_must_exit_regions) diff --git a/ItemList.py b/ItemList.py index 5d135ff9..3bea81da 100644 --- a/ItemList.py +++ b/ItemList.py @@ -709,7 +709,7 @@ def balance_prices(world, player): def check_hints(world, player): - if world.shuffle[player] in ['simple', 'restricted', 'full', 'lite', 'crossed', 'insanity']: + if world.shuffle[player] in ['simple', 'restricted', 'full', 'lite', 'liteplus', 'crossed', 'insanity']: for shop, location_list in shop_to_location_table.items(): if shop in ['Capacity Upgrade', 'Light World Death Mountain Shop', 'Potion Shop']: continue # near the queen, near potions, and near 7 chests are fine diff --git a/Rom.py b/Rom.py index e1acf138..98a1913a 100644 --- a/Rom.py +++ b/Rom.py @@ -1599,7 +1599,7 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False): rom.write_bytes(0x02F539, [0xEA, 0xEA, 0xEA, 0xEA, 0xEA] if world.powder_patch_required[player] else [0xAD, 0xBF, 0x0A, 0xF0, 0x4F]) # allow smith into multi-entrance caves in appropriate shuffles - if world.shuffle[player] in ['restricted', 'full', 'lite', 'crossed', 'insanity'] or (world.shuffle[player] == 'simple' and world.mode[player] == 'inverted'): + if world.shuffle[player] in ['restricted', 'full', 'lite', 'liteplus', 'crossed', 'insanity'] or (world.shuffle[player] == 'simple' and world.mode[player] == 'inverted'): rom.write_byte(0x18004C, 0x01) # set correct flag for hera basement item diff --git a/Rules.py b/Rules.py index 382194cb..f9765866 100644 --- a/Rules.py +++ b/Rules.py @@ -844,7 +844,7 @@ def ow_rules(world, player): if world.mode[player] != 'inverted': set_rule(world.get_entrance('Agahnims Tower', player), lambda state: state.has('Cape', player) or state.has_beam_sword(player) or state.has('Beat Agahnim 1', player)) # barrier gets removed after killing agahnim, relevant for entrance shuffle set_rule(world.get_entrance('GT Entry Approach', player), lambda state: state.has_crystals(world.crystals_needed_for_gt[player], player)) - set_rule(world.get_entrance('GT Entry Leave', player), lambda state: state.has_crystals(world.crystals_needed_for_gt[player], player) or state.world.shuffle[player] in ('restricted', 'full', 'lite', 'crossed', 'insanity')) + set_rule(world.get_entrance('GT Entry Leave', player), lambda state: state.has_crystals(world.crystals_needed_for_gt[player], player) or state.world.shuffle[player] in ('restricted', 'full', 'lite', 'liteplus', 'crossed', 'insanity')) else: set_rule(world.get_entrance('Agahnims Tower', player), lambda state: state.has_crystals(world.crystals_needed_for_gt[player], player)) diff --git a/resources/app/cli/args.json b/resources/app/cli/args.json index bdb8eb83..d9a9f294 100644 --- a/resources/app/cli/args.json +++ b/resources/app/cli/args.json @@ -147,6 +147,7 @@ "restricted", "full", "lite", + "liteplus", "crossed", "insanity", "dungeonsfull", diff --git a/resources/app/gui/lang/en.json b/resources/app/gui/lang/en.json index 63ddc4ab..c76700b3 100644 --- a/resources/app/gui/lang/en.json +++ b/resources/app/gui/lang/en.json @@ -141,6 +141,7 @@ "randomizer.entrance.entranceshuffle.restricted": "Restricted", "randomizer.entrance.entranceshuffle.full": "Full", "randomizer.entrance.entranceshuffle.lite": "Lite", + "randomizer.entrance.entranceshuffle.liteplus": "Lite+", "randomizer.entrance.entranceshuffle.crossed": "Crossed", "randomizer.entrance.entranceshuffle.insanity": "Insanity", "randomizer.entrance.entranceshuffle.restricted_legacy": "Restricted (Legacy)", diff --git a/resources/app/gui/randomize/entrando/widgets.json b/resources/app/gui/randomize/entrando/widgets.json index 0a392da3..ff189cb4 100644 --- a/resources/app/gui/randomize/entrando/widgets.json +++ b/resources/app/gui/randomize/entrando/widgets.json @@ -11,6 +11,7 @@ "restricted", "full", "lite", + "liteplus", "crossed", "insanity", "dungeonsfull",