The Steam Engine v1
4000
ID:
391
Family ID:
Author:
Glowackos/cedi
Rarity:
unique
Element:
iron
Mana:
1000
Mana regen:
10
Status:
Approved

Description:

One of the greatest inventions of the dwarves.
Specials:
+10 mana/lvl
+5% mana regen/lvl
Speed Up
Increases the power level of the engine by 1. Maximum power level is 50.

AC_TYPE_NOAC_IMMEDIATE
 0, 0 range, 0.5s cooldown
Speed Down
Decreases the power level of the engine by 1.

AC_TYPE_NOAC_IMMEDIATE
 0, 0 range, 5.00s cooldown
Power Surge
Towers under the effect of Steam Power have a 1% base attackspeed adjusted chance to cause a surge in the Steam Engine, granting it 1 exp.

Level Bonus:
+0.04 exp
Steam Power - Aura
Increases attackdamage of towers in 450 AOE by [6 x power level]% and attackspeed by half this amount. In order to sustain this, the engine consumes a lot of mana. Mana regeneration is reduced by [10 x power level x squareroot(towers powered)]%. If the mana of the engine reaches zero it will deactivate itself for 120 seconds. Does not stack with other Steam Engines!
Download

Toggle Triggers

Autocast

caster_art: AUTOCAST_cooldown: 0.5 AUTOCAST_numBuffsBeforeIdle: 0 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_NOAC_IMMEDIATE AUTOCAST_manacost: 0 AUTOCAST_range: 0 AUTOCAST_buffType: 0 AUTOCAST_targetSelf: true AUTOCAST_targetType: 0 target_art: AUTOCAST_autoRange: 0.00
private function onAutocast takes Tower tower returns nothing
    if tower.userInt < 50 then
        set tower.userInt = tower.userInt + 1
        call engine_UpdateManaUse(tower)
        call engine_UpdateAnims(tower)
    endif
    call tower.getOwner().displayFloatingText("Power Level: " + I2S(tower.userInt), tower, 50+4*tower.userInt, 150-3*tower.userInt, 100-2*tower.userInt)
endfunction

Autocast

caster_art: AUTOCAST_cooldown: 5.00 AUTOCAST_numBuffsBeforeIdle: 0 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_NOAC_IMMEDIATE AUTOCAST_manacost: 0 AUTOCAST_range: 0 AUTOCAST_buffType: 0 AUTOCAST_targetSelf: true AUTOCAST_targetType: 0 target_art: AUTOCAST_autoRange: 0.00
private function onAutocast takes Tower tower returns nothing
    if tower.userInt > 0 then
        set tower.userInt = tower.userInt - 1
        call engine_UpdateManaUse(tower)
        call engine_UpdateAnims(tower)
    endif
    call tower.getOwner().displayFloatingText("Power Level: " + I2S(tower.userInt), tower, 50+4*tower.userInt, 150-3*tower.userInt, 100-2*tower.userInt)
endfunction

Header

    globals
        BuffType cedi_steam_buff
        MultiboardValues cedi_steam_MB
    endglobals
    
    function engine_UpdateAnims takes Tower tower returns nothing
        local Effect e = tower.userInt3
        local unit u = tower.getUnit()
        call SetUnitTimeScale(u, I2R( tower.userInt) / 10.0)
        call e.setAnimationSpeed(0.5 + I2R( tower.userInt) / 20.0)
        call e.setScale(I2R(tower.userInt) / 20.0)
        set u = null
    endfunction
    
    function engine_UpdateManaUse takes Tower tower returns nothing
        local real manaDeg = tower.userInt * SquareRoot(tower.userInt2) * 10 / 100.0
        call tower.modifyProperty(MOD_MANA_REGEN_PERC, tower.userReal - manaDeg)
        set tower.userReal = manaDeg
    endfunction
    
    function steam_buff_onCreate takes Buff B returns nothing
        local Tower tower = B.getCaster()
        set B.userReal = 0.06 * tower.userInt
        set tower.userInt2 = tower.userInt2 + 1
        call engine_UpdateManaUse(tower)
        call B.getBuffedUnit().modifyProperty(MOD_DAMAGE_ADD_PERC, B.userReal)
        call B.getBuffedUnit().modifyProperty(MOD_ATTACKSPEED, B.userReal / 2.0)
    endfunction
    
    function steam_buff_onAttack takes Buff B returns nothing
        local Tower caster = B.getCaster()
        local Tower tower = B.getBuffedUnit()
        local integer lvl = caster.getLevel()
        if caster.calcChance(0.01 * tower.getBaseAttackspeed()) then
            call caster.addExp(1 + 0.04 * lvl)
            call Effect.createScaled("Objects\\Spawnmodels\\Human\\FragmentationShards\\FragBoomSpawn.mdl",tower.getX() + 11, tower.getY() + 56, 40.0, 0.0, 3).destroy()
        endif
    endfunction
    
    function steam_buff_periodic takes Buff B returns nothing
        local real r = 0.06 * Unit(B.getCaster()).userInt - B.userReal
        set B.userReal = B.userReal + r
        call B.getBuffedUnit().modifyProperty( MOD_DAMAGE_ADD_PERC, r)
        call B.getBuffedUnit().modifyProperty( MOD_ATTACKSPEED, r / 2.0)
    endfunction
    
    function steam_buff_onCleanup takes Buff B returns nothing
        local Tower tower = B.getCaster()
        set tower.userInt2 = tower.userInt2 - 1
        call engine_UpdateManaUse(tower)
        call B.getBuffedUnit().modifyProperty(MOD_DAMAGE_ADD_PERC, -B.userReal)
        call B.getBuffedUnit().modifyProperty(MOD_ATTACKSPEED, -B.userReal / 2.0)
    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 cedi_steam_buff = BuffType.createAuraEffectType(true)
        call cedi_steam_buff.setBuffIcon('@@0@@')
        call cedi_steam_buff.addEventOnCreate(steam_buff_onCreate)
        call cedi_steam_buff.addEventOnAttack(steam_buff_onAttack, 1.0, 0.0)
        call cedi_steam_buff.addPeriodicEvent(steam_buff_periodic, 1.0)
        call cedi_steam_buff.addEventOnCleanup(steam_buff_onCleanup)
        set cedi_steam_MB = MultiboardValues.create(2)
        call cedi_steam_MB.setKey(0,"Power Level") 
        call cedi_steam_MB.setKey(1,"Towers Powered")
    endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    local Effect e = Effect.createAnimatedScaled("Doodads\\Cinematic\\FireTrapUp\\FireTrapUp.mdl",tower.getX() - 4, tower.getY() + 41, 75.0, 0.0 ,0.55)
    //Power level
    set tower.userInt = 0
    //Num towers in AOE
    set tower.userInt2 = 0
    //Store effect
    set tower.userInt3 = e
    //Mana degen
    set tower.userReal = 0.0
    call engine_UpdateAnims(tower)
