actually launch the randomization
parent
bd7e1bc15d
commit
409efe14ac
130
Randomizer.py
130
Randomizer.py
|
@ -5016,72 +5016,74 @@ def start_randomizer(rom, settings):
|
||||||
if settings['Num'] > repeat:
|
if settings['Num'] > repeat:
|
||||||
repeat = settings['Num']
|
repeat = settings['Num']
|
||||||
settings.pop('Num')
|
settings.pop('Num')
|
||||||
if settings['Patch']:
|
if settings['Patch']:
|
||||||
Patch = True
|
Patch = True
|
||||||
else:
|
else:
|
||||||
Patch = False
|
Patch = False
|
||||||
settings.pop('Patch')
|
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())
|
|
||||||
|
|
||||||
with open(os.path.join('.', 'data', 'NodeData.json')) as jsonFile:
|
for loop in range(repeat):
|
||||||
RoomNodes = json.load(jsonFile)
|
initialize()
|
||||||
for area in RoomNodes:
|
SeedSettings = settings.copy()
|
||||||
areaIndex = list(RoomNodes.keys()).index(area)
|
if Debug:
|
||||||
for node in RoomNodes[area]:
|
print('Debug generation enabled')
|
||||||
name = node.get('Name')
|
if loop > 0:
|
||||||
room = node.get('Room')
|
SeedValue = str(random.randrange(sys.maxsize))
|
||||||
item = node.get('Item')
|
|
||||||
nodeType = node.get('Type')
|
Difficulty = SeedSettings['Difficulty']
|
||||||
World.AddNodeToRoom('Room-S{}-{:02X}'.format(areaIndex, int(room, 16)), name)
|
DamageRuns = SeedSettings['DamageRuns']
|
||||||
if item == 'Missile' or item == 'Power Bomb':
|
random.seed(SeedValue + str(SeedSettings))
|
||||||
World.add_to_minors(name)
|
World = Graph.Game(BaseGame)
|
||||||
elif nodeType == 'Boss':
|
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)
|
World.add_to_majors(name)
|
||||||
BossLocations.append(name)
|
if name == 'Data S3':
|
||||||
else:
|
BossLocations.append(name)
|
||||||
if nodeType == 'Data' or item == 'E-Tank':
|
if not 'Item' in name:
|
||||||
World.add_to_majors(name)
|
if not nodeType == 'Boss':
|
||||||
if name == 'Data S3':
|
if nodeType == 'Data':
|
||||||
BossLocations.append(name)
|
pass
|
||||||
if not 'Item' in name:
|
AreaItemLocations[areaIndex].append(name)
|
||||||
if not nodeType == 'Boss':
|
|
||||||
if nodeType == 'Data':
|
|
||||||
pass
|
|
||||||
AreaItemLocations[areaIndex].append(name)
|
|
||||||
|
|
||||||
World.ConnectAllNodes()
|
World.ConnectAllNodes()
|
||||||
StartLocation = 'S0-00'
|
StartLocation = 'S0-00'
|
||||||
|
|
Loading…
Reference in New Issue