Green Lightning v1
500
ID:
329
Family ID:
Author:
drol
Rarity:
rare
Element:
storm
Attack Type:
Energy
Attack Range:
1200
Attack CD:
2
Damage:
486-635
Abil. Factor:
0.59
Status:
Approved

Description:

This tower gains mana by attacking and can use it to gain an attackspeed boost.

Latest Upload Comment:

Restored from 1.10
Specials:
+20% dmg to magical
Lightning Surge
Increases the attackspeed of this tower by 100% for the next 5 attacks. The surge fades after 8 seconds.

Level Bonus:
+2% attackspeed
+1 attack per 5 levels
Mana Feed
Attacks restore 4 mana to the tower and increase spell crit chance by 5%.

Hint: Mana regeneration increases mana gained.

Level Bonus:
+0.1% spell crit chance
Lightning Burst
Grants a 12.5% chance to deal 15 times current mana as spell damage on attack.
Resets the bonus spell crit of 'Mana Feed'.

Level Bonus:
+0.5% chance
Download

Toggle Triggers

Autocast

caster_art: AUTOCAST_cooldown: 6 AUTOCAST_numBuffsBeforeIdle: 0 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_IMMEDIATE AUTOCAST_manacost: 60 AUTOCAST_range: 1200 AUTOCAST_buffType: 0 AUTOCAST_targetSelf: false AUTOCAST_targetType: 0 target_art: AUTOCAST_autoRange: 1200
private function onAutocast takes Tower tower returns nothing
    
    set tower.userInt = 5 + tower.getLevel() / 5
    call drol_surge.apply(tower,tower,tower.getLevel())
endfunction

Header

    globals
    //@export
    BuffType drol_surge
    endglobals
    
    function surge takes Buff b returns nothing
        local Unit caster = b.getCaster() 
        if (caster.userInt < 1) then
            call b.removeBuff()
        else
            set caster.userInt = caster.userInt - 1
        endif
    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   drol_surge = BuffType.create(8,0,true)
        call  m.addModification(MOD_ATTACKSPEED, 1.0 , 0.02)
        call  drol_surge.setBuffModifier(m)
        call  drol_surge.setBuffIcon('@@1@@')
        call  drol_surge.addEventOnAttack(surge,1,0)
    
    endfunction

On Attack

ONATTACK_chance: 1.0 ONATTACK_chanceLevelAdd: 0.0
function onAttack takes Tower tower returns nothing
  local unit towerUnit = tower.getUnit()
  local real mana = GetUnitState(towerUnit, UNIT_STATE_MANA)
  
  call SetUnitState(towerUnit , UNIT_STATE_MANA, mana + 4 * (1. + tower.getProp_ManaRegPercBonus()))
  
  call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, 0.05+(tower.getLevel()*0.001))
  set tower.userReal = tower.userReal + 0.05 + (tower.getLevel()*0.001)
  set towerUnit = null
endfunction

On Damage

ONDAMAGE_chance: 0.125 ONDAMAGE_chanceLevelAdd: 0.005
function onDamage takes Tower tower returns nothing
    local Effect targetEffect 
    local Creep creep = Event.getTarget()
    
    if not creep.isImmune() then
    
        set targetEffect = Effect.createScaled("Abilities\\Spells\\Human\\ManaFlare\\ManaFlareBoltImpact.mdl", GetUnitX(creep.getUnit()), GetUnitY(creep.getUnit()), 0, 0, 1.8)
        call targetEffect.setLifetime(1.0)
        call tower.doSpellDamage(creep, GetUnitState(tower.getUnit(), UNIT_STATE_MANA) * 15,tower.calcSpellCritNoBonus())
        call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, -(tower.userReal))
        set tower.userReal = 0.0
    
    endif
    
endfunction

On Tower Creation

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