Dagger of Bane v1
700
lvl: 18

ID:

132

Author:

F12ight

Rarity:

unique

Status:

Approved

Description:

The dagger oozes out deadly green poison.

Latest Upload Comment:

Restored from 1.10
Deadly Poison
Applies a deadly poison on damage to the main target of the attack. Each second the poison deals 15% of the tower's base damage as spell damage to the target. The spell damage is always critical. Lasts 4 seconds.
Download

Toggle Triggers

Header

goldcost: 0
globals
    BuffType fright_poison_dagger_buff
endglobals

function dealDamage takes Buff b returns nothing
    local Tower tower = b.getCaster()
    if tower == b.userInt then
        call tower.doSpellDamage(b.getBuffedUnit(),tower.getCurrentAttackDamageBase()*0.15,tower.getProp_SpellCritDamage())
    else
        call b.removeBuff()
    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 fright_poison_dagger_buff = BuffType.create(4.01,0,false)   // + 0.01 seconds is a dirty hack to make damage tick 4 times with 100% duration
    call fright_poison_dagger_buff.setBuffIcon('@@0@@')
    call fright_poison_dagger_buff.addPeriodicEvent(EventHandler.dealDamage,1)
endfunction

On Damage

ONDAMAGE_chance: 1.0 goldcost: 700 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Item itm returns nothing
 
    local Buff P
    local Unit u
    if Event.isMainTarget() then
        set u = Event.getTarget()
        set P = u.getBuffOfType( fright_poison_dagger_buff )
        if P != 0 then
            call fright_poison_dagger_buff.apply(itm.getCarrier(), Event.getTarget(), 0)
        else
            set fright_poison_dagger_buff.apply(itm.getCarrier(), Event.getTarget(), 0).userInt = itm.getCarrier()
        endif
    endif
endfunction