Merge branch 'DoorDevOWG' of https://github.com/compiling/ALttPEntranceRandomizer into compiling-DoorDevOWG

This commit is contained in:
aerinon
2021-05-04 16:15:28 -06:00
44 changed files with 3068 additions and 330 deletions

10
Main.py
View File

@@ -11,6 +11,7 @@ import zlib
from BaseClasses import World, CollectionState, Item, Region, Location, Shop, Entrance, Settings
from Items import ItemFactory
from KeyDoorShuffle import validate_key_placement
from OverworldGlitchRules import create_owg_connections
from PotShuffle import shuffle_pots
from Regions import create_regions, create_shops, mark_light_world_regions, create_dungeon_regions, adjust_locations
from InvertedRegions import create_inverted_regions, mark_dark_world_regions
@@ -123,6 +124,8 @@ def main(args, seed=None, fish=None):
create_regions(world, player)
else:
create_inverted_regions(world, player)
if world.logic[player] in ('owglitches', 'nologic'):
create_owg_connections(world, player)
create_dungeon_regions(world, player)
create_shops(world, player)
create_doors(world, player)
@@ -392,6 +395,8 @@ def copy_world(world):
create_shops(ret, player)
create_rooms(ret, player)
create_dungeons(ret, player)
if world.logic[player] in ('owglitches', 'nologic'):
create_owg_connections(ret, player)
copy_dynamic_regions_and_locations(world, ret)
for player in range(1, world.players + 1):
@@ -429,7 +434,7 @@ def copy_world(world):
for location in world.get_locations():
new_location = ret.get_location(location.name, location.player)
if location.item is not None:
item = Item(location.item.name, location.item.advancement, location.item.priority, location.item.type, player = location.item.player)
item = Item(location.item.name, location.item.advancement, location.item.priority, location.item.type, player=location.item.player)
new_location.item = item
item.location = new_location
item.world = ret
@@ -508,6 +513,7 @@ def create_playthrough(world):
# get locations containing progress items
prog_locations = [location for location in world.get_filled_locations() if location.item.advancement]
optional_locations = ['Trench 1 Switch', 'Trench 2 Switch', 'Ice Block Drop']
state_cache = [None]
collection_spheres = []
state = CollectionState(world)
@@ -533,7 +539,7 @@ def create_playthrough(world):
logging.getLogger('').debug(world.fish.translate("cli", "cli", "building.calculating.spheres"), len(collection_spheres), len(sphere), len(prog_locations))
if not sphere:
logging.getLogger('').error(world.fish.translate("cli", "cli", "cannot.reach.items"), [world.fish.translate("cli","cli","cannot.reach.item") % (location.item.name, location.item.player, location.name, location.player) for location in sphere_candidates])
if any([world.accessibility[location.item.player] != 'none' for location in sphere_candidates]):
if any([location.name not in optional_locations and world.accessibility[location.item.player] != 'none' for location in sphere_candidates]):
raise RuntimeError(world.fish.translate("cli", "cli", "cannot.reach.progression"))
else:
old_world.spoiler.unreachables = sphere_candidates.copy()