Nerubian Queen v1
1800
ID:
570
Family ID:
Author:
Boekie
Rarity:
unique
Element:
darkness
Attack Type:
Physical
Attack Range:
950
Attack CD:
1.25
Damage:
987-1026
Abil. Factor:
0.4
Status:
Approved

Description:

The mother of all Nerubian spiders. She is very poisonous!

Latest Upload Comment:

Restored from 1.10
Inject Parasite
When the Queen damages a creep she has a 30% chance to inject a parasite that lives for 10 seconds. Each second the creep will suffer 500 spelldamage and will permanently lose 2% armor. When an infected creep dies, the Nerubian Queen will gain 0.75% permanent bonus attackdamage and the parasite will attempt to jump to another host in 500 range.

Level Bonus:
+0.4% chance 
+100 spelldamage
+0.08% armor reduction
Download

Toggle Triggers

Header

    globals
        BuffType boekie_injectParasite_buff
        ProjectileType boekie_parasite_jump
        MultiboardValues boekie_queen_damage
    endglobals
    
    function boekie_poison takes Buff b returns nothing 
        local Unit target = b.getBuffedUnit()
        local Tower tower = b.getCaster()
        call tower.doSpellDamage(target,500+b.getLevel()*100,tower.calcSpellCritNoBonus())
        call target.modifyProperty(MOD_ARMOR_PERC, -(0.02 + (b.getLevel()*0.0008))) 
    endfunction  
        
    function boekie_parasite_onDeath takes Buff b returns nothing 
        local Creep creep = b.getBuffedUnit()
        local Tower tower = b.getCaster()
        local Iterate it = Iterate.overUnitsInRangeOfUnit(tower, TARGET_CREEPS, creep, 500)
        local Creep newHost = it.next()
        local Creep temp = 0
        local Projectile p
        
        call Effect.createSimple("Objects\\Spawnmodels\\Undead\\UndeadBlood\\UndeadBloodCryptFiend.mdl", creep.getX(), creep.getY()).destroy()
        if tower != 0 then
            call tower.modifyProperty(MOD_DAMAGE_ADD_PERC, 0.0075)
            set tower.userReal = tower.userReal + 0.0075
        endif
        
        //Find a new host! Prefers targets that aren't carrying parasites already.
        loop
            exitwhen newHost == 0 or newHost.getBuffOfType(boekie_injectParasite_buff) == 0
            if newHost != creep then
                set temp = newHost
            endif
            set newHost = it.next()
        endloop
        if newHost == 0 then
            if temp == 0 then
                //noone to jump to! parasite dies :(
                call Effect.createScaled("units\\creeps\\Spider\\Spider.mdl", creep.getX(), creep.getY(), 0.0, 0.0, 0.2).destroy()
                return
            else
                //can only jump to a target that already has a parasite. Do it anyway, to refresh the buff duration.
                set newHost = temp
            endif
        else
            call it.destroy()
        endif
        set p = Projectile.createLinearInterpolationFromUnitToUnit(boekie_parasite_jump, tower, 0.0, 0.0, creep, newHost, 0.5, true)
        call p.setScale(0.2)
        set p.userInt = newHost.getUID()
    endfunction
    
    function boekie_parasite_inject takes Tower tower, Creep newHost returns nothing
        local integer level = tower.getLevel()
        call boekie_injectParasite_buff.applyCustomTimed(tower,newHost,level,10)
    endfunction
    
    function boekie_parasite_jump_onCleanup takes Projectile p returns nothing
        local Creep creep = p.getHomingTarget()
        if creep.getUID() == p.userInt then
            call boekie_parasite_inject(p.getCaster(), creep)
        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 boekie_injectParasite_buff = BuffType.create(0,0,false) 
        call boekie_injectParasite_buff.setBuffIcon('@@0@@')  
        call boekie_injectParasite_buff.addPeriodicEvent(EventHandler.boekie_poison,1) 
        call boekie_injectParasite_buff.addEventOnDeath(EventHandler.boekie_parasite_onDeath)
        
        set boekie_parasite_jump = ProjectileType.createInterpolate("units\\creeps\\Spider\\Spider.mdl",500)
        call boekie_parasite_jump.setEventOnCleanup(boekie_parasite_jump_onCleanup)
        call boekie_parasite_jump.disableExplodeOnHit()
        
        set boekie_queen_damage = MultiboardValues.create(1)
        call boekie_queen_damage.setKey(0,"Damage Gained")
    endfunction

On Damage

ONDAMAGE_chance: 0.30 ONDAMAGE_chanceLevelAdd: 0.004
function onDamage takes Tower tower returns nothing
    call boekie_parasite_inject(tower, Event.getTarget())
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    set tower.userReal = 0
endfunction

On Tower Details

function onTowerDetails takes Tower tower returns MultiboardValues
    call boekie_queen_damage.setValue(0, formatPercent(tower.userReal,0))
    return boekie_queen_damage
endfunction