Fisherman v1
3000
ID:
211
Family ID:
Author:
cedi
Rarity:
unique
Element:
ice
Attack Type:
Physical
Attack Range:
1100
Attack CD:
1
Damage:
1983-1983
Status:
Approved

Description:

Am I a man? So can I be called fisherman?
Specials:
+8% damage/lvl
Fresh Fish!
Each time Fisherman's Net strangles a creep, the dps of towers in 500 range is increased by 15% of this tower's dps for 5 seconds.

Level Bonus:
+0.1 second duration
+0.004 damage per second multipler
Impatient
After 4 attacks on the same target the fisherman will attack a different unit. Favoring creeps that are not suffering the effect of 'Fisherman's Net'.
Fisherman's Net
Creeps damaged by this tower get caught in its net, slowing them by 25% for 3 seconds. If a creep's movement speed is below 120 when this buff expires, it will have failed to free itself and will have a 3% chance of getting strangled in the net and dying. Bosses and immune units receive 400% attack damage from this tower instead of death. The chance to die is adjusted by how long the creep was ensnared: the longer the buff duration, the greater the chance and vice versa. Stunned creeps will also trigger the instant kill chance.

Level Bonus:
+1% slow
+2.4 movement speed required
+0.2% chance
Download

Toggle Triggers

Header

    globals
        BuffType Fisherman_dpsBoost
        BuffType Fisherman_slow
        MultiboardValues MB
    endglobals
        
    function FreshFish takes Tower t returns nothing
        local Unit U
        local integer buffLevel = R2I(1000 * t.getCurrentAttackDamageWithBonus() / t.getCurrentAttackspeed() * (0.15 + 0.004 * t.getLevel()))
        local real duration = 5.0 + 0.1 * t.getLevel()
        local Iterate I = Iterate.overUnitsInRangeOfCaster(t, TARGET_TYPE_TOWERS, 500.0)
        loop
            set U = I.next()
            exitwhen U == 0
            call Fisherman_dpsBoost.applyCustomTimed(t, U, buffLevel, duration)
        endloop
    endfunction
        
    function slow_start takes Buff B returns nothing
        set B.userReal = Game.getGameTime()
    endfunction
        
    function slow_end takes Buff B returns nothing
        local Unit U = B.getBuffedUnit()
        local Tower T = B.getCaster()
        local integer lvl = T.getLevel()
        local unit u = U.getUnit()
        if GetUnitMoveSpeed(u) <= 120 + 2.4 * lvl or U.getBuffOfGroup("stun") != 0 then
            if T.calcChance((0.03 + lvl * 0.002) * ((Game.getGameTime() - B.userReal) / 25 / 3.0)) then
                if U.getSize() >= SIZE_BOSS or U.isImmune() then
                    call T.doAttackDamage(U, T.getCurrentAttackDamageWithBonus() * (4 + 0.16 * lvl), T.calcAttackMulticrit(0,0,0))
                else
                    call T.killInstantly(U)
                endif
                call FreshFish(T)
                call SFXOnUnit("Objects\\Spawnmodels\\Human\\HumanLargeDeathExplode\\HumanLargeDeathExplode.mdl",u,"origin")
                set T.userInt = T.userInt + 1
            endif
        endif
        set u = null
    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()
        
        call m.addModification(MOD_DPS_ADD, 0.0, 0.001)
        set Fisherman_dpsBoost = BuffType.create(0.0, 0.0, true) //Applied custom timed.
        call Fisherman_dpsBoost.setBuffIcon( '@@0@@' )
        call Fisherman_dpsBoost.setBuffModifier(m)
        
        set m = Modifier.create()
        call m.addModification(MOD_MOVESPEED, -0.25, -0.01)
        set Fisherman_slow = BuffType.create(3.0, 0.0, false)
        call Fisherman_slow.setBuffModifier(m)
        call Fisherman_slow.setBuffIcon( '@@1@@' )
        call Fisherman_slow.addEventOnCreate(slow_start)
        call Fisherman_slow.setEventOnExpire(slow_end)
        
        set MB = MultiboardValues.create( 1 )
        call MB.setKey( 0, "Strangled Units" )
    endfunction

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
    local Unit U = Event.getTarget()
    local Unit T
    local Iterate I
    
    if tower.userInt3 != U.getUID() then
        set tower.userInt3 = U.getUID()
        set tower.userInt2 = 0
    endif
    
    set tower.userInt2 = tower.userInt2 + 1
    
    if tower.userInt2 > 4 and U.getSize() < SIZE_BOSS then
        set I = Iterate.overUnitsInRangeOfCaster( tower, TARGET_TYPE_CREEPS, tower.getRange() )
        
        loop
            set T = I.next()
            exitwhen T == 0
            
            if T != U and T.getBuffOfType( Fisherman_slow ) == 0 then
                call IssueTargetOrder( tower.getUnit(), "attack", T.getUnit() )
                call I.destroy()
                return
            endif
        endloop
        set tower.userInt2 = 0
    endif
    
