diff --git a/Randomizer.py b/Randomizer.py index 946c17a..c2288b1 100644 --- a/Randomizer.py +++ b/Randomizer.py @@ -1869,637 +1869,428 @@ def randomize_game(graph): 'Mega Core-X': 0, 'Box-2': 500} print('Generating, please wait...') - while True: - if not gameBeatable == False: - if not init == False: - if not SeedSettings['SectorShuffle'] == True: - areaDoors = {1:[ - 'S1-6B', 'S1-68'], - 2:[ - 'S2-7F', 'S2-82'], - 3:[ - 'S3-59', 'S3-56'], - 4:[ - 'S4-6C', 'S4-6A'], - 5:[ - 'S5-02', 'S5-53'], - 6:[ - 'S6-51', 'S6-54']} - areaLayout = random.sample(range(1, 7), 6) - if SeedSettings['MajorMinor'] == True: - if areaLayout[2] != 1: - if areaLayout[2] != 2: - if areaLayout[3] != 1: - if areaLayout[3] != 2: - attemptedLayouts.append(areaLayout) - while True: - if areaLayout in attemptedLayouts: - areaLayout = random.sample(range(1, 7), 6) + while gameBeatable == False: + if init == False: + if SeedSettings['SectorShuffle'] == True: + areaDoors = {1:['S1-6B', 'S1-68'], + 2:['S2-7F', 'S2-82'], + 3:['S3-59', 'S3-56'], + 4:['S4-6C', 'S4-6A'], + 5:['S5-02', 'S5-53'], + 6:['S6-51', 'S6-54']} + areaLayout = random.sample(range(1, 7), 6) + if SeedSettings['MajorMinor'] == True: + while areaLayout[2] != 1 and areaLayout[2] != 2 and areaLayout[3] != 1 and areaLayout[3] != 2: + attemptedLayouts.append(areaLayout) + while areaLayout in attemptedLayouts: + areaLayout = random.sample(range(1, 7), 6) + else: + while areaLayout in attemptedLayouts: + areaLayout = random.sample(range(1, 7), 6) + attemptedLayouts.append(areaLayout) - while True: - pass + for area in areaLayout: + elevator = areaLayout.index(area) + if elevator == 0: + leftArea = areaLayout[5] + else: + leftArea = areaLayout[areaLayout.index(area) - 1] + if elevator == 5: + rightArea = areaLayout[0] + else: + rightArea = areaLayout[areaLayout.index(area) + 1] + if area == 1: + topTile = 19 + bottomTile = 35 + leftTile = 179 + rightTile = 180 + tileset = 17 + if leftArea > 2: + leftTube = 226 + leftArea + else: + leftTube = 235 + leftArea + if rightArea > 2: + rightTube = 9 + rightArea + elif rightArea == 2: + rightTube = 4 + else: + rightTube = 1 + graph.patcher.update({4857211: leftTube}) + graph.patcher.update({4857224: (leftTube + 16)}) + graph.patcher.update({4856958: rightTube}) + graph.patcher.update({4856975: (rightTube + 16)}) + elif area == 2: + topTile = 20 + bottomTile = 36 + leftTile = 181 + rightTile = 182 + tileset = 35 + if leftArea > 2: + leftTube = 9 + leftArea + elif leftArea == 2: + leftTube = 4 + else: + leftTube = 1 + if rightArea > 2: + rightTube = 226 + rightArea + else: + rightTube = 235 + rightArea + graph.patcher.update({5091931: leftTube}) + graph.patcher.update({5091944: (leftTube + 16)}) + graph.patcher.update({5092202: rightTube}) + graph.patcher.update({5092219: (rightTube + 16)}) + elif area == 3: + topTile = 21 + bottomTile = 37 + leftTile = 183 + rightTile = 184 + tileset = 36 + if leftArea > 2: + leftTube = 226 + leftArea + else: + leftTube = 235 + leftArea + if rightArea > 2: + rightTube = 9 + rightArea + elif rightArea == 2: + rightTube = 4 + else: + rightTube = 1 + graph.patcher.update({5254431: leftTube}) + graph.patcher.update({5254447: (leftTube + 16)}) + graph.patcher.update({5254714: rightTube}) + graph.patcher.update({5254731: (rightTube + 16)}) + elif area == 4: + topTile = 51 + bottomTile = 67 + leftTile = 195 + rightTile = 196 + tileset = 37 + if leftArea > 2: + leftTube = 9 + leftArea + elif leftArea == 2: + leftTube = 4 + else: + leftTube = 1 + if rightArea > 2: + rightTube = 226 + rightArea + else: + rightTube = 235 + rightArea + graph.patcher.update({5512395: leftTube}) + graph.patcher.update({5512408: (leftTube + 16)}) + graph.patcher.update({5512134: rightTube}) + graph.patcher.update({5512151: (rightTube + 16)}) + elif area == 5: + topTile = 52 + bottomTile = 68 + leftTile = 197 + rightTile = 198 + tileset = 38 + if leftArea > 2: + leftTube = 226 + leftArea + else: + leftTube = 235 + leftArea + if rightArea > 2: + rightTube = 226 + rightArea + else: + rightTube = 235 + rightArea + graph.patcher.update({5358711: leftTube}) + graph.patcher.update({5358724: (leftTube + 16)}) + graph.patcher.update({5361542: rightTube}) + graph.patcher.update({5361559: (rightTube + 16)}) + elif area == 6: + topTile = 24 + bottomTile = 40 + leftTile = 199 + rightTile = 200 + tileset = 39 + if leftArea > 2: + leftTube = 226 + leftArea + else: + leftTube = 235 + leftArea + if rightArea > 2: + rightTube = 226 + rightArea + else: + rightTube = 235 + rightArea + graph.patcher.update({5598427: leftTube}) + graph.patcher.update({5598440: (leftTube + 16)}) + graph.patcher.update({5598706: rightTube}) + graph.patcher.update({5598723: (rightTube + 16)}) + if elevator == 0: + graph.patcher.update({4669078: leftTile}) + graph.patcher.update({4669079: rightTile}) + graph.patcher.update({4669026: leftTile}) + graph.patcher.update({4669027: rightTile}) + graph.patcher.update({4670120: leftTile}) + graph.patcher.update({4670121: rightTile}) + graph.patcher.update({4670922: leftTile}) + graph.patcher.update({4670923: rightTile}) + graph.patcher.update({4671720: leftTile}) + graph.patcher.update({4671721: rightTile}) + graph.patcher.update({4672508: leftTile}) + graph.patcher.update({4672509: rightTile}) + graph.patcher.update({4673296: leftTile}) + graph.patcher.update({4673297: rightTile}) + graph.patcher.update({4674087: topTile}) + graph.patcher.update({4674099: bottomTile}) + graph.patcher.update({3945300: tileset}) + graph.patcher.update({5713644: (171 + area)}) + source = 'S0-47' + elif elevator == 1: + graph.patcher.update({4669038: leftTile}) + graph.patcher.update({4669039: rightTile}) + graph.patcher.update({4669028: leftTile}) + graph.patcher.update({4669029: rightTile}) + graph.patcher.update({4670106: leftTile}) + graph.patcher.update({4670107: rightTile}) + graph.patcher.update({4670908: leftTile}) + graph.patcher.update({4670909: rightTile}) + graph.patcher.update({4671708: leftTile}) + graph.patcher.update({4671709: rightTile}) + graph.patcher.update({4672494: leftTile}) + graph.patcher.update({4672495: rightTile}) + graph.patcher.update({4674067: leftTile}) + graph.patcher.update({4674068: rightTile}) + graph.patcher.update({4673301: topTile}) + graph.patcher.update({4673315: bottomTile}) + graph.patcher.update({3945240: tileset}) + graph.patcher.update({5713617: (171 + area)}) + source = 'S0-45' + elif elevator == 2: + graph.patcher.update({4669001: leftTile}) + graph.patcher.update({4669002: rightTile}) + graph.patcher.update({4669030: leftTile}) + graph.patcher.update({4669031: rightTile}) + graph.patcher.update({4670094: leftTile}) + graph.patcher.update({4670095: rightTile}) + graph.patcher.update({4670896: leftTile}) + graph.patcher.update({4670897: rightTile}) + graph.patcher.update({4671696: leftTile}) + graph.patcher.update({4671697: rightTile}) + graph.patcher.update({4673279: leftTile}) + graph.patcher.update({4673280: rightTile}) + graph.patcher.update({4674079: leftTile}) + graph.patcher.update({4674080: rightTile}) + graph.patcher.update({4672499: topTile}) + graph.patcher.update({4672513: bottomTile}) + graph.patcher.update({3945180: tileset}) + graph.patcher.update({5713597: (171 + area)}) + source = 'S0-43' + elif elevator == 3: + graph.patcher.update({4669012: leftTile}) + graph.patcher.update({4669013: rightTile}) + graph.patcher.update({4669057: leftTile}) + graph.patcher.update({4669058: rightTile}) + graph.patcher.update({4670884: leftTile}) + graph.patcher.update({4670885: rightTile}) + graph.patcher.update({4671684: leftTile}) + graph.patcher.update({4671685: rightTile}) + graph.patcher.update({4672489: leftTile}) + graph.patcher.update({4672490: rightTile}) + graph.patcher.update({4673291: leftTile}) + graph.patcher.update({4673292: rightTile}) + graph.patcher.update({4674091: leftTile}) + graph.patcher.update({4674092: rightTile}) + graph.patcher.update({4670111: topTile}) + graph.patcher.update({4670125: bottomTile}) + graph.patcher.update({3945000: tileset}) + graph.patcher.update({5713600: (171 + area)}) + source = 'S0-44' + elif elevator == 4: + graph.patcher.update({4669049: leftTile}) + graph.patcher.update({4669050: rightTile}) + graph.patcher.update({4669059: leftTile}) + graph.patcher.update({4669060: rightTile}) + graph.patcher.update({4670115: leftTile}) + graph.patcher.update({4670116: rightTile}) + graph.patcher.update({4671672: leftTile}) + graph.patcher.update({4671673: rightTile}) + graph.patcher.update({4672503: leftTile}) + graph.patcher.update({4672504: rightTile}) + graph.patcher.update({4673305: leftTile}) + graph.patcher.update({4673306: rightTile}) + graph.patcher.update({4674103: leftTile}) + graph.patcher.update({4674104: rightTile}) + graph.patcher.update({4670913: topTile}) + graph.patcher.update({4670927: bottomTile}) + graph.patcher.update({3945060: tileset}) + graph.patcher.update({5713621: (171 + area)}) + source = 'S0-46' + elif elevator == 5: + graph.patcher.update({4669089: leftTile}) + graph.patcher.update({4669090: rightTile}) + graph.patcher.update({4669061: leftTile}) + graph.patcher.update({4669062: rightTile}) + graph.patcher.update({4670129: leftTile}) + graph.patcher.update({4670130: rightTile}) + graph.patcher.update({4670917: leftTile}) + graph.patcher.update({4670918: rightTile}) + graph.patcher.update({4672517: leftTile}) + graph.patcher.update({4672518: rightTile}) + graph.patcher.update({4673319: leftTile}) + graph.patcher.update({4673320: rightTile}) + graph.patcher.update({4674115: leftTile}) + graph.patcher.update({4674116: rightTile}) + graph.patcher.update({4671701: topTile}) + graph.patcher.update({4671713: bottomTile}) + graph.patcher.update({3945120: tileset}) + graph.patcher.update({5713647: (171 + area)}) + source = 'S0-48' + destination = 'S{}-00'.format(area) + graph.UpdateDoorConnection(source, destination) + graph.UpdateDoorConnection(destination, source) + source = areaDoors.get(area)[0] + destination = areaDoors.get(leftArea)[1] + graph.UpdateDoorConnection(source, destination) + source = areaDoors.get(area)[1] + destination = areaDoors.get(rightArea)[0] + graph.UpdateDoorConnection(source, destination) - while areaLayout in attemptedLayouts: - areaLayout = random.sample(range(1, 7), 6) + graph.ConnectAllNodes() - attemptedLayouts.append(areaLayout) - for area in areaLayout: - elevator = areaLayout.index(area) - if elevator == 0: - leftArea = areaLayout[5] - else: - leftArea = areaLayout[areaLayout.index(area) - 1] - if elevator == 5: - rightArea = areaLayout[0] - else: - rightArea = areaLayout[areaLayout.index(area) + 1] - if area == 1: - topTile = 19 - bottomTile = 35 - leftTile = 179 - rightTile = 180 - tileset = 17 - if leftArea > 2: - leftTube = 226 + leftArea - else: - leftTube = 235 + leftArea - if rightArea > 2: - rightTube = 9 + rightArea - elif rightArea == 2: - rightTube = 4 - else: - rightTube = 1 - graph.patcher.update({4857211: leftTube}) - graph.patcher.update({4857224: (leftTube + 16)}) - graph.patcher.update({4856958: rightTube}) - graph.patcher.update({4856975: (rightTube + 16)}) - elif area == 2: - topTile = 20 - bottomTile = 36 - leftTile = 181 - rightTile = 182 - tileset = 35 - if leftArea > 2: - leftTube = 9 + leftArea - elif leftArea == 2: - leftTube = 4 - else: - leftTube = 1 - if rightArea > 2: - rightTube = 226 + rightArea - else: - rightTube = 235 + rightArea - graph.patcher.update({5091931: leftTube}) - graph.patcher.update({5091944: (leftTube + 16)}) - graph.patcher.update({5092202: rightTube}) - graph.patcher.update({5092219: (rightTube + 16)}) - elif area == 3: - topTile = 21 - bottomTile = 37 - leftTile = 183 - rightTile = 184 - tileset = 36 - if leftArea > 2: - leftTube = 226 + leftArea - else: - leftTube = 235 + leftArea - if rightArea > 2: - rightTube = 9 + rightArea - elif rightArea == 2: - rightTube = 4 - else: - rightTube = 1 - graph.patcher.update({5254431: leftTube}) - graph.patcher.update({5254447: (leftTube + 16)}) - graph.patcher.update({5254714: rightTube}) - graph.patcher.update({5254731: (rightTube + 16)}) - elif area == 4: - topTile = 51 - bottomTile = 67 - leftTile = 195 - rightTile = 196 - tileset = 37 - if leftArea > 2: - leftTube = 9 + leftArea - elif leftArea == 2: - leftTube = 4 - else: - leftTube = 1 - if rightArea > 2: - rightTube = 226 + rightArea - else: - rightTube = 235 + rightArea - graph.patcher.update({5512395: leftTube}) - graph.patcher.update({5512408: (leftTube + 16)}) - graph.patcher.update({5512134: rightTube}) - graph.patcher.update({5512151: (rightTube + 16)}) - elif area == 5: - topTile = 52 - bottomTile = 68 - leftTile = 197 - rightTile = 198 - tileset = 38 - if leftArea > 2: - leftTube = 226 + leftArea - else: - leftTube = 235 + leftArea - if rightArea > 2: - rightTube = 226 + rightArea - else: - rightTube = 235 + rightArea - graph.patcher.update({5358711: leftTube}) - graph.patcher.update({5358724: (leftTube + 16)}) - graph.patcher.update({5361542: rightTube}) - graph.patcher.update({5361559: (rightTube + 16)}) - elif area == 6: - topTile = 24 - bottomTile = 40 - leftTile = 199 - rightTile = 200 - tileset = 39 - if leftArea > 2: - leftTube = 226 + leftArea - else: - leftTube = 235 + leftArea - if rightArea > 2: - rightTube = 226 + rightArea - else: - rightTube = 235 + rightArea - graph.patcher.update({5598427: leftTube}) - graph.patcher.update({5598440: (leftTube + 16)}) - graph.patcher.update({5598706: rightTube}) - graph.patcher.update({5598723: (rightTube + 16)}) - if elevator == 0: - graph.patcher.update({4669078: leftTile}) - graph.patcher.update({4669079: rightTile}) - graph.patcher.update({4669026: leftTile}) - graph.patcher.update({4669027: rightTile}) - graph.patcher.update({4670120: leftTile}) - graph.patcher.update({4670121: rightTile}) - graph.patcher.update({4670922: leftTile}) - graph.patcher.update({4670923: rightTile}) - graph.patcher.update({4671720: leftTile}) - graph.patcher.update({4671721: rightTile}) - graph.patcher.update({4672508: leftTile}) - graph.patcher.update({4672509: rightTile}) - graph.patcher.update({4673296: leftTile}) - graph.patcher.update({4673297: rightTile}) - graph.patcher.update({4674087: topTile}) - graph.patcher.update({4674099: bottomTile}) - graph.patcher.update({3945300: tileset}) - graph.patcher.update({5713644: (171 + area)}) - source = 'S0-47' - elif elevator == 1: - graph.patcher.update({4669038: leftTile}) - graph.patcher.update({4669039: rightTile}) - graph.patcher.update({4669028: leftTile}) - graph.patcher.update({4669029: rightTile}) - graph.patcher.update({4670106: leftTile}) - graph.patcher.update({4670107: rightTile}) - graph.patcher.update({4670908: leftTile}) - graph.patcher.update({4670909: rightTile}) - graph.patcher.update({4671708: leftTile}) - graph.patcher.update({4671709: rightTile}) - graph.patcher.update({4672494: leftTile}) - graph.patcher.update({4672495: rightTile}) - graph.patcher.update({4674067: leftTile}) - graph.patcher.update({4674068: rightTile}) - graph.patcher.update({4673301: topTile}) - graph.patcher.update({4673315: bottomTile}) - graph.patcher.update({3945240: tileset}) - graph.patcher.update({5713617: (171 + area)}) - source = 'S0-45' - elif elevator == 2: - graph.patcher.update({4669001: leftTile}) - graph.patcher.update({4669002: rightTile}) - graph.patcher.update({4669030: leftTile}) - graph.patcher.update({4669031: rightTile}) - graph.patcher.update({4670094: leftTile}) - graph.patcher.update({4670095: rightTile}) - graph.patcher.update({4670896: leftTile}) - graph.patcher.update({4670897: rightTile}) - graph.patcher.update({4671696: leftTile}) - graph.patcher.update({4671697: rightTile}) - graph.patcher.update({4673279: leftTile}) - graph.patcher.update({4673280: rightTile}) - graph.patcher.update({4674079: leftTile}) - graph.patcher.update({4674080: rightTile}) - graph.patcher.update({4672499: topTile}) - graph.patcher.update({4672513: bottomTile}) - graph.patcher.update({3945180: tileset}) - graph.patcher.update({5713597: (171 + area)}) - source = 'S0-43' - elif elevator == 3: - graph.patcher.update({4669012: leftTile}) - graph.patcher.update({4669013: rightTile}) - graph.patcher.update({4669057: leftTile}) - graph.patcher.update({4669058: rightTile}) - graph.patcher.update({4670884: leftTile}) - graph.patcher.update({4670885: rightTile}) - graph.patcher.update({4671684: leftTile}) - graph.patcher.update({4671685: rightTile}) - graph.patcher.update({4672489: leftTile}) - graph.patcher.update({4672490: rightTile}) - graph.patcher.update({4673291: leftTile}) - graph.patcher.update({4673292: rightTile}) - graph.patcher.update({4674091: leftTile}) - graph.patcher.update({4674092: rightTile}) - graph.patcher.update({4670111: topTile}) - graph.patcher.update({4670125: bottomTile}) - graph.patcher.update({3945000: tileset}) - graph.patcher.update({5713600: (171 + area)}) - source = 'S0-44' - elif elevator == 4: - graph.patcher.update({4669049: leftTile}) - graph.patcher.update({4669050: rightTile}) - graph.patcher.update({4669059: leftTile}) - graph.patcher.update({4669060: rightTile}) - graph.patcher.update({4670115: leftTile}) - graph.patcher.update({4670116: rightTile}) - graph.patcher.update({4671672: leftTile}) - graph.patcher.update({4671673: rightTile}) - graph.patcher.update({4672503: leftTile}) - graph.patcher.update({4672504: rightTile}) - graph.patcher.update({4673305: leftTile}) - graph.patcher.update({4673306: rightTile}) - graph.patcher.update({4674103: leftTile}) - graph.patcher.update({4674104: rightTile}) - graph.patcher.update({4670913: topTile}) - graph.patcher.update({4670927: bottomTile}) - graph.patcher.update({3945060: tileset}) - graph.patcher.update({5713621: (171 + area)}) - source = 'S0-46' - elif elevator == 5: - graph.patcher.update({4669089: leftTile}) - graph.patcher.update({4669090: rightTile}) - graph.patcher.update({4669061: leftTile}) - graph.patcher.update({4669062: rightTile}) - graph.patcher.update({4670129: leftTile}) - graph.patcher.update({4670130: rightTile}) - graph.patcher.update({4670917: leftTile}) - graph.patcher.update({4670918: rightTile}) - graph.patcher.update({4672517: leftTile}) - graph.patcher.update({4672518: rightTile}) - graph.patcher.update({4673319: leftTile}) - graph.patcher.update({4673320: rightTile}) - graph.patcher.update({4674115: leftTile}) - graph.patcher.update({4674116: rightTile}) - graph.patcher.update({4671701: topTile}) - graph.patcher.update({4671713: bottomTile}) - graph.patcher.update({3945120: tileset}) - graph.patcher.update({5713647: (171 + area)}) - source = 'S0-48' - destination = 'S{}-00'.format(area) - graph.UpdateDoorConnection(source, destination) - graph.UpdateDoorConnection(destination, source) - source = areaDoors.get(area)[0] - destination = areaDoors.get(leftArea)[1] - graph.UpdateDoorConnection(source, destination) - source = areaDoors.get(area)[1] - destination = areaDoors.get(rightArea)[0] - graph.UpdateDoorConnection(source, destination) + PlacedETanks = PlacedMissiles = PlacedPowerBombs = 0 + if SeedSettings['DamageRuns']: + Energy = PlacedETanks * 100 + 99 + MissileCount = 10 + locationWeights.clear() + locationsPerArea.clear() + areaWeights.clear() + weightValue.clear() + MajorLocations.clear() + MinorLocations.clear() + AllItemLocations.clear() + newLocations.clear() + AccessibleLocations.clear() + UsedLocations.clear() + PlacedItems.clear() + NettoriOpen = False + invalidItems.clear() + invalidWeights.clear() + oldLocations.clear() + oldWeights.clear() + MajorLocations.extend(graph.majorItemLocations) + if SeedSettings['MajorMinor'] == False: + MajorLocations.extend(graph.minorItemLocations) + MinorLocations.extend(graph.minorItemLocations) + AllItemLocations.extend(graph.majorItemLocations) + AllItemLocations.extend(graph.minorItemLocations) + random.shuffle(MajorLocations) + random.shuffle(MinorLocations) + random.shuffle(AllItemLocations) + for item in MajorItems: + disable_item(graph, item) - graph.ConnectAllNodes() - PlacedETanks = PlacedMissiles = PlacedPowerBombs = 0 - if SeedSettings['DamageRuns']: - Energy = PlacedETanks * 100 + 99 - MissileCount = 10 - locationWeights.clear() - locationsPerArea.clear() - areaWeights.clear() - weightValue.clear() - MajorLocations.clear() - MinorLocations.clear() - AllItemLocations.clear() - newLocations.clear() - AccessibleLocations.clear() - UsedLocations.clear() - PlacedItems.clear() - NettoriOpen = False - invalidItems.clear() - invalidWeights.clear() - oldLocations.clear() - oldWeights.clear() - MajorLocations.extend(graph.majorItemLocations) - if SeedSettings['MajorMinor'] == False: - MajorLocations.extend(graph.minorItemLocations) - MinorLocations.extend(graph.minorItemLocations) - AllItemLocations.extend(graph.majorItemLocations) - AllItemLocations.extend(graph.minorItemLocations) - random.shuffle(MajorLocations) - random.shuffle(MinorLocations) - random.shuffle(AllItemLocations) - for item in MajorItems: - disable_item(graph, item) + disable_item(graph, 'BlueDoors') + disable_item(graph, 'GreenDoors') + disable_item(graph, 'YellowDoors') + disable_item(graph, 'RedDoors') + disable_item(graph, 'WaterLowered') + for area in range(0, 7): + AreaOpen[area] = None + locationsPerArea.append(list()) + areaWeights.append(1) + weightValue.append(1) - disable_item(graph, 'BlueDoors') - disable_item(graph, 'GreenDoors') - disable_item(graph, 'YellowDoors') - disable_item(graph, 'RedDoors') - disable_item(graph, 'WaterLowered') - for area in range(0, 7): - AreaOpen[area] = None - locationsPerArea.append(list()) - areaWeights.append(1) - weightValue.append(1) + MajorList = list(WeightedMajors.keys()) + if SeedSettings['MissilesWithoutMainData']: + WeightedMajors.update({'MainMissiles': 8}) + WeightedMajors.update({'SuperMissileItem': 8}) + WeightedMajors.update({'IceMissileItem': 8}) + WeightedMajors.update({'DiffusionItem': 8}) + if SeedSettings['PowerBombsWithoutBombs']: + WeightedMajors.update({'Bombs': 10}) + WeightedMajors.update({'MainPowerBombs': 10}) + if SeedSettings['DamageRuns']: + WeightedMajors.update({'VariaSuit': 4}) + MajorWeights = list(WeightedMajors.values()) + MajorWeights.pop(MajorList.index('Bombs')) + MajorList.remove('Bombs') + MajorWeights.pop(MajorList.index('MainPowerBombs')) + MajorList.remove('MainPowerBombs') + if SeedSettings['MissilesWithoutMainData'] == False: + MajorWeights.pop(MajorList.index('IceMissileItem')) + MajorList.remove('IceMissileItem') + MajorWeights.pop(MajorList.index('SuperMissileItem')) + MajorList.remove('SuperMissileItem') + MajorWeights.pop(MajorList.index('DiffusionItem')) + MajorList.remove('DiffusionItem') + if weightInit == False: + availableItems.clear() + path = None + for location in MajorLocations: + path = graph.get_path(StartLocation, location) + if path != None: + break - MajorList = list(WeightedMajors.keys()) - if SeedSettings['MissilesWithoutMainData']: - WeightedMajors.update({'MainMissiles': 8}) - WeightedMajors.update({'SuperMissileItem': 8}) - WeightedMajors.update({'IceMissileItem': 8}) - WeightedMajors.update({'DiffusionItem': 8}) - if SeedSettings['PowerBombsWithoutBombs']: - WeightedMajors.update({'Bombs': 10}) - WeightedMajors.update({'MainPowerBombs': 10}) - if SeedSettings['DamageRuns']: - WeightedMajors.update({'VariaSuit': 4}) - MajorWeights = list(WeightedMajors.values()) - MajorWeights.pop(MajorList.index('Bombs')) - MajorList.remove('Bombs') - MajorWeights.pop(MajorList.index('MainPowerBombs')) - MajorList.remove('MainPowerBombs') - if SeedSettings['MissilesWithoutMainData'] == False: - MajorWeights.pop(MajorList.index('IceMissileItem')) - MajorList.remove('IceMissileItem') - MajorWeights.pop(MajorList.index('SuperMissileItem')) - MajorList.remove('SuperMissileItem') - MajorWeights.pop(MajorList.index('DiffusionItem')) - MajorList.remove('DiffusionItem') - if weightInit == False: - availableItems.clear() - path = None - for location in MajorLocations: - path = graph.get_path(StartLocation, location) - if path != None: - break - - if path == None: - print('Path: No accessible locations found with this start, try changing your game settings.') - else: - for item in MajorItems: - enable_item(graph, item) - currentItemWeight = 0 - find_available_areas(graph) - for location in MajorLocations: - path = graph.get_path(StartLocation, location) - if path != None: - currentItemWeight += 1 - if currentItemWeight > 1: - availableItems.append(item) - break - - for area in range(0, 7): - AreaOpen[area] = None - - disable_item(graph, item) - disable_item(graph, 'WaterLowered') - disable_item(graph, 'BlueDoors') - disable_item(graph, 'GreenDoors') - disable_item(graph, 'YellowDoors') - disable_item(graph, 'RedDoors') - - weightInit = True - if len(availableItems) < 1: - print('Items: No accessible locations found with this start, try changing your game settings.') + if path == None: + sys.exit('No accessible locations found with this start, try changing your game settings.') + else: + for item in MajorItems: + enable_item(graph, item) + currentItemWeight = 0 find_available_areas(graph) for location in MajorLocations: path = graph.get_path(StartLocation, location) if path != None: - AccessibleLocations.append(location) - for area in range(0, 7): - if location in AreaItemLocations[area]: - if location not in locationsPerArea[area]: - locationsPerArea[area].append(location) - - for area in range(0, 7): - if len(locationsPerArea[area]) > 0: - areaWeights[area] = weightValue[area] / len(locationsPerArea[area]) - - for location in AccessibleLocations: - for area in range(0, 7): - if location in AreaItemLocations[area]: - locationWeights.append(areaWeights[area]) - - if FirstItem == None: - FirstItem = random.choice(availableItems) - MajorWeights.pop(MajorList.index(FirstItem)) - MajorList.remove(FirstItem) - enable_item(graph, FirstItem) - path = None - if SeedSettings['DamageRuns']: - Energy = Energy / 2 - while True: - if not path == None: - location = random.choice(AccessibleLocations) - path = graph.get_path(location, StartLocation) - if path != None: - locationWeights.pop(AccessibleLocations.index(location)) - AccessibleLocations.remove(location) - UsedLocations.append(location) - PlacedItems.append(FirstItem) - for area in range(0, 7): - if location not in AreaItemLocations[area]: - weightValue[area] += 1 - - if FirstItem == 'MainMissiles': - if SeedSettings['MissilesWithoutMainData'] == False: - MajorList.append('IceMissileItem') - MajorWeights.append(WeightedMajors.get('IceMissileItem')) - MajorList.append('SuperMissileItem') - MajorWeights.append(WeightedMajors.get('SuperMissileItem')) - MajorList.append('DiffusionItem') - MajorWeights.append(WeightedMajors.get('DiffusionItem')) - elif FirstItem == 'MorphBall': - MajorList.append('Bombs') - MajorWeights.append(WeightedMajors.get('Bombs')) - if SeedSettings['PowerBombsWithoutBombs'] == True: - MajorList.append('MainPowerBombs') - MajorWeights.append(WeightedMajors.get('MainPowerBombs')) - elif FirstItem == 'Bombs': - if SeedSettings['PowerBombsWithoutBombs'] == False: - MajorList.append('MainPowerBombs') - MajorWeights.append(WeightedMajors.get('MainPowerBombs')) - init = True - if SeedSettings['DamageRuns']: - Energy = PlacedETanks * 100 + 99 - find_available_areas(graph) - path = graph.get_path(StartLocation, 'End-of-Game') - if path != None: - path = graph.get_path('End-of-Game', 'S0-00') - if path != None: - gameBeatable = True - if not gameBeatable == False: - newLocations.clear() - locationWeights.clear() - for location in MajorLocations: - path = None - if location not in UsedLocations: - if location not in AccessibleLocations: - if not location == 'Data S0' or location == 'Item S0-05-16': - path = graph.get_path(location, StartLocation, depth=250) - for area in range(0, 7): - if location in AreaItemLocations[area]: - if AreaOpen[area]: - path = graph.get_path(AreaOpen[area], location, True) + currentItemWeight += 1 + if currentItemWeight > 1: + availableItems.append(item) break - if path != None: - AccessibleLocations.append(location) - MajorLocations.remove(location) - newLocations.append(location) for area in range(0, 7): - if location in AreaItemLocations[area]: - if location not in locationsPerArea[area]: - locationsPerArea[area].append(location) + AreaOpen[area] = None + disable_item(graph, item) + disable_item(graph, 'WaterLowered') + disable_item(graph, 'BlueDoors') + disable_item(graph, 'GreenDoors') + disable_item(graph, 'YellowDoors') + disable_item(graph, 'RedDoors') + + weightInit = True + + if len(availableItems) < 1: + sys.exit('No accessible locations found with this start, try changing your game settings.') + + find_available_areas(graph) + for location in MajorLocations: + path = graph.get_path(StartLocation, location) + if path != None: + AccessibleLocations.append(location) for area in range(0, 7): - if len(locationsPerArea[area]) > 0: - if SeedSettings['MajorMinor']: - areaWeights[area] = weightValue[area] / len(locationsPerArea[area]) - else: - areaWeights[area] = weightValue[area] / len(locationsPerArea[area]) + area + if location in AreaItemLocations[area]: + if location not in locationsPerArea[area]: + locationsPerArea[area].append(location) - for location in AccessibleLocations: - for area in range(0, 7): - if location in AreaItemLocations[area]: - if location in newLocations: - locationWeights.append(areaWeights[area] * 1.8) - else: - if location in BossLocations: - if SeedSettings['MajorMinor'] == False: - locationWeights.append(areaWeights[area] * 1.5) - locationWeights.append(areaWeights[area]) + for area in range(0, 7): + if len(locationsPerArea[area]) > 0: + areaWeights[area] = weightValue[area] / len(locationsPerArea[area]) - if not len(MajorList) > 0: - itemLocation = None - path = None - item = random.choices(MajorList, weights=MajorWeights, k=1)[0] - currentItemWeight = MajorWeights.pop(MajorList.index(item)) - MajorList.remove(item) - enable_item(graph, item) - if SeedSettings['DamageRuns']: - Energy = Energy / 2 - while True: - if not path == None: - if not len(AccessibleLocations) > 0: - itemLocation = random.choices(AccessibleLocations, weights=locationWeights, k=1)[0] - oldLocationWeight = locationWeights.pop(AccessibleLocations.index(itemLocation)) - AccessibleLocations.remove(itemLocation) - if itemLocation == 'Data S0' or itemLocation == 'Item S0-05-16': - path = graph.get_path(itemLocation, StartLocation, depth=250) - else: - for area in range(0, 7): - if itemLocation in AreaItemLocations[area]: - if AreaOpen[area]: - path = graph.get_path(itemLocation, AreaOpen[area], True) - break + for location in AccessibleLocations: + for area in range(0, 7): + if location in AreaItemLocations[area]: + locationWeights.append(areaWeights[area]) - if not itemLocation in BossLocations: - if not path != None: - disable_item(graph, item) - if ChargeBeam == False: - if SeedSettings['Difficulty'] > 0: - healthCheck = BossHealths.get(itemLocation) - if SeedSettings['Difficulty'] > 4: - healthCheck = healthCheck * 1.02 - elif SeedSettings['Difficulty'] > 2: - healthCheck = healthCheck * 1.05 - else: - healthCheck = healthCheck * 1.1 - healthCheck = healthCheck - MissileDamage * MissileCount - if healthCheck > 0: - if MissileDamage > 0: - tankCheck = math.ceil(healthCheck / MissileDamage / 5) - PossibleMissileTanks.clear() - if SeedSettings['MajorMinor']: - for missileLocation in MinorLocations: - if missileLocation not in UsedLocations: - missilePath = None - if missileLocation == 'Item S0-05-16': - missilePath = graph.get_path(StartLocation, missileLocation, depth=250) - if missilePath != None: - missilePath = graph.get_path(missileLocation, StartLocation, depth=250) - else: - for area in range(0, 7): - if missileLocation in AreaItemLocations[area]: - if AreaOpen[area]: - missilePath = graph.get_path(AreaOpen[area], missileLocation, True) - if missilePath != None: - missilePath = graph.get_path(missileLocation, AreaOpen[area], True) - break - if missilePath != None: - PossibleMissileTanks.append(missileLocation) + if FirstItem == None: + FirstItem = random.choice(availableItems) + MajorWeights.pop(MajorList.index(FirstItem)) + MajorList.remove(FirstItem) + enable_item(graph, FirstItem) + path = None + if SeedSettings['DamageRuns']: + Energy = Energy / 2 + while path == None: + location = random.choice(AccessibleLocations) + path = graph.get_path(location, StartLocation) + if path != None: + locationWeights.pop(AccessibleLocations.index(location)) + AccessibleLocations.remove(location) + UsedLocations.append(location) + PlacedItems.append(FirstItem) + for area in range(0, 7): + if location not in AreaItemLocations[area]: + weightValue[area] += 1 - else: - for missileLocation in AccessibleLocations: - missilePath = None - if not missileLocation == 'Data S0' or missileLocation == 'Item S0-05-16': - missilePath = graph.get_path(missileLocation, StartLocation, depth=250) - for area in range(0, 7): - if missileLocation in AreaItemLocations[area]: - if AreaOpen[area]: - missilePath = graph.get_path(missileLocation, AreaOpen[area], True) - break - if missilePath != None: - if missileLocation not in BossLocations: - PossibleMissileTanks.append(missileLocation) - - if len(PossibleMissileTanks) > int(tankCheck): - for x in range(0, int(tankCheck)): - missileLocation = random.choice(PossibleMissileTanks) - PossibleMissileTanks.remove(missileLocation) - if SeedSettings['MajorMinor'] == False: - locationWeights.pop(AccessibleLocations.index(missileLocation)) - AccessibleLocations.remove(missileLocation) - UsedLocations.append(missileLocation) - PlacedItems.append('Missile Tank') - PlacedMissiles += 1 - - MissileCount = 10 + PlacedMissiles * 5 - update_items(graph) - else: - path = None - else: - path = None - enable_item(graph, item) - if path == None: - oldLocations.append(itemLocation) - oldWeights.append(oldLocationWeight) - - if path == None: - if len(MajorList) > 0 and len(PlacedItems) > 4: - invalidItems.append(item) - invalidWeights.append(currentItemWeight) - AccessibleLocations.extend(oldLocations) - oldLocations.clear() - locationWeights.extend(oldWeights) - oldWeights.clear() - disable_item(graph, item) - else: - for item in MajorItems: - disable_item(graph, item) - - print("Couldn't find a path forward, trying again") - init = False - else: - UsedLocations.append(itemLocation) - PlacedItems.append(item) - MajorList.extend(invalidItems) - invalidItems.clear() - MajorWeights.extend(invalidWeights) - invalidWeights.clear() - AccessibleLocations.extend(oldLocations) - oldLocations.clear() - locationWeights.extend(oldWeights) - oldWeights.clear() - for area in range(0, 7): - if itemLocation in locationsPerArea[area]: - locationsPerArea[area].remove(itemLocation) - if itemLocation not in AreaItemLocations[area]: - weightValue[area] += 1 - - elif item == 'MainMissiles': + if FirstItem == 'MainMissiles': if SeedSettings['MissilesWithoutMainData'] == False: MajorList.append('IceMissileItem') MajorWeights.append(WeightedMajors.get('IceMissileItem')) @@ -2507,25 +2298,226 @@ def randomize_game(graph): MajorWeights.append(WeightedMajors.get('SuperMissileItem')) MajorList.append('DiffusionItem') MajorWeights.append(WeightedMajors.get('DiffusionItem')) - elif item == 'MorphBall': + elif FirstItem == 'MorphBall': MajorList.append('Bombs') MajorWeights.append(WeightedMajors.get('Bombs')) if SeedSettings['PowerBombsWithoutBombs'] == True: MajorList.append('MainPowerBombs') MajorWeights.append(WeightedMajors.get('MainPowerBombs')) - elif item == 'Bombs': + elif FirstItem == 'Bombs': if SeedSettings['PowerBombsWithoutBombs'] == False: MajorList.append('MainPowerBombs') MajorWeights.append(WeightedMajors.get('MainPowerBombs')) - if SeedSettings['MajorMinor'] == False: - if not len(AccessibleLocations) > 3: - if PlacedETanks < MaxETanks: - itemLocation = random.choice(AccessibleLocations) - locationWeights.pop(AccessibleLocations.index(itemLocation)) - AccessibleLocations.remove(itemLocation) - UsedLocations.append(itemLocation) - PlacedItems.append('Energy Tank') - PlacedETanks += 1 + + init = True + + if SeedSettings['DamageRuns']: + Energy = PlacedETanks * 100 + 99 + + find_available_areas(graph) + path = graph.get_path(StartLocation, 'End-of-Game') + if path != None: + path = graph.get_path('End-of-Game', 'S0-00') + if path != None: + gameBeatable = True + + if gameBeatable == False: + newLocations.clear() + locationWeights.clear() + for location in MajorLocations: + path = None + if location not in UsedLocations: + if location not in AccessibleLocations: + if location == 'Data S0' or location == 'Item S0-05-16': + path = graph.get_path(location, StartLocation, depth=250) + else: + for area in range(0, 7): + if location in AreaItemLocations[area]: + if AreaOpen[area]: + path = graph.get_path(AreaOpen[area], location, True) + break + if path != None: + AccessibleLocations.append(location) + MajorLocations.remove(location) + newLocations.append(location) + for area in range(0, 7): + if location in AreaItemLocations[area]: + if location not in locationsPerArea[area]: + locationsPerArea[area].append(location) + + for area in range(0, 7): + if len(locationsPerArea[area]) > 0: + if SeedSettings['MajorMinor']: + areaWeights[area] = weightValue[area] / len(locationsPerArea[area]) + else: + areaWeights[area] = weightValue[area] / len(locationsPerArea[area]) + area + + for location in AccessibleLocations: + for area in range(0, 7): + if location in AreaItemLocations[area]: + if location in newLocations: + locationWeights.append(areaWeights[area] * 1.8) + elif location in BossLocations and SeedSettings['MajorMinor'] == False: + locationWeights.append(areaWeights[area] * 1.5) + else: + locationWeights.append(areaWeights[area]) + + if len(MajorList) > 0: + itemLocation = None + path = None + item = random.choices(MajorList, weights=MajorWeights, k=1)[0] + currentItemWeight = MajorWeights.pop(MajorList.index(item)) + MajorList.remove(item) + enable_item(graph, item) + + if SeedSettings['DamageRuns']: + Energy = Energy / 2 + + while path == None and len(AccessibleLocations) > 0: + itemLocation = random.choices(AccessibleLocations, weights=locationWeights, k=1)[0] + oldLocationWeight = locationWeights.pop(AccessibleLocations.index(itemLocation)) + AccessibleLocations.remove(itemLocation) + if itemLocation == 'Data S0' or itemLocation == 'Item S0-05-16': + path = graph.get_path(itemLocation, StartLocation, depth=250) + else: + for area in range(0, 7): + if itemLocation in AreaItemLocations[area]: + if AreaOpen[area]: + path = graph.get_path(itemLocation, AreaOpen[area], True) + break + if itemLocation in BossLocations: + if path != None: + disable_item(graph, item) + if ChargeBeam == False and SeedSettings['Difficulty'] > 0: + healthCheck = BossHealths.get(itemLocation) + if SeedSettings['Difficulty'] > 4: + healthCheck = healthCheck * 1.02 + elif SeedSettings['Difficulty'] > 2: + healthCheck = healthCheck * 1.05 + else: + healthCheck = healthCheck * 1.1 + healthCheck = healthCheck - MissileDamage * MissileCount + if healthCheck > 0: + if MissileDamage > 0: + tankCheck = math.ceil(healthCheck / MissileDamage / 5) + PossibleMissileTanks.clear() + if SeedSettings['MajorMinor']: + for missileLocation in MinorLocations: + if missileLocation not in UsedLocations: + missilePath = None + if missileLocation == 'Item S0-05-16': + missilePath = graph.get_path(StartLocation, missileLocation, depth=250) + if missilePath != None: + missilePath = graph.get_path(missileLocation, StartLocation, depth=250) + else: + for area in range(0, 7): + if missileLocation in AreaItemLocations[area]: + if AreaOpen[area]: + missilePath = graph.get_path(AreaOpen[area], missileLocation, True) + if missilePath != None: + missilePath = graph.get_path(missileLocation, AreaOpen[area], True) + break + if missilePath != None: + PossibleMissileTanks.append(missileLocation) + else: + for missileLocation in AccessibleLocations: + missilePath = None + if missileLocation == 'Data S0' or missileLocation == 'Item S0-05-16': + missilePath = graph.get_path(missileLocation, StartLocation, depth=250) + else: + for area in range(0, 7): + if missileLocation in AreaItemLocations[area]: + if AreaOpen[area]: + missilePath = graph.get_path(missileLocation, AreaOpen[area], True) + break + if missilePath != None: + if missileLocation not in BossLocations: + PossibleMissileTanks.append(missileLocation) + + if len(PossibleMissileTanks) > int(tankCheck): + for x in range(0, int(tankCheck)): + missileLocation = random.choice(PossibleMissileTanks) + PossibleMissileTanks.remove(missileLocation) + if SeedSettings['MajorMinor'] == False: + locationWeights.pop(AccessibleLocations.index(missileLocation)) + AccessibleLocations.remove(missileLocation) + UsedLocations.append(missileLocation) + PlacedItems.append('Missile Tank') + PlacedMissiles += 1 + + MissileCount = 10 + PlacedMissiles * 5 + update_items(graph) + else: + path = None + else: + path = None + enable_item(graph, item) + + if path == None: + oldLocations.append(itemLocation) + oldWeights.append(oldLocationWeight) + + if path == None: + if len(MajorList) > 0 and len(PlacedItems) > 4: + invalidItems.append(item) + invalidWeights.append(currentItemWeight) + AccessibleLocations.extend(oldLocations) + oldLocations.clear() + locationWeights.extend(oldWeights) + oldWeights.clear() + disable_item(graph, item) + else: + for item in MajorItems: + disable_item(graph, item) + + print("Couldn't find a path forward, trying again") + init = False + else: + UsedLocations.append(itemLocation) + PlacedItems.append(item) + MajorList.extend(invalidItems) + invalidItems.clear() + MajorWeights.extend(invalidWeights) + invalidWeights.clear() + AccessibleLocations.extend(oldLocations) + oldLocations.clear() + locationWeights.extend(oldWeights) + oldWeights.clear() + for area in range(0, 7): + if itemLocation in locationsPerArea[area]: + locationsPerArea[area].remove(itemLocation) + if itemLocation not in AreaItemLocations[area]: + weightValue[area] += 1 + + if item == 'MainMissiles': + if SeedSettings['MissilesWithoutMainData'] == False: + MajorList.append('IceMissileItem') + MajorWeights.append(WeightedMajors.get('IceMissileItem')) + MajorList.append('SuperMissileItem') + MajorWeights.append(WeightedMajors.get('SuperMissileItem')) + MajorList.append('DiffusionItem') + MajorWeights.append(WeightedMajors.get('DiffusionItem')) + elif item == 'MorphBall': + MajorList.append('Bombs') + MajorWeights.append(WeightedMajors.get('Bombs')) + if SeedSettings['PowerBombsWithoutBombs'] == True: + MajorList.append('MainPowerBombs') + MajorWeights.append(WeightedMajors.get('MainPowerBombs')) + elif item == 'Bombs': + if SeedSettings['PowerBombsWithoutBombs'] == False: + MajorList.append('MainPowerBombs') + MajorWeights.append(WeightedMajors.get('MainPowerBombs')) + + if SeedSettings['MajorMinor'] == False: + if len(AccessibleLocations) > 3: + if PlacedETanks < MaxETanks: + itemLocation = random.choice(AccessibleLocations) + locationWeights.pop(AccessibleLocations.index(itemLocation)) + AccessibleLocations.remove(itemLocation) + UsedLocations.append(itemLocation) + PlacedItems.append('Energy Tank') + PlacedETanks += 1 + else: for item in MajorItems: disable_item(graph, item) @@ -2538,7 +2530,7 @@ def randomize_game(graph): if item not in MajorList: MajorList.append(item) MajorWeights.append(WeightedMajors.get(item)) - MajorLocations.extend(AccessibleLocations) + MajorLocations.extend(AccessibleLocations) for item in MajorList: if item not in PlacedItems: @@ -2547,8 +2539,8 @@ def randomize_game(graph): MajorLocations.remove(location) location = random.choice(MajorLocations) - UsedLocations.append(location) - PlacedItems.append(item) + UsedLocations.append(location) + PlacedItems.append(item) if SeedSettings['MajorMinor']: for location in MajorLocations: @@ -2559,33 +2551,32 @@ def randomize_game(graph): PlacedETanks += 1 MaxETanks = PlacedETanks - if PlacedETanks >= MaxETanks: - MinorItems.remove('Energy Tank') - if PlacedMissiles >= MaxMissiles: - MinorItems.remove('Missile Tank') - if PlacedPowerBombs >= MaxPowerBombs: - MinorItems.remove('Power Bomb Tank') - for location in AllItemLocations: - if len(MinorItems) > 0: - if location not in UsedLocations: - item = random.choice(MinorItems) - UsedLocations.append(location) - PlacedItems.append(item) - if item == 'Energy Tank': - PlacedETanks += 1 - if PlacedETanks >= MaxETanks: - MinorItems.remove('Energy Tank') - else: - if item == 'Missile Tank': - PlacedMissiles += 1 - if not PlacedMissiles >= MaxMissiles: - MinorItems.remove('Missile Tank') - if item == 'Power Bomb Tank': - PlacedPowerBombs += 1 - if PlacedPowerBombs >= MaxPowerBombs: - MinorItems.remove('Power Bomb Tank') - patch_game() + if PlacedETanks >= MaxETanks: + MinorItems.remove('Energy Tank') + if PlacedMissiles >= MaxMissiles: + MinorItems.remove('Missile Tank') + if PlacedPowerBombs >= MaxPowerBombs: + MinorItems.remove('Power Bomb Tank') + for location in AllItemLocations: + if len(MinorItems) > 0: + if location not in UsedLocations: + item = random.choice(MinorItems) + UsedLocations.append(location) + PlacedItems.append(item) + if item == 'Energy Tank': + PlacedETanks += 1 + if PlacedETanks >= MaxETanks: + MinorItems.remove('Energy Tank') + elif item == 'Missile Tank': + PlacedMissiles += 1 + if PlacedMissiles >= MaxMissiles: + MinorItems.remove('Missile Tank') + elif item == 'Power Bomb Tank': + PlacedPowerBombs += 1 + if PlacedPowerBombs >= MaxPowerBombs: + MinorItems.remove('Power Bomb Tank') + patch_game() def patch_game(): global FileName, BaseName