mods/heroesmapmods/battlegroundmapmods/gardenofterror.stormmod/base.stormdata/libgrdn.galaxy

libgrdn.galaxy
include "TriggerLibs/NativeLib"
include "TriggerLibs/HeroesLib"
include "TriggerLibs/GameLib"
include "TriggerLibs/MapMechanicsLib"
include "TriggerLibs/AILib"
include "TriggerLibs/UILib"
include "TriggerLibs/SoundLib"

include "LibGRDN_h"

//--------------------------------------------------------------------------------------------------
// Library: Garden of Terror
//--------------------------------------------------------------------------------------------------
// External Library Initialization
void libGRDN_InitLibraries () {
    libNtve_InitVariables();
    libCore_InitVariables();
    libGame_InitVariables();
    libMapM_InitVariables();
    libAIAI_InitVariables();
    libUIUI_InitVariables();
    libSond_InitVariables();
}

// Variable Initialization
bool libGRDN_InitVariables_completed = false;

void libGRDN_InitVariables () {
    int init_i;
    int init_i1;

    if (libGRDN_InitVariables_completed) {
        return;
    }

    libGRDN_InitVariables_completed = true;

    libGRDN_gv_eventPreviewTimer = TimerCreate();
    libGRDN_gv_eventWarningTimer = TimerCreate();
    libGRDN_gv_eventStartTimer = TimerCreate();
    libGRDN_gv_terrorSpawnTimer = TimerCreate();
    for (init_i = 0; init_i <= libGRDN_gv_seedSpawnLocationCount_C; init_i += 1) {
        libGRDN_gv_seedSpawns[init_i].lv_topBottomHemisphere = c_alignTop;
        libGRDN_gv_seedSpawns[init_i].lv_favoredTeam = libCore_gv_cOMPUTER_Neutral;
    }
    libGRDN_gv_seedDefenders = UnitGroupEmpty();
    libGRDN_gv_gardenUI.lv_eventWarningFrame = c_invalidDialogControlId;
    libGRDN_gv_gardenUI.lv_eventWarningTextLabel = c_invalidDialogControlId;
    libGRDN_gv_gardenUI.lv_eventWarningTimerLabel = c_invalidDialogControlId;
    libGRDN_gv_gardenUI.lv_gatherTheSeedsFrame = c_invalidDialogControlId;
    libGRDN_gv_gardenUI.lv_gardenTerrorHealthFrame = c_invalidDialogControlId;
    for (init_i1 = 0; init_i1 <= libGRDN_gv_laneCount_C; init_i1 += 1) {
        libGRDN_gv_gardenUI.lv_gardenTerrorHealthStatuses[init_i1] = c_invalidDialogControlId;
    }
    libGRDN_gv_gardenUI.lv_gardenTerrorHealthIconBlue = c_invalidDialogControlId;
    libGRDN_gv_gardenUI.lv_gardenTerrorHealthIconRed = c_invalidDialogControlId;
}

// Functions
void libGRDN_gf_InitializeSeedLocation (int lp_locationIndex, point lp_spawnPoint, int lp_hemisphere, int lp_favoredTeam, doodad lp_doodad1, doodad lp_doodad2, doodad lp_doodad3, doodad lp_doodad4, doodad lp_doodad5, doodad lp_doodad6, unit lp_sconce) {
    // Automatic Variable Declarations
    // Implementation
    libGRDN_gv_seedSpawns[lp_locationIndex].lv_point = lp_spawnPoint;
    libGRDN_gv_seedSpawns[lp_locationIndex].lv_topBottomHemisphere = lp_hemisphere;
    libGRDN_gv_seedSpawns[lp_locationIndex].lv_favoredTeam = lp_favoredTeam;
    libGRDN_gv_seedSpawns[lp_locationIndex].lv_steppingStones[1] = ActorFromDoodad(lp_doodad1);
    libGRDN_gv_seedSpawns[lp_locationIndex].lv_steppingStones[2] = ActorFromDoodad(lp_doodad2);
    libGRDN_gv_seedSpawns[lp_locationIndex].lv_steppingStones[3] = ActorFromDoodad(lp_doodad3);
    libGRDN_gv_seedSpawns[lp_locationIndex].lv_steppingStones[4] = ActorFromDoodad(lp_doodad4);
    libGRDN_gv_seedSpawns[lp_locationIndex].lv_steppingStones[5] = ActorFromDoodad(lp_doodad5);
    libGRDN_gv_seedSpawns[lp_locationIndex].lv_steppingStones[6] = ActorFromDoodad(lp_doodad6);
    libGRDN_gv_seedSpawns[lp_locationIndex].lv_lootBannerSconce = lp_sconce;
}

fixed libGRDN_gf_RandomCursedPacingSeedSpawnDelay () {
    // Variable Declarations
    fixed lv_difference;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_difference = (libGRDN_gv_delayBetweenSeedsMax_C - libGRDN_gv_delayBetweenSeedsMin_C);

    // Implementation
    return (libGRDN_gv_delayBetweenSeedsMin_C + RandomFixed(0.0, lv_difference));
}

int libGRDN_gf_SeedLocationIndex (unit lp_seed) {
    // Variable Declarations
    int lv_location;

    // Automatic Variable Declarations
    const int auto00082E49_ae = libGRDN_gv_seedSpawnLocationCount_C;
    const int auto00082E49_ai = 1;

    // Variable Initialization

    // Implementation
    lv_location = 1;
    for ( ; ( (auto00082E49_ai >= 0 && lv_location <= auto00082E49_ae) || (auto00082E49_ai < 0 && lv_location >= auto00082E49_ae) ) ; lv_location += auto00082E49_ai ) {
        if ((libGRDN_gv_seedSpawns[lv_location].lv_seedUnit == lp_seed)) {
            return lv_location;
        }

    }
    return 0;
}

int libGRDN_gf_GetNextSeedSpawnLocation () {
    // Variable Declarations
    int lv_candidate;
    int lv_candidateCount;
    int[libGRDN_gv_seedSpawnLocationCount_C + 1] lv_candidateLocations;
    int lv_selectedLocation;

    // Automatic Variable Declarations
    const int autoA00D383C_ae = libGRDN_gv_seedSpawnLocationCount_C;
    const int autoA00D383C_ai = 1;

    // Variable Initialization

    // Implementation
    lv_candidate = 1;
    for ( ; ( (autoA00D383C_ai >= 0 && lv_candidate <= autoA00D383C_ae) || (autoA00D383C_ai < 0 && lv_candidate >= autoA00D383C_ae) ) ; lv_candidate += autoA00D383C_ai ) {
        if (((lv_candidate == libGRDN_gv_currentSeedSpawnLocation) || (lv_candidate == libGRDN_gv_recentSeedLocations[1]) || (lv_candidate == libGRDN_gv_recentSeedLocations[2]))) {
            continue;
        }

        if ((libGRDN_gv_seedSpawns[lv_candidate].lv_favoredTeam == libGRDN_gv_seedSpawns[libGRDN_gv_currentSeedSpawnLocation].lv_favoredTeam)) {
            continue;
        }

        if ((libGRDN_gv_seedSpawns[lv_candidate].lv_topBottomHemisphere == libGRDN_gv_seedSpawns[libGRDN_gv_currentSeedSpawnLocation].lv_topBottomHemisphere) && (libGRDN_gv_seedSpawns[lv_candidate].lv_topBottomHemisphere == libGRDN_gv_seedSpawns[libGRDN_gv_recentSeedLocations[1]].lv_topBottomHemisphere)) {
            continue;
        }

        lv_candidateCount += 1;
        lv_candidateLocations[lv_candidateCount] = lv_candidate;
    }
    return lv_candidateLocations[RandomInt(1, lv_candidateCount)];
}

trigger auto_libGRDN_gf_SpawnSeedatLocation_Trigger = null;
int auto_libGRDN_gf_SpawnSeedatLocation_lp_location;

void libGRDN_gf_SpawnSeedatLocation (int lp_location) {
    auto_libGRDN_gf_SpawnSeedatLocation_lp_location = lp_location;

    if (auto_libGRDN_gf_SpawnSeedatLocation_Trigger == null) {
        auto_libGRDN_gf_SpawnSeedatLocation_Trigger = TriggerCreate("auto_libGRDN_gf_SpawnSeedatLocation_TriggerFunc");
    }

    TriggerExecute(auto_libGRDN_gf_SpawnSeedatLocation_Trigger, false, false);
}

