Wooden Trap v1
50
ID:
325
Family ID:
Author:
Boekie
Rarity:
uncommon
Element:
iron
Attack Type:
Physical
Attack Range:
950
Attack CD:
1.3
Damage:
38-38
Abil. Factor:
0.6
Status:
Approved

Description:

This trap is used to capture beasts but it works on other stuff too.

Latest Upload Comment:

Restored from 1.10
Activate Trap
Every 15 seconds this tower traps 3 creeps in 950 range, dealing 70 spelldamage and stunning them for 0.5 seconds.

Level Bonus:
+3 spelldamage 
-0.2 seconds cooldown
Download

Toggle Triggers

Header

    globals
    endglobals
    
    //@export
    function trap takes Tower tower, real cooldown, real baseDamage, real damageAdd, real stunDuration, integer maxTargets returns nothing
        local integer lvl = tower.getLevel()
        local Iterate it = Iterate.overUnitsInRangeOfCaster(tower,TARGET_CREEPS,950)
        local Unit next = it.nextRandom()
        local integer numTargets = 0

        loop
            exitwhen next == 0
            set numTargets = numTargets + 1
            call cb_stun.applyOnlyTimed(tower, next, stunDuration) 
            call tower.doSpellDamage(next,baseDamage+lvl*damageAdd,tower.calcSpellCritNoBonus())
            call SFXAtUnit("Abilities\\Spells\\Orc\\ReinforcedTrollBurrow\\ReinforcedTrollBurrowTarget.mdl",next.getUnit())
            exitwhen numTargets >= maxTargets
            set next = it.nextRandom()
        endloop
        
        if next != 0 then 
            call it.destroy()
        endif
        
        if numTargets > 0 then
            call Event.getCurrentPeriodicEvent().enableAdvanced(cooldown - lvl*0.2, false) //Trapping successful; go into cooldown.
        else
            call Event.getCurrentPeriodicEvent().enableAdvanced(2, false) //Nothing trapped; go into a shorter cooldown.
        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
    endfunction

Periodic

PERIODIC_period: 2
function periodic takes Tower tower returns nothing
    call trap(tower, 15, 70, 3, 0.5, 3)
endfunction