endfunction

On Tower Destruction

function onDestruct takes Tower tower returns nothing
    local Effect e = tower.userInt3
    call e.destroy()
endfunction

On Tower Details

function onTowerDetails takes Tower tower returns MultiboardValues
    call cedi_steam_MB.setValue(0,I2S(tower.userInt))
    call cedi_steam_MB.setValue(1,I2S(tower.userInt2))
    return cedi_steam_MB    
endfunction

Periodic

PERIODIC_period: 1.0
function periodic takes Tower tower returns nothing
    local unit u = tower.getUnit()
    if tower.userInt != 0 and GetUnitState(u, UNIT_STATE_MANA) <= 1.0 then
        set tower.userInt = 0
        call engine_UpdateManaUse(tower)
        call engine_UpdateAnims(tower)
        call tower.getOwner().displayFloatingText("Power Level: 0", tower, 50, 150, 100)
        call cb_stun.applyOnlyTimed( tower, tower, 120.0 )
    endif
    set u = null
endfunction

Tower Aura

AURA_auraEffect: cedi_steam_buff AURA_power: 1 AURA_level: 1 AURA_auraRange: 450.0 AURA_targetType: TARGET_TYPE_TOWERS AURA_levelAdd: 1 AURA_powerAdd: 1 AURA_targetSelf: false
The Conduit v1
4000
ID:
399
Family ID:
Author:
Ashbringer
Rarity:
unique
Element:
storm
Attack Type:
Magic
Attack Range:
1200
Attack CD:
2
Damage:
1-1
Mana:
1000
Mana regen:
0
Status:
Approved

Description:

Charges itself up to disintegrate enemies and overcharge nearby lesser towers.
Specials:
5% spell crit chance (+0.5%/lvl)
x1.5 spell crit damage (+x0.05/lvl)
Absorb Energy:
Attacks hit up to 10 enemies, but do no damage. There is a 10% chance per hit to gather energy, restoring 50 mana to the tower and the target will lose 50 mana if it has mana.

Level Bonus:
+1 mana
+0.2% chance
Unleash
Unleashes built up energy, dealing [400 x wave] spell damage to a single enemy and increasing the spell crit damage of nearby towers within 350 range by x0.75 for 5 seconds.

Level Bonus:
+8 spell damage per wave
+x0.03 spell crit damage

AC_TYPE_OFFENSIVE_BUFF
 400, 1200.00 range, 0.50s cooldown
Conduit - Aura
Attack speed, trigger chances, spell damage, spell crit chance and spell crit damage bonuses on this tower are applied to Common and Uncommon Storm towers in 350 range at a rate of 50%.

Level Bonus:
+2% stats
Download

Toggle Triggers

Autocast

AUTOCAST_cooldown: 0.50 AUTOCAST_autoRange: 1200.00 AUTOCAST_manacost: 400 AUTOCAST_range: 1200.00 AUTOCAST_targetType: TARGET_TYPE_CREEPS AUTOCAST_numBuffsBeforeIdle: 1 caster_art: target_art: AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_BUFF AUTOCAST_buffType: 0 AUTOCAST_isExtended: false AUTOCAST_targetSelf: false
private function onAutocast takes Tower tower returns nothing
    local Iterate it = Iterate.overUnitsInRangeOfUnit(tower,TARGET_TOWERS,tower,350)
    local Unit next
    local real cast_damage = (400 + (tower.getLevel() * 8)) * tower.getOwner().getTeam().getLevel()

    loop
        set next = it.next()
            call ashbringer_unleash_buff.apply(tower,next,tower.getLevel())
        exitwhen next == 0
    endloop
    
    call ashbringer_unleash_cast.targetCastFromCaster(tower,Event.getTarget(),1.0+tower.getLevel()*0.02,tower.calcSpellCritNoBonus())
    call tower.doSpellDamage(Event.getTarget(), cast_damage, tower.calcSpellCritNoBonus())
endfunction

Header

    globals
      BuffType ashbringer_conduit_aura
      Cast ashbringer_unleash_cast
      BuffType ashbringer_unleash_buff
    endglobals

    function ashbringer_conduit_update takes Buff b returns nothing
        local Tower tower = b.getBuffedUnit()
        local Tower caster = b.getCaster()
        local real tower_level = caster.getLevel()
        local real caster_level_factor = 0.5 + (tower_level * 0.02)
        call tower.modifyProperty(MOD_SPELL_DAMAGE_DEALT, -b.userReal)
        call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, -b.userReal2)
        call tower.modifyProperty(MOD_SPELL_CRIT_DAMAGE, -b.userReal3)
        call tower.modifyProperty(MOD_ATTACKSPEED, -(b.userInt/1000.0))
        call tower.modifyProperty(MOD_TRIGGER_CHANCES, -(b.userInt2/1000.0))
        set b.userReal = (caster.getProp_SpellDmgDealt() - 1.0)*caster_level_factor
        set b.userReal2 = (caster.getProp_SpellCritChance() - (0.05 + (tower_level * 0.005)))*caster_level_factor
        set b.userReal3 = (caster.getProp_SpellCritDamage() - (1.5 + (tower_level * 0.05)))*caster_level_factor
        set b.userInt = R2I((caster.getProp_Attackspeed() - (0.00 + (tower_level * 0.012)))*caster_level_factor*1000.0)
        set b.userInt2 = R2I((caster.getProp_TriggerChances()- 1.0)*caster_level_factor*1000.0)
        call tower.modifyProperty(MOD_SPELL_DAMAGE_DEALT, b.userReal)
        call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, b.userReal2)
        call tower.modifyProperty(MOD_SPELL_CRIT_DAMAGE, b.userReal3)
        call tower.modifyProperty(MOD_ATTACKSPEED, (b.userInt/1000.0))
        call tower.modifyProperty(MOD_TRIGGER_CHANCES, (b.userInt2/1000.0))
    endfunction

    function ashbringer_conduit_create takes Buff b returns nothing
        set b.userReal = 0
        set b.userReal2 = 0
        set b.userReal3 = 0
        set b.userInt = 0
        set b.userInt2 = 0
        call ashbringer_conduit_update(b)
    endfunction

    function ashbringer_conduit_cleanup takes Buff b returns nothing
        local Tower tower = b.getBuffedUnit()
        call tower.modifyProperty(MOD_SPELL_DAMAGE_DEALT, -b.userReal)
        call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, -b.userReal2)
        call tower.modifyProperty(MOD_SPELL_CRIT_DAMAGE, -b.userReal3)
        call tower.modifyProperty(MOD_ATTACKSPEED, -b.userInt/1000.0)
        call tower.modifyProperty(MOD_TRIGGER_CHANCES, -b.userInt2/1000.0)
    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 ashbringer_conduit_aura = BuffType.createAuraEffectType(true)
        set ashbringer_unleash_cast = Cast.create('@@1@@',"chainlightning",1.0)
        set ashbringer_unleash_buff=BuffType.create(3,0,false)
        
        call ashbringer_conduit_aura.setBuffIcon('@@2@@')
        call ashbringer_conduit_aura.addEventOnCreate(ashbringer_conduit_create)
        call ashbringer_conduit_aura.addEventOnCleanup(ashbringer_conduit_cleanup)
        call ashbringer_conduit_aura.addPeriodicEvent(ashbringer_conduit_update, 5)
        
        call m.addModification(MOD_SPELL_CRIT_DAMAGE, 0.75, 0.03)
        call ashbringer_unleash_buff.setBuffIcon('@@3@@')
        call ashbringer_unleash_buff.setBuffModifier(m)
        
        call ashbringer_unleash_cast.setSourceHeight(220.0)
    endfunction

