Adept Elementalist v1
500
ID:
62
Family ID:
Author:
Kel-Thuzad
Rarity:
uncommon
Element:
astral
Attack Type:
Magic
Attack Range:
900
Attack CD:
2
Damage:
83-83
Status:
Approved

Description:

Little more experienced mage of elements.
Elemental Chaos
Elementalist casts one of the following spells on attack:

Fire Blast: 40% chance, 250 AoE, 500 damage
Frost Nova: 20% chance, 250 AoE, 250 damage, 12% slow for 3 seconds
Aftershock: 40% chance, 750 damage, 0.5 seconds stun

Level Bonus:
+10 damage (Fire Blast)
+8 damage (Frost Nova)
+0.01 seconds stun (Aftershock)
Download

Toggle Triggers

Header

globals
    //@import
    BuffType KelSlow 
endglobals
//The init function
private function init takes nothing returns nothing
endfunction

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
    local integer randomSpellID=GetRandomInt(1,5)
    local Creep c = Event.getTarget()
    local Unit u
    local Iterate it
    if randomSpellID<3 then
        call SFXAtUnit("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl",c.getUnit())
        call tower.doSpellDamageAoEUnit(c,250,500+tower.getLevel()*10,tower.calcSpellCritNoBonus(),0)
    elseif randomSpellID<5 then
        call SFXAtUnit("Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl",c.getUnit())
        call cb_stun.applyOnlyTimed(tower,c,0.5+tower.getLevel()*0.01)
        call tower.doSpellDamage(c,750,tower.calcSpellCritNoBonus())
    else
        set it = Iterate.overUnitsInRangeOfUnit(tower,TARGET_CREEPS,c,250)
        loop
            set u = it.next() //Get the next unit
            exitwhen u == 0 //Stop when there are no more units
            call KelSlow.applyCustomTimed(tower,u,120,3)
        endloop
        call SFXAtUnit("Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl",c.getUnit())
        call tower.doSpellDamageAoEUnit(c,250,50+tower.getLevel()*8,tower.calcSpellCritNoBonus(),0)
    endif
endfunction
Energy Junction v1
500
ID:
99
Family ID:
Author:
SirCoqalot.
Rarity:
uncommon
Element:
iron
Attack Type:
Energy
Attack Range:
500
Attack CD:
0.7
Damage:
455-455
Mana:
20
Mana regen:
1
Status:
Approved

Description:

Support tower which only attacks air. Buffs other units attackspeed and adds some spell and normal damage.
Specials:
Attacks AIR only
Jolt
Buffs a tower in 500 range for 10 seconds increasing its attackspeed by 20%. The buffed tower deals 150 attack damage and 150 spell damage on attack multiplied with its base attackspeed. 

Level Bonus:
+6 attack and spell damage 
+0.2% attackspeed

AC_TYPE_ALWAYS_BUFF
 15, 500 range, 8s cooldown
Download

Toggle Triggers

Autocast

AUTOCAST_cooldown: 8 AUTOCAST_autoRange: 500 AUTOCAST_manacost: 15 AUTOCAST_range: 500 AUTOCAST_targetType: TARGET_TYPE_TOWERS AUTOCAST_numBuffsBeforeIdle: 0 caster_art: target_art: AUTOCAST_autocastType: AC_TYPE_ALWAYS_BUFF AUTOCAST_buffType: sir_junction_buff AUTOCAST_isExtended: false AUTOCAST_targetSelf: true
private function onAutocast takes Tower tower returns nothing

endfunction

