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

            [Art] => ReplaceableTextures\CommandButtons\BTNNerubianZiggurat.blp
            [dmgplus1] => 695
            [bldtm] => 1
            [unitSound] => Array
                (
                )

            [goldcost] => 600
            [sides1] => 1
            [launchZ] => 100
            [acquire] => 800
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Undisturbed Crypt
            [red] => 100
            [weapTp1] => missile
            [MissileHoming] => 1
            [file] => Doodads\Northrend\Structures\AncientZiggurat\AncientZiggurat1.mdl
            [uberSplat] => Array
                (
                )

            [Missileart] => Abilities\Spells\Undead\OrbOfDeath\AnnihilationMissile.mdl
            [Missilespeed] => 1000
            [dice1] => 1
            [RngBuff1] => 250
            [green] => 100
            [modelScale] => 0.4
            [rangeN1] => 1000
            [atkType1] => hero
            [cool1] => 1.95
            [Ubertip] => A combination of decaying body parts and the presence of an unfathomable evil create a pillar of darkness within this crypt to form a reliable attack and the ability to explode corpses.
            [blue] => 100
            [abilList] => Array
                (
                )

            [buildingShadow] => Array
                (
                )

            [targs1] => Array
                (
                )

            [weapsOn] => 1
        )

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

            [abil_factor] => 0.55
            [mail] => footbanana
            [author] => eMoo
            [alpha] => 255
            [authorDisplay] => eMoo
            [element] => darkness
            [rarity] => rare
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -6.5114
                    [y] => 8.66364
                    [z] => 57.6
                    [scale] => 1
                    [rot] => 5.63741
                    [file] => Abilities\Spells\Other\BlackArrow\BlackArrowMissile.mdl
                    [red] => 1
                    [green] => 1
                    [blue] => 1
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [1] => Array
                (
                    [x] => -3.09968
                    [y] => 3.22637
                    [z] => 76.8
                    [scale] => 0.7
                    [rot] => 4.98651
                    [file] => Abilities\Spells\Other\BlackArrow\BlackArrowMissile.mdl
                    [red] => 1
                    [green] => 1
                    [blue] => 1
                    [alpha] => 255
                    [pitch] => -4.68
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [2] => Array
                (
                    [x] => 24.8482
                    [y] => -40.4773
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 0.366519
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile0.mdl
                    [red] => 100
                    [green] => 100
                    [blue] => 100
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [3] => Array
                (
                    [x] => 38.1927
                    [y] => -41.6792
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 1.64061
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile0.mdl
                    [red] => 100
                    [green] => 100
                    [blue] => 100
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [4] => Array
                (
                    [x] => 12.5705
                    [y] => -41.6792
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 2.04204
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile0.mdl
                    [red] => 100
                    [green] => 100
                    [blue] => 100
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [5] => Array
                (
                    [x] => -45.884
                    [y] => -16.2852
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 1.64061
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile0.mdl
                    [red] => 100
                    [green] => 100
                    [blue] => 100
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [6] => Array
                (
                    [x] => -48.9812
                    [y] => 11.2219
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 0.890118
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile0.mdl
                    [red] => 100
                    [green] => 100
                    [blue] => 100
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [7] => Array
                (
                    [x] => -28.7058
                    [y] => 23.3128
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 3.21141
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile0.mdl
                    [red] => 100
                    [green] => 100
                    [blue] => 100
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [8] => Array
                (
                    [x] => -21.3614
                    [y] => 40.5248
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 2.93215
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile0.mdl
                    [red] => 100
                    [green] => 100
                    [blue] => 100
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [9] => Array
                (
                    [x] => -0.925637
                    [y] => 45.1665
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 4.27606
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile0.mdl
                    [red] => 100
                    [green] => 100
                    [blue] => 100
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [10] => Array
                (
                    [x] => 18.5588
                    [y] => 44.004
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 3.89209
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile0.mdl
                    [red] => 100
                    [green] => 100
                    [blue] => 100
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [11] => Array
                (
                    [x] => 40.9237
                    [y] => 17.6428
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 5.65487
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile0.mdl
                    [red] => 100
                    [green] => 100
                    [blue] => 100
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [12] => Array
                (
                    [x] => 43.4311
                    [y] => -7.33867
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 4.05714
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile0.mdl
                    [red] => 100
                    [green] => 100
                    [blue] => 100
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [13] => Array
                (
                    [x] => -36.9392
                    [y] => -44.5261
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 3.78737
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile0.mdl
                    [red] => 100
                    [green] => 100
                    [blue] => 100
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [14] => Array
                (
                    [x] => -13.7583
                    [y] => -44.5261
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 1.53589
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile0.mdl
                    [red] => 100
                    [green] => 100
                    [blue] => 100
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

        )

    [dmgTable] => Array
        (
        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Attack
                    [code] => call burstFire(tower, 0.3+tower.getLevel()*0.006,Event.getTarget(),100)
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNFeedBack.blp
                            [name] => Critical Mass
                            [short_explain] => Has a chance to fire multiple projectiles on attack.
                            [ONATTACK_chance] => 0.3
                            [ONATTACK_chanceLevelAdd] => 0.003
                            [long_explain] => Has a |cffFFFF8030%|r chance on attack to shoot an extra projectile. For each projectile after the initial one, there is a |cffFFFF8030%|r chance to shoot an extra projectile. There is a maximum of |cffFFFF8014|r projectiles fired per attack.|n|n|cffFF8000Level Bonus:|r|n |cffFFFF80+0.3%|r initial chance|n |cffFFFF80+0.6%|r extra chance
                        )

                )

            [1] => Array
                (
                    [name] => Header
                    [code] => globals
    //@export
    ProjectileType Top_Crypt_ball
    ProjectileType meat
    //@export
    EventTypeList Top_Corpse_explode
    Unit array targList
    BuffType Top_Corpse_buff
    endglobals

    
    function fire takes Unit tower returns nothing
        local unit tu = tower.getUnit()
        local unit u
        local real tx = GetUnitX(tu)
        local real ty = GetUnitY(tu)
        local real r1
        local real r2
        local integer num = 0
        local Unit U
        local Iterate it = Iterate.overCorpsesInRange(tower,tx,ty,1000)
        local Iterate it2
        local Projectile proj

            
        // loops through all the nearby corpses
        loop
            if num == 0 then
                set u = it.nextCorpse()
            else
                call it.destroy()
            endif
            
            exitwhen u == null or num > 0
            
            if IsUnitType(u,UNIT_TYPE_FLYING) == false then 
                    
                set num = 0
                    
                set it2 = Iterate.overUnitsInRange(tower,TARGET_CREEPS,GetUnitX(u),GetUnitY(u),500)
                loop
                    set U = it2.next()
                    exitwhen U == 0
                    set targList[num] = U
                    set num = num + 1
                endloop
            endif
        endloop
            
        // if corpse is an actual unit then it sets off the ability
        if u != null then
            call ShowUnit(u,false)
            set U = 4
            set tx = GetUnitX(u)
            set ty = GetUnitY(u)
            call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Orc\\OrcLargeDeathExplode\\OrcLargeDeathExplode.mdl",tx,ty))
            
            call Effect.createScaled("Abilities\\Weapons\\MeatwagonMissile\\T_MeatwagonMissile.mdl",tx,ty,0,GetRandomReal(0,360),1.2).destroy()
            
            loop
                exitwhen 0 <= U
                set r1 = GetRandomReal(0.017,6.283)
                set r2 = GetRandomInt(200,500)
                set proj = Projectile.createLinearInterpolationFromPointToPoint(meat,tower,0,0,tx,ty,0,tx+r2*Cos(r1),ty+r2*Sin(r1),0,GetRandomReal(0.1,0.6))
                call proj.setScale(0.5)
                set U = U - 1
            endloop
            
            set U = 0
            loop
                exitwhen U >= num
                call Top_Corpse_buff.apply(tower, targList[U], tower.userInt)
                set U = U + 1
            endloop
        endif
        set tu = null
        set u = null
    endfunction
    
    function incDmg takes Unit tower returns nothing
        set tower.userInt = tower.userInt2+tower.userInt3*tower.getLevel()
    endfunction
    
    //@export
    function burstFire takes Tower tower, real chance, Creep target, real z returns nothing
        local integer numShots = 0
        local real x = tower.getX()
        local real y = tower.getY()
        local integer UID = target.getUID()
        local Projectile p
        loop
            set p = Projectile.createFromPointToUnit(Top_Crypt_ball,tower,1,1,x+GetRandomReal(-2*numShots,2*numShots),y+GetRandomReal(-2*numShots,2*numShots),z,target,true,false,false)
            call p.setScale(0.4)
            set p.speed = 500 + RMinBJ(numShots * 80,500)+numShots*20
            set p.accelerate = RMaxBJ(20 - numShots * 2,0)
            set numShots = numShots + 1
            exitwhen tower.calcChance(chance) == false or numShots >= 14 or target.getUID() != UID
        endloop
    endfunction
    
    function hit takes Projectile p, Unit creep returns nothing
        local Tower tower = p.getCaster()
        call tower.doAttackDamage(creep,tower.getCurrentAttackDamageWithBonus(),tower.calcAttackMulticrit(0, 0, 0))
    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 Top_Crypt_ball = ProjectileType.create("Abilities\\Spells\\Undead\\OrbOfDeath\\AnnihilationMissile.mdl",5,500)
        call Top_Crypt_ball.enableHoming(ProjectileTargetEvent.hit,0)
        
        set meat = ProjectileType.createInterpolate("Abilities\\Weapons\\MeatwagonMissile\\T_MeatwagonMissile.mdl",400)
        
        set Top_Corpse_explode = EventTypeList.create()
        call Top_Corpse_explode.addPeriodicEvent(fire,5)
        call Top_Corpse_explode.addEventOnLevelUp(incDmg)
        
        set Top_Corpse_buff = BuffType.create(8, 0.25, false)
        call Top_Corpse_buff.setBuffIcon('@@0@@')
        call m.addModification(MOD_MOVESPEED, 0, -0.001)
        call m.addModification(MOD_DMG_FROM_DARKNESS, 0, 0.001)
        call Top_Corpse_buff.setBuffModifier(m)
    endfunction
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNDarkSummoning.blp
                            [name] => Corpse Explosion
                            [short_explain] => Occasionally explodes nearby corpses for large damage
                            [long_explain] => Explodes a corpse within |cffFFFF801000|r range of the tower, causing enemies in |cffFFFF80500|r range of the corpse to take |cffFFFF805%|r more damage from darkness towers and move |cffFFFF805%|r slower for |cffFFFF808|r seconds. |cffFFFF805|r second cooldown. Doesn't affect Air.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.2%|r slow and damage taken|n|cffFFFF80+0.25|r seconds duration
                        )

                )

            [2] => Array
                (
                    [name] => On Tower Creation
                    [code] => call tower.addEventList(Top_Corpse_explode)
set tower.userInt = 50 //This will be the base+level damage.
set tower.userInt2 = 50 //Base damage.
set tower.userInt3 = 2 //Level up damage.
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => Bslo
                    [oeValues] => Array
                        (
                            [Buffubertip] => This unit is coated with guts; it moves slower and takes more damage from darkness towers.
                            [TargetArt] => Array
                                (
                                )

                            [Bufftip] => Gut Coated
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNCorpseExplode.blp
                        )

                )

        )

    [units] => Array
        (
        )

    [references] => Array
        (
            [0] => Array
                (
                    [export] => true
                    [category] => global
                    [typ] => ProjectileType
                    [name] => Top_Crypt_ball
                )

            [1] => Array
                (
                    [export] => true
                    [category] => global
                    [typ] => EventTypeList
                    [name] => Top_Corpse_explode
                )

        )

)