On Damage

ONDAMAGE_chance: 0.1 ONDAMAGE_chanceLevelAdd: 0.002
function onDamage takes Tower tower returns nothing
    local real mana = 50.0 + (1.0 * tower.getLevel())
    set Event.damage = 0
    call tower.addMana(mana)
    call Event.getTarget().subtractMana(mana, true)
    call Lightning.createFromUnitToPoint("BLUE", Event.getTarget(), tower.getX(), tower.getY(), 180.00).setLifetime(0.5)
endfunction

Tower Aura

AURA_powerAdd: 0 AURA_auraEffect: ashbringer_conduit_aura AURA_levelAdd: 0 AURA_power: 1 AURA_targetType: TARGET_TYPE_TOWERS + TARGET_TYPE_ELEMENT_STORM + TARGET_TYPE_RARITY_UNCOMMON + TARGET_TYPE_RARITY_COMMON AURA_targetSelf: false AURA_level: 1 AURA_auraRange: 350
Soulflame Device v1
4000
ID:
433
Family ID:
Author:
Ashbringer
Rarity:
unique
Element:
darkness
Attack Type:
Decay
Attack Range:
1000
Attack CD:
1.5
Damage:
1344-1344
Mana:
100
Mana regen:
0
Status:
Approved

Description:

Burns and consumes the souls of the living.
Specials:
-40% dmg to undead (+1%/lvl)
Soulfire:
Attacks hit up to 8 enemies in range and have a 20% chance to ignite the enemy's soul, dealing 1000 spell damage per second for 5 seconds. This effect stacks.

Level Bonus:
+0.4% chance
+40 spell damage
Awaken
Increases the attack speed of towers within 350 range by 50% for 3 seconds and permanently increases the attack speed of this tower by 1%.

Level Bonus:
+2% attack speed

AC_TYPE_OFFENSIVE_IMMEDIATE
 50, 900 range, 4s cooldown
Soul Consumption
When an enemy dies under the effect of Soulfire, Soulfire spreads to nearby enemies within 200 range. The enemy is consumed by the tower, restoring 5 mana.
Evil Device - Aura
Attack speed, trigger chances, spell damage, spell crit chance and spell crit damage bonuses on this tower are applied to Common and Uncommon Darkness towers in 350 range at a rate of 50%.

Level Bonus:
+2% stats
Download

Toggle Triggers

Autocast

AUTOCAST_cooldown: 4 AUTOCAST_autoRange: 900 AUTOCAST_manacost: 50 AUTOCAST_range: 900 AUTOCAST_targetType: 0 AUTOCAST_numBuffsBeforeIdle: 0 caster_art: Objects\Spawnmodels\Undead\UCancelDeath\UCancelDeath.mdl target_art: AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_IMMEDIATE AUTOCAST_buffType: 0 AUTOCAST_isExtended: true AUTOCAST_targetSelf: false
private function onAutocast takes Tower tower returns nothing
    local Iterate it = Iterate.overUnitsInRangeOfUnit(tower,TARGET_TOWERS,tower,350)
    local Unit next

    loop
        set next = it.next()
            call ashbringer_awaken_buff.apply(tower,next,tower.getLevel())
        exitwhen next == 0
    endloop
    set tower.userInt = tower.userInt + 1
    call tower.modifyProperty(MOD_ATTACKSPEED, 0.01)
endfunction

