Exemplo n.º 1
0
def register_dwarf_npc():
    size = (
        30, 30
    )  # Must not align perfectly with grid cell size (pathfinding issues)
    sprite = Sprite.NEUTRAL_NPC_DWARF
    npc_type = NpcType.NEUTRAL_DWARF
    movement_speed = 0.03
    register_npc_data(npc_type, NpcData.neutral(sprite, size, movement_speed))
    register_npc_behavior(npc_type, NpcMind)
    introduction = "Hello there. I'm always looking for treasure. If you find any, we might be able to strike a deal!"
    dialog_options = [
        sell_item_option(
            ItemType.GOLD_NUGGET, 20,
            "I'll give you good money for a nugget of pure gold!"),
        sell_item_option(ItemType.SAPHIRE, 30,
                         "If you find a saphire I can make you real rich!"),
        DialogOptionData("\"Good bye\"", "cancel", None)
    ]
    dialog_data = DialogData(PortraitIconSprite.VIKING, introduction,
                             dialog_options)
    register_npc_dialog_data(npc_type, dialog_data)
    sprite_sheet = SpriteSheet("resources/graphics/enemy_sprite_sheet.png")
    original_sprite_size = (32, 32)
    scaled_sprite_size = (48, 48)
    indices_by_dir = {
        Direction.DOWN: [(0, 4), (1, 4), (2, 4)],
        Direction.LEFT: [(0, 5), (1, 5), (2, 5)],
        Direction.RIGHT: [(0, 6), (1, 6), (2, 6)],
        Direction.UP: [(0, 7), (1, 7), (2, 7)]
    }
    register_entity_sprite_map(sprite, sprite_sheet, original_sprite_size,
                               scaled_sprite_size, indices_by_dir, (-8, -16))
    register_portrait_icon_sprite_path(
        PortraitIconSprite.VIKING, 'resources/graphics/viking_portrait.png')
Exemplo n.º 2
0
def register_sorcerer_npc():
    size = (30, 30)  # Must not align perfectly with grid cell size (pathfinding issues)
    sprite = Sprite.NEUTRAL_NPC_SORCERER
    portrait_icon_sprite = PortraitIconSprite.SORCERER
    npc_type = NpcType.NEUTRAL_SORCERER
    movement_speed = 0.03
    register_npc_data(npc_type, NpcData.neutral(sprite, size, movement_speed))
    register_npc_behavior(npc_type, NpcMind)
    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)]
    dialog_text_body = "Greetings. I am glad to see that you have made it this far! However, great danger lies ahead... " \
                       "Here, see if any of these potions are of interest to you."
    dialog_data = DialogData(portrait_icon_sprite, dialog_text_body, dialog_options)
    register_npc_dialog_data(npc_type, dialog_data)
    sprite_sheet = SpriteSheet("resources/graphics/enemy_sprite_sheet_3.png")
    original_sprite_size = (32, 32)
    scaled_sprite_size = (48, 48)
    x = 3
    indices_by_dir = {
        Direction.DOWN: [(x, 4), (x + 1, 4), (x + 2, 4)],
        Direction.LEFT: [(x, 5), (x + 1, 5), (x + 2, 5)],
        Direction.RIGHT: [(x, 6), (x + 1, 6), (x + 2, 6)],
        Direction.UP: [(x, 7), (x + 1, 7), (x + 2, 7)]
    }
    register_entity_sprite_map(sprite, sprite_sheet, original_sprite_size, scaled_sprite_size, indices_by_dir,
                               (-8, -16))
    register_portrait_icon_sprite_path(portrait_icon_sprite, 'resources/graphics/portrait_sorcerer_npc.png')