endfunction

On Damage

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

On Tower Creation

function onCreate takes Tower tower returns nothing
    set tower.userInt = 0
    set tower.userInt2 = 0
    set tower.userInt3 = 0
endfunction

On Tower Details

function onTowerDetails takes Tower tower returns MultiboardValues
    call MB.setValue( 0, I2S( tower.userInt ) )
    return MB
endfunction
Elder Northern Troll v1
3000
ID:
251
Family ID:
Author:
DaveMatthews
Rarity:
rare
Element:
ice
Attack Type:
Elemental
Attack Range:
800
Attack CD:
2
Damage:
5459-5459
Status:
Approved

Description:

Wanders in the cold northern lands, looking for preys.
Specials:
+20% dmg to orcs (+0.4%/lvl)
+20% dmg to humanoids (+0.4%/lvl)
Ice Smashing Axe
On attack this tower has a 15% chance to throw a giant axe. The axe shatters all the buffs from its target and deals 30% of the tower's attack damage as elemental damage for each buff purged. If more than 5 buffs are removed the enemy is also stunned for 1.5 seconds (0.75 on bosses). The axe is so heavy that its wielder's attack speed is slowed by 30% for 3 seconds after throwing it. 

Level Bonus:
+0.6% damage per buff 
-0.4% attack speed reduction
Ice Coated Axes
This tower deals 0.7% bonus damage for every 1% movement speed the target is missing. 

Level Bonus:
+0.03% damage
Download

Toggle Triggers

Header

    globals
        //@import
        BuffType dave_fatigue
        //@import
        ProjectileType dave_axe
    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 Attack

ONATTACK_chance: 0.15 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
    local Projectile p
    local Unit creep = Event.getTarget()
    local integer level = tower.getLevel()

    set p = Projectile.createLinearInterpolationFromUnitToUnit(dave_axe, tower,1,1, tower, creep, 0.2, true)
    set p.userReal = 0.3+0.006*level
    call p.setScale(1.5)
    call dave_fatigue.apply(tower,tower,level)
endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    local Creep creep = Event.getTarget()
    local integer level= tower.getLevel()
    local real speed = creep.getBaseMovespeed()
    local real currentSpeed = creep.getCurrentMovespeed()
    local real slow
    local real damage
    if currentSpeed < speed then
        set slow = (speed - currentSpeed) / speed
        set damage = Event.damage*slow*(0.7+0.03*level)
        set Event.damage = Event.damage+damage
        call tower.getOwner().displaySmallFloatingText("+"+I2S(R2I(damage)),creep,100,100,255,0)
    endif
endfunction
Starskin Skink v1
3000
ID:
258
Family ID:
Author:
cedi
Rarity:
uncommon
Element:
nature
Attack Type:
Decay
Attack Range:
800
Attack CD:
1
Damage:
1243-1277
Status:
Approved

Description:

It likes to hug people.
Poisonous Skin - Aura
This and any towers in 200 range gain a poisonous attack. The poison deals 127.5 spell damage per second for 5 seconds. The effect stacks and is attack speed and range adjusted.

Level Bonus:
+5.1 spell damage per second
Download

Toggle Triggers

Header

            globals
        //@import
        BuffType cedi_skinkA //Aura
        //@import
        BuffType cedi_skinkB //Buff
    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 Tower Creation

function onCreate takes Tower tower returns nothing
            
set tower.userReal = 127.5
    set tower.userReal2 = 5.1
        
endfunction

Tower Aura

AURA_auraEffect: cedi_skinkA AURA_power: 0 AURA_level: 0 AURA_auraRange: 200 AURA_targetType: TARGET_TYPE_TOWERS AURA_levelAdd: 1 AURA_powerAdd: 1 AURA_targetSelf: true
            
        
Valor v1
3000
ID:
262
Family ID:
Author:
cedi
Rarity:
unique
Element:
iron
Status:
Approved

Description:

A truly inspiring sight.
Valor's Light
Whenever a creep comes within 800 range of this tower it takes an initial 2000 spell damage per second and its movement speed is decreased by 30%. The damage and slow of this ability decay by 50% every second. Lasts 5 seconds.

Level Bonus:
+80 spell damage
+1.2% slow
Last Line of Defense
Any creep passing this tower twice will take 1% more spell and attack damage for each tower within 400 range of this tower. This effect is goldcost adjusted, towers with a goldcost of 2500 provide the full bonus.

Level Bonus:
+0.08% spell and attack damage taken per tower
We Will Not Fall! - Aura
Increases the attack and spell damage of all towers in 400 range by 0.5% for each percent of lost lives. If the team has more than 100% lives, towers will deal less damage!

