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

            [targs1] => ground,enemies
            [splashTargs1] => ground,enemies
            [goldcost] => 2500
            [weapsOn] => 1
            [Hfact1] => 0.4
            [dice1] => 1
            [Missilespeed] => 900
            [moveHeight] => 40
            [file] => units\undead\MeatWagon\MeatWagon.mdl
            [Harea1] => 50
            [atkType1] => hero
            [modelScale] => 0.3
            [weapTp1] => msplash
            [Missilearc] => 0.3
            [acquire] => 1150
            [rangeN1] => 1150
            [upgrades] => Array
                (
                )

            [cool1] => 3
            [Ubertip] => The Plague Bringer is a siege engine mounted ontop of corrupted crypts using the corpses of the fallen as ammunition.
            [green] => 230
            [Farea1] => 25
            [abilList] => Array
                (
                )

            [Qarea1] => 150
            [launchZ] => 75
            [Name] => Plagued Crypt
            [Missileart] => Abilities\Weapons\MeatwagonMissile\MeatwagonMissile.mdl
            [launchY] => -15
            [Art] => ReplaceableTextures\CommandButtons\BTNMeatWagon.blp
            [red] => 155
            [buildingShadow] => Array
                (
                )

            [blue] => 155
            [turnRate] => 0.4
            [unitSound] => Meatwagon
            [Qfact1] => 0.25
            [sides1] => 18
            [uberSplat] => OSMA
            [auto] => Array
                (
                )

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

    [settings] => Array
        (
            [author] => cedi
            [element] => darkness
            [authorDisplay] => cedi
            [alpha] => 255
            [balanceTip] => |cffFF0000Attacks GROUND only|r|n|cffCCFF00Splash attack:|n   |cffFFFF0025|r AoE: |cff00FF00100%|r damage|r|n   |cffFFFF0050|r AoE: |cffFFFF0040%|r damage|r|n   |cffFFFF00150|r AoE: |cffFF800025%|r damage|r
            [rarity] => unique
            [version] => 1.0
            [abil_factor] => 0.4
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => 19.1594
                    [y] => 43.7141
                    [z] => 0
                    [scale] => 0.5
                    [rot] => 1.61038
                    [file] => Doodads\Ashenvale\Props\ScorchedRemains\ScorchedRemains1.mdl
                    [red] => 155
                    [green] => 230
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [1] => Array
                (
                    [x] => 54.0721
                    [y] => -2.05844
                    [z] => 0
                    [scale] => 0.5
                    [rot] => 0.274618
                    [file] => Doodads\Ashenvale\Props\ScorchedRemains\ScorchedRemains1.mdl
                    [red] => 155
                    [green] => 230
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [2] => Array
                (
                    [x] => -43.9411
                    [y] => -0.0276194
                    [z] => 0
                    [scale] => 0.5
                    [rot] => 0.210246
                    [file] => Doodads\Ashenvale\Props\ScorchedRemains\ScorchedRemains1.mdl
                    [red] => 155
                    [green] => 230
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [3] => Array
                (
                    [x] => -19.6033
                    [y] => 42.1906
                    [z] => 0
                    [scale] => 0.5
                    [rot] => 2.41936
                    [file] => Doodads\Ashenvale\Props\ScorchedRemains\ScorchedRemains1.mdl
                    [red] => 155
                    [green] => 230
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [4] => Array
                (
                    [x] => 2.90509
                    [y] => 8.91049
                    [z] => 0
                    [scale] => 3
                    [rot] => 1.91986
                    [file] => Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
                    [red] => 180
                    [green] => 180
                    [blue] => 180
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [5] => Array
                (
                    [x] => 2.2196
                    [y] => 10.4554
                    [z] => 6.4
                    [scale] => 0.4
                    [rot] => 4.69965
                    [file] => buildings\undead\Ziggurat\Ziggurat.mdl
                    [red] => 155
                    [green] => 230
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => true
                    [animation] => birth
                    [aniSpeed] => 0.2
                )

            [6] => Array
                (
                    [x] => -4.43827
                    [y] => -1.50191
                    [z] => -6.4
                    [scale] => 0.6
                    [rot] => 3.75246
                    [file] => buildings\other\NerubianZiggurat\NerubianZiggurat.mdl
                    [red] => 120
                    [green] => 155
                    [blue] => 120
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

        )

    [dmgTable] => Array
        (
        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Damage
                    [code] => call BT.apply(tower, Event.getTarget(), tower.getLevel())
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 1.0
                            [icon] => 
                            [visible] => false
                            [name] => 
                            [short_explain] => 
                            [ONDAMAGE_chanceLevelAdd] => 0.0
                            [long_explain] => 
                        )

                )

            [1] => Array
                (
                    [name] => On Tower Details
                    [code] => call MB.setValue( 0, I2S( tower.getBuffOfType( cedi_armyOfDamned ).getLevel() ) )
    call MB.setValue( 1, formatFloat( 1.5 * Pow( 1.1, -tower.getBuffOfType( cedi_armyOfDamned ).getLevel() ), 2 ) )
    return MB
                    [values] => Array
                        (
                        )

                )

            [2] => Array
                (
                    [name] => Header
                    [code] => globals
        BuffType BT
        BuffType cedi_armyOfDamned
        MultiboardValues MB
    endglobals
    
    function periodicDamage takes Buff B returns nothing
        local Unit T = B.getBuffedUnit()
        local Unit C = B.getCaster()
        local integer level = C.getLevel()
        call C.doSpellDamage( T, (750.00 + level * 30.00) + (( 375.00 + 15.00 * level) * B.userInt ), C.calcSpellCritNoBonus() )
    endfunction
    
    function periodicSpread takes Buff B returns nothing
        local Tower C = B.getCaster()
        local Unit T = B.getBuffedUnit()
        local Unit U
        local integer level = C.getLevel()
        local Iterate I
        //spread
        if B.userInt2 == 1 then
            set I = Iterate.overUnitsInRangeOfUnit( C, TARGET_CREEPS, T, 250.00 )
            loop
                set U = I.nextRandom()
                exitwhen U == 0
                if U != T then
                    call BT.apply(C, U, level)
                    call I.destroy()
                    exitwhen true
                endif
            endloop
        else
            set B.userInt2 = 1
        endif
        
        set B = C.getBuffOfType( cedi_armyOfDamned )
        if B == 0 then
            call Event.getCurrentPeriodicEvent().enableAdvanced(1.5, false )
        else
            //call Event.getCurrentPeriodicEvent().enableAdvanced(1.5 * Pow( 0.9, B.getLevel()), false )  //this decreases time between spreads by 10%
            call Event.getCurrentPeriodicEvent().enableAdvanced(1.5 * Pow( 1.1, -B.getLevel()), false ) //this increases rate of spreading by 10%   (there is a difference)
        endif
    endfunction
    
    function refresh takes Buff B returns nothing
        set B.userInt = B.userInt + 1
    endfunction
        
    function onCreate takes Buff B returns nothing
        set B.userInt = 0      // Damage increase multiplier
        set B.userInt2 = 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 BT = BuffType.create( 5.00, 0.2, false )
        call BT.setBuffIcon( '@@0@@' )
        call BT.addPeriodicEvent( periodicDamage, 1 )
        call BT.addPeriodicEvent( periodicSpread, 0.01 )    //the periodic gets set in the periodic handling event
        call BT.setEventOnRefresh( refresh )
        call BT.setEventOnUpgrade( refresh )
        call BT.addEventOnCreate( onCreate)
        
        call m.addModification( MOD_ATTACKSPEED, 0.0, 0.05 )
        call m.addModification( MOD_DAMAGE_BASE_PERC, 0.0, 0.05 )
        set cedi_armyOfDamned = BuffType.create( -1, 0, true )
        call cedi_armyOfDamned.setBuffIcon( '@@1@@' )
        call cedi_armyOfDamned.setBuffModifier( m )
        
        set MB = MultiboardValues.create( 2 )
        call MB.setKey( 0, "Souls Extracted" )
        call MB.setKey( 1, "Infection Rate" )
	endfunction
                    [values] => Array
                        (
                            [icon] => ReplaceableTextures\CommandButtons\BTNPlagueCloud.blp
                            [visible] => true
                            [name] => Plague
                            [short_explain] => The attacks of this tower are infected with a plague.
                            [long_explain] => When a creep is damaged by this tower it will become infected with a plague. This plague deals |cffFFFF80750|r damage per second and lasts |cffFFFF805|r seconds. Every |cffFFFF801.5|r seconds the plague can spread to a creep in |cffFFFF80250|r range around the infected creep. If an infected creep is infected again by the plague the duration will refresh and the damage is increased by |cffFFFF80375|r.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+30|r damage|n|cffFFFF80+0.2|r seconds duration|n|cffFFFF80+15|r damage per rebuff
                        )

                )

            [3] => Array
                (
                    [name] => Periodic
                    [code] => local Iterate I = Iterate.overCorpsesInRange( tower, tower.getX(), tower.getY(), 1150.00 )
   local unit u = I.nextCorpse()
   local Buff B = tower.getBuffOfType(cedi_armyOfDamned)
   local integer UID
   if u != null then
      call I.destroy()
      call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl", GetUnitX(u), GetUnitY(u)))
      call RemoveUnit(u)
      set u = null
       
      if B != 0 then
         set B = cedi_armyOfDamned.apply(tower, tower, B.getLevel() + 1)
      else
         set B = cedi_armyOfDamned.apply(tower, tower, 1)      
      endif
       
      set UID = B.getUID()

      call TriggerSleepAction((20 + 0.4 * tower.getLevel()) * tower.getProp_BuffDuration())

      if B.getUID() == UID then
         call B.setLevel(B.getLevel()-1)
         if B.getLevel() == 0 then
            call B.removeBuff()
         endif
      endif
   endif
                    [values] => Array
                        (
                            [icon] => ReplaceableTextures\CommandButtons\BTNDarkSummoning.blp
                            [visible] => true
                            [PERIODIC_period] => 3.0
                            [name] => Army of the Damned
                            [short_explain] => Uses nearby corpses to increase this tower's attack speed and damage and Plague's rate of spread.
                            [long_explain] => Every |cffFFFF803|r seconds, if there is a corpse within |cffFFFF801150|r range this tower will extract its soul, increasing its attack speed and damage by |cffFFFF805%|r and Plague's rate of spread by |cffFFFF8010%|r. This buff lasts |cffFFFF8020|r seconds and stacks, but new stacks will not refresh the duration of old ones.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.4|r seconds duration
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => BHfs
                    [oeValues] => Array
                        (
                            [Bufftip] => Plague
                            [Targetattach] => head
                            [Buffubertip] => This creep takes damage over time and is highly infectious!
                            [Targetattachcount] => 1
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNPlagueCloud.blp
                            [TargetArt] => Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
                            [EditorName] => Plague
                        )

                )

            [1] => Array
                (
                    [id] => @@1@@
                    [derivedFrom] => Binf
                    [oeValues] => Array
                        (
                            [Bufftip] => Army of the Damned
                            [Targetattach] => weapon
                            [Buffubertip] => This tower has increased attack speed and an increased plague infection rate.
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNDarkSummoning.blp
                            [TargetArt] => Abilities\Spells\Items\OrbVenom\OrbVenomMissile.mdl,Abilities\Spells\NightElf\TargetArtLumber\TargetArtLumber.mdl
                            [EditorName] => Army of the Damned
                        )

                )

        )

    [units] => Array
        (
        )

    [references] => Array
        (
        )

)