Exemplo n.º 3
0
def register_frog_npc():
    size = (
        30, 30
    )  # Must not align perfectly with grid cell size (pathfinding issues)
    sprite = Sprite.NEUTRAL_NPC_FROG
    movement_speed = 0.03
    register_npc_data(NPC_TYPE, NpcData.neutral(sprite, size, movement_speed))
    register_npc_behavior(NPC_TYPE, NpcMind)
    _register_dialog()
    sprite_sheet = SpriteSheet(
        "resources/graphics/characters_midona_spritesheet.png")
    original_sprite_size = (32, 32)
    scaled_sprite_size = (48, 48)
    x = 6
    y = 0
    indices_by_dir = {
        Direction.DOWN: [(x, y), (x + 1, y), (x + 2, y)],
        Direction.LEFT: [(x, y + 1), (x + 1, y + 1), (x + 2, y + 1)],
        Direction.RIGHT: [(x, y + 2), (x + 1, y + 2), (x + 2, y + 2)],
        Direction.UP: [(x, y + 3), (x + 1, y + 3), (x + 2, y + 3)]
    }
    register_entity_sprite_map(sprite, sprite_sheet, original_sprite_size,
                               scaled_sprite_size, indices_by_dir, (-9, -18))
    register_portrait_icon_sprite_path(
        UI_ICON_SPRITE, 'resources/graphics/portrait_frog_npc.png')
def register_warpstone_merchant_npc():
    size = (
        30, 30
    )  # Must not align perfectly with grid cell size (pathfinding issues)
    sprite = Sprite.NEUTRAL_WARPSTONE_MERCHANT
    npc_type = NpcType.NEUTRAL_WARPSTONE_MERCHANT
    ui_icon_sprite = PortraitIconSprite.WARPSTONE_MERCHANT
    movement_speed = 0.03
    register_npc_data(npc_type, NpcData.neutral(sprite, size, movement_speed))
    register_npc_behavior(npc_type, NpcMind)
    introduction = "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!"
    dialog_options = [
        buy_consumable_option(ConsumableType.WARP_STONE, 2),
        DialogOptionData("\"Good bye\"", "cancel", None)
    ]
    dialog_data = DialogData(ui_icon_sprite, introduction, dialog_options)
    register_npc_dialog_data(npc_type, dialog_data)
    sprite_sheet = SpriteSheet("resources/graphics/manga_spritesheet.png")
    original_sprite_size = (32, 32)
    scaled_sprite_size = (48, 48)
    x = 0
    y = 0
    indices_by_dir = {
        Direction.DOWN: [(x, y), (x + 1, y), (x + 2, y)],
        Direction.LEFT: [(x, y + 1), (x + 1, y + 1), (x + 2, y + 1)],
        Direction.RIGHT: [(x, y + 2), (x + 1, y + 2), (x + 2, y + 2)],
        Direction.UP: [(x, y + 3), (x + 1, y + 3), (x + 2, y + 3)]
    }
    register_entity_sprite_map(sprite, sprite_sheet, original_sprite_size,
                               scaled_sprite_size, indices_by_dir, (-8, -16))
    register_portrait_icon_sprite_path(
        ui_icon_sprite,
        'resources/graphics/portrait_warpstone_merchant_npc.png')
Exemplo n.º 5
0
def register_ninja_npc():
    size = (
        30, 30
    )  # Must not align perfectly with grid cell size (pathfinding issues)
    sprite = Sprite.NEUTRAL_NPC_NINJA

    movement_speed = 0.03
    register_npc_data(NPC_TYPE, NpcData.neutral(sprite, size, movement_speed))
    register_npc_behavior(NPC_TYPE, NpcMind)

    _register_dialog()

    sprite_sheet = SpriteSheet("resources/graphics/enemy_sprite_sheet_3.png")
    original_sprite_size = (32, 32)
    scaled_sprite_size = (48, 48)
    x = 6
    indices_by_dir = {
        Direction.DOWN: [(x, 0), (x + 1, 0), (x + 2, 0)],
        Direction.LEFT: [(x, 1), (x + 1, 1), (x + 2, 1)],
        Direction.RIGHT: [(x, 2), (x + 1, 2), (x + 2, 2)],
        Direction.UP: [(x, 3), (x + 1, 3), (x + 2, 3)]
    }
    register_entity_sprite_map(sprite, sprite_sheet, original_sprite_size,
                               scaled_sprite_size, indices_by_dir, (-8, -16))
    register_portrait_icon_sprite_path(
        PORTRAIT_ICON_SPRITE, 'resources/graphics/ninja_portrait.png')
