Ball Lightning Accelerator v1
2200
ID:
123
Family ID:
Author:
cedi
Rarity:
unique
Element:
iron
Attack Type:
Magic
Attack Range:
1000
Attack CD:
0.8
Damage:
1-1
Mana:
1000
Mana regen:
8
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.
Specials:
+50 mana/lvl
+1 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.0 range, 40.00s cooldown
Energetic Weapon
The Accelerator attacks with energetic missiles, which deal 500 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:
+25 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.0 AUTOCAST_buffType: 0 AUTOCAST_targetSelf: false AUTOCAST_targetType: 0 target_art: AUTOCAST_autoRange: 1000.0
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
        //@export
        ProjectileType tomy_EnergeticWeaponPT
        //@export
        BuffType tomy_EnergyAbsorptionTargetBT
        //@export
        BuffType tomy_EnergyAbsorptionCasterBT
        //@export
        BuffType tomy_SlowBT
    endglobals
    
    function EnergeticWeaponCollision takes Projectile p, Unit target returns nothing
        local Unit caster = p.getCaster()
        local real slow = ( p.userReal / 4000.00)
        local unit u = target.getUnit()
        local lightning lightningEffect = AddLightningEx("FORK", false, p.x + 50.0 * Cos(p.direction* bj_DEGTORAD), p.y + 50.0 * Sin(p.direction* bj_DEGTORAD), p.z + 60.0, GetUnitX(u), GetUnitY(u), GetUnitFlyHeight(u))
        if (slow > 20) then
            set slow = 20
        endif
        call p.doSpellDamage(target, p.userReal)
        call tomy_SlowBT.applyCustomTimed( caster, target, R2I(slow * 10), 1.50 + 0.04 * caster.getLevel() )
        call SFXAtUnit("Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl", u)
        call TriggerSleepAction(0.20)
        call DestroyLightning(lightningEffect)
        set u = null
        set lightningEffect = null
    endfunction
    
    //Do not remove or rename this function!
    //Put your initialization tasks here, this function will be called on map init
    private function init takes nothing returns nothing
        local Modifier m = Modifier.create()
        // ======= Energy Absorption Target =======
        call m.addModification( MOD_ATTACKSPEED, -0.1, 0.001 )
        set tomy_EnergyAbsorptionTargetBT = BuffType.create(8.00, 0.00, false)
        call tomy_EnergyAbsorptionTargetBT.setBuffModifier( m )
        call tomy_EnergyAbsorptionTargetBT.setBuffIcon( '@@0@@' )
        // ======= Energy Absorption Caster =======
        set m = Modifier.create()
        call m.addModification(MOD_MANA_REGEN, 0.00, 0.04)
        set tomy_EnergyAbsorptionCasterBT = BuffType.create(8.00, 0.00, true)
        call tomy_EnergyAbsorptionCasterBT.setBuffModifier( m )
        call tomy_EnergyAbsorptionCasterBT.setBuffIcon( '@@2@@' )
        // ======= Energetic Weapon =======
        set tomy_EnergeticWeaponPT = ProjectileType.createRanged("Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl", 1000.0, 650.0) 
        call tomy_EnergeticWeaponPT.enableCollision( EnergeticWeaponCollision, 250.00, TARGET_CREEPS, false )
        // ======= Slow =======
        set m = Modifier.create()
        call m.addModification( MOD_MOVESPEED, -0.00, -0.001 )
        set tomy_SlowBT = BuffType.create( 1.5, 0.04, false )
        call tomy_SlowBT.setBuffIcon( '@@1@@' )
        call tomy_SlowBT.setBuffModifier( m )
    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 = 500.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
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