Пример #1
0
def _register_dialog():
    dialog_options = [
        buy_consumable_option(ConsumableType.HEALTH, 5),
        buy_consumable_option(ConsumableType.MANA, 5),
        buy_consumable_option(ConsumableType.SPEED, 5),
        buy_consumable_option(ConsumableType.POWER, 10),
        DialogOptionData("\"Good bye\"", "cancel", None)
    ]
    text_low_level = "Huh?! Well, aren't you the brave one, making it all the way out here! I would think " \
                     "twice before heading down that way! Well since you are here, see if any of these " \
                     "potions are of interest."
    text_high_level = "You are on the doorsteps of the Red Baron's domain! Please be careful. " \
                      "Here, see if any of these potions can be of use."
    dialog_low_level = DialogData(PORTRAIT_ICON_SPRITE, text_low_level,
                                  dialog_options)
    dialog_high_level = DialogData(PORTRAIT_ICON_SPRITE, text_high_level,
                                   dialog_options)

    def get_dialog_data(game_state: GameState) -> DialogData:
        if game_state.player_state.level < 5:
            return dialog_low_level
        else:
            return dialog_high_level

    register_conditional_npc_dialog_data(NPC_TYPE, get_dialog_data)
Пример #2
0
def _register_dialog():
    bye_option = DialogOptionData("\"Good bye\"", "cancel", None)
    name = "Tink"
    low_level_dialog = DialogData(
        name=name,
        portrait_icon_sprite=UI_ICON_SPRITE,
        text_body=
        "These aren't any regular old statues! They are magical gateways to distant places! "
        "I'm extracting their powers into something more ... mobile! "
        "Just give me a while, and come back later!",
        options=[bye_option])

    high_level_dialog = DialogData(
        name=name,
        portrait_icon_sprite=UI_ICON_SPRITE,
        text_body="Hah! I managed to infuse the statues' teleporting powers into these stones. " \
                  "You can carry them with you and use them any time you want to return to this place! "
                  "Isn't that neat?",
        options=[buy_consumable_option(ConsumableType.WARP_STONE, 2), bye_option])

    def get_dialog_data(game_state: GameState) -> DialogData:
        if game_state.player_state.level < 2:
            return low_level_dialog
        else:
            return high_level_dialog

    register_conditional_npc_dialog_data(NPC_TYPE, get_dialog_data)
Пример #3
0
def _register_dialog():
    dialog_text_body = "Ah.. You're new here, aren't you? Interested in my stock of potions? They come at a price of course..."
    consumables_1 = [
        buy_consumable_option(ConsumableType.BREW, 2),
        buy_consumable_option(ConsumableType.HEALTH_LESSER, 3),
        buy_consumable_option(ConsumableType.MANA_LESSER, 3)
    ]
    consumables_2 = [
        buy_consumable_option(ConsumableType.SPEED, 4),
        buy_consumable_option(ConsumableType.POWER, 10)
    ]
    bye_option = DialogOptionData("\"Good bye\"", "cancel", None)

    name = "Zak"
    dialog_low_level = DialogData(name, PORTRAIT_ICON_SPRITE, dialog_text_body,
                                  consumables_1 + [bye_option])
    dialog_high_level = DialogData(
        name, PORTRAIT_ICON_SPRITE, dialog_text_body,
        consumables_1 + consumables_2 + [bye_option])

    def get_dialog_data(game_state: GameState) -> DialogData:
        if game_state.player_state.level < 3:
            return dialog_low_level
        else:
            return dialog_high_level

    register_conditional_npc_dialog_data(NPC_TYPE, get_dialog_data)
