Exemple #1
0
def register_ice_witch_enemy():
    size = (
        32, 32
    )  # Must not align perfectly with grid cell size (pathfinding issues)
    sprite = Sprite.ENEMY_ICE_WITCH
    npc_type = NpcType.ICE_WITCH
    movement_speed = 0.07
    health = 50
    exp_reward = 40
    npc_data = NpcData.enemy(sprite, size, health, 0, movement_speed,
                             exp_reward, LootTableId.LEVEL_6,
                             SoundId.DEATH_ICE_WITCH)
    register_npc_data(npc_type, npc_data)
    register_npc_behavior(npc_type, NpcMind)
    sprite_sheet = SpriteSheet("resources/graphics/enemy_ice_witch.png")
    original_sprite_size = (32, 32)
    scaled_sprite_size = (48, 48)

    sheet_x = 0
    indices_by_dir = {
        Direction.DOWN: [(sheet_x, 0), (sheet_x + 1, 0), (sheet_x + 2, 0),
                         (sheet_x + 1, 0)],
        Direction.LEFT: [(sheet_x, 1), (sheet_x + 1, 1), (sheet_x + 2, 1),
                         (sheet_x + 1, 1)],
        Direction.RIGHT: [(sheet_x, 2), (sheet_x + 1, 2), (sheet_x + 2, 2),
                          (sheet_x + 1, 2)],
        Direction.UP: [(sheet_x, 3), (sheet_x + 1, 3), (sheet_x + 2, 3),
                       (sheet_x + 1, 3)]
    }
    register_entity_sprite_map(sprite, sprite_sheet, original_sprite_size,
                               scaled_sprite_size, indices_by_dir, (-8, -16))
    register_buff_effect(SLOW_BUFF_TYPE, SlowedByIceWitch)
    register_buff_text(SLOW_BUFF_TYPE, "Frozen")
Exemple #2
0
def register_hero_warrior():
    sprite = Sprite.HERO_WARRIOR
    portrait_icon_sprite = PortraitIconSprite.HERO_WARRIOR
    player_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 + i, 4) for i in range(3)],
        Direction.LEFT: [(x + i, 5) for i in range(3)],
        Direction.RIGHT: [(x + i, 6) for i in range(3)],
        Direction.UP: [(x + i, 7) for i in range(3)]
    }
    sprite_position_relative_to_entity = (-8, -16)
    register_entity_sprite_map(sprite, player_sprite_sheet,
                               original_sprite_size, scaled_sprite_size,
                               indices_by_dir,
                               sprite_position_relative_to_entity)
    register_portrait_icon_sprite_path(
        portrait_icon_sprite, 'resources/graphics/portrait_warrior_hero.png')
    entity_speed = 0.105
    description = "A sturdy melee fighter, the warrior can stand his ground against any foe, and thrives when there " \
                  "are enemies all around."
    hero_data = HeroData(sprite, portrait_icon_sprite,
                         _get_initial_player_state_warrior(), entity_speed,
                         PLAYER_ENTITY_SIZE, description)
    register_hero_data(HERO_ID, hero_data)
    register_hero_upgrade_effect(HeroUpgradeId.WARRIOR_RETRIBUTION,
                                 _apply_retribution_talent)
    register_buff_effect(BUFF_RETRIBUTION, BuffedFromRetribution)
    register_buff_text(BUFF_RETRIBUTION, "Retribution")
Exemple #3
0
def register_heal_ability():
    register_ability_effect(AbilityType.HEAL, _apply_heal)
    register_ability_data(
        AbilityType.HEAL,
        AbilityData("Heal", UiIconSprite.ABILITY_HEAL, 10, Millis(15000),
                    "TODO", None))
    register_ui_icon_sprite_path(UiIconSprite.ABILITY_HEAL,
                                 "resources/graphics/heal_ability.png")
    register_buff_effect(BuffType.HEALING_OVER_TIME, HealingOverTime)
    register_buff_text(BuffType.HEALING_OVER_TIME, "Healing")
