Silver Knight v1 
                1200
                     
             
                 | 
    
    
              ID:              39 
             Family ID:       
             Author:          SirCoqaLot. 
             Rarity:          rare 
             Element:         iron 
            
                 Attack Type:     Physical 
                 Attack Range:    875 
                 Attack CD:       1.35 
                 Damage:  939-1019 
            
            
             Status:          Approved 
     | 
    
    
    
             
                            Specials:
                        +30% bounty collected (+1.2%/lvl)  
                            Transmute
                        This tower has a 3.5% chance on attack to turn a non boss, non champion target into 6 additional gold immediately. Level Bonus: +0.04% chance  
                            Gold Greed
                        On attack this tower deals [16 x squareroot (current gold)] spell damage to its target.
                        
                     | 
    
    
    
            Download
            
            
            
            
             Toggle Triggers Header     globals
        //@export
        MultiboardValues Sir_gold_bonus
    endglobals
     
    private function init takes nothing returns nothing
         set Sir_gold_bonus = MultiboardValues.create(1)
        call Sir_gold_bonus.setKey(0,"Gold Greed")
    endfunction
                        
                    On Damage 
                            
                                ONDAMAGE_chance: 1.0
                            
                                ONDAMAGE_chanceLevelAdd: 0.0
                            
                             
                        
                        
                            function onDamage takes Tower tower returns nothing
        
    local Unit creep = Event.getTarget()
    set tower.userReal = 16.0*Pow(GetPlayerState(tower.getOwner().getThePlayer(), PLAYER_STATE_RESOURCE_GOLD),0.5)
    if not creep.isImmune() then
        if creep.getSize() < SIZE_CHAMPION and tower.calcChance(0.035+tower.getLevel()*0.0004) then
            call SFXAtUnit("Abilities\\Spells\\Other\\Transmute\\PileofGold.mdl",creep.getUnit())
            call tower.killInstantly(creep)
            call tower.getOwner().giveGold( 6,tower.getUnit(), true, true)
        else
            call tower.doSpellDamage(creep,tower.userReal,tower.calcSpellCritNoBonus())   
            call tower.getOwner().displayFloatingTextX(I2S(R2I(tower.getProp_SpellDmgDealt()*tower.userReal)),creep,255, 200, 0,255,0.05,0.0,2.0)
        endif
    endif
endfunction
                        
                    On Tower Details function onTowerDetails takes Tower tower returns MultiboardValues
    set tower.userReal = tower.getProp_SpellDmgDealt()*16.0*Pow(GetPlayerState(tower.getOwner().getThePlayer(), PLAYER_STATE_RESOURCE_GOLD),0.5) 
    call Sir_gold_bonus.setValue(0,I2S(R2I(tower.userReal)))
    return Sir_gold_bonus
endfunction
                        
                     | 
            
             
                Glacial Creeper v1 
                1200
                     
             
                 | 
    
    
              ID:              154 
             Family ID:       
             Author:          drol 
             Rarity:          common 
             Element:         ice 
            
                 Attack Type:     Energy 
                 Attack Range:    750 
                 Attack CD:       0.75 
                 Damage:  592-766 
            
            
             Status:          Approved 
     | 
    
    
    
             Description: Can still grow even in the coldest places.  
                            Frozen Thorn
                        Has a 15% chance to deal 1500 additional spell damage each time it deals damage. Level Bonus: +60 spell damage  | 
    
    
    
            Download
            
            
            
            
             Toggle Triggers On Damage 
                            
                                ONDAMAGE_chance: 1.0
                            
                                ONDAMAGE_chanceLevelAdd: 0.0
                            
                             
                        
                        
                            function onDamage takes Tower tower returns nothing
    if Event.isMainTarget() and tower.calcChance(0.15) and not Event.getTarget().isImmune() then
        call SFXAtUnit("Abilities\\Spells\\Undead\\FrostArmor\\FrostArmorDamage.mdl", Event.getTarget().getUnit())
        call tower.doSpellDamage(Event.getTarget(), 1500 + 60 * tower.getLevel(), tower.calcSpellCritNoBonus())
    endif