Level Bonus:
+0.02% more spell and attack damage
Download

Toggle Triggers

Header

    globals
        //Dummy buff to count times the creep walked past.
        BuffType Last_Line_Prob
        //Real effect of the last line ability
        BuffType Last_Line_Buff
        
        //Buff Type for we will not fall
        BuffType We_Will
        
        //Valor's Light damage and slow
        BuffType Valor
    endglobals
    
    //Periodic adjustment for the effect granted through we will not fall
    //If this is buggy, it's glow's fault. :P
    function We_WillAdjust takes Buff B returns nothing
        local Unit U = B.getBuffedUnit()
        local real newBonus = (100 - U.getOwner().getTeam().getLivesPercent()) / 100.0 * (0.5 + 0.02 * B.getCaster().getLevel())
        local real delta = newBonus - B.userReal
        if delta != 0 then
            call U.modifyProperty(MOD_SPELL_DAMAGE_DEALT, delta)
            call U.modifyProperty(MOD_DAMAGE_ADD_PERC, delta)
            set B.userReal = newBonus
        endif
    endfunction
    
    //Init for we will not fall 
    function We_WillInit takes Buff B returns nothing
        set B.userReal = 0.00
        call We_WillAdjust( B )
    endfunction
    
    //Cleanup for the we will not fall effect
    function We_WillEnd takes Buff B returns nothing
        local Unit U = B.getBuffedUnit()
        call U.modifyProperty( MOD_SPELL_DAMAGE_DEALT, -B.userReal )
        call U.modifyProperty( MOD_DAMAGE_ADD_PERC, -B.userReal )
    endfunction
    
    //Valor Buff damage and slow. First time should work now.
    function ValorEffect takes Buff B returns nothing
        local Unit U = B.getBuffedUnit()
        if B.userInt == 0 then
            //First time, only slow, flag being first
            set B.userInt = 1
        else
            //additional times, decrease slow effect!
            call B.setPower(B.getPower()/2)
        endif
        
        //Deal the right amount of damage
        call B.getCaster().doSpellDamage( U, B.userReal, B.getCaster().calcSpellCritNoBonus() )
        //Adjust the amount of damage dealt.
        set B.userReal = B.userReal * 0.5
        
        //Some sfx to pretty it up
        call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Heal\\HealTarget.mdl", U.getUnit(), "origin" ) )
    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 up dummy. No icon, no effect
        set Last_Line_Prob = BuffType.create( -1.0, 0.00, false ) //Dummy Buff, to count the times a unit entered
        //Set up the buff and icon.
        set Last_Line_Buff = BuffType.create( -1.0, 0.00, false ) //Real buff, adding the damage bonus.
        call Last_Line_Buff.setBuffIcon( '@@0@@' )
        
        //Set up for we will not fall
        //Init and adjust are noew two parts to allow for initiation
        set We_Will = BuffType.createAuraEffectType( true )
        call We_Will.setBuffIcon( '@@1@@' )
        call We_Will.addPeriodicEvent( We_WillAdjust, 15.0 )
        call We_Will.addEventOnCreate( We_WillInit )
        call We_Will.addEventOnCleanup( We_WillEnd )
        
        //Valor's light, damage and slow
        set Valor = BuffType.create( 5.0, 0.0, false )
        call Valor.setBuffIcon( '@@2@@' )
        //call Valor.addEventOnCreate( ValorEffect )
        call Valor.addPeriodicEvent( ValorEffect, 1.0 )
        call m.addModification(MOD_MOVESPEED,0,-0.001)
        call Valor.setBuffModifier(m)    
    endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    call SetUnitFacing( tower.getUnit(), 270.00 - 45.00 )
    call SetUnitAnimationByIndex( tower.getUnit(), 5 )
    call TriggerSleepAction( 0.3 )
    call SetUnitTimeScale( tower.getUnit(), 0.0 )
endfunction

On Unit Comes In Range

