Dutchman's Grave v1
5000
ID:
414
Family ID:
Author:
cedi
Rarity:
unique
Element:
darkness
Attack Type:
Physical
Attack Range:
2000
Attack CD:
2.5
Damage:
7138-7138
Status:
Approved

Description:

An inscription is written on the grave: "The admiral defeated the Dutchman and its crew near this island."
Soul Storm
When this spell is activated 2 souls will be released every 0.3 seconds. When a soul collides with a creep it deals 14000 spell damage. When a soul damages a creep, its damage is reduced by 50%.

AC_TYPE_NOAC_IMMEDIATE
 0, 600.00 range, 5.00s cooldown
Cannon
The Dutchman attacks a random creep in 800 range, dealing the tower's attack damage in 250 AoE around the target on hit. Uses the tower's attackspeed.
Soul Attack
Every 5 seconds the Dutchman attacks a random creep in 1200 range with a collected soul. Deals 14000 spell damage to the target.

Level Bonus:
+1400 spell damage
Panic
Whenever the Dutchman kills a creep, it collects its soul. All creeps in a range of 300 around the killed creep start to panic. They have only one thing in mind: RUN!. They don ' t care about their defense and their armor is reduced by 25, but they run 20% faster. This effect lasts 10 seconds.

Level Bonus:
-1 armor
-0.2% movement speed
Download

Toggle Triggers

Autocast

AUTOCAST_cooldown: 5.00 AUTOCAST_autoRange: 600.00 AUTOCAST_manacost: 0 AUTOCAST_range: 600.00 AUTOCAST_targetType: 0 AUTOCAST_numBuffsBeforeIdle: 0 caster_art: target_art: AUTOCAST_autocastType: AC_TYPE_NOAC_IMMEDIATE AUTOCAST_buffType: 0 AUTOCAST_isExtended: false AUTOCAST_targetSelf: true
private function onAutocast takes Tower tower returns nothing
    set Dutchman(tower.userInt).soulstorm = true
endfunction

