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

            [Art] => ReplaceableTextures\CommandButtons\BTNBlueDragonSpawn.blp
            [turnRate] => 3
            [dmgplus1] => 2042
            [bldtm] => 1
            [goldcost] => 2350
            [unitSound] => DragonSpawn
            [sides1] => 1
            [acquire] => 900
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Servant of the Twin Flames
            [weapTp1] => missile
            [MissileHoming] => 1
            [file] => Units\Creeps\DragonSpawnGreen\DragonSpawnGreen.mdl
            [uberSplat] => OSMA
            [Missileart] => Abilities\Weapons\ShadowHunterMissile\ShadowHunterMissile.mdl
            [Missilespeed] => 1500
            [dice1] => 1
            [RngBuff1] => 250
            [green] => 150
            [modelScale] => 0.65
            [rangeN1] => 900
            [backSw1] => 0.5
            [atkType1] => siege
            [cool1] => 1.1
            [Ubertip] => A fighter skilled in both physical and magical attacks.
            [blue] => 150
            [abilList] => Array
                (
                )

            [dmgpt1] => 0.83
            [buildingShadow] => Array
                (
                )

            [targs1] => Array
                (
                )

            [weapsOn] => 1
        )

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

            [abil_factor] => 0.7
            [author] => DaveMatthews
            [alpha] => 255
            [authorDisplay] => DaveMatthews
            [version] => 1.0
            [element] => fire
            [rarity] => unique
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -44.7084
                    [y] => 39.3762
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 2.19912
                    [file] => Doodads\Dungeon\Rocks\DungeonStalagmite\DungeonStalagmite3.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [1] => Array
                (
                    [x] => 4.03846
                    [y] => -5.64126
                    [z] => 0
                    [scale] => 1.02
                    [rot] => 3.12414
                    [file] => Doodads\Dungeon\Props\LavaCracks\LavaCracks3.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [2] => Array
                (
                    [x] => 38.4701
                    [y] => 39.3763
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 2.19912
                    [file] => Doodads\Dungeon\Rocks\DungeonStalagmite\DungeonStalagmite3.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [3] => Array
                (
                    [x] => -46.5685
                    [y] => -42.4641
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 2.19912
                    [file] => Doodads\Dungeon\Rocks\DungeonStalagmite\DungeonStalagmite3.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [4] => Array
                (
                    [x] => 43.416
                    [y] => -39.8194
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 2.19912
                    [file] => Doodads\Dungeon\Rocks\DungeonStalagmite\DungeonStalagmite3.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [5] => Array
                (
                    [x] => -43.3728
                    [y] => 28.8512
                    [z] => 51.2
                    [scale] => 0.4
                    [rot] => 5.044
                    [file] => Abilities\Spells\NightElf\Immolation\ImmolationTarget.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [6] => Array
                (
                    [x] => 38.2419
                    [y] => 30.159
                    [z] => 89.6
                    [scale] => 0.35
                    [rot] => 1.79769
                    [file] => Abilities\Spells\Other\ImmolationRed\ImmolationRedTarget.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 Level Up
                    [code] => if tower.getLevel() < 15 then
    set tower.userInt3 = 8
  elseif tower.getLevel() < 25 then
    set tower.userInt3 = 7 
  elseif tower.getLevel() == 25 then
    set tower.userInt3 = 6
  endif
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [1] => Array
                (
                    [name] => On Attack
                    [code] => local Projectile p
local Iterate it
local Effect e
local Unit u
local integer level = tower.getLevel()

if tower.calcChance( tower.getProp_SpellCritChance() ) then
    set Projectile.createBezierInterpolationFromUnitToUnit(dave_red,tower,1,1,tower,Event.getTarget(),0,0.3,0,true).userReal = 0.65+0.005*level
    if tower.userInt >= tower.userInt3 then
        set tower.userInt = 0
        set it = Iterate.overUnitsInRangeOfCaster(tower,TARGET_CREEPS,900)
        loop
          set u = it.next()
          exitwhen u == 0
          call tower.doSpellDamage(u,tower.getCurrentAttackDamageWithBonus()*(0.55+0.005*level),tower.calcSpellCritNoBonus())
          call SFXOnUnit("Abilities\\Spells\\NightElf\\Immolation\\ImmolationDamage.mdl",u.getUnit(), "chest")
          set e = Effect.createColored("Abilities\\Spells\\Demon\\DarkConversion\\ZombifyTarget.mdl",tower.getX()-48,tower.getY()+48, 40, 0.0, 0.42, 0, 255, 0, 255)
          call e.setLifetime(0.5)
        endloop
    else
        set tower.userInt = tower.userInt + 1
    endif
endif
    
if tower.calcChance( tower.getProp_AtkCritChance() ) then
    set Projectile.createBezierInterpolationFromUnitToUnit(dave_green,tower,1,1,tower,Event.getTarget(),0,-0.3,0,true).userReal = 0.65+0.005*level
    if tower.userInt2 >= tower.userInt3 then
        set tower.userInt2 = 0
        set it = Iterate.overUnitsInRangeOfCaster(tower,TARGET_CREEPS,900)
        loop
          set u = it.next()
          exitwhen u == 0
          call tower.doAttackDamage(u,tower.getCurrentAttackDamageWithBonus()*(0.55+0.005*level),tower.calcAttackMulticrit(0,0,0))
          call SFXOnUnit("Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeEmbers.mdl",u.getUnit(), "chest")
          set e = Effect.createColored("Abilities\\Spells\\Demon\\DarkConversion\\ZombifyTarget.mdl",tower.getX()+48,tower.getY()+48, 40, 0.0, 0.42, 255, 0, 0, 255)
          call e.setLifetime(0.5)
        endloop 
    else 
        set tower.userInt2 = tower.userInt2 + 1
    endif
endif
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNFire.blp
                            [name] => Twin Flames
                            [short_explain] => Has a chance to launch two kinds of fire bolt.
                            [ONATTACK_chance] => 1
                            [ONATTACK_chanceLevelAdd] => 0
                            [long_explain] => On each attack, this tower has a chance equal to its crit chance to launch a green flame, dealing |cffFFFF8065%|r of tower's attack damage as spell damage, and a chance equal to its spell crit chance to launch a red flame, dealing |cffFFFF8065%|r of tower's attack damage as physical damage. |n|n|cffFF8000Level Bonus: |r|n|cffFFFF80+0.5%|r damage
                        )

                )

            [2] => Array
                (
                    [name] => Header
                    [code] => globals
        //@export
        BuffType dave_physical_buff
        //@export
        BuffType dave_spell_buff
        //@export
        ProjectileType dave_red
        //@export
        ProjectileType dave_green
    endglobals
    
    
    function redHit takes Projectile p, Unit creep returns nothing  
        local Tower tower = p.getCaster()
        local integer level= tower.getLevel()
        call tower.doAttackDamage(creep,tower.getCurrentAttackDamageWithBonus()*p.userReal, tower.calcAttackMulticrit(0,0,0))  
    endfunction
    
    function greenHit takes Projectile p, Unit creep returns nothing  
        local Tower tower = p.getCaster()
        local integer level= tower.getLevel()
        call tower.doSpellDamage(creep,tower.getCurrentAttackDamageWithBonus()*p.userReal, tower.calcSpellCritNoBonus())  
    endfunction
    

    private function init takes nothing returns nothing
        local Modifier m = Modifier.create()
        local Modifier n = Modifier.create()
        
        //Physical
        set dave_physical_buff = BuffType.create(7,0,true)
        call m.addModification(MOD_ATK_CRIT_CHANCE,0,0.01)
        call dave_physical_buff.setBuffModifier(m)
        call dave_physical_buff.setBuffIcon('@@1@@')
        
        //Spell        
        set dave_spell_buff = BuffType.create(7,0,true)
        call n.addModification(MOD_SPELL_CRIT_CHANCE,0,0.01)         
        call dave_spell_buff.setBuffModifier(n)
        call dave_spell_buff.setBuffIcon('@@0@@')
        
        //Missiles
        set dave_red = ProjectileType.create("Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl",4,1000) 
        call dave_red.setEventOnInterpolationFinished(ProjectileTargetEvent.redHit)
        set dave_green = ProjectileType.create("Abilities\\Weapons\\GreenDragonMissile\\GreenDragonMissile.mdl",4,1000)
        call dave_green.setEventOnInterpolationFinished(ProjectileTargetEvent.greenHit)
        
	endfunction
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNWallOfFire.blp
                            [name] => Twin Pulses
                            [short_explain] => Deals spell damage to nearby enemy creeps.
                            [long_explain] => Every time this tower has launched |cffFFFF808|r red flames, it releases a green pulse, dealing |cffFFFF8055%|r of its attack damage as spell damage in |cffFFFF80900|r AoE and every time it has launched |cffFFFF808|r green flames, it releases a red pulse, dealing |cffFFFF8055%|r of its attack damage as physical damage in |cffFFFF80900|r AoE. |n|n|cffFF8000Level Bonus: |r|n|cffFFFF80+0.5%|r damage |r|n|cffFFFF80-1|r flame needed at level |cffFFFF8015|r and |cffFFFF8025|r
                        )

                )

            [3] => Array
                (
                    [name] => On Damage
                    [code] => local Buff b = tower.getBuffOfType(dave_physical_buff)
local Buff s = tower.getBuffOfType(dave_spell_buff)
local integer levelP
local integer levelS

if b != 0 then
   set levelP = b.getLevel()
endif

if s !=0 then
   set levelS = s.getLevel()
endif

if Event.isAttackDamageCritical() then
  if tower.getProp_AtkCritChance() < tower.getProp_SpellCritChance() or levelS == 10 then
     if b==0 then
        call dave_physical_buff.apply(tower,tower,1)
     else
        call dave_physical_buff.apply(tower,tower,IMinBJ(levelP + 1, 10))
     endif
  elseif tower.getProp_AtkCritChance() > tower.getProp_SpellCritChance() or levelP == 10 then
     if s==0 then
        call dave_spell_buff.apply(tower,tower, 1)
     else
        call dave_spell_buff.apply(tower,tower,IMinBJ(levelS + 1, 10))
     endif
  endif
endif
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 1
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNCleavingAttack.blp
                            [name] => Twin Disciplines
                            [short_explain] => Gains bonus critical chance on crit.
                            [ONDAMAGE_chanceLevelAdd] => 0
                            [long_explain] => Each time it scores a critical hit with an attack, this tower gains |cffFFFF801%|r bonus critical chance or spell critical chance, both stacking up to |cffFFFF8010|r times, for |cffFFFF807|r seconds. The lower chance will always be prioritized.
                        )

                )

            [4] => Array
                (
                    [name] => On Tower Creation
                    [code] => set tower.userInt = 0
  set tower.userInt2 = 0
  
  if tower.getLevel() < 15 then
    set tower.userInt3 = 8
  elseif tower.getLevel() < 25 then
    set tower.userInt3 = 7 
  elseif tower.getLevel() == 25 then
    set tower.userInt3 = 6
  endif
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => Bblo
                    [oeValues] => Array
                        (
                            [Targetattach] => hand,right
                            [Targetattach1] => Array
                                (
                                )

                            [Buffubertip] => This tower has its spell critical chance increased.
                            [TargetArt] => Abilities\Weapons\GreenDragonMissile\GreenDragonMissile.mdl
                            [Targetattachcount] => 1
                            [Bufftip] => Twin Disciplines
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNThoriumMelee.blp
                        )

                )

            [1] => Array
                (
                    [id] => @@1@@
                    [derivedFrom] => Bblo
                    [oeValues] => Array
                        (
                            [Targetattach1] => Array
                                (
                                )

                            [Buffubertip] => This tower has its critical chance increased.
                            [TargetArt] => Abilities\Weapons\RedDragonBreath\RedDragonMissile.mdl
                            [Targetattachcount] => 1
                            [Bufftip] => Twin Disciplines
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNArcaniteMelee.blp
                        )

                )

        )

    [units] => Array
        (
        )

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

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

            [2] => Array
                (
                    [export] => true
                    [category] => global
                    [typ] => ProjectileType
                    [name] => dave_red
                )

            [3] => Array
                (
                    [export] => true
                    [category] => global
                    [typ] => ProjectileType
                    [name] => dave_green
                )

        )

)