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

            [Art] => ReplaceableTextures\CommandButtons\BTNTwilightImmolationOn.blp
            [turnRate] => 2
            [dmgplus1] => 3513
            [bldtm] => 1
            [goldcost] => 3600
            [unitSound] => ObsidianDestroyer
            [sides1] => 1
            [manaN] => 500
            [launchZ] => 100
            [acquire] => 800
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [launchY] => 60
            [launchX] => 60
            [Name] => Anomalus
            [red] => 85
            [weapTp1] => missile
            [MissileHoming] => 1
            [file] => units\creeps\VoidWalker\VoidWalker.mdl
            [uberSplat] => YTDB
            [Missilespeed] => 1200
            [dice1] => 1
            [RngBuff1] => 250
            [green] => 175
            [modelScale] => 1.15
            [rangeN1] => 800
            [atkType1] => magic
            [cool1] => 1.5
            [Ubertip] => A primordial entity with an endless hunger for magic.
            [scaleBull] => 0
            [abilList] => @@0@@
            [customTeamColor] => 1
            [buildingShadow] => Array
                (
                )

            [targs1] => Array
                (
                )

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

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

            [abil_factor] => 0.5
            [author] => Ashbringer
            [alpha] => 255
            [authorDisplay] => |cffff6600Ashbringer|r
            [version] => 1.0
            [element] => arcane
            [rarity] => unique
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -0.3842
                    [y] => 0.154328
                    [z] => 70.4
                    [scale] => 1.35
                    [rot] => 4.72984
                    [file] => Abilities\Spells\Other\Drain\ManaDrainTarget.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [1] => Array
                (
                    [x] => -31.1144
                    [y] => 8.13701
                    [z] => -12.8
                    [scale] => 0.15
                    [rot] => 3.15819
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal1.mdl
                    [red] => 255
                    [green] => 25
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.75
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [2] => Array
                (
                    [x] => -0.527501
                    [y] => 45.0575
                    [z] => 12.8
                    [scale] => 0.21
                    [rot] => 4.71239
                    [file] => Doodads\Cinematic\ShimmeringPortal\ShimmeringPortal.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [3] => Array
                (
                    [x] => 19.5635
                    [y] => -29.0293
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 5.66402
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal1.mdl
                    [red] => 255
                    [green] => 25
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.75
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [4] => Array
                (
                    [x] => 37.9538
                    [y] => 20.816
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 0.337774
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal1.mdl
                    [red] => 255
                    [green] => 25
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.75
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [5] => Array
                (
                    [x] => 9.79373
                    [y] => -34.9727
                    [z] => 0
                    [scale] => 0.13
                    [rot] => 4.98448
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal2.mdl
                    [red] => 195
                    [green] => 25
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.7
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [6] => Array
                (
                    [x] => 9.66413
                    [y] => 35.4228
                    [z] => 0
                    [scale] => 0.13
                    [rot] => 1.309
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal8.mdl
                    [red] => 255
                    [green] => 55
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.75
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [7] => Array
                (
                    [x] => -17.4628
                    [y] => 37.9728
                    [z] => 0
                    [scale] => 0.0999999
                    [rot] => 2.5455
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal1.mdl
                    [red] => 255
                    [green] => 25
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.75
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [8] => Array
                (
                    [x] => -31.3382
                    [y] => 27.0233
                    [z] => 0
                    [scale] => 0.13
                    [rot] => 2.20565
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal2.mdl
                    [red] => 195
                    [green] => 25
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.7
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [9] => Array
                (
                    [x] => -24.0722
                    [y] => -15.2703
                    [z] => 0
                    [scale] => 0.17
                    [rot] => 4.23208
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal0.mdl
                    [red] => 255
                    [green] => 25
                    [blue] => 195
                    [alpha] => 255
                    [pitch] => -0.9
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [10] => Array
                (
                    [x] => -2.95995
                    [y] => 30.3833
                    [z] => 0
                    [scale] => 0.13
                    [rot] => 1.73364
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal0.mdl
                    [red] => 255
                    [green] => 25
                    [blue] => 195
                    [alpha] => 255
                    [pitch] => -0.9
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [11] => Array
                (
                    [x] => -38.2059
                    [y] => -13.3897
                    [z] => 0
                    [scale] => 0.13
                    [rot] => 3.25504
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal8.mdl
                    [red] => 255
                    [green] => 55
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.75
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [12] => Array
                (
                    [x] => 25.7751
                    [y] => 31.3295
                    [z] => 0
                    [scale] => 0.0999999
                    [rot] => 0.085806
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal0.mdl
                    [red] => 255
                    [green] => 25
                    [blue] => 195
                    [alpha] => 255
                    [pitch] => -0.9
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [13] => Array
                (
                    [x] => 0.0134145
                    [y] => -0.417175
                    [z] => 25.6
                    [scale] => 2.5
                    [rot] => 2.21657
                    [file] => Abilities\Weapons\SpiritOfVengeanceMissile\SpiritOfVengeanceMissile.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [14] => Array
                (
                    [x] => 19.5848
                    [y] => 31.5127
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 0.92165
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal1.mdl
                    [red] => 255
                    [green] => 25
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.75
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [15] => Array
                (
                    [x] => 40.7853
                    [y] => -5.0522
                    [z] => 0
                    [scale] => 0.0999999
                    [rot] => 5.39592
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal1.mdl
                    [red] => 255
                    [green] => 25
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.75
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [16] => Array
                (
                    [x] => 5.56499
                    [y] => -41.1721
                    [z] => 0
                    [scale] => 0.1
                    [rot] => 4.3025
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal1.mdl
                    [red] => 255
                    [green] => 25
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.75
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [17] => Array
                (
                    [x] => -20.641
                    [y] => 10.9743
                    [z] => -19.2
                    [scale] => 0.2
                    [rot] => 2.71663
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal0.mdl
                    [red] => 255
                    [green] => 25
                    [blue] => 195
                    [alpha] => 255
                    [pitch] => -0.9
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [18] => Array
                (
                    [x] => -27.4611
                    [y] => -24.0266
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 4.83608
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal1.mdl
                    [red] => 255
                    [green] => 25
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.75
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [19] => Array
                (
                    [x] => -11.6307
                    [y] => -34.1377
                    [z] => 0
                    [scale] => 0.13
                    [rot] => 4.80659
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal8.mdl
                    [red] => 255
                    [green] => 55
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.75
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [20] => Array
                (
                    [x] => 33.2317
                    [y] => -11.2005
                    [z] => 0
                    [scale] => 0.13
                    [rot] => 5.46924
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal8.mdl
                    [red] => 255
                    [green] => 55
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.75
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [21] => Array
                (
                    [x] => 36.9
                    [y] => 3.09875
                    [z] => 0
                    [scale] => 0.18
                    [rot] => 5.96707
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal2.mdl
                    [red] => 195
                    [green] => 25
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.7
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [22] => Array
                (
                    [x] => -42.5739
                    [y] => 2.64309
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 3.9338
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal1.mdl
                    [red] => 255
                    [green] => 25
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -0.75
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [23] => Array
                (
                    [x] => -0.0697521
                    [y] => 0.408075
                    [z] => 32
                    [scale] => 1.45
                    [rot] => 0.00194359
                    [file] => Abilities\Spells\Undead\Possession\PossessionCaster.mdl
                    [red] => 255
                    [green] => 1
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [24] => Array
                (
                    [x] => -0.0472429
                    [y] => -0.085364
                    [z] => 51.2
                    [scale] => 1.2
                    [rot] => 2.14676
                    [file] => Abilities\Spells\Undead\Possession\PossessionCaster.mdl
                    [red] => 155
                    [green] => 1
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -3.14
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [25] => Array
                (
                    [x] => -0.127409
                    [y] => -0.0641797
                    [z] => -185.6
                    [scale] => 1.8
                    [rot] => 5.20108
                    [file] => Doodads\Ruins\Props\RuinsPillar\RuinsPillar2.mdl
                    [red] => 35
                    [green] => 1
                    [blue] => 35
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [26] => Array
                (
                    [x] => 13.9003
                    [y] => -18.0094
                    [z] => 0
                    [scale] => 0.17
                    [rot] => 5.00351
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal0.mdl
                    [red] => 255
                    [green] => 25
                    [blue] => 195
                    [alpha] => 255
                    [pitch] => -0.9
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [27] => Array
                (
                    [x] => -0.0639799
                    [y] => 0.397603
                    [z] => 25.6
                    [scale] => 1.8
                    [rot] => 0.00194359
                    [file] => Abilities\Spells\Undead\Possession\PossessionCaster.mdl
                    [red] => 255
                    [green] => 1
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

        )

    [dmgTable] => Array
        (
        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Attack
                    [code] => local real mana = GetUnitState(tower.getUnit(), UNIT_STATE_MANA)
    local real mana_perc = mana / GetUnitState(tower.getUnit(), UNIT_STATE_MAX_MANA)
    local Iterate i
    local Creep next
    local real damage = 25 + (tower.getLevel() * 1)
    local Effect e
    
    if tower.userInt2 == 1 and tower.calcChance(mana_perc) then
        call SetUnitState(tower.getUnit(), UNIT_STATE_MANA, 0)
        set tower.userReal3 = tower.userReal3 + mana
        call Lightning.createFromPointToPoint("BLUE", tower.getX(), tower.getY(), 50, tower.userReal, tower.userReal2, 50).setLifetime(0.3)
        call Effect.createScaled("war3mapImported\\ArcaneExplosion.mdx", tower.userReal, tower.userReal2, 0.0, 0.0, 1.0 + (tower.userReal3 * 0.0003))
        set i = Iterate.overUnitsInRange(tower, TARGET_TYPE_CREEPS, tower.userReal, tower.userReal2, 300 * (1 + (tower.userReal3 * 0.0003)))
        
        loop
            set next = i.next()
            exitwhen next == 0
            
            call tower.doSpellDamage(next, damage * mana, tower.calcSpellCritNoBonus())
        endloop
        set e = tower.userInt3
        call e.setScale(1.5 * (1.0 + (tower.userReal3 * 0.0006)))
    endif
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNArcaneFlame.blp
                            [name] => Rift Surge
                            [short_explain] => Attacks have a chance to deposit mana into the Nether Rift, empowering it.
                            [ONATTACK_chance] => 1.0
                            [ONATTACK_chanceLevelAdd] => 0.0
                            [long_explain] => Attacks have a chance equal to current mana percentage to deposit all remaining mana into the Nether Rift, causing an explosion for |cffffff8025|r spell damage per point of mana. The Nether Rift's damage, area of effect and chance of spawning additional entities are increased based on how much mana it has, but loses |cffffff8010%|r of its mana every time it deals damage.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+1|r spell damage
                        )

                )

            [1] => Array
                (
                    [name] => Header
                    [code] => globals
        BuffType ashbringer_manavoid_aura
        ProjectileType ashbringer_rift_missile
        ProjectileType ashbringer_riftdragon_missile
        MultiboardValues ashbringer_rift_mana
    endglobals
    
    struct riftdragons
        Effect array fx[50]
        real array dur[50]
        real array atk[50]
        real array x[50]
        real array y[50]
        boolean array active[50]
        
        method add_dragon takes Tower tower, Creep creep returns nothing
            local integer count = 0
            local integer found = -1
            local integer random
            local Effect e
            local real x
            local real y
            local real angle
            
            loop
                exitwhen count>49 or found >= 0
                
                if not .active[count] then
                    set found = count
                endif
                
                set count = count + 1
            endloop
            
            if found >= 0 then
                set angle = GetRandomReal(0, 359)

                set x = tower.userReal + (GetRandomReal(75, 150) * Cos(Deg2Rad(angle)))
                set y = tower.userReal2 + (GetRandomReal(75, 150) * Sin(Deg2Rad(angle)))
            
                call Effect.create("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", x, y, 110.0, 270.0).setLifetime(3.0)
                set .fx[found] = Effect.createAnimatedScaled("units\\creeps\\NetherDragon\\NetherDragon.mdl", x, y, 140, 270.0, 0.5)
                call .fx[found].setFacing(bj_RADTODEG * Atan2(creep.getY() - y, creep.getX() - x))
                call .fx[found].setTeamcolor(GetPlayerColor(tower.getOwner().getThePlayer()))
                set .dur[found] = 12 * tower.getProp_BuffDuration()
                set .x[found] = x
                set .y[found] = y
                set .atk[found] = 0
                set .active[found] = true
            endif
        endmethod
        
        
        method ashbringer_riftdragon_tick takes Tower tower, integer rd returns nothing
            local Iterate i
            local Creep next
            local real angle
            
            if .dur[rd] >= 1 and .active[rd] then
                if .atk[rd] < 1 then
                    set i = Iterate.overUnitsInRange(tower, TARGET_TYPE_CREEPS, .x[rd], .y[rd], 600 * (1 + (tower.userReal3 * 0.0003)))
                    set next = i.nextRandom()
                    if next !=0 then
                        set .atk[rd] = 2
                        call i.destroy()
                        call Projectile.createFromPointToUnit(ashbringer_riftdragon_missile, tower, 0.0, 0.0, .x[rd], .y[rd], 140, next, true, false, false)
                        set angle = bj_RADTODEG * Atan2(next.getY() - .y[rd], next.getX() - .x[rd])
                        call .fx[rd].setFacing(angle)
                        call .fx[rd].setAnimation("attack")
                        set .fx[rd].userInt = 1
                    else
                        if .fx[rd].userInt == 1 then
                            call .fx[rd].setAnimation("stand")
                        endif
                        set .fx[rd].userInt = 0
                    endif
                else
                    if .fx[rd].userInt == 1 then
                        call .fx[rd].setAnimation("stand")
                    endif
                    set .fx[rd].userInt = 0
                endif
                set .atk[rd] = .atk[rd] - 1
                set .dur[rd] = .dur[rd] - 1
            elseif .active[rd] then
                call .fx[rd].noDeathAnimation()
                call .fx[rd].destroy()
                call Effect.create("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", .x[rd], .y[rd], 110.0, 270.0).setLifetime(3.0)
                set .active[rd] = false
            endif
        endmethod
        
        method update_dragons takes Tower tower returns nothing
            local integer count = 0
            
            loop
                exitwhen count>49
                
                if .active[count] then
                    call .ashbringer_riftdragon_tick(tower, count)
                endif
                
                set count = count + 1
            endloop
        endmethod
        
        method cleanup takes Tower tower returns nothing
            local integer count = 0
            
            loop
                exitwhen count>49
                
                if .active[count] then
                    call .fx[count].destroy()
                endif
                
                set count = count + 1
            endloop
        endmethod
    endstruct

    function ashbringer_manavoid_create takes Buff b returns nothing
        local Tower t = b.getCaster()
        
        set b.userInt = t.getUID()
        call t.modifyProperty(MOD_MANA_REGEN, 1.0)
    endfunction

    function ashbringer_manavoid_cleanup takes Buff b returns nothing
        local Tower t = b.getCaster()
        
        call t.modifyProperty(MOD_MANA_REGEN, -1.0)
    endfunction
    
    function ashbringer_rift_turn takes Projectile p returns nothing
        local real turn = GetRandomReal(-7.0, 7.0)
        local real compare = GetRandomReal(0, p.userReal2+p.userReal3)
        
        set p.rotation = turn
    endfunction
    
    function ashbringer_rift_damage takes DummyUnit d returns nothing
        local Unit target = Event.getTarget()
        local Tower tower = d.getCaster()
        local real damage = (3000 + (tower.getLevel() * 120)) * 0.2
        
        call tower.doSpellDamage(target, damage, tower.calcSpellCritNoBonus())
    endfunction
    
    
    function ashbringer_riftdragon_hit takes Projectile p, Creep c returns nothing
        local Tower tower = p.getCaster()
        local real damage = (3000 + (tower.getLevel() * 120)) * 0.2
        
        call tower.doSpellDamage(c, damage, tower.calcSpellCritNoBonus())
    endfunction
    
    function ashbringer_rift_periodic takes Tower tower returns nothing
        local riftdragons rd = tower.userInt
        local Creep next
        local EventHandler ev = ashbringer_rift_damage
        local Projectile p
        local real turn
        local real angle
        local Effect e
        local integer random
        local real x
        local real y
        local real mana_mult = 1 + (tower.userReal3 * 0.001)
        local Iterate i = Iterate.overUnitsInRange(tower, TARGET_TYPE_CREEPS, tower.userReal, tower.userReal2, 300 * (1 + (tower.userReal3 * 0.0003)))
        local real damage
        local integer count = i.count()
        local Effect array ea
        local timer t
        
        if count > 0 then
            set mana_mult = 1 + ((mana_mult - 1) / i.count())
        endif
        set damage = (3000 + (tower.getLevel() * 120)) * mana_mult
        
        loop
            set next = i.nextRandom()
            exitwhen next == 0
            call Effect.createColored("Abilities\\Spells\\Orc\\LightningShield\\LightningShieldBuff.mdl", next.getX(), next.getY(), next.getZ(), GetRandomReal(0, 359), 1.5, 155, 55, 255, 255).setLifetime(3.0)
            call tower.doSpellDamage(next, damage, tower.calcSpellCritNoBonus())
            /*
            if tower.calcChance(0.5) then
                call Lightning.createFromPointToUnit("PZAP", tower.userReal, tower.userReal2, 50, next).setLifetime(0.1)
                call Effect.createColored("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", next.getX(), next.getY(), next.getZ(), GetRandomReal(0, 359), 1.0, 155, 55, 255, 255).setLifetime(3.0)
                call tower.doSpellDamage(next, damage, tower.calcSpellCritNoBonus())
            endif
            */
            if tower.calcChance(0.05 * mana_mult) then
                set random = GetRandomInt(0, 1)
                if random == 0 then
                    set angle = bj_RADTODEG * Atan2(next.getY() - tower.userReal2, next.getX() - tower.userReal)
                    set turn = GetRandomReal(-5, 5)
                    set p = Projectile.create(ashbringer_rift_missile, tower, 0, 0, tower.userReal, tower.userReal2, 75, angle)
                    call p.color(155, 55, 255, 255)
                    call p.setScale(0.7)
                    set p.rotation = turn
                    //set p.accelerate = 3
                    if turn>0 then
                        set p.userReal3 = turn
                    else
                        set p.userReal2 = -turn
                    endif
                    call p.addAbility('@@1@@')
                    call p.setDamageEvent(ev)
                else
                    call rd.add_dragon(tower, next)
                endif
            endif
        endloop
        
        if count > 0 then
            set tower.userReal3 = tower.userReal3 * 0.90
            set e = tower.userInt3
            call e.setScale(1.5 * (1 + (tower.userReal3 * 0.0006)))
        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 m = Modifier.create()
        
        set ashbringer_manavoid_aura = BuffType.createAuraEffectType(true)
        call ashbringer_manavoid_aura.setBuffIcon('@@2@@')
        call ashbringer_manavoid_aura.addEventOnCreate(ashbringer_manavoid_create)
        call ashbringer_manavoid_aura.addEventOnCleanup(ashbringer_manavoid_cleanup)
        call m.addModification(MOD_MANA_REGEN_PERC, -0.3, 0.00)
        call ashbringer_manavoid_aura.setBuffModifier(m)
        
        set ashbringer_rift_missile = ProjectileType.create("Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl", 10, 80)
        call ashbringer_rift_missile.enablePeriodic(ProjectileEvent.ashbringer_rift_turn, 0.5)
        
        set ashbringer_riftdragon_missile = ProjectileType.create("Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl", 3.0, 900)
        call ashbringer_riftdragon_missile.enableHoming(ashbringer_riftdragon_hit, 0.0)
        
        set ashbringer_rift_mana = MultiboardValues.create(1)  
        call ashbringer_rift_mana.setKey(0, "Rift Mana") 
    endfunction
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [2] => Array
                (
                    [name] => On Tower Details
                    [code] => call ashbringer_rift_mana.setValue(0, I2S(R2I(tower.userReal3))) 
    return ashbringer_rift_mana
                    [values] => Array
                        (
                            [0] => Array
                                (
                                    [_value] => 0
                                    [typ] => string
                                )

                        )

                )

            [3] => Array
                (
                    [name] => On Tower Destruction
                    [code] => local Effect e
    local riftdragons rd = tower.userInt
    
    if tower.userInt2 == 1 then
        set e = tower.userInt3
        call e.destroy()
        call rd.cleanup(tower)
        call rd.destroy()
    endif
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [4] => Array
                (
                    [name] => On Damage
                    [code] => local Creep target = Event.getTarget()
    local unit u = target.getUnit()
    local real mana = 0.05 * (GetUnitState(u, UNIT_STATE_LIFE) / GetUnitState(u, UNIT_STATE_MAX_LIFE))
    
    call tower.addManaPerc(mana)
    call target.subtractManaPerc(mana, true)
    set u = null
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 1.0
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNVampiricAura.blp
                            [name] => Endless Thirst
                            [short_explain] => Gains mana from attacks based on enemy health.
                            [ONDAMAGE_chanceLevelAdd] => 0.0
                            [long_explain] => Attacks restore up to |cffffff805%|r of maximum mana, based on the target's health. Mana gained decreases with lower enemy health. The target will lose an equal percentage of mana if possible.
                        )

                )

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

                    [values] => Array
                        (
                            [AURA_powerAdd] => 0
                            [visible] => true
                            [AURA_auraEffect] => ashbringer_manavoid_aura
                            [AURA_levelAdd] => 0
                            [AURA_power] => 1
                            [icon] => ReplaceableTextures\CommandButtons\BTNOrbofSlowness.blp
                            [AURA_targetType] => TARGET_TYPE_TOWERS
                            [long_explain] => Reduces the mana regeneration of other towers in |cffffff80225|r range by |cffffff8030%|r. Anomalus gains |cffffff801|r mana per second for each tower affected.
                            [AURA_targetSelf] => false
                            [name] => Mana Void
                            [AURA_level] => 1
                            [short_explain] => Reduces mana regeneration of nearby towers. Gains mana regeneration for each tower affected.
                            [AURA_auraRange] => 225
                        )

                )

            [6] => Array
                (
                    [name] => Periodic
                    [code] => local riftdragons rd = tower.userInt
    
    if tower.userInt2 == 1 then
        call ashbringer_rift_periodic(tower)
        call rd.update_dragons(tower)
    endif
                    [values] => Array
                        (
                            [visible] => false
                            [PERIODIC_period] => 1.0
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [7] => Array
                (
                    [name] => Autocast
                    [code] => local real x = GetSpellTargetX()
    local real y = GetSpellTargetY()
    local Effect e
    
    if tower.userInt2 == 1 then
        set e = tower.userInt3
        call e.destroy()
    endif
    
    set e = Effect.createScaled("war3mapImported\\Effect_RiftPurple.mdx", x, y, 75, GetUnitFacing(tower.getUnit()), 1.5 * (1 + (tower.userReal3 * 0.0006)))
    set tower.userReal = x
    set tower.userReal2 = y
    set tower.userInt2 = 1
    set tower.userInt3 = e
                    [values] => Array
                        (
                            [AUTOCAST_cooldown] => 30
                            [AUTOCAST_autoRange] => 800
                            [AUTOCAST_manacost] => 100
                            [icon] => ReplaceableTextures\CommandButtons\BTNArcaneBlast.blp
                            [AUTOCAST_range] => 800
                            [AUTOCAST_targetType] => 0
                            [AUTOCAST_numBuffsBeforeIdle] => 0
                            [caster_art] => 
                            [long_explain] => Create a permanent rift at the target location. Every second, the rift strikes all enemies in |cffffff80300|r range for |cffffff803000|r spell damage and has a |cffffff805%|r chance per enemy to spawn additional entities that deal spell damage in other forms. Maximum |cffffff801|r rift.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+120|r spell damage
                            [target_art] => 
                            [AUTOCAST_autocastType] => AC_TYPE_NOAC_POINT
                            [AUTOCAST_buffType] => 0
                            [AUTOCAST_isExtended] => false
                            [name] => Nether Rift
                            [AUTOCAST_targetSelf] => false
                            [short_explain] => Creates a permanent rift that damages enemies and spawns entities.
                        )

                )

            [8] => Array
                (
                    [name] => On Tower Creation
                    [code] => local riftdragons rd = riftdragons.create()

    call SetUnitColor(tower.getUnit(), ConvertPlayerColor(3))
    
    set tower.userInt = rd
    set tower.userInt2 = 0
    set tower.userInt3 = 0
    set tower.userReal = 0
    set tower.userReal2 = 0
    set tower.userReal3 = 0
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

        )

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

                            [MissileHoming] => 1
                            [TargetArt] => Abilities\Spells\Other\Drain\ManaDrainTarget.mdl
                            [LightningEffect] => DRAM
                            [Missileart] => Abilities\Spells\Undead\DevourMagic\DevourMagicBirthMissile.mdl
                            [Missilespeed] => 4000
                            [Unubertip] => -HIDE-
                            [DataA1] => 0.1
                            [DataB1] => 0.1
                            [Name] => Anomalus
                        )

                )

            [1] => Array
                (
                    [id] => @@1@@
                    [derivedFrom] => Apxf
                    [oeValues] => Array
                        (
                            [Art] => ReplaceableTextures\CommandButtons\BTNMarkOfFire.blp
                            [HeroDur1] => 0.01
                            [DataA3] => 1
                            [DataA1] => 1
                            [Area2] => 350
                            [BuffID1] => @@3@@
                            [Area1] => 350
                            [DataA2] => 1
                            [DataB1] => 0
                            [Area3] => 350
                            [Name] => Pink
                            [Dur1] => 0.01
                            [Ubertip] => Pink
                            [Missileart] => Abilities\Spells\Undead\DevourMagic\DevourMagicBirthMissile.mdl
                            [Missilespeed] => 1000
                            [Tip] => Pink
                        )

                )

        )

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

                            [Buffubertip] => Reduced mana regeneration.
                            [TargetArt] => Array
                                (
                                )

                            [Bufftip] => Mana Void
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNOrbofSlowness.blp
                        )

                )

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

                            [Buffubertip] => Array
                                (
                                )

                            [TargetArt] => Array
                                (
                                )

                            [Bufftip] => Nether Rift
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNArcaneBlast.blp
                        )

                )

        )

    [units] => Array
        (
        )

    [references] => Array
        (
        )

    [lightning] => Array
        (
        )

)