bool auto_libGRDN_gf_SpawnSeedatLocation_TriggerFunc (bool testConds, bool runActions) {
    int lp_location = auto_libGRDN_gf_SpawnSeedatLocation_lp_location;

    // Variable Declarations
    fixed lv_defenderRotationOffset;
    fixed lv_defenderRotationOffsetPerDefender_C;
    const fixed lv_defenderDistanceOffset_C = 2.0;
    int lv_defenderIndex;

    // Automatic Variable Declarations
    const int autoF47D4613_ae = libGRDN_gv_seedDefenderCount_C;
    const int autoF47D4613_ai = 1;

    // Variable Initialization
    lv_defenderRotationOffset = libNtve_gf_RandomAngle();
    lv_defenderRotationOffsetPerDefender_C = (360.0 / libGRDN_gv_seedDefenderCount_C);

    // Implementation
    libNtve_gf_SendActorMessageToUnit(libGRDN_gv_seedSpawns[lp_location].lv_previewUnit, "Signal StartSwirl");
    libNtve_gf_SendActorMessageToUnit(libGRDN_gv_seedSpawns[lp_location].lv_previewUnit, "Create RavenCurseTributeSpawnSound");
    libGRDN_gf_PingUnitUntilitsDead(libGRDN_gv_seedSpawns[lp_location].lv_previewUnit, true);
    AddUnitOfInterest(libGRDN_gv_seedSpawns[lp_location].lv_previewUnit, 10.0, libGRDN_gv_seedSpawnTime_C, "SetUpAroundSeedPreview", libNtve_ge_GoalTeam_Both, 0);
    libGRDN_gf_ShowSeedWarningSlideoutwithTimer(libGRDN_gv_seedSpawnTime_C);
    libNtve_gf_CreateActorAtPoint("UI_Game_Ping_GardenOfTerror_EventWarning", libGRDN_gv_seedSpawns[lp_location].lv_point);
    if ((libGRDN_gv_firstSeedEventWarningPlayed == false)) {
        SoundtrackStop(PlayerGroupAll(), c_soundtrackCategoryMusic, true);
        libSond_gf_SoundtrackApplyNewDefaultSoundtrackForPlayerGroup("MX_GardenOfTerror_EventWarning", PlayerGroupAll());
    }

    Wait(libGRDN_gv_seedSpawnTime_C, c_timeGame);
    libGRDN_gf_ShowHideObjectivePreviewatLocation(false, lp_location);
    if ((libGRDN_gv_firstSeedEventWarningPlayed == false)) {
        SoundtrackStop(PlayerGroupAll(), c_soundtrackCategoryMusic, true);
        libSond_gf_SoundtrackPlayMapSoundtrackAsDefaultSoundtrackForAllPlayers();
        libGRDN_gv_firstSeedEventWarningPlayed = true;
    }

    libNtve_gf_CreateUnitsWithDefaultFacing(1, "Seed", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Neutral, libGRDN_gv_seedSpawns[lp_location].lv_point, null);
    libGRDN_gv_seedSpawns[lp_location].lv_seedUnit = UnitLastCreated();
    libGRDN_gf_PingUnitUntilitsDead(UnitLastCreated(), false);
    ActorCreate(ActorScopeFromUnit(UnitLastCreated()), "UI_Game_Ping_Tribute_Ready", null, null, null);
    libNtve_gf_CreateActorAtPoint("UI_Game_Ping_GardenOfTerror_Seed_Spawned", libGRDN_gv_seedSpawns[lp_location].lv_point);
    lv_defenderIndex = 1;
    for ( ; ( (autoF47D4613_ai >= 0 && lv_defenderIndex <= autoF47D4613_ae) || (autoF47D4613_ai < 0 && lv_defenderIndex >= autoF47D4613_ae) ) ; lv_defenderIndex += autoF47D4613_ai ) {
        libGRDN_gf_SpawnSeedDefender(PointWithOffsetPolar(libGRDN_gv_seedSpawns[libGRDN_gv_currentSeedSpawnLocation].lv_point, lv_defenderDistanceOffset_C, ((lv_defenderRotationOffsetPerDefender_C * lv_defenderIndex) + lv_defenderRotationOffset)));
    }
    libNtve_gf_ShareVisionofUnit(libGRDN_gv_seedSpawns[lp_location].lv_seedUnit, true, libCore_gv_cOMPUTER_TeamOrder);
    libNtve_gf_ShareVisionofUnit(libGRDN_gv_seedSpawns[lp_location].lv_seedUnit, true, libCore_gv_cOMPUTER_TeamChaos);
    AddUnitOfInterest(libGRDN_gv_seedSpawns[lp_location].lv_seedUnit, 10.0, 0.0, "GatherSeed", libNtve_ge_GoalTeam_Both, 0);
    libUIUI_gf_AttachHelpButtonToUnit(libGRDN_gv_seedSpawns[lp_location].lv_seedUnit, libMapM_gt_MMHelpbuttonClicked, StringExternal("Param/Value/lib_GRDN_FD8A033E"), 110, 50);
    libGRDN_gf_ShowHideGathertheSeedsSlideout(true);
    return true;
}

trigger auto_libGRDN_gf_SpawnSeedDefender_Trigger = null;
point auto_libGRDN_gf_SpawnSeedDefender_lp_spawnPoint;

void libGRDN_gf_SpawnSeedDefender (point lp_spawnPoint) {
    auto_libGRDN_gf_SpawnSeedDefender_lp_spawnPoint = lp_spawnPoint;

    if (auto_libGRDN_gf_SpawnSeedDefender_Trigger == null) {
        auto_libGRDN_gf_SpawnSeedDefender_Trigger = TriggerCreate("auto_libGRDN_gf_SpawnSeedDefender_TriggerFunc");
    }

    TriggerExecute(auto_libGRDN_gf_SpawnSeedDefender_Trigger, false, false);
}

bool auto_libGRDN_gf_SpawnSeedDefender_TriggerFunc (bool testConds, bool runActions) {
    point lp_spawnPoint = auto_libGRDN_gf_SpawnSeedDefender_lp_spawnPoint;

    // Variable Declarations
    region lv_aggroRegion;
    region lv_leashRegion;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_aggroRegion = RegionCircle(UnitGetPosition(libGRDN_gv_seedSpawns[libGRDN_gv_currentSeedSpawnLocation].lv_seedUnit), 6.0);
    lv_leashRegion = RegionCircle(UnitGetPosition(libGRDN_gv_seedSpawns[libGRDN_gv_currentSeedSpawnLocation].lv_seedUnit), 10.0);

    // Implementation
    libNtve_gf_CreateUnitsWithDefaultFacing(1, "Shambler", 0, libCore_gv_cOMPUTER_Hostile, lp_spawnPoint, null);
    UnitGroupAdd(libGRDN_gv_seedDefenders, UnitLastCreated());
    libGame_gf_UpdateScalingForUnit(UnitLastCreated(), libGame_gv_scalingTicks, 0);
    libAIAI_gf_StartDefenderAI(false, libNtve_gf_ConvertUnitToUnitGroup(UnitLastCreated()), lv_leashRegion, lv_aggroRegion, true);
    return true;
}

void libGRDN_gf_EndSeedPhase (int lp_winningTeam) {
    // Automatic Variable Declarations
    // Implementation
    libMapM_gf_JungleStartHibernateCamps();
    libGRDN_gf_ShowHideGathertheSeedsSlideout(false);
    libGRDN_gf_ShowSeedUIActiveLabel(lp_winningTeam);
    libGRDN_gf_RunNightfallEnvironmentEffects();
    libGRDN_gf_SpawnGardenTerrors();
}

point libGRDN_gf_GardenTerrorUnburrowPoint (int lp_lane, int lp_team) {
    // Variable Declarations
    const fixed lv_additionalStructureOffset_C = 3.0;
    point lv_furthestMinionPos;
    fixed lv_furthestMinionPosX;
    point lv_furthestStructurePos;
    fixed lv_furthestStructurePosX;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_furthestMinionPos = AILaneGetFrontMostWaveUnitPosition(lp_lane, lp_team, true, false, false, false);
    lv_furthestMinionPosX = PointGetX(lv_furthestMinionPos);
    lv_furthestStructurePos = AILaneGetFrontMostStructurePosition(lp_lane, lp_team, true, true, true, true, true, true);
    lv_furthestStructurePosX = PointGetX(lv_furthestStructurePos);

    // Implementation
    if ((lp_team == libGame_gv_teamOrderIndex_C)) {
        if ((lv_furthestMinionPosX > lv_furthestStructurePosX)) {
            return lv_furthestMinionPos;
        }
        else {
            return PointWithOffset(lv_furthestStructurePos, lv_additionalStructureOffset_C, 0.0);
        }
    }
    else {
        if ((lv_furthestMinionPosX > lv_furthestStructurePosX)) {
            return PointWithOffset(lv_furthestStructurePos, (lv_additionalStructureOffset_C * -1.0), 0.0);
        }
        else {
            return lv_furthestMinionPos;
        }
    }
}

void libGRDN_gf_SpawnGardenTerrors () {
    // Variable Declarations
    int lv_lane;
    int lv_winningTeam;

    // Automatic Variable Declarations
    const int autoB967247D_ae = libGRDN_gv_laneCount_C;
    const int autoB967247D_ai = 1;

    // Variable Initialization

    // Implementation
    if ((libGRDN_gv_seedsCollected[libGame_gv_teamOrderIndex_C] > libGRDN_gv_seedsCollected[libGame_gv_teamChaosIndex_C])) {
        lv_winningTeam = libGame_gv_teamOrderIndex_C;
    }
    else {
        lv_winningTeam = libGame_gv_teamChaosIndex_C;
    }
    PlayerCreateEffectPoint(libGame_gf_ComputerPlayerInTeam(lv_winningTeam), "GardenTerrorSpawnExplosionDummy", libGRDN_gv_seedSpawns[libGRDN_gv_currentSeedSpawnLocation].lv_point);
    lv_lane = 1;
    for ( ; ( (autoB967247D_ai >= 0 && lv_lane <= autoB967247D_ae) || (autoB967247D_ai < 0 && lv_lane >= autoB967247D_ae) ) ; lv_lane += autoB967247D_ai ) {
        libNtve_gf_CreateUnitsWithDefaultFacing(1, "GardenTerror", c_unitCreateIgnorePlacement, libGame_gf_ComputerPlayerInTeam(lv_winningTeam), libGRDN_gv_seedSpawns[libGRDN_gv_currentSeedSpawnLocation].lv_point, null);
        libGRDN_gv_gardenTerrors[lv_lane] = UnitLastCreated();
        libGame_gf_UpdateScalingForUnit(libGRDN_gv_gardenTerrors[lv_lane], libGame_gv_scalingTicks, 0);
        libGRDN_gf_FollowTerrortoLane(UnitLastCreated(), lv_lane);
        AILaneUnitCreated(lv_lane, libGRDN_gv_gardenTerrors[lv_lane], libNtve_ge_LaneUnitType_Wave);
        UnitSetCustomValue(UnitLastCreated(), (libCore_ge_CustomValueIndexes_LaneIndex), lv_lane);
        libCore_gf_CreateMinimapPingStorm(PlayerGroupAll(), "StormAlert", UnitGetPosition(libGRDN_gv_gardenTerrors[lv_lane]), Color(100.00, 100.00, 0.00), 3.0);
        PingSetUnit(PingLastCreated(), libGRDN_gv_gardenTerrors[lv_lane]);
        libNtve_gf_SetDialogItemUnit(libGRDN_gv_gardenUI.lv_gardenTerrorHealthStatuses[lv_lane], UnitLastCreated(), PlayerGroupAll());
    }
    libGRDN_gf_PlayTerrorsSummonedTransmission(lv_winningTeam);
    libGRDN_gf_ShowHideGardenTerrorHealthUI(true, lv_winningTeam);
}

trigger auto_libGRDN_gf_FollowTerrortoLane_Trigger = null;
unit auto_libGRDN_gf_FollowTerrortoLane_lp_terrorUnit;
int auto_libGRDN_gf_FollowTerrortoLane_lp_laneNumber;