def register_stealth_ability():
    ui_icon_sprite = UiIconSprite.ABILITY_STEALTH

    register_ability_effect(ABILITY_TYPE, _apply_ability)
    description = "Become invisible to enemies, and add effects to your other abilities."
    ability_data = AbilityData("Stealth", ui_icon_sprite, STEALTH_MANA_COST, STEALTH_COOLDOWN, description,
                               SoundId.ABILITY_STEALTH)
    register_ability_data(ABILITY_TYPE, ability_data)
    register_ui_icon_sprite_path(ui_icon_sprite, "resources/graphics/sneak_icon.png")
    register_buff_effect(BUFF_STEALTH, Stealthing)
    register_buff_text(BUFF_STEALTH, "Stealthed")
    register_hero_upgrade_effect(HeroUpgradeId.ABILITY_STEALTH_MANA_COST, UpgradeStealthManaCost())
Exemple #5
0
def register_dash_ability():
    ui_icon_sprite = UiIconSprite.ABILITY_DASH
    register_ability_effect(ABILITY_TYPE, _apply_ability)
    description = "Dash over an enemy, dealing " + str(DAMAGE) + " magic damage. Then, gain +" + \
                  "{:.0f}".format(DODGE_CHANCE_BOOST * 100) + "% dodge chance and +" + \
                  str(HEALTH_REGEN_BOOST) + " health regen"
    mana_cost = 12
    ability_data = AbilityData("Dash", ui_icon_sprite, mana_cost, Millis(4000), description, SoundId.ABILITY_DASH)
    register_ability_data(ABILITY_TYPE, ability_data)
    register_ui_icon_sprite_path(ui_icon_sprite, "resources/graphics/icon_ability_dash.png")
    register_buff_effect(BUFF_AFTER_ENEMY_JUMP, AfterEnemyJump)
    register_buff_text(BUFF_AFTER_ENEMY_JUMP, "Protected")
    register_buff_effect(BUFF_SPEED, IncreasedSpeedAfterDash)
Exemple #6
0
def register_stone_amulet_item():
    register_buff_effect(BUFF_TYPE, ProtectedByStoneAmulet)
    register_buff_text(BUFF_TYPE, "Protected")

    item_type = ItemType.STONE_AMULET
    register_custom_effect_item(
        item_type=item_type,
        ui_icon_sprite=UiIconSprite.ITEM_STONE_AMULET,
        sprite=Sprite.ITEM_STONE_AMULET,
        image_file_path="resources/graphics/item_stone_amulet.png",
        item_equipment_category=ItemEquipmentCategory.NECK,
        name="Stone Amulet",
        item_effect=ItemEffect(item_type)
    )
Exemple #7
0
def register_invis_potion():
    ui_icon_sprite = UiIconSprite.POTION_INVISIBILITY
    sprite = Sprite.POTION_INVIS
    register_consumable_effect(POTION_TYPE, _apply_invis)
    register_buff_effect(BUFF_TYPE, Invisibility)
    register_buff_text(BUFF_TYPE, "Invisibility")
    image_path = "resources/graphics/invis_potion.png"
    register_ui_icon_sprite_path(ui_icon_sprite, image_path)
    register_entity_sprite_initializer(
        sprite, SpriteInitializer(image_path, POTION_ENTITY_SIZE))
    data = ConsumableData(ui_icon_sprite, sprite, "Invisibility potion",
                          "Grants temporary invisibility",
                          ConsumableCategory.OTHER, SoundId.CONSUMABLE_BUFF)
    register_consumable_data(POTION_TYPE, data)