endfunction
                        
                     | 
            
             
                Skilled Witch v1 
                1200
                     
             
                 | 
    
    
              ID:              184 
             Family ID:       
             Author:          cedi 
             Rarity:          uncommon 
             Element:         darkness 
            
                 Attack Type:     Essence 
                 Attack Range:    1100 
                 Attack CD:       1.6 
                 Damage:  1076-1076 
            
            
                 Mana:     30 
                
                     Mana regen:     1.5 
                
            
             Status:          Approved 
     | 
    
    
    
             Description: Yes, she is scary.  
                            Specials:
                        +1 mana/lvl +0.1 mana regen/lvl  
                            Love Potion
                        The witch throws a bottle of love potion on the target, slowing it by 36% and increasing its item drop chance by 28.8%. The potion lasts 7 seconds. Level Bonus: +0.375% slow +0.3% Item drop chance AC_TYPE_OFFENSIVE_BUFF  
                            Soul Split
                        When the witch attacks, it has a 39% chance to deal 800 spell damage to its target, increasing the witch's attackspeed by 20% and decreasing the chance to trigger this spell by 8.5%. These effects last 13 seconds and stack. If the target is under the influence of a Love Potion, the attackspeed bonus, the damage and the duration of this spell are doubled. Level Bonus: +32 spell damage  | 
    
    
    
            Download
            
            
            
            
             Toggle Triggers Autocast 
                            
                                caster_art: 
                            
                                AUTOCAST_cooldown: 3.00
                            
                                AUTOCAST_numBuffsBeforeIdle: 1
                            
                                AUTOCAST_isExtended: false
                            
                                AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_BUFF
                            
                                AUTOCAST_manacost: 25
                            
                                AUTOCAST_range: 1100.00
                            
                                AUTOCAST_buffType: cedi_LovePotion
                            
                                AUTOCAST_targetSelf: false
                            
                                AUTOCAST_targetType: TARGET_TYPE_CREEPS
                            
                                target_art: 
                            
                                AUTOCAST_autoRange: 1100.00
                            
                             
                        
                        
                            private function onAutocast takes Tower tower returns nothing
    set Projectile.createFromUnitToUnit( cedi_LoveMissile, tower, 1.00, tower.calcSpellCritNoBonus(), tower, Event.getTarget(), true, false, false ).userInt = 288 + tower.getLevel() * 3
endfunction
                        
                    Header     globals
        //@import
        BuffType cedi_LovePotion
        //@import
        BuffType cedi_SoulBuff
        //@import
        ProjectileType cedi_LoveMissile
    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 real multipler = 1.00
    local integer UID = tower.getUID()
    if ( tower.calcChance( tower.userReal / 100.00 ) ) then
        if Event.getTarget().getBuffOfType( cedi_LovePotion ) != 0 then
            set multipler = 2.00
            call tower.getOwner().displayFloatingTextX( "Double", tower, 255, 0, 0, 255, 64.00, 1.00, 2.00 )
        endif
        call SFXAtUnit("Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl", tower.getUnit())
        call tower.doSpellDamage( Event.getTarget(), (800 + 32 * tower.getLevel() ) * multipler, tower.calcSpellCritNoBonus() )
        call cedi_SoulBuff.applyCustomTimed( tower, tower, 1, 13 * multipler )
        set tower.userReal = tower.userReal - 8.50 //* multipler
        call tower.modifyProperty( MOD_ATTACKSPEED, 0.20 * multipler ) 
        
        call TriggerSleepAction( 13.00 * multipler )
        if tower.getUID() == UID then
            call tower.modifyProperty( MOD_ATTACKSPEED, -0.20 * multipler ) 
            set tower.userReal = tower.userReal + 8.50 //* multipler
        endif
    endif
endfunction
                        
                    On Tower Creation function onCreate takes Tower tower returns nothing
    set tower.userReal = 39.00
endfunction
                        
                     | 
            
             
                Fortified Burrow v1 
                1200
                     
             
                 | 
    
    
              ID:              187 
             Family ID:       
             Author:          tolleder 
             Rarity:          uncommon 
             Element:         iron 
            
                 Attack Type:     Physical 
                 Attack Range:    700 
                 Attack CD:       3 
                 Damage:  4274-4274 
            
            
             Status:          Approved 
     | 
    
    
    
             Description: A burrow with Troll Head Hunters inside, which will try to break through every armor.  
                            Piercing Shot
                        30% of this tower's attack damage cannot be reduced by armor resistances. Level Bonus: +1.2% damage ratio  | 
    
    
    
            Download
            
            
            
            
             Toggle Triggers On Damage 
                            
                                ONDAMAGE_chance: 1.0
                            
                                ONDAMAGE_chanceLevelAdd: 0.0
                            
                             
                        
                        
                            function onDamage takes Tower tower returns nothing
    local real curRatio=0.3+0.012*tower.getLevel()
    local real sDmg=Event.damage
    local real damageBase=Event.damage
    local Creep target=Event.getTarget()
    local real temp = AttackType.PHYSICAL.getDamageAgainst(target.getArmorType())
    
    if temp > 0. and temp < 1. then //igoniring armor type "resistance" not weakness :P
        set damageBase = damageBase / temp 
    endif
    
    set temp = (1 - target.getCurrentArmorDamageReduction())
    if temp > 0. then
        set damageBase = damageBase / temp 
    endif 
    
    if sDmg < damageBase then
        set Event.damage=damageBase*curRatio+sDmg*(1.-curRatio)
    endif
    //The engine calculates critical strike extra damage ***AFTER*** the onDamage event, so there is no need to care about it in this trigger.
