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

            [Art] => ReplaceableTextures\CommandButtons\BTNMilitia.blp
            [turnRate] => 3
            [dmgplus1] => 70
            [bldtm] => 1
            [unitSound] => Peasant
            [goldcost] => 250
            [sides1] => 1
            [acquire] => 800
            [upgrades] => Array
                (
                )

            [Upgrade] => Array
                (
                )

            [Name] => Militia Watchtower
            [weapTp1] => missile
            [MissileHoming] => 1
            [file] => units\human\Militia\Militia.mdl
            [Missileart] => Abilities\Weapons\Axe\AxeMissile.mdl
            [Missilespeed] => 1500
            [dice1] => 1
            [RngBuff1] => 250
            [modelScale] => 0.4
            [rangeN1] => 850
            [atkType1] => siege
            [cool1] => 0.7
            [Ubertip] => Militia guardians rain axes at the heads of the enemies. However, they are not very accurate, and afraid of undead and large creeps.
            [abilList] => Array
                (
                )

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

            [targs1] => Array
                (
                )

            [weapsOn] => 1
        )

    [settings] => Array
        (
            [balanceTip] => |cffFFFF00-20% |rdmg to bosses (|cffFFFF00+0.6%|r/lvl)|n|cffFFFF00-20% |rdmg to undead (|cffFFFF00+0.4%|r/lvl)|n|cffFFFF00+20% |rdmg to nature (|cffFFFF00+0.4%|r/lvl)
            [abil_factor] => 0.433
            [author] => ShyGnome
            [alpha] => 255
            [authorDisplay] => ShyGnome
            [version] => 1.0
            [element] => iron
            [rarity] => uncommon
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => 14.2113
                    [y] => -44.3111
                    [z] => 0
                    [scale] => 0.45
                    [rot] => 4.64258
                    [file] => units\human\Militia\Militia.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [1] => Array
                (
                    [x] => -40.5935
                    [y] => 37.6844
                    [z] => 0
                    [scale] => 0.5
                    [rot] => 1.85005
                    [file] => units\human\Militia\Militia.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [2] => Array
                (
                    [x] => -50.531
                    [y] => -2.11241
                    [z] => 0
                    [scale] => 0.5
                    [rot] => 3.35103
                    [file] => Doodads\LordaeronSummer\Terrain\Crates\Crates1.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [3] => Array
                (
                    [x] => 42.0355
                    [y] => -16.7123
                    [z] => 0
                    [scale] => 0.55
                    [rot] => 5.89921
                    [file] => Doodads\LordaeronSummer\Terrain\Crates\Crates0.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [4] => Array
                (
                    [x] => -0.160399
                    [y] => 11.3147
                    [z] => 0
                    [scale] => 0.7
                    [rot] => 4.69494
                    [file] => buildings\human\HumanTower\HumanTower.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => true
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

        )

    [dmgTable] => Array
        (
            [0] => Array
                (
                    [id] => MOD_DMG_TO_BOSS
                    [base] => -0.2
                    [add] => 0.006
                )

            [1] => Array
                (
                    [id] => MOD_DMG_TO_UNDEAD
                    [base] => -0.2
                    [add] => 0.004
                )

            [2] => Array
                (
                    [id] => MOD_DMG_TO_NATURE
                    [base] => 0.2
                    [add] => 0.004
                )

        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Attack
                    [code] => local integer attacks = 2
    local boolean add = false
    local Unit maintarget = Event.getTarget()
    local Unit target
    local Iterate it = Iterate.overUnitsInRangeOfUnit(tower,TARGET_TYPE_CREEPS,maintarget,450)
    local real sidearc = 0.20
    local boolean itDestroyed = false
 
    if tower.getLevel() >= 15 then
        set attacks = attacks + 1
    endif

    if tower.getLevel() >= 25 then
        set attacks = attacks + 1
    endif
    
    loop
        exitwhen attacks == 0 // Exit when all attacks are fired
        
        // If the Iterate is not destroyed, get the next target
        if not itDestroyed then
            set target = it.next()
        
            // If there are no more targets
            if target == 0 then
                set itDestroyed = true // Iterate is destroyed (auto destroy)
                set target = maintarget // target is the maintarget now
            endif
        endif
  
        // If there are no more units, shoot at the maintarget (itDestroyed). If there are units then don't shoot at the maintarget
        if itDestroyed or target != maintarget then
            call Projectile.createBezierInterpolationFromUnitToUnit(MilitiaAxe,tower,0,0,tower,target,0,sidearc,0,true).setScale(0.40)
            set attacks = attacks - 1
            set sidearc = -sidearc
            if add then
                set sidearc = sidearc + 0.20
            endif
            set add = not add
        endif

    endloop
 
    // If the Iterate is not destroyed yet, destroy it
    if not itDestroyed then
        call it.destroy()
    endif
                    [values] => Array
                        (
                            [visible] => true
                            [icon] => ReplaceableTextures\CommandButtons\BTNFanOfKnives.blp
                            [name] => Hail of Axes
                            [short_explain] => Attacks multiple enemies at once with a chance to miss.
                            [ONATTACK_chance] => 1.0
                            [ONATTACK_chanceLevelAdd] => 0.0
                            [long_explain] => Militia guardians throw axes to up to |cffFFFF803|r enemies at once, but each attack has |cffFFFF8033%|r chance to miss.  If there are less creeps than attacks, the remaining axes will hit the main target.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80-1%|r chance to miss|n|cffFFFF80+1|r target at levels |cffFFFF8015|r and |cffFFFF8025|r
                        )

                )

            [1] => Array
                (
                    [name] => Header
                    [code] => globals
        //@export
        ProjectileType MilitiaAxe
    endglobals

    function MilitiaAxeHit takes Projectile p, Unit target returns nothing
   local Tower tower = p.getCaster()
   if tower.calcBadChance(0.33-0.01*tower.getLevel()) then
      call tower.getOwner().displayFloatingTextX("Miss",tower,255, 0, 0,255,0.05,0.0,2.0)
   else
      call tower.doAttackDamage(target,tower.getCurrentAttackDamageWithBonus(),tower.calcAttackCritNoBonus())
   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 MilitiaAxe = ProjectileType.createInterpolate("Abilities\\Weapons\\Axe\\AxeMissile.mdl",800)
            call MilitiaAxe.setEventOnInterpolationFinished(MilitiaAxeHit)
	endfunction
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

            [2] => Array
                (
                    [name] => On Damage
                    [code] => if tower.calcBadChance(0.33-0.01*tower.getLevel()) then
        set Event.damage = 0
        call tower.getOwner().displayFloatingTextX("Miss",tower,255, 0, 0,255,0.05,0.0,2.0)
    endif
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 1.0
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [ONDAMAGE_chanceLevelAdd] => 0.0
                            [long_explain] => 
                        )

                )

            [3] => Array
                (
                    [name] => On Tower Creation
                    [code] => set tower.userInt = 1 // Save the family member (1 = first member)
    set tower.userInt2 = 0 // Used to save the buff (double linked list)
                    [values] => Array
                        (
                            [visible] => false
                            [icon] => 
                            [name] => 
                            [short_explain] => 
                            [long_explain] => 
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
        )

    [units] => Array
        (
        )

    [references] => Array
        (
            [0] => Array
                (
                    [export] => true
                    [category] => global
                    [typ] => ProjectileType
                    [name] => MilitiaAxe
                )

        )

)