Exemple #8
0
def register_dash_ability():
    ui_icon_sprite = UiIconSprite.ABILITY_DASH
    register_ability_effect(ABILITY_TYPE, _apply_ability)
    description = "Dash over an enemy, dealing " + str(DAMAGE) + " magic damage. [from stealth: gain +" + \
                  "{:.0f}".format(DODGE_CHANCE_BOOST * 100) + "% dodge chance and +" + \
                  "{:.0f}".format(LIFE_STEAL_BOOST * 100) + "% life steal for " + \
                  "{:.0f}".format(BUFF_FROM_STEALTH_DURATION / 1000) + "s]"
    mana_cost = 12
    ability_data = AbilityData("Dash", ui_icon_sprite, mana_cost, Millis(4000), description, SoundId.ABILITY_DASH)
    register_ability_data(ABILITY_TYPE, ability_data)
    register_ui_icon_sprite_path(ui_icon_sprite, "resources/graphics/icon_ability_dash.png")
    register_buff_effect(BUFF_FROM_STEALTH, FromStealth)
    register_buff_text(BUFF_FROM_STEALTH, "Element of surprise")
    register_buff_effect(BUFF_SPEED, IncreasedSpeedAfterDash)
def register_speed_potion():
    ui_icon_sprite = UiIconSprite.POTION_SPEED
    sprite = Sprite.POTION_SPEED
    register_consumable_effect(ConsumableType.SPEED, _apply_speed)
    register_buff_effect(BUFF_TYPE, IncreasedMoveSpeed)
    register_buff_text(BUFF_TYPE, "Speed potion")
    image_path = "resources/graphics/item_speed_potion.png"
    register_ui_icon_sprite_path(ui_icon_sprite, image_path)
    register_entity_sprite_initializer(
        sprite, SpriteInitializer(image_path, POTION_ENTITY_SIZE))
    description = "Gain +" + "{:.0f}".format(SPEED_INCREASE * 100) + "% movement speed for " + \
                  "{:.0f}".format(DURATION / 1000) + "s."
    data = ConsumableData(ui_icon_sprite, sprite, "Speed potion", description,
                          ConsumableCategory.OTHER, SoundId.CONSUMABLE_BUFF)
    register_consumable_data(ConsumableType.SPEED, data)
Exemple #10
0
def register_elixir_of_power():
    ui_icon_sprite = UiIconSprite.ELIXIR_POWER
    sprite = Sprite.ELIXIR_POWER
    consumable_type = ConsumableType.POWER
    register_consumable_level(consumable_type, 6)
    register_consumable_effect(consumable_type, _apply)
    register_buff_effect(BUFF_TYPE, BuffedFromElixirOfPower)
    name = "Elixir of Power"
    register_buff_text(BUFF_TYPE, name)
    image_path = "resources/graphics/item_elixir_of_power.png"
    register_ui_icon_sprite_path(ui_icon_sprite, image_path)
    register_entity_sprite_initializer(sprite, SpriteInitializer(image_path, POTION_ENTITY_SIZE))
    description = "Gain +" + "{:.0f}".format(DAMAGE_MODIFIER_INCREASE * 100) + " attack power for " + \
                  "{:.0f}".format(DURATION / 1000) + "s."
    data = ConsumableData(ui_icon_sprite, sprite, name, description, ConsumableCategory.OTHER, SoundId.CONSUMABLE_BUFF)
    register_consumable_data(consumable_type, data)
