Fenced Flames v4
120
ID:
991
Family ID:
Author:
Deemzul
Rarity:
uncommon
Element:
fire
Attack Type:
Physical
Attack Range:
900
Attack CD:
1.2
Damage:
90-90
Abil. Factor:
0.3
Status:
Rejected

Description:

Burning inside! Burning inside!

Latest Upload Comment:

Initial upload.
Embers
Every 1 second, causes Common towers in 300 range to launch a projectile at a random creep in this tower's attack range that deals 8% of the Common tower's attack damage as Elemental damage.

Level Bonus:
+0.16% damage factor
Download

Toggle Triggers

Header

                globals
    //@export
        ProjectileType spark
    //@export
        TargetType CommonTowers
    //@export
        Creep array fenced_temp_targets
    endglobals
    function interpolateFinished takes Projectile p, Unit target returns nothing
        local Tower tower = p.userInt
        call tower.doCustomAttackDamage(target,p.userReal,p.userReal2,AttackType.ELEMENTAL)
    endfunction
    private function init takes nothing returns nothing
        set spark = ProjectileType.createInterpolate("Abilities\\Spells\\Orc\\TrollBerserk\\HeadhunterWEAPONSLeft.mdl",650.0)
        call spark.setEventOnInterpolationFinished(ProjectileTargetEvent.interpolateFinished)
        
        set CommonTowers = TargetType.create(TARGET_TYPE_TOWERS+TARGET_TYPE_RARITY_COMMON)
        call spark.enableFreeSpin()
        call spark.setStartSpin(30)
    endfunction
        

Periodic

PERIODIC_period: 1
function periodic takes Tower tower returns nothing
            
    //Iterating over towers first is more wasteful, because it's safe to assume people wouldn't have this tower
    //If they didn't have Common towers near it
        local Iterate it = Iterate.overUnitsInRange(tower,CommonTowers,tower.getX(),tower.getY(),300)
        local Tower u = it.next() //This destroys the Iterate 'it' if there are no common towers in range
        local Iterate it2
        local Projectile p
        local Creep target
        local integer maxi = 0
        if u != 0 then
            set it2 = Iterate.overUnitsInRange(tower,TARGET_CREEPS,tower.getX(),tower.getY(),tower.getRange()+72) //+72 for tower collision size, bit of a hack to get real attack range AoE-- iterate only takes target collision to consideration
            loop //This always destroys the Iterate 'it2'
                set target = it2.next()
                exitwhen target == 0
                set fenced_temp_targets[maxi] = target
                set maxi = maxi + 1
            endloop
            if maxi > 0 then
                set maxi = maxi - 1 //GetRandomInt is inclusive, so minus 1
                loop //This destroys the Iterate 'it'
                    set target = fenced_temp_targets[GetRandomInt(0,maxi)]
                    call spark.setSpeed(GetRandomReal(500,750)) //Cannot change interpolated Projectile's speed after creation
                    set p = Projectile.createBezierInterpolationFromUnitToUnit(spark,u,1,1,u,target,GetRandomReal(0.0,0.3),GetRandomReal(-0.8,0.8),GetRandomReal(0.1,0.4),true)
                    set p.userInt = u
                    set p.userReal = u.getCurrentAttackDamageWithBonus()*0.08
                    set p.userReal2 = u.calcAttackMulticrit(0,0,0)
                    set p.spin = GetRandomReal(12,60)
                    call p.setScale(0.5)
                    set u = it.next()
                    exitwhen u == 0
                endloop
            else
                //this destroys the Iterate 'it' if it2 was empty
                call it.destroy()
            endif
        endif
        
endfunction

Glowackos

May 8, 2020, 2:46 p.m.

Nup. Ability too fancy for uncommon.