Example #1
0
def _create_string_patches(hint_config: HintConfiguration,
                           game: GameDescription,
                           all_patches: Dict[int, GamePatches],
                           players_config: PlayersConfiguration,
                           rng: Random,
                           ) -> list:
    """

    :param hint_config:
    :param game:
    :param patches:
    :return:
    """
    patches = all_patches[players_config.player_index]
    string_patches = []

    # Location Hints
    string_patches.extend(
        item_hints.create_hints(patches, game.world_list, rng)
    )

    # Sky Temple Keys
    stk_mode = hint_config.sky_temple_keys
    if stk_mode == SkyTempleKeyHintMode.DISABLED:
        string_patches.extend(sky_temple_key_hint.hide_hints())
    else:
        string_patches.extend(sky_temple_key_hint.create_hints(all_patches, players_config, game.world_list,
                                                               stk_mode == SkyTempleKeyHintMode.HIDE_AREA))

    # Elevator Scans
    string_patches.extend(_create_elevator_scan_port_patches(game.world_list, patches.elevator_connection))

    string_patches.extend(_logbook_title_string_patches())

    return string_patches
def test_create_hints_all_starting(hide_area: bool,
                                   empty_patches, echoes_game_description):
    # Setup
    patches = empty_patches.assign_extra_initial_items({
        echoes_game_description.resource_database.get_item(echoes_items.SKY_TEMPLE_KEY_ITEMS[key]): 1
        for key in range(9)
    })

    expected = [
        {"asset_id": 0xD97685FE,
         "strings": make_starting_stk_hint(1)},
        {"asset_id": 0x32413EFD,
         "strings": make_starting_stk_hint(2)},
        {"asset_id": 0xDD8355C3,
         "strings": make_starting_stk_hint(3)},
        {"asset_id": 0x3F5F4EBA,
         "strings": make_starting_stk_hint(4)},
        {"asset_id": 0xD09D2584,
         "strings": make_starting_stk_hint(5)},
        {"asset_id": 0x3BAA9E87,
         "strings": make_starting_stk_hint(6)},
        {"asset_id": 0xD468F5B9,
         "strings": make_starting_stk_hint(7)},
        {"asset_id": 0x2563AE34,
         "strings": make_starting_stk_hint(8)},
        {"asset_id": 0xCAA1C50A,
         "strings": make_starting_stk_hint(9)},
    ]

    # Run
    result = sky_temple_key_hint.create_hints(patches, echoes_game_description.world_list, hide_area)

    # Assert
    assert result == expected
def test_create_hints_all_placed(hide_area: bool,
                                 empty_patches, echoes_game_description):
    # Setup
    patches = empty_patches.assign_new_pickups([
        (PickupIndex(17 + key), pickup_creator.create_sky_temple_key(key, echoes_game_description.resource_database))
        for key in range(9)
    ])
    expected = [
        {"asset_id": 0xD97685FE,
         "strings": _create_hint_text(hide_area, 1, "Sky Temple Grounds - Profane Path")},
        {"asset_id": 0x32413EFD,
         "strings": _create_hint_text(hide_area, 2, "Sky Temple Grounds - Phazon Grounds")},
        {"asset_id": 0xDD8355C3,
         "strings": _create_hint_text(hide_area, 3, "Sky Temple Grounds - Ing Reliquary")},
        {"asset_id": 0x3F5F4EBA,
         "strings": _create_hint_text(hide_area, 4, "Great Temple - Transport A Access")},
        {"asset_id": 0xD09D2584,
         "strings": _create_hint_text(hide_area, 5, "Great Temple - Temple Sanctuary")},
        {"asset_id": 0x3BAA9E87,
         "strings": _create_hint_text(hide_area, 6, "Great Temple - Transport B Access")},
        {"asset_id": 0xD468F5B9,
         "strings": _create_hint_text(hide_area, 7, "Great Temple - Main Energy Controller")},
        {"asset_id": 0x2563AE34,
         "strings": _create_hint_text(hide_area, 8, "Great Temple - Main Energy Controller")},
        {"asset_id": 0xCAA1C50A,
         "strings": _create_hint_text(hide_area, 9, "Agon Wastes - Mining Plaza")},
    ]

    # Run
    result = sky_temple_key_hint.create_hints(patches, echoes_game_description.world_list, hide_area)

    # Assert
    assert result == expected
Example #4
0
def _create_string_patches(
    hint_config: HintConfiguration,
    game: GameDescription,
    patches: GamePatches,
    rng: Random,
) -> list:
    """

    :param hint_config:
    :param game:
    :param patches:
    :return:
    """
    string_patches = []

    # Location Hints
    string_patches.extend(
        item_hints.create_hints(patches, game.world_list, rng))

    # Sky Temple Keys
    stk_mode = hint_config.sky_temple_keys
    if stk_mode == SkyTempleKeyHintMode.DISABLED:
        string_patches.extend(sky_temple_key_hint.hide_hints())
    else:
        string_patches.extend(
            sky_temple_key_hint.create_hints(
                patches, game.world_list,
                stk_mode == SkyTempleKeyHintMode.HIDE_AREA))

    return string_patches
