Storm Coil v1
3000
ID:
576
Family ID:
Author:
SirCoqaLot.
Rarity:
unique
Element:
storm
Attack Type:
Energy
Attack Range:
1000
Attack CD:
4
Damage:
3270-3270
Mana:
50
Mana regen:
1
Status:
Approved

Description:

Strong storm tower that creates a magnetic surge beneath a target dealing damage as it moves. Deals more damage and slows the further away the target is.
Magnetic Surge
This tower creates a magnetic surge at its target's current location. The creep will suffer spell damage equal to 4 times the distance to the spot where the surge was created every 0.4 seconds. This effect lasts 4 seconds. 

Level Bonus:
+2% spell damage 
+0.1 seconds duration

AC_TYPE_OFFENSIVE_BUFF
 40, 1000 range, 4s cooldown
Overload
On attack this tower deals [distance to the target x 12] energy damage, modified by its attack damage and slows the target for 1.5 seconds. The further away the target is, the more it will be slowed down. The maximum slow of 30% can only be reached, if the target has the maximum distance to the tower.
Energetic Field - Aura
Units in 1000 range around this tower are dealt up to 20% bonus damage by Storm towers. The further away creeps are from tower, the more damage is dealt. 

Level Bonus:
+0.6% maximum damage
Download

Toggle Triggers

Autocast

AUTOCAST_cooldown: 4 AUTOCAST_autoRange: 1000 AUTOCAST_manacost: 40 AUTOCAST_range: 1000 AUTOCAST_targetType: TARGET_TYPE_CREEPS AUTOCAST_numBuffsBeforeIdle: 1 caster_art: target_art: AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_BUFF AUTOCAST_buffType: 0 AUTOCAST_isExtended: false AUTOCAST_targetSelf: false
private function onAutocast takes Tower tower returns nothing
    local Unit creep = Event.getTarget()
    local Buff b = sir_tesla_debuff.applyAdvanced(tower,creep,0,0,4.0+tower.getLevel()*0.1)
    set b.userReal = GetUnitX(creep.getUnit())
    set b.userReal2= GetUnitY(creep.getUnit())
endfunction

Header

    globals
    BuffType sir_tesla_debuff
    BuffType sir_tesla_slow 
    BuffType sir_tesla_aura
    endglobals
    
    
    public function sirTeslaPeriodic takes Buff b returns nothing
        local Unit target = b.getBuffedUnit()
        local Tower tower = b.getCaster()
        local real x1 = GetUnitX(target.getUnit())
        local real y1 = GetUnitY(target.getUnit())
        local real originx = b.userReal
        local real originy = b.userReal2
        call tower.doSpellDamage(target,4*SquareRoot((originx - x1)*(originx - x1) + (originy - y1)*(originy - y1))*(1 + tower.getLevel()*0.02),tower.calcSpellCritNoBonus())
        call tower.getOwner().displayFloatingTextX(I2S(R2I(4*SquareRoot((originx - x1)*(originx - x1) + (originy - y1)*(originy - y1))*(1 + tower.getLevel()*0.02))),target,150, 150, 255,255,0.05,0.0,2.0)
        call SFXAtUnit("Abilities\\Spells\\Items\\AIlb\\AIlbSpecialArt.mdl",target.getUnit())
    endfunction
    
    function sir_tesla_event takes Buff b returns nothing
        local Tower tower = b.getCaster()
        local Unit creep = b.getBuffedUnit()
        local real tx = tower.getX()
        local real ty = tower.getY()
        local real dx = creep.getX()-tx
        local real dy = creep.getY()-ty
        local real range = SquareRoot(dx * dx + dy * dy)
        
        if Element.STORM == Event.getTarget().getCategory() then
            set Event.damage = Event.damage * (range * (0.00020+tower.getLevel()*0.000006) + 1)
        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 = Modifier.create()
    set sir_tesla_slow = BuffType.create(0,0,false)
    call sir_tesla_slow.setBuffIcon('@@1@@')
    call m.addModification(MOD_MOVESPEED,0,-0.0001)
    call sir_tesla_slow.setBuffModifier(m) 
    set sir_tesla_debuff = BuffType.create(0,0,false)
    call sir_tesla_debuff.setBuffIcon('@@0@@')
    call sir_tesla_debuff.setStackingGroup("sir_tesla_debuff")
    call sir_tesla_debuff.addPeriodicEvent(sirTeslaPeriodic,0.4) 
    set sir_tesla_aura = BuffType.createAuraEffectType(false)
    call sir_tesla_aura.addEventOnDamaged(sir_tesla_event,1,0)
    call sir_tesla_aura.setBuffIcon('@@2@@')
    endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    local Unit target = Event.getTarget()
    local real tx = tower.getX()
    local real ty = tower.getY()
    local real dx = target.getX()-tx
    local real dy = target.getY()-ty
    local real range = SquareRoot(dx * dx + dy * dy)
    local real damage = (R2I(range)*12.0)*tower.getCurrentAttackDamageWithBonus()/tower.getBaseDamage()
    call tower.doAttackDamage(target,R2I(damage),tower.calcAttackMulticrit(0,0,0))
    call tower.getOwner().displayFloatingTextX(I2S(R2I(damage)),target,255, 200, 0,255,0.05,0.0,2.0)
    call sir_tesla_slow.applyAdvanced(tower,target,0,R2I(range*3),1.5)
endfunction

Tower Aura

AURA_powerAdd: 0 AURA_auraEffect: sir_tesla_aura AURA_levelAdd: 0 AURA_power: 0 AURA_targetType: TARGET_TYPE_CREEPS AURA_targetSelf: true AURA_level: 0 AURA_auraRange: 1000