Black Dragon Roost v2
1600
ID:
223
Family ID:
Author:
cedi
Rarity:
unique
Element:
darkness
Attack Type:
Essence
Attack Range:
800
Attack CD:
2
Damage:
1501-1501
Status:
Approved

Description:

It's said that the black dragons are the reaper's mounts.
Fear the Dark
Whenever this tower damages a creep it has a 20% chance to debuff it for 7 seconds. Debuffed creeps take 30% more damage. Each creep in 500 range decreases the effect by 25%, creeps with this buff don't count. The effect on bosses is 50% weaker.

Level Bonus:
+0.4% chance
+0.28 seconds duration
1.2% more damage taken
Download

Toggle Triggers

Header

            globals
        BuffType BT
    endglobals
    
    function startA takes Buff B returns nothing
        local Unit U = B.getBuffedUnit() 
        local unit u = U.getUnit() 
        
        call SetUnitVertexColor( u, 125, 125, 125, 255 )
        set u = null
    endfunction
    
    function clean takes Buff B returns nothing
        local Unit U = B.getBuffedUnit() 
        local unit u = U.getUnit() 
        
        call SetUnitVertexColor( u, 255, 255, 255, 255 )
        set u = null
    endfunction
    
    function dmg takes Buff B returns nothing
        local Tower C = B.getCaster()
        local Unit T = B.getBuffedUnit()
        local real r = C.getLevel() * 0.012 + 0.30
        local Iterate I = Iterate.overUnitsInRangeOfUnit( C, TARGET_CREEPS, T, 500.00 )
        local Unit U
        
        if T.getSize() >= SIZE_BOSS then
            set r = r / 2.00
        endif
        
        loop
            set U = I.next()
            exitwhen U == 0
            if U.getBuffOfType( BT ) != 0 then
                set r = r * 0.75
            endif
        endloop
        
        set Event.damage = Event.damage * ( 1.00 + r )
    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 BT = BuffType.create( 7.0, 0.28, false )
        call BT.setBuffIcon( '@@0@@' )
        call BT.addEventOnCreate( startA )
        call BT.addEventOnCleanup( clean )
        call BT.addEventOnDamage( dmg, 1.00, 0.00 )
    endfunction
        

On Damage

ONDAMAGE_chance: 0.2 ONDAMAGE_chanceLevelAdd: 0.004
function onDamage takes Tower tower returns nothing
            
call BT.apply( tower, Event.getTarget(), tower.getLevel() )
        
endfunction