Tiny Storm Lantern v1
250
ID:
380
Family ID:
Author:
Boekie
Rarity:
uncommon
Element:
storm
Attack Type:
Energy
Attack Range:
1000
Attack CD:
1.3
Damage:
207-207
Abil. Factor:
0.67
Status:
Approved

Description:

This tower is able to release a burst attack.

Latest Upload Comment:

Restored from 1.10
Burst Lightning
Has a 20% chance on attack to fire 2 extra projectiles at random creeps in 300 range around the main target. Each extra projectile deals the same amount of damage as a normal attack. 

Level Bonus:
+1% chance
+1 extra projectile at levels 15 and 25
Download

Toggle Triggers

Header

    globals
        ProjectileType ball 
    endglobals
    
    public function hit takes Projectile p, Unit creep returns nothing  
        local Tower tower = p.getCaster()  
        call tower.doAttackDamage(creep,tower.getCurrentAttackDamageWithBonus(), tower.calcAttackMulticrit(0.0,0.0,0))
    endfunction  
    
    //@export
    function newAttack takes Tower tower, integer numShots, Creep creep returns nothing
        local integer UID = creep.getUID()
        local Iterate it = Iterate.overUnitsInRangeOfUnit(tower,TARGET_CREEPS,creep,300)
        local Creep next
        call TriggerSleepAction(0.2)
        set next = it.nextRandom()
        loop
            if next == 0 then
                if creep.getUID() != UID then
                    return
                endif
                call Projectile.createFromUnitToUnit(ball,tower,1.0,0,tower,creep,true,false,false).setScale(0.50)
            else
                call Projectile.createFromUnitToUnit(ball,tower,1.0,0,tower,next,true,false,false).setScale(0.50)
                set next = it.nextRandom()
            endif
            set numShots = numShots - 1
            exitwhen numShots == 0
            call TriggerSleepAction(0.2)
        endloop
        if next != 0 then
            call it.destroy()
    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 ball = ProjectileType.create("Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl",4,1000)  
        call ball.enableHoming(ProjectileTargetEvent.hit,0)  
    endfunction 

On Attack

ONATTACK_chance: 0.20 ONATTACK_chanceLevelAdd: 0.01
function onAttack takes Tower tower returns nothing
    local Creep creep = Event.getTarget()
    local integer numShots = 2
    local integer twrLevel = tower.getLevel()
    if twrLevel == 25 then
        set numShots = 4 
    elseif twrLevel >= 15 then
        set numShots = 3
    endif
    
    call newAttack(tower,numShots,creep)
    
endfunction