Zeus v1
2500
ID:
199
Family ID:
Author:
Boekie
Rarity:
unique
Element:
storm
Attack Type:
Energy
Attack Range:
1200
Attack CD:
2
Damage:
2581-2600
Mana:
100
Mana regen:
1
Status:
Approved

Description:

Zeus, the God of Thunder, is able to invoke massive lighting storms.
Specials:
+5 mana/lvl
Thunderstorm
Zeus releases a mighty thunderstorm, this thunder storm strikes creeps in 1000 range for 2500 spelldamage and stuns them for 0.5 seconds (20% chance on bosses). There is a maximum of 20 lightning strikes.

Level Bonus:
+125 damage
+1 lightning strike per 5 levels

AC_TYPE_OFFENSIVE_IMMEDIATE
 90, 1000 range, 10s cooldown
Electrified Attack
Zeus's attacks deal an additional 500 spelldamage in 175 AoE around their target. 

Level Bonus:
+20 spelldamage
Divine Hammer
Whenever Zeus kills a creep he restores 5% of his maximum mana.
Download

Toggle Triggers

Autocast

AUTOCAST_cooldown: 10 AUTOCAST_autoRange: 1000 AUTOCAST_manacost: 90 AUTOCAST_range: 1000 AUTOCAST_targetType: 0 AUTOCAST_numBuffsBeforeIdle: 0 caster_art: target_art: AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_IMMEDIATE AUTOCAST_buffType: 0 AUTOCAST_isExtended: false AUTOCAST_targetSelf: false
private function onAutocast takes Tower tower returns nothing
    set tower.userInt2 = 20 + (R2I(tower.getLevel()/5))
    if tower.userInt3 == 0 then
        set tower.userInt3 = Effect.create("Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl", tower.getX() - 16, tower.getY() - 16, 50, 0)
    endif
    call PeriodicEvent(tower.userInt).enable()
endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    if Event.isMainTarget() then
        call tower.doSpellDamageAoEUnit(Event.getTarget(),175,500+(tower.getLevel()*20),tower.calcSpellCritNoBonus(),0.0)
    endif
endfunction

On Kill

function onKill takes Tower tower returns nothing
    local unit towerUnit = tower.getUnit() 
    call SetUnitState(towerUnit,UNIT_STATE_MANA, GetUnitState(towerUnit,UNIT_STATE_MANA)+GetUnitState(towerUnit,UNIT_STATE_MAX_MANA)*0.05)
    set towerUnit = null
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    set tower.userInt=0 //stores periodic
    set tower.userInt2=0 //stores number of bolts to still be releaseed
    set tower.userInt3=0 //stores static effect
endfunction

On Tower Destruction

function onDestruct takes Tower tower returns nothing
    if tower.userInt3 != 0 then
        call Effect(tower.userInt3).destroy()
        set tower.userInt3 = 0
    endif
endfunction

Periodic

PERIODIC_period: 0.2
function periodic takes Tower tower returns nothing
    local Iterate inRange
    local integer numResults = 0
    local Unit result
    local Unit next
    local PeriodicEvent pE

    if tower.userInt2 > 0 then
        set inRange = Iterate.overUnitsInRangeOfCaster(tower,TARGET_CREEPS,1200)
        loop
            set next = inRange.next()
            exitwhen next == 0
            set numResults = numResults + 1
            if GetRandomReal(0.0,1.0) <= 1.0 / numResults then
                set result = next
            endif
        endloop
        if numResults > 0 then
            call tower.doSpellDamage(result,2500.0+(tower.getLevel()*125),tower.calcSpellCritNoBonus())
            if result.getSize() >= SIZE_BOSS then
                if tower.calcChance(0.20) then
                    call cb_stun.applyOnlyTimed(tower, result, 0.5)
                endif
            else
                call cb_stun.applyOnlyTimed(tower, result, 0.5)
            endif
            call SFXOnUnit("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl",result.getUnit(),"origin")
        endif
        set tower.userInt2 = tower.userInt2 - 1
    else
        set pE=Event.getCurrentPeriodicEvent()
        set tower.userInt=pE
        if tower.userInt3 != 0 then
            call Effect(tower.userInt3).destroy()
            set tower.userInt3 = 0
        endif
        call pE.disable()
    endif  
    
endfunction