Header

    globals
    BuffType ashbringer_soulfire_buff
    BuffType ashbringer_device_aura
    ProjectileType ashbringer_consumption_projectile
    BuffType ashbringer_awaken_buff
    MultiboardValues ashbringer_awaken_count
    endglobals
    
    function ashbringer_consumption_missile takes Unit target, Tower tower returns nothing
        local real towerX = tower.getX()
        local real towerY = tower.getY()
        
        call Projectile.createFromUnitToPoint(ashbringer_consumption_projectile, target, 0, 0, target, towerX, towerY, 215.00, false, true)
    endfunction
    
    function ashbringer_device_update takes Buff b returns nothing
        local Tower tower = b.getBuffedUnit()
        local Tower caster = b.getCaster()
        local real tower_level = caster.getLevel()
        local real caster_level_factor = 0.5 + (tower_level * 0.02)
        
        call tower.modifyProperty(MOD_SPELL_DAMAGE_DEALT, -b.userReal)
        call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, -b.userReal2)
        call tower.modifyProperty(MOD_SPELL_CRIT_DAMAGE, -b.userReal3)
        call tower.modifyProperty(MOD_ATTACKSPEED, -(b.userInt/1000.0))
        call tower.modifyProperty(MOD_TRIGGER_CHANCES, -(b.userInt2/1000.0))
        
        set b.userReal = (caster.getProp_SpellDmgDealt() - 1.0)*caster_level_factor
        set b.userReal2 = (caster.getProp_SpellCritChance() - (0.0125 + (tower_level * 0.0015)))*caster_level_factor
        set b.userReal3 = (caster.getProp_SpellCritDamage() - (1.25 + (tower_level * 0.02)))*caster_level_factor
        set b.userInt = R2I((caster.getProp_Attackspeed() - (0.00 + (tower_level * 0.012)))*caster_level_factor*1000.0)
        set b.userInt2 = R2I((caster.getProp_TriggerChances()- 1.0)*caster_level_factor*1000.0)
        
        call tower.modifyProperty(MOD_SPELL_DAMAGE_DEALT, b.userReal)
        call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, b.userReal2)
        call tower.modifyProperty(MOD_SPELL_CRIT_DAMAGE, b.userReal3)
        call tower.modifyProperty(MOD_ATTACKSPEED, (b.userInt/1000.0))
        call tower.modifyProperty(MOD_TRIGGER_CHANCES, (b.userInt2/1000.0))
    endfunction

    function ashbringer_device_create takes Buff b returns nothing
        set b.userReal = 0
        set b.userReal2 = 0
        set b.userReal3 = 0
        set b.userInt = 0
        set b.userInt2 = 0
        call ashbringer_device_update(b)
    endfunction

    function ashbringer_device_cleanup takes Buff b returns nothing
        local Tower tower = b.getBuffedUnit()
        call tower.modifyProperty(MOD_SPELL_DAMAGE_DEALT, -b.userReal)
        call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, -b.userReal2)
        call tower.modifyProperty(MOD_SPELL_CRIT_DAMAGE, -b.userReal3)
        call tower.modifyProperty(MOD_ATTACKSPEED, -b.userInt/1000.0)
        call tower.modifyProperty(MOD_TRIGGER_CHANCES, -b.userInt2/1000.0)
    endfunction
    
    function ashbringer_soulfire_apply takes Tower tower, Creep creep, integer stacks returns nothing
        local Buff b
        local integer i
        
        if stacks<1 then
            set stacks = 1
        endif
            
        set b = creep.getBuffOfType(ashbringer_soulfire_buff)
        if ( b != 0 ) then
            set i = b.getPower() + stacks
            call ashbringer_soulfire_buff.applyCustomPower(tower, creep, 1, i)
        else
            set i = stacks
            call ashbringer_soulfire_buff.applyCustomPower(tower, creep, 1, i)
        endif
    endfunction
    
    function ashbringer_soulfire_damage takes Buff b returns nothing
        local Tower tower = b.getCaster()
        local integer power = b.getPower()
        call tower.doSpellDamage(b.getBuffedUnit(), (1000 + (tower.getLevel() * 40)) * I2R(power), tower.calcSpellCritNoBonus())
    endfunction
    
    function ashbringer_soulfire_ondeath takes Buff b returns nothing
        local Creep creep = b.getBuffedUnit()
        local Tower tower = b.getCaster()
        local Iterate it = Iterate.overUnitsInRangeOfUnit(tower, TARGET_CREEPS, creep, 200)
        local Unit next
        local integer nearby = 0
        
        call Effect.createSimpleAtUnit("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl", creep).destroy()
        call ashbringer_consumption_missile(creep, tower)
    
        if tower != 0 then
            call tower.addMana(5.00)
        endif
        
        set nearby = it.count()
        loop
            set next = it.next()
            call ashbringer_soulfire_apply(tower, next, b.getPower()/nearby)
            exitwhen next == 0
        endloop
    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 ashbringer_device_aura = BuffType.createAuraEffectType(true)
        call ashbringer_device_aura.setBuffIcon('@@2@@')
        call ashbringer_device_aura.addEventOnCreate(ashbringer_device_create)
        call ashbringer_device_aura.addEventOnCleanup(ashbringer_device_cleanup)
        call ashbringer_device_aura.addPeriodicEvent(ashbringer_device_update, 5)

        set ashbringer_soulfire_buff = BuffType.create(5,0,false) 
        call ashbringer_soulfire_buff.setBuffIcon('@@1@@')  
        call ashbringer_soulfire_buff.addPeriodicEvent(EventHandler.ashbringer_soulfire_damage,1) 
        call ashbringer_soulfire_buff.addEventOnDeath(EventHandler.ashbringer_soulfire_ondeath)
            
        set ashbringer_consumption_projectile = ProjectileType.create("Abilities\\weapons\\AvengerMissile\\AvengerMissile.mdl", 5.0, 900.0)
        
        set ashbringer_awaken_buff=BuffType.create(3, 0, true)
        call m.addModification(MOD_ATTACKSPEED, 0.5, 0.02)
        call ashbringer_awaken_buff.setBuffIcon('@@3@@')
        call ashbringer_awaken_buff.setBuffModifier(m)
        
        set ashbringer_awaken_count = MultiboardValues.create(1)  
        call ashbringer_awaken_count.setKey(0,"Awaken Cast") 
    endfunction

On Damage

ONDAMAGE_chance: 0.2 ONDAMAGE_chanceLevelAdd: 0.004
function onDamage takes Tower tower returns nothing
    call ashbringer_soulfire_apply(tower, Event.getTarget(), 1)
endfunction

On Tower Creation

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

On Tower Details

goldcost: 0
function onTowerDetails takes Tower tower returns MultiboardValues
    call ashbringer_awaken_count.setValue(0, I2S(tower.userInt)) 
    return ashbringer_awaken_count
endfunction

Tower Aura

AURA_powerAdd: 0 AURA_auraEffect: ashbringer_device_aura AURA_levelAdd: 0 AURA_power: 1 AURA_targetType: TARGET_TYPE_TOWERS + TARGET_TYPE_ELEMENT_DARKNESS + TARGET_TYPE_RARITY_UNCOMMON + TARGET_TYPE_RARITY_COMMON AURA_targetSelf: false AURA_level: 1 AURA_auraRange: 350
The Furnace v1
4000
ID:
434
Family ID:
Author:
Ashbringer
Rarity:
unique
Element:
fire
Attack Type:
Elemental
Attack Range:
1000
Attack CD:
1.8
Damage:
988-988
Mana:
3000
Mana regen:
0
Status:
Approved

Description:

Feel the heat.
Specials:
Splash attack:
   300 AoE: 100% damage
Intense Heat
Expends all mana to unleash a wave of heat, dealing [Mana x 7] spell damage and applying Lingering Flame to all enemies in 1000 range. Increases the attack and spell crit chance of nearby towers within 350 range by [Mana / 300]% for 4 seconds.

