PTR build 2.57.1.98674_ptr. Go to the live site.

mods/heroesmapmods/battlegroundmapmods/skytemple.stormmod/base.stormdata/libmlcp.galaxy

libmlcp.galaxy
include "TriggerLibs/NativeLib"
include "TriggerLibs/HeroesLib"
include "TriggerLibs/GameLib"
include "TriggerLibs/MapMechanicsLib"
include "TriggerLibs/AILib"
include "TriggerLibs/UILib"
include "TriggerLibs/SupportLib"

include "LibMLCP_h"

//--------------------------------------------------------------------------------------------------
// Library: Sky Temple
//--------------------------------------------------------------------------------------------------
// External Library Initialization
void libMLCP_InitLibraries () {
    libNtve_InitVariables();
    libCore_InitVariables();
    libGame_InitVariables();
    libMapM_InitVariables();
    libAIAI_InitVariables();
    libUIUI_InitVariables();
    libSprt_InitVariables();
}

// Variable Initialization
bool libMLCP_InitVariables_completed = false;

void libMLCP_InitVariables () {
    int init_i;
    int init_i1;
    int init_j1;

    if (libMLCP_InitVariables_completed) {
        return;
    }

    libMLCP_InitVariables_completed = true;

    for (init_i = 0; init_i <= libMLCP_gv_mMSkyTempleMaxCount_C; init_i += 1) {
        for (init_i1 = 0; init_i1 <= libCore_gv_bALMaxTeams; init_i1 += 1) {
            libMLCP_gv_mMSkyTemples[init_i].lv_targetPing[init_i1] = c_invalidPingId;
        }
        libMLCP_gv_mMSkyTemples[init_i].lv_helperText = c_textTagNone;
        libMLCP_gv_mMSkyTemples[init_i].lv_defendersActivated = UnitGroupEmpty();
    }
    libMLCP_gv_mMSkyTempleTempleBlessWarningTime = 30.0;
    libMLCP_gv_mMSkyTempleBlessingFirstTime = true;
    libMLCP_gv_mMSkyTempleBlessingWarningTimer = TimerCreate();
    libMLCP_gv_mMSkyTempleBlessWarningLongWaitTimer = TimerCreate();
    libMLCP_gv_mMSkyTempleObjectivePreviewTimer = TimerCreate();
    libMLCP_gv_mMSkyTempleObjectivePreviewDelay_C = 30.0;
    libMLCP_gv_mMSkyTempleDefenderWithGlobes = UnitGroupEmpty();
    libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsPanel = c_invalidDialogControlId;
    libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTimerModeFrame = c_invalidDialogControlId;
    libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTimerModeNameLabel = c_invalidDialogControlId;
    libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTimerModeTimeLabel = c_invalidDialogControlId;
    libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleModeFrame = c_invalidDialogControlId;
    for (init_i1 = 0; init_i1 <= 3; init_i1 += 1) {
        libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleBGImageBlue[init_i1] = c_invalidDialogControlId;
    }
    for (init_i1 = 0; init_i1 <= 3; init_i1 += 1) {
        libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleBGImageRed[init_i1] = c_invalidDialogControlId;
    }
    for (init_i1 = 0; init_i1 <= 3; init_i1 += 1) {
        libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleDisabledImage[init_i1] = c_invalidDialogControlId;
    }
    for (init_i1 = 0; init_i1 <= 3; init_i1 += 1) {
        libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleEnabledImage[init_i1] = c_invalidDialogControlId;
    }
    for (init_i1 = 0; init_i1 <= 3; init_i1 += 1) {
        libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleProgress2[init_i1] = c_invalidDialogControlId;
    }
    for (init_i1 = 0; init_i1 <= 3; init_i1 += 1) {
        libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleProgress1[init_i1] = c_invalidDialogControlId;
    }
    for (init_i1 = 0; init_i1 <= 3; init_i1 += 1) {
        libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleFinalShotsPanel[init_i1] = c_invalidDialogControlId;
    }
    for (init_i1 = 0; init_i1 <= 3; init_i1 += 1) {
        for (init_j1 = 0; init_j1 <= 5; init_j1 += 1) {
            libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleFinalShots[init_i1][init_j1] = c_invalidDialogControlId;
        }
    }
    for (init_i1 = 0; init_i1 <= 3; init_i1 += 1) {
        libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleTimerLabel[init_i1] = c_invalidDialogControlId;
    }
    for (init_i1 = 0; init_i1 <= 3; init_i1 += 1) {
        libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleFireEffect[init_i1] = c_invalidDialogControlId;
    }
    for (init_i1 = 0; init_i1 <= 30; init_i1 += 1) {
        libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleFireEffect2[init_i1] = c_invalidDialogControlId;
    }
    for (init_i1 = 0; init_i1 <= 2; init_i1 += 1) {
        libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleFireEffect3[init_i1] = c_invalidDialogControlId;
    }
    for (init_i1 = 0; init_i1 <= 2; init_i1 += 1) {
        for (init_j1 = 0; init_j1 <= 5; init_j1 += 1) {
            libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleFireEffect4[init_i1][init_j1] = c_invalidDialogControlId;
        }
    }
    for (init_i1 = 0; init_i1 <= 2; init_i1 += 1) {
        for (init_j1 = 0; init_j1 <= 5; init_j1 += 1) {
            libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleFireEffect5[init_i1][init_j1] = c_invalidDialogControlId;
        }
    }
    libMLCP_gv_mMSkyTemplePanel.lv_mainContainerPanel = c_invalidDialogControlId;
    libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeFrame = c_invalidDialogControlId;
    libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeNameLabel = c_invalidDialogControlId;
    libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeTimeLabel = c_invalidDialogControlId;
    libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTempleModeFrame = c_invalidDialogControlId;
    for (init_i = 0; init_i <= 3; init_i += 1) {
        libMLCP_gv_mMSkyTemplePanelIcons[init_i].lv_containerPanel = c_invalidDialogControlId;
        libMLCP_gv_mMSkyTemplePanelIcons[init_i].lv_fireEffect = c_invalidDialogControlId;
        libMLCP_gv_mMSkyTemplePanelIcons[init_i].lv_shrineIcon = c_invalidDialogControlId;
        libMLCP_gv_mMSkyTemplePanelIcons[init_i].lv_shrineProgress = c_invalidDialogControlId;
        libMLCP_gv_mMSkyTemplePanelIcons[init_i].lv_shrineCaptureProgressMask = c_invalidDialogControlId;
        for (init_i1 = 0; init_i1 <= 5; init_i1 += 1) {
            libMLCP_gv_mMSkyTemplePanelIcons[init_i].lv_bullets[init_i1] = c_invalidDialogControlId;
        }
        libMLCP_gv_mMSkyTemplePanelIcons[init_i].lv_cooldownLabel = c_invalidDialogControlId;
    }
}

// Presets
// Functions
void libMLCP_gf_MMSkyTempleAddTemple (unit lp_temple, point lp_blockerLoc, int lp_team1AttackingTown1_1, int lp_team1AttackingTown1_2, int lp_team1AttackingTown1_3, int lp_team1AttackingTown1_4, int lp_team1AttackingTown1_5, int lp_team1AttackingTown1_6, int lp_team1AttackingTown2_1, int lp_team1AttackingTown2_2, int lp_team1AttackingTown2_3, int lp_team1AttackingTown2_4, int lp_team1AttackingTown2_5, int lp_team1AttackingTown2_6) {
    // Variable Declarations
    int lv_itPlayer;

    // Automatic Variable Declarations
    int auto3BC44FB9_val;

    // Variable Initialization

    // Implementation
    libMLCP_gv_mMSkyTempleCount += 1;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_temple = lp_temple;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_blockerLoc = lp_blockerLoc;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_attackTownTargetingOrder[libGame_gv_teamOrderIndex_C][1] = lp_team1AttackingTown1_1;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_attackTownTargetingOrder[libGame_gv_teamOrderIndex_C][2] = lp_team1AttackingTown1_2;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_attackTownTargetingOrder[libGame_gv_teamOrderIndex_C][3] = lp_team1AttackingTown1_3;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_attackTownTargetingOrder[libGame_gv_teamOrderIndex_C][4] = lp_team1AttackingTown1_4;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_attackTownTargetingOrder[libGame_gv_teamOrderIndex_C][5] = lp_team1AttackingTown1_5;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_attackTownTargetingOrder[libGame_gv_teamOrderIndex_C][6] = lp_team1AttackingTown1_6;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_attackTownTargetingOrder[libGame_gv_teamChaosIndex_C][1] = lp_team1AttackingTown2_1;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_attackTownTargetingOrder[libGame_gv_teamChaosIndex_C][2] = lp_team1AttackingTown2_2;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_attackTownTargetingOrder[libGame_gv_teamChaosIndex_C][3] = lp_team1AttackingTown2_3;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_attackTownTargetingOrder[libGame_gv_teamChaosIndex_C][4] = lp_team1AttackingTown2_4;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_attackTownTargetingOrder[libGame_gv_teamChaosIndex_C][5] = lp_team1AttackingTown2_5;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_attackTownTargetingOrder[libGame_gv_teamChaosIndex_C][6] = lp_team1AttackingTown2_6;
    UnitCreate(1, "JungleCampIconUnit", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Neutral, UnitGetPosition(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_temple), UnitGetFacing(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_temple), null);
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_minimapIcon = UnitLastCreated();
    auto3BC44FB9_val = libMLCP_gv_mMSkyTempleCount;
    if (auto3BC44FB9_val == libMLCP_ge_MMSkyTempleTempleIndex_Top) {
        libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_temple, "MinimapIcon Assets\\Textures\\storm_ui_minimapicon_skytempletop.dds");
        libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_minimapIcon, "MinimapIcon Assets\\Textures\\storm_ui_minimapicon_skytempletop.dds");
    }
    else if (auto3BC44FB9_val == libMLCP_ge_MMSkyTempleTempleIndex_Middle) {
        libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_temple, "MinimapIcon Assets\\Textures\\storm_ui_minimapicon_skytemplemid.dds");
        libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_minimapIcon, "MinimapIcon Assets\\Textures\\storm_ui_minimapicon_skytemplemid.dds");
    }
    else if (auto3BC44FB9_val == libMLCP_ge_MMSkyTempleTempleIndex_Bottom) {
        libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_temple, "MinimapIcon Assets\\Textures\\storm_ui_minimapicon_skytemplebot.dds");
        libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_minimapIcon, "MinimapIcon Assets\\Textures\\storm_ui_minimapicon_skytemplebot.dds");
    }
    else {
    }
    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_temple, "MinimapIconTintColor 255,217,186,123");
    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_minimapIcon, "MinimapIconTintColor 255,145,113,218");
    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_temple, "MinimapIconScale 0.800000");
    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_minimapIcon, "MinimapIconScale 0.800000");
    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_temple, "SetMinimapVisibility");
    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_temple, "SetMinimapVisibilityAlways");
    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_minimapIcon, "SetMinimapVisibility");
    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_minimapIcon, "SetMinimapVisibilityAlways");
}

void libMLCP_gf_MMSkyTempleAddTempleDefenderSpawnLocations (point lp_location1, point lp_location2, point lp_location3, point lp_location4, point lp_location5) {
    // Automatic Variable Declarations
    // Implementation
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_defenderSpawnPoints[1] = lp_location1;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_defenderSpawnPoints[2] = lp_location2;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_defenderSpawnPoints[3] = lp_location3;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_defenderSpawnPoints[4] = lp_location4;
    libMLCP_gv_mMSkyTemples[libMLCP_gv_mMSkyTempleCount].lv_defenderSpawnPoints[5] = lp_location5;
}

point libMLCP_gf_MMSkyTempleLocation (int lp_templeIndex) {
    // Automatic Variable Declarations
    // Implementation
    return UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple);
}

void libMLCP_gf_MMSkyTempleRandomNextTemples (int lp_blessCount, bool lp_removeDisabled) {
    // Variable Declarations
    int lv_itTempleIndex;
    int[libMLCP_gv_mMSkyTempleMaxCount_C + 1] lv_nextPotentialTempleFalses;
    int lv_nextPotentialCountFalse;
    int[libMLCP_gv_mMSkyTempleMaxCount_C + 1] lv_nextPotentialTempleTrue;
    int lv_nextPotentialCountTrue;

    // Automatic Variable Declarations
    int auto1CD157AC_ae;
    const int auto1CD157AC_ai = 1;
    int auto9B22148A_val;
    int auto7310A2F8_ae;
    const int auto7310A2F8_ai = 1;
    int auto7F1718AC_ae;
    const int auto7F1718AC_ai = 1;
    int autoB2D9BC69_ae;
    const int autoB2D9BC69_ai = 1;
    int auto1431C042_val;
    int auto07350521_ae;
    const int auto07350521_ai = 1;
    int autoEDC4FCF5_ae;
    const int autoEDC4FCF5_ai = 1;
    int autoB56E7122_val;
    int auto0529CBF6_ae;
    const int auto0529CBF6_ai = 1;
    int auto81386968_ae;
    const int auto81386968_ai = 1;
    int auto45F7DC11_ae;
    const int auto45F7DC11_ai = 1;

    // Variable Initialization

    // Implementation
    if ((lp_removeDisabled == true)) {
        auto1CD157AC_ae = libMLCP_gv_mMSkyTempleCount;
        lv_itTempleIndex = 1;
        for ( ; ( (auto1CD157AC_ai >= 0 && lv_itTempleIndex <= auto1CD157AC_ae) || (auto1CD157AC_ai < 0 && lv_itTempleIndex >= auto1CD157AC_ae) ) ; lv_itTempleIndex += auto1CD157AC_ai ) {
            if ((libMLCP_gv_mMSkyTempleBlessTemplesDisabledForNext[lv_itTempleIndex] == false)) {
                lv_nextPotentialCountTrue += 1;
                lv_nextPotentialTempleTrue[lv_nextPotentialCountTrue] = lv_itTempleIndex;
            }
            else {
                lv_nextPotentialCountFalse += 1;
                lv_nextPotentialTempleFalses[lv_nextPotentialCountFalse] = lv_itTempleIndex;
            }
        }
        auto9B22148A_val = lp_blessCount;
        if (auto9B22148A_val == 1) {
            auto7310A2F8_ae = libMLCP_gv_mMSkyTempleCount;
            lv_itTempleIndex = 1;
            for ( ; ( (auto7310A2F8_ai >= 0 && lv_itTempleIndex <= auto7310A2F8_ae) || (auto7310A2F8_ai < 0 && lv_itTempleIndex >= auto7310A2F8_ae) ) ; lv_itTempleIndex += auto7310A2F8_ai ) {
                libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTempleIndex] = false;
            }
            libMLCP_gv_mMSkyTempleBlessNextTemples[lv_nextPotentialTempleTrue[RandomInt(1, lv_nextPotentialCountTrue)]] = true;
            return ;
        }
        else if (auto9B22148A_val == 2) {
            if ((lv_nextPotentialCountTrue == 2)) {
                auto7F1718AC_ae = libMLCP_gv_mMSkyTempleCount;
                lv_itTempleIndex = 1;
                for ( ; ( (auto7F1718AC_ai >= 0 && lv_itTempleIndex <= auto7F1718AC_ae) || (auto7F1718AC_ai < 0 && lv_itTempleIndex >= auto7F1718AC_ae) ) ; lv_itTempleIndex += auto7F1718AC_ai ) {
                    libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTempleIndex] = !(libMLCP_gv_mMSkyTempleBlessTemplesDisabledForNext[lv_itTempleIndex]);
                }
                return ;
            }

        }
        else {
        }
    }

    autoB2D9BC69_ae = libMLCP_gv_mMSkyTempleCount;
    lv_itTempleIndex = 1;
    for ( ; ( (autoB2D9BC69_ai >= 0 && lv_itTempleIndex <= autoB2D9BC69_ae) || (autoB2D9BC69_ai < 0 && lv_itTempleIndex >= autoB2D9BC69_ae) ) ; lv_itTempleIndex += autoB2D9BC69_ai ) {
        if ((libMLCP_gv_mMSkyTempleBlessLastTemples[lv_itTempleIndex] == true)) {
            lv_nextPotentialCountTrue += 1;
            lv_nextPotentialTempleTrue[lv_nextPotentialCountTrue] = lv_itTempleIndex;
        }
        else {
            lv_nextPotentialCountFalse += 1;
            lv_nextPotentialTempleFalses[lv_nextPotentialCountFalse] = lv_itTempleIndex;
        }
    }
    if ((lp_blessCount == lv_nextPotentialCountTrue) && (lp_blessCount != 3)) {
        auto1431C042_val = lp_blessCount;
        if (auto1431C042_val == 1) {
            auto07350521_ae = libMLCP_gv_mMSkyTempleCount;
            lv_itTempleIndex = 1;
            for ( ; ( (auto07350521_ai >= 0 && lv_itTempleIndex <= auto07350521_ae) || (auto07350521_ai < 0 && lv_itTempleIndex >= auto07350521_ae) ) ; lv_itTempleIndex += auto07350521_ai ) {
                libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTempleIndex] = false;
            }
            libMLCP_gv_mMSkyTempleBlessNextTemples[lv_nextPotentialTempleFalses[RandomInt(1, lv_nextPotentialCountFalse)]] = true;
        }
        else if (auto1431C042_val == 2) {
            autoEDC4FCF5_ae = libMLCP_gv_mMSkyTempleCount;
            lv_itTempleIndex = 1;
            for ( ; ( (autoEDC4FCF5_ai >= 0 && lv_itTempleIndex <= autoEDC4FCF5_ae) || (autoEDC4FCF5_ai < 0 && lv_itTempleIndex >= autoEDC4FCF5_ae) ) ; lv_itTempleIndex += autoEDC4FCF5_ai ) {
                libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTempleIndex] = false;
            }
            libMLCP_gv_mMSkyTempleBlessNextTemples[lv_nextPotentialTempleFalses[1]] = true;
            libMLCP_gv_mMSkyTempleBlessNextTemples[lv_nextPotentialTempleTrue[RandomInt(1, lv_nextPotentialCountTrue)]] = true;
        }
        else {
        }
        return ;
    }

    autoB56E7122_val = lp_blessCount;
    if (autoB56E7122_val == 1) {
        auto0529CBF6_ae = libMLCP_gv_mMSkyTempleCount;
        lv_itTempleIndex = 1;
        for ( ; ( (auto0529CBF6_ai >= 0 && lv_itTempleIndex <= auto0529CBF6_ae) || (auto0529CBF6_ai < 0 && lv_itTempleIndex >= auto0529CBF6_ae) ) ; lv_itTempleIndex += auto0529CBF6_ai ) {
            libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTempleIndex] = false;
        }
        libMLCP_gv_mMSkyTempleBlessNextTemples[RandomInt(1, libMLCP_gv_mMSkyTempleCount)] = true;
    }
    else if (autoB56E7122_val == 2) {
        auto81386968_ae = libMLCP_gv_mMSkyTempleCount;
        lv_itTempleIndex = 1;
        for ( ; ( (auto81386968_ai >= 0 && lv_itTempleIndex <= auto81386968_ae) || (auto81386968_ai < 0 && lv_itTempleIndex >= auto81386968_ae) ) ; lv_itTempleIndex += auto81386968_ai ) {
            libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTempleIndex] = true;
        }
        libMLCP_gv_mMSkyTempleBlessNextTemples[RandomInt(1, libMLCP_gv_mMSkyTempleCount)] = false;
    }
    else if (autoB56E7122_val == 3) {
        auto45F7DC11_ae = libMLCP_gv_mMSkyTempleCount;
        lv_itTempleIndex = 1;
        for ( ; ( (auto45F7DC11_ai >= 0 && lv_itTempleIndex <= auto45F7DC11_ae) || (auto45F7DC11_ai < 0 && lv_itTempleIndex >= auto45F7DC11_ae) ) ; lv_itTempleIndex += auto45F7DC11_ai ) {
            libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTempleIndex] = true;
        }
    }
    else {
    }
}