Header

    globals
        //@export
        BuffType sir_junction_buff
    endglobals
    
    function junctionOnCreate takes Buff b returns nothing
        local Tower tower = b.getCaster()
        local Tower buffee = b.getBuffedUnit()
        set b.userInt = 0
        if tower != buffee then
            set b.userInt = Lightning.createFromPointToUnit("CLPB", tower.getX(), tower.getY(), tower.getZ() - 60, buffee)
        endif
        //Add & save attackspeed
        set b.userReal = tower.userReal + tower.userReal2 * tower.getLevel()
        call buffee.modifyProperty(MOD_ATTACKSPEED, b.userReal)
    endfunction
    
    function junctionOnDamage takes Buff b returns nothing
        local Tower caster = b.getCaster()
        local Tower buffee = b.getBuffedUnit()
        local Creep creep  = Event.getTarget()
        local real damage = caster.userReal3 * (1 + caster.getLevel() / 25.0) * buffee.getBaseAttackspeed()
        
        call buffee.doSpellDamage(creep, damage, buffee.calcSpellCritNoBonus())
        call buffee.doAttackDamage(creep, damage, buffee.calcAttackMulticrit(0,0,0))
        call SFXAtUnit("Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl", creep.getUnit())
    endfunction
    
    function junctionOnCleanup takes Buff b returns nothing
        if b.userInt != 0 then
            call Lightning(b.userInt).destroy()
        endif
        call b.getBuffedUnit().modifyProperty(MOD_ATTACKSPEED, -b.userReal)
    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
        set sir_junction_buff = BuffType.create(10,0,true)
        call sir_junction_buff.setBuffIcon('@@0@@')
        call sir_junction_buff.addEventOnCreate(EventHandler.junctionOnCreate)
        call sir_junction_buff.addEventOnAttack(EventHandler.junctionOnDamage,1.0,0.0)
        call sir_junction_buff.addEventOnCleanup(EventHandler.junctionOnCleanup)
    endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    set tower.userReal = 0.2 //base attackspeed boost
    set tower.userReal2 = 0.002 //attackspeed boost add
    set tower.userReal3 = 150.0 //base dmg & spelldmg per attack (/25 for level bonus)
endfunction

On Tower Destruction

function onDestruct takes Tower tower returns nothing
    //Kill all buffs made by this tower in aoe, so that all lightnings get removed
    local Iterate it = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TOWERS, 500)
    local Tower cur = it.next()
    local Buff b
    
    loop
        exitwhen cur == 0
        set b = cur.getBuffOfType(sir_junction_buff)
        if b != 0 then
            if b.getCaster() == tower then
                call b.removeBuff()
            endif
        endif
        set cur = it.next()
    endloop
endfunction
Zealot v1
500
ID:
192
Family ID:
Author:
dzk87
Rarity:
rare
Element:
storm
Attack Type:
Physical
Attack Range:
875
Attack CD:
2
Damage:
1051-1161
Status:
Approved

Description:

Driven by zealotry, this unit is exceptionally good in physical combat.
Lightning Shield
As the zealot gets pumped up debuff durations are reduced by 4% with each stack of Zeal.
Zeal
Each attack works the Zealot into a greater frenzy, increasing his attack speed by 1% from each tower in 175 range. These towers have their attack speed slowed by 1%. Both effects stack up to 5 times and last 2.5 seconds. The attack speed amount reduces slightly with more towers.
Only towers that cost 200 gold or more are affected by this.

Level Bonus:
+1 max stack per 5 levels
Phase Blade
Each attack on the same creep penetrates deeper through its armor. Per attack 2% of this tower's attack damage won't be reduced by armor resistances. This effect stacks up to 5 times.

Level Bonus:
+0.08% damage per stack
Download

Toggle Triggers