Exemplo n.º 6
0
def register_dwarf_npc():
    size = (
        30, 30
    )  # Must not align perfectly with grid cell size (pathfinding issues)
    sprite = Sprite.NEUTRAL_NPC_DWARF
    npc_type = NpcType.NEUTRAL_DWARF
    movement_speed = 0.03
    register_npc_data(npc_type, NpcData.neutral(sprite, size, movement_speed))
    register_npc_behavior(npc_type, NpcMind)
    sprite_sheet = SpriteSheet("resources/graphics/enemy_sprite_sheet.png")
    original_sprite_size = (32, 32)
    scaled_sprite_size = (48, 48)
    indices_by_dir = {
        Direction.DOWN: [(0, 4), (1, 4), (2, 4)],
        Direction.LEFT: [(0, 5), (1, 5), (2, 5)],
        Direction.RIGHT: [(0, 6), (1, 6), (2, 6)],
        Direction.UP: [(0, 7), (1, 7), (2, 7)]
    }
    register_entity_sprite_map(sprite, sprite_sheet, original_sprite_size,
                               scaled_sprite_size, indices_by_dir, (-8, -16))

    register_quest_giver_dialog(
        npc_name="Gimli",
        npc_type=npc_type,
        icon_sprite=UI_ICON_SPRITE,
        icon_sprite_file_path='resources/graphics/viking_portrait.png',
        quest=Quest(QUEST_ID, "Corrupted orb",
                    "Defeat the skeleton king and retrieve the magic orb."),
        quest_min_level=QUEST_MIN_LEVEL,
        quest_intro=
        "I've heard tales of a powerful skeleton mage that possesses a very rare magic orb. I think it's "
        "time that it finds itself a new owner!",
        boss_npc_type=NpcType.SKELETON_BOSS,
        quest_item_type=QUEST_ITEM_TYPE,
        custom_options=[
            sell_item_option(
                plain_item_id(ItemType.GOLD_NUGGET), 20,
                "I'll give you good money for a nugget of pure gold!"),
            sell_item_option(
                plain_item_id(ItemType.SAPPHIRE), 30,
                "If you find a sapphire I can make you real rich!")
        ],
        dialog_before_quest=
        "Hello there. I'm always looking for treasure. If you find any, we might be able to strike a "
        "deal!",
        dialog_give_quest=
        "Hello there. I'm always looking for treasure. If you find any, we might be able to strike a "
        "deal!",
        dialog_during_quest="Hey! Any luck with the orb?",
        dialog_after_completed="Hi old friend! Got any more good stuff?",
        reward_item_id=lambda _: random_item_two_affixes(5))