Level Bonus:
+0.2 spell damage per mana

AC_TYPE_OFFENSIVE_IMMEDIATE
 100, 750 range, 5s cooldown
Uncontrollable Flames
The tower attacks a random enemy in range with each attack. Enemies hit are inflicted with Lingering Flame, dealing 100 spell damage per second for 10 seconds. This effect stacks.

Level Bonus:
+2 spell damage
Flames of the Forge - Aura
Attack speed, trigger chances, spell damage, spell crit chance and spell crit damage bonuses on this tower are applied to Common and Uncommon Fire towers in 350 range at a rate of 50%.

Level Bonus:
+2% stats
Feed the Flames - Aura
This tower fuels itself in various ways. Gains 1% of maximum mana on attack. Whenever Lingering Flame deals damage, there is a 20% chance to gain 0.5% of maximum mana per stack. On kill, gains 4% of total mana and maximum mana is increased by 10. 

Level Bonus:
+0.4% chance
Download

Toggle Triggers

Autocast

AUTOCAST_cooldown: 5 AUTOCAST_autoRange: 750 AUTOCAST_manacost: 100 AUTOCAST_range: 750 AUTOCAST_targetType: 0 AUTOCAST_numBuffsBeforeIdle: 0 caster_art: target_art: AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_IMMEDIATE AUTOCAST_buffType: 0 AUTOCAST_isExtended: true AUTOCAST_targetSelf: false
private function onAutocast takes Tower tower returns nothing
    local Iterate damagecast = Iterate.overUnitsInRangeOfUnit(tower,TARGET_CREEPS,tower,1000)
    local Iterate buffcast = Iterate.overUnitsInRangeOfUnit(tower,TARGET_TOWERS,tower,350)
    local Unit next
    local real towermana = GetUnitState( tower.getUnit(), UNIT_STATE_MANA)
    local real fxscale = 0.8 + ((RMinBJ(towermana, 3000) / 3000) * 0.9)
    
    call Effect.createScaled("Objects\\Spawnmodels\\Human\\SmallFlameSpawn\\SmallFlameSpawn.mdl", tower.getX(), tower.getY(), 0, 270, fxscale).setLifetime(6.6)
    loop
        set next = damagecast.next()
        exitwhen next == 0
        call ashbringer_linger_apply(tower, next)
        call tower.doSpellDamage(next, (7 + (tower.getLevel() * 0.2)) * towermana, tower.calcSpellCritNoBonus())
        call Effect.createSimpleOnUnit("Doodads\\Cinematic\\FireTrapUp\\FireTrapUp.mdl", next, "origin").setLifetime(3.0)
    endloop

    loop
        set next = buffcast.next()
        exitwhen next == 0
            call ashbringer_intense_buff.apply(tower,next,R2I(towermana/15.0))
    endloop
    call tower.subtractMana(towermana, true)
endfunction

Header

    globals
    BuffType ashbringer_linger_buff
    BuffType ashbringer_heart_aura
    BuffType ashbringer_intense_buff
    BuffType ashbringer_attackrandom_buff
    endglobals
    
    function ashbringer_heart_update takes Buff b returns nothing
        local Tower tower = b.getBuffedUnit()
        local Tower caster = b.getCaster()
        local real tower_level = caster.getLevel()
        local real caster_level_factor = 0.5 + (tower_level * 0.02)
        
        call tower.modifyProperty(MOD_SPELL_DAMAGE_DEALT, -b.userReal)
        call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, -b.userReal2)
        call tower.modifyProperty(MOD_SPELL_CRIT_DAMAGE, -b.userReal3)
        call tower.modifyProperty(MOD_ATTACKSPEED, -(b.userInt/1000.0))
        call tower.modifyProperty(MOD_TRIGGER_CHANCES, -(b.userInt2/1000.0))
        
        set b.userReal = (caster.getProp_SpellDmgDealt() - 1.0)*caster_level_factor
        set b.userReal2 = (caster.getProp_SpellCritChance() - (0.0125 + (tower_level * 0.0015)))*caster_level_factor
        set b.userReal3 = (caster.getProp_SpellCritDamage() - (1.25 + (tower_level * 0.02)))*caster_level_factor
        set b.userInt = R2I((caster.getProp_Attackspeed() - (0.00 + (tower_level * 0.012)))*caster_level_factor*1000.0)
        set b.userInt2 = R2I((caster.getProp_TriggerChances()- 1.0)*caster_level_factor*1000.0)
        
        call tower.modifyProperty(MOD_SPELL_DAMAGE_DEALT, b.userReal)
        call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, b.userReal2)
        call tower.modifyProperty(MOD_SPELL_CRIT_DAMAGE, b.userReal3)
        call tower.modifyProperty(MOD_ATTACKSPEED, (b.userInt/1000.0))
        call tower.modifyProperty(MOD_TRIGGER_CHANCES, (b.userInt2/1000.0))
    endfunction

    function ashbringer_heart_create takes Buff b returns nothing
        set b.userReal = 0
        set b.userReal2 = 0
        set b.userReal3 = 0
        set b.userInt = 0
        set b.userInt2 = 0
        call ashbringer_heart_update(b)
    endfunction

    function ashbringer_heart_cleanup takes Buff b returns nothing
        local Tower tower = b.getBuffedUnit()
        call tower.modifyProperty(MOD_SPELL_DAMAGE_DEALT, -b.userReal)
        call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, -b.userReal2)
        call tower.modifyProperty(MOD_SPELL_CRIT_DAMAGE, -b.userReal3)
        call tower.modifyProperty(MOD_ATTACKSPEED, -b.userInt/1000.0)
        call tower.modifyProperty(MOD_TRIGGER_CHANCES, -b.userInt2/1000.0)
    endfunction
    
    function ashbringer_linger_apply takes Tower tower, Creep creep returns nothing
        local Buff b
        local integer i
        set b = creep.getBuffOfType(ashbringer_linger_buff)
        if ( b != 0 ) then
            set i = b.getPower() + 1
            call ashbringer_linger_buff.applyCustomPower(tower, creep, 1, i)
        else
            set i = 1
            call ashbringer_linger_buff.applyCustomPower(tower, creep, 1, i)
        endif
    endfunction
    
    function ashbringer_linger_damage takes Buff b returns nothing
        local Tower tower = b.getCaster()
        local integer power = b.getPower()
        call tower.doSpellDamage(b.getBuffedUnit(), (100 + (tower.getLevel() * 2)) * I2R(power), tower.calcSpellCritNoBonus())
        if (tower.calcChance((0.2 + (tower.getLevel() * 0.004)))) then
            call tower.addManaPerc(0.005 * I2R(power))
        endif
    endfunction
    
    function setUserInt takes Buff b returns nothing        
        set   b.userInt = b.getCaster()
    endfunction
    
    function attackRandomTarget takes Buff b returns nothing
        local Tower      tower     = b.userInt
        local Iterate    iterator  = Iterate.overUnitsInRangeOfCaster(tower, TARGET_CREEPS, 1000)
        local integer    loopIndex = 0
        local Unit       loopUnit
        local Unit array unitsInRange

        loop  
            set loopUnit = iterator.next()
            exitwhen loopUnit == 0 
            set unitsInRange[loopIndex] = loopUnit
            set loopIndex = loopIndex + 1
        endloop
        set loopUnit = unitsInRange[GetRandomInt(0,loopIndex-1)]
        
        call IssueTargetOrder(tower.getUnit(), "attack", loopUnit.getUnit())
    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 ashbringer_heart_aura = BuffType.createAuraEffectType(true)
        call ashbringer_heart_aura.setBuffIcon('@@1@@')
        call ashbringer_heart_aura.addEventOnCreate(ashbringer_heart_create)
        call ashbringer_heart_aura.addEventOnCleanup(ashbringer_heart_cleanup)
        call ashbringer_heart_aura.addPeriodicEvent(ashbringer_heart_update, 5)

        set ashbringer_linger_buff = BuffType.create(10,0,false) 
        call ashbringer_linger_buff.setBuffIcon('@@0@@')  
        call ashbringer_linger_buff.addPeriodicEvent(EventHandler.ashbringer_linger_damage,1) 
            
        set ashbringer_intense_buff=BuffType.create(4,0,true)
        call m.addModification(MOD_ATK_CRIT_CHANCE, 0.0, 0.0005)
        call m.addModification(MOD_SPELL_CRIT_CHANCE, 0.0, 0.0005)
        call ashbringer_intense_buff.setBuffIcon('@@2@@')
        call ashbringer_intense_buff.setBuffModifier(m)
        
        set  ashbringer_attackrandom_buff = BuffType.createAuraEffectType(true)
        call ashbringer_attackrandom_buff.addEventOnCreate(EventHandler.setUserInt)
        call ashbringer_attackrandom_buff.addEventOnAttack(EventHandler.attackRandomTarget, 1, 0)
    endfunction

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
    call tower.addManaPerc(0.01)