Header

    globals
        //@export
        BuffType storm_zealot_fury
        //@export 
        BuffType storm_zealot_wound
        //@export
        BuffType storm_zealot_slow
        //@export
        BuffType storm_zealot_shield
    endglobals

    function storm_zealot_shield_Cleanup takes Buff b returns nothing
        if b.userInt2 != 0 then
            call Effect(b.userInt2).destroy()
        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()
        local Modifier n = Modifier.create()
        local Modifier o = Modifier.create()
        
        call m.addModification(MOD_ATTACKSPEED, 0.0, 0.0001)
        call n.addModification(MOD_ATTACKSPEED, 0.0, -0.0001)
        call o.addModification(MOD_DEBUFF_DURATION, 0.0, -0.0001)
        
        set storm_zealot_fury = BuffType.create(2.5, 0, true)
        set storm_zealot_wound = BuffType.create(200, 0, false)
        set storm_zealot_slow = BuffType.create(2.5, 0, true)
        set storm_zealot_shield = BuffType.create(2.5, 0, true)
        
        call storm_zealot_fury.setBuffModifier(m)
        call storm_zealot_slow.setBuffModifier(n)
        call storm_zealot_shield.setBuffModifier(o)
        
        call storm_zealot_fury.setBuffIcon('@@0@@')
        call storm_zealot_wound.setBuffIcon('@@1@@')
        call storm_zealot_slow.setBuffIcon('@@3@@')
        call storm_zealot_shield.setBuffIcon('@@2@@')
        
        call storm_zealot_shield.addEventOnCleanup(storm_zealot_shield_Cleanup)
    endfunction

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
    local Buff b
    local Tower u
    local Iterate it = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TOWERS, 175.0)
    local integer leechCounter = 0
    local integer leechPower
    local integer maxStacks = 5 + tower.getLevel()/5
 
    loop 
        set u = it.next()
        exitwhen u == 0 
        if u != tower and u.getGoldcost() >= 200 then
            set leechCounter = leechCounter + 1
        endif 
    endloop
    
    if leechCounter == 0 then
        return
    endif
    
    set leechPower = 105 - 5*leechCounter //1% leech per tower with 1 tower, 0.65% per tower with 8 
 
    set it = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TOWERS, 175.0)
    
    // Slows all towers in 175 range
    loop 
        set u = it.next()
        exitwhen u == 0 
        if u != tower and u.getGoldcost() >= 200 then
            set b = u.getBuffOfType(storm_zealot_slow)
            if b != 0 then
                set b.userInt = IMinBJ(b.userInt + 1, maxStacks)
                call storm_zealot_slow.applyCustomPower(tower, u, b.userInt, leechPower*b.userInt)
            else
                set storm_zealot_slow.applyCustomPower(tower, u, 1, leechPower).userInt = 1
            endif
        endif 
    endloop

    set leechPower = leechPower * leechCounter //in a way that's the per stack base
    set b = tower.getBuffOfType(storm_zealot_fury)
    
    //now apply zeal
    if b != 0 then
        call storm_zealot_fury.apply(tower, tower, IMinBJ(leechPower + b.getLevel(), leechPower * maxStacks))
    else
        call storm_zealot_fury.apply(tower, tower, leechPower) //used normal apply so power = level
    endif
    
    set b = tower.getBuffOfType(storm_zealot_shield)
    
    if b != 0 then
        if b.userInt < maxStacks then
            set b.userInt = b.userInt + 1
            if b.userInt == maxStacks then
                if b.userInt2 == 0 then
                    set b.userInt2 = Effect.createScaled("Abilities\\Spells\\Human\\ManaShield\\ManaShieldCaster.mdl", tower.getX(), tower.getY(), 115, 0, 0.65)
                    call Effect(b.userInt2).noDeathAnimation()
                endif
            endif
        endif
        
        call storm_zealot_shield.apply(tower, tower, 400 * b.userInt)
    else
        set b = storm_zealot_shield.apply(tower, tower, 400)
        set b.userInt = 1
        set b.userInt2 = 0
    endif
endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    local Creep target = Event.getTarget()
    local Buff phaseWound = target.getBuffOfType(storm_zealot_wound) 
    local real damageBase = Event.damage
    local real totalArmorPierce
    local real temp = AttackType.PHYSICAL.getDamageAgainst(target.getArmorType())
    
    if Event.isSpellDamage() or not Event.isMainTarget() then
        return
    endif
    
    //first check+upgrade the wound level
    if phaseWound == 0 then
        set phaseWound = storm_zealot_wound.apply(tower, target, 1)
        set phaseWound.userInt = 1 //stack counter
        set phaseWound.userInt2 = tower.getUID()
    else
        //multiple zealots + family member check. If another zealot attacks, no armor pierce for him
        //only the guy who put the first wound gets armor pierce
        //perfection would need hashtables storing wound level for every tower,creep pair. Not worth it i think.
        if phaseWound.userInt2 != tower.getUID() then
            return
        endif
        set phaseWound.userInt = IMinBJ(5, phaseWound.userInt + 1)
        call phaseWound.refreshDuration()
    endif
        
    if temp > 0.001 and temp < 1. then //ignoring armor type "resistance" not weakness :P 
        set damageBase = damageBase / temp 
    endif 
    
    set temp = 1 - target.getCurrentArmorDamageReduction()
    
     if temp > 0.001 and temp < 1. then 
        set damageBase = damageBase / temp 
    endif  
 
    set totalArmorPierce = (0.02 + 0.0008*tower.getLevel()) * phaseWound.userInt
    
    if Event.damage < damageBase then 
        set Event.damage = damageBase*totalArmorPierce + Event.damage*(1.-totalArmorPierce) 
    endif 
endfunction
Geothermal Extractor v1
500
ID:
221
Family ID:
Author:
Velex
Rarity:
rare
Element:
fire
Attack Type:
Elemental
Attack Range:
700
Attack CD:
0.5
Damage:
185-185
Status:
Approved

Description:

Aura tower with a damage bonus aura.
Thermal Boost - Aura
Increases damage of towers in 200 range by 18%.

Level Bonus:
+0.5% damage
Download

Toggle Triggers

Header

    globals
        //@export
        BuffType velex_dmg_aura
    endglobals
    

    private function init takes nothing returns nothing
        local Modifier m = Modifier.create()
        set velex_dmg_aura = BuffType.createAuraEffectType(true)
        call m.addModification(MOD_DAMAGE_ADD_PERC,0.0,0.001)
        call velex_dmg_aura.setBuffModifier(m)
        call velex_dmg_aura.setStackingGroup("dmg_aura")
        call velex_dmg_aura.setBuffIcon('@@0@@')
    endfunction

Tower Aura

AURA_powerAdd: 5 AURA_auraEffect: velex_dmg_aura AURA_levelAdd: 5 AURA_power: 180 AURA_targetType: TARGET_TYPE_TOWERS AURA_targetSelf: true AURA_level: 180 AURA_auraRange: 200
Ice Battery v1
500
ID:
320
Family ID:
Author:
tolleder
Rarity:
rare
Element:
ice
Attack Type:
Elemental
Attack Range:
800
Attack CD:
3
Damage:
822-822
Mana:
250
Mana regen:
2
Status:
Approved

Description:

A rare tower which can store ice for later use.
Specials:
+10 mana/lvl
Battery Overload
The tower attacks creeps in a range of 1200 every 0.2 seconds till all mana is gone. Each attack (or try to attack) costs 10 mana, deals 300 damage and applies Frost.

Level Bonus:
+12 damage

AC_TYPE_OFFENSIVE_IMMEDIATE
 100, 1200 range, 20.0s cooldown
Frost
A creep hit by one of this tower's shots is slowed by 10% for 9 seconds.

Level Bonus:
+0.3% slow
+0.3 seconds duration
Download

Toggle Triggers

Autocast

caster_art: AUTOCAST_cooldown: 20.0 AUTOCAST_numBuffsBeforeIdle: 0 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_IMMEDIATE AUTOCAST_manacost: 100 AUTOCAST_range: 1200 AUTOCAST_buffType: 0 AUTOCAST_targetSelf: false AUTOCAST_targetType: 0 target_art: AUTOCAST_autoRange: 800
private function onAutocast takes Tower tower returns nothing
    local unit towerUnit=tower.getUnit()
    local PeriodicEvent pE
    call SetUnitState(towerUnit,UNIT_STATE_MANA,GetUnitState(towerUnit,UNIT_STATE_MANA)+100)
    if tower.userInt!=0 then
        set pE=tower.userInt
        call pE.enable()
    endif
    set towerUnit = null