void libMLCP_gf_MMSkyTempleNextTemplesLogic () {
    // Variable Declarations
    int lv_nextIndex;
    int lv_itTempleIndex;
    int lv_blessCount;
    int lv_thirdStageIndex;
    int lv_availableCount;

    // Automatic Variable Declarations
    int auto0E14EC3A_ae;
    const int auto0E14EC3A_ai = 1;
    int autoA367FA1B_val;
    int auto7B0ED323_ae;
    const int auto7B0ED323_ai = 1;
    int autoA13233C6_ae;
    const int autoA13233C6_ai = 1;
    int auto03317064_ae;
    const int auto03317064_ai = 1;

    // Variable Initialization

    // Implementation
    lv_nextIndex = (libMLCP_gv_mMSkyTempleBlessIndex + 1);
    auto0E14EC3A_ae = libMLCP_gv_mMSkyTempleCount;
    lv_itTempleIndex = 1;
    for ( ; ( (auto0E14EC3A_ai >= 0 && lv_itTempleIndex <= auto0E14EC3A_ae) || (auto0E14EC3A_ai < 0 && lv_itTempleIndex >= auto0E14EC3A_ae) ) ; lv_itTempleIndex += auto0E14EC3A_ai ) {
        libMLCP_gv_mMSkyTempleBlessLastTemples[lv_itTempleIndex] = libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTempleIndex];
        libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTempleIndex] = false;
    }
    autoA367FA1B_val = lv_nextIndex;
    if (autoA367FA1B_val == 1) {
        libMLCP_gv_mMSkyTempleBlessNextTemples[libMLCP_ge_MMSkyTempleTempleIndex_Top] = true;
        libMLCP_gv_mMSkyTempleBlessNextTemples[libMLCP_ge_MMSkyTempleTempleIndex_Middle] = true;
    }
    else if (autoA367FA1B_val == 2) {
        libMLCP_gv_mMSkyTempleBlessNextTemples[libMLCP_ge_MMSkyTempleTempleIndex_Bottom] = true;
    }
    else if (autoA367FA1B_val == 3) {
        if ((RandomInt(1, 2) == 1)) {
            libMLCP_gv_mMSkyTempleBlessNextTemples[libMLCP_ge_MMSkyTempleTempleIndex_Top] = true;
            libMLCP_gv_mMSkyTempleBlessNextTemples[libMLCP_ge_MMSkyTempleTempleIndex_Bottom] = true;
        }
        else {
            libMLCP_gv_mMSkyTempleBlessNextTemples[libMLCP_ge_MMSkyTempleTempleIndex_Middle] = true;
            libMLCP_gv_mMSkyTempleBlessNextTemples[libMLCP_ge_MMSkyTempleTempleIndex_Bottom] = true;
        }
    }
    else if (autoA367FA1B_val == 4) {
        lv_blessCount = RandomInt(1, 2);
        libMLCP_gv_mMSkyTempleBlessNextTemplesPreviousCount = lv_blessCount;
        libMLCP_gf_MMSkyTempleRandomNextTemples(lv_blessCount, false);
    }
    else if (autoA367FA1B_val == 5) {
        lv_blessCount = (3 - libMLCP_gv_mMSkyTempleBlessNextTemplesPreviousCount);
        auto7B0ED323_ae = libMLCP_gv_mMSkyTempleCount;
        lv_itTempleIndex = 1;
        for ( ; ( (auto7B0ED323_ai >= 0 && lv_itTempleIndex <= auto7B0ED323_ae) || (auto7B0ED323_ai < 0 && lv_itTempleIndex >= auto7B0ED323_ae) ) ; lv_itTempleIndex += auto7B0ED323_ai ) {
            if ((libMLCP_gv_mMSkyTempleBlessTemplesActivation[lv_itTempleIndex] >= libMLCP_gv_mMSkyTempleBlessTemplesActivationGoal[lv_itTempleIndex])) {
                libMLCP_gv_mMSkyTempleBlessTemplesDisabledForNext[lv_itTempleIndex] = true;
            }
            else {
                libMLCP_gv_mMSkyTempleBlessTemplesDisabledForNext[lv_itTempleIndex] = false;
            }
        }
        libMLCP_gf_MMSkyTempleRandomNextTemples(lv_blessCount, true);
    }
    else if (autoA367FA1B_val == 6) {
        if ((libMLCP_gv_mMSkyTempleBlessTemplesActivation[1] > libMLCP_gv_mMSkyTempleBlessTemplesActivation[2])) {
            libMLCP_gv_mMSkyTempleBlessTemplesActivationGoal[1] = 3;
            libMLCP_gv_mMSkyTempleBlessTemplesActivationGoal[2] = 2;
        }
        else if ((libMLCP_gv_mMSkyTempleBlessTemplesActivation[1] < libMLCP_gv_mMSkyTempleBlessTemplesActivation[2])) {
            libMLCP_gv_mMSkyTempleBlessTemplesActivationGoal[1] = 2;
            libMLCP_gv_mMSkyTempleBlessTemplesActivationGoal[2] = 3;
        }
        else if (true) {
            if ((RandomInt(1, 2) == 1)) {
                libMLCP_gv_mMSkyTempleBlessTemplesActivationGoal[1] = 3;
                libMLCP_gv_mMSkyTempleBlessTemplesActivationGoal[2] = 2;
            }
            else {
                libMLCP_gv_mMSkyTempleBlessTemplesActivationGoal[1] = 2;
                libMLCP_gv_mMSkyTempleBlessTemplesActivationGoal[2] = 3;
            }
        }
        autoA13233C6_ae = libMLCP_gv_mMSkyTempleCount;
        lv_itTempleIndex = 1;
        for ( ; ( (autoA13233C6_ai >= 0 && lv_itTempleIndex <= autoA13233C6_ae) || (autoA13233C6_ai < 0 && lv_itTempleIndex >= autoA13233C6_ae) ) ; lv_itTempleIndex += autoA13233C6_ai ) {
            if ((libMLCP_gv_mMSkyTempleBlessTemplesActivation[lv_itTempleIndex] < libMLCP_gv_mMSkyTempleBlessTemplesActivationGoal[lv_itTempleIndex])) {
                libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTempleIndex] = true;
            }
            else {
                libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTempleIndex] = false;
            }
        }
    }
    else {
        if ((libMLCP_gv_mMSkyTempleBless1TempleRepeatCount >= 2)) {
            lv_blessCount = 2;
            libMLCP_gv_mMSkyTempleBless1TempleRepeatCount = 0;
            libMLCP_gv_mMSkyTempleBless2TemplesRepeatCount = 1;
            libMLCP_gf_MMSkyTempleRandomNextTemples(lv_blessCount, false);
        }
        else if ((libMLCP_gv_mMSkyTempleBless2TemplesRepeatCount >= 2)) {
            lv_blessCount = 1;
            libMLCP_gv_mMSkyTempleBless1TempleRepeatCount = 1;
            libMLCP_gv_mMSkyTempleBless2TemplesRepeatCount = 0;
            libMLCP_gf_MMSkyTempleRandomNextTemples(lv_blessCount, false);
        }
        else if (true) {
            lv_blessCount = RandomInt(1, 3);
            if ((lv_blessCount > 1)) {
                lv_blessCount = 2;
                libMLCP_gv_mMSkyTempleBless1TempleRepeatCount = 0;
                libMLCP_gv_mMSkyTempleBless2TemplesRepeatCount += 1;
                libMLCP_gf_MMSkyTempleRandomNextTemples(lv_blessCount, false);
            }

            if ((lv_blessCount == 1)) {
                libMLCP_gv_mMSkyTempleBless2TemplesRepeatCount = 0;
                libMLCP_gv_mMSkyTempleBless1TempleRepeatCount += 1;
                libMLCP_gf_MMSkyTempleRandomNextTemples(lv_blessCount, false);
            }

        }
    }
    if ((lv_nextIndex >= 3)) {
        auto03317064_ae = libMLCP_gv_mMSkyTempleCount;
        lv_itTempleIndex = 1;
        for ( ; ( (auto03317064_ai >= 0 && lv_itTempleIndex <= auto03317064_ae) || (auto03317064_ai < 0 && lv_itTempleIndex >= auto03317064_ae) ) ; lv_itTempleIndex += auto03317064_ai ) {
            if ((libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTempleIndex] == true)) {
                libMLCP_gv_mMSkyTempleBlessTemplesActivation[lv_itTempleIndex] += 1;
            }

        }
    }

}

void libMLCP_gf_MMSkyTemplePrepareTemples () {
    // Variable Declarations
    int lv_itTempleIndex;

    // Automatic Variable Declarations
    int autoBC435CD0_ae;
    const int autoBC435CD0_ai = 1;
    int autoBF6DBD13_val;

    // Variable Initialization

    // Implementation
    TriggerExecute(libMLCP_gt_MMSkyTempleBeaconColor, true, false);
    libMLCP_gf_MMSkyTempleTransmissionTempleActivationWarningQ(PlayerGroupAll());
    autoBC435CD0_ae = libMLCP_gv_mMSkyTempleCount;
    lv_itTempleIndex = 1;
    for ( ; ( (autoBC435CD0_ai >= 0 && lv_itTempleIndex <= autoBC435CD0_ae) || (autoBC435CD0_ai < 0 && lv_itTempleIndex >= autoBC435CD0_ae) ) ; lv_itTempleIndex += autoBC435CD0_ai ) {
        if ((libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTempleIndex] == true)) {
            libCore_gf_CreateMinimapPingStorm(PlayerGroupAll(), "StormAlert", libMLCP_gf_MMSkyTempleLocation(lv_itTempleIndex), Color(100.00, 100.00, 0.00), 4.0);
            SoundPlayAtPointForPlayer(SoundLink("UI_Game_Ping_LuxoriaTemple_Spawned", -1), c_maxPlayers, PlayerGroupAll(), libMLCP_gf_MMSkyTempleLocation(lv_itTempleIndex), 0.0, 100.0, 0.0);
            libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple, "SetMinimapVisibility");
            libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple, "SetMinimapVisibilityAlways");
            libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_minimapIcon, "MinimapIconTintColor 255,217,186,123");
            autoBF6DBD13_val = lv_itTempleIndex;
            if (autoBF6DBD13_val == libMLCP_ge_MMSkyTempleTempleIndex_Top) {
                libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple, "MinimapTooltip DOCSTR_TempleCroc");
                libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_minimapIcon, "MinimapTooltip DOCSTR_TempleCroc");
            }
            else if (autoBF6DBD13_val == libMLCP_ge_MMSkyTempleTempleIndex_Middle) {
                libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple, "MinimapTooltip DOCSTR_TempleSnake");
                libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_minimapIcon, "MinimapTooltip DOCSTR_TempleSnake");
            }
            else if (autoBF6DBD13_val == libMLCP_ge_MMSkyTempleTempleIndex_Bottom) {
                libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple, "MinimapTooltip DOCSTR_TempleJackal");
                libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_minimapIcon, "MinimapTooltip DOCSTR_TempleJackal");
            }
            else {
            }
            libMLCP_gf_MMSkyTemplePrepareTempleDefenders(lv_itTempleIndex);
            AddUnitOfInterest(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_beacon, libMLCP_gv_mMSkyTempleTempleCaptureRadius_C, 0.0, "TempleBeacon", libNtve_ge_GoalTeam_Both, libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_beaconIndex);
        }

    }
    TimerStart(libMLCP_gv_mMSkyTempleBlessingWarningTimer, libMLCP_gv_mMSkyTempleTempleBlessWarningTime, false, c_timeGame);
}

void libMLCP_gf_MMSkyTempleSetupPreview () {
    // Variable Declarations
    int lv_itTempleIndex;

    // Automatic Variable Declarations
    int auto4C700B01_ae;
    const int auto4C700B01_ai = 1;

    // Variable Initialization

    // Implementation
    libMLCP_gf_MMSkyTempleNextTemplesLogic();
    auto4C700B01_ae = libMLCP_gv_mMSkyTempleCount;
    lv_itTempleIndex = 1;
    for ( ; ( (auto4C700B01_ai >= 0 && lv_itTempleIndex <= auto4C700B01_ae) || (auto4C700B01_ai < 0 && lv_itTempleIndex >= auto4C700B01_ae) ) ; lv_itTempleIndex += auto4C700B01_ai ) {
        if ((libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTempleIndex] == true)) {
            libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_minimapIcon, "SetMinimapVisibility 1");
            libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_minimapIcon, "SetMinimapVisibilityAlways 1");
            libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_minimapIcon, "MinimapIconTintColor 255,145,113,218");
            libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple, "MinimapTooltip DOCSTR_TemplePreview");
            libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_minimapIcon, "MinimapTooltip DOCSTR_TemplePreview");
        }
        else {
            libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_minimapIcon, "SetMinimapVisibility");
            libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_minimapIcon, "SetMinimapVisibilityAlways");
        }
    }
}

trigger auto_libMLCP_gf_MMSkyTempleBlessTemple_Trigger = null;
int auto_libMLCP_gf_MMSkyTempleBlessTemple_lp_templeIndex;

void libMLCP_gf_MMSkyTempleBlessTemple (int lp_templeIndex) {
    auto_libMLCP_gf_MMSkyTempleBlessTemple_lp_templeIndex = lp_templeIndex;

    if (auto_libMLCP_gf_MMSkyTempleBlessTemple_Trigger == null) {
        auto_libMLCP_gf_MMSkyTempleBlessTemple_Trigger = TriggerCreate("auto_libMLCP_gf_MMSkyTempleBlessTemple_TriggerFunc");
    }

    TriggerExecute(auto_libMLCP_gf_MMSkyTempleBlessTemple_Trigger, false, false);
}

bool auto_libMLCP_gf_MMSkyTempleBlessTemple_TriggerFunc (bool testConds, bool runActions) {
    int lp_templeIndex = auto_libMLCP_gf_MMSkyTempleBlessTemple_lp_templeIndex;

    // Automatic Variable Declarations
    // Implementation
    if ((libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_blessed == true)) {
        return true;
    }

    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_blessed = true;
    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_finalStage = false;
    StatEventCreate("SkyTempleActivated");
    StatEventAddDataInt(StatEventLastCreated(), "Event", libMLCP_gv_mMSkyTempleBlessIndex);
    StatEventAddDataInt(StatEventLastCreated(), "TempleID", lp_templeIndex);
    StatEventAddDataFixed(StatEventLastCreated(), "GameTime", libUIUI_gf_HeroesGameTime());
    StatEventSend(StatEventLastCreated());
    libCore_gf_CreateMinimapPingStorm(PlayerGroupAll(), "StormAlert", libMLCP_gf_MMSkyTempleLocation(lp_templeIndex), Color(100.00, 100.00, 0.00), 6.0);
    SoundPlayAtPointForPlayer(SoundLink("UI_Game_Ping_LuxoriaTemple_Ready", -1), c_maxPlayers, PlayerGroupAll(), libMLCP_gf_MMSkyTempleLocation(lp_templeIndex), 0.0, 100.0, 0.0);
    libGame_gf_CapturePointEnable(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_beaconIndex);
    libCore_gf_SendActorMessageToDoodadsInRegion("Signal ActivateCapturePoint", RegionCircle(UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple), 12.0), null);
    UnitSetPropertyFixed(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, c_unitPropEnergyMax, libMLCP_gv_mMSkyTempleTempleTotalShots);
    UnitSetPropertyFixed(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, c_unitPropEnergyPercent, 100.0);
    libGame_gf_UpdateScalingForUnit(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, libGame_gv_scalingTicks, UnitBehaviorCount(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleScaling"));
    libMLCP_gf_MMSkyTempleBlessingProgress(lp_templeIndex);
    return true;
}

trigger auto_libMLCP_gf_MMSkyTempleBlessTempleDone_Trigger = null;
int auto_libMLCP_gf_MMSkyTempleBlessTempleDone_lp_templeIndex;

void libMLCP_gf_MMSkyTempleBlessTempleDone (int lp_templeIndex) {
    auto_libMLCP_gf_MMSkyTempleBlessTempleDone_lp_templeIndex = lp_templeIndex;

    if (auto_libMLCP_gf_MMSkyTempleBlessTempleDone_Trigger == null) {
        auto_libMLCP_gf_MMSkyTempleBlessTempleDone_Trigger = TriggerCreate("auto_libMLCP_gf_MMSkyTempleBlessTempleDone_TriggerFunc");
    }

    TriggerExecute(auto_libMLCP_gf_MMSkyTempleBlessTempleDone_Trigger, false, false);
}

bool auto_libMLCP_gf_MMSkyTempleBlessTempleDone_TriggerFunc (bool testConds, bool runActions) {
    int lp_templeIndex = auto_libMLCP_gf_MMSkyTempleBlessTempleDone_lp_templeIndex;

    // Variable Declarations
    unit lv_itDefender;
    unit lv_target;
    unit lv_itTornado;

    // Automatic Variable Declarations
    unitgroup autoCA0226CA_g;
    int autoCA0226CA_u;

    // Variable Initialization

    // Implementation
    if ((libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_blessed == false)) {
        return true;
    }

    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_progress = 0.0;
    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_spawnStage = 0;
    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_targetUnit = null;
    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderAIIndex = 0;
    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_finalStage = true;
    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_finalShots = libMLCP_gv_mMSkyTempleTempleFinalShotCount_C;
    libMLCP_gf_MMSkyTempleBlessTempleFinalBlast(lp_templeIndex);
    libMLCP_gf_MMSkyTempleClearTargetRevealers(lp_templeIndex, 6.0);
    libNtve_gf_PlayAnimation(libNtve_gf_MainActorofUnit(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_beacon), c_animNameDefault, "Spell", c_animFlagNonLooping, c_animTimeDefault);
    libGame_gv_capturePoints[libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_beaconIndex].lv_enabled = false;
    Wait(1.0, c_timeGame);
    ActorSend(libNtve_gf_MainActorofUnit(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_beacon), "Signal Hide");
    autoCA0226CA_g = libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defendersActivated;
    autoCA0226CA_u = UnitGroupCount(autoCA0226CA_g, c_unitCountAll);
    for (;; autoCA0226CA_u -= 1) {
        lv_itDefender = UnitGroupUnitFromEnd(autoCA0226CA_g, autoCA0226CA_u);
        if (lv_itDefender == null) { break; }
        libMLCP_gf_MMSkyTempleDeactivateTempleDefender(lv_itDefender);
    }
    Wait(3.5, c_timeGame);
    if ((UnitHasBehavior2(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleStage1") == true)) {
        UnitBehaviorRemovePlayer(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleStage1", libCore_gv_cOMPUTER_Neutral, 1);
    }

    Wait(1.0, c_timeGame);
    libGame_gv_capturePoints[libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_beaconIndex].lv_enabled = true;
    libGame_gf_CapturePointDisable(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_beaconIndex);
    libCore_gf_SendActorMessageToDoodadsInRegion("Signal DeactivateCapturePoint", RegionCircle(UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple), 12.0), null);
    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_blessed = false;
    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "SetMinimapVisibility");
    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "SetMinimapVisibilityAlways");
    RemoveUnitOfInterest(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_beacon, "TempleBeacon", libNtve_ge_GoalTeam_Both);
    return true;
}

int libMLCP_gf_MMSkyTempleActivateTempleCount (bool lp_next) {
    // Variable Declarations
    int lv_count;
    int lv_itTemple;

    // Automatic Variable Declarations
    int autoD87CA2A2_ae;
    const int autoD87CA2A2_ai = 1;
    int auto642F9B19_ae;
    const int auto642F9B19_ai = 1;

    // Variable Initialization

    // Implementation
    if ((lp_next == true)) {
        auto642F9B19_ae = libMLCP_gv_mMSkyTempleCount;
        lv_itTemple = 1;
        for ( ; ( (auto642F9B19_ai >= 0 && lv_itTemple <= auto642F9B19_ae) || (auto642F9B19_ai < 0 && lv_itTemple >= auto642F9B19_ae) ) ; lv_itTemple += auto642F9B19_ai ) {
            if ((libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTemple] == true)) {
                lv_count += 1;
            }

        }
    }
    else {
        autoD87CA2A2_ae = libMLCP_gv_mMSkyTempleCount;
        lv_itTemple = 1;
        for ( ; ( (autoD87CA2A2_ai >= 0 && lv_itTemple <= autoD87CA2A2_ae) || (autoD87CA2A2_ai < 0 && lv_itTemple >= autoD87CA2A2_ae) ) ; lv_itTemple += autoD87CA2A2_ai ) {
            if ((libMLCP_gv_mMSkyTemples[lv_itTemple].lv_blessed == true)) {
                lv_count += 1;
            }

        }
    }
    return lv_count;
}

bool libMLCP_gf_MMSkyTempleAnyTempleActive () {
    // Variable Declarations
    int lv_itTempleIndex;

    // Automatic Variable Declarations
    int autoB5B817F5_ae;

    // Variable Initialization

    // Implementation
    autoB5B817F5_ae = libMLCP_gv_mMSkyTempleCount;
    lv_itTempleIndex = 1;
    for ( ; lv_itTempleIndex <= autoB5B817F5_ae ; lv_itTempleIndex += 1 ) {
        if ((libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_blessed == true) && (UnitIsValid(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_beacon) == true)) {
            return true;
        }

    }
    return false;
}

void libMLCP_gf_MMSkyTemplePrepareTempleDefenders (int lp_templeIndex) {
    // Variable Declarations
    int lv_bossPosIndex;
    int lv_itMinion;
    unit lv_itHero;

    // Automatic Variable Declarations
    int auto2F3AA251_val;
    unitgroup auto18908D08_g;
    int auto18908D08_u;
    const int autoC862D788_ae = 5;
    const int autoC862D788_ai = 1;
    int autoF532BFE8_val;

    // Variable Initialization

    // Implementation
    libNtve_gf_CreateUnitsAtPoint2(1, "TempleGuardianBoss", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Hostile, libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderSpawnPoints[1], null);
    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderArray[1] = UnitLastCreated();
    libNtve_gf_ShowHideUnit(UnitLastCreated(), false);
    libNtve_gf_PauseUnit(UnitLastCreated(), true);
    libNtve_gf_MakeUnitInvulnerable(UnitLastCreated(), true);
    UnitSetState(UnitLastCreated(), c_unitStateTargetable, false);
    UnitSetState(UnitLastCreated(), c_unitStateStatusBar, false);
    libNtve_gf_PlayAnimation(libNtve_gf_MainActorofUnit(UnitLastCreated()), c_animNameDefault, "Stand", 0, 0.0);
    libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "AnimSetPausedAll");
    Wait(0.0625, c_timeGame);
    ActorSend(libNtve_gf_ActorLastCreated(), "AnimSetPausedAll");
    auto2F3AA251_val = lp_templeIndex;
    if (auto2F3AA251_val == 1) {
        libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "ModelSwap TempleDefenderMeleeBossCroc");
        libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "SetGroupIcon 0 Assets\\Textures\\Storm_UI_InGame_TargetInfoPanel_Unit_SkyTemple_Merc_Temple_Croc_Melee.dds");
    }
    else if (auto2F3AA251_val == 2) {
        libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "ModelSwap TempleDefenderMeleeBossSnake");
        libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "SetGroupIcon 0 Assets\\Textures\\Storm_UI_InGame_TargetInfoPanel_Unit_SkyTemple_Merc_Temple_Snake_Melee.dds");
    }
    else if (auto2F3AA251_val == 3) {
        libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "ModelSwap TempleDefenderMeleeBossJackal");
        libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "SetGroupIcon 0 Assets\\Textures\\Storm_UI_InGame_TargetInfoPanel_Unit_SkyTemple_Merc_Temple_Jackal_Melee.dds");
    }
    else {
    }
    libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue(lp_templeIndex, 1, UnitLastCreated());
    auto18908D08_g = UnitGroup(null, c_playerAny, RegionCircle(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_blockerLoc, 2.0), libCore_gv_filtersHeroic, 0);
    auto18908D08_u = UnitGroupCount(auto18908D08_g, c_unitCountAll);
    for (;; auto18908D08_u -= 1) {
        lv_itHero = UnitGroupUnitFromEnd(auto18908D08_g, auto18908D08_u);
        if (lv_itHero == null) { break; }
        UnitSetPosition(lv_itHero, PointWithOffset(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_blockerLoc, 0.0, -2.0), true);
    }
    libNtve_gf_CreateUnitsWithDefaultFacing(1, "TempleDefenderPathingBlocker", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Neutral, libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_blockerLoc, null);
    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderBossPathingBlocker = UnitLastCreated();
    lv_itMinion = 2;
    for ( ; ( (autoC862D788_ai >= 0 && lv_itMinion <= autoC862D788_ae) || (autoC862D788_ai < 0 && lv_itMinion >= autoC862D788_ae) ) ; lv_itMinion += autoC862D788_ai ) {
        libNtve_gf_CreateUnitsAtPoint2(1, "TempleDefenderRanged", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Hostile, libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderSpawnPoints[lv_itMinion], null);
        libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderArray[lv_itMinion] = UnitLastCreated();
        libNtve_gf_ShowHideUnit(UnitLastCreated(), false);
        libNtve_gf_PauseUnit(UnitLastCreated(), true);
        libNtve_gf_MakeUnitInvulnerable(UnitLastCreated(), true);
        UnitSetState(UnitLastCreated(), c_unitStateTargetable, false);
        UnitSetState(UnitLastCreated(), c_unitStateStatusBar, false);
        autoF532BFE8_val = lp_templeIndex;
        if (autoF532BFE8_val == 1) {
            libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "ModelSwap TempleDefenderRangedCroc");
            libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "SetGroupIcon 0 Assets\\Textures\\Storm_UI_InGame_TargetInfoPanel_Unit_SkyTemple_Merc_Temple_Croc_Ranged.dds");
        }
        else if (autoF532BFE8_val == 2) {
            libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "ModelSwap TempleDefenderRangedSnake");
            libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "SetGroupIcon 0 Assets\\Textures\\Storm_UI_InGame_TargetInfoPanel_Unit_SkyTemple_Merc_Temple_Snake_Ranged.dds");
        }
        else if (autoF532BFE8_val == 3) {
            libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "ModelSwap TempleDefenderRangedJackal");
            libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "SetGroupIcon 0 Assets\\Textures\\Storm_UI_InGame_TargetInfoPanel_Unit_SkyTemple_Merc_Temple_Jackal_Ranged.dds");
        }
        else {
        }
        libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue(lp_templeIndex, lv_itMinion, UnitLastCreated());
    }
}