endfunction

On Damage

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

On Kill

function onKill takes Tower tower returns nothing
    call tower.modifyProperty(MOD_MANA, 10)
    call tower.addManaPerc(0.04)
endfunction

Tower Aura

AURA_powerAdd: 0 AURA_auraEffect: ashbringer_heart_aura AURA_levelAdd: 0 AURA_power: 1 AURA_targetType: TARGET_TYPE_TOWERS + TARGET_TYPE_ELEMENT_FIRE + TARGET_TYPE_RARITY_UNCOMMON + TARGET_TYPE_RARITY_COMMON AURA_targetSelf: false AURA_level: 1 AURA_auraRange: 350

Tower Aura

AURA_powerAdd: 0 AURA_auraEffect: ashbringer_attackrandom_buff AURA_levelAdd: 0 AURA_power: 1 AURA_targetType: TARGET_TYPE_PLAYER_TOWERS + TARGET_TYPE_ELEMENT_FIRE AURA_targetSelf: true AURA_level: 1 AURA_auraRange: 0
Sapphirons Cold Grave v1
4000
ID:
526
Family ID:
Author:
cedi
Rarity:
unique
Element:
ice
Attack Type:
Elemental
Attack Range:
1500
Attack CD:
4
Damage:
1-1
Status:
Approved

Description:

Sapphiron died a long time ago, but his bones do still carry an unbelievable power.
Ice Shard
This tower fires an ice shard towards an enemy. After a distance of 300 the ice shard splits into 2 new shards which will split again. If a shard collides with an enemy it deals 2280 spell damage. There is a maximum of 4 splits.

Level Bonus:
+85 damage
Liquide Ice
Each time an ice shard damages an enemy, it decreases the target's defense against ice towers. The target takes 15% more damage from attacks of ice towers. The effect lasts until the creep's death and stacks.

Level Bonus:
+0.4% damage increase
Download

Toggle Triggers

Header

    globals
        ProjectileType shard
        BuffType b
    endglobals
        
    function Expiration takes Projectile p returns nothing
        local integer i = p.userInt
        local real angle = p.direction
        local Unit tower = p.getCaster()
        local Projectile P
        if i > 0 then
            set i = i - 1
            set p.userInt = i
            set P = Projectile.create( shard, tower, 1.00, tower.calcSpellCritNoBonus(), p.x, p.y, p.z, angle + 15.00 )
            set P.userInt = i
            set P = Projectile.create( shard, tower, 1.00, tower.calcSpellCritNoBonus(), p.x, p.y, p.z, angle - 15.00 )
            set P.userInt = i
        endif
    endfunction
            
    function Impact takes Projectile p, Unit target returns nothing
        local Unit caster = p.getCaster()
        local Buff B = target.getBuffOfType( b )
        local real r = 0.15 + 0.004 * I2R( caster.getLevel() )
        call caster.doSpellDamage( target, 2280.00 + 85.00 * I2R( caster.getLevel() ), caster.calcSpellCritNoBonus() )
        call SFXAtUnit( "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl", target.getUnit() )
        call target.modifyProperty( MOD_DMG_FROM_ICE, r )
        if B == 0 then
            set B = b.apply( caster, target, 1 )
            set B.userReal = r
        else
            call B.setLevel( B.getLevel() + 1 )
            set B.userReal = B.userReal + r
        endif
        call caster.getOwner().displayFloatingText( "|cFFBFFFFF" + I2S( R2I( B.userReal * 100.00 + 0.5 ) ) + "%|r", target, 255, 255, 255 )
    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 shard = ProjectileType.createRanged( "Abilities\\Weapons\\LichMissile\\LichMissile.mdl", 300.00, 400.00 )
        call shard.setEventOnExpiration( Expiration )
        call shard.enableCollision( Impact, 75.00, TARGET_CREEPS, true )
        set b = BuffType.create( -1.00, 0.00, false )
        call b.setBuffIcon( '@@0@@' )
    endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    local Projectile P = Projectile.createFromUnitToUnit( shard, tower, 1.00, tower.calcSpellCritNoBonus(), tower, Event.getTarget(), false, true, false )
    set P.userInt = 4
