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

            [Art] => ReplaceableTextures\CommandButtons\BTNFireForTheCannon.blp
            [dmgplus1] => 0
            [bldtm] => 1
            [goldcost] => 1000
            [sides1] => 192
            [Missilearc] => 0.3
            [manaN] => 40
            [acquire] => 800
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Inflamed Stone
            [weapTp1] => missile
            [MissileHoming] => 1
            [file] => Doodads\Outland\Rocks\Outland_Rock\Outland_Rock3.mdl
            [uberSplat] => OSMA
            [Missileart] => Abilities\Weapons\FireBallMissile\FireBallMissile.mdl
            [Missilespeed] => 2000
            [dice1] => 1
            [RngBuff1] => 250
            [regenMana] => 5
            [modelScale] => 0.45
            [rangeN1] => 850
            [atkType1] => magic
            [cool1] => 1
            [Ubertip] => Advanced tower that will critical strike if it is has enough mana.
            [abilList] => Array
                (
                )

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

            [targs1] => Array
                (
                )

            [weapsOn] => 1
        )

    [settings] => Array
        (
            [balanceTip] => |cffFFFF00+2% |rmana regen/lvl
            [abil_factor] => 0.09
            [author] => SirCoqaLot.
            [alpha] => 255
            [authorDisplay] => SirCoqaLot.
            [version] => 1.0
            [element] => fire
            [rarity] => rare
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => 8.24751
                    [y] => -4.97861
                    [z] => -51.2
                    [scale] => 0.55
                    [rot] => 1.6922
                    [file] => Abilities\Spells\Other\Doom\DoomTarget.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [1] => Array
                (
                    [x] => -30.3836
                    [y] => 23.2199
                    [z] => 6.4
                    [scale] => 0.125
                    [rot] => 5.44417
                    [file] => Doodads\Outland\Rocks\Outland_Spires\Outland_Spires8.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [2] => Array
                (
                    [x] => 41.388
                    [y] => -29.6286
                    [z] => 6.4
                    [scale] => 0.125
                    [rot] => 1.71415
                    [file] => Doodads\Outland\Rocks\Outland_Spires\Outland_Spires8.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [3] => Array
                (
                    [x] => 2.58177
                    [y] => 5.55509
                    [z] => 0
                    [scale] => 0.85
                    [rot] => 3.63029
                    [file] => Doodads\Barrens\Props\Barrens_Bones\Barrens_Bones0.mdl
                    [red] => 255
                    [green] => 170
                    [blue] => 120
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

        )

    [dmgTable] => Array
        (
            [0] => Array
                (
                    [id] => MOD_MANA_REGEN_PERC
                    [base] => 0
                    [add] => 0.02
                )

        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Attack
                    [code] => local real mana = GetUnitState(tower.getUnit(),UNIT_STATE_MANA)
    call addAttackStats (tower)
    if mana >= (20 - 0.2*tower.getLevel()) then
        call tower.subtractMana(mana, false) 
        call tower.addCustomAttackCrit((mana - (20 - 0.2*tower.getLevel())) *0.08+tower.getProp_AtkCritDamage())
    endif
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNFlare.blp
                            [name] => Spellfire Projectiles
                            [short_explain] => On attack this tower uses all of its mana to let the next attack crit.
                            [ONATTACK_chance] => 1.0
                            [ONATTACK_chanceLevelAdd] => 0.0
                            [long_explain] => If this tower has at least |cffffff8020|r mana when it attacks, it will pay all its mana to proc a critical strike. |cffffff8020|r Mana is used to grant the critical strike and every further point of mana spent grants |cffffff808%|r more critical damage to that attack. |n|n|cffFF8000Level Bonus:|r|n|cffffff80-.2|r Mana needed
                        )

                )

            [1] => Array
                (
                    [name] => Header
                    [code] => globals

    //@export
    BuffType spellFlameDamage
    
    //@export
    BuffType spellFlameCritDamage

    //@export
    BuffType spellFlameCritChance
	
    endglobals
    
    //@export
    function addAttackStats takes Tower tower returns nothing 
        local integer lvl = tower.getLevel()
	local real spellBonuses = .84*100+100
	local real spellLevel = .0336*100
        //Just grab the current spell damage
	//Add attackdamage equal to that amount.
	//It should be a buff though.
    
	call spellFlameDamage.apply(tower, tower,R2I((tower.getProp_SpellDmgDealt())*(spellBonuses+spellLevel*lvl)))
	call spellFlameCritDamage.apply(tower, tower,R2I((tower.getProp_SpellCritDamage())*(spellBonuses+spellLevel*lvl)))
	call spellFlameCritChance.apply(tower, tower,R2I((tower.getProp_SpellCritChance())*(spellBonuses+spellLevel*lvl)))

    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 m = Modifier.create()
        set spellFlameDamage = BuffType.create(-1,0,false)
	call m.addModification(MOD_DAMAGE_ADD_PERC, 0.000, 0.01)
	call spellFlameDamage.setBuffModifier(m)

	
	set m = Modifier.create()
        call m.addModification( MOD_ATK_CRIT_CHANCE, 0.000, 0.01 )
        set spellFlameCritChance = BuffType.create(-1,0,false)
	call spellFlameCritChance.setBuffModifier(m)
	

	set m = Modifier.create()
	call m.addModification( MOD_ATK_CRIT_DAMAGE, 0.000, 0.01 )
	set spellFlameCritDamage= BuffType.create(-1,0,false)
        call spellFlameCritDamage.setBuffModifier(m)

    endfunction
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNInnerFire.blp
                            [name] => Spellfire
                            [short_explain] => This tower treats all spell modifiers as attack bonuses
                            [long_explain] => This tower treats all spell modifiers as attack bonuses, with an |cffffff8084%|r bonus gain of stated effect. This is recalculated before every attack. |n|n|cffFF8000Level Bonus:|r|n|cffffff80+3.36%|r bonus gain
                        )

                )

            [2] => Array
                (
                    [name] => On Tower Creation
                    [code] => Array
                        (
                        )

                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
        )

    [units] => Array
        (
        )

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

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

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

        )

)