Пример #4
0
def register_quest_giver_dialog(
        npc_name: str,
        npc_type: NpcType,
        icon_sprite: PortraitIconSprite,
        icon_sprite_file_path: str,
        quest: Quest,
        quest_min_level: int,
        quest_intro: str,
        boss_npc_type: NpcType,
        quest_item_type: ItemType,
        custom_options: List[DialogOptionData],
        dialog_before_quest: str,
        dialog_give_quest: str,
        dialog_during_quest: str,
        dialog_after_completed: str,
        reward_item_id: Callable[[GameState], Optional[ItemId]]):
    bye_option = DialogOptionData("\"Good bye\"", "cancel", None)

    register_quest(quest.quest_id, quest)

    give_quest = give_quest_option(quest, quest_intro, boss_npc_type, quest_item_type)
    complete_quest = complete_quest_option(quest, boss_npc_type, quest_item_type, reward_item_id)

    dialog_data_before_quest = DialogData(
        npc_name,
        icon_sprite,
        dialog_before_quest,
        custom_options + [bye_option])
    dialog_data_give_quest = DialogData(
        npc_name,
        icon_sprite,
        dialog_give_quest,
        custom_options + [give_quest, bye_option])
    dialog_data_during_quest = DialogData(
        npc_name,
        icon_sprite,
        dialog_during_quest,
        custom_options + [complete_quest, bye_option])
    dialog_data_after_completed = DialogData(
        npc_name,
        icon_sprite,
        dialog_after_completed,
        custom_options + [bye_option])

    def get_dialog_data(game_state: GameState) -> DialogData:
        if game_state.player_state.has_completed_quest(quest.quest_id):
            return dialog_data_after_completed
        elif game_state.player_state.has_quest(quest.quest_id):
            return dialog_data_during_quest
        elif game_state.player_state.level >= quest_min_level:
            return dialog_data_give_quest
        else:
            return dialog_data_before_quest

    register_conditional_npc_dialog_data(npc_type, get_dialog_data)
    register_portrait_icon_sprite_path(icon_sprite, icon_sprite_file_path)
Пример #5
0
def _register_dialog():
    option_blessing = DialogOptionData("Receive blessing", "gain full health",
                                       HealAction())
    option_advice = DialogOptionData("Ask for advice", "see random hint",
                                     HintAction())
    option_accept_quest = DialogOptionData(
        "QUEST: \"The red baron\"", "accept quest", AcceptQuest(),
        UiIconSprite.ITEM_KEY, "Key",
        "The red baron... Yes, he has caused us much trouble. He stole from me a key that may"
        " lead us out of here. You must bring it back to me!")
    option_complete_quest = DialogOptionData("QUEST: \"The red baron\"",
                                             "give", CompleteQuest(),
                                             UiIconSprite.ITEM_KEY, "Key",
                                             "...")
    option_bye = DialogOptionData("\"Good bye\"", "cancel", None)
    name = "Nomad"
    dialog_text = "Greetings. I am here only to serve. Seek me out when you are wounded or need guidance!"
    dialog_before_quest = DialogData(
        name, PORTRAIT_ICON_SPRITE, dialog_text,
        [option_blessing, option_advice, option_bye])
    dialog_can_give_quest = DialogData(
        name, PORTRAIT_ICON_SPRITE, dialog_text,
        [option_blessing, option_advice, option_accept_quest, option_bye])
    dialog_during_quest = DialogData(
        name, PORTRAIT_ICON_SPRITE, dialog_text,
        [option_blessing, option_advice, option_complete_quest, option_bye])
    dialog_after_quest = DialogData(
        name, PORTRAIT_ICON_SPRITE, "Oh you're back...",
        [option_blessing, option_advice, option_bye])

    def get_dialog_data(game_state: GameState) -> DialogData:
        if game_state.player_state.has_completed_quest(QUEST_ID):
            return dialog_after_quest
        elif game_state.player_state.has_quest(QUEST_ID):
            return dialog_during_quest
        elif _is_player_eligible_for_quest(game_state):
            return dialog_can_give_quest
        else:
            return dialog_before_quest

    register_conditional_npc_dialog_data(NPC_TYPE, get_dialog_data)