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

            [Art] => ReplaceableTextures\CommandButtons\BTNArcaneFlame.blp
            [dmgplus1] => 573
            [bldtm] => 1
            [goldcost] => 750
            [unitSound] => MageTower
            [sides1] => 1
            [Missilearc] => 0.3
            [manaN] => 1000
            [launchZ] => 160
            [acquire] => 950
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Manaspark Spire
            [weapTp1] => msplash
            [file] => .mdl
            [uberSplat] => YTDG
            [Missilespeed] => 1500
            [Missileart] => war3mapImported\TwilightDragonMissile.mdl
            [dice1] => 1
            [RngBuff1] => 250
            [modelScale] => 0.1
            [rangeN1] => 950
            [atkType1] => pierce
            [cool1] => 1.75
            [Ubertip] => For burning more than just mana.
            [scaleBull] => 0
            [abilList] => Array
                (
                )

            [buildingShadow] => Array
                (
                )

            [targs1] => Array
                (
                )

            [weapsOn] => 1
        )

    [settings] => Array
        (
            [balanceTip] => |cffCCFF00Splash attack:|n   |cffFFFF00200|r AoE: |cff00FF00100%|r damage|r
            [abil_factor] => 0.6
            [author] => Ashbringer
            [alpha] => 0
            [authorDisplay] => |cffff6600Ashbringer|r
            [version] => 1.0
            [element] => arcane
            [rarity] => rare
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -0.211841
                    [y] => 0.163665
                    [z] => 0
                    [scale] => 0.54
                    [rot] => 5.49779
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 20
                    [green] => 20
                    [blue] => 115
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [1] => Array
                (
                    [x] => -1.07133
                    [y] => -0.290481
                    [z] => 96
                    [scale] => 0.44
                    [rot] => 0.785398
                    [file] => Doodads\Cityscape\Structures\City_LowWall_TallEndCap\City_LowWall_TallEndCap.mdl
                    [red] => 75
                    [green] => 1
                    [blue] => 75
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [2] => Array
                (
                    [x] => -0.0600059
                    [y] => 0.0680379
                    [z] => 179.2
                    [scale] => 1.45
                    [rot] => 4.85202
                    [file] => war3mapImported\TwilightRageTarget.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [3] => Array
                (
                    [x] => 0.0201634
                    [y] => -0.0973693
                    [z] => 140.8
                    [scale] => 0.4
                    [rot] => 4.70105
                    [file] => war3mapImported\TwilightImmolationTarget.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [4] => Array
                (
                    [x] => -0.500852
                    [y] => -16.4823
                    [z] => 0
                    [scale] => 0.12
                    [rot] => 1.5708
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 45
                    [green] => 1
                    [blue] => 65
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [5] => Array
                (
                    [x] => 0.237459
                    [y] => 16.5586
                    [z] => 0
                    [scale] => 0.12
                    [rot] => 4.71239
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 45
                    [green] => 1
                    [blue] => 65
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [6] => Array
                (
                    [x] => -0.500852
                    [y] => -16.4823
                    [z] => 6.4
                    [scale] => 0.12
                    [rot] => 1.5708
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 45
                    [green] => 1
                    [blue] => 65
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [7] => Array
                (
                    [x] => 0.237459
                    [y] => 16.5586
                    [z] => 6.4
                    [scale] => 0.12
                    [rot] => 4.71239
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 45
                    [green] => 1
                    [blue] => 65
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [8] => Array
                (
                    [x] => -0.500852
                    [y] => -16.4823
                    [z] => 12.8
                    [scale] => 0.12
                    [rot] => 1.5708
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 45
                    [green] => 1
                    [blue] => 65
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [9] => Array
                (
                    [x] => 0.237459
                    [y] => 16.5586
                    [z] => 12.8
                    [scale] => 0.12
                    [rot] => 4.71239
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 45
                    [green] => 1
                    [blue] => 65
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [10] => Array
                (
                    [x] => -0.0787883
                    [y] => 0.0456027
                    [z] => 64
                    [scale] => 0.95
                    [rot] => 0.0698132
                    [file] => Abilities\Spells\Undead\Possession\PossessionCaster.mdl
                    [red] => 115
                    [green] => 1
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [11] => Array
                (
                    [x] => -0.152538
                    [y] => -0.288403
                    [z] => 38.4
                    [scale] => 1.5
                    [rot] => 4.71239
                    [file] => Abilities\Spells\Undead\Possession\PossessionTarget.mdl
                    [red] => 85
                    [green] => 1
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -3.14
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [12] => Array
                (
                    [x] => -11.2619
                    [y] => 9.6843
                    [z] => 12.8
                    [scale] => 0.16
                    [rot] => 2.3562
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 20
                    [green] => 1
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [13] => Array
                (
                    [x] => 10.6032
                    [y] => 10.2359
                    [z] => 12.8
                    [scale] => 0.16
                    [rot] => 0.785398
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 20
                    [green] => 1
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [14] => Array
                (
                    [x] => 0.0160149
                    [y] => -0.186741
                    [z] => -12.8
                    [scale] => 0.7
                    [rot] => 4.57276
                    [file] => war3mapImported\TwilightImmolationTarget.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [15] => Array
                (
                    [x] => -10.0712
                    [y] => -10.1456
                    [z] => 12.8
                    [scale] => 0.16
                    [rot] => 3.92699
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 20
                    [green] => 1
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [16] => Array
                (
                    [x] => 10.4387
                    [y] => -9.57156
                    [z] => 12.8
                    [scale] => 0.16
                    [rot] => 5.49779
                    [file] => war3mapImported\City_ColumnSemiCircle2.mdl
                    [red] => 20
                    [green] => 1
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => -1.57
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

        )

    [dmgTable] => Array
        (
        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Attack
                    [code] => local real chance = 0.15 + (tower.getLevel() * 0.006)
    local real mana = 15 + (tower.getLevel() * 0.6)
    local real damage_per_mana = 75 + (tower.getLevel() * 3)
    call ashbringer_echo_launch(tower, tower.getUID(), Event.getTarget(), 5, chance, 160, mana, damage_per_mana)
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNArcaneFlame.blp
                            [name] => Echoing Blaze
                            [short_explain] => Attacks have a chance to fire additional projectiles.
                            [ONATTACK_chance] => 0.15
                            [ONATTACK_chanceLevelAdd] => 0.006
                            [long_explain] => Attacks have a |cffffff8015%|r chance to fire an additional projectile at a random point near the target. Each additional projectile can trigger another, up to a maximum of |cffffff805|r times.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.6%|r chance
                        )

                )

            [1] => Array
                (
                    [name] => Header
                    [code] => globals
        //@export
        ProjectileType ashbringer_echo_missile
    endglobals
    
    //@export
    function ashbringer_manaflame_feedback takes Tower tower, Creep target, real mana, real damage returns nothing
        set mana = target.subtractMana(mana, true)
        if mana > 0 then
            call tower.doSpellDamage(target, damage*mana, tower.calcSpellCritNoBonus())
            call tower.addMana(mana)
            call Effect.createSimpleOnUnit("Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayDamage.mdl", target, "chest").setLifetime(3.0)
        endif
    endfunction
    
    //@export
    function ashbringer_echo_launch takes Tower tower, integer UID, Creep target, integer max, real chance, real z, real mana, real damage_per_mana returns nothing
        local real target_x = target.getX()
        local real target_y = target.getY()
        local Projectile p
        local real random_angle = GetRandomReal(0, 360)
        local real random_distance = GetRandomReal(75, 225)
        
        call TriggerSleepAction(0.1)
        if tower.getUID() == UID then
            set target_x = target_x + random_distance * Cos(Deg2Rad(random_angle))
            set target_y = target_y + random_distance * Sin(Deg2Rad(random_angle))
            set p = Projectile.createLinearInterpolationFromPointToPoint(ashbringer_echo_missile, tower, 0, 0, tower.getX(), tower.getY(), z, target_x, target_y, target.getZ(), 0.3)
            set p.userReal = target_x
            set p.userReal2 = target_y
            set p.userReal3 = mana
            set p.userInt = UID
            set p.userInt2 = R2I(damage_per_mana * 100)
            set max = max - 1
            if max > 0 and tower.calcChance(chance) then
                call ashbringer_echo_launch(tower, UID, target, max, chance, z, mana, damage_per_mana)
            endif
        endif
    endfunction
    
    //@export
    function ashbringer_echo_hit takes Projectile p returns nothing
        local Tower tower = p.getCaster()
        local Iterate i
        local Creep next
        
        if tower.getUID() == p.userInt then
            set i = Iterate.overUnitsInRange(tower, TARGET_TYPE_CREEPS, p.userReal, p.userReal2, 200)
            loop
                set next = i.next()
                exitwhen next == 0
                call tower.doAttackDamage(next, tower.getCurrentAttackDamageWithBonus(), tower.calcAttackMulticrit(0, 0, 0))
                call ashbringer_manaflame_feedback(tower, next, p.userReal3, I2R(p.userInt2)/100)
            endloop
        endif
    endfunction
    
    //@export
    function ashbringer_manaflare_cast takes Tower tower, real damage, real mana_perc, real damage_per_mana, real z returns nothing
        local Iterate i = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TYPE_CREEPS, 950)
        local Creep next
        local real damage_final
        local real mana
        local real max_mana
        local real x = tower.getX()
        local real y = tower.getY()
        
        loop
            set next = i.next()
            exitwhen next == 0
            set mana = GetUnitState(next.getUnit(), UNIT_STATE_MANA)
            set max_mana = GetUnitState(next.getUnit(), UNIT_STATE_MAX_MANA)
            if max_mana > 0 then
                set mana = mana - next.subtractMana(mana * mana_perc, true)
                set damage_final = damage + ((max_mana - mana) * damage_per_mana)
            else
                set damage_final = damage
            endif
            call tower.doSpellDamage(next, damage_final, tower.calcSpellCritNoBonus())
            call Lightning.createFromPointToUnit("PMBZ", x, y, z, next).setLifetime(0.2)
            call Effect.createSimpleOnUnit("Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayDamage.mdl", next, "chest").setLifetime(3.0)
        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
        set ashbringer_echo_missile = ProjectileType.create("war3mapImported\\TwilightDragonMissile.mdl", 5, 1500) 
        call ashbringer_echo_missile.setEventOnCleanup(ProjectileEvent.ashbringer_echo_hit)
    endfunction
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [2] => Array
                (
                    [name] => On Damage
                    [code] => call ashbringer_manaflame_feedback(tower, Event.getTarget(), 15 + (tower.getLevel() * 0.6), 75 + (tower.getLevel() * 3))
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 1.0
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNFeedBack.blp
                            [name] => Siphon Burn
                            [short_explain] => Attacks burn mana and mana burnt is given to the tower.
                            [ONDAMAGE_chanceLevelAdd] => 0
                            [long_explain] => Attacks burn up to |cffffff8015|r mana from each enemy, dealing |cffffff8075|r spell damage per point of mana burnt. The tower gains mana equal to the amount of mana burnt. Immune enemies will lose mana but not take damage.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.6|r mana burnt|n|cffFFFF80+3|r spell damage per mana
                        )

                )

            [3] => Array
                (
                    [name] => Autocast
                    [code] => local real damage = 1500 + (tower.getLevel() * 30)
    local real mana_perc = 0.05 + (tower.getLevel() * 0.001)
    local real damage_per_mana = 75 + (tower.getLevel() * 3)
    
    call ashbringer_manaflare_cast(tower, damage, mana_perc, damage_per_mana, 160)
                    [values] => Array
                        (
                            [AUTOCAST_cooldown] => 8
                            [AUTOCAST_autoRange] => 800
                            [AUTOCAST_manacost] => 750
                            [icon] => ReplaceableTextures\CommandButtons\BTNManaFlare.blp
                            [AUTOCAST_range] => 900
                            [AUTOCAST_targetType] => 0
                            [AUTOCAST_numBuffsBeforeIdle] => 0
                            [caster_art] => 
                            [long_explain] => Deals |cffffff801500|r spell damage to all enemies within attack range. Additionally removes |cffffff805%|r of each enemy's current mana and then deals |cffffff8075|r spell damage per point of their maximum mana they are missing. Immune enemies will lose mana but not take damage.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+30|r base spell damage|n|cffFFFF80+0.1%|r mana burnt|n|cffFFFF80+3|r spell damage per mana
                            [target_art] => 
                            [AUTOCAST_autocastType] => AC_TYPE_OFFENSIVE_IMMEDIATE
                            [AUTOCAST_buffType] => 0
                            [AUTOCAST_isExtended] => false
                            [name] => Mana Flare
                            [AUTOCAST_targetSelf] => false
                            [short_explain] => Inflicts a powerful mana burn on all enemies in attack range.
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
        )

    [units] => Array
        (
        )

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

        )

    [lightning] => Array
        (
        )

)