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

            [Art] => ReplaceableTextures\CommandButtons\BTNStaticShock.blp
            [dmgplus1] => 21779
            [bldtm] => 1
            [goldcost] => 5000
            [sides1] => 1
            [launchZ] => 166
            [acquire] => 1200
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Tesla Coil
            [weapTp1] => missile
            [MissileHoming] => 1
            [file] => .mdl
            [Missilespeed] => 4000
            [dice1] => 1
            [RngBuff1] => 250
            [modelScale] => 0.1
            [rangeN1] => 1200
            [atkType1] => normal
            [cool1] => 5
            [Ubertip] => The engineers warned what would happen when power had no ceiling.
            [scaleBull] => 0
            [abilList] => Array
                (
                )

            [buildingShadow] => Array
                (
                )

            [targs1] => Array
                (
                )

            [weapsOn] => 1
        )

    [settings] => Array
        (
            [balanceTip] => |cffFFFF00+3% |rattack speed/lvl|n|cffFFFF00+8% |rdamage/lvl
            [abil_factor] => 0.7
            [author] => Ashbringer
            [alpha] => 255
            [authorDisplay] => |c00FF6600Ashbringer|r
            [version] => 1.0
            [element] => iron
            [rarity] => unique
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -0.847444
                    [y] => -24.3896
                    [z] => 25.6
                    [scale] => 0.155
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 75
                    [green] => 75
                    [blue] => 85
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [1] => Array
                (
                    [x] => 15.5924
                    [y] => -0.0428402
                    [z] => -12.8
                    [scale] => 0.55
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 65
                    [green] => 55
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => -0.1
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [2] => Array
                (
                    [x] => -0.549865
                    [y] => -18.9217
                    [z] => 70.4
                    [scale] => 0.125
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 75
                    [green] => 75
                    [blue] => 85
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [3] => Array
                (
                    [x] => -0.0757025
                    [y] => -15.2639
                    [z] => -12.8
                    [scale] => 0.55
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 65
                    [green] => 55
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => -0.1
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [4] => Array
                (
                    [x] => 0.535584
                    [y] => 19.0837
                    [z] => 70.4
                    [scale] => 0.125
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 75
                    [green] => 75
                    [blue] => 85
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [5] => Array
                (
                    [x] => 0.0514519
                    [y] => 15.4162
                    [z] => -12.8
                    [scale] => 0.55
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 65
                    [green] => 55
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => -0.1
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [6] => Array
                (
                    [x] => -13.3989
                    [y] => -0.00500449
                    [z] => -12.8
                    [scale] => 0.55
                    [rot] => 0
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 65
                    [green] => 55
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => -0.1
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [7] => Array
                (
                    [x] => -0.258195
                    [y] => 36.4911
                    [z] => 0
                    [scale] => 0.9
                    [rot] => 4.71239
                    [file] => Abilities\Spells\Orc\Purge\PurgeBuffTarget.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [8] => Array
                (
                    [x] => 23.8439
                    [y] => 24.0508
                    [z] => -38.4
                    [scale] => 0.525
                    [rot] => 3.92699
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 85
                    [green] => 75
                    [blue] => 75
                    [alpha] => 255
                    [pitch] => -0.24
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [9] => Array
                (
                    [x] => -19.0785
                    [y] => 0.0141736
                    [z] => 70.4
                    [scale] => 0.125
                    [rot] => 0.000000238419
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 75
                    [green] => 75
                    [blue] => 85
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [10] => Array
                (
                    [x] => 18.927
                    [y] => -1.07126
                    [z] => 70.4
                    [scale] => 0.125
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 75
                    [green] => 75
                    [blue] => 85
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [11] => Array
                (
                    [x] => 0.581328
                    [y] => 24.1913
                    [z] => 25.6
                    [scale] => 0.155
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 75
                    [green] => 75
                    [blue] => 85
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [12] => Array
                (
                    [x] => 24.3771
                    [y] => -0.821423
                    [z] => 25.6
                    [scale] => 0.155
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 75
                    [green] => 75
                    [blue] => 85
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [13] => Array
                (
                    [x] => -24.2038
                    [y] => 0.607318
                    [z] => 25.6
                    [scale] => 0.155
                    [rot] => 0.000000119209
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 75
                    [green] => 75
                    [blue] => 85
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [14] => Array
                (
                    [x] => -0.221889
                    [y] => -14.3371
                    [z] => 115.2
                    [scale] => 0.095
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 75
                    [green] => 75
                    [blue] => 85
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [15] => Array
                (
                    [x] => 0.595097
                    [y] => 13.9423
                    [z] => 115.2
                    [scale] => 0.095
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 75
                    [green] => 75
                    [blue] => 85
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [16] => Array
                (
                    [x] => -0.0998538
                    [y] => -0.00168491
                    [z] => 0
                    [scale] => 0.325
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Props\FountainRuined\FountainRuined.mdl
                    [red] => 155
                    [green] => 1
                    [blue] => 1
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [17] => Array
                (
                    [x] => -14.4337
                    [y] => -0.294783
                    [z] => 115.2
                    [scale] => 0.095
                    [rot] => 0.000000238419
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 75
                    [green] => 75
                    [blue] => 85
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [18] => Array
                (
                    [x] => 13.8458
                    [y] => -1.11175
                    [z] => 115.2
                    [scale] => 0.095
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\Archway1\Archway1.mdl
                    [red] => 75
                    [green] => 75
                    [blue] => 85
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [19] => Array
                (
                    [x] => -0.0402334
                    [y] => 0.0771465
                    [z] => 166.4
                    [scale] => 2.25
                    [rot] => 4.71239
                    [file] => war3mapImported\BoatMissileMod.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [20] => Array
                (
                    [x] => -0.141368
                    [y] => 11.4507
                    [z] => 115.2
                    [scale] => 0.775
                    [rot] => 4.71239
                    [file] => Abilities\Spells\Orc\Purge\PurgeBuffTarget.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [21] => Array
                (
                    [x] => -24.1467
                    [y] => -23.6283
                    [z] => -38.4
                    [scale] => 0.525
                    [rot] => 0.785398
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 85
                    [green] => 75
                    [blue] => 75
                    [alpha] => 255
                    [pitch] => -0.24
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [22] => Array
                (
                    [x] => 24.3374
                    [y] => -24.6486
                    [z] => -38.4
                    [scale] => 0.525
                    [rot] => 2.3562
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 85
                    [green] => 75
                    [blue] => 75
                    [alpha] => 255
                    [pitch] => -0.24
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [23] => Array
                (
                    [x] => -23.9188
                    [y] => 24.0084
                    [z] => -38.4
                    [scale] => 0.525
                    [rot] => 5.49779
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 85
                    [green] => 75
                    [blue] => 75
                    [alpha] => 255
                    [pitch] => -0.24
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

        )

    [dmgTable] => Array
        (
            [0] => Array
                (
                    [id] => MOD_ATTACKSPEED
                    [base] => 0
                    [add] => 0.03
                )

            [1] => Array
                (
                    [id] => MOD_DAMAGE_BASE_PERC
                    [base] => 0
                    [add] => 0.08
                )

        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => Header
                    [code] => globals
        BuffType ashbringer_red_alert_neg
        BuffType ashbringer_red_alert_pos
    endglobals
    
    struct tesla
        Effect e1
        Effect e2
        Effect e3
        Effect e4
    
        method ashbringer_tesla_charge takes Tower tower returns nothing
            set tower.userInt = tower.userInt + 1
            set tower.userInt2 = tower.userInt2 + 1
            //call Effect.createScaled("Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl", tower.getX(), tower.getY()-20, 30, 0, 1.35).setLifetime(0.2)
            if tower.userInt == 1 then
                set .e1 = Effect.createScaled("Abilities\\Spells\\Orc\\LightningShield\\LightningShieldTarget.mdl", tower.getX(), tower.getY(), 108, 0, 1.27)
                call .e1.setPitch(180)
                call .e4.setScale(1.5)
            elseif tower.userInt == 2 then
                set .e2 = Effect.createScaled("Abilities\\Spells\\Orc\\LightningShield\\LightningShieldTarget.mdl", tower.getX(), tower.getY(), 134, 45, 1.03)
                call .e2.setPitch(180)
                call .e4.setScale(1.75)
            elseif tower.userInt == 3 then
                set .e3 = Effect.createScaled("Abilities\\Spells\\Orc\\LightningShield\\LightningShieldTarget.mdl", tower.getX(), tower.getY(), 160, 90, 0.76)
                call .e3.setPitch(180)
                call .e4.setScale(2.0)
            endif
        endmethod
    endstruct
    
    function ashbringer_tesla_chain takes Tower tower, Unit from, Unit previous, real chance, real damage, real loss returns nothing
        local Iterate i
        local Unit next
        local Unit closest = 0
        local real distance
        local real closest_distance = 0
        
        set i = Iterate.overUnitsInRangeOfUnit(tower, TARGET_TYPE_CREEPS, from, 750)
        loop
            set next = i.next()
            exitwhen next == 0
            if next != previous and next != from then
                set distance = DistanceBetweenPoints(GetUnitLoc(from.getUnit()), GetUnitLoc(next.getUnit()))
                if (closest_distance == 0 or distance < closest_distance) then
                    set closest_distance = distance
                    set closest = next
                endif
            endif
        endloop
        if closest != 0 then
            call Lightning.createFromUnitToUnit("ZAP1", from, closest).setLifetime(0.2)
            call Effect.createSimpleAtUnit("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", closest).setLifetime(1)
            call tower.doAttackDamage(closest, damage, tower.calcAttackMulticrit(0, 0, 0))
            if tower.calcChance(chance) then
                call ashbringer_tesla_chain(tower, closest, from, chance * loss, damage * loss, loss)
            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_red_alert_neg = BuffType.create(5, 0.2, false)
        call ashbringer_red_alert_neg.setBuffIcon('@@0@@')
        call mod.addModification(MOD_ATTACKSPEED, 0, -0.001)
        call ashbringer_red_alert_neg.setBuffModifier(mod)
        
        set mod = Modifier.create()
        set ashbringer_red_alert_pos = BuffType.create(5, 0.2, true)
        call ashbringer_red_alert_pos.setBuffIcon('@@0@@')
        call mod.addModification(MOD_ATTACKSPEED, 0, 0.001)
        call ashbringer_red_alert_pos.setBuffModifier(mod)
        call ashbringer_red_alert_pos.setSpecialEffectSimple("Abilities\\Spells\\Orc\\CommandAura\\CommandAura.mdl")
	endfunction
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNSRUnrelentningStorm.blp
                            [name] => Electrical Escalation
                            [short_explain] => While uncharged, attacks do no damage and charge the tower instead. Once fully charged, the next attack will do massive damage.
                            [long_explain] => If less than |cffFFFF803|r rings are charged, attacks will deal no damage and instead charge a ring. Once all |cffFFFF803|r rings are charged, the next attack will consume all charge to deal |cffFFFF804x|r damage.
                        )

                )

            [1] => Array
                (
                    [name] => On Tower Destruction
                    [code] => local tesla t = tower.userInt3
    
    if t.e1 != 0 then
        call t.e1.destroy()
    endif
    if t.e2 != 0 then
        call t.e2.destroy()
    endif
    if t.e3 != 0 then
        call t.e3.destroy()
    endif
    if t.e4 != 0 then
        call t.e4.destroy()
    endif
    
    call t.destroy()
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [2] => Array
                (
                    [name] => On Damage
                    [code] => local tesla t = tower.userInt3
    local Unit target = Event.getTarget()
    
    if tower.userInt < 3 then
        call t.ashbringer_tesla_charge(tower)
        set Event.damage = 0
    else
        if t.e1 != 0 then
            call t.e1.destroy()
        endif
        if t.e2 != 0 then
            call t.e2.destroy()
        endif
        if t.e3 != 0 then
            call t.e3.destroy()
        endif
        if t.e4 != 0 then
            call t.e4.destroy()
        endif
        set t.e4 = Effect.createScaled("Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl", tower.getX(), tower.getY(), 166, GetRandomReal(0, 359), 1.25)
        set tower.userInt = 0
        set Event.damage = Event.damage * tower.userInt2
        call Lightning.createFromPointToUnit("ZAP1", tower.getX(), tower.getY(), 166, target).setLifetime(0.2)
        call Effect.createSimpleAtUnit("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", target).setLifetime(1)
        call ashbringer_tesla_chain(tower, target, 0, 1.0, tower.userInt2 * tower.getCurrentAttackDamageWithBonus(), 1 - 0.35 + (tower.getLevel() * 0.004))
        set tower.userInt2 = 1
    endif
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 1.0
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNSRLightningOverload.blp
                            [name] => Arc Cascade
                            [short_explain] => Charged attacks chain to a large number of enemies, but chance and damage reduces with each chain.
                            [ONDAMAGE_chanceLevelAdd] => 0.0
                            [long_explain] => Charged attacks have a |cffFFFF80100%|r chance to chain to a nearby enemy within |cffFFFF80750|r range of the target. This effect can chain repeatedly, but with each jump the damage and chance to chain is reduced by |cffFFFF8035%|r multiplicatively and cannot chain to the previous target.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80-0.4%|r chance and damage loss
                        )

                )

            [3] => Array
                (
                    [name] => Autocast
                    [code] => local Buff b
    local integer power = R2I((0.1 + (tower.getLevel() * 0.004)) / 0.001)
    local Iterate i = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TYPE_TOWERS, 175)
    local integer count = 0
    local Unit next
    
    loop
        set next = i.next()
        exitwhen next == 0
        if next != tower then
            set count = count + 1
            call ashbringer_red_alert_neg.apply(tower, next, power)
        endif
    endloop
    
    if count > 0 then
        call ashbringer_red_alert_pos.apply(tower, tower, count * power)
    endif
                    [values] => Array
                        (
                            [AUTOCAST_cooldown] => 30
                            [AUTOCAST_autoRange] => 1100
                            [AUTOCAST_manacost] => 0
                            [icon] => ReplaceableTextures\CommandButtons\BTNRuneTap.blp
                            [AUTOCAST_range] => 1200
                            [AUTOCAST_targetType] => 0
                            [AUTOCAST_numBuffsBeforeIdle] => 0
                            [caster_art] => Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
                            [long_explain] => Redirects |cffFFFF8010%|r attack speed from other towers within |cffFFFF80175|r range to the Tesla Coil. Lasts for |cffFFFF805|r seconds.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.4%|r attack speed redirected|n|cffFFFF80+0.2|r seconds duration
                            [target_art] => 
                            [AUTOCAST_autocastType] => AC_TYPE_OFFENSIVE_IMMEDIATE
                            [AUTOCAST_buffType] => 0
                            [AUTOCAST_isExtended] => false
                            [name] => Red Alert
                            [AUTOCAST_targetSelf] => false
                            [short_explain] => Redirects attack speed from nearby towers to the Tesla Coil.
                        )

                )

            [4] => Array
                (
                    [name] => On Tower Creation
                    [code] => local tesla t = tesla.create()
    
    set t.e4 = Effect.createScaled("Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl", tower.getX(), tower.getY(), 166, GetRandomReal(0, 359), 1.25)
    set tower.userInt = 0
    set tower.userInt2 = 1
    set tower.userInt3 = t
    set tower.userReal = 0
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => Bslo
                    [oeValues] => Array
                        (
                            [Buffubertip] => Attack speed redirected to the Tesla Coil.
                            [TargetArt] => Array
                                (
                                )

                            [Bufftip] => Red Alert
                            [Spelldetail] => 2
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNRuneTap.blp
                        )

                )

        )

    [units] => Array
        (
        )

    [references] => Array
        (
        )

    [lightning] => Array
        (
        )

)