function Trig_Shuffle_Periodic_Func001Func001Func007Func005C takes nothing returns boolean
if ( not ( udg_CardState > 3 ) ) then
return false
endif
return true
endfunction
function Trig_Shuffle_Periodic_Func001Func001Func007C takes nothing returns boolean
if ( not ( udg_NextCardInterval > 0.00 ) ) then
return false
endif
return true
endfunction
function Trig_Shuffle_Periodic_Func001Func001Func009C takes nothing returns boolean
if ( not ( udg_ShufflingDuration > 0.00 ) ) then
return false
endif
return true
endfunction
function Trig_Shuffle_Periodic_Func001Func001A takes nothing returns nothing
set udg_TempUnit = GetEnumUnit()
set udg_CardState = LoadIntegerBJ(StringHashBJ("CardState"), GetHandleIdBJ(GetEnumUnit()), udg_TF_Hash)
set udg_NextCardInterval = LoadRealBJ(StringHashBJ("NextInterval"), GetHandleIdBJ(GetEnumUnit()), udg_TF_Hash)
set udg_ShufflingDuration = LoadRealBJ(StringHashBJ("ShuffleDuration"), GetHandleIdBJ(GetEnumUnit()), udg_TF_Hash)
set udg_ShuffleTag = LoadTextTagHandleBJ(StringHashBJ("ShuffleTag"), GetHandleIdBJ(GetEnumUnit()), udg_TF_Hash)
set udg_BuffSFX = LoadEffectHandleBJ(StringHashBJ("CardSFX"), GetHandleIdBJ(GetEnumUnit()), udg_TF_Hash)
if ( Trig_Shuffle_Periodic_Func001Func001Func007C() ) then
set udg_NextCardInterval = ( udg_NextCardInterval - 30.00 )
else
set udg_NextCardInterval = 1200.00
call UnitRemoveAbilityBJ( udg_CardValue[udg_CardState], udg_TempUnit )
call DestroyEffectBJ( udg_BuffSFX )
set udg_CardState = ( udg_CardState + 1 )
if ( Trig_Shuffle_Periodic_Func001Func001Func007Func005C() ) then
set udg_CardState = 1
call SaveEffectHandleBJ( GetLastCreatedEffectBJ(), StringHashBJ("CardSFX"), GetHandleIdBJ(GetEnumUnit()), udg_TF_Hash )
else
endif
call SetTextTagColorBJ( udg_ShuffleTag, udg_TagRed[udg_CardState], udg_TagGreen[udg_CardState], udg_TagBlue[udg_CardState], 0 )
call AddSpecialEffectTargetUnitBJ( "overhead", udg_TempUnit, udg_CardSFX[udg_CardState] )
call SaveEffectHandleBJ( GetLastCreatedEffectBJ(), StringHashBJ("CardSFX"), GetHandleIdBJ(GetEnumUnit()), udg_TF_Hash )
call UnitAddAbilityBJ( udg_CardValue[udg_CardState], udg_TempUnit )
endif
call SetTextTagPosUnitBJ( udg_ShuffleTag, udg_TempUnit, 0 )
if ( Trig_Shuffle_Periodic_Func001Func001Func009C() ) then
set udg_ShufflingDuration = ( udg_ShufflingDuration - 30.00 )
call SetTextTagTextBJ( udg_ShuffleTag, R2SW(( udg_ShufflingDuration / 1000.00 ), 1, 2), 10 )
else
call SetTextTagTextBJ( udg_ShuffleTag, "TRIGSTR_056", 10 )
call SetTextTagPermanentBJ( udg_ShuffleTag, false )
call SetTextTagLifespanBJ( udg_ShuffleTag, 5 )
call SetTextTagFadepointBJ( udg_ShuffleTag, 1.00 )
call SetTextTagVelocityBJ( udg_ShuffleTag, 40.00, 180.00 )
call DestroyEffectBJ( udg_BuffSFX )
call UnitRemoveBuffBJ( 'B000', udg_TempUnit )
call UnitRemoveAbilityBJ( udg_CardValue[udg_CardState], udg_TempUnit )
call UnitRemoveAbilityBJ( udg_CardThrow[udg_CardState], udg_TempUnit )
call GroupRemoveUnitSimple( udg_TempUnit, udg_ShuffleGroup )
call SetPlayerAbilityAvailableBJ( true, 'A000', GetOwningPlayer(udg_TempUnit) )
endif
call SaveRealBJ( udg_NextCardInterval, StringHashBJ("NextInterval"), GetHandleIdBJ(GetEnumUnit()), udg_TF_Hash )
call SaveRealBJ( udg_ShufflingDuration, StringHashBJ("ShuffleDuration"), GetHandleIdBJ(GetEnumUnit()), udg_TF_Hash )
call SaveIntegerBJ( udg_CardState, StringHashBJ("CardState"), GetHandleIdBJ(GetEnumUnit()), udg_TF_Hash )
endfunction
function Trig_Shuffle_Periodic_Func001C takes nothing returns boolean
if ( not ( IsUnitGroupEmptyBJ(udg_ShuffleGroup) == false ) ) then
return false
endif
return true
endfunction
function Trig_Shuffle_Periodic_Actions takes nothing returns nothing
if ( Trig_Shuffle_Periodic_Func001C() ) then
call ForGroupBJ( udg_ShuffleGroup, function Trig_Shuffle_Periodic_Func001Func001A )
else
call DisableTrigger( GetTriggeringTrigger() )
endif
endfunction
//===========================================================================
function InitTrig_Shuffle_Periodic takes nothing returns nothing
set gg_trg_Shuffle_Periodic = CreateTrigger( )
call DisableTrigger( gg_trg_Shuffle_Periodic )
call TriggerRegisterTimerEventPeriodic( gg_trg_Shuffle_Periodic, 0.03 )
call TriggerAddAction( gg_trg_Shuffle_Periodic, function Trig_Shuffle_Periodic_Actions )
endfunction