Lich King v1
2500
ID:
649
Family ID:
Author:
Natac
Rarity:
unique
Element:
ice
Attack Type:
Elemental
Attack Range:
800
Attack CD:
1.4
Damage:
2197-2296
Abil. Factor:
0.5
Status:
Approved

Description:

The frozen king of all ice and snow.

Latest Upload Comment:

Restored from 1.10
Icy Curse
Curses creeps it damages for 5 seconds, increasing their debuff duration by 30%.

Level Bonus:
+0.8% debuff duration
King's Authority
The Lich King rules over every creep in 900 range. Every creep leaving this range will be punished with 500 spelldamage for every second it was under this aura's effect.
If a creep dies in this area of authority, the spelldamage that didn't get dealt is stored. The next creep to then leave the Lich King's area will be punished with [stored damage x 0.5] spelldamage.

Level Bonus:
+20 damage per second
+[stored damage x 0.04] spelldamage
Download

Toggle Triggers

Header

    globals
        BuffType         natac_icyCurse_BuffType
        BuffType         natac_kingsPresent_Aura
        MultiboardValues natac_storedDamage_MuliboardValue
    endglobals
    
    function initAuraBuff takes Buff b returns nothing
        set b.userInt  = Game.getGameTime() // The time at which the buff was applied
        set b.userInt2 = b.getLevel()  // The max dps of this buff*
        set b.userInt3 = b.getCaster() // The king, ruling over this unit*
        set b.userReal = 0.0 // Stored damage, if the creep leaves the range of an enraged king*
        //*) only needed if you have 2 kings in a row and no CleanUp event is fired, cause the units 
        //   directly enter the aura of the 2nd king.
    endfunction
    
    function enterNewArea takes Buff b returns nothing
        local integer newDps      = b.getLevel()
        local Tower   oldKing     = b.userInt3 // The king who has ruled over this unit until now.
        // The damage the unit would have suffered from the old king, if it werent entering a new area now.
        local real    oldWrathDmg = oldKing.userReal*(0.5+oldKing.getLevel()*0.04)
        
        set oldKing.userReal = 0.0      // Reset stored damage of the old king
        set b.userReal3 = b.getCaster() // Set to the new king, ruling over this unit now
        
        // Store the max dps, if the dps of the new area is higher 
        if(newDps > b.userInt2) then 
            set b.userInt2 = newDps
        endif
        
        // Attach wrath dmg of the old king, to deal the dmg later
        if(oldWrathDmg > 0.0) then 
            set b.userReal = b.userReal + oldWrathDmg
        endif
    endfunction
    
    function doDamage takes Buff b returns nothing
        local Unit    target = b.getBuffedUnit()
        local Unit    caster = b.getCaster()
        
        // (1) Calculate time gone since the buff was applied
        // (2) multiply by 0.04 to get seconds 
        // (3) finally multiply with max dmg per second to get overall damage
        local real damage = (Game.getGameTime()-b.userInt)*0.04*b.userInt2
        
        // (4) Add the stored damage, other kings would have done to this unit
        set damage = damage + b.userReal
        
        if(GetUnitState(target.getUnit(), UNIT_STATE_LIFE) > 0 ) then   
            // Creep is alive: Add all stored damage to the normal dealt damage
            if(caster.userReal > 0) then
                call  caster.getTeam().displayFloatingText("Feel the Wrath!", caster, 15,15,200)
                // Add stored damage
                set   damage = damage + (caster.userReal*(0.5+caster.getLevel()*0.04)) 
                set   caster.userReal = 0.0 // Reset stored damage
            endif
            call  SFXAtUnit("Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl", target.getUnit())  
            call  caster.doSpellDamage(b.getBuffedUnit(), damage, caster.calcSpellCritNoBonus())
            call  caster.getTeam().displayFloatingText(I2S(R2I(damage)), target,15,15,200) //Show at TARGET
        else
            // Creep is dead: Store damage for the next alive creep
            set   caster.userReal = caster.userReal + damage
            call  caster.getTeam().displayFloatingText("+"+I2S(R2I(damage)), caster,15,15,200) //Show at CASTER
        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 icyCurseMod  = Modifier.create()
        call  icyCurseMod.addModification(MOD_DEBUFF_DURATION, 0.30, 0.008)
        set   natac_icyCurse_BuffType = BuffType.create(5, 0.0, false)
        call  natac_icyCurse_BuffType.setBuffModifier(icyCurseMod)
        call  natac_icyCurse_BuffType.setBuffIcon('@@0@@')
    
        set   natac_kingsPresent_Aura = BuffType.createAuraEffectType(false)
        call  natac_kingsPresent_Aura.addEventOnCreate (EventHandler.initAuraBuff)
        call  natac_kingsPresent_Aura.setEventOnRefresh(EventHandler.enterNewArea)
        call  natac_kingsPresent_Aura.addEventOnCleanup(EventHandler.doDamage)
        call  natac_kingsPresent_Aura.setBuffIcon('@@1@@')
        
        set  natac_storedDamage_MuliboardValue = MultiboardValues.create(1)
        call natac_storedDamage_MuliboardValue.setKey(0, "Stored Damage")
    endfunction

On Damage

ONDAMAGE_chance: 1.0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Tower tower returns nothing
    call natac_icyCurse_BuffType.apply(tower, Event.getTarget(), tower.getLevel())
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
    set tower.userReal = 0 // Damage stored for creeps dying under the auras effect.
endfunction

On Tower Details

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

Tower Aura

AURA_auraEffect: natac_kingsPresent_Aura AURA_power: 500 AURA_level: 500 AURA_auraRange: 900 AURA_targetType: TARGET_TYPE_CREEPS AURA_levelAdd: 20 AURA_powerAdd: 20 AURA_targetSelf: false