void libGRDN_gf_FollowTerrortoLane (unit lp_terrorUnit, int lp_laneNumber) {
    auto_libGRDN_gf_FollowTerrortoLane_lp_terrorUnit = lp_terrorUnit;
    auto_libGRDN_gf_FollowTerrortoLane_lp_laneNumber = lp_laneNumber;

    if (auto_libGRDN_gf_FollowTerrortoLane_Trigger == null) {
        auto_libGRDN_gf_FollowTerrortoLane_Trigger = TriggerCreate("auto_libGRDN_gf_FollowTerrortoLane_TriggerFunc");
    }

    TriggerExecute(auto_libGRDN_gf_FollowTerrortoLane_Trigger, false, false);
}

bool auto_libGRDN_gf_FollowTerrortoLane_TriggerFunc (bool testConds, bool runActions) {
    unit lp_terrorUnit = auto_libGRDN_gf_FollowTerrortoLane_lp_terrorUnit;
    int lp_laneNumber = auto_libGRDN_gf_FollowTerrortoLane_lp_laneNumber;

    // Variable Declarations
    const fixed lv_unburrowCheckInterval_C = 0.125;
    const fixed lv_redirectCheckInterval_C = 1.0;
    const fixed lv_unburrowPointRangeCheck_C = 3.5;
    fixed lv_timeSinceLastRedirect;
    point lv_unburrowPoint;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_timeSinceLastRedirect = lv_redirectCheckInterval_C;

    // Implementation
    while (((lv_unburrowPoint == null) || (DistanceBetweenPoints(UnitGetPosition(lp_terrorUnit), lv_unburrowPoint) > lv_unburrowPointRangeCheck_C))) {
        if ((lv_timeSinceLastRedirect >= lv_redirectCheckInterval_C)) {
            lv_unburrowPoint = libGRDN_gf_GardenTerrorUnburrowPoint(lp_laneNumber, libGame_gf_TeamNumberOfPlayer(UnitGetOwner(lp_terrorUnit)));
            UnitIssueOrder(lp_terrorUnit, OrderTargetingPoint(AbilityCommand("move", 0), lv_unburrowPoint), c_orderQueueReplace);
            lv_timeSinceLastRedirect = 0.0;
        }

        Wait(lv_unburrowCheckInterval_C, c_timeGame);
        lv_timeSinceLastRedirect += lv_unburrowCheckInterval_C;
    }
    UnitCreateEffectUnit(lp_terrorUnit, "GardenTerrorBurrowEnemyFoundSet", lp_terrorUnit);
    return true;
}

void libGRDN_gf_EndTerrorPhase (int lp_terrorOwningTeam) {
    // Variable Declarations
    int lv_locationIndex;

    // Automatic Variable Declarations
    // Variable Initialization

    // Implementation
    libGRDN_gv_seedsCollected[lp_terrorOwningTeam] = 0;
    libGRDN_gf_ShowSeedUICounterLabel(lp_terrorOwningTeam);
    libGRDN_gf_ShowHideGardenTerrorHealthUI(false, lp_terrorOwningTeam);
    libGRDN_gf_RunDaybreakEnvironmentEffects();
    libMapM_gf_JungleStopHibernateCamps();
    TimerStart(libGRDN_gv_eventWarningTimer, (libGRDN_gf_RandomCursedPacingSeedSpawnDelay() + libGRDN_gv_extraDelayAfterEvent_C), false, c_timeGame);
    TimerStart(libGRDN_gv_eventPreviewTimer, libGRDN_gv_longPreviewDelay_C, false, c_timeGame);
    libGRDN_gf_PlayTerrorsDefeatedTransmission(lp_terrorOwningTeam);
}

trigger auto_libGRDN_gf_RunNightfallEnvironmentEffects_Trigger = null;

void libGRDN_gf_RunNightfallEnvironmentEffects () {
    if (auto_libGRDN_gf_RunNightfallEnvironmentEffects_Trigger == null) {
        auto_libGRDN_gf_RunNightfallEnvironmentEffects_Trigger = TriggerCreate("auto_libGRDN_gf_RunNightfallEnvironmentEffects_TriggerFunc");
    }

    TriggerExecute(auto_libGRDN_gf_RunNightfallEnvironmentEffects_Trigger, false, false);
}

bool auto_libGRDN_gf_RunNightfallEnvironmentEffects_TriggerFunc (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_team;
    int lv_itPlayer;

    // Automatic Variable Declarations
    const int auto7B8A06BE_ae = libCore_gv_bALMaxPlayers;
    const int auto7B8A06BE_ai = 1;

    // Variable Initialization

    // Implementation
    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal MM1On");
    libCore_gf_DataAnnouncerVOSetDefaultAnnouncerForPlayerGroup(PlayerGroupAll(), "GardensNightAnnouncer");
    libGame_gf_SpecialLightingEventStart("StormGardenofTerrorNight", PlayerGroupAll(), 2.0);
    libGame_gf_SpecialLightingEventEnd("StormGardenofTerrorTransition", PlayerGroupAll(), 0.0);
    if ((libGRDN_gv_seedsCollected[libGame_gv_teamOrderIndex_C] > libGRDN_gv_seedsCollected[libGame_gv_teamChaosIndex_C])) {
        ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal RainRight");
    }
    else {
        ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal RainLeft");
    }
    libCore_gv_mAPMapSoundtrack[1] = "MX_GardenOfTerror_Night_LVL_1";
    libCore_gv_mAPMapSoundtrack[2] = "MX_GardenOfTerror_Night_LVL_10";
    libCore_gv_mAPMapSoundtrack[3] = "MX_GardenOfTerror_Night_LVL_20";
    SoundtrackStop(PlayerGroupAll(), c_soundtrackCategoryMusic, true);
    libSond_gf_SoundtrackPlayMapSoundtrackAsDefaultSoundtrackForAllPlayers();
    SoundtrackPlay(PlayerGroupAll(), c_soundtrackCategoryAmbience, "Amb_2D_GardenOfTerror_Night", c_soundtrackCueAny, c_soundtrackIndexAny, true);
    ActorCreate(ActorScopeFromActor(libMapM_gv_mapMechanicControllerActor), "Amb_Group_GardenOfTerror_Day2Night", null, null, null);
    SoundChannelMute(PlayerGroupAll(), c_soundCategoryUser14, false);
    SoundChannelMute(PlayerGroupAll(), c_soundCategorySPieces, true);
    SoundChannelMute(PlayerGroupAll(), c_soundCategoryMessage, true);
    lv_itPlayer = 1;
    for ( ; ( (auto7B8A06BE_ai >= 0 && lv_itPlayer <= auto7B8A06BE_ae) || (auto7B8A06BE_ai < 0 && lv_itPlayer >= auto7B8A06BE_ae) ) ; lv_itPlayer += auto7B8A06BE_ai ) {
        libUIUI_gf_VignetteOverlayPlayForPlayer(lv_itPlayer, "Cutscenes\\GameUI_GlobalVignetteOverlay.StormCutscene");
    }
    libUIUI_gf_VignetteOverlayPlayForPlayer(libCore_gv_oBSERVER_ObserverUIPlayer, "Cutscenes\\GameUI_GlobalVignetteOverlay.StormCutscene");
    return true;
}