Exemplo n.º 7
0
def register_nomad_npc():
    sprite = Sprite.NEUTRAL_NPC_NOMAD
    npc_type = NpcType.NEUTRAL_NOMAD
    register_npc_data(
        npc_type, NpcData.neutral(sprite=sprite, size=(30, 30), speed=0.03))
    register_npc_behavior(npc_type, NpcMind)
    register_entity_sprite_map(
        sprite=sprite,
        sprite_sheet=SpriteSheet(
            "resources/graphics/enemy_sprite_sheet_3.png"),
        original_sprite_size=(32, 32),
        scaled_sprite_size=(48, 48),
        indices_by_dir={
            Direction.DOWN: [(3, 0), (4, 0), (5, 0)],
            Direction.LEFT: [(3, 1), (4, 1), (5, 1)],
            Direction.RIGHT: [(3, 2), (4, 2), (5, 2)],
            Direction.UP: [(3, 3), (4, 3), (5, 3)]
        },
        position_relative_to_entity=(-8, -16))

    register_quest_giver_dialog(
        npc_name="Nomad",
        npc_type=NpcType.NEUTRAL_NOMAD,
        icon_sprite=PortraitIconSprite.NOMAD,
        icon_sprite_file_path='resources/graphics/nomad_portrait.png',
        quest=QUEST,
        quest_min_level=QUEST_MIN_LEVEL,
        quest_intro=
        "The red baron has caused us great trouble. Get rid of him and I'll be forever "
        "grateful! Oh, and please bring back anything interesting that he's carrying.",
        boss_npc_type=NpcType.WARRIOR_KING,
        quest_item_type=QUEST_ITEM_TYPE,
        custom_options=[
            DialogOptionData("Receive blessing", "gain full health",
                             HealAction()),
            DialogOptionData("Ask for advice", "see random hint", HintAction())
        ],
        dialog_before_quest=
        "Greetings. I am here only to serve. Seek me out when you are wounded or need guidance!",
        dialog_give_quest=
        "Greetings. I am here only to serve. Seek me out when you are wounded or need guidance!",
        dialog_during_quest=
        "Greetings. I am here only to serve. Seek me out when you are wounded or need guidance!",
        dialog_after_completed=
        "Greetings. I am here only to serve. Seek me out when you are wounded or need guidance!",
        reward_item_id=lambda _: plain_item_id(ItemType.PORTAL_KEY))
def register_young_sorceress_npc():
    npc_type = NpcType.NEUTRAL_YOUNG_SORCERESS
    size = (
        30, 30
    )  # Must not align perfectly with grid cell size (pathfinding issues)
    sprite = Sprite.NEUTRAL_NPC_YOUNG_SORCERESS
    movement_speed = 0.03
    register_npc_data(npc_type, NpcData.neutral(sprite, size, movement_speed))
    register_npc_behavior(npc_type, NpcMind)
    sprite_sheet = SpriteSheet("resources/graphics/manga_spritesheet.png")
    original_sprite_size = (32, 32)
    scaled_sprite_size = (48, 48)
    x = 6
    indices_by_dir = {
        Direction.DOWN: [(x, 4), (x + 1, 4), (x + 2, 4)],
        Direction.LEFT: [(x, 5), (x + 1, 5), (x + 2, 5)],
        Direction.RIGHT: [(x, 6), (x + 1, 6), (x + 2, 6)],
        Direction.UP: [(x, 7), (x + 1, 7), (x + 2, 7)]
    }
    register_entity_sprite_map(sprite, sprite_sheet, original_sprite_size,
                               scaled_sprite_size, indices_by_dir, (-8, -16))

    register_quest_giver_dialog(
        npc_name="Mida",
        npc_type=NpcType.NEUTRAL_YOUNG_SORCERESS,
        icon_sprite=PortraitIconSprite.YOUNG_SORCERESS,
        icon_sprite_file_path=
        'resources/graphics/portrait_young_sorceress_npc.png',
        quest=Quest(QUEST_ID, "Lost pet",
                    "Retrieve Mida's pet frog from the goblin king."),
        quest_min_level=QUEST_MIN_LEVEL,
        quest_intro=
        "Will you help me? I'll give you something in return. Promise!",
        boss_npc_type=NpcType.GOBLIN_WARRIOR,
        quest_item_type=ItemType.QUEST_FROG,
        custom_options=[],
        dialog_before_quest="",
        dialog_give_quest=
        "Hey you! Have you seen my pet frog? I bet it was that old green mean goblin king that took "
        "it!",
        dialog_during_quest="Hi friend! Any luck?",
        dialog_after_completed="Thank you for helping me!",
        reward_item_id=_get_reward_for_hero)
