Rotted Flashing Grave v1
70
ID:
650
Family ID:
Author:
Natac
Rarity:
common
Element:
storm
Attack Type:
Energy
Attack Range:
2000
Attack CD:
1
Damage:
36-36
Abil. Factor:
1.04
Status:
Approved

Description:

A common grave of a fallen storm warrior, whose wrath outlasts its death and still seeks for revenge.

Latest Upload Comment:

Restored from 1.10
Specials:
+10% dmg to magical (+1%/lvl)
Wrath of the Storm
The enormous wrath of the dead warrior flows out of this tower undirected. So the tower only hits a random target in range each attack.
Download

Toggle Triggers

Header

    globals
        //@export
        BuffType natac_flashingGraveRandomTarget_BuffType
    endglobals
    
    function setUserInt takes Buff b returns nothing        
        set   b.userInt = b.getCaster() // To avoid this call on every "onAttack"-Event
    endfunction
    
    function attackRandomTarget takes Buff b returns nothing
        local Tower      tower     = b.userInt
        local Iterate    iterator  = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TYPE_CREEPS, 2000)
        local integer    loopIndex = 0 // Temp integer variable in both loops. Used as array index and total number of possible targets
        local Unit       loopUnit      // Temp unit variable. Used for the loop and to store the choosen target
        local Unit array unitsInRange  // Contains all units found by the iterator

        // --- Find a random Target ---
        // Add all units to the array. So the array gets filled and we can also count the number of
        // possible targets in the loopIndex.
        loop  
            set loopUnit = iterator.next()
            exitwhen loopUnit == 0 
            set unitsInRange[loopIndex] = loopUnit
            set loopIndex = loopIndex + 1
        endloop
        set loopUnit = unitsInRange[GetRandomInt(0,loopIndex-1)] // Get random target
        
        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
        set  natac_flashingGraveRandomTarget_BuffType = BuffType.createAuraEffectType(true)
        call natac_flashingGraveRandomTarget_BuffType.addEventOnCreate(EventHandler.setUserInt)
        call natac_flashingGraveRandomTarget_BuffType.addEventOnAttack(EventHandler.attackRandomTarget, 1, 0)
    endfunction

Tower Aura

AURA_auraEffect: natac_flashingGraveRandomTarget_BuffType AURA_power: 1 AURA_level: 1 AURA_auraRange: 0 AURA_targetType: TARGET_TYPE_PLAYER_TOWERS + TARGET_TYPE_ELEMENT_STORM AURA_levelAdd: 0 AURA_powerAdd: 0 AURA_targetSelf: true