void libGRDN_gf_RunDaybreakEnvironmentEffects () {
    // Variable Declarations
    int lv_itTeam;

    // Automatic Variable Declarations
    // Variable Initialization

    // Implementation
    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal MM1Off");
    libCore_gf_DataAnnouncerVOSetDefaultAnnouncerForPlayerGroup(PlayerGroupAll(), "GardensDayAnnouncer");
    libGame_gf_SpecialLightingEventEnd("StormGardenofTerrorNight", PlayerGroupAll(), 2.0);
    libGame_gf_SpecialLightingEventEnd("Storm_RavenCourt_Curse", PlayerGroupAll(), 1.0);
    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal RainOff");
    libUIUI_gf_VignetteOverlayStopForAllPlayersExcludingSpecifiedPlayerGroup(PlayerGroupEmpty());
    SoundChannelMute(PlayerGroupAll(), c_soundCategoryUser14, true);
    SoundChannelMute(PlayerGroupAll(), c_soundCategorySPieces, false);
    SoundChannelMute(PlayerGroupAll(), c_soundCategoryMessage, false);
    libCore_gv_mAPMapSoundtrack[1] = "MX_GardenOfTerror_Day_LVL_1";
    libCore_gv_mAPMapSoundtrack[2] = "MX_GardenOfTerror_Day_LVL_10";
    libCore_gv_mAPMapSoundtrack[3] = "MX_GardenOfTerror_Day_LVL_20";
    libSond_gf_SoundtrackPlayMapSoundtrackAsDefaultSoundtrackForAllPlayers();
    SoundPlayForPlayer(SoundLink("Event_GardenOfTerror_Transition_Night2Day", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);
    SoundtrackPlay(PlayerGroupAll(), c_soundtrackCategoryAmbience, "Amb_2D_GardenOfTerror_Day", c_soundtrackCueAny, c_soundtrackIndexAny, false);
    ActorCreate(ActorScopeFromActor(libMapM_gv_mapMechanicControllerActor), "Amb_Group_GardenOfTerror_Night2Day", null, null, null);
}

void libGRDN_gf_InitializeGardenUI () {
    // Variable Declarations
    int lv_lane;

    // Automatic Variable Declarations
    const int autoD16462B4_ae = libGRDN_gv_laneCount_C;
    const int autoD16462B4_ai = 1;

    // Variable Initialization

    // Implementation
    DialogControlCreateInPanelFromTemplate(libUIUI_gv_mapMechanicsPanel.lv_mainPanel, c_triggerControlTypePanel, "GardenMapMechanic/EventWarningFrame");
    libGRDN_gv_gardenUI.lv_eventWarningFrame = DialogControlLastCreated();
    DialogControlSetObservedType(libGRDN_gv_gardenUI.lv_eventWarningFrame, c_triggerObservedTypeDefaultObservedPlayerId);
    DialogControlSetVisible(libGRDN_gv_gardenUI.lv_eventWarningFrame, PlayerGroupAll(), false);
    DialogControlHookup(libGRDN_gv_gardenUI.lv_eventWarningFrame, c_triggerControlTypeLabel, "TextLabel");
    libGRDN_gv_gardenUI.lv_eventWarningTextLabel = DialogControlLastCreated();
    DialogControlHookup(libGRDN_gv_gardenUI.lv_eventWarningFrame, c_triggerControlTypeLabel, "TimerLabel");
    libGRDN_gv_gardenUI.lv_eventWarningTimerLabel = DialogControlLastCreated();
    DialogControlCreateInPanelFromTemplate(libUIUI_gv_mapMechanicsPanel.lv_mainPanel, c_triggerControlTypePanel, "GardenMapMechanic/GatherTheSeedsFrame");
    libGRDN_gv_gardenUI.lv_gatherTheSeedsFrame = DialogControlLastCreated();
    DialogControlSetObservedType(libGRDN_gv_gardenUI.lv_gatherTheSeedsFrame, c_triggerObservedTypeDefaultObservedPlayerId);
    DialogControlSetVisible(libGRDN_gv_gardenUI.lv_gatherTheSeedsFrame, PlayerGroupAll(), false);
    DialogControlCreateInPanelFromTemplate(libUIUI_gv_mapMechanicsPanel.lv_mainPanel, c_triggerControlTypePanel, "GardenMapMechanic/GardenTerrorHealthFrame");
    libGRDN_gv_gardenUI.lv_gardenTerrorHealthFrame = DialogControlLastCreated();
    DialogControlSetObservedType(libGRDN_gv_gardenUI.lv_gardenTerrorHealthFrame, c_triggerObservedTypeDefaultObservedPlayerId);
    DialogControlSetVisible(libGRDN_gv_gardenUI.lv_gardenTerrorHealthFrame, PlayerGroupAll(), false);
    lv_lane = 1;
    for ( ; ( (autoD16462B4_ai >= 0 && lv_lane <= autoD16462B4_ae) || (autoD16462B4_ai < 0 && lv_lane >= autoD16462B4_ae) ) ; lv_lane += autoD16462B4_ai ) {
        DialogControlHookup(libGRDN_gv_gardenUI.lv_gardenTerrorHealthFrame, c_triggerControlTypeUnitStatus, "MapMechanicStatus/TerrorHealthBarAnchorFrame"+(IntToString(lv_lane))+"/TerrorUnitStatusFrame");
        libGRDN_gv_gardenUI.lv_gardenTerrorHealthStatuses[lv_lane] = DialogControlLastCreated();
    }
    DialogControlHookup(libGRDN_gv_gardenUI.lv_gardenTerrorHealthFrame, c_triggerControlTypeImage, "Icon_Blue");
    libGRDN_gv_gardenUI.lv_gardenTerrorHealthIconBlue = DialogControlLastCreated();
    DialogControlHookup(libGRDN_gv_gardenUI.lv_gardenTerrorHealthFrame, c_triggerControlTypeImage, "Icon_Red");
    libGRDN_gv_gardenUI.lv_gardenTerrorHealthIconRed = DialogControlLastCreated();
}

void libGRDN_gf_UpdateSeedCountUI () {
    // Variable Declarations
    int lv_team;

    // Automatic Variable Declarations
    const int auto1D7BDD7C_ae = libGame_gv_teamChaosIndex_C;
    const int auto1D7BDD7C_ai = 1;

    // Variable Initialization

    // Implementation
    lv_team = libGame_gv_teamOrderIndex_C;
    for ( ; ( (auto1D7BDD7C_ai >= 0 && lv_team <= auto1D7BDD7C_ae) || (auto1D7BDD7C_ai < 0 && lv_team >= auto1D7BDD7C_ae) ) ; lv_team += auto1D7BDD7C_ai ) {
        TextExpressionSetToken("Param/Expression/lib_GRDN_4BF59B6D", "A", IntToText(libGRDN_gv_seedsCollected[lv_team]));
        TextExpressionSetToken("Param/Expression/lib_GRDN_4BF59B6D", "B", IntToText(libGRDN_gv_seedsNeeded_C));
        libNtve_gf_SetDialogItemText(libUIUI_gv_mapMechanicsPanel.lv_gardenOfTerrorSeedsFrameSeedCounterLabel[lv_team], TextExpressionAssemble("Param/Expression/lib_GRDN_4BF59B6D"), PlayerGroupAll());
    }
}

void libGRDN_gf_ShowHideSeedUI (bool lp_toggle) {
    // Automatic Variable Declarations
    // Implementation
    libUIUI_gf_MapMechanicsGardenOfTerrorShowHidePanel(lp_toggle);
}

void libGRDN_gf_ShowHideGardenTerrorHealthUI (bool lp_toggle, int lp_terrorTeam) {
    // Automatic Variable Declarations
    // Implementation
    DialogControlSetVisible(libGRDN_gv_gardenUI.lv_gardenTerrorHealthFrame, PlayerGroupAll(), lp_toggle);
    DialogControlSetVisible(libGRDN_gv_gardenUI.lv_gardenTerrorHealthIconBlue, libGame_gf_PlayersOnTeamHeroes(lp_terrorTeam, false), true);
    DialogControlSetVisible(libGRDN_gv_gardenUI.lv_gardenTerrorHealthIconRed, libGame_gf_PlayersOnTeamHeroes(lp_terrorTeam, false), false);
    DialogControlSetVisible(libGRDN_gv_gardenUI.lv_gardenTerrorHealthIconRed, libGame_gf_PlayersOnTeamHeroes(libGame_gf_EnemyTeam(lp_terrorTeam), false), true);
    DialogControlSetVisible(libGRDN_gv_gardenUI.lv_gardenTerrorHealthIconBlue, libGame_gf_PlayersOnTeamHeroes(libGame_gf_EnemyTeam(lp_terrorTeam), false), false);
}

void libGRDN_gf_ShowSeedUICounterLabel (int lp_team) {
    // Automatic Variable Declarations
    // Implementation
    DialogControlSetVisible(libUIUI_gv_mapMechanicsPanel.lv_gardenOfTerrorSeedsFrameSeedCounterLabel[lp_team], PlayerGroupAll(), true);
    libGRDN_gf_UpdateSeedCountUI();
    DialogControlSetVisible(libUIUI_gv_mapMechanicsPanel.lv_gardenOfTerrorSeedsFrameStatusLabel[lp_team], PlayerGroupAll(), false);
}

void libGRDN_gf_ShowSeedUIActiveLabel (int lp_team) {
    // Automatic Variable Declarations
    // Implementation
    DialogControlSetVisible(libUIUI_gv_mapMechanicsPanel.lv_gardenOfTerrorSeedsFrameSeedCounterLabel[lp_team], PlayerGroupAll(), false);
    libNtve_gf_SetDialogItemText(libUIUI_gv_mapMechanicsPanel.lv_gardenOfTerrorSeedsFrameStatusLabel[lp_team], StringExternal("Param/Value/lib_GRDN_4ED97AF4"), PlayerGroupAll());
    DialogControlSetVisible(libUIUI_gv_mapMechanicsPanel.lv_gardenOfTerrorSeedsFrameStatusLabel[lp_team], PlayerGroupAll(), true);
}

void libGRDN_gf_ShowHideGathertheSeedsSlideout (bool lp_toggle) {
    // Variable Declarations
    int lv_team;

    // Automatic Variable Declarations
    // Variable Initialization

    // Implementation
    if ((lp_toggle == true)) {
        DialogControlSetVisible(libGRDN_gv_gardenUI.lv_gatherTheSeedsFrame, PlayerGroupAll(), true);
    }
    else {
        libGRDN_gf_UpdateSeedCountUI();
        DialogControlSendAnimationEvent(libGRDN_gv_gardenUI.lv_gatherTheSeedsFrame, PlayerGroupAll(), "PlaySlideOut");
    }
}

void libGRDN_gf_ShowHideObjectivePreviewatLocation (bool lp_toggle, int lp_locationIndex) {
    // Automatic Variable Declarations
    // Implementation
    if ((lp_toggle == true)) {
        libNtve_gf_CreateUnitsWithDefaultFacing(1, "SeedSpawnPreview", c_unitCreateIgnorePlacement, libCore_gv_cOMPUTER_Neutral, libGRDN_gv_seedSpawns[lp_locationIndex].lv_point, null);
        libGRDN_gv_seedSpawns[lp_locationIndex].lv_previewUnit = UnitLastCreated();
    }
    else {
        UnitKill(libGRDN_gv_seedSpawns[lp_locationIndex].lv_previewUnit);
    }
}

trigger auto_libGRDN_gf_ShowSeedWarningSlideoutwithTimer_Trigger = null;
fixed auto_libGRDN_gf_ShowSeedWarningSlideoutwithTimer_lp_waitTime;

void libGRDN_gf_ShowSeedWarningSlideoutwithTimer (fixed lp_waitTime) {
    auto_libGRDN_gf_ShowSeedWarningSlideoutwithTimer_lp_waitTime = lp_waitTime;

    if (auto_libGRDN_gf_ShowSeedWarningSlideoutwithTimer_Trigger == null) {
        auto_libGRDN_gf_ShowSeedWarningSlideoutwithTimer_Trigger = TriggerCreate("auto_libGRDN_gf_ShowSeedWarningSlideoutwithTimer_TriggerFunc");
    }

    TriggerExecute(auto_libGRDN_gf_ShowSeedWarningSlideoutwithTimer_Trigger, false, false);
}

bool auto_libGRDN_gf_ShowSeedWarningSlideoutwithTimer_TriggerFunc (bool testConds, bool runActions) {
    fixed lp_waitTime = auto_libGRDN_gf_ShowSeedWarningSlideoutwithTimer_lp_waitTime;

    // Variable Declarations
    timer lv_timer;
    int lv_displayedTime;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_timer = TimerCreate();
    lv_displayedTime = FixedToInt(lp_waitTime);

    // Implementation
    TimerStart(lv_timer, lp_waitTime, false, c_timeGame);
    DialogControlSetVisible(libGRDN_gv_gardenUI.lv_eventWarningFrame, PlayerGroupAll(), true);
    while ((TimerGetRemaining(lv_timer) > 0.0)) {
        libNtve_gf_SetDialogItemText(libGRDN_gv_gardenUI.lv_eventWarningTimerLabel, IntToText(lv_displayedTime), PlayerGroupAll());
        Wait(0.0625, c_timeGame);
        lv_displayedTime = (FixedToInt(TimerGetRemaining(lv_timer)) + 1);
    }
    DialogControlSendAnimationEvent(libGRDN_gv_gardenUI.lv_eventWarningFrame, PlayerGroupAll(), "PlaySlideOut");
    return true;
}

trigger auto_libGRDN_gf_PingUnitUntilitsDead_Trigger = null;
unit auto_libGRDN_gf_PingUnitUntilitsDead_lp_unit;
bool auto_libGRDN_gf_PingUnitUntilitsDead_lp_longFirstPing;

void libGRDN_gf_PingUnitUntilitsDead (unit lp_unit, bool lp_longFirstPing) {
    auto_libGRDN_gf_PingUnitUntilitsDead_lp_unit = lp_unit;
    auto_libGRDN_gf_PingUnitUntilitsDead_lp_longFirstPing = lp_longFirstPing;

    if (auto_libGRDN_gf_PingUnitUntilitsDead_Trigger == null) {
        auto_libGRDN_gf_PingUnitUntilitsDead_Trigger = TriggerCreate("auto_libGRDN_gf_PingUnitUntilitsDead_TriggerFunc");
    }

    TriggerExecute(auto_libGRDN_gf_PingUnitUntilitsDead_Trigger, false, false);
}

bool auto_libGRDN_gf_PingUnitUntilitsDead_TriggerFunc (bool testConds, bool runActions) {
    unit lp_unit = auto_libGRDN_gf_PingUnitUntilitsDead_lp_unit;
    bool lp_longFirstPing = auto_libGRDN_gf_PingUnitUntilitsDead_lp_longFirstPing;

    // Variable Declarations
    fixed lv_timeBetweenPings_C;
    const fixed lv_shortPingTime_C = 3.0;
    const fixed lv_longPingTime_C = 6.0;
    bool lv_isFirstPing;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_timeBetweenPings_C = 2.0;
    lv_isFirstPing = true;

    // Implementation
    while ((UnitIsAlive(lp_unit) == true)) {
        if ((lv_isFirstPing == true)) {
            if ((lp_longFirstPing == true)) {
                libCore_gf_CreateMinimapPingStorm(PlayerGroupAll(), "StormAlertSilent", UnitGetPosition(lp_unit), Color(100.00, 100.00, 0.00), lv_longPingTime_C);
                Wait((lv_longPingTime_C + lv_timeBetweenPings_C), c_timeGame);
            }
            else {
                libCore_gf_CreateMinimapPingStorm(PlayerGroupAll(), "StormAlertSilent", UnitGetPosition(lp_unit), Color(100.00, 100.00, 0.00), lv_shortPingTime_C);
                Wait((lv_shortPingTime_C + lv_timeBetweenPings_C), c_timeGame);
            }
            lv_isFirstPing = false;
        }
        else {
            libCore_gf_CreateMinimapPingStorm(PlayerGroupAll(), "StormAlert", UnitGetPosition(lp_unit), Color(100.00, 100.00, 0.00), lv_shortPingTime_C);
            Wait((lv_shortPingTime_C + lv_timeBetweenPings_C), c_timeGame);
        }
    }
    return true;
}

trigger auto_libGRDN_gf_PlaySeedWarningFirstTransmission_Trigger = null;

void libGRDN_gf_PlaySeedWarningFirstTransmission () {
    if (auto_libGRDN_gf_PlaySeedWarningFirstTransmission_Trigger == null) {
        auto_libGRDN_gf_PlaySeedWarningFirstTransmission_Trigger = TriggerCreate("auto_libGRDN_gf_PlaySeedWarningFirstTransmission_TriggerFunc");
    }

    TriggerExecute(auto_libGRDN_gf_PlaySeedWarningFirstTransmission_Trigger, false, false);
}

bool auto_libGRDN_gf_PlaySeedWarningFirstTransmission_TriggerFunc (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Implementation
    if ((libGame_gv_gameOver == true)) {
        return true;
    }

    TriggerQueueEnter();
    UserDataResetType("MapVOEvent");
    UserDataSetInt("MapVOEvent", "Gardens - Night Soon First", "Value", 1, 1);
    ConversationDataRun("GardensofTerror", PlayerGroupAll(), c_conversationSkipNone, false);
    libCore_gf_WaitForConversationToFinish();
    TriggerQueueExit();
    return true;
}

trigger auto_libGRDN_gf_PlaySeedWarningRepeatTransmission_Trigger = null;

void libGRDN_gf_PlaySeedWarningRepeatTransmission () {
    if (auto_libGRDN_gf_PlaySeedWarningRepeatTransmission_Trigger == null) {
        auto_libGRDN_gf_PlaySeedWarningRepeatTransmission_Trigger = TriggerCreate("auto_libGRDN_gf_PlaySeedWarningRepeatTransmission_TriggerFunc");
    }

    TriggerExecute(auto_libGRDN_gf_PlaySeedWarningRepeatTransmission_Trigger, false, false);
}

bool auto_libGRDN_gf_PlaySeedWarningRepeatTransmission_TriggerFunc (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Implementation
    if ((libGame_gv_gameOver == true)) {
        return true;
    }

    TriggerQueueEnter();
    UserDataResetType("MapVOEvent");
    UserDataSetInt("MapVOEvent", "Gardens - Night Soon Repeat", "Value", 1, 1);
    ConversationDataRun("GardensofTerror", PlayerGroupAll(), c_conversationSkipNone, false);
    libCore_gf_WaitForConversationToFinish();
    TriggerQueueExit();
    return true;
}

trigger auto_libGRDN_gf_PlaySeedSpawnFirstTransmission_Trigger = null;

void libGRDN_gf_PlaySeedSpawnFirstTransmission () {
    if (auto_libGRDN_gf_PlaySeedSpawnFirstTransmission_Trigger == null) {
        auto_libGRDN_gf_PlaySeedSpawnFirstTransmission_Trigger = TriggerCreate("auto_libGRDN_gf_PlaySeedSpawnFirstTransmission_TriggerFunc");
    }

    TriggerExecute(auto_libGRDN_gf_PlaySeedSpawnFirstTransmission_Trigger, false, false);
}

bool auto_libGRDN_gf_PlaySeedSpawnFirstTransmission_TriggerFunc (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Implementation
    if ((libGame_gv_gameOver == true)) {
        return true;
    }

    TriggerQueueEnter();
    UserDataResetType("MapVOEvent");
    UserDataSetInt("MapVOEvent", "Gardens - Night Begins First", "Value", 1, 1);
    ConversationDataRun("GardensofTerror", PlayerGroupAll(), c_conversationSkipNone, false);
    libCore_gf_WaitForConversationToFinish();
    TriggerQueueExit();
    return true;
}

trigger auto_libGRDN_gf_PlaySeedSpawnRepeatTransmission_Trigger = null;

void libGRDN_gf_PlaySeedSpawnRepeatTransmission () {
    if (auto_libGRDN_gf_PlaySeedSpawnRepeatTransmission_Trigger == null) {
        auto_libGRDN_gf_PlaySeedSpawnRepeatTransmission_Trigger = TriggerCreate("auto_libGRDN_gf_PlaySeedSpawnRepeatTransmission_TriggerFunc");
    }

    TriggerExecute(auto_libGRDN_gf_PlaySeedSpawnRepeatTransmission_Trigger, false, false);
}

bool auto_libGRDN_gf_PlaySeedSpawnRepeatTransmission_TriggerFunc (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Implementation
    if ((libGame_gv_gameOver == true)) {
        return true;
    }

    TriggerQueueEnter();
    UserDataResetType("MapVOEvent");
    UserDataSetInt("MapVOEvent", "Gardens - Night Begins Repeat", "Value", 1, 1);
    ConversationDataRun("GardensofTerror", PlayerGroupAll(), c_conversationSkipNone, false);
    libCore_gf_WaitForConversationToFinish();
    TriggerQueueExit();
    return true;
}

trigger auto_libGRDN_gf_PlayTerrorsSpawningSoonTransmission_Trigger = null;

void libGRDN_gf_PlayTerrorsSpawningSoonTransmission () {
    if (auto_libGRDN_gf_PlayTerrorsSpawningSoonTransmission_Trigger == null) {
        auto_libGRDN_gf_PlayTerrorsSpawningSoonTransmission_Trigger = TriggerCreate("auto_libGRDN_gf_PlayTerrorsSpawningSoonTransmission_TriggerFunc");
    }

    TriggerExecute(auto_libGRDN_gf_PlayTerrorsSpawningSoonTransmission_Trigger, false, false);
}

bool auto_libGRDN_gf_PlayTerrorsSpawningSoonTransmission_TriggerFunc (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Implementation
    if ((libGame_gv_gameOver == true)) {
        return true;
    }

    TriggerQueueEnter();
    UserDataResetType("MapVOEvent");
    UserDataSetInt("MapVOEvent", "Gardens - 100 Seeds - Day", "Value", 1, 1);
    ConversationDataRun("GardensofTerror", PlayerGroupAll(), c_conversationSkipNone, false);
    libCore_gf_WaitForConversationToFinish();
    TriggerQueueExit();
    return true;
}

trigger auto_libGRDN_gf_PlayTerrorsSummonedTransmission_Trigger = null;
int auto_libGRDN_gf_PlayTerrorsSummonedTransmission_lp_activeTeam;

void libGRDN_gf_PlayTerrorsSummonedTransmission (int lp_activeTeam) {
    auto_libGRDN_gf_PlayTerrorsSummonedTransmission_lp_activeTeam = lp_activeTeam;

    if (auto_libGRDN_gf_PlayTerrorsSummonedTransmission_Trigger == null) {
        auto_libGRDN_gf_PlayTerrorsSummonedTransmission_Trigger = TriggerCreate("auto_libGRDN_gf_PlayTerrorsSummonedTransmission_TriggerFunc");
    }

    TriggerExecute(auto_libGRDN_gf_PlayTerrorsSummonedTransmission_Trigger, false, false);
}

bool auto_libGRDN_gf_PlayTerrorsSummonedTransmission_TriggerFunc (bool testConds, bool runActions) {
    int lp_activeTeam = auto_libGRDN_gf_PlayTerrorsSummonedTransmission_lp_activeTeam;

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

    TriggerQueueEnter();
    UserDataResetType("MapVOEvent");
    ConversationDataLineResetPlayers("GardensofTerror", ("Left"));
    ConversationDataLineResetPlayers("GardensofTerror", ("Right"));
    ConversationDataLineResetPlayers("GardensofTerror", ("Observer"));
    if ((lp_activeTeam == libGame_gv_teamOrderIndex_C)) {
        UserDataSetInt("MapVOEvent", "Gardens - Plant Spawned Left - Night", "Value", 1, 1);
    }
    else {
        UserDataSetInt("MapVOEvent", "Gardens - Plant Spawned Right - Night", "Value", 1, 1);
    }
    ConversationDataLineSetPlayers("GardensofTerror", ("Left"), libGame_gf_PlayersOnTeamHeroes(libGame_gv_teamOrderIndex_C, false));
    ConversationDataLineSetPlayers("GardensofTerror", ("Right"), libGame_gf_PlayersOnTeamHeroes(libGame_gv_teamChaosIndex_C, false));
    ConversationDataLineSetPlayers("GardensofTerror", ("Observer"), libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer]);
    ConversationDataRun("GardensofTerror", PlayerGroupAll(), c_conversationSkipNone, false);
    libCore_gf_WaitForConversationToFinish();
    TriggerQueueExit();
    return true;
}

