示例#1
0
def hide_hints(world_list: WorldList) -> list:
    """
    Creates the string patches entries that changes the Lore scans in the game
    completely useless text.
    :return:
    """

    return [create_simple_logbook_hint(logbook_node.string_asset_id, "Some item was placed somewhere.")
            for logbook_node in world_list.all_nodes if isinstance(logbook_node, LogbookNode)]
示例#2
0
def create_hints(
    all_patches: Dict[int, GamePatches],
    players_config: PlayersConfiguration,
    world_list: WorldList,
    rng: Random,
) -> list:
    """
    Creates the string patches entries that changes the Lore scans in the game for item pickups
    :param all_patches:
    :param players_config:
    :param world_list:
    :param rng:
    :return:
    """

    hint_name_creator = LocationHintCreator(world_list, rng, _JOKE_HINTS)
    patches = all_patches[players_config.player_index]

    location_formatters: Dict[HintLocationPrecision, LocationFormatter] = {
        HintLocationPrecision.KEYBEARER:
        TemplatedFormatter(
            "The Flying Ing Cache in {node} contains {determiner}{pickup}.",
            hint_name_creator),
        HintLocationPrecision.GUARDIAN:
        GuardianFormatter(),
        HintLocationPrecision.LIGHT_SUIT_LOCATION:
        TemplatedFormatter(
            "U-Mos's reward for returning the Sanctuary energy is {determiner}{pickup}.",
            hint_name_creator),
        HintLocationPrecision.DETAILED:
        TemplatedFormatter(
            "{determiner.title}{pickup} can be found in {node}.",
            hint_name_creator),
        HintLocationPrecision.WORLD_ONLY:
        TemplatedFormatter(
            "{determiner.title}{pickup} can be found in {node}.",
            hint_name_creator),
        HintLocationPrecision.RELATIVE_TO_AREA:
        RelativeAreaFormatter(world_list, patches),
        HintLocationPrecision.RELATIVE_TO_INDEX:
        RelativeItemFormatter(world_list, patches),
    }

    hints_for_asset: Dict[int, str] = {}
    for asset, hint in patches.hints.items():
        hints_for_asset[asset.asset_id] = create_message_for_hint(
            hint, all_patches, players_config, hint_name_creator,
            location_formatters, world_list)

    return [
        create_simple_logbook_hint(
            logbook_node.string_asset_id,
            hints_for_asset.get(logbook_node.string_asset_id,
                                "Someone forgot to leave a message."),
        ) for logbook_node in world_list.all_nodes
        if isinstance(logbook_node, LogbookNode)
    ]
示例#3
0
def hide_hints() -> list:
    """
    Creates the string patches entries that changes the Sky Temple Gateway hint scans with hints for
    completely useless text.
    :return:
    """

    return [
        create_simple_logbook_hint(
            _SKY_TEMPLE_KEY_SCAN_ASSETS[key_number],
            "{} is lost somewhere in Aether.".format(
                _sky_temple_key_name(key_number + 1)),
        ) for key_number in range(9)
    ]
