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

            [targs1] => Array
                (
                )

            [RngBuff2] => 250
            [goldcost] => 3200
            [weapsOn] => 1
            [dice1] => 1
            [Missilespeed] => 1200
            [moveHeight] => -10
            [file] => Doodads\Cinematic\GlowingRunes\GlowingRunes4.mdl
            [targCount2] => 0
            [manaN] => 1200
            [atkType1] => normal
            [modelScale] => 0.5
            [weapTp1] => missile
            [weapTp2] => missile
            [rangeN2] => 800
            [upgrades] => Array
                (
                )

            [rangeN1] => 700
            [cool2] => 2.5
            [cool1] => 2.5
            [Ubertip] => A gate to the astral plane, glowing figures can be seen flying around on the other side.
            [green] => 0
            [regenMana] => 12
            [abilList] => Array
                (
                )

            [atkType2] => unknown
            [mana0] => 400
            [Name] => Planar Gate
            [Art] => ReplaceableTextures\CommandButtons\BTNDizzy.blp
            [red] => 0
            [buildingShadow] => Array
                (
                )

            [sides2] => 1
            [blue] => 0
            [sides1] => 1
            [uberSplat] => OSMA
            [auto] => Array
                (
                )

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

    [settings] => Array
        (
            [author] => Majildian
            [element] => astral
            [authorDisplay] => |cff87cefaMajildian|r
            [alpha] => 255
            [balanceTip] => Array
                (
                )

            [rarity] => unique
            [version] => 1.0
            [abil_factor] => 0.28
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -0.580143
                    [y] => -49.3214
                    [z] => 6.4
                    [scale] => 0.2
                    [rot] => 3.92699
                    [file] => Doodads\Ruins\Terrain\RuinsWall135\RuinsWall1352.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [1] => Array
                (
                    [x] => 16.4064
                    [y] => -0.110802
                    [z] => 12.8
                    [scale] => 0.09
                    [rot] => 0.000000476837
                    [file] => Doodads\Terrain\ForceBridgeLarge0\ForceBridgeLarge0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 40
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => true
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [2] => Array
                (
                    [x] => -21.1756
                    [y] => -1.39448
                    [z] => 12.8
                    [scale] => 0.09
                    [rot] => 0.000000476837
                    [file] => Doodads\Terrain\ForceBridgeLarge0\ForceBridgeLarge0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 40
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => true
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [3] => Array
                (
                    [x] => -4.2108
                    [y] => 19.3146
                    [z] => 19.2
                    [scale] => 0.09
                    [rot] => 4.71239
                    [file] => Doodads\Terrain\ForceBridgeLarge0\ForceBridgeLarge0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 40
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => true
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [4] => Array
                (
                    [x] => -4.34946
                    [y] => -20.0992
                    [z] => 19.2
                    [scale] => 0.09
                    [rot] => 4.71239
                    [file] => Doodads\Terrain\ForceBridgeLarge0\ForceBridgeLarge0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 40
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => true
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [5] => Array
                (
                    [x] => -2.84301
                    [y] => -40.8933
                    [z] => 32
                    [scale] => 0.08
                    [rot] => 4.71239
                    [file] => Doodads\Terrain\CliffDoodad\NagaStairsSmall0\NagaStairsSmall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [6] => Array
                (
                    [x] => 35.536
                    [y] => -2.30235
                    [z] => 38.4
                    [scale] => 0.08
                    [rot] => 0
                    [file] => Doodads\Terrain\CliffDoodad\NagaStairsSmall0\NagaStairsSmall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [7] => Array
                (
                    [x] => -3.55155
                    [y] => 38.22
                    [z] => 44.8
                    [scale] => 0.08
                    [rot] => 1.5708
                    [file] => Doodads\Terrain\CliffDoodad\NagaStairsSmall0\NagaStairsSmall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [8] => Array
                (
                    [x] => -41.9526
                    [y] => -2.37324
                    [z] => 38.4
                    [scale] => 0.08
                    [rot] => 3.14159
                    [file] => Doodads\Terrain\CliffDoodad\NagaStairsSmall0\NagaStairsSmall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [9] => Array
                (
                    [x] => -41.3301
                    [y] => 39.4703
                    [z] => 12.8
                    [scale] => 0.3
                    [rot] => 2.3562
                    [file] => Doodads\Ruins\Props\RuinsObelisk\RuinsObelisk1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [10] => Array
                (
                    [x] => 36.3577
                    [y] => -37.6519
                    [z] => -0.000000953674
                    [scale] => 0.3
                    [rot] => 5.49779
                    [file] => Doodads\Ruins\Props\RuinsObelisk\RuinsObelisk1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [11] => Array
                (
                    [x] => 36.2096
                    [y] => 38.9168
                    [z] => 12.8
                    [scale] => 0.3
                    [rot] => 3.92699
                    [file] => Doodads\Ruins\Props\RuinsObelisk\RuinsObelisk1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [12] => Array
                (
                    [x] => -40.5513
                    [y] => -38.3495
                    [z] => -0.000000953674
                    [scale] => 0.3
                    [rot] => 0.785398
                    [file] => Doodads\Ruins\Props\RuinsObelisk\RuinsObelisk1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [13] => Array
                (
                    [x] => -12.2252
                    [y] => -4.68228
                    [z] => -6.4
                    [scale] => 0.25
                    [rot] => 0.628319
                    [file] => Doodads\LordaeronSummer\Props\Flies\Flies.mdl
                    [red] => 255
                    [green] => 200
                    [blue] => 200
                    [alpha] => 100
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [14] => Array
                (
                    [x] => -4.33351
                    [y] => 7.39873
                    [z] => 6.4
                    [scale] => 0.3
                    [rot] => 0.122173
                    [file] => Doodads\LordaeronSummer\Props\Flies\Flies.mdl
                    [red] => 255
                    [green] => 200
                    [blue] => 200
                    [alpha] => 100
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [15] => Array
                (
                    [x] => 5.39259
                    [y] => -2.79764
                    [z] => -6.4
                    [scale] => 0.25
                    [rot] => 5.51524
                    [file] => Doodads\LordaeronSummer\Props\Flies\Flies.mdl
                    [red] => 255
                    [green] => 200
                    [blue] => 200
                    [alpha] => 100
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [16] => Array
                (
                    [x] => 44.8984
                    [y] => -0.946648
                    [z] => 12.8
                    [scale] => 0.2
                    [rot] => 5.49779
                    [file] => Doodads\Ruins\Terrain\RuinsWall135\RuinsWall1352.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [17] => Array
                (
                    [x] => -2.74986
                    [y] => 46.9452
                    [z] => 19.2
                    [scale] => 0.2
                    [rot] => 0.785398
                    [file] => Doodads\Ruins\Terrain\RuinsWall135\RuinsWall1352.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [18] => Array
                (
                    [x] => -43.7985
                    [y] => -1.55855
                    [z] => 12.8
                    [scale] => 0.2
                    [rot] => 2.3562
                    [file] => Doodads\Ruins\Terrain\RuinsWall135\RuinsWall1352.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [19] => Array
                (
                    [x] => -3.0757
                    [y] => 47.4756
                    [z] => 0
                    [scale] => 0.2
                    [rot] => 0.785398
                    [file] => Doodads\Ruins\Terrain\RuinsWall135\RuinsWall1352.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [20] => Array
                (
                    [x] => -41.9925
                    [y] => 0.774975
                    [z] => 0
                    [scale] => 0.2
                    [rot] => 2.3562
                    [file] => Doodads\Ruins\Terrain\RuinsWall135\RuinsWall1352.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [21] => Array
                (
                    [x] => 44.7093
                    [y] => -0.879212
                    [z] => 0
                    [scale] => 0.2
                    [rot] => 5.49779
                    [file] => Doodads\Ruins\Terrain\RuinsWall135\RuinsWall1352.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [22] => Array
                (
                    [x] => -1.46622
                    [y] => -2.85077
                    [z] => 12.8
                    [scale] => 0.2
                    [rot] => 3.14159
                    [file] => Doodads\Cinematic\ElevatorPuzzle\ElevatorPuzzle.mdl
                    [red] => 227
                    [green] => 200
                    [blue] => 129
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

        )

    [dmgTable] => Array
        (
        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Tower Creation
                    [code] => set tower.userInt = 0
                    [values] => Array
                        (
                            [icon] => 
                            [visible] => false
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [1] => Array
                (
                    [name] => On Damage
                    [code] => //Set damage to 0 so the tower doesn't deal 2x damage on first hit.
    set Event.damage = 0
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 1.0
                            [icon] => 
                            [visible] => false
                            [name] => 
                            [short_explain] => 
                            [ONDAMAGE_chanceLevelAdd] => 0.0
                            [long_explain] => 
                        )

                )

            [2] => Array
                (
                    [name] => Header
                    [code] => globals
        ProjectileType Maj_bouncingProj
        BuffType Maj_astralEruption
        BuffType Maj_astralDmgModBuff
    endglobals
    
    
    // p.userInt = number of crits
    // p.userInt2 = UID
    // p.userInt3 = check for buff
    // p.userReal = damage loss per bounce
    // p.userReal2 = damage ratio of this projectile
    // p.userReal3 = damage to deal
    function bounce takes Projectile p, Unit target returns nothing
        local Tower tower = p.getCaster()
        local Iterate it
        local Unit next
        local Projectile P
        local Playor pl
        local integer intVar
        local string critStr
        local real dmgMod
        local Buff b
        
        //Check if this projectile has damage ratio left and if the target is still alive.
        if p.userReal2 > 0 and target.getUID() == p.userInt2 then
            //Set the locals.
            set it = Iterate.overUnitsInRangeOfUnit(tower, TARGET_CREEPS, target, 500)
            set intVar = 0
            set critStr = ""
            set b = target.getBuffOfType(Maj_astralDmgModBuff)
            
            //Check if the tower cast the buff since the last time this projectile hit.
            if tower.getBuffOfType(Maj_astralEruption) > 0 and p.userInt3 == 0 then
                set p.userInt3 = 1
            endif
            
            //Check if the tower crit this attack, and if so, display the damage colored red above the tower
            //with exclamation marks after it equal to the number of crits. This only runs the first time the
            //projectile hits because p.userInt is set to 0 at the end.
            if p.userInt > 0 then
                set pl = tower.getOwner()
                set intVar = 0
                loop
                    set critStr = critStr + "!"
                    set intVar = intVar + 1
                    exitwhen intVar == p.userInt
                endloop
                call pl.displayFloatingText(I2S(R2I(p.userReal3)) + critStr, tower, 255, 0, 0)
            endif
            
            //Check if the buff was applied on the tower when it launched this projectile, and if
            //the target isn't immune then increase the damage it takes from astral, and apply the
            //buff or if the buff was already applied, increase the amount of damage taken to remove
            //when the buff gets purged or similar.
            if p.userInt3 == 1 then
                if target.isImmune() == false then
                    set dmgMod = p.userReal2*0.01
                    call target.modifyProperty(MOD_DMG_FROM_ASTRAL, dmgMod)
                
                    if b > 0 then
                        set b.userReal = b.userReal+dmgMod
                    else
                        set b = Maj_astralDmgModBuff.apply(tower,target,0)
                        set b.userReal = dmgMod
                    endif
                endif
            endif
            
            // Deal the damage (double if the projectile got buffed).
            call tower.doAttackDamage(target,p.userReal3 * p.userReal2 * (1+p.userInt3),1)
            
            //Choose a target from all creeps in 500 range that isn't this projectile's target.
            set next = it.nextRandom()
            if next == target and next != 0 then
                set next = it.nextRandom()
            endif
            //If no valid targets in range, end here and decrease tower's userInt so portal can fire again.
            if next == 0 then
                set tower.userInt = tower.userInt - 1
                return
            endif
            call it.destroy()
            
            //Fire the projectile to the next unit and set all the necessary values.
            set P = Projectile.createLinearInterpolationFromUnitToUnit(Maj_bouncingProj, tower, 1, 1, target, next, .35, true)
            
            set P.userInt = 0
            set P.userInt2 = next.getUID()
            set P.userInt3 = p.userInt3
            set P.userReal = p.userReal
            set P.userReal2 = p.userReal2-p.userReal    //decrease new projectile's damage multiplier
            set P.userReal3 = p.userReal3
        
        //Or if the projectile had no damage ratio, end here and decrease the tower userInt.
        else
            set tower.userInt = tower.userInt - 1
        endif
    endfunction
    
    //In case the buff gets purged.
    function removeMod takes Buff b returns nothing
        call b.getBuffedUnit().modifyProperty(MOD_DMG_FROM_ASTRAL, -b.userReal)
    endfunction
   
    //Do not remove or rename this function!
    //Put your initialization tasks here, this function will be called on map init
    private function init takes nothing returns nothing
        set Maj_astralEruption = BuffType.create(6, 0.18, true)
        set Maj_astralDmgModBuff = BuffType.create(-1, 0, false)
        set Maj_bouncingProj = ProjectileType.createInterpolate("Abilities\\Weapons\\MurgulMagicMissile\\MurgulMagicMissile.mdl", 1250)
        call Maj_bouncingProj.setEventOnInterpolationFinished(ProjectileTargetEvent.bounce)
        call Maj_astralEruption.setBuffIcon('@@0@@')
        call Maj_astralDmgModBuff.setBuffIcon('@@1@@')
        call Maj_astralDmgModBuff.addEventOnCleanup(removeMod)
	endfunction
                    [values] => Array
                        (
                            [icon] => 
                            [visible] => false
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [3] => Array
                (
                    [name] => Autocast
                    [code] => local real x = tower.getX()
    local real y = tower.getY()
    call Maj_astralEruption.apply(tower, tower, tower.getLevel())
    call Effect.createColored("Abilities\\Spells\\Orc\\Voodoo\\VoodooAura.mdl", x, y, 0, 0, 1, 1, 255, 255, 255).setLifetime(0.5)
    call TriggerSleepAction(0.3)
    call Effect.createColored("Abilities\\Spells\\Orc\\Voodoo\\VoodooAura.mdl", x, y, 0, 0, 2, 1, 255, 255, 255).setLifetime(0.5)
    call TriggerSleepAction(0.3)
    call Effect.createColored("Abilities\\Spells\\Orc\\Voodoo\\VoodooAura.mdl", x, y, 0, 0, 3, 1, 255, 255, 255).setLifetime(0.5)
                    [values] => Array
                        (
                            [caster_art] => 
                            [icon] => ReplaceableTextures\CommandButtons\BTNWispSplode.blp
                            [AUTOCAST_cooldown] => 35
                            [AUTOCAST_numBuffsBeforeIdle] => 0
                            [AUTOCAST_isExtended] => false
                            [long_explain] => Releases a huge wave of astral power through the gate, weakening the boundary between the planes.|nThis empowers all currently alive falcons and any that are created during the next |cffFFFF806|r seconds, allowing them to deal double damage and partially shift their targets into the astral plane, increasing the damage they take from astral towers by |cffFFFF801%|r of the falcon's current damage ratio.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.18|r seconds
                            [AUTOCAST_autocastType] => AC_TYPE_OFFENSIVE_IMMEDIATE
                            [AUTOCAST_manacost] => 1000
                            [AUTOCAST_range] => 0
                            [AUTOCAST_buffType] => Maj_astralEruption
                            [name] => Astral Eruption
                            [AUTOCAST_targetSelf] => true
                            [short_explain] => Weakens the boundary between the planes, allowing more energy through.
                            [AUTOCAST_targetType] => 0
                            [target_art] => 
                            [AUTOCAST_autoRange] => 700
                        )

                )

            [4] => Array
                (
                    [name] => On Attack
                    [code] => local Unit target
    local integer crits
    local real curDmg
    local Projectile p
    local Buff b

    //Check if the amount of birds summoned is low enough to create another one.
    if tower.userInt < R2I(1+(tower.getLevel()/8)) or tower.calcChance(0.20) then
        //Set the locals.
        set target = Event.getTarget()
        set crits = tower.getNumberOfCrits()
        set curDmg = tower.getCurrentAttackDamageWithBonus()
        set b = tower.getBuffOfType(Maj_astralEruption)
        
        //Set the projectile values.
        set p = Projectile.createLinearInterpolationFromUnitToUnit(Maj_bouncingProj, tower, 1, 1, tower, target, .5, true)
        set p.userInt2 = target.getUID()
        set p.userReal = 0.05-(tower.getLevel()*0.001)  //damage multiplier loss per bounce
        set p.userReal2 = 1 //Projectile's current damage multiplier
        if b > 0 then
            set p.userInt3 = 1
        else
            set p.userInt3 = 0
        endif
        //Check for crits.
        if (crits > 0) then
            set p.userReal3 = curDmg * (crits * (tower.getProp_AtkCritDamage() - 1) + 1)
            set p.userInt = crits
        else
            set p.userReal3 = curDmg
            set p.userInt = 0
        endif    
        
        //Increase counter for birds summoned.
        set tower.userInt = tower.userInt+1
    endif
    //Remove crits so a 0! doesn't pop up over the tower.
    call tower.resetAttackCrits()
                    [values] => Array
                        (
                            [icon] => ReplaceableTextures\CommandButtons\BTNScout.blp
                            [visible] => true
                            [name] => Planeshift
                            [short_explain] => Summons a falcon from the astral planes that bounces many times, dealing damage to creeps.
                            [ONATTACK_chance] => 1.0
                            [ONATTACK_chanceLevelAdd] => 0.0
                            [long_explain] => On attack the Gate releases a magical falcon to hunt down its enemies.|nThe falcon deals energy damage equal to the Gate's current attack damage and bounces until it runs out of damage. Each bounce deals |cffFFFF805%|r less damage.|nThere is a maximum of |cffFFFF801|r falcon summoned at a time and a |cffFFFF8020%|r chance to ignore the maximum.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80-0.1%|r damage loss per bounce|n|cffFFFF80+1|r falcon every |cffFFFF808|r levels
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => Bams
                    [oeValues] => Array
                        (
                            [Bufftip] => Astral Burst
                            [Targetattach] => Array
                                (
                                )

                            [Buffubertip] => An astral burst has been sent through this portal recently.
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNWispSplode.blp
                            [TargetArt] => Array
                                (
                                )

                        )

                )

            [1] => Array
                (
                    [id] => @@1@@
                    [derivedFrom] => Bams
                    [oeValues] => Array
                        (
                            [Bufftip] => Astral Shift
                            [Targetattach] => Array
                                (
                                )

                            [Buffubertip] => This unit has been struck by a planar bird; it takes more damage from astral towers.
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNWispSplode.blp
                            [TargetArt] => Array
                                (
                                )

                        )

                )

        )

    [units] => Array
        (
        )

    [references] => Array
        (
        )

)