Example #1
0
def _register_weapon_rack():
    register_entity_sprite_initializer(
        Sprite.WALL_WEAPON_RACK,
        SpriteInitializer("resources/graphics/wall_weapon_rack.png",
                          (50, 100)), (0, -70))
    register_wall_data(WallType.WEAPON_RACK,
                       WallData(Sprite.WALL_WEAPON_RACK, (50, 30)))
def register_amulet_of_mana_item():
    item_types = [
        ItemType.AMULET_OF_MANA_1, ItemType.AMULET_OF_MANA_2,
        ItemType.AMULET_OF_MANA_3
    ]
    mana_regen_boosts = [0.5, 0.75, 1]
    ui_icon_sprite = UiIconSprite.ITEM_AMULET_OF_MANA
    sprite = Sprite.ITEM_AMULET_OF_MANA
    register_ui_icon_sprite_path(ui_icon_sprite,
                                 "resources/graphics/item_amulet.png")
    register_entity_sprite_initializer(
        sprite,
        SpriteInitializer("resources/graphics/item_amulet.png",
                          ITEM_ENTITY_SIZE))
    for i in range(3):
        item_type = item_types[i]
        mana_regen_boost = mana_regen_boosts[i]
        effect = StatModifyingItemEffect(
            item_type, {HeroStat.MANA_REGEN: mana_regen_boost})
        register_item_effect(item_type, effect)
        name = "Amulet of Mana (" + str(i + 1) + ")"
        description = effect.get_description()
        item_data = ItemData(ui_icon_sprite, sprite, name, description,
                             ItemEquipmentCategory.NECK)
        register_item_data(item_type, item_data)
Example #3
0
def register_randomized_stat_modifying_item(
        item_type: ItemType,
        ui_icon_sprite: UiIconSprite,
        sprite: Sprite,
        image_file_path: str,
        item_equipment_category: ItemEquipmentCategory,
        name: str,
        stat_modifier_intervals: Union[List[StatModifierInterval],
                                       Dict[HeroStat, List[Union[int,
                                                                 float]]]],
        item_level: Optional[int] = None,
        is_unique: bool = False):
    if item_level is not None:
        register_item_level(item_type, item_level)
    register_ui_icon_sprite_path(ui_icon_sprite, image_file_path)
    register_entity_sprite_initializer(
        sprite, SpriteInitializer(image_file_path, ITEM_ENTITY_SIZE))

    # This is legacy. TODO: only allow list arg
    if isinstance(stat_modifier_intervals, dict):
        stat_modifier_intervals = [
            StatModifierInterval(hero_stat, stat_modifier_intervals[hero_stat])
            for hero_stat in stat_modifier_intervals
        ]

    item_data = ItemData(ui_icon_sprite,
                         sprite,
                         name, [],
                         stat_modifier_intervals,
                         is_unique=is_unique,
                         item_equipment_category=item_equipment_category)
    register_item_data(item_type, item_data)
Example #4
0
def register_custom_effect_item(
        item_type: ItemType,
        ui_icon_sprite: UiIconSprite,
        sprite: Sprite,
        image_file_path: str,
        item_equipment_category: ItemEquipmentCategory,
        name: str,
        custom_effect: AbstractItemEffect,
        custom_description: List[str],
        stat_modifier_intervals: List[StatModifierInterval],
        item_level: Optional[int] = None,
        is_unique: bool = False):
    if item_level is not None:
        register_item_level(item_type, item_level)
    item_data = ItemData(ui_icon_sprite,
                         sprite,
                         name,
                         custom_description,
                         stat_modifier_intervals,
                         is_unique=is_unique,
                         item_equipment_category=item_equipment_category)
    register_custom_item_effect(item_type, custom_effect)
    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_data(item_type, item_data)
Example #5
0
def _register_decorated_table():
    register_entity_sprite_initializer(
        Sprite.WALL_DECORATED_TABLE,
        SpriteInitializer("resources/graphics/wall_table_candles.png",
                          (100, 75)), (-5, -35))
    register_wall_data(WallType.DECORATED_TABLE,
                       WallData(Sprite.WALL_DECORATED_TABLE, (90, 40)))