endfunction

Header

    globals
        BuffType slowAndDamage
        ProjectileType pT
    endglobals
    
    public function hit takes Projectile p, Unit creep returns nothing
        local Tower tower=p.getCaster()
        call tower.doSpellDamage(creep,tower.getLevel()*12+300,tower.calcSpellCritNoBonus())
        call slowAndDamage.apply(tower,creep,tower.getLevel())
    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 slow=Modifier.create()
        call slow.addModification(MOD_MOVESPEED,-0.10,-0.003)
        
        set slowAndDamage=BuffType.create(9,0.3,false)
        call slowAndDamage.setBuffIcon('@@0@@')
        call slowAndDamage.setBuffModifier(slow)
        call slowAndDamage.setStackingGroup("IceBattery")
        
        set pT=ProjectileType.create("Abilities\\Weapons\\LichMissile\\LichMissile.mdl",10.0,1200.0)        
        call pT.enableHoming(ProjectileTargetEvent.hit,0.0)
    endfunction

On Damage

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

On Tower Creation

function onCreate takes Tower tower returns nothing
    set tower.userInt=0
    call SetUnitState(tower.getUnit(),UNIT_STATE_MANA,0)
endfunction

Periodic

PERIODIC_period: 0.2
function periodic takes Tower tower returns nothing
    local unit towerUnit=tower.getUnit()
    local Iterate inRange
    local real numResults=0.0
    local Unit result
    local Unit next
    local Projectile p
    local PeriodicEvent pE
    
    if GetUnitState(towerUnit,UNIT_STATE_MANA)>10 then
        //Random creep in range
        set inRange=Iterate.overUnitsInRangeOfCaster(tower,TARGET_CREEPS,1200)
        loop
            set next=inRange.next()
            exitwhen next==0
            
            set numResults=numResults+1.0 
            if GetRandomReal(0.0,1.0)<=1.0/numResults then
                set result=next
            endif
        endloop
        
        if numResults>0.5 then
            //if GetRandomReal(0.0,3.0)<=2.0 then
                //if GetRandomReal(0.0,2.0)<=1.0 then
                    set p= Projectile.createFromPointToUnit(pT,tower,1.0,1.0,GetUnitX(towerUnit)+3.0,GetUnitY(towerUnit)-6.0,198.0,result,true,false,false)
                //else
                    //set p= Projectile.createFromPointToUnit(pT,tower,1.0,1.0,GetUnitX(towerUnit)-32.0,GetUnitY(towerUnit)-2.0,147.0,result,true,false,false)
            //else
                //set p= Projectile.createFromPointToUnit(pT,tower,1.0,1.0,GetUnitX(towerUnit)-32.0,GetUnitY(towerUnit)-2.0,147.0,result,true,false,false)
            //endif
            call p.setScale(0.5)
        endif
        
        
        //Manacost
        call SetUnitState(towerUnit,UNIT_STATE_MANA,GetUnitState(towerUnit,UNIT_STATE_MANA)-10)
    else
        set pE=Event.getCurrentPeriodicEvent()
        set tower.userInt=pE
        call pE.disable()
    endif
    set towerUnit = null
endfunction
Green Lightning v1
500
ID:
329
Family ID:
Author:
drol
Rarity:
rare
Element:
storm
Attack Type:
Energy
Attack Range:
1200
Attack CD:
2
Damage:
486-635
Mana:
65
Mana regen:
0
Status:
Approved

Description:

This tower gains mana by attacking and can use it to gain an attackspeed boost.
Specials:
+20% dmg to magical
Lightning Surge
Increases the attackspeed of this tower by 100% for the next 5 attacks. The surge fades after 8 seconds.

Level Bonus:
+2% attackspeed
+1 attack per 5 levels

AC_TYPE_OFFENSIVE_IMMEDIATE
 60, 1200 range, 6s cooldown
Mana Feed
Attacks restore 4 mana to the tower and increase spell crit chance by 5%.

Hint: Mana regeneration increases mana gained.

