Storm Battery v1
500
ID:
357
Family ID:
Author:
tolleder
Rarity:
rare
Element:
storm
Attack Type:
Energy
Attack Range:
800
Attack CD:
3
Damage:
822-822
Mana:
250
Mana regen:
2
Status:
Approved

Description:

A rare tower which can store electricity 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 electrifies the target.

Level Bonus:
+12 damage

AC_TYPE_OFFENSIVE_IMMEDIATE
 100, 1200 range, 20.0s cooldown
Electrify
The Storm Battery's projectiles electrify their target for 9 seconds. Every time an electrified creep is damaged by an attack or spell it has a chance of 20% to take 40% extra damage. 

Level Bonus:
+0.3% chance
+0.8% damage
+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
        //@export
        BuffType Tolleder_StormBat_bT
        //@export
        ProjectileType Tolleder_StormBat_pT
    endglobals
    
    public function hit takes Projectile p, Unit creep returns nothing
        local Tower tower=p.getCaster()
        local integer towerLevel=tower.getLevel()
        call tower.doSpellDamage(creep,p.userReal,tower.calcSpellCritNoBonus())
        //call slowAndDamage.apply(tower,creep,tower.getLevel())
        set Tolleder_StormBat_bT.applyCustomPower(tower,creep,R2I(1000.*(p.userReal2)*(0.2+0.003*I2R(towerLevel))),towerLevel).userReal=p.userReal2+1.
    endfunction
    
    public function onDamaged takes Buff b returns nothing
        local Tower tower=b.getCaster()
        local Playor plr=tower.getOwner()
        if tower.calcChance(0.2+I2R(b.getPower())*0.003) then
            set Event.damage=Event.damage*b.userReal //*(1.+0.4+0.008*b.getPower())
            call plr.displaySmallFloatingText(I2S(R2I(Event.damage)), b.getBuffedUnit(),128,255,255,20.)
        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
        set Tolleder_StormBat_bT=BuffType.create(9,0.3,false)
        call Tolleder_StormBat_bT.setBuffIcon('@@0@@')
        call Tolleder_StormBat_bT.addEventOnDamaged(EventHandler.onDamaged,1.,0.) //0.2,0.003)
        call Tolleder_StormBat_bT.setStackingGroup("StormBattery")
        //userReal=How many times the damage
        
        set Tolleder_StormBat_pT=ProjectileType.create("Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl",10.0,1200.0)        
        call Tolleder_StormBat_pT.enableHoming(ProjectileTargetEvent.hit,0.0)
        //userReal=Damage on hit
        //userReal2=Bonus damage
    endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    local integer towerLevel=tower.getLevel()
    //call slowAndDamage.apply(tower,Event.getTarget(),tower.getLevel())
    set Tolleder_StormBat_bT.applyCustomPower(tower,Event.getTarget(),R2I(1000.*(0.4+0.008*I2R(towerLevel))*(0.2+0.003*I2R(towerLevel))),towerLevel).userReal=0.4+0.008*I2R(towerLevel)+1.
    
    
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
    
    // mana cost paying
    if tower.subtractMana(10,false) == 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
            set p= Projectile.createFromPointToUnit(Tolleder_StormBat_pT,tower,1.0,1.0,GetUnitX(towerUnit)+3.0,GetUnitY(towerUnit)-6.0,160.0,result,true,false,false)
            set p.userReal=tower.getLevel()*12+300
            set p.userReal2=0.4+0.008*I2R(tower.getLevel())
            
            call p.setScale(0.5)
        endif
        
        // Manacost already payed
        // 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
Storm Storage v1
1200
ID:
358
Family ID:
Author:
tolleder
Rarity:
rare
Element:
storm
Attack Type:
Energy
Attack Range:
800
Attack CD:
3
Damage:
1973-1973
Mana:
300
Mana regen:
2
Status:
Approved

Description:

A rare tower which can store electricity for later use.
Specials:
+10 mana/lvl
Storage 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 750 spelldamage and electrifies the target.

Level Bonus:
+30 damage

AC_TYPE_OFFENSIVE_IMMEDIATE
 100, 1200 range, 20.0s cooldown
Electrify
The Storm Storage's projectiles electrify their target for 9 seconds. Every time an electrified creep is damaged by an attack or spell it has a chance of 20% to take 80% extra damage. 

Level Bonus:
+0.3% chance
+1.6% damage
+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
        //@import
        BuffType Tolleder_StormBat_bT
        //@import
        ProjectileType Tolleder_StormBat_pT
    endglobals

    //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
    endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    local integer towerLevel=tower.getLevel()
    //call slowAndDamage.apply(tower,Event.getTarget(),tower.getLevel())
    set Tolleder_StormBat_bT.applyCustomPower(tower,Event.getTarget(),R2I(1000.*(0.8+0.016*I2R(towerLevel))*(0.2+0.003*I2R(towerLevel))),towerLevel).userReal=0.8+0.016*I2R(towerLevel)+1.
    
    
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
            set p= Projectile.createFromPointToUnit(Tolleder_StormBat_pT,tower,1.0,1.0,GetUnitX(towerUnit)+3.0,GetUnitY(towerUnit)-6.0,160.0,result,true,false,false)
            set p.userReal=tower.getLevel()*30+750
            set p.userReal2=0.8+0.016*I2R(tower.getLevel())
            
            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
Storm Accumulator v1
3000
ID:
359
Family ID:
Author:
tolleder
Rarity:
rare
Element:
storm
Attack Type:
Energy
Attack Range:
800
Attack CD:
3
Damage:
4933-4933
Mana:
350
Mana regen:
2
Status:
Approved

Description:

A rare tower which can store electricity for later use.
Specials:
+10 mana/lvl
Accumulator 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 1800 spelldamage and electrifies the target.

Level Bonus:
+72 damage

AC_TYPE_OFFENSIVE_IMMEDIATE
 100, 1200 range, 20.0s cooldown
Electrify
The Storm Accumulator's projectiles electrify their target for 9 seconds. Every time an electrified creep is damaged by an attack or spell it has a chance of 20% to take 120% extra damage. 

Level Bonus:
+0.3% chance
+2.4% damage
+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
        //@import
        BuffType Tolleder_StormBat_bT
        //@import
        ProjectileType Tolleder_StormBat_pT
    endglobals

    //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
    endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    local integer towerLevel=tower.getLevel()
    //call slowAndDamage.apply(tower,Event.getTarget(),tower.getLevel())
    set Tolleder_StormBat_bT.applyCustomPower(tower,Event.getTarget(),R2I(1000.*(1.2+0.024*I2R(towerLevel))*(0.2+0.003*I2R(towerLevel))),towerLevel).userReal=1.2+0.024*I2R(towerLevel)+1.
    
    
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
            set p= Projectile.createFromPointToUnit(Tolleder_StormBat_pT,tower,1.0,1.0,GetUnitX(towerUnit)+3.0,GetUnitY(towerUnit)-6.0,160.0,result,true,false,false)
            set p.userReal=tower.getLevel()*72+1800
            set p.userReal2=1.2+0.024*I2R(tower.getLevel())
            
            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