Soulflame Device v1
4000
ID:
433
Family ID:
Author:
Ashbringer
Rarity:
unique
Element:
darkness
Attack Type:
Decay
Attack Range:
1000
Attack CD:
1.5
Damage:
1344-1344
Mana:
100
Mana regen:
0
Status:
Approved

Description:

Burns and consumes the souls of the living.
Specials:
-40% dmg to undead (+1%/lvl)
Soulfire:
Attacks hit up to 8 enemies in range and have a 20% chance to ignite the enemy's soul, dealing 1000 spell damage per second for 5 seconds. This effect stacks.

Level Bonus:
+0.4% chance
+40 spell damage
Awaken
Increases the attack speed of towers within 350 range by 50% for 3 seconds and permanently increases the attack speed of this tower by 1%.

Level Bonus:
+2% attack speed

AC_TYPE_OFFENSIVE_IMMEDIATE
 50, 900 range, 4s cooldown
Soul Consumption
When an enemy dies under the effect of Soulfire, Soulfire spreads to nearby enemies within 200 range. The enemy is consumed by the tower, restoring 5 mana.
Evil Device - Aura
Attack speed, trigger chances, spell damage, spell crit chance and spell crit damage bonuses on this tower are applied to Common and Uncommon Darkness towers in 350 range at a rate of 50%.

Level Bonus:
+2% stats
Download

Toggle Triggers

Autocast

AUTOCAST_cooldown: 4 AUTOCAST_autoRange: 900 AUTOCAST_manacost: 50 AUTOCAST_range: 900 AUTOCAST_targetType: 0 AUTOCAST_numBuffsBeforeIdle: 0 caster_art: Objects\Spawnmodels\Undead\UCancelDeath\UCancelDeath.mdl target_art: AUTOCAST_autocastType: AC_TYPE_OFFENSIVE_IMMEDIATE AUTOCAST_buffType: 0 AUTOCAST_isExtended: true AUTOCAST_targetSelf: false
private function onAutocast takes Tower tower returns nothing
    local Iterate it = Iterate.overUnitsInRangeOfUnit(tower,TARGET_TOWERS,tower,350)
    local Unit next

    loop
        set next = it.next()
            call ashbringer_awaken_buff.apply(tower,next,tower.getLevel())
        exitwhen next == 0
    endloop
    set tower.userInt = tower.userInt + 1
    call tower.modifyProperty(MOD_ATTACKSPEED, 0.01)
endfunction

