Ancient Energy Converter v1
3500
ID:
202
Family ID:
Author:
geX
Rarity:
unique
Element:
storm
Attack Type:
Energy
Attack Range:
1600
Attack CD:
1.1
Damage:
72-2472
Mana:
1200
Mana regen:
20
Status:
Approved

Description:

Converts energy into pure destruction!
Specials:
Bounce attack:
   3 targets
   -70% damage per bounce
+25 mana/lvl
Energy Conversion
Spawns 3 orbs that last 12 seconds flying around the Converter. Each orb deals  1500 damage per second to random units in 650 range.
Additionally, the orbs have a 25% chance every second to cast a chainlightining that deals 1500 initial damage and hits up to 4 targets dealing 25% less damage with each bounce.
Units hit by the chainlightning are stunned for 0.8 seconds.

Level Bonus:
+75 orb damage
+1 orb spawned per 5 levels

AC_TYPE_OFFENSIVE_IMMEDIATE
 1200, 0.0 range, 12.0s cooldown
Download

Toggle Triggers

Autocast

caster_art: Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl AUTOCAST_cooldown: 12.0 AUTOCAST_numBuffsBeforeIdle: 0 AUTOCAST_isExtended: true AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_IMMEDIATE AUTOCAST_manacost: 1200 AUTOCAST_range: 0.0 AUTOCAST_buffType: 0 AUTOCAST_targetSelf: false AUTOCAST_targetType: 0 target_art: AUTOCAST_autoRange: 650.0
private function onAutocast takes Tower tower returns nothing
        local integer level = tower.getLevel()
        local integer numProjectiles = 3 + level/5
        local integer i = numProjectiles
        local Projectile p
        local real x = tower.getX()
        local real y = tower.getY()
        
        //Rotate either left or right
        call myProj.setStartRotation(1.2 * (GetRandomInt(0,1)*2-1.0))
        
        //Spawn projectiles
        loop
            set i = i - 1
            set p = Projectile.create(myProj,tower,1.0+level*0.05,tower.calcSpellCritNoBonus(),x,y,80.0,i*360.0/numProjectiles)
            call p.setScale(2.0)
            call p.addAbility('@@0@@')
            exitwhen i < 1
        endloop
    
endfunction

Header

    globals
        Cast lightCast
        ProjectileType myProj
        TargetType myTargType
    endglobals
    
    function damageStun takes DummyUnit d returns nothing
        call cb_stun.applyOnlyTimed(d.getCaster(),Event.getTarget(),0.8)
    endfunction
    
    function periodicLightning takes Projectile p returns nothing
        local Iterate it
        local Unit u
        local Unit caster = p.getCaster()
        if caster.calcChance(0.25) then
            set it = it.overUnitsInRange(caster,myTargType,p.x,p.y,650.0)
            set u = it.next()
            if u != 0 then
                call lightCast.targetCastFromPoint(caster, u,p.x,p.y,p.getDmgRatio(),p.getCritRatio())
                call it.destroy()
            endif
        endif
    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 lightCast = Cast.create('@@1@@',"chainlightning",5.0)
        call lightCast.setDamageEvent(damageStun)
        call lightCast.setSourceHeight(80.0)
        set myProj = ProjectileType.create("Abilities\\Spells\\Human\\ManaFlare\\ManaFlareTarget.mdl",12.0,250.0)
        call myProj.enablePeriodic(periodicLightning,1.0)
        set myTargType = TargetType.create(TARGET_TYPE_CREEPS)
    endfunction