trigger auto_libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue_Trigger = null;
int auto_libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue_lp_templeIndex;
int auto_libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue_lp_defenderIndex;
unit auto_libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue_lp_defender;

void libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue (int lp_templeIndex, int lp_defenderIndex, unit lp_defender) {
    auto_libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue_lp_templeIndex = lp_templeIndex;
    auto_libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue_lp_defenderIndex = lp_defenderIndex;
    auto_libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue_lp_defender = lp_defender;

    if (auto_libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue_Trigger == null) {
        auto_libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue_Trigger = TriggerCreate("auto_libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue_TriggerFunc");
    }

    TriggerExecute(auto_libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue_Trigger, false, false);
}

bool auto_libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue_TriggerFunc (bool testConds, bool runActions) {
    int lp_templeIndex = auto_libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue_lp_templeIndex;
    int lp_defenderIndex = auto_libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue_lp_defenderIndex;
    unit lp_defender = auto_libMLCP_gf_MMSkyTemplePrepareTempleDefenderStatue_lp_defender;

    // Automatic Variable Declarations
    int autoA010BAA8_val;
    int auto311C110C_val;

    // Implementation
    libNtve_gf_CreateActorAtPoint("TempleDefenderBirthActor", UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderArray[lp_defenderIndex]));
    if ((lp_defenderIndex == 1)) {
        auto311C110C_val = lp_templeIndex;
        if (auto311C110C_val == 1) {
            ActorSend(libNtve_gf_ActorLastCreated(), "Signal MeleeCroc");
        }
        else if (auto311C110C_val == 2) {
            ActorSend(libNtve_gf_ActorLastCreated(), "Signal MeleeSnake");
        }
        else if (auto311C110C_val == 3) {
            ActorSend(libNtve_gf_ActorLastCreated(), "Signal MeleeJackal");
        }
        else {
            return true;
        }
    }
    else {
        autoA010BAA8_val = lp_templeIndex;
        if (autoA010BAA8_val == 1) {
            ActorSend(libNtve_gf_ActorLastCreated(), "Signal RangedCroc");
        }
        else if (autoA010BAA8_val == 2) {
            ActorSend(libNtve_gf_ActorLastCreated(), "Signal RangedSnake");
        }
        else if (autoA010BAA8_val == 3) {
            ActorSend(libNtve_gf_ActorLastCreated(), "Signal RangedJackal");
        }
        else {
            return true;
        }
    }
    libNtve_gf_MakeModelFaceAngle(libNtve_gf_ActorLastCreated(), UnitGetFacing(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderArray[lp_defenderIndex]));
    libCore_gf_StoreActorForUnit(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderArray[lp_defenderIndex], 1, libNtve_gf_ActorLastCreated());
    ActorSend(libNtve_gf_ActorLastCreated(), "AnimBracketStart Statue Stand,Work,Start Stand,Work Stand,Work,End 0 0.000000");
    ActorSend(libNtve_gf_ActorLastCreated(), "SetPlayerId");
    ActorSend(libNtve_gf_ActorLastCreated(), "SetVisibility");
    Wait(0.0625, c_timeGame);
    ActorSend(libNtve_gf_ActorLastCreated(), "SetVisibility 1");
    return true;
}

void libMLCP_gf_MMSkyTempleActivateTempleDefenderWaves (int lp_templeIndex, int lp_stage) {
    // Variable Declarations
    const int lv_leashRadius = 10;
    unitgroup lv_newUnits;
    int[3] lv_stageMinionIndexes;
    int lv_itStageMinionIndex;
    int lv_itDefender;

    // Automatic Variable Declarations
    int autoE8BE65EB_val;
    const int autoFDD761F5_ae = 2;
    const int autoFDD761F5_ai = 1;
    int autoA45CF8EE_ae;
    const int autoA45CF8EE_ai = 1;
    int autoCF44A03E_ae;
    const int autoCF44A03E_ai = 1;

    // Variable Initialization
    lv_newUnits = UnitGroupEmpty();

    // Implementation
    autoE8BE65EB_val = lp_stage;
    if (autoE8BE65EB_val == 1) {
        lv_stageMinionIndexes[1] = 1;
        lv_stageMinionIndexes[2] = 0;
    }
    else if (autoE8BE65EB_val == 2) {
        lv_stageMinionIndexes[1] = 2;
        lv_stageMinionIndexes[2] = 3;
    }
    else if (autoE8BE65EB_val == 3) {
        lv_stageMinionIndexes[1] = 4;
        lv_stageMinionIndexes[2] = 5;
    }
    else {
    }
    lv_itStageMinionIndex = 1;
    for ( ; ( (autoFDD761F5_ai >= 0 && lv_itStageMinionIndex <= autoFDD761F5_ae) || (autoFDD761F5_ai < 0 && lv_itStageMinionIndex >= autoFDD761F5_ae) ) ; lv_itStageMinionIndex += autoFDD761F5_ai ) {
        if ((lv_stageMinionIndexes[lv_itStageMinionIndex] > 0)) {
            libMLCP_gf_MMSkyTempleActivateTempleDefender(lp_templeIndex, libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderArray[lv_stageMinionIndexes[lv_itStageMinionIndex]]);
            UnitGroupAdd(lv_newUnits, libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderArray[lv_stageMinionIndexes[lv_itStageMinionIndex]]);
        }

    }
    if ((UnitGroupCount(lv_newUnits, c_unitCountAll) >= 1)) {
        if ((libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderAIIndex == 0)) {
            libAIAI_gf_StartDefenderAI(false, lv_newUnits, RegionCircle(UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_beacon), lv_leashRadius), RegionCircle(UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_beacon), 5.0), false);
            libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderAIIndex = libAIAI_gf_LastCreatedDefenderAI();
            autoCF44A03E_ae = libAIAI_gf_DefenderUnitCount(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderAIIndex);
            lv_itDefender = 1;
            for ( ; ( (autoCF44A03E_ai >= 0 && lv_itDefender <= autoCF44A03E_ae) || (autoCF44A03E_ai < 0 && lv_itDefender >= autoCF44A03E_ae) ) ; lv_itDefender += autoCF44A03E_ai ) {
                libAIAI_gf_SetDefenderLeashLocation(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderAIIndex, lv_itDefender, UnitGetPosition(libAIAI_gf_DefenderUnit(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderAIIndex, lv_itDefender)));
            }
        }
        else {
            libAIAI_gf_AddUnitsToDefenderAI(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderAIIndex, lv_newUnits);
            autoA45CF8EE_ae = libAIAI_gf_DefenderUnitCount(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderAIIndex);
            lv_itDefender = 1;
            for ( ; ( (autoA45CF8EE_ai >= 0 && lv_itDefender <= autoA45CF8EE_ae) || (autoA45CF8EE_ai < 0 && lv_itDefender >= autoA45CF8EE_ae) ) ; lv_itDefender += autoA45CF8EE_ai ) {
                if ((UnitGroupHasUnit(lv_newUnits, libAIAI_gf_DefenderUnit(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderAIIndex, lv_itDefender)) == true)) {
                    libAIAI_gf_SetDefenderLeashLocation(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderAIIndex, lv_itDefender, PointWithOffsetPolar(UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_beacon), 4.6, AngleBetweenPoints(UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_beacon), UnitGetPosition(libAIAI_gf_DefenderUnit(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderAIIndex, lv_itDefender)))));
                }

            }
        }
        UnitGroupAddUnitGroup(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defendersActivated, lv_newUnits);
    }

}

trigger auto_libMLCP_gf_MMSkyTempleActivateTempleDefender_Trigger = null;
int auto_libMLCP_gf_MMSkyTempleActivateTempleDefender_lp_templeIndex;
unit auto_libMLCP_gf_MMSkyTempleActivateTempleDefender_lp_defender;

void libMLCP_gf_MMSkyTempleActivateTempleDefender (int lp_templeIndex, unit lp_defender) {
    auto_libMLCP_gf_MMSkyTempleActivateTempleDefender_lp_templeIndex = lp_templeIndex;
    auto_libMLCP_gf_MMSkyTempleActivateTempleDefender_lp_defender = lp_defender;

    if (auto_libMLCP_gf_MMSkyTempleActivateTempleDefender_Trigger == null) {
        auto_libMLCP_gf_MMSkyTempleActivateTempleDefender_Trigger = TriggerCreate("auto_libMLCP_gf_MMSkyTempleActivateTempleDefender_TriggerFunc");
    }

    TriggerExecute(auto_libMLCP_gf_MMSkyTempleActivateTempleDefender_Trigger, false, false);
}

bool auto_libMLCP_gf_MMSkyTempleActivateTempleDefender_TriggerFunc (bool testConds, bool runActions) {
    int lp_templeIndex = auto_libMLCP_gf_MMSkyTempleActivateTempleDefender_lp_templeIndex;
    unit lp_defender = auto_libMLCP_gf_MMSkyTempleActivateTempleDefender_lp_defender;

    // Variable Declarations
    actor lv_effectActor;

    // Automatic Variable Declarations
    string auto68FB8DFF_val;

    // Variable Initialization

    // Implementation
    lv_effectActor = libCore_gf_ActorStoredForUnit(lp_defender, 1);
    ActorSend(lv_effectActor, "AnimBracketStop Statue");
    auto68FB8DFF_val = UnitGetType(lp_defender);
    if (auto68FB8DFF_val == "TempleGuardianBoss") {
        libGame_gf_UpdateScalingForUnit(lp_defender, libGame_gv_scalingTicks, 0);
        Wait(3.0, c_timeGame);
        UnitRemove(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderBossPathingBlocker);
        libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_defenderBossPathingBlocker = null;
        Wait(2.2, c_timeGame);
        UnitSetState(lp_defender, c_unitStateStatusBar, true);
    }
    else if (auto68FB8DFF_val == "TempleDefenderRanged") {
        libGame_gf_UpdateScalingForUnit(lp_defender, libGame_gv_scalingTicks, 0);
        Wait(4.5, c_timeGame);
        UnitBehaviorAdd(lp_defender, "TempleRangedDefenderBirthDelay", lp_defender, 1);
    }
    else {
    }
    libNtve_gf_ShowHideUnit(lp_defender, true);
    ActorSend(lv_effectActor, "Destroy Immediate");
    libNtve_gf_SendActorMessageToUnit(lp_defender, "AnimSetPausedAll 0");
    libNtve_gf_SendActorMessageToUnit(lp_defender, "AnimPlay Birth Birth 0 0.000000 -1.000000 1.000000 AsTimeScale");
    libNtve_gf_PauseUnit(lp_defender, false);
    libNtve_gf_MakeUnitInvulnerable(lp_defender, false);
    UnitSetState(lp_defender, c_unitStateTargetable, true);
    libNtve_gf_SendActorMessageToUnit(lp_defender, "Signal ActivationSound");
    UnitGroupAdd(libMLCP_gv_mMSkyTempleDefenderWithGlobes, lp_defender);
    return true;
}

trigger auto_libMLCP_gf_MMSkyTempleDeactivateTempleDefender_Trigger = null;
unit auto_libMLCP_gf_MMSkyTempleDeactivateTempleDefender_lp_defender;

void libMLCP_gf_MMSkyTempleDeactivateTempleDefender (unit lp_defender) {
    auto_libMLCP_gf_MMSkyTempleDeactivateTempleDefender_lp_defender = lp_defender;

    if (auto_libMLCP_gf_MMSkyTempleDeactivateTempleDefender_Trigger == null) {
        auto_libMLCP_gf_MMSkyTempleDeactivateTempleDefender_Trigger = TriggerCreate("auto_libMLCP_gf_MMSkyTempleDeactivateTempleDefender_TriggerFunc");
    }

    TriggerExecute(auto_libMLCP_gf_MMSkyTempleDeactivateTempleDefender_Trigger, false, false);
}

bool auto_libMLCP_gf_MMSkyTempleDeactivateTempleDefender_TriggerFunc (bool testConds, bool runActions) {
    unit lp_defender = auto_libMLCP_gf_MMSkyTempleDeactivateTempleDefender_lp_defender;

    // Automatic Variable Declarations
    // Implementation
    UnitGroupRemove(libMLCP_gv_mMSkyTempleDefenderWithGlobes, lp_defender);
    UnitCreateEffectUnit(lp_defender, "KillSquish", lp_defender);
    return true;
}

int libMLCP_gf_MMSkyTempleTempleIndexForDefenders (int lp_defenderAIIndex) {
    // Variable Declarations
    int lv_itTempleIndex;

    // Automatic Variable Declarations
    int auto6E3B4F58_ae;
    const int auto6E3B4F58_ai = 1;

    // Variable Initialization

    // Implementation
    auto6E3B4F58_ae = libMLCP_gv_mMSkyTempleCount;
    lv_itTempleIndex = 1;
    for ( ; ( (auto6E3B4F58_ai >= 0 && lv_itTempleIndex <= auto6E3B4F58_ae) || (auto6E3B4F58_ai < 0 && lv_itTempleIndex >= auto6E3B4F58_ae) ) ; lv_itTempleIndex += auto6E3B4F58_ai ) {
        if ((libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_defenderAIIndex == lp_defenderAIIndex)) {
            return lv_itTempleIndex;
        }

    }
    return 0;
}

unit libMLCP_gf_MMSkyTempleNextTarget (int lp_templeIndex) {
    // Variable Declarations
    int lv_team;
    int lv_nextTownIndex;
    int lv_nextTown;
    int lv_enemyPlayer;
    int lv_enemyTeam;
    unitgroup lv_townOuterLoop;
    unitgroup lv_townInnerLoop;
    unit lv_townHall;
    unit lv_enemyCore;
    int lv_town;
    unitgroup lv_buildings;
    unit lv_itBuilding;

    // Automatic Variable Declarations
    const int auto49769E3F_ae = 6;
    const int auto49769E3F_ai = 1;
    playergroup autoD7A1CC5D_g;
    int autoD7A1CC5D_var;
    unitgroup auto1493EB6F_g;
    int auto1493EB6F_u;

    // Variable Initialization
    lv_townOuterLoop = UnitGroupEmpty();
    lv_townInnerLoop = UnitGroupEmpty();
    lv_buildings = UnitGroupEmpty();

    // Implementation
    if ((UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple) == libCore_gv_cOMPUTER_TeamChaos)) {
        lv_enemyPlayer = libCore_gv_cOMPUTER_TeamOrder;
        lv_enemyCore = libGame_gv_teams[libGame_gv_teamOrderIndex_C].lv_core;
    }
    else {
        lv_enemyPlayer = libCore_gv_cOMPUTER_TeamChaos;
        lv_enemyCore = libGame_gv_teams[libGame_gv_teamChaosIndex_C].lv_core;
    }
    lv_enemyTeam = libGame_gf_TeamNumberOfPlayer(lv_enemyPlayer);
    lv_team = libGame_gf_EnemyTeam(lv_enemyTeam);
    lv_nextTown = 0;
    lv_nextTownIndex = libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_attackTownTargetingIndex[lv_team];
    if ((lv_nextTownIndex <= 0)) {
        lv_nextTownIndex = 1;
    }

    lv_nextTownIndex = lv_nextTownIndex;
    for ( ; ( (auto49769E3F_ai >= 0 && lv_nextTownIndex <= auto49769E3F_ae) || (auto49769E3F_ai < 0 && lv_nextTownIndex >= auto49769E3F_ae) ) ; lv_nextTownIndex += auto49769E3F_ai ) {
        lv_town = libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_attackTownTargetingOrder[lv_team][lv_nextTownIndex];
        if ((libMLCP_gf_MMSkyTempleTownAlive(lv_town, lv_enemyPlayer) == true)) {
            lv_nextTown = lv_town;
            break;
        }

    }
    if ((lv_nextTown <= 0)) {
        libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_attackTownTargetingIndex[lv_team] = 7;
        if ((UnitIsAlive(lv_enemyCore) == true) && (libNtve_gf_UnitIsInvulnerable(lv_enemyCore) == false)) {
            return lv_enemyCore;
        }
        else {
            return null;
        }
    }

    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_attackTownTargetingIndex[lv_team] = lv_nextTownIndex;
    autoD7A1CC5D_g = libGame_gf_PlayersOnTeamHeroes(libGame_gf_TeamNumberOfPlayer(lv_enemyPlayer), true);
    autoD7A1CC5D_var = -1;
    while (true) {
        	autoD7A1CC5D_var = PlayerGroupNextPlayer(autoD7A1CC5D_g, autoD7A1CC5D_var);
        	if (autoD7A1CC5D_var<0) { break; }
        	UnitGroupAddUnitGroup(lv_buildings, UnitGroup(null, autoD7A1CC5D_var, libGame_gv_townTownData[lv_town].lv_townRegion, UnitFilter(0, (1 << (c_targetFilterAITargetableStructure - 32)), (1 << c_targetFilterNoMinionAggro) | (1 << c_targetFilterMissile), (1 << (c_targetFilterStasis - 32)) | (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterInvulnerable - 32))), 0));
    }
    lv_townHall = libGame_gv_townTownData[lv_town].lv_structureUnits[libGame_gv_townTownData[lv_town].lv_townHallIndex];
    if ((UnitIsAlive(lv_townHall) == false)) {
        UnitGroupRemove(lv_buildings, UnitGroupUnit(libNtve_gf_UnitsInRegionWithAllianceToPlayerMatchingCondition(UnitTypeFromString("RagnarosBigRag"), "", "", c_playerAny, c_unitAllianceAny, libGame_gv_townTownData[lv_town].lv_townRegion, UnitFilter(0, (1 << (c_targetFilterAITargetableStructure - 32)), (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), 1));
        return UnitGroupClosestToPoint(lv_buildings, UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple));
    }

    auto1493EB6F_g = lv_buildings;
    auto1493EB6F_u = UnitGroupCount(auto1493EB6F_g, c_unitCountAll);
    for (;; auto1493EB6F_u -= 1) {
        lv_itBuilding = UnitGroupUnitFromEnd(auto1493EB6F_g, auto1493EB6F_u);
        if (lv_itBuilding == null) { break; }
        if ((DistanceBetweenPoints(UnitGetPosition(lv_itBuilding), UnitGetPosition(lv_townHall)) > 10.0)) {
            UnitGroupAdd(lv_townOuterLoop, lv_itBuilding);
        }
        else {
            UnitGroupAdd(lv_townInnerLoop, lv_itBuilding);
        }
    }
    if ((libNtve_gf_UnitGroupIsDead(lv_townOuterLoop) == false)) {
        return UnitGroupClosestToPoint(lv_townOuterLoop, UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple));
    }

    if ((libNtve_gf_UnitGroupIsDead(lv_townInnerLoop) == false)) {
        return UnitGroupClosestToPoint(lv_townInnerLoop, UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple));
    }

    return null;
}

unitgroup libMLCP_gf_MMSkyTempleFinalShotNextTarget (int lp_templeIndex) {
    // Variable Declarations
    int lv_team;
    int lv_nextTownIndex;
    int lv_nextTown;
    int lv_enemyPlayer;
    int lv_enemyTeam;
    unitgroup lv_townOuterLoop;
    unitgroup lv_townInnerLoop;
    unit lv_townHall;
    unit lv_enemyCore;
    int lv_town;
    unitgroup lv_buildings;
    unit lv_itBuilding;
    unitgroup lv_result;

    // Automatic Variable Declarations
    const int autoED281AC5_ae = 6;
    const int autoED281AC5_ai = 1;
    playergroup auto4BA4BE3B_g;
    int auto4BA4BE3B_var;
    unitgroup autoF1FAB08C_g;
    int autoF1FAB08C_u;

    // Variable Initialization
    lv_townOuterLoop = UnitGroupEmpty();
    lv_townInnerLoop = UnitGroupEmpty();
    lv_buildings = UnitGroupEmpty();
    lv_result = UnitGroupEmpty();

    // Implementation
    if ((UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple) == libCore_gv_cOMPUTER_TeamChaos)) {
        lv_enemyPlayer = libCore_gv_cOMPUTER_TeamOrder;
        lv_enemyCore = libGame_gv_teams[libGame_gv_teamOrderIndex_C].lv_core;
    }
    else {
        lv_enemyPlayer = libCore_gv_cOMPUTER_TeamChaos;
        lv_enemyCore = libGame_gv_teams[libGame_gv_teamChaosIndex_C].lv_core;
    }
    lv_enemyTeam = libGame_gf_TeamNumberOfPlayer(lv_enemyPlayer);
    lv_team = libGame_gf_EnemyTeam(lv_enemyTeam);
    lv_nextTown = 0;
    lv_nextTownIndex = libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_attackTownTargetingIndex[lv_team];
    if ((lv_nextTownIndex <= 0)) {
        lv_nextTownIndex = 1;
    }

    lv_nextTownIndex = lv_nextTownIndex;
    for ( ; ( (autoED281AC5_ai >= 0 && lv_nextTownIndex <= autoED281AC5_ae) || (autoED281AC5_ai < 0 && lv_nextTownIndex >= autoED281AC5_ae) ) ; lv_nextTownIndex += autoED281AC5_ai ) {
        lv_town = libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_attackTownTargetingOrder[lv_team][lv_nextTownIndex];
        if ((libMLCP_gf_MMSkyTempleTownAlive(lv_town, lv_enemyPlayer) == true)) {
            lv_nextTown = lv_town;
            break;
        }

    }
    if ((lv_nextTown <= 0)) {
        libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_attackTownTargetingIndex[lv_team] = 7;
        if ((UnitIsAlive(lv_enemyCore) == true)) {
            UnitGroupAdd(lv_result, lv_enemyCore);
            return lv_result;
        }
        else {
            return lv_result;
        }
    }

    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_attackTownTargetingIndex[lv_team] = lv_nextTownIndex;
    auto4BA4BE3B_g = libGame_gf_PlayersOnTeamHeroes(libGame_gf_TeamNumberOfPlayer(lv_enemyPlayer), true);
    auto4BA4BE3B_var = -1;
    while (true) {
        	auto4BA4BE3B_var = PlayerGroupNextPlayer(auto4BA4BE3B_g, auto4BA4BE3B_var);
        	if (auto4BA4BE3B_var<0) { break; }
        	UnitGroupAddUnitGroup(lv_buildings, UnitGroup(null, auto4BA4BE3B_var, libGame_gv_townTownData[lv_town].lv_townRegion, UnitFilter(0, (1 << (c_targetFilterAITargetableStructure - 32)), (1 << c_targetFilterNoMinionAggro) | (1 << c_targetFilterMissile), (1 << (c_targetFilterStasis - 32)) | (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterInvulnerable - 32))), 0));
    }
    lv_townHall = libGame_gv_townTownData[lv_town].lv_structureUnits[libGame_gv_townTownData[lv_town].lv_townHallIndex];
    if ((UnitIsAlive(lv_townHall) == false)) {
        UnitGroupRemove(lv_buildings, UnitGroupUnit(libNtve_gf_UnitsInRegionWithAllianceToPlayerMatchingCondition(UnitTypeFromString("RagnarosBigRag"), "", "", c_playerAny, c_unitAllianceAny, libGame_gv_townTownData[lv_town].lv_townRegion, UnitFilter(0, (1 << (c_targetFilterAITargetableStructure - 32)), (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), 1));
        return libMLCP_gf_MMSkyTempleClosestUnits(lv_buildings, 3, UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple));
    }

    autoF1FAB08C_g = lv_buildings;
    autoF1FAB08C_u = UnitGroupCount(autoF1FAB08C_g, c_unitCountAll);
    for (;; autoF1FAB08C_u -= 1) {
        lv_itBuilding = UnitGroupUnitFromEnd(autoF1FAB08C_g, autoF1FAB08C_u);
        if (lv_itBuilding == null) { break; }
        if ((DistanceBetweenPoints(UnitGetPosition(lv_itBuilding), UnitGetPosition(lv_townHall)) > 10.0)) {
            UnitGroupAdd(lv_townOuterLoop, lv_itBuilding);
        }
        else {
            UnitGroupAdd(lv_townInnerLoop, lv_itBuilding);
        }
    }
    if ((libNtve_gf_UnitGroupIsDead(lv_townOuterLoop) == false)) {
        if ((UnitGroupCount(lv_townOuterLoop, c_unitCountAlive) <= 2)) {
            UnitGroupAddUnitGroup(lv_townOuterLoop, libMLCP_gf_MMSkyTempleClosestUnits(lv_townInnerLoop, (3 - UnitGroupCount(lv_townOuterLoop, c_unitCountAlive)), UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple)));
        }

        return lv_townOuterLoop;
    }

    if ((libNtve_gf_UnitGroupIsDead(lv_townInnerLoop) == false)) {
        return lv_townInnerLoop;
    }

    return null;
}

