Old Hunter v1
1000
lvl: 40

ID:

242

Author:

Guennter

Rarity:

rare

Status:

Approved

Description:

"I will teach you, what hunting is like!"

Latest Upload Comment:

Restored from 1.10
Old Hunter
After each kill, the carrier transfers 1 flat experience to up to 5 random towers in 500 range. The carrier must be at least level 5 to trigger this ability.
Download

Toggle Triggers

On Kill

goldcost: 1000
function onKill takes Item itm returns nothing
    local Tower tower = itm.getCarrier() 
    local Tower next
    local Iterate in_range
    local integer count
    
    // test if tower is minimum lvl 5
    if tower.getLevel() >= 5 then
        // test, if there are towers in range
        set in_range = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TOWERS, 500)
        set count = IMinBJ(5, in_range.count())
        if count > 0 then 
            call tower.removeExpFlat(count)
            loop
                set next = in_range.nextRandom()
                exitwhen next == 0
                call next.addExpFlat(1)
                call SFXAtUnit("Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl", next.getUnit())
                set count = count - 1
                exitwhen count == 0
            endloop
            if next != 0 then
                call in_range.destroy()
            endif
        else
            call in_range.destroy()
        endif
    endif   
endfunction