Goblin Stronghold v1
2500
ID:
373
Family ID:
Author:
cedi
Rarity:
unique
Element:
iron
Attack Type:
Physical
Attack Range:
800
Attack CD:
2.5
Damage:
897-906
Abil. Factor:
0.1
Status:
Approved

Description:

You should always consider goblin-made items to be a nuclear weapon with a faulty trigger, you just might live to see another day.

Latest Upload Comment:

Restored from 1.10
Clockwork Engineer
Whenever this tower attacks it has a 20% chance to launch a clockwork engineer at a random tower within 500 range, increasing attack speed and damage by 10% - 40% for 5 seconds.

Level Bonus:
+0.6% chance
+0.6% attack speed and damage
Goblin Sapper
Whenever this tower attacks it has a 20% chance to launch a sapper team at the attacked creep. On contact the sappers deal 1350 - 7650 spell damage to the target and all creeps within 250 range. Also slows all affected creeps by 25% - 45% for 3 seconds.

Level Bonus:
+0.4% chance
+180 spell damage
+0.6% slow
Download

Toggle Triggers

Header

    globals
        ProjectileType cedi_gob_sapper
        ProjectileType cedi_gob_robot //Both robot and emitter
        
        BuffType cedi_gob_sapperB
        BuffType cedi_gob_robotB
        BuffType cedi_gob_emitterB
    endglobals
    
    function Sapper_Hit takes Projectile P, Unit U returns nothing
        local Tower T = P.getCaster()
        local Iterate I = Iterate.overUnitsInRangeOfUnit( T, TARGET_CREEPS, U, 250.00 )
        
        if T == 0 then
            //We got no caster, abbadon ship.
            call I.destroy()
            return
        endif
        
        call T.getOwner().displaySmallFloatingText( I2S( P.userInt / 10 ) + "% slow", U, 100, 100, 255, 40.0 )
        
        call DestroyEffect( AddSpecialEffect( "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", P.x, P.y ) )
        
        loop
            set U = I.next()
            exitwhen U == 0
            call T.doSpellDamage( U, P.userReal, T.calcSpellCritNoBonus() )
            call cedi_gob_sapperB.apply( T, U, P.userInt )
        endloop
    endfunction
    
    //Both robot and emitter
    function Robot_Hit takes Projectile P, Unit U returns nothing
        set P.explode = false
        
        if P.getCaster() == 0 then
            //We got no caster, abbadon ship.
            return
        endif
        
        if P.userInt == 1 then
            //robot
            call cedi_gob_robotB.apply( P.getCaster(), U, P.userInt2 )
            call P.getCaster().getOwner().displaySmallFloatingText( I2S( P.userInt2 / 10 ) + "% AS and DMG", U, 100, 255, 100, 40.0 )
        else
            //emitter
            call cedi_gob_emitterB.apply( P.getCaster(), U, P.userInt2 )
            call P.getCaster().getOwner().displaySmallFloatingText( I2S( P.userInt2 / 10 ) + "% Trigger Chance", U, 100, 255, 100, 40.0 )
        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
        local Modifier m
        
        //sapper
        set cedi_gob_sapper = ProjectileType.create( "units\\creeps\\GoblinSapper\\GoblinSapper.mdl", 20.0, 700.00 )
        call cedi_gob_sapper.enableHoming( Sapper_Hit, 0 )
        //sapper buff
        set cedi_gob_sapperB = BuffType.create( 3.0, 0.0, false )
        call cedi_gob_sapperB.setBuffIcon( '@@2@@' )
        set m = Modifier.create()
        call m.addModification( MOD_MOVESPEED, 0.00, -0.001 )
        call cedi_gob_sapperB.setBuffModifier( m )
        
        //robot / emitter
        set cedi_gob_robot = ProjectileType.createInterpolate( "", 200.0 )
        call cedi_gob_robot.setEventOnInterpolationFinished( Robot_Hit )
        //robot buff
        set cedi_gob_robotB = BuffType.create( 5.0, 0.0, true )
        call cedi_gob_robotB.setBuffIcon( '@@3@@' )
        set m = Modifier.create()
        call m.addModification( MOD_DAMAGE_ADD_PERC, 0.00, 0.001 )
        call m.addModification( MOD_ATTACKSPEED, 0.00, 0.001 )
        call cedi_gob_robotB.setBuffModifier( m )
        call cedi_gob_robotB.setSpecialEffect( "Units\\Creeps\\HeroTinkerRobot\\HeroTinkerRobot.mdl", 120.0, 0.7 )
        
        //emitter buff
        set cedi_gob_emitterB = BuffType.create( 5.0, 0.0, true )
        call cedi_gob_emitterB.setBuffIcon( '@@4@@' )
        set m = Modifier.create()
        call m.addModification( MOD_TRIGGER_CHANCES, 0.00, 0.001 )
        call cedi_gob_emitterB.setBuffModifier( m )
        call cedi_gob_emitterB.setSpecialEffect( "units\\creeps\\GoblinLandMine\\GoblinLandMine.mdl", 120.0, 1.0 )
    endfunction

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
    local Unit U = Event.getTarget()
    local Projectile P
    local integer lvl = tower.getLevel()
    local boolean b = false
    local Iterate I
    //sapper
    if tower.calcChance( 0.2 + 0.004 * lvl ) then
        set b = true 
        set P = Projectile.createFromUnitToUnit( cedi_gob_sapper, tower, 1.0, 1.0, tower, U, true, false, false )
        //set damage 4500 (0.3/1.7)  + 180
        set P.userReal = GetRandomReal( 1350.0, 7650.0 ) + 180.00 * lvl
        //set slow / 15% + 10%  / 0.001
        set P.userInt = GetRandomInt( 250, 450 ) + 6 * lvl
    endif
    
    //robot
    if tower.calcChance( 0.2 + 0.004 * lvl ) then
        set I = Iterate.overUnitsInRangeOfCaster( tower, TARGET_TOWERS, 500.00 )
        set U = I.nextRandom()
        
        //Don't target self
        if U == tower then
            set U = I.nextRandom()
        endif
        
        if U != 0 then
            call I.destroy()
        else
            //no sense doing anything more.
            return
        endif
    
        set b = true 
        set P = Projectile.createLinearInterpolationFromUnitToUnit( cedi_gob_robot, tower, 1.0, 1.0, tower, U, 0.35, true )
        //set model
        call P.setModel( "Units\\Creeps\\HeroTinkerRobot\\HeroTinkerRobot.mdl" )
        //set type
        set P.userInt = 1
        //set effect / 10% - 40%
        set P.userInt2 = GetRandomInt( 100, 400 ) + 6 * lvl
    endif
    
    //emitter
    if tower.calcChance( 0.2 + 0.004 * lvl ) then
        set I = Iterate.overUnitsInRangeOfCaster( tower, TARGET_TOWERS, 500.00 )
        set U = I.nextRandom()
        
        //Don't target self
        if U == tower then
            set U = I.nextRandom()
        endif
        
        if U != 0 then
            call I.destroy()
        else
            //no sense doing anything more.
            return
        endif
    
        set b = true 
        set P = Projectile.createLinearInterpolationFromUnitToUnit( cedi_gob_robot, tower, 1.0, 1.0, tower, U, 0.33, true )
        //set model
        call P.setModel( "units\\creeps\\GoblinLandMine\\GoblinLandMine.mdl" )
        //set type
        set P.userInt = 0
        //set effect / 30% - 60% +15%
        set P.userInt2 = GetRandomInt( 300, 600 ) + 6 * lvl
    endif
    
    //Economy
    if not b then
        //Nothing happened, add gold
        call tower.getOwner().giveGold( 5.0, tower.getUnit(), true, true )
    endif
endfunction