trigger auto_libGRDN_gf_PlayTerrorsDefeatedTransmission_Trigger = null;
int auto_libGRDN_gf_PlayTerrorsDefeatedTransmission_lp_activeTeam;

void libGRDN_gf_PlayTerrorsDefeatedTransmission (int lp_activeTeam) {
    auto_libGRDN_gf_PlayTerrorsDefeatedTransmission_lp_activeTeam = lp_activeTeam;

    if (auto_libGRDN_gf_PlayTerrorsDefeatedTransmission_Trigger == null) {
        auto_libGRDN_gf_PlayTerrorsDefeatedTransmission_Trigger = TriggerCreate("auto_libGRDN_gf_PlayTerrorsDefeatedTransmission_TriggerFunc");
    }

    TriggerExecute(auto_libGRDN_gf_PlayTerrorsDefeatedTransmission_Trigger, false, false);
}

bool auto_libGRDN_gf_PlayTerrorsDefeatedTransmission_TriggerFunc (bool testConds, bool runActions) {
    int lp_activeTeam = auto_libGRDN_gf_PlayTerrorsDefeatedTransmission_lp_activeTeam;

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

    TriggerQueueEnter();
    UserDataResetType("MapVOEvent");
    ConversationDataLineResetPlayers("GardensofTerror", ("Left"));
    ConversationDataLineResetPlayers("GardensofTerror", ("Right"));
    ConversationDataLineResetPlayers("GardensofTerror", ("Observer"));
    if ((lp_activeTeam == libGame_gv_teamOrderIndex_C)) {
        UserDataSetInt("MapVOEvent", "Gardens - Plant Killed Left - Night", "Value", 1, 1);
    }
    else {
        UserDataSetInt("MapVOEvent", "Gardens - Plant Killed Right - Night", "Value", 1, 1);
    }
    ConversationDataLineSetPlayers("GardensofTerror", ("Left"), libGame_gf_PlayersOnTeamHeroes(libGame_gv_teamOrderIndex_C, false));
    ConversationDataLineSetPlayers("GardensofTerror", ("Right"), libGame_gf_PlayersOnTeamHeroes(libGame_gv_teamChaosIndex_C, false));
    ConversationDataLineSetPlayers("GardensofTerror", ("Observer"), libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer]);
    ConversationDataRun("GardensofTerror", PlayerGroupAll(), c_conversationSkipNone, false);
    libCore_gf_WaitForConversationToFinish();
    TriggerQueueExit();
    return true;
}

