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)
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')
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)
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)
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')
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')