Array
(
    [scriptVersion] => 7
    [oeValues] => Array
        (
            [RngBuff1] => 250
            [MissileHoming] => 1
            [Upgrade] => Array
                (
                )

            [targs1] => Array
                (
                )

            [goldcost] => 70
            [weapsOn] => 1
            [dice1] => 1
            [Missilespeed] => 3000
            [moveHeight] => 70
            [file] => Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
            [atkType1] => normal
            [modelScale] => 0.4
            [weapTp1] => missile
            [acquire] => 800
            [rangeN1] => 2000
            [upgrades] => Array
                (
                )

            [cool1] => 1
            [Ubertip] => A common grave of a fallen storm warrior, whose wrath outlasts its death and still seeks for revenge.
            [abilList] => @@0@@
            [launchZ] => 0
            [Name] => Rotted Flashing Grave
            [Art] => ReplaceableTextures\CommandButtons\BTNManaFlare.blp
            [buildingShadow] => Array
                (
                )

            [unitSound] => GryphonAviary
            [sides1] => 1
            [auto] => Array
                (
                )

            [dmgplus1] => 35
            [bldtm] => 1
        )

    [settings] => Array
        (
            [author] => Natac
            [element] => storm
            [authorDisplay] => Natac
            [alpha] => 255
            [balanceTip] => |cffFFFF00+10% |rdmg to magical (|cffFFFF00+1%|r/lvl)
            [rarity] => common
            [version] => 1.0
            [abil_factor] => 1.04
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -1.12397
                    [y] => -0.355131
                    [z] => -6.4
                    [scale] => 0.8
                    [rot] => 3.33376
                    [file] => Doodads\Underground\Props\GCracks\GCracks3.mdl
                    [red] => 1
                    [green] => 1
                    [blue] => 1
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [1] => Array
                (
                    [x] => 34.2556
                    [y] => -34.2068
                    [z] => -12.8
                    [scale] => 0.3
                    [rot] => 2.3562
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.55
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

        )

    [dmgTable] => Array
        (
            [0] => Array
                (
                    [id] => MOD_DMG_TO_MAGIC
                    [base] => 0.1
                    [add] => 0.01
                )

        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => Header
                    [code] => 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
                    [values] => Array
                        (
                            [icon] => 
                            [visible] => false
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [1] => Array
                (
                    [name] => Tower Aura
                    [code] => Array
                        (
                        )

                    [values] => Array
                        (
                            [icon] => ReplaceableTextures\CommandButtons\BTNMonsoon.blp
                            [visible] => true
                            [AURA_auraEffect] => natac_flashingGraveRandomTarget_BuffType
                            [AURA_power] => 1
                            [AURA_level] => 1
                            [long_explain] => 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.
                            [AURA_auraRange] => 0
                            [AURA_targetType] => TARGET_TYPE_PLAYER_TOWERS + TARGET_TYPE_ELEMENT_STORM
                            [AURA_levelAdd] => 0
                            [AURA_powerAdd] => 0
                            [name] => Wrath of the Storm
                            [AURA_targetSelf] => true
                            [short_explain] => The tower attacks only random.
                        )

                )

        )

    [abilities] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => Alit
                    [oeValues] => Array
                        (
                            [Name] => Lightning Attack
                            [Art] => ReplaceableTextures\CommandButtons\BTNChainLightning.blp
                            [Unubertip] => -HIDE-
                        )

                )

        )

    [buffs] => Array
        (
        )

    [units] => Array
        (
        )

    [references] => Array
        (
            [0] => Array
                (
                    [export] => true
                    [category] => global
                    [typ] => BuffType
                    [name] => natac_flashingGraveRandomTarget_BuffType
                )

        )

)