Example #6
0
def _register_bench_mirror():
    register_entity_sprite_initializer(
        Sprite.WALL_BENCH_MIRROR,
        SpriteInitializer("resources/graphics/wall_bench_mirror.png",
                          (35, 70)), (0, -50))
    register_wall_data(WallType.BENCH_MIRROR,
                       WallData(Sprite.WALL_BENCH_MIRROR, (35, 20)))
def register_blessed_shield_item():
    item_types = [
        ItemType.BLESSED_SHIELD_1, ItemType.BLESSED_SHIELD_2,
        ItemType.BLESSED_SHIELD_3
    ]
    healing_amounts = [2, 3, 4]
    armor_boost = 2
    ui_icon_sprite = UiIconSprite.ITEM_BLESSED_SHIELD
    sprite = Sprite.ITEM_BLESSED_SHIELD
    register_ui_icon_sprite_path(ui_icon_sprite,
                                 "resources/graphics/item_blessed_shield.png")
    register_entity_sprite_initializer(
        sprite,
        SpriteInitializer("resources/graphics/item_blessed_shield.png",
                          ITEM_ENTITY_SIZE))
    for i in range(3):
        item_type = item_types[i]

        healing_amount = healing_amounts[i]
        stat_modifiers = {
            HeroStat.ARMOR: armor_boost,
            HeroStat.BLOCK_AMOUNT: 6
        }
        effect = ItemEffect(healing_amount, item_type, stat_modifiers)
        register_item_effect(item_type, effect)
        name = "Blessed Shield (" + str(i + 1) + ")"
        description = effect.get_description() + [
            "On block: gain " + str(healing_amount) + " health"
        ]
        item_data = ItemData(ui_icon_sprite, sprite, name, description,
                             ItemEquipmentCategory.OFF_HAND)
        register_item_data(item_type, item_data)
Example #8
0
def _register_light_pole():
    register_entity_sprite_initializer(
        Sprite.WALL_LIGHT_POLE,
        SpriteInitializer("resources/graphics/wall_lightpole.png", (35, 105)),
        (0, -80))
    register_wall_data(WallType.LIGHT_POLE,
                       WallData(Sprite.WALL_LIGHT_POLE, (35, 25)))
def register_passive_item(item_type: ItemType, ui_icon_sprite: UiIconSprite,
                          sprite: Sprite, image_file_path: str, name: str,
                          description_lines: List[str]):
    item_effect = EmptyItemEffect(item_type)
    item_data = ItemData(ui_icon_sprite, sprite, name, description_lines)
    register_item_effect(item_type, item_effect)
    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_data(item_type, item_data)
Example #10
0
def register_quest_item(
        item_type: ItemType,
        ui_icon_sprite: UiIconSprite,
        sprite: Sprite,
        image_file_path: str,
        name: str,
        description_lines: List[str]):
    item_data = ItemData(ui_icon_sprite, sprite, name, description_lines, [],
                         is_unique=False, item_equipment_category=ItemEquipmentCategory.QUEST)
    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_data(item_type, item_data)
Example #11
0
def _register_pillows():
    register_entity_sprite_initializer(
        Sprite.WALL_PILLOW,
        SpriteInitializer("resources/graphics/wall_pillow.png", (40, 30)),
        (0, 0))
    register_wall_data(WallType.PILLOW, WallData(Sprite.WALL_PILLOW, (40, 30)))
    register_entity_sprite_initializer(
        Sprite.WALL_PILLOWS_2,
        SpriteInitializer("resources/graphics/wall_pillows_2.png", (40, 35)),
        (0, -5))
    register_wall_data(WallType.PILLOWS_2,
                       WallData(Sprite.WALL_PILLOWS_2, (40, 30)))
