Array
(
    [scriptVersion] => 7
    [oeValues] => Array
        (
            [RngBuff1] => 250
            [MissileHoming] => 1
            [Upgrade] => Array
                (
                )

            [targs1] => Array
                (
                )

            [customTeamColor] => 1
            [goldcost] => 500
            [weapsOn] => 1
            [dice1] => 1
            [Missilespeed] => 1800
            [impactZ] => 140
            [moveHeight] => 120
            [file] => units\other\DranaiWhite\DranaiWhite.mdl
            [dmgpt1] => 0.49
            [atkType1] => siege
            [modelScale] => 0.7
            [weapTp1] => missile
            [Missilearc] => 0.05
            [acquire] => 875
            [rangeN1] => 875
            [upgrades] => Array
                (
                )

            [cool1] => 2
            [Ubertip] => Driven by zealotry, this unit is exceptionally good in physical combat.
            [backSw1] => 0.48
            [abilList] => Array
                (
                )

            [Name] => Zealot
            [Missileart] => Abilities\Weapons\GargoyleMissile\GargoyleMissile.mdl
            [Art] => ReplaceableTextures\CommandButtons\BTNDranaiAkama.blp
            [buildingShadow] => Array
                (
                )

            [unitSound] => Draenei
            [turnRate] => 0.7
            [sides1] => 111
            [uberSplat] => OSMA
            [auto] => Array
                (
                )

            [dmgplus1] => 1050
            [bldtm] => 1
        )

    [settings] => Array
        (
            [author] => dzk87
            [element] => storm
            [authorDisplay] => dzk87
            [alpha] => 255
            [balanceTip] => Array
                (
                )

            [rarity] => rare
            [version] => 1.0
            [abil_factor] => 0.93
        )

    [effects] => Array
        (
            [0] => Array
                (
                    [x] => 24.461
                    [y] => -0.966258
                    [z] => 0
                    [scale] => 0.35
                    [rot] => 3.10669
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [1] => Array
                (
                    [x] => -26.8128
                    [y] => -0.0290893
                    [z] => 0
                    [scale] => 0.35
                    [rot] => 3.10669
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [2] => Array
                (
                    [x] => -2.46385
                    [y] => -43.2678
                    [z] => 0
                    [scale] => 0.3
                    [rot] => 3.10669
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [3] => Array
                (
                    [x] => 0.97876
                    [y] => 1.6326
                    [z] => -12.8
                    [scale] => 1
                    [rot] => 3.38594
                    [file] => Doodads\Cityscape\Props\CrystalLamp\CrystalLamp.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [4] => Array
                (
                    [x] => 28.581
                    [y] => -1.04494
                    [z] => 0
                    [scale] => 0.45
                    [rot] => 2.54818
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal3.mdl
                    [red] => 255
                    [green] => 100
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [5] => Array
                (
                    [x] => -22.5874
                    [y] => 2.99136
                    [z] => 0
                    [scale] => 0.45
                    [rot] => 1.39626
                    [file] => Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal3.mdl
                    [red] => 255
                    [green] => 100
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

            [6] => Array
                (
                    [x] => -1.02718
                    [y] => 23.5147
                    [z] => 0
                    [scale] => 0.35
                    [rot] => 3.10669
                    [file] => Doodads\Cityscape\Props\City_Oblisk\City_Oblisk.mdl
                    [red] => 255
                    [green] => 255
                    [blue] => 255
                    [alpha] => 255
                    [pitch] => 0
                    [advanced] => false
                    [animation] => Array
                        (
                        )

                    [aniSpeed] => 50
                )

        )

    [dmgTable] => Array
        (
        )

    [triggers] => Array
        (
            [0] => Array
                (
                    [name] => On Damage
                    [code] => local Creep target = Event.getTarget()
    local Buff phaseWound = target.getBuffOfType(storm_zealot_wound) 
    local real damageBase = Event.damage
    local real totalArmorPierce
    local real temp = AttackType.PHYSICAL.getDamageAgainst(target.getArmorType())
    
    if Event.isSpellDamage() or not Event.isMainTarget() then
        return
    endif
    
    //first check+upgrade the wound level
    if phaseWound == 0 then
        set phaseWound = storm_zealot_wound.apply(tower, target, 1)
        set phaseWound.userInt = 1 //stack counter
        set phaseWound.userInt2 = tower.getUID()
    else
        //multiple zealots + family member check. If another zealot attacks, no armor pierce for him
        //only the guy who put the first wound gets armor pierce
        //perfection would need hashtables storing wound level for every tower,creep pair. Not worth it i think.
        if phaseWound.userInt2 != tower.getUID() then
            return
        endif
        set phaseWound.userInt = IMinBJ(5, phaseWound.userInt + 1)
        call phaseWound.refreshDuration()
    endif
        
    if temp > 0.001 and temp < 1. then //ignoring armor type "resistance" not weakness :P 
        set damageBase = damageBase / temp 
    endif 
    
    set temp = 1 - target.getCurrentArmorDamageReduction()
    
     if temp > 0.001 and temp < 1. then 
        set damageBase = damageBase / temp 
    endif  
 
    set totalArmorPierce = (0.02 + 0.0008*tower.getLevel()) * phaseWound.userInt
    
    if Event.damage < damageBase then 
        set Event.damage = damageBase*totalArmorPierce + Event.damage*(1.-totalArmorPierce) 
    endif
                    [values] => Array
                        (
                            [ONDAMAGE_chance] => 1.0
                            [icon] => ReplaceableTextures\CommandButtons\BTNWhirlwind.blp
                            [visible] => true
                            [name] => Phase Blade
                            [short_explain] => Each attack on the same creep increases the damage versus that creep, this effect stacks.
                            [ONDAMAGE_chanceLevelAdd] => 0.0
                            [long_explain] => Each attack on the same creep penetrates deeper through its armor. Per attack |cffFFFF802%|r of this tower's attack damage won't be reduced by armor resistances. This effect stacks up to |cffFFFF805|r times.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+0.08%|r damage per stack
                        )

                )

            [1] => Array
                (
                    [name] => Header
                    [code] => globals
        //@export
        BuffType storm_zealot_fury
        //@export 
        BuffType storm_zealot_wound
        //@export
        BuffType storm_zealot_slow
        //@export
        BuffType storm_zealot_shield
    endglobals

    function storm_zealot_shield_Cleanup takes Buff b returns nothing
        if b.userInt2 != 0 then
            call Effect(b.userInt2).destroy()
        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()
        local Modifier n = Modifier.create()
        local Modifier o = Modifier.create()
        
        call m.addModification(MOD_ATTACKSPEED, 0.0, 0.0001)
        call n.addModification(MOD_ATTACKSPEED, 0.0, -0.0001)
        call o.addModification(MOD_DEBUFF_RESISTANCE, 0.0, 0.0001)
        
        set storm_zealot_fury = BuffType.create(2.5, 0, true)
        set storm_zealot_wound = BuffType.create(200, 0, false)
        set storm_zealot_slow = BuffType.create(2.5, 0, true)
        set storm_zealot_shield = BuffType.create(2.5, 0, true)
        
        call storm_zealot_fury.setBuffModifier(m)
        call storm_zealot_slow.setBuffModifier(n)
        call storm_zealot_shield.setBuffModifier(o)
        
        call storm_zealot_fury.setBuffIcon('@@0@@')
        call storm_zealot_wound.setBuffIcon('@@1@@')
        call storm_zealot_slow.setBuffIcon('@@3@@')
        call storm_zealot_shield.setBuffIcon('@@2@@')
        
        call storm_zealot_shield.addEventOnCleanup(storm_zealot_shield_Cleanup)
	endfunction
                    [values] => Array
                        (
                            [icon] => ReplaceableTextures\CommandButtons\BTNLightningShield.blp
                            [visible] => true
                            [name] => Lightning Shield
                            [short_explain] => Debuff Resistance gets increased with each stack of Zeal.
                            [long_explain] => As the zealot gets pumped up debuff resistance is increased by |cffFFFF804%|r with each stack of Zeal.
                        )

                )

            [2] => Array
                (
                    [name] => On Attack
                    [code] => local Buff b
    local Tower u
    local Iterate it = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TOWERS, 175.0)
    local integer leechCounter = 0
    local integer leechPower
    local integer maxStacks = 5 + tower.getLevel()/5
 
    loop 
        set u = it.next()
        exitwhen u == 0 
        if u != tower and u.getGoldcost() >= 200 then
            set leechCounter = leechCounter + 1
        endif 
    endloop
    
    if leechCounter == 0 then
        return
    endif
    
    set leechPower = 105 - 5*leechCounter //1% leech per tower with 1 tower, 0.65% per tower with 8 
 
    set it = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TOWERS, 175.0)
    
    // Slows all towers in 175 range
    loop 
        set u = it.next()
        exitwhen u == 0 
        if u != tower and u.getGoldcost() >= 200 then
            set b = u.getBuffOfType(storm_zealot_slow)
            if b != 0 then
                set b.userInt = IMinBJ(b.userInt + 1, maxStacks)
                call storm_zealot_slow.applyCustomPower(tower, u, b.userInt, leechPower*b.userInt)
            else
                set storm_zealot_slow.applyCustomPower(tower, u, 1, leechPower).userInt = 1
            endif
        endif 
    endloop

    set leechPower = leechPower * leechCounter //in a way that's the per stack base
    set b = tower.getBuffOfType(storm_zealot_fury)
    
    //now apply zeal
    if b != 0 then
        call storm_zealot_fury.apply(tower, tower, IMinBJ(leechPower + b.getLevel(), leechPower * maxStacks))
    else
        call storm_zealot_fury.apply(tower, tower, leechPower) //used normal apply so power = level
    endif
    
    set b = tower.getBuffOfType(storm_zealot_shield)
    
    if b != 0 then
        if b.userInt < maxStacks then
            set b.userInt = b.userInt + 1
            if b.userInt == maxStacks then
                if b.userInt2 == 0 then
                    set b.userInt2 = Effect.createScaled("Abilities\\Spells\\Human\\ManaShield\\ManaShieldCaster.mdl", tower.getX(), tower.getY(), 115, 0, 0.65)
                    call Effect(b.userInt2).noDeathAnimation()
                endif
            endif
        endif
        
        call storm_zealot_shield.apply(tower, tower, 400 * b.userInt)
    else
        set b = storm_zealot_shield.apply(tower, tower, 400)
        set b.userInt = 1
        set b.userInt2 = 0
    endif
                    [values] => Array
                        (
                            [icon] => ReplaceableTextures\CommandButtons\BTNControlMagic.blp
                            [visible] => true
                            [name] => Zeal
                            [short_explain] => Each attack works the Zealot into a greater frenzy, increasing his attack speed but slowing the towers around him. This effect stacks.
                            [ONATTACK_chance] => 1.0
                            [ONATTACK_chanceLevelAdd] => 0.0
                            [long_explain] => Each attack works the Zealot into a greater frenzy, increasing his attack speed by |cffFFFF801%|r from each tower in |cffFFFF80175|r range. These towers have their attack speed slowed by |cffFFFF801%|r. Both effects stack up to |cffFFFF805|r times and last |cffFFFF802.5|r seconds. The attack speed amount reduces slightly with more towers.|nOnly towers that cost |cffFFFF80200|r gold or more are affected by this.|n|n|cffFF8000Level Bonus:|r|n|cffFFFF80+1|r max stack per |cffFFFF805|r levels
                        )

                )

        )

    [abilities] => Array
        (
        )

    [buffs] => Array
        (
            [0] => Array
                (
                    [id] => @@0@@
                    [derivedFrom] => Bblo
                    [oeValues] => Array
                        (
                            [Bufftip] => Zeal
                            [Buffubertip] => This unit's attack speed is increased.
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNControlMagic.blp
                            [TargetArt] => Abilities\Weapons\FarseerMissile\FarseerMissile.mdl,Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
                        )

                )

            [1] => Array
                (
                    [id] => @@1@@
                    [derivedFrom] => Bbof
                    [oeValues] => Array
                        (
                            [Bufftip] => Phase Blade
                            [Buffubertip] => This unit is taking more damage from a Zealot.
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNWhirlwind.blp
                            [TargetArt] => Array
                                (
                                )

                        )

                )

            [2] => Array
                (
                    [id] => @@2@@
                    [derivedFrom] => Bblo
                    [oeValues] => Array
                        (
                            [Targetattach1] => Array
                                (
                                )

                            [Bufftip] => Lightning Shield
                            [Targetattach] => Array
                                (
                                )

                            [Buffubertip] => This unit has increased debuff resistance.
                            [Targetattachcount] => 0
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNLightningShield.blp
                            [TargetArt] => Array
                                (
                                )

                        )

                )

            [3] => Array
                (
                    [id] => @@3@@
                    [derivedFrom] => Bbof
                    [oeValues] => Array
                        (
                            [Bufftip] => Fanaticism
                            [Buffubertip] => This unit's attack speed is reduced by a nearby Zealot.
                            [Buffart] => ReplaceableTextures\CommandButtons\BTNWispSplode.blp
                            [TargetArt] => Array
                                (
                                )

                        )

                )

        )

    [units] => Array
        (
        )

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

            [1] => Array
                (
                    [export] => true
                    [category] => global
                    [typ] => BuffType
                    [name] => storm_zealot_wound
                )

            [2] => Array
                (
                    [export] => true
                    [category] => global
                    [typ] => BuffType
                    [name] => storm_zealot_slow
                )

            [3] => Array
                (
                    [export] => true
                    [category] => global
                    [typ] => BuffType
                    [name] => storm_zealot_shield
                )

        )

)