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

            [Art] => ReplaceableTextures\CommandButtons\BTNStasisTrap.blp
            [dmgplus1] => 502
            [bldtm] => 1
            [goldcost] => 750
            [unitSound] => AltarOfStorms
            [sides1] => 1
            [Missilearc] => 0.1
            [manaN] => 1000
            [launchZ] => 200
            [acquire] => 950
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Derelict Feedback Pylon
            [weapTp1] => missile
            [MissileHoming] => 1
            [file] => .mdl
            [uberSplat] => YTDI
            [Missilespeed] => 4000
            [Missileart] => Abilities\Spells\Human\SpellSteal\SpellStealMissile.mdl
            [dice1] => 1
            [RngBuff1] => 250
            [rangeN1] => 950
            [atkType1] => normal
            [cool1] => 1.75
            [Ubertip] => They thought they could wield the arcane through technology. They were mistaken.
            [scaleBull] => 0
            [abilList] => Array
                (
                )

            [buildingShadow] => Array
                (
                )

            [targs1] => Array
                (
                )

            [weapsOn] => 1
        )

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

            [abil_factor] => 0.35
            [author] => Ashbringer
            [alpha] => 0
            [authorDisplay] => |cffff6600Ashbringer|r
            [version] => 1.0
            [element] => iron
            [rarity] => rare
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -0.211841
                    [y] => 0.163665
                    [z] => 0
                    [scale] => 0.58
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 75
                    [green] => 75
                    [blue] => 75
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [1] => Array
                (
                    [x] => -2.31431
                    [y] => -0.522754
                    [z] => 51.2
                    [scale] => 0.75
                    [rot] => 4.4965
                    [file] => Doodads\Cityscape\Props\LanternPost\LanternPost.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [2] => Array
                (
                    [x] => -1.07133
                    [y] => -0.290481
                    [z] => 102.4
                    [scale] => 0.48
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\City_LowWall_TallEndCap\City_LowWall_TallEndCap.mdl
                    [red] => 35
                    [green] => 25
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [3] => Array
                (
                    [x] => -18.9475
                    [y] => 0.0280259
                    [z] => 0
                    [scale] => 0.13
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\City_ColumnSemiCircle\City_ColumnSemiCircle.mdl
                    [red] => 25
                    [green] => 25
                    [blue] => 25
                    [alpha] => 255
                    [pitch] => -5.5
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [4] => Array
                (
                    [x] => -0.20346
                    [y] => 0.0454079
                    [z] => 0
                    [scale] => 0.26
                    [rot] => 0
                    [file] => Doodads\Ruins\Props\Ruins_NagaCircle\Ruins_NagaCircle.mdl
                    [red] => 1
                    [green] => 1
                    [blue] => 1
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [5] => Array
                (
                    [x] => -14.3652
                    [y] => -53.9952
                    [z] => -12.8
                    [scale] => 0.3
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [6] => Array
                (
                    [x] => 18.6659
                    [y] => 0.462093
                    [z] => 0
                    [scale] => 0.13
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\City_ColumnSemiCircle\City_ColumnSemiCircle.mdl
                    [red] => 25
                    [green] => 25
                    [blue] => 25
                    [alpha] => 255
                    [pitch] => -5.5
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [7] => Array
                (
                    [x] => 0.0692417
                    [y] => -19.1892
                    [z] => 0
                    [scale] => 0.13
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\City_ColumnSemiCircle\City_ColumnSemiCircle.mdl
                    [red] => 25
                    [green] => 25
                    [blue] => 25
                    [alpha] => 255
                    [pitch] => -5.5
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [8] => Array
                (
                    [x] => -0.36484
                    [y] => 18.4242
                    [z] => 0
                    [scale] => 0.13
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\City_ColumnSemiCircle\City_ColumnSemiCircle.mdl
                    [red] => 25
                    [green] => 25
                    [blue] => 25
                    [alpha] => 255
                    [pitch] => -5.5
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [9] => Array
                (
                    [x] => 42.5821
                    [y] => -42.7903
                    [z] => -12.8
                    [scale] => 0.3
                    [rot] => 2.3562
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [10] => Array
                (
                    [x] => -41.8267
                    [y] => 42.4862
                    [z] => -12.8
                    [scale] => 0.3
                    [rot] => 2.3562
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [11] => Array
                (
                    [x] => -41.9477
                    [y] => -42.6438
                    [z] => -12.8
                    [scale] => 0.3
                    [rot] => 0.785398
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [12] => Array
                (
                    [x] => 42.4461
                    [y] => 41.8788
                    [z] => -12.8
                    [scale] => 0.3
                    [rot] => 0.785398
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [13] => Array
                (
                    [x] => 15.0945
                    [y] => -54.2774
                    [z] => -12.8
                    [scale] => 0.3
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [14] => Array
                (
                    [x] => -14.5099
                    [y] => 53.8074
                    [z] => -12.8
                    [scale] => 0.3
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [15] => Array
                (
                    [x] => 14.9499
                    [y] => 53.5252
                    [z] => -12.8
                    [scale] => 0.3
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [16] => Array
                (
                    [x] => 53.9405
                    [y] => 14.2054
                    [z] => -12.8
                    [scale] => 0.3
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [17] => Array
                (
                    [x] => 53.6583
                    [y] => -15.2543
                    [z] => -12.8
                    [scale] => 0.3
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [18] => Array
                (
                    [x] => -53.0816
                    [y] => 15.1012
                    [z] => -12.8
                    [scale] => 0.3
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [19] => Array
                (
                    [x] => -53.1061
                    [y] => -15.2393
                    [z] => -12.8
                    [scale] => 0.3
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [20] => Array
                (
                    [x] => -1.58847
                    [y] => -0.396146
                    [z] => 185.6
                    [scale] => 1.5
                    [rot] => 0.848767
                    [file] => Abilities\Weapons\VengeanceMissile\VengeanceMissile.mdl
                    [red] => 255
                    [green] => 155
                    [blue] => 1
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [21] => Array
                (
                    [x] => -1.08516
                    [y] => -0.2516
                    [z] => -57.6
                    [scale] => 1.1
                    [rot] => 1.13446
                    [file] => Abilities\Spells\Orc\SpiritLink\SpiritLinkZapTarget.mdl
                    [red] => 255
                    [green] => 75
                    [blue] => 1
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [22] => Array
                (
                    [x] => -1.67781
                    [y] => -1.13616
                    [z] => 198.4
                    [scale] => 0.850001
                    [rot] => 4.15388
                    [file] => Abilities\Weapons\WitchDoctorMissile\WitchDoctorMissile.mdl
                    [red] => 255
                    [green] => 155
                    [blue] => 1
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [23] => Array
                (
                    [x] => 46.1079
                    [y] => 14.5959
                    [z] => 6.4
                    [scale] => 0.3
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [24] => Array
                (
                    [x] => 45.8257
                    [y] => -14.8639
                    [z] => 6.4
                    [scale] => 0.3
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [25] => Array
                (
                    [x] => -46.3316
                    [y] => 15.014
                    [z] => 6.4
                    [scale] => 0.3
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [26] => Array
                (
                    [x] => -46.6138
                    [y] => -14.4458
                    [z] => 6.4
                    [scale] => 0.3
                    [rot] => 3.14159
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [27] => Array
                (
                    [x] => -14.7697
                    [y] => -46.6925
                    [z] => 6.4
                    [scale] => 0.3
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [28] => Array
                (
                    [x] => 14.69
                    [y] => -46.9746
                    [z] => 6.4
                    [scale] => 0.3
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [29] => Array
                (
                    [x] => -14.6502
                    [y] => 46.836
                    [z] => 6.4
                    [scale] => 0.3
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [30] => Array
                (
                    [x] => 14.8095
                    [y] => 46.5538
                    [z] => 6.4
                    [scale] => 0.3
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [31] => Array
                (
                    [x] => 0.130378
                    [y] => -51.058
                    [z] => 0
                    [scale] => 0.37
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\City_LowWall_ShortEndCap\City_LowWall_ShortEndCap.mdl
                    [red] => 55
                    [green] => 55
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [32] => Array
                (
                    [x] => 43.0897
                    [y] => -43.9042
                    [z] => 0
                    [scale] => 0.32
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\City_LowWall_ShortEndCap\City_LowWall_ShortEndCap.mdl
                    [red] => 55
                    [green] => 55
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [33] => Array
                (
                    [x] => 42.9413
                    [y] => 43.1833
                    [z] => 0
                    [scale] => 0.32
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\City_LowWall_ShortEndCap\City_LowWall_ShortEndCap.mdl
                    [red] => 55
                    [green] => 55
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [34] => Array
                (
                    [x] => -43.2013
                    [y] => 43.6545
                    [z] => 0
                    [scale] => 0.32
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\City_LowWall_ShortEndCap\City_LowWall_ShortEndCap.mdl
                    [red] => 55
                    [green] => 55
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [35] => Array
                (
                    [x] => -43.3603
                    [y] => -43.5178
                    [z] => 0
                    [scale] => 0.32
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\City_LowWall_ShortEndCap\City_LowWall_ShortEndCap.mdl
                    [red] => 55
                    [green] => 55
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [36] => Array
                (
                    [x] => 50.4567
                    [y] => 0.173932
                    [z] => 0
                    [scale] => 0.37
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\City_LowWall_ShortEndCap\City_LowWall_ShortEndCap.mdl
                    [red] => 55
                    [green] => 55
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [37] => Array
                (
                    [x] => 0.476551
                    [y] => 50.2515
                    [z] => 0
                    [scale] => 0.37
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\City_LowWall_ShortEndCap\City_LowWall_ShortEndCap.mdl
                    [red] => 55
                    [green] => 55
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [38] => Array
                (
                    [x] => -49.5713
                    [y] => 0.113231
                    [z] => 0
                    [scale] => 0.37
                    [rot] => 0
                    [file] => Doodads\Cityscape\Structures\City_LowWall_ShortEndCap\City_LowWall_ShortEndCap.mdl
                    [red] => 55
                    [green] => 55
                    [blue] => 55
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

        )

    [dmgTable] => Array
        (
        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Attack
                    [code] => call ashbringer_haywire_attack(tower, Event.getTarget(), 0, 2, 5 + (tower.getLevel() * 0.1), 25 + (tower.getLevel() * 1))
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNStasisTrap.blp
                            [name] => Haywire
                            [short_explain] => Attacks hit a random amount of additional enemies.
                            [ONATTACK_chance] => 1.0
                            [ONATTACK_chanceLevelAdd] => 0.0
                            [long_explain] => Attacks hit |cffffff800|r to |cffffff802|r additional enemies. Affected by trigger chances. |n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+1|r maximum targets at level |cffffff8015|r|n|cffFFFF80+1|r minimum targets at level |cffffff8025|r
                        )

                )

            [1] => Array
                (
                    [name] => Header
                    [code] => globals
        //@export
        BuffType ashbringer_haywire_buff
        //@export
        ProjectileType ashbringer_failsafe_missile
    endglobals
    
    //@export
    function ashbringer_failsafe_hit takes Projectile p, Creep c returns nothing
        local Tower t = p.getCaster()
    
        if c.getUID() == p.userInt then
            call t.doSpellDamage(c, t.getCurrentAttackDamageWithBonus() * p.userReal, t.calcSpellCritNoBonus())
            call Effect.createColored("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", c.getX(), c.getY(), c.getZ(), 270.0, 1.5, 255, 95, 1, 255).setLifetime(3.0)
        endif
    endfunction
    
    //@export
    function ashbringer_haywire_attack takes Tower tower, Creep target, integer min, integer max, real mana, real damage_per returns nothing
        local Iterate i
        local Creep next
        local integer level = tower.getLevel()
        local integer random
        local real trigger_mult
        local real x = tower.getX()
        local real y = tower.getY()
        local integer count
        
        if level >= 15 then
            set max = max + 1
        endif
        
        if level >= 25 then
            set min = min + 1
        endif
        
        call Lightning.createFromPointToUnit("OZAP", x, y, 200, target).setLifetime(0.2)
        call Effect.createSimpleOnUnit("Abilities\\Spells\\Human\\Feedback\\SpellBreakerAttack.mdl", target, "chest").setLifetime(3.0)
        set mana = target.subtractMana(mana, true)
        if mana > 0 then
            call tower.doSpellDamage(target, damage_per*mana, tower.calcSpellCritNoBonus())
            call tower.addMana(mana)
        endif
        
        /*
        set random = GetRandomInt(min, max)
        if tower.calcChance((max - random) * ((tower.getProp_TriggerChances() - 1) / 15)) and random=max
            set count = count + 1
            if tower.calcChance(1.0/I2R(max-min+1)) then
                set random = random + 1
            endif
        endloop
        set count = 0
        
        //set trigger_mult = (1 / (4.0 / RMaxBJ(, 0.1))) + 0.75
        //set random = GetRandomInt(min*100, R2I(I2R(max)*100*trigger_mult)+99.9)
        //set random = IMinBJ(R2I(trigger_mult - ModuloReal(trigger_mult, 100)) / 100, max)
        
        if random >= 1 then
            set i = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TYPE_CREEPS, 950)
            loop
                set next = i.nextRandom()
                exitwhen count == random or next == 0
                
                if next != target then
                    call Lightning.createFromPointToUnit("OZAP", x, y, 200, next).setLifetime(0.2)
                    call Effect.createSimpleOnUnit("Abilities\\Spells\\Human\\Feedback\\SpellBreakerAttack.mdl", next, "chest").setLifetime(3.0)
                    call tower.doAttackDamage(next, tower.getCurrentAttackDamageWithBonus(), tower.calcAttackMulticrit(0, 0, 0))
                    set mana = next.subtractMana(mana, true)
                    if mana > 0 then
                        call tower.doSpellDamage(next, damage_per*mana, tower.calcSpellCritNoBonus())
                        call tower.addMana(mana)
                    endif
                    set count = count + 1
                endif
            endloop
            if next != 0 then
                call i.destroy()
            endif
        endif
    endfunction
    
    //@export
    function ashbringer_failsafe_cast takes Tower tower, real range, real damage, real mana returns nothing
        local integer level = tower.getLevel()
        local integer random = GetRandomInt(1, 3)
        local Iterate i
        local Unit next
        local Projectile p
        
        call Effect.createColored("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", tower.getX(), tower.getY(), 0, 270.0, 2.5, 255, 95, 1, 255).setLifetime(3.0)
        
        if random == 1 then
            set i = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TYPE_CREEPS, 1000)
            set next = i.nextRandom()
            
            if next != 0 then
                set p = Projectile.createFromPointToUnit(ashbringer_failsafe_missile, tower, 0.0, 0.0, tower.getX(), tower.getY(), 200, next, true, false, true)
                call p.color(255, 155, 1, 255)
                call p.setScale(3.0)
                set p.userInt = next.getUID()
                set p.userReal = damage
                call i.destroy()
            endif
        elseif random == 2 then
            set i = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TYPE_TOWERS, range)
            
            loop
                set next = i.next()
                exitwhen next == 0
                call next.addManaPerc(mana * (1.0 - (GetUnitState(next.getUnit(), UNIT_STATE_MANA) / GetUnitState(next.getUnit(), UNIT_STATE_MAX_MANA))))
                call Effect.createSimpleAtUnit("Abilities\\Spells\\Items\\AIma\\AImaTarget.mdl", next).setLifetime(2.0)
            endloop
        elseif random == 3 then
            call ashbringer_haywire_buff.apply(tower, tower, 50 + tower.getLevel())
        else
        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 mod = Modifier.create()
        
        set ashbringer_haywire_buff = BuffType.create(5.0, 0.1, true)
        call ashbringer_haywire_buff.setBuffIcon('@@0@@')
        call ashbringer_haywire_buff.setStackingGroup("ashbringer_haywire_buff")
        call mod.addModification(MOD_ATTACKSPEED, 0.0, 0.01)
        call ashbringer_haywire_buff.setBuffModifier(mod)
        call ashbringer_haywire_buff.setSpecialEffectAdvanced("Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl", 0, 20, 0, 1.3, 270, 255, 95, 1, 255, 0)
        
        set ashbringer_failsafe_missile = ProjectileType.create("Abilities\\Weapons\\VengeanceMissile\\VengeanceMissile.mdl", 5.0, 800)
        call ashbringer_failsafe_missile.enableHoming(ashbringer_failsafe_hit, 0.0)
    endfunction
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNFeedBack.blp
                            [name] => Feedback Loop
                            [short_explain] => Attacks burn mana and mana burnt is given to the tower.
                            [long_explain] => Attacks burn up to |cffffff805|r mana from each enemy, dealing |cffffff8025|r spell damage per point of mana burnt. The tower gains mana equal to the amount of mana burnt. Can remove mana from immune enemies.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.1|r mana burnt|n|cffFFFF80+1|r spell damage per mana
                        )

                )

            [2] => Array
                (
                    [name] => Autocast
                    [code] => call ashbringer_failsafe_cast(tower, 250, 7.5 + (tower.getLevel() * 0.1), 0.05 + (tower.getLevel() * 0.001))
                    [values] => Array
                        (
                            [AUTOCAST_cooldown] => 8
                            [AUTOCAST_autoRange] => 800
                            [AUTOCAST_manacost] => 500
                            [icon] => ReplaceableTextures\CommandButtons\BTNMagicLariet.blp
                            [AUTOCAST_range] => 900
                            [AUTOCAST_targetType] => 0
                            [AUTOCAST_numBuffsBeforeIdle] => 0
                            [caster_art] => 
                            [long_explain] => Discharge excess energy haphazardly, causing one of three random outcomes:|n>Strike a single random enemy for |cffffff80750%|r of attack damage as spell damage.|n>Restores |cffffff805%|r of each tower's missing mana in |cffffff80250|r range.|n>Increases this tower's attack speed by |cffffff8025%|r for |cffffff805.0|r seconds.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.1|r damage|n|cffFFFF80+0.1%|r mana|n|cffFFFF80+1%|r attack speed|n|cffFFFF80+0.1|r seconds duration
                            [target_art] => 
                            [AUTOCAST_autocastType] => AC_TYPE_OFFENSIVE_IMMEDIATE
                            [AUTOCAST_buffType] => 0
                            [AUTOCAST_isExtended] => false
                            [name] => Failsafe
                            [AUTOCAST_targetSelf] => false
                            [short_explain] => Discharge excess energy, causing a random effect.
                        )

                )

        )

    [abilities] => Array
        (
        )

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

                            [Buffubertip] => Increased attack speed.
                            [TargetArt] => Array
                                (
                                )

                            [Bufftip] => Overload
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNMagicLariet.blp
                        )

                )

        )

    [units] => Array
        (
        )

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

            [1] => Array
                (
                    [export] => true
                    [category] => global
                    [typ] => ProjectileType
                    [name] => ashbringer_failsafe_missile
                )

        )

    [lightning] => Array
        (
        )

)