Dark Matter Trident v1
410
lvl: 9

ID:

178

Author:

cedi

Rarity:

unique

Status:

Approved

Description:

Made from a mysterious material.

Latest Upload Comment:

Restored from 1.10
Drain Physical Energy
Whenever the carrier of this item hits a creep, the carrier gains 2% attackspeed and the creep is slowed by 2%. Both effects are attackspeed adjusted, last 5 seconds and stack up to 20 times.

Level Bonus:
+0.1 second duration
Download

Toggle Triggers

Header

goldcost: 410
    globals
        BuffType neg
        BuffType pos
    endglobals
    
    //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
        local Modifier m = Modifier.create()
        call m.addModification( MOD_MOVESPEED, 0.0, -0.0002 )
        
        set neg = BuffType.create( 2.5, 0.0, false )
        call neg.setBuffIcon( '@@0@@' )
        call neg.setBuffModifier( m )
        
        set m = Modifier.create()
        call m.addModification( MOD_ATTACKSPEED, 0.0, 0.0002 )
        
        set pos = BuffType.create( 2.5, 0.0, true )
        call pos.setBuffIcon( '@@1@@' )
        call pos.setBuffModifier( m )
    endfunction

On Damage

ONDAMAGE_chance: 1.0 goldcost: 0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Item itm returns nothing
    local Buff B
    local Tower T
    local Creep C
    local integer levelAdd
    local real dur
    if Event.isMainTarget() then
        set T = itm.getCarrier()
        set C = Event.getTarget()
        set levelAdd = R2I(100.0 * T.getCurrentAttackspeed())
        set dur = 5 + 0.1 * T.getLevel()
        
        set B = T.getBuffOfType(pos)
        if B != 0 then
            call pos.applyCustomTimed(T, T, IMinBJ(levelAdd + B.getLevel(), 2000), dur)
        else
            call pos.applyCustomTimed(T, T, levelAdd, dur)
        endif
        
        set B = C.getBuffOfType(neg)
        if B != 0 then
            call neg.applyCustomTimed(T, C, IMinBJ(levelAdd + B.getLevel(), 2000), dur)
        else
            call neg.applyCustomTimed(T, C, levelAdd, dur)
        endif
    endif
endfunction