Fisherman v1
3000
ID:
211
Family ID:
Author:
cedi
Rarity:
unique
Element:
ice
Attack Type:
Physical
Attack Range:
1100
Attack CD:
1
Damage:
1983-1983
Abil. Factor:
0.68
Status:
Approved

Description:

Am I a man? So can I be called fisherman?

Latest Upload Comment:

Restored from 1.10
Specials:
+8% damage/lvl
Fresh Fish!
Each time Fisherman's Net strangles a creep, the dps of towers in 500 range is increased by 15% of this tower's dps for 5 seconds.

Level Bonus:
+0.1 second duration
+0.004 damage per second multipler
Impatient
After 4 attacks on the same target the fisherman will attack a different unit. Favoring creeps that are not suffering the effect of 'Fisherman's Net'.
Fisherman's Net
Creeps damaged by this tower get caught in its net, slowing them by 25% for 3 seconds. If a creep's movement speed is below 120 when this buff expires, it will have failed to free itself and will have a 3% chance of getting strangled in the net and dying. Bosses and immune units receive 400% attack damage from this tower instead of death. The chance to die is adjusted by how long the creep was ensnared: the longer the buff duration, the greater the chance and vice versa. Stunned creeps will also trigger the instant kill chance.

Level Bonus:
+1% slow
+2.4 movement speed required
+0.2% chance
Download

Toggle Triggers

Header

    globals
        BuffType Fisherman_dpsBoost
        BuffType Fisherman_slow
        MultiboardValues MB
    endglobals
        
    function FreshFish takes Tower t returns nothing
        local Unit U
        local integer buffLevel = R2I(1000 * t.getCurrentAttackDamageWithBonus() / t.getCurrentAttackspeed() * (0.15 + 0.004 * t.getLevel()))
        local real duration = 5.0 + 0.1 * t.getLevel()
        local Iterate I = Iterate.overUnitsInRangeOfCaster(t, TARGET_TYPE_TOWERS, 500.0)
        loop
            set U = I.next()
            exitwhen U == 0
            call Fisherman_dpsBoost.applyCustomTimed(t, U, buffLevel, duration)
        endloop
    endfunction
        
    function slow_start takes Buff B returns nothing
        set B.userReal = Game.getGameTime()
    endfunction
        
    function slow_end takes Buff B returns nothing
        local Unit U = B.getBuffedUnit()
        local Tower T = B.getCaster()
        local integer lvl = T.getLevel()
        local unit u = U.getUnit()
        if GetUnitMoveSpeed(u) <= 120 + 2.4 * lvl or U.getBuffOfGroup("stun") != 0 then
            if T.calcChance((0.03 + lvl * 0.002) * ((Game.getGameTime() - B.userReal) / 25 / 3.0)) then
                if U.getSize() >= SIZE_BOSS or U.isImmune() then
                    call T.doAttackDamage(U, T.getCurrentAttackDamageWithBonus() * (4 + 0.16 * lvl), T.calcAttackMulticrit(0,0,0))
                else
                    call T.killInstantly(U)
                endif
                call FreshFish(T)
                call SFXOnUnit("Objects\\Spawnmodels\\Human\\HumanLargeDeathExplode\\HumanLargeDeathExplode.mdl",u,"origin")
                set T.userInt = T.userInt + 1
            endif
        endif
        set u = null
    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
        local Modifier m = Modifier.create()
        
        call m.addModification(MOD_DPS_ADD, 0.0, 0.001)
        set Fisherman_dpsBoost = BuffType.create(0.0, 0.0, true) //Applied custom timed.
        call Fisherman_dpsBoost.setBuffIcon( '@@0@@' )
        call Fisherman_dpsBoost.setBuffModifier(m)
        
        set m = Modifier.create()
        call m.addModification(MOD_MOVESPEED, -0.25, -0.01)
        set Fisherman_slow = BuffType.create(3.0, 0.0, false)
        call Fisherman_slow.setBuffModifier(m)
        call Fisherman_slow.setBuffIcon( '@@1@@' )
        call Fisherman_slow.addEventOnCreate(slow_start)
        call Fisherman_slow.setEventOnExpire(slow_end)
        
        set MB = MultiboardValues.create( 1 )
        call MB.setKey( 0, "Strangled Units" )
    endfunction

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
    local Unit U = Event.getTarget()
    local Unit T
    local Iterate I
    
    if tower.userInt3 != U.getUID() then
        set tower.userInt3 = U.getUID()
        set tower.userInt2 = 0
    endif
    
    set tower.userInt2 = tower.userInt2 + 1
    
    if tower.userInt2 > 4 and U.getSize() < SIZE_BOSS then
        set I = Iterate.overUnitsInRangeOfCaster( tower, TARGET_TYPE_CREEPS, tower.getRange() )
        
        loop
            set T = I.next()
            exitwhen T == 0
            
            if T != U and T.getBuffOfType( Fisherman_slow ) == 0 then
                call IssueTargetOrder( tower.getUnit(), "attack", T.getUnit() )
                call I.destroy()
                return
            endif
        endloop
        set tower.userInt2 = 0
    endif
    
endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    call Fisherman_slow.apply(tower, Event.getTarget(), tower.getLevel())
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    set tower.userInt = 0
    set tower.userInt2 = 0
    set tower.userInt3 = 0
endfunction

On Tower Details

function onTowerDetails takes Tower tower returns MultiboardValues
    call MB.setValue( 0, I2S( tower.userInt ) )
    return MB
endfunction