def test_create_hints_all_starting(hide_area: bool, multiworld: bool,
                                   empty_patches, echoes_game_description):
    # Setup
    players_config = PlayersConfiguration(0, {
        0: "you",
        1: "them"
    } if multiworld else {0: "you"})
    area_namer = {0: None, 1: None} if multiworld else {0: None}
    patches = empty_patches.assign_extra_initial_items({
        echoes_game_description.resource_database.get_item(
            echoes_items.SKY_TEMPLE_KEY_ITEMS[key]): 1
        for key in range(9)
    })

    expected = [
        {
            "asset_id": 0xD97685FE,
            "strings": make_starting_stk_hint(1)
        },
        {
            "asset_id": 0x32413EFD,
            "strings": make_starting_stk_hint(2)
        },
        {
            "asset_id": 0xDD8355C3,
            "strings": make_starting_stk_hint(3)
        },
        {
            "asset_id": 0x3F5F4EBA,
            "strings": make_starting_stk_hint(4)
        },
        {
            "asset_id": 0xD09D2584,
            "strings": make_starting_stk_hint(5)
        },
        {
            "asset_id": 0x3BAA9E87,
            "strings": make_starting_stk_hint(6)
        },
        {
            "asset_id": 0xD468F5B9,
            "strings": make_starting_stk_hint(7)
        },
        {
            "asset_id": 0x2563AE34,
            "strings": make_starting_stk_hint(8)
        },
        {
            "asset_id": 0xCAA1C50A,
            "strings": make_starting_stk_hint(9)
        },
    ]

    # Run
    result = sky_temple_key_hint.create_hints(
        {0: patches}, players_config,
        echoes_game_description.resource_database, area_namer, hide_area)

    # Assert
    assert result == expected
def test_create_hints_all_placed(hide_area: bool, multiworld: bool,
                                 empty_patches, echoes_game_description):
    # Setup
    hint_creator = LocationHintCreator(echoes_game_description.world_list,
                                       None, None)
    players_config = PlayersConfiguration(0, {
        0: "you",
        1: "them"
    } if multiworld else {0: "you"})
    patches = empty_patches.assign_new_pickups([
        (PickupIndex(17 + key),
         PickupTarget(
             pickup_creator.create_sky_temple_key(
                 key, echoes_game_description.resource_database), 0))
        for key in range(5 if multiworld else 9)
    ])
    other_patches = empty_patches.assign_new_pickups([
        (PickupIndex(17 + key),
         PickupTarget(
             pickup_creator.create_sky_temple_key(
                 key, echoes_game_description.resource_database), 0))
        for key in range(5, 9)
    ])
    expected = [
        {
            "asset_id":
            0xD97685FE,
            "strings":
            _create_hint_text(hide_area, multiworld, 1,
                              "Sky Temple Grounds - Profane Path")
        },
        {
            "asset_id":
            0x32413EFD,
            "strings":
            _create_hint_text(hide_area, multiworld, 2,
                              "Sky Temple Grounds - Phazon Grounds")
        },
        {
            "asset_id":
            0xDD8355C3,
            "strings":
            _create_hint_text(hide_area, multiworld, 3,
                              "Sky Temple Grounds - Ing Reliquary")
        },
        {
            "asset_id":
            0x3F5F4EBA,
            "strings":
            _create_hint_text(hide_area, multiworld, 4,
                              "Great Temple - Transport A Access")
        },
        {
            "asset_id":
            0xD09D2584,
            "strings":
            _create_hint_text(hide_area, multiworld, 5,
                              "Great Temple - Temple Sanctuary")
        },
        {
            "asset_id":
            0x3BAA9E87,
            "strings":
            _create_hint_text(hide_area, multiworld, 6,
                              "Great Temple - Transport B Access")
        },
        {
            "asset_id":
            0xD468F5B9,
            "strings":
            _create_hint_text(hide_area, multiworld, 7,
                              "Great Temple - Main Energy Controller")
        },
        {
            "asset_id":
            0x2563AE34,
            "strings":
            _create_hint_text(hide_area, multiworld, 8,
                              "Great Temple - Main Energy Controller")
        },
        {
            "asset_id":
            0xCAA1C50A,
            "strings":
            _create_hint_text(hide_area, multiworld, 9,
                              "Agon Wastes - Mining Plaza")
        },
    ]

    # Run
    result = sky_temple_key_hint.create_hints(
        {
            0: patches,
            1: other_patches
        } if multiworld else {0: patches}, players_config,
        echoes_game_description.resource_database, {
            0: hint_creator,
            1: hint_creator
        } if multiworld else {0: hint_creator}, hide_area)

    # Assert
    assert result == expected