Harby v1
3100
ID:
267
Family ID:
Author:
Glowackos
Rarity:
unique
Element:
darkness
Attack Type:
Decay
Attack Range:
800
Attack CD:
1.4
Damage:
2785-2785
Abil. Factor:
0.5
Status:
Approved

Description:

A statue built in honor of the great Obsidian Warrior. Legend often depicts him wearing nothing but a dark shroud, though his true story is shrouded in darkness.

Latest Upload Comment:

Restored from 1.10
Specials:
x1.45 spell crit damage (+x0.05/lvl)
-55% debuff duration (-1%/lvl)
+10 mana/lvl
Arcane Orb
Infuses Harby's attacks with arcane energy at the cost of 100 mana per attack. Deals [6 x Current Mana] as bonus spelldamage. This ability also passively grants 1 bonus maximum mana for each creep Harby kills.

Level Bonus:
+[0.1 x Current Mana] as bonus spelldamage
Grotesque Awakening
Whenever hit by a spell, the statue comes to life for 5 seconds, enabling it to attack. This ability is affected by buff duration.
Arcane Aura
Towers in 350 range have a 10% chance to replenish 10% of their total manapool when casting an ability that costs mana. Cannot retrigger on the same tower within 5 seconds. This effect will also proc off Harby's Arcane Orb attacks, without the retrigger restriction.

Level Bonus:
+0.4% chance
+0.2% maximum mana replenished
Download

Toggle Triggers

Header

    globals
        BuffType glow_arcaneAura
        BuffType glow_awaken
        ProjectileType glow_arcaneOrb
    endglobals
    
    function awakenOnCreate takes Buff b returns nothing
        local unit u = b.getBuffedUnit().getUnit()
        call SFXAtUnit("Abilities\\Spells\\Human\\Polymorph\\PolyMorphDoneGround.mdl", u)
        call SFXAtUnit("Objects\\Spawnmodels\\Undead\\UndeadBlood\\ObsidianStatueCrumble2.mdl", u)
        call AddUnitAnimationProperties(u, "stand alternate", true)
        //Set the unit's height cause it looks dodgy after morphing
        call SetUnitFlyHeight(u, 100, 2000)
        call UnitRemoveAbility(u, '@@0@@')
        set u = null
    endfunction
    
    function awakenOnCleanup takes Buff b returns nothing
        local unit u = b.getBuffedUnit().getUnit()
        call SFXAtUnit("Abilities\\Spells\\Human\\Polymorph\\PolyMorphDoneGround.mdl", u)
        call AddUnitAnimationProperties(u, "stand alternate", false)
        call SetUnitFlyHeight(u, 40, 2000)
        call UnitAddAbility(u, '@@0@@')
        set u = null
    endfunction

    function arcane_manaReplenish takes Tower t returns nothing
        call Effect.createColored("Abilities\\Spells\\Undead\\ReplenishHealth\\ReplenishHealthCasterOverhead.mdl", t.getX(), t.getY(), t.getZ()+80, 0.0, 1.0, 100, 100, 255, 255).destroy()
        call t.addManaPerc(0.1 + 0.002 * t.getLevel())
    endfunction
    
    function arcane_onCreate takes Buff b returns nothing
        set b.userInt = 0 //Stores when the buff last procced.
    endfunction
    
    function arcane_onSpellCast takes Buff b returns nothing
        local Tower t = b.getBuffedUnit()
        //125 = 5 * 25 ticks = 5 seconds.
        if (b.userInt + 125 < Game.getGameTime()) and Event.getAutocastType().getManacost() > 0.0 then 
            if t.calcChance(0.1 + 0.004 * t.getLevel()) then
                call arcane_manaReplenish(t)
                set b.userInt = Game.getGameTime()
            endif
        endif
    endfunction
    
    function arcane_orb_hit takes Projectile p, Unit target returns nothing
        call p.doSpellDamage(target, p.userReal)
    endfunction
    
    //Do not remove or rename this function!
    //Put your initialization tasks here, this function will be called on map init
    private function init takes nothing returns nothing
        set glow_arcaneAura = BuffType.createAuraEffectType(true)
        call glow_arcaneAura.setBuffIcon('@@1@@')
        call glow_arcaneAura.addEventOnCreate(EventHandler.arcane_onCreate)
        call glow_arcaneAura.addEventOnSpellCast(EventHandler.arcane_onSpellCast)
        
        set glow_awaken = BuffType.create(5, 0, true)
        call glow_awaken.addEventOnCreate(EventHandler.awakenOnCreate)
        call glow_awaken.addEventOnCleanup(EventHandler.awakenOnCleanup)
        call glow_awaken.setBuffIcon('@@2@@')
        
        set glow_arcaneOrb = ProjectileType.create("Abilities\\Weapons\\AvengerMissile\\AvengerMissile.mdl", 10, 1500)
        call glow_arcaneOrb.enableHoming(ProjectileTargetEvent.arcane_orb_hit, 0.0)
    endfunction

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
    //Since the tower WILL have the mana most of the time (I assume..), may as well compute these values immediately.
    local real dmg = (6 + 0.1 * tower.getLevel()) * GetUnitState(tower.getUnit(), UNIT_STATE_MANA)
    local Creep creep = Event.getTarget()
    local Projectile p
    if tower.getBuffOfType(glow_awaken) != 0 then
        // Throw out the attack projectile (tower's real attack does all the work but we hide its projectile model)
        set p = Projectile.createFromUnitToUnit(glow_arcaneOrb,tower,1.0,tower.calcSpellCritNoBonus(),tower,creep,true,false,false)
        if tower.subtractMana(100, false) == 100 then
            if tower.calcChance(0.1 + 0.004 * tower.getLevel()) then
                call arcane_manaReplenish(tower)
            endif
            call tower.getOwner().getTeam().displayFloatingTextX("+" + I2S(R2I(dmg)), tower, 255, 0, 255, 255, 0.05, 2, 3)
            set p.userReal = dmg
            // Swap out projectile model for arcane-orb-empowered attacks.
            call p.setModel("Abilities\\Weapons\\IllidanMissile\\IllidanMissile.mdl")
        else
            set p.userReal = 0
        endif
    endif
endfunction

On Kill

function onKill takes Tower tower returns nothing
    call tower.modifyProperty(MOD_MANA, 1)
endfunction

On Spell Target

function onSpellTarget takes Tower tower returns nothing
    call glow_awaken.apply(tower, tower, 0)
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    call AddUnitAnimationProperties(tower.getUnit(), "stand alternate", false)
    call tower.modifyProperty(MOD_MANA, tower.getKills())
endfunction

Tower Aura

AURA_powerAdd: 1 AURA_auraEffect: glow_arcaneAura AURA_levelAdd: 1 AURA_power: 0 AURA_targetType: TARGET_TYPE_TOWERS AURA_targetSelf: true AURA_level: 0 AURA_auraRange: 350