function Trig_ShadowBall_Dot_Actions takes nothing returns nothing
local unit temp
local real x
local real y
local real facing
local integer cvalue
local integer tempunitpreset
local group shadowballgroup = CreateGroup()
local integer n1
local integer n = 1
loop
exitwhen(n > dhcount)
if (shadowballcast[n] == 1) then
set x = GetUnitX(shadowballunit[n])
set y = GetUnitY(shadowballunit[n])
call GroupEnumUnitsInRange(shadowballgroup, x, y, 200, Filter(function TrueBoolexpr))
loop
set temp = FirstOfGroup(shadowballgroup)
exitwhen temp == null
set cvalue = GetUnitUserData(demonhunters[n])
if (GetPlayerId(GetOwningPlayer(temp)) != cvalue) then
if (GetPlayerId(GetOwningPlayer(temp)) != 15) then
set tempunitpreset = 0
set n1 = ((n*50)-50)
loop
exitwhen(n1>shadowballhitunitsno[n])
if(shadowballhitunits[n1+((n*50)-50)] == temp) then
set tempunitpreset = 1
endif
set n1 = n1 + 1
endloop
if (tempunitpreset == 0) then
call UnitDamageTarget( demonhunters[n], temp, 150, true, false, ATTACK_TYPE_NORMAL , DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS )
set x = GetUnitX(temp)
set y = GetUnitY(temp)
if(shadowballboolean[n] == false) then
call SetUnitX(shadowballhealdummy1[n], x)
call SetUnitY(shadowballhealdummy1[n], y)
call IssueTargetOrder( shadowballhealdummy1[n], "shadowstrike", demonhunters[n])
set shadowballboolean[n] = true
elseif(shadowballboolean[n] == true) then
call SetUnitX(shadowballhealdummy2[n], x)
call SetUnitY(shadowballhealdummy2[n], y)
call IssueTargetOrder( shadowballhealdummy2[n], "shadowstrike", demonhunters[n])
set shadowballboolean[n] = false
endif
set shadowballhitunitsno[n] = shadowballhitunitsno[n] + 1
set shadowballhitunits[shadowballhitunitsno[n]+((n*50)-50)] = temp
endif
endif
endif
call GroupRemoveUnit(shadowballgroup, temp)
endloop
set shadowballgroup=null
set shadowballtimer[n] = shadowballtimer[n] - 20
if (shadowballtimer[n] <= 0) then
call SetUnitAnimation( shadowballunit[n], "death" )
call QueueUnitAnimation( shadowballunit[n], "Stand" )
set shadowballcast[n] = 0
set shadowballhitunitsno[n] = ((n*50)-50)
set shadowballdeathtimer[n] = 180
endif
endif
// Animation
if (shadowballdeathtimer[n] > 0) then
set shadowballdeathtimer[n] = shadowballdeathtimer[n] - 20
if (shadowballdeathtimer[n] == 0) then
call hidespecial(shadowballunit[n])
endif
endif
if (shadowballtimer[n] == 0) then
set facing = GetUnitFacing(demonhunters[n])
call SetUnitFacing(shadowballunit[n], facing)
call SetUnitFacing(shadowballhealdummy1[n], (facing+180))
call SetUnitFacing(shadowballhealdummy2[n], (facing+180))
endif
set n = n + 1
endloop
call DestroyGroup(shadowballgroup)
set temp = null
endfunction
//===========================================================================
function InitTrig_ShadowBall_Dot takes nothing returns nothing
set gg_trg_ShadowBall_Dot = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_ShadowBall_Dot, 0.20 )
call TriggerAddAction( gg_trg_ShadowBall_Dot, function Trig_ShadowBall_Dot_Actions )
endfunction