endfunction
Electric Death v1
4400
ID:
124
Family ID:
Author:
cedi
Rarity:
unique
Element:
iron
Attack Type:
Magic
Attack Range:
1000
Attack CD:
0.7
Damage:
1-1
Mana:
2000
Mana regen:
16
Status:
Approved

Description:

This deadly thing was invented by the dwarves to aid them in the long war against the orcs. However they never ended up using it, as it consumes far too much energy.The second generation can be the end of the world...
Specials:
+100 mana/lvl
+3 mana regen/lvl
Energy Absorb
Decreases the attackspeed of all towers in 1000 range by 10%. Increases the mana regeneration of the Accelerator by 2 mana per second for each weakened tower. Both effects last 8 seconds

Level Bonus:
-0.1% attackspeed weakening
+0.04 mana per second

AC_TYPE_OFFENSIVE_IMMEDIATE
 0, 1000 range, 40.00s cooldown
Energetic Weapon
The Accelerator attacks with energetic missiles, which deal 1000 plus 3 times the current mana as spell damage to all units in 250 range of the missile. Additionally, the missile slows all units by 1% for each 4000 damage it deals to a creep for 1.5 seconds. Cannot slow by more than 20%. Each attack consumes 20% of this tower ' s current mana.

Level Bonus:
+50 spell damage
+5% mana converted to damage
+0.04 seconds slow duration
Download

Toggle Triggers

Autocast

caster_art: AUTOCAST_cooldown: 40.00 AUTOCAST_numBuffsBeforeIdle: 0 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_IMMEDIATE AUTOCAST_manacost: 0 AUTOCAST_range: 1000 AUTOCAST_buffType: 0 AUTOCAST_targetSelf: false AUTOCAST_targetType: 0 target_art: AUTOCAST_autoRange: 1000
private function onAutocast takes Tower tower returns nothing
    local integer numTowers = 0 
    local integer lvl = tower.getLevel() 
    local Unit u 
    local Iterate it = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TOWERS, 1000.0) 
    loop 
        set u = it.next() 
        exitwhen u == 0 
        if u != tower then 
            set numTowers = numTowers + 1 
            call tomy_EnergyAbsorptionTargetBT.apply(tower, u, lvl) 
        endif 
    endloop 
    if numTowers > 0 then 
        call tomy_EnergyAbsorptionCasterBT.apply(tower, tower, (50 + lvl) * numTowers) 
    endif
endfunction

Header

    globals
        //@import
        ProjectileType tomy_EnergeticWeaponPT 
        //@import 
        BuffType tomy_EnergyAbsorptionTargetBT 
        //@import 
        BuffType tomy_EnergyAbsorptionCasterBT 
        //@import 
        BuffType tomy_SlowBT
    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 u = tower.getUnit() 
    local unit t = Event.getTarget().getUnit() 
    local Projectile p 
    local real angle = Atan2(GetUnitY( t ) - GetUnitY( u ), GetUnitX( t ) - GetUnitX( u )) 
    local real mana = GetUnitState(u, UNIT_STATE_MANA) 
    set p = Projectile.create(tomy_EnergeticWeaponPT, tower, 1.00, tower.calcSpellCritNoBonus(), GetUnitX( u ) + Cos( angle ) * 110.00, GetUnitY( u ) + Sin( angle ) * 110.00, 40.00, angle * bj_RADTODEG ) 
    set p.userReal = 1000.00 * (1.00 + tower.getLevel() * 0.05) + mana * (3.00 + tower.getLevel() * 0.05 ) 
    set p.z = 10.0 
    call p.setScale( 2.00 ) 
    call SetUnitState( u, UNIT_STATE_MANA, mana * 0.80 ) 
    set u = null 
    set t = null
endfunction
It v1
4500
ID:
216
Family ID:
Author:
axllow
Rarity:
unique
Element:
darkness
Attack Type:
Decay
Attack Range:
800
Attack CD:
2
Damage:
8684-8684
Status:
Approved

Description:

An unsightly being from a distant realm, adept in performing daemonic rituals and casting nasty curses.
Specials:
10% spell crit chance (+0.5%/lvl)
Recreation Field
Set up Recreation Field at a chosen location. Field has 250 AoE and will punish creeps that walk over it at the wrong moment.

AC_TYPE_NOAC_POINT
 0, 800 range, 5s cooldown
Corruption Field
Set up Corruption Field at a chosen location. Field has 250 AoE and will punish creeps that walk over it at the wrong moment.

AC_TYPE_NOAC_POINT
 0, 800 range, 5s cooldown
It Hunger
Every time an enemy creep is transported by Dark Ritual or killed by this tower, It permanently gains 0.1% spelldamage. There is a maximum of 700% bonus spelldamage.

Level Bonus:
 +0.01% spelldamage
Dark Ritual
When this tower attacks, it awakens the powerful dark magic in Recreation and Corruption Fields, dealing 3000 spelldamage to all creeps unfortunate enough to be standing in those areas. If a non-boss enemy in Corruption Field is affected by Dark Ritual for the first time, it will be immediately transported to Recreation Field.

Level Bonus:
 +100 spelldamage

Cooldown: 1 sec
Download

Toggle Triggers

Autocast

caster_art: AUTOCAST_cooldown: 5 AUTOCAST_numBuffsBeforeIdle: 0 AUTOCAST_isExtended: true AUTOCAST_autocastType: AC_TYPE_NOAC_POINT AUTOCAST_manacost: 0 AUTOCAST_range: 800 AUTOCAST_buffType: 0 AUTOCAST_targetSelf: false AUTOCAST_targetType: 0 target_art: AUTOCAST_autoRange: 0
private function onAutocast takes Tower tower returns nothing
    local Summoner sum = tower.userInt
    local real lastX = sum.toX
    local real lastY = sum.toY
    set sum.toX = GetSpellTargetX()
    set sum.toY = GetSpellTargetY()
    if isPointOnCreepPath(sum.toX,sum.toY) then
            if tower.userInt2 == 1 then
                call sum.future.setPosition(sum.toX,sum.toY)
            else
                set tower.userInt2 = 1
                set sum.future = Effect.createColored("Abilities\\Spells\\Undead\\VampiricAura\\VampiricAura.mdl",sum.toX,sum.toY,0,270.0,2.0,255,0,0,255)
                call sum.future.noDeathAnimation()
            endif
        else
            set sum.toX = lastX
            set sum.toY = lastY
            call tower.getOwner().displaySmallFloatingText("Invalid location!",tower,255, 150, 0,30)
    endif
