Array
(
    [scriptVersion] => 8
    [oeValues] => Array
        (
            [targCount1] => 2
            [Farea1] => 400
            [auto] => Array
                (
                )

            [Art] => ReplaceableTextures\CommandButtons\BTNUpgradeMoonGlaive.blp
            [damageLoss1] => 0.5
            [turnRate] => 3
            [dmgplus1] => 3913
            [bldtm] => 1
            [goldcost] => 3750
            [unitSound] => HeroWarden
            [sides1] => 1
            [acquire] => 1000
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Glaive Master
            [weapTp1] => mbounce
            [impactZ] => 60
            [file] => units\nightelf\herowarden\herowarden.mdl
            [Harea1] => 400
            [Missileart] => Abilities\Weapons\BloodElfSpellThiefMISSILE\BloodElfSpellThiefMISSILE.mdl
            [Missilespeed] => 1300
            [Qfact1] => 1
            [Qarea1] => 400
            [dice1] => 1
            [Hfact1] => 1
            [RngBuff1] => 250
            [modelScale] => 0.5
            [rangeN1] => 1000
            [atkType1] => siege
            [cool1] => 2
            [Ubertip] => She's really enthusiastic about glaives. Don't ask her why.
            [scaleBull] => 0
            [abilList] => Array
                (
                )

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

            [targs1] => Array
                (
                )

            [weapsOn] => 1
            [teamColor] => 12
        )

    [settings] => Array
        (
            [balanceTip] => |cffCCFF00Bounce attack:|n   |cffFFFF002|r targets|n   |cffFFFF00-50%|r damage per bounce
            [abil_factor] => 0.55
            [author] => Ashbringer
            [alpha] => 255
            [authorDisplay] => |cffff6600Ashbringer|r
            [version] => 1.0
            [element] => iron
            [rarity] => unique
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -0.437306
                    [y] => 1.6872
                    [z] => 0
                    [scale] => 0.7
                    [rot] => 5.26828
                    [file] => buildings\human\HumanTower\HumanTower.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => true
                    [animation] => stand ready attack
                    [aniSpeed] => 50
                    [pcolor] => 255
                )

            [1] => Array
                (
                    [x] => 48.0426
                    [y] => -47.9084
                    [z] => 0
                    [scale] => 0.2
                    [rot] => 5.49779
                    [file] => Doodads\Cityscape\Structures\City_ColumnSingle\City_ColumnSingle.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [2] => Array
                (
                    [x] => -48.2475
                    [y] => -47.805
                    [z] => 0
                    [scale] => 0.2
                    [rot] => 3.92699
                    [file] => Doodads\Cityscape\Structures\City_ColumnSingle\City_ColumnSingle.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [3] => Array
                (
                    [x] => 47.8542
                    [y] => 48.4574
                    [z] => 0
                    [scale] => 0.2
                    [rot] => 3.92699
                    [file] => Doodads\Cityscape\Structures\City_ColumnSingle\City_ColumnSingle.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [4] => Array
                (
                    [x] => -48.0666
                    [y] => 48.3903
                    [z] => 0
                    [scale] => 0.2
                    [rot] => 5.49779
                    [file] => Doodads\Cityscape\Structures\City_ColumnSingle\City_ColumnSingle.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [5] => Array
                (
                    [x] => -48.34
                    [y] => -47.211
                    [z] => 89.6
                    [scale] => 0.5
                    [rot] => 4.99164
                    [file] => Abilities\Weapons\SentinelMissile\SentinelMissile.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [6] => Array
                (
                    [x] => 49.1393
                    [y] => -48.4633
                    [z] => 89.6
                    [scale] => 0.5
                    [rot] => 3.14159
                    [file] => Abilities\Weapons\SentinelMissile\SentinelMissile.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [7] => Array
                (
                    [x] => 47.4334
                    [y] => 49.0549
                    [z] => 89.6
                    [scale] => 0.5
                    [rot] => 1.16937
                    [file] => Abilities\Weapons\SentinelMissile\SentinelMissile.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [8] => Array
                (
                    [x] => -46.6898
                    [y] => 46.3704
                    [z] => 89.6
                    [scale] => 0.5
                    [rot] => 4.71239
                    [file] => Abilities\Weapons\SentinelMissile\SentinelMissile.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [9] => Array
                (
                    [x] => 3.74801
                    [y] => 0.330053
                    [z] => 70.4
                    [scale] => 1
                    [rot] => 0
                    [file] => Abilities\Weapons\GlaiveMissile\GlaiveMissile.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [10] => Array
                (
                    [x] => -0.400722
                    [y] => -18.7229
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\City_ColumnSemiCircle\City_ColumnSemiCircle.mdl
                    [red] => 90
                    [green] => 90
                    [blue] => 90
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [11] => Array
                (
                    [x] => 0.0902447
                    [y] => 19.3685
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\City_ColumnSemiCircle\City_ColumnSemiCircle.mdl
                    [red] => 90
                    [green] => 90
                    [blue] => 90
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [12] => Array
                (
                    [x] => -0.400722
                    [y] => -18.7229
                    [z] => 38.4
                    [scale] => 0.15
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\City_ColumnSemiCircle\City_ColumnSemiCircle.mdl
                    [red] => 90
                    [green] => 90
                    [blue] => 90
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [13] => Array
                (
                    [x] => 0.0902447
                    [y] => 19.3685
                    [z] => 38.4
                    [scale] => 0.15
                    [rot] => 4.71239
                    [file] => Doodads\Cityscape\Structures\City_ColumnSemiCircle\City_ColumnSemiCircle.mdl
                    [red] => 90
                    [green] => 90
                    [blue] => 90
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [14] => Array
                (
                    [x] => -38.3375
                    [y] => -48.4563
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [15] => Array
                (
                    [x] => -19.336
                    [y] => -48.4562
                    [z] => 6.4
                    [scale] => 0.15
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [16] => Array
                (
                    [x] => -0.334565
                    [y] => -48.4562
                    [z] => 12.8
                    [scale] => 0.15
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [17] => Array
                (
                    [x] => 18.6669
                    [y] => -48.4562
                    [z] => 6.4
                    [scale] => 0.15
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [18] => Array
                (
                    [x] => 37.7419
                    [y] => -48.4514
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 1.5708
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [19] => Array
                (
                    [x] => 47.4692
                    [y] => 38.2266
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 0.000000119209
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [20] => Array
                (
                    [x] => 47.4692
                    [y] => 19.2251
                    [z] => 6.4
                    [scale] => 0.15
                    [rot] => 0.000000119209
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [21] => Array
                (
                    [x] => 47.4692
                    [y] => 0.223663
                    [z] => 12.8
                    [scale] => 0.15
                    [rot] => 0.000000119209
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [22] => Array
                (
                    [x] => 47.4692
                    [y] => -18.7778
                    [z] => 6.4
                    [scale] => 0.15
                    [rot] => 0.000000119209
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [23] => Array
                (
                    [x] => 47.4741
                    [y] => -37.8528
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 0.000000119209
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [24] => Array
                (
                    [x] => -48.213
                    [y] => 38.4941
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 0.000000119209
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [25] => Array
                (
                    [x] => -48.2129
                    [y] => 19.4927
                    [z] => 6.4
                    [scale] => 0.15
                    [rot] => 0.000000119209
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [26] => Array
                (
                    [x] => -48.2129
                    [y] => 0.491227
                    [z] => 12.8
                    [scale] => 0.15
                    [rot] => 0.000000119209
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [27] => Array
                (
                    [x] => -48.2129
                    [y] => -18.5102
                    [z] => 6.4
                    [scale] => 0.15
                    [rot] => 0.000000119209
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

            [28] => Array
                (
                    [x] => -48.2081
                    [y] => -37.5853
                    [z] => 0
                    [scale] => 0.15
                    [rot] => 0.000000119209
                    [file] => Doodads\Cityscape\Structures\CityLowWall90\CityLowWall90.mdl
                    [red] => 155
                    [green] => 155
                    [blue] => 155
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

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

        )

    [dmgTable] => Array
        (
        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Attack
                    [code] => call ashbringer_bounder_throw(tower)
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNVorpalBlades.blp
                            [name] => Bounder
                            [short_explain] => Attacks have a chance to throw a glaive that bounces to every Glaivesaw.
                            [ONATTACK_chance] => 0.15
                            [ONATTACK_chanceLevelAdd] => 0.006
                            [long_explain] => Attacks have a |cffffff8015%|r chance to throw a glaive at one of your Glaivesaws, which then bounces to every other Glaivesaw, dealing |cffffff80300%|r attack damage to enemies it passes through. The bounder will never bounce between the two furthest Glaivesaws.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.6%|r chance|n|cffFFFF80+6%|r damage
                        )

                )

            [1] => Array
                (
                    [name] => Header
                    [code] => globals
        ProjectileType ashbringer_storm_missile
        ProjectileType ashbringer_bounder_missile
    endglobals
    
    struct Machinations
        integer max
        Effect array e[3]
        boolean array b[3]
        real array x[3]
        real array y[3]
        integer array c[3]
        integer array t[3]
    endstruct
    
    function ashbringer_machinations_setup  takes Tower tower returns nothing
        local Machinations ma = Machinations.create()
        local integer count = 0
        
        set tower.userInt = 0
        set tower.userReal2 = I2R(tower.getUID())
        set ma.max = 3 + 1
        
        loop
            set ma.t[count] = -1
            set ma.e[count] = 0
            set ma.b[count] = false
            set ma.c[count] = 3 + 1
            set count = count + 1
            exitwhen count==3
        endloop
        set tower.userInt3 = ma
    endfunction
    
    function ashbringer_bounder_throw takes Tower tower returns nothing
        local Machinations ma = tower.userInt3
        local integer random = GetRandomInt(0, 1)
        local integer first
        local integer second
        local integer third
        local integer bounces = ma.max
        local Projectile p
        
        if ma.max == 0 or random == 0 then
            set first = ma.t[0]
            set second = ma.t[1]
            set third = ma.t[2]
        elseif ma.max == 1 and random == 1 then
            set first = ma.t[1]
            set second = ma.t[0]
            set third = ma.t[2]
        elseif ma.max == 2 and random == 1 then
            set first = ma.t[2]
            set second = ma.t[1]
            set third = ma.t[0]
        endif
        
        if ma.max!=(3+1) then
            set p = Projectile.createLinearInterpolationFromPointToPoint(ashbringer_bounder_missile, tower, 0, 0, tower.getX(), tower.getY(), 110, ma.x[first], ma.y[first], 0, 0)
            set p.userInt = first
            set p.userInt2 = second
            set p.userInt3 = third
            set p.userReal = I2R(bounces)
        endif
    endfunction
    
    function ashbringer_bounder_bounce takes Projectile p, Creep target returns nothing
        local Tower tower = p.getCaster()
        local Machinations ma = tower.userInt3
        local Projectile n
        
        if p.userReal>0 and p.userInt2 >= 0 then
            call p.avertDestruction()
            call p.startLinearInterpolationToPoint(ma.x[p.userInt2], ma.y[p.userInt2], 0, 0)
            set p.userReal = p.userReal - 1
                
            set p.userInt = p.userInt2
            set p.userInt2 = p.userInt3
        endif
    endfunction
    
    function ashbringer_bounder_hit takes Projectile p, Unit target returns nothing
        local Tower tower = p.getCaster()
        call tower.doAttackDamage(target, tower.getCurrentAttackDamageWithBonus() * (3 + (tower.getLevel() * 0.06)), tower.calcAttackMulticrit(0,0,0))
    endfunction
    
    function ashbringer_storm_throw takes Tower tower, Creep target returns nothing 
        local Projectile p
        
        set p = Projectile.createBezierInterpolationFromUnitToUnit(ashbringer_storm_missile, tower, 1, 1, tower, target, 0, 0.3, 0.17, true)
        set p.userInt = 1
        set p.userInt2 = 10
        set p.userReal2 = tower.getX()
        set p.userReal3 = tower.getY()
    endfunction
    
    function ashbringer_storm_bounce takes Projectile p, Creep target returns nothing 
        local Tower tower = p.getCaster()
        local Iterate i
        
        if p.userInt==1 then
            call p.avertDestruction()
            call tower.doAttackDamage(target, tower.getCurrentAttackDamageWithBonus() * (0.5 + (tower.getLevel() * 0.02)), tower.calcAttackMulticrit(0,0,0))
            call p.startBezierInterpolationToPoint(p.userReal2, p.userReal3, 100, 0, 0.3, 0.17)
            set p.userInt = 0
        elseif p.userInt2>0 then
            set i = Iterate.overUnitsInRange(tower, TARGET_TYPE_CREEPS, p.userReal2, p.userReal3, tower.getRange())
            set target = i.nextRandom()
            if target!=0 then
                call p.avertDestruction()
                call p.startBezierInterpolationToUnit(target, 0, 0.3, 0.17, true)
                set p.userInt = 1
                set p.userInt2 = p.userInt2 - 1
                call i.destroy()
            endif
        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
        set ashbringer_storm_missile = ProjectileType.createInterpolate("Abilities\\Weapons\\SentinelMissile\\SentinelMissile.mdl", 1100)
        call ashbringer_storm_missile.setEventOnInterpolationFinished(ProjectileTargetEvent.ashbringer_storm_bounce)
        
        set ashbringer_bounder_missile = ProjectileType.createInterpolate("Abilities\\Weapons\\GlaiveMissile\\GlaiveMissile.mdl", 2000)
        call ashbringer_bounder_missile.enableCollision(ProjectileTargetEvent.ashbringer_bounder_hit, 100, TARGET_TYPE_CREEPS, false)
        call ashbringer_bounder_missile.setEventOnInterpolationFinished(ProjectileTargetEvent.ashbringer_bounder_bounce)
    endfunction
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [2] => Array
                (
                    [name] => On Tower Destruction
                    [code] => local Machinations ma = tower.userInt3
    local integer max_mach = 3
    local integer count = max_mach
    
    loop
        set count = count - 1
        if ma.b[count] == true then
            call ma.e[count].destroy()
        endif
        
        exitwhen count==0
    endloop
    
    call ma.destroy()
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [3] => Array
                (
                    [name] => On Damage
                    [code] => call ashbringer_storm_throw(tower, Event.getTarget())
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 0.05
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNUpgradeMoonGlaive.blp
                            [name] => Glaive Storm
                            [short_explain] => Attack hits have a chance to fire a projectile which repeatedly bounces between enemies and the tower.
                            [ONDAMAGE_chanceLevelAdd] => 0.002
                            [long_explain] => Attack hits have a |cffffff805%|r chance to throw an additional glaive at the target, dealing |cffffff8050%|r attack damage before returning to the tower. When the glaive returns, it bounces to a new random target within attack range, repeating until there are no targets in range or a maximum of |cffffff8010|r hits. |n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.2%|r chance|n|cffFFFF80+2%|r damage
                        )

                )

            [4] => Array
                (
                    [name] => Periodic
                    [code] => local Machinations ma = tower.userInt3
    local Iterate i
    local integer count = 0
    local integer max_mach = 3
    local real damage = tower.getCurrentAttackDamageWithBonus() * (0.5 + (tower.getLevel() * 0.01))
    local Creep next
    
    loop
        if ma.b[count] == true then
            set i = Iterate.overUnitsInRange(tower, TARGET_TYPE_CREEPS, ma.x[count], ma.y[count], 150)
            set next = i.next()
            loop
                exitwhen next == 0
                call Effect.createSimpleOnUnit("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl", next, "origin").setLifetime(2.0)
                call tower.doAttackDamage(next, damage, tower.calcAttackMulticrit(0,0,0))
                set next = i.next()
            endloop
            //call i.destroy()
        endif
        
        set count = count + 1
        exitwhen count==max_mach
    endloop
                    [values] => Array
                        (
                            [visible] => false
                            [PERIODIC_period] => 0.5
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [5] => Array
                (
                    [name] => Autocast
                    [code] => local Machinations ma = tower.userInt3
    local real target_x = GetSpellTargetX()
    local real target_y = GetSpellTargetY()
    local real dist1
    local real dist2 = 0
    local integer subcount
    local integer max_mach = 3
    local integer count = 0
    local integer sel = max_mach + 1
    local integer closest
    local real distance1 = 0
    local real distance2 = 0
    local real distance3 = 0
    
    loop
        if ma.b[count]==false then
            set ma.b[count] = true
            set ma.e[count] = Effect.createAnimatedScaled("Abilities\\Weapons\\BloodElfSpellThiefMISSILE\\BloodElfSpellThiefMISSILE.mdl", target_x+20, target_y, 40.0, 0.0, 1.45)
            call ma.e[count].setAnimationSpeed(2.0)
            call ma.e[count].setScale(2.0)
            set ma.x[count] = target_x
            set ma.y[count] = target_y
            if count==0 then
                set ma.c[count] = sel
            elseif count==1 then
                set ma.c[count-1] = 1
                set ma.c[count] = 0
            else
                set ma.c[count] = sel
            endif
            set ma.max = count
            
            set sel = count
            set count = max_mach
        else
        endif
        set count = count + 1
        
        exitwhen count>=max_mach
    endloop
    
    if sel>max_mach then
        set count = 0
        call ma.e[0].destroy()
        loop
            if count<(max_mach-1) then
                set ma.b[count] = ma.b[count+1]
                set ma.e[count] = ma.e[count+1]
                set ma.x[count] = ma.x[count+1]
                set ma.y[count] = ma.y[count+1]
                set ma.c[count] = sel
            endif
            set count = count + 1
            
            exitwhen count==max_mach
        endloop
        
        set ma.b[max_mach-1] = true
        set ma.e[max_mach-1] = Effect.createAnimatedScaled("Abilities\\Weapons\\BloodElfSpellThiefMISSILE\\BloodElfSpellThiefMISSILE.mdl", target_x+20, target_y, 40.0, 0.0, 1.45)
        call ma.e[max_mach-1].setAnimationSpeed(2.0)
        call ma.e[max_mach-1].setScale(2.0)
        set ma.x[max_mach-1] = target_x
        set ma.y[max_mach-1] = target_y
        set ma.c[max_mach-1] = sel
        
        set sel = 0
    endif
    
    if ma.max == 0 then
        set ma.t[0] = 0
    elseif ma.max == 1 then
        set ma.t[0] = 0
        set ma.t[1] = 1
    elseif ma.max == 2 then
        set distance1 = DistanceBetweenPoints(Location(ma.x[0], ma.y[0]), Location(ma.x[1], ma.y[1]))
        set distance2 = DistanceBetweenPoints(Location(ma.x[0], ma.y[0]), Location(ma.x[2], ma.y[2]))
        set distance3 = DistanceBetweenPoints(Location(ma.x[1], ma.y[1]), Location(ma.x[2], ma.y[2]))
        
        if distance1 >= distance2 and distance1 >= distance3 then
            set ma.t[0] = 0
            set ma.t[1] = 2
            set ma.t[2] = 1
        elseif distance2 >= distance1 and distance2 >= distance3 then
            set ma.t[0] = 0
            set ma.t[1] = 1
            set ma.t[2] = 2
        elseif distance3 >= distance1 and distance3 >= distance2 then
            set ma.t[0] = 1
            set ma.t[1] = 0
            set ma.t[2] = 2
        endif
    endif

    if ma.max>1 then
        set count = 0
        loop
            if ma.b[count]==true then
                set subcount = 0
                set closest = max_mach + 1
                set dist2 = 0
                loop
                    if ma.b[subcount]==true and count!=subcount then
                        set dist1 = SquareRoot(((ma.x[subcount]-ma.x[count]) * (ma.x[subcount]-ma.x[count])) + ((ma.y[subcount]-ma.y[count]) * (ma.y[subcount]-ma.y[count])))
                        
                        if dist2==0 then
                            set dist2 = dist1
                        endif
                        
                        if dist1<=dist2 and dist1>=50 then
                            set dist2 = dist1
                            set closest = subcount
                        endif
                    endif
                    set subcount = subcount + 1
                    
                    exitwhen subcount==max_mach
                endloop
                set ma.c[count] = closest
            endif
            set count = count + 1
            
            exitwhen count==max_mach
        endloop
    endif
    
    set tower.userInt3 = ma
                    [values] => Array
                        (
                            [AUTOCAST_cooldown] => 10
                            [AUTOCAST_autoRange] => 0
                            [AUTOCAST_manacost] => 0
                            [icon] => ReplaceableTextures\CommandButtons\BTNEngineeringUpgrade.blp
                            [AUTOCAST_range] => 1100
                            [AUTOCAST_targetType] => 0
                            [AUTOCAST_numBuffsBeforeIdle] => 0
                            [caster_art] => 
                            [long_explain] => Create a Glaivesaw at the target location. Glaivesaws deal |cffffff8050%|r attack damage to enemies within |cffffff80150|r range every |cffffff800.5|r seconds. Limit |cffffff803|r.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+1%|r damage
                            [target_art] => 
                            [AUTOCAST_autocastType] => AC_TYPE_NOAC_POINT
                            [AUTOCAST_buffType] => 0
                            [AUTOCAST_isExtended] => true
                            [name] => Glaivesaw
                            [AUTOCAST_targetSelf] => false
                            [short_explain] => Place up to |cffffff803|r devices that damage enemies near them.
                        )

                )

            [6] => Array
                (
                    [name] => On Tower Creation
                    [code] => call ashbringer_machinations_setup(tower)
    call SetUnitColor(tower.getUnit(), ConvertPlayerColor(12))
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
        )

    [units] => Array
        (
        )

    [references] => Array
        (
        )

    [lightning] => Array
        (
        )

)