Fragmentation Round v1
2000
lvl: 60

ID:

208

Author:

cedi

Rarity:

unique

Status:

Approved

Description:


Latest Upload Comment:

Restored from 1.10
Fragmentation Round
On damage, the carrier of this item has a 40% chance to hit up to 2 other creeps within 500 range of the main target with fragments that deal 45% of the damage and cause hit creeps to take 40% more damage from further fragments and splash damage for the next 5 seconds.
Download

Toggle Triggers

Header

goldcost: 2000
    globals
        ProjectileType PT
        BuffType BT
    endglobals
    
    function PT_Hit takes Projectile P, Unit U returns nothing
        local Tower T = P.getCaster()
        local Buff B = U.getBuffOfType( BT )
        
        if B != 0 then
            set P.userReal = P.userReal * (1.40 )
        endif
        
        call T.doAttackDamage( U, P.userReal * 0.45 , 1.0 )
        
        call BT.apply( T, U, B.getLevel() )
    endfunction 
    
    function BT_DMG takes Buff B returns nothing
        if Event.isMainTarget() == false and Event.isSpellDamage() == false then
            set Event.damage = Event.damage * ( 1.40 )
        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.createInterpolate( "Abilities\\Weapons\\BloodElfSpellThiefMISSILE\\BloodElfSpellThiefMISSILE.mdl", 1000.0 )
        call PT.enableHoming( PT_Hit, 0.1 )
        
        set BT = BuffType.create( 5.0, 0.0, false )
        call BT.setBuffIcon( '@@0@@' )
        call BT.addEventOnDamaged( BT_DMG, 1.0, 0.0 )
    endfunction

On Damage

ONDAMAGE_chance: 0.4 goldcost: 0 ONDAMAGE_chanceLevelAdd: 0.0
function onDamage takes Item itm returns nothing
    local Iterate I
    local Unit U
    local Unit Targ
    local integer i = 2
    
    if Event.isMainTarget() then
        set Targ = Event.getTarget()
        set I = Iterate.overUnitsInRangeOfUnit( itm.getCarrier(), TARGET_CREEPS, Targ, 500.0 )
        
        loop
            set U = I.next()
            exitwhen U == 0
            if U != Targ then
                set Projectile.createFromUnitToUnit( PT, itm.getCarrier(), 1.0, 1.0, Targ, U, true, false, true ).userReal = Event.damage
                set i = i - 1
                
                if i == 0 then
                    call I.destroy()
                    exitwhen true
                endif
            endif
        endloop
    endif
endfunction