include "TriggerLibs/NativeLib"
include "TriggerLibs/HeroesLib_h"
include "TriggerLibs/GameLib_h"
include "TriggerLibs/AILib_h"
include "TriggerLibs/UILib_h"
include "TriggerLibs/StartingExperienceLib_h"
include "TriggerLibs/GameDataHelperLib_h"
include "TriggerLibs/SupportLib_h"

include "TriggerLibs/MapMechanicsLib_h"

//--------------------------------------------------------------------------------------------------
// Library: Maps
//--------------------------------------------------------------------------------------------------
// External Library Initialization
void libMapM_InitLibraries () {
    libNtve_InitVariables();
    libCore_InitVariables();
    libGame_InitVariables();
    libAIAI_InitVariables();
    libUIUI_InitVariables();
    libStEx_InitVariables();
    libGDHL_InitVariables();
    libSprt_InitVariables();
}

// Variable Initialization
bool libMapM_InitVariables_completed = false;

void libMapM_InitVariables () {
    int init_i;
    int init_i1;

    if (libMapM_InitVariables_completed) {
        return;
    }

    libMapM_InitVariables_completed = true;

    libMapM_gv_bALJungleLeashRespawnTime = 45.0;
    libMapM_gv_bALJungleCampScalingTimerDuration = 60.0;
    libMapM_gv_bALJungleOgreMageAuraAbilityPowerPercentage = 0.2;
    for (init_i = 0; init_i <= libMapM_gv_jungleMaxCamps; init_i += 1) {
        libMapM_gv_jungleCreepCamps[init_i].lv_campHelperTextTag = c_textTagNone;
        libMapM_gv_jungleCreepCamps[init_i].lv_campRespawnTextTag = c_textTagNone;
        libMapM_gv_jungleCreepCamps[init_i].lv_campSpecialTextTag = c_textTagNone;
        for (init_i1 = 0; init_i1 <= 3; init_i1 += 1) {
            libMapM_gv_jungleCreepCamps[init_i].lv_campPings[init_i1] = c_invalidPingId;
        }
        libMapM_gv_jungleCreepCamps[init_i].lv_stateCreepRespawnTimer = TimerCreate();
        libMapM_gv_jungleCreepCamps[init_i].lv_stateCreepActiveTimer = TimerCreate();
        libMapM_gv_jungleCreepCamps[init_i].lv_aIState = 2;
    }
    for (init_i = 0; init_i <= libMapM_gv_jungleMaxCamps; init_i += 1) {
        libMapM_gv_jungleMiniMapIconGroup[init_i] = UnitGroupEmpty();
    }
    libMapM_gv_jungleScalingTimer = TimerCreate();
    for (init_i = 0; init_i <= libCore_gv_bALMaxEnginePlayerCount; init_i += 1) {
        libMapM_gv_mMIntroCutscene[init_i] = c_cutsceneNone;
    }
    libMapM_gv_mMRavenTributes = UnitGroupEmpty();
    libMapM_gv_mMRavenStartTimer = TimerCreate();
    libMapM_gv_mMRavenWarningTimer = TimerCreate();
    libMapM_gv_mMRavenCurseTimer = TimerCreate();
    libMapM_gv_mMRavenEventFirstTime = true;
    for (init_i = 0; init_i <= 2; init_i += 1) {
        libMapM_gv_mMCannonballsBallsSubmitMaxCurrent[init_i] = libMapM_gv_mMCannonballsBallsSubmitMax_C;
    }
    libMapM_gv_mMCannonballsGhostShipMissileTargetPing = c_invalidPingId;
    libMapM_gv_mMCannonballsTreasureChestTimer = TimerCreate();
    libMapM_gv_mMCannonballsTreasureChestPingTimer = TimerCreate();
    libMapM_gv_mMCannonballsTreasureChestIsFirstChest = true;
    libMapM_gv_mMGardensDragonDragonballKnightNameC = StringExternal("Param/Value/lib_MapM_C1C93EA8");
    libMapM_gv_mMGardensDragonDragonballShrineNameC = StringExternal("Param/Value/lib_MapM_779CD885");
    libMapM_gv_mMGardensDragonStatueTextTag = c_textTagNone;
    libMapM_gv_mMGardensDragonStatueTextTagAllyOwned = c_textTagNone;
    libMapM_gv_mMGardensDragonStatueTextTagEnemyOwned = c_textTagNone;
    libMapM_gv_mMGardensDragonDragonKnightLifeTimer = TimerCreate();
    libMapM_gv_mMGardensDragonSpawnFirstTime = true;
    libMapM_gv_mMGardensDragonDragonTowerStartTimer = TimerCreate();
    libMapM_gv_mMGardensDragonDragonTowerRespawnTimer = TimerCreate();
    libMapM_gv_mMGardensDragonDragonTowerWarningTimer = TimerCreate();
    libMapM_gv_mMGardensDragonDragonStatueActiveReminderTimer = TimerCreate();
    for (init_i = 0; init_i <= libMapM_gv_mMGardensDragonDragonTowerMaxCount; init_i += 1) {
        libMapM_gv_mMGardensDragonDragonTowers[init_i].lv_enabled = true;
        libMapM_gv_mMGardensDragonDragonTowers[init_i].lv_helperText = c_textTagNone;
    }
    libMapM_gv_mMDragonballsTransmissionShrinesRechargeFirstTime = true;
    libMapM_gv_mMUnderworldGatesAbove = UnitGroupEmpty();
    libMapM_gv_mMUnderworldGatesBelow = UnitGroupEmpty();
    for (init_i = 0; init_i <= libCore_gv_bALMaxEnginePlayerCount; init_i += 1) {
        libMapM_gv_mMUnderworldPlayerPlane[init_i] = 1;
    }
    for (init_i = 0; init_i <= 30; init_i += 1) {
        libMapM_gv_mMUnderworldMinionGroups[init_i].lv_units = UnitGroupEmpty();
    }
    libMapM_gv_mMUnderworldSkulls = UnitGroupEmpty();
    libMapM_gv_mMUnderworldSummonedBossHP = StringToFixed(CatalogFieldValueGet(c_gameCatalogUnit, "UnderworldSummonedBoss", "LifeMax", 1));
    libMapM_gv_mMUnderworldSummonedBossDamage = StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "UnderworldSummonedBossWeaponDamage", "Amount", 1));
    libMapM_gv_mMUnderworldSummonedBossDamageStun = StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "UnderworldSummonedBossStunDamage", "Amount", 1));
    libMapM_gv_mMUnderworldSummonedBossDamageRootImpact = StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "UnderworldSummonedBossRootsImpactDamage", "Amount", 1));
    libMapM_gv_mMUnderworldSummonedBossDamageRootSustain = StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "UnderworldSummonedBossRootsSustainedDamage", "Amount", 1));
    libMapM_gv_mMUnderworldOpenFirstTime = true;
    libMapM_gv_mMUnderworldPrepTimer = TimerCreate();
    libMapM_gv_mMUnderworldMinimapSplit = c_invalidDialogControlId;
    libMapM_gv_mMUnderworldTransmissionUnderworldOpenFirstTime = true;
    libMapM_gv_mMHoCForestActiveAncients = UnitGroupEmpty();
}

// Presets
string libMapM_ge_JungleCampStates_Ident (int lp_val) {
         if (lp_val == 0) { return "Idle"; }
    else if (lp_val == 1) { return "Busy"; }
    else if (lp_val == 2) { return "Dead"; }
    else if (lp_val == 3) { return "Paused"; }
    else if (lp_val == 4) { return "Hibernating"; }
    else if (lp_val == 5) { return "HibernatingReadyToRespawn"; }
    return null;
}

// Functions
void libMapM_gf_DataInitializeScalingDataForDefender (int lp_defenderType, string lp_scalingBehavior) {
    int autoFE2B172D_ae;
    int autoFE2B172D_ai;

    // Variable Declarations
    int lv_itRank;
    int lv_defenderTypeIndex;
    int lv_totalXPBuffAmount;

    // Variable Initialization

    // Implementation
    lv_defenderTypeIndex = (lp_defenderType);
    libMapM_gv_dataJungleCampDefenderData[lv_defenderTypeIndex].lv_numberOfRanks = (CatalogFieldValueCount(c_gameCatalogBehavior, lp_scalingBehavior, "VeterancyLevelArray", c_playerAny) - 1);
    autoFE2B172D_ae = libMapM_gv_dataJungleCampDefenderData[lv_defenderTypeIndex].lv_numberOfRanks;
    autoFE2B172D_ai = 1;
    lv_itRank = 1;
    for ( ; ( (autoFE2B172D_ai >= 0 && lv_itRank <= autoFE2B172D_ae) || (autoFE2B172D_ai <= 0 && lv_itRank >= autoFE2B172D_ae) ) ; lv_itRank += autoFE2B172D_ai ) {
        lv_totalXPBuffAmount += StringToInt(CatalogFieldValueGet(c_gameCatalogBehavior, lp_scalingBehavior, "VeterancyLevelArray[" + IntToString(lv_itRank) + "].Modification.Food", c_playerAny));
        libMapM_gv_dataJungleCampDefenderData[lv_defenderTypeIndex].lv_xPBuffAmount[lv_itRank] = lv_totalXPBuffAmount;
    }
}

void libMapM_gf_DataInitializeScalingDataForMerc (int lp_mercType, string lp_scalingBehavior) {
    int auto1C3E138D_ae;
    int auto1C3E138D_ai;

    // Variable Declarations
    int lv_itRank;
    int lv_mercTypeIndex;
    int lv_totalXPBuffAmount;

    // Variable Initialization

    // Implementation
    lv_mercTypeIndex = (lp_mercType);
    libMapM_gv_dataJungleCampMercData[lv_mercTypeIndex].lv_numberOfRanks = (CatalogFieldValueCount(c_gameCatalogBehavior, lp_scalingBehavior, "VeterancyLevelArray", c_playerAny) - 1);
    auto1C3E138D_ae = libMapM_gv_dataJungleCampMercData[lv_mercTypeIndex].lv_numberOfRanks;
    auto1C3E138D_ai = 1;
    lv_itRank = 1;
    for ( ; ( (auto1C3E138D_ai >= 0 && lv_itRank <= auto1C3E138D_ae) || (auto1C3E138D_ai <= 0 && lv_itRank >= auto1C3E138D_ae) ) ; lv_itRank += auto1C3E138D_ai ) {
        lv_totalXPBuffAmount += StringToInt(CatalogFieldValueGet(c_gameCatalogBehavior, lp_scalingBehavior, "VeterancyLevelArray[" + IntToString(lv_itRank) + "].Modification.Food", c_playerAny));
        libMapM_gv_dataJungleCampMercData[lv_mercTypeIndex].lv_xPBuffAmount[lv_itRank] = lv_totalXPBuffAmount;
    }
}

void libMapM_gf_JungleInitializeDefenderData (int lp_camp) {
    int auto6AB4C519_ae;
    int auto6AB4C519_ai;
    int auto7D68F867_ae;
    int auto7D68F867_ai;
    int auto95FF0122_ae;
    int auto95FF0122_ai;

    // Variable Declarations
    int lv_i;
    int lv_campTypeIndex;
    int lv_missingPoints;

    // Variable Initialization

    // Implementation
    if ((libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampDefenderType != 0)) {
        lv_campTypeIndex = (libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampDefenderType);
        libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderCampIsSoloable = libMapM_gv_dataJungleCampDefenderData[lv_campTypeIndex].lv_campIsSoloable;
        libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderRespawnTime = libMapM_gv_dataJungleCampDefenderData[lv_campTypeIndex].lv_respawnTime;
        libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderCount = libMapM_gv_dataJungleCampDefenderData[lv_campTypeIndex].lv_numberOfCreeps;
        auto6AB4C519_ae = libMapM_gv_dataJungleCampDefenderData[lv_campTypeIndex].lv_numberOfCreeps;
        auto6AB4C519_ai = 1;
        lv_i = 1;
        for ( ; ( (auto6AB4C519_ai >= 0 && lv_i <= auto6AB4C519_ae) || (auto6AB4C519_ai <= 0 && lv_i >= auto6AB4C519_ae) ) ; lv_i += auto6AB4C519_ai ) {
            libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderUnitTypes[lv_i] = libMapM_gv_dataJungleCampDefenderData[lv_campTypeIndex].lv_creepUnitTypes[lv_i];
        }
        libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderNumberOfRanks = libMapM_gv_dataJungleCampDefenderData[lv_campTypeIndex].lv_numberOfRanks;
        auto7D68F867_ae = libMapM_gv_dataJungleCampDefenderData[lv_campTypeIndex].lv_numberOfRanks;
        auto7D68F867_ai = 1;
        lv_i = 0;
        for ( ; ( (auto7D68F867_ai >= 0 && lv_i <= auto7D68F867_ae) || (auto7D68F867_ai <= 0 && lv_i >= auto7D68F867_ae) ) ; lv_i += auto7D68F867_ai ) {
            libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderCampLevel[lv_i] = libMapM_gv_dataJungleCampDefenderData[lv_campTypeIndex].lv_campLevel[lv_i];
        }
    }
    else {
    }
    auto95FF0122_ae = libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderCount;
    auto95FF0122_ai = 1;
    lv_i = 1;
    for ( ; ( (auto95FF0122_ai >= 0 && lv_i <= auto95FF0122_ae) || (auto95FF0122_ai <= 0 && lv_i >= auto95FF0122_ae) ) ; lv_i += auto95FF0122_ai ) {
        if ((libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataDefenderSpawnPoints[lv_i] == null)) {
            lv_missingPoints += 1;
        }
        else {
        }
    }
    if ((lv_missingPoints > 0)) {
        TextExpressionSetToken("Param/Expression/lib_MapM_7AB5D588", "A", IntToText(lp_camp));
        TextExpressionSetToken("Param/Expression/lib_MapM_7AB5D588", "B", IntToText(lv_missingPoints));
        TriggerDebugOutput(1, TextExpressionAssemble("Param/Expression/lib_MapM_7AB5D588"), true);
    }
    else {
    }
    libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderCaptureXPValue = libMapM_gv_dataJungleCampDefenderData[lv_campTypeIndex].lv_xPAwardForCapture;
}

void libMapM_gf_JungleInitializeMercCampData (int lp_camp) {
    int autoD92817D3_ae;
    int autoD92817D3_ai;
    int auto3F7D2E74_ae;
    int auto3F7D2E74_ai;
    int autoC6A8DA7C_ae;
    int autoC6A8DA7C_ai;
    int auto2503891E_ae;
    int auto2503891E_ai;

    // Variable Declarations
    int lv_i;
    int lv_team;
    int lv_lane;
    int lv_wapoint;
    int lv_campTypeIndex;
    int lv_ownerPlayer;
    point lv_rallyPoint;
    bool lv_foundLane;
    int lv_spawnLane;
    int lv_spawnFirstWaypointIndex;

    // Variable Initialization

    // Implementation
    lv_campTypeIndex = (libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataMercSpawnType);
    libMapM_gv_jungleCreepCamps[lp_camp].lv_mercNumberOfMinionsSpawned = libMapM_gv_dataJungleCampMercData[lv_campTypeIndex].lv_numberOfMinionsSpawned;
    autoD92817D3_ae = libMapM_gv_dataJungleCampMercData[lv_campTypeIndex].lv_numberOfMinionsSpawned;
    autoD92817D3_ai = 1;
    lv_i = 1;
    for ( ; ( (autoD92817D3_ai >= 0 && lv_i <= autoD92817D3_ae) || (autoD92817D3_ai <= 0 && lv_i >= autoD92817D3_ae) ) ; lv_i += autoD92817D3_ai ) {
        libMapM_gv_jungleCreepCamps[lp_camp].lv_mercSpawnedMinionUnitType[lv_i] = libMapM_gv_dataJungleCampMercData[lv_campTypeIndex].lv_spawnedMinionUnitTypes[lv_i];
    }
    libMapM_gv_jungleCreepCamps[lp_camp].lv_mercNumberOfRanks = libMapM_gv_dataJungleCampMercData[lv_campTypeIndex].lv_numberOfRanks;
    auto3F7D2E74_ae = 2;
    auto3F7D2E74_ai = 1;
    lv_team = 1;
    for ( ; ( (auto3F7D2E74_ai >= 0 && lv_team <= auto3F7D2E74_ae) || (auto3F7D2E74_ai <= 0 && lv_team >= auto3F7D2E74_ae) ) ; lv_team += auto3F7D2E74_ai ) {
        lv_rallyPoint = libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataMercMinionRallyPoint[lv_team];
        if ((lv_team == 1)) {
            lv_ownerPlayer = libCore_gv_cOMPUTER_TeamOrder;
        }
        else {
            lv_ownerPlayer = libCore_gv_cOMPUTER_TeamChaos;
        }
        lv_foundLane = false;
        autoC6A8DA7C_ae = libGame_gv_laneCount;
        autoC6A8DA7C_ai = 1;
        lv_lane = 1;
        for ( ; ( (autoC6A8DA7C_ai >= 0 && lv_lane <= autoC6A8DA7C_ae) || (autoC6A8DA7C_ai <= 0 && lv_lane >= autoC6A8DA7C_ae) ) ; lv_lane += autoC6A8DA7C_ai ) {
            auto2503891E_ae = libGame_gv_laneData[lv_lane].lv_waypointCount;
            auto2503891E_ai = 1;
            lv_wapoint = 1;
            for ( ; ( (auto2503891E_ai >= 0 && lv_wapoint <= auto2503891E_ae) || (auto2503891E_ai <= 0 && lv_wapoint >= auto2503891E_ae) ) ; lv_wapoint += auto2503891E_ai ) {
                if ((libGame_gv_laneData[lv_lane].lv_waypoints[lv_wapoint] == lv_rallyPoint)) {
                    lv_spawnLane = lv_lane;
                    lv_spawnFirstWaypointIndex = lv_wapoint;
                    lv_foundLane = true;
                    break;
                }
                else {
                }
            }
        }
        if ((lv_foundLane == false)) {
            libGame_gf_CalculateSpawnedMinionGoalPoints(lv_ownerPlayer, libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint);
            lv_spawnLane = libGame_gv_spawnedMinionLane;
            lv_spawnFirstWaypointIndex = libGame_gv_spawnedMinionFirstWaypointIndex;
        }
        else {
        }
        libMapM_gv_jungleCreepCamps[lp_camp].lv_mercSpawnLane[lv_team] = lv_spawnLane;
        libMapM_gv_jungleCreepCamps[lp_camp].lv_mercSpawnFirstWaypointIndex[lv_team] = lv_spawnFirstWaypointIndex;
    }
}

void libMapM_gf_JungleInitializeDoubloonCampData (int lp_camp) {
    // Variable Declarations
    int lv_i;
    int lv_spawnwave;
    int lv_lane;
    int lv_wapoint;
    int lv_campTypeIndex;
    point lv_rallyPoint;

    // Variable Initialization

    // Implementation
    lv_campTypeIndex = (libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataBattleshipSpawnType);
    libMapM_gv_jungleCreepCamps[lp_camp].lv_piratesNumberOfRanks = libMapM_gv_dataJungleCampMercData[lv_campTypeIndex].lv_numberOfRanks;
}

void libMapM_gf_JungleInitializeDoubloonSmallCampData (int lp_camp) {
    // Variable Declarations
    int lv_campTypeIndex;

    // Variable Initialization

    // Implementation
    lv_campTypeIndex = (libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataBattleshipSpawnType);
    libMapM_gv_jungleCreepCamps[lp_camp].lv_piratesNumberOfRanks = libMapM_gv_dataJungleCampMercData[lv_campTypeIndex].lv_numberOfRanks;
}

void libMapM_gf_JungleInitializeAshenvaleForestCampData (int lp_camp) {
    // Implementation
    libMapM_gf_MMHoCLivingTreesInitializeLivingTreesArray();
    libMapM_gf_MMHoCForestInitializeForestsArray();
    libMapM_gv_mMHoCForestJungleCamp = lp_camp;
    libMapM_gv_jungleCreepCamps[lp_camp].lv_mercNumberOfRanks = libMapM_gv_dataJungleCampMercData[(4)].lv_numberOfRanks;
    libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataMercSpawnType = 4;
}

void libMapM_gf_JungleInitializeCreepCamp (int lp_camp) {
    int autoBEEB7AAF_val;

    // Variable Declarations
    unit lv_iconUnit;
    string lv_icon;
    const int lv_textTagHeightOffset = 4;

    // Variable Initialization

    // Implementation
    libMapM_gv_jungleCreepCamps[lp_camp].lv_campOwnershipFlagUnit = UnitGroupUnit(UnitGroup("CampOwnershipFlag", c_playerAny, libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataDefenderLeashRegion, UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 1), 1);
    autoBEEB7AAF_val = libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampType;
    if (autoBEEB7AAF_val == 0) {
        libNtve_gf_CreateUnitsWithDefaultFacing(1, "JungleCampIconUnitTeamColor", c_unitCreateIgnorePlacement, 0, libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint);
        lv_iconUnit = UnitLastCreated();
    }
    else {
        libNtve_gf_CreateUnitsWithDefaultFacing(1, "JungleCampIconUnit", c_unitCreateIgnorePlacement, 0, libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint);
        lv_iconUnit = UnitLastCreated();
    }
    TextTagCreate(StringToText(""), 16, UnitGetPosition(libMapM_gv_jungleCreepCamps[lp_camp].lv_campOwnershipFlagUnit), lv_textTagHeightOffset, true, false, PlayerGroupAll());
    TextTagShow(TextTagLastCreated(), PlayerGroupAll(), false);
    libMapM_gv_jungleCreepCamps[lp_camp].lv_campHelperTextTag = TextTagLastCreated();
    TextTagCreate(StringToText(""), 32, PointWithOffset(libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint, 1.0, 1.0), 0.0, true, false, PlayerGroupAll());
    TextTagShow(TextTagLastCreated(), PlayerGroupAll(), false);
    libMapM_gv_jungleCreepCamps[lp_camp].lv_campRespawnTextTag = TextTagLastCreated();
    TextTagCreate(StringToText(""), 32, PointWithOffset(libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint, 1.0, 1.0), 0.0, true, false, PlayerGroupAll());
    TextTagShow(TextTagLastCreated(), PlayerGroupAll(), false);
    libMapM_gv_jungleCreepCamps[lp_camp].lv_campSpecialTextTag = TextTagLastCreated();
    lv_icon = libMapM_gf_JungleGetCurrentIconForJungleCamp(lp_camp, true);
    libNtve_gf_SendActorMessageToUnit(lv_iconUnit, "MinimapIcon " + lv_icon);
    libMapM_gv_jungleCreepCamps[lp_camp].lv_campIconUnit = lv_iconUnit;
}

int libMapM_gf_JungleGetJungleCampForUnit (unit lp_unit) {
    // Variable Declarations
    int lv_i;

    // Variable Initialization

    // Implementation
    return FixedToInt(UnitGetCustomValue(lp_unit, libCore_gf_CustomValueIndex(1)));
}

string libMapM_gf_JungleGetCurrentIconForJungleCamp (int lp_camp, bool lp_alive) {
    int autoC825EDFA_val;

    // Implementation
    autoC825EDFA_val = libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampType;
    if (autoC825EDFA_val == 0) {
        if ((libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampDefenderType == 3)) {
            if ((lp_alive == true)) {
                return "Assets\\Textures\\storm_ui_minimapicon_ogrenaut.dds";
            }
            else {
                return "Assets\\Textures\\storm_ui_minimapicon_ogrenaut_dead.dds";
            }
        }
        else {
            if (true) {
                return "Assets\\Textures\\storm_ui_minimapicon_ogrecamp.dds";
            }
            else {
                return "Assets\\Textures\\storm_ui_minimapicon_ogrecamp_dead.dds";
            }
        }
    }
    else if (autoC825EDFA_val == 1) {
        if ((lp_alive == true)) {
            return "Assets\\Textures\\storm_ui_minimapicon_ogreking.dds";
        }
        else {
            return "Assets\\Textures\\storm_ui_minimapicon_ogreking_dead.dds";
        }
    }
    else if (autoC825EDFA_val == 2) {
        if ((lp_alive == true)) {
            return "Assets\\Textures\\storm_ui_minimapicon_creepcamp_weak.dds";
        }
        else {
            return "Assets\\Textures\\storm_ui_minimapicon_creepcamp_weak_dead.dds";
        }
    }
    else {
        if ((lp_alive == true)) {
            return "Assets\\Textures\\storm_ui_minimapicon_creepcamp_medium.dds";
        }
        else {
            return "Assets\\Textures\\storm_ui_minimapicon_creepcamp_medium_dead.dds";
        }
    }
}

string libMapM_gf_JungleGetPortraitForJungleCamp (int lp_camp) {
    int auto253F4BAC_val;
    int autoF6D62E55_val;

    // Implementation
    auto253F4BAC_val = libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampType;
    if (auto253F4BAC_val == 0) {
        autoF6D62E55_val = libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataMercSpawnType;
        if (autoF6D62E55_val == 1) {
            return "Assets\\Textures\\war3_btnSiegeGiant.dds";
        }
        else if (autoF6D62E55_val == 2) {
            return "Assets\\Textures\\war3_btnogre.dds";
        }
        else if (autoF6D62E55_val == 3) {
            return "Assets\\Textures\\storm_ui_minimapicon_ogrenaut.dds";
        }
        else {
            return "Assets\\Textures\\war3_btnmercenarycamp.dds";
        }
    }
    else {
    }
    return null;
}

string libMapM_gf_JungleGetPortraitForUnitType (string lp_unitType) {
    string autoA489BFB7_val;

    // Implementation
    autoA489BFB7_val = lp_unitType;
    if (autoA489BFB7_val == "MercLanerSiegeGiant") {
        return "Assets\\Textures\\storm_temp_war3_btnberserk.dds";
    }
    else if (autoA489BFB7_val == "MercLanerMeleeOgre") {
        return "Assets\\Textures\\storm_temp_war3_btnrevenant.dds";
    }
    else if (autoA489BFB7_val == "MercLanerRangedOgre") {
        return "Assets\\Textures\\storm_temp_war3_btnrevenant.dds";
    }
    else if (autoA489BFB7_val == "MercLanerDragon") {
        return "Assets\\Textures\\storm_temp_war3_btnbronzedragon.dds";
    }
    else if (autoA489BFB7_val == "JungleGraveGolemLaner") {
        return "Assets\\Textures\\storm_temp_war3_btngolemthunderclap.dds";
    }
    else {
    }
    return null;
}

text libMapM_gf_JungleGetNameTextForJungleCamp (int lp_camp) {
    int auto9A00953C_val;
    int auto4B152FD2_val;

    // Implementation
    auto9A00953C_val = libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampType;
    if (auto9A00953C_val == 0) {
        auto4B152FD2_val = libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataMercSpawnType;
        if (auto4B152FD2_val == 1) {
            return StringExternal("Param/Value/lib_MapM_71255AE7");
        }
        else if (auto4B152FD2_val == 2) {
            return StringExternal("Param/Value/lib_MapM_D0F00D8A");
        }
        else if (auto4B152FD2_val == 3) {
            return StringExternal("Param/Value/lib_MapM_B9B68899");
        }
        else {
            return StringExternal("Param/Value/lib_MapM_B37AEAAE");
        }
    }
    else if (auto9A00953C_val == 1) {
        return StringExternal("Param/Value/lib_MapM_2AE79BAD");
    }
    else if (auto9A00953C_val == 2) {
        return StringExternal("Param/Value/lib_MapM_B72F24BC");
    }
    else {
    }
    return StringExternal("Param/Value/lib_MapM_6B5370A7");
}

unit libMapM_gf_JungleGetRandomEnemyHeroInRangeOfMinionWithMinimumRangeRequirements (unit lp_creep, point lp_position, fixed lp_minimumRange, fixed lp_maximumRange, unit lp_restrictedUnit) {
    unitgroup autoBBCB82D8_g;
    int autoBBCB82D8_u;

    // Variable Declarations
    unit lv_u;
    unitgroup lv_unitGroup;
    point lv_minionPosition;

    // Variable Initialization
    lv_unitGroup = UnitGroupEmpty();

    // Implementation
    autoBBCB82D8_g = UnitGroup(null, c_playerAny, RegionCircle(lp_position, lp_maximumRange), UnitFilter((1 << c_targetFilterHeroic) | (1 << c_targetFilterVisible), 0, (1 << c_targetFilterPlayer) | (1 << c_targetFilterAlly) | (1 << c_targetFilterStructure) | (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    autoBBCB82D8_u = 1;
    for ( ; autoBBCB82D8_u <= UnitGroupCount(autoBBCB82D8_g, c_unitCountAll) ; autoBBCB82D8_u += BoolToInt(lv_u == UnitGroupUnit(autoBBCB82D8_g, autoBBCB82D8_u)) ) {
        lv_u = UnitGroupUnit(autoBBCB82D8_g, autoBBCB82D8_u);
        if ((DistanceBetweenPoints(lp_position, UnitGetPosition(lv_u)) >= lp_minimumRange) && (lv_u != lp_restrictedUnit)) {
            UnitGroupAdd(lv_unitGroup, lv_u);
        }
        else {
        }
    }
    return UnitGroupUnit(lv_unitGroup, RandomInt(1, UnitGroupCount(lv_unitGroup, c_unitCountAll)));
}

int libMapM_gf_JungleGetCampIndexFromDefenderIndex (int lp_defenderIndex) {
    int autoFFD97303_ae;
    int autoFFD97303_ai;

    // Variable Declarations
    int lv_itCamp;

    // Variable Initialization

    // Implementation
    autoFFD97303_ae = libMapM_gv_jungleNumberOfCreepCamps;
    autoFFD97303_ai = 1;
    lv_itCamp = 1;
    for ( ; ( (autoFFD97303_ai >= 0 && lv_itCamp <= autoFFD97303_ae) || (autoFFD97303_ai <= 0 && lv_itCamp >= autoFFD97303_ae) ) ; lv_itCamp += autoFFD97303_ai ) {
        if ((libMapM_gv_jungleCreepCamps[lv_itCamp].lv_aIDefenderAIIndex == lp_defenderIndex)) {
            return lv_itCamp;
        }
        else {
        }
    }
    return 0;
}

void libMapM_gf_JungleUpdateTextTagForCamp (int lp_camp, int lp_type) {
    int auto9E3B2594_val;
    int auto12367E0F_val;
    int autoBC18E485_val;

    // Variable Declarations
    int lv_campType;
    int lv_campLevel;
    text lv_helperTextStart;

    // Variable Initialization

    // Implementation
    lv_campType = libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampType;
    auto9E3B2594_val = lp_type;
    if (auto9E3B2594_val == 0) {
        lv_campLevel = libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderCampLevel[libMapM_gv_jungleCreepCamps[lp_camp].lv_stateCurrentDefenderScalingTicks];
        auto12367E0F_val = libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampDefenderType;
        if (auto12367E0F_val == 4) {
            lv_helperTextStart = TextExpressionAssemble("Param/Expression/lib_MapM_D3749169");
        }
        else if (auto12367E0F_val == 1) {
            lv_helperTextStart = TextExpressionAssemble("Param/Expression/lib_MapM_9D23BB4E");
        }
        else if (auto12367E0F_val == 2) {
            lv_helperTextStart = TextExpressionAssemble("Param/Expression/lib_MapM_E73FDC76");
        }
        else if (auto12367E0F_val == 3) {
            lv_helperTextStart = TextExpressionAssemble("Param/Expression/lib_MapM_F8D83948");
        }
        else {
            TextExpressionSetToken("Param/Expression/lib_MapM_C98903E3", "A", IntToText(lv_campLevel));
            lv_helperTextStart = TextExpressionAssemble("Param/Expression/lib_MapM_C98903E3");
        }
        autoBC18E485_val = lv_campType;
        if (autoBC18E485_val == 0) {
            TextExpressionSetToken("Param/Expression/lib_MapM_151AD4C0", "A", lv_helperTextStart);
            TextTagSetText(libMapM_gv_jungleCreepCamps[lp_camp].lv_campHelperTextTag, TextExpressionAssemble("Param/Expression/lib_MapM_151AD4C0"));
        }
        else if (autoBC18E485_val == 3) {
            TextExpressionSetToken("Param/Expression/lib_MapM_417836B8", "A", lv_helperTextStart);
            TextTagSetText(libMapM_gv_jungleCreepCamps[lp_camp].lv_campHelperTextTag, TextExpressionAssemble("Param/Expression/lib_MapM_417836B8"));
        }
        else if (autoBC18E485_val == 1) {
            TextExpressionSetToken("Param/Expression/lib_MapM_C04855C3", "A", lv_helperTextStart);
            TextTagSetText(libMapM_gv_jungleCreepCamps[lp_camp].lv_campHelperTextTag, TextExpressionAssemble("Param/Expression/lib_MapM_C04855C3"));
        }
        else if (autoBC18E485_val == 2) {
            TextExpressionSetToken("Param/Expression/lib_MapM_729CF307", "A", lv_helperTextStart);
            TextTagSetText(libMapM_gv_jungleCreepCamps[lp_camp].lv_campHelperTextTag, TextExpressionAssemble("Param/Expression/lib_MapM_729CF307"));
        }
        else {
        }
    }
    else if (auto9E3B2594_val == 1) {
        TextExpressionSetToken("Param/Expression/lib_MapM_CF390F62", "A", TextTimeFormat(StringToText("<min2/>:<sec2/>"), FixedToInt(TimerGetRemaining(libMapM_gv_jungleCreepCamps[lp_camp].lv_stateCreepRespawnTimer))));
        TextTagSetText(libMapM_gv_jungleCreepCamps[lp_camp].lv_campRespawnTextTag, TextExpressionAssemble("Param/Expression/lib_MapM_CF390F62"));
    }
    else if (auto9E3B2594_val == 2) {
    }
    else {
    }
}

void libMapM_gf_JungleSwitchToTextTagForCamp (int lp_camp, int lp_type) {
    int autoE48F464D_val;

    // Implementation
    TextTagShow(libMapM_gv_jungleCreepCamps[lp_camp].lv_campHelperTextTag, PlayerGroupAll(), false);
    TextTagShow(libMapM_gv_jungleCreepCamps[lp_camp].lv_campRespawnTextTag, PlayerGroupAll(), false);
    TextTagShow(libMapM_gv_jungleCreepCamps[lp_camp].lv_campSpecialTextTag, PlayerGroupAll(), false);
    libMapM_gf_JungleUpdateTextTagForCamp(lp_camp, lp_type);
    autoE48F464D_val = lp_type;
    if (autoE48F464D_val == 0) {
        TextTagShow(libMapM_gv_jungleCreepCamps[lp_camp].lv_campHelperTextTag, PlayerGroupAll(), true);
    }
    else if (autoE48F464D_val == 1) {
        TextTagShow(libMapM_gv_jungleCreepCamps[lp_camp].lv_campHelperTextTag, PlayerGroupAll(), true);
        TextTagShow(libMapM_gv_jungleCreepCamps[lp_camp].lv_campRespawnTextTag, PlayerGroupAll(), true);
    }
    else if (autoE48F464D_val == 2) {
        TextTagShow(libMapM_gv_jungleCreepCamps[lp_camp].lv_campSpecialTextTag, PlayerGroupAll(), true);
    }
    else {
    }
}

void libMapM_gf_JungleUpdateMinimapTooltipForCamp (int lp_camp) {
    int auto5F9910CC_val;

    // Variable Declarations
    int lv_campDisplayLevel;

    // Variable Initialization

    // Implementation
    lv_campDisplayLevel = libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderCampLevel[libMapM_gv_jungleCreepCamps[lp_camp].lv_stateCurrentDefenderScalingTicks];
    auto5F9910CC_val = libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampType;
    if (auto5F9910CC_val == 1) {
        TextExpressionSetToken("Param/Expression/lib_MapM_5B7D0143", "A", IntToText(lv_campDisplayLevel));
        ActorSendAsText(libNtve_gf_MainActorofUnit(libMapM_gv_jungleCreepCamps[lp_camp].lv_campIconUnit), TextExpressionAssemble("Param/Expression/lib_MapM_5B7D0143"));
    }
    else if (auto5F9910CC_val == 0) {
        if ((libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderCampIsSoloable == true)) {
            TextExpressionSetToken("Param/Expression/lib_MapM_38707B1D", "A", IntToText(lv_campDisplayLevel));
            ActorSendAsText(libNtve_gf_MainActorofUnit(libMapM_gv_jungleCreepCamps[lp_camp].lv_campIconUnit), TextExpressionAssemble("Param/Expression/lib_MapM_38707B1D"));
        }
        else {
            TextExpressionSetToken("Param/Expression/lib_MapM_2C883B38", "A", IntToText(lv_campDisplayLevel));
            ActorSendAsText(libNtve_gf_MainActorofUnit(libMapM_gv_jungleCreepCamps[lp_camp].lv_campIconUnit), TextExpressionAssemble("Param/Expression/lib_MapM_2C883B38"));
        }
    }
    else if (auto5F9910CC_val == 3) {
        TextExpressionSetToken("Param/Expression/lib_MapM_8E46907F", "A", IntToText(lv_campDisplayLevel));
        ActorSendAsText(libNtve_gf_MainActorofUnit(libMapM_gv_jungleCreepCamps[lp_camp].lv_campIconUnit), TextExpressionAssemble("Param/Expression/lib_MapM_8E46907F"));
    }
    else {
        TextExpressionSetToken("Param/Expression/lib_MapM_7274346A", "A", IntToText(lv_campDisplayLevel));
        ActorSendAsText(libNtve_gf_MainActorofUnit(libMapM_gv_jungleCreepCamps[lp_camp].lv_campIconUnit), TextExpressionAssemble("Param/Expression/lib_MapM_7274346A"));
    }
}

void libMapM_gf_JungleCreatePingsForCamp (int lp_camp, unit lp_unitPingIsAttachedTo) {
    // Variable Declarations
    int lv_i;
    int lv_owner;
    playergroup lv_killingTeam;
    playergroup lv_otherTeam;
    color lv_observerPingColor;
    string lv_pingModel;

    // Variable Initialization
    lv_killingTeam = PlayerGroupEmpty();
    lv_otherTeam = PlayerGroupEmpty();
    lv_observerPingColor = Color(0,0,0);
    lv_pingModel = "StormPingBoss";

    // Implementation
    lv_owner = UnitGetOwner(lp_unitPingIsAttachedTo);
    if ((lv_owner == libCore_gv_cOMPUTER_TeamOrder)) {
        lv_killingTeam = libCore_gv_teamOrder;
        lv_otherTeam = libCore_gv_teamChaos;
        lv_observerPingColor = libCore_gv_cOLORAllyColor;
    }
    else {
        lv_killingTeam = libCore_gv_teamChaos;
        lv_otherTeam = libCore_gv_teamOrder;
        lv_observerPingColor = libCore_gv_cOLOREnemyColor;
    }
    libNtve_gf_CreatePingFacingAngle(lv_killingTeam, lv_pingModel, UnitGetPosition(lp_unitPingIsAttachedTo), libCore_gv_cOLORAllyColor, 0.0, 270.0);
    PingSetUnit(PingLastCreated(), lp_unitPingIsAttachedTo);
    libMapM_gv_jungleCreepCamps[lp_camp].lv_campPings[1] = PingLastCreated();
    libNtve_gf_CreatePingFacingAngle(lv_otherTeam, lv_pingModel, UnitGetPosition(lp_unitPingIsAttachedTo), libCore_gv_cOLOREnemyColor, 0.0, 270.0);
    PingSetUnit(PingLastCreated(), lp_unitPingIsAttachedTo);
    libMapM_gv_jungleCreepCamps[lp_camp].lv_campPings[2] = PingLastCreated();
    PingSetUseUnitVisibility(PingLastCreated(), true);
    libNtve_gf_CreatePingFacingAngle(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], lv_pingModel, UnitGetPosition(lp_unitPingIsAttachedTo), lv_observerPingColor, 0.0, 270.0);
    PingSetUnit(PingLastCreated(), lp_unitPingIsAttachedTo);
    libMapM_gv_jungleCreepCamps[lp_camp].lv_campPings[3] = PingLastCreated();
}

void libMapM_gf_JungleDestroyPingsForCamp (int lp_camp) {
    int autoBCD039EF_ae;
    int autoBCD039EF_ai;

    // Variable Declarations
    int lv_i;

    // Variable Initialization

    // Implementation
    autoBCD039EF_ae = 3;
    autoBCD039EF_ai = 1;
    lv_i = 1;
    for ( ; ( (autoBCD039EF_ai >= 0 && lv_i <= autoBCD039EF_ae) || (autoBCD039EF_ai <= 0 && lv_i >= autoBCD039EF_ae) ) ; lv_i += autoBCD039EF_ai ) {
        PingDestroy(libMapM_gv_jungleCreepCamps[lp_camp].lv_campPings[lv_i]);
    }
}

void libMapM_gf_JungleRespawnCreepsForCamp (int lp_camp) {
    unitgroup auto10B8F53E_g;
    int auto10B8F53E_u;
    unitgroup autoB3DF04CC_g;
    int autoB3DF04CC_u;
    int auto9754AF77_ae;
    int auto9754AF77_ai;
    playergroup auto77130FE9_g;
    int auto77130FE9_p;
    playergroup auto8581218A_g;
    int auto8581218A_p;

    // Variable Declarations
    int lv_i;
    unit lv_u;
    region lv_aggroRegion;
    int lv_numberofcreeps;
    string lv_icon;
    int lv_heightOffset;
    text lv_helperTextStart;
    unitgroup lv_defenderGroup;

    // Variable Initialization
    lv_heightOffset = 4;
    lv_defenderGroup = UnitGroupEmpty();

    // Implementation
    if (((libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampType == 0) || (libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampType == 1))) {
        UnitSetOwner(libMapM_gv_jungleCreepCamps[lp_camp].lv_campIconUnit, 0, true);
        UnitSetOwner(libMapM_gv_jungleCreepCamps[lp_camp].lv_campOwnershipFlagUnit, 0, true);
        libNtve_gf_SendActorMessageToGameRegion(libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataDefenderLeashRegion, "Signal OwnerNeutral");
    }
    else {
    }
    lv_numberofcreeps = libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderCount;
    auto10B8F53E_g = libAIAI_gf_DefenderGroup(libMapM_gv_jungleCreepCamps[lp_camp].lv_aIDefenderAIIndex);
    auto10B8F53E_u = 1;
    for ( ; auto10B8F53E_u <= UnitGroupCount(auto10B8F53E_g, c_unitCountAll) ; auto10B8F53E_u += BoolToInt(lv_u == UnitGroupUnit(auto10B8F53E_g, auto10B8F53E_u)) ) {
        lv_u = UnitGroupUnit(auto10B8F53E_g, auto10B8F53E_u);
        UnitRemove(lv_u);
    }
    libNtve_gf_SendActorMessageToGameRegion(RegionCircle(libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint, 25.0), "Signal CreepCleanup");
    autoB3DF04CC_g = UnitGroup("MercDefenderSiegeGiantOrientDummy", c_playerAny, RegionCircle(libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint, 25.0), UnitFilter(0, 0, (1 << c_targetFilterRawResource) | (1 << c_targetFilterHarvestableResource), 0), 0);
    autoB3DF04CC_u = 1;
    for ( ; autoB3DF04CC_u <= UnitGroupCount(autoB3DF04CC_g, c_unitCountAll) ; autoB3DF04CC_u += BoolToInt(lv_u == UnitGroupUnit(autoB3DF04CC_g, autoB3DF04CC_u)) ) {
        lv_u = UnitGroupUnit(autoB3DF04CC_g, autoB3DF04CC_u);
        UnitRemove(lv_u);
    }
    Wait(0.125, c_timeGame);
    auto9754AF77_ae = lv_numberofcreeps;
    auto9754AF77_ai = 1;
    lv_i = 1;
    for ( ; ( (auto9754AF77_ai >= 0 && lv_i <= auto9754AF77_ae) || (auto9754AF77_ai <= 0 && lv_i >= auto9754AF77_ae) ) ; lv_i += auto9754AF77_ai ) {
        libNtve_gf_CreateUnitsAtPoint2(1, libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderUnitTypes[lv_i], c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Hostile, libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataDefenderSpawnPoints[lv_i]);
        UnitGroupAdd(lv_defenderGroup, UnitLastCreated());
        UnitSetCustomValue(UnitLastCreated(), libCore_gf_CustomValueIndex(1), IntToFixed(lp_camp));
        libGame_gf_SendEventJungleCampDefenderCreated(UnitLastCreated());
    }
    libAIAI_gf_StartDefenderAI(lv_defenderGroup, libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataDefenderLeashRegion, lv_aggroRegion, true);
    libMapM_gv_jungleCreepCamps[lp_camp].lv_aIDefenderAIIndex = libAIAI_gf_LastCreatedDefenderAI();
    libMapM_gv_jungleCreepCamps[lp_camp].lv_stateCurrentDefenderScalingTicks = 0;
    libMapM_gv_jungleCreepCamps[lp_camp].lv_stateCurrentMercScalingTicks = 0;
    libMapM_gf_JungleUpdateScalingForCamp(lp_camp, libMapM_gv_jungleScalingTicks);
    libMapM_gf_JungleTransitionCampIntoState(lp_camp, 0);
    lv_icon = libMapM_gf_JungleGetCurrentIconForJungleCamp(lp_camp, true);
    libNtve_gf_SendActorMessageToUnit(libMapM_gv_jungleCreepCamps[lp_camp].lv_campIconUnit, "MinimapIcon " + lv_icon);
    auto77130FE9_g = PlayerGroupAll(); 
    auto77130FE9_p = 1;
    for ( ; auto77130FE9_p <= PlayerGroupCount(auto77130FE9_g) ; auto77130FE9_p += BoolToInt(lv_i == PlayerGroupPlayer(auto77130FE9_g, auto77130FE9_p)) ) {
        lv_i = PlayerGroupPlayer(auto77130FE9_g, auto77130FE9_p);
        libNtve_gf_ShareVisionofUnit(libMapM_gv_jungleCreepCamps[lp_camp].lv_campIconUnit, true, lv_i);
    }
    Wait(0.0625, c_timeGame);
    auto8581218A_g = PlayerGroupAll(); 
    auto8581218A_p = 1;
    for ( ; auto8581218A_p <= PlayerGroupCount(auto8581218A_g) ; auto8581218A_p += BoolToInt(lv_i == PlayerGroupPlayer(auto8581218A_g, auto8581218A_p)) ) {
        lv_i = PlayerGroupPlayer(auto8581218A_g, auto8581218A_p);
        libNtve_gf_ShareVisionofUnit(libMapM_gv_jungleCreepCamps[lp_camp].lv_campIconUnit, false, lv_i);
    }
    libMapM_gf_JungleSwitchToTextTagForCamp(lp_camp, 0);
    libMapM_gf_JungleUpdateMinimapTooltipForCamp(lp_camp);
    libGame_gf_SendEventJungleCampSpawned(lp_camp);
}

void libMapM_gf_JungleUpdateScalingForCamp (int lp_camp, int lp_scalingTicks) {
    int autoB6DA41F5_ae;
    int autoB6DA41F5_ai;

    // Variable Declarations
    int lv_itDefender;
    int lv_currentDefenderScalingTicks;
    int lv_newDefenderScalingTicks;
    int lv_newMercScalingTicks;
    int lv_campDefenderType;
    unit lv_creepUnit;

    // Variable Initialization

    // Implementation
    lv_currentDefenderScalingTicks = libMapM_gv_jungleCreepCamps[lp_camp].lv_stateCurrentDefenderScalingTicks;
    lv_newDefenderScalingTicks = MinI(lp_scalingTicks, libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderNumberOfRanks);
    lv_newMercScalingTicks = MinI(lp_scalingTicks, libMapM_gv_jungleCreepCamps[lp_camp].lv_mercNumberOfRanks);
    lv_campDefenderType = (libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampDefenderType);
    autoB6DA41F5_ae = libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderCount;
    autoB6DA41F5_ai = 1;
    lv_itDefender = 1;
    for ( ; ( (autoB6DA41F5_ai >= 0 && lv_itDefender <= autoB6DA41F5_ae) || (autoB6DA41F5_ai <= 0 && lv_itDefender >= autoB6DA41F5_ae) ) ; lv_itDefender += autoB6DA41F5_ai ) {
        lv_creepUnit = libAIAI_gf_DefenderUnit(libMapM_gv_jungleCreepCamps[lp_camp].lv_aIDefenderAIIndex, lv_itDefender);
        libCore_gf_UpdateScalingForUnit(lv_creepUnit, lv_newDefenderScalingTicks, lv_currentDefenderScalingTicks, libMapM_gv_dataJungleCampDefenderData[lv_campDefenderType].lv_xPBuffAmount[lv_currentDefenderScalingTicks]);
        UnitSetPropertyFixed(lv_creepUnit, c_unitPropLifePercent, 100.0);
    }
    libMapM_gv_jungleCreepCamps[lp_camp].lv_stateCurrentDefenderScalingTicks = lv_newDefenderScalingTicks;
    libMapM_gv_jungleCreepCamps[lp_camp].lv_stateCurrentMercScalingTicks = lv_newMercScalingTicks;
    libMapM_gf_JungleUpdateTextTagForCamp(lp_camp, 0);
    libMapM_gf_JungleUpdateMinimapTooltipForCamp(lp_camp);
}

void libMapM_gf_JungleTransitionCampIntoState (int lp_camp, int lp_state) {
    int auto438F5FF1_val;
    unitgroup auto11B9D48C_g;
    int auto11B9D48C_u;
    unitgroup auto0136C2BD_g;
    int auto0136C2BD_u;

    // Variable Declarations
    unit lv_itUnit;
    string lv_icon;

    // Variable Initialization

    // Implementation
    libMapM_gv_jungleCreepCamps[lp_camp].lv_aIState = lp_state;
    auto438F5FF1_val = lp_state;
    if (auto438F5FF1_val == 0) {
        libMapM_gf_JungleUpdateScalingForCamp(lp_camp, libMapM_gv_jungleScalingTicks);
    }
    else if (auto438F5FF1_val == 1) {
        TimerPause(libMapM_gv_jungleCreepCamps[lp_camp].lv_stateCreepRespawnTimer, true);
    }
    else if (auto438F5FF1_val == 2) {
        TimerStart(libMapM_gv_jungleCreepCamps[lp_camp].lv_stateCreepRespawnTimer, libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderRespawnTime, false, c_timeGame);
        libMapM_gf_JungleSwitchToTextTagForCamp(lp_camp, 1);
        lv_icon = libMapM_gf_JungleGetCurrentIconForJungleCamp(lp_camp, false);
        libNtve_gf_SendActorMessageToUnit(libMapM_gv_jungleCreepCamps[lp_camp].lv_campIconUnit, "MinimapIcon " + lv_icon);
        if ((libMapM_gv_jungleCampsShouldBeHibernating == true)) {
            libMapM_gf_JungleTransitionCampIntoState(lp_camp, 4);
        }
        else {
        }
    }
    else if (auto438F5FF1_val == 3) {
        auto11B9D48C_g = libAIAI_gf_DefenderGroup(libMapM_gv_jungleCreepCamps[lp_camp].lv_aIDefenderAIIndex);
        auto11B9D48C_u = 1;
        for ( ; auto11B9D48C_u <= UnitGroupCount(auto11B9D48C_g, c_unitCountAll) ; auto11B9D48C_u += BoolToInt(lv_itUnit == UnitGroupUnit(auto11B9D48C_g, auto11B9D48C_u)) ) {
            lv_itUnit = UnitGroupUnit(auto11B9D48C_g, auto11B9D48C_u);
            UnitIssueOrder(lv_itUnit, Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
        }
    }
    else if (auto438F5FF1_val == 4) {
        auto0136C2BD_g = libAIAI_gf_DefenderGroup(libMapM_gv_jungleCreepCamps[lp_camp].lv_aIDefenderAIIndex);
        auto0136C2BD_u = 1;
        for ( ; auto0136C2BD_u <= UnitGroupCount(auto0136C2BD_g, c_unitCountAll) ; auto0136C2BD_u += BoolToInt(lv_itUnit == UnitGroupUnit(auto0136C2BD_g, auto0136C2BD_u)) ) {
            lv_itUnit = UnitGroupUnit(auto0136C2BD_g, auto0136C2BD_u);
            UnitBehaviorAdd(lv_itUnit, "GardensPreHibernateFearController", lv_itUnit, 1);
        }
        ActorSend(libNtve_gf_MainActorofUnit(libMapM_gv_jungleCreepCamps[lp_camp].lv_campIconUnit), "SetMinimapVisibility");
    }
    else if (auto438F5FF1_val == 5) {
    }
    else {
    }
}

void libMapM_gf_JungleStartHibernateCamps () {
    int autoF0D500E2_ae;
    int autoF0D500E2_ai;

    // Variable Declarations
    int lv_itCamp;

    // Variable Initialization

    // Implementation
    libMapM_gv_jungleCampsShouldBeHibernating = true;
    autoF0D500E2_ae = libMapM_gv_jungleNumberOfCreepCamps;
    autoF0D500E2_ai = 1;
    lv_itCamp = 1;
    for ( ; ( (autoF0D500E2_ai >= 0 && lv_itCamp <= autoF0D500E2_ae) || (autoF0D500E2_ai <= 0 && lv_itCamp >= autoF0D500E2_ae) ) ; lv_itCamp += autoF0D500E2_ai ) {
        if ((libMapM_gv_jungleCreepCamps[lv_itCamp].lv_aIState != 1) && (libMapM_gv_jungleCreepCamps[lv_itCamp].lv_aIState != 3)) {
            libMapM_gf_JungleTransitionCampIntoState(lv_itCamp, 4);
        }
        else {
        }
    }
}

void libMapM_gf_JungleStopHibernateCamps () {
    int autoE0EA0DBF_ae;
    int autoE0EA0DBF_ai;
    int autoB7B3B98F_ae;
    int autoB7B3B98F_ai;

    // Variable Declarations
    int lv_itCamp;
    int lv_itDefenderIndex;
    unit lv_defenderUnit;

    // Variable Initialization

    // Implementation
    libMapM_gv_jungleCampsShouldBeHibernating = false;
    autoE0EA0DBF_ae = libMapM_gv_jungleNumberOfCreepCamps;
    autoE0EA0DBF_ai = 1;
    lv_itCamp = 1;
    for ( ; ( (autoE0EA0DBF_ai >= 0 && lv_itCamp <= autoE0EA0DBF_ae) || (autoE0EA0DBF_ai <= 0 && lv_itCamp >= autoE0EA0DBF_ae) ) ; lv_itCamp += autoE0EA0DBF_ai ) {
        if ((libMapM_gv_jungleCreepCamps[lv_itCamp].lv_aIState == 4)) {
            autoB7B3B98F_ae = libMapM_gv_jungleCreepCamps[lv_itCamp].lv_defenderCount;
            autoB7B3B98F_ai = 1;
            lv_itDefenderIndex = 1;
            for ( ; ( (autoB7B3B98F_ai >= 0 && lv_itDefenderIndex <= autoB7B3B98F_ae) || (autoB7B3B98F_ai <= 0 && lv_itDefenderIndex >= autoB7B3B98F_ae) ) ; lv_itDefenderIndex += autoB7B3B98F_ai ) {
                lv_defenderUnit = libAIAI_gf_DefenderUnit(libMapM_gv_jungleCreepCamps[lv_itCamp].lv_aIDefenderAIIndex, lv_itDefenderIndex);
                UnitBehaviorRemove(lv_defenderUnit, "GardensPreHibernateFearController", 1);
                UnitBehaviorRemove(lv_defenderUnit, "GardensMercCampHibernator", 1);
                if ((UnitIsAlive(lv_defenderUnit) == true)) {
                    UnitIssueOrder(lv_defenderUnit, OrderTargetingPoint(AbilityCommand("move", 0), libMapM_gv_jungleCreepCamps[lv_itCamp].lv_mapDataDefenderSpawnPoints[lv_itDefenderIndex]), c_orderQueueReplace);
                }
                else {
                }
            }
            ActorSend(libNtve_gf_MainActorofUnit(libMapM_gv_jungleCreepCamps[lv_itCamp].lv_campIconUnit), "SetMinimapVisibility 1");
            libMapM_gf_JungleTransitionCampIntoState(lv_itCamp, 0);
            if ((UnitGroupCount(libAIAI_gf_DefenderGroup(libMapM_gv_jungleCreepCamps[lv_itCamp].lv_aIDefenderAIIndex), c_unitCountAlive) > 0) && (UnitGroupCount(libAIAI_gf_DefenderGroup(libMapM_gv_jungleCreepCamps[lv_itCamp].lv_aIDefenderAIIndex), c_unitCountAlive) < libMapM_gv_jungleCreepCamps[lv_itCamp].lv_defenderCount)) {
                TimerStart(libMapM_gv_jungleCreepCamps[lv_itCamp].lv_stateCreepRespawnTimer, libMapM_gv_bALJungleLeashRespawnTime, false, c_timeGame);
            }
            else {
            }
        }
        else {
        }
        if ((libMapM_gv_jungleCreepCamps[lv_itCamp].lv_aIState == 5)) {
            ActorSend(libNtve_gf_MainActorofUnit(libMapM_gv_jungleCreepCamps[lv_itCamp].lv_campIconUnit), "SetMinimapVisibility 1");
            libMapM_gf_JungleRespawnCreepsForCamp(lv_itCamp);
        }
        else {
        }
    }
}

void libMapM_gf_JungleTurnOnCampCaptureBeacon (int lp_camp) {
    // Implementation
    libMapM_gv_jungleCreepCamps[lp_camp].lv_captureCaptureEnabled = true;
    UnitSetOwner(libMapM_gv_jungleCreepCamps[lp_camp].lv_campIconUnit, 0, true);
    UnitSetOwner(libMapM_gv_jungleCreepCamps[lp_camp].lv_campOwnershipFlagUnit, 0, true);
    libGame_gf_CapturePointEnable(libMapM_gv_jungleCreepCamps[lp_camp].lv_captureCapturePointIndex);
    libMapM_gf_JungleTransitionCampIntoState(lp_camp, 3);
}

void libMapM_gf_JungleTurnOffCampCaptureBeacon (int lp_camp, int lp_owner) {
    // Implementation
    libMapM_gv_jungleCreepCamps[lp_camp].lv_captureCaptureEnabled = false;
    UnitSetOwner(libMapM_gv_jungleCreepCamps[lp_camp].lv_captureCircleOfPowerUnit, lp_owner, true);
    libMapM_gf_JungleTransitionCampCaptureBeacontoHidden(lp_camp);
}

void libMapM_gf_JungleTransitionCampCaptureBeacontoHidden (int lp_camp) {
    // Implementation
    libGame_gf_CapturePointDisable(libMapM_gv_jungleCreepCamps[lp_camp].lv_captureCapturePointIndex);
}

void libMapM_gf_JungleGrantCaptureRewards (int lp_camp, int lp_owner, bool lp_hasMercLordTalent) {
    unitgroup auto413D25E3_g;
    int auto413D25E3_u;
    int auto9C82785C_val;
    playergroup autoBD49DA57_g;
    int autoBD49DA57_p;

    // Variable Declarations
    int lv_itPlayer;
    int lv_killingFaction;
    string lv_campPortrait;
    unit lv_unit;
    fixed lv_xPValue;

    // Variable Initialization

    // Implementation
    if ((lp_owner == libCore_gv_cOMPUTER_TeamOrder)) {
        libMapM_gv_jungleCreepCamps[lp_camp].lv_statTrackingOrderCaptures += 1;
        lv_killingFaction = 0;
    }
    else {
        libMapM_gv_jungleCreepCamps[lp_camp].lv_statTrackingChaosCaptures += 1;
        lv_killingFaction = 1;
    }
    StatEventCreate("JungleCampCapture");
    StatEventAddDataInt(StatEventLastCreated(), "CampID", lp_camp);
    StatEventSend(StatEventLastCreated());
    auto413D25E3_g = UnitGroup(null, c_playerAny, RegionCircle(libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint, libMapM_gv_bALJungleCampCaptureRadius), UnitFilter((1 << c_targetFilterHeroic), 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterHallucination - 32)) | (1 << (c_targetFilterBenign - 32))), 0);
    auto413D25E3_u = 1;
    for ( ; auto413D25E3_u <= UnitGroupCount(auto413D25E3_g, c_unitCountAll) ; auto413D25E3_u += BoolToInt(lv_unit == UnitGroupUnit(auto413D25E3_g, auto413D25E3_u)) ) {
        lv_unit = UnitGroupUnit(auto413D25E3_g, auto413D25E3_u);
        libGame_gv_scoreValues[UnitGetOwner(lv_unit)].lv_creepCampsCaptured += 1;
    }
    auto9C82785C_val = libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampType;
    if (auto9C82785C_val == 0) {
        libGame_gv_teams[libGame_gf_TeamNumberOfPlayer(lp_owner)].lv_map_MercCampCaptures += 1;
        libMapM_gf_JungleTransitionCampIntoState(lp_camp, 2);
        libMapM_gf_JungleMercCampCapturedAnnouncement(lp_camp, lp_owner);
        libMapM_gf_JungleSpawnMercMinions(lp_camp, lp_owner, lp_hasMercLordTalent);
        lv_xPValue = libMapM_gv_jungleCreepCamps[lp_camp].lv_defenderCaptureXPValue;
        autoBD49DA57_g = libGame_gf_AlliedPlayerGroupOfPlayer(lp_owner); 
        autoBD49DA57_p = 1;
        for ( ; autoBD49DA57_p <= PlayerGroupCount(autoBD49DA57_g) ; autoBD49DA57_p += BoolToInt(lv_itPlayer == PlayerGroupPlayer(autoBD49DA57_g, autoBD49DA57_p)) ) {
            lv_itPlayer = PlayerGroupPlayer(autoBD49DA57_g, autoBD49DA57_p);
            libGame_gf_GrantXPToPlayer(lv_xPValue, lv_itPlayer, 3);
            libUIUI_gf_UIFloatingCombatTextXP(lv_itPlayer, libMapM_gv_jungleCreepCamps[lp_camp].lv_captureCircleOfPowerUnit, TextExpressionAssemble("Param/Expression/lib_MapM_6093B2DF"), 8);
        }
    }
    else if (auto9C82785C_val == 3) {
        libMapM_gf_MMHoCForestActivated(lp_camp, lp_owner);
    }
    else if (auto9C82785C_val == 1) {
        libMapM_gf_JungleTransitionCampIntoState(lp_camp, 2);
        libMapM_gf_JungleMercCampCapturedAnnouncement(lp_camp, lp_owner);
        CatalogFieldValueSet(c_gameCatalogEffect, "DropCannonballsPersistent", "PeriodCount", libCore_gv_cOMPUTER_Neutral, IntToString(3));
        PlayerCreateEffectPoint(libCore_gv_cOMPUTER_Neutral, "DropCannonballsPersistent", libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint);
    }
    else if (auto9C82785C_val == 2) {
        libMapM_gf_JungleTransitionCampIntoState(lp_camp, 2);
        CatalogFieldValueSet(c_gameCatalogEffect, "DropCannonballsPersistent", "PeriodCount", libCore_gv_cOMPUTER_Neutral, IntToString(2));
        PlayerCreateEffectPoint(libCore_gv_cOMPUTER_Neutral, "DropCannonballsPersistent", libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint);
    }
    else {
    }
    if ((libMapM_gf_MapMechanicExistsOnMap(2) == true)) {
        libMapM_gf_MMCannonballsCreepRewards(lp_camp);
    }
    else {
    }
}

void libMapM_gf_JungleMercCampCapturedAnnouncement (int lp_camp, int lp_owner) {
    // Variable Declarations
    int lv_mercType;

    // Variable Initialization

    // Implementation
    lv_mercType = libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataMercSpawnType;
    if ((lp_owner == libCore_gv_cOMPUTER_TeamOrder)) {
        MinimapPing(libCore_gv_teamOrder, libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint, 5.0, Color(0.00, 33.33, 100.00));
        MinimapPing(libCore_gv_teamChaos, libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint, 5.0, Color(100.00, 0.00, 0.00));
        MinimapPing(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint, 5.0, Color(0.00, 33.33, 100.00));
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_teamOrder, 2, 48, "AllyCapturedMercenaryCamp", StringExternal("Param/Value/lib_MapM_724F28A8"), null, null, null, libGame_gv_announcement_QuickSoundOnlyTimerDuration_C, false);
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_teamChaos, 2, 49, "EnemyCapturedMercenaryCamp", StringExternal("Param/Value/lib_MapM_C5509F3B"), null, null, null, libGame_gv_announcement_QuickSoundOnlyTimerDuration_C, false);
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 2, 50, "AllyCapturedMercenaryCamp", StringExternal("Param/Value/lib_MapM_2EF3D152"), null, null, null, libGame_gv_announcement_QuickSoundOnlyTimerDuration_C, false);
        SoundtrackPlay(libCore_gv_teamOrder, c_soundtrackCategoryMusic, "MX_Stinger_MercCampTaken_Ally", c_soundtrackCueAny, c_soundtrackIndexAny, false);
        SoundtrackPlay(libCore_gv_teamChaos, c_soundtrackCategoryMusic, "MX_Stinger_MercCampTaken_Enemy", c_soundtrackCueAny, c_soundtrackIndexAny, false);
    }
    else {
        MinimapPing(libCore_gv_teamOrder, libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint, 5.0, Color(100.00, 0.00, 0.00));
        MinimapPing(libCore_gv_teamChaos, libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint, 5.0, Color(0.00, 33.33, 100.00));
        MinimapPing(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint, 5.0, Color(100.00, 0.00, 0.00));
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_teamOrder, 2, 49, "EnemyCapturedMercenaryCamp", StringExternal("Param/Value/lib_MapM_1EBE148B"), null, null, null, libGame_gv_announcement_QuickSoundOnlyTimerDuration_C, false);
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_teamChaos, 2, 48, "AllyCapturedMercenaryCamp", StringExternal("Param/Value/lib_MapM_755ECC06"), null, null, null, libGame_gv_announcement_QuickSoundOnlyTimerDuration_C, false);
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 2, 51, "AllyCapturedMercenaryCamp", StringExternal("Param/Value/lib_MapM_BBC97D89"), null, null, null, libGame_gv_announcement_QuickSoundOnlyTimerDuration_C, false);
        SoundtrackPlay(libCore_gv_teamOrder, c_soundtrackCategoryMusic, "MX_Stinger_MercCampTaken_Enemy", c_soundtrackCueAny, c_soundtrackIndexAny, false);
        SoundtrackPlay(libCore_gv_teamChaos, c_soundtrackCategoryMusic, "MX_Stinger_MercCampTaken_Ally", c_soundtrackCueAny, c_soundtrackIndexAny, false);
    }
}

void libMapM_gf_JungleSpawnMercMinions (int lp_camp, int lp_owner, bool lp_hasMercLordTalent) {
    int autoB70C7584_ae;
    int autoB70C7584_ai;
    string auto0937F60E_val;

    // Variable Declarations
    int lv_i;
    int lv_team;
    point lv_spawnPoint;
    point lv_rallyPoint;
    int lv_mercTypeIndex;
    int lv_scalingTicks;
    unit lv_minion;
    int lv_waveIndex;
    int lv_lane;
    int lv_waypoint;
    bool lv_isOgreKing;
    unit lv_spawnHelperUnit;

    // Variable Initialization

    // Implementation
    lv_team = libGame_gf_TeamNumberOfPlayer(lp_owner);
    lv_spawnPoint = libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint;
    lv_rallyPoint = libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataMercMinionRallyPoint[lv_team];
    lv_mercTypeIndex = (libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataMercSpawnType);
    lv_scalingTicks = libMapM_gv_jungleCreepCamps[lp_camp].lv_stateCurrentMercScalingTicks;
    libNtve_gf_SendActorMessageToGameRegion(RegionCircle(lv_spawnPoint, 25.0), "Signal CreepCleanup");
    autoB70C7584_ae = libMapM_gv_jungleCreepCamps[lp_camp].lv_mercNumberOfMinionsSpawned;
    autoB70C7584_ai = 1;
    lv_i = 1;
    for ( ; ( (autoB70C7584_ai >= 0 && lv_i <= autoB70C7584_ae) || (autoB70C7584_ai <= 0 && lv_i >= autoB70C7584_ae) ) ; lv_i += autoB70C7584_ai ) {
        if ((libMapM_gv_jungleCreepCamps[lp_camp].lv_mercSpawnedMinionUnitType[lv_i] == "MercLanerSiegeGiant")) {
            lv_spawnHelperUnit = UnitGroupRandomUnit(UnitGroup("MercDefenderSiegeGiantOrientDummy", c_playerAny, RegionCircle(lv_spawnPoint, 25.0), UnitFilter(0, 0, (1 << c_targetFilterRawResource) | (1 << c_targetFilterHarvestableResource), 0), 0), c_unitCountAlive);
            if ((UnitIsValid(lv_spawnHelperUnit) == true)) {
                UnitCreate(1, libMapM_gv_jungleCreepCamps[lp_camp].lv_mercSpawnedMinionUnitType[lv_i], c_unitCreateIgnorePlacement, lp_owner, UnitGetPosition(lv_spawnHelperUnit), UnitGetFacing(lv_spawnHelperUnit));
                UnitRemove(lv_spawnHelperUnit);
            }
            else {
                libNtve_gf_UnitCreateFacingPoint(1, libMapM_gv_jungleCreepCamps[lp_camp].lv_mercSpawnedMinionUnitType[lv_i], 0, lp_owner, lv_spawnPoint, lv_rallyPoint);
            }
        }
        else {
            libNtve_gf_UnitCreateFacingPoint(1, libMapM_gv_jungleCreepCamps[lp_camp].lv_mercSpawnedMinionUnitType[lv_i], 0, lp_owner, lv_spawnPoint, lv_rallyPoint);
        }
        lv_minion = UnitLastCreated();
        libGame_gf_SendEventJungleCampLanerCreated(lv_minion);
        libCore_gf_UpdateScalingForUnit(lv_minion, lv_scalingTicks, 0, libMapM_gv_dataJungleCampMercData[lv_mercTypeIndex].lv_xPBuffAmount[lv_scalingTicks]);
        if ((lp_hasMercLordTalent == true)) {
            auto0937F60E_val = UnitGetType(lv_minion);
            if (auto0937F60E_val == "MercLanerSiegeGiant") {
                UnitBehaviorAdd(lv_minion, "TalentMercenaryLordGiantBuff", lv_minion, 1);
            }
            else if (auto0937F60E_val == "MercLanerMeleeOgre") {
                UnitBehaviorAdd(lv_minion, "TalentMercenaryLordKnightBuff", lv_minion, 1);
            }
            else if (auto0937F60E_val == "MercLanerRangedOgre") {
                UnitBehaviorAdd(lv_minion, "TalentMercenaryLordKnightBuff", lv_minion, 1);
            }
            else {
            }
        }
        else {
        }
        UnitSetCustomValue(lv_minion, libCore_gf_CustomValueIndex(3), IntToFixed(lp_camp));
        UnitGroupAdd(libMapM_gv_jungleMiniMapIconGroup[lp_camp], lv_minion);
        lv_lane = libMapM_gv_jungleCreepCamps[lp_camp].lv_mercSpawnLane[lv_team];
        lv_waypoint = libMapM_gv_jungleCreepCamps[lp_camp].lv_mercSpawnFirstWaypointIndex[lv_team];
        lv_isOgreKing = (libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataMercSpawnType == 3);
        libAIAI_gf_MinionAIStartMinionAI(lv_minion, lv_lane, lv_waypoint, lv_isOgreKing, false, 0);
    }
    libMapM_gf_JungleSetMiniMapIconForMercMinions(lp_camp, libMapM_gf_JungleGetPortraitForJungleCamp(lp_camp), libMapM_gv_jungleMiniMapIconGroup[lp_camp]);
    libMapM_gf_JungleCreateMercPath(libMapM_gv_jungleMiniMapLeader[lp_camp], true);
}

trigger auto_libMapM_gf_JungleSetMiniMapIconForMercMinions_Trigger = null;
int auto_libMapM_gf_JungleSetMiniMapIconForMercMinions_lp_camp;
string auto_libMapM_gf_JungleSetMiniMapIconForMercMinions_lp_mercUnitMiniMapModel;
unitgroup auto_libMapM_gf_JungleSetMiniMapIconForMercMinions_lp_mercUnitGroup;

void libMapM_gf_JungleSetMiniMapIconForMercMinions (int lp_camp, string lp_mercUnitMiniMapModel, unitgroup lp_mercUnitGroup) {
    auto_libMapM_gf_JungleSetMiniMapIconForMercMinions_lp_camp = lp_camp;
    auto_libMapM_gf_JungleSetMiniMapIconForMercMinions_lp_mercUnitMiniMapModel = lp_mercUnitMiniMapModel;
    auto_libMapM_gf_JungleSetMiniMapIconForMercMinions_lp_mercUnitGroup = lp_mercUnitGroup;

    if (auto_libMapM_gf_JungleSetMiniMapIconForMercMinions_Trigger == null) {
        auto_libMapM_gf_JungleSetMiniMapIconForMercMinions_Trigger = TriggerCreate("auto_libMapM_gf_JungleSetMiniMapIconForMercMinions_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_JungleSetMiniMapIconForMercMinions_Trigger, false, false);
}

bool auto_libMapM_gf_JungleSetMiniMapIconForMercMinions_TriggerFunc (bool testConds, bool runActions) {
    int lp_camp = auto_libMapM_gf_JungleSetMiniMapIconForMercMinions_lp_camp;
    string lp_mercUnitMiniMapModel = auto_libMapM_gf_JungleSetMiniMapIconForMercMinions_lp_mercUnitMiniMapModel;
    unitgroup lp_mercUnitGroup = auto_libMapM_gf_JungleSetMiniMapIconForMercMinions_lp_mercUnitGroup;

    string auto36B84E72_val;

    // Variable Declarations
    string lv_image;
    bool lv_mercLeaderBool;
    unit lv_minimapUnit;
    int lv_i;

    // Variable Initialization

    // Implementation
    UnitGroupLoopBegin(lp_mercUnitGroup);
    for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
        lv_minimapUnit = UnitGroupLoopCurrent();
        if ((lv_mercLeaderBool == false)) {
            lv_mercLeaderBool = true;
            libMapM_gv_jungleMiniMapLeader[lp_camp] = UnitGroupLoopCurrent();
            UnitBehaviorAdd(UnitGroupLoopCurrent(), "MinionDeathMonitor", UnitGroupLoopCurrent(), 1);
            auto36B84E72_val = UnitGetType(UnitGroupLoopCurrent());
            if (auto36B84E72_val == "MercLanerSiegeGiant") {
                libNtve_gf_SendActorMessageToUnit(lv_minimapUnit, "MinimapIcon Assets\\Textures\\storm_temp_war3_btnoneheadedogre.dds");
                libNtve_gf_SendActorMessageToUnit(lv_minimapUnit, "MinimapIconBackground Assets\\Textures\\storm_ui_minimapicon_herobg.dds");
                ActorSendAsText(libNtve_gf_MainActorofUnit(lv_minimapUnit), TextExpressionAssemble("Param/Expression/lib_MapM_A623D505"));
            }
            else if (auto36B84E72_val == "MercLanerMeleeOgre") {
                libNtve_gf_SendActorMessageToUnit(lv_minimapUnit, "MinimapIcon Assets\\Textures\\storm_temp_war3_btndeeplordrevenant.dds");
                libNtve_gf_SendActorMessageToUnit(lv_minimapUnit, "MinimapIconBackground Assets\\Textures\\storm_ui_minimapicon_herobg.dds");
                ActorSendAsText(libNtve_gf_MainActorofUnit(lv_minimapUnit), TextExpressionAssemble("Param/Expression/lib_MapM_328E11D8"));
            }
            else if (auto36B84E72_val == "MercLanerRangedOgre") {
                libNtve_gf_SendActorMessageToUnit(lv_minimapUnit, "MinimapIcon Assets\\Textures\\storm_temp_war3_btndeeplordrevenant.dds");
                libNtve_gf_SendActorMessageToUnit(lv_minimapUnit, "MinimapIconBackground Assets\\Textures\\storm_ui_minimapicon_herobg.dds");
                ActorSendAsText(libNtve_gf_MainActorofUnit(lv_minimapUnit), TextExpressionAssemble("Param/Expression/lib_MapM_0628E837"));
            }
            else if (auto36B84E72_val == "JungleGraveGolemLaner") {
                ActorSendAsText(libNtve_gf_MainActorofUnit(lv_minimapUnit), TextExpressionAssemble("Param/Expression/lib_MapM_A04BD23A"));
            }
            else {
            }
        }
        else {
            libNtve_gf_SendActorMessageToUnit(lv_minimapUnit, "MinimapIcon Assets\\Textures\\blank.dds");
            libNtve_gf_SendActorMessageToUnit(lv_minimapUnit, "MinimapIconBackground Assets\\Textures\\blank.dds");
        }
    }
    UnitGroupLoopEnd();
    return true;
}

void libMapM_gf_JungleCreateMercPath (unit lp_mercLeader, bool lp_newPath) {
    int autoB97B7772_val;

    // Variable Declarations
    int lv_camp;
    int lv_waveIndex;
    int lv_currentLane;
    int lv_i;
    const fixed lv_pingDuration = 0.75;

    // Variable Initialization

    // Implementation
    lv_camp = FixedToInt(UnitGetCustomValue(lp_mercLeader, libCore_gf_CustomValueIndex(3)));
    if ((UnitIsAlive(lp_mercLeader) == false)) {
        if ((libMapM_gv_jungleMiniMapOrderPath[lv_camp] != 0)) {
            PathDestroy(libMapM_gv_jungleMiniMapOrderPath[lv_camp]);
            PathDestroy(libMapM_gv_jungleMiniMapChaosPath[lv_camp]);
            PathDestroy(libMapM_gv_jungleMiniMapObserverPath[lv_camp]);
            libMapM_gv_jungleMiniMapOrderPath[lv_camp] = 0;
            libMapM_gv_jungleMiniMapChaosPath[lv_camp] = 0;
            libMapM_gv_jungleMiniMapObserverPath[lv_camp] = 0;
        }
        else {
        }
        return ;
    }
    else {
    }
    if ((libMapM_gv_jungleMiniMapOrderPath[lv_camp] != 0)) {
        PathClearWayPoints(libMapM_gv_jungleMiniMapOrderPath[lv_camp]);
        PathClearWayPoints(libMapM_gv_jungleMiniMapChaosPath[lv_camp]);
        PathClearWayPoints(libMapM_gv_jungleMiniMapObserverPath[lv_camp]);
    }
    else {
        PathCreateForUnit(libCore_gv_teamOrder, lp_mercLeader);
        libMapM_gv_jungleMiniMapOrderPath[lv_camp] = PathLastCreated();
        PathSetVisible(libMapM_gv_jungleMiniMapOrderPath[lv_camp], c_pathLocationWorld, false);
        PathCreateForUnit(libCore_gv_teamChaos, lp_mercLeader);
        libMapM_gv_jungleMiniMapChaosPath[lv_camp] = PathLastCreated();
        PathSetVisible(libMapM_gv_jungleMiniMapChaosPath[lv_camp], c_pathLocationWorld, false);
        PathCreateForUnit(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], lp_mercLeader);
        libMapM_gv_jungleMiniMapObserverPath[lv_camp] = PathLastCreated();
        PathSetVisible(libMapM_gv_jungleMiniMapObserverPath[lv_camp], c_pathLocationWorld, false);
    }
    lv_waveIndex = FixedToInt(UnitGetCustomValue(lp_mercLeader, libCore_gf_CustomValueIndex(0)));
    lv_currentLane = libAIAI_gv_minionAIActiveMinions[lv_waveIndex].lv_lane;
    lv_i = libAIAI_gv_minionAIActiveMinions[lv_waveIndex].lv_nextWaypoint;
    autoB97B7772_val = libAIAI_gv_minionAIActiveMinions[lv_waveIndex].lv_teamToAttack;
    if (autoB97B7772_val == libGame_gv_teamChaosIndex_C) {
        PathSetColor(libMapM_gv_jungleMiniMapOrderPath[lv_camp], c_pathLocationAll, ColorWithAlpha(0.00, 50.20, 100.00, 89.41));
        PathSetColor(libMapM_gv_jungleMiniMapChaosPath[lv_camp], c_pathLocationAll, ColorWithAlpha(100.00, 24.71, 24.71, 89.41));
        PathSetColor(libMapM_gv_jungleMiniMapObserverPath[lv_camp], c_pathLocationAll, ColorWithAlpha(0.00, 50.20, 100.00, 89.41));
        PathSetDestinationUnit(libMapM_gv_jungleMiniMapOrderPath[lv_camp], libGame_gv_teams[libGame_gv_teamChaosIndex_C].lv_core);
        PathSetDestinationUnit(libMapM_gv_jungleMiniMapChaosPath[lv_camp], libGame_gv_teams[libGame_gv_teamChaosIndex_C].lv_core);
        PathSetDestinationUnit(libMapM_gv_jungleMiniMapObserverPath[lv_camp], libGame_gv_teams[libGame_gv_teamChaosIndex_C].lv_core);
        while ((lv_i < (libGame_gv_laneData[lv_currentLane].lv_waypointCount - 1))) {
            PathAddWayPoint(libMapM_gv_jungleMiniMapOrderPath[lv_camp], libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i]);
            PathAddWayPoint(libMapM_gv_jungleMiniMapChaosPath[lv_camp], libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i]);
            PathAddWayPoint(libMapM_gv_jungleMiniMapObserverPath[lv_camp], libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i]);
            if ((lp_newPath == true)) {
                libNtve_gf_CreatePingFacingAngle(libCore_gv_teamOrder, "StormPingArrow", libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i], ColorWithAlpha(0.00, 0.00, 100.00, 0.00), lv_pingDuration, AngleBetweenPoints(libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i], libGame_gv_laneData[lv_currentLane].lv_waypoints[(lv_i + 1)]));
                PingSetScale(PingLastCreated(), 0.3);
                libNtve_gf_CreatePingFacingAngle(libCore_gv_teamChaos, "StormPingArrow", libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i], ColorWithAlpha(100.00, 0.00, 0.00, 0.00), lv_pingDuration, AngleBetweenPoints(libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i], libGame_gv_laneData[lv_currentLane].lv_waypoints[(lv_i + 1)]));
                PingSetScale(PingLastCreated(), 0.3);
                libNtve_gf_CreatePingFacingAngle(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], "StormPingArrow", libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i], ColorWithAlpha(0.00, 0.00, 100.00, 0.00), lv_pingDuration, AngleBetweenPoints(libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i], libGame_gv_laneData[lv_currentLane].lv_waypoints[(lv_i + 1)]));
                PingSetScale(PingLastCreated(), 0.3);
            }
            else {
            }
            lv_i += 1;
        }
    }
    else if (autoB97B7772_val == libGame_gv_teamOrderIndex_C) {
        PathSetColor(libMapM_gv_jungleMiniMapOrderPath[lv_camp], c_pathLocationAll, ColorWithAlpha(100.00, 24.71, 24.71, 89.02));
        PathSetColor(libMapM_gv_jungleMiniMapChaosPath[lv_camp], c_pathLocationAll, ColorWithAlpha(0.00, 50.20, 100.00, 89.41));
        PathSetColor(libMapM_gv_jungleMiniMapObserverPath[lv_camp], c_pathLocationAll, ColorWithAlpha(100.00, 24.71, 24.71, 89.02));
        PathSetDestinationUnit(libMapM_gv_jungleMiniMapOrderPath[lv_camp], libGame_gv_teams[libGame_gv_teamOrderIndex_C].lv_core);
        PathSetDestinationUnit(libMapM_gv_jungleMiniMapChaosPath[lv_camp], libGame_gv_teams[libGame_gv_teamOrderIndex_C].lv_core);
        PathSetDestinationUnit(libMapM_gv_jungleMiniMapObserverPath[lv_camp], libGame_gv_teams[libGame_gv_teamOrderIndex_C].lv_core);
        while ((lv_i > 1)) {
            PathAddWayPoint(libMapM_gv_jungleMiniMapOrderPath[lv_camp], libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i]);
            PathAddWayPoint(libMapM_gv_jungleMiniMapChaosPath[lv_camp], libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i]);
            PathAddWayPoint(libMapM_gv_jungleMiniMapObserverPath[lv_camp], libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i]);
            if ((lp_newPath == true)) {
                libNtve_gf_CreatePingFacingAngle(libCore_gv_teamOrder, "StormPingArrow", libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i], ColorWithAlpha(100.00, 0.00, 0.00, 0.00), lv_pingDuration, AngleBetweenPoints(libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i], libGame_gv_laneData[lv_currentLane].lv_waypoints[(lv_i - 1)]));
                PingSetScale(PingLastCreated(), 0.3);
                libNtve_gf_CreatePingFacingAngle(libCore_gv_teamChaos, "StormPingArrow", libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i], ColorWithAlpha(0.00, 0.00, 100.00, 0.00), lv_pingDuration, AngleBetweenPoints(libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i], libGame_gv_laneData[lv_currentLane].lv_waypoints[(lv_i - 1)]));
                PingSetScale(PingLastCreated(), 0.3);
                libNtve_gf_CreatePingFacingAngle(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], "StormPingArrow", libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i], ColorWithAlpha(100.00, 0.00, 0.00, 0.00), lv_pingDuration, AngleBetweenPoints(libGame_gv_laneData[lv_currentLane].lv_waypoints[lv_i], libGame_gv_laneData[lv_currentLane].lv_waypoints[(lv_i - 1)]));
                PingSetScale(PingLastCreated(), 0.3);
            }
            else {
            }
            lv_i -= 1;
        }
    }
    else {
    }
}

void libMapM_gf_MapMechanicAdd (int lp_mechanic, trigger lp_initializeCallback) {
    int auto8E00ECF5_val;

    // Implementation
    if ((GameTestConfigType() == 2)) {
        return ;
    }
    else {
    }
    if ((libMapM_gv_mapMechanicControllerActor == null)) {
        libNtve_gf_CreateActorAtPoint("MMController", RegionGetCenter(RegionEntireMap()));
        libMapM_gv_mapMechanicControllerActor = libNtve_gf_ActorLastCreated();
    }
    else {
    }
    if ((libMapM_gf_MapMechanicExistsOnMap(lp_mechanic) == true)) {
        return ;
    }
    else {
    }
    libMapM_gv_mapMechanicsCount += 1;
    libMapM_gv_mapMechanics[libMapM_gv_mapMechanicsCount] = lp_mechanic;
    libMapM_gv_mapMechanicsInitCallbacks[libMapM_gv_mapMechanicsCount] = lp_initializeCallback;
    libGame_gf_SendEventMapMechanicInitialization(lp_mechanic);
    auto8E00ECF5_val = lp_mechanic;
    if (auto8E00ECF5_val == 2) {
        libMapM_gf_MMCannonballsInit();
    }
    else if (auto8E00ECF5_val == 1) {
        libMapM_gf_MMRavenCurseInit();
    }
    else if (auto8E00ECF5_val == 3) {
        libMapM_gf_MMGardensDragonInit();
    }
    else if (auto8E00ECF5_val == 4) {
        libMapM_gf_MMUnderworldInit();
    }
    else {
    }
}

int libMapM_gf_MapMechanicIndex (int lp_mechanic) {
    int autoF832F727_ae;
    int autoF832F727_ai;

    // Variable Declarations
    int lv_itMechanic;

    // Variable Initialization

    // Implementation
    autoF832F727_ae = libMapM_gv_mapMechanicsCount;
    autoF832F727_ai = 1;
    lv_itMechanic = 1;
    for ( ; ( (autoF832F727_ai >= 0 && lv_itMechanic <= autoF832F727_ae) || (autoF832F727_ai <= 0 && lv_itMechanic >= autoF832F727_ae) ) ; lv_itMechanic += autoF832F727_ai ) {
        if ((libMapM_gv_mapMechanics[lv_itMechanic] == lp_mechanic)) {
            return lv_itMechanic;
        }
        else {
        }
    }
    return 0;
}

bool libMapM_gf_MapMechanicExistsOnMap (int lp_mechanic) {
    // Implementation
    return (libMapM_gf_MapMechanicIndex(lp_mechanic) > 0);
}

int libMapM_gf_PrimaryMapMechanic () {
    // Implementation
    return libMapM_gv_mapMechanics[1];
}

trigger auto_libMapM_gf_PlayMapMechanicIntroForPlayer_Trigger = null;
int auto_libMapM_gf_PlayMapMechanicIntroForPlayer_lp_player;
string auto_libMapM_gf_PlayMapMechanicIntroForPlayer_lp_cutscene;

void libMapM_gf_PlayMapMechanicIntroForPlayer (int lp_player, string lp_cutscene) {
    auto_libMapM_gf_PlayMapMechanicIntroForPlayer_lp_player = lp_player;
    auto_libMapM_gf_PlayMapMechanicIntroForPlayer_lp_cutscene = lp_cutscene;

    if (auto_libMapM_gf_PlayMapMechanicIntroForPlayer_Trigger == null) {
        auto_libMapM_gf_PlayMapMechanicIntroForPlayer_Trigger = TriggerCreate("auto_libMapM_gf_PlayMapMechanicIntroForPlayer_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_PlayMapMechanicIntroForPlayer_Trigger, false, false);
}

bool auto_libMapM_gf_PlayMapMechanicIntroForPlayer_TriggerFunc (bool testConds, bool runActions) {
    int lp_player = auto_libMapM_gf_PlayMapMechanicIntroForPlayer_lp_player;
    string lp_cutscene = auto_libMapM_gf_PlayMapMechanicIntroForPlayer_lp_cutscene;

    playergroup autoA1C853BF_g;
    int autoA1C853BF_p;
    playergroup auto341C65FA_g;
    int auto341C65FA_p;

    // Variable Declarations
    fixed lv_fadeDuration;
    revealer lv_revealer;
    int lv_itPlayer;

    // Variable Initialization

    // Implementation
    libGame_gv_players[lp_player].lv_heroSpawnReady = false;
    libNtve_gf_CinematicMode(true, libCore_gv_playerGroupFromPlayer[lp_player], c_transitionDurationImmediate);
    DialogControlFadeTransparency(libUIUI_gv_uIGameUIHandles.lv_consoleUIContainer, libCore_gv_playerGroupFromPlayer[lp_player], 0.0, 100.0);
    CutsceneFade(false, 0.0, Color(0,0,0), 100.0, libCore_gv_playerGroupFromPlayer[lp_player], true);
    libStEx_gf_TurnCinematicCameraOnOff(lp_player, true);
    autoA1C853BF_g = PlayerGroupAll(); 
    autoA1C853BF_p = 1;
    for ( ; autoA1C853BF_p <= PlayerGroupCount(autoA1C853BF_g) ; autoA1C853BF_p += BoolToInt(lv_itPlayer == PlayerGroupPlayer(autoA1C853BF_g, autoA1C853BF_p)) ) {
        lv_itPlayer = PlayerGroupPlayer(autoA1C853BF_g, autoA1C853BF_p);
        if ((lv_itPlayer != lp_player) && (libNtve_gf_PlayerIsEnemy(lp_player, lv_itPlayer, 0) == true)) {
            PlayerSetAlliance(lp_player, c_allianceIdVision, lv_itPlayer, false);
        }
        else {
        }
    }
    VisRevealerCreate(lp_player, RegionEntireMap());
    CutsceneCreateNoPosition(lp_cutscene, libCore_gv_playerGroupFromPlayer[lp_player], false);
    libMapM_gv_mMIntroCutscene[lp_player] = CutsceneLastCreated();
    CutscenePlay(libMapM_gv_mMIntroCutscene[lp_player]);
    libMapM_gv_mMIntroCutscenePlayer = lp_player;
    TriggerExecute(libMapM_gt_MMIntroSkippable, true, true);
    if ((libMapM_gv_mMIntroCutsceneCompleted[lp_player] == false)) {
        lv_fadeDuration = 0.75;
        CutsceneFade(false, lv_fadeDuration, Color(0,0,0), 0.0, libCore_gv_playerGroupFromPlayer[lp_player], false);
        libStEx_gf_CinematicFade(false, lv_fadeDuration, Color(0.00, 0.00, 0.00), lp_player);
        Wait(lv_fadeDuration, c_timeGame);
        CutsceneStop(libMapM_gv_mMIntroCutscene[lp_player]);
    }
    else {
    }
    VisRevealerEnable(VisRevealerLastCreated(), false);
    VisRevealerDestroy(VisRevealerLastCreated());
    auto341C65FA_g = PlayerGroupAll(); 
    auto341C65FA_p = 1;
    for ( ; auto341C65FA_p <= PlayerGroupCount(auto341C65FA_g) ; auto341C65FA_p += BoolToInt(lv_itPlayer == PlayerGroupPlayer(auto341C65FA_g, auto341C65FA_p)) ) {
        lv_itPlayer = PlayerGroupPlayer(auto341C65FA_g, auto341C65FA_p);
        if ((lv_itPlayer != lp_player) && (libNtve_gf_PlayerIsEnemy(lp_player, lv_itPlayer, 0) == true)) {
            PlayerSetAlliance(lp_player, c_allianceIdVision, lv_itPlayer, true);
        }
        else {
        }
    }
    libStEx_gf_CinematicModeTutorial(false, libCore_gv_playerGroupFromPlayer[lp_player], 1.0);
    libStEx_gf_TurnCinematicCameraOnOff(lp_player, false);
    DialogControlFadeTransparency(libUIUI_gv_uIGameUIHandles.lv_consoleUIContainer, libCore_gv_playerGroupFromPlayer[lp_player], 0.0, 0.0);
    lv_fadeDuration = 1.5;
    CutsceneFade(true, lv_fadeDuration, Color(0,0,0), 0.0, libCore_gv_playerGroupFromPlayer[lp_player], false);
    libStEx_gf_CinematicFade(true, lv_fadeDuration, Color(0.00, 0.00, 0.00), lp_player);
    Wait(lv_fadeDuration, c_timeGame);
    libGame_gv_players[lp_player].lv_heroSpawnReady = true;
    return true;
}

void libMapM_gf_PlayMapMechanicIntro (string lp_cutscene) {
    int autoC1D9807C_ae;
    int autoC1D9807C_ai;

    // Variable Declarations
    int lv_itPlayer;

    // Variable Initialization

    // Implementation
    autoC1D9807C_ae = libCore_gv_bALMaxPlayers;
    autoC1D9807C_ai = 1;
    lv_itPlayer = 1;
    for ( ; ( (autoC1D9807C_ai >= 0 && lv_itPlayer <= autoC1D9807C_ae) || (autoC1D9807C_ai <= 0 && lv_itPlayer >= autoC1D9807C_ae) ) ; lv_itPlayer += autoC1D9807C_ai ) {
        if ((PlayerStatus(lv_itPlayer) != c_playerStatusUnused) && (PlayerType(lv_itPlayer) == c_playerTypeUser)) {
            libMapM_gf_PlayMapMechanicIntroForPlayer(lv_itPlayer, lp_cutscene);
        }
        else {
        }
    }
}

void libMapM_gf_MMRavenCurseAddTributeSpawnLocation (point lp_spawnLocation) {
    // Implementation
    if ((libMapM_gv_mMRavenTributeSpawnPointsCount >= libMapM_gv_mMRavenTributeSpawnPointsCountMax_C)) {
        TriggerDebugOutput(1, StringExternal("Param/Value/lib_MapM_55A9F5EA"), true);
        return ;
    }
    else {
    }
    libMapM_gv_mMRavenTributeSpawnPointsCount += 1;
    libMapM_gv_mMRavenTributeSpawnPoints[libMapM_gv_mMRavenTributeSpawnPointsCount] = lp_spawnLocation;
}

bool libMapM_gf_MMRavenCurseStarted () {
    // Implementation
    return (libMapM_gv_mMRavenTeamStats[1].lv_cursed || libMapM_gv_mMRavenTeamStats[2].lv_cursed);
}

void libMapM_gf_MMRavenCurseInit () {
    playergroup autoFB3018C5_g;
    int autoFB3018C5_p;

    // Variable Declarations
    int lv_itPlayer;

    // Variable Initialization

    // Implementation
    TriggerEnable(libMapM_gt_MMRavenCurseGateOpen, true);
    TriggerEnable(libMapM_gt_MMRavenTributeCollectStarted, true);
    TriggerEnable(libMapM_gt_MMRavenTributeCollectCanceled, true);
    TriggerEnable(libMapM_gt_MMRavenDebugStartElunees, true);
    TriggerEnable(libMapM_gt_MMRavenDebugStartNexten, true);
    TriggerEnable(libMapM_gt_MMRavenDebugStartCurseec, true);
    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal MM1Off");
    autoFB3018C5_g = PlayerGroupAll(); 
    autoFB3018C5_p = 1;
    for ( ; autoFB3018C5_p <= PlayerGroupCount(autoFB3018C5_g) ; autoFB3018C5_p += BoolToInt(lv_itPlayer == PlayerGroupPlayer(autoFB3018C5_g, autoFB3018C5_p)) ) {
        lv_itPlayer = PlayerGroupPlayer(autoFB3018C5_g, autoFB3018C5_p);
        CatalogFieldValueSet(c_gameCatalogAbil, "CaptureMacGuffin", "Activity", lv_itPlayer, "DOCSTR_MMRavenCurse_CapturingTribute");
    }
}

fixed libMapM_gf_MMRavenStartTime () {
    // Implementation
    return libMapM_gv_mMRavenStartTime_C;
}

fixed libMapM_gf_MMRavenTributeSpawnTime () {
    // Implementation
    return libMapM_gv_mMRavenTributeSpawnTime_C;
}

int libMapM_gf_MMRavenTributeThresholdAmount () {
    // Implementation
    return libMapM_gv_mMRavenTributeThreshold_C;
}

string libMapM_gf_MMRavenTributeUnitType () {
    // Implementation
    return "RavenLordTribute";
}

point libMapM_gf_MMRavenRandomSpawnPoint () {
    int auto3F8AF97C_ae;
    int auto3F8AF97C_ai;

    // Variable Declarations
    int lv_spawnIndex;
    int[libMapM_gv_mMRavenTributeSpawnPointsCountMax_C + 1] lv_availableSpawnPointIndex;
    int lv_availableSpawnPointsCount;
    int lv_index;

    // Variable Initialization

    // Implementation
    if ((libMapM_gv_mMRavenTributeSpawnPointsCount < 1)) {
        return null;
    }
    else {
        auto3F8AF97C_ae = libMapM_gv_mMRavenTributeSpawnPointsCount;
        auto3F8AF97C_ai = 1;
        lv_index = 1;
        for ( ; ( (auto3F8AF97C_ai >= 0 && lv_index <= auto3F8AF97C_ae) || (auto3F8AF97C_ai <= 0 && lv_index >= auto3F8AF97C_ae) ) ; lv_index += auto3F8AF97C_ai ) {
            if ((lv_index != libMapM_gv_mMRavenLastTributeSpawnIndex1) && (!(((libMapM_gv_mMRavenLastTributeSpawnIndex1 > 0) && (libMapM_gv_mMRavenLastTributeSpawnIndex2 > 0) && (ModI(libMapM_gv_mMRavenLastTributeSpawnIndex1, 2) == ModI(libMapM_gv_mMRavenLastTributeSpawnIndex2, 2)) && (ModI(lv_index, 2) == ModI(libMapM_gv_mMRavenLastTributeSpawnIndex1, 2)))))) {
                lv_availableSpawnPointsCount += 1;
                lv_availableSpawnPointIndex[lv_availableSpawnPointsCount] = lv_index;
            }
            else {
            }
        }
        libMapM_gv_mMRavenLastTributeSpawnIndex2 = libMapM_gv_mMRavenLastTributeSpawnIndex1;
        libMapM_gv_mMRavenLastTributeSpawnIndex1 = lv_availableSpawnPointIndex[RandomInt(1, lv_availableSpawnPointsCount)];
        return libMapM_gv_mMRavenTributeSpawnPoints[libMapM_gv_mMRavenLastTributeSpawnIndex1];
    }
}

void libMapM_gf_MMRavenStartSpawnTimer5090 () {
    // Variable Declarations
    fixed lv_spawnTime;

    // Variable Initialization

    // Implementation
    lv_spawnTime = (libMapM_gv_mMRavenTributeSpawnTime_C + RandomFixed((libMapM_gv_mMRavenTributeSpawnTimeVariance * -1), libMapM_gv_mMRavenTributeSpawnTimeVariance));
    TimerStart(libMapM_gv_mMRavenWarningTimer, (lv_spawnTime - libMapM_gv_mMRavenSpawnWarningTimerTime_C), false, c_timeGame);
}

void libMapM_gf_MMRavenTributeCollectionThresholdReached (int lp_winningTeam) {
    // Implementation
    if ((lp_winningTeam == libGame_gf_TeamNumberOfPlayer(libCore_gv_cOMPUTER_TeamOrder))) {
        libMapM_gf_MMRavenCurseStart(libCore_gv_cOMPUTER_TeamChaos);
    }
    else {
        libMapM_gf_MMRavenCurseStart(libCore_gv_cOMPUTER_TeamOrder);
    }
}

void libMapM_gf_MMRavenCurseStart (int lp_cursedPlayer) {
    // Variable Declarations
    int lv_itPlayer;
    int lv_index;
    int lv_cursedTeam;
    int lv_enemyTeam;

    // Variable Initialization

    // Implementation
    lv_cursedTeam = libGame_gf_TeamNumberOfPlayer(lp_cursedPlayer);
    lv_enemyTeam = (3 - lv_cursedTeam);
    libMapM_gf_MMRavenPlayCurseSound(lv_cursedTeam);
    SoundChannelMute(PlayerGroupAll(), c_soundCategoryAmbient, true);
    SoundtrackPlay(PlayerGroupAll(), c_soundtrackCategoryMusic, "Storm_Music_RavenKing_Cursed", c_soundtrackCueAny, c_soundtrackIndexAny, true);
    libGame_gf_SendEventMapRavenLordCurseStarts(lv_enemyTeam);
    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal MM1On");
    libGame_gv_teams[lv_enemyTeam].lv_map_CursesPlacedOnEnemyTeam += 1;
    StatEventCreate("RavenCurseActivated");
    StatEventAddDataFixed(StatEventLastCreated(), "TeamID", lv_enemyTeam);
    StatEventAddDataInt(StatEventLastCreated(), "TeamScore", libMapM_gv_mMRavenTeamStats[lv_enemyTeam].lv_triburteCollected);
    StatEventAddDataInt(StatEventLastCreated(), "OpponentScore", libMapM_gv_mMRavenTeamStats[lv_cursedTeam].lv_triburteCollected);
    StatEventSend(StatEventLastCreated());
    libMapM_gv_mMRavenTeamStats[libGame_gf_TeamNumberOfPlayer(lp_cursedPlayer)].lv_cursed = true;
    UnitGroupLoopBegin(UnitGroup(null, lp_cursedPlayer, RegionEntireMap(), UnitFilter((1 << c_targetFilterArmored), 0, (1 << c_targetFilterLight) | (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
        UnitBehaviorAdd(UnitGroupLoopCurrent(), "RavenLordsCurseStructures", UnitGroupLoopCurrent(), 1);
        UnitBehaviorSetDuration(UnitGroupLoopCurrent(), "RavenLordsCurseStructures", libMapM_gv_mMRavenCurseDuration_C);
        UnitBehaviorAdd(UnitGroupLoopCurrent(), "RavenLordsCurseStructuresWarning", UnitGroupLoopCurrent(), 1);
        UnitBehaviorSetDuration(UnitGroupLoopCurrent(), "RavenLordsCurseStructuresWarning", (libMapM_gv_mMRavenCurseDuration_C - 5.0));
    }
    UnitGroupLoopEnd();
    UnitGroupLoopBegin(UnitGroup(null, lp_cursedPlayer, RegionEntireMap(), UnitFilter((1 << c_targetFilterStructure), 0, (1 << c_targetFilterLight) | (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
        if ((UnitHasBehavior2(UnitGroupLoopCurrent(), "TownGateBehavior") == true)) {
            UnitBehaviorAdd(UnitGroupLoopCurrent(), "RavenLordsCurseStructures", UnitGroupLoopCurrent(), 1);
            UnitBehaviorSetDuration(UnitGroupLoopCurrent(), "RavenLordsCurseStructures", libMapM_gv_mMRavenCurseDuration_C);
            UnitBehaviorAdd(UnitGroupLoopCurrent(), "RavenLordsCurseStructuresWarning", UnitGroupLoopCurrent(), 1);
            UnitBehaviorSetDuration(UnitGroupLoopCurrent(), "RavenLordsCurseStructuresWarning", (libMapM_gv_mMRavenCurseDuration_C - 1.0));
        }
        else {
        }
    }
    UnitGroupLoopEnd();
    UnitGroupLoopBegin(UnitGroup(null, lp_cursedPlayer, RegionEntireMap(), UnitFilter((1 << c_targetFilterBiological), 0, (1 << c_targetFilterRobotic) | (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
        libMapM_gf_MMRavenApplyCurseEffectOnMinion(UnitGroupLoopCurrent());
    }
    UnitGroupLoopEnd();
    TriggerExecute(libMapM_gt_MMRavenCurseStartLightTransition, true, false);
    TimerStart(libMapM_gv_mMRavenCurseTimer, libMapM_gv_mMRavenCurseDuration_C, false, c_timeGame);
    libGame_gf_AnnouncementAddItemForPlayerGroup(libGame_gf_PlayersOnTeamHeroes(lv_cursedTeam, false), 0, 0, "RavenCurseAlly", StringExternal("Param/Value/lib_MapM_D1793208"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    libGame_gf_AnnouncementAddItemForPlayerGroup(libGame_gf_PlayersOnTeamHeroes(lv_enemyTeam, false), 0, 0, "RavenCurseEnemy", StringExternal("Param/Value/lib_MapM_B7E16B97"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    if ((lv_cursedTeam == 1)) {
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 0, 0, "RavenCurseEnemy", StringExternal("Param/Value/lib_MapM_46EE92B4"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    }
    else {
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 0, 0, "RavenCurseEnemy", StringExternal("Param/Value/lib_MapM_FED8C9D5"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    }
}

void libMapM_gf_MMRavenApplyCurseEffectOnMinion (unit lp_unit) {
    // Implementation
    UnitBehaviorAdd(lp_unit, "RavenLordsCurseUnits", lp_unit, 1);
    UnitSetPropertyFixed(lp_unit, c_unitPropLife, 1.0);
    libNtve_gf_SendActorMessageToUnit(lp_unit, "SetTintColor 207,159,255");
}

void libMapM_gf_MMRavenRemoveCurseEffectOnMinion (unit lp_minion) {
    // Implementation
    if ((UnitIsAlive(lp_minion) == false)) {
        return ;
    }
    else {
    }
    UnitSetPropertyFixed(lp_minion, c_unitPropLifePercent, 100.0);
    UnitBehaviorRemove(lp_minion, "RavenLordsCurseUnits", 1);
    libNtve_gf_SendActorMessageToUnit(lp_minion, "SetTintColor 255,255,255");
}

trigger auto_libMapM_gf_MMRavenPlayCurseSound_Trigger = null;
int auto_libMapM_gf_MMRavenPlayCurseSound_lp_cursedTeam;

void libMapM_gf_MMRavenPlayCurseSound (int lp_cursedTeam) {
    auto_libMapM_gf_MMRavenPlayCurseSound_lp_cursedTeam = lp_cursedTeam;

    if (auto_libMapM_gf_MMRavenPlayCurseSound_Trigger == null) {
        auto_libMapM_gf_MMRavenPlayCurseSound_Trigger = TriggerCreate("auto_libMapM_gf_MMRavenPlayCurseSound_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMRavenPlayCurseSound_Trigger, false, false);
}

bool auto_libMapM_gf_MMRavenPlayCurseSound_TriggerFunc (bool testConds, bool runActions) {
    int lp_cursedTeam = auto_libMapM_gf_MMRavenPlayCurseSound_lp_cursedTeam;

    // Variable Declarations
    int lv_enemyTeam;

    // Variable Initialization

    // Implementation
    SoundPlayForPlayer(SoundLink("Event_RavenCurse_CurseStart", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);
    SoundPlayForPlayer(SoundLink("Event_RavenCurse_CurseMid", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);
    libMapM_gv_mMRavenCurseSound = SoundLastPlayed();
    Wait(2.0, c_timeReal);
    lv_enemyTeam = (3 - lp_cursedTeam);
    libMapM_gf_MMRavenTransmissionEnemyCursedQ(libGame_gf_PlayersOnTeamHeroes(lv_enemyTeam, false));
    libMapM_gf_MMRavenTransmissionAlliedCursedQ(libGame_gf_PlayersOnTeamHeroes(lp_cursedTeam, false));
    libMapM_gf_MMRavenTransmissionObserverCursedQ();
    return true;
}

void libMapM_gf_MMRavenObjectiveUIUpdateText () {
    // Variable Declarations
    int lv_indexTeam;
    int lv_indexTeamEnemy;

    // Variable Initialization

    // Implementation
    libUIUI_gf_MapMechanicsRavenCourtSetTributeCountForTeam(libMapM_gv_mMRavenTeamStats[libGame_gv_teamOrderIndex_C].lv_triburteCollected, libGame_gv_teamOrderIndex_C);
    libUIUI_gf_MapMechanicsRavenCourtSetTributeCountForTeam(libMapM_gv_mMRavenTeamStats[libGame_gv_teamChaosIndex_C].lv_triburteCollected, libGame_gv_teamChaosIndex_C);
}

trigger auto_libMapM_gf_MMRavenTransmissionEventStartQ_Trigger = null;
playergroup auto_libMapM_gf_MMRavenTransmissionEventStartQ_lp_players;

void libMapM_gf_MMRavenTransmissionEventStartQ (playergroup lp_players) {
    auto_libMapM_gf_MMRavenTransmissionEventStartQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMRavenTransmissionEventStartQ_Trigger == null) {
        auto_libMapM_gf_MMRavenTransmissionEventStartQ_Trigger = TriggerCreate("auto_libMapM_gf_MMRavenTransmissionEventStartQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMRavenTransmissionEventStartQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMRavenTransmissionEventStartQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMRavenTransmissionEventStartQ_lp_players;

    // Implementation
    if ((libMapM_gv_mMRavenEventFirstTime == true)) {
        TriggerQueueEnter();
        // Transmission - SoundLink("CreepVO_RavenKing_067", -1)
        TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("CreepVO_RavenKing_067", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
        TriggerQueueExit();
    }
    else {
        libMapM_gf_MMRavenTransmissionTributeAboutToSpawnQ(lp_players);
    }
    return true;
}

trigger auto_libMapM_gf_MMRavenTransmissionTributeAboutToSpawnQ_Trigger = null;
playergroup auto_libMapM_gf_MMRavenTransmissionTributeAboutToSpawnQ_lp_players;

void libMapM_gf_MMRavenTransmissionTributeAboutToSpawnQ (playergroup lp_players) {
    auto_libMapM_gf_MMRavenTransmissionTributeAboutToSpawnQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMRavenTransmissionTributeAboutToSpawnQ_Trigger == null) {
        auto_libMapM_gf_MMRavenTransmissionTributeAboutToSpawnQ_Trigger = TriggerCreate("auto_libMapM_gf_MMRavenTransmissionTributeAboutToSpawnQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMRavenTransmissionTributeAboutToSpawnQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMRavenTransmissionTributeAboutToSpawnQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMRavenTransmissionTributeAboutToSpawnQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    // Transmission - SoundLink("Raven_TributeSpawn", -1)
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("Raven_TributeSpawn", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMRavenTransmissionEnemyCursedQ_Trigger = null;
playergroup auto_libMapM_gf_MMRavenTransmissionEnemyCursedQ_lp_players;

void libMapM_gf_MMRavenTransmissionEnemyCursedQ (playergroup lp_players) {
    auto_libMapM_gf_MMRavenTransmissionEnemyCursedQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMRavenTransmissionEnemyCursedQ_Trigger == null) {
        auto_libMapM_gf_MMRavenTransmissionEnemyCursedQ_Trigger = TriggerCreate("auto_libMapM_gf_MMRavenTransmissionEnemyCursedQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMRavenTransmissionEnemyCursedQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMRavenTransmissionEnemyCursedQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMRavenTransmissionEnemyCursedQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    // Transmission - SoundLink("Raven_EnemyCursed", -1)
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("Raven_EnemyCursed", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMRavenTransmissionAlliedCursedQ_Trigger = null;
playergroup auto_libMapM_gf_MMRavenTransmissionAlliedCursedQ_lp_players;

void libMapM_gf_MMRavenTransmissionAlliedCursedQ (playergroup lp_players) {
    auto_libMapM_gf_MMRavenTransmissionAlliedCursedQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMRavenTransmissionAlliedCursedQ_Trigger == null) {
        auto_libMapM_gf_MMRavenTransmissionAlliedCursedQ_Trigger = TriggerCreate("auto_libMapM_gf_MMRavenTransmissionAlliedCursedQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMRavenTransmissionAlliedCursedQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMRavenTransmissionAlliedCursedQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMRavenTransmissionAlliedCursedQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    // Transmission - SoundLink("Raven_AlliesCursed", -1)
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("Raven_AlliesCursed", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMRavenTransmissionObserverCursedQ_Trigger = null;

void libMapM_gf_MMRavenTransmissionObserverCursedQ () {
    if (auto_libMapM_gf_MMRavenTransmissionObserverCursedQ_Trigger == null) {
        auto_libMapM_gf_MMRavenTransmissionObserverCursedQ_Trigger = TriggerCreate("auto_libMapM_gf_MMRavenTransmissionObserverCursedQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMRavenTransmissionObserverCursedQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMRavenTransmissionObserverCursedQ_TriggerFunc (bool testConds, bool runActions) {
    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(PlayerGroupSingle(libCore_gv_oBSERVER_ObserverUIPlayer), TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("Raven_ObserverCurse", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMRavenTransmissionEnemyCurseEndsQ_Trigger = null;
playergroup auto_libMapM_gf_MMRavenTransmissionEnemyCurseEndsQ_lp_players;

void libMapM_gf_MMRavenTransmissionEnemyCurseEndsQ (playergroup lp_players) {
    auto_libMapM_gf_MMRavenTransmissionEnemyCurseEndsQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMRavenTransmissionEnemyCurseEndsQ_Trigger == null) {
        auto_libMapM_gf_MMRavenTransmissionEnemyCurseEndsQ_Trigger = TriggerCreate("auto_libMapM_gf_MMRavenTransmissionEnemyCurseEndsQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMRavenTransmissionEnemyCurseEndsQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMRavenTransmissionEnemyCurseEndsQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMRavenTransmissionEnemyCurseEndsQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    // Transmission - SoundLink("CreepVO_RavenKing_084", -1)
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("CreepVO_RavenKing_084", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMRavenTransmissionAlliedCurseEndsQ_Trigger = null;
playergroup auto_libMapM_gf_MMRavenTransmissionAlliedCurseEndsQ_lp_players;

void libMapM_gf_MMRavenTransmissionAlliedCurseEndsQ (playergroup lp_players) {
    auto_libMapM_gf_MMRavenTransmissionAlliedCurseEndsQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMRavenTransmissionAlliedCurseEndsQ_Trigger == null) {
        auto_libMapM_gf_MMRavenTransmissionAlliedCurseEndsQ_Trigger = TriggerCreate("auto_libMapM_gf_MMRavenTransmissionAlliedCurseEndsQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMRavenTransmissionAlliedCurseEndsQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMRavenTransmissionAlliedCurseEndsQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMRavenTransmissionAlliedCurseEndsQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    // Transmission - SoundLink("CreepVO_RavenKing_085", -1)
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("CreepVO_RavenKing_085", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMRavenTransmissionObserverCurseEndsQ_Trigger = null;

void libMapM_gf_MMRavenTransmissionObserverCurseEndsQ () {
    if (auto_libMapM_gf_MMRavenTransmissionObserverCurseEndsQ_Trigger == null) {
        auto_libMapM_gf_MMRavenTransmissionObserverCurseEndsQ_Trigger = TriggerCreate("auto_libMapM_gf_MMRavenTransmissionObserverCurseEndsQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMRavenTransmissionObserverCurseEndsQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMRavenTransmissionObserverCurseEndsQ_TriggerFunc (bool testConds, bool runActions) {
    // Implementation
    TriggerQueueEnter();
    // Transmission - SoundLink("CreepVO_RavenKing_085", -1)
    TransmissionSendForPlayer(PlayerGroupSingle(libCore_gv_oBSERVER_ObserverUIPlayer), TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("CreepVO_RavenKing_085", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

void libMapM_gf_MMCannonballsInitGhostshipInfo (point lp_shipLoc, point lp_beaconLoc) {
    // Implementation
    libMapM_gv_mMCannonballsGhostShipLoc = lp_shipLoc;
    libMapM_gv_mMCannonballsGhostShipBeaconLoc = lp_beaconLoc;
}

void libMapM_gf_MMCannonballsInitTreasureChestInfo (point lp_chestLocation1, point lp_chestLocation2) {
    // Implementation
    libMapM_gv_mMCannonballsGhostChestLocations[1] = lp_chestLocation1;
    libMapM_gv_mMCannonballsGhostChestLocations[2] = lp_chestLocation2;
}

int libMapM_gf_MMCannonballsHeroCannonballsCount (int lp_player) {
    // Variable Declarations
    unit lv_heroUnit;
    fixed lv_cannonballCount;

    // Variable Initialization

    // Implementation
    lv_heroUnit = libGame_gv_players[lp_player].lv_heroUnit;
    lv_cannonballCount = UnitBehaviorCount(lv_heroUnit, "CannonballStack");
    return FixedToInt(lv_cannonballCount);
}

int libMapM_gf_MMCannonballsPirateShipCost (int lp_team) {
    // Implementation
    return libMapM_gv_mMCannonballsBallsSubmitMaxCurrent[lp_team];
}

void libMapM_gf_MMCannonballsAddGhostShipTargetOrder (int lp_team, int lp_townIndex) {
    // Implementation
    libMapM_gv_mMCannonballsGhostShipTargetTownOrdersCount[lp_team] += 1;
    libMapM_gv_mMCannonballsGhostShipTargetTownOrders[lp_team][libMapM_gv_mMCannonballsGhostShipTargetTownOrdersCount[lp_team]] = lp_townIndex;
}

void libMapM_gf_MMCannonballsInit () {
    playergroup auto08C27EB2_g;
    int auto08C27EB2_p;

    // Variable Declarations
    int lv_itPlayer;

    // Variable Initialization

    // Implementation
    TriggerEnable(libMapM_gt_MMCannonballsHeroDies, true);
    TriggerEnable(libMapM_gt_MMCannonballsHeroSpawned, true);
    TriggerEnable(libMapM_gt_MMCannonballsHeroRespawns, true);
    TriggerEnable(libMapM_gt_MMCannonballsGatesAreOpenComplete, true);
    TriggerEnable(libMapM_gt_MMCannonballsCampSpawned, true);
    TriggerEnable(libMapM_gt_MMCannonballsBattleshipKilledATown, true);
    libMapM_gf_MMCannonballsUpdateHeroStatusCannonballCount();
    TriggerEnable(libMapM_gt_MMCannonballsHeroPickup, true);
    TriggerEnable(libMapM_gt_MMCannonballsBallsHandedIn, true);
    TriggerEnable(libMapM_gt_MMCannonballsShootingStart, true);
    TriggerEnable(libMapM_gt_MMCannonballsShootingEnd, true);
    TriggerEnable(libMapM_gt_MMCannonballsTreasureSpawnChests, true);
    TriggerEnable(libMapM_gt_MMCannonballsTreasureChestAttacked, true);
    TriggerEnable(libMapM_gt_MMCannonballsDoubloonCreated, true);
    TriggerEnable(libMapM_gt_MMCannonballsDebugModify, true);
    TriggerEnable(libMapM_gt_MMCannonballsDebugEventStart, true);
    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal MM1Off");
    auto08C27EB2_g = PlayerGroupAll(); 
    auto08C27EB2_p = 1;
    for ( ; auto08C27EB2_p <= PlayerGroupCount(auto08C27EB2_g) ; auto08C27EB2_p += BoolToInt(lv_itPlayer == PlayerGroupPlayer(auto08C27EB2_g, auto08C27EB2_p)) ) {
        lv_itPlayer = PlayerGroupPlayer(auto08C27EB2_g, auto08C27EB2_p);
        CatalogFieldValueSet(c_gameCatalogAbil, "CaptureMacGuffin", "Activity", lv_itPlayer, "DOCSTR_MMDoubloons_HandinDoubloons");
    }
}

int libMapM_gf_MMCannonballsTeamCannonballsCount (int lp_team) {
    // Implementation
    return libMapM_gv_mMCannonballsBallsSubmitted[lp_team];
}

void libMapM_gf_MMCannonballsSubmitReqIncrease (int lp_team) {
    // Implementation
    libMapM_gv_mMCannonballsBallsSubmitMaxCurrent[lp_team] += libMapM_gv_mMCannonballsBallsSubmitMaxInc_C;
}

void libMapM_gf_MMCannonballsSetHeroCannonballsCount (int lp_player, int lp_count) {
    int autoB3BC8955_ae;
    int autoB3BC8955_ai;

    // Variable Declarations
    int lv_itPlayer;
    unit lv_heroUnit;
    unit lv_vehicleUnit;
    int lv_numCannonballs;

    // Variable Initialization

    // Implementation
    lv_heroUnit = libGame_gv_players[lp_player].lv_heroUnit;
    lv_numCannonballs = libMapM_gf_MMCannonballsHeroCannonballsCount(lp_player);
    UnitBehaviorRemove(lv_heroUnit, "CannonballStack", lv_numCannonballs);
    if ((lp_count <= 0)) {
        UnitAbilityEnable(libGame_gv_players[lp_player].lv_heroUnit, "CaptureMacGuffin", false);
    }
    else {
        UnitBehaviorAdd(lv_heroUnit, "CannonballStack", lv_heroUnit, lp_count);
        UnitAbilityEnable(libGame_gv_players[lp_player].lv_heroUnit, "CaptureMacGuffin", true);
    }
    if ((UnitIsAlive(libGame_gv_players[lp_player].lv_activeVehicle) == true)) {
        lv_vehicleUnit = libGame_gv_players[lp_player].lv_activeVehicle;
        UnitBehaviorRemove(lv_vehicleUnit, "CannonballStack", lv_numCannonballs);
        if ((lp_count <= 0)) {
            UnitAbilityEnable(lv_vehicleUnit, "CaptureMacGuffin", false);
        }
        else {
            UnitBehaviorAdd(lv_vehicleUnit, "CannonballStack", lv_heroUnit, lp_count);
            UnitAbilityEnable(lv_vehicleUnit, "CaptureMacGuffin", true);
        }
    }
    else {
    }
    autoB3BC8955_ae = libCore_gv_bALMaxPlayers;
    autoB3BC8955_ai = 1;
    lv_itPlayer = 1;
    for ( ; ( (autoB3BC8955_ai >= 0 && lv_itPlayer <= autoB3BC8955_ae) || (autoB3BC8955_ai <= 0 && lv_itPlayer >= autoB3BC8955_ae) ) ; lv_itPlayer += autoB3BC8955_ai ) {
        if ((libUIUI_gv_uITargetInfoPanelCurrentTargetForPlayer[lv_itPlayer] == lv_heroUnit)) {
            libUIUI_gf_UITargetInfoPanelUpdateMapMechanicTextForPlayer(IntToText(lp_count), lv_itPlayer);
        }
        else {
        }
    }
}

void libMapM_gf_MMCannonballsModifyHeroCannonballsCount (int lp_player, int lp_count) {
    // Variable Declarations
    unit lv_heroUnit;
    int lv_finalCount;

    // Variable Initialization

    // Implementation
    if ((lp_count == 0)) {
        return ;
    }
    else {
    }
    lv_finalCount = (libMapM_gf_MMCannonballsHeroCannonballsCount(lp_player) + lp_count);
    lv_finalCount = MaxI(lv_finalCount, 0);
    libMapM_gf_MMCannonballsSetHeroCannonballsCount(lp_player, lv_finalCount);
}

void libMapM_gf_MMCannonballsCreepRewards (int lp_camp) {
    // Variable Declarations
    int lv_cannonballCount;

    // Variable Initialization
    lv_cannonballCount = 2;

    // Implementation
    if ((libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampType == 0)) {
        if (((libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampDefenderType == 2) || (libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampDefenderType == 3))) {
            lv_cannonballCount = 2;
        }
        else {
            lv_cannonballCount = 2;
        }
    }
    else if ((libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampType != 1) && (libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampType != 2)) {
        lv_cannonballCount = 2;
    }
    else if (true) {
        return ;
    }
    CatalogFieldValueSet(c_gameCatalogEffect, "DropCannonballsPersistentJungleCamps", "PeriodCount", libCore_gv_cOMPUTER_Hostile, IntToString(lv_cannonballCount));
    PlayerCreateEffectPoint(libCore_gv_cOMPUTER_Hostile, "DropCannonballsPersistentJungleCamps", libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataCampCaptainSpawnPoint);
}

void libMapM_gf_MMCannonballsObjectiveUIUpdateText () {
    // Implementation
    libUIUI_gf_MapMechanicsBlackheartsBaySetDoubloonCountForTeam(libMapM_gf_MMCannonballsTeamCannonballsCount(libGame_gv_teamOrderIndex_C), libMapM_gf_MMCannonballsPirateShipCost(libGame_gv_teamOrderIndex_C), libGame_gv_teamOrderIndex_C);
    libUIUI_gf_MapMechanicsBlackheartsBaySetDoubloonCountForTeam(libMapM_gf_MMCannonballsTeamCannonballsCount(libGame_gv_teamChaosIndex_C), libMapM_gf_MMCannonballsPirateShipCost(libGame_gv_teamChaosIndex_C), libGame_gv_teamChaosIndex_C);
}

trigger auto_libMapM_gf_MMCannonballsUpdateHeroStatusCannonballCount_Trigger = null;

void libMapM_gf_MMCannonballsUpdateHeroStatusCannonballCount () {
    if (auto_libMapM_gf_MMCannonballsUpdateHeroStatusCannonballCount_Trigger == null) {
        auto_libMapM_gf_MMCannonballsUpdateHeroStatusCannonballCount_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsUpdateHeroStatusCannonballCount_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsUpdateHeroStatusCannonballCount_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsUpdateHeroStatusCannonballCount_TriggerFunc (bool testConds, bool runActions) {
    int auto51DB919E_ae;
    int auto51DB919E_ai;

    // Variable Declarations
    int lv_itPlayer;
    int lv_itPlayerTarget;

    // Variable Initialization

    // Implementation
    while (true) {
        auto51DB919E_ae = libCore_gv_bALMaxPlayers;
        auto51DB919E_ai = 1;
        lv_itPlayer = 1;
        for ( ; ( (auto51DB919E_ai >= 0 && lv_itPlayer <= auto51DB919E_ae) || (auto51DB919E_ai <= 0 && lv_itPlayer >= auto51DB919E_ae) ) ; lv_itPlayer += auto51DB919E_ai ) {
            if ((libGame_gv_players[lv_itPlayer].lv_heroUnit != null)) {
                if ((libUIUI_gv_uIHeroStatusFrames[lv_itPlayer].lv_mapMechanicIcon != c_invalidDialogControlId) && (libUIUI_gv_uIHeroStatusFrames[lv_itPlayer].lv_mapMechanicCount != c_invalidDialogControlId)) {
                    if ((libMapM_gf_MMCannonballsHeroCannonballsCount(lv_itPlayer) >= libMapM_gv_mMCannonballsHeroStatusBarIconVisibleThreadhold_C)) {
                        TextExpressionSetToken("Param/Expression/lib_MapM_17AE9E82", "A", IntToText(libMapM_gf_MMCannonballsHeroCannonballsCount(lv_itPlayer)));
                        libNtve_gf_SetDialogItemText(libUIUI_gv_uIHeroStatusFrames[lv_itPlayer].lv_mapMechanicCount, TextExpressionAssemble("Param/Expression/lib_MapM_17AE9E82"), PlayerGroupAll());
                        DialogControlSetVisible(libUIUI_gv_uIHeroStatusFrames[lv_itPlayer].lv_mapMechanicFrame, PlayerGroupAll(), true);
                    }
                    else {
                        DialogControlSetVisible(libUIUI_gv_uIHeroStatusFrames[lv_itPlayer].lv_mapMechanicFrame, PlayerGroupAll(), false);
                    }
                }
                else {
                }
            }
            else {
            }
        }
        Wait(0.25, c_timeGame);
    }
    return true;
}

void libMapM_gf_MMCannonballsGhostShipWakeUp (int lp_team, bool lp_new) {
    // Variable Declarations
    int lv_computerPlayer;
    int lv_shipTeam;
    int lv_enemyTeam;

    // Variable Initialization

    // Implementation
    lv_shipTeam = lp_team;
    lv_enemyTeam = (3 - lv_shipTeam);
    lv_computerPlayer = libGame_gf_ComputerPlayerInTeam(lv_shipTeam);
    libMapM_gf_MMCannonballsDisableBeacon();
    UnitSetOwner(libMapM_gv_mMCannonballsGhostShip, lv_computerPlayer, true);
    UnitSetOwner(libMapM_gv_mMCannonballsGhostShipBeacon, lv_computerPlayer, true);
    libMapM_gv_mMCannonballsTrasmissionPlaying = false;
    if ((lp_new == false)) {
        libMapM_gf_MMCannonballsTransmissionSummonedQ(libGame_gf_PlayersOnTeamHeroes(lv_shipTeam, false));
        libMapM_gf_MMCannonballsTransmissionSummonedForEnemyQ(libGame_gf_PlayersOnTeamHeroes(lv_enemyTeam, false));
        libMapM_gf_MMCannonballsTransmissionSummonedObserversQ(PlayerGroupSingle(libCore_gv_oBSERVER_ObserverUIPlayer));
    }
    else {
        if ((lv_shipTeam == libMapM_gv_mMCannonballsGhostShipLastTeam)) {
            libMapM_gf_MMCannonballsTransmissionSummonedContinueAAQ(libGame_gf_PlayersOnTeamHeroes(lv_shipTeam, false));
            libMapM_gf_MMCannonballsTransmissionSummonedContinueBBQ(libGame_gf_PlayersOnTeamHeroes(lv_enemyTeam, false));
        }
        else {
            libMapM_gf_MMCannonballsTransmissionSummonedContinueBAQ(libGame_gf_PlayersOnTeamHeroes(lv_shipTeam, false));
            libMapM_gf_MMCannonballsTransmissionSummonedContinueABQ(libGame_gf_PlayersOnTeamHeroes(lv_enemyTeam, false));
        }
    }
    libGame_gf_AnnouncementAddItemForPlayerGroup(libGame_gf_PlayersOnTeamHeroes(lv_shipTeam, false), 0, 0, "GhostShipAlly", StringExternal("Param/Value/lib_MapM_8B514A03"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    libGame_gf_AnnouncementAddItemForPlayerGroup(libGame_gf_PlayersOnTeamHeroes(lv_enemyTeam, false), 0, 0, "GhostShipEnemy", StringExternal("Param/Value/lib_MapM_D9423EE6"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    if ((lv_enemyTeam == 1)) {
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 0, 0, "GhostShipAlly", StringExternal("Param/Value/lib_MapM_1B63421A"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
        libNtve_gf_CreatePingFacingAngle(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], "PingWarning", UnitGetPosition(libMapM_gv_mMCannonballsGhostShip), ColorWithAlpha(100.00, 0.00, 0.00, 0.00), 4.0, 270.0);
    }
    else {
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 0, 0, "GhostShipAlly", StringExternal("Param/Value/lib_MapM_AE284FBC"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
        libNtve_gf_CreatePingFacingAngle(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], "StormPingWarning", UnitGetPosition(libMapM_gv_mMCannonballsGhostShip), ColorWithAlpha(0.00, 0.00, 100.00, 0.00), 4.0, 270.0);
    }
    libNtve_gf_CreatePingFacingAngle(libGame_gf_PlayersOnTeamHeroes(lv_shipTeam, false), "StormPingWarning", UnitGetPosition(libMapM_gv_mMCannonballsGhostShip), ColorWithAlpha(0.00, 100.00, 0.00, 0.00), 4.0, 270.0);
    libNtve_gf_CreatePingFacingAngle(libGame_gf_PlayersOnTeamHeroes(lv_enemyTeam, false), "StormPingWarning", UnitGetPosition(libMapM_gv_mMCannonballsGhostShip), ColorWithAlpha(100.00, 0.00, 0.00, 0.00), 4.0, 270.0);
    StatEventCreate("GhostShipCaptured");
    StatEventAddDataFixed(StatEventLastCreated(), "TeamID", lv_shipTeam);
    StatEventAddDataInt(StatEventLastCreated(), "TeamScore", libMapM_gv_mMCannonballsBallsSubmitted[lv_shipTeam]);
    StatEventAddDataInt(StatEventLastCreated(), "OpponentScore", libMapM_gv_mMCannonballsBallsSubmitted[(3 - lv_shipTeam)]);
    StatEventSend(StatEventLastCreated());
    libMapM_gv_mMCannonballsTransmissionFiringIndex = 0;
    libMapM_gv_mMCannonballsTransmissionFiringRandomness = RandomInt(4, 9);
    libGame_gf_SendEventDoubloonsGhostShipShootingStart(lv_computerPlayer);
    libMapM_gf_MMCannonballsBattleshipBehavior();
    TimerPause(libMapM_gv_mMCannonballsTreasureChestTimer, true);
    Wait(5.0, c_timeGame);
    libMapM_gv_mMCannonballsBallsSubmitted[lv_shipTeam] = (libMapM_gv_mMCannonballsBallsSubmitted[lv_shipTeam] - libMapM_gf_MMCannonballsPirateShipCost(lv_shipTeam));
    libMapM_gv_mMCannonballsGhostShipLastTeam = lv_shipTeam;
}

void libMapM_gf_MMCannonballsDisableBeacon () {
    // Implementation
    UnitBehaviorAdd(libMapM_gv_mMCannonballsGhostShipBeacon, "MacGuffinNotActive", libMapM_gv_mMCannonballsGhostShipBeacon, 1);
    TriggerEnable(libMapM_gt_MMCannonballsDetectHero, false);
    libNtve_gf_SendActorMessageToGameRegion(libMapM_gv_mMCannonballsGhostShipPlayerDetectorRegion, "Signal ReturnToShip");
    Wait(3.25, c_timeGame);
    libNtve_gf_ShowHideUnit(libMapM_gv_mMCannonballsGhostShipBeacon, false);
    libNtve_gf_ShowHideUnit(libMapM_gv_mMCannonballsGhostShipCaptain, false);
    libNtve_gf_SendActorMessageToGameRegion(libMapM_gv_mMCannonballsGhostShipPlayerDetectorRegion, "Signal CloseChest");
}

trigger auto_libMapM_gf_MMCannonballsBattleshipBehavior_Trigger = null;

void libMapM_gf_MMCannonballsBattleshipBehavior () {
    if (auto_libMapM_gf_MMCannonballsBattleshipBehavior_Trigger == null) {
        auto_libMapM_gf_MMCannonballsBattleshipBehavior_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsBattleshipBehavior_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsBattleshipBehavior_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsBattleshipBehavior_TriggerFunc (bool testConds, bool runActions) {
    int auto2EF5E28F_n;
    int auto2EF5E28F_i;

    // Variable Declarations
    int lv_shipTeam;
    int lv_enemyTeam;
    int lv_currentCharges;
    int lv_targetCharges;
    int lv_itPlayer;
    unit lv_target;
    int lv_shotsLeftInBarrage;
    bool lv_needNewTarget;
    int lv_nextTeam;
    fixed lv_expectedFacingAngle;
    fixed lv_expectedFacingAngle1;
    fixed lv_expectedFacingAngle2;
    fixed lv_angleDiff1;
    fixed lv_angleDiff2;
    const fixed lv_preferedFacingMax = 45.0;
    const fixed lv_preferedFacingMin = -45.0;
    fixed lv_preferedFacing;
    fixed lv_angleDiff;

    // Variable Initialization
    lv_shotsLeftInBarrage = 3;
    lv_preferedFacing = ((lv_preferedFacingMax + lv_preferedFacingMin) / 2.0);

    // Implementation
    lv_shipTeam = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(libMapM_gv_mMCannonballsGhostShip));
    lv_enemyTeam = (3 - lv_shipTeam);
    lv_currentCharges = FixedToInt(UnitAbilityChargeInfo(libMapM_gv_mMCannonballsGhostShip, AbilityCommand("GhostShipBombardChargedPort", 0), c_unitAbilChargeCountLeft));
    lv_targetCharges = (libMapM_gv_mMCannonballsStartInBattleship_C + libMapM_gv_mMCannonballsStockedInBattleship_C);
    UnitAbilityAddChargeUsed(libMapM_gv_mMCannonballsGhostShip, "GhostShipBombardChargedPort", "Abil/BattleshipBombardCharged", (lv_currentCharges - lv_targetCharges));
    UnitAbilityAddChargeUsed(libMapM_gv_mMCannonballsGhostShip, "GhostShipBombardChargedStarboard", "Abil/BattleshipBombardCharged", (lv_currentCharges - lv_targetCharges));
    libMapM_gv_mMCannonballsGhostShipTotalAmmo = lv_targetCharges;
    Wait(3.0, c_timeGame);
    while (true) {
        if (((libGame_gv_gameOver == true) || (UnitIsAlive(libMapM_gv_mMCannonballsGhostShip) == false) || (libMapM_gf_MMCannonballsBattleshipAmmoLeft() <= 0))) {
            return true;
        }
        else {
        }
        while ((lv_shotsLeftInBarrage > 0)) {
            lv_target = libMapM_gf_MMCannonballsBattleshipNextTarget();
            lv_needNewTarget = false;
            if ((libGame_gf_TownGetTownStructurePresetFromUnitID(UnitGetType(lv_target)) == 1) && (UnitBehaviorCount(lv_target, "BattleshipBombardTarget") >= 1)) {
                lv_shotsLeftInBarrage = 0;
            }
            else {
            }
            if ((lv_shotsLeftInBarrage > 0)) {
                if ((libMapM_gv_mMCannonballsGhostShipShooting == false)) {
                    lv_expectedFacingAngle1 = libCore_gf_StandalizedAngle((AngleBetweenPoints(UnitGetPosition(libMapM_gv_mMCannonballsGhostShip), UnitGetPosition(lv_target)) - 90.0));
                    if ((lv_expectedFacingAngle1 <= lv_preferedFacingMax) && (lv_expectedFacingAngle1 >= lv_preferedFacingMin)) {
                        lv_expectedFacingAngle = lv_expectedFacingAngle1;
                    }
                    else {
                        lv_expectedFacingAngle2 = libCore_gf_StandalizedAngle((AngleBetweenPoints(UnitGetPosition(libMapM_gv_mMCannonballsGhostShip), UnitGetPosition(lv_target)) + 90.0));
                        if ((lv_expectedFacingAngle2 <= lv_preferedFacingMax) && (lv_expectedFacingAngle2 >= lv_preferedFacingMin)) {
                            lv_expectedFacingAngle = lv_expectedFacingAngle2;
                        }
                        else {
                            lv_angleDiff1 = libCore_gf_StandalizedAngleDifference(lv_expectedFacingAngle1, lv_preferedFacing);
                            lv_angleDiff2 = libCore_gf_StandalizedAngleDifference(lv_expectedFacingAngle2, lv_preferedFacing);
                            if ((lv_angleDiff1 < lv_angleDiff2)) {
                                lv_expectedFacingAngle = lv_expectedFacingAngle1;
                            }
                            else {
                                lv_expectedFacingAngle = lv_expectedFacingAngle2;
                            }
                            if ((lv_expectedFacingAngle > lv_preferedFacingMax)) {
                                lv_expectedFacingAngle = lv_preferedFacingMax;
                            }
                            else {
                                lv_expectedFacingAngle = lv_preferedFacingMin;
                            }
                        }
                    }
                    lv_angleDiff = libCore_gf_StandalizedAngleDifference(lv_expectedFacingAngle, UnitGetFacing(libMapM_gv_mMCannonballsGhostShip));
                    if ((lv_angleDiff >= 15.0)) {
                        UnitIssueOrder(libMapM_gv_mMCannonballsGhostShip, OrderTargetingPoint(AbilityCommand("move", 4), PointWithOffsetPolar(UnitGetPosition(libMapM_gv_mMCannonballsGhostShip), 5.0, lv_expectedFacingAngle)), c_orderQueueReplace);
                        while (true) {
                            if ((UnitTestState(libMapM_gv_mMCannonballsGhostShip, c_unitStateIdle) == true)) {
                                break;
                            }
                            else {
                            }
                            Wait(0.125, c_timeGame);
                        }
                    }
                    else {
                    }
                }
                else {
                }
            }
            else {
            }
            while ((lv_needNewTarget == false) && (lv_shotsLeftInBarrage > 0)) {
                libMapM_gf_MMCannonballsBattleshipShooting(lv_target);
                lv_shotsLeftInBarrage -= 1;
                if ((UnitGetPropertyFixed(lv_target, c_unitPropLife, c_unitPropCurrent) <= (StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "BattleshipBombardDamage", "Amount", 0)) * IntToFixed((libMapM_gv_mMShotsPerBarrage_C - lv_shotsLeftInBarrage))))) {
                    lv_needNewTarget = true;
                }
                else {
                }
                Wait(0.75, c_timeGame);
            }
        }
        while (!((libMapM_gv_mMCannonballsGhostShipShooting == false))) {
            Wait(0.125, c_timeGame);
        }
        if ((libMapM_gf_MMCannonballsBattleshipAmmoLeft() >= 3)) {
            lv_shotsLeftInBarrage = 3;
        }
        else {
            lv_shotsLeftInBarrage = libMapM_gf_MMCannonballsBattleshipAmmoLeft();
        }
        if ((libMapM_gf_MMCannonballsBattleshipAmmoLeft() <= 0)) {
            lv_nextTeam = lv_shipTeam;
            auto2EF5E28F_n = 2;
            for (auto2EF5E28F_i = 1; auto2EF5E28F_i <= auto2EF5E28F_n; auto2EF5E28F_i += 1) {
                if ((libMapM_gf_MMCannonballsTeamCannonballsCount(lv_nextTeam) >= libMapM_gf_MMCannonballsPirateShipCost(lv_nextTeam))) {
                    Wait(5.0, c_timeGame);
                    libMapM_gf_MMCannonballsGhostShipWakeUp(lv_nextTeam, true);
                    return true;
                }
                else {
                }
                lv_nextTeam = lv_enemyTeam;
            }
            Wait(2.0, c_timeGame);
            libMapM_gf_MMCannonballsTransmissionLeavingQ(PlayerGroupAll());
            Wait(2.0, c_timeGame);
            TriggerEnable(libMapM_gt_MMCannonballsBattleshipShootingMissileCreated, false);
            Wait(4.0, c_timeGame);
            UnitSetOwner(libMapM_gv_mMCannonballsGhostShip, libCore_gv_cOMPUTER_Neutral, true);
            UnitIssueOrder(libMapM_gv_mMCannonballsGhostShip, OrderTargetingPoint(AbilityCommand("move", 4), PointWithOffsetPolar(UnitGetPosition(libMapM_gv_mMCannonballsGhostShip), 5.0, lv_preferedFacing)), c_orderQueueReplace);
            UnitSetOwner(libMapM_gv_mMCannonballsGhostShipBeacon, libCore_gv_cOMPUTER_Neutral, true);
            libNtve_gf_ShowHideUnit(libMapM_gv_mMCannonballsGhostShipBeacon, true);
            libNtve_gf_ShowHideUnit(libMapM_gv_mMCannonballsGhostShipCaptain, true);
            libNtve_gf_SendActorMessageToGameRegion(libMapM_gv_mMCannonballsGhostShipPlayerDetectorRegion, "Signal LeaveShip");
            libMapM_gf_MMCannonballsSubmitReqIncrease(lv_shipTeam);
            TriggerExecute(libMapM_gt_MMCannonballsOpenChestUponRespawn, true, false);
            TriggerEnable(libMapM_gt_MMCannonballsDetectHero, true);
            libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_activeHumanPlayers, 0, 0, "GhostShipEventEnd", StringExternal("Param/Value/lib_MapM_04E192E8"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
            libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 0, 0, "GhostShipEventEnd", StringExternal("Param/Value/lib_MapM_2602F17D"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
            MinimapPing(PlayerGroupAll(), UnitGetPosition(libMapM_gv_mMCannonballsGhostShipBeacon), 4.0, Color(100.00, 100.00, 0.00));
            libGame_gf_SendEventDoubloonsGhostShipShootingEnd();
            TimerPause(libMapM_gv_mMCannonballsTreasureChestTimer, false);
            return true;
        }
        else {
        }
        Wait(6.0, c_timeGame);
    }
    return true;
}

int libMapM_gf_MMCannonballsBattleshipAmmoLeft () {
    // Implementation
    if ((UnitIsAlive(libMapM_gv_mMCannonballsGhostShip) == false)) {
        return 0;
    }
    else {
    }
    return FixedToInt(UnitAbilityChargeInfo(libMapM_gv_mMCannonballsGhostShip, AbilityCommand("GhostShipBombardChargedPort", 0), c_unitAbilChargeCountLeft));
}

unit libMapM_gf_MMCannonballsBattleshipNextTarget () {
    unitgroup auto5925C3B5_g;
    int auto5925C3B5_u;

    // Variable Declarations
    int lv_nextTownIndex;
    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;
    unit lv_target;

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

    // Implementation
    if ((UnitGetOwner(libMapM_gv_mMCannonballsGhostShip) == 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);
    if ((libMapM_gv_mMCannonballsGhostShipTargetTownIndex[lv_enemyTeam] > 0)) {
        lv_town = libMapM_gv_mMCannonballsGhostShipTargetTownOrders[lv_enemyTeam][libMapM_gv_mMCannonballsGhostShipTargetTownIndex[lv_enemyTeam]];
        if ((libMapM_gf_MMCannonballsTownAlive(lv_town, lv_enemyPlayer) == true)) {
            lv_nextTownIndex = libMapM_gv_mMCannonballsGhostShipTargetTownIndex[lv_enemyTeam];
        }
        else {
        }
    }
    else {
    }
    if ((lv_nextTownIndex <= 0)) {
        while (true) {
            if ((libMapM_gv_mMCannonballsGhostShipTargetTownIndex[lv_enemyTeam] >= libMapM_gv_mMCannonballsGhostShipTargetTownOrdersCount[lv_enemyTeam])) {
                break;
            }
            else {
            }
            libMapM_gv_mMCannonballsGhostShipTargetTownIndex[lv_enemyTeam] += 1;
            lv_town = libMapM_gv_mMCannonballsGhostShipTargetTownOrders[lv_enemyTeam][libMapM_gv_mMCannonballsGhostShipTargetTownIndex[lv_enemyTeam]];
            if ((libMapM_gf_MMCannonballsTownAlive(lv_town, lv_enemyPlayer) == true)) {
                lv_nextTownIndex = libMapM_gv_mMCannonballsGhostShipTargetTownIndex[lv_enemyTeam];
                break;
            }
            else {
            }
        }
    }
    else {
    }
    if ((lv_nextTownIndex <= 0)) {
        if ((UnitIsAlive(lv_enemyCore) == true)) {
            return lv_enemyCore;
        }
        else {
            return null;
        }
    }
    else {
    }
    lv_town = libMapM_gv_mMCannonballsGhostShipTargetTownOrders[lv_enemyTeam][lv_nextTownIndex];
    lv_buildings = UnitGroup(null, lv_enemyPlayer, libGame_gv_townTownData[lv_town].lv_townRegion, UnitFilter((1 << c_targetFilterStructure), 0, (1 << c_targetFilterPsionic) | (1 << c_targetFilterMissile), (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)) {
        return null;
    }
    else {
    }
    auto5925C3B5_g = lv_buildings;
    auto5925C3B5_u = 1;
    for ( ; auto5925C3B5_u <= UnitGroupCount(auto5925C3B5_g, c_unitCountAll) ; auto5925C3B5_u += BoolToInt(lv_itBuilding == UnitGroupUnit(auto5925C3B5_g, auto5925C3B5_u)) ) {
        lv_itBuilding = UnitGroupUnit(auto5925C3B5_g, auto5925C3B5_u);
        if ((DistanceBetweenPoints(UnitGetPosition(lv_itBuilding), UnitGetPosition(lv_townHall)) > 10.0) && (UnitBehaviorCount(lv_itBuilding, "BattleshipBombardTarget") <= 0)) {
            UnitGroupAdd(lv_townOuterLoop, lv_itBuilding);
        }
        else {
            if ((lv_itBuilding != lv_townHall) && (UnitBehaviorCount(lv_itBuilding, "BattleshipBombardTarget") <= 0)) {
                UnitGroupAdd(lv_townInnerLoop, lv_itBuilding);
            }
            else {
            }
        }
    }
    if ((libNtve_gf_UnitGroupIsDead(lv_townOuterLoop) == false)) {
        return UnitGroupRandomUnit(lv_townOuterLoop, c_unitCountAlive);
    }
    else {
    }
    if ((libNtve_gf_UnitGroupIsDead(lv_townInnerLoop) == false)) {
        return UnitGroupRandomUnit(lv_townInnerLoop, c_unitCountAlive);
    }
    else {
    }
    return lv_townHall;
}

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

    // Variable Initialization
    lv_buildings = UnitGroupEmpty();

    // Implementation
    lv_buildings = UnitGroup(null, lp_player, libGame_gv_townTownData[lp_town].lv_townRegion, UnitFilter((1 << c_targetFilterStructure), 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    lv_townhall = libGame_gv_townTownData[lp_town].lv_structureUnits[libGame_gv_townTownData[lp_town].lv_townHallIndex];
    return UnitIsAlive(lv_townhall);
}

trigger auto_libMapM_gf_MMCannonballsBattleshipShooting_Trigger = null;
unit auto_libMapM_gf_MMCannonballsBattleshipShooting_lp_target;

void libMapM_gf_MMCannonballsBattleshipShooting (unit lp_target) {
    auto_libMapM_gf_MMCannonballsBattleshipShooting_lp_target = lp_target;

    if (auto_libMapM_gf_MMCannonballsBattleshipShooting_Trigger == null) {
        auto_libMapM_gf_MMCannonballsBattleshipShooting_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsBattleshipShooting_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsBattleshipShooting_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsBattleshipShooting_TriggerFunc (bool testConds, bool runActions) {
    unit lp_target = auto_libMapM_gf_MMCannonballsBattleshipShooting_lp_target;

    // Variable Declarations
    unit lv_missile;
    int lv_pingTarget;
    int lv_pingBall;
    int lv_pingTrail;
    int lv_localOrderWaitingIndex;
    int lv_localMissionWaitingIndex;

    // Variable Initialization
    lv_pingTarget = c_invalidPingId;
    lv_pingBall = c_invalidPingId;
    lv_pingTrail = c_invalidPingId;

    // Implementation
    if (((UnitIsAlive(libMapM_gv_mMCannonballsGhostShip) == false) || (UnitIsAlive(lp_target) == false))) {
        return true;
    }
    else {
    }
    libMapM_gf_MMCannonballsTransmissionFiringQ(PlayerGroupAll());
    libMapM_gv_mMCannonballsGhostShipMissile = null;
    TriggerEnable(libMapM_gt_MMCannonballsBattleshipShootingMissileCreated, true);
    if ((libMapM_gv_mMCannonballsGhostShipMissileTargetPing == c_invalidPingId)) {
        libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "StormPingGhostShipImpact", UnitGetPosition(lp_target), ColorWithAlpha(100.00, 0.00, 0.00, 0.00), 3.0, 270.0);
        libMapM_gv_mMCannonballsGhostShipMissileTargetPing = PingLastCreated();
    }
    else {
    }
    while (!((libMapM_gv_mMCannonballsGhostShipShooting == false))) {
        Wait(0.125, c_timeGame);
    }
    libMapM_gv_mMCannonballsGhostShipShooting = true;
    if ((PointGetY(UnitGetPosition(libMapM_gv_mMCannonballsGhostShip)) <= PointGetY(UnitGetPosition(lp_target)))) {
        UnitIssueOrder(libMapM_gv_mMCannonballsGhostShip, OrderTargetingUnit(AbilityCommand("GhostShipBombardChargedPort", 0), lp_target), c_orderQueueReplace);
        UnitAbilityAddChargeUsed(libMapM_gv_mMCannonballsGhostShip, "GhostShipBombardChargedStarboard", "Abil/BattleshipBombardCharged", 1.0);
    }
    else {
        UnitIssueOrder(libMapM_gv_mMCannonballsGhostShip, OrderTargetingUnit(AbilityCommand("GhostShipBombardChargedStarboard", 0), lp_target), c_orderQueueReplace);
        UnitAbilityAddChargeUsed(libMapM_gv_mMCannonballsGhostShip, "GhostShipBombardChargedPort", "Abil/BattleshipBombardCharged", 1.0);
    }
    Wait(0.75, c_timeGame);
    libMapM_gv_mMCannonballsGhostShipShooting = false;
    Wait(1.25, c_timeGame);
    SoundPlayForPlayer(SoundLink("Event_GhostShip_Cannon_Fire_Distant", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);
    Wait(2.0, c_timeGame);
    libMapM_gv_mMCannonballsGhostShipMissileTargetPing = c_invalidPingId;
    return true;
}

void libMapM_gf_MMCannonballsBattleshipShootingShakingCamera (point lp_targetLocation) {
    int auto3CB61D97_ae;
    int auto3CB61D97_ai;

    // Variable Declarations
    int lv_itPlayer;

    // Variable Initialization

    // Implementation
    auto3CB61D97_ae = libCore_gv_bALMaxPlayers;
    auto3CB61D97_ai = 1;
    lv_itPlayer = 1;
    for ( ; ( (auto3CB61D97_ai >= 0 && lv_itPlayer <= auto3CB61D97_ae) || (auto3CB61D97_ai <= 0 && lv_itPlayer >= auto3CB61D97_ae) ) ; lv_itPlayer += auto3CB61D97_ai ) {
        if ((PlayerStatus(lv_itPlayer) != c_playerStatusActive)) {
            continue;
        }
        else {
        }
        if ((DistanceBetweenPoints(CameraGetTarget(lv_itPlayer), lp_targetLocation) <= 15.0)) {
            CameraShake(lv_itPlayer, "Medium", "Earthquake", 0.0, 0.5, 0.75);
        }
        else if ((DistanceBetweenPoints(CameraGetTarget(lv_itPlayer), lp_targetLocation) <= 30.0)) {
            CameraShake(lv_itPlayer, "Light", "Earthquake", 0.0, 0.5, 0.5);
        }
    }
}

text libMapM_gf_MMCannonballsTreasureSetTextTagHelp () {
    // Implementation
    return TextExpressionAssemble("Param/Expression/lib_MapM_8E09AF21");
}

text libMapM_gf_MMCannonballsTreasureSetTextTagDoubloonCount (int lp_coins) {
    // Implementation
    TextExpressionSetToken("Param/Expression/lib_MapM_21B22EFB", "A", IntToText(lp_coins));
    return TextExpressionAssemble("Param/Expression/lib_MapM_21B22EFB");
}

void libMapM_gf_MMCannonballsTreasureTheFirstTimer () {
    // Implementation
    TimerStart(libMapM_gv_mMCannonballsTreasureChestTimer, libMapM_gv_mMCannonballsTreasureChestFirstTimerDur_C, false, c_timeGame);
}

void libMapM_gf_MMCannonballsTreasureStartTimer () {
    // Implementation
    TimerStart(libMapM_gv_mMCannonballsTreasureChestTimer, RandomFixed(libMapM_gv_mMCannonballsTreasureChestTimerMin_C, libMapM_gv_mMCannonballsTreasureChestTimerMax_C), false, c_timeGame);
}

trigger auto_libMapM_gf_MMCannonballsTransmissionSpawningQ_Trigger = null;
playergroup auto_libMapM_gf_MMCannonballsTransmissionSpawningQ_lp_players;

void libMapM_gf_MMCannonballsTransmissionSpawningQ (playergroup lp_players) {
    auto_libMapM_gf_MMCannonballsTransmissionSpawningQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMCannonballsTransmissionSpawningQ_Trigger == null) {
        auto_libMapM_gf_MMCannonballsTransmissionSpawningQ_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsTransmissionSpawningQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsTransmissionSpawningQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsTransmissionSpawningQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMCannonballsTransmissionSpawningQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    // Transmission - SoundLink("Raven_TributeSpawn", -1)
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("CreepVO_GhostShip_110", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMCannonballsTransmissionSummonedQ_Trigger = null;
playergroup auto_libMapM_gf_MMCannonballsTransmissionSummonedQ_lp_players;

void libMapM_gf_MMCannonballsTransmissionSummonedQ (playergroup lp_players) {
    auto_libMapM_gf_MMCannonballsTransmissionSummonedQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMCannonballsTransmissionSummonedQ_Trigger == null) {
        auto_libMapM_gf_MMCannonballsTransmissionSummonedQ_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsTransmissionSummonedQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsTransmissionSummonedQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsTransmissionSummonedQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMCannonballsTransmissionSummonedQ_lp_players;

    // Implementation
    libMapM_gv_mMCannonballsTrasmissionPlaying = true;
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GhostShip_Spawn", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    libMapM_gv_mMCannonballsTrasmissionPlaying = false;
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMCannonballsTransmissionSummonedObserversQ_Trigger = null;
playergroup auto_libMapM_gf_MMCannonballsTransmissionSummonedObserversQ_lp_players;

void libMapM_gf_MMCannonballsTransmissionSummonedObserversQ (playergroup lp_players) {
    auto_libMapM_gf_MMCannonballsTransmissionSummonedObserversQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMCannonballsTransmissionSummonedObserversQ_Trigger == null) {
        auto_libMapM_gf_MMCannonballsTransmissionSummonedObserversQ_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsTransmissionSummonedObserversQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsTransmissionSummonedObserversQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsTransmissionSummonedObserversQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMCannonballsTransmissionSummonedObserversQ_lp_players;

    // Implementation
    libMapM_gv_mMCannonballsTrasmissionPlaying = true;
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GhostShip_AttackObserver", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    libMapM_gv_mMCannonballsTrasmissionPlaying = false;
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMCannonballsTransmissionSummonedForEnemyQ_Trigger = null;
playergroup auto_libMapM_gf_MMCannonballsTransmissionSummonedForEnemyQ_lp_players;

void libMapM_gf_MMCannonballsTransmissionSummonedForEnemyQ (playergroup lp_players) {
    auto_libMapM_gf_MMCannonballsTransmissionSummonedForEnemyQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMCannonballsTransmissionSummonedForEnemyQ_Trigger == null) {
        auto_libMapM_gf_MMCannonballsTransmissionSummonedForEnemyQ_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsTransmissionSummonedForEnemyQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsTransmissionSummonedForEnemyQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsTransmissionSummonedForEnemyQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMCannonballsTransmissionSummonedForEnemyQ_lp_players;

    // Implementation
    libMapM_gv_mMCannonballsTrasmissionPlaying = true;
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GhostShip_Enemy", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    libMapM_gv_mMCannonballsTrasmissionPlaying = false;
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueAAQ_Trigger = null;
playergroup auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueAAQ_lp_players;

void libMapM_gf_MMCannonballsTransmissionSummonedContinueAAQ (playergroup lp_players) {
    auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueAAQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueAAQ_Trigger == null) {
        auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueAAQ_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueAAQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueAAQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueAAQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueAAQ_lp_players;

    // Implementation
    libMapM_gv_mMCannonballsTrasmissionPlaying = true;
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GhostShip_AA", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    libMapM_gv_mMCannonballsTrasmissionPlaying = false;
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueABQ_Trigger = null;
playergroup auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueABQ_lp_players;

void libMapM_gf_MMCannonballsTransmissionSummonedContinueABQ (playergroup lp_players) {
    auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueABQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueABQ_Trigger == null) {
        auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueABQ_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueABQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueABQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueABQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueABQ_lp_players;

    // Implementation
    libMapM_gv_mMCannonballsTrasmissionPlaying = true;
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GhostShip_AB", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    libMapM_gv_mMCannonballsTrasmissionPlaying = false;
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBAQ_Trigger = null;
playergroup auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBAQ_lp_players;

void libMapM_gf_MMCannonballsTransmissionSummonedContinueBAQ (playergroup lp_players) {
    auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBAQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBAQ_Trigger == null) {
        auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBAQ_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBAQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBAQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBAQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBAQ_lp_players;

    // Implementation
    libMapM_gv_mMCannonballsTrasmissionPlaying = true;
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GhostShip_BA", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    libMapM_gv_mMCannonballsTrasmissionPlaying = false;
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBBQ_Trigger = null;
playergroup auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBBQ_lp_players;

void libMapM_gf_MMCannonballsTransmissionSummonedContinueBBQ (playergroup lp_players) {
    auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBBQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBBQ_Trigger == null) {
        auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBBQ_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBBQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBBQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBBQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMCannonballsTransmissionSummonedContinueBBQ_lp_players;

    // Implementation
    libMapM_gv_mMCannonballsTrasmissionPlaying = true;
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GhostShip_BB", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    libMapM_gv_mMCannonballsTrasmissionPlaying = false;
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMCannonballsTransmissionFiringQ_Trigger = null;
playergroup auto_libMapM_gf_MMCannonballsTransmissionFiringQ_lp_players;

void libMapM_gf_MMCannonballsTransmissionFiringQ (playergroup lp_players) {
    auto_libMapM_gf_MMCannonballsTransmissionFiringQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMCannonballsTransmissionFiringQ_Trigger == null) {
        auto_libMapM_gf_MMCannonballsTransmissionFiringQ_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsTransmissionFiringQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsTransmissionFiringQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsTransmissionFiringQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMCannonballsTransmissionFiringQ_lp_players;

    // Implementation
    libMapM_gv_mMCannonballsTransmissionFiringIndex += 1;
    if ((libMapM_gv_mMCannonballsTransmissionFiringIndex != libMapM_gv_mMCannonballsTransmissionFiringRandomness)) {
        return true;
    }
    else {
    }
    if ((libMapM_gv_mMCannonballsTrasmissionPlaying == true)) {
        return true;
    }
    else {
    }
    libMapM_gv_mMCannonballsTrasmissionPlaying = true;
    TriggerQueueEnter();
    // Transmission - SoundLink("Raven_EnemyCursed", -1)
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GhostShip_Attack", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    libMapM_gv_mMCannonballsTrasmissionPlaying = false;
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMCannonballsTransmissionLeavingQ_Trigger = null;
playergroup auto_libMapM_gf_MMCannonballsTransmissionLeavingQ_lp_players;

void libMapM_gf_MMCannonballsTransmissionLeavingQ (playergroup lp_players) {
    auto_libMapM_gf_MMCannonballsTransmissionLeavingQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMCannonballsTransmissionLeavingQ_Trigger == null) {
        auto_libMapM_gf_MMCannonballsTransmissionLeavingQ_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsTransmissionLeavingQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsTransmissionLeavingQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsTransmissionLeavingQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMCannonballsTransmissionLeavingQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    // Transmission - SoundLink("Raven_TributeSpawn", -1)
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GhostShip_Despawn", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMCannonballsTransmissionChestSpawningQ_Trigger = null;
playergroup auto_libMapM_gf_MMCannonballsTransmissionChestSpawningQ_lp_players;

void libMapM_gf_MMCannonballsTransmissionChestSpawningQ (playergroup lp_players) {
    auto_libMapM_gf_MMCannonballsTransmissionChestSpawningQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMCannonballsTransmissionChestSpawningQ_Trigger == null) {
        auto_libMapM_gf_MMCannonballsTransmissionChestSpawningQ_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsTransmissionChestSpawningQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsTransmissionChestSpawningQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsTransmissionChestSpawningQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMCannonballsTransmissionChestSpawningQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    // Transmission - SoundLink("Treasure2Spawn", -1)
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("Treasure2Spawn", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMCannonballsTransmissionChestSpawningFirstTimeQ_Trigger = null;
playergroup auto_libMapM_gf_MMCannonballsTransmissionChestSpawningFirstTimeQ_lp_players;

void libMapM_gf_MMCannonballsTransmissionChestSpawningFirstTimeQ (playergroup lp_players) {
    auto_libMapM_gf_MMCannonballsTransmissionChestSpawningFirstTimeQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMCannonballsTransmissionChestSpawningFirstTimeQ_Trigger == null) {
        auto_libMapM_gf_MMCannonballsTransmissionChestSpawningFirstTimeQ_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsTransmissionChestSpawningFirstTimeQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsTransmissionChestSpawningFirstTimeQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsTransmissionChestSpawningFirstTimeQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMCannonballsTransmissionChestSpawningFirstTimeQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    // Transmission - SoundLink("Raven_TributeSpawn", -1)
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("CreepVO_GhostShip_234", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMCannonballsTransmissionChestDespawnedQ_Trigger = null;
playergroup auto_libMapM_gf_MMCannonballsTransmissionChestDespawnedQ_lp_players;

void libMapM_gf_MMCannonballsTransmissionChestDespawnedQ (playergroup lp_players) {
    auto_libMapM_gf_MMCannonballsTransmissionChestDespawnedQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMCannonballsTransmissionChestDespawnedQ_Trigger == null) {
        auto_libMapM_gf_MMCannonballsTransmissionChestDespawnedQ_Trigger = TriggerCreate("auto_libMapM_gf_MMCannonballsTransmissionChestDespawnedQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMCannonballsTransmissionChestDespawnedQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMCannonballsTransmissionChestDespawnedQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMCannonballsTransmissionChestDespawnedQ_lp_players;

    // Deprecated
    TriggerQueueEnter();
    // Transmission - SoundLink("Raven_TributeSpawn", -1)
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("TreasureKilled", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMGardensDragonInitTowers_Trigger = null;
unit auto_libMapM_gf_MMGardensDragonInitTowers_lp_towerMoon;
unit auto_libMapM_gf_MMGardensDragonInitTowers_lp_towerStar;

void libMapM_gf_MMGardensDragonInitTowers (unit lp_towerMoon, unit lp_towerStar) {
    auto_libMapM_gf_MMGardensDragonInitTowers_lp_towerMoon = lp_towerMoon;
    auto_libMapM_gf_MMGardensDragonInitTowers_lp_towerStar = lp_towerStar;

    if (auto_libMapM_gf_MMGardensDragonInitTowers_Trigger == null) {
        auto_libMapM_gf_MMGardensDragonInitTowers_Trigger = TriggerCreate("auto_libMapM_gf_MMGardensDragonInitTowers_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMGardensDragonInitTowers_Trigger, false, false);
}

bool auto_libMapM_gf_MMGardensDragonInitTowers_TriggerFunc (bool testConds, bool runActions) {
    unit lp_towerMoon = auto_libMapM_gf_MMGardensDragonInitTowers_lp_towerMoon;
    unit lp_towerStar = auto_libMapM_gf_MMGardensDragonInitTowers_lp_towerStar;

    unitgroup auto8A56646F_g;
    int auto8A56646F_u;
    playergroup autoAFCA884A_g;
    int autoAFCA884A_p;
    unitgroup auto254889A9_g;
    int auto254889A9_u;
    unitgroup auto4ED31F5E_g;
    int auto4ED31F5E_u;
    playergroup auto3D9EC4D4_g;
    int auto3D9EC4D4_p;
    unitgroup autoC3C6CAFA_g;
    int autoC3C6CAFA_u;
    playergroup autoAB2D3B75_g;
    int autoAB2D3B75_p;

    // Variable Declarations
    unit lv_u;
    unit lv_utarget;
    int lv_player;
    fixed lv_beam_fulldistance;
    fixed lv_beam_count;
    int lv_itPlayer;

    // Variable Initialization

    // Implementation
    libMapM_gv_mMGardensDragonTowerMoon = lp_towerMoon;
    libMapM_gv_mMGardensDragonTowerStar = lp_towerStar;
    UnitGroupLoopBegin(UnitGroup("VehicleDragon", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
        libMapM_gv_mMGardensDragonDragonKnightRespawnPoint = UnitGetPosition(UnitGroupLoopCurrent());
        libMapM_gv_mMGardensDragonStatue = UnitGroupLoopCurrent();
        UnitSetState(libMapM_gv_mMGardensDragonStatue, c_unitStateStatusBar, false);
    }
    UnitGroupLoopEnd();
    auto8A56646F_g = UnitGroup("DragonShireShrineSun", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    auto8A56646F_u = 1;
    for ( ; auto8A56646F_u <= UnitGroupCount(auto8A56646F_g, c_unitCountAll) ; auto8A56646F_u += BoolToInt(lv_u == UnitGroupUnit(auto8A56646F_g, auto8A56646F_u)) ) {
        lv_u = UnitGroupUnit(auto8A56646F_g, auto8A56646F_u);
        libMapM_gv_mMGardensDragonDragonTowerCount += 1;
        libMapM_gv_mMGardensDragonDragonTowers[libMapM_gv_mMGardensDragonDragonTowerCount].lv_shrineUnit = lv_u;
        libNtve_gf_CreateUnitsWithDefaultFacing(1, "DragonballCaptureBeacon", c_unitCreateIgnorePlacement, UnitGetOwner(lv_u), UnitGetPosition(lv_u));
        libGame_gf_CapturePointCreate(UnitLastCreated(), libMapM_gv_mMGardensDragonDragonballTowerCaptureRadius_C, libMapM_gv_mMGardensDragonDragonTowerCaptureTime_C, libMapM_gv_mMGardensDragonDragonTowerOverCaptureTime_C, true, true);
        libMapM_gv_mMGardensDragonDragonTowers[libMapM_gv_mMGardensDragonDragonTowerCount].lv_captureBeaconIndex = libGame_gf_LastCreatedCapturePoint();
        libGame_gf_CapturePointDisable(libMapM_gv_mMGardensDragonDragonTowers[libMapM_gv_mMGardensDragonDragonTowerCount].lv_captureBeaconIndex);
        autoAFCA884A_g = PlayerGroupAll(); 
        autoAFCA884A_p = 1;
        for ( ; autoAFCA884A_p <= PlayerGroupCount(autoAFCA884A_g) ; autoAFCA884A_p += BoolToInt(lv_player == PlayerGroupPlayer(autoAFCA884A_g, autoAFCA884A_p)) ) {
            lv_player = PlayerGroupPlayer(autoAFCA884A_g, autoAFCA884A_p);
            VisRevealArea(lv_player, RegionCircle(UnitGetPosition(lv_u), 0.75), 0.125, false);
        }
        auto254889A9_g = UnitGroup("GardensDragonShrineTargetSun", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
        auto254889A9_u = 1;
        for ( ; auto254889A9_u <= UnitGroupCount(auto254889A9_g, c_unitCountAll) ; auto254889A9_u += BoolToInt(lv_utarget == UnitGroupUnit(auto254889A9_g, auto254889A9_u)) ) {
            lv_utarget = UnitGroupUnit(auto254889A9_g, auto254889A9_u);
            libMapM_gv_mMGardensDragonDragonTowers[libMapM_gv_mMGardensDragonDragonTowerCount].lv_shrineBeamTargetUnit = lv_utarget;
        }
        libMapM_gv_mMGardensDragonSoundRegion = RegionCircle(UnitGetPosition(lv_u), 1.0);
        lv_beam_count = 0.0;
        lv_beam_fulldistance = DistanceBetweenPoints(UnitGetPosition(lv_u), UnitGetPosition(lv_utarget));
        while ((lv_beam_count < lv_beam_fulldistance)) {
            lv_beam_count += 1.0;
            RegionAddCircle(libMapM_gv_mMGardensDragonSoundRegion, true, libNtve_gf_PointOffsetTowardsPoint(UnitGetPosition(lv_u), lv_beam_count, UnitGetPosition(lv_utarget)), 1.0);
        }
    }
    auto4ED31F5E_g = UnitGroup("DragonShireShrineMoon", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    auto4ED31F5E_u = 1;
    for ( ; auto4ED31F5E_u <= UnitGroupCount(auto4ED31F5E_g, c_unitCountAll) ; auto4ED31F5E_u += BoolToInt(lv_u == UnitGroupUnit(auto4ED31F5E_g, auto4ED31F5E_u)) ) {
        lv_u = UnitGroupUnit(auto4ED31F5E_g, auto4ED31F5E_u);
        libMapM_gv_mMGardensDragonDragonTowerCount += 1;
        libMapM_gv_mMGardensDragonDragonTowers[libMapM_gv_mMGardensDragonDragonTowerCount].lv_shrineUnit = lv_u;
        libNtve_gf_CreateUnitsWithDefaultFacing(1, "DragonballCaptureBeacon", c_unitCreateIgnorePlacement, UnitGetOwner(lv_u), UnitGetPosition(lv_u));
        libGame_gf_CapturePointCreate(UnitLastCreated(), libMapM_gv_mMGardensDragonDragonballTowerCaptureRadius_C, libMapM_gv_mMGardensDragonDragonTowerCaptureTime_C, libMapM_gv_mMGardensDragonDragonTowerOverCaptureTime_C, true, true);
        libMapM_gv_mMGardensDragonDragonTowers[libMapM_gv_mMGardensDragonDragonTowerCount].lv_captureBeaconIndex = libGame_gf_LastCreatedCapturePoint();
        libGame_gf_CapturePointDisable(libMapM_gv_mMGardensDragonDragonTowers[libMapM_gv_mMGardensDragonDragonTowerCount].lv_captureBeaconIndex);
        auto3D9EC4D4_g = PlayerGroupAll(); 
        auto3D9EC4D4_p = 1;
        for ( ; auto3D9EC4D4_p <= PlayerGroupCount(auto3D9EC4D4_g) ; auto3D9EC4D4_p += BoolToInt(lv_player == PlayerGroupPlayer(auto3D9EC4D4_g, auto3D9EC4D4_p)) ) {
            lv_player = PlayerGroupPlayer(auto3D9EC4D4_g, auto3D9EC4D4_p);
            VisRevealArea(lv_player, RegionCircle(UnitGetPosition(lv_u), 0.75), 0.125, false);
        }
        autoC3C6CAFA_g = UnitGroup("GardensDragonShrineTargetMoon", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
        autoC3C6CAFA_u = 1;
        for ( ; autoC3C6CAFA_u <= UnitGroupCount(autoC3C6CAFA_g, c_unitCountAll) ; autoC3C6CAFA_u += BoolToInt(lv_utarget == UnitGroupUnit(autoC3C6CAFA_g, autoC3C6CAFA_u)) ) {
            lv_utarget = UnitGroupUnit(autoC3C6CAFA_g, autoC3C6CAFA_u);
            libMapM_gv_mMGardensDragonDragonTowers[libMapM_gv_mMGardensDragonDragonTowerCount].lv_shrineBeamTargetUnit = lv_utarget;
        }
        lv_beam_count = 0.0;
        lv_beam_fulldistance = DistanceBetweenPoints(UnitGetPosition(lv_u), UnitGetPosition(lv_utarget));
        while ((lv_beam_count < lv_beam_fulldistance)) {
            lv_beam_count += 1.0;
            RegionAddCircle(libMapM_gv_mMGardensDragonSoundRegion, true, libNtve_gf_PointOffsetTowardsPoint(UnitGetPosition(lv_u), lv_beam_count, UnitGetPosition(lv_utarget)), 1.0);
        }
    }
    autoAB2D3B75_g = PlayerGroupAll(); 
    autoAB2D3B75_p = 1;
    for ( ; autoAB2D3B75_p <= PlayerGroupCount(autoAB2D3B75_g) ; autoAB2D3B75_p += BoolToInt(lv_itPlayer == PlayerGroupPlayer(autoAB2D3B75_g, autoAB2D3B75_p)) ) {
        lv_itPlayer = PlayerGroupPlayer(autoAB2D3B75_g, autoAB2D3B75_p);
        if ((StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "UseVehiclePersistent", "PeriodicPeriodArray[" + IntToString(0) + "]", 0)) == 0.0)) {
            TriggerDebugOutput(1, StringExternal("Param/Value/lib_MapM_8D3E1C40"), true);
        }
        else {
        }
        CatalogFieldValueSet(c_gameCatalogEffect, "UseVehiclePersistent", "PeriodCount", lv_itPlayer, IntToString(FixedToInt((libMapM_gv_mMGardensDragonDragonStatueChannelTime_C / StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "UseVehiclePersistent", "PeriodicPeriodArray[" + IntToString(0) + "]", 0))))));
    }
    return true;
}

void libMapM_gf_MMGardensDragonInit () {
    // Implementation
    TriggerEnable(libMapM_gt_MMGardensDragonDebugCheatStartObelisksso, true);
    TriggerEnable(libMapM_gt_MMGardensDragonGateOpen, true);
    TriggerEnable(libMapM_gt_MMGardensDragonWarningTimerExpires, true);
    TriggerEnable(libMapM_gt_MMGardensDragonWarningTimerStart, true);
    TriggerEnable(libMapM_gt_MMGardensDragonDragonEventStarts, true);
    TriggerEnable(libMapM_gt_MMGardensDragonDragonEventEnds, true);
    TriggerEnable(libMapM_gt_MMGardensDragonTransformChannelFinish, true);
}

int libMapM_gf_MMGardensDragonObeliskCountForTeam (int lp_team) {
    int auto99C48419_val;

    // Variable Declarations
    int lv_obeliskCount;
    int lv_player;

    // Variable Initialization

    // Implementation
    auto99C48419_val = lp_team;
    if (auto99C48419_val == 1) {
        lv_player = libCore_gv_cOMPUTER_TeamOrder;
    }
    else if (auto99C48419_val == 2) {
        lv_player = libCore_gv_cOMPUTER_TeamChaos;
    }
    else {
        return 0;
    }
    lv_obeliskCount = UnitGroupCount(UnitGroup("DragonShireShrineSun", lv_player, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), c_unitCountAlive);
    lv_obeliskCount += UnitGroupCount(UnitGroup("DragonShireShrineMoon", lv_player, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), c_unitCountAlive);
    return lv_obeliskCount;
}

trigger auto_libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership_Trigger = null;
int auto_libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership_lp_dragonballTowerIndex;
int auto_libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership_lp_newOwner;
playergroup auto_libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership_lp_capturingPlayers;

void libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership (int lp_dragonballTowerIndex, int lp_newOwner, playergroup lp_capturingPlayers) {
    auto_libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership_lp_dragonballTowerIndex = lp_dragonballTowerIndex;
    auto_libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership_lp_newOwner = lp_newOwner;
    auto_libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership_lp_capturingPlayers = lp_capturingPlayers;

    if (auto_libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership_Trigger == null) {
        auto_libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership_Trigger = TriggerCreate("auto_libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership_Trigger, false, false);
}

bool auto_libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership_TriggerFunc (bool testConds, bool runActions) {
    int lp_dragonballTowerIndex = auto_libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership_lp_dragonballTowerIndex;
    int lp_newOwner = auto_libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership_lp_newOwner;
    playergroup lp_capturingPlayers = auto_libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership_lp_capturingPlayers;

    playergroup autoAAB21751_g;
    int autoAAB21751_p;

    // Variable Declarations
    int lv_player;
    unitgroup lv_pillarUnits;
    int lv_iterPlayer;

    // Variable Initialization
    lv_pillarUnits = UnitGroupEmpty();

    // Implementation
    if ((lp_newOwner == libCore_gv_cOMPUTER_Neutral)) {
        libNtve_gf_SendActorMessageToUnit(libMapM_gv_mMGardensDragonDragonTowers[lp_dragonballTowerIndex].lv_shrineUnit, "AnimBracketStop Capture");
    }
    else {
        libNtve_gf_SendActorMessageToUnit(libMapM_gv_mMGardensDragonDragonTowers[lp_dragonballTowerIndex].lv_shrineUnit, "AnimBracketStart Capture Stand,Work,Start Stand,Work Stand,Work,End");
    }
    StatEventCreate("DragonTowerOwnerChange");
    StatEventAddDataInt(StatEventLastCreated(), "DragonTowerID", lp_dragonballTowerIndex);
    StatEventAddDataInt(StatEventLastCreated(), "Team", libGame_gf_TeamNumberOfPlayer(lp_newOwner));
    StatEventSend(StatEventLastCreated());
    UnitSetOwner(libMapM_gv_mMGardensDragonDragonTowers[lp_dragonballTowerIndex].lv_shrineUnit, lp_newOwner, true);
    libGame_gf_SendEventMapDragonShireObeliskOwnershipChange(lp_newOwner, libMapM_gv_mMGardensDragonDragonTowers[lp_dragonballTowerIndex].lv_shrineUnit, lp_capturingPlayers);
    ActorSend(libNtve_gf_MainActorofUnit(libMapM_gv_mMGardensDragonDragonTowers[lp_dragonballTowerIndex].lv_shrineUnit), "Signal ActiveSoundTog");
    TriggerExecute(libMapM_gt_MMGardensDragonDragonTowerCheckObeliskStatus, true, false);
    Wait(0.125, c_timeGame);
    autoAAB21751_g = PlayerGroupAll(); 
    autoAAB21751_p = 1;
    for ( ; autoAAB21751_p <= PlayerGroupCount(autoAAB21751_g) ; autoAAB21751_p += BoolToInt(lv_player == PlayerGroupPlayer(autoAAB21751_g, autoAAB21751_p)) ) {
        lv_player = PlayerGroupPlayer(autoAAB21751_g, autoAAB21751_p);
        VisRevealArea(lv_player, RegionCircle(UnitGetPosition(libMapM_gv_mMGardensDragonDragonTowers[lp_dragonballTowerIndex].lv_shrineUnit), 0.75), 0.125, false);
    }
    return true;
}

trigger auto_libMapM_gf_MMGardensDragonDeactivateStatue_Trigger = null;
int auto_libMapM_gf_MMGardensDragonDeactivateStatue_lp_team;

void libMapM_gf_MMGardensDragonDeactivateStatue (int lp_team) {
    auto_libMapM_gf_MMGardensDragonDeactivateStatue_lp_team = lp_team;

    if (auto_libMapM_gf_MMGardensDragonDeactivateStatue_Trigger == null) {
        auto_libMapM_gf_MMGardensDragonDeactivateStatue_Trigger = TriggerCreate("auto_libMapM_gf_MMGardensDragonDeactivateStatue_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMGardensDragonDeactivateStatue_Trigger, false, false);
}

bool auto_libMapM_gf_MMGardensDragonDeactivateStatue_TriggerFunc (bool testConds, bool runActions) {
    int lp_team = auto_libMapM_gf_MMGardensDragonDeactivateStatue_lp_team;

    playergroup autoA4D903F6_g;
    int autoA4D903F6_p;

    // Variable Declarations
    int lv_camp;
    int lv_scalingcamp;
    int lv_defender;
    int lv_p;

    // Variable Initialization

    // Implementation
    UnitSetOwner(libMapM_gv_mMGardensDragonStatue, 0, true);
    UnitGroupLoopBegin(UnitGroup("DragonShireShrineSun", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
        UnitIssueOrder(UnitGroupLoopCurrent(), Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
    }
    UnitGroupLoopEnd();
    UnitGroupLoopBegin(UnitGroup("DragonShireShrineMoon", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
        UnitIssueOrder(UnitGroupLoopCurrent(), Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
    }
    UnitGroupLoopEnd();
    ActorScopeSend(ActorScopeFromActor(libMapM_gv_mMGardensDragonSoundRegionActor), "Signal StopSound");
    ActorRegionCreate(null, "DragonBeamEndRegion", libMapM_gv_mMGardensDragonSoundRegion);
    UnitBehaviorRemove(libMapM_gv_mMGardensDragonStatue, "GenericVehicleBehaviorEmpty", 1);
    UnitBehaviorAdd(libMapM_gv_mMGardensDragonStatue, "DragonShrineDeactivated", libMapM_gv_mMGardensDragonStatue, 1);
    libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "StormPingWarning", UnitGetPosition(libMapM_gv_mMGardensDragonStatue), ColorWithAlpha(100.00, 0.00, 0.00, 0.00), 3.0, 270.0);
    TextTagShow(libMapM_gv_mMGardensDragonStatueTextTag, PlayerGroupAll(), true);
    autoA4D903F6_g = libCore_gv_activeHumanPlayers; 
    autoA4D903F6_p = 1;
    for ( ; autoA4D903F6_p <= PlayerGroupCount(autoA4D903F6_g) ; autoA4D903F6_p += BoolToInt(lv_p == PlayerGroupPlayer(autoA4D903F6_g, autoA4D903F6_p)) ) {
        lv_p = PlayerGroupPlayer(autoA4D903F6_g, autoA4D903F6_p);
        if ((libMapM_gv_mapMechanicUsedTracker[lv_p].lv_dragonStatue == true)) {
            TextTagShow(libMapM_gv_mMGardensDragonStatueTextTag, libCore_gv_playerGroupFromPlayer[lv_p], false);
        }
        else {
        }
    }
    TextTagShow(libMapM_gv_mMGardensDragonStatueTextTagAllyOwned, PlayerGroupAll(), false);
    TextTagShow(libMapM_gv_mMGardensDragonStatueTextTagEnemyOwned, PlayerGroupAll(), false);
    TimerPause(libMapM_gv_mMGardensDragonDragonStatueActiveReminderTimer, true);
    return true;
}

trigger auto_libMapM_gf_MMGardensDragonActivateStatueForTeam_Trigger = null;
int auto_libMapM_gf_MMGardensDragonActivateStatueForTeam_lp_team;

void libMapM_gf_MMGardensDragonActivateStatueForTeam (int lp_team) {
    auto_libMapM_gf_MMGardensDragonActivateStatueForTeam_lp_team = lp_team;

    if (auto_libMapM_gf_MMGardensDragonActivateStatueForTeam_Trigger == null) {
        auto_libMapM_gf_MMGardensDragonActivateStatueForTeam_Trigger = TriggerCreate("auto_libMapM_gf_MMGardensDragonActivateStatueForTeam_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMGardensDragonActivateStatueForTeam_Trigger, false, false);
}

bool auto_libMapM_gf_MMGardensDragonActivateStatueForTeam_TriggerFunc (bool testConds, bool runActions) {
    int lp_team = auto_libMapM_gf_MMGardensDragonActivateStatueForTeam_lp_team;

    int autoE85C092C_ae;
    int autoE85C092C_ai;
    playergroup autoA43C1C70_g;
    int autoA43C1C70_p;
    playergroup auto6728DB37_g;
    int auto6728DB37_p;

    // Variable Declarations
    int lv_camp;
    int lv_scalingcamp;
    int lv_defender;
    int lv_i;
    int lv_p;

    // Variable Initialization

    // Implementation
    UnitSetOwner(libMapM_gv_mMGardensDragonStatue, lp_team, true);
    autoE85C092C_ae = libMapM_gv_mMGardensDragonDragonTowerCount;
    autoE85C092C_ai = 1;
    lv_i = 1;
    for ( ; ( (autoE85C092C_ai >= 0 && lv_i <= autoE85C092C_ae) || (autoE85C092C_ai <= 0 && lv_i >= autoE85C092C_ae) ) ; lv_i += autoE85C092C_ai ) {
        UnitIssueOrder(libMapM_gv_mMGardensDragonDragonTowers[lv_i].lv_shrineUnit, OrderTargetingUnit(AbilityCommand("GardensObeliskActivate", 0), libMapM_gv_mMGardensDragonDragonTowers[lv_i].lv_shrineBeamTargetUnit), c_orderQueueReplace);
    }
    ActorRegionCreate(null, "DragonBeamStartRegion", libMapM_gv_mMGardensDragonSoundRegion);
    ActorRegionCreate(null, "DragonBeamLoopRegion", libMapM_gv_mMGardensDragonSoundRegion);
    libMapM_gv_mMGardensDragonSoundRegionActor = libNtve_gf_ActorLastCreated();
    UnitBehaviorAdd(libMapM_gv_mMGardensDragonStatue, "GenericVehicleBehaviorEmpty", libMapM_gv_mMGardensDragonStatue, 1);
    UnitBehaviorRemove(libMapM_gv_mMGardensDragonStatue, "DragonShrineDeactivated", 1);
    TextTagShow(libMapM_gv_mMGardensDragonStatueTextTag, PlayerGroupAll(), false);
    TextTagShow(libMapM_gv_mMGardensDragonStatueTextTagAllyOwned, PlayerGroupAlliance(c_playerGroupAlly, lp_team), true);
    autoA43C1C70_g = PlayerGroupAlliance(c_playerGroupAlly, lp_team); 
    autoA43C1C70_p = 1;
    for ( ; autoA43C1C70_p <= PlayerGroupCount(autoA43C1C70_g) ; autoA43C1C70_p += BoolToInt(lv_p == PlayerGroupPlayer(autoA43C1C70_g, autoA43C1C70_p)) ) {
        lv_p = PlayerGroupPlayer(autoA43C1C70_g, autoA43C1C70_p);
        if ((PlayerGroupHasPlayer(libCore_gv_activeHumanPlayers, lv_p) == true)) {
            if ((libMapM_gv_mapMechanicUsedTracker[lv_p].lv_dragonStatue == true)) {
                TextTagShow(libMapM_gv_mMGardensDragonStatueTextTagAllyOwned, libCore_gv_playerGroupFromPlayer[lv_p], false);
            }
            else {
            }
        }
        else {
        }
    }
    TextTagShow(libMapM_gv_mMGardensDragonStatueTextTagEnemyOwned, PlayerGroupAlliance(c_playerGroupEnemy, lp_team), true);
    auto6728DB37_g = PlayerGroupAlliance(c_playerGroupEnemy, lp_team); 
    auto6728DB37_p = 1;
    for ( ; auto6728DB37_p <= PlayerGroupCount(auto6728DB37_g) ; auto6728DB37_p += BoolToInt(lv_p == PlayerGroupPlayer(auto6728DB37_g, auto6728DB37_p)) ) {
        lv_p = PlayerGroupPlayer(auto6728DB37_g, auto6728DB37_p);
        if ((PlayerGroupHasPlayer(libCore_gv_activeHumanPlayers, lv_p) == true)) {
            if ((libMapM_gv_mapMechanicUsedTracker[lv_p].lv_dragonStatue == true)) {
                TextTagShow(libMapM_gv_mMGardensDragonStatueTextTagEnemyOwned, libCore_gv_playerGroupFromPlayer[lv_p], false);
            }
            else {
            }
        }
        else {
        }
    }
    TimerStart(libMapM_gv_mMGardensDragonDragonStatueActiveReminderTimer, 1.0, false, c_timeGame);
    if ((lp_team == libCore_gv_cOMPUTER_TeamOrder)) {
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_teamOrder, 2, 0, "DragonKnightAllyObelisk_All", StringExternal("Param/Value/lib_MapM_0FD8EC02"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_teamChaos, 2, 0, "DragonKnightEnemyObelisk_All", StringExternal("Param/Value/lib_MapM_B6C2BBCC"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 2, 0, "DragonKnightEnemyObelisk_All", StringExternal("Param/Value/lib_MapM_7B3F3376"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    }
    else {
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_teamChaos, 0, 0, "DragonKnightAllyObelisk_All", StringExternal("Param/Value/lib_MapM_F5B0226C"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_teamOrder, 0, 0, "DragonKnightEnemyObelisk_All", StringExternal("Param/Value/lib_MapM_7EB3F089"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 0, 0, "DragonKnightEnemyObelisk_All", StringExternal("Param/Value/lib_MapM_AC841AEC"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    }
    return true;
}

bool libMapM_gf_MMGardensDragonObeliskFullyCaptured (unit lp_obeliskUnit) {
    int auto7B50E203_ae;

    // Variable Declarations
    int lv_obeliskIndex;

    // Variable Initialization

    // Implementation
    auto7B50E203_ae = libMapM_gv_mMGardensDragonDragonTowerObeliskCount_C;
    lv_obeliskIndex = 1;
    for ( ; lv_obeliskIndex <= auto7B50E203_ae ; lv_obeliskIndex += 1 ) {
        if ((libMapM_gv_mMGardensDragonDragonTowers[lv_obeliskIndex].lv_shrineUnit == lp_obeliskUnit)) {
            return libGame_gf_CapturePointFullyCaptured(libMapM_gv_mMGardensDragonDragonTowers[lv_obeliskIndex].lv_captureBeaconIndex);
        }
        else {
        }
    }
    return false;
}

void libMapM_gf_MMGardensDragonDragonHasEnteredArtHooks () {
    // Implementation
    libGame_gf_SpecialLightingEventStart("StormDragonFire", PlayerGroupAll(), 3.0);
    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal MM1On");
    SoundPlayForPlayer(SoundLink("Event_Gardens_Dragon_Ambient_Start", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);
    SoundPlayForPlayer(SoundLink("Event_Gardens_Dragon_Ambient_Loop", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);
    libMapM_gv_mMGardensDragonAmbientSound = SoundLastPlayed();
}

void libMapM_gf_MMGardensDragonDragonHasLeftArtHooks () {
    // Implementation
    libGame_gf_SpecialLightingEventEnd("StormDragonFire", PlayerGroupAll(), 3.0);
    libGame_gf_AnnouncementAddItemForPlayerGroup(PlayerGroupAll(), 0, 0, "DragonKnightEventEnd", StringExternal("Param/Value/lib_MapM_F838CDDB"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal MM1Off");
    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal MM2On");
    SoundStop(libMapM_gv_mMGardensDragonAmbientSound, true);
    SoundPlayForPlayer(SoundLink("Event_Gardens_Dragon_Ambient_End", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);
}

trigger auto_libMapM_gf_MMDragonballsTransmissionObelisksOpenWarningQ_Trigger = null;
playergroup auto_libMapM_gf_MMDragonballsTransmissionObelisksOpenWarningQ_lp_players;

void libMapM_gf_MMDragonballsTransmissionObelisksOpenWarningQ (playergroup lp_players) {
    auto_libMapM_gf_MMDragonballsTransmissionObelisksOpenWarningQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMDragonballsTransmissionObelisksOpenWarningQ_Trigger == null) {
        auto_libMapM_gf_MMDragonballsTransmissionObelisksOpenWarningQ_Trigger = TriggerCreate("auto_libMapM_gf_MMDragonballsTransmissionObelisksOpenWarningQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMDragonballsTransmissionObelisksOpenWarningQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMDragonballsTransmissionObelisksOpenWarningQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMDragonballsTransmissionObelisksOpenWarningQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    if ((libMapM_gv_mMDragonballsTransmissionShrinesRechargeFirstTime == true)) {
        libMapM_gv_mMDragonballsTransmissionShrinesRechargeFirstTime = false;
        TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("CreepVO_LadyofThorns_292", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, 11);
    }
    else {
        TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("ShrinesRecharge", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    }
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMDragonballsTransmissionObelisksSpawnQ_Trigger = null;
playergroup auto_libMapM_gf_MMDragonballsTransmissionObelisksSpawnQ_lp_players;

void libMapM_gf_MMDragonballsTransmissionObelisksSpawnQ (playergroup lp_players) {
    auto_libMapM_gf_MMDragonballsTransmissionObelisksSpawnQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMDragonballsTransmissionObelisksSpawnQ_Trigger == null) {
        auto_libMapM_gf_MMDragonballsTransmissionObelisksSpawnQ_Trigger = TriggerCreate("auto_libMapM_gf_MMDragonballsTransmissionObelisksSpawnQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMDragonballsTransmissionObelisksSpawnQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMDragonballsTransmissionObelisksSpawnQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMDragonballsTransmissionObelisksSpawnQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("CreepVO_LadyofThorns_296", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMDragonballsTransmissionObelisksRepawnQ_Trigger = null;
playergroup auto_libMapM_gf_MMDragonballsTransmissionObelisksRepawnQ_lp_players;

void libMapM_gf_MMDragonballsTransmissionObelisksRepawnQ (playergroup lp_players) {
    auto_libMapM_gf_MMDragonballsTransmissionObelisksRepawnQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMDragonballsTransmissionObelisksRepawnQ_Trigger == null) {
        auto_libMapM_gf_MMDragonballsTransmissionObelisksRepawnQ_Trigger = TriggerCreate("auto_libMapM_gf_MMDragonballsTransmissionObelisksRepawnQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMDragonballsTransmissionObelisksRepawnQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMDragonballsTransmissionObelisksRepawnQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMDragonballsTransmissionObelisksRepawnQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("ShrineSpawnRepeat", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap1Q_Trigger = null;
playergroup auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap1Q_lp_players;

void libMapM_gf_MMDragonballsTransmissionObelisksAllyCap1Q (playergroup lp_players) {
    auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap1Q_lp_players = lp_players;

    if (auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap1Q_Trigger == null) {
        auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap1Q_Trigger = TriggerCreate("auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap1Q_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap1Q_Trigger, false, false);
}

bool auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap1Q_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap1Q_lp_players;

    return true;
}

trigger auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap2Q_Trigger = null;
playergroup auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap2Q_lp_players;

void libMapM_gf_MMDragonballsTransmissionObelisksAllyCap2Q (playergroup lp_players) {
    auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap2Q_lp_players = lp_players;

    if (auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap2Q_Trigger == null) {
        auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap2Q_Trigger = TriggerCreate("auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap2Q_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap2Q_Trigger, false, false);
}

bool auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap2Q_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMDragonballsTransmissionObelisksAllyCap2Q_lp_players;

    return true;
}

trigger auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap1Q_Trigger = null;
playergroup auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap1Q_lp_players;

void libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap1Q (playergroup lp_players) {
    auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap1Q_lp_players = lp_players;

    if (auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap1Q_Trigger == null) {
        auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap1Q_Trigger = TriggerCreate("auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap1Q_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap1Q_Trigger, false, false);
}

bool auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap1Q_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap1Q_lp_players;

    return true;
}

trigger auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap2Q_Trigger = null;
playergroup auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap2Q_lp_players;

void libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap2Q (playergroup lp_players) {
    auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap2Q_lp_players = lp_players;

    if (auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap2Q_Trigger == null) {
        auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap2Q_Trigger = TriggerCreate("auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap2Q_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap2Q_Trigger, false, false);
}

bool auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap2Q_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap2Q_lp_players;

    return true;
}

trigger auto_libMapM_gf_MMDragonballsTransmissionObelisksObserverCap2Q_Trigger = null;

void libMapM_gf_MMDragonballsTransmissionObelisksObserverCap2Q () {
    if (auto_libMapM_gf_MMDragonballsTransmissionObelisksObserverCap2Q_Trigger == null) {
        auto_libMapM_gf_MMDragonballsTransmissionObelisksObserverCap2Q_Trigger = TriggerCreate("auto_libMapM_gf_MMDragonballsTransmissionObelisksObserverCap2Q_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMDragonballsTransmissionObelisksObserverCap2Q_Trigger, false, false);
}

bool auto_libMapM_gf_MMDragonballsTransmissionObelisksObserverCap2Q_TriggerFunc (bool testConds, bool runActions) {
    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(PlayerGroupSingle(libCore_gv_oBSERVER_ObserverUIPlayer), TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("Shrine2Taken_Observer", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMDragonballsTransmissionAllyDragonQ_Trigger = null;
playergroup auto_libMapM_gf_MMDragonballsTransmissionAllyDragonQ_lp_players;

void libMapM_gf_MMDragonballsTransmissionAllyDragonQ (playergroup lp_players) {
    auto_libMapM_gf_MMDragonballsTransmissionAllyDragonQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMDragonballsTransmissionAllyDragonQ_Trigger == null) {
        auto_libMapM_gf_MMDragonballsTransmissionAllyDragonQ_Trigger = TriggerCreate("auto_libMapM_gf_MMDragonballsTransmissionAllyDragonQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMDragonballsTransmissionAllyDragonQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMDragonballsTransmissionAllyDragonQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMDragonballsTransmissionAllyDragonQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("DragonActive", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMDragonballsTransmissionEnemyDragonQ_Trigger = null;
playergroup auto_libMapM_gf_MMDragonballsTransmissionEnemyDragonQ_lp_players;

void libMapM_gf_MMDragonballsTransmissionEnemyDragonQ (playergroup lp_players) {
    auto_libMapM_gf_MMDragonballsTransmissionEnemyDragonQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMDragonballsTransmissionEnemyDragonQ_Trigger == null) {
        auto_libMapM_gf_MMDragonballsTransmissionEnemyDragonQ_Trigger = TriggerCreate("auto_libMapM_gf_MMDragonballsTransmissionEnemyDragonQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMDragonballsTransmissionEnemyDragonQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMDragonballsTransmissionEnemyDragonQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMDragonballsTransmissionEnemyDragonQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("DragonActiveEnemy", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMDragonballsTransmissionObserverDragonQ_Trigger = null;

void libMapM_gf_MMDragonballsTransmissionObserverDragonQ () {
    if (auto_libMapM_gf_MMDragonballsTransmissionObserverDragonQ_Trigger == null) {
        auto_libMapM_gf_MMDragonballsTransmissionObserverDragonQ_Trigger = TriggerCreate("auto_libMapM_gf_MMDragonballsTransmissionObserverDragonQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMDragonballsTransmissionObserverDragonQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMDragonballsTransmissionObserverDragonQ_TriggerFunc (bool testConds, bool runActions) {
    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(PlayerGroupSingle(libCore_gv_oBSERVER_ObserverUIPlayer), TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("DragonActive_Observer", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMDragonballsTransmissionDragonExpireQ_Trigger = null;
playergroup auto_libMapM_gf_MMDragonballsTransmissionDragonExpireQ_lp_players;

void libMapM_gf_MMDragonballsTransmissionDragonExpireQ (playergroup lp_players) {
    auto_libMapM_gf_MMDragonballsTransmissionDragonExpireQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMDragonballsTransmissionDragonExpireQ_Trigger == null) {
        auto_libMapM_gf_MMDragonballsTransmissionDragonExpireQ_Trigger = TriggerCreate("auto_libMapM_gf_MMDragonballsTransmissionDragonExpireQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMDragonballsTransmissionDragonExpireQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMDragonballsTransmissionDragonExpireQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMDragonballsTransmissionDragonExpireQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("DragonEnd", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMUnderworldInitWorld_Trigger = null;
region auto_libMapM_gf_MMUnderworldInitWorld_lp_aboveGroundPlayable;
region auto_libMapM_gf_MMUnderworldInitWorld_lp_aboveGroundCamera;
region auto_libMapM_gf_MMUnderworldInitWorld_lp_underGroundPlayable;
region auto_libMapM_gf_MMUnderworldInitWorld_lp_fullWorldCamera;
point auto_libMapM_gf_MMUnderworldInitWorld_lp_summonPos_Order;
point auto_libMapM_gf_MMUnderworldInitWorld_lp_summonPos_Chaos;

void libMapM_gf_MMUnderworldInitWorld (region lp_aboveGroundPlayable, region lp_aboveGroundCamera, region lp_underGroundPlayable, region lp_fullWorldCamera, point lp_summonPos_Order, point lp_summonPos_Chaos) {
    auto_libMapM_gf_MMUnderworldInitWorld_lp_aboveGroundPlayable = lp_aboveGroundPlayable;
    auto_libMapM_gf_MMUnderworldInitWorld_lp_aboveGroundCamera = lp_aboveGroundCamera;
    auto_libMapM_gf_MMUnderworldInitWorld_lp_underGroundPlayable = lp_underGroundPlayable;
    auto_libMapM_gf_MMUnderworldInitWorld_lp_fullWorldCamera = lp_fullWorldCamera;
    auto_libMapM_gf_MMUnderworldInitWorld_lp_summonPos_Order = lp_summonPos_Order;
    auto_libMapM_gf_MMUnderworldInitWorld_lp_summonPos_Chaos = lp_summonPos_Chaos;

    if (auto_libMapM_gf_MMUnderworldInitWorld_Trigger == null) {
        auto_libMapM_gf_MMUnderworldInitWorld_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldInitWorld_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldInitWorld_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldInitWorld_TriggerFunc (bool testConds, bool runActions) {
    region lp_aboveGroundPlayable = auto_libMapM_gf_MMUnderworldInitWorld_lp_aboveGroundPlayable;
    region lp_aboveGroundCamera = auto_libMapM_gf_MMUnderworldInitWorld_lp_aboveGroundCamera;
    region lp_underGroundPlayable = auto_libMapM_gf_MMUnderworldInitWorld_lp_underGroundPlayable;
    region lp_fullWorldCamera = auto_libMapM_gf_MMUnderworldInitWorld_lp_fullWorldCamera;
    point lp_summonPos_Order = auto_libMapM_gf_MMUnderworldInitWorld_lp_summonPos_Order;
    point lp_summonPos_Chaos = auto_libMapM_gf_MMUnderworldInitWorld_lp_summonPos_Chaos;

    playergroup auto5F9B2BAC_g;
    int auto5F9B2BAC_p;
    unitgroup auto3CAA9934_g;
    int auto3CAA9934_u;
    unitgroup autoA6C4D835_g;
    int autoA6C4D835_u;
    int auto892DBE2E_ae;
    int auto892DBE2E_ai;

    // Variable Declarations
    int lv_itPlayer;
    unit lv_itGate;
    unit lv_itBush;

    // Variable Initialization

    // Implementation
    libMapM_gv_mMUnderworldAboveGroundPlayable = lp_aboveGroundPlayable;
    libMapM_gv_mMUnderworldAboveGroundCamera = lp_aboveGroundCamera;
    libMapM_gv_mMUnderworldUnderGroundPlayable = lp_underGroundPlayable;
    libMapM_gv_mMUnderworldFullWorldCamera = lp_fullWorldCamera;
    libMapM_gv_mMUnderworldGatesAbove = UnitGroup("HoleLadderDown", libCore_gv_cOMPUTER_Neutral, lp_aboveGroundPlayable, UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    libMapM_gv_mMUnderworldGatesBelow = UnitGroup("HoleLadderUp", libCore_gv_cOMPUTER_Neutral, lp_underGroundPlayable, UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    auto5F9B2BAC_g = PlayerGroupAll(); 
    auto5F9B2BAC_p = 1;
    for ( ; auto5F9B2BAC_p <= PlayerGroupCount(auto5F9B2BAC_g) ; auto5F9B2BAC_p += BoolToInt(lv_itPlayer == PlayerGroupPlayer(auto5F9B2BAC_g, auto5F9B2BAC_p)) ) {
        lv_itPlayer = PlayerGroupPlayer(auto5F9B2BAC_g, auto5F9B2BAC_p);
        VisRevealArea(lv_itPlayer, libMapM_gv_mMUnderworldUnderGroundPlayable, 1.0, true);
        CatalogFieldValueSet(c_gameCatalogEffect, "CaptureMacGuffin", "PeriodCount", lv_itPlayer, "4");
        CatalogFieldValueSet(c_gameCatalogAbil, "CaptureMacGuffin", "Range[" + IntToString(0) + "]", lv_itPlayer, "2.5");
        CatalogFieldValueSet(c_gameCatalogEffect, "CaptureMacGuffin", "PeriodicValidator", lv_itPlayer, "CaptureMacguffinPeriodValidatorCombat");
    }
    libNtve_gf_ShowHideDoodadsInRegion(false, RegionEntireMap(), "UnderworldGateHelper");
    libMapM_gv_mMUnderworldSummonedBossLocation[1] = lp_summonPos_Order;
    libMapM_gv_mMUnderworldSummonedBossLocation[2] = lp_summonPos_Chaos;
    libNtve_gf_CreateUnitsWithDefaultFacing(1, "UnderworldSummonedBossBody", c_unitCreateIgnorePlacement, libGame_gf_ComputerPlayerInTeam(libGame_gv_teamOrderIndex_C), libMapM_gv_mMUnderworldSummonedBossLocation[libGame_gv_teamOrderIndex_C]);
    libMapM_gv_mMUnderworldSummonedBossBody[libGame_gv_teamOrderIndex_C] = UnitLastCreated();
    libNtve_gf_CreateUnitsWithDefaultFacing(1, "UnderworldSummonedBossBody", c_unitCreateIgnorePlacement, libGame_gf_ComputerPlayerInTeam(libGame_gv_teamChaosIndex_C), libMapM_gv_mMUnderworldSummonedBossLocation[libGame_gv_teamChaosIndex_C]);
    libMapM_gv_mMUnderworldSummonedBossBody[libGame_gv_teamChaosIndex_C] = UnitLastCreated();
    auto3CAA9934_g = libMapM_gv_mMUnderworldGatesAbove;
    auto3CAA9934_u = 1;
    for ( ; auto3CAA9934_u <= UnitGroupCount(auto3CAA9934_g, c_unitCountAll) ; auto3CAA9934_u += BoolToInt(lv_itGate == UnitGroupUnit(auto3CAA9934_g, auto3CAA9934_u)) ) {
        lv_itGate = UnitGroupUnit(auto3CAA9934_g, auto3CAA9934_u);
        libNtve_gf_PlayAnimation(libNtve_gf_MainActorofUnit(lv_itGate), "Cover", "Cover", c_animFlagPlayForever, c_animTimeDefault);
        UnitSetState(lv_itGate, c_unitStateHighlightable, false);
        UnitSetState(lv_itGate, c_unitStateTargetable, false);
    }
    autoA6C4D835_g = libMapM_gv_mMUnderworldGatesBelow;
    autoA6C4D835_u = 1;
    for ( ; autoA6C4D835_u <= UnitGroupCount(autoA6C4D835_g, c_unitCountAll) ; autoA6C4D835_u += BoolToInt(lv_itGate == UnitGroupUnit(autoA6C4D835_g, autoA6C4D835_u)) ) {
        lv_itGate = UnitGroupUnit(autoA6C4D835_g, autoA6C4D835_u);
        if ((libCore_gf_TextTagStoredForUnit(lv_itGate, 1) == c_textTagNone)) {
            TextTagCreate(StringExternal("Param/Value/lib_MapM_CD21A1AF"), 16, UnitGetPosition(lv_itGate), 1.0, true, false, libCore_gv_activeHumanPlayers);
            libCore_gf_StoreTextTagForUnit(lv_itGate, 1, TextTagLastCreated());
            TextTagAttachToUnit(TextTagLastCreated(), lv_itGate, 3.0);
            TextTagShow(TextTagLastCreated(), libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], false);
        }
        else {
        }
    }
    libMapM_gf_MMUnderworldTurnGroundHoleLightOnOff(false);
    libMapM_gf_MMUnderworldHookupMinimapSplit();
    TriggerEnable(libMapM_gt_MMUnderworldPlayerMovesCamera, true);
    auto892DBE2E_ae = libCore_gv_bALMaxPlayers;
    auto892DBE2E_ai = 1;
    lv_itPlayer = 1;
    for ( ; ( (auto892DBE2E_ai >= 0 && lv_itPlayer <= auto892DBE2E_ae) || (auto892DBE2E_ai <= 0 && lv_itPlayer >= auto892DBE2E_ae) ) ; lv_itPlayer += auto892DBE2E_ai ) {
        CameraSetChannel(lv_itPlayer, libMapM_gf_MMUnderworldGroundHoleCamera(libMapM_gf_MMUnderworldGroundHole(UnitGroupUnit(libMapM_gv_mMUnderworldGatesAbove, 1))), "SC2Camera001", 8, 1.2);
        CameraSetChannel(lv_itPlayer, libMapM_gf_MMUnderworldGroundHoleCamera(libMapM_gf_MMUnderworldGroundHole(UnitGroupUnit(libMapM_gv_mMUnderworldGatesAbove, 2))), "SC2Camera001", 1, 1.2);
    }
    CameraSetChannel(libCore_gv_oBSERVER_ObserverUIPlayer, libMapM_gf_MMUnderworldGroundHoleCamera(libMapM_gf_MMUnderworldGroundHole(UnitGroupUnit(libMapM_gv_mMUnderworldGatesAbove, 1))), "SC2Camera001", 8, 1.2);
    CameraSetChannel(libCore_gv_oBSERVER_ObserverUIPlayer, libMapM_gf_MMUnderworldGroundHoleCamera(libMapM_gf_MMUnderworldGroundHole(UnitGroupUnit(libMapM_gv_mMUnderworldGatesAbove, 2))), "SC2Camera001", 1, 1.2);
    SoundLengthQuery(SoundLink("Event_Mines_Boss_Summon_Start", -1));
    return true;
}

unit libMapM_gf_MMUnderworldPlayerHeroUnit (int lp_player) {
    // Implementation
    if ((libGame_gv_players[lp_player].lv_activeVehicle != null) && (UnitIsAlive(libGame_gv_players[lp_player].lv_activeVehicle) == true)) {
        return libGame_gv_players[lp_player].lv_activeVehicle;
    }
    else {
    }
    return libGame_gv_players[lp_player].lv_heroUnit;
}

unit libMapM_gf_MMUnderworldGroundHole (unit lp_gate) {
    // Implementation
    return libCore_gf_UnitStoredForUnit(lp_gate, 1);
}

unit libMapM_gf_MMUnderworldGroundHoleVision (unit lp_hole) {
    // Implementation
    return libCore_gf_UnitStoredForUnit(lp_hole, 1);
}

unit libMapM_gf_MMUnderworldGroundHoleCamera (unit lp_hole) {
    // Implementation
    return libCore_gf_UnitStoredForUnit(lp_hole, 2);
}

unit libMapM_gf_MMUnderworldUndergroundLadder (unit lp_gate) {
    // Implementation
    return libCore_gf_UnitStoredForUnit(lp_gate, 2);
}

unit libMapM_gf_MMUnderworldUndergroundEntranceLight (unit lp_gate, int lp_team) {
    // Implementation
    return libCore_gf_UnitStoredForUnit(lp_gate, (lp_team + 2));
}

point libMapM_gf_MMUnderworldGateEnteringSpawnPoint (unit lp_gate) {
    // Implementation
    return libCore_gf_PointStoredForUnit(lp_gate, 1);
}

void libMapM_gf_MMUnderworldChangePlane (int lp_player, int lp_groundPlane) {
    // Implementation
    if (((lp_player < 0) || (lp_player > libCore_gv_bALMaxEnginePlayerCount))) {
        return ;
    }
    else {
    }
    if ((libMapM_gv_mMUnderworldPlayerPlane[lp_player] == lp_groundPlane)) {
        return ;
    }
    else {
    }
    if ((lp_groundPlane == 2)) {
        libMapM_gv_mMUnderworldPlayerPlane[lp_player] = 2;
    }
    else {
        libMapM_gv_mMUnderworldPlayerPlane[lp_player] = 1;
    }
    libMapM_gf_MMUnderworldUpdateHeroLighting(lp_player);
    libMapM_gf_MMUnderworldUpdateAmbience(lp_player);
}

void libMapM_gf_MMUnderworldUpdateHeroLighting (int lp_player) {
    // Variable Declarations
    unit lv_hero;

    // Variable Initialization

    // Implementation
    lv_hero = libMapM_gf_MMUnderworldPlayerHeroUnit(lp_player);
    if ((lv_hero == null)) {
        return ;
    }
    else {
    }
    if ((libNtve_gf_UnitInRegion(lv_hero, libMapM_gv_mMUnderworldUnderGroundPlayable) == true)) {
        if ((libCore_gf_ActorStoredForUnit(lv_hero, 1) == null)) {
            libNtve_gf_AttachModelToUnit(lv_hero, "UnderworldHeroLight", "Ref_Origin");
            ActorSend(libNtve_gf_ActorLastCreated(), "SetFilter Ally");
            ActorSend(libNtve_gf_ActorLastCreated(), "SetFilter Enemy");
            ActorSend(libNtve_gf_ActorLastCreated(), "SetFilter Neutral");
            libCore_gf_StoreActorForUnit(lv_hero, 1, libNtve_gf_ActorLastCreated());
        }
        else {
        }
        if ((libCore_gf_ActorStoredForUnit(lv_hero, 2) == null)) {
            libNtve_gf_AttachModelToUnit(lv_hero, "UnderworldHeroLightOther", "Ref_Origin");
            ActorSend(libNtve_gf_ActorLastCreated(), "SetFilter");
            ActorSend(libNtve_gf_ActorLastCreated(), "SetFilter Enemy");
            ActorSend(libNtve_gf_ActorLastCreated(), "SetFilter Neutral");
            libCore_gf_StoreActorForUnit(lv_hero, 2, libNtve_gf_ActorLastCreated());
        }
        else {
        }
    }
    else {
        if ((libCore_gf_ActorStoredForUnit(lv_hero, 1) != null)) {
            ActorSend(libCore_gf_ActorStoredForUnit(lv_hero, 1), "Destroy Immediate");
            libCore_gf_StoreActorForUnit(lv_hero, 1, null);
        }
        else {
        }
        if ((libCore_gf_ActorStoredForUnit(lv_hero, 2) != null)) {
            ActorSend(libCore_gf_ActorStoredForUnit(lv_hero, 2), "Destroy Immediate");
            libCore_gf_StoreActorForUnit(lv_hero, 2, null);
        }
        else {
        }
    }
}

void libMapM_gf_MMUnderworldTurnGroundHoleLightOnOff (bool lp_onOff) {
    unitgroup auto897E9816_g;
    int auto897E9816_u;
    unitgroup auto833BD99D_g;
    int auto833BD99D_u;
    unitgroup auto16C39F67_g;
    int auto16C39F67_u;
    unitgroup autoA5AA62EA_g;
    int autoA5AA62EA_u;

    // Variable Declarations
    unit lv_itGate;

    // Variable Initialization

    // Implementation
    if ((lp_onOff == true)) {
        auto16C39F67_g = libMapM_gv_mMUnderworldGatesAbove;
        auto16C39F67_u = 1;
        for ( ; auto16C39F67_u <= UnitGroupCount(auto16C39F67_g, c_unitCountAll) ; auto16C39F67_u += BoolToInt(lv_itGate == UnitGroupUnit(auto16C39F67_g, auto16C39F67_u)) ) {
            lv_itGate = UnitGroupUnit(auto16C39F67_g, auto16C39F67_u);
            libNtve_gf_ClearAnimation(libNtve_gf_MainActorofUnit(lv_itGate), c_animNameDefault);
        }
        autoA5AA62EA_g = libMapM_gv_mMUnderworldGatesBelow;
        autoA5AA62EA_u = 1;
        for ( ; autoA5AA62EA_u <= UnitGroupCount(autoA5AA62EA_g, c_unitCountAll) ; autoA5AA62EA_u += BoolToInt(lv_itGate == UnitGroupUnit(autoA5AA62EA_g, autoA5AA62EA_u)) ) {
            lv_itGate = UnitGroupUnit(autoA5AA62EA_g, autoA5AA62EA_u);
            libNtve_gf_ClearAnimation(libNtve_gf_MainActorofUnit(lv_itGate), c_animNameDefault);
        }
    }
    else {
        auto897E9816_g = libMapM_gv_mMUnderworldGatesAbove;
        auto897E9816_u = 1;
        for ( ; auto897E9816_u <= UnitGroupCount(auto897E9816_g, c_unitCountAll) ; auto897E9816_u += BoolToInt(lv_itGate == UnitGroupUnit(auto897E9816_g, auto897E9816_u)) ) {
            lv_itGate = UnitGroupUnit(auto897E9816_g, auto897E9816_u);
            libNtve_gf_PlayAnimation(libNtve_gf_MainActorofUnit(lv_itGate), c_animNameDefault, "Dead", c_animFlagPlayForever, c_animTimeDefault);
        }
        auto833BD99D_g = libMapM_gv_mMUnderworldGatesBelow;
        auto833BD99D_u = 1;
        for ( ; auto833BD99D_u <= UnitGroupCount(auto833BD99D_g, c_unitCountAll) ; auto833BD99D_u += BoolToInt(lv_itGate == UnitGroupUnit(auto833BD99D_g, auto833BD99D_u)) ) {
            lv_itGate = UnitGroupUnit(auto833BD99D_g, auto833BD99D_u);
            libNtve_gf_PlayAnimation(libNtve_gf_MainActorofUnit(lv_itGate), c_animNameDefault, "Dead", c_animFlagPlayForever, c_animTimeDefault);
        }
    }
}

void libMapM_gf_MMUnderworldChangeAmbience (string lp_ambience, string lp_reverb, playergroup lp_players) {
    playergroup auto5C3964BA_g;
    int auto5C3964BA_p;

    // Variable Declarations
    int lv_itPlayer;

    // Variable Initialization

    // Implementation
    auto5C3964BA_g = lp_players; 
    auto5C3964BA_p = 1;
    for ( ; auto5C3964BA_p <= PlayerGroupCount(auto5C3964BA_g) ; auto5C3964BA_p += BoolToInt(lv_itPlayer == PlayerGroupPlayer(auto5C3964BA_g, auto5C3964BA_p)) ) {
        lv_itPlayer = PlayerGroupPlayer(auto5C3964BA_g, auto5C3964BA_p);
        if ((libMapM_gv_mMUnderworldAmbience[lv_itPlayer] == lp_ambience)) {
            continue;
        }
        else {
        }
        libMapM_gv_mMUnderworldAmbience[lv_itPlayer] = lp_ambience;
    }
    SoundtrackPlay(lp_players, c_soundtrackCategoryAmbience, lp_ambience, c_soundtrackCueAny, c_soundtrackIndexAny, true);
    SoundSetReverbForPlayers(lp_players, lp_reverb, 1.5, true, true);
}

void libMapM_gf_MMUnderworldUpdateAmbience (int lp_player) {
    // Implementation
    if ((RegionContainsPoint(libMapM_gv_mMUnderworldAboveGroundPlayable, CameraGetTarget(lp_player)) == true)) {
        libMapM_gf_MMUnderworldChangeAmbience("RavenCourtAmbientDay", "BetaVerb", PlayerGroupSingle(lp_player));
    }
    else {
        libMapM_gf_MMUnderworldChangeAmbience("Ambient_Underworld_Mines", "Test_HauntedMines_Verb", PlayerGroupSingle(lp_player));
    }
}

void libMapM_gf_MapMechanicUnderworldAddMinionGroup (region lp_groupArea) {
    unitgroup autoB712B1C0_g;
    int autoB712B1C0_u;

    // Variable Declarations
    int lv_groupIndex;
    unit lv_itMinion;
    int lv_minionIndex;

    // Variable Initialization

    // Implementation
    libMapM_gv_mMUnderworldMinionGroupCount += 1;
    lv_groupIndex = libMapM_gv_mMUnderworldMinionGroupCount;
    libMapM_gv_mMUnderworldMinionGroups[lv_groupIndex].lv_area = lp_groupArea;
    autoB712B1C0_g = UnitGroup(null, libCore_gv_cOMPUTER_Hostile, lp_groupArea, UnitFilter((1 << c_targetFilterLight), 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    autoB712B1C0_u = 1;
    for ( ; autoB712B1C0_u <= UnitGroupCount(autoB712B1C0_g, c_unitCountAll) ; autoB712B1C0_u += BoolToInt(lv_itMinion == UnitGroupUnit(autoB712B1C0_g, autoB712B1C0_u)) ) {
        lv_itMinion = UnitGroupUnit(autoB712B1C0_g, autoB712B1C0_u);
        libMapM_gv_mMUnderworldMinionGroups[lv_groupIndex].lv_minionCount += 1;
        lv_minionIndex = libMapM_gv_mMUnderworldMinionGroups[lv_groupIndex].lv_minionCount;
        libMapM_gv_mMUnderworldMinionGroups[lv_groupIndex].lv_minionType[lv_minionIndex] = UnitGetType(lv_itMinion);
        libMapM_gv_mMUnderworldMinionGroups[lv_groupIndex].lv_positions[lv_minionIndex] = UnitGetPosition(lv_itMinion);
        PointSetFacing(libMapM_gv_mMUnderworldMinionGroups[lv_groupIndex].lv_positions[lv_minionIndex], UnitGetFacing(lv_itMinion));
        UnitRemove(lv_itMinion);
    }
    libMapM_gv_mMUnderworldMinionGroups[lv_groupIndex].lv_units = UnitGroupEmpty();
    if ((libMapM_gv_mMUnderworldMinionGroups[lv_groupIndex].lv_minionCount >= 3)) {
        libMapM_gv_mMUnderworldMinionGroups[lv_groupIndex].lv_regenGlobeCount = 1;
    }
    else {
        libMapM_gv_mMUnderworldMinionGroups[lv_groupIndex].lv_regenGlobeCount = 0;
    }
}

void libMapM_gf_MapMechanicUnderworldAddBoss (region lp_bossRegion) {
    // Implementation
    libMapM_gv_mMUnderworldBossRegion = lp_bossRegion;
    libMapM_gv_mMUnderworldBoss = UnitGroupUnit(UnitGroup("UnderworldBoss", libCore_gv_cOMPUTER_Hostile, lp_bossRegion, UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 1), 1);
    libMapM_gv_mMUnderworldBossLocation = UnitGetPosition(libMapM_gv_mMUnderworldBoss);
    PointSetFacing(libMapM_gv_mMUnderworldBossLocation, UnitGetFacing(libMapM_gv_mMUnderworldBoss));
    UnitRemove(libMapM_gv_mMUnderworldBoss);
    libMapM_gv_mMUnderworldBoss = null;
}

int libMapM_gf_MMUnderworldBossSkullDropCount () {
    // Implementation
    if ((libMapM_gv_mMUnderworldMineOpenTimes <= 2)) {
        return 20;
    }
    else {
    }
    if ((libMapM_gv_mMUnderworldMineOpenTimes == 3)) {
        return 40;
    }
    else {
    }
    return 60;
}

trigger auto_libMapM_gf_MMUnderworldSpawnMinions_Trigger = null;

void libMapM_gf_MMUnderworldSpawnMinions () {
    if (auto_libMapM_gf_MMUnderworldSpawnMinions_Trigger == null) {
        auto_libMapM_gf_MMUnderworldSpawnMinions_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldSpawnMinions_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldSpawnMinions_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldSpawnMinions_TriggerFunc (bool testConds, bool runActions) {
    int auto24787213_ae;
    int auto24787213_ai;
    int auto1C434AB5_ae;
    int auto1C434AB5_ai;

    // Variable Declarations
    int lv_itGroupIndex;
    unit lv_itMinion;
    int lv_itMinionIndex;
    int lv_defenderAIIndex;

    // Variable Initialization

    // Implementation
    libMapM_gv_mMUnderworldSkullTotal = 0;
    auto24787213_ae = libMapM_gv_mMUnderworldMinionGroupCount;
    auto24787213_ai = 1;
    lv_itGroupIndex = 1;
    for ( ; ( (auto24787213_ai >= 0 && lv_itGroupIndex <= auto24787213_ae) || (auto24787213_ai <= 0 && lv_itGroupIndex >= auto24787213_ae) ) ; lv_itGroupIndex += auto24787213_ai ) {
        UnitGroupClear(libMapM_gv_mMUnderworldMinionGroups[lv_itGroupIndex].lv_units);
        if ((libMapM_gv_mMUnderworldMineOpenTimes >= 3)) {
            if (((lv_itGroupIndex == 5) || (lv_itGroupIndex == 6) || (lv_itGroupIndex == 8) || (lv_itGroupIndex == 9))) {
                continue;
            }
            else {
            }
        }
        else {
        }
        if ((libMapM_gv_mMUnderworldMineOpenTimes >= 4)) {
            if (((lv_itGroupIndex == 3) || (lv_itGroupIndex == 4) || (lv_itGroupIndex == 10) || (lv_itGroupIndex == 11))) {
                continue;
            }
            else {
            }
        }
        else {
        }
        auto1C434AB5_ae = libMapM_gv_mMUnderworldMinionGroups[lv_itGroupIndex].lv_minionCount;
        auto1C434AB5_ai = 1;
        lv_itMinionIndex = 1;
        for ( ; ( (auto1C434AB5_ai >= 0 && lv_itMinionIndex <= auto1C434AB5_ae) || (auto1C434AB5_ai <= 0 && lv_itMinionIndex >= auto1C434AB5_ae) ) ; lv_itMinionIndex += auto1C434AB5_ai ) {
            libNtve_gf_CreateUnitsAtPoint2(1, libMapM_gv_mMUnderworldMinionGroups[lv_itGroupIndex].lv_minionType[lv_itMinionIndex], 0, libCore_gv_cOMPUTER_Hostile, libMapM_gv_mMUnderworldMinionGroups[lv_itGroupIndex].lv_positions[lv_itMinionIndex]);
            lv_itMinion = UnitLastCreated();
            UnitGroupAdd(libMapM_gv_mMUnderworldMinionGroups[lv_itGroupIndex].lv_units, lv_itMinion);
            libCore_gf_StoreIntegerForUnit(lv_itMinion, 1, lv_itGroupIndex);
            libCore_gf_UpdateScalingForUnit(UnitLastCreated(), libMapM_gv_mMUnderworldScalingCurrentTicks, 0, FixedToInt(libMapM_gv_mMUnderworldMinionScalingCurrent.lv_xP));
            libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "SetMinimapVisibilityAlways 1");
        }
        libAIAI_gf_StartDefenderAI(libMapM_gv_mMUnderworldMinionGroups[lv_itGroupIndex].lv_units, RegionCircle(RegionGetCenter(libMapM_gv_mMUnderworldMinionGroups[lv_itGroupIndex].lv_area), 14.0), null, false);
        libMapM_gv_mMUnderworldSkullTotal += libMapM_gv_mMUnderworldMinionGroups[lv_itGroupIndex].lv_minionCount;
        libMapM_gv_mMUnderworldMinionGroups[lv_itGroupIndex].lv_regenGlobeDropped = false;
        Wait(0.0625, c_timeGame);
    }
    libNtve_gf_CreateUnitsAtPoint2(1, "UnderworldBoss", 0, libCore_gv_cOMPUTER_Hostile, libMapM_gv_mMUnderworldBossLocation);
    libMapM_gv_mMUnderworldBoss = UnitLastCreated();
    libMapM_gv_mMUnderworldSkullTotal += libMapM_gf_MMUnderworldBossSkullDropCount();
    libCore_gf_UpdateScalingForUnit(UnitLastCreated(), libMapM_gv_mMUnderworldScalingCurrentTicks, 0, FixedToInt(libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_xP));
    libAIAI_gf_StartDefenderAI(libNtve_gf_ConvertUnitToUnitGroup(libMapM_gv_mMUnderworldBoss), RegionCircle(UnitGetPosition(libMapM_gv_mMUnderworldBoss), 13.0), null, false);
    libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "SetMinimapVisibilityAlways 1");
    TriggerEnable(libMapM_gt_MMUnderworldMinionDies, true);
    libGame_gf_SendEventMapUnderworldUndeadSpawned(libMapM_gv_mMUnderworldGatesAbove, libMapM_gv_mMUnderworldUnderGroundPlayable, libMapM_gv_mMUnderworldSkullTotal);
    return true;
}

void libMapM_gf_MMUnderworldDropSkulls (point lp_location, int lp_count, bool lp_forBoss) {
    int auto904B67A2_n;
    int auto904B67A2_i;

    // Variable Declarations
    unit lv_itSkull;
    int lv_itPlayer;
    unit lv_pickupHero;
    unitgroup lv_herosNearby;
    unitgroup lv_skulls;

    // Variable Initialization
    lv_herosNearby = UnitGroupEmpty();
    lv_skulls = UnitGroupEmpty();

    // Implementation
    if ((lp_count <= 0)) {
        return ;
    }
    else {
    }
    if ((lp_forBoss == true)) {
        CatalogFieldValueSet(c_gameCatalogEffect, "DropUnderworldPowerupPersistentLargeArea", "PeriodCount", libCore_gv_cOMPUTER_Neutral, IntToString(lp_count));
        PlayerCreateEffectPoint(libCore_gv_cOMPUTER_Neutral, "DropUnderworldPowerupPersistentLargeArea", lp_location);
    }
    else {
        auto904B67A2_n = lp_count;
        for (auto904B67A2_i = 1; auto904B67A2_i <= auto904B67A2_n; auto904B67A2_i += 1) {
            UnitCreate(1, "ItemUnderworldPowerup", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Neutral, lp_location, libNtve_gf_RandomAngle());
        }
    }
}

bool libMapM_gf_MMUnderworldCleared () {
    // Variable Declarations
    int lv_itGroupIndex;

    // Variable Initialization

    // Implementation
    return (libMapM_gv_mMUnderworldSkullTotal <= (libMapM_gv_mMUnderworldSkullCollected[1] + libMapM_gv_mMUnderworldSkullCollected[2]));
}

void libMapM_gf_MMUnderworldSetScalingValue (int lp_scalingType, int lp_minuteMark, int lp_hPFlatPerMinute, int lp_hPPercentPerMinute, int lp_dmgFlatPerMinute, int lp_dmgPercentPerMinute, fixed lp_xPPerMinute) {
    int autoC6E850E6_val;
    int auto6FDDC669_ae;
    int auto6FDDC669_ai;

    // Variable Declarations
    int lv_itMinute;

    // Variable Initialization

    // Implementation
    autoC6E850E6_val = lp_scalingType;
    if (autoC6E850E6_val == 2) {
        auto6FDDC669_ae = libCore_gv_dataScalingMaxScalingTicks;
        auto6FDDC669_ai = 1;
        lv_itMinute = lp_minuteMark;
        for ( ; ( (auto6FDDC669_ai >= 0 && lv_itMinute <= auto6FDDC669_ae) || (auto6FDDC669_ai <= 0 && lv_itMinute >= auto6FDDC669_ae) ) ; lv_itMinute += auto6FDDC669_ai ) {
            libMapM_gv_mMUnderworldSummonedBossScalingChanges[lv_itMinute].lv_hPFlat = lp_hPFlatPerMinute;
            libMapM_gv_mMUnderworldSummonedBossScalingChanges[lv_itMinute].lv_hPPercent = lp_hPPercentPerMinute;
            libMapM_gv_mMUnderworldSummonedBossScalingChanges[lv_itMinute].lv_damageFlat = lp_dmgFlatPerMinute;
            libMapM_gv_mMUnderworldSummonedBossScalingChanges[lv_itMinute].lv_damagePercent = lp_dmgPercentPerMinute;
            libMapM_gv_mMUnderworldSummonedBossScalingChanges[lv_itMinute].lv_xP = lp_xPPerMinute;
        }
    }
    else {
    }
}

void libMapM_gf_MMUnderworldInitializeScalingDataForUnderworldHostileNPCs (int lp_scalingType, string lp_scalingBehavior) {
    int auto3744E342_ae;
    int auto3744E342_ai;
    int auto8EF50413_val;

    // Variable Declarations
    int lv_itRank;
    int lv_behaviorScalingLevels;

    // Variable Initialization

    // Implementation
    lv_behaviorScalingLevels = (CatalogFieldValueCount(c_gameCatalogBehavior, lp_scalingBehavior, "VeterancyLevelArray", c_playerAny) - 1);
    auto3744E342_ae = lv_behaviorScalingLevels;
    auto3744E342_ai = 1;
    lv_itRank = 1;
    for ( ; ( (auto3744E342_ai >= 0 && lv_itRank <= auto3744E342_ae) || (auto3744E342_ai <= 0 && lv_itRank >= auto3744E342_ae) ) ; lv_itRank += auto3744E342_ai ) {
        auto8EF50413_val = lp_scalingType;
        if (auto8EF50413_val == 0) {
            libMapM_gv_mMUnderworldMinionScalingChanges[lv_itRank].lv_xP = StringToInt(CatalogFieldValueGet(c_gameCatalogBehavior, lp_scalingBehavior, "VeterancyLevelArray[" + IntToString(lv_itRank) + "].Modification.Food", c_playerAny));
        }
        else if (auto8EF50413_val == 1) {
            libMapM_gv_mMUnderworldBossScalingChanges[lv_itRank].lv_xP = StringToInt(CatalogFieldValueGet(c_gameCatalogBehavior, lp_scalingBehavior, "VeterancyLevelArray[" + IntToString(lv_itRank) + "].Modification.Food", c_playerAny));
        }
        else {
        }
    }
}

void libMapM_gf_MMUnderworldApplySummonedBossScaling (int lp_team, bool lp_displayNumber) {
    // Variable Declarations
    fixed lv_hP;
    fixed lv_damage;
    fixed lv_damageStun;
    fixed lv_damageRootImpact;
    fixed lv_damageRootSustain;
    fixed lv_sizeScale;
    int lv_enemyTeam;

    // Variable Initialization

    // Implementation
    lv_hP = ((libMapM_gv_mMUnderworldSummonedBossHP+libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_hPFlat)*(1.0+(libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_hPPercent + (libMapM_gv_mMUnderworldSkullCollected[lp_team] * libMapM_gv_mMUnderworldBossBuffHPPercentPerSkull_C))));
    lv_hP = MaxF(MinF(lv_hP, 100000.0), 2000.0);
    lv_damage = ((libMapM_gv_mMUnderworldSummonedBossDamage+libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damageFlat)*(1.0+(libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damagePercent + (libMapM_gv_mMUnderworldSkullCollected[lp_team] * libMapM_gv_mMUnderworldBossBuffDmgPercentPerSkull_C))));
    lv_damageStun = ((libMapM_gv_mMUnderworldSummonedBossDamageStun+libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damageFlat)*(1.0+(libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damagePercent + (libMapM_gv_mMUnderworldSkullCollected[lp_team] * libMapM_gv_mMUnderworldBossBuffDmgPercentPerSkull_C))));
    lv_damageRootImpact = ((libMapM_gv_mMUnderworldSummonedBossDamageRootImpact+libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damageFlat)*(1.0+(libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damagePercent + (libMapM_gv_mMUnderworldSkullCollected[lp_team] * libMapM_gv_mMUnderworldBossBuffDmgPercentPerSkull_C))));
    lv_damageRootSustain = ((libMapM_gv_mMUnderworldSummonedBossDamageRootSustain+libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damageFlat)*(1.0+(libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damagePercent + (libMapM_gv_mMUnderworldSkullCollected[lp_team] * libMapM_gv_mMUnderworldBossBuffDmgPercentPerSkull_C))));
    if ((lp_displayNumber == true)) {
        TextExpressionSetToken("Param/Expression/lib_MapM_045A73E9", "A", FixedToText(lv_hP, 1));
        TextExpressionSetToken("Param/Expression/lib_MapM_045A73E9", "B", FixedToText(lv_damage, 1));
        TextExpressionSetToken("Param/Expression/lib_MapM_045A73E9", "C", FixedToText(lv_damageStun, 1));
        TextExpressionSetToken("Param/Expression/lib_MapM_045A73E9", "D", FixedToText(lv_damageRootImpact, 1));
        TextExpressionSetToken("Param/Expression/lib_MapM_045A73E9", "E", FixedToText(lv_damageRootSustain, 1));
        UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, TextExpressionAssemble("Param/Expression/lib_MapM_045A73E9"));
    }
    else {
    }
    CatalogFieldValueSet(c_gameCatalogUnit, "UnderworldSummonedBoss", "LifeMax", UnitGetOwner(libMapM_gv_mMUnderworldSummonedBoss[lp_team]), FixedToString(lv_hP, c_fixedPrecisionAny));
    CatalogFieldValueSet(c_gameCatalogUnit, "UnderworldSummonedBoss", "LifeStart", UnitGetOwner(libMapM_gv_mMUnderworldSummonedBoss[lp_team]), FixedToString(lv_hP, c_fixedPrecisionAny));
    CatalogFieldValueSet(c_gameCatalogEffect, "UnderworldSummonedBossWeaponDamage", "Amount", UnitGetOwner(libMapM_gv_mMUnderworldSummonedBoss[lp_team]), FixedToString(lv_damage, c_fixedPrecisionAny));
    CatalogFieldValueSet(c_gameCatalogEffect, "UnderworldSummonedBossStunDamage", "Amount", UnitGetOwner(libMapM_gv_mMUnderworldSummonedBoss[lp_team]), FixedToString(lv_damageStun, c_fixedPrecisionAny));
    CatalogFieldValueSet(c_gameCatalogEffect, "UnderworldSummonedBossRootsImpactDamage", "Amount", UnitGetOwner(libMapM_gv_mMUnderworldSummonedBoss[lp_team]), FixedToString(lv_damageRootImpact, c_fixedPrecisionAny));
    CatalogFieldValueSet(c_gameCatalogEffect, "UnderworldSummonedBossRootsSustainedDamage", "Amount", UnitGetOwner(libMapM_gv_mMUnderworldSummonedBoss[lp_team]), FixedToString(lv_damageRootSustain, c_fixedPrecisionAny));
    lv_enemyTeam = (3 - lp_team);
    if ((libMapM_gf_MMUnderworldSummonedBossBetter(lp_team) == true)) {
        libNtve_gf_SendActorMessageToUnit(libMapM_gv_mMUnderworldSummonedBoss[lp_team], "ModelSwap UnderworldSummonedBossBetter 1");
        lv_sizeScale = 120.0;
        UnitSetScale(libMapM_gv_mMUnderworldSummonedBoss[lp_team], lv_sizeScale, lv_sizeScale, lv_sizeScale);
    }
    else {
        if ((libMapM_gf_MMUnderworldSummonedBossBetter(lv_enemyTeam) == true)) {
            lv_sizeScale = 90.0;
            UnitSetScale(libMapM_gv_mMUnderworldSummonedBoss[lp_team], lv_sizeScale, lv_sizeScale, lv_sizeScale);
        }
        else {
            libNtve_gf_SendActorMessageToUnit(libMapM_gv_mMUnderworldSummonedBoss[lp_team], "ModelSwap UnderworldSummonedBossBetter 1");
            lv_sizeScale = 100.0;
            UnitSetScale(libMapM_gv_mMUnderworldSummonedBoss[lp_team], lv_sizeScale, lv_sizeScale, lv_sizeScale);
        }
    }
}

bool libMapM_gf_MMUnderworldSummonedBossBetter (int lp_team) {
    // Implementation
    if ((libMapM_gv_mMUnderworldSkullCollected[lp_team] > ((libMapM_gv_mMUnderworldSkullTotal + 0) / 2))) {
        return true;
    }
    else {
    }
    return false;
}

void libMapM_gf_MMUnderworldSummonBoss () {
    int autoF5122FDC_ae;
    int autoF5122FDC_ai;

    // Variable Declarations
    int lv_itTeam;
    const int lv_xOffset_C = 500;
    const int lv_yOffset_C = 40;

    // Variable Initialization

    // Implementation
    autoF5122FDC_ae = 2;
    autoF5122FDC_ai = 1;
    lv_itTeam = 1;
    for ( ; ( (autoF5122FDC_ai >= 0 && lv_itTeam <= autoF5122FDC_ae) || (autoF5122FDC_ai <= 0 && lv_itTeam >= autoF5122FDC_ae) ) ; lv_itTeam += autoF5122FDC_ai ) {
        libMapM_gf_MMUnderworldSummonBossForTeam(lv_itTeam);
    }
    TriggerExecute(libMapM_gt_MMUnderworldSummonedBossPingVisibility, true, false);
    TriggerExecute(libMapM_gt_MMUnderworldSummonedBossUIBar, true, false);
    while (!(((UnitIsAlive(libMapM_gv_mMUnderworldSummonedBoss[1]) == true) || (UnitIsAlive(libMapM_gv_mMUnderworldSummonedBoss[2]) == true)))) {
        Wait(0.0625, c_timeGame);
    }
    SoundtrackPlay(PlayerGroupAll(), c_soundtrackCategoryMusic, "Storm_Music_Mines_Golems_Event", c_soundtrackCueAny, c_soundtrackIndexAny, true);
    if ((libMapM_gv_mMUnderworldSummonedBossRevive == false)) {
        libMapM_gv_mMUnderworldSummonedBossRevive = true;
        if (((libMapM_gv_mMUnderworldSkullCollected[1] - libMapM_gv_mMUnderworldSkullCollected[2]) >= 5)) {
            libMapM_gf_MMUnderworldTransmissionGolemSummonedStrongerQ(libGame_gf_PlayersOnTeamHeroes(1, false));
            libMapM_gf_MMUnderworldTransmissionGolemSummonedWeakerQ(libGame_gf_PlayersOnTeamHeroes(2, false));
        }
        else if (((libMapM_gv_mMUnderworldSkullCollected[1] - libMapM_gv_mMUnderworldSkullCollected[2]) <= -5)) {
            libMapM_gf_MMUnderworldTransmissionGolemSummonedWeakerQ(libGame_gf_PlayersOnTeamHeroes(1, false));
            libMapM_gf_MMUnderworldTransmissionGolemSummonedStrongerQ(libGame_gf_PlayersOnTeamHeroes(2, false));
        }
        else if (true) {
            libMapM_gf_MMUnderworldTransmissionGolemSummonedSameQ(libGame_gf_PlayersOnTeamHeroes(1, false));
            libMapM_gf_MMUnderworldTransmissionGolemSummonedSameQ(libGame_gf_PlayersOnTeamHeroes(2, false));
        }
        libMapM_gf_MMUnderworldTransmissionGolemReviveObserverQ();
    }
    else {
        if (((libMapM_gv_mMUnderworldSkullCollected[1] - libMapM_gv_mMUnderworldSkullCollected[2]) >= 5)) {
            libMapM_gf_MMUnderworldTransmissionGolemRevivedStrongerQ(libGame_gf_PlayersOnTeamHeroes(1, false));
            libMapM_gf_MMUnderworldTransmissionGolemRevivedWeakerQ(libGame_gf_PlayersOnTeamHeroes(2, false));
        }
        else if (((libMapM_gv_mMUnderworldSkullCollected[1] - libMapM_gv_mMUnderworldSkullCollected[2]) <= -5)) {
            libMapM_gf_MMUnderworldTransmissionGolemRevivedWeakerQ(libGame_gf_PlayersOnTeamHeroes(1, false));
            libMapM_gf_MMUnderworldTransmissionGolemRevivedStrongerQ(libGame_gf_PlayersOnTeamHeroes(2, false));
        }
        else if (true) {
            libMapM_gf_MMUnderworldTransmissionGolemRevivedSameQ(libGame_gf_PlayersOnTeamHeroes(1, false));
            libMapM_gf_MMUnderworldTransmissionGolemRevivedSameQ(libGame_gf_PlayersOnTeamHeroes(2, false));
        }
        libMapM_gf_MMUnderworldTransmissionGolemReviveObserverQ();
    }
}

trigger auto_libMapM_gf_MMUnderworldSummonBossForTeam_Trigger = null;
int auto_libMapM_gf_MMUnderworldSummonBossForTeam_lp_team;

void libMapM_gf_MMUnderworldSummonBossForTeam (int lp_team) {
    auto_libMapM_gf_MMUnderworldSummonBossForTeam_lp_team = lp_team;

    if (auto_libMapM_gf_MMUnderworldSummonBossForTeam_Trigger == null) {
        auto_libMapM_gf_MMUnderworldSummonBossForTeam_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldSummonBossForTeam_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldSummonBossForTeam_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldSummonBossForTeam_TriggerFunc (bool testConds, bool runActions) {
    int lp_team = auto_libMapM_gf_MMUnderworldSummonBossForTeam_lp_team;

    playergroup auto69420B69_g;
    int auto69420B69_p;
    int autoF2FABE67_val;
    int autoD5504BD3_val;

    // Variable Declarations
    int lv_itPlayer;
    int lv_pingPreSpawn1;
    int lv_pingPreSpawn2;
    int lv_pingPreSpawnObserver;
    int lv_enemyTeam;
    actor lv_effect;
    unit lv_itSummonedUnit;
    int lv_ownerPlayer;

    // Variable Initialization
    lv_pingPreSpawn1 = c_invalidPingId;
    lv_pingPreSpawn2 = c_invalidPingId;
    lv_pingPreSpawnObserver = c_invalidPingId;

    // Implementation
    lv_enemyTeam = (3 - lp_team);
    auto69420B69_g = libGame_gf_PlayersOnTeamHeroes(lp_team, false); 
    auto69420B69_p = 1;
    for ( ; auto69420B69_p <= PlayerGroupCount(auto69420B69_g) ; auto69420B69_p += BoolToInt(lv_itPlayer == PlayerGroupPlayer(auto69420B69_g, auto69420B69_p)) ) {
        lv_itPlayer = PlayerGroupPlayer(auto69420B69_g, auto69420B69_p);
        VisRevealArea(lv_itPlayer, RegionCircle(libMapM_gv_mMUnderworldSummonedBossLocation[lp_team], 10.0), (libMapM_gv_mMUnderworldSummonedBossDuration_C + 5.0), true);
    }
    libGame_gf_CalculateSpawnedMinionGoalPoints(libGame_gf_ComputerPlayerInTeam(lp_team), libMapM_gv_mMUnderworldSummonedBossLocation[lp_team]);
    libGame_gf_SendEventMapUnderworldBossStartSummoning(lp_team, libMapM_gv_mMUnderworldSummonedBossLocation[lp_team], libGame_gv_spawnedMinionLane);
    libNtve_gf_CreateActorAtPoint("UnderworldSummonedBossSummonEffect", libMapM_gv_mMUnderworldSummonedBossLocation[lp_team]);
    lv_effect = libNtve_gf_ActorLastCreated();
    libMapM_gf_MMUnderworldSummonBossForTeamSound(lp_team);
    SoundPlayAtPointForPlayer(SoundLink("Event_Mines_Boss_Summon_Start", -1), c_maxPlayers, PlayerGroupAll(), libMapM_gv_mMUnderworldSummonedBossLocation[lp_team], 0.0, 100.0, 0.0);
    libNtve_gf_CreatePingFacingAngle(libGame_gf_PlayersOnTeamHeroes(lp_team, false), "StormPingAlert", libMapM_gv_mMUnderworldSummonedBossLocation[lp_team], ColorWithAlpha(0.00, 100.00, 0.00, 0.00), 0.0, 270.0);
    lv_pingPreSpawn1 = PingLastCreated();
    libNtve_gf_CreatePingFacingAngle(libGame_gf_PlayersOnTeamHeroes(lv_enemyTeam, false), "StormPingAlert", libMapM_gv_mMUnderworldSummonedBossLocation[lp_team], ColorWithAlpha(100.00, 0.00, 0.00, 0.00), 0.0, 270.0);
    lv_pingPreSpawn2 = PingLastCreated();
    autoF2FABE67_val = lp_team;
    if (autoF2FABE67_val == 1) {
        libNtve_gf_CreatePingFacingAngle(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], "StormPingAlert", libMapM_gv_mMUnderworldSummonedBossLocation[lp_team], libCore_gv_cOLORAllyColor, 0.0, 270.0);
        lv_pingPreSpawnObserver = PingLastCreated();
    }
    else if (autoF2FABE67_val == 2) {
        libNtve_gf_CreatePingFacingAngle(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], "StormPingAlert", libMapM_gv_mMUnderworldSummonedBossLocation[lp_team], libCore_gv_cOLOREnemyColor, 0.0, 270.0);
        lv_pingPreSpawnObserver = PingLastCreated();
    }
    else {
    }
    Wait(libMapM_gv_mMUnderworldSummonedBossDuration_C, c_timeGame);
    PingDestroy(lv_pingPreSpawn1);
    PingDestroy(lv_pingPreSpawn2);
    PingDestroy(lv_pingPreSpawnObserver);
    UnitRemove(libMapM_gv_mMUnderworldSummonedBossBody[lp_team]);
    libMapM_gv_mMUnderworldSummonedBossBody[lp_team] = null;
    libNtve_gf_UnitCreateFacingPoint(1, "UnderworldSummonedBoss", c_unitCreateIgnorePlacement, libGame_gf_ComputerPlayerInTeam(lp_team), libMapM_gv_mMUnderworldSummonedBossLocation[lp_team], UnitGetPosition(libGame_gv_teams[lv_enemyTeam].lv_core));
    libMapM_gv_mMUnderworldSummonedBoss[lp_team] = UnitLastCreated();
    libNtve_gf_PauseUnit(libMapM_gv_mMUnderworldSummonedBoss[lp_team], true);
    UnitSetState(libMapM_gv_mMUnderworldSummonedBoss[lp_team], c_unitStateTargetable, false);
    libNtve_gf_MakeUnitInvulnerable(libMapM_gv_mMUnderworldSummonedBoss[lp_team], true);
    UnitSetState(libMapM_gv_mMUnderworldSummonedBoss[lp_team], c_unitStateSelectable, false);
    UnitSetState(libMapM_gv_mMUnderworldSummonedBoss[lp_team], c_unitStateStatusBar, false);
    libNtve_gf_PlayAnimation(libNtve_gf_MainActorofUnit(UnitLastCreated()), c_animNameDefault, "Birth", c_animFlagNonLooping, c_animTimeDefault);
    libMapM_gf_MMUnderworldApplySummonedBossScaling(lp_team, false);
    libGame_gf_SendEventMapUnderworldBossSummoned(UnitLastCreated());
    StatEventCreate("GraveGolemSpawned");
    StatEventAddDataFixed(StatEventLastCreated(), "TeamID", lp_team);
    StatEventAddDataFixed(StatEventLastCreated(), "SkullCount", libMapM_gv_mMUnderworldSkullCollected[lp_team]);
    StatEventSend(StatEventLastCreated());
    UnitAbilityEnable(libMapM_gv_mMUnderworldSummonedBoss[lp_team], "UnderworldSummonedBossStun", false);
    UnitAbilityEnable(libMapM_gv_mMUnderworldSummonedBoss[lp_team], "UnderworldSummonedBossRoots", false);
    Wait(1.0, c_timeGame);
    if ((lv_effect != null)) {
        libNtve_gf_KillModel(lv_effect);
    }
    else {
    }
    PlayerCreateEffectPoint(UnitGetOwner(libMapM_gv_mMUnderworldSummonedBoss[lp_team]), "GolemSpawnKnockbackSearch", UnitGetPosition(libMapM_gv_mMUnderworldSummonedBoss[lp_team]));
    Wait(1.0, c_timeGame);
    UnitSetState(libMapM_gv_mMUnderworldSummonedBoss[lp_team], c_unitStateTargetable, true);
    libNtve_gf_MakeUnitInvulnerable(libMapM_gv_mMUnderworldSummonedBoss[lp_team], false);
    UnitSetState(libMapM_gv_mMUnderworldSummonedBoss[lp_team], c_unitStateSelectable, true);
    UnitSetState(libMapM_gv_mMUnderworldSummonedBoss[lp_team], c_unitStateStatusBar, true);
    lv_ownerPlayer = UnitGetOwner(libMapM_gv_mMUnderworldSummonedBoss[lp_team]);
    libGame_gf_CalculateSpawnedMinionGoalPoints(lv_ownerPlayer, UnitGetPosition(libMapM_gv_mMUnderworldSummonedBoss[lp_team]));
    libAIAI_gf_MinionAIStartMinionAI(libMapM_gv_mMUnderworldSummonedBoss[lp_team], libGame_gv_spawnedMinionLane, libGame_gv_spawnedMinionFirstWaypointIndex, false, true, 0);
    libNtve_gf_PauseUnit(libMapM_gv_mMUnderworldSummonedBoss[lp_team], false);
    libGame_gf_AnnouncementAddItemForPlayerGroup(libGame_gf_PlayersOnTeamHeroes(lp_team, false), 0, 0, "GraveGolemSummoned", StringExternal("Param/Value/lib_MapM_DCFFE823"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    if ((lp_team == 1)) {
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 0, 0, "GraveGolemSummoned", StringExternal("Param/Value/lib_MapM_F654EDA3"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    }
    else {
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 0, 0, "GraveGolemSummoned", StringExternal("Param/Value/lib_MapM_D9461192"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    }
    libNtve_gf_CreatePingFacingAngle(libGame_gf_PlayersOnTeamHeroes(lp_team, false), "StormPingBoss", UnitGetPosition(libMapM_gv_mMUnderworldSummonedBoss[lp_team]), ColorWithAlpha(0.00, 100.00, 0.00, 0.00), 0.0, 270.0);
    PingSetUnit(PingLastCreated(), libMapM_gv_mMUnderworldSummonedBoss[lp_team]);
    PingSetScale(PingLastCreated(), 0.75);
    libCore_gf_StorePingForUnit(libMapM_gv_mMUnderworldSummonedBoss[lp_team], lp_team, PingLastCreated());
    libNtve_gf_CreatePingFacingAngle(libGame_gf_PlayersOnTeamHeroes(lv_enemyTeam, false), "StormPingBoss", UnitGetPosition(libMapM_gv_mMUnderworldSummonedBoss[lp_team]), ColorWithAlpha(100.00, 0.00, 0.00, 0.00), 0.0, 270.0);
    PingSetUnit(PingLastCreated(), libMapM_gv_mMUnderworldSummonedBoss[lp_team]);
    PingSetScale(PingLastCreated(), 0.75);
    libCore_gf_StorePingForUnit(libMapM_gv_mMUnderworldSummonedBoss[lp_team], lv_enemyTeam, PingLastCreated());
    autoD5504BD3_val = lp_team;
    if (autoD5504BD3_val == 1) {
        libNtve_gf_CreatePingFacingAngle(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], "StormPingBoss", UnitGetPosition(libMapM_gv_mMUnderworldSummonedBoss[lp_team]), libCore_gv_cOLORAllyColor, 0.0, 270.0);
    }
    else if (autoD5504BD3_val == 1) {
        libNtve_gf_CreatePingFacingAngle(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], "StormPingBoss", UnitGetPosition(libMapM_gv_mMUnderworldSummonedBoss[lp_team]), libCore_gv_cOLOREnemyColor, 0.0, 270.0);
    }
    else {
    }
    PingSetUnit(PingLastCreated(), libMapM_gv_mMUnderworldSummonedBoss[lp_team]);
    PingSetScale(PingLastCreated(), 0.75);
    libCore_gf_StorePingForUnit(libMapM_gv_mMUnderworldSummonedBoss[lp_team], libCore_gv_oBSERVER_ObserverUIPlayer, PingLastCreated());
    Wait(3.0, c_timeGame);
    UnitAbilityEnable(libMapM_gv_mMUnderworldSummonedBoss[lp_team], "UnderworldSummonedBossStun", true);
    UnitAbilityEnable(libMapM_gv_mMUnderworldSummonedBoss[lp_team], "UnderworldSummonedBossRoots", true);
    UnitBehaviorAddPlayer(libMapM_gv_mMUnderworldSummonedBoss[lp_team], "UnderworldSummonedBossStunCastScan", UnitGetOwner(libMapM_gv_mMUnderworldSummonedBoss[lp_team]), 1);
    UnitBehaviorAddPlayer(libMapM_gv_mMUnderworldSummonedBoss[lp_team], "UnderworldSummonedBossRootsCastScan", UnitGetOwner(libMapM_gv_mMUnderworldSummonedBoss[lp_team]), 1);
    while (!((UnitIsAlive(libMapM_gv_mMUnderworldSummonedBoss[lp_team]) == false))) {
        Wait(1.0, c_timeGame);
    }
    PingDestroy(libCore_gf_PingStoredForUnit(libMapM_gv_mMUnderworldSummonedBoss[lp_team], 1));
    libCore_gf_StorePingForUnit(libMapM_gv_mMUnderworldSummonedBoss[lp_team], 1, c_invalidPingId);
    PingDestroy(libCore_gf_PingStoredForUnit(libMapM_gv_mMUnderworldSummonedBoss[lp_team], 2));
    libCore_gf_StorePingForUnit(libMapM_gv_mMUnderworldSummonedBoss[lp_team], 2, c_invalidPingId);
    PingDestroy(libCore_gf_PingStoredForUnit(libMapM_gv_mMUnderworldSummonedBoss[lp_team], libCore_gv_oBSERVER_ObserverUIPlayer));
    libCore_gf_StorePingForUnit(libMapM_gv_mMUnderworldSummonedBoss[lp_team], libCore_gv_oBSERVER_ObserverUIPlayer, c_invalidPingId);
    return true;
}

trigger auto_libMapM_gf_MMUnderworldSummonBossForTeamSound_Trigger = null;
int auto_libMapM_gf_MMUnderworldSummonBossForTeamSound_lp_team;

void libMapM_gf_MMUnderworldSummonBossForTeamSound (int lp_team) {
    auto_libMapM_gf_MMUnderworldSummonBossForTeamSound_lp_team = lp_team;

    if (auto_libMapM_gf_MMUnderworldSummonBossForTeamSound_Trigger == null) {
        auto_libMapM_gf_MMUnderworldSummonBossForTeamSound_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldSummonBossForTeamSound_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldSummonBossForTeamSound_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldSummonBossForTeamSound_TriggerFunc (bool testConds, bool runActions) {
    int lp_team = auto_libMapM_gf_MMUnderworldSummonBossForTeamSound_lp_team;

    // Implementation
    SoundPlayAtPointForPlayer(SoundLink("Event_Mines_Boss_Summon_Start", -1), c_maxPlayers, PlayerGroupAll(), libMapM_gv_mMUnderworldSummonedBossLocation[lp_team], 1.0, 100.0, 0.0);
    Wait(SoundLengthSync(SoundLink("Event_Mines_Boss_Summon_Start", -1)), c_timeGame);
    SoundPlayAtPointForPlayer(SoundLink("Event_Mines_Boss_Summon_Loop", -1), c_maxPlayers, PlayerGroupAll(), libMapM_gv_mMUnderworldSummonedBossLocation[lp_team], 1.0, 100.0, 0.0);
    Wait((libMapM_gv_mMUnderworldSummonedBossDuration_C - SoundLengthSync(SoundLink("Event_Mines_Boss_Summon_Start", -1))), c_timeGame);
    SoundStop(SoundLastPlayed(), true);
    SoundPlayForPlayer(SoundLink("Event_Mines_Boss_Summon_End", -1), c_maxPlayers, libGame_gf_PlayersOnTeamHeroes(lp_team, false), 100.0, 0.0);
    return true;
}

void libMapM_gf_MMUnderworldInit () {
    // Variable Declarations
    int lv_itIndexMinute;
    int lv_itPlayer;

    // Variable Initialization

    // Implementation
    TriggerEnable(libMapM_gt_MMUnderworldStartToEnterGates, true);
    TriggerEnable(libMapM_gt_MMUnderworldEnteringGates, true);
    TriggerEnable(libMapM_gt_MMUnderworldMinionDies, true);
    TriggerEnable(libMapM_gt_MMUnderworldOpenGatesTimerStarted, true);
    TriggerEnable(libMapM_gt_MMUnderworldGatesOpened, true);
    TriggerEnable(libMapM_gt_MMUnderworldSkullPickup, true);
    TriggerEnable(libMapM_gt_MMUnderworldCameraPanned, true);
    TriggerEnable(libMapM_gt_MMUnderworldSkullDropped, true);
    TriggerEnable(libMapM_gt_MMUnderworldUntargetableAcrossPlane, true);
    TriggerEnable(libMapM_gt_MMUnderworldPlayerHeroLocationTracking, true);
    TriggerEnable(libMapM_gt_MMUnderworldDebugStart, true);
    TriggerEnable(libMapM_gt_MMUnderworldDebugStart1, true);
    TriggerEnable(libMapM_gt_MMUnderworldDebugUnderworldClear, true);
    TriggerEnable(libMapM_gt_MMUnderworldDebugSummonBossScaling, true);
    TriggerEnable(libMapM_gt_MMUnderworldDebugPushEffect, true);
    libMapM_gf_MMUnderworldInitializeScalingDataForUnderworldHostileNPCs(0, "UnderworldMinionScaling");
    libMapM_gf_MMUnderworldInitializeScalingDataForUnderworldHostileNPCs(1, "UnderworldBossScaling");
    libMapM_gf_MMUnderworldSetScalingValue(2, 4, 700, 0, 5, 0, 0);
}

void libMapM_gf_MMUnderworldPrepare () {
    // Implementation
    TriggerEnable(libMapM_gt_MMUnderworldGatesOpened, false);
    TriggerExecute(libMapM_gt_MMUnderworldObjectiveUIHandler, true, false);
    libMapM_gf_MMUnderworldTransmissionUnderworldOpenQ(PlayerGroupAll());
    libMapM_gv_mMUnderworldMineOpenTimes += 1;
    TimerStart(libMapM_gv_mMUnderworldPrepTimer, libMapM_gv_mMUnderworldPrepDuration_C, false, c_timeGame);
}

void libMapM_gf_MMUnderworldStart () {
    unitgroup auto2F8D95FF_g;
    int auto2F8D95FF_u;

    // Variable Declarations
    unit lv_itGate;
    unit lv_itBush;
    int lv_itPlayer;
    int lv_cameraBoundsIndex;

    // Variable Initialization

    // Implementation
    libMapM_gf_MMUnderworldTransmissionUnderworldStartQ(PlayerGroupAll());
    libMapM_gv_mMUnderworldOpened = true;
    if ((libMapM_gv_mMUnderworldOpenFirstTime == true)) {
        auto2F8D95FF_g = libMapM_gv_mMUnderworldGatesAbove;
        auto2F8D95FF_u = 1;
        for ( ; auto2F8D95FF_u <= UnitGroupCount(auto2F8D95FF_g, c_unitCountAll) ; auto2F8D95FF_u += BoolToInt(lv_itGate == UnitGroupUnit(auto2F8D95FF_g, auto2F8D95FF_u)) ) {
            lv_itGate = UnitGroupUnit(auto2F8D95FF_g, auto2F8D95FF_u);
            libNtve_gf_ShowHideDoodadsInRegion(false, RegionCircle(UnitGetPosition(libMapM_gf_MMUnderworldGroundHole(lv_itGate)), 5.0), "Storm_KingsCrest_Emblem_RavenCourt");
            libNtve_gf_SendActorMessageToUnit(lv_itGate, "Signal MinesOpen");
            libNtve_gf_SendActorMessageToUnit(libMapM_gf_MMUnderworldGroundHole(lv_itGate), "Signal MinesOpen");
            libUIUI_gf_AttachHelpButtonToUnit(lv_itGate, libMapM_gt_MMHelpbuttonClicked, StringExternal("Param/Value/lib_MapM_1B3EE760"), 0, 275);
            UnitSetState(lv_itGate, c_unitStateHighlightable, true);
            UnitSetState(lv_itGate, c_unitStateTargetable, true);
            libNtve_gf_CreateUnitsWithDefaultFacing(1, "UnderworldMineEntranceMinimapIcon", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Neutral, UnitGetPosition(lv_itGate));
        }
    }
    else {
    }
    libMapM_gf_MMUnderworldTurnGroundHoleLightOnOff(true);
    TriggerEnable(libMapM_gt_MMUnderworldGroundHoleVision, true);
    TriggerExecute(libMapM_gt_MMUnderworldGatesPingHelper, true, false);
    libMapM_gv_mMUnderworldSkullCollected[1] = 0;
    libMapM_gv_mMUnderworldSkullCollected[2] = 0;
    libGame_gf_AnnouncementAddItemForPlayerGroup(PlayerGroupAll(), 0, 0, "UndeadSpawned", StringExternal("Param/Value/lib_MapM_1634A3BC"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    libMapM_gf_MMUnderworldSpawnMinions();
    TriggerEnable(libMapM_gt_MMUnderworldPlayerMovesCamera, true);
    TriggerExecute(libMapM_gt_MMUnderworldPlayerHeroLocationTracking, true, false);
    libMapM_gv_mMUnderworldOpenFirstTime = false;
    while (true) {
        if ((libMapM_gf_MMUnderworldCleared() == true)) {
            TriggerExecute(libMapM_gt_MMUnderworldCleared, true, false);
            return ;
        }
        else {
        }
        Wait(0.5, c_timeGame);
    }
}

void libMapM_gf_MMUnderworldObjectiveUIUpdateText () {
    // Variable Declarations
    int lv_indexTeam;
    int lv_indexTeamEnemy;

    // Variable Initialization

    // Implementation
    libUIUI_gf_MapMechanicsHauntedMinesSetSkullCountForTeam(libMapM_gv_mMUnderworldSkullCollected[libGame_gv_teamOrderIndex_C], libGame_gv_teamOrderIndex_C);
    libUIUI_gf_MapMechanicsHauntedMinesSetSkullCountForTeam(libMapM_gv_mMUnderworldSkullCollected[libGame_gv_teamChaosIndex_C], libGame_gv_teamChaosIndex_C);
}

void libMapM_gf_MMUnderworldShowHideMinimapSplit (bool lp_showHide, playergroup lp_players) {
    // Implementation
    DialogControlSetVisible(libMapM_gv_mMUnderworldMinimapSplit, lp_players, lp_showHide);
}

void libMapM_gf_MMUnderworldHookupMinimapSplit () {
    // Implementation
    if ((libMapM_gv_mMUnderworldMinimapSplit == c_invalidDialogControlId)) {
        DialogControlHookupStandard(c_triggerControlTypeImage, "UIContainer/ConsoleUIContainer/MinimapPanel/MinimapSplit");
        libMapM_gv_mMUnderworldMinimapSplit = DialogControlLastCreated();
    }
    else {
    }
}

trigger auto_libMapM_gf_MMUnderworldTransmissionUnderworldOpenQ_Trigger = null;
playergroup auto_libMapM_gf_MMUnderworldTransmissionUnderworldOpenQ_lp_players;

void libMapM_gf_MMUnderworldTransmissionUnderworldOpenQ (playergroup lp_players) {
    auto_libMapM_gf_MMUnderworldTransmissionUnderworldOpenQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMUnderworldTransmissionUnderworldOpenQ_Trigger == null) {
        auto_libMapM_gf_MMUnderworldTransmissionUnderworldOpenQ_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldTransmissionUnderworldOpenQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldTransmissionUnderworldOpenQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldTransmissionUnderworldOpenQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMUnderworldTransmissionUnderworldOpenQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    if ((libMapM_gv_mMUnderworldTransmissionUnderworldOpenFirstTime == true)) {
        libMapM_gv_mMUnderworldTransmissionUnderworldOpenFirstTime = false;
        TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("CreepVO_Necromancer_261", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, 11);
    }
    else {
        TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("CavernsOpen", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    }
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMUnderworldTransmissionUnderworldStartQ_Trigger = null;
playergroup auto_libMapM_gf_MMUnderworldTransmissionUnderworldStartQ_lp_players;

void libMapM_gf_MMUnderworldTransmissionUnderworldStartQ (playergroup lp_players) {
    auto_libMapM_gf_MMUnderworldTransmissionUnderworldStartQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMUnderworldTransmissionUnderworldStartQ_Trigger == null) {
        auto_libMapM_gf_MMUnderworldTransmissionUnderworldStartQ_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldTransmissionUnderworldStartQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldTransmissionUnderworldStartQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldTransmissionUnderworldStartQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMUnderworldTransmissionUnderworldStartQ_lp_players;

    // Variable Declarations
    int lv_randomIndex;
    const int lv_randomMax = 3;

    // Variable Initialization

    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("UndeadSpawn", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMUnderworldTransmissionUnderworldClearedQ_Trigger = null;
playergroup auto_libMapM_gf_MMUnderworldTransmissionUnderworldClearedQ_lp_players;

void libMapM_gf_MMUnderworldTransmissionUnderworldClearedQ (playergroup lp_players) {
    auto_libMapM_gf_MMUnderworldTransmissionUnderworldClearedQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMUnderworldTransmissionUnderworldClearedQ_Trigger == null) {
        auto_libMapM_gf_MMUnderworldTransmissionUnderworldClearedQ_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldTransmissionUnderworldClearedQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldTransmissionUnderworldClearedQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldTransmissionUnderworldClearedQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMUnderworldTransmissionUnderworldClearedQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("UndeadCleared", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedStrongerQ_Trigger = null;
playergroup auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedStrongerQ_lp_players;

void libMapM_gf_MMUnderworldTransmissionGolemSummonedStrongerQ (playergroup lp_players) {
    auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedStrongerQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedStrongerQ_Trigger == null) {
        auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedStrongerQ_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedStrongerQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedStrongerQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedStrongerQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedStrongerQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("CreepVO_Necromancer_271", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedStrongerQ_Trigger = null;
playergroup auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedStrongerQ_lp_players;

void libMapM_gf_MMUnderworldTransmissionGolemRevivedStrongerQ (playergroup lp_players) {
    auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedStrongerQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedStrongerQ_Trigger == null) {
        auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedStrongerQ_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedStrongerQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedStrongerQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedStrongerQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedStrongerQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GolemReviveStrong", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedWeakerQ_Trigger = null;
playergroup auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedWeakerQ_lp_players;

void libMapM_gf_MMUnderworldTransmissionGolemSummonedWeakerQ (playergroup lp_players) {
    auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedWeakerQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedWeakerQ_Trigger == null) {
        auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedWeakerQ_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedWeakerQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedWeakerQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedWeakerQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedWeakerQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("CreepVO_Necromancer_272", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedObserverQ_Trigger = null;

void libMapM_gf_MMUnderworldTransmissionGolemSummonedObserverQ () {
    if (auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedObserverQ_Trigger == null) {
        auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedObserverQ_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedObserverQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedObserverQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedObserverQ_TriggerFunc (bool testConds, bool runActions) {
    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(PlayerGroupSingle(libCore_gv_oBSERVER_ObserverUIPlayer), TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GolemRevive_Observer", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedWeakerQ_Trigger = null;
playergroup auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedWeakerQ_lp_players;

void libMapM_gf_MMUnderworldTransmissionGolemRevivedWeakerQ (playergroup lp_players) {
    auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedWeakerQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedWeakerQ_Trigger == null) {
        auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedWeakerQ_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedWeakerQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedWeakerQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedWeakerQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedWeakerQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GolemReviveWeak", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedSameQ_Trigger = null;
playergroup auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedSameQ_lp_players;

void libMapM_gf_MMUnderworldTransmissionGolemSummonedSameQ (playergroup lp_players) {
    auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedSameQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedSameQ_Trigger == null) {
        auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedSameQ_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedSameQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedSameQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedSameQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMUnderworldTransmissionGolemSummonedSameQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("CreepVO_Necromancer_273", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedSameQ_Trigger = null;
playergroup auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedSameQ_lp_players;

void libMapM_gf_MMUnderworldTransmissionGolemRevivedSameQ (playergroup lp_players) {
    auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedSameQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedSameQ_Trigger == null) {
        auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedSameQ_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedSameQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedSameQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedSameQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMUnderworldTransmissionGolemRevivedSameQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GolemReviveEqual", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMUnderworldTransmissionGolemReviveObserverQ_Trigger = null;

void libMapM_gf_MMUnderworldTransmissionGolemReviveObserverQ () {
    if (auto_libMapM_gf_MMUnderworldTransmissionGolemReviveObserverQ_Trigger == null) {
        auto_libMapM_gf_MMUnderworldTransmissionGolemReviveObserverQ_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldTransmissionGolemReviveObserverQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldTransmissionGolemReviveObserverQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldTransmissionGolemReviveObserverQ_TriggerFunc (bool testConds, bool runActions) {
    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(PlayerGroupSingle(libCore_gv_oBSERVER_ObserverUIPlayer), TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GolemRevive_Observer", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMUnderworldTransmissionOurGolemDefeatedQ_Trigger = null;
playergroup auto_libMapM_gf_MMUnderworldTransmissionOurGolemDefeatedQ_lp_players;

void libMapM_gf_MMUnderworldTransmissionOurGolemDefeatedQ (playergroup lp_players) {
    auto_libMapM_gf_MMUnderworldTransmissionOurGolemDefeatedQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMUnderworldTransmissionOurGolemDefeatedQ_Trigger == null) {
        auto_libMapM_gf_MMUnderworldTransmissionOurGolemDefeatedQ_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldTransmissionOurGolemDefeatedQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldTransmissionOurGolemDefeatedQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldTransmissionOurGolemDefeatedQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMUnderworldTransmissionOurGolemDefeatedQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GolemDefeated", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

trigger auto_libMapM_gf_MMUnderworldTransmissionEnemyGolemDefeatedQ_Trigger = null;
playergroup auto_libMapM_gf_MMUnderworldTransmissionEnemyGolemDefeatedQ_lp_players;

void libMapM_gf_MMUnderworldTransmissionEnemyGolemDefeatedQ (playergroup lp_players) {
    auto_libMapM_gf_MMUnderworldTransmissionEnemyGolemDefeatedQ_lp_players = lp_players;

    if (auto_libMapM_gf_MMUnderworldTransmissionEnemyGolemDefeatedQ_Trigger == null) {
        auto_libMapM_gf_MMUnderworldTransmissionEnemyGolemDefeatedQ_Trigger = TriggerCreate("auto_libMapM_gf_MMUnderworldTransmissionEnemyGolemDefeatedQ_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMUnderworldTransmissionEnemyGolemDefeatedQ_Trigger, false, false);
}

bool auto_libMapM_gf_MMUnderworldTransmissionEnemyGolemDefeatedQ_TriggerFunc (bool testConds, bool runActions) {
    playergroup lp_players = auto_libMapM_gf_MMUnderworldTransmissionEnemyGolemDefeatedQ_lp_players;

    // Implementation
    TriggerQueueEnter();
    TransmissionSendForPlayer(lp_players, TransmissionSource(), c_invalidPortraitId, "", "Talk", SoundLink("GolemDefeatedEnemy", c_soundIndexAny), null, null, 0.0, c_transmissionDurationAdd, true, c_maxPlayers);
    TriggerQueueExit();
    return true;
}

void libMapM_gf_MMHoCLivingTreesInitializeLivingTreesArray () {
    unitgroup auto466B25EA_g;
    int auto466B25EA_u;
    unitgroup autoA6DA5016_g;
    int autoA6DA5016_u;
    unitgroup auto4F880D75_g;
    int auto4F880D75_u;
    unitgroup auto916F650C_g;
    int auto916F650C_u;
    unitgroup auto7416F5E5_g;
    int auto7416F5E5_u;

    // Variable Declarations
    unit lv_tree;
    int lv_i;

    // Variable Initialization

    // Implementation
    libMapM_gv_mMHoCLivingTreesNumberofLivingTrees = 0;
    auto466B25EA_g = UnitGroup("StormAshenvaleForestBlocker1x1", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    auto466B25EA_u = 1;
    for ( ; auto466B25EA_u <= UnitGroupCount(auto466B25EA_g, c_unitCountAll) ; auto466B25EA_u += BoolToInt(lv_tree == UnitGroupUnit(auto466B25EA_g, auto466B25EA_u)) ) {
        lv_tree = UnitGroupUnit(auto466B25EA_g, auto466B25EA_u);
        lv_i += 1;
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_treeUnit = lv_tree;
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_treeType = UnitGetType(lv_tree);
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_location = UnitGetPosition(lv_tree);
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_facing = UnitGetFacing(lv_tree);
    }
    autoA6DA5016_g = UnitGroup("StormAshenvaleForestBlocker1x1Diagonal", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    autoA6DA5016_u = 1;
    for ( ; autoA6DA5016_u <= UnitGroupCount(autoA6DA5016_g, c_unitCountAll) ; autoA6DA5016_u += BoolToInt(lv_tree == UnitGroupUnit(autoA6DA5016_g, autoA6DA5016_u)) ) {
        lv_tree = UnitGroupUnit(autoA6DA5016_g, autoA6DA5016_u);
        lv_i += 1;
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_treeUnit = lv_tree;
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_treeType = UnitGetType(lv_tree);
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_location = UnitGetPosition(lv_tree);
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_facing = UnitGetFacing(lv_tree);
    }
    auto4F880D75_g = UnitGroup("StormAshenvaleForestBlocker2x2", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    auto4F880D75_u = 1;
    for ( ; auto4F880D75_u <= UnitGroupCount(auto4F880D75_g, c_unitCountAll) ; auto4F880D75_u += BoolToInt(lv_tree == UnitGroupUnit(auto4F880D75_g, auto4F880D75_u)) ) {
        lv_tree = UnitGroupUnit(auto4F880D75_g, auto4F880D75_u);
        lv_i += 1;
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_treeUnit = lv_tree;
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_treeType = UnitGetType(lv_tree);
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_location = UnitGetPosition(lv_tree);
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_facing = UnitGetFacing(lv_tree);
    }
    auto916F650C_g = UnitGroup("StormAshenvaleForestBlocker3x3", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    auto916F650C_u = 1;
    for ( ; auto916F650C_u <= UnitGroupCount(auto916F650C_g, c_unitCountAll) ; auto916F650C_u += BoolToInt(lv_tree == UnitGroupUnit(auto916F650C_g, auto916F650C_u)) ) {
        lv_tree = UnitGroupUnit(auto916F650C_g, auto916F650C_u);
        lv_i += 1;
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_treeUnit = lv_tree;
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_treeType = UnitGetType(lv_tree);
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_location = UnitGetPosition(lv_tree);
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_facing = UnitGetFacing(lv_tree);
    }
    auto7416F5E5_g = UnitGroup("StormAshenvaleForestBlocker6x6", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    auto7416F5E5_u = 1;
    for ( ; auto7416F5E5_u <= UnitGroupCount(auto7416F5E5_g, c_unitCountAll) ; auto7416F5E5_u += BoolToInt(lv_tree == UnitGroupUnit(auto7416F5E5_g, auto7416F5E5_u)) ) {
        lv_tree = UnitGroupUnit(auto7416F5E5_g, auto7416F5E5_u);
        lv_i += 1;
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_treeUnit = lv_tree;
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_treeType = UnitGetType(lv_tree);
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_location = UnitGetPosition(lv_tree);
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_facing = UnitGetFacing(lv_tree);
    }
    libMapM_gv_mMHoCLivingTreesNumberofLivingTrees = lv_i;
}

void libMapM_gf_MMHoCForestInitializeForestsArray () {
    int autoA60ED65D_ae;
    int autoA60ED65D_ai;
    int autoA6C9A99D_ae;
    int autoA6C9A99D_ai;
    int auto8043FF30_ae;
    int auto8043FF30_ai;
    int auto296BE7CE_ae;
    int auto296BE7CE_ai;

    // Variable Declarations
    int lv_forest;
    int lv_ancient;
    int lv_lane;
    int lv_waypoint;

    // Variable Initialization

    // Implementation
    autoA60ED65D_ae = libMapM_gv_mMHoCForestNumberofForests;
    autoA60ED65D_ai = 1;
    lv_forest = 1;
    for ( ; ( (autoA60ED65D_ai >= 0 && lv_forest <= autoA60ED65D_ae) || (autoA60ED65D_ai <= 0 && lv_forest >= autoA60ED65D_ae) ) ; lv_forest += autoA60ED65D_ai ) {
        autoA6C9A99D_ae = libGame_gv_laneCount;
        autoA6C9A99D_ai = 1;
        lv_lane = 1;
        for ( ; ( (autoA6C9A99D_ai >= 0 && lv_lane <= autoA6C9A99D_ae) || (autoA6C9A99D_ai <= 0 && lv_lane >= autoA6C9A99D_ae) ) ; lv_lane += autoA6C9A99D_ai ) {
            auto8043FF30_ae = libGame_gv_laneData[lv_lane].lv_waypointCount;
            auto8043FF30_ai = 1;
            lv_waypoint = 1;
            for ( ; ( (auto8043FF30_ai >= 0 && lv_waypoint <= auto8043FF30_ae) || (auto8043FF30_ai <= 0 && lv_waypoint >= auto8043FF30_ae) ) ; lv_waypoint += auto8043FF30_ai ) {
                if ((libGame_gv_laneData[lv_lane].lv_waypoints[lv_waypoint] == libMapM_gv_mMHoCForests[lv_forest].lv_mapDataLaneAggroPointOrder)) {
                    libMapM_gv_mMHoCForests[lv_forest].lv_orderAggroLane = lv_lane;
                    libMapM_gv_mMHoCForests[lv_forest].lv_orderAggroWaypointIndex = lv_waypoint;
                }
                else {
                }
                if ((libGame_gv_laneData[lv_lane].lv_waypoints[lv_waypoint] == libMapM_gv_mMHoCForests[lv_forest].lv_mapDataLaneAggroPointChaos)) {
                    libMapM_gv_mMHoCForests[lv_forest].lv_chaosAggroLane = lv_lane;
                    libMapM_gv_mMHoCForests[lv_forest].lv_chaosAggroWaypointIndex = lv_waypoint;
                }
                else {
                }
            }
        }
        ActorRegionCreate(null, "TriggerRegion", libMapM_gv_mMHoCForests[lv_forest].lv_mapDataRegion);
        libMapM_gv_mMHoCForests[lv_forest].lv_actorRegion = libNtve_gf_ActorLastCreated();
        auto296BE7CE_ae = libMapM_gv_mMHoCForests[lv_forest].lv_mapDataNumberofAncients;
        auto296BE7CE_ai = 1;
        lv_ancient = 1;
        for ( ; ( (auto296BE7CE_ai >= 0 && lv_ancient <= auto296BE7CE_ae) || (auto296BE7CE_ai <= 0 && lv_ancient >= auto296BE7CE_ae) ) ; lv_ancient += auto296BE7CE_ai ) {
            libMapM_gv_mMHoCForests[lv_forest].lv_ancientsUnitTypes[lv_ancient] = UnitGetType(libMapM_gv_mMHoCForests[lv_forest].lv_mapDataAncients[lv_ancient]);
            libMapM_gv_mMHoCForests[lv_forest].lv_ancientsPoints[lv_ancient] = UnitGetPosition(libMapM_gv_mMHoCForests[lv_forest].lv_mapDataAncients[lv_ancient]);
            libMapM_gv_mMHoCForests[lv_forest].lv_ancientsFacings[lv_ancient] = UnitGetFacing(libMapM_gv_mMHoCForests[lv_forest].lv_mapDataAncients[lv_ancient]);
        }
    }
}

trigger auto_libMapM_gf_MMHoCLivingTreesRemoveAlltheTrees_Trigger = null;

void libMapM_gf_MMHoCLivingTreesRemoveAlltheTrees () {
    if (auto_libMapM_gf_MMHoCLivingTreesRemoveAlltheTrees_Trigger == null) {
        auto_libMapM_gf_MMHoCLivingTreesRemoveAlltheTrees_Trigger = TriggerCreate("auto_libMapM_gf_MMHoCLivingTreesRemoveAlltheTrees_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMHoCLivingTreesRemoveAlltheTrees_Trigger, false, false);
}

bool auto_libMapM_gf_MMHoCLivingTreesRemoveAlltheTrees_TriggerFunc (bool testConds, bool runActions) {
    int auto63BA1F33_ae;
    int auto63BA1F33_ai;

    // Variable Declarations
    int lv_i;

    // Variable Initialization

    // Implementation
    auto63BA1F33_ae = libMapM_gv_mMHoCLivingTreesNumberofLivingTrees;
    auto63BA1F33_ai = 1;
    lv_i = 1;
    for ( ; ( (auto63BA1F33_ai >= 0 && lv_i <= auto63BA1F33_ae) || (auto63BA1F33_ai <= 0 && lv_i >= auto63BA1F33_ae) ) ; lv_i += auto63BA1F33_ai ) {
        UnitRemove(libMapM_gv_mMHoCLivingTrees[lv_i].lv_treeUnit);
    }
    return true;
}

trigger auto_libMapM_gf_MMHoCForestRegrowth_Trigger = null;

void libMapM_gf_MMHoCForestRegrowth () {
    if (auto_libMapM_gf_MMHoCForestRegrowth_Trigger == null) {
        auto_libMapM_gf_MMHoCForestRegrowth_Trigger = TriggerCreate("auto_libMapM_gf_MMHoCForestRegrowth_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMHoCForestRegrowth_Trigger, false, false);
}

bool auto_libMapM_gf_MMHoCForestRegrowth_TriggerFunc (bool testConds, bool runActions) {
    // Implementation
    libMapM_gf_MMHoCLivingTreesRegrowthWarning();
    Wait(libMapM_gv_mMHoCForestRegrowthWarningTime, c_timeGame);
    libMapM_gf_MMHoCLivingTreesClearOuttheForestAreas();
    libMapM_gf_MMHoCLivingTreesRemaketheTreesandAncients();
    return true;
}

void libMapM_gf_MMHoCLivingTreesRegrowthWarning () {
    int autoE7085641_ae;
    int autoE7085641_ai;

    // Variable Declarations
    int lv_forest;

    // Variable Initialization

    // Implementation
    UIDisplayMessage(libCore_gv_teamOrder, c_messageAreaDirective, TextExpressionAssemble("Param/Expression/lib_MapM_A8CDC3CE"));
    UIDisplayMessage(libCore_gv_teamChaos, c_messageAreaDirective, TextExpressionAssemble("Param/Expression/lib_MapM_62CF8A7E"));
    UIDisplayMessage(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], c_messageAreaDirective, TextExpressionAssemble("Param/Expression/lib_MapM_77B68C17"));
    autoE7085641_ae = libMapM_gv_mMHoCForestNumberofForests;
    autoE7085641_ai = 1;
    lv_forest = 1;
    for ( ; ( (autoE7085641_ai >= 0 && lv_forest <= autoE7085641_ae) || (autoE7085641_ai <= 0 && lv_forest >= autoE7085641_ae) ) ; lv_forest += autoE7085641_ai ) {
        libNtve_gf_CreateActorAtPoint("StormAshenvaleForestRegrowthWarning", RegionGetCenter(libMapM_gv_mMHoCForests[lv_forest].lv_mapDataRegion));
    }
}

void libMapM_gf_MMHoCLivingTreesClearOuttheForestAreas () {
    int auto1221AED2_ae;
    int auto1221AED2_ai;
    unitgroup auto8500FAE7_g;
    int auto8500FAE7_u;

    // Variable Declarations
    int lv_forest;
    unit lv_u;
    point lv_pushOutPoint;

    // Variable Initialization

    // Implementation
    auto1221AED2_ae = libMapM_gv_mMHoCForestNumberofForests;
    auto1221AED2_ai = 1;
    lv_forest = 1;
    for ( ; ( (auto1221AED2_ai >= 0 && lv_forest <= auto1221AED2_ae) || (auto1221AED2_ai <= 0 && lv_forest >= auto1221AED2_ae) ) ; lv_forest += auto1221AED2_ai ) {
        auto8500FAE7_g = UnitGroup(null, c_playerAny, libMapM_gv_mMHoCForests[lv_forest].lv_mapDataRegion, UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
        auto8500FAE7_u = 1;
        for ( ; auto8500FAE7_u <= UnitGroupCount(auto8500FAE7_g, c_unitCountAll) ; auto8500FAE7_u += BoolToInt(lv_u == UnitGroupUnit(auto8500FAE7_g, auto8500FAE7_u)) ) {
            lv_u = UnitGroupUnit(auto8500FAE7_g, auto8500FAE7_u);
            if ((UnitTypeTestAttribute(UnitGetType(lv_u), c_unitAttributeHeroic) == true)) {
                lv_pushOutPoint = UnitTypePlacementFromPoint(UnitGetType(lv_u), UnitGetOwner(lv_u), UnitGetPosition(lv_u), libGame_gv_bALFlyerDismountPlacementRange);
                UnitSetPosition(lv_u, lv_pushOutPoint, false);
            }
            else {
                UnitKill(lv_u);
            }
        }
    }
}

void libMapM_gf_MMHoCLivingTreesRemaketheTreesandAncients () {
    int auto9CC0B5BD_ae;
    int auto9CC0B5BD_ai;
    int auto28F0C959_ae;
    int auto28F0C959_ai;
    int auto2F4704C9_ae;
    int auto2F4704C9_ai;

    // Variable Declarations
    int lv_i;
    int lv_forest;
    int lv_ancient;

    // Variable Initialization

    // Implementation
    auto9CC0B5BD_ae = libMapM_gv_mMHoCLivingTreesNumberofLivingTrees;
    auto9CC0B5BD_ai = 1;
    lv_i = 1;
    for ( ; ( (auto9CC0B5BD_ai >= 0 && lv_i <= auto9CC0B5BD_ae) || (auto9CC0B5BD_ai <= 0 && lv_i >= auto9CC0B5BD_ae) ) ; lv_i += auto9CC0B5BD_ai ) {
        UnitCreate(1, libMapM_gv_mMHoCLivingTrees[lv_i].lv_treeType, c_unitCreateIgnorePlacement, 0, libMapM_gv_mMHoCLivingTrees[lv_i].lv_location, libMapM_gv_mMHoCLivingTrees[lv_i].lv_facing);
        libMapM_gv_mMHoCLivingTrees[lv_i].lv_treeUnit = UnitLastCreated();
    }
    auto28F0C959_ae = libMapM_gv_mMHoCForestNumberofForests;
    auto28F0C959_ai = 1;
    lv_forest = 1;
    for ( ; ( (auto28F0C959_ai >= 0 && lv_forest <= auto28F0C959_ae) || (auto28F0C959_ai <= 0 && lv_forest >= auto28F0C959_ae) ) ; lv_forest += auto28F0C959_ai ) {
        ActorRegionSend(libMapM_gv_mMHoCForests[lv_forest].lv_actorRegion, c_actorIntersectAgainstCenter, "AnimClear Death", "Doodad", "");
        ActorRegionSend(libMapM_gv_mMHoCForests[lv_forest].lv_actorRegion, c_actorIntersectAgainstCenter, "AnimPlay Birth Birth", "Doodad", "");
        auto2F4704C9_ae = libMapM_gv_mMHoCForests[lv_forest].lv_mapDataNumberofAncients;
        auto2F4704C9_ai = 1;
        lv_ancient = 1;
        for ( ; ( (auto2F4704C9_ai >= 0 && lv_ancient <= auto2F4704C9_ae) || (auto2F4704C9_ai <= 0 && lv_ancient >= auto2F4704C9_ae) ) ; lv_ancient += auto2F4704C9_ai ) {
            UnitCreate(1, libMapM_gv_mMHoCForests[lv_forest].lv_ancientsUnitTypes[lv_ancient], c_unitCreateIgnorePlacement, 0, libMapM_gv_mMHoCForests[lv_forest].lv_ancientsPoints[lv_ancient], libMapM_gv_mMHoCForests[lv_forest].lv_ancientsFacings[lv_ancient]);
            libMapM_gv_mMHoCForests[lv_forest].lv_mapDataAncients[lv_ancient] = UnitLastCreated();
        }
    }
}

void libMapM_gf_MMHoCForestActivated (int lp_camp, int lp_owner) {
    int auto1F6FD573_ae;
    int auto1F6FD573_ai;

    // Variable Declarations
    int lv_forest;

    // Variable Initialization

    // Implementation
    libMapM_gf_MMHoCLivingTreesRemoveAlltheTrees();
    SoundPlayForPlayer(SoundLink("StormAshenvaleHornofCenarius", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);
    if ((lp_owner == libCore_gv_cOMPUTER_TeamOrder)) {
        UIDisplayMessage(libCore_gv_teamOrder, c_messageAreaDirective, TextExpressionAssemble("Param/Expression/lib_MapM_570123DA"));
        UIDisplayMessage(libCore_gv_teamChaos, c_messageAreaDirective, TextExpressionAssemble("Param/Expression/lib_MapM_0B837E9D"));
        UIDisplayMessage(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], c_messageAreaDirective, TextExpressionAssemble("Param/Expression/lib_MapM_7337ABBE"));
    }
    else {
        UIDisplayMessage(libCore_gv_teamOrder, c_messageAreaDirective, TextExpressionAssemble("Param/Expression/lib_MapM_0C957170"));
        UIDisplayMessage(libCore_gv_teamChaos, c_messageAreaDirective, TextExpressionAssemble("Param/Expression/lib_MapM_DB8BA93B"));
        UIDisplayMessage(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], c_messageAreaDirective, TextExpressionAssemble("Param/Expression/lib_MapM_33B45634"));
    }
    libMapM_gv_mMHoCForestActiveAncients = UnitGroupEmpty();
    auto1F6FD573_ae = libMapM_gv_mMHoCForestNumberofForests;
    auto1F6FD573_ai = 1;
    lv_forest = 1;
    for ( ; ( (auto1F6FD573_ai >= 0 && lv_forest <= auto1F6FD573_ae) || (auto1F6FD573_ai <= 0 && lv_forest >= auto1F6FD573_ae) ) ; lv_forest += auto1F6FD573_ai ) {
        libMapM_gf_MMHoCForestDestroyForestsTrees(lv_forest);
        libMapM_gf_MMHoCForestActivateAncientsforForest(lp_camp, lp_owner, lv_forest);
    }
    TriggerEnable(libMapM_gt_MMHoCForestAncientDies, true);
}

trigger auto_libMapM_gf_MMHoCForestDestroyForestsTrees_Trigger = null;
int auto_libMapM_gf_MMHoCForestDestroyForestsTrees_lp_forest;

void libMapM_gf_MMHoCForestDestroyForestsTrees (int lp_forest) {
    auto_libMapM_gf_MMHoCForestDestroyForestsTrees_lp_forest = lp_forest;

    if (auto_libMapM_gf_MMHoCForestDestroyForestsTrees_Trigger == null) {
        auto_libMapM_gf_MMHoCForestDestroyForestsTrees_Trigger = TriggerCreate("auto_libMapM_gf_MMHoCForestDestroyForestsTrees_TriggerFunc");
    }

    TriggerExecute(auto_libMapM_gf_MMHoCForestDestroyForestsTrees_Trigger, false, false);
}

bool auto_libMapM_gf_MMHoCForestDestroyForestsTrees_TriggerFunc (bool testConds, bool runActions) {
    int lp_forest = auto_libMapM_gf_MMHoCForestDestroyForestsTrees_lp_forest;

    // Implementation
    ActorRegionSend(libMapM_gv_mMHoCForests[lp_forest].lv_actorRegion, c_actorIntersectAgainstCenter, "AnimPlay Death Death PlayForever,NonLooping", "Doodad", "");
    return true;
}

void libMapM_gf_MMHoCForestActivateAncientsforForest (int lp_camp, int lp_owner, int lp_forest) {
    int autoE968D45F_ae;
    int autoE968D45F_ai;

    // Variable Declarations
    int lv_i;
    int lv_team;
    point lv_rallyPoint;
    unit lv_ancient;
    unit lv_minion;
    int lv_aggroLane;
    int lv_aggroWaypointIndex;

    // Variable Initialization

    // Implementation
    lv_team = libGame_gf_TeamNumberOfPlayer(lp_owner);
    lv_rallyPoint = libMapM_gv_jungleCreepCamps[lp_camp].lv_mapDataMercMinionRallyPoint[lv_team];
    autoE968D45F_ae = libMapM_gv_mMHoCForests[lp_forest].lv_mapDataNumberofAncients;
    autoE968D45F_ai = 1;
    lv_i = 1;
    for ( ; ( (autoE968D45F_ai >= 0 && lv_i <= autoE968D45F_ae) || (autoE968D45F_ai <= 0 && lv_i >= autoE968D45F_ae) ) ; lv_i += autoE968D45F_ai ) {
        lv_ancient = libMapM_gv_mMHoCForests[lp_forest].lv_mapDataAncients[lv_i];
        UnitGroupAdd(libMapM_gv_mMHoCForestActiveAncients, lv_ancient);
        UnitSetOwner(lv_ancient, lp_owner, true);
        UnitBehaviorAdd(lv_ancient, "StormAshenvaleAncientWakeup", lv_ancient, 1);
        UnitCreateEffectUnit(lv_ancient, "StormAshenvaleRevealAncientEffect", lv_ancient);
        if ((lp_owner == libCore_gv_cOMPUTER_TeamOrder)) {
            lv_aggroLane = libMapM_gv_mMHoCForests[lp_forest].lv_orderAggroLane;
            lv_aggroWaypointIndex = libMapM_gv_mMHoCForests[lp_forest].lv_orderAggroWaypointIndex;
        }
        else {
            lv_aggroLane = libMapM_gv_mMHoCForests[lp_forest].lv_chaosAggroLane;
            lv_aggroWaypointIndex = libMapM_gv_mMHoCForests[lp_forest].lv_chaosAggroWaypointIndex;
        }
        lv_minion = lv_ancient;
        libAIAI_gf_MinionAIStartMinionAI(lv_minion, lv_aggroLane, lv_aggroWaypointIndex, false, false, 0);
        UnitSetCustomValue(lv_minion, libCore_gf_CustomValueIndex(3), IntToFixed(lp_camp));
    }
}

// Triggers
//--------------------------------------------------------------------------------------------------
// Trigger: #Include Map Mechanics
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_IncludeMapMechanics_Func (bool testConds, bool runActions) {
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_IncludeMapMechanics_Init () {
    libMapM_gt_IncludeMapMechanics = TriggerCreate("libMapM_gt_IncludeMapMechanics_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: Data - Jungle Camp Defender Data
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_DataJungleCampDefenderData_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    TriggerExecute(libMapM_gt_DataJungleCampDefenderKnights, true, true);
    TriggerExecute(libMapM_gt_DataJungleCampDefenderGraveGolem, true, true);
    TriggerExecute(libMapM_gt_DataJungleCampDefenderDoubloons, true, true);
    TriggerExecute(libMapM_gt_DataJungleCampDefenderSiegeGiants, true, true);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_DataJungleCampDefenderData_Init () {
    libMapM_gt_DataJungleCampDefenderData = TriggerCreate("libMapM_gt_DataJungleCampDefenderData_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: Data - Jungle Camp Defender Siege Giants
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_DataJungleCampDefenderSiegeGiants_Func (bool testConds, bool runActions) {
    int autoAADE6A3C_ae;
    int autoAADE6A3C_ai;

    // Variable Declarations
    int lv_campType;
    int lv_rank;
    int lv_rankToStartScaling;

    // Variable Initialization

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

    lv_campType = (1);
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campIsSoloable = true;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_respawnTime = 210.0;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_numberOfCreeps = 2;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_creepUnitTypes[1] = "MercDefenderSiegeGiant";
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_creepUnitTypes[2] = "MercDefenderSiegeGiant";
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_xPAwardForCapture = libCore_gv_data_XP_SiegeGiantCapture_C;
    libMapM_gf_DataInitializeScalingDataForDefender(1, "SiegeGiantDefenderScaling");
    lv_rankToStartScaling = 2;
    autoAADE6A3C_ae = (lv_rankToStartScaling - 1);
    autoAADE6A3C_ai = 1;
    lv_rank = 0;
    for ( ; ( (autoAADE6A3C_ai >= 0 && lv_rank <= autoAADE6A3C_ae) || (autoAADE6A3C_ai <= 0 && lv_rank >= autoAADE6A3C_ae) ) ; lv_rank += autoAADE6A3C_ai ) {
        libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 6;
    }
    lv_rank = lv_rankToStartScaling;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 7;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 8;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 8;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 9;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 9;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 10;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 10;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 11;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 11;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 11;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 12;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 12;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 12;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 13;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 13;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 13;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 14;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 14;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 14;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 15;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 15;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 15;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 16;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 16;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 16;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 17;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 17;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 17;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 18;
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_DataJungleCampDefenderSiegeGiants_Init () {
    libMapM_gt_DataJungleCampDefenderSiegeGiants = TriggerCreate("libMapM_gt_DataJungleCampDefenderSiegeGiants_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: Data - Jungle Camp Defender Knights
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_DataJungleCampDefenderKnights_Func (bool testConds, bool runActions) {
    int auto2880C3C4_ae;
    int auto2880C3C4_ai;

    // Variable Declarations
    int lv_campType;
    int lv_rank;
    int lv_rankToStartScaling;

    // Variable Initialization

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

    lv_campType = (2);
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campIsSoloable = true;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_respawnTime = 270.0;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_numberOfCreeps = 4;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_creepUnitTypes[1] = "MercDefenderMeleeOgre";
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_creepUnitTypes[2] = "MercDefenderMeleeOgre";
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_creepUnitTypes[3] = "MercDefenderMeleeOgre";
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_creepUnitTypes[4] = "MercDefenderRangedOgre";
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_xPAwardForCapture = libCore_gv_data_XP_OgreCapture_C;
    libMapM_gf_DataInitializeScalingDataForDefender(2, "OgreDefenderScaling");
    lv_rankToStartScaling = 2;
    auto2880C3C4_ae = (lv_rankToStartScaling - 1);
    auto2880C3C4_ai = 1;
    lv_rank = 0;
    for ( ; ( (auto2880C3C4_ai >= 0 && lv_rank <= auto2880C3C4_ae) || (auto2880C3C4_ai <= 0 && lv_rank >= auto2880C3C4_ae) ) ; lv_rank += auto2880C3C4_ai ) {
        libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 11;
    }
    lv_rank = lv_rankToStartScaling;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 12;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 13;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 13;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 14;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 14;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 15;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 15;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 16;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 16;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 16;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 17;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 17;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 17;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 18;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 18;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 18;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 19;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 19;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 19;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 20;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 20;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 20;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 21;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 21;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 21;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 22;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 22;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 22;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 23;
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_DataJungleCampDefenderKnights_Init () {
    libMapM_gt_DataJungleCampDefenderKnights = TriggerCreate("libMapM_gt_DataJungleCampDefenderKnights_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: Data - Jungle Camp Defender Grave Golem
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_DataJungleCampDefenderGraveGolem_Func (bool testConds, bool runActions) {
    int autoB335DA30_ae;
    int autoB335DA30_ai;

    // Variable Declarations
    int lv_campType;
    int lv_rank;
    int lv_rankToStartScaling;

    // Variable Initialization

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

    lv_campType = (3);
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campIsSoloable = true;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_respawnTime = 300.0;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_numberOfCreeps = 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_creepUnitTypes[1] = "JungleGraveGolemDefender";
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_xPAwardForCapture = libCore_gv_data_XP_GraveGolemCapture_C;
    libMapM_gf_DataInitializeScalingDataForDefender(3, "GraveGolemDefenderScaling");
    lv_rankToStartScaling = 2;
    autoB335DA30_ae = (lv_rankToStartScaling - 1);
    autoB335DA30_ai = 1;
    lv_rank = 0;
    for ( ; ( (autoB335DA30_ai >= 0 && lv_rank <= autoB335DA30_ae) || (autoB335DA30_ai <= 0 && lv_rank >= autoB335DA30_ae) ) ; lv_rank += autoB335DA30_ai ) {
        libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 14;
    }
    lv_rank = lv_rankToStartScaling;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 15;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 16;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 16;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 17;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 17;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 18;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 18;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 19;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 19;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 19;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 20;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 20;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 20;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 21;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 21;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 21;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 22;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 22;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 22;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 23;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 23;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 23;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 24;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 24;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 24;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 25;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 25;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 25;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 26;
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_DataJungleCampDefenderGraveGolem_Init () {
    libMapM_gt_DataJungleCampDefenderGraveGolem = TriggerCreate("libMapM_gt_DataJungleCampDefenderGraveGolem_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: Data - Jungle Camp Defender Doubloons
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_DataJungleCampDefenderDoubloons_Func (bool testConds, bool runActions) {
    int auto4811CEB5_ae;
    int auto4811CEB5_ai;

    // Variable Declarations
    int lv_campType;
    int lv_rank;
    int lv_rankToStartScaling;

    // Variable Initialization

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

    lv_campType = (4);
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campIsSoloable = true;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_respawnTime = 120.0;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_numberOfCreeps = 2;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_creepUnitTypes[1] = "SkeletalPirate";
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_creepUnitTypes[2] = "SkeletalPirate";
    libMapM_gf_DataInitializeScalingDataForDefender(4, "DoubloonDefenderScaling");
    lv_rankToStartScaling = 2;
    auto4811CEB5_ae = (lv_rankToStartScaling - 1);
    auto4811CEB5_ai = 1;
    lv_rank = 0;
    for ( ; ( (auto4811CEB5_ai >= 0 && lv_rank <= auto4811CEB5_ae) || (auto4811CEB5_ai <= 0 && lv_rank >= auto4811CEB5_ae) ) ; lv_rank += auto4811CEB5_ai ) {
        libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 5;
    }
    lv_rank = lv_rankToStartScaling;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 6;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 7;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 7;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 8;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 8;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 9;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 9;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 10;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 10;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 10;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 11;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 11;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 11;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 12;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 12;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 12;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 13;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 13;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 13;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 14;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 14;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 14;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 15;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 15;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 15;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 16;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 16;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 16;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 17;
    lv_rank += 1;
    libMapM_gv_dataJungleCampDefenderData[lv_campType].lv_campLevel[lv_rank] = 17;
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_DataJungleCampDefenderDoubloons_Init () {
    libMapM_gt_DataJungleCampDefenderDoubloons = TriggerCreate("libMapM_gt_DataJungleCampDefenderDoubloons_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: Data - Jungle Camp Merc Data
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_DataJungleCampMercData_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    TriggerExecute(libMapM_gt_DataJungleCampMercSiegeGiants, true, true);
    TriggerExecute(libMapM_gt_DataJungleCampMercOgres, true, true);
    TriggerExecute(libMapM_gt_DataJungleCampMercGraveGolem, true, true);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_DataJungleCampMercData_Init () {
    libMapM_gt_DataJungleCampMercData = TriggerCreate("libMapM_gt_DataJungleCampMercData_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: Data - Jungle Camp Merc Siege Giants
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_DataJungleCampMercSiegeGiants_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_campType;

    // Variable Initialization

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

    lv_campType = (1);
    libMapM_gv_dataJungleCampMercData[lv_campType].lv_numberOfMinionsSpawned = 2;
    libMapM_gv_dataJungleCampMercData[lv_campType].lv_spawnedMinionUnitTypes[1] = "MercLanerSiegeGiant";
    libMapM_gv_dataJungleCampMercData[lv_campType].lv_spawnedMinionUnitTypes[2] = "MercLanerSiegeGiant";
    libMapM_gf_DataInitializeScalingDataForMerc(1, "SiegeGiantMercScaling");
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_DataJungleCampMercSiegeGiants_Init () {
    libMapM_gt_DataJungleCampMercSiegeGiants = TriggerCreate("libMapM_gt_DataJungleCampMercSiegeGiants_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: Data - Jungle Camp Merc Ogres
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_DataJungleCampMercOgres_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_campType;

    // Variable Initialization

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

    lv_campType = (2);
    libMapM_gv_dataJungleCampMercData[lv_campType].lv_numberOfMinionsSpawned = 4;
    libMapM_gv_dataJungleCampMercData[lv_campType].lv_spawnedMinionUnitTypes[1] = "MercLanerMeleeOgre";
    libMapM_gv_dataJungleCampMercData[lv_campType].lv_spawnedMinionUnitTypes[2] = "MercLanerMeleeOgre";
    libMapM_gv_dataJungleCampMercData[lv_campType].lv_spawnedMinionUnitTypes[3] = "MercLanerMeleeOgre";
    libMapM_gv_dataJungleCampMercData[lv_campType].lv_spawnedMinionUnitTypes[4] = "MercLanerRangedOgre";
    libMapM_gf_DataInitializeScalingDataForMerc(2, "OgreMercScaling");
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_DataJungleCampMercOgres_Init () {
    libMapM_gt_DataJungleCampMercOgres = TriggerCreate("libMapM_gt_DataJungleCampMercOgres_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: Data - Jungle Camp Merc Grave Golem
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_DataJungleCampMercGraveGolem_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_campType;

    // Variable Initialization

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

    lv_campType = (3);
    libMapM_gv_dataJungleCampMercData[lv_campType].lv_numberOfMinionsSpawned = 1;
    libMapM_gv_dataJungleCampMercData[lv_campType].lv_spawnedMinionUnitTypes[1] = "JungleGraveGolemLaner";
    libMapM_gf_DataInitializeScalingDataForMerc(3, "GraveGolemMercScaling");
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_DataJungleCampMercGraveGolem_Init () {
    libMapM_gt_DataJungleCampMercGraveGolem = TriggerCreate("libMapM_gt_DataJungleCampMercGraveGolem_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: Initialize Jungle Camps
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_InitializeJungleCamps_Func (bool testConds, bool runActions) {
    int auto7E730838_ae;
    int auto7E730838_ai;
    playergroup autoFBAAD7A0_g;
    int autoFBAAD7A0_p;

    // Variable Declarations
    int lv_i;
    int lv_camp;

    // Variable Initialization

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

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

    auto7E730838_ae = libMapM_gv_jungleNumberOfCreepCamps;
    auto7E730838_ai = 1;
    lv_camp = 1;
    for ( ; ( (auto7E730838_ai >= 0 && lv_camp <= auto7E730838_ae) || (auto7E730838_ai <= 0 && lv_camp >= auto7E730838_ae) ) ; lv_camp += auto7E730838_ai ) {
        libMapM_gf_JungleInitializeDefenderData(lv_camp);
        if ((libMapM_gv_jungleCreepCamps[lv_camp].lv_mapDataCampType == 0)) {
            libMapM_gf_JungleInitializeMercCampData(lv_camp);
        }
        else {
        }
        if ((libMapM_gv_jungleCreepCamps[lv_camp].lv_mapDataCampType == 1)) {
            libMapM_gf_JungleInitializeDoubloonCampData(lv_camp);
        }
        else {
        }
        if ((libMapM_gv_jungleCreepCamps[lv_camp].lv_mapDataCampType == 2)) {
            libMapM_gf_JungleInitializeDoubloonSmallCampData(lv_camp);
        }
        else {
        }
        if ((libMapM_gv_jungleCreepCamps[lv_camp].lv_mapDataCampType == 3)) {
            libMapM_gf_JungleInitializeAshenvaleForestCampData(lv_camp);
        }
        else {
        }
        libNtve_gf_CreateUnitsWithDefaultFacing(1, "TownMercCampCaptureBeacon", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Neutral, libMapM_gv_jungleCreepCamps[lv_camp].lv_mapDataCampCaptainSpawnPoint);
        libMapM_gv_jungleCreepCamps[lv_camp].lv_captureCircleOfPowerUnit = UnitLastCreated();
        libGame_gf_CapturePointCreate(UnitLastCreated(), libMapM_gv_bALJungleCampCaptureRadius, libMapM_gv_bALJungleCampCaptureTime, 0.0, true, false);
        libMapM_gv_jungleCreepCamps[lv_camp].lv_captureCapturePointIndex = libGame_gf_LastCreatedCapturePoint();
        libGame_gf_CapturePointDisable(libMapM_gv_jungleCreepCamps[lv_camp].lv_captureCapturePointIndex);
        autoFBAAD7A0_g = PlayerGroupAll(); 
        autoFBAAD7A0_p = 1;
        for ( ; autoFBAAD7A0_p <= PlayerGroupCount(autoFBAAD7A0_g) ; autoFBAAD7A0_p += BoolToInt(lv_i == PlayerGroupPlayer(autoFBAAD7A0_g, autoFBAAD7A0_p)) ) {
            lv_i = PlayerGroupPlayer(autoFBAAD7A0_g, autoFBAAD7A0_p);
            VisRevealArea(lv_i, RegionCircle(UnitGetPosition(libMapM_gv_jungleCreepCamps[lv_camp].lv_captureCircleOfPowerUnit), 0.75), 0.125, false);
        }
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_InitializeJungleCamps_Init () {
    libMapM_gt_InitializeJungleCamps = TriggerCreate("libMapM_gt_InitializeJungleCamps_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: Jungle - Turn On Creep Camps
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_JungleTurnOnCreepCamps_Func (bool testConds, bool runActions) {
    int autoC924FDC4_ae;
    int autoC924FDC4_ai;

    // Variable Declarations
    int lv_camp;

    // Variable Initialization

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

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

    DialogControlSetEnabled(libUIUI_gv_uIDebugPanel.lv_spawnCreepCampsButton, PlayerGroupAll(), false);
    autoC924FDC4_ae = libMapM_gv_jungleNumberOfCreepCamps;
    autoC924FDC4_ai = 1;
    lv_camp = 1;
    for ( ; ( (autoC924FDC4_ai >= 0 && lv_camp <= autoC924FDC4_ae) || (autoC924FDC4_ai <= 0 && lv_camp >= autoC924FDC4_ae) ) ; lv_camp += autoC924FDC4_ai ) {
        libMapM_gf_JungleInitializeCreepCamp(lv_camp);
        libMapM_gf_JungleRespawnCreepsForCamp(lv_camp);
    }
    TriggerEnable(libMapM_gt_JungleCreepCampRespawnTimerExpires, true);
    TriggerEnable(libMapM_gt_JungleRespawnTimerTextTagCountdown, true);
    TriggerEnable(libAIAI_gt_DefenderAICreepsAttacked, true);
    TriggerEnable(libAIAI_gt_DefenderAIDefenderAILogic, true);
    TriggerEnable(libMapM_gt_JungleDefendersBeginFighting, true);
    TriggerEnable(libMapM_gt_JungleDefendersEndFighting, true);
    TriggerEnable(libMapM_gt_JungleAllDefendersKilled, true);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_JungleTurnOnCreepCamps_Init () {
    libMapM_gt_JungleTurnOnCreepCamps = TriggerCreate("libMapM_gt_JungleTurnOnCreepCamps_Func");
    TriggerAddEventTimer(libMapM_gt_JungleTurnOnCreepCamps, libGame_gv_jungleCampStartTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Jungle - Creep Camp Respawn Timer Expires
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_JungleCreepCampRespawnTimerExpires_Func (bool testConds, bool runActions) {
    int autoB2E12282_ae;
    int autoB2E12282_ai;

    // Variable Declarations
    int lv_itCamp;

    // Variable Initialization

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

    autoB2E12282_ae = libMapM_gv_jungleNumberOfCreepCamps;
    autoB2E12282_ai = 1;
    lv_itCamp = 1;
    for ( ; ( (autoB2E12282_ai >= 0 && lv_itCamp <= autoB2E12282_ae) || (autoB2E12282_ai <= 0 && lv_itCamp >= autoB2E12282_ae) ) ; lv_itCamp += autoB2E12282_ai ) {
        if ((EventTimer() == libMapM_gv_jungleCreepCamps[lv_itCamp].lv_stateCreepRespawnTimer)) {
            if ((libMapM_gv_jungleCreepCamps[lv_itCamp].lv_aIState == 4)) {
                libMapM_gf_JungleTransitionCampIntoState(lv_itCamp, 5);
            }
            else {
                libMapM_gf_JungleRespawnCreepsForCamp(lv_itCamp);
            }
            break;
        }
        else {
        }
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_JungleCreepCampRespawnTimerExpires_Init () {
    libMapM_gt_JungleCreepCampRespawnTimerExpires = TriggerCreate("libMapM_gt_JungleCreepCampRespawnTimerExpires_Func");
    TriggerEnable(libMapM_gt_JungleCreepCampRespawnTimerExpires, false);
    TriggerAddEventTimer(libMapM_gt_JungleCreepCampRespawnTimerExpires, libMapM_gv_jungleCreepCamps[1].lv_stateCreepRespawnTimer);
    TriggerAddEventTimer(libMapM_gt_JungleCreepCampRespawnTimerExpires, libMapM_gv_jungleCreepCamps[2].lv_stateCreepRespawnTimer);
    TriggerAddEventTimer(libMapM_gt_JungleCreepCampRespawnTimerExpires, libMapM_gv_jungleCreepCamps[3].lv_stateCreepRespawnTimer);
    TriggerAddEventTimer(libMapM_gt_JungleCreepCampRespawnTimerExpires, libMapM_gv_jungleCreepCamps[4].lv_stateCreepRespawnTimer);
    TriggerAddEventTimer(libMapM_gt_JungleCreepCampRespawnTimerExpires, libMapM_gv_jungleCreepCamps[5].lv_stateCreepRespawnTimer);
    TriggerAddEventTimer(libMapM_gt_JungleCreepCampRespawnTimerExpires, libMapM_gv_jungleCreepCamps[6].lv_stateCreepRespawnTimer);
    TriggerAddEventTimer(libMapM_gt_JungleCreepCampRespawnTimerExpires, libMapM_gv_jungleCreepCamps[7].lv_stateCreepRespawnTimer);
    TriggerAddEventTimer(libMapM_gt_JungleCreepCampRespawnTimerExpires, libMapM_gv_jungleCreepCamps[8].lv_stateCreepRespawnTimer);
    TriggerAddEventTimer(libMapM_gt_JungleCreepCampRespawnTimerExpires, libMapM_gv_jungleCreepCamps[9].lv_stateCreepRespawnTimer);
    TriggerAddEventTimer(libMapM_gt_JungleCreepCampRespawnTimerExpires, libMapM_gv_jungleCreepCamps[10].lv_stateCreepRespawnTimer);
    TriggerAddEventTimer(libMapM_gt_JungleCreepCampRespawnTimerExpires, libMapM_gv_jungleCreepCamps[11].lv_stateCreepRespawnTimer);
    TriggerAddEventTimer(libMapM_gt_JungleCreepCampRespawnTimerExpires, libMapM_gv_jungleCreepCamps[12].lv_stateCreepRespawnTimer);
    TriggerAddEventTimer(libMapM_gt_JungleCreepCampRespawnTimerExpires, libMapM_gv_jungleCreepCamps[13].lv_stateCreepRespawnTimer);
    TriggerAddEventTimer(libMapM_gt_JungleCreepCampRespawnTimerExpires, libMapM_gv_jungleCreepCamps[14].lv_stateCreepRespawnTimer);
    TriggerAddEventTimer(libMapM_gt_JungleCreepCampRespawnTimerExpires, libMapM_gv_jungleCreepCamps[15].lv_stateCreepRespawnTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Jungle - Respawn Timer Text Tag Countdown
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_JungleRespawnTimerTextTagCountdown_Func (bool testConds, bool runActions) {
    int auto1C4F524B_ae;
    int auto1C4F524B_ai;

    // Variable Declarations
    int lv_camp;

    // Variable Initialization

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

    auto1C4F524B_ae = libMapM_gv_jungleNumberOfCreepCamps;
    auto1C4F524B_ai = 1;
    lv_camp = 1;
    for ( ; ( (auto1C4F524B_ai >= 0 && lv_camp <= auto1C4F524B_ae) || (auto1C4F524B_ai <= 0 && lv_camp >= auto1C4F524B_ae) ) ; lv_camp += auto1C4F524B_ai ) {
        if ((TimerGetRemaining(libMapM_gv_jungleCreepCamps[lv_camp].lv_stateCreepRespawnTimer) > 0.0)) {
            TextExpressionSetToken("Param/Expression/lib_MapM_01DEF04D", "A", IntToText(libMapM_gv_jungleCreepCamps[lv_camp].lv_defenderCampLevel[libMapM_gv_jungleCreepCamps[lv_camp].lv_stateCurrentDefenderScalingTicks]));
            TextExpressionSetToken("Param/Expression/lib_MapM_01DEF04D", "B", FixedToText(TimerGetRemaining(libMapM_gv_jungleCreepCamps[lv_camp].lv_stateCreepRespawnTimer), 0));
            ActorSendAsText(libNtve_gf_MainActorofUnit(libMapM_gv_jungleCreepCamps[lv_camp].lv_campIconUnit), TextExpressionAssemble("Param/Expression/lib_MapM_01DEF04D"));
            libMapM_gf_JungleUpdateTextTagForCamp(lv_camp, 1);
        }
        else {
        }
        if ((TimerGetRemaining(libMapM_gv_jungleCreepCamps[lv_camp].lv_stateCreepActiveTimer) > 0.0)) {
            libMapM_gf_JungleUpdateTextTagForCamp(lv_camp, 2);
        }
        else {
        }
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_JungleRespawnTimerTextTagCountdown_Init () {
    libMapM_gt_JungleRespawnTimerTextTagCountdown = TriggerCreate("libMapM_gt_JungleRespawnTimerTextTagCountdown_Func");
    TriggerEnable(libMapM_gt_JungleRespawnTimerTextTagCountdown, false);
    TriggerAddEventTimePeriodic(libMapM_gt_JungleRespawnTimerTextTagCountdown, 1.0, c_timeGame);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Jungle - Scaling Timer Expires
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_JungleScalingTimerExpires_Func (bool testConds, bool runActions) {
    int auto1254996C_ae;
    int auto1254996C_ai;

    // Variable Declarations
    int lv_camp;

    // Variable Initialization

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

        if (!((libGame_gv_gameOver == false))) {
            return false;
        }
    }

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

    libMapM_gv_jungleScalingTicks += 1;
    if ((libMapM_gv_jungleScalingTicks > libCore_gv_dataScalingMaxScalingTicks)) {
        libMapM_gv_jungleScalingTicks = libCore_gv_dataScalingMaxScalingTicks;
    }
    else {
    }
    auto1254996C_ae = libMapM_gv_jungleNumberOfCreepCamps;
    auto1254996C_ai = 1;
    lv_camp = 1;
    for ( ; ( (auto1254996C_ai >= 0 && lv_camp <= auto1254996C_ae) || (auto1254996C_ai <= 0 && lv_camp >= auto1254996C_ae) ) ; lv_camp += auto1254996C_ai ) {
        if ((libMapM_gv_jungleCreepCamps[lv_camp].lv_aIState == 0)) {
            libMapM_gf_JungleUpdateScalingForCamp(lv_camp, libMapM_gv_jungleScalingTicks);
        }
        else {
        }
    }
    if ((libSprt_gv_dEBUG60SecondPauseOnOff == true)) {
        ConsoleCommand("Pause", true, true);
        TriggerDebugOutput(1, StringExternal("Param/Value/lib_MapM_E3B99EEC"), true);
        PlayerGroupLoopBegin(PlayerGroupAll());
        for ( ; !PlayerGroupLoopDone() ; PlayerGroupLoopStep() ) {
            UIDisplayMessage(PlayerGroupSingle(PlayerGroupLoopCurrent()), c_messageAreaDebug, FixedToText(UnitXPTotal(libGame_gv_players[PlayerGroupLoopCurrent()].lv_heroUnit), c_fixedPrecisionAny));
        }
        PlayerGroupLoopEnd();
    }
    else {
    }
    TimerStart(libMapM_gv_jungleScalingTimer, libMapM_gv_bALJungleCampScalingTimerDuration, false, c_timeGame);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_JungleScalingTimerExpires_Init () {
    libMapM_gt_JungleScalingTimerExpires = TriggerCreate("libMapM_gt_JungleScalingTimerExpires_Func");
    TriggerAddEventTimer(libMapM_gt_JungleScalingTimerExpires, libMapM_gv_jungleScalingTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Jungle - Defenders Begin Fighting
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_JungleDefendersBeginFighting_Func (bool testConds, bool runActions) {
    int auto8BE37AE4_ae;
    int auto8BE37AE4_ai;

    // Variable Declarations
    int lv_defenderAIIndex;
    int lv_testIndex;
    int lv_camp;

    // Variable Initialization

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

    lv_defenderAIIndex = libGame_gf_JungleDefenderAIDefendersBeginFightingIndex();
    auto8BE37AE4_ae = libMapM_gv_jungleMaxCamps;
    auto8BE37AE4_ai = 1;
    lv_testIndex = 1;
    for ( ; ( (auto8BE37AE4_ai >= 0 && lv_testIndex <= auto8BE37AE4_ae) || (auto8BE37AE4_ai <= 0 && lv_testIndex >= auto8BE37AE4_ae) ) ; lv_testIndex += auto8BE37AE4_ai ) {
        if ((libMapM_gv_jungleCreepCamps[lv_testIndex].lv_aIDefenderAIIndex == lv_defenderAIIndex)) {
            lv_camp = lv_testIndex;
            break;
        }
        else {
        }
    }
    if ((lv_camp > 0) && (libMapM_gv_jungleCreepCamps[lv_camp].lv_aIState != 4) && (libMapM_gv_jungleCreepCamps[lv_camp].lv_aIState != 5)) {
        libMapM_gf_JungleTransitionCampIntoState(lv_camp, 1);
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_JungleDefendersBeginFighting_Init () {
    libMapM_gt_JungleDefendersBeginFighting = TriggerCreate("libMapM_gt_JungleDefendersBeginFighting_Func");
    TriggerEnable(libMapM_gt_JungleDefendersBeginFighting, false);
    libGame_gf_JungleDefenderAIDefendersBeginFighting(libMapM_gt_JungleDefendersBeginFighting);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Jungle - Defenders End Fighting
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_JungleDefendersEndFighting_Func (bool testConds, bool runActions) {
    int autoCE3EC7FE_ae;
    int autoCE3EC7FE_ai;

    // Variable Declarations
    int lv_defenderAIIndex;
    int lv_testIndex;
    int lv_camp;

    // Variable Initialization

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

    lv_defenderAIIndex = libGame_gf_JungleDefenderAIDefendersEndFightingIndex();
    autoCE3EC7FE_ae = libMapM_gv_jungleMaxCamps;
    autoCE3EC7FE_ai = 1;
    lv_testIndex = 1;
    for ( ; ( (autoCE3EC7FE_ai >= 0 && lv_testIndex <= autoCE3EC7FE_ae) || (autoCE3EC7FE_ai <= 0 && lv_testIndex >= autoCE3EC7FE_ae) ) ; lv_testIndex += autoCE3EC7FE_ai ) {
        if ((libMapM_gv_jungleCreepCamps[lv_testIndex].lv_aIDefenderAIIndex == lv_defenderAIIndex)) {
            lv_camp = lv_testIndex;
            break;
        }
        else {
        }
    }
    if ((lv_camp > 0) && (libMapM_gv_jungleCreepCamps[lv_camp].lv_aIState != 4) && (libMapM_gv_jungleCreepCamps[lv_camp].lv_aIState != 5)) {
        libMapM_gf_JungleTransitionCampIntoState(lv_camp, 0);
        if ((UnitGroupCount(libAIAI_gf_DefenderGroup(libMapM_gv_jungleCreepCamps[lv_camp].lv_aIDefenderAIIndex), c_unitCountAlive) < libMapM_gv_jungleCreepCamps[lv_camp].lv_defenderCount)) {
            TimerStart(libMapM_gv_jungleCreepCamps[lv_camp].lv_stateCreepRespawnTimer, libMapM_gv_bALJungleLeashRespawnTime, false, c_timeGame);
        }
        else {
        }
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_JungleDefendersEndFighting_Init () {
    libMapM_gt_JungleDefendersEndFighting = TriggerCreate("libMapM_gt_JungleDefendersEndFighting_Func");
    TriggerEnable(libMapM_gt_JungleDefendersEndFighting, false);
    libGame_gf_JungleDefenderAIDefendersEndFighting(libMapM_gt_JungleDefendersEndFighting);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Jungle - All Defenders Killed
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_JungleAllDefendersKilled_Func (bool testConds, bool runActions) {
    int auto1D994751_ae;
    int auto1D994751_ai;

    // Variable Declarations
    int lv_defenderAIIndex;
    unit lv_killingUnit;
    int lv_testIndex;
    int lv_camp;
    int lv_owner;

    // Variable Initialization

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

    lv_defenderAIIndex = libGame_gf_JungleDefenderAIAllDefendersKilledIndex();
    lv_killingUnit = libGame_gf_JungleDefenderAIAllDefendersKilledKillingUnit();
    auto1D994751_ae = libMapM_gv_jungleMaxCamps;
    auto1D994751_ai = 1;
    lv_testIndex = 1;
    for ( ; ( (auto1D994751_ai >= 0 && lv_testIndex <= auto1D994751_ae) || (auto1D994751_ai <= 0 && lv_testIndex >= auto1D994751_ae) ) ; lv_testIndex += auto1D994751_ai ) {
        if ((libMapM_gv_jungleCreepCamps[lv_testIndex].lv_aIDefenderAIIndex == lv_defenderAIIndex)) {
            lv_camp = lv_testIndex;
            break;
        }
        else {
        }
    }
    if ((lv_camp > 0)) {
        if ((lv_killingUnit != null)) {
            if ((PlayerGroupHasPlayer(libCore_gv_teamOrder, UnitGetOwner(lv_killingUnit)) == true)) {
                libNtve_gf_CreateUnitsWithDefaultFacing(1, "RegenGlobe", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_TeamOrder, libMapM_gv_jungleCreepCamps[lv_camp].lv_mapDataCampCaptainSpawnPoint);
            }
            else {
                libNtve_gf_CreateUnitsWithDefaultFacing(1, "RegenGlobe", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_TeamChaos, libMapM_gv_jungleCreepCamps[lv_camp].lv_mapDataCampCaptainSpawnPoint);
            }
        }
        else {
        }
        if ((libMapM_gv_jungleCreepCamps[lv_camp].lv_mapDataCampType == 0)) {
            libMapM_gf_JungleTurnOnCampCaptureBeacon(lv_camp);
        }
        else {
            if ((PlayerGroupHasPlayer(libCore_gv_teamOrder, UnitGetOwner(lv_killingUnit)) == true)) {
                lv_owner = libCore_gv_cOMPUTER_TeamOrder;
            }
            else {
                lv_owner = libCore_gv_cOMPUTER_TeamChaos;
            }
            libMapM_gf_JungleGrantCaptureRewards(lv_camp, lv_owner, false);
        }
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_JungleAllDefendersKilled_Init () {
    libMapM_gt_JungleAllDefendersKilled = TriggerCreate("libMapM_gt_JungleAllDefendersKilled_Func");
    TriggerEnable(libMapM_gt_JungleAllDefendersKilled, false);
    libGame_gf_JungleDefenderAIAllDefendersKilled(libMapM_gt_JungleAllDefendersKilled);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Jungle - Hibernate Camps Start
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_JungleHibernateCampsStart_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    libMapM_gf_JungleStartHibernateCamps();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_JungleHibernateCampsStart_Init () {
    libMapM_gt_JungleHibernateCampsStart = TriggerCreate("libMapM_gt_JungleHibernateCampsStart_Func");
    libGame_gf_MapDragonShireDragonActivated(libMapM_gt_JungleHibernateCampsStart);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Jungle - Hibernate Camps End
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_JungleHibernateCampsEnd_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    libMapM_gf_JungleStopHibernateCamps();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_JungleHibernateCampsEnd_Init () {
    libMapM_gt_JungleHibernateCampsEnd = TriggerCreate("libMapM_gt_JungleHibernateCampsEnd_Func");
    libGame_gf_MapDragonShireDragonEnds(libMapM_gt_JungleHibernateCampsEnd);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Jungle - Camp Ownership Change
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_JungleCampOwnershipChange_Func (bool testConds, bool runActions) {
    int auto1EEBCBD3_ae;

    // Variable Declarations
    int lv_itCamp;
    int lv_index;
    int lv_owner;
    bool lv_hasMercLordTalent;

    // Variable Initialization
    lv_index = libGame_gf_CapturePointChangesOwnerCapturePointIndex();
    lv_owner = libGame_gf_CapturePointChangesOwnerOwner();
    lv_hasMercLordTalent = libGame_gf_CapturePointChangesOwnerHasMercLordTalent();

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

    auto1EEBCBD3_ae = libMapM_gv_jungleNumberOfCreepCamps;
    lv_itCamp = 1;
    for ( ; lv_itCamp <= auto1EEBCBD3_ae ; lv_itCamp += 1 ) {
        if ((libMapM_gv_jungleCreepCamps[lv_itCamp].lv_captureCapturePointIndex == lv_index)) {
            libGame_gf_SendEventMercCampCaptured(lv_itCamp, lv_owner, libGame_gf_CapturePointChangesOwnerCapturingPlayers());
            if ((lv_owner == libCore_gv_cOMPUTER_TeamOrder)) {
                libNtve_gf_SendActorMessageToGameRegion(libMapM_gv_jungleCreepCamps[lv_itCamp].lv_mapDataDefenderLeashRegion, "Signal OwnerOrder");
                UnitSetOwner(libMapM_gv_jungleCreepCamps[lv_itCamp].lv_campIconUnit, libCore_gv_cOMPUTER_TeamOrder, true);
                UnitSetOwner(libMapM_gv_jungleCreepCamps[lv_itCamp].lv_campOwnershipFlagUnit, libCore_gv_cOMPUTER_TeamOrder, true);
                libMapM_gf_JungleTurnOffCampCaptureBeacon(lv_itCamp, libCore_gv_cOMPUTER_TeamOrder);
                libMapM_gf_JungleGrantCaptureRewards(lv_itCamp, libCore_gv_cOMPUTER_TeamOrder, lv_hasMercLordTalent);
            }
            else {
            }
            if ((lv_owner == libCore_gv_cOMPUTER_TeamChaos)) {
                libNtve_gf_SendActorMessageToGameRegion(libMapM_gv_jungleCreepCamps[lv_itCamp].lv_mapDataDefenderLeashRegion, "Signal OwnerChaos");
                UnitSetOwner(libMapM_gv_jungleCreepCamps[lv_itCamp].lv_campIconUnit, libCore_gv_cOMPUTER_TeamChaos, true);
                UnitSetOwner(libMapM_gv_jungleCreepCamps[lv_itCamp].lv_campOwnershipFlagUnit, libCore_gv_cOMPUTER_TeamChaos, true);
                libMapM_gf_JungleTurnOffCampCaptureBeacon(lv_itCamp, libCore_gv_cOMPUTER_TeamChaos);
                libMapM_gf_JungleGrantCaptureRewards(lv_itCamp, libCore_gv_cOMPUTER_TeamChaos, lv_hasMercLordTalent);
            }
            else {
            }
        }
        else {
        }
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_JungleCampOwnershipChange_Init () {
    libMapM_gt_JungleCampOwnershipChange = TriggerCreate("libMapM_gt_JungleCampOwnershipChange_Func");
    libGame_gf_CapturePointChangesOwner(libMapM_gt_JungleCampOwnershipChange);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Jungle - Ogre King Dies
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_JungleOgreKingDies_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_camp;

    // Variable Initialization

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

    lv_camp = FixedToInt(UnitGetCustomValue(EventUnit(), libCore_gf_CustomValueIndex(3)));
    if ((lv_camp != 0) && (libMapM_gv_jungleCreepCamps[lv_camp].lv_mapDataMercSpawnType == 3)) {
        StatEventCreate("SuperMercDeath");
        StatEventAddDataString(StatEventLastCreated(), "UnitType", (UnitGetType(EventUnit())));
        StatEventAddDataInt(StatEventLastCreated(), "Team", libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit())));
        StatEventAddDataFixed(StatEventLastCreated(), "PositionX", PointGetX(UnitGetPosition(EventUnit())));
        StatEventAddDataFixed(StatEventLastCreated(), "PositionY", PointGetY(UnitGetPosition(EventUnit())));
        StatEventSend(StatEventLastCreated());
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_JungleOgreKingDies_Init () {
    libMapM_gt_JungleOgreKingDies = TriggerCreate("libMapM_gt_JungleOgreKingDies_Func");
    TriggerAddEventUnitDied(libMapM_gt_JungleOgreKingDies, null);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Jungle - Merc Leader Dies
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_JungleMercLeaderDies_Func (bool testConds, bool runActions) {
    int auto9AC7B9FC_ae;
    int auto9AC7B9FC_ai;

    // Variable Declarations
    int lv_i;

    // Variable Initialization

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

    auto9AC7B9FC_ae = libMapM_gv_jungleMaxCamps;
    auto9AC7B9FC_ai = 1;
    lv_i = 1;
    for ( ; ( (auto9AC7B9FC_ai >= 0 && lv_i <= auto9AC7B9FC_ae) || (auto9AC7B9FC_ai <= 0 && lv_i >= auto9AC7B9FC_ae) ) ; lv_i += auto9AC7B9FC_ai ) {
        if ((UnitIsAlive(libMapM_gv_jungleMiniMapLeader[lv_i]) == false)) {
            if ((UnitGroupCount(libMapM_gv_jungleMiniMapIconGroup[lv_i], c_unitCountAlive) > 0)) {
                libMapM_gf_JungleSetMiniMapIconForMercMinions(lv_i, "Assets\\Textures\\blank.dds", libMapM_gv_jungleMiniMapIconGroup[lv_i]);
            }
            else {
            }
            libMapM_gf_JungleCreateMercPath(libMapM_gv_jungleMiniMapLeader[lv_i], false);
        }
        else {
        }
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_JungleMercLeaderDies_Init () {
    libMapM_gt_JungleMercLeaderDies = TriggerCreate("libMapM_gt_JungleMercLeaderDies_Func");
    TriggerAddEventUnitBehaviorChange(libMapM_gt_JungleMercLeaderDies, null, "MinionDeathMonitor", c_unitBehaviorChangeDeactivate);
    TriggerAddEventUnitBehaviorChange(libMapM_gt_JungleMercLeaderDies, null, "MinionDeathMonitor", c_unitBehaviorChangeDestroy);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Jungle - Merc - Ogre Shield Used (Ogre)
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_JungleMercOgreShieldUsedOgre_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_stackCount;

    // Variable Initialization

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

    lv_stackCount = (FixedToInt(UnitGetPropertyFixed(EventUnitTargetUnit(), c_unitPropLifeMax, c_unitPropCurrent)) / CatalogFieldValueGetAsInt(c_gameCatalogBehavior, "MercLanerOgreBuff", "DamageResponse.ModifyLimit", c_playerAny));
    UnitBehaviorAdd(EventUnitTargetUnit(), "MercLanerOgreBuff", EventUnit(), lv_stackCount);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_JungleMercOgreShieldUsedOgre_Init () {
    libMapM_gt_JungleMercOgreShieldUsedOgre = TriggerCreate("libMapM_gt_JungleMercOgreShieldUsedOgre_Func");
    TriggerAddEventUnitAbility(libMapM_gt_JungleMercOgreShieldUsedOgre, null, AbilityCommand("MercLanerOgreBuffAbilityOgreOnly", 0), c_abilEffectStageFinish, false);
    TriggerAddEventUnitAbility(libMapM_gt_JungleMercOgreShieldUsedOgre, null, AbilityCommand("MercDefenderOgreBuffAbility", 0), c_abilEffectStageFinish, false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Jungle - Merc - Ogre Shield Used (Hero)
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_JungleMercOgreShieldUsedHero_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_stackCount;

    // Variable Initialization

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

    lv_stackCount = (FixedToInt(UnitGetPropertyFixed(EventUnitTargetUnit(), c_unitPropLifeMax, c_unitPropCurrent)) / CatalogFieldValueGetAsInt(c_gameCatalogBehavior, "MercLanerOgreBuff", "DamageResponse.ModifyLimit", c_playerAny));
    lv_stackCount = (lv_stackCount / 4);
    UnitBehaviorAdd(EventUnitTargetUnit(), "MercLanerOgreBuff", EventUnit(), lv_stackCount);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_JungleMercOgreShieldUsedHero_Init () {
    libMapM_gt_JungleMercOgreShieldUsedHero = TriggerCreate("libMapM_gt_JungleMercOgreShieldUsedHero_Func");
    TriggerAddEventUnitAbility(libMapM_gt_JungleMercOgreShieldUsedHero, null, AbilityCommand("MercLanerOgreBuffAbilityHeroOnly", 0), c_abilEffectStageFinish, false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Initialize Map Mechanics
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_InitializeMapMechanics_Func (bool testConds, bool runActions) {
    int auto7C9A6F5C_ae;
    int auto7C9A6F5C_ai;

    // Variable Declarations
    int lv_itIndex;

    // Variable Initialization

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

    auto7C9A6F5C_ae = libMapM_gv_mapMechanicsCount;
    auto7C9A6F5C_ai = 1;
    lv_itIndex = 1;
    for ( ; ( (auto7C9A6F5C_ai >= 0 && lv_itIndex <= auto7C9A6F5C_ae) || (auto7C9A6F5C_ai <= 0 && lv_itIndex >= auto7C9A6F5C_ae) ) ; lv_itIndex += auto7C9A6F5C_ai ) {
        if ((libMapM_gv_mapMechanicsInitCallbacks[lv_itIndex] != null)) {
            TriggerExecute(libMapM_gv_mapMechanicsInitCallbacks[lv_itIndex], true, false);
        }
        else {
        }
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_InitializeMapMechanics_Init () {
    libMapM_gt_InitializeMapMechanics = TriggerCreate("libMapM_gt_InitializeMapMechanics_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Helpbutton Clicked
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMHelpbuttonClicked_Func (bool testConds, bool runActions) {
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMHelpbuttonClicked_Init () {
    libMapM_gt_MMHelpbuttonClicked = TriggerCreate("libMapM_gt_MMHelpbuttonClicked_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Intro Skippable
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMIntroSkippable_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_cutscene;
    int lv_player;

    // Variable Initialization
    lv_cutscene = c_cutsceneNone;

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

    lv_player = libMapM_gv_mMIntroCutscenePlayer;
    lv_cutscene = libMapM_gv_mMIntroCutscene[lv_player];
    TriggerSkippableBegin(libCore_gv_playerGroupFromPlayer[lv_player], 0, null, true, false);
    libMapM_gv_mMIntroCutsceneCompleted[lv_player] = false;
    WaitForCutsceneToEnd(lv_cutscene);
    libMapM_gv_mMIntroCutsceneCompleted[lv_player] = true;
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMIntroSkippable_Init () {
    libMapM_gt_MMIntroSkippable = TriggerCreate("libMapM_gt_MMIntroSkippable_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Raven Curse Gate Open
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMRavenCurseGateOpen_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    TriggerEnable(TriggerGetCurrent(), false);
    TriggerEnable(libMapM_gt_MMRavenSpawnTribute, true);
    TriggerEnable(libMapM_gt_MMRavenTributeObtained, true);
    TimerStart(libMapM_gv_mMRavenStartTimer, (libMapM_gf_MMRavenStartTime() + RandomFixed((libMapM_gv_mMRavenTributeSpawnTimeVariance * -1), libMapM_gv_mMRavenTributeSpawnTimeVariance)), false, c_timeGame);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMRavenCurseGateOpen_Init () {
    libMapM_gt_MMRavenCurseGateOpen = TriggerCreate("libMapM_gt_MMRavenCurseGateOpen_Func");
    TriggerEnable(libMapM_gt_MMRavenCurseGateOpen, false);
    TriggerAddEventTimer(libMapM_gt_MMRavenCurseGateOpen, libGame_gv_openTheGatesTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Raven Start Spawning
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMRavenStartSpawning_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!((TriggerIsEnabled(TriggerGetCurrent()) == true))) {
            return false;
        }
    }

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

    TriggerEnable(TriggerGetCurrent(), false);
    if ((libMapM_gv_mMRavenEventFirstTime == true)) {
        TimerStart(libMapM_gv_mMRavenWarningTimer, 0.125, false, c_timeGame);
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMRavenStartSpawning_Init () {
    libMapM_gt_MMRavenStartSpawning = TriggerCreate("libMapM_gt_MMRavenStartSpawning_Func");
    TriggerAddEventTimer(libMapM_gt_MMRavenStartSpawning, libMapM_gv_mMRavenStartTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Raven Spawn Tribute
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMRavenSpawnTribute_Func (bool testConds, bool runActions) {
    playergroup auto4CE6CAAB_g;
    int auto4CE6CAAB_p;
    int auto89EC37D8_n;
    int auto89EC37D8_i;

    // Variable Declarations
    point lv_spawnPoint;
    int lv_itPlayer;
    sound lv_pingSound;

    // Variable Initialization

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

    libMapM_gv_mMRavenCurseLifted = false;
    lv_spawnPoint = libMapM_gf_MMRavenRandomSpawnPoint();
    if ((libMapM_gv_mMRavenEventFirstTime == false)) {
        libMapM_gf_MMRavenTransmissionTributeAboutToSpawnQ(PlayerGroupAll());
    }
    else {
        libMapM_gf_MMRavenTransmissionEventStartQ(PlayerGroupAll());
        TriggerExecute(libMapM_gt_MMRavenObjectiveUIHandler, true, false);
    }
    Wait(2.0, c_timeGame);
    libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_allHeroPlayersPlusObserver, 0, 0, "RavenCurseBegin", StringExternal("Param/Value/lib_MapM_3A16F0D9"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    SoundPlayForPlayer(SoundLink("UI_Game_Ping_MiniMap", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);
    SoundPlayAtPointForPlayer(SoundLink("Event_RavenCurse_TributeSpawn", -1), c_maxPlayers, PlayerGroupAll(), lv_spawnPoint, 2.0, 100.0, 0.0);
    libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "StormPingSimple", lv_spawnPoint, ColorWithAlpha(100.00, 100.00, 0.00, 0.00), 2.0, 270.0);
    libGame_gf_SendEventMapTributeWarning(lv_spawnPoint);
    libNtve_gf_CreateUnitsWithDefaultFacing(1, "RavenLordTributeWarning", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Neutral, lv_spawnPoint);
    libMapM_gv_mMRavenTributeWarning = UnitLastCreated();
    VisRevealerCreate(libCore_gv_cOMPUTER_TeamOrder, RegionCircle(lv_spawnPoint, libMapM_gv_mMRavenRevealRadius_C));
    libMapM_gv_mMRavenOrderRevealer = VisRevealerLastCreated();
    VisRevealerCreate(libCore_gv_cOMPUTER_TeamChaos, RegionCircle(lv_spawnPoint, libMapM_gv_mMRavenRevealRadius_C));
    libMapM_gv_mMRavenChaosRevealer = VisRevealerLastCreated();
    Wait(libMapM_gv_mMRavenSpawnWarningTimerTime_C, c_timeGame);
    UnitKill(libMapM_gv_mMRavenTributeWarning);
    libNtve_gf_CreateModelAtPoint("RavenLordTributeSpawn", lv_spawnPoint);
    Wait(0.5, c_timeReal);
    libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_allHeroPlayersPlusObserver, 0, 0, "RavenCurseBegin", StringExternal("Param/Value/lib_MapM_53C3F2B2"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "StormPingSimple", lv_spawnPoint, ColorWithAlpha(100.00, 100.00, 0.00, 0.00), 3.0, 270.0);
    libNtve_gf_CreateUnitsWithDefaultFacing(1, "RavenLordTribute", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Neutral, lv_spawnPoint);
    libNtve_gf_PlayAnimation(libNtve_gf_MainActorofUnit(UnitLastCreated()), c_animNameDefault, "Birth", c_animFlagNonLooping, 0.0);
    UnitGroupAddUnitGroup(libMapM_gv_mMRavenTributes, UnitLastCreatedGroup());
    TriggerEnable(libMapM_gt_MMRavenTributeObtained, true);
    libGame_gf_SendEventMapTributeSpawned(UnitLastCreated());
    libMapM_gv_mMRavenEventFirstTime = false;
    Wait(1.0, c_timeGame);
    libUIUI_gf_AttachHelpButtonToUnit(UnitLastCreated(), libMapM_gt_MMHelpbuttonClicked, StringExternal("Param/Value/lib_MapM_E2F763F8"), 110, 135);
    Wait(0.5, c_timeGame);
    auto4CE6CAAB_g = libCore_gv_activeHumanPlayers; 
    auto4CE6CAAB_p = 1;
    for ( ; auto4CE6CAAB_p <= PlayerGroupCount(auto4CE6CAAB_g) ; auto4CE6CAAB_p += BoolToInt(lv_itPlayer == PlayerGroupPlayer(auto4CE6CAAB_g, auto4CE6CAAB_p)) ) {
        lv_itPlayer = PlayerGroupPlayer(auto4CE6CAAB_g, auto4CE6CAAB_p);
        if ((libMapM_gv_mapMechanicUsedTracker[lv_itPlayer].lv_ravenTribute == true)) {
            libUIUI_gf_ShowHideHelpButtonOnUnitForPlayer(lv_itPlayer, false, UnitLastCreated());
        }
        else {
        }
    }
    while (true) {
        Wait(9.0, c_timeGame);
        if (((libGame_gv_gameOver == true) || (UnitIsAlive(UnitLastCreated()) == false))) {
            return true;
        }
        else {
        }
        lv_pingSound = SoundLastPlayed();
        libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "StormPingSimple", UnitGetPosition(UnitLastCreated()), ColorWithAlpha(100.00, 100.00, 0.00, 0.00), 0.0, 270.0);
        libCore_gf_StorePingForUnit(UnitLastCreated(), 1, PingLastCreated());
        PingSetUnit(PingLastCreated(), UnitLastCreated());
        auto89EC37D8_n = 6;
        for (auto89EC37D8_i = 1; auto89EC37D8_i <= auto89EC37D8_n; auto89EC37D8_i += 1) {
            if (((libGame_gv_gameOver == true) || (UnitIsAlive(UnitLastCreated()) == false))) {
                break;
            }
            else {
            }
            Wait(1.0, c_timeGame);
        }
        PingDestroy(libCore_gf_PingStoredForUnit(UnitLastCreated(), 1));
        libCore_gf_StorePingForUnit(UnitLastCreated(), 1, c_invalidPingId);
        SoundStop(lv_pingSound, true);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMRavenSpawnTribute_Init () {
    libMapM_gt_MMRavenSpawnTribute = TriggerCreate("libMapM_gt_MMRavenSpawnTribute_Func");
    TriggerEnable(libMapM_gt_MMRavenSpawnTribute, false);
    TriggerAddEventTimer(libMapM_gt_MMRavenSpawnTribute, libMapM_gv_mMRavenWarningTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Raven Tribute Collect Started
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMRavenTributeCollectStarted_Func (bool testConds, bool runActions) {
    int autoB2ADE185_val;

    // Variable Declarations
    int lv_count;

    // Variable Initialization

    // Conditions
    if (testConds) {
        if (!((UnitGetType(EventUnitTargetUnit()) == "RavenLordTribute"))) {
            return false;
        }
    }

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

    lv_count = (libCore_gf_IntegerStoredForUnit(EventUnitTargetUnit(), 1) + 1);
    libCore_gf_StoreIntegerForUnit(EventUnitTargetUnit(), 1, lv_count);
    libNtve_gf_TurnAnimationPropertiesOn(libNtve_gf_MainActorofUnit(EventUnitTargetUnit()), "Work");
    autoB2ADE185_val = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()));
    if (autoB2ADE185_val == libGame_gv_teamOrderIndex_C) {
        libNtve_gf_SendActorMessageToUnit(EventUnitTargetUnit(), "StatusIncrement TributeCaptureOrder");
    }
    else if (autoB2ADE185_val == libGame_gv_teamChaosIndex_C) {
        libNtve_gf_SendActorMessageToUnit(EventUnitTargetUnit(), "StatusIncrement TributeCaptureChaos");
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMRavenTributeCollectStarted_Init () {
    libMapM_gt_MMRavenTributeCollectStarted = TriggerCreate("libMapM_gt_MMRavenTributeCollectStarted_Func");
    TriggerEnable(libMapM_gt_MMRavenTributeCollectStarted, false);
    TriggerAddEventUnitAbility(libMapM_gt_MMRavenTributeCollectStarted, null, AbilityCommand("CaptureMacGuffin", 0), c_abilEffectStageChannel, false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Raven Tribute Collect Canceled
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMRavenTributeCollectCanceled_Func (bool testConds, bool runActions) {
    int autoC5D651B5_val;

    // Variable Declarations
    int lv_count;

    // Variable Initialization

    // Conditions
    if (testConds) {
        if (!((UnitGetType(EventUnitTargetUnit()) == "RavenLordTribute"))) {
            return false;
        }
    }

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

    lv_count = MaxI((libCore_gf_IntegerStoredForUnit(EventUnitTargetUnit(), 1) - 1), 0);
    libCore_gf_StoreIntegerForUnit(EventUnitTargetUnit(), 1, lv_count);
    if ((lv_count == 0)) {
        libNtve_gf_TurnAnimationPropertiesOff(libNtve_gf_MainActorofUnit(EventUnitTargetUnit()), "Work");
    }
    else {
    }
    autoC5D651B5_val = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()));
    if (autoC5D651B5_val == libGame_gv_teamOrderIndex_C) {
        libNtve_gf_SendActorMessageToUnit(EventUnitTargetUnit(), "StatusDecrement TributeCaptureOrder");
    }
    else if (autoC5D651B5_val == libGame_gv_teamChaosIndex_C) {
        libNtve_gf_SendActorMessageToUnit(EventUnitTargetUnit(), "StatusDecrement TributeCaptureChaos");
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMRavenTributeCollectCanceled_Init () {
    libMapM_gt_MMRavenTributeCollectCanceled = TriggerCreate("libMapM_gt_MMRavenTributeCollectCanceled_Func");
    TriggerEnable(libMapM_gt_MMRavenTributeCollectCanceled, false);
    TriggerAddEventUnitAbility(libMapM_gt_MMRavenTributeCollectCanceled, null, AbilityCommand("CaptureMacGuffin", 0), c_unitAbilStageCancel, false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Raven Tribute Collect Interrupted
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMRavenTributeCollectInterrupted_Func (bool testConds, bool runActions) {
    int auto6A2ED71E_val;

    // Conditions
    if (testConds) {
        if (!((libMapM_gf_MapMechanicExistsOnMap(1) == true))) {
            return false;
        }
    }

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

    auto6A2ED71E_val = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventPlayerEffectUsedUnit(c_effectUnitCaster)));
    if (auto6A2ED71E_val == libGame_gv_teamOrderIndex_C) {
        libNtve_gf_SendActorMessageToUnit(UnitGroupUnit(libMapM_gv_mMRavenTributes, 1), "StatusDecrement TributeCaptureOrder");
    }
    else if (auto6A2ED71E_val == libGame_gv_teamChaosIndex_C) {
        libNtve_gf_SendActorMessageToUnit(UnitGroupUnit(libMapM_gv_mMRavenTributes, 1), "StatusDecrement TributeCaptureChaos");
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMRavenTributeCollectInterrupted_Init () {
    libMapM_gt_MMRavenTributeCollectInterrupted = TriggerCreate("libMapM_gt_MMRavenTributeCollectInterrupted_Func");
    TriggerAddEventPlayerEffectUsed(libMapM_gt_MMRavenTributeCollectInterrupted, c_playerAny, "CaptureMacguffinDummyDamageResponse");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Raven Tribute Obtained
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMRavenTributeObtained_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_collectedPlayer;
    int lv_collectedTeam;
    int lv_collectedTeamEnemy;
    unit lv_macGuffinUnit;
    int lv_teamIterator;
    string lv_macGuffinCount;
    int lv_regenGlobeOwner;
    point lv_regenGlobePoint;

    // Variable Initialization
    lv_macGuffinUnit = EventPlayerEffectUsedUnit(c_effectUnitTarget);
    lv_macGuffinCount = "";
    lv_regenGlobePoint = UnitGetPosition(lv_macGuffinUnit);

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

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

    TriggerEnable(TriggerGetCurrent(), false);
    lv_collectedPlayer = EventPlayerEffectUsedUnitOwner(c_effectPlayerCaster);
    lv_collectedTeam = libGame_gf_TeamNumberOfPlayer(lv_collectedPlayer);
    lv_collectedTeamEnemy = (3 - lv_collectedTeam);
    libGame_gf_SendEventMapTributePickedUp(lv_collectedPlayer, UnitGetPosition(lv_macGuffinUnit));
    libNtve_gf_SendActorMessageToUnit(lv_macGuffinUnit, "Signal TributeOwnerNeutral");
    libNtve_gf_SendActorMessageToUnit(lv_macGuffinUnit, "StatusSet TributeOwnerChaos 0");
    libNtve_gf_SendActorMessageToUnit(lv_macGuffinUnit, "StatusSet TributeOwnerOrder 0");
    UnitKill(lv_macGuffinUnit);
    libMapM_gv_mMRavenTeamStats[lv_collectedTeam].lv_triburteCollected += 1;
    VisRevealerDestroy(libMapM_gv_mMRavenOrderRevealer);
    VisRevealerDestroy(libMapM_gv_mMRavenChaosRevealer);
    libMapM_gv_mapMechanicUsedTracker[lv_collectedPlayer].lv_ravenTribute = true;
    StatEventCreate("TributeCollected");
    StatEventAddDataFixed(StatEventLastCreated(), "TeamID", lv_collectedTeam);
    StatEventSend(StatEventLastCreated());
    if ((lv_collectedTeam == 1)) {
        lv_regenGlobeOwner = libCore_gv_cOMPUTER_TeamOrder;
    }
    else {
        lv_regenGlobeOwner = libCore_gv_cOMPUTER_TeamChaos;
    }
    libNtve_gf_CreateUnitsWithDefaultFacing(1, "RegenGlobe", c_unitCreateIgnorePlacement, lv_regenGlobeOwner, lv_regenGlobePoint);
    lv_macGuffinCount = IntToString(libMapM_gv_mMRavenTeamStats[lv_teamIterator].lv_triburteCollected);
    if ((libMapM_gv_mMRavenTeamStats[lv_collectedTeam].lv_triburteCollected >= libMapM_gf_MMRavenTributeThresholdAmount())) {
        libMapM_gf_MMRavenTributeCollectionThresholdReached(lv_collectedTeam);
    }
    else {
        libGame_gf_AnnouncementAddItemForPlayerGroup(libGame_gf_PlayersOnTeamHeroes(lv_collectedTeam, false), 0, 0, "RavenTributeAlly", StringExternal("Param/Value/lib_MapM_9B843118"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
        libGame_gf_AnnouncementAddItemForPlayerGroup(libGame_gf_PlayersOnTeamHeroes(lv_collectedTeamEnemy, false), 0, 0, "RavenTributeEnemy", StringExternal("Param/Value/lib_MapM_45503F0C"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
        if ((lv_collectedTeam == 1)) {
            libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 0, 0, "RavenTributeAlly", StringExternal("Param/Value/lib_MapM_AAFBCC51"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
        }
        else {
            libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 0, 0, "RavenTributeAlly", StringExternal("Param/Value/lib_MapM_22F449CC"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
        }
        libMapM_gf_MMRavenStartSpawnTimer5090();
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMRavenTributeObtained_Init () {
    libMapM_gt_MMRavenTributeObtained = TriggerCreate("libMapM_gt_MMRavenTributeObtained_Func");
    TriggerEnable(libMapM_gt_MMRavenTributeObtained, false);
    TriggerAddEventPlayerEffectUsed(libMapM_gt_MMRavenTributeObtained, c_playerAny, "CaptureMacGuffinCastComplete");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Raven Curse Start Light Transition
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMRavenCurseStartLightTransition_Func (bool testConds, bool runActions) {
    int autoBC4A830B_ae;
    int autoBC4A830B_ai;
    int auto5770710C_ae;
    int auto5770710C_ai;

    // Variable Declarations
    int lv_itPlayer;

    // Variable Initialization

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

    autoBC4A830B_ae = libCore_gv_bALMaxPlayers;
    autoBC4A830B_ai = 1;
    lv_itPlayer = 1;
    for ( ; ( (autoBC4A830B_ai >= 0 && lv_itPlayer <= autoBC4A830B_ae) || (autoBC4A830B_ai <= 0 && lv_itPlayer >= autoBC4A830B_ae) ) ; lv_itPlayer += autoBC4A830B_ai ) {
        libGame_gf_SpecialLightingEventStart("StormRavenCourtCurseTransition", PlayerGroupSingle(lv_itPlayer), 1.0);
    }
    PlayerSetLighting(libCore_gv_oBSERVER_ObserverUIPlayer, "StormRavenCourtCurseTransition", 1.0);
    Wait(1.0, c_timeGame);
    auto5770710C_ae = libCore_gv_bALMaxPlayers;
    auto5770710C_ai = 1;
    lv_itPlayer = 1;
    for ( ; ( (auto5770710C_ai >= 0 && lv_itPlayer <= auto5770710C_ae) || (auto5770710C_ai <= 0 && lv_itPlayer >= auto5770710C_ae) ) ; lv_itPlayer += auto5770710C_ai ) {
        libGame_gf_SpecialLightingEventStart("StormRavenCourtCurseFinal", PlayerGroupSingle(lv_itPlayer), 2.0);
    }
    PlayerSetLighting(libCore_gv_oBSERVER_ObserverUIPlayer, "StormRavenCourtCurseFinal", 2.0);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMRavenCurseStartLightTransition_Init () {
    libMapM_gt_MMRavenCurseStartLightTransition = TriggerCreate("libMapM_gt_MMRavenCurseStartLightTransition_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Raven Curse Finished
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMRavenCurseFinished_Func (bool testConds, bool runActions) {
    int autoE00FC9FB_ae;
    int autoE00FC9FB_ai;

    // Variable Declarations
    int lv_itPlayer;
    int lv_cursedTeam;
    int lv_enemyTeam;
    int lv_cursedPlayer;

    // Variable Initialization

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

    SoundChannelMute(PlayerGroupAll(), c_soundCategoryAmbient, false);
    SoundStop(libMapM_gv_mMRavenCurseSound, true);
    SoundPlayForPlayer(SoundLink("Event_RavenCurse_CurseEnd", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);
    libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_allHeroPlayersPlusObserver, 0, 0, "RavenCurseEnemy", StringExternal("Param/Value/lib_MapM_C33F0D2E"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal MM1Off");
    if ((libMapM_gv_mMRavenTeamStats[1].lv_cursed == true)) {
        lv_cursedTeam = 1;
        lv_cursedPlayer = libCore_gv_cOMPUTER_TeamOrder;
        libMapM_gv_mMRavenTeamStats[libGame_gf_TeamNumberOfPlayer(libCore_gv_cOMPUTER_TeamChaos)].lv_triburteCollected = 0;
    }
    else if ((libMapM_gv_mMRavenTeamStats[2].lv_cursed == true)) {
        lv_cursedTeam = 2;
        lv_cursedPlayer = libCore_gv_cOMPUTER_TeamChaos;
        libMapM_gv_mMRavenTeamStats[libGame_gf_TeamNumberOfPlayer(libCore_gv_cOMPUTER_TeamOrder)].lv_triburteCollected = 0;
    }
    else if (true) {
        return true;
    }
    lv_enemyTeam = (3 - lv_cursedTeam);
    libGame_gf_SendEventMapRavenLordCurseEnds();
    libMapM_gf_MMRavenTransmissionEnemyCurseEndsQ(libGame_gf_PlayersOnTeamHeroes(lv_enemyTeam, false));
    libMapM_gf_MMRavenTransmissionAlliedCurseEndsQ(libGame_gf_PlayersOnTeamHeroes(lv_cursedTeam, false));
    libMapM_gf_MMRavenTransmissionObserverCurseEndsQ();
    SoundtrackStop(PlayerGroupAll(), c_soundtrackCategoryMusic, true);
    if ((libCore_gv_mAPMapSoundtrack != null)) {
        SoundtrackPlay(PlayerGroupAll(), c_soundtrackCategoryMusic, libCore_gv_mAPMapSoundtrack, c_soundtrackCueAny, c_soundtrackIndexAny, true);
    }
    else {
    }
    UnitGroupLoopBegin(UnitGroup(null, lv_cursedPlayer, RegionEntireMap(), UnitFilter((1 << c_targetFilterBiological), 0, (1 << c_targetFilterRobotic) | (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
        libMapM_gf_MMRavenRemoveCurseEffectOnMinion(UnitGroupLoopCurrent());
    }
    UnitGroupLoopEnd();
    libMapM_gv_mMRavenTeamStats[1].lv_cursed = false;
    libMapM_gv_mMRavenTeamStats[2].lv_cursed = false;
    libMapM_gv_mMRavenCurseLifted = true;
    autoE00FC9FB_ae = libCore_gv_bALMaxPlayers;
    autoE00FC9FB_ai = 1;
    lv_itPlayer = 1;
    for ( ; ( (autoE00FC9FB_ai >= 0 && lv_itPlayer <= autoE00FC9FB_ae) || (autoE00FC9FB_ai <= 0 && lv_itPlayer >= autoE00FC9FB_ae) ) ; lv_itPlayer += autoE00FC9FB_ai ) {
        libGame_gf_SpecialLightingEventEnd("StormRavenCourtCurseFinal", PlayerGroupSingle(lv_itPlayer), 2.0);
    }
    PlayerSetLighting(libCore_gv_oBSERVER_ObserverUIPlayer, libCore_gv_mAPMapLight, 3.0);
    Wait(libMapM_gv_mMRavenTributePostCurseWaitTime_C, c_timeGame);
    libMapM_gf_MMRavenStartSpawnTimer5090();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMRavenCurseFinished_Init () {
    libMapM_gt_MMRavenCurseFinished = TriggerCreate("libMapM_gt_MMRavenCurseFinished_Func");
    TriggerAddEventTimer(libMapM_gt_MMRavenCurseFinished, libMapM_gv_mMRavenCurseTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Raven Objective UI Handler
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMRavenObjectiveUIHandler_Func (bool testConds, bool runActions) {
    // Variable Declarations
    text lv_tipEffect;
    text lv_tip;
    text lv_tipCursed;
    int lv_indexTeam;
    int lv_indexTeamEnemy;
    int lv_state;
    int lv_lastState;

    // Variable Initialization

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

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

    TriggerEnable(TriggerGetCurrent(), false);
    lv_tipEffect = StringExternal("Param/Value/lib_MapM_E2282CCF");
    TextExpressionSetToken("Param/Expression/lib_MapM_A249BD62", "A", IntToText(libMapM_gv_mMRavenTributeThreshold_C));
    TextExpressionSetToken("Param/Expression/lib_MapM_A249BD62", "B", lv_tipEffect);
    lv_tip = TextExpressionAssemble("Param/Expression/lib_MapM_A249BD62");
    lv_tipCursed = lv_tipEffect;
    while (true) {
        if ((libMapM_gv_mMRavenCurseLifted == true)) {
            lv_state = 3;
            libUIUI_gf_MapMechanicsRavenCourtSetModeForTeam(0, 0);
            Wait(8.0, c_timeGame);
            while (!((libMapM_gv_mMRavenCurseLifted == false))) {
                Wait(0.25, c_timeGame);
            }
            lv_lastState = lv_state;
        }
        else if ((libMapM_gf_MMRavenCurseStarted() == true)) {
            lv_state = 2;
            if ((libMapM_gv_mMRavenTeamStats[1].lv_cursed == true)) {
                lv_indexTeam = 1;
                lv_indexTeamEnemy = 2;
            }
            else {
                lv_indexTeam = 2;
                lv_indexTeamEnemy = 1;
            }
            if ((lv_state != lv_lastState)) {
                libUIUI_gf_MapMechanicsRavenCourtSetModeForTeam(1, lv_indexTeamEnemy);
                libUIUI_gf_MapMechanicsRavenCourtSetTributeCountForTeam(0, lv_indexTeamEnemy);
            }
            else {
            }
            libUIUI_gf_MapMechanicsRavenCourtSetRemainingCurseTimeForTeam(FixedToInt(TimerGetRemaining(libMapM_gv_mMRavenCurseTimer)), lv_indexTeamEnemy);
            lv_lastState = lv_state;
        }
        else if (true) {
            lv_state = 1;
            if ((lv_state != lv_lastState)) {
                libUIUI_gf_MapMechanicsRavenCourtSetModeForTeam(0, 0);
                libUIUI_gf_MapMechanicsRavenCourtShowHidePanel(true);
            }
            else {
            }
            libMapM_gf_MMRavenObjectiveUIUpdateText();
            lv_lastState = lv_state;
        }
        Wait(0.25, c_timeGame);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMRavenObjectiveUIHandler_Init () {
    libMapM_gt_MMRavenObjectiveUIHandler = TriggerCreate("libMapM_gt_MMRavenObjectiveUIHandler_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Raven Debug (Start Elune -es)
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMRavenDebugStartElunees_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {
            return false;
        }
    }

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

    TimerStart(libMapM_gv_mMRavenStartTimer, 1.0, false, c_timeGame);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMRavenDebugStartElunees_Init () {
    libMapM_gt_MMRavenDebugStartElunees = TriggerCreate("libMapM_gt_MMRavenDebugStartElunees_Func");
    TriggerEnable(libMapM_gt_MMRavenDebugStartElunees, false);
    TriggerAddEventChatMessage(libMapM_gt_MMRavenDebugStartElunees, c_playerAny, "-es", true);
    TriggerAddEventChatMessage(libMapM_gt_MMRavenDebugStartElunees, c_playerAny, "EVENTSTART", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Raven Debug (Start Next -en)
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMRavenDebugStartNexten_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {
            return false;
        }
    }

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

    if ((TriggerIsEnabled(libMapM_gt_MMRavenStartSpawning) == true)) {
        TimerStart(libMapM_gv_mMRavenStartTimer, 1.0, false, c_timeGame);
        while (!((TriggerIsEnabled(libMapM_gt_MMRavenStartSpawning) == false))) {
            Wait(0.25, c_timeGame);
        }
    }
    else {
    }
    TimerStart(libMapM_gv_mMRavenWarningTimer, 1.0, false, c_timeGame);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMRavenDebugStartNexten_Init () {
    libMapM_gt_MMRavenDebugStartNexten = TriggerCreate("libMapM_gt_MMRavenDebugStartNexten_Func");
    TriggerEnable(libMapM_gt_MMRavenDebugStartNexten, false);
    TriggerAddEventChatMessage(libMapM_gt_MMRavenDebugStartNexten, c_playerAny, "-en", true);
    TriggerAddEventChatMessage(libMapM_gt_MMRavenDebugStartNexten, c_playerAny, "TRIBUTENEXT", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Raven Debug (Start Curse -ec)
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMRavenDebugStartCurseec_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {
            return false;
        }
    }

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

    if ((TriggerIsEnabled(libMapM_gt_MMRavenStartSpawning) == true)) {
        TimerStart(libMapM_gv_mMRavenStartTimer, 1.0, false, c_timeGame);
        while (!((TriggerIsEnabled(libMapM_gt_MMRavenStartSpawning) == false))) {
            Wait(0.25, c_timeGame);
        }
    }
    else {
    }
    libMapM_gv_mMRavenTeamStats[1].lv_triburteCollected = (libMapM_gv_mMRavenTributeThreshold_C - 1);
    TimerStart(libMapM_gv_mMRavenWarningTimer, 1.0, false, c_timeGame);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMRavenDebugStartCurseec_Init () {
    libMapM_gt_MMRavenDebugStartCurseec = TriggerCreate("libMapM_gt_MMRavenDebugStartCurseec_Func");
    TriggerEnable(libMapM_gt_MMRavenDebugStartCurseec, false);
    TriggerAddEventChatMessage(libMapM_gt_MMRavenDebugStartCurseec, c_playerAny, "-ec", true);
    TriggerAddEventChatMessage(libMapM_gt_MMRavenDebugStartCurseec, c_playerAny, "TRIBUTELAST", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Hero Spawned
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsHeroSpawned_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!((libGame_gf_UnitIsHero(EventUnitCreatedUnit()) == true))) {
            return false;
        }

        if (!((UnitFilterMatch(EventUnitCreatedUnit(), UnitGetOwner(EventUnitCreatedUnit()), UnitFilter(0, 0, 0, (1 << (c_targetFilterHallucination - 32)))) == true))) {
            return false;
        }
    }

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

    TriggerExecute(libMapM_gt_MMCannonballsHeroMapMechanicStatusSetup, true, false);
    libMapM_gf_MMCannonballsSetHeroCannonballsCount(UnitGetOwner(EventUnitCreatedUnit()), 0);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsHeroSpawned_Init () {
    libMapM_gt_MMCannonballsHeroSpawned = TriggerCreate("libMapM_gt_MMCannonballsHeroSpawned_Func");
    TriggerEnable(libMapM_gt_MMCannonballsHeroSpawned, false);
    TriggerAddEventUnitCreated(libMapM_gt_MMCannonballsHeroSpawned, null, null, null);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Hero Map Mechanic Status Setup
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsHeroMapMechanicStatusSetup_Func (bool testConds, bool runActions) {
    // Variable Declarations
    text lv_tooltip;

    // Variable Initialization

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

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

    TriggerEnable(TriggerGetCurrent(), false);
    lv_tooltip = StringExternal("Param/Value/lib_MapM_145A86BF");
    libUIUI_gf_UITargetInfoPanelSetUpMapMechanicInfo("@UI/HUD_Icon_TeamMapMechanic_Doubloon_Small", lv_tooltip);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsHeroMapMechanicStatusSetup_Init () {
    libMapM_gt_MMCannonballsHeroMapMechanicStatusSetup = TriggerCreate("libMapM_gt_MMCannonballsHeroMapMechanicStatusSetup_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Hero Dies
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsHeroDies_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_player;
    int lv_count;
    point lv_spawnLocation;
    unit lv_deadHero;
    unitgroup lv_itemsCarried;
    unit lv_itItem;

    // Variable Initialization
    lv_itemsCarried = UnitGroupEmpty();

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

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

    if ((UnitGetType(libGame_gv_players[libGame_gf_HeroKilledPlayer()].lv_heroUnit) == "HeroAbathur") && (UnitIsAlive(libGame_gv_players[libGame_gf_HeroKilledPlayer()].lv_heroUnit) == true)) {
        return true;
    }
    else {
    }
    lv_player = libGame_gf_HeroKilledPlayer();
    lv_deadHero = libGame_gv_players[lv_player].lv_heroUnit;
    lv_count = libMapM_gf_MMCannonballsHeroCannonballsCount(lv_player);
    lv_itemsCarried = UnitInventoryGroup(lv_deadHero);
    libGame_gf_SendEventDoubloonsDoubloonsDropped(lv_player, lv_count);
    libMapM_gf_MMCannonballsModifyHeroCannonballsCount(lv_player, (lv_count * -1));
    if ((lv_count <= 0)) {
        return true;
    }
    else {
    }
    lv_spawnLocation = libGame_gf_HeroKilledLocaiton();
    Wait(0.25, c_timeGame);
    CatalogFieldValueSet(c_gameCatalogEffect, "DropCannonballsPersistent", "PeriodCount", libCore_gv_cOMPUTER_Neutral, IntToString(lv_count));
    PlayerCreateEffectPoint(libCore_gv_cOMPUTER_Neutral, "DropCannonballsPersistent", lv_spawnLocation);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsHeroDies_Init () {
    libMapM_gt_MMCannonballsHeroDies = TriggerCreate("libMapM_gt_MMCannonballsHeroDies_Func");
    TriggerEnable(libMapM_gt_MMCannonballsHeroDies, false);
    libGame_gf_HeroKilled(libMapM_gt_MMCannonballsHeroDies);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Hero Respawns
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsHeroRespawns_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_player;

    // Variable Initialization

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

        if (!((libGame_gf_UnitIsHero(EventUnit()) == true))) {
            return false;
        }
    }

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

    lv_player = UnitGetOwner(EventUnit());
    libMapM_gf_MMCannonballsSetHeroCannonballsCount(lv_player, 0);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsHeroRespawns_Init () {
    libMapM_gt_MMCannonballsHeroRespawns = TriggerCreate("libMapM_gt_MMCannonballsHeroRespawns_Func");
    TriggerEnable(libMapM_gt_MMCannonballsHeroRespawns, false);
    TriggerAddEventUnitRevive(libMapM_gt_MMCannonballsHeroRespawns, null);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Detect Hero
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsDetectHero_Func (bool testConds, bool runActions) {
    // Variable Declarations
    unitgroup lv_herosInDetectorRegion;

    // Variable Initialization
    lv_herosInDetectorRegion = UnitGroupEmpty();

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

    lv_herosInDetectorRegion = UnitGroup(null, c_playerAny, libMapM_gv_mMCannonballsGhostShipPlayerDetectorRegion, UnitFilter((1 << c_targetFilterHeroic), 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    if ((UnitGroupCount(lv_herosInDetectorRegion, c_unitCountAlive) >= 1)) {
        libNtve_gf_SendActorMessageToGameRegion(libMapM_gv_mMCannonballsGhostShipPlayerDetectorRegion, "Signal OpenChest");
    }
    else {
        if ((UnitGroupCount(lv_herosInDetectorRegion, c_unitCountAlive) <= 0)) {
            libNtve_gf_SendActorMessageToGameRegion(libMapM_gv_mMCannonballsGhostShipPlayerDetectorRegion, "Signal CloseChest");
        }
        else {
        }
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsDetectHero_Init () {
    libMapM_gt_MMCannonballsDetectHero = TriggerCreate("libMapM_gt_MMCannonballsDetectHero_Func");
    TriggerEnable(libMapM_gt_MMCannonballsDetectHero, false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Gates Are Open Complete
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsGatesAreOpenComplete_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    libMapM_gf_MMCannonballsTreasureTheFirstTimer();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsGatesAreOpenComplete_Init () {
    libMapM_gt_MMCannonballsGatesAreOpenComplete = TriggerCreate("libMapM_gt_MMCannonballsGatesAreOpenComplete_Func");
    TriggerEnable(libMapM_gt_MMCannonballsGatesAreOpenComplete, false);
    TriggerAddEventTimer(libMapM_gt_MMCannonballsGatesAreOpenComplete, libGame_gv_openTheGatesTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Camp Spawned
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsCampSpawned_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    TriggerEnable(TriggerGetCurrent(), false);
    Wait(21.0, c_timeGame);
    SoundPlayForPlayer(SoundLink("Doodad_GhostShip_Horn", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);
    Wait(4.0, c_timeGame);
    TriggerExecute(libMapM_gt_MMCannonballsEventStart, true, false);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsCampSpawned_Init () {
    libMapM_gt_MMCannonballsCampSpawned = TriggerCreate("libMapM_gt_MMCannonballsCampSpawned_Func");
    TriggerEnable(libMapM_gt_MMCannonballsCampSpawned, false);
    TriggerAddEventTimer(libMapM_gt_MMCannonballsCampSpawned, libGame_gv_jungleCampStartTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Event Start
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsEventStart_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!((TriggerIsEnabled(TriggerGetCurrent()) == true))) {
            return false;
        }
    }

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

    TriggerEnable(TriggerGetCurrent(), false);
    libMapM_gf_MMCannonballsTransmissionSpawningQ(PlayerGroupAll());
    libNtve_gf_CreateUnitsAtPoint2(1, "JungleBattleship", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Neutral, libMapM_gv_mMCannonballsGhostShipLoc);
    libMapM_gv_mMCannonballsGhostShip = UnitLastCreated();
    UnitSetState(libMapM_gv_mMCannonballsGhostShip, c_unitStateHighlightable, false);
    Wait(4.0, c_timeGame);
    UnitCreate(1, "DocksPirateCaptain", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Neutral, PointWithOffset(libMapM_gv_mMCannonballsGhostShipBeaconLoc, -0.85, 1.0), PointGetFacing(libMapM_gv_mMCannonballsGhostShipBeaconLoc));
    libMapM_gv_mMCannonballsGhostShipCaptain = UnitLastCreated();
    Wait(1.0, c_timeGame);
    UnitCreate(1, "GhostShipBeacon", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Neutral, PointWithOffset(libMapM_gv_mMCannonballsGhostShipBeaconLoc, 0.75, -0.25), PointGetFacing(libMapM_gv_mMCannonballsGhostShipBeaconLoc));
    libMapM_gv_mMCannonballsGhostShipBeacon = UnitLastCreated();
    libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_allHeroPlayersPlusObserver, 0, 0, "GhostShipEvent", StringExternal("Param/Value/lib_MapM_22E52C7B"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "StormPingAlert", UnitGetPosition(libMapM_gv_mMCannonballsGhostShip), ColorWithAlpha(100.00, 100.00, 0.00, 0.00), 3.0, 270.0);
    libMapM_gv_mMCannonballsGhostShipPlayerDetectorRegion = RegionCircle(UnitGetPosition(libMapM_gv_mMCannonballsGhostShipBeacon), 10.0);
    TriggerEnable(libMapM_gt_MMCannonballsDetectHero, true);
    TriggerExecute(libMapM_gt_MMCannonballsObjectiveUIHandler, true, false);
    libGame_gf_SendEventDoubloonsGhostShipShowsUp(libMapM_gv_mMCannonballsGhostShipBeacon);
    Wait(2.0, c_timeGame);
    libUIUI_gf_AttachHelpButtonToUnit(libMapM_gv_mMCannonballsGhostShipBeacon, libMapM_gt_MMHelpbuttonClicked, StringExternal("Param/Value/lib_MapM_E65C7E11"), 70, 275);
    libNtve_gf_SendActorMessageToGameRegion(libMapM_gv_mMCannonballsGhostShipPlayerDetectorRegion, "Signal OpenChest");
    UnitSetState(libMapM_gv_mMCannonballsGhostShip, c_unitStateHighlightable, true);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsEventStart_Init () {
    libMapM_gt_MMCannonballsEventStart = TriggerCreate("libMapM_gt_MMCannonballsEventStart_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Hero Pickup
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsHeroPickup_Func (bool testConds, bool runActions) {
    // Variable Declarations
    unit lv_heroUnit;
    unitgroup lv_itemsCarried;
    unit lv_itItem;
    string lv_chargeLink;

    // Variable Initialization
    lv_itemsCarried = UnitGroupEmpty();
    lv_chargeLink = "";

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

    lv_heroUnit = EventUnitTargetUnit();
    libMapM_gf_MMCannonballsModifyHeroCannonballsCount(UnitGetOwner(lv_heroUnit), 1);
    libGame_gf_SendEventDoubloonsDoubloonCollected(UnitGetOwner(lv_heroUnit));
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsHeroPickup_Init () {
    libMapM_gt_MMCannonballsHeroPickup = TriggerCreate("libMapM_gt_MMCannonballsHeroPickup_Func");
    TriggerEnable(libMapM_gt_MMCannonballsHeroPickup, false);
    TriggerAddEventUnitAbility(libMapM_gt_MMCannonballsHeroPickup, null, AbilityCommand("ItemDoubloonPickup", 0), c_abilEffectStageCast, false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Balls Handed In
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsBallsHandedIn_Func (bool testConds, bool runActions) {
    int auto00CA6EA5_val;

    // Variable Declarations
    int lv_handInPlayer;
    int lv_handInTeam;
    int lv_handInTeamPlayer;
    int lv_handInTeamEnemy;
    playergroup lv_soundPlayerGroup;
    int lv_cannonballsHandedIn;

    // Variable Initialization
    lv_soundPlayerGroup = PlayerGroupEmpty();

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

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

    lv_handInPlayer = EventPlayerEffectUsedUnitOwner(c_effectPlayerCaster);
    lv_handInTeam = libGame_gf_TeamNumberOfPlayer(lv_handInPlayer);
    if (((libMapM_gv_mMCannonballsBallsSubmitted[1] >= libMapM_gf_MMCannonballsPirateShipCost(1)) || (libMapM_gv_mMCannonballsBallsSubmitted[2] >= libMapM_gf_MMCannonballsPirateShipCost(2)))) {
        return true;
    }
    else {
    }
    auto00CA6EA5_val = lv_handInTeam;
    if (auto00CA6EA5_val == 1) {
        lv_handInTeamPlayer = libCore_gv_cOMPUTER_TeamOrder;
    }
    else if (auto00CA6EA5_val == 2) {
        lv_handInTeamPlayer = libCore_gv_cOMPUTER_TeamChaos;
    }
    else {
        return true;
    }
    lv_handInTeamEnemy = (3 - lv_handInTeam);
    lv_cannonballsHandedIn = MinI(libMapM_gf_MMCannonballsHeroCannonballsCount(lv_handInPlayer), (libMapM_gf_MMCannonballsPirateShipCost(lv_handInTeam) - libMapM_gv_mMCannonballsBallsSubmitted[lv_handInTeam]));
    libGame_gf_SendEventDoubloonsDoubloonsTurnedIn(lv_handInPlayer, lv_cannonballsHandedIn);
    TextExpressionSetToken("Param/Expression/lib_MapM_3948C3A5", "A", IntToText(lv_cannonballsHandedIn));
    TextTagCreate(TextExpressionAssemble("Param/Expression/lib_MapM_3948C3A5"), 24, UnitGetPosition(libMapM_gv_mMCannonballsGhostShipBeacon), 3.0, true, true, libGame_gf_PlayersOnTeamHeroes(lv_handInTeam, false));
    TextTagSetVelocity(TextTagLastCreated(), 1.5, 90.0);
    TextTagSetFogVisibility(TextTagLastCreated(), c_visTypeFog);
    TextTagSetTime(TextTagLastCreated(), c_textTagTimeDuration, 4.0);
    TextExpressionSetToken("Param/Expression/lib_MapM_06B7AC3F", "A", IntToText(lv_cannonballsHandedIn));
    TextTagCreate(TextExpressionAssemble("Param/Expression/lib_MapM_06B7AC3F"), 24, UnitGetPosition(libMapM_gv_mMCannonballsGhostShipBeacon), 3.0, true, true, libGame_gf_PlayersOnTeamHeroes(lv_handInTeamEnemy, false));
    TextTagSetVelocity(TextTagLastCreated(), 1.5, 90.0);
    TextTagSetFogVisibility(TextTagLastCreated(), c_visTypeFog);
    TextTagSetTime(TextTagLastCreated(), c_textTagTimeDuration, 4.0);
    TextExpressionSetToken("Param/Expression/lib_MapM_CB7B62FE", "A", IntToText(lv_cannonballsHandedIn));
    TextTagCreate(TextExpressionAssemble("Param/Expression/lib_MapM_CB7B62FE"), 24, UnitGetPosition(libMapM_gv_mMCannonballsGhostShipBeacon), 3.0, true, true, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer]);
    TextTagSetVelocity(TextTagLastCreated(), 1.5, 90.0);
    TextTagSetFogVisibility(TextTagLastCreated(), c_visTypeFog);
    TextTagSetTime(TextTagLastCreated(), c_textTagTimeDuration, 4.0);
    lv_soundPlayerGroup = PlayerGroupCopy(PlayerGroupAll());
    PlayerGroupRemove(lv_soundPlayerGroup, lv_handInPlayer);
    SoundPlayAtPointForPlayer(SoundLink("UI_Doubloon_Pickup", -1), c_maxPlayers, lv_soundPlayerGroup, UnitGetPosition(libMapM_gv_mMCannonballsGhostShipBeacon), 2.0, 100.0, 0.0);
    SoundPlayForPlayer(SoundLink("UI_Doubloon_Pickup", -1), c_maxPlayers, PlayerGroupSingle(lv_handInPlayer), 100.0, 0.0);
    if ((libMapM_gv_mapMechanicUsedTracker[lv_handInPlayer].lv_docksTurnInPoint == false)) {
        libMapM_gv_mapMechanicUsedTracker[lv_handInPlayer].lv_docksTurnInPoint = true;
        libUIUI_gf_ShowHideHelpButtonOnUnitForPlayer(lv_handInPlayer, false, libMapM_gv_mMCannonballsGhostShipBeacon);
    }
    else {
    }
    libMapM_gv_mMCannonballsBallsSubmitted[lv_handInTeam] += lv_cannonballsHandedIn;
    libMapM_gf_MMCannonballsSetHeroCannonballsCount(lv_handInPlayer, (libMapM_gf_MMCannonballsHeroCannonballsCount(lv_handInPlayer) - lv_cannonballsHandedIn));
    if ((libMapM_gf_MMCannonballsTeamCannonballsCount(lv_handInTeam) >= libMapM_gf_MMCannonballsPirateShipCost(lv_handInTeam))) {
        libGame_gv_teams[lv_handInTeam].lv_map_CannonFirings += 1;
        libMapM_gf_MMCannonballsGhostShipWakeUp(lv_handInTeam, false);
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsBallsHandedIn_Init () {
    libMapM_gt_MMCannonballsBallsHandedIn = TriggerCreate("libMapM_gt_MMCannonballsBallsHandedIn_Func");
    TriggerEnable(libMapM_gt_MMCannonballsBallsHandedIn, false);
    TriggerAddEventPlayerEffectUsed(libMapM_gt_MMCannonballsBallsHandedIn, c_playerAny, "CaptureMacGuffinCastComplete");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs ObjectiveUI Handler
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsObjectiveUIHandler_Func (bool testConds, bool runActions) {
    // Variable Declarations
    text lv_tip;
    int lv_indexTeam;
    int lv_indexTeamEnemy;
    int lv_state;
    int lv_lastState;

    // Variable Initialization

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

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

    TriggerEnable(TriggerGetCurrent(), false);
    lv_tip = StringExternal("Param/Value/lib_MapM_3E10B1D9");
    libUIUI_gf_MapMechanicsBlackheartsBayShowHidePanel(true);
    while (true) {
        if ((UnitGetOwner(libMapM_gv_mMCannonballsGhostShip) != libCore_gv_cOMPUTER_Neutral)) {
            lv_state = 2;
            lv_indexTeam = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(libMapM_gv_mMCannonballsGhostShip));
            lv_indexTeamEnemy = (3 - lv_indexTeam);
            if ((lv_state != lv_lastState)) {
                libUIUI_gf_MapMechanicsBlackheartsBaySetMode(1);
                libUIUI_gf_MapMechanicsBlackheartsBayShowCannonballForTeam(lv_indexTeam);
            }
            else {
            }
            libUIUI_gf_MapMechanicsBlackheartsBaySetShotCountForTeam(libMapM_gf_MMCannonballsBattleshipAmmoLeft(), lv_indexTeam);
            lv_lastState = lv_state;
        }
        else if ((UnitIsAlive(libMapM_gv_mMCannonballsGhostShip) == true)) {
            lv_state = 1;
            if ((lv_state != lv_lastState)) {
                libUIUI_gf_MapMechanicsBlackheartsBaySetMode(0);
            }
            else {
            }
            lv_lastState = lv_state;
        }
        libMapM_gf_MMCannonballsObjectiveUIUpdateText();
        Wait(0.5, c_timeGame);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsObjectiveUIHandler_Init () {
    libMapM_gt_MMCannonballsObjectiveUIHandler = TriggerCreate("libMapM_gt_MMCannonballsObjectiveUIHandler_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Doubloon Created
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsDoubloonCreated_Func (bool testConds, bool runActions) {
    int auto350159A6_n;
    int auto350159A6_i;
    int auto66D96A69_ae;
    int auto66D96A69_ai;
    int autoE1F793CC_ae;
    int autoE1F793CC_ai;
    int autoF031688E_ae;
    int autoF031688E_ai;

    // Variable Declarations
    int lv_itPlayer;

    // Variable Initialization

    // Conditions
    if (testConds) {
        if (!((UnitGetType(EventUnitCreatedUnit()) == "ItemCannonball"))) {
            return false;
        }
    }

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

    auto350159A6_n = 5;
    for (auto350159A6_i = 1; auto350159A6_i <= auto350159A6_n; auto350159A6_i += 1) {
        if ((UnitIsAlive(EventUnitCreatedUnit()) == false)) {
            return true;
        }
        else {
        }
        auto66D96A69_ae = libCore_gv_bALMaxPlayers;
        auto66D96A69_ai = 1;
        lv_itPlayer = 1;
        for ( ; ( (auto66D96A69_ai >= 0 && lv_itPlayer <= auto66D96A69_ae) || (auto66D96A69_ai <= 0 && lv_itPlayer >= auto66D96A69_ae) ) ; lv_itPlayer += auto66D96A69_ai ) {
            if ((libNtve_gf_UnitIsVisibleToPlayer(EventUnitCreatedUnit(), lv_itPlayer) == true)) {
                libNtve_gf_ShareVisionofUnit(EventUnitCreatedUnit(), true, lv_itPlayer);
            }
            else {
            }
        }
        Wait(1.0, c_timeGame);
    }
    autoE1F793CC_ae = libCore_gv_bALMaxPlayers;
    autoE1F793CC_ai = 1;
    lv_itPlayer = 1;
    for ( ; ( (autoE1F793CC_ai >= 0 && lv_itPlayer <= autoE1F793CC_ae) || (autoE1F793CC_ai <= 0 && lv_itPlayer >= autoE1F793CC_ae) ) ; lv_itPlayer += autoE1F793CC_ai ) {
        libNtve_gf_ShareVisionofUnit(EventUnitCreatedUnit(), true, lv_itPlayer);
    }
    while (!((UnitIsAlive(EventUnitCreatedUnit()) == false))) {
        Wait(1.0, c_timeGame);
    }
    autoF031688E_ae = libCore_gv_bALMaxPlayers;
    autoF031688E_ai = 1;
    lv_itPlayer = 1;
    for ( ; ( (autoF031688E_ai >= 0 && lv_itPlayer <= autoF031688E_ae) || (autoF031688E_ai <= 0 && lv_itPlayer >= autoF031688E_ae) ) ; lv_itPlayer += autoF031688E_ai ) {
        libNtve_gf_ShareVisionofUnit(EventUnitCreatedUnit(), false, lv_itPlayer);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsDoubloonCreated_Init () {
    libMapM_gt_MMCannonballsDoubloonCreated = TriggerCreate("libMapM_gt_MMCannonballsDoubloonCreated_Func");
    TriggerEnable(libMapM_gt_MMCannonballsDoubloonCreated, false);
    TriggerAddEventUnitCreated(libMapM_gt_MMCannonballsDoubloonCreated, null, null, null);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Open Chest Upon Respawn
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsOpenChestUponRespawn_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    Wait(3.0, c_timeGame);
    libNtve_gf_SendActorMessageToGameRegion(libMapM_gv_mMCannonballsGhostShipPlayerDetectorRegion, "Signal OpenChest");
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsOpenChestUponRespawn_Init () {
    libMapM_gt_MMCannonballsOpenChestUponRespawn = TriggerCreate("libMapM_gt_MMCannonballsOpenChestUponRespawn_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Battleship Shooting Missile Created
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsBattleshipShootingMissileCreated_Func (bool testConds, bool runActions) {
    // Variable Declarations
    unit lv_missile;
    int lv_pingBall;
    int lv_pingTrail;
    point lv_missilePosition;
    sound lv_ballLoopingSound;

    // Variable Initialization
    lv_pingBall = c_invalidPingId;
    lv_pingTrail = c_invalidPingId;

    // Conditions
    if (testConds) {
        if (!((UnitGetType(EventUnitCreatedUnit()) == "BattleshipBombardMissile"))) {
            return false;
        }
    }

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

    libMapM_gv_mMCannonballsGhostShipMissile = EventUnitCreatedUnit();
    lv_missile = libMapM_gv_mMCannonballsGhostShipMissile;
    libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "BattleshipBombardMissile", UnitGetPosition(lv_missile), ColorWithAlpha(0.00, 0.00, 0.00, 0.00), 0.0, UnitGetFacing(lv_missile));
    lv_pingBall = PingLastCreated();
    PingSetScale(PingLastCreated(), 0.08);
    PingSetUnit(PingLastCreated(), lv_missile);
    Wait(0.125, c_timeGame);
    libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "DemonHunterHungeringArrowMissile", UnitGetPosition(lv_missile), ColorWithAlpha(0.00, 0.00, 0.00, 0.00), 0.0, UnitGetFacing(lv_missile));
    lv_pingTrail = PingLastCreated();
    PingSetScale(PingLastCreated(), 0.2);
    PingSetUnit(PingLastCreated(), lv_missile);
    SoundPlayOnUnitForPlayer(SoundLink("Event_GhostShip_CannonBall_Loop", -1), c_maxPlayers, PlayerGroupAll(), lv_missile, 0.0, 100.0, 0.0);
    lv_ballLoopingSound = SoundLastPlayed();
    while (true) {
        if ((UnitIsAlive(lv_missile) == false)) {
            SoundStop(lv_ballLoopingSound, true);
            PingDestroy(lv_pingBall);
            PingDestroy(lv_pingTrail);
            libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "BattleshipBombardImpact", lv_missilePosition, ColorWithAlpha(0.00, 0.00, 0.00, 0.00), 0.0625, 270.0);
            SoundPlayForPlayer(SoundLink("Event_GhostShip_Cannon_Explo_Distant", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);
            PingSetScale(PingLastCreated(), 0.1);
            libMapM_gf_MMCannonballsBattleshipShootingShakingCamera(lv_missilePosition);
            return true;
        }
        else {
        }
        lv_missilePosition = UnitGetPosition(lv_missile);
        Wait(0.0625, c_timeGame);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsBattleshipShootingMissileCreated_Init () {
    libMapM_gt_MMCannonballsBattleshipShootingMissileCreated = TriggerCreate("libMapM_gt_MMCannonballsBattleshipShootingMissileCreated_Func");
    TriggerEnable(libMapM_gt_MMCannonballsBattleshipShootingMissileCreated, false);
    TriggerAddEventUnitCreated(libMapM_gt_MMCannonballsBattleshipShootingMissileCreated, null, null, null);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Battleship Killed A Town
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsBattleshipKilledATown_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!(((UnitGetType(EventUnit()) == "TownTownHallL1") || (UnitGetType(EventUnit()) == "TownTownHallL2") || (UnitGetType(EventUnit()) == "TownTownHallL3")))) {
            return false;
        }

        if (!((libNtve_gf_KillingUnit() == libMapM_gv_mMCannonballsGhostShip))) {
            return false;
        }

        if (!((libGame_gv_gameOver == false))) {
            return false;
        }
    }

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

    SoundPlayForPlayer(SoundLink("GhostShipCrew_TownKill", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsBattleshipKilledATown_Init () {
    libMapM_gt_MMCannonballsBattleshipKilledATown = TriggerCreate("libMapM_gt_MMCannonballsBattleshipKilledATown_Func");
    TriggerEnable(libMapM_gt_MMCannonballsBattleshipKilledATown, false);
    TriggerAddEventUnitDied(libMapM_gt_MMCannonballsBattleshipKilledATown, null);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Treasure Spawn Chests
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsTreasureSpawnChests_Func (bool testConds, bool runActions) {
    int auto3446CC47_ae;
    playergroup autoE78FFB98_g;
    int autoE78FFB98_p;
    playergroup auto817F775A_g;
    int auto817F775A_p;

    // Variable Declarations
    int lv_p;
    int lv_iter;

    // Variable Initialization

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

    auto3446CC47_ae = libMapM_gv_mMCannonballsTreasureChestMaxCount_C;
    lv_iter = 1;
    for ( ; lv_iter <= auto3446CC47_ae ; lv_iter += 1 ) {
        libNtve_gf_CreateUnitsAtPoint2(1, "DocksTreasureChest", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Hostile, libMapM_gv_mMCannonballsGhostChestLocations[lv_iter]);
        libMapM_gv_mMCannonballsTreasureChestChests[lv_iter] = UnitLastCreated();
        libGame_gf_SendEventMapChestSpawned(UnitLastCreated());
        autoE78FFB98_g = libCore_gv_allHeroPlayersPlusObserver; 
        autoE78FFB98_p = 1;
        for ( ; autoE78FFB98_p <= PlayerGroupCount(autoE78FFB98_g) ; autoE78FFB98_p += BoolToInt(lv_p == PlayerGroupPlayer(autoE78FFB98_g, autoE78FFB98_p)) ) {
            lv_p = PlayerGroupPlayer(autoE78FFB98_g, autoE78FFB98_p);
            VisRevealArea(lv_p, RegionCircle(UnitGetPosition(UnitLastCreated()), 1.0), 1.0, false);
        }
        TextTagCreate(libMapM_gf_MMCannonballsTreasureSetTextTagHelp(), 16, UnitGetPosition(libMapM_gv_mMCannonballsTreasureChestChests[lv_iter]), 1.0, false, false, PlayerGroupAll());
        libCore_gf_StoreTextTagForUnit(libMapM_gv_mMCannonballsTreasureChestChests[lv_iter], 1, TextTagLastCreated());
        TextTagAttachToUnit(TextTagLastCreated(), libMapM_gv_mMCannonballsTreasureChestChests[lv_iter], 5.0);
        auto817F775A_g = libCore_gv_activeHumanPlayers; 
        auto817F775A_p = 1;
        for ( ; auto817F775A_p <= PlayerGroupCount(auto817F775A_g) ; auto817F775A_p += BoolToInt(lv_p == PlayerGroupPlayer(auto817F775A_g, auto817F775A_p)) ) {
            lv_p = PlayerGroupPlayer(auto817F775A_g, auto817F775A_p);
            if ((libMapM_gv_mapMechanicUsedTracker[lv_p].lv_docksDoubloonsChest == false)) {
                TextTagShow(libCore_gf_TextTagStoredForUnit(libMapM_gv_mMCannonballsTreasureChestChests[lv_iter], 1), PlayerGroupAll(), true);
            }
            else {
            }
        }
        TextTagCreate(libMapM_gf_MMCannonballsTreasureSetTextTagDoubloonCount(libMapM_gv_mMCannonballsGhostChestCoinsDrop_C), 16, UnitGetPosition(libMapM_gv_mMCannonballsTreasureChestChests[lv_iter]), 1.0, false, false, PlayerGroupAll());
        libCore_gf_StoreTextTagForUnit(libMapM_gv_mMCannonballsTreasureChestChests[lv_iter], 2, TextTagLastCreated());
        TextTagAttachToUnit(TextTagLastCreated(), libMapM_gv_mMCannonballsTreasureChestChests[lv_iter], 4.0);
        TextTagShow(libCore_gf_TextTagStoredForUnit(libMapM_gv_mMCannonballsTreasureChestChests[lv_iter], 2), PlayerGroupAll(), true);
    }
    TriggerEnable(libMapM_gt_MMCannonballsTreasureChestsAreDead, true);
    TriggerEnable(libMapM_gt_MMCannonballsTreasureAChestDies, true);
    TriggerEnable(libMapM_gt_MMCannonballsTreasureChestSpawnsDoubloon, true);
    TriggerEnable(libMapM_gt_MMCannonballsTreasureChestPingTimerExpires, true);
    TimerStart(libMapM_gv_mMCannonballsTreasureChestPingTimer, 0.25, false, c_timeGame);
    if ((libMapM_gv_mMCannonballsTreasureChestIsFirstChest == true)) {
        libMapM_gv_mMCannonballsTreasureChestIsFirstChest = false;
        libMapM_gf_MMCannonballsTransmissionChestSpawningFirstTimeQ(PlayerGroupAll());
    }
    else {
        libMapM_gf_MMCannonballsTransmissionChestSpawningQ(PlayerGroupAll());
    }
    libGame_gf_AnnouncementAddItemForPlayerGroup(PlayerGroupAll(), 0, 0, "GhostShipTreasureSpawn", StringExternal("Param/Value/lib_MapM_29AF53D5"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsTreasureSpawnChests_Init () {
    libMapM_gt_MMCannonballsTreasureSpawnChests = TriggerCreate("libMapM_gt_MMCannonballsTreasureSpawnChests_Func");
    TriggerEnable(libMapM_gt_MMCannonballsTreasureSpawnChests, false);
    TriggerAddEventTimer(libMapM_gt_MMCannonballsTreasureSpawnChests, libMapM_gv_mMCannonballsTreasureChestTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Treasure Chest Spawns Doubloon
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsTreasureChestSpawnsDoubloon_Func (bool testConds, bool runActions) {
    // Variable Declarations
    unit lv_chest;
    int lv_coinsLeft;

    // Variable Initialization
    lv_chest = EventPlayerEffectUsedUnit(c_effectUnitCaster);

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

    if ((UnitGetPropertyFixed(lv_chest, c_unitPropLifePercent, c_unitPropCurrent) > 34.0)) {
        lv_coinsLeft = (libMapM_gv_mMCannonballsGhostChestCoinsDrop_C - 1);
    }
    else {
        lv_coinsLeft = (libMapM_gv_mMCannonballsGhostChestCoinsDrop_C - 2);
    }
    TextTagSetText(libCore_gf_TextTagStoredForUnit(lv_chest, 2), libMapM_gf_MMCannonballsTreasureSetTextTagDoubloonCount(lv_coinsLeft));
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsTreasureChestSpawnsDoubloon_Init () {
    libMapM_gt_MMCannonballsTreasureChestSpawnsDoubloon = TriggerCreate("libMapM_gt_MMCannonballsTreasureChestSpawnsDoubloon_Func");
    TriggerEnable(libMapM_gt_MMCannonballsTreasureChestSpawnsDoubloon, false);
    TriggerAddEventPlayerEffectUsed(libMapM_gt_MMCannonballsTreasureChestSpawnsDoubloon, c_playerAny, "TreasureChestDrop1DoubloonPersistent");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Treasure Chest Ping Timer Expires
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsTreasureChestPingTimerExpires_Func (bool testConds, bool runActions) {
    int auto99FFF1ED_ae;

    // Variable Declarations
    int lv_iter;

    // Variable Initialization

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

    auto99FFF1ED_ae = libMapM_gv_mMCannonballsTreasureChestMaxCount_C;
    lv_iter = 1;
    for ( ; lv_iter <= auto99FFF1ED_ae ; lv_iter += 1 ) {
        if ((UnitIsAlive(libMapM_gv_mMCannonballsTreasureChestChests[lv_iter]) == true)) {
            libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "StormPingAlert", UnitGetPosition(libMapM_gv_mMCannonballsTreasureChestChests[lv_iter]), ColorWithAlpha(100.00, 100.00, 0.00, 0.00), 5.0, 270.0);
            libCore_gf_StorePingForUnit(libMapM_gv_mMCannonballsTreasureChestChests[lv_iter], 1, PingLastCreated());
        }
        else {
        }
    }
    TimerStart(libMapM_gv_mMCannonballsTreasureChestPingTimer, libMapM_gv_mMCannonballsTreasureChestPingTimerTime, false, c_timeGame);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsTreasureChestPingTimerExpires_Init () {
    libMapM_gt_MMCannonballsTreasureChestPingTimerExpires = TriggerCreate("libMapM_gt_MMCannonballsTreasureChestPingTimerExpires_Func");
    TriggerEnable(libMapM_gt_MMCannonballsTreasureChestPingTimerExpires, false);
    TriggerAddEventTimer(libMapM_gt_MMCannonballsTreasureChestPingTimerExpires, libMapM_gv_mMCannonballsTreasureChestPingTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Treasure A Chest Dies
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsTreasureAChestDies_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    TextTagDestroy(libCore_gf_TextTagStoredForUnit(EventUnit(), 1));
    TextTagDestroy(libCore_gf_TextTagStoredForUnit(EventUnit(), 2));
    PingDestroy(libCore_gf_PingStoredForUnit(EventUnit(), 1));
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsTreasureAChestDies_Init () {
    libMapM_gt_MMCannonballsTreasureAChestDies = TriggerCreate("libMapM_gt_MMCannonballsTreasureAChestDies_Func");
    TriggerEnable(libMapM_gt_MMCannonballsTreasureAChestDies, false);
    TriggerAddEventUnitDied(libMapM_gt_MMCannonballsTreasureAChestDies, UnitRefFromVariable("libMapM_gv_mMCannonballsTreasureChestChests[1]"));
    TriggerAddEventUnitDied(libMapM_gt_MMCannonballsTreasureAChestDies, UnitRefFromVariable("libMapM_gv_mMCannonballsTreasureChestChests[2]"));
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Treasure Chests Are Dead
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsTreasureChestsAreDead_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!(((UnitIsAlive(libMapM_gv_mMCannonballsTreasureChestChests[1]) == false) && (UnitIsAlive(libMapM_gv_mMCannonballsTreasureChestChests[2]) == false) && (TriggerIsEnabled(TriggerGetCurrent()) == true)))) {
            return false;
        }
    }

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

    TriggerEnable(TriggerGetCurrent(), false);
    TriggerEnable(libMapM_gt_MMCannonballsTreasureAChestDies, false);
    TriggerEnable(libMapM_gt_MMCannonballsTreasureChestSpawnsDoubloon, false);
    TriggerEnable(libMapM_gt_MMCannonballsTreasureChestPingTimerExpires, false);
    libMapM_gf_MMCannonballsTreasureStartTimer();
    libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "StormPingSimple", UnitGetPosition(EventUnit()), ColorWithAlpha(100.00, 100.00, 0.00, 0.00), 3.0, 270.0);
    TextTagDestroy(libCore_gf_TextTagStoredForUnit(EventUnit(), 1));
    TextTagDestroy(libCore_gf_TextTagStoredForUnit(EventUnit(), 2));
    libGame_gf_AnnouncementAddItemForPlayerGroup(PlayerGroupAll(), 0, 0, "GhostShipTreasureDestroyed", StringExternal("Param/Value/lib_MapM_D68E7FA4"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsTreasureChestsAreDead_Init () {
    libMapM_gt_MMCannonballsTreasureChestsAreDead = TriggerCreate("libMapM_gt_MMCannonballsTreasureChestsAreDead_Func");
    TriggerEnable(libMapM_gt_MMCannonballsTreasureChestsAreDead, false);
    TriggerAddEventUnitDied(libMapM_gt_MMCannonballsTreasureChestsAreDead, UnitRefFromVariable("libMapM_gv_mMCannonballsTreasureChestChests[1]"));
    TriggerAddEventUnitDied(libMapM_gt_MMCannonballsTreasureChestsAreDead, UnitRefFromVariable("libMapM_gv_mMCannonballsTreasureChestChests[2]"));
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Treasure Chest Attacked
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsTreasureChestAttacked_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_attackingPlayer;

    // Variable Initialization
    lv_attackingPlayer = UnitGetOwner(EventUnitTarget());

    // Conditions
    if (testConds) {
        if (!((lv_attackingPlayer > 0))) {
            return false;
        }

        if (!((lv_attackingPlayer <= libCore_gv_bALMaxPlayers))) {
            return false;
        }
    }

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

    if ((libMapM_gv_mapMechanicUsedTracker[lv_attackingPlayer].lv_docksDoubloonsChest == false)) {
        libMapM_gv_mapMechanicUsedTracker[lv_attackingPlayer].lv_docksDoubloonsChest = true;
        TextTagShow(libCore_gf_TextTagStoredForUnit(libMapM_gv_mMCannonballsTreasureChestChests[1], 1), libCore_gv_playerGroupFromPlayer[lv_attackingPlayer], false);
        TextTagShow(libCore_gf_TextTagStoredForUnit(libMapM_gv_mMCannonballsTreasureChestChests[2], 1), libCore_gv_playerGroupFromPlayer[lv_attackingPlayer], false);
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsTreasureChestAttacked_Init () {
    libMapM_gt_MMCannonballsTreasureChestAttacked = TriggerCreate("libMapM_gt_MMCannonballsTreasureChestAttacked_Func");
    TriggerEnable(libMapM_gt_MMCannonballsTreasureChestAttacked, false);
    TriggerAddEventUnitAttacked2(libMapM_gt_MMCannonballsTreasureChestAttacked, UnitRefFromVariable("libMapM_gv_mMCannonballsTreasureChestChests[1]"), null);
    TriggerAddEventUnitAttacked2(libMapM_gt_MMCannonballsTreasureChestAttacked, UnitRefFromVariable("libMapM_gv_mMCannonballsTreasureChestChests[2]"), null);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Shooting Start
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsShootingStart_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    libGame_gf_SpecialLightingEventStart("StormKingsCrestDocksNight", PlayerGroupAll(), 10.0);
    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal MM1On");
    SoundtrackPlay(PlayerGroupAll(), c_soundtrackCategoryMusic, "Storm_Music_GhostShip_Start", c_soundtrackCueAny, c_soundtrackIndexAny, true);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsShootingStart_Init () {
    libMapM_gt_MMCannonballsShootingStart = TriggerCreate("libMapM_gt_MMCannonballsShootingStart_Func");
    TriggerEnable(libMapM_gt_MMCannonballsShootingStart, false);
    libGame_gf_MapDoubloonsGhostShipShootingStart(libMapM_gt_MMCannonballsShootingStart);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Shooting End
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsShootingEnd_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    libGame_gf_SpecialLightingEventEnd("StormKingsCrestDocksNight", PlayerGroupAll(), 7.5);
    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal MM1Off");
    SoundtrackStop(PlayerGroupAll(), c_soundtrackCategoryMusic, true);
    if ((libCore_gv_mAPMapSoundtrack != null)) {
        SoundtrackPlay(PlayerGroupAll(), c_soundtrackCategoryMusic, libCore_gv_mAPMapSoundtrack, c_soundtrackCueAny, c_soundtrackIndexAny, true);
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsShootingEnd_Init () {
    libMapM_gt_MMCannonballsShootingEnd = TriggerCreate("libMapM_gt_MMCannonballsShootingEnd_Func");
    TriggerEnable(libMapM_gt_MMCannonballsShootingEnd, false);
    libGame_gf_MapDoubloonsGhostShipShootingEnd(libMapM_gt_MMCannonballsShootingEnd);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Debug Event Start
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsDebugEventStart_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {
            return false;
        }
    }

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

    TriggerExecute(libMapM_gt_MMCannonballsEventStart, true, false);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsDebugEventStart_Init () {
    libMapM_gt_MMCannonballsDebugEventStart = TriggerCreate("libMapM_gt_MMCannonballsDebugEventStart_Func");
    TriggerEnable(libMapM_gt_MMCannonballsDebugEventStart, false);
    TriggerAddEventChatMessage(libMapM_gt_MMCannonballsDebugEventStart, c_playerAny, "EVENTSTART", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Cannonballs Debug Modify
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMCannonballsDebugModify_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {
            return false;
        }
    }

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

    libMapM_gf_MMCannonballsModifyHeroCannonballsCount(UnitGetOwner(UnitGroupUnit(UnitGroupSelected(EventPlayer()), 1)), StringToInt(StringWord(EventChatMessage(false), 2)));
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMCannonballsDebugModify_Init () {
    libMapM_gt_MMCannonballsDebugModify = TriggerCreate("libMapM_gt_MMCannonballsDebugModify_Func");
    TriggerEnable(libMapM_gt_MMCannonballsDebugModify, false);
    TriggerAddEventChatMessage(libMapM_gt_MMCannonballsDebugModify, c_playerAny, "DOUBLOONS", false);
    TriggerAddEventChatMessage(libMapM_gt_MMCannonballsDebugModify, c_playerAny, "-mmm", false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Gate Open
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonGateOpen_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    TimerStart(libMapM_gv_mMGardensDragonDragonTowerStartTimer, libMapM_gv_mMGardensDragonDragonTowerStartTime_C, false, c_timeGame);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonGateOpen_Init () {
    libMapM_gt_MMGardensDragonGateOpen = TriggerCreate("libMapM_gt_MMGardensDragonGateOpen_Func");
    TriggerEnable(libMapM_gt_MMGardensDragonGateOpen, false);
    TriggerAddEventTimer(libMapM_gt_MMGardensDragonGateOpen, libGame_gv_openTheGatesTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Warning Timer Start
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonWarningTimerStart_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    TriggerExecute(libMapM_gt_MMGardensDragonObjectiveUIHandler, true, false);
    libMapM_gv_mMGardensDragonCurrentState = 1;
    TimerStart(libMapM_gv_mMGardensDragonDragonTowerWarningTimer, libMapM_gv_mMGardensDragonWarningTime_C, false, c_timeGame);
    libGame_gf_AnnouncementAddItemForPlayerGroup(PlayerGroupAll(), 0, 0, "DragonKnightEventBegin", StringExternal("Param/Value/lib_MapM_6E09602F"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    libMapM_gf_MMDragonballsTransmissionObelisksOpenWarningQ(PlayerGroupAll());
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonWarningTimerStart_Init () {
    libMapM_gt_MMGardensDragonWarningTimerStart = TriggerCreate("libMapM_gt_MMGardensDragonWarningTimerStart_Func");
    TriggerEnable(libMapM_gt_MMGardensDragonWarningTimerStart, false);
    TriggerAddEventTimer(libMapM_gt_MMGardensDragonWarningTimerStart, libMapM_gv_mMGardensDragonDragonTowerStartTimer);
    TriggerAddEventTimer(libMapM_gt_MMGardensDragonWarningTimerStart, libMapM_gv_mMGardensDragonDragonTowerRespawnTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Warning Timer Expires
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonWarningTimerExpires_Func (bool testConds, bool runActions) {
    playergroup auto1E05FCEC_g;
    int auto1E05FCEC_p;
    int autoE4D52634_ae;
    playergroup auto94A62BD7_g;
    int auto94A62BD7_p;

    // Variable Declarations
    int lv_obelisk;
    int lv_p;
    const int lv_fontSize = 15;

    // Variable Initialization

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

    libMapM_gv_mMGardensDragonCurrentState = 2;
    TextTagCreate(StringExternal("Param/Value/lib_MapM_60EE21E2"), lv_fontSize, UnitGetPosition(libMapM_gv_mMGardensDragonStatue), 0.0, true, false, PlayerGroupAll());
    libMapM_gv_mMGardensDragonStatueTextTag = TextTagLastCreated();
    TextTagAttachToUnit(TextTagLastCreated(), libMapM_gv_mMGardensDragonStatue, libMapM_gv_mMGardensDragonDragonStatueHelperTextTagHeightOffset_C);
    TextTagShow(TextTagLastCreated(), PlayerGroupAll(), true);
    auto1E05FCEC_g = libCore_gv_activeHumanPlayers; 
    auto1E05FCEC_p = 1;
    for ( ; auto1E05FCEC_p <= PlayerGroupCount(auto1E05FCEC_g) ; auto1E05FCEC_p += BoolToInt(lv_p == PlayerGroupPlayer(auto1E05FCEC_g, auto1E05FCEC_p)) ) {
        lv_p = PlayerGroupPlayer(auto1E05FCEC_g, auto1E05FCEC_p);
        if ((libMapM_gv_mapMechanicUsedTracker[lv_p].lv_dragonStatue == true)) {
            TextTagShow(TextTagLastCreated(), libCore_gv_playerGroupFromPlayer[lv_p], false);
        }
        else {
        }
    }
    TextTagCreate(StringExternal("Param/Value/lib_MapM_A60971D2"), lv_fontSize, UnitGetPosition(libMapM_gv_mMGardensDragonStatue), 0.0, true, false, PlayerGroupAll());
    libMapM_gv_mMGardensDragonStatueTextTagAllyOwned = TextTagLastCreated();
    TextTagAttachToUnit(TextTagLastCreated(), libMapM_gv_mMGardensDragonStatue, libMapM_gv_mMGardensDragonDragonStatueHelperTextTagHeightOffset_C);
    TextTagShow(TextTagLastCreated(), PlayerGroupAll(), false);
    TextTagCreate(StringExternal("Param/Value/lib_MapM_EEE97929"), lv_fontSize, UnitGetPosition(libMapM_gv_mMGardensDragonStatue), 0.0, true, false, PlayerGroupAll());
    libMapM_gv_mMGardensDragonStatueTextTagEnemyOwned = TextTagLastCreated();
    TextTagAttachToUnit(TextTagLastCreated(), libMapM_gv_mMGardensDragonStatue, libMapM_gv_mMGardensDragonDragonStatueHelperTextTagHeightOffset_C);
    TextTagShow(TextTagLastCreated(), PlayerGroupAll(), false);
    if ((libMapM_gv_mMGardensDragonSpawnFirstTime == true)) {
        libMapM_gv_mMGardensDragonSpawnFirstTime = false;
        autoE4D52634_ae = libMapM_gv_mMGardensDragonDragonTowerObeliskCount_C;
        lv_obelisk = 1;
        for ( ; lv_obelisk <= autoE4D52634_ae ; lv_obelisk += 1 ) {
            libUIUI_gf_AttachHelpButtonToUnit(libMapM_gv_mMGardensDragonDragonTowers[lv_obelisk].lv_shrineUnit, libMapM_gt_MMHelpbuttonClicked, StringExternal("Param/Value/lib_MapM_C773195E"), 95, 370);
            auto94A62BD7_g = libCore_gv_activeHumanPlayers; 
            auto94A62BD7_p = 1;
            for ( ; auto94A62BD7_p <= PlayerGroupCount(auto94A62BD7_g) ; auto94A62BD7_p += BoolToInt(lv_p == PlayerGroupPlayer(auto94A62BD7_g, auto94A62BD7_p)) ) {
                lv_p = PlayerGroupPlayer(auto94A62BD7_g, auto94A62BD7_p);
                if ((libMapM_gv_mapMechanicUsedTracker[lv_p].lv_dragonShrine == true)) {
                    libUIUI_gf_ShowHideHelpButtonOnUnitForPlayer(lv_p, false, libMapM_gv_mMGardensDragonDragonTowers[lv_obelisk].lv_shrineUnit);
                }
                else {
                }
            }
        }
        TriggerExecute(libMapM_gt_MMGardensDragonTurnOnDragonTowersFirstTime, true, false);
    }
    else {
        TriggerExecute(libMapM_gt_MMGardensDragonTurnOnDragonTowersAgain, true, false);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonWarningTimerExpires_Init () {
    libMapM_gt_MMGardensDragonWarningTimerExpires = TriggerCreate("libMapM_gt_MMGardensDragonWarningTimerExpires_Func");
    TriggerEnable(libMapM_gt_MMGardensDragonWarningTimerExpires, false);
    TriggerAddEventTimer(libMapM_gt_MMGardensDragonWarningTimerExpires, libMapM_gv_mMGardensDragonDragonTowerWarningTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Dragon Event Starts
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonDragonEventStarts_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    libMapM_gv_mMGardensDragonCurrentState = 3;
    SoundChannelMute(PlayerGroupAll(), c_soundCategoryAmbient, true);
    SoundtrackPlay(PlayerGroupAll(), c_soundtrackCategoryMusic, "Storm_Music_Dragonknight", c_soundtrackCueAny, c_soundtrackIndexAny, true);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonDragonEventStarts_Init () {
    libMapM_gt_MMGardensDragonDragonEventStarts = TriggerCreate("libMapM_gt_MMGardensDragonDragonEventStarts_Func");
    TriggerEnable(libMapM_gt_MMGardensDragonDragonEventStarts, false);
    libGame_gf_MapDragonShireDragonActivated(libMapM_gt_MMGardensDragonDragonEventStarts);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Dragon Event Ends
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonDragonEventEnds_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    libMapM_gv_mMGardensDragonCurrentState = 0;
    SoundChannelMute(PlayerGroupAll(), c_soundCategoryAmbient, false);
    SoundtrackStop(PlayerGroupAll(), c_soundtrackCategoryMusic, true);
    if ((libCore_gv_mAPMapSoundtrack != null)) {
        SoundtrackPlay(PlayerGroupAll(), c_soundtrackCategoryMusic, libCore_gv_mAPMapSoundtrack, c_soundtrackCueAny, c_soundtrackIndexAny, true);
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonDragonEventEnds_Init () {
    libMapM_gt_MMGardensDragonDragonEventEnds = TriggerCreate("libMapM_gt_MMGardensDragonDragonEventEnds_Func");
    TriggerEnable(libMapM_gt_MMGardensDragonDragonEventEnds, false);
    libGame_gf_MapDragonShireDragonEnds(libMapM_gt_MMGardensDragonDragonEventEnds);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Turn On Dragon Towers First Time
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonTurnOnDragonTowersFirstTime_Func (bool testConds, bool runActions) {
    int auto27701136_ae;
    int auto27701136_ai;
    int autoFF5452D1_ae;
    int autoFF5452D1_ai;

    // Variable Declarations
    int lv_indexTeam;
    int lv_obelisk;
    int lv_player;

    // Variable Initialization

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

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

    TriggerEnable(TriggerGetCurrent(), false);
    auto27701136_ae = libMapM_gv_mMGardensDragonDragonTowerCount;
    auto27701136_ai = 1;
    lv_obelisk = 1;
    for ( ; ( (auto27701136_ai >= 0 && lv_obelisk <= auto27701136_ae) || (auto27701136_ai <= 0 && lv_obelisk >= auto27701136_ae) ) ; lv_obelisk += auto27701136_ai ) {
        ActorSend(libNtve_gf_MainActorofUnit(libMapM_gv_mMGardensDragonDragonTowers[lv_obelisk].lv_shrineUnit), "SetMinimapVisibility 1");
        libGame_gf_SendEventMapObeliskSpawned(libMapM_gv_mMGardensDragonDragonTowers[lv_obelisk].lv_shrineUnit);
        libGame_gf_CapturePointEnable(libMapM_gv_mMGardensDragonDragonTowers[lv_obelisk].lv_captureBeaconIndex);
        libNtve_gf_SendActorMessageToUnit(libMapM_gv_mMGardensDragonDragonTowers[lv_obelisk].lv_shrineUnit, "Signal OwnerNeutral");
    }
    TriggerEnable(libMapM_gt_MMGardensDragonDragonTowerChangeOwnershipEventFires, true);
    libMapM_gf_MMDragonballsTransmissionObelisksSpawnQ(PlayerGroupAll());
    autoFF5452D1_ae = libMapM_gv_mMGardensDragonDragonTowerCount;
    autoFF5452D1_ai = 1;
    lv_obelisk = 1;
    for ( ; ( (autoFF5452D1_ai >= 0 && lv_obelisk <= autoFF5452D1_ae) || (autoFF5452D1_ai <= 0 && lv_obelisk >= autoFF5452D1_ae) ) ; lv_obelisk += autoFF5452D1_ai ) {
        libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "StormPingAlert", UnitGetPosition(libMapM_gv_mMGardensDragonDragonTowers[lv_obelisk].lv_shrineUnit), ColorWithAlpha(100.00, 100.00, 0.00, 0.00), 5.0, 270.0);
    }
    Wait(2.0, c_timeGame);
    libGame_gf_AnnouncementAddItemForPlayerGroup(PlayerGroupAll(), 0, 0, "DragonKnightEventBegin", StringExternal("Param/Value/lib_MapM_5531EDF1"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonTurnOnDragonTowersFirstTime_Init () {
    libMapM_gt_MMGardensDragonTurnOnDragonTowersFirstTime = TriggerCreate("libMapM_gt_MMGardensDragonTurnOnDragonTowersFirstTime_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Turn On Dragon Towers Again
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonTurnOnDragonTowersAgain_Func (bool testConds, bool runActions) {
    int autoC4CF07E2_ae;
    int autoC4CF07E2_ai;
    playergroup auto82B36A20_g;
    int auto82B36A20_p;

    // Variable Declarations
    int lv_p;
    int lv_dragontower;

    // Variable Initialization

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

    TriggerEnable(libMapM_gt_MMGardensDragonDragonTowerChangeOwnershipEventFires, true);
    UnitCreate(1, "VehicleDragon", c_unitCreateIgnorePlacement, 0, libMapM_gv_mMGardensDragonDragonKnightRespawnPoint, 270.0);
    libMapM_gv_mMGardensDragonStatue = UnitLastCreated();
    UnitSetState(libMapM_gv_mMGardensDragonStatue, c_unitStateStatusBar, false);
    TimerPause(libMapM_gv_mMGardensDragonDragonKnightLifeTimer, true);
    libMapM_gf_MMDragonballsTransmissionObelisksRepawnQ(PlayerGroupAll());
    libGame_gf_AnnouncementAddItemForPlayerGroup(PlayerGroupAll(), 0, 0, "DragonKnightEventBegin", StringExternal("Param/Value/lib_MapM_E0581E09"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    autoC4CF07E2_ae = libMapM_gv_mMGardensDragonDragonTowerCount;
    autoC4CF07E2_ai = 1;
    lv_dragontower = 1;
    for ( ; ( (autoC4CF07E2_ai >= 0 && lv_dragontower <= autoC4CF07E2_ae) || (autoC4CF07E2_ai <= 0 && lv_dragontower >= autoC4CF07E2_ae) ) ; lv_dragontower += autoC4CF07E2_ai ) {
        UnitSetOwner(libMapM_gv_mMGardensDragonDragonTowers[lv_dragontower].lv_shrineUnit, libCore_gv_cOMPUTER_Neutral, true);
        ActorSend(libNtve_gf_MainActorofUnit(libMapM_gv_mMGardensDragonDragonTowers[lv_dragontower].lv_shrineUnit), "SetMinimapVisibility 1");
        libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "StormPingWarning", UnitGetPosition(libMapM_gv_mMGardensDragonDragonTowers[lv_dragontower].lv_shrineUnit), ColorWithAlpha(100.00, 0.00, 0.00, 0.00), 3.0, 270.0);
        libGame_gf_CapturePointEnable(libMapM_gv_mMGardensDragonDragonTowers[lv_dragontower].lv_captureBeaconIndex);
        libNtve_gf_SendActorMessageToUnit(libMapM_gv_mMGardensDragonDragonTowers[lv_dragontower].lv_shrineUnit, "Signal OwnerNeutral");
        auto82B36A20_g = PlayerGroupAll(); 
        auto82B36A20_p = 1;
        for ( ; auto82B36A20_p <= PlayerGroupCount(auto82B36A20_g) ; auto82B36A20_p += BoolToInt(lv_p == PlayerGroupPlayer(auto82B36A20_g, auto82B36A20_p)) ) {
            lv_p = PlayerGroupPlayer(auto82B36A20_g, auto82B36A20_p);
            VisRevealArea(lv_p, RegionCircle(UnitGetPosition(libMapM_gv_mMGardensDragonDragonTowers[lv_dragontower].lv_shrineUnit), 0.75), 0.125, false);
        }
        libGame_gf_SendEventMapObeliskSpawned(libMapM_gv_mMGardensDragonDragonTowers[lv_dragontower].lv_shrineUnit);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonTurnOnDragonTowersAgain_Init () {
    libMapM_gt_MMGardensDragonTurnOnDragonTowersAgain = TriggerCreate("libMapM_gt_MMGardensDragonTurnOnDragonTowersAgain_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Dragon Tower - Change Ownership Event Fires
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonDragonTowerChangeOwnershipEventFires_Func (bool testConds, bool runActions) {
    int auto8EAED812_ae;
    int auto16B91710_val;
    playergroup autoDA72EB8E_g;
    int autoDA72EB8E_p;

    // Variable Declarations
    int lv_index;
    int lv_owner;
    int lv_obelisk;
    int lv_p;

    // Variable Initialization
    lv_index = libGame_gf_CapturePointChangesOwnerCapturePointIndex();
    lv_owner = libGame_gf_CapturePointChangesOwnerOwner();

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

    auto8EAED812_ae = libMapM_gv_mMGardensDragonDragonTowerObeliskCount_C;
    lv_obelisk = 1;
    for ( ; lv_obelisk <= auto8EAED812_ae ; lv_obelisk += 1 ) {
        if ((libMapM_gv_mMGardensDragonDragonTowers[lv_obelisk].lv_captureBeaconIndex == lv_index)) {
            auto16B91710_val = lv_owner;
            if (auto16B91710_val == libCore_gv_cOMPUTER_TeamOrder) {
                libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership(lv_obelisk, libCore_gv_cOMPUTER_TeamOrder, libGame_gf_CapturePointChangesOwnerCapturingPlayers());
                libNtve_gf_SendActorMessageToUnit(libMapM_gv_mMGardensDragonDragonTowers[lv_obelisk].lv_shrineUnit, "Signal OwnerOrder");
                libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "StormPingAlert", UnitGetPosition(libMapM_gv_mMGardensDragonDragonTowers[lv_obelisk].lv_shrineUnit), ColorWithAlpha(100.00, 100.00, 0.00, 0.00), 5.0, 270.0);
            }
            else if (auto16B91710_val == libCore_gv_cOMPUTER_TeamChaos) {
                libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership(lv_obelisk, libCore_gv_cOMPUTER_TeamChaos, libGame_gf_CapturePointChangesOwnerCapturingPlayers());
                libNtve_gf_SendActorMessageToUnit(libMapM_gv_mMGardensDragonDragonTowers[lv_obelisk].lv_shrineUnit, "Signal OwnerChaos");
                libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "StormPingAlert", UnitGetPosition(libMapM_gv_mMGardensDragonDragonTowers[lv_obelisk].lv_shrineUnit), ColorWithAlpha(100.00, 100.00, 0.00, 0.00), 5.0, 270.0);
            }
            else if (auto16B91710_val == libCore_gv_cOMPUTER_Neutral) {
                libMapM_gf_MMGardensDragonChangeDragonballTowerOwnership(lv_obelisk, libCore_gv_cOMPUTER_Neutral, libGame_gf_CapturePointChangesOwnerCapturingPlayers());
                libNtve_gf_SendActorMessageToUnit(libMapM_gv_mMGardensDragonDragonTowers[lv_obelisk].lv_shrineUnit, "Signal OwnerNeutral");
            }
            else {
            }
            if ((lv_owner != libCore_gv_cOMPUTER_Neutral)) {
                autoDA72EB8E_g = PlayerGroupAlliance(c_playerGroupAlly, lv_owner); 
                autoDA72EB8E_p = 1;
                for ( ; autoDA72EB8E_p <= PlayerGroupCount(autoDA72EB8E_g) ; autoDA72EB8E_p += BoolToInt(lv_p == PlayerGroupPlayer(autoDA72EB8E_g, autoDA72EB8E_p)) ) {
                    lv_p = PlayerGroupPlayer(autoDA72EB8E_g, autoDA72EB8E_p);
                    if ((libNtve_gf_UnitInRegion(libGame_gv_players[lv_p].lv_heroUnit, RegionCircle(UnitGetPosition(libMapM_gv_mMGardensDragonDragonTowers[lv_obelisk].lv_shrineUnit), libMapM_gv_mMGardensDragonDragonballTowerCaptureRadius_C)) == true)) {
                        libMapM_gv_mapMechanicUsedTracker[lv_p].lv_dragonShrine = true;
                        libUIUI_gf_ShowHideHelpButtonOnUnitForPlayer(lv_p, false, libMapM_gv_mMGardensDragonDragonTowers[lv_obelisk].lv_shrineUnit);
                    }
                    else {
                    }
                }
            }
            else {
            }
        }
        else {
        }
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonDragonTowerChangeOwnershipEventFires_Init () {
    libMapM_gt_MMGardensDragonDragonTowerChangeOwnershipEventFires = TriggerCreate("libMapM_gt_MMGardensDragonDragonTowerChangeOwnershipEventFires_Func");
    TriggerEnable(libMapM_gt_MMGardensDragonDragonTowerChangeOwnershipEventFires, false);
    libGame_gf_CapturePointChangesOwner(libMapM_gt_MMGardensDragonDragonTowerChangeOwnershipEventFires);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Dragon Tower - Check Obelisk Status
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonDragonTowerCheckObeliskStatus_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_orderOwned;
    int lv_chaosOwned;

    // Variable Initialization

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

    UnitGroupLoopBegin(UnitGroup("DragonShireShrineSun", libCore_gv_cOMPUTER_TeamOrder, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
        lv_orderOwned += 1;
    }
    UnitGroupLoopEnd();
    UnitGroupLoopBegin(UnitGroup("DragonShireShrineMoon", libCore_gv_cOMPUTER_TeamOrder, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
        lv_orderOwned += 1;
    }
    UnitGroupLoopEnd();
    UnitGroupLoopBegin(UnitGroup("DragonShireShrineSun", libCore_gv_cOMPUTER_TeamChaos, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
        lv_chaosOwned += 1;
    }
    UnitGroupLoopEnd();
    UnitGroupLoopBegin(UnitGroup("DragonShireShrineMoon", libCore_gv_cOMPUTER_TeamChaos, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
        lv_chaosOwned += 1;
    }
    UnitGroupLoopEnd();
    if (((lv_chaosOwned == libMapM_gv_mMGardensDragonDragonTowerObeliskCount_C) || (lv_orderOwned == libMapM_gv_mMGardensDragonDragonTowerObeliskCount_C))) {
        if ((lv_chaosOwned == libMapM_gv_mMGardensDragonDragonTowerObeliskCount_C)) {
            libMapM_gf_MMGardensDragonActivateStatueForTeam(libCore_gv_cOMPUTER_TeamChaos);
            libMapM_gf_MMDragonballsTransmissionObelisksAllyCap2Q(libCore_gv_teamChaos);
            libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap2Q(libCore_gv_teamOrder);
        }
        else {
            libMapM_gf_MMGardensDragonActivateStatueForTeam(libCore_gv_cOMPUTER_TeamOrder);
            libMapM_gf_MMDragonballsTransmissionObelisksAllyCap2Q(libCore_gv_teamOrder);
            libMapM_gf_MMDragonballsTransmissionObelisksEnemyCap2Q(libCore_gv_teamChaos);
        }
        libMapM_gf_MMDragonballsTransmissionObelisksObserverCap2Q();
    }
    else {
        if ((UnitGetOwner(libMapM_gv_mMGardensDragonStatue) != 0)) {
            libMapM_gf_MMGardensDragonDeactivateStatue(UnitGetOwner(libMapM_gv_mMGardensDragonStatue));
        }
        else {
        }
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonDragonTowerCheckObeliskStatus_Init () {
    libMapM_gt_MMGardensDragonDragonTowerCheckObeliskStatus = TriggerCreate("libMapM_gt_MMGardensDragonDragonTowerCheckObeliskStatus_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Transform Channel Finish
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonTransformChannelFinish_Func (bool testConds, bool runActions) {
    int auto632F3216_ae;
    int auto632F3216_ai;

    // Variable Declarations
    int lv_itObelisk;
    int lv_dragonRidingPlayer;

    // Variable Initialization

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

    TriggerEnable(libMapM_gt_MMGardensDragonDragonTowerChangeOwnershipEventFires, false);
    TriggerEnable(libMapM_gt_MMGardensDragonMercCampHibernatorDetectorLeashed, true);
    TriggerEnable(libMapM_gt_MMGardensDragonMercCampHibernatorDetectorSpawned, true);
    UnitBehaviorAdd(libMapM_gv_mMGardensDragonStatue, "VehicleDragonTimedLife", EventPlayerEffectUsedUnit(c_effectUnitCaster), 1);
    TimerPause(libMapM_gv_mMGardensDragonDragonStatueActiveReminderTimer, true);
    TimerStart(libMapM_gv_mMGardensDragonDragonKnightLifeTimer, libMapM_gv_mMGardensDragonDragonKnightMaxTime_C, false, c_timeGame);
    TriggerEnable(libMapM_gt_MMGardensDragonDragonKnightDiesorExpires, true);
    libMapM_gv_mMGardensDragonUnit = libGame_gv_players[EventPlayerEffectUsedUnitOwner(c_effectPlayerCaster)].lv_activeVehicle;
    UnitSetPosition(libMapM_gv_mMGardensDragonUnit, PointWithOffset(UnitGetPosition(libMapM_gv_mMGardensDragonUnit), 0.0, -3.0), false);
    UnitSetState(libMapM_gv_mMGardensDragonUnit, c_unitStateStatusBar, true);
    lv_dragonRidingPlayer = EventPlayerEffectUsedUnitOwner(c_effectPlayerCaster);
    StatEventCreate("DragonKnightActivated");
    StatEventAddDataFixed(StatEventLastCreated(), "TeamID", libGame_gf_TeamNumberOfPlayer(lv_dragonRidingPlayer));
    StatEventSend(StatEventLastCreated());
    if ((libCore_gf_ActorStoredForUnit(libMapM_gv_mMGardensDragonUnit, 1) == null)) {
        libNtve_gf_AttachModelToUnit(libMapM_gv_mMGardensDragonUnit, "GardensDragonLight", "Ref_Center");
        libCore_gf_StoreActorForUnit(libMapM_gv_mMGardensDragonUnit, 1, libNtve_gf_ActorLastCreated());
    }
    else {
    }
    auto632F3216_ae = libMapM_gv_mMGardensDragonDragonTowerCount;
    auto632F3216_ai = 1;
    lv_itObelisk = 1;
    for ( ; ( (auto632F3216_ai >= 0 && lv_itObelisk <= auto632F3216_ae) || (auto632F3216_ai <= 0 && lv_itObelisk >= auto632F3216_ae) ) ; lv_itObelisk += auto632F3216_ai ) {
        UnitSetOwner(libMapM_gv_mMGardensDragonDragonTowers[lv_itObelisk].lv_shrineUnit, libCore_gv_cOMPUTER_Neutral, true);
        UnitIssueOrder(libMapM_gv_mMGardensDragonDragonTowers[lv_itObelisk].lv_shrineUnit, Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
        libGame_gf_CapturePointDisable(libMapM_gv_mMGardensDragonDragonTowers[lv_itObelisk].lv_captureBeaconIndex);
        ActorSend(libNtve_gf_MainActorofUnit(libMapM_gv_mMGardensDragonDragonTowers[lv_itObelisk].lv_shrineUnit), "SetMinimapVisibility");
        libNtve_gf_SendActorMessageToUnit(libMapM_gv_mMGardensDragonDragonTowers[lv_itObelisk].lv_shrineUnit, "AnimBracketStop Capture");
        UnitStatusBarOverride(libMapM_gv_mMGardensDragonDragonTowers[lv_itObelisk].lv_shrineUnit, -1);
        TextTagDestroy(libMapM_gv_mMGardensDragonDragonTowers[lv_itObelisk].lv_helperText);
    }
    ActorScopeSend(ActorScopeFromActor(libMapM_gv_mMGardensDragonSoundRegionActor), "Signal StopSound");
    ActorRegionCreate(null, "DragonBeamEndRegion", libMapM_gv_mMGardensDragonSoundRegion);
    libGame_gf_SendEventMapDragonActivated(libMapM_gv_mMGardensDragonStatue, lv_dragonRidingPlayer);
    TextTagDestroy(libMapM_gv_mMGardensDragonStatueTextTag);
    TextTagDestroy(libMapM_gv_mMGardensDragonStatueTextTagAllyOwned);
    TextTagDestroy(libMapM_gv_mMGardensDragonStatueTextTagEnemyOwned);
    libMapM_gv_mapMechanicUsedTracker[EventPlayerEffectUsedUnitOwner(c_effectPlayerCaster)].lv_dragonStatue = true;
    libUIUI_gf_UIUnitStatusFramesHookupUnitStatusFramesForPlayer(lv_dragonRidingPlayer);
    libMapM_gf_MMGardensDragonDragonHasEnteredArtHooks();
    if ((PlayerGroupHasPlayer(libCore_gv_teamOrder, EventPlayerEffectUsedUnitOwner(c_effectPlayerOrigin)) == true)) {
        libMapM_gf_MMDragonballsTransmissionAllyDragonQ(libCore_gv_teamOrder);
        libMapM_gf_MMDragonballsTransmissionEnemyDragonQ(libCore_gv_teamChaos);
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_teamOrder, 2, 0, "DragonKnightAlly", StringExternal("Param/Value/lib_MapM_23CF635B"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_teamChaos, 2, 0, "DragonKnightEnemy", StringExternal("Param/Value/lib_MapM_A0DED82D"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 2, 0, "DragonKnightEnemy", StringExternal("Param/Value/lib_MapM_8D0DE27F"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    }
    else {
        libMapM_gf_MMDragonballsTransmissionAllyDragonQ(libCore_gv_teamChaos);
        libMapM_gf_MMDragonballsTransmissionEnemyDragonQ(libCore_gv_teamOrder);
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_teamChaos, 0, 0, "DragonKnightAlly", StringExternal("Param/Value/lib_MapM_57057928"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_teamOrder, 0, 0, "DragonKnightEnemy", StringExternal("Param/Value/lib_MapM_174226AF"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
        libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 0, 0, "DragonKnightEnemy", StringExternal("Param/Value/lib_MapM_DADF56D6"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    }
    libMapM_gf_MMDragonballsTransmissionObserverDragonQ();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonTransformChannelFinish_Init () {
    libMapM_gt_MMGardensDragonTransformChannelFinish = TriggerCreate("libMapM_gt_MMGardensDragonTransformChannelFinish_Func");
    TriggerEnable(libMapM_gt_MMGardensDragonTransformChannelFinish, false);
    TriggerAddEventPlayerEffectUsed(libMapM_gt_MMGardensDragonTransformChannelFinish, c_playerAny, "UseVehicleCastCompleteSet");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Take Dragon Reminder Timer Expires
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonTakeDragonReminderTimerExpires_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_obelisk;

    // Variable Initialization

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

    libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "StormPingWarning", UnitGetPosition(libMapM_gv_mMGardensDragonStatue), ColorWithAlpha(100.00, 0.00, 0.00, 0.00), 5.0, 270.0);
    TimerStart(libMapM_gv_mMGardensDragonDragonStatueActiveReminderTimer, libMapM_gv_mMGardensDragonDragonStatueReminderTimerTime_C, false, c_timeGame);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonTakeDragonReminderTimerExpires_Init () {
    libMapM_gt_MMGardensDragonTakeDragonReminderTimerExpires = TriggerCreate("libMapM_gt_MMGardensDragonTakeDragonReminderTimerExpires_Func");
    TriggerAddEventTimer(libMapM_gt_MMGardensDragonTakeDragonReminderTimerExpires, libMapM_gv_mMGardensDragonDragonStatueActiveReminderTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Merc Camp Hibernator Detector Leashed
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonMercCampHibernatorDetectorLeashed_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_camp;

    // Variable Initialization

    // Conditions
    if (testConds) {
        if (!((UnitIsAlive(libMapM_gv_mMGardensDragonUnit) == true))) {
            return false;
        }
    }

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

    lv_camp = libMapM_gf_JungleGetCampIndexFromDefenderIndex(libGame_gf_JungleDefenderAIDefendersEndFightingIndex());
    if ((lv_camp > 0)) {
        libMapM_gf_JungleTransitionCampIntoState(lv_camp, 4);
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonMercCampHibernatorDetectorLeashed_Init () {
    libMapM_gt_MMGardensDragonMercCampHibernatorDetectorLeashed = TriggerCreate("libMapM_gt_MMGardensDragonMercCampHibernatorDetectorLeashed_Func");
    TriggerEnable(libMapM_gt_MMGardensDragonMercCampHibernatorDetectorLeashed, false);
    libGame_gf_JungleDefenderAIDefendersEndFighting(libMapM_gt_MMGardensDragonMercCampHibernatorDetectorLeashed);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Merc Camp Hibernator Detector Spawned
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonMercCampHibernatorDetectorSpawned_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!((UnitIsAlive(libMapM_gv_mMGardensDragonUnit) == true))) {
            return false;
        }
    }

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

    libMapM_gf_JungleTransitionCampIntoState(libGame_gf_JungleCampSpawnedIndex(), 4);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonMercCampHibernatorDetectorSpawned_Init () {
    libMapM_gt_MMGardensDragonMercCampHibernatorDetectorSpawned = TriggerCreate("libMapM_gt_MMGardensDragonMercCampHibernatorDetectorSpawned_Func");
    TriggerEnable(libMapM_gt_MMGardensDragonMercCampHibernatorDetectorSpawned, false);
    libGame_gf_JungleCampSpawned(libMapM_gt_MMGardensDragonMercCampHibernatorDetectorSpawned);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Dragon Knight Dies or Expires
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonDragonKnightDiesorExpires_Func (bool testConds, bool runActions) {
    // Variable Declarations
    unit lv_u;
    int lv_camp;
    int lv_i;
    int lv_player;

    // Variable Initialization
    lv_player = UnitGetOwner(EventUnit());

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

    UnitCreateEffectPoint(libGame_gv_players[lv_player].lv_heroUnit, "VehicleDragonKnightDeathKnockbackPersistent", UnitGetPosition(libGame_gv_players[lv_player].lv_heroUnit));
    TimerStart(libMapM_gv_mMGardensDragonDragonTowerRespawnTimer, libMapM_gv_mMGardensDragonDragonTowerRespawnTime_C, false, c_timeGame);
    TimerStart(libMapM_gv_mMGardensDragonDragonKnightLifeTimer, 0.0, false, c_timeGame);
    TriggerEnable(libMapM_gt_MMGardensDragonMercCampHibernatorDetectorLeashed, false);
    TriggerEnable(libMapM_gt_MMGardensDragonMercCampHibernatorDetectorSpawned, false);
    libGame_gf_SendEventMapDragonShireDragonEnds();
    libMapM_gf_MMGardensDragonDragonHasLeftArtHooks();
    Wait(0.5, c_timeGame);
    libMapM_gf_MMDragonballsTransmissionDragonExpireQ(PlayerGroupAll());
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonDragonKnightDiesorExpires_Init () {
    libMapM_gt_MMGardensDragonDragonKnightDiesorExpires = TriggerCreate("libMapM_gt_MMGardensDragonDragonKnightDiesorExpires_Func");
    TriggerEnable(libMapM_gt_MMGardensDragonDragonKnightDiesorExpires, false);
    TriggerAddEventUnitDied(libMapM_gt_MMGardensDragonDragonKnightDiesorExpires, UnitRefFromVariable("libMapM_gv_mMGardensDragonUnit"));
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Objective UI Handler
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonObjectiveUIHandler_Func (bool testConds, bool runActions) {
    int auto3C7A2C06_val;
    int auto01D05E00_val;

    // Variable Declarations
    text lv_tip;
    int lv_indexTeam;
    int lv_indexTeamEnemy;
    int lv_state;
    int lv_lastState;

    // Variable Initialization

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

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

    TriggerEnable(TriggerGetCurrent(), false);
    lv_tip = TextExpressionAssemble("Param/Expression/lib_MapM_EE88F2AF");
    while (true) {
        if ((libMapM_gv_mMGardensDragonCurrentState == 3)) {
            lv_state = 3;
            if ((libGame_gf_TeamNumberOfPlayer(UnitGetOwner(libMapM_gv_mMGardensDragonStatue)) == 1)) {
                lv_indexTeam = 1;
                lv_indexTeamEnemy = 2;
            }
            else {
                lv_indexTeam = 2;
                lv_indexTeamEnemy = 1;
            }
            if ((lv_state != lv_lastState)) {
                libUIUI_gf_MapMechanicsDragonShireSetUpDragonForTeam(libMapM_gv_mMGardensDragonUnit, lv_indexTeam);
                libUIUI_gf_MapMechanicsDragonShireSetMode(2);
                if ((lv_indexTeam == 1)) {
                }
                else {
                }
            }
            else {
            }
            libUIUI_gf_MapMechanicsDragonShireSetRemainingDragonTime(FixedToInt(TimerGetRemaining(libMapM_gv_mMGardensDragonDragonKnightLifeTimer)));
            lv_lastState = lv_state;
        }
        else if ((libMapM_gv_mMGardensDragonCurrentState == 1)) {
            lv_state = 1;
            if ((lv_state != lv_lastState)) {
                libUIUI_gf_MapMechanicsDragonShireSetMode(0);
                libUIUI_gf_MapMechanicsDragonShireShowHidePanel(true);
            }
            else {
            }
            libUIUI_gf_MapMechanicsDragonShireSetRemainingShrineWarningTime(FixedToInt(TimerGetRemaining(libMapM_gv_mMGardensDragonDragonTowerWarningTimer)));
            lv_lastState = lv_state;
        }
        else if ((libMapM_gv_mMGardensDragonCurrentState == 2)) {
            lv_state = 2;
            if ((lv_state != lv_lastState)) {
                libUIUI_gf_MapMechanicsDragonShireSetMode(1);
            }
            else {
            }
            libUIUI_gf_MapMechanicsDragonShireSetMoonShrineOwner(0);
            libUIUI_gf_MapMechanicsDragonShireSetStarShrineOwner(0);
            auto3C7A2C06_val = UnitGetOwner(libMapM_gv_mMGardensDragonTowerMoon);
            if (auto3C7A2C06_val == libCore_gv_cOMPUTER_TeamOrder) {
                libUIUI_gf_MapMechanicsDragonShireSetMoonShrineOwner(libGame_gv_teamOrderIndex_C);
            }
            else if (auto3C7A2C06_val == libCore_gv_cOMPUTER_TeamChaos) {
                libUIUI_gf_MapMechanicsDragonShireSetMoonShrineOwner(libGame_gv_teamChaosIndex_C);
            }
            else {
            }
            auto01D05E00_val = UnitGetOwner(libMapM_gv_mMGardensDragonTowerStar);
            if (auto01D05E00_val == libCore_gv_cOMPUTER_TeamOrder) {
                libUIUI_gf_MapMechanicsDragonShireSetStarShrineOwner(libGame_gv_teamOrderIndex_C);
            }
            else if (auto01D05E00_val == libCore_gv_cOMPUTER_TeamChaos) {
                libUIUI_gf_MapMechanicsDragonShireSetStarShrineOwner(libGame_gv_teamChaosIndex_C);
            }
            else {
            }
            lv_lastState = lv_state;
        }
        else if ((libMapM_gv_mMGardensDragonCurrentState == 0)) {
            lv_state = 0;
            if ((lv_state != lv_lastState)) {
                libUIUI_gf_MapMechanicsDragonShireShowHidePanel(false);
            }
            else {
            }
            lv_lastState = lv_state;
        }
        Wait(0.25, c_timeGame);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonObjectiveUIHandler_Init () {
    libMapM_gt_MMGardensDragonObjectiveUIHandler = TriggerCreate("libMapM_gt_MMGardensDragonObjectiveUIHandler_Func");
    TriggerAddEventChatMessage(libMapM_gt_MMGardensDragonObjectiveUIHandler, c_playerAny, "-eu", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Gardens Dragon Debug Cheat (Start Obelisks -so)
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMGardensDragonDebugCheatStartObelisksso_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {
            return false;
        }
    }

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

    TriggerExecute(libMapM_gt_MMGardensDragonObjectiveUIHandler, true, false);
    libMapM_gv_mMGardensDragonCurrentState = 1;
    TimerStart(libMapM_gv_mMGardensDragonDragonTowerWarningTimer, libMapM_gv_mMGardensDragonWarningTime_C, false, c_timeGame);
    TimerPause(libMapM_gv_mMGardensDragonDragonTowerStartTimer, true);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMGardensDragonDebugCheatStartObelisksso_Init () {
    libMapM_gt_MMGardensDragonDebugCheatStartObelisksso = TriggerCreate("libMapM_gt_MMGardensDragonDebugCheatStartObelisksso_Func");
    TriggerEnable(libMapM_gt_MMGardensDragonDebugCheatStartObelisksso, false);
    TriggerAddEventChatMessage(libMapM_gt_MMGardensDragonDebugCheatStartObelisksso, c_playerAny, "-so", true);
    TriggerAddEventChatMessage(libMapM_gt_MMGardensDragonDebugCheatStartObelisksso, c_playerAny, "EVENTSTART", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Start To Enter Gates
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldStartToEnterGates_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_macguffinPeriod;
    fixed lv_durationNotUnstoppable;
    int lv_localCastIndex;
    int lv_player;

    // Variable Initialization

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

    lv_player = UnitGetOwner(EventUnit());
    libMapM_gv_mMUnderworldEnterGateIndex[lv_player] += 1;
    lv_localCastIndex = libMapM_gv_mMUnderworldEnterGateIndex[lv_player];
    lv_macguffinPeriod = CatalogFieldValueGetAsInt(c_gameCatalogEffect, "CaptureMacGuffin", "PeriodCount", UnitGetOwner(EventUnit()));
    lv_durationNotUnstoppable = (lv_macguffinPeriod - 0.5);
    Wait((lv_durationNotUnstoppable * 0.125), c_timeGame);
    if ((UnitHasBehavior2(EventUnit(), "MacGuffinDummy") == true) && (libMapM_gv_mMUnderworldEnterGateIndex[lv_player] == lv_localCastIndex)) {
        UnitBehaviorAdd(EventUnit(), "HauntedMinesUnstoppableDummy", EventUnit(), 1);
        libMapM_gv_mMUnderworldEnterGateIndex[lv_player] = 0;
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldStartToEnterGates_Init () {
    libMapM_gt_MMUnderworldStartToEnterGates = TriggerCreate("libMapM_gt_MMUnderworldStartToEnterGates_Func");
    TriggerEnable(libMapM_gt_MMUnderworldStartToEnterGates, false);
    TriggerAddEventUnitAbility(libMapM_gt_MMUnderworldStartToEnterGates, null, AbilityCommand("CaptureMacGuffin", 0), c_abilEffectStageCast, false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Entering Gates
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldEnteringGates_Func (bool testConds, bool runActions) {
    unitgroup autoEAA00391_g;
    int autoEAA00391_u;
    unitgroup autoFD0B3F2D_g;
    int autoFD0B3F2D_u;

    // Variable Declarations
    int lv_computerTeam;
    unit lv_hero;
    unit lv_gate;
    unit lv_itGate;
    int lv_player;
    int lv_abathurPlayer;
    actor lv_teleportEffect1;
    actor lv_teleportEffect2;

    // Variable Initialization

    // Conditions
    if (testConds) {
        if (!((libGame_gf_UnitIsHero(EventPlayerEffectUsedUnit(c_effectUnitCaster)) == true))) {
            return false;
        }
    }

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

    lv_hero = EventPlayerEffectUsedUnit(c_effectUnitCaster);
    lv_gate = EventPlayerEffectUsedUnit(c_effectUnitTarget);
    lv_player = UnitGetOwner(lv_hero);
    if ((libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventPlayerEffectUsedUnit(c_effectUnitCaster))) == 1)) {
        lv_computerTeam = libCore_gv_cOMPUTER_TeamOrder;
    }
    else {
        lv_computerTeam = libCore_gv_cOMPUTER_TeamChaos;
    }
    libGame_gf_SendEventMapUnderworldPlayerUsesGate(lv_player);
    UnitCreateEffectPoint(lv_hero, "TeleportVisualDummyEffect", UnitGetPosition(lv_hero));
    UnitIssueOrder(lv_hero, Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
    libNtve_gf_ShowHideUnit(lv_hero, false);
    libNtve_gf_MakeUnitUncommandable(lv_hero, true);
    libNtve_gf_MakeUnitInvulnerable(lv_hero, true);
    UnitSetState(lv_hero, c_unitStateTargetable, false);
    UnitSetState(lv_hero, c_unitStateStoppable, false);
    UnitSetPosition(lv_hero, libMapM_gf_MMUnderworldGateEnteringSpawnPoint(lv_gate), false);
    UnitCreateEffectUnit(lv_hero, "UnderworldTeleport", lv_hero);
    if ((UnitGroupHasUnit(libMapM_gv_mMUnderworldGatesAbove, lv_gate) == true)) {
        autoFD0B3F2D_g = libMapM_gv_mMUnderworldGatesAbove;
        autoFD0B3F2D_u = 1;
        for ( ; autoFD0B3F2D_u <= UnitGroupCount(autoFD0B3F2D_g, c_unitCountAll) ; autoFD0B3F2D_u += BoolToInt(lv_itGate == UnitGroupUnit(autoFD0B3F2D_g, autoFD0B3F2D_u)) ) {
            lv_itGate = UnitGroupUnit(autoFD0B3F2D_g, autoFD0B3F2D_u);
            libUIUI_gf_ShowHideHelpButtonOnUnitForPlayer(lv_player, false, lv_itGate);
            libUIUI_gf_ShowHideHelpButtonOnUnitForPlayer(libCore_gv_oBSERVER_ObserverUIPlayer, false, lv_itGate);
        }
    }
    else {
        if ((UnitGroupHasUnit(libMapM_gv_mMUnderworldGatesBelow, lv_gate) == true)) {
            autoEAA00391_g = libMapM_gv_mMUnderworldGatesBelow;
            autoEAA00391_u = 1;
            for ( ; autoEAA00391_u <= UnitGroupCount(autoEAA00391_g, c_unitCountAll) ; autoEAA00391_u += BoolToInt(lv_itGate == UnitGroupUnit(autoEAA00391_g, autoEAA00391_u)) ) {
                lv_itGate = UnitGroupUnit(autoEAA00391_g, autoEAA00391_u);
                TextTagShow(libCore_gf_TextTagStoredForUnit(lv_itGate, 1), libCore_gv_playerGroupFromPlayer[lv_player], false);
            }
        }
        else {
        }
    }
    if ((UnitGetType(lv_hero) == "HeroArthas")) {
        UnitGroupLoopBegin(UnitGroup("ArthasGhoul", lv_player, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
        for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
            UnitSetPosition(UnitGroupLoopCurrent(), UnitGetPosition(lv_hero), false);
            UnitIssueOrder(UnitGroupLoopCurrent(), Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
        }
        UnitGroupLoopEnd();
        UnitGroupLoopBegin(UnitGroup("ImmortalServitudeSkeleton", lv_computerTeam, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
        for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
            if ((libNtve_gf_PlayerIsEnemy(UnitGetOwner(UnitGroupLoopCurrent()), lv_player, 0) == true)) {
                UnitSetPosition(UnitGroupLoopCurrent(), UnitGetPosition(lv_hero), false);
                UnitIssueOrder(UnitGroupLoopCurrent(), Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
                libAIAI_gf_MinionAIStartMinionAI(UnitGroupLoopCurrent(), libGame_gv_spawnedMinionLane, libGame_gv_spawnedMinionFirstWaypointIndex, false, false, 0);
            }
            else {
            }
        }
        UnitGroupLoopEnd();
        UnitGroupLoopBegin(UnitGroup(null, lv_computerTeam, libMapM_gv_mMUnderworldUnderGroundPlayable, UnitFilter((1 << c_targetFilterHeroic), 0, (1 << c_targetFilterStructure) | (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
        for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
            if ((libNtve_gf_PlayerIsEnemy(UnitGetOwner(UnitGroupLoopCurrent()), lv_player, 0) == true) && (UnitBehaviorCount(UnitGroupLoopCurrent(), "ImmortalServitudeDeadHeroBehavior") == 1) && (UnitBehaviorCount(UnitGroupLoopCurrent(), "ImmortalServitudeInitialDeadHeroBehavior") == 1)) {
                UnitSetPosition(UnitGroupLoopCurrent(), UnitGetPosition(lv_hero), false);
                UnitIssueOrder(UnitGroupLoopCurrent(), Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
                libAIAI_gf_MinionAIStartMinionAI(UnitGroupLoopCurrent(), libGame_gv_spawnedMinionLane, libGame_gv_spawnedMinionFirstWaypointIndex, false, false, 0);
            }
            else {
            }
        }
        UnitGroupLoopEnd();
    }
    else {
    }
    if ((UnitGetType(lv_hero) == "HeroStitches")) {
        UnitGroupLoopBegin(UnitGroup("StitchesStinkling", lv_player, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
        for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
            UnitSetPosition(UnitGroupLoopCurrent(), UnitGetPosition(lv_hero), false);
            UnitIssueOrder(UnitGroupLoopCurrent(), Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
        }
        UnitGroupLoopEnd();
    }
    else {
    }
    if ((UnitGetType(lv_hero) == "HeroRaynor")) {
        UnitGroupLoopBegin(UnitGroup("RaynorRaynorsBanshee", lv_player, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
        for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
            UnitSetPosition(UnitGroupLoopCurrent(), UnitGetPosition(lv_hero), false);
            UnitIssueOrder(UnitGroupLoopCurrent(), Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
            libGDHL_gv_heroRaynorRaynorsBansheeIsAttacking[UnitGetOwner(lv_hero)] = false;
        }
        UnitGroupLoopEnd();
    }
    else {
    }
    if ((UnitGetType(lv_hero) == "HeroWitchDoctor")) {
        UnitGroupLoopBegin(UnitGroup("WitchDoctorGargantuan", lv_player, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
        for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
            UnitSetPosition(UnitGroupLoopCurrent(), UnitGetPosition(lv_hero), false);
        }
        UnitGroupLoopEnd();
    }
    else {
    }
    if ((UnitGetType(lv_hero) == "HeroKerrigan")) {
        UnitGroupLoopBegin(UnitGroup("KerriganUltralisk", lv_player, libMapM_gv_mMUnderworldUnderGroundPlayable, UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
        for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
            UnitSetPosition(UnitGroupLoopCurrent(), UnitGetPosition(lv_hero), false);
            libAIAI_gf_MinionAIStartMinionAI(UnitGroupLoopCurrent(), libGame_gv_spawnedMinionLane, libGame_gv_spawnedMinionFirstWaypointIndex, false, false, 0);
        }
        UnitGroupLoopEnd();
    }
    else {
    }
    if ((UnitGetType(lv_hero) == "HeroAbathur")) {
        UnitGroupLoopBegin(UnitGroup("AbathurLocustNormal", lv_computerTeam, libMapM_gv_mMUnderworldUnderGroundPlayable, UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
        for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
            if ((libNtve_gf_PlayerIsEnemy(UnitGetOwner(UnitGroupLoopCurrent()), lv_player, 0) == true)) {
                UnitSetPosition(UnitGroupLoopCurrent(), UnitGetPosition(lv_hero), false);
                libAIAI_gf_MinionAIStartMinionAI(UnitGroupLoopCurrent(), libGame_gv_spawnedMinionLane, libGame_gv_spawnedMinionFirstWaypointIndex, false, false, 0);
            }
            else {
            }
        }
        UnitGroupLoopEnd();
        UnitGroupLoopBegin(UnitGroup("AbathurLocustAssaultStrain", lv_computerTeam, libMapM_gv_mMUnderworldUnderGroundPlayable, UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
        for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
            if ((libNtve_gf_PlayerIsEnemy(UnitGetOwner(UnitGroupLoopCurrent()), lv_player, 0) == true)) {
                UnitSetPosition(UnitGroupLoopCurrent(), UnitGetPosition(lv_hero), false);
                libAIAI_gf_MinionAIStartMinionAI(UnitGroupLoopCurrent(), libGame_gv_spawnedMinionLane, libGame_gv_spawnedMinionFirstWaypointIndex, false, false, 0);
            }
            else {
            }
        }
        UnitGroupLoopEnd();
        UnitGroupLoopBegin(UnitGroup("AbathurLocustBombardStrain", lv_computerTeam, libMapM_gv_mMUnderworldUnderGroundPlayable, UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
        for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
            if ((libNtve_gf_PlayerIsEnemy(UnitGetOwner(UnitGroupLoopCurrent()), lv_player, 0) == true)) {
                UnitSetPosition(UnitGroupLoopCurrent(), UnitGetPosition(lv_hero), false);
                libAIAI_gf_MinionAIStartMinionAI(UnitGroupLoopCurrent(), libGame_gv_spawnedMinionLane, libGame_gv_spawnedMinionFirstWaypointIndex, false, false, 0);
            }
            else {
            }
        }
        UnitGroupLoopEnd();
    }
    else {
    }
    UnitSetFacing(lv_hero, PointGetFacing(libMapM_gf_MMUnderworldGateEnteringSpawnPoint(lv_gate)), 0.0);
    if ((UnitBehaviorCount(lv_hero, "AbathurSymbioteHostBehavior") == 1)) {
        lv_abathurPlayer = UnitGetOwner(UnitBehaviorEffectUnit(lv_hero, "AbathurSymbioteHostBehavior", c_effectUnitCaster, 0));
        libGame_gf_CameraPanCameraForPlayerAndUpdateMapBoundsIfNecessary(lv_abathurPlayer, UnitGetPosition(EventPlayerEffectUsedUnit(c_effectUnitCaster)), 0.0, -1, 0.0, false);
    }
    else {
    }
    libGame_gf_CameraPanCameraForPlayerAndUpdateMapBoundsIfNecessary(lv_player, UnitGetPosition(EventPlayerEffectUsedUnit(c_effectUnitCaster)), 0.0, -1, 0.0, false);
    libNtve_gf_AttachModelToUnit(lv_hero, "TeleportChargeFinal", "Ref_Origin");
    lv_teleportEffect1 = libNtve_gf_ActorLastCreated();
    libNtve_gf_AttachModelToUnit(lv_hero, "TeleportTargetEffect", "Ref_Origin");
    lv_teleportEffect2 = libNtve_gf_ActorLastCreated();
    SoundPlayOnUnitForPlayer(SoundLink("Gen_Hearthstone_TeleportDone", -1), c_maxPlayers, PlayerGroupAll(), lv_hero, 0.0, 100.0, 0.0);
    Wait(0.125, c_timeGame);
    libNtve_gf_MakeUnitUncommandable(lv_hero, false);
    libNtve_gf_MakeUnitInvulnerable(lv_hero, false);
    UnitSetState(lv_hero, c_unitStateTargetable, true);
    UnitSetState(lv_hero, c_unitStateStoppable, true);
    UnitIssueOrder(lv_hero, Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
    libNtve_gf_ShowHideUnit(lv_hero, true);
    PathSetSourceUnit(libGame_gv_players[lv_player].lv_pathDisplay, lv_hero);
    Wait(0.75, c_timeGame);
    libNtve_gf_KillModel(lv_teleportEffect1);
    libNtve_gf_KillModel(lv_teleportEffect2);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldEnteringGates_Init () {
    libMapM_gt_MMUnderworldEnteringGates = TriggerCreate("libMapM_gt_MMUnderworldEnteringGates_Func");
    TriggerEnable(libMapM_gt_MMUnderworldEnteringGates, false);
    TriggerAddEventPlayerEffectUsed(libMapM_gt_MMUnderworldEnteringGates, c_playerAny, "CaptureMacGuffinCastComplete");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Camera Panned
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldCameraPanned_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_player;
    point lv_target;
    int lv_abathurPlayer;

    // Variable Initialization

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

    lv_player = libGame_gf_CameraPannedFromScriptPlayer();
    lv_target = libGame_gf_CameraPannedFromScriptPoint();
    if ((RegionContainsPoint(libMapM_gv_mMUnderworldUnderGroundPlayable, lv_target) == true)) {
        libMapM_gf_MMUnderworldChangePlane(lv_player, 2);
    }
    else {
        libMapM_gf_MMUnderworldChangePlane(lv_player, 1);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldCameraPanned_Init () {
    libMapM_gt_MMUnderworldCameraPanned = TriggerCreate("libMapM_gt_MMUnderworldCameraPanned_Func");
    TriggerEnable(libMapM_gt_MMUnderworldCameraPanned, false);
    libGame_gf_CameraPannedFromScript(libMapM_gt_MMUnderworldCameraPanned);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Player Hero Location Tracking
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldPlayerHeroLocationTracking_Func (bool testConds, bool runActions) {
    int auto7E7B0D56_ae;
    int auto7E7B0D56_ai;

    // Variable Declarations
    int lv_itPlayer;

    // Variable Initialization

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

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

    TriggerEnable(TriggerGetCurrent(), false);
    while (true) {
        auto7E7B0D56_ae = libCore_gv_bALMaxPlayers;
        auto7E7B0D56_ai = 1;
        lv_itPlayer = 1;
        for ( ; ( (auto7E7B0D56_ai >= 0 && lv_itPlayer <= auto7E7B0D56_ae) || (auto7E7B0D56_ai <= 0 && lv_itPlayer >= auto7E7B0D56_ae) ) ; lv_itPlayer += auto7E7B0D56_ai ) {
            if ((libGame_gv_players[lv_itPlayer].lv_playerStatus == 0)) {
                continue;
            }
            else {
            }
            if ((UnitIsAlive(libGame_gv_players[lv_itPlayer].lv_heroUnit) == true)) {
                if ((libNtve_gf_UnitInRegion(libMapM_gf_MMUnderworldPlayerHeroUnit(lv_itPlayer), libMapM_gv_mMUnderworldAboveGroundPlayable) == true)) {
                    libMapM_gf_MMUnderworldChangePlane(lv_itPlayer, 1);
                }
                else {
                    libMapM_gf_MMUnderworldChangePlane(lv_itPlayer, 2);
                }
            }
            else {
            }
        }
        Wait(0.0625, c_timeGame);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldPlayerHeroLocationTracking_Init () {
    libMapM_gt_MMUnderworldPlayerHeroLocationTracking = TriggerCreate("libMapM_gt_MMUnderworldPlayerHeroLocationTracking_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Ground Hole Vision
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldGroundHoleVision_Func (bool testConds, bool runActions) {
    int auto746458D9_ae;
    int auto746458D9_ai;
    unitgroup auto65A1C578_g;
    int auto65A1C578_u;

    // Variable Declarations
    int lv_itPlayer;
    unit lv_itGate;
    unit lv_itHole;
    int lv_lightIndex;

    // Variable Initialization

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

    auto746458D9_ae = libCore_gv_cOMPUTER_TeamChaos;
    auto746458D9_ai = 1;
    lv_itPlayer = libCore_gv_cOMPUTER_TeamOrder;
    for ( ; ( (auto746458D9_ai >= 0 && lv_itPlayer <= auto746458D9_ae) || (auto746458D9_ai <= 0 && lv_itPlayer >= auto746458D9_ae) ) ; lv_itPlayer += auto746458D9_ai ) {
        auto65A1C578_g = libMapM_gv_mMUnderworldGatesAbove;
        auto65A1C578_u = 1;
        for ( ; auto65A1C578_u <= UnitGroupCount(auto65A1C578_g, c_unitCountAll) ; auto65A1C578_u += BoolToInt(lv_itGate == UnitGroupUnit(auto65A1C578_g, auto65A1C578_u)) ) {
            lv_itGate = UnitGroupUnit(auto65A1C578_g, auto65A1C578_u);
            lv_itHole = libMapM_gf_MMUnderworldGroundHole(lv_itGate);
            if ((libNtve_gf_UnitIsVisibleToPlayer(libMapM_gf_MMUnderworldGroundHoleVision(lv_itHole), lv_itPlayer) == true)) {
                if ((libCore_gf_IntegerStoredForUnit(lv_itHole, lv_itPlayer) == 0)) {
                    libNtve_gf_ShareVisionofUnit(libMapM_gf_MMUnderworldUndergroundLadder(lv_itGate), true, lv_itPlayer);
                    libCore_gf_StoreIntegerForUnit(lv_itHole, lv_itPlayer, 1);
                }
                else {
                }
            }
            else {
                if ((libCore_gf_IntegerStoredForUnit(lv_itHole, lv_itPlayer) == 1)) {
                    libNtve_gf_ShareVisionofUnit(libMapM_gf_MMUnderworldUndergroundLadder(lv_itGate), false, lv_itPlayer);
                    libCore_gf_StoreIntegerForUnit(lv_itHole, lv_itPlayer, 0);
                }
                else {
                }
            }
        }
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldGroundHoleVision_Init () {
    libMapM_gt_MMUnderworldGroundHoleVision = TriggerCreate("libMapM_gt_MMUnderworldGroundHoleVision_Func");
    TriggerEnable(libMapM_gt_MMUnderworldGroundHoleVision, false);
    TriggerAddEventTimePeriodic(libMapM_gt_MMUnderworldGroundHoleVision, 0.25, c_timeGame);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Player Moves Camera
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldPlayerMovesCamera_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    libMapM_gf_MMUnderworldUpdateAmbience(EventPlayer());
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldPlayerMovesCamera_Init () {
    libMapM_gt_MMUnderworldPlayerMovesCamera = TriggerCreate("libMapM_gt_MMUnderworldPlayerMovesCamera_Func");
    TriggerEnable(libMapM_gt_MMUnderworldPlayerMovesCamera, false);
    TriggerAddEventCameraMove(libMapM_gt_MMUnderworldPlayerMovesCamera, 1, c_cameraMoveReasonAny);
    TriggerAddEventCameraMove(libMapM_gt_MMUnderworldPlayerMovesCamera, 2, c_cameraMoveReasonAny);
    TriggerAddEventCameraMove(libMapM_gt_MMUnderworldPlayerMovesCamera, 3, c_cameraMoveReasonAny);
    TriggerAddEventCameraMove(libMapM_gt_MMUnderworldPlayerMovesCamera, 4, c_cameraMoveReasonAny);
    TriggerAddEventCameraMove(libMapM_gt_MMUnderworldPlayerMovesCamera, 5, c_cameraMoveReasonAny);
    TriggerAddEventCameraMove(libMapM_gt_MMUnderworldPlayerMovesCamera, 6, c_cameraMoveReasonAny);
    TriggerAddEventCameraMove(libMapM_gt_MMUnderworldPlayerMovesCamera, 7, c_cameraMoveReasonAny);
    TriggerAddEventCameraMove(libMapM_gt_MMUnderworldPlayerMovesCamera, 8, c_cameraMoveReasonAny);
    TriggerAddEventCameraMove(libMapM_gt_MMUnderworldPlayerMovesCamera, 9, c_cameraMoveReasonAny);
    TriggerAddEventCameraMove(libMapM_gt_MMUnderworldPlayerMovesCamera, 10, c_cameraMoveReasonAny);
    TriggerAddEventCameraMove(libMapM_gt_MMUnderworldPlayerMovesCamera, libCore_gv_oBSERVER_ObserverUIPlayer, c_cameraMoveReasonAny);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Untargetable Across Plane
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldUntargetableAcrossPlane_Func (bool testConds, bool runActions) {
    // Variable Declarations
    unit lv_orderUnit;
    point lv_targetPoint;
    unit lv_targetUnit;
    int lv_itSlot;

    // Variable Initialization

    // Conditions
    if (testConds) {
        if (!((OrderGetFlag(EventUnitOrder(), c_cmdQueued) == false))) {
            return false;
        }

        if (!((OrderGetAbilityCommand(EventUnitOrder()) != AbilityCommand("L90ETCStageDive", 0)))) {
            return false;
        }

        if (!((OrderGetAbilityCommand(EventUnitOrder()) != AbilityCommand("AbathurSymbiote", 0)))) {
            return false;
        }

        if (!((OrderGetAbilityCommand(EventUnitOrder()) != AbilityCommand("FaerieDragonPhaseShiftFlight", 0)))) {
            return false;
        }

        if (!((OrderGetAbilityCommand(EventUnitOrder()) != AbilityCommand("NovaPrecisionStrike", 0)))) {
            return false;
        }

        if (!((OrderGetAbilityCommand(EventUnitOrder()) != AbilityCommand("TyrandeStarfall", 0)))) {
            return false;
        }
    }

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

    lv_orderUnit = EventUnit();
    if ((UnitGetType(lv_orderUnit) == "HeroAbathur") && (EventPlayer() >= 1) && (EventPlayer() <= libCore_gv_bALMaxPlayers)) {
        if ((UnitIsAlive(libGame_gv_players[EventPlayer()].lv_activeVehicle) == true)) {
            return true;
        }
        else {
        }
        lv_orderUnit = libMapM_gf_MMUnderworldPlayerHeroUnit(EventPlayer());
    }
    else {
    }
    if ((AbilityCommandGetAbility(OrderGetAbilityCommand(EventUnitOrder())) == "StormInventory") && ((UnitGetType(OrderGetTargetItem(EventUnitOrder())) == "TalentBucketCalldownMule") || (UnitGetType(OrderGetTargetItem(EventUnitOrder())) == "TalentBucketClairvoyance"))) {
        return true;
    }
    else {
    }
    lv_targetPoint = OrderGetTargetPoint(EventUnitOrder());
    if ((lv_targetPoint != null)) {
        if ((libNtve_gf_UnitInRegion(lv_orderUnit, libMapM_gv_mMUnderworldAboveGroundPlayable) == true) && (RegionContainsPoint(libMapM_gv_mMUnderworldUnderGroundPlayable, lv_targetPoint) == true)) {
            UIDisplayMessage(PlayerGroupSingle(EventPlayer()), c_messageAreaError, StringExternal("Param/Value/lib_MapM_F73CFDCD"));
            UnitIssueOrder(lv_orderUnit, Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
            return true;
        }
        else {
        }
        if ((libNtve_gf_UnitInRegion(lv_orderUnit, libMapM_gv_mMUnderworldUnderGroundPlayable) == true) && (RegionContainsPoint(libMapM_gv_mMUnderworldAboveGroundPlayable, lv_targetPoint) == true)) {
            UIDisplayMessage(PlayerGroupSingle(EventPlayer()), c_messageAreaError, StringExternal("Param/Value/lib_MapM_3C9A30E8"));
            UnitIssueOrder(lv_orderUnit, Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
            return true;
        }
        else {
        }
    }
    else {
    }
    lv_targetUnit = OrderGetTargetUnit(EventUnitOrder());
    if ((lv_targetUnit != null)) {
        if ((libNtve_gf_UnitInRegion(lv_orderUnit, libMapM_gv_mMUnderworldAboveGroundPlayable) == true) && (libNtve_gf_UnitInRegion(lv_targetUnit, libMapM_gv_mMUnderworldUnderGroundPlayable) == true)) {
            UIDisplayMessage(PlayerGroupSingle(EventPlayer()), c_messageAreaError, StringExternal("Param/Value/lib_MapM_1E2B7F04"));
            UnitIssueOrder(lv_orderUnit, Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
            return true;
        }
        else {
        }
        if ((libNtve_gf_UnitInRegion(lv_orderUnit, libMapM_gv_mMUnderworldUnderGroundPlayable) == true) && (libNtve_gf_UnitInRegion(lv_targetUnit, libMapM_gv_mMUnderworldAboveGroundPlayable) == true)) {
            UIDisplayMessage(PlayerGroupSingle(EventPlayer()), c_messageAreaError, StringExternal("Param/Value/lib_MapM_2FCBB15A"));
            UnitIssueOrder(lv_orderUnit, Order(AbilityCommand("stop", 0)), c_orderQueueReplace);
            return true;
        }
        else {
        }
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldUntargetableAcrossPlane_Init () {
    libMapM_gt_MMUnderworldUntargetableAcrossPlane = TriggerCreate("libMapM_gt_MMUnderworldUntargetableAcrossPlane_Func");
    TriggerEnable(libMapM_gt_MMUnderworldUntargetableAcrossPlane, false);
    TriggerAddEventUnitOrder(libMapM_gt_MMUnderworldUntargetableAcrossPlane, null, null);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Minion Dies
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldMinionDies_Func (bool testConds, bool runActions) {
    int auto303C433C_n;
    int auto303C433C_i;

    // Variable Declarations
    int lv_groupIndex;
    int lv_regenGlobeOwner;
    int lv_regenGlobeCount;
    int lv_itGroupIndex;

    // Variable Initialization

    // Conditions
    if (testConds) {
        if (!(((UnitGetType(EventUnit()) == "UnderworldMinion") || (UnitGetType(EventUnit()) == "UnderworldRangedMinion") || (UnitGetType(EventUnit()) == "UnderworldBoss")))) {
            return false;
        }
    }

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

    if ((UnitGetType(EventUnit()) == "UnderworldBoss")) {
        libMapM_gf_MMUnderworldDropSkulls(UnitGetPosition(EventUnit()), libMapM_gf_MMUnderworldBossSkullDropCount(), true);
        lv_regenGlobeCount = 3;
    }
    else {
        libMapM_gf_MMUnderworldDropSkulls(UnitGetPosition(EventUnit()), 1, false);
    }
    if ((lv_regenGlobeCount > 0)) {
        libMapM_gv_mMUnderworldMinionGroups[lv_groupIndex].lv_regenGlobeDropped = true;
        if ((PlayerGroupHasPlayer(libCore_gv_teamOrder, UnitGetOwner(libNtve_gf_KillingUnit())) == true)) {
            lv_regenGlobeOwner = libCore_gv_cOMPUTER_TeamOrder;
        }
        else {
            lv_regenGlobeOwner = libCore_gv_cOMPUTER_TeamChaos;
        }
        auto303C433C_n = lv_regenGlobeCount;
        for (auto303C433C_i = 1; auto303C433C_i <= auto303C433C_n; auto303C433C_i += 1) {
            libNtve_gf_CreateUnitsWithDefaultFacing(1, "RegenGlobe", c_unitCreateIgnorePlacement, lv_regenGlobeOwner, RegionRandomPoint(RegionCircle(UnitGetPosition(EventUnit()), 2.0)));
        }
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldMinionDies_Init () {
    libMapM_gt_MMUnderworldMinionDies = TriggerCreate("libMapM_gt_MMUnderworldMinionDies_Func");
    TriggerEnable(libMapM_gt_MMUnderworldMinionDies, false);
    TriggerAddEventUnitDied(libMapM_gt_MMUnderworldMinionDies, null);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Skull Dropped
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldSkullDropped_Func (bool testConds, bool runActions) {
    int auto7E2477BE_n;
    int auto7E2477BE_i;
    int auto5B2A74DC_ae;
    int auto5B2A74DC_ai;
    int auto81D43B5E_ae;
    int auto81D43B5E_ai;
    int auto279681DE_ae;
    int auto279681DE_ai;

    // Variable Declarations
    int lv_itPlayer;

    // Variable Initialization

    // Conditions
    if (testConds) {
        if (!((UnitGetType(EventUnitCreatedUnit()) == "ItemUnderworldPowerup"))) {
            return false;
        }
    }

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

    SoundPlayAtPointForPlayer(SoundLink("UI_Game_Skull_Drop", -1), c_maxPlayers, PlayerGroupAll(), UnitGetPosition(EventUnitCreatedUnit()), 0.0, 100.0, 0.5);
    auto7E2477BE_n = 5;
    for (auto7E2477BE_i = 1; auto7E2477BE_i <= auto7E2477BE_n; auto7E2477BE_i += 1) {
        if ((UnitIsAlive(EventUnitCreatedUnit()) == false)) {
            return true;
        }
        else {
        }
        auto5B2A74DC_ae = libCore_gv_bALMaxPlayers;
        auto5B2A74DC_ai = 1;
        lv_itPlayer = 1;
        for ( ; ( (auto5B2A74DC_ai >= 0 && lv_itPlayer <= auto5B2A74DC_ae) || (auto5B2A74DC_ai <= 0 && lv_itPlayer >= auto5B2A74DC_ae) ) ; lv_itPlayer += auto5B2A74DC_ai ) {
            if ((libNtve_gf_UnitIsVisibleToPlayer(EventUnitCreatedUnit(), lv_itPlayer) == true)) {
                libNtve_gf_ShareVisionofUnit(EventUnitCreatedUnit(), true, lv_itPlayer);
            }
            else {
            }
        }
        Wait(1.0, c_timeGame);
    }
    auto81D43B5E_ae = libCore_gv_bALMaxPlayers;
    auto81D43B5E_ai = 1;
    lv_itPlayer = 1;
    for ( ; ( (auto81D43B5E_ai >= 0 && lv_itPlayer <= auto81D43B5E_ae) || (auto81D43B5E_ai <= 0 && lv_itPlayer >= auto81D43B5E_ae) ) ; lv_itPlayer += auto81D43B5E_ai ) {
        libNtve_gf_ShareVisionofUnit(EventUnitCreatedUnit(), true, lv_itPlayer);
    }
    while (!((UnitIsAlive(EventUnitCreatedUnit()) == false))) {
        Wait(1.0, c_timeGame);
    }
    auto279681DE_ae = libCore_gv_bALMaxPlayers;
    auto279681DE_ai = 1;
    lv_itPlayer = 1;
    for ( ; ( (auto279681DE_ai >= 0 && lv_itPlayer <= auto279681DE_ae) || (auto279681DE_ai <= 0 && lv_itPlayer >= auto279681DE_ae) ) ; lv_itPlayer += auto279681DE_ai ) {
        libNtve_gf_ShareVisionofUnit(EventUnitCreatedUnit(), false, lv_itPlayer);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldSkullDropped_Init () {
    libMapM_gt_MMUnderworldSkullDropped = TriggerCreate("libMapM_gt_MMUnderworldSkullDropped_Func");
    TriggerEnable(libMapM_gt_MMUnderworldSkullDropped, false);
    TriggerAddEventUnitCreated(libMapM_gt_MMUnderworldSkullDropped, null, null, null);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Skull Pickup
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldSkullPickup_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_collectingPlayer;
    playergroup lv_textTagPlayers;

    // Variable Initialization
    lv_textTagPlayers = PlayerGroupEmpty();

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

    lv_collectingPlayer = UnitGetOwner(EventUnitTargetUnit());
    libMapM_gv_mMUnderworldSkullCollected[libGame_gf_TeamNumberOfPlayer(lv_collectingPlayer)] += 1;
    SoundPlayAtPointForPlayer(SoundLink("UI_Game_Skull_Pickup", -1), c_maxPlayers, PlayerGroupAll(), UnitGetPosition(EventUnitTargetUnit()), 0.5, 100.0, 0.0);
    libNtve_gf_AddPlayerGroupToPlayerGroup(libGame_gf_AlliedPlayerGroupOfPlayer(UnitGetOwner(EventUnitTargetUnit())), lv_textTagPlayers);
    PlayerGroupAdd(lv_textTagPlayers, libCore_gv_oBSERVER_ObserverUIPlayer);
    TextTagCreate(StringExternal("Param/Value/lib_MapM_D67F880C"), 24, UnitGetPosition(EventUnitTargetUnit()), 1.0, true, true, lv_textTagPlayers);
    TextTagSetVelocity(TextTagLastCreated(), 1.5, 90.0);
    TextTagSetTime(TextTagLastCreated(), c_textTagTimeDuration, 3.0);
    TextTagSetFogVisibility(TextTagLastCreated(), c_visTypeFog);
    TextTagCreate(StringExternal("Param/Value/lib_MapM_2BA9782F"), 24, UnitGetPosition(EventUnitTargetUnit()), 1.0, true, true, libGame_gf_EnemyPlayerGroupOfPlayer(UnitGetOwner(EventUnitTargetUnit())));
    TextTagSetVelocity(TextTagLastCreated(), 1.5, 90.0);
    TextTagSetTime(TextTagLastCreated(), c_textTagTimeDuration, 3.0);
    TextTagSetFogVisibility(TextTagLastCreated(), c_visTypeFog);
    libGame_gf_SendEventMapUnderworldSkullCollected(libMapM_gv_mMUnderworldSkullCollected[1], libMapM_gv_mMUnderworldSkullCollected[2], lv_collectingPlayer);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldSkullPickup_Init () {
    libMapM_gt_MMUnderworldSkullPickup = TriggerCreate("libMapM_gt_MMUnderworldSkullPickup_Func");
    TriggerEnable(libMapM_gt_MMUnderworldSkullPickup, false);
    TriggerAddEventUnitAbility(libMapM_gt_MMUnderworldSkullPickup, null, AbilityCommand("ItemUndergroundSkullPickup", 0), c_unitAbilStageComplete, false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Scaling
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldScaling_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!((TriggerIsEnabled(TriggerGetCurrent()) == true))) {
            return false;
        }
    }

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

    TriggerEnable(TriggerGetCurrent(), false);
    while (true) {
        Wait(60.0, c_timeGame);
        libMapM_gv_mMUnderworldScalingCurrentTicks += 1;
        if ((libMapM_gv_mMUnderworldScalingCurrentTicks > libCore_gv_dataScalingMaxScalingTicks)) {
            libMapM_gv_mMUnderworldScalingCurrentTicks = libCore_gv_dataScalingMaxScalingTicks;
        }
        else {
        }
        libMapM_gv_mMUnderworldMinionScalingCurrent.lv_xP = (libMapM_gv_mMUnderworldMinionScalingCurrent.lv_xP + libMapM_gv_mMUnderworldMinionScalingChanges[libMapM_gv_mMUnderworldScalingCurrentTicks].lv_xP);
        libMapM_gv_mMUnderworldBossScalingCurrent.lv_xP = (libMapM_gv_mMUnderworldBossScalingCurrent.lv_xP + libMapM_gv_mMUnderworldBossScalingChanges[libMapM_gv_mMUnderworldScalingCurrentTicks].lv_xP);
        libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_hPFlat = (libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_hPFlat + libMapM_gv_mMUnderworldSummonedBossScalingChanges[libMapM_gv_mMUnderworldScalingCurrentTicks].lv_hPFlat);
        libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_hPPercent = (libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_hPPercent + libMapM_gv_mMUnderworldSummonedBossScalingChanges[libMapM_gv_mMUnderworldScalingCurrentTicks].lv_hPPercent);
        libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damageFlat = (libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damageFlat + libMapM_gv_mMUnderworldSummonedBossScalingChanges[libMapM_gv_mMUnderworldScalingCurrentTicks].lv_damageFlat);
        libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damagePercent = (libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damagePercent + libMapM_gv_mMUnderworldSummonedBossScalingChanges[libMapM_gv_mMUnderworldScalingCurrentTicks].lv_damagePercent);
        libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_xP = (libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_xP + libMapM_gv_mMUnderworldSummonedBossScalingChanges[libMapM_gv_mMUnderworldScalingCurrentTicks].lv_xP);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldScaling_Init () {
    libMapM_gt_MMUnderworldScaling = TriggerCreate("libMapM_gt_MMUnderworldScaling_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Summoned Boss Ping Visibility
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldSummonedBossPingVisibility_Func (bool testConds, bool runActions) {
    int auto6DFD38D5_ae;
    int auto6DFD38D5_ai;
    playergroup auto9316B709_g;
    int auto9316B709_p;
    playergroup autoF4FEC896_g;
    int autoF4FEC896_p;

    // Variable Declarations
    int lv_itPlayer;
    int lv_itTeam;
    playergroup lv_pingPlayers;

    // Variable Initialization
    lv_pingPlayers = PlayerGroupEmpty();

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

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

    TriggerEnable(TriggerGetCurrent(), false);
    while (true) {
        auto6DFD38D5_ae = 2;
        auto6DFD38D5_ai = 1;
        lv_itTeam = 1;
        for ( ; ( (auto6DFD38D5_ai >= 0 && lv_itTeam <= auto6DFD38D5_ae) || (auto6DFD38D5_ai <= 0 && lv_itTeam >= auto6DFD38D5_ae) ) ; lv_itTeam += auto6DFD38D5_ai ) {
            if ((UnitIsAlive(libMapM_gv_mMUnderworldSummonedBoss[lv_itTeam]) == true)) {
                if ((libCore_gf_PingStoredForUnit(libMapM_gv_mMUnderworldSummonedBoss[lv_itTeam], 1) != c_invalidPingId)) {
                    lv_pingPlayers = PlayerGroupEmpty();
                    auto9316B709_g = libGame_gf_PlayersOnTeamHeroes(1, false); 
                    auto9316B709_p = 1;
                    for ( ; auto9316B709_p <= PlayerGroupCount(auto9316B709_g) ; auto9316B709_p += BoolToInt(lv_itPlayer == PlayerGroupPlayer(auto9316B709_g, auto9316B709_p)) ) {
                        lv_itPlayer = PlayerGroupPlayer(auto9316B709_g, auto9316B709_p);
                        if ((PlayerStatus(lv_itPlayer) == c_playerStatusActive)) {
                            PlayerGroupAdd(lv_pingPlayers, lv_itPlayer);
                        }
                        else {
                        }
                    }
                    PingSetPlayerGroup(libCore_gf_PingStoredForUnit(libMapM_gv_mMUnderworldSummonedBoss[lv_itTeam], 1), lv_pingPlayers);
                }
                else {
                }
                if ((libCore_gf_PingStoredForUnit(libMapM_gv_mMUnderworldSummonedBoss[lv_itTeam], 2) != c_invalidPingId)) {
                    lv_pingPlayers = PlayerGroupEmpty();
                    autoF4FEC896_g = libGame_gf_PlayersOnTeamHeroes(2, false); 
                    autoF4FEC896_p = 1;
                    for ( ; autoF4FEC896_p <= PlayerGroupCount(autoF4FEC896_g) ; autoF4FEC896_p += BoolToInt(lv_itPlayer == PlayerGroupPlayer(autoF4FEC896_g, autoF4FEC896_p)) ) {
                        lv_itPlayer = PlayerGroupPlayer(autoF4FEC896_g, autoF4FEC896_p);
                        if ((PlayerStatus(lv_itPlayer) == c_playerStatusActive)) {
                            PlayerGroupAdd(lv_pingPlayers, lv_itPlayer);
                        }
                        else {
                        }
                    }
                    PingSetPlayerGroup(libCore_gf_PingStoredForUnit(libMapM_gv_mMUnderworldSummonedBoss[lv_itTeam], 2), lv_pingPlayers);
                }
                else {
                }
            }
            else {
            }
        }
        Wait(0.2, c_timeGame);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldSummonedBossPingVisibility_Init () {
    libMapM_gt_MMUnderworldSummonedBossPingVisibility = TriggerCreate("libMapM_gt_MMUnderworldSummonedBossPingVisibility_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Summoned Bosses Died
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldSummonedBossesDied_Func (bool testConds, bool runActions) {
    unit auto86A40564_val;

    // Variable Declarations
    int lv_team;
    int lv_enemyTeam;

    // Variable Initialization

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

    auto86A40564_val = EventUnit();
    if (auto86A40564_val == libMapM_gv_mMUnderworldSummonedBoss[1]) {
        lv_team = 1;
    }
    else if (auto86A40564_val == libMapM_gv_mMUnderworldSummonedBoss[2]) {
        lv_team = 2;
    }
    else {
        return true;
    }
    lv_enemyTeam = (3 - lv_team);
    libMapM_gv_mMUnderworldSummonedBossLocation[lv_team] = UnitGetPosition(EventUnit());
    libGame_gf_AnnouncementAddItemForPlayerGroup(libGame_gf_PlayersOnTeamHeroes(lv_team, false), 0, 0, "AllyGolemSlain", StringExternal("Param/Value/lib_MapM_DD54B101"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    libGame_gf_AnnouncementAddItemForPlayerGroup(libGame_gf_PlayersOnTeamHeroes(lv_enemyTeam, false), 0, 0, "EnemyGolemSlain", StringExternal("Param/Value/lib_MapM_5065385C"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    libGame_gf_AnnouncementAddItemForPlayerGroup(libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], 0, 0, "AllyGolemSlain", StringExternal("Param/Value/lib_MapM_5F6F2353"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    libMapM_gf_MMUnderworldTransmissionOurGolemDefeatedQ(libGame_gf_PlayersOnTeamHeroes(lv_team, false));
    libMapM_gf_MMUnderworldTransmissionEnemyGolemDefeatedQ(libGame_gf_PlayersOnTeamHeroes(lv_enemyTeam, false));
    PingDestroy(libCore_gf_PingStoredForUnit(libMapM_gv_mMUnderworldSummonedBoss[lv_team], 1));
    libCore_gf_StorePingForUnit(libMapM_gv_mMUnderworldSummonedBoss[lv_team], 1, c_invalidPingId);
    PingDestroy(libCore_gf_PingStoredForUnit(libMapM_gv_mMUnderworldSummonedBoss[lv_team], 2));
    libCore_gf_StorePingForUnit(libMapM_gv_mMUnderworldSummonedBoss[lv_team], 2, c_invalidPingId);
    Wait(1.5, c_timeGame);
    libNtve_gf_CreateUnitsWithDefaultFacing(1, "UnderworldSummonedBossBody", c_unitCreateIgnorePlacement, libGame_gf_ComputerPlayerInTeam(lv_team), libMapM_gv_mMUnderworldSummonedBossLocation[lv_team]);
    libMapM_gv_mMUnderworldSummonedBossBody[lv_team] = UnitLastCreated();
    if ((UnitIsAlive(libMapM_gv_mMUnderworldSummonedBoss[1]) == false) && (UnitIsAlive(libMapM_gv_mMUnderworldSummonedBoss[2]) == false)) {
        SoundtrackStop(PlayerGroupAll(), c_soundtrackCategoryMusic, true);
        if ((libCore_gv_mAPMapSoundtrack != null)) {
            SoundtrackPlay(PlayerGroupAll(), c_soundtrackCategoryMusic, libCore_gv_mAPMapSoundtrack, c_soundtrackCueAny, c_soundtrackIndexAny, true);
        }
        else {
        }
        Wait((libMapM_gv_mMUnderworldEventCooldown_C - 4.0), c_timeGame);
        SoundPlayForPlayer(SoundLink("Event_GraveGolem_Awaken", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);
        Wait(4.0, c_timeGame);
        libMapM_gf_MMUnderworldPrepare();
    }
    else {
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldSummonedBossesDied_Init () {
    libMapM_gt_MMUnderworldSummonedBossesDied = TriggerCreate("libMapM_gt_MMUnderworldSummonedBossesDied_Func");
    TriggerEnable(libMapM_gt_MMUnderworldSummonedBossesDied, false);
    TriggerAddEventUnitDied(libMapM_gt_MMUnderworldSummonedBossesDied, UnitRefFromVariable("libMapM_gv_mMUnderworldSummonedBoss[1]"));
    TriggerAddEventUnitDied(libMapM_gt_MMUnderworldSummonedBossesDied, UnitRefFromVariable("libMapM_gv_mMUnderworldSummonedBoss[2]"));
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Open Gates Timer Started
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldOpenGatesTimerStarted_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_itPlayer;

    // Variable Initialization

    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldOpenGatesTimerStarted_Init () {
    libMapM_gt_MMUnderworldOpenGatesTimerStarted = TriggerCreate("libMapM_gt_MMUnderworldOpenGatesTimerStarted_Func");
    TriggerEnable(libMapM_gt_MMUnderworldOpenGatesTimerStarted, false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Gates Opened
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldGatesOpened_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    TriggerExecute(libMapM_gt_MMUnderworldScaling, true, false);
    Wait(libMapM_gv_mMUnderworldStartTime, c_timeGame);
    if ((TriggerIsEnabled(TriggerGetCurrent()) == false)) {
        return true;
    }
    else {
    }
    libMapM_gf_MMUnderworldPrepare();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldGatesOpened_Init () {
    libMapM_gt_MMUnderworldGatesOpened = TriggerCreate("libMapM_gt_MMUnderworldGatesOpened_Func");
    TriggerEnable(libMapM_gt_MMUnderworldGatesOpened, false);
    TriggerAddEventTimer(libMapM_gt_MMUnderworldGatesOpened, libGame_gv_openTheGatesTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Underworld Opened
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldUnderworldOpened_Func (bool testConds, bool runActions) {
    // Actions
    if (!runActions) {
        return true;
    }

    libMapM_gf_MMUnderworldStart();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldUnderworldOpened_Init () {
    libMapM_gt_MMUnderworldUnderworldOpened = TriggerCreate("libMapM_gt_MMUnderworldUnderworldOpened_Func");
    TriggerAddEventTimer(libMapM_gt_MMUnderworldUnderworldOpened, libMapM_gv_mMUnderworldPrepTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Gates Ping & Helper
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldGatesPingHelper_Func (bool testConds, bool runActions) {
    unitgroup auto1CED1C49_g;
    int auto1CED1C49_u;
    unitgroup auto524930BF_g;
    int auto524930BF_u;
    int auto7CD0990F_n;
    int auto7CD0990F_i;
    unitgroup autoD3BA7307_g;
    int autoD3BA7307_u;
    int auto2E5EA7E1_ae;
    int auto2E5EA7E1_ai;
    unitgroup autoF9E752AD_g;
    int autoF9E752AD_u;
    unitgroup auto78BAAB89_g;
    int auto78BAAB89_u;

    // Variable Declarations
    unit lv_itGate;
    int lv_itPlayer;
    playergroup lv_pingPlayers;

    // Variable Initialization
    lv_pingPlayers = PlayerGroupEmpty();

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

    while (true) {
        if ((libMapM_gv_mMUnderworldOpened == false)) {
            auto1CED1C49_g = libMapM_gv_mMUnderworldGatesAbove;
            auto1CED1C49_u = 1;
            for ( ; auto1CED1C49_u <= UnitGroupCount(auto1CED1C49_g, c_unitCountAll) ; auto1CED1C49_u += BoolToInt(lv_itGate == UnitGroupUnit(auto1CED1C49_g, auto1CED1C49_u)) ) {
                lv_itGate = UnitGroupUnit(auto1CED1C49_g, auto1CED1C49_u);
                PingDestroy(libCore_gf_PingStoredForUnit(lv_itGate, 1));
                libCore_gf_StorePingForUnit(lv_itGate, 1, c_invalidPingId);
            }
            return true;
        }
        else {
        }
        auto524930BF_g = libMapM_gv_mMUnderworldGatesAbove;
        auto524930BF_u = 1;
        for ( ; auto524930BF_u <= UnitGroupCount(auto524930BF_g, c_unitCountAll) ; auto524930BF_u += BoolToInt(lv_itGate == UnitGroupUnit(auto524930BF_g, auto524930BF_u)) ) {
            lv_itGate = UnitGroupUnit(auto524930BF_g, auto524930BF_u);
            libNtve_gf_CreatePingFacingAngle(PlayerGroupAll(), "StormPingAlert", UnitGetPosition(lv_itGate), ColorWithAlpha(100.00, 100.00, 0.00, 0.00), 0.0, 270.0);
            libCore_gf_StorePingForUnit(lv_itGate, 1, PingLastCreated());
        }
        auto7CD0990F_n = 6;
        for (auto7CD0990F_i = 1; auto7CD0990F_i <= auto7CD0990F_n; auto7CD0990F_i += 1) {
            if ((libMapM_gv_mMUnderworldOpened == false)) {
                autoD3BA7307_g = libMapM_gv_mMUnderworldGatesAbove;
                autoD3BA7307_u = 1;
                for ( ; autoD3BA7307_u <= UnitGroupCount(autoD3BA7307_g, c_unitCountAll) ; autoD3BA7307_u += BoolToInt(lv_itGate == UnitGroupUnit(autoD3BA7307_g, autoD3BA7307_u)) ) {
                    lv_itGate = UnitGroupUnit(autoD3BA7307_g, autoD3BA7307_u);
                    PingDestroy(libCore_gf_PingStoredForUnit(lv_itGate, 1));
                    libCore_gf_StorePingForUnit(lv_itGate, 1, c_invalidPingId);
                }
                return true;
            }
            else {
            }
            PlayerGroupClear(lv_pingPlayers);
            auto2E5EA7E1_ae = libCore_gv_bALMaxPlayers;
            auto2E5EA7E1_ai = 1;
            lv_itPlayer = 1;
            for ( ; ( (auto2E5EA7E1_ai >= 0 && lv_itPlayer <= auto2E5EA7E1_ae) || (auto2E5EA7E1_ai <= 0 && lv_itPlayer >= auto2E5EA7E1_ae) ) ; lv_itPlayer += auto2E5EA7E1_ai ) {
                if ((UnitIsAlive(libMapM_gf_MMUnderworldPlayerHeroUnit(lv_itPlayer)) == true) && (libNtve_gf_UnitInRegion(libMapM_gf_MMUnderworldPlayerHeroUnit(lv_itPlayer), libMapM_gv_mMUnderworldUnderGroundPlayable) == false)) {
                    PlayerGroupAdd(lv_pingPlayers, lv_itPlayer);
                }
                else {
                }
            }
            autoF9E752AD_g = libMapM_gv_mMUnderworldGatesAbove;
            autoF9E752AD_u = 1;
            for ( ; autoF9E752AD_u <= UnitGroupCount(autoF9E752AD_g, c_unitCountAll) ; autoF9E752AD_u += BoolToInt(lv_itGate == UnitGroupUnit(autoF9E752AD_g, autoF9E752AD_u)) ) {
                lv_itGate = UnitGroupUnit(autoF9E752AD_g, autoF9E752AD_u);
                PingSetPlayerGroup(libCore_gf_PingStoredForUnit(lv_itGate, 1), lv_pingPlayers);
            }
            Wait(1.0, c_timeGame);
        }
        auto78BAAB89_g = libMapM_gv_mMUnderworldGatesAbove;
        auto78BAAB89_u = 1;
        for ( ; auto78BAAB89_u <= UnitGroupCount(auto78BAAB89_g, c_unitCountAll) ; auto78BAAB89_u += BoolToInt(lv_itGate == UnitGroupUnit(auto78BAAB89_g, auto78BAAB89_u)) ) {
            lv_itGate = UnitGroupUnit(auto78BAAB89_g, auto78BAAB89_u);
            PingDestroy(libCore_gf_PingStoredForUnit(lv_itGate, 1));
            libCore_gf_StorePingForUnit(lv_itGate, 1, c_invalidPingId);
        }
        Wait(8.0, c_timeGame);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldGatesPingHelper_Init () {
    libMapM_gt_MMUnderworldGatesPingHelper = TriggerCreate("libMapM_gt_MMUnderworldGatesPingHelper_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Cleared
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldCleared_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_itGroupIndex;
    unit lv_itMinion;
    unit lv_itSkull;
    unit lv_itGate;
    unit lv_itBush;

    // Variable Initialization

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

    libMapM_gf_MMUnderworldTransmissionUnderworldClearedQ(PlayerGroupAll());
    libGame_gf_AnnouncementAddItemForPlayerGroup(PlayerGroupAll(), 0, 0, "UndeadDefeated", StringExternal("Param/Value/lib_MapM_F9BCC082"), null, null, null, libGame_gv_announcement_StandardTimerDuration_C, false);
    libMapM_gf_MMUnderworldTurnGroundHoleLightOnOff(false);
    libGame_gf_SendEventMapUnderworldCleared();
    Wait(3.0, c_timeGame);
    libMapM_gv_mMUnderworldOpened = false;
    libMapM_gf_MMUnderworldSummonBoss();
    while (!(((UnitIsAlive(libMapM_gv_mMUnderworldSummonedBoss[1]) == true) || (UnitIsAlive(libMapM_gv_mMUnderworldSummonedBoss[2]) == true)))) {
        Wait(1.0, c_timeGame);
    }
    TriggerEnable(libMapM_gt_MMUnderworldSummonedBossesDied, true);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldCleared_Init () {
    libMapM_gt_MMUnderworldCleared = TriggerCreate("libMapM_gt_MMUnderworldCleared_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld ObjectiveUI Handler
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldObjectiveUIHandler_Func (bool testConds, bool runActions) {
    // Variable Declarations
    text lv_tip;
    int lv_indexTeam;
    int lv_indexTeamEnemy;
    int lv_state;
    int lv_lastState;

    // Variable Initialization
    lv_state = 2;
    lv_lastState = 2;

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

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

    TriggerEnable(TriggerGetCurrent(), false);
    lv_tip = StringExternal("Param/Value/lib_MapM_558DD799");
    while (true) {
        if ((TimerGetRemaining(libMapM_gv_mMUnderworldPrepTimer) > 0.0)) {
            lv_state = 1;
            if ((lv_state != lv_lastState)) {
                libUIUI_gf_MapMechanicsHauntedMinesSetMode(0);
                libUIUI_gf_MapMechanicsHauntedMinesShowHidePanel(true);
            }
            else {
            }
            libUIUI_gf_MapMechanicsHauntedMinesSetRemainingMinesWarningTime(FixedToInt(TimerGetRemaining(libMapM_gv_mMUnderworldPrepTimer)));
            lv_lastState = lv_state;
        }
        else if ((libMapM_gv_mMUnderworldOpened == true)) {
            lv_state = 2;
            if ((lv_state != lv_lastState)) {
                libUIUI_gf_MapMechanicsHauntedMinesSetMode(1);
                libUIUI_gf_MapMechanicsHauntedMinesShowHidePanel(true);
            }
            else {
            }
            libMapM_gf_MMUnderworldObjectiveUIUpdateText();
            lv_lastState = lv_state;
        }
        else if (((UnitIsAlive(libMapM_gv_mMUnderworldSummonedBoss[1]) == true) || (UnitIsAlive(libMapM_gv_mMUnderworldSummonedBoss[2]) == true))) {
            lv_state = 3;
            lv_lastState = lv_state;
        }
        else if (true) {
            if (((lv_lastState == 1) || (lv_lastState == 2))) {
                Wait(0.5, c_timeGame);
                continue;
            }
            else {
            }
            lv_state = 0;
            if ((lv_state != lv_lastState)) {
                Wait(4.0, c_timeGame);
                libUIUI_gf_MapMechanicsHauntedMinesShowHidePanel(false);
            }
            else {
            }
            lv_lastState = lv_state;
        }
        Wait(0.5, c_timeGame);
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldObjectiveUIHandler_Init () {
    libMapM_gt_MMUnderworldObjectiveUIHandler = TriggerCreate("libMapM_gt_MMUnderworldObjectiveUIHandler_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Summoned Boss UI Bar
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldSummonedBossUIBar_Func (bool testConds, bool runActions) {
    int auto2D617A3B_ae;
    int auto2D617A3B_ai;

    // Variable Declarations
    int lv_itTeam;
    fixed lv_current;
    timer lv_summonTimer;
    unit[3] lv_tempGolems;

    // Variable Initialization
    lv_summonTimer = TimerCreate();

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

    TimerStart(lv_summonTimer, libMapM_gv_mMUnderworldSummonedBossDuration_C, false, c_timeGame);
    auto2D617A3B_ae = 2;
    auto2D617A3B_ai = 1;
    lv_itTeam = 1;
    for ( ; ( (auto2D617A3B_ai >= 0 && lv_itTeam <= auto2D617A3B_ae) || (auto2D617A3B_ai <= 0 && lv_itTeam >= auto2D617A3B_ae) ) ; lv_itTeam += auto2D617A3B_ai ) {
        libNtve_gf_CreateUnitsWithDefaultFacing(1, "UnderworldSummonedBoss", c_unitCreateIgnorePlacement, libGame_gf_ComputerPlayerInTeam(lv_itTeam), Point(0.0, 0.0));
        lv_tempGolems[lv_itTeam] = UnitLastCreated();
        libNtve_gf_ShowHideUnit(UnitLastCreated(), false);
        libNtve_gf_MakeUnitInvulnerable(UnitLastCreated(), true);
        libNtve_gf_PauseUnit(UnitLastCreated(), true);
        UnitSetState(UnitLastCreated(), c_unitStateTargetable, false);
        UnitSetState(UnitLastCreated(), c_unitStateRadarable, false);
        UnitSetState(UnitLastCreated(), c_unitStateStatusBar, false);
        UnitSetState(UnitLastCreated(), c_unitStateSelectable, false);
        UnitSetState(UnitLastCreated(), c_unitStateHighlightable, false);
        UnitSetState(UnitLastCreated(), c_unitStateDetectable, false);
        UnitSetState(UnitLastCreated(), c_unitStateCursorable, false);
        UnitSetPropertyFixed(UnitLastCreated(), c_unitPropLifeMax, 2000.0);
    }
    UnitSetPropertyFixed(lv_tempGolems[1], c_unitPropLifePercent, 0.1);
    UnitSetPropertyFixed(lv_tempGolems[2], c_unitPropLifePercent, 0.1);
    libUIUI_gf_MapMechanicsHauntedMinesSetUpGolemForTeam(lv_tempGolems[libGame_gv_teamOrderIndex_C], libMapM_gv_mMUnderworldSkullCollected[libGame_gv_teamOrderIndex_C], libGame_gv_teamOrderIndex_C);
    libUIUI_gf_MapMechanicsHauntedMinesSetUpGolemForTeam(lv_tempGolems[libGame_gv_teamChaosIndex_C], libMapM_gv_mMUnderworldSkullCollected[libGame_gv_teamChaosIndex_C], libGame_gv_teamChaosIndex_C);
    libUIUI_gf_MapMechanicsHauntedMinesSetMode(2);
    while (true) {
        lv_current = (TimerGetElapsed(lv_summonTimer)*100/TimerGetDuration(lv_summonTimer));
        if ((lv_current > 0.1)) {
            UnitSetPropertyFixed(lv_tempGolems[1], c_unitPropLifePercent, lv_current);
            UnitSetPropertyFixed(lv_tempGolems[2], c_unitPropLifePercent, lv_current);
        }
        else {
        }
        Wait(0.125, c_timeGame);
        if ((TimerGetRemaining(lv_summonTimer) == 0.0)) {
            break;
        }
        else {
        }
    }
    while (!(((UnitIsAlive(libMapM_gv_mMUnderworldSummonedBoss[1]) == true) && (UnitIsAlive(libMapM_gv_mMUnderworldSummonedBoss[2]) == true)))) {
        Wait(0.25, c_timeGame);
    }
    libUIUI_gf_MapMechanicsHauntedMinesSetUpGolemForTeam(libMapM_gv_mMUnderworldSummonedBoss[libGame_gv_teamOrderIndex_C], libMapM_gv_mMUnderworldSkullCollected[libGame_gv_teamOrderIndex_C], libGame_gv_teamOrderIndex_C);
    libUIUI_gf_MapMechanicsHauntedMinesSetUpGolemForTeam(libMapM_gv_mMUnderworldSummonedBoss[libGame_gv_teamChaosIndex_C], libMapM_gv_mMUnderworldSkullCollected[libGame_gv_teamChaosIndex_C], libGame_gv_teamChaosIndex_C);
    UnitRemove(lv_tempGolems[1]);
    UnitRemove(lv_tempGolems[2]);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldSummonedBossUIBar_Init () {
    libMapM_gt_MMUnderworldSummonedBossUIBar = TriggerCreate("libMapM_gt_MMUnderworldSummonedBossUIBar_Func");
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Debug Start
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldDebugStart_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {
            return false;
        }
    }

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

    libMapM_gf_MMUnderworldPrepare();
    TimerStart(libMapM_gv_mMUnderworldPrepTimer, 1.0, false, c_timeGame);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldDebugStart_Init () {
    libMapM_gt_MMUnderworldDebugStart = TriggerCreate("libMapM_gt_MMUnderworldDebugStart_Func");
    TriggerEnable(libMapM_gt_MMUnderworldDebugStart, false);
    TriggerAddEventChatMessage(libMapM_gt_MMUnderworldDebugStart, c_playerAny, "-us", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Debug Start 1
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldDebugStart1_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {
            return false;
        }
    }

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

    TriggerEnable(TriggerGetCurrent(), false);
    libMapM_gf_MMUnderworldPrepare();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldDebugStart1_Init () {
    libMapM_gt_MMUnderworldDebugStart1 = TriggerCreate("libMapM_gt_MMUnderworldDebugStart1_Func");
    TriggerEnable(libMapM_gt_MMUnderworldDebugStart1, false);
    TriggerAddEventChatMessage(libMapM_gt_MMUnderworldDebugStart1, c_playerAny, "-uss", true);
    TriggerAddEventChatMessage(libMapM_gt_MMUnderworldDebugStart1, c_playerAny, "EVENTSTART", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Debug Underworld Clear
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldDebugUnderworldClear_Func (bool testConds, bool runActions) {
    int autoC0DA8949_ae;
    int autoC0DA8949_ai;

    // Variable Declarations
    int lv_itGroupIndex;
    int lv_team;

    // Variable Initialization

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

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

    autoC0DA8949_ae = libMapM_gv_mMUnderworldMinionGroupCount;
    autoC0DA8949_ai = 1;
    lv_itGroupIndex = 1;
    for ( ; ( (autoC0DA8949_ai >= 0 && lv_itGroupIndex <= autoC0DA8949_ae) || (autoC0DA8949_ai <= 0 && lv_itGroupIndex >= autoC0DA8949_ae) ) ; lv_itGroupIndex += autoC0DA8949_ai ) {
        UnitGroupLoopBegin(libMapM_gv_mMUnderworldMinionGroups[lv_itGroupIndex].lv_units);
        for ( ; !UnitGroupLoopDone() ; UnitGroupLoopStep() ) {
            PingDestroy(libCore_gf_PingStoredForUnit(UnitGroupLoopCurrent(), 1));
            UnitRemove(UnitGroupLoopCurrent());
        }
        UnitGroupLoopEnd();
        UnitRemove(libMapM_gv_mMUnderworldBoss);
        PingDestroy(libCore_gf_PingStoredForUnit(libMapM_gv_mMUnderworldBoss, 1));
    }
    lv_team = libGame_gf_TeamNumberOfPlayer(EventPlayer());
    if (((lv_team < 1) || (lv_team > 2))) {
        lv_team = 1;
    }
    else {
    }
    libMapM_gv_mMUnderworldSkullCollected[lv_team] = StringToInt(StringWord(EventChatMessage(false), 2));
    libMapM_gv_mMUnderworldSkullCollected[(3 - lv_team)] = (libMapM_gv_mMUnderworldSkullTotal - libMapM_gv_mMUnderworldSkullCollected[lv_team]);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldDebugUnderworldClear_Init () {
    libMapM_gt_MMUnderworldDebugUnderworldClear = TriggerCreate("libMapM_gt_MMUnderworldDebugUnderworldClear_Func");
    TriggerEnable(libMapM_gt_MMUnderworldDebugUnderworldClear, false);
    TriggerAddEventChatMessage(libMapM_gt_MMUnderworldDebugUnderworldClear, c_playerAny, "MINECLEAR", false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Debug Summon Boss Scaling
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldDebugSummonBossScaling_Func (bool testConds, bool runActions) {
    int auto68B48C87_ae;
    int auto68B48C87_ai;

    // Variable Declarations
    int lv_indexMin;

    // Variable Initialization

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

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

    libMapM_gv_mMUnderworldSummonedBoss[1] = UnitGroupUnit(UnitGroupSelected(1), 1);
    libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_hPFlat = 0;
    libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_hPPercent = 0;
    libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damageFlat = 0;
    libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damagePercent = 0;
    libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_xP = 0.0;
    auto68B48C87_ae = StringToInt(StringWord(EventChatMessage(false), 2));
    auto68B48C87_ai = 1;
    lv_indexMin = 1;
    for ( ; ( (auto68B48C87_ai >= 0 && lv_indexMin <= auto68B48C87_ae) || (auto68B48C87_ai <= 0 && lv_indexMin >= auto68B48C87_ae) ) ; lv_indexMin += auto68B48C87_ai ) {
        libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_hPFlat = (libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_hPFlat + libMapM_gv_mMUnderworldSummonedBossScalingChanges[lv_indexMin].lv_hPFlat);
        libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_hPPercent = (libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_hPPercent + libMapM_gv_mMUnderworldSummonedBossScalingChanges[lv_indexMin].lv_hPPercent);
        libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damageFlat = (libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damageFlat + libMapM_gv_mMUnderworldSummonedBossScalingChanges[lv_indexMin].lv_damageFlat);
        libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damagePercent = (libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_damagePercent + libMapM_gv_mMUnderworldSummonedBossScalingChanges[lv_indexMin].lv_damagePercent);
        libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_xP = (libMapM_gv_mMUnderworldSummonedBossScalingCurrent.lv_xP + libMapM_gv_mMUnderworldSummonedBossScalingChanges[lv_indexMin].lv_xP);
    }
    libMapM_gv_mMUnderworldSkullCollected[1] = StringToInt(StringWord(EventChatMessage(false), 3));
    libMapM_gv_mMUnderworldSkullCollected[2] = (100 - libMapM_gv_mMUnderworldSkullCollected[1]);
    libMapM_gf_MMUnderworldApplySummonedBossScaling(1, true);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldDebugSummonBossScaling_Init () {
    libMapM_gt_MMUnderworldDebugSummonBossScaling = TriggerCreate("libMapM_gt_MMUnderworldDebugSummonBossScaling_Func");
    TriggerEnable(libMapM_gt_MMUnderworldDebugSummonBossScaling, false);
    TriggerAddEventChatMessage(libMapM_gt_MMUnderworldDebugSummonBossScaling, c_playerAny, "-ubs", false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM Underworld Debug Push Effect
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMUnderworldDebugPushEffect_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {
            return false;
        }
    }

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

    PlayerCreateEffectPoint(1, "GolemSpawnKnockbackSearch", CameraGetTarget(1));
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMUnderworldDebugPushEffect_Init () {
    libMapM_gt_MMUnderworldDebugPushEffect = TriggerCreate("libMapM_gt_MMUnderworldDebugPushEffect_Func");
    TriggerEnable(libMapM_gt_MMUnderworldDebugPushEffect, false);
    TriggerAddEventChatMessage(libMapM_gt_MMUnderworldDebugPushEffect, c_playerAny, "-pe", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: MM HoC Forest - Ancient Dies
//--------------------------------------------------------------------------------------------------
bool libMapM_gt_MMHoCForestAncientDies_Func (bool testConds, bool runActions) {
    // Conditions
    if (testConds) {
        if (!(((UnitGroupHasUnit(libMapM_gv_mMHoCForestActiveAncients, EventUnit()) == true) && (UnitGroupCount(libMapM_gv_mMHoCForestActiveAncients, c_unitCountAlive) == 0)))) {
            return false;
        }
    }

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

    TriggerEnable(TriggerGetCurrent(), false);
    libMapM_gf_MMHoCForestRegrowth();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libMapM_gt_MMHoCForestAncientDies_Init () {
    libMapM_gt_MMHoCForestAncientDies = TriggerCreate("libMapM_gt_MMHoCForestAncientDies_Func");
    TriggerEnable(libMapM_gt_MMHoCForestAncientDies, false);
    TriggerAddEventUnitDied(libMapM_gt_MMHoCForestAncientDies, null);
}

void libMapM_InitTriggers () {
    libMapM_gt_IncludeMapMechanics_Init();
    libMapM_gt_DataJungleCampDefenderData_Init();
    libMapM_gt_DataJungleCampDefenderSiegeGiants_Init();
    libMapM_gt_DataJungleCampDefenderKnights_Init();
    libMapM_gt_DataJungleCampDefenderGraveGolem_Init();
    libMapM_gt_DataJungleCampDefenderDoubloons_Init();
    libMapM_gt_DataJungleCampMercData_Init();
    libMapM_gt_DataJungleCampMercSiegeGiants_Init();
    libMapM_gt_DataJungleCampMercOgres_Init();
    libMapM_gt_DataJungleCampMercGraveGolem_Init();
    libMapM_gt_InitializeJungleCamps_Init();
    libMapM_gt_JungleTurnOnCreepCamps_Init();
    libMapM_gt_JungleCreepCampRespawnTimerExpires_Init();
    libMapM_gt_JungleRespawnTimerTextTagCountdown_Init();
    libMapM_gt_JungleScalingTimerExpires_Init();
    libMapM_gt_JungleDefendersBeginFighting_Init();
    libMapM_gt_JungleDefendersEndFighting_Init();
    libMapM_gt_JungleAllDefendersKilled_Init();
    libMapM_gt_JungleHibernateCampsStart_Init();
    libMapM_gt_JungleHibernateCampsEnd_Init();
    libMapM_gt_JungleCampOwnershipChange_Init();
    libMapM_gt_JungleOgreKingDies_Init();
    libMapM_gt_JungleMercLeaderDies_Init();
    libMapM_gt_JungleMercOgreShieldUsedOgre_Init();
    libMapM_gt_JungleMercOgreShieldUsedHero_Init();
    libMapM_gt_InitializeMapMechanics_Init();
    libMapM_gt_MMHelpbuttonClicked_Init();
    libMapM_gt_MMIntroSkippable_Init();
    libMapM_gt_MMRavenCurseGateOpen_Init();
    libMapM_gt_MMRavenStartSpawning_Init();
    libMapM_gt_MMRavenSpawnTribute_Init();
    libMapM_gt_MMRavenTributeCollectStarted_Init();
    libMapM_gt_MMRavenTributeCollectCanceled_Init();
    libMapM_gt_MMRavenTributeCollectInterrupted_Init();
    libMapM_gt_MMRavenTributeObtained_Init();
    libMapM_gt_MMRavenCurseStartLightTransition_Init();
    libMapM_gt_MMRavenCurseFinished_Init();
    libMapM_gt_MMRavenObjectiveUIHandler_Init();
    libMapM_gt_MMRavenDebugStartElunees_Init();
    libMapM_gt_MMRavenDebugStartNexten_Init();
    libMapM_gt_MMRavenDebugStartCurseec_Init();
    libMapM_gt_MMCannonballsHeroSpawned_Init();
    libMapM_gt_MMCannonballsHeroMapMechanicStatusSetup_Init();
    libMapM_gt_MMCannonballsHeroDies_Init();
    libMapM_gt_MMCannonballsHeroRespawns_Init();
    libMapM_gt_MMCannonballsDetectHero_Init();
    libMapM_gt_MMCannonballsGatesAreOpenComplete_Init();
    libMapM_gt_MMCannonballsCampSpawned_Init();
    libMapM_gt_MMCannonballsEventStart_Init();
    libMapM_gt_MMCannonballsHeroPickup_Init();
    libMapM_gt_MMCannonballsBallsHandedIn_Init();
    libMapM_gt_MMCannonballsObjectiveUIHandler_Init();
    libMapM_gt_MMCannonballsDoubloonCreated_Init();
    libMapM_gt_MMCannonballsOpenChestUponRespawn_Init();
    libMapM_gt_MMCannonballsBattleshipShootingMissileCreated_Init();
    libMapM_gt_MMCannonballsBattleshipKilledATown_Init();
    libMapM_gt_MMCannonballsTreasureSpawnChests_Init();
    libMapM_gt_MMCannonballsTreasureChestSpawnsDoubloon_Init();
    libMapM_gt_MMCannonballsTreasureChestPingTimerExpires_Init();
    libMapM_gt_MMCannonballsTreasureAChestDies_Init();
    libMapM_gt_MMCannonballsTreasureChestsAreDead_Init();
    libMapM_gt_MMCannonballsTreasureChestAttacked_Init();
    libMapM_gt_MMCannonballsShootingStart_Init();
    libMapM_gt_MMCannonballsShootingEnd_Init();
    libMapM_gt_MMCannonballsDebugEventStart_Init();
    libMapM_gt_MMCannonballsDebugModify_Init();
    libMapM_gt_MMGardensDragonGateOpen_Init();
    libMapM_gt_MMGardensDragonWarningTimerStart_Init();
    libMapM_gt_MMGardensDragonWarningTimerExpires_Init();
    libMapM_gt_MMGardensDragonDragonEventStarts_Init();
    libMapM_gt_MMGardensDragonDragonEventEnds_Init();
    libMapM_gt_MMGardensDragonTurnOnDragonTowersFirstTime_Init();
    libMapM_gt_MMGardensDragonTurnOnDragonTowersAgain_Init();
    libMapM_gt_MMGardensDragonDragonTowerChangeOwnershipEventFires_Init();
    libMapM_gt_MMGardensDragonDragonTowerCheckObeliskStatus_Init();
    libMapM_gt_MMGardensDragonTransformChannelFinish_Init();
    libMapM_gt_MMGardensDragonTakeDragonReminderTimerExpires_Init();
    libMapM_gt_MMGardensDragonMercCampHibernatorDetectorLeashed_Init();
    libMapM_gt_MMGardensDragonMercCampHibernatorDetectorSpawned_Init();
    libMapM_gt_MMGardensDragonDragonKnightDiesorExpires_Init();
    libMapM_gt_MMGardensDragonObjectiveUIHandler_Init();
    libMapM_gt_MMGardensDragonDebugCheatStartObelisksso_Init();
    libMapM_gt_MMUnderworldStartToEnterGates_Init();
    libMapM_gt_MMUnderworldEnteringGates_Init();
    libMapM_gt_MMUnderworldCameraPanned_Init();
    libMapM_gt_MMUnderworldPlayerHeroLocationTracking_Init();
    libMapM_gt_MMUnderworldGroundHoleVision_Init();
    libMapM_gt_MMUnderworldPlayerMovesCamera_Init();
    libMapM_gt_MMUnderworldUntargetableAcrossPlane_Init();
    libMapM_gt_MMUnderworldMinionDies_Init();
    libMapM_gt_MMUnderworldSkullDropped_Init();
    libMapM_gt_MMUnderworldSkullPickup_Init();
    libMapM_gt_MMUnderworldScaling_Init();
    libMapM_gt_MMUnderworldSummonedBossPingVisibility_Init();
    libMapM_gt_MMUnderworldSummonedBossesDied_Init();
    libMapM_gt_MMUnderworldOpenGatesTimerStarted_Init();
    libMapM_gt_MMUnderworldGatesOpened_Init();
    libMapM_gt_MMUnderworldUnderworldOpened_Init();
    libMapM_gt_MMUnderworldGatesPingHelper_Init();
    libMapM_gt_MMUnderworldCleared_Init();
    libMapM_gt_MMUnderworldObjectiveUIHandler_Init();
    libMapM_gt_MMUnderworldSummonedBossUIBar_Init();
    libMapM_gt_MMUnderworldDebugStart_Init();
    libMapM_gt_MMUnderworldDebugStart1_Init();
    libMapM_gt_MMUnderworldDebugUnderworldClear_Init();
    libMapM_gt_MMUnderworldDebugSummonBossScaling_Init();
    libMapM_gt_MMUnderworldDebugPushEffect_Init();
    libMapM_gt_MMHoCForestAncientDies_Init();
}

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

void libMapM_InitLib () {
    if (libMapM_InitLib_completed) {
        return;
    }

    libMapM_InitLib_completed = true;

    libMapM_InitLibraries();
    libMapM_InitVariables();
    libMapM_InitTriggers();
}

include "TriggerLibs/HeroesLib"
include "TriggerLibs/GameLib"
include "TriggerLibs/AILib"
include "TriggerLibs/UILib"
include "TriggerLibs/StartingExperienceLib"
include "TriggerLibs/GameDataHelperLib"
include "TriggerLibs/SupportLib"