// Triggers
//--------------------------------------------------------------------------------------------------
// Trigger: Map Initialization
//--------------------------------------------------------------------------------------------------
bool libGRDN_gt_MapInitialization_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Actions
    if (!runActions) {
        return true;
    }

    libGame_gf_SendMapSpecificAwardInitializeEventwithUserData(null, "Generic Instance");
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_MapInitialization_Init () {
    libGRDN_gt_MapInitialization = TriggerCreate("libGRDN_gt_MapInitialization_Func");
    TriggerAddEventMapInit(libGRDN_gt_MapInitialization);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Include Mod Initialization
//--------------------------------------------------------------------------------------------------
bool libGRDN_gt_IncludeModInitialization_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Actions
    if (!runActions) {
        return true;
    }

    libGRDN_gf_InitializeGardenUI();
    libCore_gf_DataAnnouncerVOSetDefaultAnnouncerForPlayerGroup(PlayerGroupAll(), "GardensDayAnnouncer");
    libCore_gv_mAPMapLight = "StormGardenofTerrorDay";
    GameSetLighting(libCore_gv_mAPMapLight, 0.0);
    libGRDN_gv_gardenTerrorEmergePoints[1] = Point(120.0, 162.0);
    libGRDN_gv_gardenTerrorEmergePoints[2] = Point(124.0, 108.0);
    libGRDN_gv_gardenTerrorEmergePoints[3] = Point(128.0, 54.0);
    libUIUI_gf_PingCreateNewPingTarget("Seed", false, StringExternal("Param/Value/lib_GRDN_7D294B55"), StringExternal("Param/Value/lib_GRDN_4F2FB6D5"), StringExternal("Param/Value/lib_GRDN_3A149BB7"), SoundLink("UI_Game_Ping_General", -1), SoundLink("UI_Game_Ping_General", -1));
    libUIUI_gf_PingCreateNewPingTarget("SeedSpawnPreview", false, StringExternal("Param/Value/lib_GRDN_A2EA9282"), StringExternal("Param/Value/lib_GRDN_BDDE897C"), StringExternal("Param/Value/lib_GRDN_23CF71F0"), SoundLink("UI_Game_Ping_General", -1), SoundLink("UI_Game_Ping_General", -1));
    libUIUI_gf_PingCreateNewPingTarget("Shambler", false, StringExternal("Param/Value/lib_GRDN_090E5778"), StringExternal("Param/Value/lib_GRDN_E7F35236"), StringExternal("Param/Value/lib_GRDN_49071226"), SoundLink("UI_Game_Ping_Attack", -1), SoundLink("UI_Game_Ping_Attack", -1));
    libUIUI_gf_PingCreateNewPingTarget("GardenTerror", false, StringExternal("Param/Value/lib_GRDN_C8B472AD"), StringExternal("Param/Value/lib_GRDN_0215742A"), StringExternal("Param/Value/lib_GRDN_0FF005E3"), SoundLink("UI_Game_Ping_Help", -1), SoundLink("UI_Game_Ping_Attack", -1));
    libNtve_gf_CreateActorAtPoint("MMController", RegionGetCenter(RegionEntireMap()));
    libMapM_gv_mapMechanicControllerActor = libNtve_gf_ActorLastCreated();
    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal MM1Off");
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_IncludeModInitialization_Init () {
    libGRDN_gt_IncludeModInitialization = TriggerCreate("libGRDN_gt_IncludeModInitialization_Func");
    libCore_gf_IncludeModInitialization(libGRDN_gt_IncludeModInitialization);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Gates Open
//--------------------------------------------------------------------------------------------------
bool libGRDN_gt_GatesOpen_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Actions
    if (!runActions) {
        return true;
    }

    TimerStart(libGRDN_gv_eventPreviewTimer, libGRDN_gv_longPreviewDelay_C, false, c_timeGame);
    TimerStart(libGRDN_gv_eventWarningTimer, libGRDN_gv_laningTimeAtGameStart_C, false, c_timeGame);
    SoundtrackStop(PlayerGroupAll(), c_soundtrackCategoryMusic, true);
    libSond_gf_SoundtrackApplyNewDefaultSoundtrackForPlayerGroup("MX_GardenOfTerror_GameStart", PlayerGroupAll());
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_GatesOpen_Init () {
    libGRDN_gt_GatesOpen = TriggerCreate("libGRDN_gt_GatesOpen_Func");
    TriggerAddEventTimer(libGRDN_gt_GatesOpen, libGame_gv_openTheGatesTimer);
}

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

    libGRDN_gv_recentSeedLocations[2] = libGRDN_gv_recentSeedLocations[1];
    libGRDN_gv_recentSeedLocations[1] = libGRDN_gv_currentSeedSpawnLocation;
    libGRDN_gv_currentSeedSpawnLocation = libGRDN_gf_GetNextSeedSpawnLocation();
    libGRDN_gf_ShowHideObjectivePreviewatLocation(true, libGRDN_gv_currentSeedSpawnLocation);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_EventPreviewTimerExpires_Init () {
    libGRDN_gt_EventPreviewTimerExpires = TriggerCreate("libGRDN_gt_EventPreviewTimerExpires_Func");
    TriggerAddEventTimer(libGRDN_gt_EventPreviewTimerExpires, libGRDN_gv_eventPreviewTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Event Warning Timer Expires
//--------------------------------------------------------------------------------------------------
bool libGRDN_gt_EventWarningTimerExpires_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Actions
    if (!runActions) {
        return true;
    }

    libGRDN_gf_ShowHideSeedUI(true);
    libGRDN_gf_UpdateSeedCountUI();
    if ((libGRDN_gv_firstSeedSpawnTransmissionPlayed == false)) {
        libGRDN_gf_PlaySeedWarningFirstTransmission();
        libGRDN_gv_firstSeedSpawnTransmissionPlayed = true;
    }
    else {
        libGRDN_gf_PlaySeedWarningRepeatTransmission();
    }
    SoundPlayForPlayer(SoundLink("UI_CampaignHintNotify", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.1);
    libGRDN_gf_SpawnSeedatLocation(libGRDN_gv_currentSeedSpawnLocation);
    TimerStart(libGRDN_gv_eventStartTimer, libGRDN_gv_seedSpawnTime_C, false, c_timeGame);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_EventWarningTimerExpires_Init () {
    libGRDN_gt_EventWarningTimerExpires = TriggerCreate("libGRDN_gt_EventWarningTimerExpires_Func");
    TriggerAddEventTimer(libGRDN_gt_EventWarningTimerExpires, libGRDN_gv_eventWarningTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Event Start Timer Expires
//--------------------------------------------------------------------------------------------------
bool libGRDN_gt_EventStartTimerExpires_Func (bool testConds, bool runActions) {
    // Automatic Variable Declarations
    // Actions
    if (!runActions) {
        return true;
    }

    if ((libGRDN_gv_firstTerrorSpawnTransmissionPlayed == false)) {
        libGRDN_gf_PlaySeedSpawnFirstTransmission();
        libGRDN_gv_firstTerrorSpawnTransmissionPlayed = true;
    }
    else {
        libGRDN_gf_PlaySeedSpawnRepeatTransmission();
    }
    libGRDN_gf_ShowHideGathertheSeedsSlideout(true);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_EventStartTimerExpires_Init () {
    libGRDN_gt_EventStartTimerExpires = TriggerCreate("libGRDN_gt_EventStartTimerExpires_Func");
    TriggerAddEventTimer(libGRDN_gt_EventStartTimerExpires, libGRDN_gv_eventStartTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Seed Channel Start
//--------------------------------------------------------------------------------------------------
bool libGRDN_gt_SeedChannelStart_Func (bool testConds, bool runActions) {
    // Variable Declarations
    unit lv_seedUnit;
    int lv_gatheringTeam;
    int lv_seedLocation;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_seedUnit = EventUnitTargetUnit();
    lv_gatheringTeam = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()));
    lv_seedLocation = libGRDN_gf_SeedLocationIndex(lv_seedUnit);

    // Conditions
    if (testConds) {
        if (!((UnitGetType(lv_seedUnit) == "Seed"))) {
            return false;
        }
    }

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

    if ((lv_gatheringTeam == libGame_gv_teamOrderIndex_C)) {
        libNtve_gf_SendActorMessageToUnit(libGRDN_gv_seedSpawns[lv_seedLocation].lv_seedUnit, "StatusIncrement TributeCaptureOrder");
    }
    else {
        libNtve_gf_SendActorMessageToUnit(libGRDN_gv_seedSpawns[lv_seedLocation].lv_seedUnit, "StatusIncrement TributeCaptureChaos");
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_SeedChannelStart_Init () {
    libGRDN_gt_SeedChannelStart = TriggerCreate("libGRDN_gt_SeedChannelStart_Func");
    TriggerAddEventUnitAbility(libGRDN_gt_SeedChannelStart, null, AbilityCommand("CaptureMacGuffin", 0), c_abilEffectStageChannel, false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Seed Channel Stop
//--------------------------------------------------------------------------------------------------
bool libGRDN_gt_SeedChannelStop_Func (bool testConds, bool runActions) {
    // Variable Declarations
    unit lv_seedUnit;
    int lv_gatheringTeam;
    int lv_seedLocation;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_seedUnit = EventUnitTargetUnit();
    lv_gatheringTeam = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()));
    lv_seedLocation = libGRDN_gf_SeedLocationIndex(lv_seedUnit);

    // Conditions
    if (testConds) {
        if (!((UnitGetType(lv_seedUnit) == "Seed"))) {
            return false;
        }
    }

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

    if ((lv_gatheringTeam == libGame_gv_teamOrderIndex_C)) {
        libNtve_gf_SendActorMessageToUnit(lv_seedUnit, "StatusDecrement TributeCaptureOrder");
    }
    else {
        libNtve_gf_SendActorMessageToUnit(lv_seedUnit, "StatusDecrement TributeCaptureChaos");
    }
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_SeedChannelStop_Init () {
    libGRDN_gt_SeedChannelStop = TriggerCreate("libGRDN_gt_SeedChannelStop_Func");
    TriggerAddEventUnitAbility(libGRDN_gt_SeedChannelStop, null, AbilityCommand("CaptureMacGuffin", 0), c_unitAbilStageCancel, false);
    TriggerAddEventUnitAbility(libGRDN_gt_SeedChannelStop, null, AbilityCommand("CaptureMacGuffin", 0), c_unitAbilStageComplete, false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Seed Gathered
//--------------------------------------------------------------------------------------------------
bool libGRDN_gt_SeedGathered_Func (bool testConds, bool runActions) {
    // Variable Declarations
    unit lv_seed;
    unit lv_hero;
    int lv_player;
    int lv_team;
    int lv_location;
    unit lv_seedDefender;

    // Automatic Variable Declarations
    unitgroup auto31ABF747_g;
    int auto31ABF747_u;

    // Variable Initialization
    lv_seed = EventPlayerEffectUsedUnit(c_effectUnitTarget);
    lv_hero = EventPlayerEffectUsedUnit(c_effectUnitCaster);
    lv_player = EventPlayerEffectUsedUnitOwner(c_effectPlayerCaster);
    lv_team = libGame_gf_TeamNumberOfPlayer(lv_player);
    lv_location = libGRDN_gf_SeedLocationIndex(lv_seed);

    // Conditions
    if (testConds) {
        if (!((UnitGetType(lv_seed) == "Seed"))) {
            return false;
        }
    }

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

    libNtve_gf_SendActorMessageToUnit(lv_seed, "Signal TributeOwnerNeutral");
    libNtve_gf_SendActorMessageToUnit(lv_seed, "StatusSet TributeOwnerChaos 0");
    libNtve_gf_SendActorMessageToUnit(lv_seed, "StatusSet TributeOwnerOrder 0");
    UnitKill(lv_seed);
    libGRDN_gv_seedsCollected[lv_team] += 1;
    libGame_gf_SendMapSpecificAwardEvent(lv_player, 1.0, true);
    auto31ABF747_g = libGRDN_gv_seedDefenders;
    auto31ABF747_u = UnitGroupCount(auto31ABF747_g, c_unitCountAll);
    for (;; auto31ABF747_u -= 1) {
        lv_seedDefender = UnitGroupUnitFromEnd(auto31ABF747_g, auto31ABF747_u);
        if (lv_seedDefender == null) { break; }
        UnitBehaviorAdd(lv_seedDefender, "UnitGivesNoXP", lv_seedDefender, 1);
        UnitKill(lv_seedDefender);
    }
    libNtve_gf_CreateUnitsWithDefaultFacing(1, "RegenGlobe", 0, libGame_gf_ComputerPlayerInTeam(lv_team), UnitGetPosition(lv_seed), null);
    libGame_gf_DropLootBannerinSconce(libGRDN_gv_seedSpawns[lv_location].lv_lootBannerSconce, PlayerBanner(lv_player), lv_player, true);
    libGRDN_gf_UpdateSeedCountUI();
    libGRDN_gf_ShowHideGathertheSeedsSlideout(false);
    if ((libGRDN_gv_seedsCollected[lv_team] >= libGRDN_gv_seedsNeeded_C)) {
        libNtve_gf_CreateActorAtPoint("UI_Game_Ping_GardenOfTerror_Terror_Summoned", libGRDN_gv_seedSpawns[lv_location].lv_point);
        libGRDN_gf_EndSeedPhase(lv_team);
    }
    else {
        libNtve_gf_CreateActorAtPoint("UI_Game_Ping_GardenOfTerror_Seed_Collected", libGRDN_gv_seedSpawns[lv_location].lv_point);
        TimerStart(libGRDN_gv_eventWarningTimer, libGRDN_gf_RandomCursedPacingSeedSpawnDelay(), false, c_timeGame);
        TimerStart(libGRDN_gv_eventPreviewTimer, libGRDN_gv_shortPreviewDelay_C, false, c_timeGame);
    }
    libNtve_gf_CreateActorAtPoint("Event_GardenOfTerror_Seed_Pickup_Sound", libGRDN_gv_seedSpawns[lv_location].lv_point);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_SeedGathered_Init () {
    libGRDN_gt_SeedGathered = TriggerCreate("libGRDN_gt_SeedGathered_Func");
    TriggerAddEventPlayerEffectUsed(libGRDN_gt_SeedGathered, c_playerAny, "CaptureMacGuffinCastComplete");
}

//--------------------------------------------------------------------------------------------------
// Trigger: Terror Spawn Timer Expires
//--------------------------------------------------------------------------------------------------
bool libGRDN_gt_TerrorSpawnTimerExpires_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_winningTeam;

    // Automatic Variable Declarations
    // Variable Initialization

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

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

    if ((libGRDN_gv_seedsCollected[libGame_gv_teamOrderIndex_C] > libGRDN_gv_seedsCollected[libGame_gv_teamChaosIndex_C])) {
        lv_winningTeam = libGame_gv_teamOrderIndex_C;
    }
    else {
        lv_winningTeam = libGame_gv_teamChaosIndex_C;
    }
    libGRDN_gf_ShowSeedUIActiveLabel(lv_winningTeam);
    libGRDN_gf_RunNightfallEnvironmentEffects();
    libGRDN_gf_SpawnGardenTerrors();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_TerrorSpawnTimerExpires_Init () {
    libGRDN_gt_TerrorSpawnTimerExpires = TriggerCreate("libGRDN_gt_TerrorSpawnTimerExpires_Func");
    TriggerAddEventTimer(libGRDN_gt_TerrorSpawnTimerExpires, libGRDN_gv_terrorSpawnTimer);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Garden Terror Killed
//--------------------------------------------------------------------------------------------------
bool libGRDN_gt_GardenTerrorKilled_Func (bool testConds, bool runActions) {
    // Variable Declarations
    unit lv_terrorUnit;
    bool lv_allTerrorsAreDead;
    int lv_lane;

    // Automatic Variable Declarations
    const int auto76F78E1B_ae = libGRDN_gv_laneCount_C;
    const int auto76F78E1B_ai = 1;

    // Variable Initialization
    lv_terrorUnit = EventUnit();
    lv_allTerrorsAreDead = true;

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

        if (!((UnitGetType(lv_terrorUnit) == "GardenTerror"))) {
            return false;
        }
    }

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

    lv_lane = 1;
    for ( ; ( (auto76F78E1B_ai >= 0 && lv_lane <= auto76F78E1B_ae) || (auto76F78E1B_ai < 0 && lv_lane >= auto76F78E1B_ae) ) ; lv_lane += auto76F78E1B_ai ) {
        if ((UnitIsAlive(libGRDN_gv_gardenTerrors[lv_lane]) == true)) {
            lv_allTerrorsAreDead = false;
        }

    }
    if ((lv_allTerrorsAreDead == true)) {
        libNtve_gf_CreateActorAtPoint("UI_Game_Ping_GardenOfTerror_EventEnd", UnitGetPosition(lv_terrorUnit));
        libGRDN_gf_EndTerrorPhase(libGame_gf_TeamNumberOfPlayer(UnitGetOwner(lv_terrorUnit)));
    }

    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_GardenTerrorKilled_Init () {
    libGRDN_gt_GardenTerrorKilled = TriggerCreate("libGRDN_gt_GardenTerrorKilled_Func");
    TriggerAddEventUnitDied(libGRDN_gt_GardenTerrorKilled, null);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Garden Terror Appears in Lane
//--------------------------------------------------------------------------------------------------
bool libGRDN_gt_GardenTerrorAppearsinLane_Func (bool testConds, bool runActions) {
    // Variable Declarations
    unit lv_terrorUnit;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_terrorUnit = EventUnit();

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

        if (!((UnitGetType(lv_terrorUnit) == "GardenTerror"))) {
            return false;
        }
    }

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

    UnitCreateAIThinkTree(lv_terrorUnit);
    libCore_gf_CreateMinimapPingStorm(PlayerGroupAll(), "StormAlert", UnitGetPosition(lv_terrorUnit), Color(100.00, 100.00, 0.00), 3.0);
    PingSetUnit(PingLastCreated(), lv_terrorUnit);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_GardenTerrorAppearsinLane_Init () {
    libGRDN_gt_GardenTerrorAppearsinLane = TriggerCreate("libGRDN_gt_GardenTerrorAppearsinLane_Func");
    TriggerAddEventUnitBehaviorChange(libGRDN_gt_GardenTerrorAppearsinLane, null, "GardenTerrorBurrowed", c_unitBehaviorChangeDestroy);
}

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

        if (!((TimerGetRemaining(libGame_gv_openTheGatesTimer) <= 0.0))) {
            return false;
        }
    }

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

    TriggerDebugOutput(1, StringExternal("Param/Value/lib_GRDN_9DC34B88"), true);
    TimerPause(libGRDN_gv_eventPreviewTimer, true);
    TimerPause(libGRDN_gv_eventWarningTimer, true);
    TimerPause(libGRDN_gv_eventStartTimer, true);
    if ((TimerGetRemaining(libGRDN_gv_eventPreviewTimer) > 0.0)) {
        TriggerExecute(libGRDN_gt_EventPreviewTimerExpires, true, true);
    }

    TriggerExecute(libGRDN_gt_EventWarningTimerExpires, true, true);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_eventstart_Init () {
    libGRDN_gt_eventstart = TriggerCreate("libGRDN_gt_eventstart_Func");
    TriggerAddEventChatMessage(libGRDN_gt_eventstart, c_playerAny, "eventstart", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: trans-terrors1soon
//--------------------------------------------------------------------------------------------------
bool libGRDN_gt_transterrors1soon_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_spawningTeam;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_spawningTeam = libGame_gv_teamOrderIndex_C;

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

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

    if ((EventChatMessage(false) == "trans-terrors2soon")) {
        lv_spawningTeam = libGame_gv_teamChaosIndex_C;
    }

    TextExpressionSetToken("Param/Expression/lib_GRDN_1329FBA2", "A", IntToText(lv_spawningTeam));
    TriggerDebugOutput(1, TextExpressionAssemble("Param/Expression/lib_GRDN_1329FBA2"), true);
    libGRDN_gf_PlayTerrorsSpawningSoonTransmission();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_transterrors1soon_Init () {
    libGRDN_gt_transterrors1soon = TriggerCreate("libGRDN_gt_transterrors1soon_Func");
    TriggerAddEventChatMessage(libGRDN_gt_transterrors1soon, c_playerAny, "trans-terrors1soon", true);
    TriggerAddEventChatMessage(libGRDN_gt_transterrors1soon, c_playerAny, "trans-terrors2soon", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: trans-terrors1now
//--------------------------------------------------------------------------------------------------
bool libGRDN_gt_transterrors1now_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_spawningTeam;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_spawningTeam = libGame_gv_teamOrderIndex_C;

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

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

    if ((EventChatMessage(false) == "trans-terrors2now")) {
        lv_spawningTeam = libGame_gv_teamChaosIndex_C;
    }

    TextExpressionSetToken("Param/Expression/lib_GRDN_6B387896", "A", IntToText(lv_spawningTeam));
    TriggerDebugOutput(1, TextExpressionAssemble("Param/Expression/lib_GRDN_6B387896"), true);
    libGRDN_gf_PlayTerrorsSummonedTransmission(lv_spawningTeam);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_transterrors1now_Init () {
    libGRDN_gt_transterrors1now = TriggerCreate("libGRDN_gt_transterrors1now_Func");
    TriggerAddEventChatMessage(libGRDN_gt_transterrors1now, c_playerAny, "trans-terrors1now", true);
    TriggerAddEventChatMessage(libGRDN_gt_transterrors1now, c_playerAny, "trans-terrors2now", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: trans-terrors1dead
//--------------------------------------------------------------------------------------------------
bool libGRDN_gt_transterrors1dead_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_spawningTeam;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_spawningTeam = libGame_gv_teamOrderIndex_C;

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

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

    if ((EventChatMessage(false) == "trans-terrors2dead")) {
        lv_spawningTeam = libGame_gv_teamChaosIndex_C;
    }

    TextExpressionSetToken("Param/Expression/lib_GRDN_A384C1C1", "A", IntToText(lv_spawningTeam));
    TriggerDebugOutput(1, TextExpressionAssemble("Param/Expression/lib_GRDN_A384C1C1"), true);
    libGRDN_gf_PlayTerrorsDefeatedTransmission(lv_spawningTeam);
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_transterrors1dead_Init () {
    libGRDN_gt_transterrors1dead = TriggerCreate("libGRDN_gt_transterrors1dead_Func");
    TriggerAddEventChatMessage(libGRDN_gt_transterrors1dead, c_playerAny, "trans-terrors1dead", true);
    TriggerAddEventChatMessage(libGRDN_gt_transterrors1dead, c_playerAny, "trans-terrors2dead", true);
}

//--------------------------------------------------------------------------------------------------
// Trigger: terrors
//--------------------------------------------------------------------------------------------------
bool libGRDN_gt_terrors_Func (bool testConds, bool runActions) {
    // Variable Declarations
    int lv_spawningTeam;

    // Automatic Variable Declarations
    // Variable Initialization
    lv_spawningTeam = libGame_gv_teamOrderIndex_C;

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

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

    if ((EventChatMessage(false) == "terrors2")) {
        lv_spawningTeam = libGame_gv_teamChaosIndex_C;
    }

    TextExpressionSetToken("Param/Expression/lib_GRDN_E52B4802", "A", IntToText(lv_spawningTeam));
    TriggerDebugOutput(1, TextExpressionAssemble("Param/Expression/lib_GRDN_E52B4802"), true);
    TimerPause(libGRDN_gv_eventPreviewTimer, true);
    TimerPause(libGRDN_gv_eventWarningTimer, true);
    TimerPause(libGRDN_gv_terrorSpawnTimer, true);
    libGRDN_gv_currentSeedSpawnLocation = 2;
    libGRDN_gv_seedsCollected[lv_spawningTeam] = 3;
    libGRDN_gv_seedsCollected[libGame_gf_EnemyTeam(lv_spawningTeam)] = 0;
    libGRDN_gf_UpdateSeedCountUI();
    libGRDN_gf_SpawnGardenTerrors();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_terrors_Init () {
    libGRDN_gt_terrors = TriggerCreate("libGRDN_gt_terrors_Func");
    TriggerAddEventChatMessage(libGRDN_gt_terrors, c_playerAny, "terrors", true);
    TriggerAddEventChatMessage(libGRDN_gt_terrors, c_playerAny, "terrors1", true);
    TriggerAddEventChatMessage(libGRDN_gt_terrors, c_playerAny, "terrors2", true);
}

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

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

    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal RainOn");
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_rainon_Init () {
    libGRDN_gt_rainon = TriggerCreate("libGRDN_gt_rainon_Func");
    TriggerAddEventChatMessage(libGRDN_gt_rainon, c_playerAny, "rainon", true);
}

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

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

    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal RainOff");
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_rainoff_Init () {
    libGRDN_gt_rainoff = TriggerCreate("libGRDN_gt_rainoff_Func");
    TriggerAddEventChatMessage(libGRDN_gt_rainoff, c_playerAny, "rainoff", true);
}

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

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

    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal RainLeft");
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_rainleft_Init () {
    libGRDN_gt_rainleft = TriggerCreate("libGRDN_gt_rainleft_Func");
    TriggerAddEventChatMessage(libGRDN_gt_rainleft, c_playerAny, "rainleft", true);
}

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

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

    ActorSend(libMapM_gv_mapMechanicControllerActor, "Signal RainRight");
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_rainright_Init () {
    libGRDN_gt_rainright = TriggerCreate("libGRDN_gt_rainright_Func");
    TriggerAddEventChatMessage(libGRDN_gt_rainright, c_playerAny, "rainright", true);
}

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

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

    libGRDN_gf_RunNightfallEnvironmentEffects();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_night_Init () {
    libGRDN_gt_night = TriggerCreate("libGRDN_gt_night_Func");
    TriggerAddEventChatMessage(libGRDN_gt_night, c_playerAny, "night", true);
}

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

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

    libGRDN_gf_RunDaybreakEnvironmentEffects();
    return true;
}

//--------------------------------------------------------------------------------------------------
void libGRDN_gt_day_Init () {
    libGRDN_gt_day = TriggerCreate("libGRDN_gt_day_Func");
    TriggerAddEventChatMessage(libGRDN_gt_day, c_playerAny, "day", true);
}

void libGRDN_InitTriggers () {
    libGRDN_gt_MapInitialization_Init();
    libGRDN_gt_IncludeModInitialization_Init();
    libGRDN_gt_GatesOpen_Init();
    libGRDN_gt_EventPreviewTimerExpires_Init();
    libGRDN_gt_EventWarningTimerExpires_Init();
    libGRDN_gt_EventStartTimerExpires_Init();
    libGRDN_gt_SeedChannelStart_Init();
    libGRDN_gt_SeedChannelStop_Init();
    libGRDN_gt_SeedGathered_Init();
    libGRDN_gt_TerrorSpawnTimerExpires_Init();
    libGRDN_gt_GardenTerrorKilled_Init();
    libGRDN_gt_GardenTerrorAppearsinLane_Init();
    libGRDN_gt_eventstart_Init();
    libGRDN_gt_transterrors1soon_Init();
    libGRDN_gt_transterrors1now_Init();
    libGRDN_gt_transterrors1dead_Init();
    libGRDN_gt_terrors_Init();
    libGRDN_gt_rainon_Init();
    libGRDN_gt_rainoff_Init();
    libGRDN_gt_rainleft_Init();
    libGRDN_gt_rainright_Init();
    libGRDN_gt_night_Init();
    libGRDN_gt_day_Init();
}

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

void libGRDN_InitLib () {
    if (libGRDN_InitLib_completed) {
        return;
    }

    libGRDN_InitLib_completed = true;

    libGRDN_InitLibraries();
    libGRDN_InitVariables();
    libGRDN_InitTriggers();
}