Function MeleeTriggerActionPlayerLeft

Line
9684
Location
blizzard.j
Constant?
no
Type
function
Arguments
nothing
Returns
nothing
9684
function MeleeTriggerActionPlayerLeft takes nothing returns nothing
9685
    local player thePlayer = GetTriggerPlayer()
9686
9687
    // Just show game over for observers when they leave
9688
    if (IsPlayerObserver(thePlayer)) then
9689
        call RemovePlayerPreserveUnitsBJ(thePlayer, PLAYER_GAME_RESULT_NEUTRAL, false)
9690
        return
9691
    endif
9692
9693
    call CachePlayerHeroData(thePlayer)
9694
9695
    // This is the same as defeat except the player generates the message 
9696
    // "player left the game" as opposed to "player was defeated".
9697
9698
    if (MeleeGetAllyCount(thePlayer) > 0) then
9699
        // If at least one ally is still alive and kicking, share units with
9700
        // them and proceed with death.
9701
        call ShareEverythingWithTeam(thePlayer)
9702
        call MeleeDoLeave(thePlayer)
9703
    else
9704
        // If no living allies remain, swap all units and buildings over to
9705
        // neutral_passive and proceed with death.
9706
        call MakeUnitsPassiveForTeam(thePlayer)
9707
        call MeleeDoLeave(thePlayer)
9708
    endif
9709
    call MeleeCheckForLosersAndVictors()
9710
endfunction