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

            [Art] => ReplaceableTextures\CommandButtons\BTNPowerGenerator.blp
            [turnRate] => 3
            [dmgplus1] => 821
            [bldtm] => 1
            [goldcost] => 500
            [unitSound] => ArcaneObservatory
            [sides1] => 1
            [manaN] => 2500
            [launchZ] => 130
            [acquire] => 800
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Arcane Battery
            [weapTp1] => missile
            [MissileHoming] => 1
            [file] => units\nightelf\Wisp\Wisp.mdl
            [uberSplat] => YTDG
            [Missilespeed] => 5000
            [dice1] => 1
            [regenMana] => 20
            [green] => 0
            [rangeN1] => 800
            [atkType1] => normal
            [cool1] => 3
            [Ubertip] => A deadly mana reserve.
            [scaleBull] => 0
            [abilList] => @@0@@
            [customTeamColor] => 1
            [buildingShadow] => Array
                (
                )

            [targs1] => Array
                (
                )

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

    [settings] => Array
        (
            [balanceTip] => |cffFFFF00+10 |rmana/lvl
            [abil_factor] => 0.4
            [author] => Ashbringer
            [alpha] => 0
            [authorDisplay] => |cffff6600Ashbringer|r
            [version] => 1.0
            [element] => arcane
            [rarity] => rare
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => 15.9923
                    [y] => 16.003
                    [z] => 0
                    [scale] => 0.25
                    [rot] => 0.785398
                    [file] => war3mapImported\Square_Column.mdl
                    [red] => 25
                    [green] => 10
                    [blue] => 225
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [1] => Array
                (
                    [x] => -16.1273
                    [y] => 15.898
                    [z] => 0
                    [scale] => 0.25
                    [rot] => 5.49779
                    [file] => war3mapImported\Square_Column.mdl
                    [red] => 25
                    [green] => 10
                    [blue] => 225
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [2] => Array
                (
                    [x] => -16.1882
                    [y] => -16.1838
                    [z] => 0
                    [scale] => 0.25
                    [rot] => 3.92699
                    [file] => war3mapImported\Square_Column.mdl
                    [red] => 25
                    [green] => 10
                    [blue] => 225
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [3] => Array
                (
                    [x] => 15.9819
                    [y] => -16.0118
                    [z] => 0
                    [scale] => 0.25
                    [rot] => 2.3562
                    [file] => war3mapImported\Square_Column.mdl
                    [red] => 25
                    [green] => 10
                    [blue] => 225
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [4] => Array
                (
                    [x] => 0.49422
                    [y] => -16.676
                    [z] => 0
                    [scale] => 0.26
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 25
                    [green] => 10
                    [blue] => 225
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [5] => Array
                (
                    [x] => -0.0568663
                    [y] => 16.5065
                    [z] => 0
                    [scale] => 0.26
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 25
                    [green] => 10
                    [blue] => 225
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [6] => Array
                (
                    [x] => 16.3755
                    [y] => 0.0289771
                    [z] => 0
                    [scale] => 0.26
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 25
                    [green] => 10
                    [blue] => 225
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [7] => Array
                (
                    [x] => -16.5595
                    [y] => -0.0879896
                    [z] => 0
                    [scale] => 0.26
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 25
                    [green] => 10
                    [blue] => 225
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [8] => Array
                (
                    [x] => 0.460634
                    [y] => -16.7279
                    [z] => 83.2
                    [scale] => 0.26
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 25
                    [green] => 10
                    [blue] => 225
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [9] => Array
                (
                    [x] => -0.090452
                    [y] => 16.4546
                    [z] => 83.2
                    [scale] => 0.26
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 25
                    [green] => 10
                    [blue] => 225
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [10] => Array
                (
                    [x] => 16.3419
                    [y] => -0.0229064
                    [z] => 83.2
                    [scale] => 0.26
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 25
                    [green] => 10
                    [blue] => 225
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [11] => Array
                (
                    [x] => -16.5931
                    [y] => -0.139873
                    [z] => 83.2
                    [scale] => 0.26
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 25
                    [green] => 10
                    [blue] => 225
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [12] => Array
                (
                    [x] => -0.212181
                    [y] => -0.379893
                    [z] => 64
                    [scale] => 0.35
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\City_LowWall_TallEndCap\City_LowWall_TallEndCap.mdl
                    [red] => 75
                    [green] => 25
                    [blue] => 225
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [13] => Array
                (
                    [x] => -0.0701777
                    [y] => -0.0014116
                    [z] => 89.6
                    [scale] => 0.4
                    [rot] => 1.25664
                    [file] => Abilities\Spells\Orc\LightningShield\LightningShieldTarget.mdl
                    [red] => 255
                    [green] => 1
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [14] => Array
                (
                    [x] => -0.0461915
                    [y] => 0.107576
                    [z] => 89.6
                    [scale] => 0.6
                    [rot] => 5.50062
                    [file] => Doodads\Cinematic\GlowingRunes\GlowingRunes5.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [15] => Array
                (
                    [x] => -0.0983455
                    [y] => -0.0133621
                    [z] => 32
                    [scale] => 1
                    [rot] => 0
                    [file] => Abilities\Weapons\DruidoftheTalonMissile\DruidoftheTalonMissile.mdl
                    [red] => 255
                    [green] => 155
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -4.71
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [16] => Array
                (
                    [x] => -0.22985
                    [y] => 0.330411
                    [z] => 0
                    [scale] => 0.1
                    [rot] => 0
                    [file] => Doodads\Ruins\Props\Ruins_NagaCircle\Ruins_NagaCircle.mdl
                    [red] => 255
                    [green] => 5
                    [blue] => 225
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [17] => Array
                (
                    [x] => 5.89694
                    [y] => 0.0148718
                    [z] => 38.4
                    [scale] => 1.1
                    [rot] => 0
                    [file] => Abilities\Weapons\WingedSerpentMissile\WingedSerpentMissile.mdl
                    [red] => 255
                    [green] => 155
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -4.71
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [18] => Array
                (
                    [x] => 0.465513
                    [y] => 5.46865
                    [z] => 38.4
                    [scale] => 1.1
                    [rot] => 1.5708
                    [file] => Abilities\Weapons\WingedSerpentMissile\WingedSerpentMissile.mdl
                    [red] => 255
                    [green] => 155
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -4.71
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

        )

    [dmgTable] => Array
        (
            [0] => Array
                (
                    [id] => MOD_MANA
                    [base] => 0
                    [add] => 10
                )

        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => Header
                    [code] => globals
        //@export
        BuffType ashbringer_overload_buff
        //@export
        BuffType ashbringer_extraction_debuff
    endglobals
    
    //@export
    function ashbringer_overload_periodic takes Buff b returns nothing
        local Tower tower = b.getCaster()
        local Iterate i
        local Unit random
        local integer count = 0
        local integer power = tower.userInt + (tower.getLevel() * tower.userInt2)
        
        if GetUnitState(tower.getUnit(), UNIT_STATE_MANA) > tower.userInt3 then
            set i = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TYPE_CREEPS, 900)
            set random = i.nextRandom()
            if random != 0 then
                call i.destroy()
                call tower.subtractMana(tower.userInt3, true)
                call Lightning.createFromPointToUnit("ZAP9", tower.getX(), tower.getY(), 110, random).setLifetime(0.2)
                call Effect.createSimpleOnUnit("Abilities\\Weapons\\BlackKeeperMissile\\BlackKeeperMissile.mdl", random, "chest").destroy()
                call tower.doAttackDamage(random, tower.getCurrentAttackDamageWithBonus(), tower.calcAttackMulticrit(0, 0, 0))
                call ashbringer_extraction_debuff.applyCustomPower(tower, random, power, power)
                set b.userInt = 0
            else
                set b.userInt = b.userInt + 1
                if b.userInt > 4 then
                    call b.removeBuff()
                endif
            endif
        else
            call b.removeBuff()
        endif
    endfunction
    
    //@export
    function ashbringer_extraction_onattacked takes Buff b returns nothing
        local Tower tower = b.getCaster()
        local Tower target = Event.getTarget()
        local real chance = (0.05 + (tower.getLevel() * 0.001)) * target.getBaseAttackspeed()
        local real mana = tower.userReal3 * (1.0 - (GetUnitState(target.getUnit(), UNIT_STATE_MANA) / GetUnitState(target.getUnit(), UNIT_STATE_MAX_MANA)))
        
        if tower.getFamily() == target.getFamily() then
            set chance = chance * 2
            set mana = mana * 2
        endif
        
        if target.calcChance(chance) then
            call target.addManaPerc(mana)
            call Lightning.createFromUnitToUnit("ZAP8", b.getBuffedUnit(), target).setLifetime(0.1)
        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_extraction_debuff = BuffType.create(8.0, 0.0, false)
        call ashbringer_extraction_debuff .setBuffIcon('@@2@@')
        call mod.addModification(MOD_DMG_FROM_ARCANE, 0.0, 0.001)
        call ashbringer_extraction_debuff.setBuffModifier(mod)
        call ashbringer_extraction_debuff.addEventOnAttacked(EventHandler.ashbringer_extraction_onattacked, 1.0, 0.0)
        
        set ashbringer_overload_buff = BuffType.create(-1.0, 0.0, true)
        call ashbringer_overload_buff.setBuffIcon('@@1@@')
        call ashbringer_overload_buff.addPeriodicEvent(EventHandler.ashbringer_overload_periodic, 0.2)
    endfunction
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [1] => Array
                (
                    [name] => On Damage
                    [code] => local integer power = 100 + (tower.getLevel() * 2)
    call ashbringer_extraction_debuff.applyCustomPower(tower, Event.getTarget(), power, power)
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 1.0
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNManaDrain.blp
                            [name] => Arcane Extraction
                            [short_explain] => Applies a debuff on hit that increases damage taken by |cFFFF77FFArcane|r towers and restores mana to attackers.
                            [ONDAMAGE_chanceLevelAdd] => 0
                            [long_explain] => Attacks apply Arcane Extraction on hit, increasing damage enemies take from |cFFFF77FFArcane|r towers by |cffffff8010%|r and giving attackers a |cffffff805%|r attack speed adjusted chance to restore |cffffff801%|r of their missing mana. The chance and mana is doubled for the Arcane Battery. Lasts |cffffff808|r seconds.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.2%|r damage from |cFFFF77FFArcane|r|n|cffFFFF80+0.1%|r mana chance
                        )

                )

            [2] => Array
                (
                    [name] => Autocast
                    [code] => call tower.addMana(1000.0)
    set ashbringer_overload_buff.apply(tower, tower, tower.getLevel()).userInt = 0
                    [values] => Array
                        (
                            [AUTOCAST_cooldown] => 20
                            [AUTOCAST_autoRange] => 800
                            [AUTOCAST_manacost] => 1000
                            [icon] => ReplaceableTextures\CommandButtons\BTNWispSplode.blp
                            [AUTOCAST_range] => 800
                            [AUTOCAST_targetType] => TARGET_TYPE_CREEPS
                            [AUTOCAST_numBuffsBeforeIdle] => 0
                            [caster_art] => Abilities\Spells\Other\Charm\CharmTarget.mdl
                            [long_explain] => Rapidly strikes a random enemy within attack range every |cffffff800.2|r seconds, dealing attack damage and applying Arcane Extraction. Drains |cffffff80100|r mana per strike and lasts until there are no enemies in range or until the tower has insufficient mana. This ability refunds its mana cost.
                            [target_art] => 
                            [AUTOCAST_autocastType] => AC_TYPE_OFFENSIVE_IMMEDIATE
                            [AUTOCAST_buffType] => 0
                            [AUTOCAST_isExtended] => false
                            [name] => Overload
                            [AUTOCAST_targetSelf] => false
                            [short_explain] => Rapidly attacks random enemies at the cost of mana.
                        )

                )

            [3] => Array
                (
                    [name] => On Tower Creation
                    [code] => call SetUnitColor(tower.getUnit(), ConvertPlayerColor(7))
    set tower.userInt = 100
    set tower.userInt2 = 2
    set tower.userInt3 = 100
    set tower.userReal = 0.05
    set tower.userReal2 = 0.001
    set tower.userReal3 = 0.01
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => Alit
                    [oeValues] => Array
                        (
                            [Art] => Array
                                (
                                )

                            [MissileHoming] => 1
                            [TargetArt] => Abilities\Spells\Human\Feedback\ArcaneTowerAttack.mdl
                            [LightningEffect] => ZAP9
                            [Missilespeed] => 5000
                            [Missileart] => Array
                                (
                                )

                            [Unubertip] => -HIDE-
                            [DataA1] => 0.1
                            [targs1] => air,ground,structure,ward,item,debris
                            [DataB1] => 0.1
                            [Name] => Arcane Lightning
                        )

                )

        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@1@@
                    [derivedFrom] => Binf
                    [oeValues] => Array
                        (
                            [Targetattach] => Array
                                (
                                )

                            [Buffubertip] => Unloading mana.
                            [TargetArt] => Array
                                (
                                )

                            [Bufftip] => Overload
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNWispSplode.blp
                        )

                )

            [1] => Array
                (
                    [id] => @@2@@
                    [derivedFrom] => Binf
                    [oeValues] => Array
                        (
                            [Targetattach] => head
                            [Buffubertip] => Takes increased damage from Arcane towers and restores mana when hit.
                            [TargetArt] => Abilities\Weapons\SpiritOfVengeanceMissile\SpiritOfVengeanceMissile.mdl
                            [Bufftip] => Arcane Extraction
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNManaDrain.blp
                        )

                )

        )

    [units] => Array
        (
        )

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

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

        )

    [lightning] => Array
        (
        )

)