Exemplo n.º 9
0
def register_ninja_npc():
    size = (
        30, 30
    )  # Must not align perfectly with grid cell size (pathfinding issues)
    sprite = Sprite.NEUTRAL_NPC_NINJA
    portrait_icon_sprite = PortraitIconSprite.NINJA
    npc_type = NpcType.NEUTRAL_NINJA
    movement_speed = 0.03
    register_npc_data(npc_type, NpcData.neutral(sprite, size, movement_speed))
    register_npc_behavior(npc_type, NpcMind)

    dialog_options = [
        buy_consumable_option(ConsumableType.BREW, 2),
        buy_consumable_option(ConsumableType.HEALTH_LESSER, 3),
        buy_consumable_option(ConsumableType.MANA_LESSER, 3),
        buy_consumable_option(ConsumableType.SPEED, 4),
        buy_consumable_option(ConsumableType.POWER, 10),
        DialogOptionData("\"Good bye\"", "cancel", None)
    ]
    dialog_text_body = "Ah.. You're new here, aren't you? Interested in my stock of potions? " \
                       "They come at a price of course..."
    dialog_data = DialogData(portrait_icon_sprite, dialog_text_body,
                             dialog_options)
    register_npc_dialog_data(npc_type, dialog_data)
    sprite_sheet = SpriteSheet("resources/graphics/enemy_sprite_sheet_3.png")
    original_sprite_size = (32, 32)
    scaled_sprite_size = (48, 48)
    x = 6
    indices_by_dir = {
        Direction.DOWN: [(x, 0), (x + 1, 0), (x + 2, 0)],
        Direction.LEFT: [(x, 1), (x + 1, 1), (x + 2, 1)],
        Direction.RIGHT: [(x, 2), (x + 1, 2), (x + 2, 2)],
        Direction.UP: [(x, 3), (x + 1, 3), (x + 2, 3)]
    }
    register_entity_sprite_map(sprite, sprite_sheet, original_sprite_size,
                               scaled_sprite_size, indices_by_dir, (-8, -16))
    register_portrait_icon_sprite_path(
        portrait_icon_sprite, 'resources/graphics/ninja_portrait.png')
Exemplo n.º 10
0
def register_challenge_starter_npc():
    size = (
        30, 30
    )  # Must not align perfectly with grid cell size (pathfinding issues)
    sprite = Sprite.NEUTRAL_NPC_CHALLENGE_STARTER
    portrait_icon_sprite = PortraitIconSprite.CHALLENGE_STARTER
    npc_type = NpcType.NEUTRAL_CHALLENGE_STARTER
    movement_speed = 0.03
    register_npc_data(npc_type, NpcData.neutral(sprite, size, movement_speed))
    register_npc_behavior(npc_type, NpcMind)

    dialog_options = [
        buy_item_option(ItemType.GLADIATOR_ARMOR, 20),
        buy_item_option(ItemType.HEALING_WAND, 20),
        buy_item_option(ItemType.ZULS_AEGIS, 20),
        buy_item_option(ItemType.WARLOCKS_COWL, 20),
        buy_item_option(ItemType.DRUIDS_RING, 20),
        DialogOptionData("\"Good bye\"", "cancel", None)
    ]
    dialog_text_body = "Choose wisely."
    dialog_data = DialogData(portrait_icon_sprite, dialog_text_body,
                             dialog_options)
    register_npc_dialog_data(npc_type, dialog_data)
    sprite_sheet = SpriteSheet("resources/graphics/enemy_sprite_sheet_3.png")
    original_sprite_size = (32, 32)
    scaled_sprite_size = (48, 48)
    x = 6
    indices_by_dir = {
        Direction.DOWN: [(x, 0), (x + 1, 0), (x + 2, 0)],
        Direction.LEFT: [(x, 1), (x + 1, 1), (x + 2, 1)],
        Direction.RIGHT: [(x, 2), (x + 1, 2), (x + 2, 2)],
        Direction.UP: [(x, 3), (x + 1, 3), (x + 2, 3)]
    }
    register_entity_sprite_map(sprite, sprite_sheet, original_sprite_size,
                               scaled_sprite_size, indices_by_dir, (-8, -16))
    register_portrait_icon_sprite_path(
        portrait_icon_sprite, 'resources/graphics/ninja_portrait.png')