UNITINRANGE_targetType: TARGET_TYPE_CREEPS UNITINRANGE_range: 800
function onUnitInRange takes Tower tower returns nothing
    local Unit U = Event.getTarget()
    local Tower T
    local Buff B 
    local Buff V
    local real amount = 0
    local Iterate I
    
    //setup
    set V = Valor.apply( tower, U, 300+12*tower.getLevel() )
    set V.userReal = 2000.0 + 80.0 * tower.getLevel()
    set V.userInt = 0
    
    //call it myself to ensure that the setup has already run.
    call ValorEffect( V )
    
    set B = U.getBuffOfType( Last_Line_Prob )
    
    //Second time walking past?
    if B != 0 then
        //Yes!
        call B.removeBuff()
        //Apply the last line buff. (Only visuals, effect is permanent, no cleanup required)
        set B = Last_Line_Buff.apply( tower, U, tower.getLevel() )
        
        set I = Iterate.overUnitsInRangeOfCaster( tower, TARGET_TOWERS, 400.0 )
        
        //Calculate the amount of additional damage they should take.
        loop
            set T = I.next()
            exitwhen T == 0
            if T != tower then
                set amount = amount + RMinBJ(I2R(T.getGoldcost())  / 2500.,1) * ( 0.01 + 0.0008 * tower.getLevel() )
            endif
        endloop
        
        //Modify the damage they take.
        call U.modifyProperty( MOD_SPELL_DAMAGE_RECEIVED, amount )
        call U.modifyProperty( MOD_ATK_DAMAGE_RECEIVED, amount )
    else
        //No, check if it already has the last line buff
        set B = U.getBuffOfType( Last_Line_Buff )
        if B == 0 then
            //No? Okay, let's add the dummy.
            call Last_Line_Prob.apply( tower, U, 0 )
        endif
    endif
endfunction

Tower Aura

AURA_powerAdd: 1 AURA_auraEffect: We_Will AURA_levelAdd: 1 AURA_power: 0 AURA_targetType: TARGET_TYPE_TOWERS AURA_targetSelf: false AURA_level: 0 AURA_auraRange: 400
Green Thunder Storm v1
3000
ID:
265
Family ID:
Author:
drol
Rarity:
rare
Element:
storm
Attack Type:
Energy
Attack Range:
1200
Attack CD:
2
Damage:
1375-2274
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 250% 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 12.5%.

Hint: Mana regeneration increases mana gained.

Level Bonus:
+0.25% spell crit chance
Lightning Burst
Grants a 12.5% chance to deal 45 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()+75)
endfunction

Header

    globals
    //@import
    BuffType drol_surge
    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 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.125+(tower.getLevel()*0.0025))
  set tower.userReal = tower.userReal + 0.125 + (tower.getLevel()*0.0025)
  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) * 45,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
Glacial Sea Turtle v1
3000
ID:
284
Family ID:
Author:
i_mOck_death
Rarity:
rare
Element:
ice
Attack Type:
Energy
Attack Range:
900
Attack CD:
0.8
Damage:
1-1
Mana:
4800
Mana regen:
0
Status:
Approved

Description:

Become one with water. Become a turtle.
Specials:
+192 mana/lvl
Splash
Every attack the turtle restores 192 mana. Mana regeneration will increase mana restored. Mana degeneration will not decrease mana restored below 192.

Level Bonus:
+7.68 mana restored
Aqua Breath
This tower deals Energy damage equal to its mana.
Cold Blooded
Every second this tower loses 1.75% of its max mana.
Download

Toggle Triggers

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)
  
    if tower.getProp_ManaRegPercBonus() > 0 then
        call SetUnitState(towerUnit , UNIT_STATE_MANA, mana + (192+tower.getLevel()*7.68) * (1. + tower.getProp_ManaRegPercBonus()))
    else
        call SetUnitState(towerUnit , UNIT_STATE_MANA, mana + (192))
    endif
    set towerUnit = null
        
endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
            
local Unit creep = Event.getTarget()
    call tower.doAttackDamage(creep, GetUnitState(tower.getUnit(), UNIT_STATE_MANA),tower.calcAttackMulticrit(0.0,0.0,0))
        
endfunction

Periodic

PERIODIC_period: 1
function periodic takes Tower tower returns nothing
            
call tower.subtractMana(GetUnitState(tower.getUnit(), UNIT_STATE_MAX_MANA)*.0175, false)
        
endfunction
Ice Accumulator v1
3000
ID:
322
Family ID:
Author:
tolleder
Rarity:
rare
Element:
ice
Attack Type:
Elemental
Attack Range:
800
Attack CD:
3
Damage:
4933-4933
Mana:
350
Mana regen:
2
Status:
Approved

Description:

A rare tower which can store ice 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 damage and applies Frost.

Level Bonus:
+72 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 20% for 9 seconds.

Level Bonus:
+0.6% 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()*72+1800,tower.calcSpellCritNoBonus())
        call slowAndDamage.applyCustomPower(tower,creep,3*tower.getLevel()+52,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.20,-0.006)
        
        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.applyCustomPower(tower,Event.getTarget(),3*tower.getLevel()+52,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)+21.0,GetUnitY(towerUnit)-1.0,122.0,result,true,false,false)
                else
                    set p= Projectile.createFromPointToUnit(pT,tower,1.0,1.0,GetUnitX(towerUnit)-3.0,GetUnitY(towerUnit)-54.0,141.0,result,true,false,false)
                endif
            else
                set p= Projectile.createFromPointToUnit(pT,tower,1.0,1.0,GetUnitX(towerUnit)-21.0,GetUnitY(towerUnit)-3.0,166.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