Eredar Warlock v1
2800
ID:
132
Family ID:
Author:
SirCoqaLot.
Rarity:
unique
Element:
darkness
Attack Type:
Essence
Attack Range:
890
Attack CD:
3
Damage:
1753-1752
Abil. Factor:
0.15
Status:
Approved

Description:

Daemonic entity that will stun allied towers and temporarily steal their damage for itself and will threaten nearby units by occasionally releasing shadowboltwaves.

Latest Upload Comment:

Restored from 1.10
Siphon Essence
Casts a buff on a nearby tower, if that tower tries to attack in the next 5 seconds it will be stunned for 2.5 seconds and this tower will deal [stunned tower's DPS x 3] as essence damage to the target of the buffed tower. 

Level Bonus:
-0.02 seconds stun duration
Shadowbolt Wave
Every autocast of this tower has a 20% chance to release 10 shadowbolts. Every shadowbolt flies towards a random target in 1000 range and deals 1050 spell damage. This Spell has a 40% chance to trigger if the last autocast released a shadowboltwave.

Level Bonus:
+21 spell damage
Download

Toggle Triggers

Autocast

AUTOCAST_cooldown: 2.5 AUTOCAST_autoRange: 400 AUTOCAST_manacost: 0 AUTOCAST_range: 400 AUTOCAST_targetType: TARGET_TYPE_TOWERS AUTOCAST_numBuffsBeforeIdle: 1 caster_art: target_art: AUTOCAST_autocastType: AC_TYPE_ALWAYS_BUFF AUTOCAST_buffType: 0 AUTOCAST_isExtended: true AUTOCAST_targetSelf: false
private function onAutocast takes Tower tower returns nothing
    local Tower target = Event.getTarget()
    call sir_eredar_buff.apply(tower,target,1)
    call rollForShadowWave(tower)
endfunction

Header

    globals
    //@export
    ProjectileType sir_eredar_attackProj
    //@export
    ProjectileType sir_eredar_waveProj
    //@export
    BuffType sir_eredar_buff
    endglobals
   
    //@export
    function rollForShadowWave takes Tower t returns nothing
        local Projectile p
        local integer counter = 0
        local integer projCount
        local real angle
        local real x
        local real y
        local real z
        local Iterate it
       
        if (t.userInt == 0 and t.calcChance(0.20)) or (t.userInt == 1 and t.calcChance(0.40)) then   
            set t.userInt = 1
            // Check whether there's anything to shoot at before creating any projectiles.
            set it = Iterate.overUnitsInRangeOfCaster(t, TARGET_CREEPS, 1000)
            if it.count() == 0 then
                return
            endif
            call it.destroy()
            
            set projCount = t.userInt2
            set angle = 0
            set x = t.getX()
            set y = t.getY()
            set z = t.getZ()
            
            loop
                exitwhen projCount == 0
                set p = Projectile.createFromUnitToPoint(sir_eredar_waveProj, t, 1, 1, t, x+300*Cos(angle), y+300*Sin(angle), z, false, false)
                set angle = angle + 36 * bj_DEGTORAD
                set projCount = projCount - 1
            endloop
        else
            set t.userInt = 0
        endif
    endfunction
   
    public function sir_eredar_launch takes Projectile p returns nothing
        local Tower t = p.getCaster()
        local Iterate it
        
        if t != 0 then
            set it = Iterate.overUnitsInRangeOfCaster(t, TARGET_CREEPS, 1000)
            if it.count() != 0 then
                set p.explode = false // projectile will only explode if there are no targets around.
                call Projectile.createFromPointToUnit(sir_eredar_attackProj, t, 1, 1, p.x, p.y, p.z, it.nextRandom(), true, false, false)
                if it.count() != 0 then
                    call it.destroy()
                endif
            endif
        endif
    endfunction
   
    public function sir_eredar_hit takes Projectile p, Unit creep returns nothing
        local Tower tower = p.getCaster()
        call tower.doSpellDamage(creep, tower.userReal * (1+tower.getLevel()*0.02), tower.calcSpellCritNoBonus())
    endfunction
   
    public function sir_towerstun takes Buff b returns nothing       
        local Tower eredar = b.getCaster()
        local Tower attacker = b.getBuffedUnit()
        local Unit target = Event.getTarget()
        local real dmg = attacker.getCurrentAttackDamageWithBonus()/attacker.getCurrentAttackspeed() * 3
        call cb_stun.applyOnlyTimed(eredar,attacker,2.5-eredar.getLevel()*0.02)
        call eredar.doAttackDamage(target,dmg,eredar.calcSpellCritNoBonus())
        call Effect.createSimple("Abilities\\Spells\\Undead\\Impale\\ImpaleHitTarget.mdl",attacker.getX(),attacker.getY()).destroy()
        call eredar.getOwner().displayFloatingTextX(I2S(R2I(dmg)), target, 255, 0, 150, 255, 0.05, 0.0, 2.0)
        call Effect.createSimple("Abilities\\Spells\\Undead\\Impale\\ImpaleHitTarget.mdl",target.getX(),target.getY()).destroy()
    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 sir_eredar_buff = BuffType.create(5,0,true) 
        call sir_eredar_buff.setBuffIcon('@@0@@')       
        set sir_eredar_waveProj = ProjectileType.createRanged("Abilities\\Spells\\Other\\BlackArrow\\BlackArrowMissile.mdl", 300, 600)
        call sir_eredar_waveProj.setEventOnExpiration(ProjectileEvent.sir_eredar_launch)
        set sir_eredar_attackProj = ProjectileType.create("Abilities\\Spells\\Other\\BlackArrow\\BlackArrowMissile.mdl", 4, 1000)
        call sir_eredar_attackProj.enableHoming(ProjectileTargetEvent.sir_eredar_hit,0)       
        call sir_eredar_buff.addEventOnAttack(sir_towerstun,1,0)
   endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    set tower.userInt = 0 // stores whether last autocast triggered shadowbolts
    set tower.userInt2 = 10 // stores num shadowbolts to release
    set tower.userReal = 1050 // stores base shadowbolt damage
endfunction