|   Zealot v1 500
                       |  ID: 192  Family ID:  Author: dzk87  Rarity: rare  Element: storm  Attack Type: Physical  Attack Range: 875  Attack CD: 2  Damage: 1051-1161  Status: Approved |  Lightning Shield As the zealot gets pumped up debuff durations are reduced by 4% with each stack of Zeal. Zeal Each attack works the Zealot into a greater frenzy, increasing his attack speed by 1% from each tower in 175 range. These towers have their attack speed slowed by 1%. Both effects stack up to 5 times and last 2.5 seconds. The attack speed amount reduces slightly with more towers. Only towers that cost 200 gold or more are affected by this. Level Bonus: +1 max stack per 5 levels  Phase Blade Each attack on the same creep penetrates deeper through its armor. Per attack 2% of this tower's attack damage won't be reduced by armor resistances. This effect stacks up to 5 times. Level Bonus: +0.08% damage per stack | Download Toggle Triggers Header     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_DURATION, 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)
    endfunctionOn Attack 
                            
                                ONATTACK_chance: 1.0
                            
                                ONATTACK_chanceLevelAdd: 0.0
                            
                             function onAttack takes Tower tower returns nothing
    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
endfunctionOn Damage 
                            
                                ONDAMAGE_chance: 1.0
                            
                                ONDAMAGE_chanceLevelAdd: 0.0
                            
                             function onDamage takes Tower tower returns nothing
    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 
endfunction | 
|   Devoted Zealot v1 1150
                       |  ID: 193  Family ID:  Author: dzk87  Rarity: rare  Element: storm  Attack Type: Physical  Attack Range: 875  Attack CD: 2  Damage: 2371-2554  Status: Approved | Description: Driven by zealotry, this unit is exceptionally good in physical combat.  Lightning Shield As the zealot gets pumped up debuff durations are reduced by 6.5% with each stack of Zeal. Zeal Each attack works the Zealot into a greater frenzy, increasing his attack speed by 2% from each tower in 175 range. These towers have their attack speed slowed by 2%. Both effects stack up to 5 times and last 2.5 seconds. The attack speed amount reduces slightly with more towers. Only towers that cost 460 gold or more are affected by this. Level Bonus: +1 max stack per 5 levels  Phase Blade Each attack on the same creep penetrates deeper through its armor. Per attack 4% of this tower's attack damage won't be reduced by armor resistances. This effect stacks up to 5 times. Level Bonus: +0.16% damage per stack | Download Toggle Triggers Header     globals
        //@import
        BuffType storm_zealot_fury
        //@import 
        BuffType storm_zealot_wound
        //@import
        BuffType storm_zealot_slow
        //@import
        BuffType storm_zealot_shield
    endglobals
    
    //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
    
    endfunctionOn Attack 
                            
                                ONATTACK_chance: 1.0
                            
                                ONATTACK_chanceLevelAdd: 0.0
                            
                             function onAttack takes Tower tower returns nothing
    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() >= 460 then
            set leechCounter = leechCounter + 1
        endif 
    endloop
    
    if leechCounter == 0 then
        return
    endif
    
    set leechPower = 210 - 10*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() >= 460 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.67) 
                    call Effect(b.userInt2).noDeathAnimation()
                endif
            endif 
        endif
        
        call storm_zealot_shield.apply(tower, tower, 650 * b.userInt) 
    else 
        set b = storm_zealot_shield.apply(tower, tower, 650)
        set b.userInt = 1
        set b.userInt2 = 0
    endif 
endfunctionOn Damage 
                            
                                ONDAMAGE_chance: 1.0
                            
                                ONDAMAGE_chanceLevelAdd: 0.0
                            
                             function onDamage takes Tower tower returns nothing
    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.04 + 0.0016*tower.getLevel()) * phaseWound.userInt
    
    if Event.damage < damageBase then 
        set Event.damage = damageBase*totalArmorPierce + Event.damage*(1.-totalArmorPierce) 
    endif 