endfunction
                        
                     | 
            
             
                Red Ball Lightning v1 
                1200
                     
             
                 | 
    
    
              ID:              288 
             Family ID:       
             Author:          SirCoqaLot. 
             Rarity:          rare 
             Element:         storm 
            
                 Attack Type:     Energy 
                 Attack Range:    1200 
                 Attack CD:       1.65 
                 Damage:  228-677 
            
            
             Status:          Approved 
     | 
    
    
    
             Description: Quite an advanced construction for its times. It harbors a pulsating red crystal at its center, which has been rumored to drive lesser beings insane.  
                            Specials:
                        Bounce attack:
   2 targets
   -60% damage per bounce
                     
                            Lightning Shock
                        This tower has a 30% chance to deal 1200 spell damage to its target, whenever it deals damage. This ability has a 10% bonus chance to crit with 60% bonus damage. Level Bonus: +0.5% chance +48 damage  
                            Lightning Charge - Aura
                        Towers in 250 range have their spell damage increased by 20%. Level Bonus: +0.4% spell damage  | 
    
    
    
            Download
            
            
            
            
             Toggle Triggers Header     globals
        //@export
        BuffType sir_spell_aura
    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()
    set sir_spell_aura = BuffType.createAuraEffectType(true)
    call m.addModification(MOD_SPELL_DAMAGE_DEALT,0.0,0.0001)
    call sir_spell_aura.setBuffModifier(m)
    call sir_spell_aura.setBuffIcon('@@0@@')
    
    endfunction
                        
                    On Damage 
                            
                                ONDAMAGE_chance: 0.3
                            
                                ONDAMAGE_chanceLevelAdd: 0.005
                            
                             
                        
                        
                            function onDamage takes Tower tower returns nothing
    local Unit creep = Event.getTarget()
    call Lightning.createFromUnitToUnit("AFOD", tower, creep).setLifetime(0.2)
    call tower.doSpellDamage(creep,1200*(1+tower.getLevel()*0.04),tower.calcSpellCrit(0.1,0.6))
endfunction
                        
                    Tower Aura 
                            
                                AURA_auraEffect: sir_spell_aura
                            
                                AURA_power: 2000
                            
                                AURA_level: 2000
                            
                                AURA_auraRange: 250
                            
                                AURA_targetType: TARGET_TYPE_TOWERS
                            
                                AURA_levelAdd: 40
                            
                                AURA_powerAdd: 40
                            
                                AURA_targetSelf: true
                            
                             
                        
                        
                     | 
            
             
                Essence of Hate v1 
                1200
                     
             
                 | 
    
    
              ID:              292 
             Family ID:       
             Author:          Killamasta 
             Rarity:          uncommon 
             Element:         darkness 
            
                 Attack Type:     Decay 
                 Attack Range:    800 
                 Attack CD:       2 
                 Damage:  101-101 
            
            
             Status:          Approved 
     | 
    
    
    
             Description: A piece of a black heart. Poisons many enemies.  
                            Specials:
                        Bounce attack:
   6 targets
   -0% damage per bounce
                     
                            Poisononed Heart
                        This tower destroys a piece of the creep's heart on damage. The affected creep takes 300 Spelldamage every second for 6 seconds. Level Bonus: +12 poison damage +0.4 seconds poison duration  | 
    
    
    
            Download
            
            
            
            
             Toggle Triggers Header     globals  
       //@import
       BuffType Poisoned_heart // this is used to declare the 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 Damage 
                            
                                ONDAMAGE_chance: 1.0
                            
                                ONDAMAGE_chanceLevelAdd: 0.0
                            
                             
                        
                        
                            function onDamage takes Tower tower returns nothing
  
 local Unit creep = Event.getTarget()
 
set Poisoned_heart.applyCustomTimed(tower,creep,tower.getLevel(),6+tower.getLevel()*.4).userReal = 300. + 12 * tower.getLevel()
 
endfunction
                        
                     | 
            
             
                Ice Storage v1 
                1200
                     
             
                 | 
    
    
              ID:              321 
             Family ID:       
             Author:          tolleder 
             Rarity:          rare 
             Element:         ice 
            
                 Attack Type:     Elemental 
                 Attack Range:    800 
                 Attack CD:       3 
                 Damage:  1973-1973 
            
            
                 Mana:     300 
                
                     Mana regen:     2 
                
            
             Status:          Approved 
     | 
    
    
    
             Description: A rare tower which can store ice 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 damage and applies Frost. Level Bonus: +30 damage AC_TYPE_OFFENSIVE_IMMEDIATE  
                            Frost
                        A creep hit by one of this tower's shots is slowed by 15% for 9 seconds. Level Bonus: +0.45% 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()*30+750,tower.calcSpellCritNoBonus())
        call slowAndDamage.applyCustomPower(tower,creep,2*tower.getLevel()+26,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.15,-0.0045)
        
        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(),2*tower.getLevel()+26,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)+37.0,GetUnitY(towerUnit)-22.0,90.0,result,true,false,false)
            else
                set p= Projectile.createFromPointToUnit(pT,tower,1.0,1.0,GetUnitX(towerUnit)-11.0,GetUnitY(towerUnit)+3.0,160.0,result,true,false,false)
            endif
            //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
                        
                     | 
Description: