Overcharge Shot v1
800
lvl: 21

ID:

215

Author:

cedi

Rarity:

unique

Status:

Approved

Description:

Spells: collateral damage.

Latest Upload Comment:

Restored from 1.10
Overcharge Shot
This tower's attack continues for 350 units through the main target, dealing 35% of the tower's attack damage to any creep in its path.

Level Bonus:
+0.6% damage
Download

Toggle Triggers

Header

goldcost: 0
    globals
        ProjectileType PT
    endglobals
    
    function PT_Hit takes Projectile P, Unit U returns nothing
        local Tower T
        if U.getUID() != P.userInt then
            //Not the original target
            set T = P.getCaster()
            call T.doAttackDamage( U, P.userReal, T.calcAttackMulticrit( 0, 0, 0 ) )
        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
        set PT = ProjectileType.createRanged( "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl", 350.00, 1000.00 )
        call PT.enableCollision( PT_Hit, 75.0, TARGET_CREEPS, false )
    endfunction

On Damage

ONDAMAGE_chance: 1.0 goldcost: 800 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Item itm returns nothing
    local real angle
    local Creep C
    local Tower T
    local Projectile P
    if Event.isMainTarget() then
        set T = itm.getCarrier()
        set C = Event.getTarget()
        set angle = bj_RADTODEG * Atan2( C.getY() - T.getY(), C.getX() - T.getX() )
        set P = Projectile.createFromUnit( PT, T, C, angle, 1.0, 1.0 )
        set P.userInt = C.getUID()
        set P.userReal = T.getCurrentAttackDamageWithBonus() * ( 0.35 + 0.006 * T.getLevel() )
    endif
endfunction