Ejemplo n.º 1
0
def logic_bootstrap(
    configuration: LayoutConfiguration,
    game: GameDescription,
    patches: GamePatches,
) -> Tuple[Logic, 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)
    logic = Logic(game, configuration)
    starting_state = calculate_starting_state(logic, patches)

    if configuration.trick_level == LayoutTrickLevel.MINIMAL_RESTRICTIONS:
        _add_minimal_restrictions_initial_resources(starting_state.resources,
                                                    game.resource_database)

    difficulty_level, static_resources = static_resources_for_layout_logic(
        configuration.trick_level, game.resource_database)

    starting_state.resources = merge_resources(static_resources,
                                               starting_state.resources)
    starting_state.resources[
        game.resource_database.difficulty_resource] = difficulty_level

    game.simplify_connections(starting_state.resources)

    return logic, starting_state
Ejemplo n.º 2
0
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.translator_configuration))
    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.simplify_connections(starting_state.resources)

    return game, starting_state