M.E.F.I.S. Rocket v1
1500
lvl: 44

ID:

207

Author:

cedi

Rarity:

unique

Status:

Approved

Description:

Now, If only I could remember where I put the manual.

Latest Upload Comment:

Restored from 1.10
Anti-Immunity Missile
Fires immune-seeking missiles. The attack range, speed, damage and type is the same as the carrier's, unless the attack type is Magic, which is dealt as Essence damage. Damage is scaled by 20% of the tower's spell damage.

Level Bonus:
+0.8% scaling
Download

Toggle Triggers

Header

goldcost: 0
    globals
        ProjectileType PT
        MultiboardValues MB
    endglobals
    
    function hitPT takes Projectile P, Unit U returns nothing
        local Tower T = P.getCaster()
        //local AttackType AT = P.userInt
        call T.doCustomAttackDamage( U, P.userReal, T.calcAttackMulticrit( 0, 0, 0 ), P.userInt )
    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
        set PT = ProjectileType.createInterpolate( "Abilities\\Spells\\Other\\TinkerRocket\\TinkerRocketMissile.mdl", 1000.00 )
        call PT.setEventOnInterpolationFinished( hitPT )
        
        set MB = MultiboardValues.create( 1 )
        call MB.setKey( 0, "Damage" )
    endfunction

On Item Pickup

goldcost: 0
function onPickup  takes Item itm returns nothing
    local Tower T = itm.getCarrier()
    
    if T.getAttackType() != AttackType.MAGIC then
        set itm.userInt = T.getAttackType()
    else
        set itm.userInt = AttackType.ESSENCE
    endif
endfunction

On Tower Details

goldcost: 0
function onTowerDetails takes Item itm returns MultiboardValues
    local Tower T = itm.getCarrier()
    local real dmg = T.getCurrentAttackDamageWithBonus() * ( T.getProp_SpellDmgDealt() * ( 0.2 + 0.008 * T.getLevel() ) )
    call MB.setValue( 0, formatFloat( dmg, 0 ) )
    return MB
endfunction

Periodic

PERIODIC_period: 0.1 goldcost: 1500
function periodic takes Item itm returns nothing
    local Tower T = itm.getCarrier()
    local Iterate I = Iterate.overUnitsInRangeOfCaster( T, TARGET_CREEPS, T.getRange() )
    local Unit U
    local real dmg
    local Projectile P
    
    call Event.getCurrentPeriodicEvent().enableAdvanced( T.getCurrentAttackspeed(), true )
    
    loop
        set U = I.next()
        if U == 0 then
            return //No target
        endif
        
        exitwhen U.isImmune()
    endloop

    //Gotcha
    call I.destroy() //If this point is reached the Iteration still exists and has to be destroyed
    set dmg = T.getCurrentAttackDamageWithBonus() * ( T.getProp_SpellDmgDealt() * ( 0.2 + 0.008 * T.getLevel() ) )
    set P = Projectile.createLinearInterpolationFromUnitToUnit( PT, T, 1.0, 1.0, T, U, 0.35, true )
    set P.userReal = dmg
    set P.userInt = itm.userInt
endfunction