diff --git a/BaseClasses.py b/BaseClasses.py index e94a2731..3bb7c9bd 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -83,9 +83,12 @@ class World(object): self.spoiler = Spoiler(self) self.lamps_needed_for_dark_rooms = 1 - def intialize_regions(self): - for region in self.regions: + def initialize_regions(self, regions=None): + for region in regions if regions else self.regions: region.world = self + self._region_cache[(region.name, region.player)] = region + for exit in region.exits: + self._entrance_cache[(exit.name, exit.player)] = exit def get_region(self, regionname, player): if isinstance(regionname, Region): diff --git a/Gui.py b/Gui.py index fb192883..cd9c629f 100755 --- a/Gui.py +++ b/Gui.py @@ -405,6 +405,7 @@ def guiMain(args=None): guiargs.sprite = sprite guiargs.skip_playthrough = False guiargs.outputpath = None + guiargs.securerandom = False try: if guiargs.count is not None: seed = guiargs.seed diff --git a/InvertedRegions.py b/InvertedRegions.py index 39b04361..bd1bb983 100644 --- a/InvertedRegions.py +++ b/InvertedRegions.py @@ -323,7 +323,7 @@ def create_inverted_regions(world, player): shop.add_inventory(0, 'Bomb Upgrade (+5)', 100, 7) if not world.retro: shop.add_inventory(1, 'Arrow Upgrade (+5)', 100, 7) - world.intialize_regions() + world.initialize_regions() def create_lw_region(player, name, locations=None, exits=None): return _create_region(player, name, RegionType.LightWorld, 'Light World', locations, exits) diff --git a/Main.py b/Main.py index 8fc7e31d..41093dbb 100644 --- a/Main.py +++ b/Main.py @@ -8,6 +8,7 @@ import RaceRandom as random import time from BaseClasses import World, CollectionState, Item, Region, Location, Shop +from Items import ItemFactory from Regions import create_regions, mark_light_world_regions from InvertedRegions import create_inverted_regions, mark_dark_world_regions from EntranceShuffle import link_entrances, link_inverted_entrances @@ -215,51 +216,35 @@ def copy_dynamic_regions_and_locations(world, ret): def copy_world(world): # ToDo: Not good yet - ret = World(world.players, world.shuffle, world.logic, world.mode, world.swords, world.difficulty, world.difficulty_adjustments, world.timer, world.progressive, world.goal, world.algorithm, world.accessibility, world.shuffle_ganon, world.retro, world.custom, world.customitemarray, world.hints) - ret.teams = world.teams - ret.player_names = copy.deepcopy(world.player_names) - ret.remote_items = world.remote_items.copy() + ret = World(world.players, world.shuffle, world.logic, world.mode, world.swords, world.difficulty, world.difficulty_adjustments, world.timer, world.progressive, world.goal, world.algorithm, world.place_dungeon_items, world.accessibility, world.shuffle_ganon, world.quickswap, world.fastmenu, world.disable_music, world.keysanity, world.retro, world.custom, world.customitemarray, world.boss_shuffle, world.hints) ret.required_medallions = world.required_medallions.copy() ret.swamp_patch_required = world.swamp_patch_required.copy() ret.ganon_at_pyramid = world.ganon_at_pyramid.copy() ret.powder_patch_required = world.powder_patch_required.copy() ret.ganonstower_vanilla = world.ganonstower_vanilla.copy() - ret.treasure_hunt_count = world.treasure_hunt_count.copy() - ret.treasure_hunt_icon = world.treasure_hunt_icon.copy() - ret.sewer_light_cone = world.sewer_light_cone.copy() + ret.treasure_hunt_count = world.treasure_hunt_count + ret.treasure_hunt_icon = world.treasure_hunt_icon + ret.sewer_light_cone = world.sewer_light_cone ret.light_world_light_cone = world.light_world_light_cone ret.dark_world_light_cone = world.dark_world_light_cone ret.seed = world.seed - ret.can_access_trock_eyebridge = world.can_access_trock_eyebridge.copy() - ret.can_access_trock_front = world.can_access_trock_front.copy() - ret.can_access_trock_big_chest = world.can_access_trock_big_chest.copy() - ret.can_access_trock_middle = world.can_access_trock_middle.copy() + ret.can_access_trock_eyebridge = world.can_access_trock_eyebridge + ret.can_access_trock_front = world.can_access_trock_front + ret.can_access_trock_big_chest = world.can_access_trock_big_chest + ret.can_access_trock_middle = world.can_access_trock_middle ret.can_take_damage = world.can_take_damage - ret.difficulty_requirements = world.difficulty_requirements.copy() - ret.fix_fake_world = world.fix_fake_world.copy() + ret.difficulty_requirements = world.difficulty_requirements + ret.fix_fake_world = world.fix_fake_world ret.lamps_needed_for_dark_rooms = world.lamps_needed_for_dark_rooms - ret.mapshuffle = world.mapshuffle.copy() - ret.compassshuffle = world.compassshuffle.copy() - ret.keyshuffle = world.keyshuffle.copy() - ret.bigkeyshuffle = world.bigkeyshuffle.copy() - ret.crystals_needed_for_ganon = world.crystals_needed_for_ganon.copy() - ret.crystals_needed_for_gt = world.crystals_needed_for_gt.copy() - ret.open_pyramid = world.open_pyramid.copy() - ret.boss_shuffle = world.boss_shuffle.copy() - ret.enemy_shuffle = world.enemy_shuffle.copy() - ret.enemy_health = world.enemy_health.copy() - ret.enemy_damage = world.enemy_damage.copy() - ret.beemizer = world.beemizer.copy() - ret.timer = world.timer.copy() - ret.shufflepots = world.shufflepots.copy() - ret.extendedmsu = world.extendedmsu.copy() + ret.crystals_needed_for_ganon = world.crystals_needed_for_ganon + ret.crystals_needed_for_gt = world.crystals_needed_for_gt + ret.boss_shuffle = world.boss_shuffle for player in range(1, world.players + 1): if world.mode[player] != 'inverted': create_regions(ret, player) else: create_inverted_regions(ret, player) - create_shops(ret, player) create_dungeons(ret, player) copy_dynamic_regions_and_locations(world, ret) @@ -285,7 +270,7 @@ def copy_world(world): # fill locations for location in world.get_locations(): 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) ret.get_location(location.name, location.player).item = item item.location = ret.get_location(location.name, location.player) item.world = ret @@ -308,7 +293,6 @@ def copy_world(world): for player in range(1, world.players + 1): set_rules(ret, player) - return ret diff --git a/Regions.py b/Regions.py index db0e0727..693bc6c0 100644 --- a/Regions.py +++ b/Regions.py @@ -313,7 +313,7 @@ def create_regions(world, player): shop.add_inventory(0, 'Bomb Upgrade (+5)', 100, 7) if not world.retro: shop.add_inventory(1, 'Arrow Upgrade (+5)', 100, 7) - world.intialize_regions() + world.initialize_regions() def create_lw_region(player, name, locations=None, exits=None): return _create_region(player, name, RegionType.LightWorld, 'Light World', locations, exits)