def logic_bootstrap( configuration: EchoesConfiguration, game: GameDescription, patches: GamePatches, ) -> Tuple[GameDescription, State]: """ Core code for starting a new Logic/State. :param configuration: :param game: :param patches: :return: """ game = copy.deepcopy(game) starting_state = calculate_starting_state(game, patches) if configuration.trick_level.minimal_logic: _add_minimal_logic_initial_resources( starting_state.resources, game.resource_database, configuration.major_items_configuration) static_resources = trick_resources_for_configuration( configuration.trick_level, game.resource_database) static_resources.update(version_resources_for_game(game.resource_database)) static_resources.update( misc_resources_for_configuration(configuration, game.resource_database)) for resource, quantity in static_resources.items(): starting_state.resources[resource] = quantity game.patch_requirements(starting_state.resources, configuration.damage_strictness.value) return game, starting_state
def logic_bootstrap( self, configuration: BaseConfiguration, game: GameDescription, patches: GamePatches, ) -> Tuple[GameDescription, State]: """ Core code for starting a new Logic/State. :param configuration: :param game: :param patches: :return: """ if not game.mutable: raise ValueError("Running logic_bootstrap with non-mutable game") game.world_list.ensure_has_node_cache() starting_state = self.calculate_starting_state(game, patches, configuration) if configuration.trick_level.minimal_logic: self._add_minimal_logic_initial_resources( starting_state.resources, game, configuration.major_items_configuration) static_resources = ResourceCollection.with_database( game.resource_database) static_resources.add_resource_gain( self.trick_resources_for_configuration(configuration.trick_level, game.resource_database)) static_resources.add_resource_gain( self.event_resources_for_configuration(configuration, game.resource_database)) static_resources.add_resource_gain( self.version_resources_for_game(configuration, game.resource_database)) static_resources.add_resource_gain( self.misc_resources_for_configuration(configuration, game.resource_database)) for resource, quantity in static_resources.as_resource_gain(): starting_state.resources.set_resource(resource, quantity) game.patch_requirements(starting_state.resources, configuration.damage_strictness.value) return game, starting_state
def logic_bootstrap( configuration: LayoutConfiguration, game: GameDescription, patches: GamePatches, ) -> Tuple[GameDescription, State]: """ Core code for starting a new Logic/State. :param configuration: :param game: :param patches: :return: """ # global state for easy printing functions debug._gd = game game = copy.deepcopy(game) starting_state = calculate_starting_state(game, patches) if configuration.trick_level_configuration.global_level == LayoutTrickLevel.MINIMAL_RESTRICTIONS: major_items_config = configuration.major_items_configuration _add_minimal_restrictions_initial_resources( starting_state.resources, game.resource_database, major_items_config.progressive_grapple, major_items_config.progressive_suit, ) difficulty_level, static_resources = static_resources_for_layout_logic( configuration.trick_level_configuration, game.resource_database) add_resources_into_another(starting_state.resources, static_resources) add_resources_into_another( starting_state.resources, _create_vanilla_translator_resources(game.resource_database, configuration.elevators)) starting_state.resources[ game.resource_database.difficulty_resource] = difficulty_level # All version differences are patched out from the game starting_state.resources[find_resource_info_with_long_name( game.resource_database.version, "NTSC")] = 1 game.patch_requirements(starting_state.resources, configuration.damage_strictness.value) return game, starting_state
def logic_bootstrap(configuration: LayoutConfiguration, game: GameDescription, patches: GamePatches, ) -> Tuple[GameDescription, State]: """ Core code for starting a new Logic/State. :param configuration: :param game: :param patches: :return: """ # global state for easy printing functions debug._gd = game game = copy.deepcopy(game) starting_state = calculate_starting_state(game, patches) if configuration.trick_level_configuration.minimal_logic: major_items_config = configuration.major_items_configuration _add_minimal_logic_initial_resources(starting_state.resources, game.resource_database, major_items_config.progressive_grapple, major_items_config.progressive_suit, ) static_resources = trick_resources_for_configuration(configuration.trick_level_configuration, game.resource_database) static_resources.update(version_resources_for_game(game.resource_database)) static_resources.update(misc_resources_for_configuration(configuration, game.resource_database)) for resource, quantity in static_resources.items(): starting_state.resources[resource] = quantity game.patch_requirements(starting_state.resources, configuration.damage_strictness.value) return game, starting_state