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

            [Art] => ReplaceableTextures\CommandButtons\BTNSacrificialPit.blp
            [dmgplus1] => 839
            [bldtm] => 1
            [goldcost] => 425
            [unitSound] => SacrificialAltar
            [sides1] => 1
            [Missilearc] => 0.6
            [launchZ] => 0
            [acquire] => 2500
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Necrotic Mortar
            [weapTp1] => msplash
            [file] => units\nightelf\Wisp\Wisp.mdl
            [uberSplat] => YTDB
            [Missilespeed] => 1500
            [Missileart] => Abilities\Weapons\IllidanMissile\IllidanMissile.mdl
            [dice1] => 1
            [RngBuff1] => 250
            [modelScale] => 0.75
            [rangeN1] => 2500
            [atkType1] => hero
            [cool1] => 7
            [Ubertip] => A volley of death and damnation.
            [scaleBull] => 0
            [abilList] => Array
                (
                )

            [buildingShadow] => Array
                (
                )

            [targs1] => ground
            [weapsOn] => 1
            [minRange] => 1250
            [teamColor] => 6
        )

    [settings] => Array
        (
            [balanceTip] => |cffFFFF001250|r |cffFF0000minimum attack range|r|n|cffFF0000Attacks GROUND only|r|n|cffCCFF00Splash attack:|n   |cffFFFF00150|r AoE: |cff00FF00100%|r damage|r|n|cffFFFF00+3% |rattack speed/lvl
            [abil_factor] => 0.45
            [author] => Ashbringer
            [alpha] => 255
            [authorDisplay] => |cffff6600Ashbringer|r
            [version] => 1.0
            [element] => darkness
            [rarity] => uncommon
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -3.10147
                    [y] => -0.227176
                    [z] => 0.000000953674
                    [scale] => 0.31
                    [rot] => 4.50295
                    [file] => buildings\undead\SacrificialPit\SacrificialPit.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => true
                    [animation] => Array
                        (
                        )

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

            [1] => Array
                (
                    [x] => -0.00569187
                    [y] => 0.0132058
                    [z] => -19.2
                    [scale] => 1.65
                    [rot] => 2.77507
                    [file] => Abilities\Spells\Other\GeneralAuraTarget\GeneralAuraTarget.mdl
                    [red] => 1
                    [green] => 255
                    [blue] => 1
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

        )

    [dmgTable] => Array
        (
            [0] => Array
                (
                    [id] => MOD_ATTACKSPEED
                    [base] => 0
                    [add] => 0.03
                )

        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Attack
                    [code] => local Creep target = Event.getTarget()
    local integer power = R2I((0.15 + (tower.getLevel() * 0.006)) / 0.001)
    local real debuff_dmg = 0.1 + (tower.getLevel() * 0.004)
    
    call ashbringer_mortar_launch(tower, target.getX(), target.getY(), 5, debuff_dmg, power, 0)
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNOrbOfDeath.blp
                            [name] => Necrotic Volley
                            [short_explain] => Attacks bombard the area around the target with multiple projectiles.
                            [ONATTACK_chance] => 1.0
                            [ONATTACK_chanceLevelAdd] => 1.0
                            [long_explain] => Attacks bombard the area around the target with |cffffff805|r additional projectiles. The further away the enemy is, the greater the spread of the projectiles.
                        )

                )

            [1] => Array
                (
                    [name] => Header
                    [code] => globals
        ProjectileType ashbringer_mortar_missile
        //@export
        BuffType ashbringer_damned_buff
    endglobals
    
    //@export
    function ashbringer_mortar_launch takes Tower tower, real x, real y, integer count, real debuff_dmg, integer power, real z returns nothing
        local real tower_x = tower.getX()
        local real tower_y = tower.getY()
        local real target_x 
        local real target_y
        local real random_angle
        local real random_distance
        local real crit = tower.calcAttackMulticrit(0, 0, 0)
        local real distance = DistanceBetweenPoints(Location(tower_x, tower_y), Location(x, y))
        local Projectile p
        
        loop
            exitwhen count == 0
            set random_angle = GetRandomReal(0, 360)
            set random_distance = GetRandomReal(50, 250 + (distance / 10) )
            set target_x = x + random_distance * Cos(Deg2Rad(random_angle))
            set target_y = y + random_distance * Sin(Deg2Rad(random_angle))
            set p = Projectile.createLinearInterpolationFromPointToPoint(ashbringer_mortar_missile, tower, 0, 0, tower_x, tower_y, z, target_x, target_y, 0, 0.6)
            set p.userReal = tower.getCurrentAttackDamageWithBonus()
            set p.userReal2 = crit
            set p.userReal3 = tower.getCurrentAttackDamageWithBonus() * debuff_dmg
            set p.userInt = power
            call p.setScale(1.4)
            set count = count - 1
            call TriggerSleepAction(0.02)
            //set p.speed = distance
        endloop
    endfunction
    
    function ashbringer_mortar_hit takes Projectile p returns nothing
        local Tower tower = p.getCaster()
        local Iterate i
        local Creep next
        local Buff b
        
        set i = Iterate.overUnitsInRange(tower, TARGET_TYPE_CREEPS, p.x, p.y, 150)
        loop
            set next = i.next()
            exitwhen next == 0
            call tower.doAttackDamage(next, p.userReal, p.userReal2)
            call Effect.createSimpleOnUnit("Abilities\\Weapons\\IllidanMissile\\IllidanMissile.mdl", next, "chest").destroy()
            set b = next.getBuffOfType(ashbringer_damned_buff)
            if b!=0 then
                set b.userInt = b.userInt + 1
                if p.userReal3 > b.userReal then
                    set b.userReal = p.userReal3
                endif
                if p.userInt > b.getPower() then
                    call b.setPower(p.userInt)
                endif
                call b.refreshDuration()
            else
                set b = ashbringer_damned_buff.apply(tower, next, p.userInt)
                set b.userInt = 1
                set b.userInt2 = tower
                set b.userReal = p.userReal3
            endif
        endloop
    endfunction
    
    function ashbringer_damned_periodic takes Buff b returns nothing
        local Tower tower = b.userInt2
        local Creep target = b.getBuffedUnit()
        
        call tower.doCustomAttackDamage(target, b.userReal * b.userInt, tower.calcAttackMulticrit(0, 0, 0), AttackType.DECAY)
    endfunction
    
    //Do not remove or rename this function!
    //Put your initialization tasks here, this function will be called on map init
    private function init takes nothing returns nothing
        local Modifier mod = Modifier.create()
        set ashbringer_mortar_missile = ProjectileType.create("Abilities\\Weapons\\IllidanMissile\\IllidanMissile.mdl", 15, 1500) 
        call ashbringer_mortar_missile.setEventOnCleanup(ProjectileEvent.ashbringer_mortar_hit)
        
        set ashbringer_damned_buff = BuffType.create(5, 0.12, false)
        call ashbringer_damned_buff.setBuffIcon('@@0@@')
        call ashbringer_damned_buff.addPeriodicEvent(ashbringer_damned_periodic, 1)
        call mod.addModification(MOD_HP_REGEN_PERC, 0, -0.001)
        call ashbringer_damned_buff.setBuffModifier(mod)
    endfunction
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [2] => Array
                (
                    [name] => On Damage
                    [code] => local Creep target = Event.getTarget()
    local Buff b
    local integer power = R2I((0.15 + (tower.getLevel() * 0.006)) / 0.001)
    local real debuff_dmg = tower.getCurrentAttackDamageWithBonus() * 0.1 + (tower.getLevel() * 0.004)
    
    set b = target.getBuffOfType(ashbringer_damned_buff)
    if b!=0 then
        set b.userInt = b.userInt + 1
        if debuff_dmg > b.userReal then
            set b.userReal = debuff_dmg
        endif
        if power > b.getPower() then
            call b.setPower(power)
        endif
        call b.refreshDuration()
    else
        set b = ashbringer_damned_buff.apply(tower, target, power)
        set b.userInt = 1
        set b.userInt2 = tower
        set b.userReal = debuff_dmg
    endif
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 1.0
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNDeathCoil.blp
                            [name] => Damned
                            [short_explain] => Enemies hit have reduced life regeneration and take stacking damage over time.
                            [ONDAMAGE_chanceLevelAdd] => 0
                            [long_explain] => Each volley hit inflicts a stack of damned on the enemy. Damned deals |cffffff8010%|r of attack damage per stack per second and reduces life regeneration by |cffffff8015%|r. Lasts |cffffff805|r seconds.|n|n|cffFF8000Level Bonus:|r|n|cffffff80+0.4%|r of attack damage|n|cffffff80+0.6%|r life regeneration reduction|n|cffffff80+0.12|r seconds duration
                        )

                )

            [3] => Array
                (
                    [name] => On Tower Creation
                    [code] => call SetUnitColor(tower.getUnit(), ConvertPlayerColor(6))
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => Binf
                    [oeValues] => Array
                        (
                            [Targetattach] => chest
                            [Buffubertip] => Reduced life regeneration and taking damage over time.
                            [TargetArt] => Abilities\Weapons\BansheeMissile\BansheeMissile.mdl
                            [Bufftip] => Damned
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNDeathCoil.blp
                        )

                )

        )

    [units] => Array
        (
        )

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

        )

    [lightning] => Array
        (
        )

)