def register_custom_effect_item(
        item_type: ItemType,
        ui_icon_sprite: UiIconSprite,
        sprite: Sprite,
        image_file_path: str,
        item_equipment_category: ItemEquipmentCategory,
        name: str,
        item_effect: AbstractItemEffect):
    item_data = ItemData(ui_icon_sprite, sprite, name, item_effect.get_description(), item_equipment_category)
    register_item_effect(item_type, item_effect)
    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_data(item_type, item_data)
Example #13
0
def register_health_potion():
    consumable_type = ConsumableType.HEALTH
    sprite = Sprite.POTION_HEALTH
    ui_icon_sprite = UiIconSprite.POTION_HEALTH
    register_consumable_level(consumable_type, 4)
    register_consumable_effect(consumable_type, _apply_health)
    image_path = "resources/graphics/icon_potion_health.png"
    register_entity_sprite_initializer(sprite, SpriteInitializer(image_path, POTION_ENTITY_SIZE))
    register_ui_icon_sprite_path(ui_icon_sprite, image_path)
    description = "Restores " + str(HEALING_AMOUNT) + " health"
    data = ConsumableData(ui_icon_sprite, sprite, "Health potion", description, ConsumableCategory.HEALTH,
                          SoundId.CONSUMABLE_POTION)
    register_consumable_data(consumable_type, data)
def register_stat_modifying_item(
        item_type: ItemType, ui_icon_sprite: UiIconSprite, sprite: Sprite,
        image_file_path: str, item_equipment_category: ItemEquipmentCategory,
        name: str, stat_modifiers: Dict[HeroStat, Union[int, float]]):
    item_effect = StatModifyingItemEffect(item_type, stat_modifiers)
    item_data = ItemData(ui_icon_sprite, sprite, name,
                         item_effect.get_description(),
                         item_equipment_category)
    register_item_effect(item_type, item_effect)
    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_data(item_type, item_data)
Example #15
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)
def register_warpstone_consumable():
    consumable_type = ConsumableType.WARP_STONE
    sprite = Sprite.CONSUMABLE_WARPSTONE
    ui_icon_sprite = UiIconSprite.CONSUMABLE_WARPSTONE

    register_consumable_effect(consumable_type, _apply)
    image_path = "resources/graphics/consumable_warpstone.png"
    register_entity_sprite_initializer(
        sprite, SpriteInitializer(image_path, POTION_ENTITY_SIZE))
    register_ui_icon_sprite_path(ui_icon_sprite, image_path)
    description = "Warps you back to safety"
    data = ConsumableData(ui_icon_sprite, sprite, "Warpstone", description,
                          ConsumableCategory.OTHER, SoundId.WARP)
    register_consumable_data(consumable_type, data)
def register_lesser_mana_potion():
    consumable_type = ConsumableType.MANA_LESSER
    sprite = Sprite.POTION_MANA_LESSER
    ui_icon_sprite = UiIconSprite.POTION_MANA_LESSER

    register_consumable_effect(consumable_type, _apply_mana)
    image_path = "resources/graphics/icon_potion_lesser_mana.png"
    register_entity_sprite_initializer(
        sprite, SpriteInitializer(image_path, POTION_ENTITY_SIZE))
    register_ui_icon_sprite_path(ui_icon_sprite, image_path)
    data = ConsumableData(ui_icon_sprite, sprite, "Lesser mana potion",
                          "Restores " + str(MANA_AMOUNT) + " mana",
                          ConsumableCategory.MANA, SoundId.CONSUMABLE_POTION)
    register_consumable_data(consumable_type, data)
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)
Example #19
0
def register_freezing_gauntlet_item():
    ui_icon_sprite = UiIconSprite.ITEM_FREEZING_GAUNTLET
    sprite = Sprite.ITEM_FREEZING_GAUNTLET
    image_file_path = "resources/graphics/item_freezing_gauntlet.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 = "Freezing Gauntlet"
    description = ["Slows your targets by " + str(int(SLOW_AMOUNT * 100)) + "% for " \
                   + "{:.1f}".format(SLOW_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, DebuffedByFreezingGauntlet)
Example #20
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)
Example #21
0
def register_blood_amulet():
    ui_icon_sprite = UiIconSprite.ITEM_BLOOD_AMULET
    sprite = Sprite.ITEM_BLOOD_AMULET
    image_file_path = "resources/graphics/item_blood_amulet.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 = "Blood Amulet"
    description = [
        str(int(PROC_CHANCE * 100)) + "% on kill: gain " +
        str(HEALTH_ON_KILL_AMOUNT) + " health"
    ]
    item_data = ItemData(ui_icon_sprite, sprite, name, description,
                         ItemEquipmentCategory.NECK)
    register_item_data(ITEM_TYPE, item_data)