Level Bonus:
+0.1% spell crit chance
Lightning Burst
Grants a 12.5% chance to deal 15 times current mana as spell damage on attack.
Resets the bonus spell crit of 'Mana Feed'.

Level Bonus:
+0.5% chance
Download

Toggle Triggers

Autocast

caster_art: AUTOCAST_cooldown: 6 AUTOCAST_numBuffsBeforeIdle: 0 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_IMMEDIATE AUTOCAST_manacost: 60 AUTOCAST_range: 1200 AUTOCAST_buffType: 0 AUTOCAST_targetSelf: false AUTOCAST_targetType: 0 target_art: AUTOCAST_autoRange: 1200
private function onAutocast takes Tower tower returns nothing
    
    set tower.userInt = 5 + tower.getLevel() / 5
    call drol_surge.apply(tower,tower,tower.getLevel())
endfunction

Header

    globals
    //@export
    BuffType drol_surge
    endglobals
    
    function surge takes Buff b returns nothing
        local Unit caster = b.getCaster() 
        if (caster.userInt < 1) then
            call b.removeBuff()
        else
            set caster.userInt = caster.userInt - 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   drol_surge = BuffType.create(8,0,true)
        call  m.addModification(MOD_ATTACKSPEED, 1.0 , 0.02)
        call  drol_surge.setBuffModifier(m)
        call  drol_surge.setBuffIcon('@@1@@')
        call  drol_surge.addEventOnAttack(surge,1,0)
    
    endfunction

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
  local unit towerUnit = tower.getUnit()
  local real mana = GetUnitState(towerUnit, UNIT_STATE_MANA)
  
  call SetUnitState(towerUnit , UNIT_STATE_MANA, mana + 4 * (1. + tower.getProp_ManaRegPercBonus()))
  
  call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, 0.05+(tower.getLevel()*0.001))
  set tower.userReal = tower.userReal + 0.05 + (tower.getLevel()*0.001)
  set towerUnit = null
endfunction

On Damage

ONDAMAGE_chance: 0.125 ONDAMAGE_chanceLevelAdd: 0.005
function onDamage takes Tower tower returns nothing
    local Effect targetEffect 
    local Creep creep = Event.getTarget()
    
    if not creep.isImmune() then
    
        set targetEffect = Effect.createScaled("Abilities\\Spells\\Human\\ManaFlare\\ManaFlareBoltImpact.mdl", GetUnitX(creep.getUnit()), GetUnitY(creep.getUnit()), 0, 0, 1.8)
        call targetEffect.setLifetime(1.0)
        call tower.doSpellDamage(creep, GetUnitState(tower.getUnit(), UNIT_STATE_MANA) * 15,tower.calcSpellCritNoBonus())
        call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, -(tower.userReal))
        set tower.userReal = 0.0
    
    endif
    
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    set tower.userReal = 0.0
    set tower.userInt = 0
    
endfunction
Magic Battery v1
500
ID:
331
Family ID:
Author:
tolleder
Rarity:
rare
Element:
astral
Attack Type:
Magic
Attack Range:
800
Attack CD:
3
Damage:
822-822
Mana:
250
Mana regen:
2
Status:
Approved

Description:

A rare tower which can store magic energy for later use.
Specials:
+10 mana/lvl
Battery Overload
The tower attacks creeps in a range of 1200 every 0.2 seconds till all mana is gone. Each attack (or try to attack) costs 10 mana, deals 300 spelldamage and applies Faerie Fire.

Level Bonus:
+12 damage

AC_TYPE_OFFENSIVE_IMMEDIATE
 100, 1200 range, 20.0s cooldown
Faerie Fire
A creep hit by one of this tower's shots takes 10% extra damage from spells and debuffs last 20% longer for 9 seconds.

Level Bonus:
+0.4% extra spell damage
+0.6% extra debuff duration
+0.3 seconds Faerie Fire duration
Download

Toggle Triggers

Autocast

