diff --git a/Randomizer.py b/Randomizer.py index a0b47ef..92f13b0 100644 --- a/Randomizer.py +++ b/Randomizer.py @@ -5016,72 +5016,74 @@ def start_randomizer(rom, settings): if settings['Num'] > repeat: repeat = settings['Num'] settings.pop('Num') - if settings['Patch']: - Patch = True - else: - Patch = False - settings.pop('Patch') - for loop in range(repeat): - initialize() - SeedSettings = settings.copy() - if Debug: - print('Debug generation enabled') - if loop > 0: - SeedValue = str(random.randrange(sys.maxsize)) - Difficulty = SeedSettings['Difficulty'] - DamageRuns = SeedSettings['DamageRuns'] - random.seed(SeedValue + str(SeedSettings)) - World = Graph.Game(BaseGame) - World.RemoveNodeFromRoom('Room-S2-07', 'S2-10') - World.RemoveNodeFromRoom('Room-S2-0D', 'S2-1E') - World.RemoveNodeFromRoom('Room-S3-07', 'S3-10') - World.RemoveNodeFromRoom('Room-S3-12', 'S3-2B') - World.RemoveNodeFromRoom('Room-S5-15', 'S5-2A') - World.AddNodeToRoom('Room-S2-1F', 'S2-10') - World.AddNodeToRoom('Room-S2-2E', 'S2-1E') - World.AddNodeToRoom('Room-S3-16', 'S3-10') - World.AddNodeToRoom('Room-S3-17', 'S3-2B') - World.AddNodeToRoom('Room-S5-16', 'S5-2A') - World.UpdateDoorConnection('S0-4A', 'S0-61') - World.UpdateDoorConnection('S0-96', 'S0-22') - World.UpdateDoorConnection('S0-98', 'S0-20') - World.UpdateDoorConnection('S2-13', 'S2-45') - World.UpdateDoorConnection('S2-19', 'S2-2F') - World.UpdateDoorConnection('S2-1B', 'S2-68') - World.UpdateDoorConnection('S2-23', 'S2-69') - World.UpdateDoorConnection('S2-5F', 'S2-6A') - World.UpdateDoorConnection('S2-6E', 'S2-70') - World.UpdateDoorConnection('S3-2D', 'S3-2E') - World.UpdateDoorConnection('S5-28', 'S5-6C') - AreaItemLocations = list() - for area in range(7): - AreaItemLocations.append(list()) + if settings['Patch']: + Patch = True + else: + Patch = False + settings.pop('Patch') - with open(os.path.join('.', 'data', 'NodeData.json')) as jsonFile: - RoomNodes = json.load(jsonFile) - for area in RoomNodes: - areaIndex = list(RoomNodes.keys()).index(area) - for node in RoomNodes[area]: - name = node.get('Name') - room = node.get('Room') - item = node.get('Item') - nodeType = node.get('Type') - World.AddNodeToRoom('Room-S{}-{:02X}'.format(areaIndex, int(room, 16)), name) - if item == 'Missile' or item == 'Power Bomb': - World.add_to_minors(name) - elif nodeType == 'Boss': + for loop in range(repeat): + initialize() + SeedSettings = settings.copy() + if Debug: + print('Debug generation enabled') + if loop > 0: + SeedValue = str(random.randrange(sys.maxsize)) + + Difficulty = SeedSettings['Difficulty'] + DamageRuns = SeedSettings['DamageRuns'] + random.seed(SeedValue + str(SeedSettings)) + World = Graph.Game(BaseGame) + World.RemoveNodeFromRoom('Room-S2-07', 'S2-10') + World.RemoveNodeFromRoom('Room-S2-0D', 'S2-1E') + World.RemoveNodeFromRoom('Room-S3-07', 'S3-10') + World.RemoveNodeFromRoom('Room-S3-12', 'S3-2B') + World.RemoveNodeFromRoom('Room-S5-15', 'S5-2A') + World.AddNodeToRoom('Room-S2-1F', 'S2-10') + World.AddNodeToRoom('Room-S2-2E', 'S2-1E') + World.AddNodeToRoom('Room-S3-16', 'S3-10') + World.AddNodeToRoom('Room-S3-17', 'S3-2B') + World.AddNodeToRoom('Room-S5-16', 'S5-2A') + World.UpdateDoorConnection('S0-4A', 'S0-61') + World.UpdateDoorConnection('S0-96', 'S0-22') + World.UpdateDoorConnection('S0-98', 'S0-20') + World.UpdateDoorConnection('S2-13', 'S2-45') + World.UpdateDoorConnection('S2-19', 'S2-2F') + World.UpdateDoorConnection('S2-1B', 'S2-68') + World.UpdateDoorConnection('S2-23', 'S2-69') + World.UpdateDoorConnection('S2-5F', 'S2-6A') + World.UpdateDoorConnection('S2-6E', 'S2-70') + World.UpdateDoorConnection('S3-2D', 'S3-2E') + World.UpdateDoorConnection('S5-28', 'S5-6C') + AreaItemLocations = list() + for area in range(7): + AreaItemLocations.append(list()) + + with open(os.path.join('.', 'data', 'NodeData.json')) as jsonFile: + RoomNodes = json.load(jsonFile) + for area in RoomNodes: + areaIndex = list(RoomNodes.keys()).index(area) + for node in RoomNodes[area]: + name = node.get('Name') + room = node.get('Room') + item = node.get('Item') + nodeType = node.get('Type') + World.AddNodeToRoom('Room-S{}-{:02X}'.format(areaIndex, int(room, 16)), name) + if item == 'Missile' or item == 'Power Bomb': + World.add_to_minors(name) + elif nodeType == 'Boss': + World.add_to_majors(name) + BossLocations.append(name) + else: + if nodeType == 'Data' or item == 'E-Tank': World.add_to_majors(name) - BossLocations.append(name) - else: - if nodeType == 'Data' or item == 'E-Tank': - World.add_to_majors(name) - if name == 'Data S3': - BossLocations.append(name) - if not 'Item' in name: - if not nodeType == 'Boss': - if nodeType == 'Data': - pass - AreaItemLocations[areaIndex].append(name) + if name == 'Data S3': + BossLocations.append(name) + if not 'Item' in name: + if not nodeType == 'Boss': + if nodeType == 'Data': + pass + AreaItemLocations[areaIndex].append(name) World.ConnectAllNodes() StartLocation = 'S0-00'