unitgroup libMLCP_gf_MMSkyTempleClosestUnits (unitgroup lp_group, int lp_count, point lp_sourceLocation) {
    // Variable Declarations
    unit lv_itUnitClosest;
    unitgroup lv_sourceGroup;
    int lv_resultCount;
    unitgroup lv_resultGroup;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_sourceGroup = UnitGroupEmpty();
    lv_resultGroup = UnitGroupEmpty();

    // Implementation
    lv_resultCount = lp_count;
    if ((lv_resultCount > UnitGroupCount(lp_group, c_unitCountAlive))) {
        return UnitGroupCopy(lp_group);
    }

    lv_sourceGroup = UnitGroupCopy(lp_group);
    while (true) {
        if ((lv_resultCount <= 0)) {
            break;
        }

        if ((libNtve_gf_UnitGroupIsDead(lv_sourceGroup) == false)) {
            lv_itUnitClosest = UnitGroupClosestToPoint(lv_sourceGroup, lp_sourceLocation);
            UnitGroupAdd(lv_resultGroup, lv_itUnitClosest);
            UnitGroupRemove(lv_sourceGroup, lv_itUnitClosest);
            lv_resultCount -= 1;
        }

    }
    return lv_resultGroup;
}

bool libMLCP_gf_MMSkyTempleTownAlive (int lp_town, int lp_player) {
    // Variable Declarations
    unitgroup lv_buildings;
    unit lv_townhall;

    // Automatic Variable Declarations
    playergroup autoAE19B409_g;
    int autoAE19B409_var;

    // Variable Initialization
    lv_buildings = UnitGroupEmpty();

    // Implementation
    lv_buildings = UnitGroup(null, lp_player, libGame_gv_townTownData[lp_town].lv_townRegion, UnitFilter(0, (1 << (c_targetFilterAITargetableStructure - 32)), (1 << c_targetFilterNoMinionAggro) | (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    if ((UnitIsAlive(libGame_gf_TownTownHall(lp_town)) == true) && (UnitGroupHasUnit(lv_buildings, libGame_gf_TownTownHall(lp_town)) == false)) {
        autoAE19B409_g = libGame_gf_PlayersOnTeamHeroes(libGame_gf_TeamNumberOfPlayer(lp_player), false);
        autoAE19B409_var = -1;
        while (true) {
            	autoAE19B409_var = PlayerGroupNextPlayer(autoAE19B409_g, autoAE19B409_var);
            	if (autoAE19B409_var<0) { break; }
            	UnitGroupAddUnitGroup(lv_buildings, UnitGroup(null, autoAE19B409_var, libGame_gv_townTownData[lp_town].lv_townRegion, UnitFilter(0, (1 << (c_targetFilterAITargetableStructure - 32)), (1 << c_targetFilterNoMinionAggro) | (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
        }
    }

    return !(libNtve_gf_UnitGroupIsDead(lv_buildings));
}

bool libMLCP_gf_MMSkyTempleTownAliveForFinalBlast (int lp_town, int lp_player) {
    // Variable Declarations
    unitgroup lv_buildings;
    unit lv_itBuilding;
    unitgroup lv_buildingsResult;

    // Automatic Variable Declarations
    playergroup auto0897F87A_g;
    int auto0897F87A_var;
    unitgroup autoFE4AFF9A_g;
    int autoFE4AFF9A_u;

    // Variable Initialization
    lv_buildings = UnitGroupEmpty();
    lv_buildingsResult = UnitGroupEmpty();

    // Implementation
    lv_buildings = UnitGroup(null, lp_player, libGame_gv_townTownData[lp_town].lv_townRegion, UnitFilter(0, (1 << (c_targetFilterAITargetableStructure - 32)), (1 << c_targetFilterNoMinionAggro) | (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterInvulnerable - 32))), 0);
    if ((UnitIsAlive(libGame_gf_TownTownHall(lp_town)) == true) && (UnitGroupHasUnit(lv_buildings, libGame_gf_TownTownHall(lp_town)) == false)) {
        auto0897F87A_g = libGame_gf_PlayersOnTeamHeroes(libGame_gf_TeamNumberOfPlayer(lp_player), false);
        auto0897F87A_var = -1;
        while (true) {
            	auto0897F87A_var = PlayerGroupNextPlayer(auto0897F87A_g, auto0897F87A_var);
            	if (auto0897F87A_var<0) { break; }
            	UnitGroupAddUnitGroup(lv_buildings, UnitGroup(null, auto0897F87A_var, libGame_gv_townTownData[lp_town].lv_townRegion, UnitFilter(0, (1 << (c_targetFilterAITargetableStructure - 32)), (1 << c_targetFilterNoMinionAggro) | (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
        }
    }

    autoFE4AFF9A_g = lv_buildings;
    autoFE4AFF9A_u = UnitGroupCount(autoFE4AFF9A_g, c_unitCountAll);
    for (;; autoFE4AFF9A_u -= 1) {
        lv_itBuilding = UnitGroupUnitFromEnd(autoFE4AFF9A_g, autoFE4AFF9A_u);
        if (lv_itBuilding == null) { break; }
        if ((libMLCP_gf_MMSkyTempleBuildingGoodForFinalBlast(lv_itBuilding) == true)) {
            return true;
        }

    }
    return false;
}

bool libMLCP_gf_MMSkyTempleBuildingGoodForFinalBlast (unit lp_building) {
    // Automatic Variable Declarations
    // Implementation
    if ((((UnitIsAlive(lp_building) == true) && (UnitGetPropertyFixed(lp_building, c_unitPropLife, c_unitPropCurrent) >= libMLCP_gv_mMSkyTempleTempleFinalBlastLifeThreshold_C)) || (lp_building == libGame_gv_teams[libGame_gv_teamOrderIndex_C].lv_core) || (lp_building == libGame_gv_teams[libGame_gv_teamChaosIndex_C].lv_core))) {
        return true;
    }

    return false;
}

int libMLCP_gf_MMSkyTempleTempleStage (int lp_index) {
    // Automatic Variable Declarations
    // Implementation
    if ((libMLCP_gv_mMSkyTemples[lp_index].lv_blessed == false)) {
        return 0;
    }
    else {
        if ((libMLCP_gv_mMSkyTemples[lp_index].lv_progress < libMLCP_gv_mMSkyTempleTempleStageDuration_C)) {
            return 1;
        }
        else {
            return 2;
        }
    }
}

trigger auto_libMLCP_gf_MMSkyTempleBlessingProgress_Trigger = null;
int auto_libMLCP_gf_MMSkyTempleBlessingProgress_lp_templeIndex;

void libMLCP_gf_MMSkyTempleBlessingProgress (int lp_templeIndex) {
    auto_libMLCP_gf_MMSkyTempleBlessingProgress_lp_templeIndex = lp_templeIndex;

    if (auto_libMLCP_gf_MMSkyTempleBlessingProgress_Trigger == null) {
        auto_libMLCP_gf_MMSkyTempleBlessingProgress_Trigger = TriggerCreate("auto_libMLCP_gf_MMSkyTempleBlessingProgress_TriggerFunc");
    }

    TriggerExecute(auto_libMLCP_gf_MMSkyTempleBlessingProgress_Trigger, false, false);
}

bool auto_libMLCP_gf_MMSkyTempleBlessingProgress_TriggerFunc (bool testConds, bool runActions) {
    int lp_templeIndex = auto_libMLCP_gf_MMSkyTempleBlessingProgress_lp_templeIndex;

    // Variable Declarations
    fixed lv_timeInterval_C;
    int lv_timeIndex;
    unit lv_target;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_timeInterval_C = 0.25;

    // Implementation
    while (true) {
        if ((libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_blessed == false)) {
            return true;
        }

        if ((UnitHasBehavior2(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleBlessed") == false)) {
            UnitBehaviorAddPlayer(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleBlessed", libCore_gv_cOMPUTER_Neutral, 1);
        }

        libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_progress = (libMLCP_gv_mMSkyTempleTempleStageDuration_C-(UnitGetPropertyFixed(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, c_unitPropEnergy, c_unitPropCurrent)-libMLCP_gv_mMSkyTempleTempleFinalShotCount_C));
        if ((UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple) != libCore_gv_cOMPUTER_Neutral)) {
            if ((libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_progress >= 0.0) && (libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_spawnStage < 1)) {
                libMLCP_gf_MMSkyTempleActivateTempleDefenderWaves(lp_templeIndex, 1);
                libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_spawnStage = 1;
            }
            else if ((libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_progress >= 10.0) && (libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_spawnStage < 2)) {
                libMLCP_gf_MMSkyTempleActivateTempleDefenderWaves(lp_templeIndex, 2);
                libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_spawnStage = 2;
            }
            else if ((libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_progress >= 25.0) && (libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_spawnStage < 3)) {
                libMLCP_gf_MMSkyTempleActivateTempleDefenderWaves(lp_templeIndex, 3);
                libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_spawnStage = 3;
            }
        }

        if ((libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_progress >= libMLCP_gv_mMSkyTempleTempleStageDuration_C) && (UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple) != libCore_gv_cOMPUTER_Neutral) && (UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_beacon) != libCore_gv_cOMPUTER_Neutral)) {
            libMLCP_gf_MMSkyTempleBlessTempleDone(lp_templeIndex);
            return true;
        }

        if ((UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple) != libCore_gv_cOMPUTER_Neutral) && (UnitHasBehavior2(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_beacon, "DisableBeaconBuff") == false)) {
            if ((UnitHasBehavior2(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleStage1") == false)) {
                UnitBehaviorAdd(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleStage1", libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, 1);
            }

            if (((UnitIsAlive(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_targetUnit) == false) || (libNtve_gf_UnitIsInvulnerable(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_targetUnit) == true) || (libNtve_gf_PlayerIsEnemy(UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple), UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_targetUnit), libNtve_ge_PlayerRelation_Enemy) == false))) {
                libMLCP_gf_MMSkyTempleClearTargetRevealers(lp_templeIndex, 6.0);
                lv_target = libMLCP_gf_MMSkyTempleNextTarget(lp_templeIndex);
                if ((UnitIsAlive(lv_target) == true)) {
                    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_targetRevealerCount += 1;
                    VisRevealerCreate(UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple), RegionCircle(UnitGetPosition(lv_target), 5.0));
                    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_targetRevealers[libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_targetRevealerCount] = VisRevealerLastCreated();
                    Wait(0.5, c_timeGame);
                    UnitIssueOrder(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, OrderTargetingUnit(AbilityCommand("attack", 0), lv_target), c_orderQueueReplace);
                    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_targetUnit = lv_target;
                }
                else {
                    libMLCP_gf_MMSkyTempleStopShooting(lp_templeIndex);
                }
            }
            else {
                if ((UnitOrder(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, 0) == null)) {
                    UnitIssueOrder(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, OrderTargetingUnit(AbilityCommand("attack", 0), lv_target), c_orderQueueReplace);
                }

            }
        }
        else {
            if ((UnitHasBehavior2(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleStage1") == true)) {
                UnitBehaviorRemove(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleStage1", 1);
            }

            libMLCP_gf_MMSkyTempleStopShooting(lp_templeIndex);
        }
        Wait(lv_timeInterval_C, c_timeGame);
    }
    return true;
}

trigger auto_libMLCP_gf_MMSkyTempleClearTargetRevealers_Trigger = null;
int auto_libMLCP_gf_MMSkyTempleClearTargetRevealers_lp_templeIndex;
fixed auto_libMLCP_gf_MMSkyTempleClearTargetRevealers_lp_delay;

void libMLCP_gf_MMSkyTempleClearTargetRevealers (int lp_templeIndex, fixed lp_delay) {
    auto_libMLCP_gf_MMSkyTempleClearTargetRevealers_lp_templeIndex = lp_templeIndex;
    auto_libMLCP_gf_MMSkyTempleClearTargetRevealers_lp_delay = lp_delay;

    if (auto_libMLCP_gf_MMSkyTempleClearTargetRevealers_Trigger == null) {
        auto_libMLCP_gf_MMSkyTempleClearTargetRevealers_Trigger = TriggerCreate("auto_libMLCP_gf_MMSkyTempleClearTargetRevealers_TriggerFunc");
    }

    TriggerExecute(auto_libMLCP_gf_MMSkyTempleClearTargetRevealers_Trigger, false, false);
}

bool auto_libMLCP_gf_MMSkyTempleClearTargetRevealers_TriggerFunc (bool testConds, bool runActions) {
    int lp_templeIndex = auto_libMLCP_gf_MMSkyTempleClearTargetRevealers_lp_templeIndex;
    fixed lp_delay = auto_libMLCP_gf_MMSkyTempleClearTargetRevealers_lp_delay;

    // Variable Declarations
    int lv_itRevealer;
    revealer[11] lv_revealers;
    int lv_count;

    // Automatic Variable Declarations
    int auto62B1314A_ae;
    const int auto62B1314A_ai = 1;
    int autoA1E15699_ae;
    const int autoA1E15699_ai = 1;

    // Variable Initialization

    // Implementation
    lv_count = libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_targetRevealerCount;
    if ((lv_count == 0)) {
        return true;
    }

    auto62B1314A_ae = lv_count;
    lv_itRevealer = 1;
    for ( ; ( (auto62B1314A_ai >= 0 && lv_itRevealer <= auto62B1314A_ae) || (auto62B1314A_ai < 0 && lv_itRevealer >= auto62B1314A_ae) ) ; lv_itRevealer += auto62B1314A_ai ) {
        lv_revealers[lv_itRevealer] = libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_targetRevealers[lv_itRevealer];
    }
    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_targetRevealerCount = 0;
    Wait(lp_delay, c_timeGame);
    autoA1E15699_ae = lv_count;
    lv_itRevealer = 1;
    for ( ; ( (autoA1E15699_ai >= 0 && lv_itRevealer <= autoA1E15699_ae) || (autoA1E15699_ai < 0 && lv_itRevealer >= autoA1E15699_ae) ) ; lv_itRevealer += autoA1E15699_ai ) {
        VisRevealerDestroy(lv_revealers[lv_itRevealer]);
    }
    return true;
}

void libMLCP_gf_MMSkyTempleStopShooting (int lp_templeIndex) {
    // Automatic Variable Declarations
    // Implementation
    UnitIssueOrder(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
    libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_targetUnit = null;
    libMLCP_gf_MMSkyTempleClearTargetRevealers(lp_templeIndex, 6.0);
    libMLCP_gf_TempleMasterSendAwardData();
}

string libMLCP_gf_MMSkyTempleShootingBeam (fixed lp_distance) {
    // Automatic Variable Declarations
    // Implementation
    if ((lp_distance > 32.0) && (lp_distance < 36.0)) {
        return "StormPingLightningA";
    }
    else if ((lp_distance > 38.0) && (lp_distance < 42.0)) {
        return "StormPingLightningB";
    }
    else if ((lp_distance > 43.0) && (lp_distance < 47.0)) {
        return "StormPingLightningC";
    }
    else if ((lp_distance > 60.0) && (lp_distance < 64.0)) {
        return "StormPingLightningD";
    }
    else if ((lp_distance > 68.0) && (lp_distance < 72.0)) {
        return "StormPingLightningE";
    }
    else if ((lp_distance > 75.0) && (lp_distance < 80.0)) {
        return "StormPingLightningF";
    }
    else if ((lp_distance > 86.0) && (lp_distance < 88.0)) {
        return "StormPingLightningG";
    }
    else if ((lp_distance > 88.0) && (lp_distance < 91.0)) {
        return "StormPingLightningH";
    }
    else if ((lp_distance > 91.0) && (lp_distance < 95.0)) {
        return "StormPingLightningI";
    }
    else if ((lp_distance > 103.0) && (lp_distance < 108.5)) {
        return "StormPingLightningJ";
    }
    else if ((lp_distance >= 108.5) && (lp_distance <= 131.0)) {
        return "StormPingLightningK";
    }
    else if ((lp_distance > 131.0) && (lp_distance < 133.0)) {
        return "StormPingLightningL";
    }
    return null;
}

trigger auto_libMLCP_gf_MMSkyTempleShootingPing_Trigger = null;
int auto_libMLCP_gf_MMSkyTempleShootingPing_lp_templeIndex;
unit auto_libMLCP_gf_MMSkyTempleShootingPing_lp_target;

void libMLCP_gf_MMSkyTempleShootingPing (int lp_templeIndex, unit lp_target) {
    auto_libMLCP_gf_MMSkyTempleShootingPing_lp_templeIndex = lp_templeIndex;
    auto_libMLCP_gf_MMSkyTempleShootingPing_lp_target = lp_target;

    if (auto_libMLCP_gf_MMSkyTempleShootingPing_Trigger == null) {
        auto_libMLCP_gf_MMSkyTempleShootingPing_Trigger = TriggerCreate("auto_libMLCP_gf_MMSkyTempleShootingPing_TriggerFunc");
    }

    TriggerExecute(auto_libMLCP_gf_MMSkyTempleShootingPing_Trigger, false, false);
}

bool auto_libMLCP_gf_MMSkyTempleShootingPing_TriggerFunc (bool testConds, bool runActions) {
    int lp_templeIndex = auto_libMLCP_gf_MMSkyTempleShootingPing_lp_templeIndex;
    unit lp_target = auto_libMLCP_gf_MMSkyTempleShootingPing_lp_target;

    // Variable Declarations
    int lv_team;
    int lv_enemyTeam;
    point lv_pointStart;
    point lv_pointEnd;
    point lv_pointEnd2;
    fixed lv_distance;
    fixed lv_angle;
    int lv_townIndex;
    int lv_damage;
    string lv_beamModel;
    fixed lv_distanceCenter;
    fixed lv_scaling;
    bool lv_isCore;

    // Automatic Variable Declarations
    unit autoFB2BC9C5_val;
    int auto2BD4C46F_val;

    // Variable Initialization

    // Implementation
    lv_team = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple));
    lv_enemyTeam = libGame_gf_EnemyTeam(lv_team);
    lv_pointStart = UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple);
    lv_pointEnd = UnitGetPosition(lp_target);
    lv_townIndex = libGame_gf_TownGetTownForUnit(lp_target);
    if (((lv_townIndex <= 0) || (lv_townIndex > libGame_gv_townTownCount))) {
        autoFB2BC9C5_val = lp_target;
        if (autoFB2BC9C5_val == libGame_gv_teams[1].lv_core) {
            lv_pointEnd2 = lv_pointEnd;
            lv_isCore = true;
        }
        else if (autoFB2BC9C5_val == libGame_gv_teams[2].lv_core) {
            lv_pointEnd2 = lv_pointEnd;
            lv_isCore = true;
        }
        else {
            return true;
        }
    }
    else {
        lv_pointEnd2 = libGame_gv_townTownData[lv_townIndex].lv_townHallPosition;
    }
    lv_distance = DistanceBetweenPoints(lv_pointStart, lv_pointEnd);
    lv_distanceCenter = DistanceBetweenPoints(lv_pointStart, lv_pointEnd2);
    lv_angle = AngleBetweenPoints(lv_pointStart, lv_pointEnd2);
    lv_beamModel = libMLCP_gf_MMSkyTempleShootingBeam(lv_distanceCenter);
    lv_scaling = 1.0;
    if ((lv_isCore == true)) {
        auto2BD4C46F_val = lp_templeIndex;
        if (auto2BD4C46F_val == libMLCP_ge_MMSkyTempleTempleIndex_Top) {
            lv_beamModel = "StormPingLightningK";
        }
        else if (auto2BD4C46F_val == libMLCP_ge_MMSkyTempleTempleIndex_Middle) {
            lv_beamModel = "StormPingLightningG";
        }
        else if (auto2BD4C46F_val == libMLCP_ge_MMSkyTempleTempleIndex_Bottom) {
            lv_beamModel = "StormPingLightningK";
            lv_scaling = 1.05;
        }
        else {
        }
    }

    libNtve_gf_CreatePingFacingAngleWithType(PlayerGroupAll(), lv_beamModel, lv_pointStart, ColorWithAlpha(0.00, 0.00, 0.00, 0.00), 1.3334, lv_angle, -1, -1);
    PingSetScale(PingLastCreated(), lv_scaling);
    if ((libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_finalStage == false)) {
        lv_damage = CatalogFieldValueGetAsInt(c_gameCatalogEffect, "LuxoriaTempleStage1WeaponDamage", "Amount", UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple));
        lv_damage += (MaxI(UnitBehaviorCount(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleScaling")-1, 0)*20);
    }
    else {
        lv_damage = CatalogFieldValueGetAsInt(c_gameCatalogEffect, "LuxoriaTempleStage2WeaponDamage", "Amount", UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple));
        lv_damage += (MaxI(UnitBehaviorCount(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleScaling")-1, 0)*20);
    }
    return true;
}

trigger auto_libMLCP_gf_MMSkyTempleShootingPingBackup_Trigger = null;
int auto_libMLCP_gf_MMSkyTempleShootingPingBackup_lp_templeIndex;
unit auto_libMLCP_gf_MMSkyTempleShootingPingBackup_lp_target;

void libMLCP_gf_MMSkyTempleShootingPingBackup (int lp_templeIndex, unit lp_target) {
    auto_libMLCP_gf_MMSkyTempleShootingPingBackup_lp_templeIndex = lp_templeIndex;
    auto_libMLCP_gf_MMSkyTempleShootingPingBackup_lp_target = lp_target;

    if (auto_libMLCP_gf_MMSkyTempleShootingPingBackup_Trigger == null) {
        auto_libMLCP_gf_MMSkyTempleShootingPingBackup_Trigger = TriggerCreate("auto_libMLCP_gf_MMSkyTempleShootingPingBackup_TriggerFunc");
    }

    TriggerExecute(auto_libMLCP_gf_MMSkyTempleShootingPingBackup_Trigger, false, false);
}

bool auto_libMLCP_gf_MMSkyTempleShootingPingBackup_TriggerFunc (bool testConds, bool runActions) {
    int lp_templeIndex = auto_libMLCP_gf_MMSkyTempleShootingPingBackup_lp_templeIndex;
    unit lp_target = auto_libMLCP_gf_MMSkyTempleShootingPingBackup_lp_target;

    int init_i;
    int init_j;

    // Variable Declarations
    int[3] lv_pingTarget;
    int[3][31] lv_pingArrow;
    int lv_team;
    int lv_enemyTeam;
    int lv_itTeam;
    point lv_pointStart;
    point lv_pointEnd;
    fixed lv_distance;
    fixed lv_angle;
    point lv_pingLoc;
    fixed lv_pingDistance;
    int lv_pingArrorCount;
    int lv_itPingIndex;

    // Automatic Variable Declarations
    const int autoEA8FAAF2_ae = 2;
    const int autoEA8FAAF2_ai = 1;
    const int auto9FD0F632_ae = 2;
    const int auto9FD0F632_ai = 1;
    const int auto0C55EEF4_ae = 2;
    const int auto0C55EEF4_ai = 1;
    int auto15951192_ae;
    const int auto15951192_ai = 1;

    // Variable Initialization
    for (init_i = 0; init_i <= 2; init_i += 1) {
        lv_pingTarget[init_i] = c_invalidPingId;
    }
    for (init_i = 0; init_i <= 2; init_i += 1) {
        for (init_j = 0; init_j <= 30; init_j += 1) {
            lv_pingArrow[init_i][init_j] = c_invalidPingId;
        }
    }

    // Implementation
    lv_team = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple));
    lv_enemyTeam = libGame_gf_EnemyTeam(lv_team);
    lv_pointStart = UnitGetPosition(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple);
    lv_pointEnd = UnitGetPosition(lp_target);
    lv_angle = AngleBetweenPoints(lv_pointStart, lv_pointEnd);
    lv_distance = DistanceBetweenPoints(lv_pointStart, lv_pointEnd);
    lv_pingDistance = 7.0;
    lv_pingArrorCount = 0;
    while (true) {
        if ((UnitIsAlive(lp_target) == false)) {
            break;
        }

        if (((lv_pingDistance + 5.0) > lv_distance)) {
            break;
        }

        lv_pingArrorCount += 1;
        lv_pingLoc = PointWithOffsetPolar(lv_pointStart, lv_pingDistance, lv_angle);
        lv_itTeam = 1;
        for ( ; ( (autoEA8FAAF2_ai >= 0 && lv_itTeam <= autoEA8FAAF2_ae) || (autoEA8FAAF2_ai < 0 && lv_itTeam >= autoEA8FAAF2_ae) ) ; lv_itTeam += autoEA8FAAF2_ai ) {
            libNtve_gf_CreatePingFacingAngleWithType(libGame_gf_PlayersOnTeamHeroes(lv_itTeam, false), "StormPingArrow", lv_pingLoc, ColorWithAlpha(0.00, 0.00, 0.00, 0.00), 0.0, lv_angle, -1, -1);
            PingSetScale(PingLastCreated(), 0.3);
            if ((lv_itTeam == lv_team)) {
                PingSetColor(PingLastCreated(), Color(0.00, 100.00, 0.00));
            }
            else {
                PingSetColor(PingLastCreated(), Color(100.00, 0.00, 0.00));
            }
            lv_pingArrow[lv_itTeam][lv_pingArrorCount] = PingLastCreated();
        }
        lv_pingDistance += 10.0;
        Wait(0.25, c_timeGame);
    }
    if ((UnitIsAlive(lp_target) == true)) {
        lv_itTeam = 1;
        for ( ; ( (auto9FD0F632_ai >= 0 && lv_itTeam <= auto9FD0F632_ae) || (auto9FD0F632_ai < 0 && lv_itTeam >= auto9FD0F632_ae) ) ; lv_itTeam += auto9FD0F632_ai ) {
            libNtve_gf_CreatePingFacingAngleWithType(libGame_gf_PlayersOnTeamHeroes(lv_itTeam, false), "BeaconAssaultPing", UnitGetPosition(lp_target), ColorWithAlpha(0.00, 0.00, 0.00, 0.00), 0.0, 0.0, -1, -1);
            PingSetScale(PingLastCreated(), 0.3);
            if ((lv_itTeam == lv_team)) {
                PingSetColor(PingLastCreated(), Color(0.00, 100.00, 0.00));
            }
            else {
                PingSetColor(PingLastCreated(), Color(100.00, 0.00, 0.00));
            }
            lv_pingTarget[lv_itTeam] = PingLastCreated();
        }
    }

    while (true) {
        if (((UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple) == libCore_gv_cOMPUTER_Neutral) || (UnitIsAlive(lp_target) == false) || (libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_targetUnit != lp_target))) {
            lv_itTeam = 1;
            for ( ; ( (auto0C55EEF4_ai >= 0 && lv_itTeam <= auto0C55EEF4_ae) || (auto0C55EEF4_ai < 0 && lv_itTeam >= auto0C55EEF4_ae) ) ; lv_itTeam += auto0C55EEF4_ai ) {
                auto15951192_ae = lv_pingArrorCount;
                lv_itPingIndex = 1;
                for ( ; ( (auto15951192_ai >= 0 && lv_itPingIndex <= auto15951192_ae) || (auto15951192_ai < 0 && lv_itPingIndex >= auto15951192_ae) ) ; lv_itPingIndex += auto15951192_ai ) {
                    PingDestroy(lv_pingArrow[lv_itTeam][lv_itPingIndex]);
                }
                PingDestroy(lv_pingTarget[lv_itTeam]);
            }
            return true;
        }

        Wait(0.25, c_timeGame);
    }
    return true;
}

trigger auto_libMLCP_gf_MMSkyTempleBlessTempleFinalBlast_Trigger = null;
int auto_libMLCP_gf_MMSkyTempleBlessTempleFinalBlast_lp_templeIndex;

void libMLCP_gf_MMSkyTempleBlessTempleFinalBlast (int lp_templeIndex) {
    auto_libMLCP_gf_MMSkyTempleBlessTempleFinalBlast_lp_templeIndex = lp_templeIndex;

    if (auto_libMLCP_gf_MMSkyTempleBlessTempleFinalBlast_Trigger == null) {
        auto_libMLCP_gf_MMSkyTempleBlessTempleFinalBlast_Trigger = TriggerCreate("auto_libMLCP_gf_MMSkyTempleBlessTempleFinalBlast_TriggerFunc");
    }

    TriggerExecute(auto_libMLCP_gf_MMSkyTempleBlessTempleFinalBlast_Trigger, false, false);
}

bool auto_libMLCP_gf_MMSkyTempleBlessTempleFinalBlast_TriggerFunc (bool testConds, bool runActions) {
    int lp_templeIndex = auto_libMLCP_gf_MMSkyTempleBlessTempleFinalBlast_lp_templeIndex;

    // Variable Declarations
    unit lv_target;
    point lv_targetLoc;
    unitgroup lv_targetGroup;
    int lv_playerWithMostCaptureTime;

    // Automatic Variable Declarations
    playergroup autoEC67E8F4_g;
    int autoEC67E8F4_var;
    int auto714C43EE_n;
    int auto714C43EE_i;
    const int auto6C306029_n = libMLCP_gv_mMSkyTempleTempleFinalShotCount_C;
    int auto6C306029_i;

    // Variable Initialization
    lv_targetGroup = UnitGroupEmpty();

    // Implementation
    autoEC67E8F4_g = libGame_gf_PlayersOnTeamHeroes(libGame_gf_TeamNumberOfPlayer(UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple)), false);
    autoEC67E8F4_var = -1;
    while (true) {
        	autoEC67E8F4_var = PlayerGroupNextPlayer(autoEC67E8F4_g, autoEC67E8F4_var);
        	if (autoEC67E8F4_var<0) { break; }
        	if ((libGame_gf_CapturePointGetCaptureTimeForCurrentEnabledPointForPlayer(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_beaconIndex, autoEC67E8F4_var) > libGame_gf_CapturePointGetCaptureTimeForCurrentEnabledPointForPlayer(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_beaconIndex, lv_playerWithMostCaptureTime))) {
            lv_playerWithMostCaptureTime = autoEC67E8F4_var;
        }

    }
    libGame_gf_DropLootBannerinSconce(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_bannerSconce, libGame_gv_players[lv_playerWithMostCaptureTime].lv_lootContent.lv_loot_Banner.lv_bannerID, lv_playerWithMostCaptureTime, true);
    UnitBehaviorRemove(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleStage1", 1);
    UnitBehaviorRemove(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleStage2", 1);
    UnitBehaviorAddPlayer(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleFinalBlastChannelBehavior", UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple), 1);
    Wait(0.0625, c_timeGame);
    lv_target = null;
    auto714C43EE_n = FixedToInt((4.0 / 0.125));
    for (auto714C43EE_i = 1; auto714C43EE_i <= auto714C43EE_n; auto714C43EE_i += 1) {
        if ((UnitIsAlive(lv_target) == false)) {
            if ((lv_targetLoc != null)) {
                UnitIssueOrder(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, OrderTargetingPoint(AbilityCommand("LuxoriaTempleTurretRelease", 0), lv_targetLoc), c_orderQueueReplace);
            }

            lv_target = libMLCP_gf_MMSkyTempleNextTarget(lp_templeIndex);
            if ((UnitIsAlive(lv_target) == true)) {
                VisRevealArea(UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple), RegionCircle(UnitGetPosition(lv_target), 5.0), 7.0, false);
                lv_targetLoc = UnitGetPosition(lv_target);
                UnitIssueOrder(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, OrderTargetingUnit(AbilityCommand("LuxoriaTempleTurretHold", 0), lv_target), c_orderQueueReplace);
                libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_targetUnit = lv_target;
            }

        }

        Wait(0.125, c_timeGame);
    }
    UnitBehaviorRemovePlayer(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleFinalBlastChannelBehavior", UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple), 1);
    UnitBehaviorAddPlayer(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleFinalBlastActiveBehavior", UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple), 1);
    for (auto6C306029_i = 1; auto6C306029_i <= auto6C306029_n; auto6C306029_i += 1) {
        lv_target = libMLCP_gf_MMSkyTempleNextTarget(lp_templeIndex);
        VisRevealArea(UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple), RegionCircle(UnitGetPosition(lv_target), 5.0), 5.0, false);
        UnitIssueOrder(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, OrderTargetingUnit(AbilityCommand("LuxoriaTempleTurretHold", 0), lv_target), c_orderQueueReplace);
        libMLCP_gf_MMSkyTempleShootingPing(lp_templeIndex, lv_target);
        Wait(0.0625, c_timeGame);
        if ((UnitIsAlive(lv_target) == false)) {
            lv_target = libMLCP_gf_MMSkyTempleNextTarget(lp_templeIndex);
            VisRevealArea(UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple), RegionCircle(UnitGetPosition(lv_target), 5.0), 5.0, false);
        }

        UnitIssueOrder(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, OrderTargetingUnit(AbilityCommand("LuxoriaTempleFinalBlast", 0), lv_target), c_orderQueueAddToEnd);
        Wait(RandomFixed(0.125, 0.25), c_timeGame);
        libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_finalShots -= 1;
        libMLCP_gf_MMSkyTempleUISetTempleStage(lp_templeIndex, 2, libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_finalShots);
    }
    Wait(1.0, c_timeGame);
    UnitSetPropertyFixed(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, c_unitPropEnergyPercent, 100.0);
    libMLCP_gf_TempleMasterSendAwardData();
    UnitBehaviorRemovePlayer(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, "LuxoriaTempleFinalBlastActiveBehavior", UnitGetOwner(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple), 1);
    if ((lv_targetLoc != null)) {
        UnitIssueOrder(libMLCP_gv_mMSkyTemples[lp_templeIndex].lv_temple, OrderTargetingPoint(AbilityCommand("LuxoriaTempleTurretRelease", 0), lv_targetLoc), c_orderQueueReplace);
    }

    return true;
}

void libMLCP_gf_MMSkyTempleUIInit (int lp_parentPanel) {
    int init_i;

    // Variable Declarations
    int[6] lv_panels;
    int lv_currentPanelLayer;
    int lv_itTemple;
    int lv_itBullets;

    // Automatic Variable Declarations
    const int auto34909C28_ae = 3;
    const int auto34909C28_ai = 1;
    const int autoDAB59C4F_ae = 5;
    const int autoDAB59C4F_ai = 1;

    // Variable Initialization
    for (init_i = 0; init_i <= 5; init_i += 1) {
        lv_panels[init_i] = c_invalidDialogControlId;
    }

    // Implementation
    DialogControlCreateInPanelFromTemplate(lp_parentPanel, c_triggerControlTypePanel, "CapturePoints/CapturePointsPanel");
    DialogControlSetVisible(DialogControlLastCreated(), PlayerGroupAll(), false);
    lv_currentPanelLayer += 1;
    lv_panels[lv_currentPanelLayer] = DialogControlLastCreated();
    libMLCP_gv_mMSkyTemplePanel.lv_mainContainerPanel = DialogControlLastCreated();
    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "TimerModeFrame");
    DialogControlSetVisible(DialogControlLastCreated(), PlayerGroupAll(), false);
    lv_currentPanelLayer += 1;
    lv_panels[lv_currentPanelLayer] = DialogControlLastCreated();
    libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeFrame = DialogControlLastCreated();
    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypeLabel, "TempleActivateLabel");
    libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeNameLabel = DialogControlLastCreated();
    libNtve_gf_SetDialogItemText(DialogControlLastCreated(), StringExternal("Param/Value/lib_MLCP_6E780D54"), PlayerGroupAll());
    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypeLabel, "TempleActivateTimer");
    libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeTimeLabel = DialogControlLastCreated();
    lv_currentPanelLayer -= 1;
    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "TempleModeFrame");
    DialogControlSetVisible(DialogControlLastCreated(), PlayerGroupAll(), true);
    lv_currentPanelLayer += 1;
    lv_panels[lv_currentPanelLayer] = DialogControlLastCreated();
    libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTempleModeFrame = DialogControlLastCreated();
    lv_itTemple = 1;
    for ( ; ( (auto34909C28_ai >= 0 && lv_itTemple <= auto34909C28_ae) || (auto34909C28_ai < 0 && lv_itTemple >= auto34909C28_ae) ) ; lv_itTemple += auto34909C28_ai ) {
        DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "ShrineIndicators"+IntToString(lv_itTemple));
        libMLCP_gv_mMSkyTemplePanelIcons[lv_itTemple].lv_containerPanel = DialogControlLastCreated();
        lv_currentPanelLayer += 1;
        lv_panels[lv_currentPanelLayer] = DialogControlLastCreated();
        DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "FireEffect");
        DialogControlSetVisible(DialogControlLastCreated(), PlayerGroupAll(), false);
        libMLCP_gv_mMSkyTemplePanelIcons[lv_itTemple].lv_fireEffect = DialogControlLastCreated();
        DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypeImage, "ShrineIcon");
        libMLCP_gv_mMSkyTemplePanelIcons[lv_itTemple].lv_shrineIcon = DialogControlLastCreated();
        DialogControlHookup(DialogControlLastCreated(), c_triggerControlTypePanel, "ShrineCaptureProgressMask");
        libMLCP_gv_mMSkyTemplePanelIcons[lv_itTemple].lv_shrineCaptureProgressMask = DialogControlLastCreated();
        DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypeProgressBar, "ShrineProgress");
        DialogControlSetVisible(DialogControlLastCreated(), PlayerGroupAll(), false);
        libMLCP_gv_mMSkyTemplePanelIcons[lv_itTemple].lv_shrineProgress = DialogControlLastCreated();
        DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypeLabel, "CooldownLabel");
        DialogControlSetVisible(DialogControlLastCreated(), PlayerGroupAll(), false);
        libMLCP_gv_mMSkyTemplePanelIcons[lv_itTemple].lv_cooldownLabel = DialogControlLastCreated();
        DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "BulletContainer");
        lv_currentPanelLayer += 1;
        lv_panels[lv_currentPanelLayer] = DialogControlLastCreated();
        lv_itBullets = 1;
        for ( ; ( (autoDAB59C4F_ai >= 0 && lv_itBullets <= autoDAB59C4F_ae) || (autoDAB59C4F_ai < 0 && lv_itBullets >= autoDAB59C4F_ae) ) ; lv_itBullets += autoDAB59C4F_ai ) {
            DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypeImage, "Bullet"+IntToString(lv_itBullets));
            DialogControlSetVisible(DialogControlLastCreated(), PlayerGroupAll(), false);
            libMLCP_gv_mMSkyTemplePanelIcons[lv_itTemple].lv_bullets[lv_itBullets] = DialogControlLastCreated();
        }
        lv_currentPanelLayer -= 1;
        lv_currentPanelLayer -= 1;
    }
    lv_currentPanelLayer -= 1;
    TriggerExecute(libMLCP_gt_MMSkyTempleUIHandler, true, false);
}

void libMLCP_gf_MMSkyTempleUIShowHidePanel (bool lp_showHide) {
    // Automatic Variable Declarations
    // Implementation
    DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanel.lv_mainContainerPanel, PlayerGroupAll(), lp_showHide);
}