示例#4
0
def create_hints(
    patches: GamePatches,
    world_list: WorldList,
    hide_area: bool,
) -> list:
    """
    Creates the string patches entries that changes the Sky Temple Gateway hint scans with hints for where
    the STK actually are.
    :param patches:
    :param world_list:
    :param hide_area: Should the hint include only the world?
    :return:
    """
    location_hint_creator = LocationHintCreator(world_list)
    sky_temple_key_hints = {}

    for pickup_index, pickup in patches.pickup_assignment.items():
        resources = resource_info.convert_resource_gain_to_current_resources(
            pickup.resource_gain({}))

        for resource, quantity in resources.items():
            if quantity < 1:
                continue

            try:
                key_number = echoes_items.SKY_TEMPLE_KEY_ITEMS.index(
                    resource.index) + 1
            except ValueError:
                continue

            assert resource.index not in sky_temple_key_hints

            sky_temple_key_hints[
                resource.index] = "{} is located in {}.".format(
                    _sky_temple_key_name(key_number),
                    color_text(
                        TextColor.LOCATION,
                        location_hint_creator.index_node_name(
                            pickup_index, hide_area),
                    ),
                )

    for starting_resource, quantity in patches.starting_items.items():
        if quantity < 1:
            continue
        try:
            key_number = echoes_items.SKY_TEMPLE_KEY_ITEMS.index(
                starting_resource.index) + 1
        except ValueError:
            continue

        assert starting_resource.index not in sky_temple_key_hints
        sky_temple_key_hints[
            starting_resource.index] = "{} has no need to be located.".format(
                _sky_temple_key_name(key_number), )

    if len(sky_temple_key_hints) != len(echoes_items.SKY_TEMPLE_KEY_ITEMS):
        raise ValueError(
            "Expected to find {} Sky Temple Keys between pickup placement and starting items, found {}"
            .format(len(echoes_items.SKY_TEMPLE_KEY_ITEMS),
                    len(sky_temple_key_hints)))

    return [
        create_simple_logbook_hint(_SKY_TEMPLE_KEY_SCAN_ASSETS[key_number],
                                   sky_temple_key_hints[key_index]) for
        key_number, key_index in enumerate(echoes_items.SKY_TEMPLE_KEY_ITEMS)
    ]
示例#5
0
def create_hints(patches: GamePatches,
                 world_list: WorldList,
                 rng: Random,
                 ) -> list:
    """
    Creates the string patches entries that changes the Lore scans in the game for item pickups
    :param patches:
    :param world_list:
    :param rng:
    :return:
    """

    hint_name_creator = LocationHintCreator(world_list)
    joke_items = sorted(set(_PRIME_1_ITEMS) | set(_PRIME_3_ITEMS))
    joke_locations = sorted(set(_PRIME_1_LOCATIONS) | set(_PRIME_3_LOCATIONS))
    joke_hints = sorted(_JOKE_HINTS)

    rng.shuffle(joke_items)
    rng.shuffle(joke_locations)
    rng.shuffle(joke_hints)

    hints_for_asset: Dict[int, str] = {}

    for asset, hint in patches.hints.items():
        if hint.precision.is_joke:
            if not joke_hints:
                joke_hints = sorted(_JOKE_HINTS)
                rng.shuffle(joke_hints)
            message = color_text(TextColor.JOKE, joke_hints.pop())

        else:
            target = patches.pickup_assignment.get(hint.target)

            # Determine location name
            if hint.hint_type is HintType.GUARDIAN:
                node_name = color_text(TextColor.GUARDIAN, _GUARDIAN_NAMES[hint.target])
            elif hint.location_precision == HintLocationPrecision.WRONG_GAME:
                node_name = color_text(TextColor.JOKE, "{} (?)".format(joke_locations.pop())
                                       if joke_locations else "an unknown location")
            else:
                node_name = color_text(TextColor.LOCATION, hint_name_creator.index_node_name(
                    hint.target,
                    hint.location_precision != HintLocationPrecision.DETAILED
                ))

            # Determine pickup name
            if target is not None:
                is_joke, determiner, pickup_name = _calculate_pickup_hint(
                    hint.item_precision,
                    _calculate_determiner(patches.pickup_assignment, target.pickup),
                    target.pickup,
                    joke_items,
                )
            else:
                is_joke = False
                determiner = "the " if len(patches.pickup_assignment) == 118 else "an "
                pickup_name = "Energy Transfer Module"

            if hint.hint_type is HintType.LOCATION:
                determiner = determiner.title()

            pickup_name = color_text(TextColor.JOKE if is_joke else TextColor.ITEM, pickup_name)
            message = _HINT_MESSAGE_TEMPLATES[hint.hint_type].format(determiner=determiner,
                                                                     pickup=pickup_name,
                                                                     node=node_name)
        hints_for_asset[asset.asset_id] = message

    return [
        create_simple_logbook_hint(
            logbook_node.string_asset_id,
            hints_for_asset.get(logbook_node.string_asset_id, "Someone forgot to leave a message."),
        )
        for logbook_node in world_list.all_nodes
        if isinstance(logbook_node, LogbookNode)
    ]