Header

    globals
    BuffType ashbringer_soulfire_buff
    BuffType ashbringer_device_aura
    ProjectileType ashbringer_consumption_projectile
    BuffType ashbringer_awaken_buff
    MultiboardValues ashbringer_awaken_count
    endglobals
    
    function ashbringer_consumption_missile takes Unit target, Tower tower returns nothing
        local real towerX = tower.getX()
        local real towerY = tower.getY()
        
        call Projectile.createFromUnitToPoint(ashbringer_consumption_projectile, target, 0, 0, target, towerX, towerY, 215.00, false, true)
    endfunction
    
    function ashbringer_device_update takes Buff b returns nothing
        local Tower tower = b.getBuffedUnit()
        local Tower caster = b.getCaster()
        local real tower_level = caster.getLevel()
        local real caster_level_factor = 0.5 + (tower_level * 0.02)
        
        call tower.modifyProperty(MOD_SPELL_DAMAGE_DEALT, -b.userReal)
        call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, -b.userReal2)
        call tower.modifyProperty(MOD_SPELL_CRIT_DAMAGE, -b.userReal3)
        call tower.modifyProperty(MOD_ATTACKSPEED, -(b.userInt/1000.0))
        call tower.modifyProperty(MOD_TRIGGER_CHANCES, -(b.userInt2/1000.0))
        
        set b.userReal = (caster.getProp_SpellDmgDealt() - 1.0)*caster_level_factor
        set b.userReal2 = (caster.getProp_SpellCritChance() - (0.0125 + (tower_level * 0.0015)))*caster_level_factor
        set b.userReal3 = (caster.getProp_SpellCritDamage() - (1.25 + (tower_level * 0.02)))*caster_level_factor
        set b.userInt = R2I((caster.getProp_Attackspeed() - (0.00 + (tower_level * 0.012)))*caster_level_factor*1000.0)
        set b.userInt2 = R2I((caster.getProp_TriggerChances()- 1.0)*caster_level_factor*1000.0)
        
        call tower.modifyProperty(MOD_SPELL_DAMAGE_DEALT, b.userReal)
        call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, b.userReal2)
        call tower.modifyProperty(MOD_SPELL_CRIT_DAMAGE, b.userReal3)
        call tower.modifyProperty(MOD_ATTACKSPEED, (b.userInt/1000.0))
        call tower.modifyProperty(MOD_TRIGGER_CHANCES, (b.userInt2/1000.0))
    endfunction

    function ashbringer_device_create takes Buff b returns nothing
        set b.userReal = 0
        set b.userReal2 = 0
        set b.userReal3 = 0
        set b.userInt = 0
        set b.userInt2 = 0
        call ashbringer_device_update(b)
    endfunction

    function ashbringer_device_cleanup takes Buff b returns nothing
        local Tower tower = b.getBuffedUnit()
        call tower.modifyProperty(MOD_SPELL_DAMAGE_DEALT, -b.userReal)
        call tower.modifyProperty(MOD_SPELL_CRIT_CHANCE, -b.userReal2)
        call tower.modifyProperty(MOD_SPELL_CRIT_DAMAGE, -b.userReal3)
        call tower.modifyProperty(MOD_ATTACKSPEED, -b.userInt/1000.0)
        call tower.modifyProperty(MOD_TRIGGER_CHANCES, -b.userInt2/1000.0)
    endfunction
    
    function ashbringer_soulfire_apply takes Tower tower, Creep creep, integer stacks returns nothing
        local Buff b
        local integer i
        
        if stacks<1 then
            set stacks = 1
        endif
            
        set b = creep.getBuffOfType(ashbringer_soulfire_buff)
        if ( b != 0 ) then
            set i = b.getPower() + stacks
            call ashbringer_soulfire_buff.applyCustomPower(tower, creep, 1, i)
        else
            set i = stacks
            call ashbringer_soulfire_buff.applyCustomPower(tower, creep, 1, i)
        endif
    endfunction
    
    function ashbringer_soulfire_damage takes Buff b returns nothing
        local Tower tower = b.getCaster()
        local integer power = b.getPower()
        call tower.doSpellDamage(b.getBuffedUnit(), (1000 + (tower.getLevel() * 40)) * I2R(power), tower.calcSpellCritNoBonus())
    endfunction
    
    function ashbringer_soulfire_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, 200)
        local Unit next
        local integer nearby = 0
        
        call Effect.createSimpleAtUnit("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl", creep).destroy()
        call ashbringer_consumption_missile(creep, tower)
    
        if tower != 0 then
            call tower.addMana(5.00)
        endif
        
        set nearby = it.count()
        loop
            set next = it.next()
            call ashbringer_soulfire_apply(tower, next, b.getPower()/nearby)
            exitwhen next == 0
        endloop
    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 ashbringer_device_aura = BuffType.createAuraEffectType(true)
        call ashbringer_device_aura.setBuffIcon('@@2@@')
        call ashbringer_device_aura.addEventOnCreate(ashbringer_device_create)
        call ashbringer_device_aura.addEventOnCleanup(ashbringer_device_cleanup)
        call ashbringer_device_aura.addPeriodicEvent(ashbringer_device_update, 5)

        set ashbringer_soulfire_buff = BuffType.create(5,0,false) 
        call ashbringer_soulfire_buff.setBuffIcon('@@1@@')  
        call ashbringer_soulfire_buff.addPeriodicEvent(EventHandler.ashbringer_soulfire_damage,1) 
        call ashbringer_soulfire_buff.addEventOnDeath(EventHandler.ashbringer_soulfire_ondeath)
            
        set ashbringer_consumption_projectile = ProjectileType.create("Abilities\\weapons\\AvengerMissile\\AvengerMissile.mdl", 5.0, 900.0)
        
        set ashbringer_awaken_buff=BuffType.create(3, 0, true)
        call m.addModification(MOD_ATTACKSPEED, 0.5, 0.02)
        call ashbringer_awaken_buff.setBuffIcon('@@3@@')
        call ashbringer_awaken_buff.setBuffModifier(m)
        
        set ashbringer_awaken_count = MultiboardValues.create(1)  
        call ashbringer_awaken_count.setKey(0,"Awaken Cast") 
    endfunction

On Damage

ONDAMAGE_chance: 0.2 ONDAMAGE_chanceLevelAdd: 0.004
function onDamage takes Tower tower returns nothing
    call ashbringer_soulfire_apply(tower, Event.getTarget(), 1)
endfunction

On Tower Creation

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

On Tower Details

goldcost: 0
function onTowerDetails takes Tower tower returns MultiboardValues
    call ashbringer_awaken_count.setValue(0, I2S(tower.userInt)) 
    return ashbringer_awaken_count
endfunction

Tower Aura

AURA_powerAdd: 0 AURA_auraEffect: ashbringer_device_aura AURA_levelAdd: 0 AURA_power: 1 AURA_targetType: TARGET_TYPE_TOWERS + TARGET_TYPE_ELEMENT_DARKNESS + TARGET_TYPE_RARITY_UNCOMMON + TARGET_TYPE_RARITY_COMMON AURA_targetSelf: false AURA_level: 1 AURA_auraRange: 350