Magic Mushroom v1
3200
ID:
377
Family ID:
Author:
drol
Rarity:
unique
Element:
nature
Attack Type:
Magic
Attack Range:
900
Attack CD:
0.9
Damage:
1513-1612
Mana:
60
Mana regen:
4
Status:
Approved

Description:

A humongous mushroom emanating mystical powers.
Specials:
+0.16 mana regen/lvl
Mystical Trance
Buffs a tower in 500 range, increasing its spell damage and trigger chances by 25%. Lasts 5 seconds.

Level Bonus:
+0.2 sec duration
+1% spell damage
+1% trigger chances

AC_TYPE_OFFENSIVE_BUFF
 50, 500 range, 2s cooldown
Fungus Strike
After casting Mystical Trance the Mushroom's next attack will deal 100% of its damage as spell damage with an additional 20% chance to crit. Additionally makes the target creep receive 10% more damage from spells. This effect is permanent and stacks.

Level Bonus:
+1% spell damage
+0.8% spell crit chance
Rapid Growth
Every 20 seconds the Mushroom has a 40% chance to grow, permanently gaining 3% bonus spell damage. Maximum of 40 succesful growths.

Level Bonus:
-0.4 seconds
+0.12% bonus spell damage
Download

Toggle Triggers

Autocast

caster_art: Abilities\Spells\Items\AIre\AIreTarget.mdl AUTOCAST_cooldown: 2 AUTOCAST_numBuffsBeforeIdle: 1 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_BUFF AUTOCAST_manacost: 50 AUTOCAST_range: 500 AUTOCAST_buffType: drol_mushroomBuff AUTOCAST_targetSelf: true AUTOCAST_targetType: TARGET_TYPE_TOWERS target_art: AUTOCAST_autoRange: 500
private function onAutocast takes Tower tower returns nothing
    set tower.userInt2 = 1
    
    call drol_mushroomBuff.applyCustomTimed(tower,Event.getTarget(),tower.getLevel(),5. + tower.getLevel()*0.2)
endfunction

Header

    globals
        //@export
        BuffType drol_mushroomGrowth
        //@export
        BuffType drol_mushroomBuff
        //@export
        BuffType drol_mushroomDebuff
        //@export
        MultiboardValues drol_mushroomMultiboardValue
    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
    
    local Modifier m = Modifier.create()
    local Modifier mm = Modifier.create()
    
    set drol_mushroomGrowth = BuffType.createAuraEffectType( true )
    set drol_mushroomBuff = BuffType.create( 5, 0.2, true)
    set drol_mushroomDebuff = BuffType.create( 3600, 0, false )
    
    call mm.addModification(MOD_SPELL_DAMAGE_DEALT,0.25,0.01)
    call mm.addModification(MOD_TRIGGER_CHANCES,0.25,0.01)
    
    call drol_mushroomGrowth.setBuffIcon( '@@0@@' )
    call drol_mushroomBuff.setBuffIcon( '@@1@@' )
    call drol_mushroomDebuff.setBuffIcon( '@@2@@' )
    
    call drol_mushroomGrowth.setBuffModifier(m)
    call drol_mushroomBuff.setBuffModifier(mm)
    
    call drol_mushroomBuff.setStackingGroup("drol_mushroomBuff")
    
    set drol_mushroomMultiboardValue = MultiboardValues.create(2)  
    call drol_mushroomMultiboardValue.setKey(0,"Growths")
    call drol_mushroomMultiboardValue.setKey(1,"Spell Damage") 
    
    endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    if tower.userInt2 != 0 and Event.isMainTarget() then
        set tower.userInt2 = 0
        call drol_mushroomDebuff.apply(tower, Event.getTarget(), tower.getLevel())
        call Event.getTarget().modifyProperty(MOD_SPELL_DAMAGE_RECEIVED, 0.1)
        call tower.doSpellDamage(Event.getTarget(),Event.damage*(1.+tower.getLevel()*0.01),tower.calcSpellCrit(0.2+tower.getLevel()*0.008,0))
        set Event.damage = 0
    endif
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    set tower.userInt = 0 // number of succesful growths
    set tower.userInt2 = 0 // used for spelldamage attack on autocast
    set tower.userReal = 0.
    
endfunction

On Tower Details