Example #22
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")
Example #23
0
def register_acid_bomb_consumable():
    consumable_type = ConsumableType.ACID_BOMB
    sprite = Sprite.CONSUMABLE_ACID_BOMB
    ui_icon_sprite = UiIconSprite.CONSUMABLE_ACID_BOMB

    register_consumable_effect(consumable_type, _apply)
    image_path = "resources/graphics/consumable_acid_bomb.png"
    register_entity_sprite_initializer(
        sprite, SpriteInitializer(image_path, POTION_ENTITY_SIZE))
    register_ui_icon_sprite_path(ui_icon_sprite, image_path)
    description = "Poisons nearby enemies, dealing " + str(DEBUFF_TOTAL_DAMAGE) + " magic damage over " + \
                  "{:.0f}".format(DEBUFF_DURATION / 1000) + "s."
    data = ConsumableData(ui_icon_sprite, sprite, "Acid bomb", description,
                          ConsumableCategory.OTHER,
                          SoundId.CONSUMABLE_ACID_BOMB)
    register_consumable_data(consumable_type, data)
    register_buff_effect(BUFF_TYPE, BuffEffect)
def register_orb_of_the_magi_item():
    item_types = [ItemType.ORB_OF_THE_MAGI_1, ItemType.ORB_OF_THE_MAGI_2, ItemType.ORB_OF_THE_MAGI_3]
    multiplier_bonuses = [0.1, 0.15, 0.2]
    ui_icon_sprite = UiIconSprite.ITEM_ORB_OF_THE_MAGI
    sprite = Sprite.ITEM_ORB_OF_THE_MAGI
    image_file_path = "resources/graphics/item_orb_of_the_magi.png"
    register_ui_icon_sprite_path(ui_icon_sprite, image_file_path)
    register_entity_sprite_initializer(
        sprite, SpriteInitializer(image_file_path, ITEM_ENTITY_SIZE))
    for i in range(3):
        item_type = item_types[i]
        bonus = multiplier_bonuses[i]
        effect = StatModifyingItemEffect(item_type, {HeroStat.MAGIC_DAMAGE: bonus})
        register_item_effect(item_type, effect)
        name = "Orb of the Magi (" + str(i + 1) + ")"
        description = effect.get_description()
        item_data = ItemData(ui_icon_sprite, sprite, name, description, ItemEquipmentCategory.OFF_HAND)
        register_item_data(item_type, item_data)
Example #25
0
def register_arcane_fire_ability():
    register_ability_effect(AbilityType.ARCANE_FIRE, _apply_channel_attack)
    description = "Channel for " + "{:.1f}".format(CHANNEL_DURATION / 1000) + \
                  "s, firing piercing missiles in front of you dealing up to " + str(MAX_TOTAL_DAMAGE) + \
                  " magic damage to enemies."
    ability_data = AbilityData("Arcane Fire", UiIconSprite.ABILITY_ARCANE_FIRE, ARCANE_FIRE_MANA_COST,
                               ARCANE_FIRE_COOLDOWN, description, SoundId.ABILITY_ARCANE_FIRE)
    register_ability_data(AbilityType.ARCANE_FIRE, ability_data)

    register_ui_icon_sprite_path(UiIconSprite.ABILITY_ARCANE_FIRE, "resources/graphics/magic_missile.png")
    register_buff_effect(BuffType.CHANNELING_ARCANE_FIRE, Channeling)
    register_entity_sprite_initializer(
        Sprite.PROJECTILE_PLAYER_ARCANE_FIRE,
        SpriteInitializer("resources/graphics/magic_missile.png", PROJECTILE_SIZE))
    register_projectile_controller(ProjectileType.PLAYER_ARCANE_FIRE, ProjectileController)
    register_buff_as_channeling(BuffType.CHANNELING_ARCANE_FIRE)
    register_hero_upgrade_effect(HeroUpgradeId.ABILITY_ARCANE_FIRE_COOLDOWN,
                                 _upgrade_arcane_fire_cooldown_and_mana_cost)
