function Cond takes nothing returns boolean
return GetSpellAbilityId() == 039;A000039;
endfunction
function G takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 039;h000039;, GetOwningPlayer(GetTriggerUnit()), l, 0.00 )
call UnitAddAbilityBJ( 039;A001039;, GetLastCreatedUnit() )
call UnitApplyTimedLifeBJ( 1.00, 039;BTLF039;, GetLastCreatedUnit() )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "entanglingroots", GetEnumUnit() )
endfunction
function Acts takes nothing returns nothing
local location udg_l = GetUnitLoc(GetTriggerUnit())
local real distance = ( 300.00 + ( 50.00 * I2R(GetUnitAbilityLevelSwapped(039;A000039;, GetTriggerUnit())) ) )
set bj_wantDestroyGroup = TRUE
call ForGroupBJ( GetUnitsInRangeOfLocAll(distance, l), function G )
call RemoveLocation( l)
endfunction
//===========================================================================
function InitTrig_Root takes nothing returns nothing
set gg_trg_Root = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Root, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Root, Condition( function Cond ) )
call TriggerAddAction( gg_trg_Root, function Acts )
endfunction
scope Root initializer Init
private function Cond takes nothing returns boolean
return GetSpellAbilityId() == 039;A000039;
endfunction
private function Acts takes nothing returns nothing
local unit caster = GetTriggerUnit()
local real X = GetUnitX(caster)
local real Y = GetUnitY(caster)
local real distance = ( 300.00 + ( 50.00 * I2R(GetUnitAbilityLevel(caster,039;A000039;)) ) )
local group g = CreateGroup()
local unit temp
local unit dummy
local player p = GetOwningPlayer(caster)
call GroupEnumUnitInRange(g,X,Y,distance,null)
loop
set temp = FirstOfGroup(g)
exitwhen temp == null
set dummy = CreateUnit(p,039;h000039;,GetUnitX(temp),GetUnitY(temp),l,0.)
call UnitAddAbility(dummy,039;A001039;)
call UnitApplyTimedLife(dummy, 039;BTLF039;, 1.)
call IssueTargetOrder(dummy,"entanglingroots",temp)
call GroupRemoveUnit(temp,g)
endloop
call DestroyGroup(g)
set caster = null
set g = null
set temp = null
set dummy = null
set p = null
endfunction
private function Init takes nothing returns nothing
local trigger Root = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(Root, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Root, Condition( function Cond ) )
call TriggerAddAction( Root, function Acts )
set Root = null
endfunction
endscope