Array
(
    [scriptVersion] => 8
    [oeValues] => Array
        (
            [auto] => Array
                (
                )

            [Art] => ReplaceableTextures\CommandButtons\BTNStaffOfNegation.blp
            [turnRate] => 3
            [dmgplus1] => 49
            [bldtm] => 1
            [goldcost] => 150
            [unitSound] => Sorceress
            [sides1] => 1
            [manaN] => 100
            [acquire] => 1100
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Storm Seer Initiate
            [weapTp1] => missile
            [impactZ] => 60
            [file] => units\human\Sorceress\Sorceress_V1.mdl
            [MissileHoming] => 1
            [Missilespeed] => 1350
            [Missileart] => Abilities\Spells\Other\ForkedLightning\ForkedLightningTarget.mdl
            [dice1] => 1
            [RngBuff1] => 250
            [regenMana] => 2
            [modelScale] => 0.65
            [rangeN1] => 1100
            [propWin] => 10
            [atkType1] => normal
            [cool1] => 1.75
            [Ubertip] => Having already decided the fate of her enemies, she intends to carry out their sentence personally.
            [scaleBull] => 0
            [abilList] => Array
                (
                )

            [moveHeight] => 20
            [buildingShadow] => Array
                (
                )

            [targs1] => Array
                (
                )

            [weapsOn] => 1
            [teamColor] => 9
        )

    [settings] => Array
        (
            [balanceTip] => Array
                (
                )

            [abil_factor] => 0.2
            [author] => Ashbringer
            [alpha] => 255
            [authorDisplay] => |cffff6600Ashbringer|r
            [version] => 1.0
            [element] => storm
            [rarity] => uncommon
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -0.19777
                    [y] => -0.123517
                    [z] => -19.2
                    [scale] => 1.55
                    [rot] => 4.60767
                    [file] => war3mapImported\GeneralAuraTargetWhite.mdl
                    [red] => 75
                    [green] => 75
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [1] => Array
                (
                    [x] => -25.0098
                    [y] => 0.46705
                    [z] => -6.4
                    [scale] => 0.1
                    [rot] => 0.000000119209
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -1.12
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [2] => Array
                (
                    [x] => 24.6707
                    [y] => -0.378239
                    [z] => -6.4
                    [scale] => 0.1
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -1.12
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [3] => Array
                (
                    [x] => -0.522618
                    [y] => -24.7946
                    [z] => -6.4
                    [scale] => 0.1
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -1.12
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [4] => Array
                (
                    [x] => 0.322672
                    [y] => 24.8859
                    [z] => -6.4
                    [scale] => 0.1
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -1.12
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [5] => Array
                (
                    [x] => -0.0233571
                    [y] => 0.0728167
                    [z] => 6.4
                    [scale] => 0.6
                    [rot] => 3.47321
                    [file] => Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
                    [red] => 85
                    [green] => 85
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [6] => Array
                (
                    [x] => -0.152735
                    [y] => -0.445176
                    [z] => 0.000000953674
                    [scale] => 0.9
                    [rot] => 5.42798
                    [file] => war3mapImported\GeneralAuraTargetWhite.mdl
                    [red] => 75
                    [green] => 75
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [7] => Array
                (
                    [x] => 0.101613
                    [y] => 0.753537
                    [z] => -12.8
                    [scale] => 0.4
                    [rot] => 5.49779
                    [file] => Doodads\Cityscape\Props\Throne\Throne.mdl
                    [red] => 1
                    [green] => 55
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => -1.4
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [8] => Array
                (
                    [x] => -0.253259
                    [y] => -0.325721
                    [z] => 38.4
                    [scale] => 0.4
                    [rot] => 4.66003
                    [file] => Abilities\Spells\Orc\LightningShield\LightningShieldTarget.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -3.14
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [9] => Array
                (
                    [x] => -0.48939
                    [y] => 0.282804
                    [z] => -12.8
                    [scale] => 0.4
                    [rot] => 2.3562
                    [file] => Doodads\Cityscape\Props\Throne\Throne.mdl
                    [red] => 1
                    [green] => 55
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => -1.4
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [10] => Array
                (
                    [x] => -0.0796918
                    [y] => 0.0271883
                    [z] => -12.8
                    [scale] => 0.4
                    [rot] => 0.785398
                    [file] => Doodads\Cityscape\Props\Throne\Throne.mdl
                    [red] => 1
                    [green] => 55
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => -1.4
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [11] => Array
                (
                    [x] => 0.391057
                    [y] => -0.56383
                    [z] => -12.8
                    [scale] => 0.4
                    [rot] => 3.92699
                    [file] => Doodads\Cityscape\Props\Throne\Throne.mdl
                    [red] => 1
                    [green] => 55
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => -1.4
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                    [pcolor] => 255
                )

        )

    [dmgTable] => Array
        (
        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Level Up
                    [code] => set tower.userReal = 10 + (tower.getLevel() * 0.4)
    set tower.userReal2 = 100 + (tower.getLevel() * 4)
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [1] => Array
                (
                    [name] => Header
                    [code] => globals
        //@export
        BuffType ashbringer_stormbrand_buff
        //@export
        BuffType ashbringer_electrocution_aura
        BuffType ashbringer_electrocution_buff
    endglobals
    
    function ashbringer_electrocution_detonate takes Tower tower, Unit target, real damage returns nothing
        call tower.doSpellDamage(target, damage, tower.calcSpellCritNoBonus())
        call Effect.createSimpleOnUnit("war3mapImported\\DemonBoltImpactBlue.mdx", target, "origin").setLifetime(1)
    endfunction
    
    function ashbringer_electrocution_apply takes Tower tower, Unit target, real hit, real damage returns nothing
        local Buff b = target.getBuffOfType(ashbringer_electrocution_buff)
        
        if not target.isImmune() then
            if b != 0 then
                set b.userReal = b.userReal +  damage
            else
                set b = ashbringer_electrocution_buff.apply(tower, target, 0)
                set b.userReal = damage
            endif
            
            if (GetWidgetLife(target.getUnit()) - hit) / GetUnitState(target.getUnit(), UNIT_STATE_MAX_LIFE) <= 0.2 then
                call ashbringer_electrocution_detonate(tower, target, b.userReal)
            endif
        endif
    endfunction
    
    function ashbringer_electrocution_hit takes Buff b returns nothing
        local Tower tower = b.getCaster()
        local Tower attacker = b.getBuffedUnit()
        local Creep target = Event.getTarget()
        
        call ashbringer_electrocution_apply(tower, target, Event.damage * (1 - target.getCurrentArmorDamageReduction()), tower.userReal * attacker.getBaseAttackspeed() * (1100 / attacker.getRange()))
    endfunction
    
    function ashbringer_electrocution_ondamaged takes Buff b returns nothing
        local Tower tower = b.getCaster()
        local Unit target = Event.getTarget()
        
        if b.userReal > 0 then
            if (GetWidgetLife(target.getUnit())-Event.damage) / GetUnitState(target.getUnit(), UNIT_STATE_MAX_LIFE) > 0.2 then
                call ashbringer_electrocution_detonate(tower, target, b.userReal)
            endif
        endif
    endfunction
    
    function ashbringer_electrocution_periodic takes Buff b returns nothing
        local Tower tower = b.getCaster()
        local Unit target = Event.getTarget()
        
        if b.userReal > 0 then
            if GetWidgetLife(target.getUnit()) / GetUnitState(target.getUnit(), UNIT_STATE_MAX_LIFE) > 0.2 then
                call ashbringer_electrocution_detonate(tower, target, b.userReal)
            endif
        endif
    endfunction
    
    function ashbringer_stormbrand_periodic takes Buff b returns nothing
        local Tower tower = b.getCaster()
        local Unit target = b.getBuffedUnit()
        
        call tower.doSpellDamage(target, tower.userReal2, tower.calcSpellCritNoBonus())
        
        call ashbringer_electrocution_apply(tower, target, tower.userReal2, tower.userReal2)
    endfunction
    
    function ashbringer_stormbrand_ondeath takes Buff b returns nothing
        local Tower tower = b.getCaster()
        local Unit target = b.getBuffedUnit()
        local Iterate i
        local Unit next
        local Unit closest = 0
        local real x = target.getX()
        local real y = target.getY()
        local real distance
        local real closest_distance = 1000
        
        if b.getRemainingDuration() >= 1.0 then
            set i = Iterate.overUnitsInRangeOfUnit(tower, TARGET_TYPE_CREEPS, target, 450)
            loop
                set next = i.next()
                exitwhen next == 0
                if next != target and next.getBuffOfType(ashbringer_stormbrand_buff) == 0 then
                    set distance = DistanceBetweenPoints(Location(x, y), Location(next.getX(), next.getY()))
                    if distance < closest_distance then
                        set closest = next
                        set closest_distance = distance
                    endif
                endif
            endloop
            
            if closest != 0 then
                 call ashbringer_stormbrand_buff.apply(tower, closest, tower.getLevel()).setRemainingDuration(b.getRemainingDuration())
            endif
        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 mod = Modifier.create()
        
        set ashbringer_electrocution_aura = BuffType.createAuraEffectType(true)
        call ashbringer_electrocution_aura.setBuffIcon('@@0@@')
        call ashbringer_electrocution_aura.addEventOnDamage(EventHandler.ashbringer_electrocution_hit, 1.0, 0.0)
        
        set ashbringer_electrocution_buff = BuffType.createAuraEffectType(false)
        call ashbringer_electrocution_buff.setBuffIcon('@@2@@')
        //call ashbringer_electrocution_buff.addEventOnDamaged(EventHandler.ashbringer_electrocution_ondamaged, 1.0, 0.0)
        call ashbringer_electrocution_buff.addPeriodicEvent(EventHandler.ashbringer_electrocution_periodic, 1.0)
        
        set ashbringer_stormbrand_buff = BuffType.create(10+0.1, 0, false)
        call ashbringer_stormbrand_buff.setBuffIcon('@@1@@')
        call ashbringer_stormbrand_buff.addPeriodicEvent(EventHandler.ashbringer_stormbrand_periodic, 1.0)
        call ashbringer_stormbrand_buff.addEventOnDeath(EventHandler.ashbringer_stormbrand_ondeath)
    endfunction
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

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

                    [values] => Array
                        (
                            [AURA_powerAdd] => 1
                            [visible] => true
                            [AURA_auraEffect] => ashbringer_electrocution_aura
                            [AURA_levelAdd] => 1
                            [AURA_power] => 0
                            [icon] => ReplaceableTextures\CommandButtons\BTNStaticShock.blp
                            [AURA_targetType] => TARGET_TYPE_TOWERS + TARGET_TYPE_ELEMENT_STORM
                            [long_explain] => |cFF8080FFStorm|r towers within |cffFFFF80200|r range charge enemies on attack, storing |cffFFFF8010|r attack speed and range adjusted spell damage on the target. The stored damage is dealt when a target's life goes below |cffFFFF8020%|r.|n|nAdditionally, damage dealt by Storm Brand is added to this effect.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+10|r spell damage
                            [AURA_targetSelf] => true
                            [name] => Aura of Electrocution
                            [AURA_level] => 0
                            [short_explain] => Nearby |cFF8080FFStorm|r towers apply a stacking charge on attack, which detonates when the target reaches low health.
                            [AURA_auraRange] => 200
                        )

                )

            [3] => Array
                (
                    [name] => Autocast
                    [code] => Array
                        (
                        )

                    [values] => Array
                        (
                            [AUTOCAST_cooldown] => 2
                            [AUTOCAST_autoRange] => 900
                            [AUTOCAST_manacost] => 50
                            [icon] => ReplaceableTextures\CommandButtons\BTNSRUnrelentningStorm.blp
                            [AUTOCAST_range] => 900
                            [AUTOCAST_targetType] => TARGET_TYPE_CREEPS
                            [AUTOCAST_numBuffsBeforeIdle] => 1
                            [caster_art] => 
                            [long_explain] => Apply a brand which deals |cffFFFF80100|r spell damage every second to the target for |cffFFFF8010|r seconds. If the target dies, the brand will jump to the closest nearby enemy in |cffFFFF80450|r range.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+4|r spell damage
                            [target_art] => 
                            [AUTOCAST_autocastType] => AC_TYPE_OFFENSIVE_BUFF
                            [AUTOCAST_buffType] => ashbringer_stormbrand_buff
                            [AUTOCAST_isExtended] => false
                            [name] => Storm Brand
                            [AUTOCAST_targetSelf] => false
                            [short_explain] => Deals spell damage every second to the target and nearby enemies for a duration.
                        )

                )

            [4] => Array
                (
                    [name] => On Tower Creation
                    [code] => call SetUnitColor(tower.getUnit(), ConvertPlayerColor(9))
    
    set tower.userInt = 0
    set tower.userReal = 10 + (tower.getLevel() * 0.4)
    set tower.userReal2 = 100 + (tower.getLevel() * 4)
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => BNrd
                    [oeValues] => Array
                        (
                            [Buffubertip] => Dealing additional spell damage to enemies at low health.
                            [TargetArt] => Array
                                (
                                )

                            [Bufftip] => Aura of Electrocution
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNStaticShock.blp
                        )

                )

            [1] => Array
                (
                    [id] => @@1@@
                    [derivedFrom] => BNrd
                    [oeValues] => Array
                        (
                            [Targetattach] => chest
                            [Buffubertip] => Taking spell damage over time.
                            [TargetArt] => Abilities\Spells\Orc\LightningShield\LightningShieldTarget.mdl
                            [Targetattachcount] => 1
                            [Bufftip] => Storm Brand
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNSRUnrelentningStorm.blp
                        )

                )

            [2] => Array
                (
                    [id] => @@2@@
                    [derivedFrom] => BNrd
                    [oeValues] => Array
                        (
                            [Buffubertip] => Will take spell damage at low health.
                            [TargetArt] => Array
                                (
                                )

                            [Bufftip] => Electrocution Sentence
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNStaticShock.blp
                        )

                )

        )

    [units] => Array
        (
        )

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

            [1] => Array
                (
                    [export] => true
                    [category] => global
                    [typ] => BuffType
                    [name] => ashbringer_electrocution_aura
                )

        )

    [lightning] => Array
        (
        )

)