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

            [targs1] => Array
                (
                )

            [goldcost] => 1600
            [weapsOn] => 1
            [dice1] => 1
            [Missilespeed] => 1000
            [moveHeight] => 50
            [file] => Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
            [atkType1] => normal
            [weapTp1] => missile
            [acquire] => 950
            [rangeN1] => 950
            [upgrades] => Array
                (
                )

            [cool1] => 2
            [Ubertip] => A field which is able to gather energy from spells.
            [abilList] => @@0@@
            [launchZ] => 0
            [Name] => Spell Collector
            [Missileart] => Abilities\Weapons\VoidWalkerMissile\VoidWalkerMissile.mdl
            [Art] => ReplaceableTextures\CommandButtons\BTNNagaWeaponUp1.blp
            [buildingShadow] => Array
                (
                )

            [turnRate] => 0.5
            [sides1] => 1
            [auto] => Array
                (
                )

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

    [settings] => Array
        (
            [author] => cedi
            [element] => storm
            [authorDisplay] => DreamStrider
            [alpha] => 255
            [balanceTip] => Array
                (
                )

            [rarity] => rare
            [version] => 1.0
            [abil_factor] => 0.3
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -34.3696
                    [y] => 2.64808
                    [z] => 0
                    [scale] => 0.1
                    [rot] => 3.92699
                    [file] => Doodads\Cityscape\Structures\Archway45\Archway45.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [1] => Array
                (
                    [x] => -24.7025
                    [y] => 27.5736
                    [z] => 0
                    [scale] => 0.1
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\Archway45\Archway45.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [2] => Array
                (
                    [x] => 1.4721
                    [y] => -33.5159
                    [z] => 0
                    [scale] => 0.1
                    [rot] => 5.49779
                    [file] => Doodads\Cityscape\Structures\Archway45\Archway45.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [3] => Array
                (
                    [x] => 36.5401
                    [y] => 2.36485
                    [z] => 0
                    [scale] => 0.1
                    [rot] => 3.92699
                    [file] => Doodads\Cityscape\Structures\Archway45\Archway45.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [4] => Array
                (
                    [x] => 2.04719
                    [y] => 38.2214
                    [z] => 0
                    [scale] => 0.1
                    [rot] => 5.49779
                    [file] => Doodads\Cityscape\Structures\Archway45\Archway45.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [5] => Array
                (
                    [x] => 24.9182
                    [y] => -23.2284
                    [z] => 0
                    [scale] => 0.1
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\Archway45\Archway45.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [6] => Array
                (
                    [x] => 25.9673
                    [y] => 27.3551
                    [z] => 0
                    [scale] => 0.1
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\Archway45\Archway45.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [7] => Array
                (
                    [x] => -24.9893
                    [y] => -24.2168
                    [z] => 0
                    [scale] => 0.1
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\Archway45\Archway45.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

        )

    [dmgTable] => Array
        (
        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Tower Creation
                    [code] => set tower.userInt = 1 //first member
                    [values] => Array
                        (
                            [icon] => 
                            [visible] => false
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [1] => Array
                (
                    [name] => On Tower Details
                    [code] => local Buff B = tower.getBuffOfType(cedi_spellInc)
    local integer lvl = 0
    if B != 0 then
        set lvl = IMinBJ(B.getLevel() + 1,10+tower.getLevel()/5)
    endif
    call cedi_spellCollectorMBValues.setValue(0, I2S(lvl))
    return cedi_spellCollectorMBValues
                    [values] => Array
                        (
                            [0] => Array
                                (
                                    [_value] => 0
                                    [typ] => string
                                )

                        )

                )

            [2] => Array
                (
                    [name] => Header
                    [code] => globals
        //@export
        ProjectileType cedi_spellCPT
        //@export
        BuffType cedi_spellGathering
        //@export
        BuffType cedi_spellInc
        //@export
        MultiboardValues cedi_spellCollectorMBValues
    endglobals
    
    function hitMissile takes Projectile P, Unit U returns nothing
        local Tower C = P.getCaster()
        if U != 0 and C != 0 then
            call P.getCaster().doSpellDamage( U, (2000.0 + 80 * C.getLevel()) * C.userInt, C.calcSpellCrit( P.userReal, P.userReal2 ) )
        endif
    endfunction
    
    function incCast takes Buff B returns nothing
        local Tower C = B.getCaster()
        local integer UID
        
        set B = C.getBuffOfType(cedi_spellInc)
        if B != 0 then
            set B = cedi_spellInc.apply(C, C, B.getLevel() + 1)
        else
            set B = cedi_spellInc.apply(C, C, 1)
        endif
        set UID = B.getUID()
        call TriggerSleepAction(Event.getAutocastType().getCooldown())
        if B.getUID() == UID then
            call B.setLevel(B.getLevel() - 1)
            if B.getLevel() == 0 then
                call B.removeBuff()
            endif
        endif
    endfunction
    
    function Launch takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local Tower tower = GetTimerData( t )
        local real chance = 0.05 + 0.002 * tower.getLevel()
        local real crit = 0.1 + 0.004 * tower.getLevel()
        local Projectile P
        local Unit T = tower.userInt3
        
        if T == 0 then
            call ReleaseTimer( t )
            set t = null
            return
        endif
        
        if tower.userInt2 >= tower.userReal then
            call ReleaseTimer( t )
            set t = null
            return
        endif
        
        set P = Projectile.createBezierInterpolationFromUnitToUnit( cedi_spellCPT, tower, 1.0, tower.calcSpellCritNoBonus(), tower, T, GetRandomReal( 0.25, 0.45 ), GetRandomReal( -0.3, 0.3 ), 0.0, true )
        set P.userReal = chance * tower.userInt2
        set P.userReal2 = crit * tower.userInt2
        set P.z = 50.0
        
        set tower.userInt2 = tower.userInt2 + 1
        
        set t = null
    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 cedi_spellCPT = ProjectileType.createInterpolate( "Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl", 1200.0 )
        call cedi_spellCPT.setEventOnInterpolationFinished( hitMissile )
        
        set cedi_spellGathering = BuffType.createAuraEffectType( true )
        call cedi_spellGathering.setBuffIcon( '@@1@@' )
        call cedi_spellGathering.addEventOnSpellCast( incCast )
        
        set cedi_spellInc = BuffType.create( 20.0, 0.0, true )
        call cedi_spellInc.setBuffIcon( '@@2@@' )
        
         set cedi_spellCollectorMBValues = MultiboardValues.create(1)
         call cedi_spellCollectorMBValues.setKey(0, "Spells Harvested")
	endfunction
                    [values] => Array
                        (
                            [icon] => 
                            [visible] => false
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [3] => Array
                (
                    [name] => On Attack
                    [code] => //local real chance = 0.05 + 0.002 * tower.getLevel()
    //local real crit = 0.1 + 0.004 * tower.getLevel()
    //local integer i = 0
    local Buff B = tower.getBuffOfType( cedi_spellInc )
    local integer max = 1
    //local Projectile P
    local Unit T = Event.getTarget()
    local real r
    local timer t = NewTimer()
    
    if B != 0 then
        set max = IMinBJ(B.getLevel() + 1,10+tower.getLevel()/5)
    endif
    
    set r = tower.getCurrentAttackspeed() / max
    
    if r > 0.2 then
        set r = 0.2
    endif
    
    set tower.userReal = max
    set tower.userInt2 = 0 //i
    set tower.userInt3 = T 
    
    call SetTimerData( t, tower )
    call TimerStart( t, r, true, function Launch )
    
    //loop
    //    exitwhen i >= max
    //    exitwhen T == 0
    //    set P = Projectile.createFromUnitToUnit( cedi_spellCPT, tower, 1.0, tower.calcSpellCritNoBonus(), tower, T, true, false, false )
    //    set P.userReal = chance * i
    //    set P.userReal2 = crit * i
    //    set P.z = 50.0
    //    set i = i + 1
    //    call TriggerSleepAction( 0.1 )
    //endloop
                    [values] => Array
                        (
                            [icon] => ReplaceableTextures\CommandButtons\BTNControlMagic.blp
                            [visible] => true
                            [name] => Magical Barrage
                            [short_explain] => Whenever this tower attacks it has a chance to launch some magical missiles. The missiles deal spell damage with increased spell crit chance and damage for each consecutive missile.
                            [ONATTACK_chance] => 0.2
                            [ONATTACK_chanceLevelAdd] => 0.008
                            [long_explain] => Whenever this tower attacks it has a |cffFFFF8020%|r chance to launch a magical missile. Whenever a tower in |cffFFFF80650|r range casts a spell, the amount of missiles on attack is increased by |cffFFFF801|r for a duration equal to the casting tower's ability's cooldown. The Spell Collector can shoot up to |cffFFFF8010|r missiles per attack. Each missile deals |cffFFFF802000|r spell damage. Each additional missile has |cffFFFF805%|r higher crit chance and |cffFFFF8010%|r higher crit damage than the previous one.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.8%|r chance|n|cffFFFF80+80|r spell damage|n|cffFFFF80+0.2%|r spell crit chance|n|cffFFFF80+0.4%|r spell crit damage|n|cffFFFF80+1|r max missiles every |cffFFFF805|r levels
                        )

                )

            [4] => Array
                (
                    [name] => Tower Aura
                    [code] => Array
                        (
                        )

                    [values] => Array
                        (
                            [icon] => 
                            [visible] => false
                            [AURA_auraEffect] => cedi_spellGathering
                            [AURA_power] => 0
                            [long_explain] => 
                            [AURA_level] => 0
                            [AURA_auraRange] => 650.0
                            [AURA_targetType] => TARGET_TYPE_TOWERS
                            [AURA_levelAdd] => 1
                            [AURA_powerAdd] => 1
                            [name] => Magical Barrage
                            [AURA_targetSelf] => true
                            [short_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => Alit
                    [oeValues] => Array
                        (
                            [Art] => Array
                                (
                                )

                            [targs1] => ground,enemies,air
                            [Unubertip] => -HIDE-
                        )

                )

        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@1@@
                    [derivedFrom] => BHfs
                    [oeValues] => Array
                        (
                            [Bufftip] => Gathering
                            [Buffubertip] => Each time this tower casts a spell the Spell Collector temporarily grows stronger.
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNControlMagic.blp
                            [TargetArt] => Array
                                (
                                )

                            [EditorName] => Gathering
                        )

                )

            [1] => Array
                (
                    [id] => @@2@@
                    [derivedFrom] => BHfs
                    [oeValues] => Array
                        (
                            [Bufftip] => Magical Barrage
                            [Buffubertip] => This tower is charged.
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNControlMagic.blp
                            [TargetArt] => Array
                                (
                                )

                            [EditorName] => Magical Barrage
                        )

                )

        )

    [units] => Array
        (
        )

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

            [1] => Array
                (
                    [export] => true
                    [category] => global
                    [typ] => BuffType
                    [name] => cedi_spellGathering
                )

            [2] => Array
                (
                    [export] => true
                    [category] => global
                    [typ] => BuffType
                    [name] => cedi_spellInc
                )

            [3] => Array
                (
                    [export] => true
                    [category] => global
                    [typ] => MultiboardValues
                    [name] => cedi_spellCollectorMBValues
                )

        )

)