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

            [Art] => ReplaceableTextures\CommandButtons\BTNScatterRockets.blp
            [dmgplus1] => 1158
            [bldtm] => 1
            [unitSound] => ArcaneSanctum
            [goldcost] => 3400
            [sides1] => 1
            [Missilearc] => 0.2
            [launchZ] => 120
            [acquire] => 1200
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Celestial Sanctum
            [weapTp1] => missile
            [file] => Doodads\Cityscape\Structures\City_ColumnSingle\City_ColumnSingle.mdl
            [MissileHoming] => 1
            [Missilespeed] => 1400
            [Missileart] => Abilities\Weapons\FaerieDragonMissile\FaerieDragonMissile.mdl
            [dice1] => 1
            [RngBuff1] => 250
            [modelScale] => 0.4
            [rangeN1] => 1200
            [atkType1] => chaos
            [cool1] => 1.7
            [Ubertip] => When the stars align, fear their portents.
            [scaleBull] => 0
            [abilList] => Array
                (
                )

            [buildingShadow] => Array
                (
                )

            [targs1] => Array
                (
                )

            [weapsOn] => 1
        )

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

            [abil_factor] => 0.2
            [author] => Ashbringer
            [alpha] => 0
            [authorDisplay] => |cffFF6600Ashbringer|r
            [version] => 1.0
            [element] => astral
            [rarity] => unique
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -0.710608
                    [y] => -0.315774
                    [z] => 0
                    [scale] => 0.6
                    [rot] => 0.598912
                    [file] => buildings\human\ArcaneSanctum\ArcaneSanctum.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => true
                    [animation] => stand work
                    [aniSpeed] => 0.5
                    [pcolor] => 255
                )

            [1] => Array
                (
                    [x] => 19.7431
                    [y] => -0.635726
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\City_ColumnSemiCircle\City_ColumnSemiCircle.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [2] => Array
                (
                    [x] => -0.222602
                    [y] => 0.143237
                    [z] => 44.8
                    [scale] => 2
                    [rot] => 0
                    [file] => Abilities\Spells\Items\OrbSlow\OrbSlow.mdl
                    [red] => 255
                    [green] => 200
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [3] => Array
                (
                    [x] => -20.9106
                    [y] => 0.105759
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\City_ColumnSemiCircle\City_ColumnSemiCircle.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 125
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [4] => Array
                (
                    [x] => -0.222602
                    [y] => 0.143237
                    [z] => 44.8
                    [scale] => 2
                    [rot] => 3.14159
                    [file] => Abilities\Spells\Items\OrbDarkness\OrbDarkness.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [5] => Array
                (
                    [x] => -0.124887
                    [y] => 0.0673427
                    [z] => 0
                    [scale] => 1.1
                    [rot] => 0.20944
                    [file] => buildings\other\CircleOfPower\CircleOfPower.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [6] => Array
                (
                    [x] => -41.0356
                    [y] => -58.8293
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 125
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [7] => Array
                (
                    [x] => -56.3789
                    [y] => -43.2894
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 125
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [8] => Array
                (
                    [x] => 46.3691
                    [y] => -56.8004
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 125
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [9] => Array
                (
                    [x] => 60.4144
                    [y] => -42.1996
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 125
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [10] => Array
                (
                    [x] => -42.5459
                    [y] => 61.7596
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 125
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [11] => Array
                (
                    [x] => 61.5585
                    [y] => 48.4871
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 125
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [12] => Array
                (
                    [x] => -56.432
                    [y] => 46.8566
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 125
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [13] => Array
                (
                    [x] => 60.7844
                    [y] => -57.1779
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 5.35816
                    [file] => Doodads\Cinematic\GlowingRunes\GlowingRunes2.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [14] => Array
                (
                    [x] => -54.7981
                    [y] => -56.3114
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 5.35816
                    [file] => Doodads\Cinematic\GlowingRunes\GlowingRunes2.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [15] => Array
                (
                    [x] => -54.343
                    [y] => 59.7989
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 5.35816
                    [file] => Doodads\Cinematic\GlowingRunes\GlowingRunes2.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [16] => Array
                (
                    [x] => 60.0209
                    [y] => 63.4608
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 5.35816
                    [file] => Doodads\Cinematic\GlowingRunes\GlowingRunes2.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

        )

    [dmgTable] => Array
        (
        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => Header
                    [code] => globals
        BuffType ashbringer_eclipse_buff
        ProjectileType ashbringer_solar_missile
        MultiboardValues ashbringer_circadian_count
    endglobals
    
    function ashbringer_starfall takes Tower tower, integer day returns integer
        local integer converted = 0
        local Iterate i = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TYPE_CREEPS, 1200)
        local Creep next = i.nextRandom()
        local real damage = day * 0.01 * tower.getCurrentAttackDamageWithBonus()
        
        if next!=0 then
            set converted = 1
            call Effect.createSimpleOnUnit("Abilities\\Spells\\NightElf\\Starfall\\StarfallTarget.mdl", next, "origin").setLifetime(2)
            call tower.doCustomAttackDamage(next, damage, tower.calcAttackMulticrit(0, 0, 0), AttackType.ENERGY)
            call i.destroy()
        endif
        
        return converted
    endfunction
    
    function ashbringer_solar takes Tower tower, real damage, integer night returns integer
        local integer converted = 0
        local Iterate i = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TYPE_CREEPS, 1200)
        local Creep next = i.next()
        
        loop
            exitwhen next==0
            set Projectile.createFromUnitToUnit(ashbringer_solar_missile, tower, 1.0, 0, tower, next, true, false, true).userReal = damage
            set converted = converted + 1
            set next = i.next()
        endloop
        
        return converted
    endfunction
    
    function ashbringer_solar_hit takes Projectile p, Unit target returns nothing
        local Tower tower = p.getCaster()
        
        if target!=0 then
            call tower.doCustomAttackDamage(target, p.userReal, tower.calcAttackMulticrit(0, 0, 0), AttackType.ELEMENTAL)
        endif
    endfunction
    
    function ashbringer_eclipse_apply takes Tower tower, Buff b returns nothing
        local real duration
        
        if b==0 then
            set b = tower.getBuffOfType(ashbringer_eclipse_buff)
        endif
        
        if b!=0 then
            set duration = b.getRemainingDuration()
            //call DisplayTextToPlayer(Player(0), 0, 0, "refresh: "+R2S(duration))
            call b.setRemainingDuration(duration + 2.0)
            //call ashbringer_eclipse_buff.applyCustomTimed(tower, tower, 0, duration + 2.0)
        else
            call ashbringer_eclipse_buff.applyCustomTimed(tower, tower, 0, 2.0)
        endif
    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_eclipse_buff=BuffType.create(-1, 0, true)
        call ashbringer_eclipse_buff.setBuffIcon('@@0@@')
        //call ashbringer_eclipse_buff.setSpecialEffectAdvanced("Abilities\\Weapons\\BoatMissile\\BoatMissile.mdl", 0, 0, 240, 2.0, 270, 0, 0, 0, 255, -4.71)
        //call ashbringer_eclipse_buff.setSpecialEffectAdvanced("Abilities\\Weapons\\WitchDoctorMissile\\WitchDoctorMissile.mdl", 0, 0, 240, 2.0, 270, 255, 155, 55, 255, 0)
        call ashbringer_eclipse_buff.setSpecialEffectColored("Abilities\\Weapons\\WitchDoctorMissile\\WitchDoctorMissile.mdl", 240, 2, 0, 0, 255, 255)
        
        set ashbringer_solar_missile = ProjectileType.create("Abilities\\Weapons\\WitchDoctorMissile\\WitchDoctorMissile.mdl", 5, 1500)
        call ashbringer_solar_missile.enableHoming(ProjectileTargetEvent.ashbringer_solar_hit, 0)
        
        set ashbringer_circadian_count = MultiboardValues.create(2)
        call ashbringer_circadian_count.setKey(0,"Day") 
        call ashbringer_circadian_count.setKey(1,"Night") 
	endfunction
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNUltravision.blp
                            [name] => Circadian Attunement
                            [short_explain] => Solar Flare and Starfall grant Day stacks to Night stacks and vice versa.
                            [long_explain] => The tower cycles between Night and Day stacks gained from abilities. Day increases the tower's critical attack damage by |cffFFFF800.001x|r per stack and Night increases the tower's attack speed by |cffFFFF800.1%|r per stack.
                        )

                )

            [1] => Array
                (
                    [name] => On Tower Details
                    [code] => call ashbringer_circadian_count.setValue(0, I2S(tower.userInt2)) 
    call ashbringer_circadian_count.setValue(1, I2S(tower.userInt3)) 
    return ashbringer_circadian_count
                    [values] => Array
                        (
                            [0] => Array
                                (
                                    [_value] => 0
                                    [typ] => string
                                )

                        )

                )

            [2] => Array
                (
                    [name] => On Kill
                    [code] => call ashbringer_eclipse_apply(tower, 0)
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNGenericSpellImmunity.blp
                            [name] => Eclipse
                            [short_explain] => Crits and kills grant Day and Night stacks.
                            [long_explain] => Critical attacks and kills grant the tower |cffFFFF802.0|r seconds of Eclipse. While Eclipse is active, the tower gains |cffFFFF801|r Day and |cffFFFF801|r Night per second and both Starfall and Solar Flare are simultaneously active. Duration accumulates.
                        )

                )

            [3] => Array
                (
                    [name] => On Damage
                    [code] => local Buff b = tower.getBuffOfType(ashbringer_eclipse_buff)
    local integer day = tower.userInt2
    local integer night = tower.userInt3
    local integer conversion
    local integer diff = 0
    local real solar_damage = tower.getCurrentAttackDamageWithBonus() * (0.5 + (tower.getLevel() * 0.002))

    if Event.isAttackDamageCritical()==true then
        call ashbringer_eclipse_apply(tower, b)
    endif
    if (tower.userInt==1 or b!=0) and night>=1 then
        if tower.calcChance(0.001*night) then
            set conversion = ashbringer_solar(tower, solar_damage, night)
            if night Array
                        (
                            [ONDAMAGE_chance] => 1.0
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNResurrection.blp
                            [name] => Solar Flare
                            [short_explain] => During day time, attack hits have a chance to damage enemies in range.
                            [ONDAMAGE_chanceLevelAdd] => 0.0
                            [long_explain] => During day time, attack hits have a |cffFFFF80[0.1%xNight]|r chance  to fire bolts at every enemy within attack range, dealing |cffFFFF8050%|r of attack damage as |cffFF8000Elemental|r damage. Converts |cffFFFF801|r Night into |cffFFFF801|r Day for each bolt fired.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.2%|r damage
                        )

                )

            [4] => Array
                (
                    [name] => Periodic
                    [code] => local Buff b = tower.getBuffOfType(ashbringer_eclipse_buff)
    local real time_of_day = GetFloatGameState(GAME_STATE_TIME_OF_DAY)
    local integer day = tower.userInt2
    local integer night = tower.userInt3
    local integer conversion
    local integer diff = 0
    
    if time_of_day>=6.00 and time_of_day<18.00 and tower.userInt==0 then
        set tower.userInt = 1
    elseif (time_of_day>=18.00 or time_of_day<6.00) and tower.userInt==1 then
        set tower.userInt = 0
    endif
    
    if (tower.userInt==0 or b!=0) and day>=1 then
        set conversion = ashbringer_starfall(tower, day)
        if day Array
                        (
                            [visible] => true
                            [PERIODIC_period] => 1.0
                            [icon] => ReplaceableTextures\CommandButtons\BTNStarfall.blp
                            [name] => Starfall
                            [short_explain] => During night time, stars periodically fall on nearby enemies.
                            [long_explain] => During night time, a star will fall onto a random enemy within attack range every second, dealing |cffFFFF80[1%xDay]|r of attack damage as |cff00FFFFEnergy|r damage to the target. Converts |cffFFFF801|r Day into |cffFFFF801|r Night.
                        )

                )

            [5] => Array
                (
                    [name] => On Tower Creation
                    [code] => set tower.userInt = 0
    set tower.userInt2 = 0
    set tower.userInt3 = 0
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => BHtc
                    [oeValues] => Array
                        (
                            [Targetattach] => Array
                                (
                                )

                            [Buffubertip] => Array
                                (
                                )

                            [TargetArt] => Array
                                (
                                )

                            [Bufftip] => Eclipse
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNGenericSpellImmunity.blp
                        )

                )

        )

    [units] => Array
        (
        )

    [references] => Array
        (
        )

    [lightning] => Array
        (
        )

)