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

            [splashTargs1] => ground,enemies,air
            [targs1] => ground,enemies
            [goldcost] => 3400
            [weapsOn] => 1
            [Hfact1] => 0.75
            [dice1] => 1
            [Missilespeed] => 700
            [impactZ] => 0
            [file] => Doodads\Ruins\Props\DalaranVioletCitadelRuin\DalaranVioletCitadelRuin.mdl
            [Harea1] => 500
            [atkType1] => chaos
            [modelScale] => 0.3
            [weapTp1] => msplash
            [Missilearc] => 1.56
            [acquire] => 2400
            [rangeN1] => 2400
            [upgrades] => Array
                (
                )

            [cool1] => 10
            [Ubertip] => Pure manmade destruction.
            [Farea1] => 400
            [propWin] => 180
            [abilList] => Array
                (
                )

            [Qarea1] => 600
            [launchZ] => 310
            [Name] => Nuclear Missile Launcher
            [Missileart] => Abilities\Spells\Other\TinkerRocket\TinkerRocketMissile.mdl
            [Art] => ReplaceableTextures\CommandButtons\BTNSelfDestruct.blp
            [buildingShadow] => Array
                (
                )

            [unitSound] => TidalGuardian
            [Qfact1] => 0.5
            [sides1] => 2
            [auto] => Array
                (
                )

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

    [settings] => Array
        (
            [author] => Natac
            [element] => iron
            [authorDisplay] => Natac
            [alpha] => 255
            [balanceTip] => |cffFF0000Attacks GROUND only|r|n|cffCCFF00Splash attack:|n   |cffFFFF00400|r AoE: |cff00FF00100%|r damage|r|n   |cffFFFF00500|r AoE: |cffFFFF0075%|r damage|r|n   |cffFFFF00600|r AoE: |cffFF800050%|r damage|r
            [rarity] => unique
            [version] => 1.0
            [abil_factor] => 1.0
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -0.432268
                    [y] => 7.1288
                    [z] => 102.4
                    [scale] => 0.3
                    [rot] => 5.51524
                    [file] => Doodads\Ruins\Props\DalaranRuinTower2\DalaranRuinTower2.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [1] => Array
                (
                    [x] => -2.48551
                    [y] => 8.8434
                    [z] => 307.2
                    [scale] => 0.35
                    [rot] => 3.83973
                    [file] => Buildings\Other\BarrelsUnit0\BarrelsUnit0.mdl
                    [red] => 1
                    [green] => 1
                    [blue] => 1
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [2] => Array
                (
                    [x] => -9.94661
                    [y] => -10.4381
                    [z] => 6.4
                    [scale] => 0.35
                    [rot] => 4.69514
                    [file] => Doodads\Ruins\Props\DalaranRuinTwoBases\DalaranRuinTwoBases0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => true
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 1
                )

            [3] => Array
                (
                    [x] => 42.4107
                    [y] => -38.658
                    [z] => 0
                    [scale] => 0.6
                    [rot] => 2.3562
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [4] => Array
                (
                    [x] => 44.5155
                    [y] => 45.2414
                    [z] => 0
                    [scale] => 0.6
                    [rot] => 3.92699
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [5] => Array
                (
                    [x] => -42.8179
                    [y] => 42.7651
                    [z] => 0
                    [scale] => 0.6
                    [rot] => 5.49779
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [6] => Array
                (
                    [x] => -12.8762
                    [y] => 19.6443
                    [z] => 76.8
                    [scale] => 0.3
                    [rot] => 4.42171
                    [file] => Doodads\Dungeon\Props\SewerWallpipes\SewerWallpipes2.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -1.56
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [7] => Array
                (
                    [x] => -2.85636
                    [y] => 14.6253
                    [z] => 76.8
                    [scale] => 0.3
                    [rot] => 4.42171
                    [file] => Doodads\Dungeon\Props\SewerWallpipes\SewerWallpipes2.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -1.56
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [8] => Array
                (
                    [x] => -30.6164
                    [y] => -29.123
                    [z] => 44.8
                    [scale] => 0.48
                    [rot] => 3.49066
                    [file] => Doodads\Outland\Props\Grate\Grate1.mdl
                    [red] => 1
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [9] => Array
                (
                    [x] => -30.0996
                    [y] => -27.8666
                    [z] => 64
                    [scale] => 0.3
                    [rot] => 0.767945
                    [file] => Abilities\Weapons\ShadowHunterMissile\ShadowHunterMissile.mdl
                    [red] => 200
                    [green] => 200
                    [blue] => 200
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [10] => Array
                (
                    [x] => 20.088
                    [y] => 22.1074
                    [z] => 44.8
                    [scale] => 0.5
                    [rot] => 6.17584
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent2.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [11] => Array
                (
                    [x] => 16.0249
                    [y] => 39.7765
                    [z] => 0
                    [scale] => 0.7
                    [rot] => 4.27195
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [12] => Array
                (
                    [x] => 15.2823
                    [y] => 38.3706
                    [z] => 38.4
                    [scale] => 0.7
                    [rot] => 4.15344
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [13] => Array
                (
                    [x] => -2.40346
                    [y] => 43.1749
                    [z] => 0
                    [scale] => 0.7
                    [rot] => 5.03204
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [14] => Array
                (
                    [x] => -1.86969
                    [y] => 41.1106
                    [z] => 38.4
                    [scale] => 0.7
                    [rot] => 4.80112
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [15] => Array
                (
                    [x] => 49.0931
                    [y] => 12.7679
                    [z] => 64
                    [scale] => 0.3
                    [rot] => 2.89253
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [16] => Array
                (
                    [x] => 37.6561
                    [y] => 35.4297
                    [z] => 44.8
                    [scale] => 0.3
                    [rot] => 5.22824
                    [file] => Doodads\Dungeon\Props\SewerWallpipes\SewerWallpipes2.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -1.56
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [17] => Array
                (
                    [x] => 42.0879
                    [y] => -4.79818
                    [z] => -25.6
                    [scale] => 1.15
                    [rot] => 0
                    [file] => Abilities\Spells\NightElf\Tranquility\TranquilityTarget.mdl
                    [red] => 150
                    [green] => 150
                    [blue] => 150
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [18] => Array
                (
                    [x] => -18.2941
                    [y] => 40.4318
                    [z] => 0
                    [scale] => 0.7
                    [rot] => 5.35456
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [19] => Array
                (
                    [x] => -17.9417
                    [y] => 38.9511
                    [z] => 38.4
                    [scale] => 0.7
                    [rot] => 5.14048
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [20] => Array
                (
                    [x] => 18.1252
                    [y] => 7.7875
                    [z] => 134.4
                    [scale] => 0.3
                    [rot] => 4.21514
                    [file] => Doodads\Dungeon\Props\SewerWallpipes\SewerWallpipes2.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -1.56
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [21] => Array
                (
                    [x] => 19.6403
                    [y] => 7.31481
                    [z] => 185.6
                    [scale] => 0.3
                    [rot] => 4.21514
                    [file] => Doodads\Dungeon\Props\SewerWallpipes\SewerWallpipes2.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -1.56
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [22] => Array
                (
                    [x] => 6.72132
                    [y] => -15.6474
                    [z] => 204.8
                    [scale] => 0.3
                    [rot] => 1.9805
                    [file] => Doodads\Dungeon\Props\SewerVent\SewerVent0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

        )

    [dmgTable] => Array
        (
        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Tower Creation
                    [code] => call natac_cooldownBar_BuffType.apply(tower, tower, 1)
                    [values] => Array
                        (
                            [icon] => 
                            [visible] => false
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [1] => Array
                (
                    [name] => On Damage
                    [code] => local Unit     target     = Event.getTarget()
    local Buff     targetBuff
    local Effect   targetEffect
    
    if(Event.isMainTarget()) then
        set  targetEffect = Effect.createAnimatedScaled("Abilities\\Weapons\\Mortar\\MortarMissile.mdl",target.getX(),target.getY(),0.0,0,3.0)
        call targetEffect.setAnimationSpeed(0.5)
        call targetEffect.setLifetime(0.05)
        
        set targetBuff = target.getBuffOfType(natac_LauncherTarget_Buff)
        if(targetBuff != 0 and targetBuff.userInt <= 0) then
            call  targetBuff.removeBuff()
        else
            set targetBuff.userInt = targetBuff.userInt - 1 
        endif
    endif
    call  SFXOnUnit("Abilities\\Spells\\Other\\AcidBomb\\BottleMissile.mdl", target.getUnit(), "origin")
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 1.0
                            [icon] => 
                            [visible] => false
                            [name] => 
                            [short_explain] => 
                            [ONDAMAGE_chanceLevelAdd] => 0.0
                            [long_explain] => 
                        )

                )

            [2] => Array
                (
                    [name] => Header
                    [code] => globals
        BuffType natac_LauncherTarget_Buff
        
        //@export
        BuffType natac_cooldownBar_BuffType //COOLDOWN BAR: Buff
        
        //COOLDOWN BAR: Globals 
        hashtable natac_cooldown_map = InitHashtable()
        
        string  BAR_TEXT = "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" // x 60
        integer TIMER        = 0
        integer TEXT_TAG     = 1
        integer BAR          = 2
        integer CURRENT_STEP = 3
        integer TIMER_PERIOD = 4
        // COOLDOWN BAR: End Globals
    endglobals
    
    // === COOLDOWN BAR: Code ===
    // Used to have a cool bar that is showing the time left until the towers cooldown is ready.
    // This function decreases the bar every time a step is over (=the timer expires)
    function oneStepDone takes nothing returns nothing
        local timer   stepTimer   = GetExpiredTimer() 
        local integer stepTimerId = GetHandleId(stepTimer) // The timers id, needed for the hash map
        local texttag bar         = LoadTextTagHandle(natac_cooldown_map, stepTimerId, BAR) // Get the floating text ifself
        local integer currentStep = LoadInteger(natac_cooldown_map, stepTimerId, CURRENT_STEP) + 1 
        local real    colorFactor = currentStep * 0.033 // This factor is used to change the red and green of the bar
        
        if(currentStep < 30) then // Time left: shorten the bar
            call SetTextTagText(bar, SubString(BAR_TEXT, 0, R2I(60-(currentStep*2))), 0.023) // Shorten bar
            call SetTextTagColor(bar, IMinBJ(R2I((1-colorFactor)*510),255), IMinBJ(R2I(colorFactor*510),255), 0, 170) // Fade bar color from red to green
            call SaveInteger(natac_cooldown_map, stepTimerId, CURRENT_STEP, currentStep) // Increase step count
            call TimerStart(stepTimer, LoadReal(natac_cooldown_map, stepTimerId, TIMER_PERIOD), false, function oneStepDone) // Start timer again
        else // Cooldown is ready: Clean up
            call DestroyTextTag(bar)
            call ReleaseTimer(stepTimer)
            
            call RemoveSavedHandle(natac_cooldown_map, stepTimerId, BAR) 
            call RemoveSavedInteger(natac_cooldown_map, stepTimerId, CURRENT_STEP)
            call RemoveSavedReal(natac_cooldown_map, stepTimerId, TIMER_PERIOD)
        endif
        set stepTimer = null
        set bar = null
    endfunction
    
    // Used to have a cool bar that is showing the time left until the towers cooldown is ready.
    // This function shows the bar and starts the timer for the first step
    function onAttack_StartFirstSequence takes Buff b returns nothing
        local texttag bar         = CreateTextTag() // This becomes the bar
        local timer   stepTimer   = NewTimer()   // A timer, expiring everytime the next step will be done
        local integer stepTimerId = GetHandleId(stepTimer)
        local Tower   tower       = b.getBuffedUnit()
        local real    stepPeriod  = tower.getCurrentAttackspeed() / 30 // The time between 2 steps
        local real    offset      = 60 * 0.45 // The offset to center the bar above the unit
    
        call SetTextTagText(bar, BAR_TEXT, 0.023)
        call SetTextTagPermanent(bar, false)
        call SetTextTagColor(bar, 255, 0, 0, 170) // Create bar with some transparency
        call SetTextTagPos(bar, tower.getX()-offset, tower.getY(), 150) // Center bar above the unit
    
        call SaveTextTagHandle(natac_cooldown_map, stepTimerId, BAR, bar) // Store the bar itself
        call SaveInteger(natac_cooldown_map, stepTimerId, CURRENT_STEP, 0) // Store the current step (we start here, so its 0)
        call SaveReal(natac_cooldown_map, stepTimerId, TIMER_PERIOD, stepPeriod) // Store the time between 2 steps
    
        call TimerStart(stepTimer, stepPeriod, false, function oneStepDone) // Start timer
        set bar = null
        set stepTimer = null
    endfunction
    // === COOLDOWN BAR: End Code ===
    
    
    
    // === Nuclear Missle Launcher - Code ===
    function initalizeTargetCounter takes Buff b returns nothing
        set b.userInt = 0
    endfunction
    
    function increaseTargetCounter takes Buff b returns nothing
        set b.userInt = b.userInt + 1
    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_LauncherTarget_Buff = BuffType.create(-1.0, 0.0, false)
        call natac_LauncherTarget_Buff.setBuffIcon('@@0@@')
        call natac_LauncherTarget_Buff.addEventOnCreate(EventHandler.initalizeTargetCounter)
        call natac_LauncherTarget_Buff.setEventOnRefresh(EventHandler.increaseTargetCounter)
        
        // COOLDOWN BAR: Initialize Buff
        set  natac_cooldownBar_BuffType = BuffType.create(-1.0, 0, true)
        call natac_cooldownBar_BuffType.addEventOnAttack(EventHandler.onAttack_StartFirstSequence, 1.0, 0.0)
        // COOLDOWN BAR: End Initialize Buff
	endfunction
                    [values] => Array
                        (
                            [icon] => 
                            [visible] => false
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [3] => Array
                (
                    [name] => On Attack
                    [code] => call natac_LauncherTarget_Buff.apply(tower, Event.getTarget(), tower.getLevel())
                    [values] => Array
                        (
                            [icon] => 
                            [visible] => false
                            [name] => 
                            [short_explain] => 
                            [ONATTACK_chance] => 1.0
                            [ONATTACK_chanceLevelAdd] => 0.0
                            [long_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => BHfs
                    [oeValues] => Array
                        (
                            [Bufftip] => Launcher Target
                            [Targetattach] => origin
                            [Buffubertip] => This unit is targeted by a Nuclear Missle Launcher.
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNSelfDestruct.blp
                            [TargetArt] => Abilities\Spells\Orc\CommandAura\CommandAuraTarget.mdl
                        )

                )

        )

    [units] => Array
        (
        )

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

        )

)