From cb1d4cc39ef675e69b9ca7f6726d03a31544fcdc Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Fri, 19 Jun 2020 01:31:32 +0200 Subject: [PATCH] apply local items in no_logic --- Rom.py | 3 +-- Rules.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Rom.py b/Rom.py index 6a72ebe4..2137d94e 100644 --- a/Rom.py +++ b/Rom.py @@ -76,8 +76,7 @@ class LocalRom(object): if not os.path.exists(local_path(os.path.join('data', 'basepatch.bmbp'))): create_patch_file(local_path('basepatch.sfc')) return - logging.info(local_path(os.path.join('data', 'basepatch.bmbp'))) - logging.info(os.path.isfile(local_path(os.path.join('data', 'basepatch.bmbp')))) + if os.path.isfile(local_path(os.path.join('data', 'basepatch.bmbp'))): _, target, buffer = create_rom_bytes(local_path(os.path.join('data', 'basepatch.bmbp'))) if self.verify(buffer): diff --git a/Rules.py b/Rules.py index 88603581..48ac31c7 100644 --- a/Rules.py +++ b/Rules.py @@ -7,7 +7,7 @@ from OverworldGlitchRules import overworld_glitches_rules def set_rules(world, player): - + locality_rules(world, player) if world.logic[player] == 'nologic': logging.getLogger('').info('WARNING! Seeds generated under this logic often require major glitches and may be impossible!') world.get_region('Menu', player).can_reach_private = lambda state: True @@ -130,15 +130,15 @@ def item_in_locations(state, item, player, locations): return True return False + def item_name(state, location, player): location = state.world.get_location(location, player) if location.item is None: return None return (location.item.name, location.item.player) -def global_rules(world, player): - # ganon can only carry triforce - add_item_rule(world.get_location('Ganon', player), lambda item: item.name == 'Triforce' and item.player == player) + +def locality_rules(world, player): if world.goal[player] == "localtriforcehunt": world.local_items[player].add('Triforce Piece') if world.local_items[player]: @@ -146,6 +146,11 @@ def global_rules(world, player): if location.player != player: for item in world.local_items[player]: forbid_item(location, item, player) + + +def global_rules(world, player): + # ganon can only carry triforce + add_item_rule(world.get_location('Ganon', player), lambda item: item.name == 'Triforce' and item.player == player) # determines which S&Q locations are available - hide from paths since it isn't an in-game location world.get_region('Menu', player).can_reach_private = lambda state: True for exit in world.get_region('Menu', player).exits: