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

            [Art] => ReplaceableTextures\CommandButtons\BTNForgottenOne.blp
            [dmgplus1] => 5288
            [bldtm] => 1
            [unitSound] => FacelessOne
            [goldcost] => 3500
            [sides1] => 1
            [Missilearc] => 0.35
            [acquire] => 1200
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Kraken
            [splashTargs1] => air,enemies,ground
            [weapTp1] => msplash
            [MissileHoming] => 1
            [file] => Units\Creeps\ForgottenOne\ForgottenOne.mdl
            [Harea1] => 100
            [uberSplat] => Array
                (
                )

            [Missileart] => Abilities\Weapons\ChimaeraAcidMissile\ChimaeraAcidMissile.mdl
            [Missilespeed] => 1050
            [Qarea1] => 250
            [Qfact1] => 0.25
            [dice1] => 1
            [RngBuff1] => 250
            [Hfact1] => 0.5
            [modelScale] => 0.3
            [rangeN1] => 1200
            [atkType1] => hero
            [cool1] => 5
            [Ubertip] => What can you do with a drunken sailor, what can you do... Throw it in my gorge.
            [scaleBull] => 0
            [abilList] => Array
                (
                )

            [buildingShadow] => Array
                (
                )

            [targs1] => air,enemies,ground
            [weapsOn] => 1
        )

    [settings] => Array
        (
            [balanceTip] => |cffCCFF00Splash attack:|n   |cffFFFF00100|r AoE: |cffFFFF0050%|r damage|r|n   |cffFFFF00250|r AoE: |cffFF800025%|r damage|r|n|cffFFFF00+10% |rdmg to bosses (|cffFFFF00+1%|r/lvl)|n|cffFFFF00+2% |rattackspeed/lvl
            [abil_factor] => 0.30
            [author] => cedi
            [alpha] => 255
            [authorDisplay] => cedi, Deemzul, His_Shadow
            [version] => 1.0
            [element] => darkness
            [rarity] => unique
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => -27.3545
                    [y] => -42.5404
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 0.805202
                    [file] => Units\Creeps\ForgottenOne\ForgottenOneTent.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [1] => Array
                (
                    [x] => -15.1726
                    [y] => 43.5154
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 4.96738
                    [file] => Units\Creeps\ForgottenOne\ForgottenOneTent.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [2] => Array
                (
                    [x] => 25.4508
                    [y] => 39.4248
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 3.75037
                    [file] => Units\Creeps\ForgottenOne\ForgottenOneTent.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [3] => Array
                (
                    [x] => 43.3959
                    [y] => -7.00121
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 2.79156
                    [file] => Units\Creeps\ForgottenOne\ForgottenOneTent.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [4] => Array
                (
                    [x] => 22.8194
                    [y] => -42.6985
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 2.40881
                    [file] => Units\Creeps\ForgottenOne\ForgottenOneTent.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [5] => Array
                (
                    [x] => -45.0617
                    [y] => 2.34607
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 5.78764
                    [file] => Units\Creeps\ForgottenOne\ForgottenOneTent.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [6] => Array
                (
                    [x] => -35.0295
                    [y] => -24.1784
                    [z] => 0
                    [scale] => 0.6
                    [rot] => 4.02172
                    [file] => Doodads\Barrens\Props\Barrens_Bones\Barrens_Bones7.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [7] => Array
                (
                    [x] => 21.8883
                    [y] => -20.7246
                    [z] => 0
                    [scale] => 0.6
                    [rot] => 2.23402
                    [file] => Doodads\Barrens\Props\Barrens_Bones\Barrens_Bones7.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [8] => Array
                (
                    [x] => -5.79772
                    [y] => 8.52751
                    [z] => 0
                    [scale] => 0.6
                    [rot] => 3.71755
                    [file] => Doodads\Barrens\Props\Barrens_Bones\Barrens_Bones7.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [9] => Array
                (
                    [x] => -25.564
                    [y] => -23.049
                    [z] => 0
                    [scale] => 0.6
                    [rot] => 5.98648
                    [file] => Doodads\Barrens\Props\Barrens_Bones\Barrens_Bones7.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [10] => Array
                (
                    [x] => 16.097
                    [y] => -37.2782
                    [z] => 0
                    [scale] => 0.6
                    [rot] => 3.68265
                    [file] => Doodads\Barrens\Props\Barrens_Bones\Barrens_Bones7.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [11] => Array
                (
                    [x] => 36.3047
                    [y] => -9.51671
                    [z] => 0
                    [scale] => 0.6
                    [rot] => 0.383973
                    [file] => Doodads\Barrens\Props\Barrens_Bones\Barrens_Bones7.mdl
                    [red] => 15
                    [green] => 15
                    [blue] => 15
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [12] => Array
                (
                    [x] => -39.1828
                    [y] => -51.5214
                    [z] => 12.8
                    [scale] => 0.4
                    [rot] => 4.23062
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile3.mdl
                    [red] => 250
                    [green] => 250
                    [blue] => 250
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [13] => Array
                (
                    [x] => 0.769665
                    [y] => -56.4937
                    [z] => 6.4
                    [scale] => 0.5
                    [rot] => 2.94454
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [14] => Array
                (
                    [x] => 46.3687
                    [y] => -37.4818
                    [z] => 6.4
                    [scale] => 0.5
                    [rot] => 0.680679
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [15] => Array
                (
                    [x] => 45.9041
                    [y] => 18.9879
                    [z] => 6.4
                    [scale] => 0.5
                    [rot] => 0.628319
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [16] => Array
                (
                    [x] => -48.6103
                    [y] => -10.3478
                    [z] => 6.4
                    [scale] => 0.5
                    [rot] => 3.02636
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [17] => Array
                (
                    [x] => 26.2285
                    [y] => -58.9028
                    [z] => 6.4
                    [scale] => 0.4
                    [rot] => 5.36524
                    [file] => Doodads\LordaeronSummer\Props\SkullPile\SkullPile3.mdl
                    [red] => 250
                    [green] => 250
                    [blue] => 250
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

        )

    [dmgTable] => Array
        (
            [0] => Array
                (
                    [id] => MOD_DMG_TO_BOSS
                    [base] => 0.1
                    [add] => 0.01
                )

            [1] => Array
                (
                    [id] => MOD_ATTACKSPEED
                    [base] => 0
                    [add] => 0.02
                )

        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => Header
                    [code] => globals
        BuffType myBuff
        Unit array resultArray
        TargetType TT_GROUND
    endglobals

    function fire_tentacles takes Tower tower returns nothing
        local integer lvl = tower.getLevel()
        local Iterate inRange = Iterate.overUnitsInRangeOfCaster(tower,TT_GROUND,1200)
        local Unit next //Used as next during the iterate and the unit to affect during the other loop.
        local integer indexCounter = 0
        local integer loopCounter
    
    
        if lvl == 25 then       // +1 tentacle on level 15 and 25
            set loopCounter = 8
        else
            if lvl > 14  then
                set loopCounter = 7
            else 
                set loopCounter = 6
            endif
        endif
        
        //loop through the iterate; store results in an array for random target selection in the second loop
        //This way we can get the same unit multiple times (vs. only getting one unit once by using Iterate.nextRandom)
        loop
            set next=inRange.next()
            exitwhen next==0
            set resultArray[indexCounter] = next
            set indexCounter = indexCounter+1
        endloop
            
        if(indexCounter > 0) then //If there were any creeps in range
            //Set cooldown (so that comes-in-range can't fire tentacles while they're on cooldown)
            set tower.userInt = Game.getGameTime() + 100 - 1*lvl
            loop
                set loopCounter = loopCounter - 1
                set next = resultArray[GetRandomInt(0,indexCounter-1)]
                call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Undead\\Impale\\ImpaleHitTarget.mdl", GetUnitX( next.getUnit() )+GetRandomReal(-35,35), GetUnitY( next.getUnit() )+GetRandomReal(-35,35) ) )
                call cb_stun.applyOnlyTimed(tower, next, 0.4)
                call tower.doCustomAttackDamage(next,tower.getCurrentAttackDamageWithBonus()*(0.15),tower.calcAttackMulticrit(0.0,0.0,0),AttackType.PHYSICAL)
                exitwhen loopCounter == 0
            endloop
            //Enable periodic with the cooldown
            if tower.userInt3 != 0 then
                call PeriodicEvent(tower.userInt3).enableAdvanced(4-0.04*lvl, false)
            endif
        else
            //No creeps were in range; periodic will go to sleep
            if tower.userInt3 != 0 then
                call PeriodicEvent(tower.userInt3).disable()
            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
        local Modifier mod = Modifier.create()
        set myBuff = BuffType.create( 5, 0.2, false )
        call mod.addModification(MOD_ARMOR,-15,-0.6)
        call myBuff.setBuffModifier(mod)
        call myBuff.setBuffIcon('@@0@@')
        set TT_GROUND = TargetType.create(TARGET_TYPE_CREEPS+TARGET_TYPE_SIZE_MASS+TARGET_TYPE_SIZE_NORMAL+TARGET_TYPE_SIZE_CHAMPION+TARGET_TYPE_SIZE_BOSS)
	endfunction
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [1] => Array
                (
                    [name] => On Kill
                    [code] => local Unit target = Event.getTarget() 
    local integer size = target.getSize()
    
   if size == SIZE_AIR then      
   call tower.modifyProperty(MOD_DAMAGE_BASE_PERC, 0.02)
   else
    if size == SIZE_MASS then 
        call tower.modifyProperty(MOD_DAMAGE_BASE_PERC, 0.005)
    else 
        if size == SIZE_NORMAL then 
            call tower.modifyProperty(MOD_DAMAGE_BASE_PERC, 0.01)
        else
            if size == SIZE_CHAMPION then 
                call tower.modifyProperty(MOD_DAMAGE_BASE_PERC, 0.02)
            else
                if size == SIZE_BOSS then 
                    call tower.modifyProperty(MOD_DAMAGE_BASE_PERC, 0.10)
                endif
            endif
        endif
    endif
    endif
    call DestroyEffect( AddSpecialEffect( "Objects\\Spawnmodels\\Orc\\OrcLargeDeathExplode\\OrcLargeDeathExplode.mdl", GetUnitX( Event.getTarget().getUnit() ), GetUnitY( Event.getTarget().getUnit() ) ) )
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNCannibalize.blp
                            [name] => Eat the Dead
                            [short_explain] => Kraken gains a permanent increase in base attack damage on kill.
                            [long_explain] => For every kill, Kraken's base attack damage increases permanently:|n|n|cffFFFF80+0.5%|r for mass creeps.|n|cffFFFF80+1%|r for normal creeps.|n|cffFFFF80+2%|r for champions.|n|cffFFFF80+2%|r for air creeps.|n|cffFFFF80+10%|r for bosses.
                        )

                )

            [2] => Array
                (
                    [name] => On Damage
                    [code] => call myBuff.apply( tower, Event.getTarget(), tower.getLevel() )
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 0.3
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNCorrosiveBreath.blp
                            [name] => Acid Goo
                            [short_explain] => Gives a chance to decrease armor on damage.
                            [ONDAMAGE_chanceLevelAdd] => 0.01
                            [long_explain] => Kraken's spit has a |cffFFFF8030%|r chance to decrease damaged creeps' armor by |cffFFFF8015|r for |cffFFFF805|r seconds.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.2|r seconds|n|cffFFFF80+0.6|r armor decrease|n|cffFFFF80+1%|r chance
                        )

                )

            [3] => Array
                (
                    [name] => Periodic
                    [code] => local integer lvl = tower.getLevel()
    //Store PeriodicEvent into userInt3
    if tower.userInt3 == 0 then
        set tower.userInt3 = Event.getCurrentPeriodicEvent()
    endif
    
    call fire_tentacles(tower)
                    [values] => Array
                        (
                            [visible] => true
                            [PERIODIC_period] => 4
                            [icon] => ReplaceableTextures\CommandButtons\BTNImpale.blp
                            [name] => Tentacle Attack
                            [short_explain] => Periodically stuns and deals a percentage of current attack damage to nearby non-flying creeps.
                            [long_explain] => Every |cffFFFF804|r seconds, the Kraken attacks random non-flying targets with |cffFFFF806|r tentacles. Each tentacle deals |cffFFFF8015%|r of Kraken's current attack damage as |cffC0C0C0Physical|r damage and stuns its target for |cffFFFF800.4|r seconds.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80-0.04|r seconds cooldown|n|cffFFFF80+1|r tentacle on levels |cffFFFF8015|r and |cffFFFF8025|r
                        )

                )

            [4] => Array
                (
                    [name] => On Unit Comes In Range
                    [code] => if tower.userInt < Game.getGameTime() then
        call fire_tentacles(tower)
    endif
                    [values] => Array
                        (
                            [UNITINRANGE_targetType] => TARGET_TYPE_CREEPS
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [UNITINRANGE_range] => 1200
                            [long_explain] => 
                        )

                )

            [5] => Array
                (
                    [name] => On Tower Creation
                    [code] => set tower.userInt = 0   //Stores the tentacles' cooldown for 'fired already' state
    set tower.userInt3 = 0  //Stores the PeriodicEvent
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => BHfs
                    [oeValues] => Array
                        (
                            [Targetattach] => chest
                            [EditorName] => Acid Goo
                            [Buffubertip] => The armor of this unit is decreased.
                            [TargetArt] => Abilities\Spells\Other\AcidBomb\BottleImpact.mdl
                            [Bufftip] => Acid Goo
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNCorrosiveBreath.blp
                        )

                )

        )

    [units] => Array
        (
        )

    [references] => Array
        (
        )

)