Undisturbed Crypt v1
600
ID:
165
Family ID:
Author:
eMoo
Rarity:
rare
Element:
darkness
Attack Type:
Decay
Attack Range:
1000
Attack CD:
1.95
Damage:
696-696
Abil. Factor:
0.55
Status:
Approved

Description:

A combination of decaying body parts and the presence of an unfathomable evil create a pillar of darkness within this crypt to form a reliable attack and the ability to explode corpses.

Latest Upload Comment:

Restored from 1.10
Corpse Explosion
Explodes a corpse within 1000 range of the tower, causing enemies in 500 range of the corpse to take 5% more damage from darkness towers and move 5% slower for 8 seconds. 5 second cooldown. Doesn't affect Air.

Level Bonus:
+0.2% slow and damage taken
+0.25 seconds duration
Critical Mass
Has a 30% chance on attack to shoot an extra projectile. For each projectile after the initial one, there is a 30% chance to shoot an extra projectile. There is a maximum of 14 projectiles fired per attack.

Level Bonus:
 +0.3% initial chance
 +0.6% extra chance
Download

Toggle Triggers

Header

    globals
    //@export
    ProjectileType Top_Crypt_ball
    ProjectileType meat
    //@export
    EventTypeList Top_Corpse_explode
    Unit array targList
    BuffType Top_Corpse_buff
    endglobals

    
    function fire takes Unit tower returns nothing
        local unit tu = tower.getUnit()
        local unit u
        local real tx = GetUnitX(tu)
        local real ty = GetUnitY(tu)
        local real r1
        local real r2
        local integer num = 0
        local Unit U
        local Iterate it = Iterate.overCorpsesInRange(tower,tx,ty,1000)
        local Iterate it2
        local Projectile proj

            
        // loops through all the nearby corpses
        loop
            if num == 0 then
                set u = it.nextCorpse()
            else
                call it.destroy()
            endif
            
            exitwhen u == null or num > 0
            
            if IsUnitType(u,UNIT_TYPE_FLYING) == false then 
                    
                set num = 0
                    
                set it2 = Iterate.overUnitsInRange(tower,TARGET_CREEPS,GetUnitX(u),GetUnitY(u),500)
                loop
                    set U = it2.next()
                    exitwhen U == 0
                    set targList[num] = U
                    set num = num + 1
                endloop
            endif
        endloop
            
        // if corpse is an actual unit then it sets off the ability
        if u != null then
            call ShowUnit(u,false)
            set U = 4
            set tx = GetUnitX(u)
            set ty = GetUnitY(u)
            call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Orc\\OrcLargeDeathExplode\\OrcLargeDeathExplode.mdl",tx,ty))
            
            call Effect.createScaled("Abilities\\Weapons\\MeatwagonMissile\\T_MeatwagonMissile.mdl",tx,ty,0,GetRandomReal(0,360),1.2).destroy()
            
            loop
                exitwhen 0 <= U
                set r1 = GetRandomReal(0.017,6.283)
                set r2 = GetRandomInt(200,500)
                set proj = Projectile.createLinearInterpolationFromPointToPoint(meat,tower,0,0,tx,ty,0,tx+r2*Cos(r1),ty+r2*Sin(r1),0,GetRandomReal(0.1,0.6))
                call proj.setScale(0.5)
                set U = U - 1
            endloop
            
            set U = 0
            loop
                exitwhen U >= num
                call Top_Corpse_buff.apply(tower, targList[U], tower.userInt)
                set U = U + 1
            endloop
        endif
        set tu = null
        set u = null
    endfunction
    
    function incDmg takes Unit tower returns nothing
        set tower.userInt = tower.userInt2+tower.userInt3*tower.getLevel()
    endfunction
    
    //@export
    function burstFire takes Tower tower, real chance, Creep target, real z returns nothing
        local integer numShots = 0
        local real x = tower.getX()
        local real y = tower.getY()
        local integer UID = target.getUID()
        local Projectile p
        loop
            set p = Projectile.createFromPointToUnit(Top_Crypt_ball,tower,1,1,x+GetRandomReal(-2*numShots,2*numShots),y+GetRandomReal(-2*numShots,2*numShots),z,target,true,false,false)
            call p.setScale(0.4)
            set p.speed = 500 + RMinBJ(numShots * 80,500)+numShots*20
            set p.accelerate = RMaxBJ(20 - numShots * 2,0)
            set numShots = numShots + 1
            exitwhen tower.calcChance(chance) == false or numShots >= 14 or target.getUID() != UID
        endloop
    endfunction
    
    function hit takes Projectile p, Unit creep returns nothing
        local Tower tower = p.getCaster()
        call tower.doAttackDamage(creep,tower.getCurrentAttackDamageWithBonus(),tower.calcAttackMulticrit(0, 0, 0))
    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()
        
        set Top_Crypt_ball = ProjectileType.create("Abilities\\Spells\\Undead\\OrbOfDeath\\AnnihilationMissile.mdl",5,500)
        call Top_Crypt_ball.enableHoming(ProjectileTargetEvent.hit,0)
        
        set meat = ProjectileType.createInterpolate("Abilities\\Weapons\\MeatwagonMissile\\T_MeatwagonMissile.mdl",400)
        
        set Top_Corpse_explode = EventTypeList.create()
        call Top_Corpse_explode.addPeriodicEvent(fire,5)
        call Top_Corpse_explode.addEventOnLevelUp(incDmg)
        
        set Top_Corpse_buff = BuffType.create(8, 0.25, false)
        call Top_Corpse_buff.setBuffIcon('@@0@@')
        call m.addModification(MOD_MOVESPEED, 0, -0.001)
        call m.addModification(MOD_DMG_FROM_DARKNESS, 0, 0.001)
        call Top_Corpse_buff.setBuffModifier(m)
    endfunction

On Attack

ONATTACK_chance: 0.3 ONATTACK_chanceLevelAdd: 0.003
function onAttack takes Tower tower returns nothing
    call burstFire(tower, 0.3+tower.getLevel()*0.006,Event.getTarget(),100)
endfunction

On Tower Creation

function onCreate takes Tower tower returns nothing
call tower.addEventList(Top_Corpse_explode)
set tower.userInt = 50 //This will be the base+level damage.
set tower.userInt2 = 50 //Base damage.
set tower.userInt3 = 2 //Level up damage.
endfunction