Exemple #11
0
def register_bloodlust_ability():
    ability_type = AbilityType.BLOOD_LUST
    register_ability_effect(ability_type, _apply_ability)
    ui_icon_sprite = UiIconSprite.ABILITY_BLOODLUST
    description = "Gain Bloodlust for " + "{:.0f}".format(BUFF_DURATION / 1000) + "s " + \
                  "(+" + str(int(LIFE_STEAL_BONUS_RATIO * 100)) + "% lifesteal, " + \
                  "reduced Slash cooldown, " + \
                  "+" + str(int(SPEED_BONUS * 100)) + "% movement speed). " + \
                  "Duration is increased by " + "{:.0f}".format(BLOODLUST_INCREASED_DURATION_FROM_KILL / 1000) + \
                  "s for each enemy killed."
    register_ability_data(
        ability_type,
        AbilityData("Bloodlust", ui_icon_sprite, 25, COOLDOWN, description, SoundId.ABILITY_BLOODLUST))
    register_ui_icon_sprite_path(ui_icon_sprite, "resources/graphics/icon_bloodlust.png")
    register_buff_effect(BUFF_TYPE, BloodLust)
    register_buff_text(BUFF_TYPE, "Bloodlust")
    register_hero_upgrade_effect(HeroUpgradeId.ABILITY_BLOODLUST_DURATION, _apply_upgrade)
Exemple #12
0
def register_brew_potion():
    consumable_type = ConsumableType.BREW
    sprite = Sprite.POTION_BREW
    ui_icon_sprite = UiIconSprite.POTION_BREW

    register_consumable_effect(consumable_type, _apply)
    image_path = "resources/graphics/icon_potion_brew.png"
    register_entity_sprite_initializer(sprite, SpriteInitializer(image_path, POTION_ENTITY_SIZE))
    register_ui_icon_sprite_path(ui_icon_sprite, image_path)
    description = "Slowly restores health and mana over " + "{:.0f}".format(BUFF_DURATION / 1000) + \
                  "s. Only works outside of combat."
    data = ConsumableData(ui_icon_sprite, sprite, "Brew", description, ConsumableCategory.HEALTH,
                          SoundId.CONSUMABLE_POTION)
    register_consumable_data(consumable_type, data)

    register_buff_effect(BUFF_TYPE, RestoringHealthFromBrew)
    register_buff_text(BUFF_TYPE, "Recovering")
def register_elixir_of_magic_resist():
    ui_icon_sprite = UiIconSprite.ELIXIR_MAGIC_RESIST
    sprite = Sprite.ELIXIR_MAGIC_RESIST
    consumable_type = ConsumableType.MAGIC_RESIST
    register_consumable_level(consumable_type, 5)
    register_consumable_effect(consumable_type, _apply)
    register_buff_effect(BUFF_TYPE, Buffed)
    name = "Elixir of Spirits"
    register_buff_text(BUFF_TYPE, name)
    image_path = "resources/graphics/item_elixir_of_spirits.png"
    register_ui_icon_sprite_path(ui_icon_sprite, image_path)
    register_entity_sprite_initializer(
        sprite, SpriteInitializer(image_path, POTION_ENTITY_SIZE))
    description = "Gain +" + "{:.0f}".format(RESIST_MODIFIER_INCREASE * 100) + "% magic resistance for " + \
                  "{:.0f}".format(DURATION / 1000) + "s."
    data = ConsumableData(ui_icon_sprite, sprite, name, description,
                          ConsumableCategory.OTHER, SoundId.CONSUMABLE_BUFF)
    register_consumable_data(consumable_type, data)
Exemple #14
0
def register_stone_amulet_item():
    register_buff_effect(BUFF_TYPE, ProtectedByStoneAmulet)
    register_buff_text(BUFF_TYPE, "Protected")

    item_type = ItemType.STONE_AMULET
    register_custom_effect_item(
        item_type=item_type,
        item_level=5,
        ui_icon_sprite=UiIconSprite.ITEM_STONE_AMULET,
        sprite=Sprite.ITEM_STONE_AMULET,
        image_file_path="resources/graphics/item_stone_amulet.png",
        item_equipment_category=ItemEquipmentCategory.NECK,
        name="Stone amulet",
        custom_description=[str(int(PROC_CHANCE * 100)) + "% on kill: gain " + str(ARMOR_BONUS) + " armor for " +
                            "{:.0f}".format(BUFF_DURATION / 1000) + "s"],
        stat_modifier_intervals=[],
        custom_effect=ItemEffect()
    )
