function Trig_Revive_Giants_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'Absk' ) ) then
return false
endif
return true
endfunction
function Trig_Revive_Giants_Boolean takes nothing returns boolean
return ( IsUnitDeadBJ(GetFilterUnit()) == true ) and ( IsUnitType(GetFilterUnit(), UNIT_TYPE_GIANT) == true ) and ( GetOwningPlayer(GetFilterUnit()) == GetOwningPlayer(GetTriggerUnit()) )
endfunction
function Trig_Revive_Giants_Revive takes nothing returns nothing
set udg_Revive_Point = GetUnitLoc(GetEnumUnit())
call CreateNUnitsAtLoc( 1, GetUnitTypeId(GetEnumUnit()), GetOwningPlayer(GetTriggerUnit()), udg_Revive_Point, bj_UNIT_FACING )
call RemoveUnit( GetEnumUnit() )
endfunction
function Trig_Revive_Giants_Actions takes nothing returns nothing
set udg_Temp_Point = GetUnitLoc(GetTriggerUnit())
set udg_Temp_Group = GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(512, udg_Temp_Point, Condition(function Trig_Revive_Giants_Boolean)))
call ForGroupBJ( udg_Temp_Group, function Trig_Revive_Giants_Revive )
call RemoveLocation (udg_Temp_Point)
call RemoveLocation (udg_Revive_Point)
call DestroyGroup (udg_Temp_Group)
endfunction
//===========================================================================
function InitTrig_Revive_Giants takes nothing returns nothing
set gg_trg_Revive_Giants = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Revive_Giants, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Revive_Giants, Condition( function Trig_Revive_Giants_Conditions ) )
call TriggerAddAction( gg_trg_Revive_Giants, function Trig_Revive_Giants_Actions )
endfunction