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

            [Art] => ReplaceableTextures\CommandButtons\BTNWindWalkOff.blp
            [dmgplus1] => 3269
            [bldtm] => 1
            [goldcost] => 3000
            [sides1] => 1
            [manaN] => 50
            [acquire] => 800
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Storm Coil
            [weapTp1] => missile
            [MissileHoming] => 1
            [file] => Abilities\Spells\Human\ManaFlare\ManaFlareTarget.mdl
            [Missileart] => Abilities\Weapons\SpiritOfVengeanceMissile\SpiritOfVengeanceMissile.mdl
            [Missilespeed] => 1800
            [dice1] => 1
            [RngBuff1] => 250
            [regenMana] => 1
            [modelScale] => 2.2
            [rangeN1] => 1000
            [atkType1] => normal
            [cool1] => 4
            [Ubertip] => Strong storm tower that creates a magnetic surge beneath a target dealing damage as it moves. Deals more damage and slows the further away the target is.
            [abilList] => Array
                (
                )

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

            [targs1] => Array
                (
                )

            [weapsOn] => 1
        )

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

            [abil_factor] => 0.2
            [author] => SirCoqaLot.
            [alpha] => 255
            [authorDisplay] => SirCoqaLot.
            [version] => 1.0
            [element] => storm
            [rarity] => unique
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => 0.370373
                    [y] => -0.0921097
                    [z] => 172.8
                    [scale] => 0.35
                    [rot] => 1.58342
                    [file] => Doodads\Cityscape\Structures\City_ColumnSingle\City_ColumnSingle.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -3.14
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [1] => Array
                (
                    [x] => 0.704167
                    [y] => -31.393
                    [z] => 64
                    [scale] => 0.35
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [2] => Array
                (
                    [x] => 26.9232
                    [y] => 13.8418
                    [z] => 64
                    [scale] => 0.35
                    [rot] => 2.0944
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [3] => Array
                (
                    [x] => -25.3009
                    [y] => 13.7374
                    [z] => 64
                    [scale] => 0.35
                    [rot] => 1.0472
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [4] => Array
                (
                    [x] => 27.0371
                    [y] => -16.7243
                    [z] => 64
                    [scale] => 0.35
                    [rot] => 1.0472
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [5] => Array
                (
                    [x] => -0.0010086
                    [y] => 28.9274
                    [z] => 64
                    [scale] => 0.35
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [6] => Array
                (
                    [x] => 1.67591
                    [y] => -37.4342
                    [z] => -6.4
                    [scale] => 0.45
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [7] => Array
                (
                    [x] => 35.8081
                    [y] => 22.274
                    [z] => -6.4
                    [scale] => 0.45
                    [rot] => 2.0944
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [8] => Array
                (
                    [x] => -25.3625
                    [y] => -16.454
                    [z] => 64
                    [scale] => 0.35
                    [rot] => 2.0944
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [9] => Array
                (
                    [x] => -31.9859
                    [y] => 22.7335
                    [z] => -6.4
                    [scale] => 0.45
                    [rot] => 1.0472
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [10] => Array
                (
                    [x] => 36.237
                    [y] => -17.7323
                    [z] => -6.4
                    [scale] => 0.45
                    [rot] => 1.0472
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [11] => Array
                (
                    [x] => 0.939209
                    [y] => 42.6825
                    [z] => -6.4
                    [scale] => 0.45
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [12] => Array
                (
                    [x] => -32.3149
                    [y] => -17.2228
                    [z] => -6.4
                    [scale] => 0.45
                    [rot] => 2.0944
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [13] => Array
                (
                    [x] => -0.7075
                    [y] => -18.3922
                    [z] => 115.2
                    [scale] => 0.2
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [14] => Array
                (
                    [x] => 14.084
                    [y] => 7.70337
                    [z] => 115.2
                    [scale] => 0.2
                    [rot] => 2.0944
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [15] => Array
                (
                    [x] => -15.4543
                    [y] => 7.84693
                    [z] => 115.2
                    [scale] => 0.2
                    [rot] => 1.0472
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [16] => Array
                (
                    [x] => 14.2136
                    [y] => -10.2989
                    [z] => 115.2
                    [scale] => 0.2
                    [rot] => 1.0472
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [17] => Array
                (
                    [x] => -0.54562
                    [y] => 16.4583
                    [z] => 115.2
                    [scale] => 0.2
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [18] => Array
                (
                    [x] => -15.5112
                    [y] => -9.66068
                    [z] => 115.2
                    [scale] => 0.2
                    [rot] => 2.0944
                    [file] => Doodads\Cityscape\Structures\CityLowWall0\CityLowWall0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [19] => Array
                (
                    [x] => 1.32988
                    [y] => -2.88054
                    [z] => 70.4
                    [scale] => 0.35
                    [rot] => 0.20944
                    [file] => Doodads\Cityscape\Structures\City_ColumnSingle\City_ColumnSingle.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => -3.14
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

        )

    [dmgTable] => Array
        (
        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => Header
                    [code] => globals
    BuffType sir_tesla_debuff
    BuffType sir_tesla_slow 
    BuffType sir_tesla_aura
    endglobals
    
    
    public function sirTeslaPeriodic takes Buff b returns nothing
        local Unit target = b.getBuffedUnit()
        local Tower tower = b.getCaster()
        local real x1 = GetUnitX(target.getUnit())
        local real y1 = GetUnitY(target.getUnit())
        local real originx = b.userReal
        local real originy = b.userReal2
        call tower.doSpellDamage(target,4*SquareRoot((originx - x1)*(originx - x1) + (originy - y1)*(originy - y1))*(1 + tower.getLevel()*0.02),tower.calcSpellCritNoBonus())
        call tower.getOwner().displayFloatingTextX(I2S(R2I(4*SquareRoot((originx - x1)*(originx - x1) + (originy - y1)*(originy - y1))*(1 + tower.getLevel()*0.02))),target,150, 150, 255,255,0.05,0.0,2.0)
        call SFXAtUnit("Abilities\\Spells\\Items\\AIlb\\AIlbSpecialArt.mdl",target.getUnit())
    endfunction
    
    function sir_tesla_event takes Buff b returns nothing
        local Tower tower = b.getCaster()
        local Unit creep = b.getBuffedUnit()
        local real tx = tower.getX()
        local real ty = tower.getY()
        local real dx = creep.getX()-tx
        local real dy = creep.getY()-ty
        local real range = SquareRoot(dx * dx + dy * dy)
        
        if Element.STORM == Event.getTarget().getCategory() then
            set Event.damage = Event.damage * (range * (0.00020+tower.getLevel()*0.000006) + 1)
        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
    local Modifier m = Modifier.create()
    set sir_tesla_slow = BuffType.create(0,0,false)
    call sir_tesla_slow.setBuffIcon('@@1@@')
    call m.addModification(MOD_MOVESPEED,0,-0.0001)
    call sir_tesla_slow.setBuffModifier(m) 
    set sir_tesla_debuff = BuffType.create(0,0,false)
    call sir_tesla_debuff.setBuffIcon('@@0@@')
    call sir_tesla_debuff.setStackingGroup("sir_tesla_debuff")
    call sir_tesla_debuff.addPeriodicEvent(sirTeslaPeriodic,0.4) 
    set sir_tesla_aura = BuffType.createAuraEffectType(false)
    call sir_tesla_aura.addEventOnDamaged(sir_tesla_event,1,0)
    call sir_tesla_aura.setBuffIcon('@@2@@')
	endfunction
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [1] => Array
                (
                    [name] => On Damage
                    [code] => local Unit target = Event.getTarget()
    local real tx = tower.getX()
    local real ty = tower.getY()
    local real dx = target.getX()-tx
    local real dy = target.getY()-ty
    local real range = SquareRoot(dx * dx + dy * dy)
    local real damage = (R2I(range)*12.0)*tower.getCurrentAttackDamageWithBonus()/tower.getBaseDamage()
    call tower.doAttackDamage(target,R2I(damage),tower.calcAttackMulticrit(0,0,0))
    call tower.getOwner().displayFloatingTextX(I2S(R2I(damage)),target,255, 200, 0,255,0.05,0.0,2.0)
    call sir_tesla_slow.applyAdvanced(tower,target,0,R2I(range*3),1.5)
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 1.0
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNOrbOfLightning.blp
                            [name] => Overload
                            [short_explain] => This tower will deal more damage the further away the target is and slow the target harder the nearer it is.
                            [ONDAMAGE_chanceLevelAdd] => 0.0
                            [long_explain] => On attack this tower deals |cffFFFF80[distance to the target x 12]|r energy damage, modified by its attack damage and slows the target for |cffFFFF801.5|r seconds. The further away the target is, the more it will be slowed down. The maximum slow of |cffFFFF8030%|r can only be reached, if the target has the maximum distance to the tower.
                        )

                )

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

                    [values] => Array
                        (
                            [AURA_powerAdd] => 0
                            [visible] => true
                            [AURA_auraEffect] => sir_tesla_aura
                            [AURA_levelAdd] => 0
                            [AURA_power] => 0
                            [icon] => ReplaceableTextures\CommandButtons\BTNFeedBack.blp
                            [AURA_targetType] => TARGET_TYPE_CREEPS
                            [long_explain] => Units in |cffffff801000|r range around this tower are dealt up to |cffffff8020%|r bonus damage by |cFF8080FFStorm|r towers. The further away creeps are from tower, the more damage is dealt. |n|n|cffFF8000Level Bonus:|r|n|cffffff80+0.6%|r maximum damage
                            [AURA_targetSelf] => true
                            [name] => Energetic Field
                            [AURA_level] => 0
                            [short_explain] => Units caught in the electric field are dealt bonus damage by storm towers.
                            [AURA_auraRange] => 1000
                        )

                )

            [3] => Array
                (
                    [name] => Autocast
                    [code] => local Unit creep = Event.getTarget()
    local Buff b = sir_tesla_debuff.applyAdvanced(tower,creep,0,0,4.0+tower.getLevel()*0.1)
    set b.userReal = GetUnitX(creep.getUnit())
    set b.userReal2= GetUnitY(creep.getUnit())
                    [values] => Array
                        (
                            [AUTOCAST_cooldown] => 4
                            [AUTOCAST_autoRange] => 1000
                            [AUTOCAST_manacost] => 40
                            [icon] => ReplaceableTextures\CommandButtons\BTNStasisTrap.blp
                            [AUTOCAST_range] => 1000
                            [AUTOCAST_targetType] => TARGET_TYPE_CREEPS
                            [AUTOCAST_numBuffsBeforeIdle] => 1
                            [caster_art] => 
                            [long_explain] => This tower creates a magnetic surge at its target's current location. The creep will suffer spell damage equal to |cffffff804|r times the distance to the spot where the surge was created every |cffFFFF800.4|r seconds. This effect lasts |cffFFFF804|r seconds. |n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+2%|r spell damage |n|cffffff80+0.1|r seconds duration
                            [target_art] => 
                            [AUTOCAST_autocastType] => AC_TYPE_OFFENSIVE_BUFF
                            [AUTOCAST_buffType] => 0
                            [AUTOCAST_isExtended] => false
                            [name] => Magnetic Surge
                            [AUTOCAST_targetSelf] => false
                            [short_explain] => This tower deals spell damage to its target as it moves.
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => Brpb
                    [oeValues] => Array
                        (
                            [EditorName] => Magnetic Surge
                            [Buffubertip] => This unit is afflicted by a Magnetic Surge and will recieve damage whenever it moves.
                            [Bufftip] => Magnetic Surge
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNStasisTrap.blp
                        )

                )

            [1] => Array
                (
                    [id] => @@1@@
                    [derivedFrom] => Brpb
                    [oeValues] => Array
                        (
                            [EditorName] => Overload
                            [Buffubertip] => This units movement speed is slowed
                            [Bufftip] => Overload
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNOrbOfLightning.blp
                        )

                )

            [2] => Array
                (
                    [id] => @@2@@
                    [derivedFrom] => Brpb
                    [oeValues] => Array
                        (
                            [EditorName] => Electric Field
                            [Buffubertip] => This unit receives more damage from storm towers.
                            [Bufftip] => Electric Field
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNFeedBack.blp
                        )

                )

        )

    [units] => Array
        (
        )

    [references] => Array
        (
        )

)