Example #26
0
def register_goats_ring():
    ui_icon_sprite = UiIconSprite.ITEM_GOATS_RING
    sprite = Sprite.ITEM_GOATS_RING
    image_file_path = "resources/graphics/item_goats_ring.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 = "The Goat's Curse"
    description = [
        "Whenever you damage an enemy, there is a  " +
        str(int(PROC_CHANCE * 100)) +
        "% chance that it will be cursed and take additional magic damage over time"
    ]
    item_data = ItemData(ui_icon_sprite, sprite, name, description,
                         ItemEquipmentCategory.RING)
    register_item_data(ITEM_TYPE, item_data)
    register_buff_effect(BUFF_TYPE, DebuffedByGoatsRing)
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)
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")
Example #29
0
def register_blue_robe_item():
    item_types = [ItemType.BLUE_ROBE_1, ItemType.BLUE_ROBE_2, ItemType.BLUE_ROBE_3]
    mana_amounts = [10, 15, 20]
    mana_regen_boost = 0.3
    ui_icon_sprite = UiIconSprite.ITEM_BLUE_ROBE
    sprite = Sprite.ITEM_BLUE_ROBE
    register_ui_icon_sprite_path(ui_icon_sprite, "resources/graphics/item_blue_robe.png")
    register_entity_sprite_initializer(
        sprite, SpriteInitializer("resources/graphics/item_blue_robe.png", ITEM_ENTITY_SIZE))
    for i in range(3):
        item_type = item_types[i]
        mana_amount = mana_amounts[i]
        effect = StatModifyingItemEffect(item_type, {
            HeroStat.MANA_REGEN: mana_regen_boost,
            HeroStat.MAX_MANA: mana_amount
        })
        register_item_effect(item_type, effect)
        name = "Blue Robe (" + str(i + 1) + ")"
        description = effect.get_description()
        item_data = ItemData(ui_icon_sprite, sprite, name, description, ItemEquipmentCategory.CHEST)
        register_item_data(item_type, item_data)
def register_orb_of_life_item():
    item_types = [
        ItemType.ORB_OF_LIFE_1, ItemType.ORB_OF_LIFE_2, ItemType.ORB_OF_LIFE_3
    ]
    bonuses = [0.04, 0.06, 0.08]
    ui_icon_sprite = UiIconSprite.ITEM_ORB_OF_LIFE
    sprite = Sprite.ITEM_ORB_OF_LIFE
    image_file_path = "resources/graphics/item_orb_of_life.png"
    register_ui_icon_sprite_path(ui_icon_sprite, image_file_path)
    register_entity_sprite_initializer(
        sprite, SpriteInitializer(image_file_path, ITEM_ENTITY_SIZE))
    for i in range(3):
        item_type = item_types[i]
        bonus = bonuses[i]
        effect = StatModifyingItemEffect(item_type,
                                         {HeroStat.LIFE_STEAL: bonus})
        register_item_effect(item_type, effect)
        name = "Orb of Life (" + str(i + 1) + ")"
        description = effect.get_description()
        item_data = ItemData(ui_icon_sprite, sprite, name, description,
                             ItemEquipmentCategory.OFF_HAND)
        register_item_data(item_type, item_data)