endfunction

Autocast

caster_art: AUTOCAST_cooldown: 5 AUTOCAST_numBuffsBeforeIdle: 0 AUTOCAST_isExtended: true AUTOCAST_autocastType: AC_TYPE_NOAC_POINT AUTOCAST_manacost: 0 AUTOCAST_range: 800 AUTOCAST_buffType: 0 AUTOCAST_targetSelf: false AUTOCAST_targetType: 0 target_art: AUTOCAST_autoRange: 0
private function onAutocast takes Tower tower returns nothing
    local Summoner sum = tower.userInt
    local real lastX = sum.fromX
    local real lastY = sum.fromY
    if(tower.userInt2 == 1) then
        set tower.userReal = 1
        set sum.fromX = GetSpellTargetX()
        set sum.fromY = GetSpellTargetY()
        //no need to check the location in this field's placement
        if tower.userInt3 == 1 then
            call sum.from.setPosition(sum.fromX,sum.fromY)
        else
            set tower.userInt3 = 1
            set sum.from = Effect.createColored("Abilities\\Spells\\Undead\\VampiricAura\\VampiricAura.mdl",sum.fromX,sum.fromY,0,270.0,2.0,0,0,255,255)
            call sum.from.noDeathAnimation()
        endif
    else
        call tower.getOwner().displaySmallFloatingText("You must place the recreation field first!",tower,255, 150, 0,30)
    endif
endfunction

Header

    globals
        integer array Summoner_units
        Effect Summoner_tp_e
        MultiboardValues Summoner_spd
    endglobals
    
    struct Summoner
        real size = 3.0
        ubersplat tow
        Effect from = 0
        Effect future = 0
        real fromX = 0
        real fromY = 0
        real toX = 0
        real toY = 0
    endstruct
    
    function It_kill takes Tower tower returns nothing
        local Summoner sum = tower.userInt
        local unit twrUnit = tower.getUnit()
        local real mod = 0.001 + (0.0001 * tower.getLevel())
        if sum.size < 10.0 then
            call tower.modifyProperty(MOD_SPELL_DAMAGE_DEALT,mod)//700% cap
            set sum.size = sum.size + mod
        endif
        if sum.size < 3.7 then
            call SetUnitScale(twrUnit,sum.size-2.7,sum.size,sum.size) 
        endif
        set twrUnit = 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 Summoner_spd = MultiboardValues.create(1)
    call Summoner_spd.setKey(0,"Spelldamage Bonus")
    endfunction

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
    //local integer currentTime = Game.getGameTime
    local Summoner sum = tower.userInt
    local Iterate inRange
    local real mod = 3000 + (tower.getLevel() * 100)
    local Creep s
    local integer UID
    local Effect DMG1
    local Effect DMG2
    local Effect TP1
    local Effect TP2
    local real toX
    local real toY
    if(tower.userReal == 1) then
        call tower.doSpellDamageAoE(sum.fromX,sum.fromY,250.0,mod,tower.calcSpellCritNoBonus(),0.0)
        //40.0 Oo
        set DMG1 = Effect.createColored("Abilities\\Spells\\Human\\Feedback\\ArcaneTowerAttack.mdl",sum.fromX,sum.fromY,100.0,270.0,40.0,0,0,0,255)
        call DMG1.setLifetime(1)
        set inRange = Iterate.overUnitsInRange(tower,TARGET_TYPE_CREEPS,sum.fromX,sum.fromY,250.0)
        loop
            set s = inRange.next()
            exitwhen s == 0
          //  set s = l 
            set UID = s.getUID()
            if UID != -1 and Summoner_units[s] != UID and s.getSize() < SIZE_BOSS then
                set TP1 = Effect.create("Abilities\\Spells\\Undead\\Darksummoning\\DarkSummonTarget.mdl",s.getX(),s.getY(),0.0,270.0)
                call TP1.setLifetime(1)
                call It_kill(tower)
                set toX = sum.toX + GetRandomReal(-25,25)
                set toY = sum.toY + GetRandomReal(-25,25)
                call s.moveToPoint(toX,toY,false)
                set TP2 = Effect.create("Abilities\\Spells\\Undead\\Darksummoning\\DarkSummonTarget.mdl",toX,toY,0.0,270.0)
                call TP2.setLifetime(1)
                call s.reorder()
                set Summoner_units[s] = UID
            endif
        endloop
        call tower.doSpellDamageAoE(sum.toX,sum.toY,250.0,mod,tower.calcSpellCritNoBonus(),0.0)
        set DMG2 = Effect.createColored("Abilities\\Spells\\Human\\Feedback\\ArcaneTowerAttack.mdl",sum.toX,sum.toY,100.0,270.0,40.0,0,0,0,255)
        call DMG2.setLifetime(1)
        set tower.userReal = 0
        call TriggerSleepAction(1.0)
        set tower.userReal = 1
    endif
endfunction

On Kill

function onKill takes Tower tower returns nothing
    call It_kill(tower)
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    local Summoner sum = Summoner.create()
    local unit twrUnit = tower.getUnit()
    set sum.tow = CreateUbersplat(GetUnitX(twrUnit) - 16.0, GetUnitY(twrUnit) - 16.0,"DRKC",255,255,255,255,false,false)
    call SetUbersplatRenderAlways(sum.tow,true)
    set tower.userInt = sum
    set tower.userInt2 = 0
    set tower.userInt3 = 0
    set twrUnit = null
endfunction

On Tower Destruction

function onDestruct takes Tower tower returns nothing
    local Summoner sum = tower.userInt
    if tower.userInt2 == 1 then
        call sum.future.destroy()
    endif
    if tower.userInt3 == 1 then
        call sum.from.destroy()
    endif
    call DestroyUbersplat(sum.tow)
    set sum.tow = null
    call sum.destroy()
endfunction

On Tower Details

goldcost: 4500
function onTowerDetails takes Tower tower returns MultiboardValues
    local Summoner sum = tower.userInt
    call Summoner_spd.setValue(0, formatPercent(sum.size - 3.0, 1)) 
    return Summoner_spd
endfunction