scope pickmain initializer I
//=====================================
//=====================================
private function ruserunnerhumanskill takes nothing returns nothing
call IssueImmediateOrder( GetLastReplacedUnitBJ(), "berserk" )
endfunction
private function userunnerhumanskill takes nothing returns nothing
call IssueImmediateOrder( GetTrainedUnit(), "berserk" )
endfunction
//=====================================
private function randomedpandaskills takes nothing returns nothing
call TriggerRegisterUnitEvent( gg_trg_pandaren_flames, GetLastReplacedUnitBJ(), EVENT_UNIT_SPELL_EFFECT )
endfunction
private function randomedmageskills takes nothing returns nothing
call TriggerRegisterUnitEvent( gg_trg_starfall, GetLastReplacedUnitBJ(), EVENT_UNIT_SPELL_CAST )
call TriggerRegisterUnitEvent( gg_trg_starfall_off, GetLastReplacedUnitBJ(), EVENT_UNIT_SPELL_ENDCAST )
endfunction
private function pandaskills takes nothing returns nothing
call TriggerRegisterUnitEvent( gg_trg_pandaren_flames, GetTrainedUnit(), EVENT_UNIT_SPELL_EFFECT )
endfunction
private function mageskills takes nothing returns nothing
call TriggerRegisterUnitEvent( gg_trg_starfall, GetTrainedUnit(), EVENT_UNIT_SPELL_CAST )
call TriggerRegisterUnitEvent( gg_trg_starfall_off, GetTrainedUnit(), EVENT_UNIT_SPELL_ENDCAST )
endfunction
private function randomedtreedemonskills takes nothing returns nothing
call TriggerRegisterUnitEvent( gg_trg_consume_tree, GetLastReplacedUnitBJ(), EVENT_UNIT_SPELL_EFFECT )
call TriggerRegisterUnitEvent( gg_trg_teleport_tree, GetLastReplacedUnitBJ(), EVENT_UNIT_SPELL_EFFECT )
endfunction
private function treedemonskills takes nothing returns nothing
call TriggerRegisterUnitEvent( gg_trg_consume_tree, GetTrainedUnit(), EVENT_UNIT_SPELL_EFFECT )
call TriggerRegisterUnitEvent( gg_trg_teleport_tree, GetTrainedUnit(), EVENT_UNIT_SPELL_EFFECT )
endfunction
private function randomeddemonmageskills takes nothing returns nothing
call UnitAddItemByIdSwapped( 'I000', GetLastReplacedUnitBJ() )
call UnitAddItemByIdSwapped( 'I001', GetLastReplacedUnitBJ() )
endfunction
private function demonmageskills takes nothing returns nothing
call UnitAddItemByIdSwapped( 'I000', GetTrainedUnit() )
call UnitAddItemByIdSwapped( 'I001', GetTrainedUnit() )
endfunction
private function randomchaser takes nothing returns nothing
call ReplaceUnitBJ(GetTrainedUnit(), udg_chasers_random[GetRandomInt(0, 9)], bj_UNIT_STATE_METHOD_DEFAULTS )
if GetUnitTypeId(GetLastReplacedUnitBJ()) == 'Edem' then
call randomedmageskills()
else
if GetUnitTypeId(GetLastReplacedUnitBJ()) == 'Ofar' then
call randomedpandaskills()
endif
endif
endfunction
//=====================================
//=====================================
private function randomrunner takes nothing returns nothing
call ReplaceUnitBJ(GetTrainedUnit(), udg_runners_random[GetRandomInt(0, 25)], bj_UNIT_STATE_METHOD_DEFAULTS )
if GetUnitTypeId(GetLastReplacedUnitBJ()) == 'unec' then
call randomedtreedemonskills()
else
if GetUnitTypeId(GetLastReplacedUnitBJ()) == 'hdhw' then
call randomeddemonmageskills()
else
if GetUnitTypeId(GetLastReplacedUnitBJ()) == 'otau' then
call ruserunnerhumanskill()
else
endif
endif
endif
endfunction
//=====================================
private function pnameset takes nothing returns nothing
call SetPlayerName( GetOwningPlayer(GetTriggerUnit()), udg_strings[( GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())) + 12 )] )
endfunction
private function setmbiconitemreplaced takes nothing returns nothing
call MultiboardSetItemIconBJ( udg_mainmultiboard, 1, S2I(udg_mbp[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))]), udg_icons[GetUnitPointValue(GetLastReplacedUnitBJ())])
endfunction
private function setmbiconitemtrained takes nothing returns nothing
call MultiboardSetItemIconBJ( udg_mainmultiboard, 1, S2I(udg_mbp[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))]), udg_icons[GetUnitPointValue(GetTrainedUnit())])
endfunction
private function setmbitemname takes nothing returns nothing
call MultiboardSetItemValueBJ( udg_mainmultiboard, 1, S2I(udg_mbp[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))]), GetPlayerName(GetOwningPlayer(GetTriggerUnit())) )
endfunction
private function rru takes nothing returns nothing
call UnitAddItemByIdSwapped( 'phlt', GetLastReplacedUnitBJ() )
call RemoveUnit(GetTriggerUnit())
endfunction
private function ru takes nothing returns nothing
call UnitAddItemByIdSwapped( 'phlt', GetTrainedUnit() )
call RemoveUnit(GetTriggerUnit())
endfunction
private function spawnflyer takes nothing returns nothing
call ReplaceUnitBJ(GetTriggerUnit(), 'nnht', bj_UNIT_STATE_METHOD_RELATIVE)
endfunction
private function rpuset takes nothing returns nothing
set udg_pickedunit[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] = GetLastReplacedUnitBJ()
endfunction
private function puset takes nothing returns nothing
set udg_pickedunit[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] = GetTrainedUnit()
endfunction
private function A takes nothing returns nothing
//=====================================
//=====================================
if GetUnitTypeId(GetTriggerUnit()) == 'ncbf' or GetUnitTypeId(GetTriggerUnit()) == 'ncbe' or GetUnitTypeId(GetTriggerUnit()) == 'ndmg' then
if GetUnitTypeId(GetTrainedUnit()) == 'edot' then
call randomrunner()
call rpuset()
call pnameset()
call setmbiconitemreplaced()
call setmbitemname()
call spawnflyer()
//=====================================
else
if GetUnitTypeId(GetTrainedUnit()) == 'unec' then
call treedemonskills()
call puset()
call pnameset()
call setmbiconitemtrained()
call setmbitemname()
call spawnflyer()
else
if GetUnitTypeId(GetTrainedUnit()) == 'hdhw' then
call demonmageskills()
call puset()
call pnameset()
call setmbiconitemtrained()
call setmbitemname()
call spawnflyer()
else
//=====================================
//=====================================
if GetUnitTypeId(GetTrainedUnit()) == 'otau' then
call userunnerhumanskill()
call puset()
call pnameset()
call setmbiconitemtrained()
call setmbitemname()
call spawnflyer()
//=====================================
else
call puset()
call pnameset()
call setmbiconitemtrained()
call setmbitemname()
call spawnflyer()
endif
endif
endif
endif
else
if GetUnitTypeId(GetTriggerUnit()) == 'nfnp' then
if GetUnitTypeId(GetTrainedUnit()) == 'edry' then
call randomchaser()
call rpuset()
call pnameset()
call setmbitemname()
call setmbiconitemreplaced()
call rru()
else
if GetUnitTypeId(GetTrainedUnit()) == 'Edem' then
call mageskills()
call puset()
call pnameset()
call setmbitemname()
call setmbiconitemtrained()
call ru()
else
if GetUnitTypeId(GetTrainedUnit()) == 'Ofar' then
call pandaskills()
call puset()
call pnameset()
call setmbitemname()
call setmbiconitemtrained()
call ru()
else
call puset()
call pnameset()
call setmbitemname()
call setmbiconitemtrained()
call ru()
endif
endif
endif
else
endif
endif
endfunction
//===========================================================================
private function I takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_TRAIN_FINISH )
call TriggerAddAction( t, function A )
endfunction
endscope