Header

    globals
        ProjectileType Proj
        ProjectileType Soul
        ProjectileType NAttack
        Cast SAttack
        BuffType Panic
        MultiboardValues mbvals
    endglobals
    
    struct Dutchman
        Projectile p = 0
        integer uid = 0
        integer souls = 0
        real nattack = 2.00
        real sattack = 5.00
        real reorder = 2.00
        real soultime = 0.30
        Unit target = 0
        boolean soulstorm = false
        
        method onDestroy takes nothing returns nothing
            call .p.destroy()
        endmethod
        
        static method create takes Projectile p, Unit target returns thistype
            local thistype this = thistype.allocate()
            set .p = p
            set .target = target
            set .uid = target.getUID()
            
            set .nattack = p.getCaster().getCurrentAttackspeed()
            return this
        endmethod
        
    endstruct
    
    function Storm takes Projectile p, Dutchman d, Unit tower returns nothing
        local Projectile p2
        if d.souls >= 2 then
            set d.souls = d.souls - 2
            set p2 = Projectile.create( Soul, tower, 1.00, tower.calcSpellCritNoBonus(), p.x, p.y, p.z, 0.00 )
            set p2.userReal = 14000.00
            set p2 = Projectile.create( Soul, tower, 1.00, tower.calcSpellCritNoBonus(), p.x, p.y, p.z, 180.00 )
            set p2.userReal = 14000.00
        else
            set d.soulstorm = false
        endif
    endfunction
    
    function NAttackHit takes Projectile p, Unit target returns nothing
        local Tower T = p.getCaster()
        call T.doAttackDamageAoEUnit(target, 250, T.getCurrentAttackDamageWithBonus(), T.calcAttackMulticrit(0,0,0),0)
    endfunction
    
    function NAttackFunc takes Projectile p, Unit tower returns nothing
        local Iterate I = Iterate.overUnitsInRange( tower, TARGET_CREEPS, p.x, p.y, 800.00 )
        local Unit U = I.nextRandom()
        if U != 0 then
            call I.destroy()
            call Projectile.createLinearInterpolationFromPointToUnit(NAttack,tower,1,1,p.x,p.y,p.z,U,0.4,true)
        endif
    endfunction
    
    function SAttackFunc takes Projectile p, Dutchman d, Unit tower returns nothing
        local Iterate I
        local Unit U
        if d.souls >= 1 then
            set I = Iterate.overUnitsInRange( tower, TARGET_CREEPS, p.x, p.y, 1200.00 )
            loop
                set U = I.nextRandom()
                exitwhen U == 0
                if not U.isImmune() then
                    set d.souls = d.souls - 1
                    call SAttack.targetCastFromPoint( tower, U, p.x, p.y, 14000.00 + I2R( tower.getLevel() ) * 1400.00, tower.calcSpellCritNoBonus())
                    call I.destroy()
                    return
                endif
            endloop
        endif
    endfunction
    
    function Periodic takes Projectile p returns nothing
        local Unit tower = p.getCaster()
        local Dutchman d = p.userInt
        if IsUnitType( d.target.getUnit(), UNIT_TYPE_DEAD ) or d.target == 0 or d.target.getUID() != d.uid then
            call p.setHomingTarget( tower )
            set d.target = tower
            set d.uid = tower.getUID()
        endif
        set d.nattack = d.nattack - 0.1
        if d.nattack <= 0.00 then
            set d.nattack = d.nattack + tower.getCurrentAttackspeed()
            call NAttackFunc( p, tower )
        endif
        set d.sattack = d.sattack - 0.1
        if d.sattack <= 0.00 then
            set d.sattack = 5.00
            call SAttackFunc( p, d, tower )
        endif
        set d.reorder = d.reorder - 0.1
        if d.reorder <= 0.00 then
            set d.reorder = 2.00
            call p.setHomingTarget( d.target )
        endif
        if d.soulstorm then
            set d.soultime = d.soultime - 0.1
            if d.soultime <= 0.00 then
                set d.soultime = 0.3
                call Storm( p, d, tower )
            endif
        endif
    endfunction
    
    function Hit takes Projectile p, Unit target returns nothing
        call p.avertDestruction()
    endfunction
    
    function SoulHit takes Projectile p, Unit target returns nothing
        call SFXOnUnit( "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl", target.getUnit(), "chest" )
        call p.doSpellDamage( target, p.userReal )
        set p.userReal = p.userReal * 0.5
    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()
        set Proj = ProjectileType.create( "units\\creeps\\UndeadDestroyerShip\\UndeadDestroyerShip.mdl", 999999.00, 550.00 )
        call Proj.enablePeriodic( Periodic, 0.10 )
        call Proj.enableHoming( Hit, 4.00 )
        set SAttack = Cast.create( '@@0@@', "acidbomb", 5.00 )
        set Panic = BuffType.create( 10.00, 0.00, false )
        call Panic.setBuffIcon( '@@2@@' )
        call m.addModification( MOD_ARMOR, -25.00, -1.00 )
        call m.addModification( MOD_MOVESPEED, 0.20, -0.002 )
        call Panic.setBuffModifier( m )
        set NAttack = ProjectileType.createInterpolate("Abilities\\Weapons\\BoatMissile\\BoatMissile.mdl", 900.00 ) 
        call NAttack.setEventOnInterpolationFinished(NAttackHit)
        set Soul = ProjectileType.create( "Abilities\\Spells\\Undead\\Possession\\PossessionMissile.mdl", 6.00, 300.00 )
        call Soul.setAcceleration( 10.00 )
        call Soul.enableCollision( SoulHit, 100.00, TARGET_CREEPS, false )
        call Soul.setStartRotation( 6.00 )
        set mbvals = MultiboardValues.create( 1 )
        call mbvals.setKey( 0, "Souls" )
    endfunction

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
    local Dutchman d = tower.userInt
    set d.target = Event.getTarget()
    set d.uid = d.target.getUID()
    call d.p.setHomingTarget( d.target )
endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    set Event.damage = 0
endfunction

On Kill

function onKill takes Tower tower returns nothing
    local Iterate I = Iterate.overUnitsInRangeOfUnit( tower, TARGET_CREEPS, Event.getTarget(), 300.00 )
    local Unit U
    local integer lvl = tower.getLevel()
    local Dutchman d = tower.userInt
    set d.souls = d.souls + 1
    call SFXAtUnit( "Abilities\\Spells\\Items\\AIso\\AIsoTarget.mdl", Event.getTarget().getUnit() )
    loop
        set U = I.next()
        exitwhen U == 0
        call Panic.apply( tower, U, lvl )
    endloop
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    local Projectile p = Projectile.createFromUnitToUnit( Proj, tower, 1.00, tower.calcSpellCritNoBonus(), tower, tower, true, true, false )
    local Dutchman d = Dutchman.create( p, tower )
    call p.color( 100, 100, 100, 180 )
    call p.setScale( 1.00 )
    set tower.userInt = d
    set p.userInt = d
endfunction

On Tower Destruction

function onDestruct takes Tower tower returns nothing
    call Dutchman(tower.userInt).destroy()
endfunction

On Tower Details

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