Exemple #15
0
def register_goblin_warlock_enemy():
    enemy_size = (24, 24)
    enemy_sprite = Sprite.ENEMY_GOBLIN_WARLOCK
    npc_type = NpcType.GOBLIN_WARLOCK
    health = 21
    exp_reward = 14
    npc_data = NpcData.enemy(enemy_sprite, enemy_size, health, 0, 0.032,
                             exp_reward, LootTableId.LEVEL_4,
                             SoundId.DEATH_GOBLIN)
    register_npc_data(npc_type, npc_data)
    register_npc_behavior(npc_type, NpcMind)

    enemy_sprite_sheet = SpriteSheet(
        "resources/graphics/enemy_sprite_sheet_2.png")
    enemy_original_sprite_size = (32, 32)
    enemy_scaled_sprite_size = (48, 48)
    enemy_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(enemy_sprite, enemy_sprite_sheet,
                               enemy_original_sprite_size,
                               enemy_scaled_sprite_size, enemy_indices_by_dir,
                               (-12, -24))

    register_projectile_controller(PROJECTILE_TYPE, ProjectileController)

    projectile_sprite_sheet = SpriteSheet(
        "resources/graphics/goblin_fireball_entity.png")
    projectile_original_sprite_size = (132, 156)
    projectile_scaled_sprite_size = (20, 20)
    projectile_indices_by_dir = {
        Direction.DOWN: [(0, 0), (1, 0), (2, 0), (3, 0)]
    }
    projectile_sprite = Sprite.PROJECTILE_ENEMY_GOBLIN_WARLOCK
    register_entity_sprite_map(projectile_sprite, projectile_sprite_sheet,
                               projectile_original_sprite_size,
                               projectile_scaled_sprite_size,
                               projectile_indices_by_dir, (0, 0))

    register_buff_effect(BUFF_TYPE, Burnt)
    register_buff_text(BUFF_TYPE, "Burnt")
def register_healing_wand_item():
    item_type = ItemType.HEALING_WAND
    ui_icon_sprite = UiIconSprite.ITEM_HEALING_WAND
    sprite = Sprite.ITEM_HEALING_WAND
    image_file_path = "resources/graphics/item_healing_wand.png"
    register_ui_icon_sprite_path(ui_icon_sprite, image_file_path)
    register_entity_sprite_initializer(
        sprite, SpriteInitializer(image_file_path, ITEM_ENTITY_SIZE))
    register_item_effect(item_type, ItemEffect(item_type))
    name = "Healing wand"
    description = [
        "When you damage an enemy, gain +" + str(HEALTH_REGEN_BONUS) +
        " health regen for " + "{:.0f}".format(BUFF_DURATION / 1000) + "s"
    ]
    item_data = ItemData(ui_icon_sprite, sprite, name, description,
                         ItemEquipmentCategory.MAIN_HAND)
    register_item_data(item_type, item_data)
    register_buff_effect(BUFF_TYPE, BuffedByHealingWand)
    register_buff_text(BUFF_TYPE, "Healing wand")
Exemple #17
0
def register_stealth_ability():
    ui_icon_sprite = UiIconSprite.ABILITY_STEALTH

    register_ability_effect(ABILITY_TYPE, _apply_ability)
    description = "Become invisible to enemies. After effect ends, gain +" + \
                  "{:.0f}".format(DODGE_CHANCE_BONUS * 100) + "% dodge chance for " + \
                  "{:.1f}".format(DURATION_POST_STEALTH / 1000) + "s"
    ability_data = AbilityData("Stealth", ui_icon_sprite, STEALTH_MANA_COST,
                               STEALTH_COOLDOWN, description,
                               SoundId.ABILITY_STEALTH)
    register_ability_data(ABILITY_TYPE, ability_data)
    register_ui_icon_sprite_path(ui_icon_sprite,
                                 "resources/graphics/sneak_icon.png")
    register_buff_effect(BUFF_STEALTH, Stealthing)
    register_buff_text(BUFF_STEALTH, "Stealthed")
    register_buff_effect(BUFF_POST_STEALTH, AfterStealthing)
    register_buff_text(BUFF_POST_STEALTH, "Element of surprise")
    register_hero_upgrade_effect(HeroUpgradeId.ABILITY_STEALTH_MANA_COST,
                                 _upgrade_mana_cost)