function onTowerDetails takes Tower tower returns MultiboardValues
    call drol_mushroomMultiboardValue.setValue(0,I2S(tower.userInt)) 
    call drol_mushroomMultiboardValue.setValue(1,I2S(R2I(tower.userReal * 100.)) + "%")
    return drol_mushroomMultiboardValue
endfunction

Periodic

PERIODIC_period: 20
function periodic takes Tower tower returns nothing
    local integer lvl = tower.getLevel()
    local real growth
    local Effect targetEffect
    
    if (tower.calcChance(0.4) and tower.userInt < 40) then
    
        call tower.modifyProperty(MOD_SPELL_DAMAGE_DEALT, 0.03+(lvl*0.0012))
        set tower.userReal = tower.userReal + 0.03 + lvl * 0.0012
    
        set targetEffect = Effect.createScaled("Abilities\\Spells\\NightElf\\TargetArtLumber\\TargetArtLumber.mdl", GetUnitX(tower.getUnit()), GetUnitY(tower.getUnit()), 30, 0, 1.4)
        call targetEffect.setLifetime(1.0)
    
        set tower.userInt = tower.userInt + 1
        set growth = 1.25 + tower.userInt * 0.015
        call SetUnitScale(tower.getUnit(), growth, growth, growth)
    
    endif

    call Event.getCurrentPeriodicEvent().enableAdvanced(20 - lvl*0.4, false)
    
endfunction
Planar Gate v1
3200
ID:
651
Family ID:
Author:
Majildian
Rarity:
unique
Element:
astral
Attack Type:
Energy
Attack Range:
700
Attack CD:
2.5
Damage:
3573-3573
Mana:
1200
Mana regen:
12
Status:
Approved

Description:

A gate to the astral plane, glowing figures can be seen flying around on the other side.
Astral Eruption
Releases a huge wave of astral power through the gate, weakening the boundary between the planes.
This empowers all currently alive falcons and any that are created during the next 6 seconds, allowing them to deal double damage and partially shift their targets into the astral plane, increasing the damage they take from astral towers by 1% of the falcon's current damage ratio.

Level Bonus:
+0.18 seconds

AC_TYPE_OFFENSIVE_IMMEDIATE
 1000, 0 range, 35s cooldown
Planeshift
On attack the Gate releases a magical falcon to hunt down its enemies.
The falcon deals energy damage equal to the Gate's current attack damage and bounces until it runs out of damage. Each bounce deals 5% less damage.
There is a maximum of 1 falcon summoned at a time and a 20% chance to ignore the maximum.

Level Bonus:
-0.1% damage loss per bounce
+1 falcon every 8 levels
Download

Toggle Triggers

Autocast

caster_art: AUTOCAST_cooldown: 35 AUTOCAST_numBuffsBeforeIdle: 0 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_IMMEDIATE AUTOCAST_manacost: 1000 AUTOCAST_range: 0 AUTOCAST_buffType: Maj_astralEruption AUTOCAST_targetSelf: true AUTOCAST_targetType: 0 target_art: AUTOCAST_autoRange: 700
private function onAutocast takes Tower tower returns nothing
    local real x = tower.getX()
    local real y = tower.getY()
    call Maj_astralEruption.apply(tower, tower, tower.getLevel())
    call Effect.createColored("Abilities\\Spells\\Orc\\Voodoo\\VoodooAura.mdl", x, y, 0, 0, 1, 1, 255, 255, 255).setLifetime(0.5)
    call TriggerSleepAction(0.3)
    call Effect.createColored("Abilities\\Spells\\Orc\\Voodoo\\VoodooAura.mdl", x, y, 0, 0, 2, 1, 255, 255, 255).setLifetime(0.5)
    call TriggerSleepAction(0.3)
    call Effect.createColored("Abilities\\Spells\\Orc\\Voodoo\\VoodooAura.mdl", x, y, 0, 0, 3, 1, 255, 255, 255).setLifetime(0.5)
endfunction