void libMLCP_gf_MMSkyTempleUISetMode (int lp_mode) {
    // Variable Declarations
    int lv_templeIndex;

    // Automatic Variable Declarations
    int autoE58CCFFC_val;
    int autoD16269B0_ae;
    const int autoD16269B0_ai = 1;
    int auto89EB967B_ae;
    const int auto89EB967B_ai = 1;
    int auto28B51728_ae;
    const int auto28B51728_ai = 1;

    // Variable Initialization

    // Implementation
    autoE58CCFFC_val = lp_mode;
    if (autoE58CCFFC_val == libMLCP_ge_MMSkyTempleUIModes_Idle) {
        DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeFrame, PlayerGroupAll(), false);
        autoD16269B0_ae = libMLCP_gv_mMSkyTempleCount;
        lv_templeIndex = 1;
        for ( ; ( (autoD16269B0_ai >= 0 && lv_templeIndex <= autoD16269B0_ae) || (autoD16269B0_ai < 0 && lv_templeIndex >= autoD16269B0_ae) ) ; lv_templeIndex += autoD16269B0_ai ) {
            DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanelIcons[lv_templeIndex].lv_cooldownLabel, PlayerGroupAll(), false);
        }
    }
    else if (autoE58CCFFC_val == libMLCP_ge_MMSkyTempleUIModes_Timer) {
        DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeFrame, PlayerGroupAll(), true);
        DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeTimeLabel, PlayerGroupAll(), true);
        if ((libMLCP_gf_MMSkyTempleActivateTempleCount(true) > 1)) {
            libNtve_gf_SetDialogItemText(libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeNameLabel, StringExternal("Param/Value/lib_MLCP_4CECE348"), PlayerGroupAll());
        }
        else {
            libNtve_gf_SetDialogItemText(libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeNameLabel, StringExternal("Param/Value/lib_MLCP_6037C0FB"), PlayerGroupAll());
        }
        auto89EB967B_ae = libMLCP_gv_mMSkyTempleCount;
        lv_templeIndex = 1;
        for ( ; ( (auto89EB967B_ai >= 0 && lv_templeIndex <= auto89EB967B_ae) || (auto89EB967B_ai < 0 && lv_templeIndex >= auto89EB967B_ae) ) ; lv_templeIndex += auto89EB967B_ai ) {
            DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanelIcons[lv_templeIndex].lv_cooldownLabel, PlayerGroupAll(), false);
            if ((libMLCP_gv_mMSkyTempleBlessNextTemples[lv_templeIndex] == true)) {
                DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanelIcons[lv_templeIndex].lv_cooldownLabel, PlayerGroupAll(), true);
            }

        }
    }
    else if (autoE58CCFFC_val == libMLCP_ge_MMSkyTempleUIModes_Temple) {
        DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeFrame, PlayerGroupAll(), true);
        DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeTimeLabel, PlayerGroupAll(), false);
        if ((libMLCP_gf_MMSkyTempleActivateTempleCount(false) > 1)) {
            libNtve_gf_SetDialogItemText(libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeNameLabel, StringExternal("Param/Value/lib_MLCP_1397187F"), PlayerGroupAll());
        }
        else {
            libNtve_gf_SetDialogItemText(libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeNameLabel, StringExternal("Param/Value/lib_MLCP_54E93A1B"), PlayerGroupAll());
        }
        auto28B51728_ae = libMLCP_gv_mMSkyTempleCount;
        lv_templeIndex = 1;
        for ( ; ( (auto28B51728_ai >= 0 && lv_templeIndex <= auto28B51728_ae) || (auto28B51728_ai < 0 && lv_templeIndex >= auto28B51728_ae) ) ; lv_templeIndex += auto28B51728_ai ) {
            DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanelIcons[lv_templeIndex].lv_cooldownLabel, PlayerGroupAll(), false);
            DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanelIcons[lv_templeIndex].lv_fireEffect, PlayerGroupAll(), false);
            DialogControlSetAnimationState(libMLCP_gv_mMSkyTemplePanelIcons[lv_templeIndex].lv_shrineIcon, PlayerGroupAll(), "Ownership", "Order");
        }
    }
    else {
    }
}

