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

            [Art] => ReplaceableTextures\CommandButtons\BTNLavaSpawn.blp
            [turnRate] => 3
            [dmgplus1] => 1269
            [bldtm] => 1
            [goldcost] => 900
            [unitSound] => LavaSpawn
            [sides1] => 5
            [acquire] => 1000
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Lava Spawnling
            [weapTp1] => missile
            [MissileHoming] => 1
            [file] => Units\Creeps\LavaSpawn\LavaSpawn.mdl
            [uberSplat] => YTDC
            [Missilespeed] => 1600
            [Missileart] => Abilities\Weapons\LavaSpawnMissile\LavaSpawnMissile.mdl
            [dice1] => 1
            [RngBuff1] => 250
            [modelScale] => 0.5
            [rangeN1] => 1000
            [atkType1] => pierce
            [cool1] => 2
            [Ubertip] => A fierce creature borne from the churning molten innards of the world.
            [abilList] => Array
                (
                )

            [moveHeight] => 20
            [buildingShadow] => Array
                (
                )

            [targs1] => Array
                (
                )

            [weapsOn] => 1
        )

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

            [abil_factor] => 0.65
            [author] => Ashbringer
            [alpha] => 255
            [authorDisplay] => |cffff6600Ashbringer|r
            [version] => 1.0
            [element] => fire
            [rarity] => rare
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => 0.9173
                    [y] => 1.37245
                    [z] => -19.2
                    [scale] => 0.25
                    [rot] => 4.71239
                    [file] => Abilities\Spells\Other\Volcano\Volcano.mdl
                    [red] => 255
                    [green] => 125
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [1] => Array
                (
                    [x] => 9.27654
                    [y] => -32.8384
                    [z] => 0
                    [scale] => 0.35
                    [rot] => 5.09795
                    [file] => Doodads\Dungeon\Rocks\DungeonRock\DungeonRock5.mdl
                    [red] => 185
                    [green] => 125
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [2] => Array
                (
                    [x] => -32.9286
                    [y] => -34.968
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 0.77368
                    [file] => Doodads\Dungeon\Rocks\DungeonRock\DungeonRock5.mdl
                    [red] => 185
                    [green] => 125
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [3] => Array
                (
                    [x] => 39.7594
                    [y] => -10.321
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 6.28231
                    [file] => Doodads\Dungeon\Rocks\DungeonRock\DungeonRock5.mdl
                    [red] => 185
                    [green] => 125
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [4] => Array
                (
                    [x] => -40.7002
                    [y] => 3.72054
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 3.59957
                    [file] => Doodads\Dungeon\Rocks\DungeonRock\DungeonRock1.mdl
                    [red] => 185
                    [green] => 125
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [5] => Array
                (
                    [x] => 25.7293
                    [y] => 30.5734
                    [z] => 0
                    [scale] => 0.4
                    [rot] => 5.12555
                    [file] => Doodads\Dungeon\Rocks\DungeonRock\DungeonRock1.mdl
                    [red] => 185
                    [green] => 125
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [6] => Array
                (
                    [x] => -0.0277833
                    [y] => -0.0713427
                    [z] => -19.2
                    [scale] => 1.6
                    [rot] => 0.488692
                    [file] => war3mapImported\GeneralAuraTargetWhite.mdl
                    [red] => 255
                    [green] => 55
                    [blue] => 1
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

        )

    [dmgTable] => Array
        (
        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Level Up
                    [code] => set tower.userReal = 0.35 + (tower.getLevel() * 0.014)
    set tower.userReal2 = 0.075 + (tower.getLevel() * 0.003)
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [1] => Array
                (
                    [name] => On Attack
                    [code] => call ashbringer_spawnling_start(tower, GetRandomInt(0, 1), tower.getX(), tower.getY(), Event.getTarget(), 0.4 + (tower.getLevel() * 0.008), 8 * tower.getProp_BuffDuration())
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNLavaSpawn.blp
                            [name] => Molten Proliferation
                            [short_explain] => Atacks can spawn a lesser copy which can duplicate itself further.
                            [ONATTACK_chance] => 0.1
                            [ONATTACK_chanceLevelAdd] => 0.0
                            [long_explain] => Attacks have a |cffFFFF8010%|r chance to spawn a lesser copy of the Lava Spawn near the target. The copy attacks nearby enemies for |cffFFFF8040%|r of the tower's dps and lasts |cffFFFF808|r seconds. Each attack made by a copy has a |cffFFFF8010%|r chance to create another copy, inheriting |cffFFFF8050%|r of its remaining duration. Cannot create further copies when there is less than |cffFFFF804|r seconds remaining. Duration is increased by buff duration stats.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.8%|r of attack damage
                        )

                )

            [2] => Array
                (
                    [name] => Header
                    [code] => globals
        BuffType ashbringer_livingbomb_buff
        ProjectileType ashbringer_spawnling_spawn_missile
        ProjectileType ashbringer_spawnling_attack_missile
    endglobals
    
    //@export
    function ashbringer_spawnling_start takes Tower tower, integer further_closer, real start_x, real start_y, Creep target, real damage, real duration returns nothing
        local Projectile p
        local real angle
        local real target_x = target.getX()
        local real target_y = target.getY()
        
        if further_closer == 0 then
            set further_closer = -1
        endif
        
        set angle = bj_RADTODEG * Atan2(start_y - target_y, start_x - target_x) 
        set angle = ModuloReal(GetRandomReal(angle-20, angle+20), 360)

        set target_x = target_x + (I2R(further_closer) * GetRandomReal(75, 125)) * Cos(Deg2Rad(angle))
        set target_y = target_y + (I2R(further_closer) * GetRandomReal(75, 125)) * Sin(Deg2Rad(angle))
        
        set p = Projectile.createLinearInterpolationFromPointToPoint(ashbringer_spawnling_spawn_missile, tower, 0, 0, start_x, start_y, 60, target_x, target_y, 0, 0.4)
        set p.userInt3 = R2I(damage * 1000)
        set p.userReal2 = angle
        set p.userReal3 = duration
    endfunction
    
    function ashbringer_spawnling_tick takes Tower t, Effect e returns nothing
        local Iterate i
        local Creep next
        local real speed = (1 + t.getProp_Attackspeed())
        local real period = RMaxBJ(2.0 / RMinBJ(RMaxBJ(speed, 0.5), 5), 0.3)
        local real angle
        local real x = e.userReal
        local real y = e.userReal2
        
        if (e.userReal3 + 0.1) > period and t.getUID() == e.userInt2 then
            set i = Iterate.overUnitsInRange(t, TARGET_TYPE_CREEPS, x, y, 600)
            set next = i.nextRandom()
            
            if next != 0 then
                set angle = bj_RADTODEG * Atan2(next.getY() - y, next.getX() - x)
                call e.setFacing(angle)
                call e.setAnimationSpeed(1.167/period)
                call e.setAnimation("attack")
                set Projectile.createFromPointToUnit(ashbringer_spawnling_attack_missile, t, 0.0, 0.0, x, y, 30, next, true, false, false).userInt3 = e.userInt3
                set e.userInt = 1
            
                if e.userReal3>4 and t.calcChance(0.1) then
                    call e.setAnimation("morph alternate")
                    call TriggerSleepAction(0.3)
                    call ashbringer_spawnling_start(t, -1, x, y, next, I2R(e.userInt3) / 1000, e.userReal3 * 0.5)
                    call TriggerSleepAction(period-0.3)
                else
                    call TriggerSleepAction(period)
                endif
                set e.userReal3 = e.userReal3 - period
                call ashbringer_spawnling_tick(t, e)
            else
                if e.userInt > 0 then
                    call e.setAnimationSpeed(1.0)
                    call e.setAnimation("stand ready")
                endif
        
                set e.userInt = 0
                set e.userReal3 = e.userReal3 - period
                call TriggerSleepAction(period)
                call ashbringer_spawnling_tick(t, e)
            endif
        else
            call e.setAnimationSpeed(1.5)
            call e.setAnimation("death")
            call TriggerSleepAction(3)
            //call e.noDeathAnimation()
            call e.destroy()
        endif
    endfunction
    
    function ashbringer_spawnling_hit takes Projectile p, Creep target returns nothing
        local Tower tower = p.getCaster()
        local real damage = tower.getCurrentAttackDamageWithBonus() * (I2R(p.userInt3) / 1000)
        
        call tower.doAttackDamage(target, damage, tower.calcAttackMulticrit(0, 0, 0))
    endfunction
    
    function ashbringer_spawnling_spawn takes Projectile p returns nothing
        local Tower tower = p.getCaster()
        local real x = p.x
        local real y = p.y
        local Effect e
        
        set e = Effect.createAnimatedScaled("Units\\Creeps\\LavaSpawn\\LavaSpawn.mdl", x, y, 0.0, p.userReal2, 0.6)
        
        set e.userInt = 1
        set e.userInt2 = tower.getUID()
        set e.userInt3 = p.userInt3
        set e.userReal = x
        set e.userReal2 = y
        set e.userReal3 = p.userReal3
        call e.setAnimationSpeed(2.0)
        call e.setAnimation("birth")
        call TriggerSleepAction(0.333)
        call ashbringer_spawnling_tick(tower, e)
    endfunction
    
    //@export
    function ashbringer_livingbomb_apply takes Tower tower, Creep target, integer level returns nothing
        local Buff b = target.getBuffOfType(ashbringer_livingbomb_buff)
        local integer power
        
        if b != 0 then
            set power = b.getPower()
            call b.setLevel(power + 1)
            call b.setPower(power + 1)
            set b.userInt = power + 1
            set b.userReal = tower.userReal
            set b.userReal2 = tower.userReal2
        else
            set b = ashbringer_livingbomb_buff.applyCustomPower(tower, target, 1, 1)
            set b.userInt = 1
            set b.userReal = tower.userReal
            set b.userReal2 = tower.userReal2
            call b.setRemainingDuration(3.0)
        endif
    endfunction
    
    function ashbringer_livingbomb_oncleanup takes Buff b returns nothing
        local Tower tower = b.getCaster()
        local Creep target = b.getBuffedUnit()
        local Iterate i = Iterate.overUnitsInRangeOfUnit(tower, TARGET_TYPE_CREEPS, target, 200)
        local Unit next
        local real damage = b.userInt * b.userReal * tower.getCurrentAttackDamageWithBonus()
        
        call Effect.createScaled("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl", target.getX(), target.getY(), 0, 0, 1.0).destroy()
        loop
            set next = i.next()
            exitwhen next == 0
            if tower.calcChance(b.userInt * b.userReal2) then
                call tower.doAttackDamage(next, damage, tower.calcAttackMulticrit(0, 0, 0))
                call ashbringer_livingbomb_apply(tower, next, tower.getLevel())
            endif
        endloop
    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_spawnling_spawn_missile = ProjectileType.create("Abilities\\Weapons\\LavaSpawnMissile\\LavaSpawnBirthMissile.mdl", 3, 1200)
        call ashbringer_spawnling_spawn_missile.setEventOnCleanup(ProjectileEvent.ashbringer_spawnling_spawn)
        
        set ashbringer_spawnling_attack_missile = ProjectileType.create("Abilities\\Weapons\\LavaSpawnMissile\\LavaSpawnMissile.mdl", 3.0, 1600)
        call ashbringer_spawnling_attack_missile.enableHoming(ashbringer_spawnling_hit, 0.0)
        
        set ashbringer_livingbomb_buff = BuffType.create(3.0, 0, false)
        call ashbringer_livingbomb_buff.setBuffIcon('@@0@@')
        call ashbringer_livingbomb_buff.addEventOnCleanup(EventHandler.ashbringer_livingbomb_oncleanup)
        call mod.addModification(MOD_DMG_FROM_FIRE, 0, 0.15)
        call ashbringer_livingbomb_buff.setBuffModifier(mod)
    endfunction
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [3] => Array
                (
                    [name] => On Damage
                    [code] => call ashbringer_livingbomb_apply(tower, Event.getTarget(), tower.getLevel())
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 0.075
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNLivingBomb.jpg
                            [name] => Living Bomb
                            [short_explain] => Attack have a chance on hit to apply a debuff which explodes after a delay and can spread further.
                            [ONDAMAGE_chanceLevelAdd] => 0.003
                            [long_explain] => Attacks have a |cffFFFF807.5%|r chance on hit to apply a stack of Living Bomb to the target. Living Bomb increases damage taken from |cFFFF5300Fire|r towers by |cffFFFF8015%|r per stack and lasts for |cffFFFF803.0|r seconds. When Living Bomb ends, it explodes, dealing |cffFFFF8035%|r of attack damage per stack to enemies within |cffFFFF80200|r range. The explosion has a |cffFFFF807.5%|r chance per stack to apply a stack to enemies hit. Additional stacks do not refresh the duration.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.3%|r chance|n|cffFFFF80+1.4%|r attack damage
                        )

                )

            [4] => Array
                (
                    [name] => On Tower Creation
                    [code] => set tower.userInt = 0
    set tower.userInt2 = 0
    set tower.userReal = 0.35 + (tower.getLevel() * 0.014)
    set tower.userReal2 = 0.075 + (tower.getLevel() * 0.003)
    call AddUnitAnimationProperties(tower.getUnit(), "alternate", false)
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => BNab
                    [oeValues] => Array
                        (
                            [Targetattach] => overhead
                            [EditorName] => Living Bomb
                            [Buffubertip] => Taking increased damage from fire towers. Detonates on expiration.
                            [TargetArt] => Abilities\Spells\Other\SoulBurn\SoulBurnbuff.mdl
                            [Bufftip] => Living Bomb
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNLivingBomb.jpg
                        )

                )

        )

    [units] => Array
        (
        )

    [references] => Array
        (
        )

    [lightning] => Array
        (
        )

)