Exemple #18
0
def register_healing_wand_item():
    item_type = ItemType.HEALING_WAND
    register_custom_effect_item(
        item_type=item_type,
        item_level=4,
        ui_icon_sprite=UiIconSprite.ITEM_HEALING_WAND,
        sprite=Sprite.ITEM_HEALING_WAND,
        image_file_path="resources/graphics/item_healing_wand.png",
        item_equipment_category=ItemEquipmentCategory.MAIN_HAND,
        name="Healing wand",
        custom_description=[
            "When you damage an enemy, gain +" + str(HEALTH_REGEN_BONUS) +
            " health regen for " + "{:.0f}".format(BUFF_DURATION / 1000) + "s"
        ],
        stat_modifier_intervals=[],
        custom_effect=ItemEffect())

    register_buff_effect(BUFF_TYPE, BuffedByHealingWand)
    register_buff_text(BUFF_TYPE, "Healing wand")
Exemple #19
0
def register_goblin_warlock_enemy():
    enemy_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_basic_enemy(
        npc_type=NpcType.GOBLIN_WARLOCK,
        npc_data=NpcData.enemy(
            sprite=Sprite.ENEMY_GOBLIN_WARLOCK,
            size=(24, 24),
            max_health=21,
            health_regen=0,
            speed=0.032,
            exp_reward=14,
            enemy_loot_table=LootTableId.LEVEL_4,
            death_sound_id=SoundId.DEATH_GOBLIN),
        mind_constructor=NpcMind,
        spritesheet_path="resources/graphics/enemy_sprite_sheet_2.png",
        original_sprite_size=(32, 32),
        scaled_sprite_size=(48, 48),
        spritesheet_indices=enemy_indices_by_dir,
        sprite_position_relative_to_entity=(-12, -24)
    )

    register_projectile_controller(PROJECTILE_TYPE, ProjectileController)

    projectile_sprite_sheet = SpriteSheet("resources/graphics/goblin_fireball_entity.png")
    projectile_original_sprite_size = (132, 156)
    projectile_scaled_sprite_size = (20, 20)
    projectile_indices_by_dir = {
        Direction.DOWN: [(0, 0), (1, 0), (2, 0), (3, 0)]
    }
    projectile_sprite = Sprite.PROJECTILE_ENEMY_GOBLIN_WARLOCK
    register_entity_sprite_map(projectile_sprite, projectile_sprite_sheet, projectile_original_sprite_size,
                               projectile_scaled_sprite_size, projectile_indices_by_dir, (0, 0))

    register_buff_effect(BUFF_TYPE, Burnt)
    register_buff_text(BUFF_TYPE, "Burnt")
Exemple #20
0
def _register_buff(buff_type: BuffType, buff_class: Type[AbstractBuffEffect],
                   buff_text: str):
    register_buff_effect(buff_type, buff_class)
    register_buff_text(buff_type, buff_text)
Exemple #21
0
def _register_buff():
    register_buff_text(BUFF_TYPE, ITEM_NAME)
    register_buff_effect(BUFF_TYPE, BuffedByWingedHelmet)
Exemple #22
0
def _register_buff():
    register_buff_text(BUFF_TYPE, ITEM_NAME)
    register_buff_effect(BUFF_TYPE, BuffedByWhip)
def _register_buff():
    register_buff_text(BUFF_TYPE, ITEM_NAME)
    register_buff_effect(BUFF_TYPE, BuffedByBloodAmulet)