void libMLCP_gf_MMSkyTempleUISetWarningTime (int lp_time) {
    // Variable Declarations
    int lv_itTemple;
    text lv_timeLabel;

    // Automatic Variable Declarations
    int autoFF16C892_ae;
    const int autoFF16C892_ai = 1;

    // Variable Initialization

    // Implementation
    if ((lp_time == 0)) {
        lv_timeLabel = StringToText("");
    }
    else {
        lv_timeLabel = TextTimeFormat(StringToText("<mintotal/>:<sec2/>"), lp_time);
    }
    libNtve_gf_SetDialogItemText(libMLCP_gv_mMSkyTemplePanel.lv_capturePointsTimerModeTimeLabel, lv_timeLabel, PlayerGroupAll());
    autoFF16C892_ae = libMLCP_gv_mMSkyTempleCount;
    lv_itTemple = 1;
    for ( ; ( (autoFF16C892_ai >= 0 && lv_itTemple <= autoFF16C892_ae) || (autoFF16C892_ai < 0 && lv_itTemple >= autoFF16C892_ae) ) ; lv_itTemple += autoFF16C892_ai ) {
        libNtve_gf_SetDialogItemText(libMLCP_gv_mMSkyTemplePanelIcons[lv_itTemple].lv_cooldownLabel, lv_timeLabel, PlayerGroupAll());
    }
}

void libMLCP_gf_MMSkyTempleUIEnableDisableTemple (bool lp_enableDisable, int lp_templeIndex) {
    // Automatic Variable Declarations
    // Implementation
    if ((lp_enableDisable == false)) {
        DialogControlSetAnimationState(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_shrineIcon, PlayerGroupAll(), "Ownership", "Disable");
    }

}

void libMLCP_gf_MMSkyTempleUISetTempleCaptureProgress (int lp_templeIndex, int lp_team, int lp_progress, int lp_progerssMax) {
    // Variable Declarations
    int lv_enemyTeam;
    const int lv_width_C = 112;
    const int lv_height_C = 112;
    int lv_height;

    // Automatic Variable Declarations
    // Variable Initialization

    // Implementation
    if ((lp_team == 0)) {
        DialogControlSetAnimationState(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_shrineProgress, PlayerGroupAll(), "Ownership", "Neutral");
        return ;
    }

    lv_enemyTeam = libGame_gf_EnemyTeam(lp_team);
    DialogControlSetAnimationState(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_shrineIcon, libGame_gf_PlayersOnTeamHeroes(lp_team, false), "Ownership", "Order");
    DialogControlSetAnimationState(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_shrineIcon, libGame_gf_PlayersOnTeamHeroes(lv_enemyTeam, false), "Ownership", "Chaos");
    if ((lp_team == libGame_gv_teamOrderIndex_C)) {
        DialogControlSetAnimationState(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_shrineIcon, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], "Ownership", "Order");
    }
    else {
        DialogControlSetAnimationState(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_shrineIcon, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], "Ownership", "Chaos");
    }
    lv_height = FixedToInt((IntToFixed(lp_progress)*IntToFixed(lv_height_C)/lp_progerssMax));
    DialogControlSetSize(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_shrineCaptureProgressMask, PlayerGroupAll(), lv_width_C, lv_height);
}

void libMLCP_gf_MMSkyTempleUISetTempleStage (int lp_templeIndex, int lp_stage, int lp_progress) {
    // Variable Declarations
    int lv_itFinalShot;
    int lv_itBulletsToHide;

    // Automatic Variable Declarations
    int autoE8763B90_val;
    const int autoB7690190_ae = 5;
    const int autoB7690190_ai = 1;
    const int autoFAF19C53_ae = 5;
    const int autoFAF19C53_ai = 1;
    const int auto0FB8CE74_ae = libMLCP_gv_mMSkyTempleTempleFinalShotCount_C;
    const int auto0FB8CE74_ai = 1;

    // Variable Initialization

    // Implementation
    autoE8763B90_val = lp_stage;
    if (autoE8763B90_val == 1) {
        DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_shrineIcon, PlayerGroupAll(), true);
        DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_shrineProgress, PlayerGroupAll(), true);
        libNtve_gf_SetDialogItemCurrentValue(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_shrineProgress, lp_progress, PlayerGroupAll());
        lv_itBulletsToHide = 1;
        for ( ; ( (autoB7690190_ai >= 0 && lv_itBulletsToHide <= autoB7690190_ae) || (autoB7690190_ai < 0 && lv_itBulletsToHide >= autoB7690190_ae) ) ; lv_itBulletsToHide += autoB7690190_ai ) {
            DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_bullets[lv_itBulletsToHide], PlayerGroupAll(), false);
        }
    }
    else if (autoE8763B90_val == 2) {
        DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_shrineIcon, PlayerGroupAll(), true);
        DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_shrineProgress, PlayerGroupAll(), false);
        lv_itBulletsToHide = 1;
        for ( ; ( (autoFAF19C53_ai >= 0 && lv_itBulletsToHide <= autoFAF19C53_ae) || (autoFAF19C53_ai < 0 && lv_itBulletsToHide >= autoFAF19C53_ae) ) ; lv_itBulletsToHide += autoFAF19C53_ai ) {
            DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_bullets[lv_itBulletsToHide], PlayerGroupAll(), true);
        }
        lv_itFinalShot = 1;
        for ( ; ( (auto0FB8CE74_ai >= 0 && lv_itFinalShot <= auto0FB8CE74_ae) || (auto0FB8CE74_ai < 0 && lv_itFinalShot >= auto0FB8CE74_ae) ) ; lv_itFinalShot += auto0FB8CE74_ai ) {
            if ((lv_itFinalShot <= lp_progress)) {
                DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_bullets[lv_itFinalShot], PlayerGroupAll(), true);
            }
            else {
                DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_bullets[lv_itFinalShot], PlayerGroupAll(), false);
            }
        }
    }
    else {
    }
}

void libMLCP_gf_MMSkyTempleUISetTempleOwner (int lp_team, int lp_templeIndex) {
    // Automatic Variable Declarations
    int autoECDBD92E_val;

    // Implementation
    autoECDBD92E_val = lp_team;
    if (autoECDBD92E_val == 0) {
        DialogControlSetAnimationState(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_shrineProgress, PlayerGroupAll(), "Ownership", "Neutral");
    }
    else if (autoECDBD92E_val == libGame_gv_teamOrderIndex_C) {
        DialogControlSetAnimationState(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_shrineProgress, PlayerGroupAll(), "Ownership", "Order");
    }
    else if (autoECDBD92E_val == libGame_gv_teamChaosIndex_C) {
        DialogControlSetAnimationState(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_shrineProgress, PlayerGroupAll(), "Ownership", "Chaos");
    }
    else {
    }
}

void libMLCP_gf_MMSkyTempleUISetTempleContested (int lp_templeIndex, bool lp_team) {
    // Automatic Variable Declarations
    // Implementation
    if ((lp_team == true)) {
        DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_fireEffect, PlayerGroupAll(), true);
    }
    else {
        DialogControlSetVisible(libMLCP_gv_mMSkyTemplePanelIcons[lp_templeIndex].lv_fireEffect, PlayerGroupAll(), false);
    }
}

trigger auto_libMLCP_gf_MMSkyTempleUIShowDamageLabel_Trigger = null;
int auto_libMLCP_gf_MMSkyTempleUIShowDamageLabel_lp_fromTeam;
int auto_libMLCP_gf_MMSkyTempleUIShowDamageLabel_lp_labelAnchor;
int auto_libMLCP_gf_MMSkyTempleUIShowDamageLabel_lp_damage;

void libMLCP_gf_MMSkyTempleUIShowDamageLabel (int lp_fromTeam, int lp_labelAnchor, int lp_damage) {
    auto_libMLCP_gf_MMSkyTempleUIShowDamageLabel_lp_fromTeam = lp_fromTeam;
    auto_libMLCP_gf_MMSkyTempleUIShowDamageLabel_lp_labelAnchor = lp_labelAnchor;
    auto_libMLCP_gf_MMSkyTempleUIShowDamageLabel_lp_damage = lp_damage;

    if (auto_libMLCP_gf_MMSkyTempleUIShowDamageLabel_Trigger == null) {
        auto_libMLCP_gf_MMSkyTempleUIShowDamageLabel_Trigger = TriggerCreate("auto_libMLCP_gf_MMSkyTempleUIShowDamageLabel_TriggerFunc");
    }

    TriggerExecute(auto_libMLCP_gf_MMSkyTempleUIShowDamageLabel_Trigger, false, false);
}

bool auto_libMLCP_gf_MMSkyTempleUIShowDamageLabel_TriggerFunc (bool testConds, bool runActions) {
    int lp_fromTeam = auto_libMLCP_gf_MMSkyTempleUIShowDamageLabel_lp_fromTeam;
    int lp_labelAnchor = auto_libMLCP_gf_MMSkyTempleUIShowDamageLabel_lp_labelAnchor;
    int lp_damage = auto_libMLCP_gf_MMSkyTempleUIShowDamageLabel_lp_damage;

    // Variable Declarations
    int lv_enemyTeam;
    int lv_frame;
    int lv_label;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_frame = c_invalidDialogControlId;
    lv_label = c_invalidDialogControlId;

    // Implementation
    libMLCP_gv_mMSkyTempleDamageLabelExtraIndex[lp_fromTeam] += 1;
    if ((libMLCP_gv_mMSkyTempleDamageLabelExtraIndex[lp_fromTeam] > 5)) {
        libMLCP_gv_mMSkyTempleDamageLabelExtraIndex[lp_fromTeam] = 1;
    }

    lv_frame = libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleFireEffect4[lp_fromTeam][libMLCP_gv_mMSkyTempleDamageLabelExtraIndex[lp_fromTeam]];
    lv_label = libMLCP_gv_mMSkyTemplePanelDEPRECATE.lv_capturePointsTempleFireEffect5[lp_fromTeam][libMLCP_gv_mMSkyTempleDamageLabelExtraIndex[lp_fromTeam]];
    DialogControlSetPositionRelative(lv_frame, PlayerGroupAll(), c_anchorCenter, lp_labelAnchor, c_anchorCenter, 0, 0);
    libNtve_gf_SetDialogItemText(lv_label, IntToText(lp_damage), PlayerGroupAll());
    lv_enemyTeam = libGame_gf_EnemyTeam(lp_fromTeam);
    libNtve_gf_SetDialogItemStyle(lv_label, "Storm_MapMechanic_MechanicSmallCounter_Blue", GameAttributePlayersForTeam(lp_fromTeam));
    libNtve_gf_SetDialogItemStyle(lv_label, "Storm_MapMechanic_MechanicSmallCounter_Red", GameAttributePlayersForTeam(lv_enemyTeam));
    if ((lp_fromTeam == libGame_gv_teamOrderIndex_C)) {
        libNtve_gf_SetDialogItemStyle(lv_label, "Storm_MapMechanic_MechanicSmallCounter_Blue", GameAttributePlayersForTeam(lp_fromTeam));
    }
    else {
        libNtve_gf_SetDialogItemStyle(lv_label, "Storm_MapMechanic_MechanicSmallCounter_Red", GameAttributePlayersForTeam(lv_enemyTeam));
    }
    DialogControlSetEnabled(lv_label, PlayerGroupAll(), false);
    DialogControlSetEnabled(lv_label, PlayerGroupAll(), true);
    return true;
}

void libMLCP_gf_TempleMasterSendAwardData () {
    // Variable Declarations
    fixed lv_time;
    int lv_playerIterator;
    int lv_pointIterator;

    // Automatic Variable Declarations
    const int auto31BE04BE_ae = libCore_gv_bALMaxPlayers;
    const int auto31BE04BE_ai = 1;
    int autoDB2D1309_ae;
    const int autoDB2D1309_ai = 1;

    // Variable Initialization

    // Implementation
    lv_playerIterator = 1;
    for ( ; ( (auto31BE04BE_ai >= 0 && lv_playerIterator <= auto31BE04BE_ae) || (auto31BE04BE_ai < 0 && lv_playerIterator >= auto31BE04BE_ae) ) ; lv_playerIterator += auto31BE04BE_ai ) {
        lv_time = 0.0;
        autoDB2D1309_ae = libMLCP_gv_mMSkyTempleCount;
        lv_pointIterator = 1;
        for ( ; ( (autoDB2D1309_ai >= 0 && lv_pointIterator <= autoDB2D1309_ae) || (autoDB2D1309_ai < 0 && lv_pointIterator >= autoDB2D1309_ae) ) ; lv_pointIterator += autoDB2D1309_ai ) {
            lv_time += libGame_gf_CapturePointGetCaptureTimeForPlayer(libMLCP_gv_mMSkyTemples[lv_pointIterator].lv_beaconIndex, lv_playerIterator);
        }
        libGame_gf_SendMapSpecificAwardEvent(lv_playerIterator, lv_time, false);
    }
}