Header

    globals
        ProjectileType Maj_bouncingProj
        BuffType Maj_astralEruption
        BuffType Maj_astralDmgModBuff
    endglobals
    
    
    // p.userInt = number of crits
    // p.userInt2 = UID
    // p.userInt3 = check for buff
    // p.userReal = damage loss per bounce
    // p.userReal2 = damage ratio of this projectile
    // p.userReal3 = damage to deal
    function bounce takes Projectile p, Unit target returns nothing
        local Tower tower = p.getCaster()
        local Iterate it
        local Unit next
        local Projectile P
        local Playor pl
        local integer intVar
        local string critStr
        local real dmgMod
        local Buff b
        
        //Check if this projectile has damage ratio left and if the target is still alive.
        if p.userReal2 > 0 and target.getUID() == p.userInt2 then
            //Set the locals.
            set it = Iterate.overUnitsInRangeOfUnit(tower, TARGET_CREEPS, target, 500)
            set intVar = 0
            set critStr = ""
            set b = target.getBuffOfType(Maj_astralDmgModBuff)
            
            //Check if the tower cast the buff since the last time this projectile hit.
            if tower.getBuffOfType(Maj_astralEruption) > 0 and p.userInt3 == 0 then
                set p.userInt3 = 1
            endif
            
            //Check if the tower crit this attack, and if so, display the damage colored red above the tower
            //with exclamation marks after it equal to the number of crits. This only runs the first time the
            //projectile hits because p.userInt is set to 0 at the end.
            if p.userInt > 0 then
                set pl = tower.getOwner()
                set intVar = 0
                loop
                    set critStr = critStr + "!"
                    set intVar = intVar + 1
                    exitwhen intVar == p.userInt
                endloop
                call pl.displayFloatingText(I2S(R2I(p.userReal3)) + critStr, tower, 255, 0, 0)
            endif
            
            //Check if the buff was applied on the tower when it launched this projectile, and if
            //the target isn't immune then increase the damage it takes from astral, and apply the
            //buff or if the buff was already applied, increase the amount of damage taken to remove
            //when the buff gets purged or similar.
            if p.userInt3 == 1 then
                if target.isImmune() == false then
                    set dmgMod = p.userReal2*0.01
                    call target.modifyProperty(MOD_DMG_FROM_ASTRAL, dmgMod)
                
                    if b > 0 then
                        set b.userReal = b.userReal+dmgMod
                    else
                        set b = Maj_astralDmgModBuff.apply(tower,target,0)
                        set b.userReal = dmgMod
                    endif
                endif
            endif
            
            // Deal the damage (double if the projectile got buffed).
            call tower.doAttackDamage(target,p.userReal3 * p.userReal2 * (1+p.userInt3),1)
            
            //Choose a target from all creeps in 500 range that isn't this projectile's target.
            set next = it.nextRandom()
            if next == target and next != 0 then
                set next = it.nextRandom()
            endif
            //If no valid targets in range, end here and decrease tower's userInt so portal can fire again.
            if next == 0 then
                set tower.userInt = tower.userInt - 1
                return
            endif
            call it.destroy()
            
            //Fire the projectile to the next unit and set all the necessary values.
            set P = Projectile.createLinearInterpolationFromUnitToUnit(Maj_bouncingProj, tower, 1, 1, target, next, .35, true)
            
            set P.userInt = 0
            set P.userInt2 = next.getUID()
            set P.userInt3 = p.userInt3
            set P.userReal = p.userReal
            set P.userReal2 = p.userReal2-p.userReal    //decrease new projectile's damage multiplier
            set P.userReal3 = p.userReal3
        
        //Or if the projectile had no damage ratio, end here and decrease the tower userInt.
        else
            set tower.userInt = tower.userInt - 1
        endif
    endfunction
    
    //In case the buff gets purged.
    function removeMod takes Buff b returns nothing
        call b.getBuffedUnit().modifyProperty(MOD_DMG_FROM_ASTRAL, -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 Maj_astralEruption = BuffType.create(6, 0.18, true)
        set Maj_astralDmgModBuff = BuffType.create(-1, 0, false)
        set Maj_bouncingProj = ProjectileType.createInterpolate("Abilities\\Weapons\\MurgulMagicMissile\\MurgulMagicMissile.mdl", 1250)
        call Maj_bouncingProj.setEventOnInterpolationFinished(ProjectileTargetEvent.bounce)
        call Maj_astralEruption.setBuffIcon('@@0@@')
        call Maj_astralDmgModBuff.setBuffIcon('@@1@@')
        call Maj_astralDmgModBuff.addEventOnCleanup(removeMod)
    endfunction

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
    local Unit target
    local integer crits
    local real curDmg
    local Projectile p
    local Buff b

    //Check if the amount of birds summoned is low enough to create another one.
    if tower.userInt < R2I(1+(tower.getLevel()/8)) or tower.calcChance(0.20) then
        //Set the locals.
        set target = Event.getTarget()
        set crits = tower.getNumberOfCrits()
        set curDmg = tower.getCurrentAttackDamageWithBonus()
        set b = tower.getBuffOfType(Maj_astralEruption)
        
        //Set the projectile values.
        set p = Projectile.createLinearInterpolationFromUnitToUnit(Maj_bouncingProj, tower, 1, 1, tower, target, .5, true)
        set p.userInt2 = target.getUID()
        set p.userReal = 0.05-(tower.getLevel()*0.001)  //damage multiplier loss per bounce
        set p.userReal2 = 1 //Projectile's current damage multiplier
        if b > 0 then
            set p.userInt3 = 1
        else
            set p.userInt3 = 0
        endif
        //Check for crits.
        if (crits > 0) then
            set p.userReal3 = curDmg * (crits * (tower.getProp_AtkCritDamage() - 1) + 1)
            set p.userInt = crits
        else
            set p.userReal3 = curDmg
            set p.userInt = 0
        endif    
        
        //Increase counter for birds summoned.
        set tower.userInt = tower.userInt+1
    endif
    //Remove crits so a 0! doesn't pop up over the tower.
    call tower.resetAttackCrits()
endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    //Set damage to 0 so the tower doesn't deal 2x damage on first hit.
    set Event.damage = 0
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    set tower.userInt = 0
endfunction
Quillboar Deathpig v1
3300
ID:
65
Family ID:
Author:
SirCoqaLot.
Rarity:
rare
Element:
nature
Attack Type:
Physical
Attack Range:
800
Attack CD:
0.9
Damage:
1590-1609
Mana:
100
Mana regen:
1
Status:
Unapproved

Description:

Advanced Nature tower that is able to release a spray of thorns from it's back.
Quillspray
This tower deals 30% of its attack damage as physical damage to every unit in 800 range around it. A creep hit by a Quillspray receives 11% more damage than it did from the previous Quillspray, if hit again within 1.5 seconds. This effect stacks up to 40 times.

Hint: Save mana to amplify the effect of this ability.

Level Bonus:
+0.2% base damage
9% chance to doublecast Quillsprays at level 15
7% chance to triplecast Quillsprays at level 25

AC_TYPE_OFFENSIVE_IMMEDIATE
 5, 800 range, 0.2s cooldown
Occasional Quillspray
On attack this tower has a 18% chance to trigger a Quillspray. 

Hint: This Quillspray costs no mana. 

Level Bonus:
+0.21% chance
Download

Toggle Triggers

Autocast

AUTOCAST_cooldown: 0.2 AUTOCAST_autoRange: 700 AUTOCAST_manacost: 5 AUTOCAST_range: 800 AUTOCAST_targetType: 0 AUTOCAST_numBuffsBeforeIdle: 0 caster_art: target_art: AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_IMMEDIATE AUTOCAST_buffType: 0 AUTOCAST_isExtended: true AUTOCAST_targetSelf: true
private function onAutocast takes Tower tower returns nothing
    local integer level = tower.getLevel()
    call quillspray(tower,1350)
    if level == 25 then 
        if tower.calcChance(0.07) then
            call quillspray(tower,1500)
            call quillspray(tower,1700)
         elseif tower.calcChance(0.09) then
            call quillspray(tower,1500)
        endif
    elseif level > 15 then
        if tower.calcChance(0.09) then
            call quillspray(tower,1500)
        endif
    endif
endfunction

Header

    globals
    //@import
    ProjectileType sir_boar_proj
    //@import
    BuffType sir_boar_debuff
    endglobals
    
    //@import
    function quillspray takes Tower tower, real speed returns nothing

    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
    endfunction

On Attack

ONATTACK_chance: 0.18 ONATTACK_chanceLevelAdd: 0.0021
function onAttack takes Tower tower returns nothing
    local integer level = tower.getLevel()
    call quillspray(tower,1350)
    if level == 25 then 
        if tower.calcChance(0.07) then
            call quillspray(tower,1500)
            call quillspray(tower,1700)
        elseif tower.calcChance(0.09) then
            call quillspray(tower,1500)
        endif
    elseif level > 15 then
        if tower.calcChance(0.09) then
            call quillspray(tower,1500)
        endif
    endif
endfunction
Shadow v1
3330
ID:
266
Family ID:
Author:
i_mOck_death
Rarity:
unique
Element:
darkness
Attack Type:
Decay
Attack Range:
830
Attack CD:
1.6
Damage:
1023-8022
Status:
Approved

Description:

The closer you are to the light, the bigger your shadow is.
Dark Orbs
Each attack has a 20% chance to spawn 3 orbs that travel outwards in all directions from Shadow. Orbs travel for 8 seconds, firing off dark rays at enemies within 450 range, which deal 15% of this tower's attack damage as spell damage per second.

Level Bonus:
+1 orb every 5 levels
+0.6% damage per second
Soul Conversion
On kill a lesser orb is spawned where the creep died. Lesser orbs last for 3 seconds, firing off lesser dark rays at enemies within 450 range, which deal 9% of this tower's attack damage as spell damage per second.

Level Bonus:
+0.36% damage per second
Dark Shroud - Aura
Towers within 300 range have 10% of their damage output stolen by Shadow. This tower then deals that damage back at its original targets in the form of Decay damage. This damage cannot crit.

Level Bonus:
+0.5% damage dealt
Download

Toggle Triggers

Header

   globals
        BuffType mOck_darkShroud
        ProjectileType mOck_darkOrb
        ProjectileType mOck_lesserDarkOrb
    endglobals
    
    function darkS takes Buff b returns nothing
        local Tower  tower = b.getCaster()  
        local Unit target = Event.getTarget()
        local real dmg = Event.damage*(.1+.005*tower.getLevel())
        
        set Event.damage = Event.damage*.9
        call tower.doCustomAttackDamage(target, dmg, 1, AttackType.DECAY)
    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 mOck_darkShroud = BuffType.createAuraEffectType(true)
        call mOck_darkShroud.setBuffIcon('@@1@@') 
        call mOck_darkShroud.addEventOnDamage(darkS,1.0, 0.0)
        
        set mOck_darkOrb = ProjectileType.create("Abilities\\Spells\\Items\\OrbDarkness\\OrbDarkness.mdl",8,200)
        set mOck_lesserDarkOrb = ProjectileType.create("Abilities\\Spells\\Items\\OrbDarkness\\OrbDarkness.mdl",3,0)
    endfunction

On Attack

ONATTACK_chance: .2 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
        local integer level = tower.getLevel()
        local integer numProjectiles = 3 + level/5
        local integer i = numProjectiles
        local Projectile p
        local real face = GetUnitFacing(tower.getUnit())
        local real x = tower.getX()
        local real y = tower.getY()
 
        loop
            set i = i - 1
            set p = Projectile.create(mOck_darkOrb,tower,tower.getCurrentAttackDamageWithBonus()*(.05+level*0.002),tower.calcSpellCritNoBonus(),x,y,80.0,face+i*360.0/numProjectiles)
            call p.setScale(1.75)
            call p.addAbility('@@0@@')
            exitwhen i < 1
        endloop
endfunction

On Kill

function onKill takes Tower tower returns nothing
    local integer level = tower.getLevel()
    local Projectile p
    local Creep creep = Event.getTarget()
    local real x = creep.getX()
    local real y = creep.getY()
    
    set p = Projectile.create(mOck_lesserDarkOrb,tower,tower.getCurrentAttackDamageWithBonus()*(.03+level*0.0012),tower.calcSpellCritNoBonus(),x,y,80.0,0)
    call p.setScale(1.25)
    call p.addAbility('@@0@@')
endfunction

Tower Aura

AURA_auraEffect: mOck_darkShroud AURA_power: 0 AURA_level: 0 AURA_auraRange: 300 AURA_targetType: TARGET_TYPE_TOWERS AURA_levelAdd: 1 AURA_powerAdd: 1 AURA_targetSelf: true
Hound of War v1
3360
ID:
76
Family ID:
Author:
cedi
Rarity:
uncommon
Element:
fire
Attack Type:
Decay
Attack Range:
800
Attack CD:
1.2
Damage:
3249-3249
Status:
Approved

Description:

The hounds of war are howling again.
Specials:
+8% damage/lvl
Roar
Whenever this tower damages a unit it has 30% chance to release a battle cry. The cry increases the attack damage of all towers in 420 range by 5% for 5 seconds. If a tower has allready the roar buff the attack damage is increased by 0.9% and the duration is refreshed. Stacks up to 100 times.

Level Bonus:
+0.9% attack damage
Download

Toggle Triggers

Header

    globals
        //@import
        BuffType cedi_helldog
    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: 0.3 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    local Iterate I = Iterate.overUnitsInRangeOfCaster( tower, TARGET_TYPE_TOWERS, 420.0 )
    local Unit U 
    local Buff B
    call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\NightElf\\BattleRoar\\RoarCaster.mdl", tower.getUnit(), "origin" ) )
    loop
        set U = I.next()
        exitwhen U == 0
        set B = U.getBuffOfType( cedi_helldog )
        if B != 0 then
            if B.userInt < 100 then
                call cedi_helldog.apply( tower, U, B.getLevel() + 18 )
                set B.userInt = B.userInt + 1
            else
                call B.refreshDuration()
            endif
        else
            call cedi_helldog.apply( tower, U, tower.getLevel() * 18 )
            set B.userInt = 0
        endif
    endloop
    //0.0005  0.003, 0.0045, 0.006, 0.0075, 0.009
    //0.05    0.05 , 0.05  , 0.05 , 0.05  , 0.05
    //        70   , 210   , 840  , 1680  , 3360
endfunction
Hound of Storms v1
3360
ID:
247
Family ID:
Author:
cedi
Rarity:
uncommon
Element:
storm
Attack Type:
Energy
Attack Range:
900
Attack CD:
1.5
Damage:
3916-3924
Status:
Approved

Description:

Do you hear the howl of the storm?
Specials:
+2.4% attackspeed/lvl
Thunderous Roar
Whenever this tower damages a unit it has 30% chance to release a battle cry. The cry increases the attack speed of all towers in 420 range by 5% for 5 seconds. If a tower already has the thunderous roar buff the attack speed is increased by 0.9% and the duration is refreshed. Stacks up to 100 times.

Level Bonus:
+0.9% attack speed
Download

Toggle Triggers

Header

    globals
        //@import
        BuffType cedi_stormdog
    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: 0.3 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    local Iterate I = Iterate.overUnitsInRangeOfCaster( tower, TARGET_TYPE_TOWERS, 420.0 )
    local Unit U 
    local Buff B
    call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\NightElf\\Taunt\\TauntCaster.mdl", tower.getUnit(), "origin" ) )
    loop
        set U = I.next()
        exitwhen U == 0
        set B = U.getBuffOfType( cedi_stormdog )
        if B != 0 then
            if B.userInt < 100 then
                call cedi_stormdog.apply( tower, U, B.getLevel() + 18 )
                set B.userInt = B.userInt + 1
            else
                call B.refreshDuration()
            endif
        else
            set B = cedi_stormdog.apply( tower, U, tower.getLevel() * 18 )
            set B.userInt = 0
        endif
    endloop
endfunction
The Omnislasher v3
3400
ID:
159
Family ID:
Author:
KublaiKhan1
Rarity:
unique
Element:
fire
Attack Type:
Physical
Attack Range:
1200
Attack CD:
5
Damage:
7109-7109
Status:
Approved

Description:

Faster than the wind, faster than Sonic, even faster than light!
Specials:
+8% damage/lvl
Omnislash
On each attack the Omnislasher moves with insane speed towards the battlefield. There, he deals damage up to 10 times before returning to his triumphant pedestal. Each such damage instance deals 10% of this tower's normal attack damage and permanently increases the damage its target takes from Physical type attacks by 4%.

Level Bonus:
+2 slashes every 5 levels
Download

Toggle Triggers

Header

            globals
        BuffType DamageIncreaseBT
    endglobals
    
    function onDamaged takes Buff b returns nothing
        local Tower tower = Event.getTarget()
        if tower.getAttackType() == AttackType.PHYSICAL then
            if Event.isSpellDamage() == false then
                set Event.damage = Event.damage * b.userReal
            endif
        endif
    endfunction
    
    function damage takes Tower tower, Unit target returns nothing
        
        local real range = 80.00
        local real angle = GetRandomReal(0.00, 360.00)
        local real x = target.getX() + Cos(angle) * range
        local real y = target.getY() + Sin(angle) * range
        local real z = target.getZ()
        
        local Effect blademaster = Effect.createAnimated("units\\demon\\HeroChaosBladeMaster\\HeroChaosBladeMaster.mdl", x, y, z, angle + 180 * bj_DEGTORAD)
        local Effect mirrorimage = Effect.create("Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl", x, y, z, angle + 180 * bj_DEGTORAD)
        local Buff b = target.getBuffOfType(DamageIncreaseBT)
        
        call blademaster.setLifetime(.4)
        call blademaster.setAnimation("attack")
        call blademaster.setScale(0.4)
        call blademaster.noDeathAnimation()
        call mirrorimage.setLifetime(.4)
        call mirrorimage.setScale(0.4)
        
        call tower.doAttackDamage(target, tower.getCurrentAttackDamageWithBonus()/10, tower.calcAttackMulticrit(0.0, 0.0, 0) )
        if b == 0 then
            set b = DamageIncreaseBT.apply(tower, target, tower.getLevel())
            set b.userReal = 1.0
        else
            set b.userReal = b.userReal + 0.04
        endif
    endfunction
    
    function onHit takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local Tower tower = GetTimerData(t)
        local unit u = tower.getUnit()
        local Unit target = tower.userInt
        local integer uid = R2I(tower.userReal)
        local integer towerUID = R2I(tower.userReal2)
        local Iterate iterate = tower.userInt3
        local integer numAttacks = tower.userInt2

        // The tower has changed (sold or replaced)
        if (tower.getUID() != towerUID) then
            call ReleaseTimer(t)
            set t = null
            set u = null
            call iterate.destroy()
            return
        endif
        
        // The target died
        if (target.getUID() != uid) then
            set target = iterate.next()
            set tower.userInt = target
            set tower.userReal = target.getUID()
        endif
        
        if (target != 0 and numAttacks > 0) then
            call damage(tower, target)
            set tower.userInt2 = numAttacks - 1
        else
            if (target != 0) then
                call iterate.destroy()
            endif 
            call ReleaseTimer(t)
            call SetUnitVertexColor(u, 255, 255, 255, 255)
            call PauseUnit(u, false)
            call SFXOnUnit("Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl", u, "origin")
            set tower.userInt3 = -1
        endif
        set t = null
        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
        set DamageIncreaseBT = BuffType.create(-1, 0.0, false)
        call DamageIncreaseBT.setBuffIcon('@@0@@')
        call DamageIncreaseBT.addEventOnDamaged(onDamaged, 1.0, 0.0)
    endfunction
        

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
            
local unit u 
    local Iterate iterate = tower.userInt3
    local timer t 
    local Unit target = Event.getTarget()
    local integer numAttacks = 10 + tower.getLevel() * 2/5
    local real fun
    if iterate == -1 then
        set u = tower.getUnit()
        set iterate = Iterate.overUnitsInRangeOfUnit(tower, TARGET_CREEPS, Event.getTarget(), 1200.00)
        set t = NewTimer()
        call TimerStart(t, tower.getCurrentAttackspeed() / numAttacks, true, function onHit)
        call SetTimerData(t,tower)
        
        call SFXOnUnit("Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl", u, "origin")
        call SetUnitVertexColor(u, 255, 255, 255, 0)
        call PauseUnit(u, true)
        
        set tower.userInt = target // Save current target
        set tower.userInt2 = numAttacks
        set tower.userInt3 = iterate
        set tower.userReal = target.getUID()
        call damage(tower, target)
        
        set fun= GetRandomReal(0,1)
        if fun< 0.03 then
            call tower.getOwner().displayFloatingTextX("I'm faster than LIGHT!", tower, 50, 150, 255, 255, 0.05, 2, 3)
        elseif fun< 0.02 then
            call tower.getOwner().displayFloatingTextX("Don't listen to Einstein's lies!", tower, 50, 150, 255, 255, 0.05, 2, 3)
        elseif fun< 0.01 then
            call tower.getOwner().displayFloatingTextX("I'm debunking relativity. Just watch me!", tower, 50, 150, 255, 255, 0.05, 2, 3)
        endif
        set u = null
        set t = null
    endif
        
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
            
set tower.userReal2 = tower.getUID()
    set tower.userInt3 = -1
        
endfunction