Death Knight v1
3500
ID:
317
Family ID:
Author:
DaveMatthews
Rarity:
unique
Element:
darkness
Attack Type:
Decay
Attack Range:
875
Attack CD:
1.1
Damage:
2659-2659
Mana:
50
Mana regen:
0
Status:
Approved

Description:

Feeds on souls to unleash his full power.
Specials:
+2 mana/lvl
Will of the Undying
The death knight decreases the base attack damage of all towers in 200 range by 10% and loses 50% of his remaining mana to increase his base damage by 15% for each tower affected for 5 seconds. Only towers that cost at least 1300 gold are affected by this spell. 

Level Bonus:
+0.2% damage absorbed

AC_TYPE_OFFENSIVE_IMMEDIATE
 50, 900 range, 10s cooldown
Insatiable Hunger
On each attack, the death knight deals 0.25% bonus damage for each mana point he's currently missing and replenishes 1% of his maximum mana. He replenishes 5% of his maximum mana for each unit he kills. 

Level Bonus:
+0.01% damage per mana point
Withering Presence
Whenever a unit comes in 900 range of the death knight, it has a 15% chance to have its health regeneration reduced by 50% and to lose 5% of its current health every second for 4 seconds. Units affected by this spell grant 50% less experience and bounty on death. 

Level Bonus:
+0.4% chance 
+1% health regen reduction 
-1% experience and bounty reduction
Download

Toggle Triggers

Autocast

caster_art: Abilities\Spells\Other\HowlOfTerror\HowlCaster.mdl AUTOCAST_cooldown: 10 AUTOCAST_numBuffsBeforeIdle: 0 AUTOCAST_isExtended: false AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_IMMEDIATE AUTOCAST_manacost: 50 AUTOCAST_range: 900 AUTOCAST_buffType: 0 AUTOCAST_targetSelf: false AUTOCAST_targetType: 0 target_art: AUTOCAST_autoRange: 900
private function onAutocast takes Tower tower returns nothing
    local integer numTowers = 0
    local integer level = tower.getLevel() 
    local Tower u
    local Iterate it = Iterate.overUnitsInRangeOfCaster(tower, TARGET_TOWERS, 200)
    local unit towerUnit = tower.getUnit()
    local real mana = GetUnitState(towerUnit, UNIT_STATE_MANA)
     
    call SetUnitState(towerUnit , UNIT_STATE_MANA, mana/2)
    loop
        set u = it.next()
        exitwhen u == 0
        if u != tower and u.getGoldcost() >= 1300 then
            set numTowers = numTowers + 1
            call dave_will_negative.apply(tower, u, (50 + level))
        endif
    endloop
    if numTowers > 0 then
        call dave_will_positive.apply(tower, tower, (75 + level) * numTowers)
    endif
    set towerUnit = null 
endfunction

Header

    globals
        BuffType dave_will_positive
        BuffType dave_will_negative
        BuffType dave_withering
    endglobals
    
    function OnWithering takes Buff b returns nothing
        local Unit buffed = b.getBuffedUnit()
        local Unit caster = b.getCaster()
        local unit u = buffed.getUnit()
        local real hp = GetWidgetLife(u)
        local real damage = hp * 0.05
    
        call SetWidgetLife(u, hp - damage)
        set u = null
    endfunction
      

    private function init takes nothing returns nothing
        local Modifier m = Modifier.create()
        local Modifier n = Modifier.create()
        local Modifier o = Modifier.create()
        
        set dave_will_positive = BuffType.create(5.0,0.0,true)
        call dave_will_positive.setBuffModifier(m)
        call m.addModification(MOD_DAMAGE_BASE_PERC,0.0,0.002)
        call dave_will_positive.setBuffIcon( '@@0@@' )
        
        set dave_will_negative = BuffType.create(5.0,0,false)
        call dave_will_negative.setBuffModifier(n)
        call n.addModification(MOD_DAMAGE_BASE_PERC,-0.0,-0.002)
        call dave_will_negative.setBuffIcon( '@@1@@' )
        
        set dave_withering = BuffType.create(4.0,0,false)
        call dave_withering.setBuffModifier(o)
        call o.addModification(MOD_HP_REGEN_PERC,-0.5,-0.1)
        call o.addModification(MOD_EXP_GRANTED,-0.5,0.01)
        call o.addModification(MOD_BOUNTY_GRANTED,-0.5,0.01)
        call dave_withering.addPeriodicEvent(EventHandler.OnWithering,1)
        call dave_withering.setBuffIcon( '@@2@@' )
    endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    local unit towerUnit = tower.getUnit()
    local integer level = tower.getLevel()
    local real mana = GetUnitState(towerUnit,UNIT_STATE_MANA)
    local real maxMana = GetUnitState(towerUnit,UNIT_STATE_MAX_MANA)
     
    call SetUnitState(towerUnit , UNIT_STATE_MANA, mana+(maxMana*0.01))
    set Event.damage = Event.damage+(Event.damage*((maxMana-mana)*(0.0025+0.0001*level)))
    set towerUnit = null
endfunction

On Kill

function onKill takes Tower tower returns nothing
    local unit towerUnit = tower.getUnit()
    local real mana = GetUnitState(towerUnit, UNIT_STATE_MANA)
    local real maxMana = GetUnitState(towerUnit,UNIT_STATE_MAX_MANA)
     
    call SetUnitState(towerUnit , UNIT_STATE_MANA, mana+(maxMana*0.05))
    set towerUnit = null
endfunction

On Unit Comes In Range

UNITINRANGE_targetType: TARGET_TYPE_CREEPS UNITINRANGE_range: 900
function onUnitInRange takes Tower tower returns nothing
    local integer level = tower.getLevel()
    
    if tower.calcChance(0.15+level*0.004) then
       call dave_withering.apply(tower,Event.getTarget(),level)
    endif
endfunction