void libMLCP_gf_MMSkyTempleSetLevel () {
    // Variable Declarations
    unitgroup lv_unitGroup;

    // Automatic Variable Declarations
    unitgroup auto940767C5_g;
    int auto940767C5_u;
    unit auto940767C5_var;
    unitgroup autoF2EB85E4_g;
    int autoF2EB85E4_u;
    unit autoF2EB85E4_var;
    unitgroup auto4833021D_g;
    int auto4833021D_u;
    unit auto4833021D_var;
    unitgroup auto2BCE5A90_g;
    int auto2BCE5A90_u;
    unit auto2BCE5A90_var;
    unitgroup autoCEDD9A41_g;
    int autoCEDD9A41_u;
    unit autoCEDD9A41_var;
    unitgroup auto43AB1A21_g;
    int auto43AB1A21_u;
    unit auto43AB1A21_var;

    // Variable Initialization
    lv_unitGroup = UnitGroupEmpty();

    // Implementation
    auto940767C5_g = UnitGroup("LuxoriaTemple", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    auto940767C5_u = UnitGroupCount(auto940767C5_g, c_unitCountAll);
    for (;; auto940767C5_u -= 1) {
        auto940767C5_var = UnitGroupUnitFromEnd(auto940767C5_g, auto940767C5_u);
        if (auto940767C5_var == null) { break; }
        UnitGroupAdd(lv_unitGroup, auto940767C5_var);
    }
    autoF2EB85E4_g = UnitGroup("TempleDefenderMelee", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    autoF2EB85E4_u = UnitGroupCount(autoF2EB85E4_g, c_unitCountAll);
    for (;; autoF2EB85E4_u -= 1) {
        autoF2EB85E4_var = UnitGroupUnitFromEnd(autoF2EB85E4_g, autoF2EB85E4_u);
        if (autoF2EB85E4_var == null) { break; }
        UnitGroupAdd(lv_unitGroup, autoF2EB85E4_var);
    }
    auto4833021D_g = UnitGroup("TempleDefenderRanged", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    auto4833021D_u = UnitGroupCount(auto4833021D_g, c_unitCountAll);
    for (;; auto4833021D_u -= 1) {
        auto4833021D_var = UnitGroupUnitFromEnd(auto4833021D_g, auto4833021D_u);
        if (auto4833021D_var == null) { break; }
        UnitGroupAdd(lv_unitGroup, auto4833021D_var);
    }
    auto2BCE5A90_g = UnitGroup("TempleChampionBoss", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    auto2BCE5A90_u = UnitGroupCount(auto2BCE5A90_g, c_unitCountAll);
    for (;; auto2BCE5A90_u -= 1) {
        auto2BCE5A90_var = UnitGroupUnitFromEnd(auto2BCE5A90_g, auto2BCE5A90_u);
        if (auto2BCE5A90_var == null) { break; }
        UnitGroupAdd(lv_unitGroup, auto2BCE5A90_var);
    }
    autoCEDD9A41_g = UnitGroup("TempleGuardianBoss", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    autoCEDD9A41_u = UnitGroupCount(autoCEDD9A41_g, c_unitCountAll);
    for (;; autoCEDD9A41_u -= 1) {
        autoCEDD9A41_var = UnitGroupUnitFromEnd(autoCEDD9A41_g, autoCEDD9A41_u);
        if (autoCEDD9A41_var == null) { break; }
        UnitGroupAdd(lv_unitGroup, autoCEDD9A41_var);
    }
    auto43AB1A21_g = lv_unitGroup;
    auto43AB1A21_u = UnitGroupCount(auto43AB1A21_g, c_unitCountAll);
    for (;; auto43AB1A21_u -= 1) {
        auto43AB1A21_var = UnitGroupUnitFromEnd(auto43AB1A21_g, auto43AB1A21_u);
        if (auto43AB1A21_var == null) { break; }
        UnitSetPropertyFixed(auto43AB1A21_var, c_unitPropXP, 0.0);
        Wait(0.0625, c_timeGame);
        libGame_gf_UpdateScalingForUnit(auto43AB1A21_var, libGame_gv_scalingTicks, 0);
    }
}

trigger auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivationWarningQ_Trigger = null;
playergroup auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivationWarningQ_lp_players;

void libMLCP_gf_MMSkyTempleTransmissionTempleActivationWarningQ (playergroup lp_players) {
    auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivationWarningQ_lp_players = lp_players;

    if (auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivationWarningQ_Trigger == null) {
        auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivationWarningQ_Trigger = TriggerCreate("auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivationWarningQ_TriggerFunc");
    }

    TriggerExecute(auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivationWarningQ_Trigger, false, false);
}

bool auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivationWarningQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivationWarningQ_lp_players;

    // Automatic Variable Declarations
    // Implementation
    if ((libGame_gv_gameOver == true)) {
        return true;
    }

    TriggerQueueEnter();
    UserDataResetType("MapVOEvent");
    UserDataSetInt("MapVOEvent", "TempleActivationWarning", "Value", 1, 1);
    if ((libMLCP_gv_mMSkyTempleBlessingFirstTime == true)) {
        UserDataSetInt("MapVOEvent", "TempleActivationWarningFirstTime", "Value", 1, 1);
    }

    ConversationDataRun("CapturePointsVO", PlayerGroupAll(), c_conversationSkipNone, true);
    TriggerQueueExit();
    return true;
}

trigger auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivatedQ_Trigger = null;
playergroup auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivatedQ_lp_players;

void libMLCP_gf_MMSkyTempleTransmissionTempleActivatedQ (playergroup lp_players) {
    auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivatedQ_lp_players = lp_players;

    if (auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivatedQ_Trigger == null) {
        auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivatedQ_Trigger = TriggerCreate("auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivatedQ_TriggerFunc");
    }

    TriggerExecute(auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivatedQ_Trigger, false, false);
}

bool auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivatedQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMLCP_gf_MMSkyTempleTransmissionTempleActivatedQ_lp_players;

    // Automatic Variable Declarations
    // Implementation
    if ((libGame_gv_gameOver == true)) {
        return true;
    }

    TriggerQueueEnter();
    UserDataResetType("MapVOEvent");
    UserDataSetInt("MapVOEvent", "TempleActivated", "Value", 1, 1);
    if ((libMLCP_gv_mMSkyTempleBlessingFirstTime == true)) {
        UserDataSetInt("MapVOEvent", "TempleActivatedFirstTime", "Value", 1, 1);
    }

    ConversationDataRun("CapturePointsVO", PlayerGroupAll(), c_conversationSkipNone, true);
    TriggerQueueExit();
    return true;
}

trigger auto_libMLCP_gf_MMSkyTempleTransmissionTempleDeactivatedQ_Trigger = null;
playergroup auto_libMLCP_gf_MMSkyTempleTransmissionTempleDeactivatedQ_lp_players;

void libMLCP_gf_MMSkyTempleTransmissionTempleDeactivatedQ (playergroup lp_players) {
    auto_libMLCP_gf_MMSkyTempleTransmissionTempleDeactivatedQ_lp_players = lp_players;

    if (auto_libMLCP_gf_MMSkyTempleTransmissionTempleDeactivatedQ_Trigger == null) {
        auto_libMLCP_gf_MMSkyTempleTransmissionTempleDeactivatedQ_Trigger = TriggerCreate("auto_libMLCP_gf_MMSkyTempleTransmissionTempleDeactivatedQ_TriggerFunc");
    }

    TriggerExecute(auto_libMLCP_gf_MMSkyTempleTransmissionTempleDeactivatedQ_Trigger, false, false);
}

bool auto_libMLCP_gf_MMSkyTempleTransmissionTempleDeactivatedQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMLCP_gf_MMSkyTempleTransmissionTempleDeactivatedQ_lp_players;

    // Automatic Variable Declarations
    // Implementation
    if ((libGame_gv_gameOver == true)) {
        return true;
    }

    TriggerQueueEnter();
    UserDataResetType("MapVOEvent");
    UserDataSetInt("MapVOEvent", "TempleDeactivated", "Value", 1, 1);
    ConversationDataRun("CapturePointsVO", PlayerGroupAll(), c_conversationSkipNone, true);
    TriggerQueueExit();
    return true;
}

// Triggers
//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Init
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleInit_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_itTempleIndex;
    int lv_itPlayer;

    // Automatic Variable Declarations
    int auto3FC03D01_ae;
    const int auto3FC03D01_ai = 1;
    playergroup auto990D4B89_g;

    // Variable Initialization

    // Conditions
    if (testConds) {
        if (!((libGame_gf_MapMechanicInitializationMechanicType() == libMLCP_gv_mMSkyTempleMechanicName_C))) {
            return false;
        }
    }

    // Actions
    if (!runActions) {
        return true;
    }

    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal MM1Off");
    TriggerEnable(libMLCP_gt_MMSkyTempleGatesOpened, true);
    TriggerEnable(libMLCP_gt_MMSkyTempleBlessWarningTimerExpires, true);
    TriggerEnable(libMLCP_gt_MMSkyTempleDebugStart, true);
    TriggerEnable(libMLCP_gt_MMSkyTempleDebugStart1, true);
    TriggerEnable(libMLCP_gt_MMSkyTempleDebugNext, true);
    TriggerEnable(libMLCP_gt_MMSkyTempleDebugScalingTime, true);
    TriggerEnable(libMLCP_gt_MMSkyTempleSpawnTestTemple, true);
    TriggerEnable(libMLCP_gt_MMSkyTempleAttacks, true);
    TriggerEnable(libMLCP_gt_MMSkyTempleTempleDefenderDies, true);
    auto3FC03D01_ae = libMLCP_gv_mMSkyTempleCount;
    lv_itTempleIndex = 1;
    for ( ; ( (auto3FC03D01_ai >= 0 && lv_itTempleIndex <= auto3FC03D01_ae) || (auto3FC03D01_ai < 0 && lv_itTempleIndex >= auto3FC03D01_ae) ) ; lv_itTempleIndex += auto3FC03D01_ai ) {
        libNtve_gf_CreateUnitsWithDefaultFacing(1, "InvisibleBeacon", c_unitCreateIgnorePlacement, UnitGetOwner(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple), PointWithOffset(UnitGetPosition(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple), 0.0, -7.5), null);
        libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_beacon = UnitLastCreated();
        libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_bannerSconce = UnitGroupUnit(UnitGroup("LootBannerSconce", c_playerAny, RegionCircle(UnitGetPosition(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_beacon), 10.0), UnitFilter(0, 0, 0, 0), 1), 1);
        libGame_gf_CapturePointCreate(UnitLastCreated(), libMLCP_gv_mMSkyTempleTempleCaptureRadius_C, libMLCP_gv_mMSkyTempleTempleCaptureTime_C, libMLCP_gv_mMSkyTempleTempleCaptureOverTime_C, libGame_ge_CapturePointDecay_Neutral, libGame_ge_CapturePointDecay_Neutral, true);
        libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_beaconIndex = libGame_gf_LastCreatedCapturePoint();
        libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "SetScale 1.300000");
        libGame_gf_CapturePointDisable(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_beaconIndex);
        auto990D4B89_g = PlayerGroupAll();
        lv_itPlayer = -1;
        while (true) {
            	lv_itPlayer = PlayerGroupNextPlayer(auto990D4B89_g, lv_itPlayer);
            	if (lv_itPlayer<0) { break; }
            	VisRevealArea(lv_itPlayer, RegionCircle(libMLCP_gf_MMSkyTempleLocation(lv_itTempleIndex), libMLCP_gv_mMSkyTempleTempleCaptureRadius_C), 0.125, false);
        }
    }
    if ((RandomInt(1, 2) == 1)) {
        libMLCP_gv_mMSkyTempleBlessTemplesActivationGoal[1] = 3;
        libMLCP_gv_mMSkyTempleBlessTemplesActivationGoal[2] = 2;
    }
    else {
        libMLCP_gv_mMSkyTempleBlessTemplesActivationGoal[1] = 2;
        libMLCP_gv_mMSkyTempleBlessTemplesActivationGoal[2] = 3;
    }
    libMLCP_gv_mMSkyTempleBlessTemplesActivationGoal[3] = 2;
    libGame_gf_SendMapSpecificAwardInitializeEventwithUserData(null, "Generic Instance");
    libCore_gf_RegisterSegregationTrigger(libCore_ge_SegregationTriggerTypes_DefenderAIIssueOrdersToCreep, libMLCP_gt_MMSkyTempleDefenderAttackLogic);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleInit_Init () {
    libMLCP_gt_MMSkyTempleInit = TriggerCreate("libMLCP_gt_MMSkyTempleInit_Func");
    libGame_gf_MapMechanicInitialization(libMLCP_gt_MMSkyTempleInit);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Ping Data Init
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTemplePingDataInit_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Actions
    if (!runActions) {
        return true;
    }

    libUIUI_gf_PingCreateNewPingTarget("LuxoriaTemple", false, null, StringExternal("Param/Value/lib_MLCP_775DA055"), StringExternal("Param/Value/lib_MLCP_0E3C3D40"), SoundLink("UI_Game_Ping_Help", -1), SoundLink("UI_Game_Ping_Attack", -1));
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTemplePingDataInit_Init () {
    libMLCP_gt_MMSkyTemplePingDataInit = TriggerCreate("libMLCP_gt_MMSkyTemplePingDataInit_Func");
    libCore_gf_IncludeModInitialization(libMLCP_gt_MMSkyTemplePingDataInit);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Announcer Init
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleAnnouncerInit_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Actions
    if (!runActions) {
        return true;
    }

    libCore_gf_DataAnnouncerVOSetDefaultAnnouncerForPlayerGroup(PlayerGroupAll(), "SnakeGod");
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleAnnouncerInit_Init () {
    libMLCP_gt_MMSkyTempleAnnouncerInit = TriggerCreate("libMLCP_gt_MMSkyTempleAnnouncerInit_Func");
    libCore_gf_IncludeModInitialization(libMLCP_gt_MMSkyTempleAnnouncerInit);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Gates Opened
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleGatesOpened_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Conditions
    if (testConds) {
        if (!((libMapM_gv_mMMapMechanicDisabled == false))) {
            return false;
        }
    }

    // Actions
    if (!runActions) {
        return true;
    }

    TimerStart(libMLCP_gv_mMSkyTempleObjectivePreviewTimer, libMLCP_gv_mMSkyTempleObjectivePreviewDelay_C, false, c_timeGame);
    Wait((libMLCP_gv_mMSkyTempleFirstTempleStartTime_C - libMLCP_gv_mMSkyTempleTempleBlessWarningTime), c_timeGame);
    if ((TriggerIsEnabled(TriggerGetCurrent()) == false)) {
        return true;
    }

    libMLCP_gf_MMSkyTemplePrepareTemples();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleGatesOpened_Init () {
    libMLCP_gt_MMSkyTempleGatesOpened = TriggerCreate("libMLCP_gt_MMSkyTempleGatesOpened_Func");
    TriggerEnable(libMLCP_gt_MMSkyTempleGatesOpened, false);
    TriggerAddEventTimer(libMLCP_gt_MMSkyTempleGatesOpened, libGame_gv_openTheGatesTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Objective Preview Timer Expires
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleObjectivePreviewTimerExpires_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Actions
    if (!runActions) {
        return true;
    }

    libMLCP_gf_MMSkyTempleSetupPreview();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleObjectivePreviewTimerExpires_Init () {
    libMLCP_gt_MMSkyTempleObjectivePreviewTimerExpires = TriggerCreate("libMLCP_gt_MMSkyTempleObjectivePreviewTimerExpires_Func");
    TriggerAddEventTimer(libMLCP_gt_MMSkyTempleObjectivePreviewTimerExpires, libMLCP_gv_mMSkyTempleObjectivePreviewTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Bless Warning Timer Expires
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleBlessWarningTimerExpires_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_itTempleIndex;
    bool lv_finished;

    // Automatic Variable Declarations
    int autoA126A775_ae;
    const int autoA126A775_ai = 1;
    int autoBE35738B_ae;
    const int autoBE35738B_ai = 1;

    // Variable Initialization

    // Actions
    if (!runActions) {
        return true;
    }

    libMLCP_gv_mMSkyTempleBlessIndex += 1;
    libMLCP_gf_MMSkyTempleTransmissionTempleActivatedQ(PlayerGroupAll());
    autoA126A775_ae = libMLCP_gv_mMSkyTempleCount;
    lv_itTempleIndex = 1;
    for ( ; ( (autoA126A775_ai >= 0 && lv_itTempleIndex <= autoA126A775_ae) || (autoA126A775_ai < 0 && lv_itTempleIndex >= autoA126A775_ae) ) ; lv_itTempleIndex += autoA126A775_ai ) {
        if ((libMLCP_gv_mMSkyTempleBlessNextTemples[lv_itTempleIndex] == true)) {
            libMLCP_gf_MMSkyTempleBlessTemple(lv_itTempleIndex);
        }

    }
    while (true) {
        lv_finished = true;
        autoBE35738B_ae = libMLCP_gv_mMSkyTempleCount;
        lv_itTempleIndex = 1;
        for ( ; ( (autoBE35738B_ai >= 0 && lv_itTempleIndex <= autoBE35738B_ae) || (autoBE35738B_ai < 0 && lv_itTempleIndex >= autoBE35738B_ae) ) ; lv_itTempleIndex += autoBE35738B_ai ) {
            if ((libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_blessed == true)) {
                lv_finished = false;
            }

        }
        if ((lv_finished == true)) {
            break;
        }

        Wait(1.0, c_timeGame);
    }
    TimerStart(libMLCP_gv_mMSkyTempleObjectivePreviewTimer, libMLCP_gv_mMSkyTempleObjectivePreviewDelay_C, false, c_timeGame);
    libMLCP_gf_MMSkyTempleTransmissionTempleDeactivatedQ(PlayerGroupAll());
    Wait((libMLCP_gv_mMSkyTempleTempleCooldown_C - libMLCP_gv_mMSkyTempleTempleBlessWarningTime), c_timeGame);
    libMLCP_gf_MMSkyTemplePrepareTemples();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleBlessWarningTimerExpires_Init () {
    libMLCP_gt_MMSkyTempleBlessWarningTimerExpires = TriggerCreate("libMLCP_gt_MMSkyTempleBlessWarningTimerExpires_Func");
    TriggerEnable(libMLCP_gt_MMSkyTempleBlessWarningTimerExpires, false);
    TriggerAddEventTimer(libMLCP_gt_MMSkyTempleBlessWarningTimerExpires, libMLCP_gv_mMSkyTempleBlessingWarningTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Defender Attack Logic
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleDefenderAttackLogic_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_defenderAIIndex;
    int lv_templeIndex;
    unit lv_creepUnit;
    unitgroup lv_validTargets;
    order lv_currentOrder;
    unit lv_currentOrderTarget;
    unitgroup lv_testTargets;
    unit lv_bestTarget;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_defenderAIIndex = libCore_gv_segTriggerIndex;
    lv_creepUnit = libCore_gv_segTriggerUnit;
    lv_validTargets = UnitGroupEmpty();

    // Actions
    if (!runActions) {
        return true;
    }

    lv_templeIndex = libMLCP_gf_MMSkyTempleTempleIndexForDefenders(lv_defenderAIIndex);
    if ((lv_templeIndex <= 0)) {
        return true;
    }

    if ((libAIAI_gv_defenderAICreepNeedsNewOrder == false)) {
        return true;
    }

    lv_validTargets = libAIAI_gf_DefenderValidTargets(lv_defenderAIIndex);
    if ((UnitGroupCount(lv_validTargets, c_unitCountAlive) <= 0)) {
        return true;
    }

    lv_currentOrder = UnitOrder(lv_creepUnit, 0);
    if ((!(((lv_currentOrder == null) || (OrderGetAbilityCommand(lv_currentOrder) == AbilityCommand("move", 0)) || (OrderGetAbilityCommand(lv_currentOrder) == AbilityCommand("move", 4)) || (OrderGetAbilityCommand(lv_currentOrder) == AbilityCommand("attack", 0)) || (OrderGetAbilityCommand(lv_currentOrder) == AbilityCommand("AttackAlly", 0)))))) {
        return true;
    }

    lv_currentOrderTarget = OrderGetTargetUnit(lv_currentOrder);
    if ((UnitGetOwner(libMLCP_gv_mMSkyTemples[lv_templeIndex].lv_temple) != libCore_gv_cOMPUTER_Neutral)) {
        lv_testTargets = UnitGroupFilterAlliance(lv_validTargets, UnitGetOwner(libMLCP_gv_mMSkyTemples[lv_templeIndex].lv_beacon), c_unitAllianceAlly, 0);
        if ((UnitIsValid(lv_currentOrderTarget) == true) && (UnitGroupHasUnit(lv_testTargets, lv_currentOrderTarget) == true)) {
            lv_bestTarget = lv_currentOrderTarget;
        }
        else {
            lv_bestTarget = UnitGroupClosestToPoint(lv_testTargets, UnitGetPosition(lv_creepUnit));
        }
    }

    if ((UnitIsValid(lv_bestTarget) != true)) {
        lv_testTargets = UnitGroupFilterRegion(lv_validTargets, libAIAI_gf_DefenderAgroRegion(lv_defenderAIIndex), 0);
        lv_bestTarget = UnitGroupClosestToPoint(lv_testTargets, UnitGetPosition(lv_creepUnit));
    }

    if ((UnitIsValid(lv_bestTarget) != true)) {
        if ((UnitIsValid(lv_currentOrderTarget) == true) && (UnitGroupHasUnit(lv_validTargets, lv_currentOrderTarget) == true)) {
            lv_bestTarget = lv_currentOrderTarget;
        }
        else {
            lv_bestTarget = UnitGroupClosestToPoint(lv_validTargets, UnitGetPosition(lv_creepUnit));
        }
    }

    if ((lv_bestTarget != null) && (lv_bestTarget != lv_currentOrderTarget)) {
        UnitIssueOrder(lv_creepUnit, OrderTargetingUnit(AbilityCommand("attack", 0), lv_bestTarget), c_orderQueueReplace);
    }

    libAIAI_gv_defenderAICreepNeedsNewOrder = false;
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleDefenderAttackLogic_Init () {
    libMLCP_gt_MMSkyTempleDefenderAttackLogic = TriggerCreate("libMLCP_gt_MMSkyTempleDefenderAttackLogic_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Temple Defender Dies
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleTempleDefenderDies_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Conditions
    if (testConds) {
        if (!((UnitGetType(EventUnit()) == "TempleGuardianBoss"))) {
            return false;
        }

        if (!((UnitGroupHasUnit(libMLCP_gv_mMSkyTempleDefenderWithGlobes, EventUnit()) == true))) {
            return false;
        }
    }

    // Actions
    if (!runActions) {
        return true;
    }

    libNtve_gf_CreateUnitsWithDefaultFacing(1, "RegenGlobeNeutral", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Neutral, UnitGetPosition(EventUnit()), null);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleTempleDefenderDies_Init () {
    libMLCP_gt_MMSkyTempleTempleDefenderDies = TriggerCreate("libMLCP_gt_MMSkyTempleTempleDefenderDies_Func");
    TriggerEnable(libMLCP_gt_MMSkyTempleTempleDefenderDies, false);
    TriggerAddEventUnitDied(libMLCP_gt_MMSkyTempleTempleDefenderDies, null);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Beacon Captured
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleBeaconCaptured_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_count;
    playergroup lv_capturingPlayer;
    int lv_itTempleIndex;

    // Automatic Variable Declarations
    int autoF1269D9C_ae;
    const int autoF1269D9C_ai = 1;

    // Variable Initialization
    lv_capturingPlayer = PlayerGroupEmpty();

    // Conditions
    if (testConds) {
        if (!((UnitGetType(EventUnit()) == "InvisibleBeacon"))) {
            return false;
        }
    }

    // Actions
    if (!runActions) {
        return true;
    }

    autoF1269D9C_ae = libMLCP_gv_mMSkyTempleCount;
    lv_itTempleIndex = 1;
    for ( ; ( (autoF1269D9C_ai >= 0 && lv_itTempleIndex <= autoF1269D9C_ae) || (autoF1269D9C_ai < 0 && lv_itTempleIndex >= autoF1269D9C_ae) ) ; lv_itTempleIndex += autoF1269D9C_ai ) {
        if ((libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_beacon == EventUnit())) {
            UnitSetOwner(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple, UnitGetOwner(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_beacon), true);
            StatEventCreate("SkyTempleCaptured");
            StatEventAddDataInt(StatEventLastCreated(), "Event", libMLCP_gv_mMSkyTempleBlessIndex);
            StatEventAddDataInt(StatEventLastCreated(), "TempleID", lv_itTempleIndex);
            StatEventAddDataInt(StatEventLastCreated(), "TeamID", libGame_gf_TeamNumberOfPlayer(UnitGetOwner(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple)));
            StatEventAddDataFixed(StatEventLastCreated(), "GameTime", libUIUI_gf_HeroesGameTime());
            StatEventSend(StatEventLastCreated());
            if ((libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_blessed == true)) {
                if ((UnitGetOwner(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple) == libCore_gv_cOMPUTER_Neutral)) {
                    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple, "SetMinimapVisibility");
                    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple, "SetMinimapVisibilityAlways");
                    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_minimapIcon, "SetMinimapVisibility 1");
                    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_minimapIcon, "SetMinimapVisibilityAlways 1");
                }
                else {
                    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple, "SetMinimapVisibility 1");
                    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple, "SetMinimapVisibilityAlways 1");
                    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_minimapIcon, "SetMinimapVisibility");
                    libNtve_gf_SendActorMessageToUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_minimapIcon, "SetMinimapVisibilityAlways");
                }
            }

            break;
        }

    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleBeaconCaptured_Init () {
    libMLCP_gt_MMSkyTempleBeaconCaptured = TriggerCreate("libMLCP_gt_MMSkyTempleBeaconCaptured_Func");
    TriggerAddEventUnitChangeOwner(libMLCP_gt_MMSkyTempleBeaconCaptured, null);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Game Over
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleGameOver_Func (bool testConds, bool runActions) {
    // Variable Declarations
    fixed lv_playerTime;
    int lv_itCapturePoint;
    int lv_itPlayer;

    // Automatic Variable Declarations
    const int auto6611B4E3_ae = libCore_gv_bALMaxPlayers;
    const int auto6611B4E3_ai = 1;
    int auto307F9D31_ae;
    const int auto307F9D31_ai = 1;

    // Variable Initialization
    lv_itPlayer = 1;

    // Actions
    if (!runActions) {
        return true;
    }

    lv_itPlayer = 1;
    for ( ; ( (auto6611B4E3_ai >= 0 && lv_itPlayer <= auto6611B4E3_ae) || (auto6611B4E3_ai < 0 && lv_itPlayer >= auto6611B4E3_ae) ) ; lv_itPlayer += auto6611B4E3_ai ) {
        lv_playerTime = 0.0;
        auto307F9D31_ae = libMLCP_gv_mMSkyTempleCount;
        lv_itCapturePoint = 1;
        for ( ; ( (auto307F9D31_ai >= 0 && lv_itCapturePoint <= auto307F9D31_ae) || (auto307F9D31_ai < 0 && lv_itCapturePoint >= auto307F9D31_ae) ) ; lv_itCapturePoint += auto307F9D31_ai ) {
            lv_playerTime += libGame_gf_CapturePointGetCaptureTimeForPlayer(libMLCP_gv_mMSkyTemples[lv_itCapturePoint].lv_beaconIndex, lv_itPlayer);
        }
        libGame_gf_SendMapSpecificAwardEvent(lv_itPlayer, lv_playerTime, false);
        libGame_gf_ScoreValuesReportIntegerValueAndLog(lv_itPlayer, "TimeInTemple", FixedToInt(lv_playerTime));
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleGameOver_Init () {
    libMLCP_gt_MMSkyTempleGameOver = TriggerCreate("libMLCP_gt_MMSkyTempleGameOver_Func");
    libGame_gf_GameOverEvent(libMLCP_gt_MMSkyTempleGameOver);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Beacon Color
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleBeaconColor_Func (bool testConds, bool runActions) {
    int init_i;

    // Variable Declarations
    int lv_itTempleIndex;
    int lv_owner;
    int[libMLCP_gv_mMSkyTempleMaxCount_C + 1] lv_oldOwner;
    int lv_itDefenderIndex;
    color lv_color;

    // Automatic Variable Declarations
    int autoA872980B_ae;
    const int autoA872980B_ai = 1;
    int auto20F335D9_val;
    const int auto4C5692C5_ae = 5;
    const int auto4C5692C5_ai = 1;
    int auto0D103B42_val;

    // Variable Initialization
    for (init_i = 0; init_i <= libMLCP_gv_mMSkyTempleMaxCount_C; init_i += 1) {
        lv_oldOwner[init_i] = libCore_gv_cOMPUTER_Neutral;
    }
    lv_color = Color(0,0,0);

    // Actions
    if (!runActions) {
        return true;
    }

    while (true) {
        if ((libGame_gv_gameOver == true)) {
            return true;
        }

        autoA872980B_ae = libMLCP_gv_mMSkyTempleCount;
        lv_itTempleIndex = 1;
        for ( ; ( (autoA872980B_ai >= 0 && lv_itTempleIndex <= autoA872980B_ae) || (autoA872980B_ai < 0 && lv_itTempleIndex >= autoA872980B_ae) ) ; lv_itTempleIndex += autoA872980B_ai ) {
            if ((libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_blessed == false)) {
                if ((lv_oldOwner[lv_itTempleIndex] != libCore_gv_cOMPUTER_Neutral)) {
                    libCore_gf_SendActorMessageToDoodadsInRegion("Signal NeutralOwner", RegionCircle(UnitGetPosition(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_beacon), 12.0), null);
                    lv_oldOwner[lv_itTempleIndex] = libCore_gv_cOMPUTER_Neutral;
                }

                continue;
            }

            lv_owner = UnitGetOwner(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_beacon);
            if ((lv_owner != lv_oldOwner[lv_itTempleIndex])) {
                auto20F335D9_val = lv_owner;
                if (auto20F335D9_val == libCore_gv_cOMPUTER_TeamOrder) {
                    libCore_gf_SendActorMessageToDoodadsInRegion("Signal OrderOwner", RegionCircle(UnitGetPosition(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_beacon), 12.0), null);
                }
                else if (auto20F335D9_val == libCore_gv_cOMPUTER_TeamChaos) {
                    libCore_gf_SendActorMessageToDoodadsInRegion("Signal ChaosOwner", RegionCircle(UnitGetPosition(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_beacon), 12.0), null);
                }
                else if (auto20F335D9_val == libCore_gv_cOMPUTER_Neutral) {
                    libCore_gf_SendActorMessageToDoodadsInRegion("Signal NeutralOwner", RegionCircle(UnitGetPosition(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_beacon), 12.0), null);
                }
                else {
                }
                lv_itDefenderIndex = 1;
                for ( ; ( (auto4C5692C5_ai >= 0 && lv_itDefenderIndex <= auto4C5692C5_ae) || (auto4C5692C5_ai < 0 && lv_itDefenderIndex >= auto4C5692C5_ae) ) ; lv_itDefenderIndex += auto4C5692C5_ai ) {
                    if ((libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_defenderArray[lv_itDefenderIndex] != null) && (UnitIsAlive(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_defenderArray[lv_itDefenderIndex]) == true) && (libCore_gf_ActorStoredForUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_defenderArray[lv_itDefenderIndex], 1) != null) && (UnitGroupHasUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_defendersActivated, libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_defenderArray[lv_itDefenderIndex]) == false)) {
                        auto0D103B42_val = lv_owner;
                        if (auto0D103B42_val == libCore_gv_cOMPUTER_TeamOrder) {
                            ActorSend(libCore_gf_ActorStoredForUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_defenderArray[lv_itDefenderIndex], 1), "SetPlayerId 11");
                        }
                        else if (auto0D103B42_val == libCore_gv_cOMPUTER_TeamChaos) {
                            ActorSend(libCore_gf_ActorStoredForUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_defenderArray[lv_itDefenderIndex], 1), "SetPlayerId 12");
                        }
                        else if (auto0D103B42_val == libCore_gv_cOMPUTER_Neutral) {
                            ActorSend(libCore_gf_ActorStoredForUnit(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_defenderArray[lv_itDefenderIndex], 1), "SetPlayerId");
                        }
                        else {
                        }
                    }

                }
                lv_oldOwner[lv_itTempleIndex] = lv_owner;
            }

        }
        Wait(0.25, c_timeGame);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleBeaconColor_Init () {
    libMLCP_gt_MMSkyTempleBeaconColor = TriggerCreate("libMLCP_gt_MMSkyTempleBeaconColor_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Attacks
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleAttacks_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_itTempleIndex;

    // Automatic Variable Declarations
    int autoD73C9856_ae;
    const int autoD73C9856_ai = 1;

    // Variable Initialization

    // Conditions
    if (testConds) {
        if (!((UnitGetType(EventUnitDamageSourceUnit()) == "LuxoriaTemple"))) {
            return false;
        }
    }

    // Actions
    if (!runActions) {
        return true;
    }

    autoD73C9856_ae = libMLCP_gv_mMSkyTempleCount;
    lv_itTempleIndex = 1;
    for ( ; ( (autoD73C9856_ai >= 0 && lv_itTempleIndex <= autoD73C9856_ae) || (autoD73C9856_ai < 0 && lv_itTempleIndex >= autoD73C9856_ae) ) ; lv_itTempleIndex += autoD73C9856_ai ) {
        if ((libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple == EventUnitDamageSourceUnit())) {
            libMLCP_gf_MMSkyTempleShootingPing(lv_itTempleIndex, EventUnit());
            StatEventCreate("SkyTempleShotsFired");
            StatEventAddDataInt(StatEventLastCreated(), "Event", libMLCP_gv_mMSkyTempleBlessIndex);
            StatEventAddDataInt(StatEventLastCreated(), "TempleID", lv_itTempleIndex);
            StatEventAddDataInt(StatEventLastCreated(), "TeamID", libGame_gf_TeamNumberOfPlayer(UnitGetOwner(libMLCP_gv_mMSkyTemples[lv_itTempleIndex].lv_temple)));
            StatEventAddDataFixed(StatEventLastCreated(), "SkyTempleShotsDamage", EventUnitDamageAmount());
            StatEventAddDataFixed(StatEventLastCreated(), "GameTime", libUIUI_gf_HeroesGameTime());
            StatEventSend(StatEventLastCreated());
            break;
        }

    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleAttacks_Init () {
    libMLCP_gt_MMSkyTempleAttacks = TriggerCreate("libMLCP_gt_MMSkyTempleAttacks_Func");
    TriggerEnable(libMLCP_gt_MMSkyTempleAttacks, false);
    TriggerAddEventUnitDamaged(libMLCP_gt_MMSkyTempleAttacks, null, c_unitDamageTypeAny, c_unitDamageEither, "LuxoriaTempleStage1WeaponDamage");
    TriggerAddEventUnitDamaged(libMLCP_gt_MMSkyTempleAttacks, null, c_unitDamageTypeAny, c_unitDamageEither, "LuxoriaTempleStage2WeaponDamage");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple UI Mod Initialize
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleUIModInitialize_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Actions
    if (!runActions) {
        return true;
    }

    libMLCP_gf_MMSkyTempleUIInit(libUIUI_gv_mapMechanicsPanel.lv_mainPanel);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleUIModInitialize_Init () {
    libMLCP_gt_MMSkyTempleUIModInitialize = TriggerCreate("libMLCP_gt_MMSkyTempleUIModInitialize_Func");
    libCore_gf_IncludeModInitialization(libMLCP_gt_MMSkyTempleUIModInitialize);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple UI Handler
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleUIHandler_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_itTeam;
    int lv_itTeamEnemy;
    int lv_itTemplIndex;
    int lv_state;
    int lv_lastState;
    int lv_stage;
    int lv_ownerTeam;
    bool lv_finalShooting;

    // Automatic Variable Declarations
    int auto220F810A_ae;
    const int auto220F810A_ai = 1;
    int auto707CDB48_ae;
    const int auto707CDB48_ai = 1;
    int auto00653FA5_ae;
    const int auto00653FA5_ai = 1;

    // Variable Initialization
    lv_state = libMLCP_ge_MMSkyTempleUIState_None;
    lv_lastState = libMLCP_ge_MMSkyTempleUIState_None;

    // Conditions
    if (testConds) {
        if (!((TriggerIsEnabled(TriggerGetCurrent()) == true))) {
            return false;
        }
    }

    // Actions
    if (!runActions) {
        return true;
    }

    TriggerEnable(TriggerGetCurrent(), false);
    auto220F810A_ae = libMLCP_gv_mMSkyTempleCount;
    lv_itTemplIndex = 1;
    for ( ; ( (auto220F810A_ai >= 0 && lv_itTemplIndex <= auto220F810A_ae) || (auto220F810A_ai < 0 && lv_itTemplIndex >= auto220F810A_ae) ) ; lv_itTemplIndex += auto220F810A_ai ) {
        libNtve_gf_SetDialogItemMinimumValue(libMLCP_gv_mMSkyTemplePanelIcons[lv_itTemplIndex].lv_shrineProgress, 0.0, PlayerGroupAll());
        libNtve_gf_SetDialogItemMaximumValue(libMLCP_gv_mMSkyTemplePanelIcons[lv_itTemplIndex].lv_shrineProgress, libMLCP_gv_mMSkyTempleTempleStageDuration_C, PlayerGroupAll());
    }
    libMLCP_gf_MMSkyTempleUIShowHidePanel(true);
    while (true) {
        if ((TimerIsPaused(libMLCP_gv_mMSkyTempleBlessingWarningTimer) == false) && (TimerGetRemaining(libMLCP_gv_mMSkyTempleBlessingWarningTimer) > 0.0)) {
            lv_state = libMLCP_ge_MMSkyTempleUIState_Preparing;
            if ((lv_state != lv_lastState)) {
                libMLCP_gf_MMSkyTempleUISetMode(libMLCP_ge_MMSkyTempleUIModes_Timer);
                TriggerStop(libMLCP_gt_MMSkyTempleUIHandlerCaptureProgress);
                TriggerEnable(libMLCP_gt_MMSkyTempleUIHandlerCaptureProgress, true);
            }

            libMLCP_gf_MMSkyTempleUISetWarningTime(FixedToInt(TimerGetRemaining(libMLCP_gv_mMSkyTempleBlessingWarningTimer)));
            lv_lastState = lv_state;
        }
        else if (((libMLCP_gv_mMSkyTemples[(libMLCP_ge_MMSkyTempleTempleIndex_Top)].lv_blessed == true) || (libMLCP_gv_mMSkyTemples[(libMLCP_ge_MMSkyTempleTempleIndex_Middle)].lv_blessed == true) || (libMLCP_gv_mMSkyTemples[(libMLCP_ge_MMSkyTempleTempleIndex_Bottom)].lv_blessed == true))) {
            lv_state = libMLCP_ge_MMSkyTempleUIState_Blessed;
            if ((lv_state != lv_lastState)) {
                libMLCP_gf_MMSkyTempleUISetMode(libMLCP_ge_MMSkyTempleUIModes_Temple);
                TriggerExecute(libMLCP_gt_MMSkyTempleUIHandlerCaptureProgress, true, false);
            }

            auto707CDB48_ae = libMLCP_gv_mMSkyTempleCount;
            lv_itTemplIndex = 1;
            for ( ; ( (auto707CDB48_ai >= 0 && lv_itTemplIndex <= auto707CDB48_ae) || (auto707CDB48_ai < 0 && lv_itTemplIndex >= auto707CDB48_ae) ) ; lv_itTemplIndex += auto707CDB48_ai ) {
                if ((libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_blessed == true)) {
                    libMLCP_gf_MMSkyTempleUIEnableDisableTemple(true, lv_itTemplIndex);
                    if ((libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_finalStage == false)) {
                        libMLCP_gf_MMSkyTempleUISetTempleStage(lv_itTemplIndex, 1, FixedToInt((libMLCP_gv_mMSkyTempleTempleStageDuration_C - libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_progress)));
                        libMLCP_gf_MMSkyTempleUISetTempleOwner(libGame_gf_TeamNumberOfPlayer(UnitGetOwner(libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_temple)), lv_itTemplIndex);
                    }
                    else {
                        libMLCP_gf_MMSkyTempleUISetTempleStage(lv_itTemplIndex, 2, libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_finalShots);
                    }
                }
                else {
                    libMLCP_gf_MMSkyTempleUIEnableDisableTemple(false, lv_itTemplIndex);
                }
            }
            lv_lastState = lv_state;
        }
        else if (true) {
            lv_state = libMLCP_ge_MMSkyTempleUIState_Idle;
            if ((lv_state != lv_lastState)) {
                libMLCP_gf_MMSkyTempleUISetMode(libMLCP_ge_MMSkyTempleUIModes_Idle);
                TriggerStop(libMLCP_gt_MMSkyTempleUIHandlerCaptureProgress);
                TriggerEnable(libMLCP_gt_MMSkyTempleUIHandlerCaptureProgress, true);
            }

            auto00653FA5_ae = libMLCP_gv_mMSkyTempleCount;
            lv_itTemplIndex = 1;
            for ( ; ( (auto00653FA5_ai >= 0 && lv_itTemplIndex <= auto00653FA5_ae) || (auto00653FA5_ai < 0 && lv_itTemplIndex >= auto00653FA5_ae) ) ; lv_itTemplIndex += auto00653FA5_ai ) {
                libMLCP_gf_MMSkyTempleUIEnableDisableTemple(false, lv_itTemplIndex);
                libMLCP_gf_MMSkyTempleUISetTempleOwner(libCore_gv_cOMPUTER_Neutral, lv_itTemplIndex);
            }
            lv_lastState = lv_state;
        }
        Wait(0.5, c_timeGame);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleUIHandler_Init () {
    libMLCP_gt_MMSkyTempleUIHandler = TriggerCreate("libMLCP_gt_MMSkyTempleUIHandler_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple UI Handler Capture Progress
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleUIHandlerCaptureProgress_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_itTemplIndex;
    int lv_ownerTeam;

    // Automatic Variable Declarations
    int auto5DE251E7_ae;
    const int auto5DE251E7_ai = 1;
    int auto5B7EAAA1_val;

    // Variable Initialization

    // Conditions
    if (testConds) {
        if (!((TriggerIsEnabled(TriggerGetCurrent()) == true))) {
            return false;
        }
    }

    // Actions
    if (!runActions) {
        return true;
    }

    TriggerEnable(TriggerGetCurrent(), false);
    while (true) {
        auto5DE251E7_ae = libMLCP_gv_mMSkyTempleCount;
        lv_itTemplIndex = 1;
        for ( ; ( (auto5DE251E7_ai >= 0 && lv_itTemplIndex <= auto5DE251E7_ae) || (auto5DE251E7_ai < 0 && lv_itTemplIndex >= auto5DE251E7_ae) ) ; lv_itTemplIndex += auto5DE251E7_ai ) {
            if ((libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_blessed == true)) {
                if ((libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_finalStage == false)) {
                    auto5B7EAAA1_val = UnitGetOwner(libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_beacon);
                    if (auto5B7EAAA1_val == libCore_gv_cOMPUTER_TeamOrder) {
                        lv_ownerTeam = libGame_gv_teamOrderIndex_C;
                    }
                    else if (auto5B7EAAA1_val == libCore_gv_cOMPUTER_TeamChaos) {
                        lv_ownerTeam = libGame_gv_teamChaosIndex_C;
                    }
                    else if (auto5B7EAAA1_val == libCore_gv_cOMPUTER_Neutral) {
                        if ((libGame_gf_CapturePointCounter(libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_beaconIndex) > 0)) {
                            lv_ownerTeam = libGame_gv_teamOrderIndex_C;
                        }
                        else if ((libGame_gf_CapturePointCounter(libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_beaconIndex) < 0)) {
                            lv_ownerTeam = libGame_gv_teamChaosIndex_C;
                        }
                        else if (true) {
                            lv_ownerTeam = 0;
                        }
                    }
                    else {
                    }
                    libMLCP_gf_MMSkyTempleUISetTempleCaptureProgress(lv_itTemplIndex, lv_ownerTeam, AbsI(libGame_gf_CapturePointCounter(libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_beaconIndex)), libGame_gf_CapturePointCounterMax(libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_beaconIndex));
                    libMLCP_gf_MMSkyTempleUISetTempleContested(lv_itTemplIndex, libGame_gf_CapturePointContested(libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_beaconIndex));
                }
                else {
                    libMLCP_gf_MMSkyTempleUISetTempleCaptureProgress(lv_itTemplIndex, libGame_gf_TeamNumberOfPlayer(UnitGetOwner(libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_temple)), libGame_gf_CapturePointCounterMax(libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_beaconIndex), libGame_gf_CapturePointCounterMax(libMLCP_gv_mMSkyTemples[lv_itTemplIndex].lv_beaconIndex));
                    libMLCP_gf_MMSkyTempleUISetTempleContested(lv_itTemplIndex, false);
                }
            }

        }
        Wait(0.0625, c_timeGame);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleUIHandlerCaptureProgress_Init () {
    libMLCP_gt_MMSkyTempleUIHandlerCaptureProgress = TriggerCreate("libMLCP_gt_MMSkyTempleUIHandlerCaptureProgress_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Harrison Jones Event
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleHarrisonJonesEvent_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Actions
    if (!runActions) {
        return true;
    }

    TriggerEnable(libMLCP_gt_MMSkyTempleHarrisonJonesEnding, true);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleHarrisonJonesEvent_Init () {
    libMLCP_gt_MMSkyTempleHarrisonJonesEvent = TriggerCreate("libMLCP_gt_MMSkyTempleHarrisonJonesEvent_Func");
    TriggerAddEventPlayerEffectUsed(libMLCP_gt_MMSkyTempleHarrisonJonesEvent, c_playerAny, "HarrisonJonesEscapedSet");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Harrison Jones Ending
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleHarrisonJonesEnding_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Conditions
    if (testConds) {
        if (!(((EventUnit() == libGame_gv_teams[libGame_gv_teamOrderIndex_C].lv_core) || (EventUnit() == libGame_gv_teams[libGame_gv_teamChaosIndex_C].lv_core)))) {
            return false;
        }
    }

    // Actions
    if (!runActions) {
        return true;
    }

    libNtve_gf_CreateActorAtPoint("LuxBazaarAdventurerVictory", UnitGetPosition(EventUnit()));
    Wait(0.0625, c_timeGame);
    libNtve_gf_SendActorMessageToGameRegion(RegionCircle(UnitGetPosition(EventUnit()), 10.0), "Signal AdventureTime");
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleHarrisonJonesEnding_Init () {
    libMLCP_gt_MMSkyTempleHarrisonJonesEnding = TriggerCreate("libMLCP_gt_MMSkyTempleHarrisonJonesEnding_Func");
    TriggerEnable(libMLCP_gt_MMSkyTempleHarrisonJonesEnding, false);
    TriggerAddEventUnitDied(libMLCP_gt_MMSkyTempleHarrisonJonesEnding, null);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Debug Start 1
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleDebugStart1_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Conditions
    if (testConds) {
        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {
            return false;
        }
    }

    // Actions
    if (!runActions) {
        return true;
    }

    libMLCP_gf_MMSkyTempleSetupPreview();
    TriggerEnable(libMLCP_gt_MMSkyTempleGatesOpened, false);
    TimerPause(libMLCP_gv_mMSkyTempleBlessingWarningTimer, true);
    libMLCP_gf_MMSkyTemplePrepareTemples();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleDebugStart1_Init () {
    libMLCP_gt_MMSkyTempleDebugStart1 = TriggerCreate("libMLCP_gt_MMSkyTempleDebugStart1_Func");
    TriggerEnable(libMLCP_gt_MMSkyTempleDebugStart1, false);
    TriggerAddEventChatMessage(libMLCP_gt_MMSkyTempleDebugStart1, c_playerAny, "EVENTSTART", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Debug Start
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleDebugStart_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Conditions
    if (testConds) {
        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {
            return false;
        }
    }

    // Actions
    if (!runActions) {
        return true;
    }

    TriggerEnable(libMLCP_gt_MMSkyTempleGatesOpened, false);
    TimerPause(libMLCP_gv_mMSkyTempleBlessingWarningTimer, true);
    libMLCP_gf_MMSkyTemplePrepareTemples();
    TimerStart(libMLCP_gv_mMSkyTempleBlessingWarningTimer, 1.0, false, c_timeGame);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleDebugStart_Init () {
    libMLCP_gt_MMSkyTempleDebugStart = TriggerCreate("libMLCP_gt_MMSkyTempleDebugStart_Func");
    TriggerEnable(libMLCP_gt_MMSkyTempleDebugStart, false);
    TriggerAddEventChatMessage(libMLCP_gt_MMSkyTempleDebugStart, c_playerAny, "-tb", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Debug Next
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleDebugNext_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_itTemple;

    // Automatic Variable Declarations
    int autoAA2EED4D_ae;
    const int autoAA2EED4D_ai = 1;

    // Variable Initialization

    // Conditions
    if (testConds) {
        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {
            return false;
        }
    }

    // Actions
    if (!runActions) {
        return true;
    }

    TriggerEnable(libMLCP_gt_MMSkyTempleGatesOpened, false);
    TimerPause(libMLCP_gv_mMSkyTempleBlessingWarningTimer, true);
    autoAA2EED4D_ae = libMLCP_gv_mMSkyTempleCount;
    lv_itTemple = 1;
    for ( ; ( (autoAA2EED4D_ai >= 0 && lv_itTemple <= autoAA2EED4D_ae) || (autoAA2EED4D_ai < 0 && lv_itTemple >= autoAA2EED4D_ae) ) ; lv_itTemple += autoAA2EED4D_ai ) {
        libMLCP_gf_MMSkyTempleBlessTempleDone(lv_itTemple);
    }
    Wait(5.0, c_timeGame);
    libMLCP_gf_MMSkyTemplePrepareTemples();
    TimerStart(libMLCP_gv_mMSkyTempleBlessingWarningTimer, 1.0, false, c_timeGame);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleDebugNext_Init () {
    libMLCP_gt_MMSkyTempleDebugNext = TriggerCreate("libMLCP_gt_MMSkyTempleDebugNext_Func");
    TriggerEnable(libMLCP_gt_MMSkyTempleDebugNext, false);
    TriggerAddEventChatMessage(libMLCP_gt_MMSkyTempleDebugNext, c_playerAny, "-tn", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Debug Scaling Time
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleDebugScalingTime_Func (bool testConds, bool runActions) {
    // Variable Declarations
    string lv_time;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_time = "";

    // Conditions
    if (testConds) {
        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {
            return false;
        }
    }

    // Actions
    if (!runActions) {
        return true;
    }

    lv_time = StringSub(EventChatMessage(false), 5, 6);
    libGame_gv_scalingTicks = StringToInt(StringWord(EventChatMessage(false), 2));
    UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, (StringExternal("Param/Value/lib_MLCP_2D9B987D") + StringToText(lv_time) + StringExternal("Param/Value/lib_MLCP_FCDA683F")));
    libMLCP_gf_MMSkyTempleSetLevel();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleDebugScalingTime_Init () {
    libMLCP_gt_MMSkyTempleDebugScalingTime = TriggerCreate("libMLCP_gt_MMSkyTempleDebugScalingTime_Func");
    TriggerEnable(libMLCP_gt_MMSkyTempleDebugScalingTime, false);
    TriggerAddEventChatMessage(libMLCP_gt_MMSkyTempleDebugScalingTime, c_playerAny, "-xp", false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MMSkyTemple Spawn Test Temple
//--------------------------------------------------------------------------------------------------
bool libMLCP_gt_MMSkyTempleSpawnTestTemple_Func (bool testConds, bool runActions) {
    // Variable Declarations
    point lv_spawnPoint;

    // Automatic Variable Declarations
    // Variable Initialization

    // Conditions
    if (testConds) {
        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {
            return false;
        }
    }

    // Actions
    if (!runActions) {
        return true;
    }

    libSprt_gf_DEBUGStartGame();
    libSprt_gf_DEBUGSpawnCreepCamps();
    libSprt_gf_DEBUGToggleSelection();
    lv_spawnPoint = CameraGetTarget(1);
    Wait(0.0625, c_timeGame);
    libNtve_gf_CreateUnitsWithDefaultFacing(1, "LuxoriaTemple", c_unitCreateIgnorePlacement, 1, lv_spawnPoint, null);
    if ((StringSub(EventChatMessage(false), 7, 7) == "1")) {
        UnitBehaviorAdd(UnitLastCreated(), "LuxoriaTempleStage1", UnitLastCreated(), 1);
    }
    else {
        UnitBehaviorAdd(UnitLastCreated(), "LuxoriaTempleStage2", UnitLastCreated(), 1);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMLCP_gt_MMSkyTempleSpawnTestTemple_Init () {
    libMLCP_gt_MMSkyTempleSpawnTestTemple = TriggerCreate("libMLCP_gt_MMSkyTempleSpawnTestTemple_Func");
    TriggerEnable(libMLCP_gt_MMSkyTempleSpawnTestTemple, false);
    TriggerAddEventChatMessage(libMLCP_gt_MMSkyTempleSpawnTestTemple, c_playerAny, "-kyle", false);
}

void libMLCP_InitTriggers () {
    libMLCP_gt_MMSkyTempleInit_Init();
    libMLCP_gt_MMSkyTemplePingDataInit_Init();
    libMLCP_gt_MMSkyTempleAnnouncerInit_Init();
    libMLCP_gt_MMSkyTempleGatesOpened_Init();
    libMLCP_gt_MMSkyTempleObjectivePreviewTimerExpires_Init();
    libMLCP_gt_MMSkyTempleBlessWarningTimerExpires_Init();
    libMLCP_gt_MMSkyTempleDefenderAttackLogic_Init();
    libMLCP_gt_MMSkyTempleTempleDefenderDies_Init();
    libMLCP_gt_MMSkyTempleBeaconCaptured_Init();
    libMLCP_gt_MMSkyTempleGameOver_Init();
    libMLCP_gt_MMSkyTempleBeaconColor_Init();
    libMLCP_gt_MMSkyTempleAttacks_Init();
    libMLCP_gt_MMSkyTempleUIModInitialize_Init();
    libMLCP_gt_MMSkyTempleUIHandler_Init();
    libMLCP_gt_MMSkyTempleUIHandlerCaptureProgress_Init();
    libMLCP_gt_MMSkyTempleHarrisonJonesEvent_Init();
    libMLCP_gt_MMSkyTempleHarrisonJonesEnding_Init();
    libMLCP_gt_MMSkyTempleDebugStart1_Init();
    libMLCP_gt_MMSkyTempleDebugStart_Init();
    libMLCP_gt_MMSkyTempleDebugNext_Init();
    libMLCP_gt_MMSkyTempleDebugScalingTime_Init();
    libMLCP_gt_MMSkyTempleSpawnTestTemple_Init();
}

//--------------------------------------------------------------------------------------------------
// Library Initialization
//--------------------------------------------------------------------------------------------------
bool libMLCP_InitLib_completed = false;

void libMLCP_InitLib () {
    if (libMLCP_InitLib_completed) {
        return;
    }

    libMLCP_InitLib_completed = true;

    libMLCP_InitLibraries();
    libMLCP_InitVariables();
    libMLCP_InitTriggers();
}