caster_art: AUTOCAST_cooldown: 20.0 AUTOCAST_numBuffsBeforeIdle: 0 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_IMMEDIATE AUTOCAST_manacost: 100 AUTOCAST_range: 1200 AUTOCAST_buffType: 0 AUTOCAST_targetSelf: false AUTOCAST_targetType: 0 target_art: AUTOCAST_autoRange: 800
private function onAutocast takes Tower tower returns nothing
    local unit towerUnit=tower.getUnit()
    local PeriodicEvent pE
    call SetUnitState(towerUnit,UNIT_STATE_MANA,GetUnitState(towerUnit,UNIT_STATE_MANA)+100)
    if tower.userInt!=0 then
        set pE=tower.userInt
        call pE.enable()
    endif
    set towerUnit = null
endfunction

Header

    globals
        BuffType slowAndDamage
        ProjectileType pT
    endglobals
    
    public function hit takes Projectile p, Unit creep returns nothing
        local Tower tower=p.getCaster()
        call tower.doSpellDamage(creep,tower.getLevel()*12+300,tower.calcSpellCritNoBonus())
        call slowAndDamage.apply(tower,creep,tower.getLevel())
    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 sWeakeness=Modifier.create()
        call sWeakeness.addModification(MOD_SPELL_DAMAGE_RECEIVED,0.10,0.004)
        call sWeakeness.addModification(MOD_DEBUFF_DURATION,0.20,0.006)
        
        set slowAndDamage=BuffType.create(9,0.3,false)
        call slowAndDamage.setBuffIcon('@@0@@')
        call slowAndDamage.setBuffModifier(sWeakeness)
        call slowAndDamage.setStackingGroup("MagicBattery")
        
        set pT=ProjectileType.create("Abilities\\Weapons\\ProcMissile\\ProcMissile.mdl",10.0,1200.0)        
        call pT.enableHoming(ProjectileTargetEvent.hit,0.0)
    endfunction

On Damage

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

On Tower Creation

function onCreate takes Tower tower returns nothing
    set tower.userInt=0
    call SetUnitState(tower.getUnit(),UNIT_STATE_MANA,0)
endfunction

Periodic

PERIODIC_period: 0.2
function periodic takes Tower tower returns nothing
    local unit towerUnit=tower.getUnit()
    local Iterate inRange
    local real numResults=0.0
    local Unit result
    local Unit next
    local Projectile p
    local PeriodicEvent pE
    
    if GetUnitState(towerUnit,UNIT_STATE_MANA)>10 then
        //Random creep in range
        set inRange=Iterate.overUnitsInRangeOfCaster(tower,TARGET_CREEPS,1200)
        loop
            set next=inRange.next()
            exitwhen next==0
            
            set numResults=numResults+1.0 
            if GetRandomReal(0.0,1.0)<=1.0/numResults then
                set result=next
            endif
        endloop
        
        if numResults>0.5 then
            //if GetRandomReal(0.0,3.0)<=2.0 then
                //if GetRandomReal(0.0,2.0)<=1.0 then
                    set p= Projectile.createFromPointToUnit(pT,tower,1.0,1.0,GetUnitX(towerUnit)+2.0,GetUnitY(towerUnit)+1.0,166.0,result,true,false,false)
                //else
                    //set p= Projectile.createFromPointToUnit(pT,tower,1.0,1.0,GetUnitX(towerUnit)-32.0,GetUnitY(towerUnit)-2.0,147.0,result,true,false,false)
            //else
                //set p= Projectile.createFromPointToUnit(pT,tower,1.0,1.0,GetUnitX(towerUnit)-32.0,GetUnitY(towerUnit)-2.0,147.0,result,true,false,false)
            //endif
            call p.setScale(0.5)
        endif
        
        
        //Manacost
        call SetUnitState(towerUnit,UNIT_STATE_MANA,GetUnitState(towerUnit,UNIT_STATE_MANA)-10)
    else
        set pE=Event.getCurrentPeriodicEvent()
        set tower.userInt=pE
        call pE.disable()
    endif
    set towerUnit = null
endfunction