def register_young_sorceress_npc():
    size = (
        30, 30
    )  # Must not align perfectly with grid cell size (pathfinding issues)
    sprite = Sprite.NEUTRAL_NPC_YOUNG_SORCERESS
    npc_type = NpcType.NEUTRAL_YOUNG_SORCERESS
    ui_icon_sprite = PortraitIconSprite.YOUNG_SORCERESS
    movement_speed = 0.03
    register_npc_data(npc_type, NpcData.neutral(sprite, size, movement_speed))
    register_npc_behavior(npc_type, NpcMind)
    introduction = "Hey you! Have you seen my pet frog? I bet it was that old green mean goblin king that took it!"

    prompt = "> "
    frog_data = ITEMS[ItemType.FROG]
    dialog_options = [
        DialogOptionData(
            prompt + frog_data.name, "give", AcceptFrog(),
            UiIconSprite.ITEM_FROG, frog_data.name,
            "If you help me get it back, I'll give you something in return!"),
        DialogOptionData("\"Good bye\"", "cancel", None)
    ]
    dialog_data = DialogData(ui_icon_sprite, introduction, dialog_options)
    register_npc_dialog_data(npc_type, dialog_data)
    sprite_sheet = SpriteSheet("resources/graphics/manga_spritesheet.png")
    original_sprite_size = (32, 32)
    scaled_sprite_size = (48, 48)
    x = 6
    indices_by_dir = {
        Direction.DOWN: [(x, 4), (x + 1, 4), (x + 2, 4)],
        Direction.LEFT: [(x, 5), (x + 1, 5), (x + 2, 5)],
        Direction.RIGHT: [(x, 6), (x + 1, 6), (x + 2, 6)],
        Direction.UP: [(x, 7), (x + 1, 7), (x + 2, 7)]
    }
    register_entity_sprite_map(sprite, sprite_sheet, original_sprite_size,
                               scaled_sprite_size, indices_by_dir, (-8, -16))
    register_portrait_icon_sprite_path(
        ui_icon_sprite, 'resources/graphics/portrait_young_sorceress_npc.png')
Exemplo n.º 12
0
def register_nomad_npc():
    size = (
        30, 30
    )  # Must not align perfectly with grid cell size (pathfinding issues)
    sprite = Sprite.NEUTRAL_NPC_NOMAD
    npc_type = NpcType.NEUTRAL_NOMAD
    movement_speed = 0.03
    register_npc_data(npc_type, NpcData.neutral(sprite, size, movement_speed))
    register_npc_behavior(npc_type, NpcMind)
    text_body = "Greetings. I am here only to serve. Seek me out when you are wounded or need guidance!"
    dialog_options = [
        DialogOptionData("Receive blessing", "gain full health", HealAction()),
        DialogOptionData("Ask for advice", "see random hint", HintAction()),
        DialogOptionData(
            "\"The red baron\"", "give", AcceptKey(), 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!"),
        DialogOptionData("\"Good bye\"", "cancel", None)
    ]
    dialog_data = DialogData(PortraitIconSprite.NOMAD, text_body,
                             dialog_options)
    register_npc_dialog_data(npc_type, dialog_data)
    sprite_sheet = SpriteSheet("resources/graphics/enemy_sprite_sheet_3.png")
    original_sprite_size = (32, 32)
    scaled_sprite_size = (48, 48)
    indices_by_dir = {
        Direction.DOWN: [(3, 0), (4, 0), (5, 0)],
        Direction.LEFT: [(3, 1), (4, 1), (5, 1)],
        Direction.RIGHT: [(3, 2), (4, 2), (5, 2)],
        Direction.UP: [(3, 3), (4, 3), (5, 3)]
    }
    register_entity_sprite_map(sprite, sprite_sheet, original_sprite_size,
                               scaled_sprite_size, indices_by_dir, (-8, -16))
    register_portrait_icon_sprite_path(
        PortraitIconSprite.NOMAD, 'resources/graphics/nomad_portrait.png')