endfunction | 
|   Frenzied Zealot v1 1900
                       |  ID: 194  Family ID:  Author: dzk87  Rarity: rare  Element: storm  Attack Type: Physical  Attack Range: 875  Attack CD: 2  Damage: 3798-4065  Status: Approved | Description: Driven by zealotry, this unit is exceptionally good in physical combat.  Lightning Shield As the zealot gets pumped up debuff durations are reduced by 8% with each stack of Zeal. Zeal Each attack works the Zealot into a greater frenzy, increasing his attack speed by 3% from each tower in 175 range. These towers have their attack speed slowed by 3%. Both effects stack up to 5 times and last 2.5 seconds. The attack speed amount reduces slightly with more towers. Only towers that cost 750 gold or more are affected by this. Level Bonus: +1 max stack per 5 levels  Phase Blade Each attack on the same creep penetrates deeper through its armor. Per attack 6% of this tower's attack damage won't be reduced by armor resistances. This effect stacks up to 5 times. Level Bonus: +0.24% damage per stack | Download Toggle Triggers Header     globals
        //@import
        BuffType storm_zealot_fury
        //@import 
        BuffType storm_zealot_wound
        //@import
        BuffType storm_zealot_slow
        //@import
        BuffType storm_zealot_shield
    endglobals
    
    //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
    
    endfunctionOn Attack 
                            
                                ONATTACK_chance: 1.0
                            
                                ONATTACK_chanceLevelAdd: 0.0
                            
                             function onAttack takes Tower tower returns nothing
    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() >= 750 then
            set leechCounter = leechCounter + 1
        endif 
    endloop
    
    if leechCounter == 0 then
        return
    endif
    
    set leechPower = 315 - 15*leechCounter
 
    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() >= 750 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(), 140, 0, 0.69) 
                    call Effect(b.userInt2).noDeathAnimation()
                endif
            endif 
        endif
        
        call storm_zealot_shield.apply(tower, tower, 800 * b.userInt) 
    else 
        set b = storm_zealot_shield.apply(tower, tower, 800)
        set b.userInt = 1
        set b.userInt2 = 0
    endif
endfunctionOn Damage 
                            
                                ONDAMAGE_chance: 1.0
                            
                                ONDAMAGE_chanceLevelAdd: 0.0
                            
                             function onDamage takes Tower tower returns nothing
    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
        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.06 + 0.0024*tower.getLevel()) * phaseWound.userInt
    
    if Event.damage < damageBase then 
        set Event.damage = damageBase*totalArmorPierce + Event.damage*(1.-totalArmorPierce) 
    endif 
endfunction | 
|   Fanatical Zealot v1 3000
                       |  ID: 195  Family ID:  Author: dzk87  Rarity: rare  Element: storm  Attack Type: Physical  Attack Range: 875  Attack CD: 2  Damage: 5767-6219  Status: Approved | Description: Driven by zealotry, this unit is exceptionally good in physical combat.  Lightning Shield As the zealot gets pumped up debuff durations are reduced by 10% with each stack of Zeal. Zeal Each attack works the Zealot into a greater frenzy, increasing his attack speed by 4% from each tower in 175 range. These towers have their attack speed slowed by 4%. Both effects stack up to 5 times and last 2.5 seconds. The attack speed amount reduces slightly with more towers. Only towers that cost 1200 gold or more are affected by this. Level Bonus: +1 max stack per 5 levels  Phase Blade Each attack on the same creep penetrates deeper through its armor. Per attack 8% of this tower's attack damage won't be reduced by armor resistances. This effect stacks up to 5 times. Level Bonus: +0.32% damage per stack | Download Toggle Triggers Header     globals
        //@import
        BuffType storm_zealot_fury
        //@import 
        BuffType storm_zealot_wound
        //@import
        BuffType storm_zealot_slow
        //@import
        BuffType storm_zealot_shield
    endglobals
    
    //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
    
    endfunctionOn Attack 
                            
                                ONATTACK_chance: 1.0
                            
                                ONATTACK_chanceLevelAdd: 0.0
                            
                             function onAttack takes Tower tower returns nothing
    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() >= 1200 then
            set leechCounter = leechCounter + 1
        endif 
    endloop
    
    if leechCounter == 0 then
        return
    endif
    
    set leechPower = 420 - 20*leechCounter
 
    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() >= 1200 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(), 135, 0, 0.70) 
                    call Effect(b.userInt2).noDeathAnimation()
                endif
            endif 
        endif
        
        call storm_zealot_shield.apply(tower, tower, 1000 * b.userInt) 
    else 
        set b = storm_zealot_shield.apply(tower, tower, 1000)
        set b.userInt = 1
        set b.userInt2 = 0
    endif
endfunctionOn Damage 
                            
                                ONDAMAGE_chance: 1.0
                            
                                ONDAMAGE_chanceLevelAdd: 0.0
                            
                             function onDamage takes Tower tower returns nothing
    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
        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.08 + 0.0032*tower.getLevel()) * phaseWound.userInt
    
    if Event.damage < damageBase then 
        set Event.damage = damageBase*totalArmorPierce + Event.damage*(1.-totalArmorPierce) 
    endif 
endfunction | 
Description: