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

            [Art] => ReplaceableTextures\CommandButtons\BTNInfernalCannon.blp
            [turnRate] => 2
            [dmgplus1] => 794
            [bldtm] => 1
            [goldcost] => 2750
            [sides1] => 1
            [acquire] => 1000
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Gatling Gun
            [weapTp1] => missile
            [MissileHoming] => 1
            [file] => units\creeps\InfernalCannonCannon\InfernalCannonCannon.mdl
            [Missileart] => Abilities\Weapons\BoatMissile\BoatMissile.mdl
            [Missilespeed] => 1500
            [dice1] => 1
            [RngBuff1] => 250
            [weapType1] => MetalHeavyChop
            [modelScale] => 0.6
            [rangeN1] => 1000
            [backSw1] => -2.5
            [atkType1] => siege
            [cool1] => 1
            [Ubertip] => A very powerful gun created by the dwarves. It has a chance to fire a burst of projectiles.
            [abilList] => Array
                (
                )

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

            [targs1] => Array
                (
                )

            [weapsOn] => 1
        )

    [settings] => Array
        (
            [balanceTip] => |cffFFFF0010%|r crit chance (|cffFFFF00+0.5%|r/lvl)
            [abil_factor] => 0.28
            [author] => Boekie
            [alpha] => 255
            [authorDisplay] => |cff00CD00Boekie|r
            [version] => 1.0
            [element] => iron
            [rarity] => unique
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -0.0000702143
                    [y] => -2.37513
                    [z] => -89.6
                    [scale] => 0.7
                    [rot] => 2.38975
                    [file] => buildings\other\WyvernCage\WyvernCage.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

        )

    [dmgTable] => Array
        (
            [0] => Array
                (
                    [id] => MOD_ATK_CRIT_CHANCE
                    [base] => 0.0875
                    [add] => 0.005
                )

        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Attack
                    [code] => local Unit target = Event.getTarget()  
    local PeriodicEvent ev = tower.userInt3
    local integer amount = 1 //initial num balls
    //0.1 is the periodic timer. if you change that, change the value here as well
    local integer maxShotsPossible = R2I(tower.getCurrentAttackspeed() / 0.1) 
    local real dmgRatio = 1.0
    
    //increment amount of extra attacks until the chance isn't met or max is reached.
    loop  
        exitwhen tower.calcChance(0.65 + tower.getLevel() * (0.004) - amount * 0.06) == false or amount > 10
        set amount = amount + 1  
    endloop
    
    //if tower cannot release as many projectiles as required, scale the dmg instead!
    if amount > maxShotsPossible then
        set dmgRatio = I2R(amount) / I2R(maxShotsPossible)
        set amount = maxShotsPossible
    endif
    
    //sets the target to shoot balls at and makes the periodic period smaller to get the rapid attack  
    set tower.userInt = target
    set tower.userInt2 = target.getUID()
    set tower.userReal = amount
    set tower.userReal2 = dmgRatio
    call ev.enable()
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNFlakCannons.blp
                            [name] => Rapid Gun Fire
                            [short_explain] => Has a chance to fire multiple projectiles on attack, they have a chance to explode.
                            [ONATTACK_chance] => 0.65
                            [ONATTACK_chanceLevelAdd] => 0.004
                            [long_explain] => Has a |cffFFFF8065%|r chance on attack to shoot an extra projectile. Every extra projectile can be followed up by another projectile, but the chance is reduced by |cffFFFF806%|r each time. Every extra projectile deals the same amount of damage as a normal attack and has a |cffFFFF8010%|r chance to explode, dealing that damage in |cffFFFF80200|r AoE around the target. Maximum of |cffFFFF8010|r extra projectiles per attack.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.4%|r chance|n|cffFFFF80+0.3%|r chance to explode
                        )

                )

            [1] => Array
                (
                    [name] => Header
                    [code] => globals
        ProjectileType ball 
        BuffType boekie_sentryBuff
    endglobals
    
    public function hit takes Projectile p, Unit creep returns nothing  
        local Tower tower = p.getCaster()  
        local Effect targetEffect
        
        if tower.calcChance(0.10 + (tower.getLevel()*0.003)) == true then
            set targetEffect = Effect.createScaled("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl", p.x, p.y, 30.0, 0, 1.6) 
            call targetEffect.setLifetime(1.0) 
            call tower.doAttackDamageAoEUnit(creep, 200, p.userReal*tower.getCurrentAttackDamageWithBonus(),tower.calcAttackMulticrit(0,0,0), 0.0)
        else
            call tower.doAttackDamage(creep,p.userReal*tower.getCurrentAttackDamageWithBonus(),tower.calcAttackMulticrit(0,0,0)) 
        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 ball = ProjectileType.create("Abilities\\Weapons\\BoatMissile\\BoatMissile.mdl",4,1000)  
        call ball.enableHoming(ProjectileTargetEvent.hit,0)  
        
        set boekie_sentryBuff = BuffType.create(0.0, 0.0, true) 
        call m.addModification(MOD_DAMAGE_ADD_PERC, 0.0, 0.005) 
        call boekie_sentryBuff.setBuffModifier(m) 
        call boekie_sentryBuff.setBuffIcon('@@0@@') 
        call boekie_sentryBuff.setStackingGroup("boekie_sentryBuff") 
    endfunction
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [2] => Array
                (
                    [name] => Periodic
                    [code] => local Unit target = tower.userInt
    local Projectile gatlingShot
     
    if tower.userInt3 == 0 then  
        //sets the userInt3 to this periodic event  
        set tower.userInt3 = Event.getCurrentPeriodicEvent()
    endif
    
    //check if target hasn't died
    if target.getUID() != tower.userInt2 then
        call PeriodicEvent(tower.userInt3).disable()
        return
    endif
    
    if tower.userReal > 0 then //balls remain to be shot?
        set gatlingShot = Projectile.createFromPointToUnit(ball,tower,1,0,tower.getX(),tower.getY(),100,target,true,false,false)
        call gatlingShot.setScale(0.4)
        set gatlingShot.userReal = tower.userReal2 //the dmgRatio
        
        set tower.userReal = tower.userReal - 1
        if tower.userReal <= 0 then  //burst attack is over so switch off periodic
            call PeriodicEvent(tower.userInt3).disable()
        endif  
    endif
                    [values] => Array
                        (
                            [visible] => false
                            [PERIODIC_period] => 0.1
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [3] => Array
                (
                    [name] => On Unit Comes In Range
                    [code] => local integer towerLevel = tower.getLevel()
    local integer buffLevel = 1
    local Buff b = tower.getBuffOfGroup("boekie_sentryBuff")
    
    if b != 0 then
        set buffLevel = IMinBJ(b.userInt + 1, 20)
    endif
    set boekie_sentryBuff.applyCustomTimed(tower, tower, buffLevel * (30 + towerLevel), 3.0 + 0.05 * towerLevel).userInt = buffLevel
                    [values] => Array
                        (
                            [UNITINRANGE_targetType] => TARGET_TYPE_CREEPS
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNClusterRockets.blp
                            [name] => Sentry
                            [short_explain] => This tower becomes stronger if intruders come in range.
                            [UNITINRANGE_range] => 800
                            [long_explain] => This tower gains |cffFFFF8015%|r attackdamage whenever a creep comes within |cffFFFF80800|r range of it. Lasts |cffFFFF803|r seconds and stacks up to |cffFFFF8020|r times. |n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.5%|r damage|n|cffFFFF80+0.05|r seconds duration
                        )

                )

            [4] => Array
                (
                    [name] => On Tower Creation
                    [code] => set tower.userInt = 0  //saves current projectile target
set tower.userInt2 = 0 //saves target UID - safety check
set tower.userInt3 = 0  //saves the periodic
set tower.userReal = 0.  //saves number of balls to fire
set tower.userReal2 = 1. //saves the projectile's dmg ratio
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => Bblo
                    [oeValues] => Array
                        (
                            [EditorName] => Sentry
                            [Buffubertip] => This unit is alerted and has increased bonus damage.
                            [TargetArt] => Abilities\Spells\NightElf\Immolation\ImmolationTarget.mdl
                            [Bufftip] => Sentry
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNClusterRockets.blp
                        )

                )

        )

    [units] => Array
        (
        )

    [references] => Array
        (
        )

)