include "TriggerLibs/NativeLib"

include "TriggerLibs/HeroesLib"

include "TriggerLibs/GameLib"

include "TriggerLibs/MapMechanicsLib"

include "TriggerLibs/AILib"

include "TriggerLibs/UILib"

include "TriggerLibs/SoundLib"



include "LibMSOC_h"



//--------------------------------------------------------------------------------------------------

// Library: Tomb Spider Queen

//--------------------------------------------------------------------------------------------------

// External Library Initialization

void libMSOC_InitLibraries () {

    libNtve_InitVariables();

    libCore_InitVariables();

    libGame_InitVariables();

    libMapM_InitVariables();

    libAIAI_InitVariables();

    libUIUI_InitVariables();

    libSond_InitVariables();

}



// Variable Initialization

bool libMSOC_InitVariables_completed = false;



void libMSOC_InitVariables () {

    int init_i;

    int init_i1;



    if (libMSOC_InitVariables_completed) {

        return;

    }



    libMSOC_InitVariables_completed = true;



    for (init_i = 0; init_i <= libMSOC_gv_mMTombSpiderQueenCount_C; init_i += 1) {

        for (init_i1 = 0; init_i1 <= libCore_gv_bALMaxTeams; init_i1 += 1) {

            libMSOC_gv_mMTombSpiderQueen[init_i].lv_ping[init_i1] = c_invalidPingId;

        }

        for (init_i1 = 0; init_i1 <= libCore_gv_bALMaxPlayers; init_i1 += 1) {

            libMSOC_gv_mMTombSpiderQueen[init_i].lv_hintTextTag[init_i1] = c_textTagNone;

        }

        for (init_i1 = 0; init_i1 <= 2; init_i1 += 1) {

            libMSOC_gv_mMTombSpiderQueen[init_i].lv_countTextTagAlly[init_i1] = c_textTagNone;

        }

        libMSOC_gv_mMTombSpiderQueen[init_i].lv_countTextTagEnemy = c_textTagNone;

    }

    libMSOC_gv_mMTombSpiderQueenGroup = UnitGroupEmpty();

    libMSOC_gv_mMTombSpiderQueenFirstActivation = true;

    libMSOC_gv_mMTombSpiderQueenTurnInCompleteFirstTime = true;

    libMSOC_gv_mMTombSpiderQueenWaitTimer = TimerCreate();

    libMSOC_gv_mMTombSpiderQueenAnimationHandlerTimer = TimerCreate();

    libMSOC_gv_mMTombSpiderQueenSandGolemDeathTimer = TimerCreate();

    libMSOC_gv_mMTombSpiderQueenSandGolemInitialTimer = TimerCreate();

    libMSOC_gv_mMTombSpiderQueenSandGolemInitialTimerDuration_C = 174;

    libMSOC_gv_mMTombSpiderQueenSandGolemDeathTimerDuration_C = 290.0;

    libMSOC_gv_mMTombSpiderQueenSoulEaterSummonTimer = TimerCreate();

    libMSOC_gv_mMTombSpiderQueenSpiderQueenHealthDecay_C = 1.0;

    libMSOC_gv_mMTombSpiderQueenScalingTimer = TimerCreate();

    libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsPanel = c_invalidDialogControlId;

    for (init_i1 = 0; init_i1 <= libCore_gv_bALMaxTeams; init_i1 += 1) {

        libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulFrame[init_i1] = c_invalidDialogControlId;

    }

    for (init_i1 = 0; init_i1 <= libCore_gv_bALMaxTeams; init_i1 += 1) {

        libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel[init_i1] = c_invalidDialogControlId;

    }

    for (init_i1 = 0; init_i1 <= libCore_gv_bALMaxTeams; init_i1 += 1) {

        libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel2[init_i1] = c_invalidDialogControlId;

    }

    for (init_i1 = 0; init_i1 <= libCore_gv_bALMaxTeams; init_i1 += 1) {

        libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTurninGlow[init_i1] = c_invalidDialogControlId;

    }

    libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterFrame = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterCooldownFrame = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterCooldownLabel = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterFrameStatusLabel = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_mainPanel = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterEnabled = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterHealth = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterFlames = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterEnabled = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterHealth = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterFlames = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterEnabled = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterHealth = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterFlames = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_mainPanel = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterEnabled = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterHealth = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterFlames = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterEnabled = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterHealth = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterFlames = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterEnabled = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterHealth = c_invalidDialogControlId;

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterFlames = c_invalidDialogControlId;

}



// Presets

// Functions

void libMSOC_gf_MMTombSpiderQueenSetMapData (point lp_statuePosition, int lp_teamIndex, unit lp_soulCage) {

    // Variable Declarations

    int lv_itTeam;

    int lv_itEffect;

    int lv_itPlayer;



    // Automatic Variable Declarations

    // Variable Initialization



    // Implementation

    libMSOC_gv_mMTombSpiderQueen[lp_teamIndex].lv_units = lp_soulCage;

    libMSOC_gv_mMTombSpiderQueen[lp_teamIndex].lv_positions = UnitGetPosition(lp_soulCage);

    UnitGroupAdd(libMSOC_gv_mMTombSpiderQueenGroup, libMSOC_gv_mMTombSpiderQueen[lp_teamIndex].lv_units);

    UnitSetState(libMSOC_gv_mMTombSpiderQueen[lp_teamIndex].lv_units, c_unitStateTargetable, false);

    UnitSetState(libMSOC_gv_mMTombSpiderQueen[lp_teamIndex].lv_units, c_unitStateHighlightable, false);

}



void libMSOC_gf_MMTombSpiderQueenUpdateSouls (int lp_team) {

    // Variable Declarations

    int lv_itPlayer;

    int lv_teamEnemy;

    playergroup lv_playersAlly;

    playergroup lv_playersEnemy;

    int lv_itSoulCage;

    int lv_itSoulEffect;



    // Automatic Variable Declarations

    const int auto0D1400A1_ae = libMSOC_gv_mMTombSpiderQueenCount_C;

    const int auto0D1400A1_ai = 1;

    playergroup auto7661A8C1_g;

    playergroup autoD023E513_g;

    playergroup autoEDD1F218_g;



    // Variable Initialization

    lv_teamEnemy = libGame_gf_EnemyTeam(lp_team);

    lv_playersAlly = PlayerGroupCopy(libGame_gf_PlayersOnTeamHeroes(lp_team, false));

    lv_playersEnemy = PlayerGroupCopy(libGame_gf_PlayersOnTeamHeroes(lv_teamEnemy, false));



    // Implementation

    lv_itSoulCage = 1;

    for ( ; ( (auto0D1400A1_ai >= 0 && lv_itSoulCage <= auto0D1400A1_ae) || (auto0D1400A1_ai < 0 && lv_itSoulCage >= auto0D1400A1_ae) ) ; lv_itSoulCage += auto0D1400A1_ai ) {

        auto7661A8C1_g = libGame_gf_PlayersOnTeamHeroes(lp_team, false);

        lv_itPlayer = -1;

        while (true) {

            	lv_itPlayer = PlayerGroupNextPlayer(auto7661A8C1_g, lv_itPlayer);

            	if (lv_itPlayer<0) { break; }

            	if ((libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_hintTextTag[lv_itPlayer] == c_textTagNone)) {

                TextTagCreate(StringToText(""), 24, libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_positions, 1.0, true, false, libCore_gv_playerGroupFromPlayer[lv_itPlayer]);

                libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_hintTextTag[lv_itPlayer] = TextTagLastCreated();

            }



        }

        if ((libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_countTextTagAlly[lp_team] == c_textTagNone)) {

            TextTagCreate(StringToText(""), 24, libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_positions, 2.0, true, false, lv_playersAlly);

            libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_countTextTagAlly[lp_team] = TextTagLastCreated();

        }



        if ((libMSOC_gv_mMTombSpiderQueen[lp_team].lv_active == false) && (libMSOC_gv_mMTombSpiderQueen[lv_teamEnemy].lv_active == false)) {

            UnitSetInfoTip(libMSOC_gv_mMTombSpiderQueen[lp_team].lv_units, (StringExternal("Param/Value/lib_MSOC_4549A6F9") + IntToText(libMSOC_gv_mMTombSpiderQueenActivationAmountRequired[lp_team]) + StringExternal("Param/Value/lib_MSOC_A3064F0E")));

            autoEDD1F218_g = libGame_gf_PlayersOnTeamHeroes(lp_team, false);

            lv_itPlayer = -1;

            while (true) {

                	lv_itPlayer = PlayerGroupNextPlayer(autoEDD1F218_g, lv_itPlayer);

                	if (lv_itPlayer<0) { break; }

                	TextTagSetText(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_hintTextTag[lv_itPlayer], StringExternal("Param/Value/lib_MSOC_EFF1B0C1"));

            }

            TextTagShow(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_countTextTagAlly[lp_team], lv_playersAlly, true);

        }

        else {

            autoD023E513_g = libGame_gf_PlayersOnTeamHeroes(lp_team, false);

            lv_itPlayer = -1;

            while (true) {

                	lv_itPlayer = PlayerGroupNextPlayer(autoD023E513_g, lv_itPlayer);

                	if (lv_itPlayer<0) { break; }

                	TextTagSetText(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_hintTextTag[lv_itPlayer], StringToText(""));

            }

            TextTagShow(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_countTextTagAlly[lp_team], lv_playersAlly, false);

        }

    }

}



trigger auto_libMSOC_gf_MMTombSpiderQueenUpdateSoulPing_Trigger = null;

int auto_libMSOC_gf_MMTombSpiderQueenUpdateSoulPing_lp_team;



void libMSOC_gf_MMTombSpiderQueenUpdateSoulPing (int lp_team) {

    auto_libMSOC_gf_MMTombSpiderQueenUpdateSoulPing_lp_team = lp_team;



    if (auto_libMSOC_gf_MMTombSpiderQueenUpdateSoulPing_Trigger == null) {

        auto_libMSOC_gf_MMTombSpiderQueenUpdateSoulPing_Trigger = TriggerCreate("auto_libMSOC_gf_MMTombSpiderQueenUpdateSoulPing_TriggerFunc");

    }



    TriggerExecute(auto_libMSOC_gf_MMTombSpiderQueenUpdateSoulPing_Trigger, false, false);

}



bool auto_libMSOC_gf_MMTombSpiderQueenUpdateSoulPing_TriggerFunc (bool testConds, bool runActions) {

    int lp_team = auto_libMSOC_gf_MMTombSpiderQueenUpdateSoulPing_lp_team;



    // Variable Declarations

    int lv_enemyTeam;

    int lv_itSoulCage;



    // Automatic Variable Declarations

    const int autoE843FDF0_ae = libMSOC_gv_mMTombSpiderQueenCount_C;

    const int autoE843FDF0_ai = 1;

    const int auto33394DE7_n = 20;

    int auto33394DE7_i;

    const int auto1499F44D_ae = libMSOC_gv_mMTombSpiderQueenCount_C;

    const int auto1499F44D_ai = 1;



    // Variable Initialization

    lv_enemyTeam = 1;



    // Implementation

    lv_enemyTeam = libGame_gf_EnemyTeam(lp_team);

    while (true) {

        if ((libMSOC_gv_mMTombSpiderQueen[lp_team].lv_active == false) && (libMSOC_gv_mMTombSpiderQueen[lv_enemyTeam].lv_active == false) && (libMSOC_gv_mMTombSpiderQueenSoulsTotal[lp_team] >= libMSOC_gv_mMTombSpiderQueenActivationAmountRequired[lp_team])) {

            if ((libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_ping[lp_team] == c_invalidPingId)) {

                lv_itSoulCage = 1;

                for ( ; ( (autoE843FDF0_ai >= 0 && lv_itSoulCage <= autoE843FDF0_ae) || (autoE843FDF0_ai < 0 && lv_itSoulCage >= autoE843FDF0_ae) ) ; lv_itSoulCage += autoE843FDF0_ai ) {

                    libCore_gf_CreateMinimapPingStorm(libGame_gf_PlayersOnTeamHeroes(lp_team, false), "StormAlert", libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_positions, Color(0.00, 100.00, 0.00), 6.0);

                    libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_ping[lp_team] = PingLastCreated();

                }

                for (auto33394DE7_i = 1; auto33394DE7_i <= auto33394DE7_n; auto33394DE7_i += 1) {

                    if (((libMSOC_gv_mMTombSpiderQueen[lp_team].lv_active == true) || (libMSOC_gv_mMTombSpiderQueen[lv_enemyTeam].lv_active == true))) {

                        break;

                    }



                    Wait(1.0, c_timeGame);

                }

                lv_itSoulCage = 1;

                for ( ; ( (auto1499F44D_ai >= 0 && lv_itSoulCage <= auto1499F44D_ae) || (auto1499F44D_ai < 0 && lv_itSoulCage >= auto1499F44D_ae) ) ; lv_itSoulCage += auto1499F44D_ai ) {

                    if ((libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_ping[lp_team] != c_invalidPingId)) {

                        PingDestroy(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_ping[lp_team]);

                        libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_ping[lp_team] = c_invalidPingId;

                    }



                }

            }



        }



        Wait(1.0, c_timeGame);

    }

    return true;

}



void libMSOC_gf_MMTombSpiderQueenAnimationHandlerMain (int lp_animState) {

    // Variable Declarations

    unit lv_itUnit;



    // Automatic Variable Declarations

    int auto21CB83E2_val;

    unitgroup auto7BCDD9C0_g;

    int auto7BCDD9C0_u;

    unitgroup auto34849214_g;

    int auto34849214_u;

    unitgroup autoDB95B934_g;

    int autoDB95B934_u;

    unitgroup auto2609EDCE_g;

    int auto2609EDCE_u;

    unitgroup auto43359709_g;

    int auto43359709_u;



    // Variable Initialization



    // Implementation

    auto21CB83E2_val = lp_animState;

    if (auto21CB83E2_val == libMSOC_ge_MMTombSpiderQueenAnimStates_Active) {

        auto7BCDD9C0_g = libMSOC_gv_mMTombSpiderQueenGroup;

        auto7BCDD9C0_u = UnitGroupCount(auto7BCDD9C0_g, c_unitCountAll);

        for (;; auto7BCDD9C0_u -= 1) {

            lv_itUnit = UnitGroupUnitFromEnd(auto7BCDD9C0_g, auto7BCDD9C0_u);

            if (lv_itUnit == null) { break; }

            libNtve_gf_SendActorMessageToUnit(lv_itUnit, "Signal Active");

        }

    }

    else if (auto21CB83E2_val == libMSOC_ge_MMTombSpiderQueenAnimStates_FirstGems) {

        auto34849214_g = libMSOC_gv_mMTombSpiderQueenGroup;

        auto34849214_u = UnitGroupCount(auto34849214_g, c_unitCountAll);

        for (;; auto34849214_u -= 1) {

            lv_itUnit = UnitGroupUnitFromEnd(auto34849214_g, auto34849214_u);

            if (lv_itUnit == null) { break; }

            libNtve_gf_SendActorMessageToUnit(lv_itUnit, "Signal FirstGems");

        }

    }

    else if (auto21CB83E2_val == libMSOC_ge_MMTombSpiderQueenAnimStates_EventPrepare) {

        autoDB95B934_g = libMSOC_gv_mMTombSpiderQueenGroup;

        autoDB95B934_u = UnitGroupCount(autoDB95B934_g, c_unitCountAll);

        for (;; autoDB95B934_u -= 1) {

            lv_itUnit = UnitGroupUnitFromEnd(autoDB95B934_g, autoDB95B934_u);

            if (lv_itUnit == null) { break; }

            libNtve_gf_SendActorMessageToUnit(lv_itUnit, "Signal EventPrepare");

        }

    }

    else if (auto21CB83E2_val == libMSOC_ge_MMTombSpiderQueenAnimStates_EventStart) {

        auto2609EDCE_g = libMSOC_gv_mMTombSpiderQueenGroup;

        auto2609EDCE_u = UnitGroupCount(auto2609EDCE_g, c_unitCountAll);

        for (;; auto2609EDCE_u -= 1) {

            lv_itUnit = UnitGroupUnitFromEnd(auto2609EDCE_g, auto2609EDCE_u);

            if (lv_itUnit == null) { break; }

            libNtve_gf_SendActorMessageToUnit(lv_itUnit, "Signal EventStart");

        }

    }

    else if (auto21CB83E2_val == libMSOC_ge_MMTombSpiderQueenAnimStates_EventEnd) {

        auto43359709_g = libMSOC_gv_mMTombSpiderQueenGroup;

        auto43359709_u = UnitGroupCount(auto43359709_g, c_unitCountAll);

        for (;; auto43359709_u -= 1) {

            lv_itUnit = UnitGroupUnitFromEnd(auto43359709_g, auto43359709_u);

            if (lv_itUnit == null) { break; }

            libNtve_gf_SendActorMessageToUnit(lv_itUnit, "Signal EventEnd");

        }

    }

    else {

    }

}



void libMSOC_gf_MMTombSpiderQueenTurnInPointTeamColor (int lp_team) {

    // Variable Declarations

    int lv_i;



    // Automatic Variable Declarations

    int autoA65AEDDB_val;

    const int auto03AAC4E3_ae = 2;

    const int auto03AAC4E3_ai = 1;

    const int auto2537F5E1_ae = 2;

    const int auto2537F5E1_ai = 1;

    const int auto83FFE808_ae = 2;

    const int auto83FFE808_ai = 1;



    // Variable Initialization



    // Implementation

    autoA65AEDDB_val = lp_team;

    if (autoA65AEDDB_val == 0) {

        lv_i = 1;

        for ( ; ( (auto03AAC4E3_ai >= 0 && lv_i <= auto03AAC4E3_ae) || (auto03AAC4E3_ai < 0 && lv_i >= auto03AAC4E3_ae) ) ; lv_i += auto03AAC4E3_ai ) {

            UnitSetOwner(libMSOC_gv_mMTombSpiderQueen[lv_i].lv_units, 0, true);

            libCore_gf_SendActorMessageToDoodadsInRegion("Signal OwnerNeutral", RegionCircle(UnitGetPosition(libMSOC_gv_mMTombSpiderQueen[lv_i].lv_units), 3.0), null);

        }

    }

    else if (autoA65AEDDB_val == 1) {

        lv_i = 1;

        for ( ; ( (auto2537F5E1_ai >= 0 && lv_i <= auto2537F5E1_ae) || (auto2537F5E1_ai < 0 && lv_i >= auto2537F5E1_ae) ) ; lv_i += auto2537F5E1_ai ) {

            UnitSetOwner(libMSOC_gv_mMTombSpiderQueen[lv_i].lv_units, 11, true);

            libCore_gf_SendActorMessageToDoodadsInRegion("Signal OwnerOrder", RegionCircle(UnitGetPosition(libMSOC_gv_mMTombSpiderQueen[lv_i].lv_units), 3.0), null);

        }

    }

    else if (autoA65AEDDB_val == 2) {

        lv_i = 1;

        for ( ; ( (auto83FFE808_ai >= 0 && lv_i <= auto83FFE808_ae) || (auto83FFE808_ai < 0 && lv_i >= auto83FFE808_ae) ) ; lv_i += auto83FFE808_ai ) {

            UnitSetOwner(libMSOC_gv_mMTombSpiderQueen[lv_i].lv_units, 12, true);

            libCore_gf_SendActorMessageToDoodadsInRegion("Signal OwnerChaos", RegionCircle(UnitGetPosition(libMSOC_gv_mMTombSpiderQueen[lv_i].lv_units), 3.0), null);

        }

    }

    else {

    }

}



void libMSOC_gf_MMTombSpiderQueenDropSoulsForEnemy (point lp_location, int lp_count, bool lp_furtherDrop, int lp_soulOwner) {

    // Variable Declarations

    int lv_enemyTeam;

    string lv_dropEffect;



    // Automatic Variable Declarations

    // Variable Initialization



    // Implementation

    if (((lp_count <= 0) || (libGame_gf_TeamNumberIsValid(libGame_gf_TeamNumberOfPlayer(lp_soulOwner)) == false) || (libMSOC_gv_mMTombSpiderQueenDisableEvent == true))) {

        return ;

    }



    lv_enemyTeam = libGame_gf_EnemyTeamNumberOfPlayer(lp_soulOwner);

    libMSOC_gf_MMTombSpiderQueenDropSoulsForAlly(lp_location, lp_count, lp_furtherDrop, libGame_gf_ComputerPlayerInTeam(lv_enemyTeam));

}



void libMSOC_gf_MMTombSpiderQueenDropSoulsForAlly (point lp_location, int lp_count, bool lp_furtherDrop, int lp_soulOwner) {

    // Variable Declarations

    int lv_enemyTeam;

    string lv_dropEffect1;

    string lv_dropEffect5;

    string lv_dropEffect20;

    int lv_count1;

    int lv_count5;

    int lv_count20;



    // Automatic Variable Declarations

    int auto9075D5F5_n;

    int auto9075D5F5_i;

    int auto59674B78_n;

    int auto59674B78_i;

    int autoAC6F1C57_n;

    int autoAC6F1C57_i;



    // Variable Initialization



    // Implementation

    if (((lp_count <= 0) || (libGame_gf_TeamNumberIsValid(libGame_gf_TeamNumberOfPlayer(lp_soulOwner)) == false) || (libMSOC_gv_mMTombSpiderQueenDisableEvent == true))) {

        return ;

    }



    if ((lp_furtherDrop == true)) {

        lv_dropEffect1 = "ItemSoulPickupOneSingleFar";

        lv_dropEffect5 = "ItemSoulPickupFiveSingleFar";

        lv_dropEffect20 = "ItemSoulPickupTwentySingleFar";

    }

    else {

        lv_dropEffect1 = "ItemSoulPickupOneSingleClose";

        lv_dropEffect5 = "ItemSoulPickupFiveSingleClose";

        lv_dropEffect20 = "ItemSoulPickupTwentySingleClose";

    }

    lv_count1 = lp_count;

    lv_count20 = (lv_count1 / 20);

    lv_count1 = ModI(lv_count1, 20);

    lv_count5 = (lv_count1 / 5);

    lv_count1 = ModI(lv_count1, 5);

    auto9075D5F5_n = lv_count20;

    for (auto9075D5F5_i = 1; auto9075D5F5_i <= auto9075D5F5_n; auto9075D5F5_i += 1) {

        PlayerCreateEffectPoint(libGame_gf_ComputerPlayerInTeam(libGame_gf_TeamNumberOfPlayer(lp_soulOwner)), lv_dropEffect20, lp_location);

    }

    auto59674B78_n = lv_count5;

    for (auto59674B78_i = 1; auto59674B78_i <= auto59674B78_n; auto59674B78_i += 1) {

        PlayerCreateEffectPoint(libGame_gf_ComputerPlayerInTeam(libGame_gf_TeamNumberOfPlayer(lp_soulOwner)), lv_dropEffect5, lp_location);

    }

    autoAC6F1C57_n = lv_count1;

    for (autoAC6F1C57_i = 1; autoAC6F1C57_i <= autoAC6F1C57_n; autoAC6F1C57_i += 1) {

        PlayerCreateEffectPoint(libGame_gf_ComputerPlayerInTeam(libGame_gf_TeamNumberOfPlayer(lp_soulOwner)), lv_dropEffect1, lp_location);

    }

}



int libMSOC_gf_MMTombSpiderQueenGetGemsHeldforUnit (unit lp_heroUnit) {

    // Automatic Variable Declarations

    // Implementation

    return FixedToInt(UnitBehaviorCount(lp_heroUnit, "MapMechanicStack"));

}



bool libMSOC_gf_MMTombSpiderQueenTurnInPossible () {

    // Variable Declarations

    int lv_itSoulCage;



    // Automatic Variable Declarations

    const int auto9988F4EF_ae = libMSOC_gv_mMTombSpiderQueenCount_C;

    const int auto9988F4EF_ai = 1;



    // Variable Initialization



    // Implementation

    lv_itSoulCage = 1;

    for ( ; ( (auto9988F4EF_ai >= 0 && lv_itSoulCage <= auto9988F4EF_ae) || (auto9988F4EF_ai < 0 && lv_itSoulCage >= auto9988F4EF_ae) ) ; lv_itSoulCage += auto9988F4EF_ai ) {

        if ((UnitIsValid(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units) == true) && (UnitBehaviorEnabled(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units, "MacguffinActivated") == true)) {

            return true;

        }



    }

    return false;

}



void libMSOC_gf_MMTombSpiderQueenEnableDisableTurnInGoals (bool lp_toggleSetting, unit lp_turnInUnit) {

    // Automatic Variable Declarations

    // Implementation

    if ((lp_toggleSetting == true)) {

        AddUnitOfInterest(lp_turnInUnit, 0.0, 0.0, "TurnInGems1", libNtve_ge_GoalTeam_Both, 0);

        AddUnitOfInterest(lp_turnInUnit, 0.0, 0.0, "TurnInGems2", libNtve_ge_GoalTeam_Both, 0);

        AddUnitOfInterest(lp_turnInUnit, 0.0, 0.0, "TurnInGems3", libNtve_ge_GoalTeam_Both, 0);

    }

    else {

        RemoveUnitOfInterest(lp_turnInUnit, "TurnInGems1", libNtve_ge_GoalTeam_Both);

        RemoveUnitOfInterest(lp_turnInUnit, "TurnInGems2", libNtve_ge_GoalTeam_Both);

        RemoveUnitOfInterest(lp_turnInUnit, "TurnInGems3", libNtve_ge_GoalTeam_Both);

    }

}



int libMSOC_gf_MMTombSpiderQueenSoulEatersCountAlive () {

    // Variable Declarations

    int lv_itSoulEater;

    int lv_count;



    // Automatic Variable Declarations

    const int auto8658FF26_ae = libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C;

    const int auto8658FF26_ai = 1;



    // Variable Initialization



    // Implementation

    lv_itSoulEater = 1;

    for ( ; ( (auto8658FF26_ai >= 0 && lv_itSoulEater <= auto8658FF26_ae) || (auto8658FF26_ai < 0 && lv_itSoulEater >= auto8658FF26_ae) ) ; lv_itSoulEater += auto8658FF26_ai ) {

        if ((UnitIsAlive(libMSOC_gv_mMTombSpiderQueenSoulEaters[lv_itSoulEater]) == true)) {

            lv_count += 1;

        }



    }

    return lv_count;

}



void libMSOC_gf_MMTombSpiderQueenSoulCollectionThresholdReached (int lp_winningTeam) {

    // Variable Declarations

    unit lv_itUnit;



    // Automatic Variable Declarations

    // Variable Initialization



    // Implementation

    if ((lp_winningTeam == libGame_gf_TeamNumberOfPlayer(libCore_gv_cOMPUTER_TeamOrder))) {

        libMSOC_gf_MMTombSpiderQueenTurnInPointTeamColor(1);

        libMSOC_gf_MMTombSpiderQueenSpawnSoulEaters(libCore_gv_cOMPUTER_TeamChaos);

        SoundPlayForPlayer(SoundLink("UI_Game_Ping_Shrine_Captured_Ally", -1), c_maxPlayers, libGame_gf_PlayersOnTeamHeroes(1, false), 100.0, 0.0);

        SoundPlayForPlayer(SoundLink("UI_Game_Ping_Shrine_Captured_Enemy", -1), c_maxPlayers, libGame_gf_PlayersOnTeamHeroes(2, false), 100.0, 0.0);

    }

    else {

        libMSOC_gf_MMTombSpiderQueenTurnInPointTeamColor(2);

        libMSOC_gf_MMTombSpiderQueenSpawnSoulEaters(libCore_gv_cOMPUTER_TeamOrder);

        SoundPlayForPlayer(SoundLink("UI_Game_Ping_Shrine_Captured_Ally", -1), c_maxPlayers, libGame_gf_PlayersOnTeamHeroes(2, false), 100.0, 0.0);

        SoundPlayForPlayer(SoundLink("UI_Game_Ping_Shrine_Captured_Enemy", -1), c_maxPlayers, libGame_gf_PlayersOnTeamHeroes(1, false), 100.0, 0.0);

    }

}



trigger auto_libMSOC_gf_MMTombSpiderQueenSpawnSoulEaters_Trigger = null;

int auto_libMSOC_gf_MMTombSpiderQueenSpawnSoulEaters_lp_enemyPlayer;



void libMSOC_gf_MMTombSpiderQueenSpawnSoulEaters (int lp_enemyPlayer) {

    auto_libMSOC_gf_MMTombSpiderQueenSpawnSoulEaters_lp_enemyPlayer = lp_enemyPlayer;



    if (auto_libMSOC_gf_MMTombSpiderQueenSpawnSoulEaters_Trigger == null) {

        auto_libMSOC_gf_MMTombSpiderQueenSpawnSoulEaters_Trigger = TriggerCreate("auto_libMSOC_gf_MMTombSpiderQueenSpawnSoulEaters_TriggerFunc");

    }



    TriggerExecute(auto_libMSOC_gf_MMTombSpiderQueenSpawnSoulEaters_Trigger, false, false);

}



bool auto_libMSOC_gf_MMTombSpiderQueenSpawnSoulEaters_TriggerFunc (bool testConds, bool runActions) {

    int lp_enemyPlayer = auto_libMSOC_gf_MMTombSpiderQueenSpawnSoulEaters_lp_enemyPlayer;



    // Variable Declarations

    int lv_itPlayer;

    int lv_index;

    int lv_enemyTeam;

    int lv_soulEaterTeam;

    playergroup lv_itPlayerGroupPlayer;

    int lv_itSpawnLocation;

    int lv_itSoulEater;



    // Automatic Variable Declarations

    int auto3B53A53D_ae;

    int auto82634F02_ae;

    int auto2DFF501F_ae;

    const int autoCEBBB573_ae = libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C;

    const int autoCEBBB573_ai = 1;



    // Variable Initialization

    lv_itPlayerGroupPlayer = PlayerGroupEmpty();



    // Implementation

    lv_enemyTeam = libGame_gf_TeamNumberOfPlayer(lp_enemyPlayer);

    lv_soulEaterTeam = libGame_gf_EnemyTeam(lv_enemyTeam);

    if ((libMSOC_gv_mMTombSpiderQueen[lv_soulEaterTeam].lv_active == true)) {

        return true;

    }



    auto3B53A53D_ae = libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C;

    lv_itSoulEater = 1;

    for ( ; lv_itSoulEater <= auto3B53A53D_ae ; lv_itSoulEater += 1 ) {

        libMSOC_gf_MMTombSpiderQueenUIUpdateHealthPanels(lv_itSoulEater, 0.0);

    }

    libMSOC_gf_MMTombSpiderQueenAnimationHandlerMain(libMSOC_ge_MMTombSpiderQueenAnimStates_EventPrepare);

    libMSOC_gv_mMTombSpiderQueen[lv_soulEaterTeam].lv_active = true;

    libMSOC_gv_mMTombSpiderQueen[lv_soulEaterTeam].lv_summoning = true;

    SoundPlayForPlayer(SoundLink("Event_LuxCrypt_SpiderCurse_Curse_Release_Start", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);

    SoundPlayForPlayer(SoundLink("Event_LuxCrypt_SpiderCurse_Curse_Amb", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);

    SoundtrackStop(PlayerGroupAll(), c_soundtrackCategoryMusic, true);

    libSond_gf_SoundtrackApplyNewDefaultSoundtrackForPlayerGroup("MX_LuxCrypt_ReleaseStart", PlayerGroupAll());

    TimerStart(libMSOC_gv_mMTombSpiderQueenSoulEaterSummonTimer, libMSOC_gv_mMTombSpiderQueenSoulEaterSummonTime, false, c_timeGame);

    libMapM_gf_JungleStartHibernateCamps();

    while (true) {

        if ((TimerGetRemaining(libMSOC_gv_mMTombSpiderQueenSoulEaterSummonTimer) == 0.0)) {

            auto2DFF501F_ae = libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C;

            lv_itSoulEater = 1;

            for ( ; lv_itSoulEater <= auto2DFF501F_ae ; lv_itSoulEater += 1 ) {

                libMSOC_gf_MMTombSpiderQueenUIUpdateHealthPanels(lv_itSoulEater, 100.0);

            }

            break;

        }

        else {

            auto82634F02_ae = libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C;

            lv_itSoulEater = 1;

            for ( ; lv_itSoulEater <= auto82634F02_ae ; lv_itSoulEater += 1 ) {

                libMSOC_gf_MMTombSpiderQueenUIUpdateHealthPanels(lv_itSoulEater, (TimerGetElapsed(libMSOC_gv_mMTombSpiderQueenSoulEaterSummonTimer) / libMSOC_gv_mMTombSpiderQueenSoulEaterSummonTime));

            }

            Wait(0.0125, c_timeGame);

        }

    }

    libMSOC_gf_MMTombSpiderQueenAnimationHandlerMain(libMSOC_ge_MMTombSpiderQueenAnimStates_EventStart);

    SoundPlayForPlayer(SoundLink("Event_LuxCrypt_SpiderCurse_Curse_Start", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);

    SoundChannelMute(PlayerGroupAll(), c_soundCategoryAmbient, true);

    SoundtrackStop(PlayerGroupAll(), c_soundtrackCategoryMusic, true);

    libSond_gf_SoundtrackApplyNewDefaultSoundtrackForPlayerGroup("MX_LuxCrypt_CurseActive", PlayerGroupAll());

    libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawnQ(lv_soulEaterTeam);

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenSoulEaterImpactsATarget, true);

    lv_itSpawnLocation = 1;

    for ( ; ( (autoCEBBB573_ai >= 0 && lv_itSpawnLocation <= autoCEBBB573_ae) || (autoCEBBB573_ai < 0 && lv_itSpawnLocation >= autoCEBBB573_ae) ) ; lv_itSpawnLocation += autoCEBBB573_ai ) {

        libNtve_gf_CreateUnitsWithDefaultFacing(1, "SoulEater", c_unitCreateIgnorePlacement, libGame_gf_ComputerPlayerInTeam(lv_soulEaterTeam), libMSOC_gv_mMTombSpiderQueenSoulEaterSpawnPoints[lv_soulEaterTeam][lv_itSpawnLocation], null);

        libMSOC_gv_mMTombSpiderQueenSoulEaters[lv_itSpawnLocation] = UnitLastCreated();

        libMSOC_gv_mMTombSpiderQueenQueensBirthing[lv_itSpawnLocation] = UnitLastCreated();

        libGame_gf_CalculateSpawnedMinionGoalPoints(UnitGetOwner(UnitLastCreated()), UnitGetPosition(UnitLastCreated()));

        libAIAI_gf_MinionAIStartMinionAI(-1, UnitLastCreated(), libGame_gv_spawnedMinionLane, libGame_gv_spawnedMinionFirstWaypointIndex, false, false, false, 0, true);

    }

    libMSOC_gv_mMTombSpiderQueen[lv_soulEaterTeam].lv_summoning = false;

    libMSOC_gf_MMTombSpiderQueenSoulEaterLifeMonitor();

    return true;

}



void libMSOC_gf_MMTombSpiderQueenSoulEaterLifeMonitor () {

    // Variable Declarations

    int lv_livingSoulEaters;

    int lv_itSoulEater;



    // Automatic Variable Declarations

    int auto3E530F6A_ae;



    // Variable Initialization

    lv_livingSoulEaters = libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C;



    // Implementation

    while ((lv_livingSoulEaters > 0)) {

        lv_livingSoulEaters = libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C;

        auto3E530F6A_ae = libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C;

        lv_itSoulEater = 1;

        for ( ; lv_itSoulEater <= auto3E530F6A_ae ; lv_itSoulEater += 1 ) {

            if ((UnitIsAlive(libMSOC_gv_mMTombSpiderQueenSoulEaters[lv_itSoulEater]) == true)) {

                libMSOC_gf_MMTombSpiderQueenUIUpdateHealthPanels(lv_itSoulEater, (UnitGetPropertyFixed(libMSOC_gv_mMTombSpiderQueenSoulEaters[lv_itSoulEater], c_unitPropLifePercent, c_unitPropCurrent) / 100.0));

            }

            else {

                lv_livingSoulEaters -= 1;

            }

        }

        Wait(0.0625, c_timeGame);

    }

    TriggerExecute(libMSOC_gt_MMTombSpiderQueenSoulEatersareDead, true, false);

}



void libMSOC_gf_MMTombSpiderQueenUpdateCameraLighting (unit lp_heroUnit) {

    // Automatic Variable Declarations

    // Implementation

    if ((libCore_gf_ActorStoredForUnit(lp_heroUnit, 1) == null)) {

        libNtve_gf_AttachActorToUnit(lp_heroUnit, "TombCameraLight", "Ref_Origin");

        libCore_gf_StoreActorForUnit(lp_heroUnit, 1, libNtve_gf_ActorLastCreated());

    }



}



void libMSOC_gf_MMCountsUpdateDisplay (int lp_orderCount, int lp_chaosCount) {

    // Automatic Variable Declarations

    // Implementation

    libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel2[libGame_gv_teamOrderIndex_C], IntToText(lp_orderCount), PlayerGroupAll());

    libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel2[libGame_gv_teamChaosIndex_C], IntToText(lp_chaosCount), PlayerGroupAll());

}



void libMSOC_gf_MMTombSpiderQueenUICheckTurnInStatus (int lp_heldCount, int lp_teamNumber) {

    // Variable Declarations

    int lv_countNeeded;



    // Automatic Variable Declarations

    // Variable Initialization



    // Implementation

    lv_countNeeded = (libMSOC_gv_mMTombSpiderQueenActivationAmountRequired[lp_teamNumber]-libMSOC_gv_mMTombSpiderQueenSoulsTotal[lp_teamNumber]);

    if ((lp_heldCount >= lv_countNeeded)) {

        DialogControlSetAnimationState(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTurninGlow[lp_teamNumber], PlayerGroupAll(), "TurninReady", "IsReady");

        DialogControlSendAnimationEvent(DialogControlLastCreated(), PlayerGroupAll(), "TurninReadyAnim");

        libAIAI_gf_AITeamDelegateAdjustEventCarriedPotentialSufficient(1, lp_teamNumber);

    }

    else {

        DialogControlSetAnimationState(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTurninGlow[lp_teamNumber], PlayerGroupAll(), "TurninReady", "NotReady");

        libAIAI_gf_AITeamDelegateResetEventCarriedPotentialSufficient(lp_teamNumber);

    }

}



void libMSOC_gf_MMTombSpiderQueenUIShowHidePanel (bool lp_showHide) {

    // Automatic Variable Declarations

    // Implementation

    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsPanel, libGame_gv_teams[libGame_gv_teamOrderIndex_C].lv_teamPlayerGroupNoNPCPlayers, lp_showHide);

    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsPanel, libGame_gv_teams[libGame_gv_teamChaosIndex_C].lv_teamPlayerGroupNoNPCPlayers, lp_showHide);

    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsPanel, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], lp_showHide);

}



void libMSOC_gf_MMTombSpiderQueenUIShowHideHealthPanels (bool lp_showHide, int lp_spawningTeam) {

    // Variable Declarations

    int lv_cursedTeam;



    // Automatic Variable Declarations

    // Variable Initialization



    // Implementation

    lv_cursedTeam = libGame_gf_EnemyTeam(lp_spawningTeam);

    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_mainPanel, libGame_gv_teams[lp_spawningTeam].lv_teamPlayerGroupNoNPCPlayers, lp_showHide);

    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_mainPanel, libGame_gv_teams[lv_cursedTeam].lv_teamPlayerGroupNoNPCPlayers, lp_showHide);

    if ((lp_spawningTeam == libGame_gv_teamOrderIndex_C)) {

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_mainPanel, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], lp_showHide);

    }

    else {

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_mainPanel, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], lp_showHide);

    }

    if ((lp_showHide == false)) {

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterEnabled, libCore_gv_allHeroPlayersPlusObserver, false);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, true);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterFlames, libCore_gv_allHeroPlayersPlusObserver, false);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterEnabled, libCore_gv_allHeroPlayersPlusObserver, false);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, true);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterFlames, libCore_gv_allHeroPlayersPlusObserver, false);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterEnabled, libCore_gv_allHeroPlayersPlusObserver, false);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, true);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterFlames, libCore_gv_allHeroPlayersPlusObserver, false);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterEnabled, libCore_gv_allHeroPlayersPlusObserver, false);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, true);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterFlames, libCore_gv_allHeroPlayersPlusObserver, false);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterEnabled, libCore_gv_allHeroPlayersPlusObserver, false);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, true);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterFlames, libCore_gv_allHeroPlayersPlusObserver, false);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterEnabled, libCore_gv_allHeroPlayersPlusObserver, false);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, true);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterFlames, libCore_gv_allHeroPlayersPlusObserver, false);

    }



}



void libMSOC_gf_MMTombSpiderQueenUIUpdateHealthPanels (int lp_soulEaterLane, fixed lp_healthPercent) {

    // Variable Declarations

    int lv_cursedTeam;

    int lv_width_C;

    int lv_height_C;

    int lv_height;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_width_C = 64;

    lv_height_C = 64;



    // Implementation

    lv_cursedTeam = libGame_gf_EnemyTeam(libMSOC_gv_mMTombSpiderQueenSummoningTeam);

    lv_height = FixedToInt((lv_height_C * lp_healthPercent));

    if ((lp_soulEaterLane == 1)) {

        DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterHealth, libGame_gv_teams[libMSOC_gv_mMTombSpiderQueenSummoningTeam].lv_teamPlayerGroupNoNPCPlayers, lv_width_C, lv_height);

        DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterHealth, libGame_gv_teams[lv_cursedTeam].lv_teamPlayerGroupNoNPCPlayers, lv_width_C, lv_height);

        if ((libMSOC_gv_mMTombSpiderQueenSummoningTeam == libGame_gv_teamOrderIndex_C)) {

            DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterHealth, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], lv_width_C, lv_height);

        }

        else {

            DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterHealth, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], lv_width_C, lv_height);

        }

    }

    else if ((lp_soulEaterLane == 2)) {

        DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterHealth, libGame_gv_teams[libMSOC_gv_mMTombSpiderQueenSummoningTeam].lv_teamPlayerGroupNoNPCPlayers, lv_width_C, lv_height);

        DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterHealth, libGame_gv_teams[lv_cursedTeam].lv_teamPlayerGroupNoNPCPlayers, lv_width_C, lv_height);

        if ((libMSOC_gv_mMTombSpiderQueenSummoningTeam == libGame_gv_teamOrderIndex_C)) {

            DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterHealth, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], lv_width_C, lv_height);

        }

        else {

            DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterHealth, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], lv_width_C, lv_height);

        }

    }

    else if ((lp_soulEaterLane == 3)) {

        DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterHealth, libGame_gv_teams[libMSOC_gv_mMTombSpiderQueenSummoningTeam].lv_teamPlayerGroupNoNPCPlayers, lv_width_C, lv_height);

        DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterHealth, libGame_gv_teams[lv_cursedTeam].lv_teamPlayerGroupNoNPCPlayers, lv_width_C, lv_height);

        if ((libMSOC_gv_mMTombSpiderQueenSummoningTeam == libGame_gv_teamOrderIndex_C)) {

            DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterHealth, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], lv_width_C, lv_height);

        }

        else {

            DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterHealth, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], lv_width_C, lv_height);

        }

    }

}



void libMSOC_gf_MMTombSpiderQueenUISetModeForTeam (int lp_mode, int lp_teamThatActivateCage) {

    // Variable Declarations

    int lv_cursedTeam;



    // Automatic Variable Declarations

    int auto710CCD1B_val;



    // Variable Initialization



    // Implementation

    auto710CCD1B_val = lp_mode;

    if (auto710CCD1B_val == libMSOC_ge_MMTombSpiderQueenUIModes_Collecting) {

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterFrame, PlayerGroupAll(), false);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulFrame[libGame_gv_teamOrderIndex_C], PlayerGroupAll(), true);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulFrame[libGame_gv_teamChaosIndex_C], PlayerGroupAll(), true);

    }

    else if (auto710CCD1B_val == libMSOC_ge_MMTombSpiderQueenUIModes_Releasing) {

        lv_cursedTeam = libGame_gf_EnemyTeam(lp_teamThatActivateCage);

        libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterFrameStatusLabel, StringExternal("Param/Value/lib_MSOC_4190C300"), libGame_gf_PlayersOnTeamHeroes(lp_teamThatActivateCage, false));

        libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterFrameStatusLabel, StringExternal("Param/Value/lib_MSOC_F4042460"), libGame_gf_PlayersOnTeamHeroes(lv_cursedTeam, false));

        if ((lp_teamThatActivateCage == 1)) {

            libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterFrameStatusLabel, StringExternal("Param/Value/lib_MSOC_19494423"), libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer]);

        }

        else {

            libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterFrameStatusLabel, StringExternal("Param/Value/lib_MSOC_04031D52"), libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer]);

        }

        libMSOC_gf_MMTombSpiderQueenUIShowHideHealthPanels(true, lp_teamThatActivateCage);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterFrame, PlayerGroupAll(), true);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulFrame[libGame_gv_teamOrderIndex_C], PlayerGroupAll(), false);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulFrame[libGame_gv_teamChaosIndex_C], PlayerGroupAll(), false);

    }

    else if (auto710CCD1B_val == libMSOC_ge_MMTombSpiderQueenUIModes_Active) {

        lv_cursedTeam = libGame_gf_EnemyTeam(lp_teamThatActivateCage);

        libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterFrameStatusLabel, StringExternal("Param/Value/lib_MSOC_D7141111"), libGame_gf_PlayersOnTeamHeroes(lp_teamThatActivateCage, false));

        libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterFrameStatusLabel, StringExternal("Param/Value/lib_MSOC_63475F62"), libGame_gf_PlayersOnTeamHeroes(lv_cursedTeam, false));

        if ((lp_teamThatActivateCage == 1)) {

            libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterFrameStatusLabel, StringExternal("Param/Value/lib_MSOC_E8FAF7E1"), libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer]);

        }

        else {

            libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterFrameStatusLabel, StringExternal("Param/Value/lib_MSOC_A62679E1"), libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer]);

        }

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterFrame, PlayerGroupAll(), true);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulFrame[libGame_gv_teamOrderIndex_C], PlayerGroupAll(), false);

        DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulFrame[libGame_gv_teamChaosIndex_C], PlayerGroupAll(), false);

    }

    else {

    }

}



void libMSOC_gf_MMTombSpiderQueenUISetSoulCountForTeam (int lp_count, int lp_countRequirement, bool lp_onCooldown, int lp_team) {

    // Variable Declarations

    int lv_enemyTeam;



    // Automatic Variable Declarations

    // Variable Initialization



    // Implementation

    lv_enemyTeam = libGame_gf_EnemyTeam(lp_team);

    if ((lp_onCooldown == true)) {

        TextExpressionSetToken("Param/Expression/lib_MSOC_45245A89", "A", IntToText(lp_count));

        TextExpressionSetToken("Param/Expression/lib_MSOC_45245A89", "B", IntToText(lp_countRequirement));

        libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel[lp_team], TextExpressionAssemble("Param/Expression/lib_MSOC_45245A89"), libGame_gf_PlayersOnTeamHeroes(lp_team, false));

    }

    else {

        if ((lp_count >= lp_countRequirement)) {

            TextExpressionSetToken("Param/Expression/lib_MSOC_43184FD7", "A", IntToText(lp_count));

            TextExpressionSetToken("Param/Expression/lib_MSOC_43184FD7", "B", IntToText(lp_countRequirement));

            libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel[lp_team], TextExpressionAssemble("Param/Expression/lib_MSOC_43184FD7"), libGame_gf_PlayersOnTeamHeroes(lp_team, false));

        }

        else {

            TextExpressionSetToken("Param/Expression/lib_MSOC_AC0777C0", "A", IntToText(lp_count));

            TextExpressionSetToken("Param/Expression/lib_MSOC_AC0777C0", "B", IntToText(lp_countRequirement));

            libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel[lp_team], TextExpressionAssemble("Param/Expression/lib_MSOC_AC0777C0"), libGame_gf_PlayersOnTeamHeroes(lp_team, false));

        }

    }

    TextExpressionSetToken("Param/Expression/lib_MSOC_49D734A1", "A", IntToText(lp_count));

    TextExpressionSetToken("Param/Expression/lib_MSOC_49D734A1", "B", IntToText(lp_countRequirement));

    libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel[lp_team], TextExpressionAssemble("Param/Expression/lib_MSOC_49D734A1"), libGame_gf_PlayersOnTeamHeroes(lv_enemyTeam, false));

    if ((lp_team == libGame_gv_teamOrderIndex_C)) {

        if ((lp_onCooldown == true)) {

            TextExpressionSetToken("Param/Expression/lib_MSOC_00A68F4F", "A", IntToText(lp_count));

            TextExpressionSetToken("Param/Expression/lib_MSOC_00A68F4F", "B", IntToText(lp_countRequirement));

            libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel[lp_team], TextExpressionAssemble("Param/Expression/lib_MSOC_00A68F4F"), libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer]);

        }

        else {

            if ((lp_count >= lp_countRequirement)) {

                TextExpressionSetToken("Param/Expression/lib_MSOC_3E8532BA", "A", IntToText(lp_count));

                TextExpressionSetToken("Param/Expression/lib_MSOC_3E8532BA", "B", IntToText(lp_countRequirement));

                libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel[lp_team], TextExpressionAssemble("Param/Expression/lib_MSOC_3E8532BA"), libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer]);

            }

            else {

                TextExpressionSetToken("Param/Expression/lib_MSOC_A8546607", "A", IntToText(lp_count));

                TextExpressionSetToken("Param/Expression/lib_MSOC_A8546607", "B", IntToText(lp_countRequirement));

                libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel[lp_team], TextExpressionAssemble("Param/Expression/lib_MSOC_A8546607"), libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer]);

            }

        }

    }

    else {

        TextExpressionSetToken("Param/Expression/lib_MSOC_54B9F6BB", "A", IntToText(lp_count));

        TextExpressionSetToken("Param/Expression/lib_MSOC_54B9F6BB", "B", IntToText(lp_countRequirement));

        libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel[lp_team], TextExpressionAssemble("Param/Expression/lib_MSOC_54B9F6BB"), libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer]);

    }

}



void libMSOC_gf_MMTombSpiderQueenUIInit (int lp_parentPanel) {

    int init_i;



    // Variable Declarations

    int[6] lv_panels;

    int lv_currentPanelLayer;

    int lv_itTeam;

    int lv_enemyTeam;



    // Automatic Variable Declarations

    const int autoA86C747E_ae = libCore_gv_bALMaxTeams;

    const int autoA86C747E_ai = 1;



    // Variable Initialization

    for (init_i = 0; init_i <= 5; init_i += 1) {

        lv_panels[init_i] = c_invalidDialogControlId;

    }



    // Implementation

    DialogControlCreateInPanelFromTemplate(lp_parentPanel, c_triggerControlTypePanel, "SoulCage/CryptPanel");

    DialogControlSetVisible(DialogControlLastCreated(), PlayerGroupAll(), false);

    lv_currentPanelLayer += 1;

    lv_panels[lv_currentPanelLayer] = DialogControlLastCreated();

    libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsPanel = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "SoulEaterFrame");

    DialogControlSetVisible(DialogControlLastCreated(), PlayerGroupAll(), false);

    lv_currentPanelLayer += 1;

    lv_panels[lv_currentPanelLayer] = DialogControlLastCreated();

    libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterFrame = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypeLabel, "SoulEaterStatusLabel");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterFrameStatusLabel = DialogControlLastCreated();

    lv_currentPanelLayer -= 1;

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "SoulCageCooldownFrame");

    DialogControlSetVisible(DialogControlLastCreated(), PlayerGroupAll(), false);

    lv_currentPanelLayer += 1;

    lv_panels[lv_currentPanelLayer] = DialogControlLastCreated();

    libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterCooldownFrame = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypeLabel, "SoulEaterTimerLabel");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterCooldownLabel = DialogControlLastCreated();

    lv_currentPanelLayer -= 1;

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "SoulEaterModeBlueFrame");

    DialogControlSetVisible(DialogControlLastCreated(), PlayerGroupAll(), false);

    lv_currentPanelLayer += 1;

    lv_panels[lv_currentPanelLayer] = DialogControlLastCreated();

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_mainPanel = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "TopSoulEaterEnabled");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterEnabled = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "TopSoulEaterHealth");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterHealth = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "TopFireEffect");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterFlames = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "MidSoulEaterEnabled");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterEnabled = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "MidSoulEaterHealth");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterHealth = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "MidFireEffect");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterFlames = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "BottomSoulEaterEnabled");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterEnabled = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "BottomSoulEaterHealth");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterHealth = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "BottomFireEffect");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterFlames = DialogControlLastCreated();

    lv_currentPanelLayer -= 1;

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "SoulEaterModeRedFrame");

    DialogControlSetVisible(DialogControlLastCreated(), PlayerGroupAll(), false);

    lv_currentPanelLayer += 1;

    lv_panels[lv_currentPanelLayer] = DialogControlLastCreated();

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_mainPanel = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "TopSoulEaterEnabled");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterEnabled = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "TopSoulEaterHealth");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterHealth = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "TopFireEffect");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterFlames = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "MidSoulEaterEnabled");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterEnabled = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "MidSoulEaterHealth");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterHealth = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "MidFireEffect");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterFlames = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "BottomSoulEaterEnabled");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterEnabled = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "BottomSoulEaterHealth");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterHealth = DialogControlLastCreated();

    DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "BottomFireEffect");

    libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterFlames = DialogControlLastCreated();

    lv_currentPanelLayer -= 1;

    lv_itTeam = 1;

    for ( ; ( (autoA86C747E_ai >= 0 && lv_itTeam <= autoA86C747E_ae) || (autoA86C747E_ai < 0 && lv_itTeam >= autoA86C747E_ae) ) ; lv_itTeam += autoA86C747E_ai ) {

        lv_enemyTeam = libGame_gf_EnemyTeam(lv_itTeam);

        DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "Team" + IntToString(lv_itTeam) + "SoulFrame");

        DialogControlSetVisible(DialogControlLastCreated(), PlayerGroupAll(), false);

        lv_currentPanelLayer += 1;

        lv_panels[lv_currentPanelLayer] = DialogControlLastCreated();

        libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulFrame[lv_itTeam] = DialogControlLastCreated();

        DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypeLabel, "SoulCounter");

        libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel[lv_itTeam] = DialogControlLastCreated();

        DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypePanel, "MapMechanicGlowContainer");

        libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTurninGlow[lv_itTeam] = DialogControlLastCreated();

        DialogControlSetAnimationState(DialogControlLastCreated(), PlayerGroupAll(), "TurninReady", "NotReady");

        DialogControlHookup(lv_panels[lv_currentPanelLayer], c_triggerControlTypeLabel, "TeamSoulCounter");

        libNtve_gf_SetDialogItemText(DialogControlLastCreated(), IntToText(0), PlayerGroupAll());

        libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel2[lv_itTeam] = DialogControlLastCreated();

        lv_currentPanelLayer -= 1;

    }

    libNtve_gf_SetDialogItemStyle(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel[libGame_gv_teamOrderIndex_C], "Storm_MapMechanic_MechanicCounterLeft_Red", libGame_gv_teams[libGame_gv_teamChaosIndex_C].lv_teamPlayerGroupNoNPCPlayers);

    libNtve_gf_SetDialogItemStyle(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel[libGame_gv_teamChaosIndex_C], "Storm_MapMechanic_MechanicCounterRight_Blue", libGame_gv_teams[libGame_gv_teamChaosIndex_C].lv_teamPlayerGroupNoNPCPlayers);

    libNtve_gf_SetDialogItemStyle(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel2[libGame_gv_teamOrderIndex_C], "Storm_ObserverMMCountLabel_Red", libGame_gv_teams[libGame_gv_teamChaosIndex_C].lv_teamPlayerGroupNoNPCPlayers);

    libNtve_gf_SetDialogItemStyle(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsTeamSoulCounterLabel2[libGame_gv_teamChaosIndex_C], "Storm_ObserverMMCountLabel_Blue", libGame_gv_teams[libGame_gv_teamChaosIndex_C].lv_teamPlayerGroupNoNPCPlayers);

}



trigger auto_libMSOC_gf_MMTombSpiderQueenSoulEaterSummoningUI_Trigger = null;

int auto_libMSOC_gf_MMTombSpiderQueenSoulEaterSummoningUI_lp_team;



void libMSOC_gf_MMTombSpiderQueenSoulEaterSummoningUI (int lp_team) {

    auto_libMSOC_gf_MMTombSpiderQueenSoulEaterSummoningUI_lp_team = lp_team;



    if (auto_libMSOC_gf_MMTombSpiderQueenSoulEaterSummoningUI_Trigger == null) {

        auto_libMSOC_gf_MMTombSpiderQueenSoulEaterSummoningUI_Trigger = TriggerCreate("auto_libMSOC_gf_MMTombSpiderQueenSoulEaterSummoningUI_TriggerFunc");

    }



    TriggerExecute(auto_libMSOC_gf_MMTombSpiderQueenSoulEaterSummoningUI_Trigger, false, false);

}



bool auto_libMSOC_gf_MMTombSpiderQueenSoulEaterSummoningUI_TriggerFunc (bool testConds, bool runActions) {

    int lp_team = auto_libMSOC_gf_MMTombSpiderQueenSoulEaterSummoningUI_lp_team;



    // Variable Declarations

    int lv_enemyTeam;

    int lv_soulEaterTeam;

    unit lv_tempUnit;

    fixed lv_current;

    int lv_itSoulEater;



    // Automatic Variable Declarations

    const int autoD67EF3B7_ae = libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C;

    const int autoD67EF3B7_ai = 1;



    // Variable Initialization



    // Implementation

    libNtve_gf_CreateUnitsWithDefaultFacing(1, "JungleCampIconUnit", c_unitCreateIgnorePlacement, libGame_gf_ComputerPlayerInTeam(lp_team), Point(0.0, 0.0), null);

    lv_tempUnit = UnitLastCreated();

    libNtve_gf_ShowHideUnit(UnitLastCreated(), false);

    libNtve_gf_MakeUnitInvulnerable(UnitLastCreated(), true);

    libNtve_gf_PauseUnit(UnitLastCreated(), true);

    libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "SetMinimapVisibility");

    libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "SetMinimapVisibilityAlways");

    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, (libMSOC_gv_mMTombSpiderQueenSoulEaterSummonTime/0.125));

    UnitSetPropertyFixed(UnitLastCreated(), c_unitPropLifePercent, 0.1);

    while (true) {

        lv_current = (TimerGetElapsed(libMSOC_gv_mMTombSpiderQueenSoulEaterSummonTimer)*100/libMSOC_gv_mMTombSpiderQueenSoulEaterSummonTime);

        if ((lv_current > 0.1)) {

            UnitSetPropertyFixed(lv_tempUnit, c_unitPropLifePercent, lv_current);

        }



        Wait(0.125, c_timeGame);

        if ((TimerGetRemaining(libMSOC_gv_mMTombSpiderQueenSoulEaterSummonTimer) == 0.0)) {

            break;

        }



    }

    while (true) {

        lv_itSoulEater = 1;

        for ( ; ( (autoD67EF3B7_ai >= 0 && lv_itSoulEater <= autoD67EF3B7_ae) || (autoD67EF3B7_ai < 0 && lv_itSoulEater >= autoD67EF3B7_ae) ) ; lv_itSoulEater += autoD67EF3B7_ai ) {

            if ((UnitIsAlive(libMSOC_gv_mMTombSpiderQueenSoulEaters[lv_itSoulEater]) == false)) {

                Wait(0.25, c_timeGame);

                continue;

            }



        }

        break;

    }

    UnitRemove(lv_tempUnit);

    return true;

}



trigger auto_libMSOC_gf_MMTombSpiderQueenSoulEaterUI_Trigger = null;

int auto_libMSOC_gf_MMTombSpiderQueenSoulEaterUI_lp_team;



void libMSOC_gf_MMTombSpiderQueenSoulEaterUI (int lp_team) {

    auto_libMSOC_gf_MMTombSpiderQueenSoulEaterUI_lp_team = lp_team;



    if (auto_libMSOC_gf_MMTombSpiderQueenSoulEaterUI_Trigger == null) {

        auto_libMSOC_gf_MMTombSpiderQueenSoulEaterUI_Trigger = TriggerCreate("auto_libMSOC_gf_MMTombSpiderQueenSoulEaterUI_TriggerFunc");

    }



    TriggerExecute(auto_libMSOC_gf_MMTombSpiderQueenSoulEaterUI_Trigger, false, false);

}



bool auto_libMSOC_gf_MMTombSpiderQueenSoulEaterUI_TriggerFunc (bool testConds, bool runActions) {

    int lp_team = auto_libMSOC_gf_MMTombSpiderQueenSoulEaterUI_lp_team;



    // Variable Declarations

    unit lv_tempUnit;

    fixed lv_current;

    int lv_itSoulEater;



    // Automatic Variable Declarations

    const int auto2F54662F_ae = libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C;

    const int auto2F54662F_ai = 1;

    const int auto86A9CCF7_ae = libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C;

    const int auto86A9CCF7_ai = 1;



    // Variable Initialization



    // Implementation

    while (true) {

        lv_itSoulEater = 1;

        for ( ; ( (auto2F54662F_ai >= 0 && lv_itSoulEater <= auto2F54662F_ae) || (auto2F54662F_ai < 0 && lv_itSoulEater >= auto2F54662F_ae) ) ; lv_itSoulEater += auto2F54662F_ai ) {

            if ((UnitIsAlive(libMSOC_gv_mMTombSpiderQueenSoulEaters[lv_itSoulEater]) == false)) {

                Wait(0.5, c_timeGame);

                continue;

            }



        }

        break;

    }

    libNtve_gf_CreateUnitsWithDefaultFacing(1, "JungleCampIconUnit", c_unitCreateIgnorePlacement, libGame_gf_ComputerPlayerInTeam(lp_team), Point(0.0, 0.0), null);

    lv_tempUnit = UnitLastCreated();

    libNtve_gf_ShowHideUnit(UnitLastCreated(), false);

    libNtve_gf_MakeUnitInvulnerable(UnitLastCreated(), true);

    libNtve_gf_PauseUnit(UnitLastCreated(), true);

    libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "SetMinimapVisibility");

    libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "SetMinimapVisibilityAlways");

    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, (UnitGetPropertyFixed(libMSOC_gv_mMTombSpiderQueenSoulEaters[1], c_unitPropLifeMax, c_unitPropCurrent)*libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C));

    UnitSetPropertyFixed(UnitLastCreated(), c_unitPropLifePercent, 0.1);

    while (true) {

        lv_current = 0.0;

        lv_itSoulEater = 1;

        for ( ; ( (auto86A9CCF7_ai >= 0 && lv_itSoulEater <= auto86A9CCF7_ae) || (auto86A9CCF7_ai < 0 && lv_itSoulEater >= auto86A9CCF7_ae) ) ; lv_itSoulEater += auto86A9CCF7_ai ) {

            if ((UnitIsAlive(libMSOC_gv_mMTombSpiderQueenSoulEaters[lv_itSoulEater]) == true)) {

                lv_current += UnitGetPropertyFixed(libMSOC_gv_mMTombSpiderQueenSoulEaters[lv_itSoulEater], c_unitPropLife, c_unitPropCurrent);

            }



        }

        UnitSetPropertyFixed(lv_tempUnit, c_unitPropLife, lv_current);

        Wait(0.5, c_timeGame);

        if ((lv_current == 0.0)) {

            break;

        }



    }

    UnitRemove(lv_tempUnit);

    return true;

}



trigger auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulCageActivatedQ_Trigger = null;

int auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulCageActivatedQ_lp_team;



void libMSOC_gf_MMTombSpiderQueenTransmissionSoulCageActivatedQ (int lp_team) {

    auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulCageActivatedQ_lp_team = lp_team;



    if (auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulCageActivatedQ_Trigger == null) {

        auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulCageActivatedQ_Trigger = TriggerCreate("auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulCageActivatedQ_TriggerFunc");

    }



    TriggerExecute(auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulCageActivatedQ_Trigger, false, false);

}



bool auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulCageActivatedQ_TriggerFunc (bool testConds, bool runActions) {

    int lp_team = auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulCageActivatedQ_lp_team;



    // Automatic Variable Declarations

    // Implementation

    if ((libGame_gv_gameOver == true)) {

        return true;

    }



    UserDataResetType("MapVOEvent");

    UserDataSetInt("MapVOEvent", "TurnInActivation", "Value", 1, 1);

    if ((libMSOC_gv_mMTombSpiderQueenFirstActivation == true)) {

        UserDataSetInt("MapVOEvent", "TurnInActivationFirstTime", "Value", 1, 1);

    }



    ConversationDataRun("SoulCageVO", PlayerGroupAll(), c_conversationSkipFull, true);

    return true;

}



trigger auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawnQ_Trigger = null;

int auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawnQ_lp_summoningTeam;



void libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawnQ (int lp_summoningTeam) {

    auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawnQ_lp_summoningTeam = lp_summoningTeam;



    if (auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawnQ_Trigger == null) {

        auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawnQ_Trigger = TriggerCreate("auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawnQ_TriggerFunc");

    }



    TriggerExecute(auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawnQ_Trigger, false, false);

}



bool auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawnQ_TriggerFunc (bool testConds, bool runActions) {

    int lp_summoningTeam = auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawnQ_lp_summoningTeam;



    // Variable Declarations

    playergroup lv_summoningPlayers;

    playergroup lv_enemyPlayers;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_summoningPlayers = PlayerGroupEmpty();

    lv_enemyPlayers = PlayerGroupEmpty();



    // Implementation

    if ((libGame_gv_gameOver == true)) {

        return true;

    }



    TriggerQueueEnter();

    UserDataResetType("MapVOEvent");

    UserDataSetInt("MapVOEvent", "SpiderSpawnAlly", "Value", 1, 1);

    ConversationDataLineResetPlayers("SoulCageVO", ("AllyOnly"));

    ConversationDataLineResetPlayers("SoulCageVO", ("EnemyOnly"));

    ConversationDataLineResetPlayers("SoulCageVO", ("Observer"));

    lv_summoningPlayers = libGame_gf_PlayersOnTeamHeroes(lp_summoningTeam, false);

    lv_enemyPlayers = libGame_gf_PlayersOnTeamHeroes(libGame_gf_EnemyTeam(lp_summoningTeam), false);

    ConversationDataLineSetPlayers("SoulCageVO", ("Observer"), PlayerGroupSingle(libCore_gv_oBSERVER_ObserverUIPlayer));

    ConversationDataLineSetPlayers("SoulCageVO", ("AllyOnly"), lv_summoningPlayers);

    ConversationDataLineSetPlayers("SoulCageVO", ("EnemyOnly"), lv_enemyPlayers);

    if ((lp_summoningTeam == libGame_gv_teamOrderIndex_C)) {

        UserDataSetInt("MapVOEvent", "SpiderSpawnedBlue", "Value", 1, 1);

    }

    else {

        UserDataSetInt("MapVOEvent", "SpiderSpawnedRed", "Value", 1, 1);

    }

    ConversationDataRun("SoulCageVO", PlayerGroupAll(), c_conversationSkipNone, false);

    libCore_gf_WaitForConversationToFinish();

    TriggerQueueExit();

    return true;

}



trigger auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawningQ_Trigger = null;

int auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawningQ_lp_summoningTeam;



void libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawningQ (int lp_summoningTeam) {

    auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawningQ_lp_summoningTeam = lp_summoningTeam;



    if (auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawningQ_Trigger == null) {

        auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawningQ_Trigger = TriggerCreate("auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawningQ_TriggerFunc");

    }



    TriggerExecute(auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawningQ_Trigger, false, false);

}



bool auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawningQ_TriggerFunc (bool testConds, bool runActions) {

    int lp_summoningTeam = auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawningQ_lp_summoningTeam;



    // Variable Declarations

    playergroup lv_summoningPlayers;

    playergroup lv_enemyPlayers;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_summoningPlayers = PlayerGroupEmpty();

    lv_enemyPlayers = PlayerGroupEmpty();



    // Implementation

    if ((libGame_gv_gameOver == true)) {

        return true;

    }



    TriggerQueueEnter();

    UserDataResetType("MapVOEvent");

    UserDataSetInt("MapVOEvent", "TurnInComplete", "Value", 1, 1);

    ConversationDataLineResetPlayers("SoulCageVO", ("AllyOnly"));

    ConversationDataLineResetPlayers("SoulCageVO", ("EnemyOnly"));

    ConversationDataLineResetPlayers("SoulCageVO", ("Observer"));

    lv_summoningPlayers = libGame_gf_PlayersOnTeamHeroes(lp_summoningTeam, false);

    lv_enemyPlayers = libGame_gf_PlayersOnTeamHeroes(libGame_gf_EnemyTeam(lp_summoningTeam), false);

    ConversationDataLineSetPlayers("SoulCageVO", ("Observer"), PlayerGroupSingle(libCore_gv_oBSERVER_ObserverUIPlayer));

    ConversationDataLineSetPlayers("SoulCageVO", ("AllyOnly"), lv_summoningPlayers);

    ConversationDataLineSetPlayers("SoulCageVO", ("EnemyOnly"), lv_enemyPlayers);

    if ((lp_summoningTeam == libGame_gv_teamOrderIndex_C)) {

        UserDataSetInt("MapVOEvent", "SpiderSpawningBlue", "Value", 1, 1);

    }

    else {

        UserDataSetInt("MapVOEvent", "SpiderSpawningRed", "Value", 1, 1);

    }

    ConversationDataRun("SoulCageVO", PlayerGroupAll(), c_conversationSkipNone, false);

    libCore_gf_WaitForConversationToFinish();

    TriggerQueueExit();

    return true;

}



trigger auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersAreDeadQ_Trigger = null;



void libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersAreDeadQ () {

    if (auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersAreDeadQ_Trigger == null) {

        auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersAreDeadQ_Trigger = TriggerCreate("auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersAreDeadQ_TriggerFunc");

    }



    TriggerExecute(auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersAreDeadQ_Trigger, false, false);

}



bool auto_libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersAreDeadQ_TriggerFunc (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Implementation

    if ((libGame_gv_gameOver == true)) {

        return true;

    }



    TriggerQueueEnter();

    UserDataResetType("MapVOEvent");

    UserDataSetInt("MapVOEvent", "SpiderDead", "Value", 1, 1);

    ConversationDataRun("SoulCageVO", PlayerGroupAll(), c_conversationSkipFull, true);

    TriggerQueueExit();

    return true;

}



// Triggers

//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Announcer Init

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenAnnouncerInit_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Actions

    if (!runActions) {

        return true;

    }



    libCore_gf_DataAnnouncerVOSetDefaultAnnouncerForPlayerGroup(PlayerGroupAll(), "SpiderQueen");

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenAnnouncerInit_Init () {

    libMSOC_gt_MMTombSpiderQueenAnnouncerInit = TriggerCreate("libMSOC_gt_MMTombSpiderQueenAnnouncerInit_Func");

    libCore_gf_IncludeModInitialization(libMSOC_gt_MMTombSpiderQueenAnnouncerInit);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Init

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenInit_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_itPlayer;



    // Automatic Variable Declarations

    const int auto92016066_ae = libCore_gv_bALMaxPlayers;

    const int auto92016066_ai = 1;



    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((libGame_gf_MapMechanicInitializationMechanicType() == libMSOC_gv_mMTombSpiderQueenMechanicName_C))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    TriggerEnable(libMSOC_gt_MMTombSpiderQueenGateOpen, true);

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenSpawnSoulsCarrierDies, true);

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenDebugShowSoulsCollected, true);

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenHandInSouls, true);

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenSoulEatersareDead, true);

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenSpawnSoulsHeroDies, true);

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenDebugKillSouleaters, true);

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenDebugEventStart, true);

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenGameOver, true);

    TriggerExecute(libMSOC_gt_MMTombSpiderQueenUILightingInit, true, false);

    lv_itPlayer = 1;

    for ( ; ( (auto92016066_ai >= 0 && lv_itPlayer <= auto92016066_ae) || (auto92016066_ai < 0 && lv_itPlayer >= auto92016066_ae) ) ; lv_itPlayer += auto92016066_ai ) {

        CatalogFieldValueSet(c_gameCatalogEffect, "CaptureMacGuffin", "PeriodCount", lv_itPlayer, "40");

    }

    libMSOC_gv_mMTombSpiderQueenActivationAmountRequired[1] = libMSOC_gv_mMTombSpiderQueenActivationAmountStart_C;

    libMSOC_gv_mMTombSpiderQueenActivationAmountRequired[2] = libMSOC_gv_mMTombSpiderQueenActivationAmountStart_C;

    libGame_gf_SendMapSpecificAwardInitializeEventwithUserData(null, "Generic Instance");

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenInit_Init () {

    libMSOC_gt_MMTombSpiderQueenInit = TriggerCreate("libMSOC_gt_MMTombSpiderQueenInit_Func");

    libGame_gf_MapMechanicInitialization(libMSOC_gt_MMTombSpiderQueenInit);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Ping Data Init

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenPingDataInit_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Actions

    if (!runActions) {

        return true;

    }



    libUIUI_gf_PingCreateNewPingTarget("SoulCage", false, null, StringExternal("Param/Value/lib_MSOC_C95A8663"), StringExternal("Param/Value/lib_MSOC_C20D0E3E"), SoundLink("UI_Game_Ping_Attack", -1), SoundLink("UI_Game_Ping_Attack", -1));

    libUIUI_gf_PingCreateNewPingTarget("SoulEater", false, null, StringExternal("Param/Value/lib_MSOC_CF793840"), StringExternal("Param/Value/lib_MSOC_3E9A7A69"), SoundLink("UI_Game_Ping_Help", -1), SoundLink("UI_Game_Ping_Attack", -1));

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenPingDataInit_Init () {

    libMSOC_gt_MMTombSpiderQueenPingDataInit = TriggerCreate("libMSOC_gt_MMTombSpiderQueenPingDataInit_Func");

    libCore_gf_IncludeModInitialization(libMSOC_gt_MMTombSpiderQueenPingDataInit);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen UI Lighting Init

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenUILightingInit_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_itPlayer;



    // Automatic Variable Declarations

    const int auto97FD83F1_ae = libCore_gv_bALMaxPlayers;

    const int auto97FD83F1_ai = 1;



    // Variable Initialization



    // Actions

    if (!runActions) {

        return true;

    }



    lv_itPlayer = 1;

    for ( ; ( (auto97FD83F1_ai >= 0 && lv_itPlayer <= auto97FD83F1_ae) || (auto97FD83F1_ai < 0 && lv_itPlayer >= auto97FD83F1_ae) ) ; lv_itPlayer += auto97FD83F1_ai ) {

        libUIUI_gf_VignetteOverlayPlayForPlayer(lv_itPlayer, "Cutscenes\\GameUI_SoulCageVignetteOverlay.StormCutscene");

    }

    libUIUI_gf_VignetteOverlayPlayForPlayer(libCore_gv_oBSERVER_ObserverUIPlayer, "Cutscenes\\GameUI_SoulCageVignetteOverlay.StormCutscene");

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenUILightingInit_Init () {

    libMSOC_gt_MMTombSpiderQueenUILightingInit = TriggerCreate("libMSOC_gt_MMTombSpiderQueenUILightingInit_Func");

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Gate Open

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenGateOpen_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_itTeam;

    int lv_teamEnemy;

    playergroup lv_playersAlly;

    playergroup lv_playersEnemy;

    int lv_itPlayer;

    unit lv_itHero;

    int lv_itSoulCage;



    // Automatic Variable Declarations

    int auto27E28056_n;

    int auto27E28056_i;

    const int auto1216C5EB_ae = libMSOC_gv_mMTombSpiderQueenCount_C;

    const int auto1216C5EB_ai = 1;

    const int auto02BA95BE_ae = libMSOC_gv_mMTombSpiderQueenCount_C;

    const int auto02BA95BE_ai = 1;

    const int auto654582D0_ae = 2;

    const int auto654582D0_ai = 1;



    // Variable Initialization

    lv_playersAlly = PlayerGroupEmpty();

    lv_playersEnemy = PlayerGroupEmpty();



    // Conditions

    if (testConds) {

        if (!((libMapM_gv_mMMapMechanicDisabled == false))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    TimerStart(libMSOC_gv_mMTombSpiderQueenSandGolemInitialTimer, libMSOC_gv_mMTombSpiderQueenSandGolemInitialTimerDuration_C, false, c_timeGame);

    auto27E28056_n = FixedToInt((libMSOC_gv_mMTombSpiderQueenSpawnTimer_C - 4.0));

    for (auto27E28056_i = 1; auto27E28056_i <= auto27E28056_n; auto27E28056_i += 1) {

        if ((libMSOC_gv_mMTombSpiderQueenEventStartOn == true)) {

            break;

        }



        Wait(1.0, c_timeGame);

    }

    if ((libMSOC_gv_mMTombSpiderQueenDisableEvent == true)) {

        return true;

    }



    libMSOC_gf_MMTombSpiderQueenAnimationHandlerMain(libMSOC_ge_MMTombSpiderQueenAnimStates_Active);

    Wait(4.0, c_timeGame);

    TriggerExecute(libMSOC_gt_MMTombSpiderQueenUIHandler, true, false);

    lv_itSoulCage = 1;

    for ( ; ( (auto1216C5EB_ai >= 0 && lv_itSoulCage <= auto1216C5EB_ae) || (auto1216C5EB_ai < 0 && lv_itSoulCage >= auto1216C5EB_ae) ) ; lv_itSoulCage += auto1216C5EB_ai ) {

        UnitBehaviorAdd(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units, "MacguffinActivated", libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units, 1);

        UnitSetState(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units, c_unitStateHighlightable, true);

        libMSOC_gf_MMTombSpiderQueenEnableDisableTurnInGoals(true, libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units);

    }

    libMSOC_gf_MMTombSpiderQueenTransmissionSoulCageActivatedQ(0);

    lv_itSoulCage = 1;

    for ( ; ( (auto02BA95BE_ai >= 0 && lv_itSoulCage <= auto02BA95BE_ae) || (auto02BA95BE_ai < 0 && lv_itSoulCage >= auto02BA95BE_ae) ) ; lv_itSoulCage += auto02BA95BE_ai ) {

        libCore_gf_CreateMinimapPingStorm(PlayerGroupAll(), "StormAlert", UnitGetPosition(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units), ColorWithAlpha(13.33, 82.75, 9.41, 0.00), 6.0);

    }

    lv_itTeam = 1;

    for ( ; ( (auto654582D0_ai >= 0 && lv_itTeam <= auto654582D0_ae) || (auto654582D0_ai < 0 && lv_itTeam >= auto654582D0_ae) ) ; lv_itTeam += auto654582D0_ai ) {

        libMSOC_gf_MMTombSpiderQueenUpdateSouls(lv_itTeam);

        libMSOC_gf_MMTombSpiderQueenUpdateSoulPing(lv_itTeam);

    }

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenGateOpen_Init () {

    libMSOC_gt_MMTombSpiderQueenGateOpen = TriggerCreate("libMSOC_gt_MMTombSpiderQueenGateOpen_Func");

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenGateOpen, false);

    TriggerAddEventTimer(libMSOC_gt_MMTombSpiderQueenGateOpen, libGame_gv_openTheGatesTimer);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Game Over

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenGameOver_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_itPlayer;



    // Automatic Variable Declarations

    const int autoC06D013A_ae = libCore_gv_bALMaxPlayers;

    const int autoC06D013A_ai = 1;



    // Variable Initialization



    // Actions

    if (!runActions) {

        return true;

    }



    lv_itPlayer = 1;

    for ( ; ( (autoC06D013A_ai >= 0 && lv_itPlayer <= autoC06D013A_ae) || (autoC06D013A_ai < 0 && lv_itPlayer >= autoC06D013A_ae) ) ; lv_itPlayer += autoC06D013A_ai ) {

        libGame_gf_ScoreValuesReportIntegerValueAndLog(lv_itPlayer, "GemsTurnedIn", libMSOC_gv_mMTombSpiderQueenTotalGemsTurnedIn[lv_itPlayer]);

    }

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenGameOver_Init () {

    libMSOC_gt_MMTombSpiderQueenGameOver = TriggerCreate("libMSOC_gt_MMTombSpiderQueenGameOver_Func");

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenGameOver, false);

    libGame_gf_GameOverEvent(libMSOC_gt_MMTombSpiderQueenGameOver);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Sand Golem Defender Spawns

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenSandGolemDefenderSpawns_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Conditions

    if (testConds) {

        if (!((UnitGetType(EventUnit()) == "JungleGraveGolemDefender"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libMSOC_gv_mMTombSpiderQueenSandGolem = EventUnit();

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenSandGolemDefenderSpawns_Init () {

    libMSOC_gt_MMTombSpiderQueenSandGolemDefenderSpawns = TriggerCreate("libMSOC_gt_MMTombSpiderQueenSandGolemDefenderSpawns_Func");

    TriggerAddEventUnitRangePoint(libMSOC_gt_MMTombSpiderQueenSandGolemDefenderSpawns, null, Point(124.0, 156.0), 1.0, true);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Sand Golem Laner Spawns

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenSandGolemLanerSpawns_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Conditions

    if (testConds) {

        if (!((UnitGetType(EventUnit()) == "JungleGraveGolemLaner"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    TimerStart(libMSOC_gv_mMTombSpiderQueenSandGolemDeathTimer, libMSOC_gv_mMTombSpiderQueenSandGolemDeathTimerDuration_C, false, c_timeGame);

    libMSOC_gv_mMTombSpiderQueenSandGolemDeathLocation = UnitGetPosition(EventUnit());

    Wait(6.0, c_timeGame);

    libCore_gf_SendActorMessageToDoodadsInRegion("Signal Close", RegionCircle(Point(124.0, 156.0), 20.0), "Storm_Doodad_LuxCrypt_ThroneRoom");

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenSandGolemLanerSpawns_Init () {

    libMSOC_gt_MMTombSpiderQueenSandGolemLanerSpawns = TriggerCreate("libMSOC_gt_MMTombSpiderQueenSandGolemLanerSpawns_Func");

    TriggerAddEventUnitRangePoint(libMSOC_gt_MMTombSpiderQueenSandGolemLanerSpawns, null, Point(124.0, 156.0), 1.0, true);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Sand Golem Death Timer Expires

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenSandGolemDeathTimerExpires_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Actions

    if (!runActions) {

        return true;

    }



    libCore_gf_SendActorMessageToDoodadsInRegion("Signal Open", RegionCircle(Point(124.0, 156.0), 20.0), "Storm_Doodad_LuxCrypt_ThroneRoom");

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenSandGolemDeathTimerExpires_Init () {

    libMSOC_gt_MMTombSpiderQueenSandGolemDeathTimerExpires = TriggerCreate("libMSOC_gt_MMTombSpiderQueenSandGolemDeathTimerExpires_Func");

    TriggerAddEventTimer(libMSOC_gt_MMTombSpiderQueenSandGolemDeathTimerExpires, libMSOC_gv_mMTombSpiderQueenSandGolemDeathTimer);

    TriggerAddEventTimer(libMSOC_gt_MMTombSpiderQueenSandGolemDeathTimerExpires, libMSOC_gv_mMTombSpiderQueenSandGolemInitialTimer);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Soul Eaters Died

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenSoulEatersDied_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Actions

    if (!runActions) {

        return true;

    }



    libMSOC_gf_MMTombSpiderQueenAnimationHandlerMain(libMSOC_ge_MMTombSpiderQueenAnimStates_Active);

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenSoulEatersDied_Init () {

    libMSOC_gt_MMTombSpiderQueenSoulEatersDied = TriggerCreate("libMSOC_gt_MMTombSpiderQueenSoulEatersDied_Func");

    TriggerAddEventTimer(libMSOC_gt_MMTombSpiderQueenSoulEatersDied, libMSOC_gv_mMTombSpiderQueenAnimationHandlerTimer);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Spawn Souls Carrier Dies

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenSpawnSoulsCarrierDies_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Conditions

    if (testConds) {

        if (!((libMapM_gv_mMMapMechanicDisabled == false))) {

            return false;

        }



        if (!((UnitGetType(EventPlayerEffectUsedUnit(c_effectUnitCaster)) == "RangedMinion"))) {

            return false;

        }



        if (!((UnitHasBehavior2(EventPlayerEffectUsedUnit(c_effectUnitCaster), "SuppressGemCreation") == false))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libMSOC_gf_MMTombSpiderQueenDropSoulsForEnemy(UnitGetPosition(EventPlayerEffectUsedUnit(c_effectUnitCaster)), libMSOC_gv_mMTombSpiderQueenMinionPriest_C, false, UnitGetOwner(EventPlayerEffectUsedUnit(c_effectUnitCaster)));

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenSpawnSoulsCarrierDies_Init () {

    libMSOC_gt_MMTombSpiderQueenSpawnSoulsCarrierDies = TriggerCreate("libMSOC_gt_MMTombSpiderQueenSpawnSoulsCarrierDies_Func");

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenSpawnSoulsCarrierDies, false);

    TriggerAddEventPlayerEffectUsed(libMSOC_gt_MMTombSpiderQueenSpawnSoulsCarrierDies, c_playerAny, "FlagbearerResponseDummy");

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Spawn Souls NPC Mind Controlled

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenSpawnSoulsNPCMindControlled_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Conditions

    if (testConds) {

        if (!((UnitGetType(libGame_gf_HeroMindControlsNPCNPCUnit()) == "RangedMinion"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    UnitBehaviorAdd(libGame_gf_HeroMindControlsNPCNPCUnit(), "SuppressGemCreation", libGame_gf_HeroMindControlsNPCNPCUnit(), 1);

    libMSOC_gf_MMTombSpiderQueenDropSoulsForEnemy(UnitGetPosition(libGame_gf_HeroMindControlsNPCNPCUnit()), libMSOC_gv_mMTombSpiderQueenMinionPriest_C, false, libGame_gf_HeroMindControlsNPCOriginalOwner());

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenSpawnSoulsNPCMindControlled_Init () {

    libMSOC_gt_MMTombSpiderQueenSpawnSoulsNPCMindControlled = TriggerCreate("libMSOC_gt_MMTombSpiderQueenSpawnSoulsNPCMindControlled_Func");

    libGame_gf_HeroMindControlsNPC(libMSOC_gt_MMTombSpiderQueenSpawnSoulsNPCMindControlled);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Spawn Souls Hero Dies

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenSpawnSoulsHeroDies_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_deadHero;

    int lv_dropCount;

    bool lv_furtherDrop;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_deadHero = libGame_gf_HeroKilledUnit();



    // Actions

    if (!runActions) {

        return true;

    }



    if (((UnitGetType(lv_deadHero) == "HeroMurky") || (UnitGetType(lv_deadHero) == "HeroOlaf") || (UnitGetType(lv_deadHero) == "HeroErik") || (UnitGetType(lv_deadHero) == "HeroBaleog"))) {

        lv_dropCount = libMSOC_gv_mMTombSpiderQueenMinionPriest_C;

        lv_furtherDrop = false;

    }

    else {

        lv_dropCount = libMSOC_gv_mMTombSpiderQueenHeroGem_C;

        lv_furtherDrop = true;

    }

    libMSOC_gf_MMTombSpiderQueenDropSoulsForEnemy(libGame_gf_HeroKilledLocation(), lv_dropCount, lv_furtherDrop, libGame_gf_HeroKilledPlayer());

    libMSOC_gf_MMTombSpiderQueenDropSoulsForAlly(libGame_gf_HeroKilledLocation(), libMSOC_gf_MMTombSpiderQueenGetGemsHeldforUnit(lv_deadHero), true, libGame_gf_HeroKilledPlayer());

    UnitBehaviorRemove(lv_deadHero, "MapMechanicStack", UnitBehaviorCount(lv_deadHero, "MapMechanicStack"));

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenSpawnSoulsHeroDies_Init () {

    libMSOC_gt_MMTombSpiderQueenSpawnSoulsHeroDies = TriggerCreate("libMSOC_gt_MMTombSpiderQueenSpawnSoulsHeroDies_Func");

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenSpawnSoulsHeroDies, false);

    libGame_gf_HeroKilled(libMSOC_gt_MMTombSpiderQueenSpawnSoulsHeroDies);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Soul Spawned

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenSoulSpawned_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_gemUnit;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_gemUnit = EventUnit();



    // Actions

    if (!runActions) {

        return true;

    }



    if ((UnitGetType(lv_gemUnit) == "ItemSoulPickup")) {

        AIAddCollectable(lv_gemUnit, "PickUpSpiderGem", 1.0);

    }

    else {

        if ((UnitGetType(lv_gemUnit) == "ItemSoulPickupFive")) {

            AIAddCollectable(lv_gemUnit, "PickUpSpiderGem", 5.0);

        }

        else {

            if ((UnitGetType(lv_gemUnit) == "ItemSoulPickupTwenty")) {

                AIAddCollectable(lv_gemUnit, "PickUpSpiderGem", 20.0);

            }



        }

    }

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenSoulSpawned_Init () {

    libMSOC_gt_MMTombSpiderQueenSoulSpawned = TriggerCreate("libMSOC_gt_MMTombSpiderQueenSoulSpawned_Func");

    TriggerAddEventUnitRegion(libMSOC_gt_MMTombSpiderQueenSoulSpawned, null, RegionPlayableMap(), true);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Soul Pick Up

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenSoulPickUp_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_collectingPlayer;

    unit lv_collectingUnit;

    playergroup lv_textTagPlayers;

    int lv_count;

    int lv_itSoulCage;



    // Automatic Variable Declarations

    string auto706F8613_val;



    // Variable Initialization

    lv_collectingPlayer = EventPlayerEffectUsedUnitOwner(c_effectPlayerTarget);

    lv_collectingUnit = EventPlayerEffectUsedUnit(c_effectUnitTarget);

    lv_textTagPlayers = PlayerGroupEmpty();



    // Actions

    if (!runActions) {

        return true;

    }



    libNtve_gf_AddPlayerGroupToPlayerGroup(libGame_gf_AlliedPlayerGroupOfPlayer(lv_collectingPlayer), lv_textTagPlayers);

    PlayerGroupAdd(lv_textTagPlayers, libCore_gv_oBSERVER_ObserverUIPlayer);

    auto706F8613_val = EventPlayerEffectUsed();

    if (auto706F8613_val == "SoulPickup1Set") {

        lv_count = 1;

    }

    else if (auto706F8613_val == "SoulPickup5Set") {

        lv_count = 5;

    }

    else if (auto706F8613_val == "SoulPickup20Set") {

        lv_count = 20;

    }

    else {

    }

    lv_count = MinI(lv_count, (100 - libMSOC_gf_MMTombSpiderQueenGetGemsHeldforUnit(lv_collectingUnit)));

    libGame_gf_SendEventMapTombSpiderQueenSoulCollected(lv_collectingPlayer, lv_count);

    TextExpressionSetToken("Param/Expression/lib_MSOC_E1422753", "A", IntToText(lv_count));

    TextTagCreate(TextExpressionAssemble("Param/Expression/lib_MSOC_E1422753"), 24, UnitGetPosition(lv_collectingUnit), 1.0, true, true, lv_textTagPlayers);

    TextTagSetVelocity(TextTagLastCreated(), 1.5, 90.0);

    TextTagSetTime(TextTagLastCreated(), c_textTagTimeDuration, 3.0);

    TextTagSetFogVisibility(TextTagLastCreated(), c_visTypeFog);

    TextExpressionSetToken("Param/Expression/lib_MSOC_217EE443", "A", IntToText(lv_count));

    TextTagCreate(TextExpressionAssemble("Param/Expression/lib_MSOC_217EE443"), 24, UnitGetPosition(lv_collectingUnit), 1.0, true, true, libGame_gf_EnemyPlayerGroupOfPlayer(lv_collectingPlayer));

    TextTagSetVelocity(TextTagLastCreated(), 1.5, 90.0);

    TextTagSetTime(TextTagLastCreated(), c_textTagTimeDuration, 3.0);

    TextTagSetFogVisibility(TextTagLastCreated(), c_visTypeFog);

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenSoulPickUp_Init () {

    libMSOC_gt_MMTombSpiderQueenSoulPickUp = TriggerCreate("libMSOC_gt_MMTombSpiderQueenSoulPickUp_Func");

    TriggerAddEventPlayerEffectUsed(libMSOC_gt_MMTombSpiderQueenSoulPickUp, c_playerAny, "SoulPickup1Set");

    TriggerAddEventPlayerEffectUsed(libMSOC_gt_MMTombSpiderQueenSoulPickUp, c_playerAny, "SoulPickup5Set");

    TriggerAddEventPlayerEffectUsed(libMSOC_gt_MMTombSpiderQueenSoulPickUp, c_playerAny, "SoulPickup20Set");

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Soul Stacks Change

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenSoulStacksChange_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_triggeringPlayer;

    int lv_i;

    unit lv_heroUnit;

    int[libCore_gv_bALMaxTeams + 1] lv_teamStacks;

    int lv_itTeam;



    // Automatic Variable Declarations

    unitgroup auto229D3E2F_g;

    int auto229D3E2F_u;

    const int auto9ED754D3_ae = libMSOC_gv_mMTombSpiderQueenCount_C;

    const int auto9ED754D3_ai = 1;

    const int autoDABAB2F7_ae = libMSOC_gv_mMTombSpiderQueenCount_C;

    const int autoDABAB2F7_ai = 1;

    const int autoC20274EB_ae = libCore_gv_bALMaxPlayers;

    const int autoC20274EB_ai = 1;

    const int auto5683D28E_ae = libCore_gv_bALMaxTeams;

    const int auto5683D28E_ai = 1;



    // Variable Initialization

    lv_triggeringPlayer = UnitGetOwner(EventUnit());



    // Conditions

    if (testConds) {

        if (!(((lv_triggeringPlayer >= 1) && (lv_triggeringPlayer <= libCore_gv_bALMaxPlayers)))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libMSOC_gv_mMTombSpiderQueenGemsHeldForPlayer[lv_triggeringPlayer] = 0;

    auto229D3E2F_g = libGame_gv_players[lv_triggeringPlayer].lv_heroUnitGroup;

    auto229D3E2F_u = UnitGroupCount(auto229D3E2F_g, c_unitCountAll);

    for (;; auto229D3E2F_u -= 1) {

        lv_heroUnit = UnitGroupUnitFromEnd(auto229D3E2F_g, auto229D3E2F_u);

        if (lv_heroUnit == null) { break; }

        if ((UnitFilterMatch(lv_heroUnit, lv_triggeringPlayer, UnitFilter(0, 0, 0, (1 << (c_targetFilterHallucination - 32)))) == true)) {

            libMSOC_gv_mMTombSpiderQueenGemsHeldForPlayer[lv_triggeringPlayer] += UnitBehaviorCount(lv_heroUnit, "MapMechanicStack");

        }



    }

    libGame_gf_ScoreValuesReportIntegerValueAndLog(lv_triggeringPlayer, "CarriedMechanic", libMSOC_gv_mMTombSpiderQueenGemsHeldForPlayer[lv_triggeringPlayer]);

    if ((libMSOC_gv_mMTombSpiderQueenGemsHeldForPlayer[lv_triggeringPlayer] > 0)) {

        lv_i = 1;

        for ( ; ( (autoDABAB2F7_ai >= 0 && lv_i <= autoDABAB2F7_ae) || (autoDABAB2F7_ai < 0 && lv_i >= autoDABAB2F7_ae) ) ; lv_i += autoDABAB2F7_ai ) {

            UnitSetStateForPlayer(libMSOC_gv_mMTombSpiderQueen[lv_i].lv_units, c_unitStateTargetable, lv_triggeringPlayer, true);

        }

    }

    else {

        lv_i = 1;

        for ( ; ( (auto9ED754D3_ai >= 0 && lv_i <= auto9ED754D3_ae) || (auto9ED754D3_ai < 0 && lv_i >= auto9ED754D3_ae) ) ; lv_i += auto9ED754D3_ai ) {

            UnitSetStateForPlayer(libMSOC_gv_mMTombSpiderQueen[lv_i].lv_units, c_unitStateTargetable, lv_triggeringPlayer, false);

        }

    }

    lv_i = 1;

    for ( ; ( (autoC20274EB_ai >= 0 && lv_i <= autoC20274EB_ae) || (autoC20274EB_ai < 0 && lv_i >= autoC20274EB_ae) ) ; lv_i += autoC20274EB_ai ) {

        lv_teamStacks[libGame_gf_TeamNumberOfPlayer(lv_i)] += libMSOC_gv_mMTombSpiderQueenGemsHeldForPlayer[lv_i];

    }

    libMSOC_gf_MMCountsUpdateDisplay(lv_teamStacks[libGame_gv_teamOrderIndex_C], lv_teamStacks[libGame_gv_teamChaosIndex_C]);

    lv_itTeam = 1;

    for ( ; ( (auto5683D28E_ai >= 0 && lv_itTeam <= auto5683D28E_ae) || (auto5683D28E_ai < 0 && lv_itTeam >= auto5683D28E_ae) ) ; lv_itTeam += auto5683D28E_ai ) {

        libMSOC_gf_MMTombSpiderQueenUICheckTurnInStatus(lv_teamStacks[lv_itTeam], lv_itTeam);

    }

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenSoulStacksChange_Init () {

    libMSOC_gt_MMTombSpiderQueenSoulStacksChange = TriggerCreate("libMSOC_gt_MMTombSpiderQueenSoulStacksChange_Func");

    TriggerAddEventUnitBehaviorChange(libMSOC_gt_MMTombSpiderQueenSoulStacksChange, null, "MapMechanicStack", c_unitBehaviorChangeIncrease);

    TriggerAddEventUnitBehaviorChange(libMSOC_gt_MMTombSpiderQueenSoulStacksChange, null, "MapMechanicStack", c_unitBehaviorChangeDecrease);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Hand In Souls

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenHandInSouls_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_channelingPlayer;

    int lv_channelingTeam;

    int lv_channelingTeamEnemy;

    unit lv_macGuffinUnit;

    unit lv_hero;

    int lv_ownCount;

    int lv_handinCount;

    int lv_itTeam;

    int lv_itSoulCage;

    unit lv_bannerSconce;



    // Automatic Variable Declarations

    unitgroup auto745D7F6A_g;

    int auto745D7F6A_u;

    const int auto34AFC495_ae = libCore_gv_bALMaxTeams;

    const int auto34AFC495_ai = 1;

    const int auto0881A808_ae = libMSOC_gv_mMTombSpiderQueenCount_C;

    const int auto0881A808_ai = 1;



    // Variable Initialization

    lv_channelingPlayer = EventPlayerEffectUsedUnitOwner(c_effectPlayerCaster);

    lv_channelingTeam = libGame_gf_TeamNumberOfPlayer(lv_channelingPlayer);

    lv_channelingTeamEnemy = libGame_gf_EnemyTeam(lv_channelingTeam);

    lv_macGuffinUnit = EventPlayerEffectUsedUnit(c_effectUnitTarget);

    lv_hero = EventPlayerEffectUsedUnit(c_effectUnitCaster);

    lv_ownCount = libMSOC_gf_MMTombSpiderQueenGetGemsHeldforUnit(lv_hero);

    lv_handinCount = libMSOC_gf_MMTombSpiderQueenGetGemsHeldforUnit(lv_hero);



    // Conditions

    if (testConds) {

        if (!((libMSOC_gv_mMTombSpiderQueen[1].lv_active == false))) {

            return false;

        }



        if (!((libMSOC_gv_mMTombSpiderQueen[2].lv_active == false))) {

            return false;

        }



        if (!((TriggerIsEnabled(TriggerGetCurrent()) == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_handinCount = MinI(lv_ownCount, (libMSOC_gv_mMTombSpiderQueenActivationAmountRequired[lv_channelingTeam] - libMSOC_gv_mMTombSpiderQueenSoulsTotal[lv_channelingTeam]));

    libMSOC_gv_mMTombSpiderQueenSoulsTotal[lv_channelingTeam] += lv_handinCount;

    UnitBehaviorRemove(lv_hero, "MapMechanicStack", lv_handinCount);

    libMSOC_gv_mMTombSpiderQueenTotalGemsTurnedIn[lv_channelingPlayer] += lv_handinCount;

    libGame_gf_SendMapSpecificAwardEvent(lv_channelingPlayer, libMSOC_gv_mMTombSpiderQueenTotalGemsTurnedIn[lv_channelingPlayer], false);

    SoundPlayAtPointForPlayer(SoundLink("UI_Game_Skull_Pickup", -1), c_maxPlayers, PlayerGroupAll(), UnitGetPosition(lv_macGuffinUnit), 0.5, 100.0, 0.0);

    TextExpressionSetToken("Param/Expression/lib_MSOC_5821093A", "A", IntToText(lv_handinCount));

    TextTagCreate(TextExpressionAssemble("Param/Expression/lib_MSOC_5821093A"), 24, UnitGetPosition(lv_macGuffinUnit), 1.0, true, true, libGame_gv_teams[lv_channelingTeam].lv_teamPlayerGroupNoNPCPlayers);

    TextTagSetVelocity(TextTagLastCreated(), 1.5, 90.0);

    TextTagSetTime(TextTagLastCreated(), c_textTagTimeDuration, 3.0);

    TextTagSetFogVisibility(TextTagLastCreated(), c_visTypeFog);

    TextExpressionSetToken("Param/Expression/lib_MSOC_E0BDA906", "A", IntToText(lv_handinCount));

    TextTagCreate(TextExpressionAssemble("Param/Expression/lib_MSOC_E0BDA906"), 24, UnitGetPosition(lv_macGuffinUnit), 1.0, true, true, libGame_gv_teams[lv_channelingTeamEnemy].lv_teamPlayerGroupNoNPCPlayers);

    TextTagSetVelocity(TextTagLastCreated(), 1.5, 90.0);

    TextTagSetTime(TextTagLastCreated(), c_textTagTimeDuration, 3.0);

    TextTagSetFogVisibility(TextTagLastCreated(), c_visTypeFog);

    if ((lv_channelingTeam == libGame_gv_teamOrderIndex_C)) {

        TextExpressionSetToken("Param/Expression/lib_MSOC_66541692", "A", IntToText(lv_handinCount));

        TextTagCreate(TextExpressionAssemble("Param/Expression/lib_MSOC_66541692"), 24, UnitGetPosition(lv_macGuffinUnit), 1.0, true, true, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer]);

        TextTagSetVelocity(TextTagLastCreated(), 1.5, 90.0);

        TextTagSetTime(TextTagLastCreated(), c_textTagTimeDuration, 3.0);

        TextTagSetFogVisibility(TextTagLastCreated(), c_visTypeFog);

    }

    else {

        TextExpressionSetToken("Param/Expression/lib_MSOC_DA0FD0DD", "A", IntToText(lv_handinCount));

        TextTagCreate(TextExpressionAssemble("Param/Expression/lib_MSOC_DA0FD0DD"), 24, UnitGetPosition(lv_macGuffinUnit), 1.0, true, true, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer]);

        TextTagSetVelocity(TextTagLastCreated(), 1.5, 90.0);

        TextTagSetTime(TextTagLastCreated(), c_textTagTimeDuration, 3.0);

        TextTagSetFogVisibility(TextTagLastCreated(), c_visTypeFog);

    }

    libMSOC_gf_MMTombSpiderQueenUpdateSouls(1);

    libMSOC_gf_MMTombSpiderQueenUpdateSouls(2);

    if ((libMSOC_gv_mMTombSpiderQueenSoulsTotal[lv_channelingTeam] < libMSOC_gv_mMTombSpiderQueenActivationAmountRequired[lv_channelingTeam])) {

        return true;

    }



    libMSOC_gv_mMTombSpiderQueenSummoningTeam = lv_channelingTeam;

    libMSOC_gv_mMTombSpiderQueenTotalTimesSpawned += 1;

    libMSOC_gf_MMTombSpiderQueenSoulCollectionThresholdReached(lv_channelingTeam);

    libGame_gf_SendEventMapObjectiveCapturedByUnit(EventPlayerEffectUsedUnit(c_effectUnitCaster));

    auto745D7F6A_g = UnitGroup("LootBannerSconce", c_playerAny, RegionCircle(UnitGetPosition(lv_macGuffinUnit), 9.0), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 2);

    auto745D7F6A_u = UnitGroupCount(auto745D7F6A_g, c_unitCountAll);

    for (;; auto745D7F6A_u -= 1) {

        lv_bannerSconce = UnitGroupUnitFromEnd(auto745D7F6A_g, auto745D7F6A_u);

        if (lv_bannerSconce == null) { break; }

        libGame_gf_DropLootBannerinSconce(lv_bannerSconce, libGame_gv_players[lv_channelingPlayer].lv_lootContent.lv_loot_Banner.lv_bannerID, lv_channelingPlayer, true);

    }

    StatEventCreate("SoulEatersSpawned");

    StatEventAddDataInt(StatEventLastCreated(), "Event", libMSOC_gv_mMTombSpiderQueenTotalTimesSpawned);

    StatEventAddDataFixed(StatEventLastCreated(), "TeamID", lv_channelingTeam);

    StatEventAddDataInt(StatEventLastCreated(), "TeamScore", libMSOC_gv_mMTombSpiderQueenSoulsTotal[lv_channelingTeam]);

    StatEventAddDataInt(StatEventLastCreated(), "OpponentScore", libMSOC_gv_mMTombSpiderQueenSoulsTotal[lv_channelingTeamEnemy]);

    StatEventAddDataFixed(StatEventLastCreated(), "GameTime", libUIUI_gf_HeroesGameTime());

    StatEventSend(StatEventLastCreated());

    libMSOC_gv_mMTombSpiderQueenSoulsTotal[lv_channelingTeam] -= libMSOC_gv_mMTombSpiderQueenActivationAmountRequired[lv_channelingTeam];

    libMSOC_gv_mMTombSpiderQueenActivationAmountRequired[lv_channelingTeam] += libMSOC_gv_mMTombSpiderQueenActivationAmountIncrement_C;

    libMSOC_gv_mMTombSpiderQueenActivationAmountRequired[lv_channelingTeam] = MinI(libMSOC_gv_mMTombSpiderQueenActivationAmountRequired[lv_channelingTeam], libMSOC_gv_mMTombSpiderQueenActivationAmountCap_C);

    libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersSpawningQ(lv_channelingTeam);

    lv_itTeam = 1;

    for ( ; ( (auto34AFC495_ai >= 0 && lv_itTeam <= auto34AFC495_ae) || (auto34AFC495_ai < 0 && lv_itTeam >= auto34AFC495_ae) ) ; lv_itTeam += auto34AFC495_ai ) {

        libMSOC_gf_MMTombSpiderQueenUpdateSouls(lv_itTeam);

    }

    lv_itSoulCage = 1;

    for ( ; ( (auto0881A808_ai >= 0 && lv_itSoulCage <= auto0881A808_ae) || (auto0881A808_ai < 0 && lv_itSoulCage >= auto0881A808_ae) ) ; lv_itSoulCage += auto0881A808_ai ) {

        UnitBehaviorRemove(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units, "MacguffinActivated", 1);

        UnitSetState(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units, c_unitStateTargetable, false);

        UnitSetState(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units, c_unitStateHighlightable, false);

        libMSOC_gf_MMTombSpiderQueenEnableDisableTurnInGoals(false, libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units);

    }

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenHandInSouls_Init () {

    libMSOC_gt_MMTombSpiderQueenHandInSouls = TriggerCreate("libMSOC_gt_MMTombSpiderQueenHandInSouls_Func");

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenHandInSouls, false);

    TriggerAddEventPlayerEffectUsed(libMSOC_gt_MMTombSpiderQueenHandInSouls, c_playerAny, "CaptureMacGuffinCastComplete");

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Start Light Transition

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenStartLightTransition_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_itPlayer;



    // Automatic Variable Declarations

    // Variable Initialization



    // Actions

    if (!runActions) {

        return true;

    }



    libGame_gf_SpecialLightingEventStart("StormSoulEaterSpawnTransition", PlayerGroupAll(), 1.0);

    Wait(1.0, c_timeGame);

    libGame_gf_SpecialLightingEventStart("StormSoulEaterSpawnFinal", PlayerGroupAll(), 2.0);

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenStartLightTransition_Init () {

    libMSOC_gt_MMTombSpiderQueenStartLightTransition = TriggerCreate("libMSOC_gt_MMTombSpiderQueenStartLightTransition_Func");

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Soul Eater Impacts A Target

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenSoulEaterImpactsATarget_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_iSoulEater;

    unit lv_unit;

    bool lv_disableTrigger;



    // Automatic Variable Declarations

    int auto82E0F869_ae;



    // Variable Initialization

    lv_disableTrigger = true;



    // Actions

    if (!runActions) {

        return true;

    }



    lv_unit = EventPlayerEffectUsedUnit(c_effectUnitCaster);

    if ((libAIAI_gf_MinionAIIsUnitLaneTheSameAsOtherUnit(lv_unit, EventPlayerEffectUsedUnit(c_effectUnitTarget)) == true)) {

        auto82E0F869_ae = libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C;

        lv_iSoulEater = 1;

        for ( ; lv_iSoulEater <= auto82E0F869_ae ; lv_iSoulEater += 1 ) {

            if ((lv_unit == libMSOC_gv_mMTombSpiderQueenQueensBirthing[lv_iSoulEater])) {

                libMSOC_gv_mMTombSpiderQueenQueensBirthing[lv_iSoulEater] = null;

                UnitBehaviorAdd(lv_unit, "SoulEaterBirthDelay", lv_unit, 1);

                UnitBehaviorRemove(lv_unit, "SoulEaterSuppressCollisionBehavior", 1);

            }

            else {

                if ((libMSOC_gv_mMTombSpiderQueenQueensBirthing[lv_iSoulEater] != null)) {

                    lv_disableTrigger = false;

                }



            }

        }

        if ((lv_disableTrigger == true)) {

            TriggerEnable(TriggerGetCurrent(), false);

        }



    }



    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenSoulEaterImpactsATarget_Init () {

    libMSOC_gt_MMTombSpiderQueenSoulEaterImpactsATarget = TriggerCreate("libMSOC_gt_MMTombSpiderQueenSoulEaterImpactsATarget_Func");

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenSoulEaterImpactsATarget, false);

    TriggerAddEventPlayerEffectUsed(libMSOC_gt_MMTombSpiderQueenSoulEaterImpactsATarget, libCore_gv_cOMPUTER_TeamOrder, "SoulEaterSpeedBoostImpactDummy");

    TriggerAddEventPlayerEffectUsed(libMSOC_gt_MMTombSpiderQueenSoulEaterImpactsATarget, libCore_gv_cOMPUTER_TeamChaos, "SoulEaterSpeedBoostImpactDummy");

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Soul Eaters Active

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenSoulEatersActive_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_itSoulEater;

    int lv_cursedTeam;



    // Automatic Variable Declarations

    const int auto3B849223_ae = libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C;

    const int auto3B849223_ai = 1;



    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((UnitGetType(EventUnit()) == "SoulEater"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_itSoulEater = 1;

    for ( ; ( (auto3B849223_ai >= 0 && lv_itSoulEater <= auto3B849223_ae) || (auto3B849223_ai < 0 && lv_itSoulEater >= auto3B849223_ae) ) ; lv_itSoulEater += auto3B849223_ai ) {

        if ((EventUnit() == libMSOC_gv_mMTombSpiderQueenSoulEaters[lv_itSoulEater])) {

            lv_cursedTeam = libGame_gf_EnemyTeam(libMSOC_gv_mMTombSpiderQueenSummoningTeam);

            if ((lv_itSoulEater == 1)) {

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterEnabled, libGame_gv_teams[libMSOC_gv_mMTombSpiderQueenSummoningTeam].lv_teamPlayerGroupNoNPCPlayers, true);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterFlames, libGame_gv_teams[libMSOC_gv_mMTombSpiderQueenSummoningTeam].lv_teamPlayerGroupNoNPCPlayers, true);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterEnabled, libGame_gv_teams[lv_cursedTeam].lv_teamPlayerGroupNoNPCPlayers, true);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterFlames, libGame_gv_teams[lv_cursedTeam].lv_teamPlayerGroupNoNPCPlayers, true);

                if ((libMSOC_gv_mMTombSpiderQueenSummoningTeam == libGame_gv_teamOrderIndex_C)) {

                    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterEnabled, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], true);

                    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterFlames, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], true);

                }

                else {

                    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterEnabled, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], true);

                    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterFlames, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], true);

                }

            }

            else if ((lv_itSoulEater == 2)) {

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterEnabled, libGame_gv_teams[libMSOC_gv_mMTombSpiderQueenSummoningTeam].lv_teamPlayerGroupNoNPCPlayers, true);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterFlames, libGame_gv_teams[libMSOC_gv_mMTombSpiderQueenSummoningTeam].lv_teamPlayerGroupNoNPCPlayers, true);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterEnabled, libGame_gv_teams[lv_cursedTeam].lv_teamPlayerGroupNoNPCPlayers, true);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterFlames, libGame_gv_teams[lv_cursedTeam].lv_teamPlayerGroupNoNPCPlayers, true);

                if ((libMSOC_gv_mMTombSpiderQueenSummoningTeam == libGame_gv_teamOrderIndex_C)) {

                    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterEnabled, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], true);

                    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterFlames, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], true);

                }

                else {

                    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterEnabled, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], true);

                    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterFlames, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], true);

                }

            }

            else if ((lv_itSoulEater == 3)) {

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterEnabled, libGame_gv_teams[libMSOC_gv_mMTombSpiderQueenSummoningTeam].lv_teamPlayerGroupNoNPCPlayers, true);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterFlames, libGame_gv_teams[libMSOC_gv_mMTombSpiderQueenSummoningTeam].lv_teamPlayerGroupNoNPCPlayers, true);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterEnabled, libGame_gv_teams[lv_cursedTeam].lv_teamPlayerGroupNoNPCPlayers, true);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterFlames, libGame_gv_teams[lv_cursedTeam].lv_teamPlayerGroupNoNPCPlayers, true);

                if ((libMSOC_gv_mMTombSpiderQueenSummoningTeam == libGame_gv_teamOrderIndex_C)) {

                    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterEnabled, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], true);

                    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterFlames, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], true);

                }

                else {

                    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterEnabled, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], true);

                    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterFlames, libCore_gv_playerGroupFromPlayer[libCore_gv_oBSERVER_ObserverUIPlayer], true);

                }

            }

        }



    }

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenSoulEatersActive_Init () {

    libMSOC_gt_MMTombSpiderQueenSoulEatersActive = TriggerCreate("libMSOC_gt_MMTombSpiderQueenSoulEatersActive_Func");

    TriggerAddEventUnitBehaviorChange(libMSOC_gt_MMTombSpiderQueenSoulEatersActive, null, "SoulEaterBirthAnimation", c_unitBehaviorChangeDestroy);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Soul Eater Dies

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenSoulEaterDies_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_itSoulEater;

    int lv_cursedTeam;



    // Automatic Variable Declarations

    const int auto51340623_ae = libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C;

    const int auto51340623_ai = 1;



    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((UnitGetType(EventUnit()) == "SoulEater"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_itSoulEater = 1;

    for ( ; ( (auto51340623_ai >= 0 && lv_itSoulEater <= auto51340623_ae) || (auto51340623_ai < 0 && lv_itSoulEater >= auto51340623_ae) ) ; lv_itSoulEater += auto51340623_ai ) {

        if ((EventUnit() == libMSOC_gv_mMTombSpiderQueenSoulEaters[lv_itSoulEater])) {

            lv_cursedTeam = libGame_gf_EnemyTeam(libMSOC_gv_mMTombSpiderQueenSummoningTeam);

            if ((lv_itSoulEater == 1)) {

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterEnabled, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterFlames, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterEnabled, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterFlames, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_topSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, 64, 1);

                DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_topSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, 64, 1);

            }

            else if ((lv_itSoulEater == 2)) {

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterEnabled, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterFlames, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterEnabled, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterFlames, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_midSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, 64, 1);

                DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_midSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, 64, 1);

            }

            else if ((lv_itSoulEater == 3)) {

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterEnabled, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterFlames, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterEnabled, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterFlames, libCore_gv_allHeroPlayersPlusObserver, false);

                DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeBlueFrame.lv_bottomSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, 64, 1);

                DialogControlSetSize(libMSOC_gv_mMTombSpiderQueenPanel.lv_soulEaterModeRedFrame.lv_bottomSoulEaterHealth, libCore_gv_allHeroPlayersPlusObserver, 64, 1);

            }

        }



    }

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenSoulEaterDies_Init () {

    libMSOC_gt_MMTombSpiderQueenSoulEaterDies = TriggerCreate("libMSOC_gt_MMTombSpiderQueenSoulEaterDies_Func");

    TriggerAddEventUnitDied(libMSOC_gt_MMTombSpiderQueenSoulEaterDies, null);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Soul Eaters are Dead

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenSoulEatersareDead_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_waitTimerTop;

    int lv_waitTimerBottom;

    int lv_itPlayer;

    int lv_cursedTeam;

    int lv_enemyTeam;

    int lv_cursedPlayer;

    int lv_itTeam;

    int lv_itSoulCage;

    int lv_soulCount;



    // Automatic Variable Declarations

    const int autoEC8D0615_ae = libMSOC_gv_mMTombSpiderQueenCount_C;

    const int autoEC8D0615_ai = 1;

    const int autoCAE11154_ae = libCore_gv_bALMaxPlayers;

    const int autoCAE11154_ai = 1;



    // Variable Initialization

    lv_waitTimerTop = c_textTagNone;

    lv_waitTimerBottom = c_textTagNone;



    // Actions

    if (!runActions) {

        return true;

    }



    libMSOC_gv_mMTombSpiderQueenFirstActivation = false;

    SoundPlayForPlayer(SoundLink("Event_LuxCrypt_SpiderCurse_Curse_End", -1), c_maxPlayers, PlayerGroupAll(), 100.0, 0.0);

    SoundtrackPlay(PlayerGroupAll(), c_soundtrackCategoryMusic, "MX_LuxCrypt_CurseEnd", c_soundtrackCueAny, c_soundtrackIndexAny, false);

    SoundChannelMute(PlayerGroupAll(), c_soundCategoryAmbient, false);

    libSond_gf_SoundtrackPlayMapSoundtrackAsDefaultSoundtrackForAllPlayers();

    if ((libMSOC_gv_mMTombSpiderQueen[2].lv_active == true)) {

        lv_cursedTeam = 1;

        lv_cursedPlayer = libCore_gv_cOMPUTER_TeamOrder;

    }

    else if ((libMSOC_gv_mMTombSpiderQueen[1].lv_active == true)) {

        lv_cursedTeam = 2;

        lv_cursedPlayer = libCore_gv_cOMPUTER_TeamChaos;

    }

    else if (true) {

        return true;

    }

    lv_enemyTeam = libGame_gf_EnemyTeam(lv_cursedTeam);

    libMSOC_gf_MMTombSpiderQueenTransmissionSoulEatersAreDeadQ();

    libMSOC_gf_MMTombSpiderQueenAnimationHandlerMain(libMSOC_ge_MMTombSpiderQueenAnimStates_EventEnd);

    libMapM_gf_JungleStopHibernateCamps();

    libMSOC_gv_mMTombSpiderQueen[1].lv_active = false;

    libMSOC_gv_mMTombSpiderQueen[2].lv_active = false;

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenHandInSouls, true);

    libMSOC_gf_MMTombSpiderQueenTurnInPointTeamColor(0);

    libGame_gf_SpecialLightingEventEnd("StormSoulEaterSpawnFinal", PlayerGroupAll(), 2.0);

    if ((libMSOC_gv_mMTombSpiderQueenDisableEvent == true)) {

        return true;

    }



    TimerStart(libMSOC_gv_mMTombSpiderQueenWaitTimer, libMSOC_gv_mMTombSpiderQueenPostAuraWaitTime_C, false, c_timeGame);

    TimerStart(libMSOC_gv_mMTombSpiderQueenAnimationHandlerTimer, libMSOC_gv_mMTombSpiderQueenAnimationHandlerTime, false, c_timeGame);

    TextTagCreate(StringToText(""), 36, PointWithOffset(PointFromId(277), 0.0, 2.0), 0.5, true, false, PlayerGroupAll());

    lv_waitTimerTop = TextTagLastCreated();

    TextTagCreate(StringToText(""), 36, PointWithOffset(PointFromId(231), 0.0, 2.0), 0.5, true, false, PlayerGroupAll());

    lv_waitTimerBottom = TextTagLastCreated();

    libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterCooldownLabel, TextTimeFormat(StringToText("<mintotal/>:<sec2/>"), FixedToInt(TimerGetRemaining(libMSOC_gv_mMTombSpiderQueenWaitTimer))), PlayerGroupAll());

    DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterCooldownFrame, libCore_gv_allHeroPlayersPlusObserver, true);

    while (true) {

        if ((TimerGetRemaining(libMSOC_gv_mMTombSpiderQueenWaitTimer) == 0.0)) {

            TextTagDestroy(lv_waitTimerTop);

            TextTagDestroy(lv_waitTimerBottom);

            DialogControlSetVisible(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterCooldownFrame, libCore_gv_allHeroPlayersPlusObserver, false);

            lv_itSoulCage = 1;

            for ( ; ( (autoEC8D0615_ai >= 0 && lv_itSoulCage <= autoEC8D0615_ae) || (autoEC8D0615_ai < 0 && lv_itSoulCage >= autoEC8D0615_ae) ) ; lv_itSoulCage += autoEC8D0615_ai ) {

                UnitBehaviorAdd(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units, "MacguffinActivated", libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units, 1);

                UnitSetState(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units, c_unitStateHighlightable, true);

                lv_itPlayer = 1;

                for ( ; ( (autoCAE11154_ai >= 0 && lv_itPlayer <= autoCAE11154_ae) || (autoCAE11154_ai < 0 && lv_itPlayer >= autoCAE11154_ae) ) ; lv_itPlayer += autoCAE11154_ai ) {

                    if ((libMSOC_gv_mMTombSpiderQueenGemsHeldForPlayer[lv_itPlayer] > 0)) {

                        UnitSetStateForPlayer(libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units, c_unitStateTargetable, lv_itPlayer, true);

                    }



                }

                libMSOC_gf_MMTombSpiderQueenEnableDisableTurnInGoals(true, libMSOC_gv_mMTombSpiderQueen[lv_itSoulCage].lv_units);

            }

            break;

        }



        TextExpressionSetToken("Param/Expression/lib_MSOC_E5992277", "A", TextTimeFormat(StringToText("<min2/>:<sec2/>"), FixedToInt(TimerGetRemaining(libMSOC_gv_mMTombSpiderQueenWaitTimer))));

        TextTagSetText(lv_waitTimerBottom, TextExpressionAssemble("Param/Expression/lib_MSOC_E5992277"));

        TextExpressionSetToken("Param/Expression/lib_MSOC_F74E1D56", "A", TextTimeFormat(StringToText("<min2/>:<sec2/>"), FixedToInt(TimerGetRemaining(libMSOC_gv_mMTombSpiderQueenWaitTimer))));

        TextTagSetText(lv_waitTimerTop, TextExpressionAssemble("Param/Expression/lib_MSOC_F74E1D56"));

        libNtve_gf_SetDialogItemText(libMSOC_gv_mMTombSpiderQueenPanel.lv_theCryptsSoulEaterCooldownLabel, TextTimeFormat(StringToText("<mintotal/>:<sec2/>"), FixedToInt(TimerGetRemaining(libMSOC_gv_mMTombSpiderQueenWaitTimer))), PlayerGroupAll());

        Wait(0.25, c_timeGame);

    }

    libMSOC_gf_MMTombSpiderQueenTransmissionSoulCageActivatedQ(0);

    libMSOC_gf_MMTombSpiderQueenUpdateSouls(1);

    libMSOC_gf_MMTombSpiderQueenUpdateSouls(2);

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenSoulEatersareDead_Init () {

    libMSOC_gt_MMTombSpiderQueenSoulEatersareDead = TriggerCreate("libMSOC_gt_MMTombSpiderQueenSoulEatersareDead_Func");

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenSoulEatersareDead, false);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Aura Start Light Transition

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenAuraStartLightTransition_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_itPlayer;



    // Automatic Variable Declarations

    // Variable Initialization



    // Actions

    if (!runActions) {

        return true;

    }



    libGame_gf_SpecialLightingEventStart("StormRavenCourtCurseTransition", PlayerGroupAll(), 1.0);

    Wait(1.0, c_timeGame);

    libGame_gf_SpecialLightingEventStart("StormRavenCourtCurseFinal", PlayerGroupAll(), 2.0);

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenAuraStartLightTransition_Init () {

    libMSOC_gt_MMTombSpiderQueenAuraStartLightTransition = TriggerCreate("libMSOC_gt_MMTombSpiderQueenAuraStartLightTransition_Func");

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenAuraStartLightTransition, false);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen SoulEater Spawn XP

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenSoulEaterSpawnXP_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Conditions

    if (testConds) {

        if (!(((UnitGetType(EventUnit()) == "SoulEater") || (UnitGetType(EventUnit()) == "SoulEaterMinion")))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libGame_gf_UpdateScalingForUnit(EventUnit(), libGame_gv_scalingTicks, 0);

    if ((UnitGetType(EventUnit()) == "SoulEaterMinion")) {

        libGame_gf_CalculateSpawnedMinionGoalPoints(UnitGetOwner(EventUnit()), UnitGetPosition(EventUnit()));

        libAIAI_gf_MinionAIStartMinionAI(-1, EventUnit(), libGame_gv_spawnedMinionLane, libGame_gv_spawnedMinionFirstWaypointIndex, false, false, false, 0, false);

    }



    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenSoulEaterSpawnXP_Init () {

    libMSOC_gt_MMTombSpiderQueenSoulEaterSpawnXP = TriggerCreate("libMSOC_gt_MMTombSpiderQueenSoulEaterSpawnXP_Func");

    TriggerAddEventUnitRegion(libMSOC_gt_MMTombSpiderQueenSoulEaterSpawnXP, null, RegionEntireMap(), true);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Scaling Timer

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenScalingTimer_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Actions

    if (!runActions) {

        return true;

    }



    TimerStart(libMSOC_gv_mMTombSpiderQueenScalingTimer, 60.0, false, c_timeGame);

    if ((libMSOC_gv_mMTombSpiderQueenScalingStart == false)) {

        libMSOC_gv_mMTombSpiderQueenScalingStart = true;

        return true;

    }



    CatalogFieldValueSet(c_gameCatalogEffect, "SoulEaterHealthDecay", "Amount", libCore_gv_cOMPUTER_TeamOrder, IntToString(FixedToInt((CatalogFieldValueGetAsInt(c_gameCatalogEffect, "SoulEaterHealthDecay", "Amount", libCore_gv_cOMPUTER_TeamOrder) + libMSOC_gv_mMTombSpiderQueenSpiderQueenHealthDecay_C))));

    CatalogFieldValueSet(c_gameCatalogEffect, "SoulEaterHealthDecay", "Amount", libCore_gv_cOMPUTER_TeamChaos, IntToString(FixedToInt((CatalogFieldValueGetAsInt(c_gameCatalogEffect, "SoulEaterHealthDecay", "Amount", libCore_gv_cOMPUTER_TeamChaos) + libMSOC_gv_mMTombSpiderQueenSpiderQueenHealthDecay_C))));

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenScalingTimer_Init () {

    libMSOC_gt_MMTombSpiderQueenScalingTimer = TriggerCreate("libMSOC_gt_MMTombSpiderQueenScalingTimer_Func");

    TriggerAddEventTimer(libMSOC_gt_MMTombSpiderQueenScalingTimer, libGame_gv_openTheGatesTimer);

    TriggerAddEventTimer(libMSOC_gt_MMTombSpiderQueenScalingTimer, libMSOC_gv_mMTombSpiderQueenScalingTimer);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen UI Mod Initialize

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenUIModInitialize_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Actions

    if (!runActions) {

        return true;

    }



    libMSOC_gf_MMTombSpiderQueenUIInit(libUIUI_gv_mapMechanicsPanel.lv_mainPanel);

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenUIModInitialize_Init () {

    libMSOC_gt_MMTombSpiderQueenUIModInitialize = TriggerCreate("libMSOC_gt_MMTombSpiderQueenUIModInitialize_Func");

    libCore_gf_IncludeModInitialization(libMSOC_gt_MMTombSpiderQueenUIModInitialize);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen UI Handler

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenUIHandler_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_itTeam;

    int lv_itTeamEnemy;

    int lv_state;

    int lv_lastState;



    // Automatic Variable Declarations

    const int auto68E08804_ae = 2;

    const int auto68E08804_ai = 1;



    // Variable Initialization

    lv_state = libMSOC_ge_MMTombSpiderQueenState_Idle;

    lv_lastState = libMSOC_ge_MMTombSpiderQueenState_Idle;



    // Conditions

    if (testConds) {

        if (!((TriggerIsEnabled(TriggerGetCurrent()) == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    TriggerEnable(TriggerGetCurrent(), false);

    while (true) {

        if (((libMSOC_gv_mMTombSpiderQueen[1].lv_active == true) || (libMSOC_gv_mMTombSpiderQueen[2].lv_active == true)) && ((libMSOC_gv_mMTombSpiderQueen[1].lv_summoning == true) || (libMSOC_gv_mMTombSpiderQueen[2].lv_summoning == true))) {

            lv_state = libMSOC_ge_MMTombSpiderQueenState_Summoning;

            if ((libMSOC_gv_mMTombSpiderQueen[1].lv_active == true)) {

                lv_itTeam = 1;

                lv_itTeamEnemy = 2;

            }

            else {

                lv_itTeam = 2;

                lv_itTeamEnemy = 1;

            }

            if ((lv_state != lv_lastState)) {

                libMSOC_gf_MMTombSpiderQueenUISetModeForTeam(libMSOC_ge_MMTombSpiderQueenUIModes_Releasing, lv_itTeam);

                libMSOC_gf_MMTombSpiderQueenSoulEaterSummoningUI(lv_itTeam);

            }



            lv_lastState = lv_state;

        }

        else if (((libMSOC_gv_mMTombSpiderQueen[1].lv_active == true) || (libMSOC_gv_mMTombSpiderQueen[2].lv_active == true))) {

            lv_state = libMSOC_ge_MMTombSpiderQueenState_Active;

            if ((libMSOC_gv_mMTombSpiderQueen[1].lv_active == true)) {

                lv_itTeam = 1;

                lv_itTeamEnemy = 2;

            }

            else {

                lv_itTeam = 2;

                lv_itTeamEnemy = 1;

            }

            if ((lv_state != lv_lastState)) {

                libMSOC_gf_MMTombSpiderQueenUISetModeForTeam(libMSOC_ge_MMTombSpiderQueenUIModes_Active, lv_itTeam);

                libMSOC_gf_MMTombSpiderQueenSoulEaterUI(lv_itTeam);

            }



            lv_lastState = lv_state;

        }

        else if ((libMSOC_gv_mMTombSpiderQueen[1].lv_active == false) && (libMSOC_gv_mMTombSpiderQueen[2].lv_active == false)) {

            lv_state = libMSOC_ge_MMTombSpiderQueenState_Collecting;

            if ((lv_state != lv_lastState)) {

                libMSOC_gf_MMTombSpiderQueenUIShowHidePanel(true);

                libMSOC_gf_MMTombSpiderQueenUISetModeForTeam(libMSOC_ge_MMTombSpiderQueenUIModes_Collecting, 0);

                if ((libMSOC_gv_mMTombSpiderQueenSummoningTeam != 0)) {

                    libMSOC_gf_MMTombSpiderQueenUIShowHideHealthPanels(false, libMSOC_gv_mMTombSpiderQueenSummoningTeam);

                }



            }



            lv_itTeam = 1;

            for ( ; ( (auto68E08804_ai >= 0 && lv_itTeam <= auto68E08804_ae) || (auto68E08804_ai < 0 && lv_itTeam >= auto68E08804_ae) ) ; lv_itTeam += auto68E08804_ai ) {

                libMSOC_gf_MMTombSpiderQueenUISetSoulCountForTeam(libMSOC_gv_mMTombSpiderQueenSoulsTotal[lv_itTeam], libMSOC_gv_mMTombSpiderQueenActivationAmountRequired[lv_itTeam], (libMSOC_gv_mMTombSpiderQueen[1].lv_active || libMSOC_gv_mMTombSpiderQueen[2].lv_active), lv_itTeam);

            }

            lv_lastState = lv_state;

        }

        Wait(0.0625, c_timeGame);

    }

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenUIHandler_Init () {

    libMSOC_gt_MMTombSpiderQueenUIHandler = TriggerCreate("libMSOC_gt_MMTombSpiderQueenUIHandler_Func");

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Harrison Jones Procced

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenHarrisonJonesProcced_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Actions

    if (!runActions) {

        return true;

    }



    TriggerEnable(TriggerGetCurrent(), false);

    libMSOC_gv_mMTombSpiderQueenHarrisonFinale = true;

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenHarrisonJonesProcced_Init () {

    libMSOC_gt_MMTombSpiderQueenHarrisonJonesProcced = TriggerCreate("libMSOC_gt_MMTombSpiderQueenHarrisonJonesProcced_Func");

    TriggerAddEventPlayerEffectUsed(libMSOC_gt_MMTombSpiderQueenHarrisonJonesProcced, c_playerAny, "HarrisonJonesProcSet");

}



//--------------------------------------------------------------------------------------------------

// Trigger: Harrison Jones Victory

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_HarrisonJonesVictory_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Conditions

    if (testConds) {

        if (!(((EventUnit() == libGame_gv_teams[libGame_gv_teamOrderIndex_C].lv_core) || (EventUnit() == libGame_gv_teams[libGame_gv_teamChaosIndex_C].lv_core)))) {

            return false;

        }



        if (!((libMSOC_gv_mMTombSpiderQueenHarrisonFinale == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libNtve_gf_CreateActorAtPoint("HarrisonJonesVictory", UnitGetPosition(EventUnit()));

    Wait(0.0625, c_timeGame);

    libNtve_gf_SendActorMessageToGameRegion(RegionCircle(UnitGetPosition(EventUnit()), 10.0), "Signal AdventureTime");

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_HarrisonJonesVictory_Init () {

    libMSOC_gt_HarrisonJonesVictory = TriggerCreate("libMSOC_gt_HarrisonJonesVictory_Func");

    TriggerAddEventUnitDied(libMSOC_gt_HarrisonJonesVictory, null);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Debug Event Start

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenDebugEventStart_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Conditions

    if (testConds) {

        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libMSOC_gv_mMTombSpiderQueenEventStartOn = true;

    libMSOC_gv_mMTombSpiderQueenSummoningTeam = 1;

    TriggerExecute(libMSOC_gt_MMTombSpiderQueenUIHandler, true, false);

    libMSOC_gf_MMTombSpiderQueenSpawnSoulEaters(libCore_gv_cOMPUTER_TeamChaos);

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenDebugEventStart_Init () {

    libMSOC_gt_MMTombSpiderQueenDebugEventStart = TriggerCreate("libMSOC_gt_MMTombSpiderQueenDebugEventStart_Func");

    TriggerAddEventChatMessage(libMSOC_gt_MMTombSpiderQueenDebugEventStart, c_playerAny, "EVENTSTART", true);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Debug Enemy Event Start

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenDebugEnemyEventStart_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Conditions

    if (testConds) {

        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libMSOC_gv_mMTombSpiderQueenEventStartOn = true;

    libMSOC_gv_mMTombSpiderQueenSummoningTeam = 2;

    TriggerExecute(libMSOC_gt_MMTombSpiderQueenUIHandler, true, false);

    libMSOC_gf_MMTombSpiderQueenSpawnSoulEaters(libCore_gv_cOMPUTER_TeamOrder);

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenDebugEnemyEventStart_Init () {

    libMSOC_gt_MMTombSpiderQueenDebugEnemyEventStart = TriggerCreate("libMSOC_gt_MMTombSpiderQueenDebugEnemyEventStart_Func");

    TriggerAddEventChatMessage(libMSOC_gt_MMTombSpiderQueenDebugEnemyEventStart, c_playerAny, "ENEMYSTART", true);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Debug Spider Spawn Run Mode

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnRunMode_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_x;



    // Automatic Variable Declarations

    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libNtve_gf_CreateUnitsWithDefaultFacing(1, "SoulEater", 0, 1, CameraGetTarget(1), null);

    UnitBehaviorRemove(UnitLastCreated(), "SoulEaterHealthDecay", 1);

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnRunMode_Init () {

    libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnRunMode = TriggerCreate("libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnRunMode_Func");

    TriggerAddEventChatMessage(libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnRunMode, c_playerAny, "-boss1", true);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Debug Spider Spawn Active

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnActive_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_x;



    // Automatic Variable Declarations

    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libNtve_gf_CreateUnitsWithDefaultFacing(1, "SoulEater", 0, 1, CameraGetTarget(1), null);

    UnitBehaviorRemove(UnitLastCreated(), "SoulEaterHealthDecay", 1);

    UnitBehaviorRemove(UnitLastCreated(), "SoulEaterSpeedBoost", 1);

    libNtve_gf_SendActorMessageToUnit(UnitLastCreated(), "Signal Birth");

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnActive_Init () {

    libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnActive = TriggerCreate("libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnActive_Func");

    TriggerAddEventChatMessage(libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnActive, c_playerAny, "-boss2", true);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Debug Spider Spawn Run Mode Enemy

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnRunModeEnemy_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_x;



    // Automatic Variable Declarations

    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libNtve_gf_CreateUnitsWithDefaultFacing(1, "SoulEater", 0, 1, CameraGetTarget(1), null);

    UnitBehaviorRemove(UnitLastCreated(), "SoulEaterHealthDecay", 1);

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnRunModeEnemy_Init () {

    libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnRunModeEnemy = TriggerCreate("libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnRunModeEnemy_Func");

    TriggerAddEventChatMessage(libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnRunModeEnemy, c_playerAny, "-enemyboss1", true);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Debug Gems Spawn

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenDebugGemsSpawn_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_x;



    // Automatic Variable Declarations

    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libNtve_gf_CreateUnitsWithDefaultFacing(1, "ItemSoulPickup", 0, 11, PointWithOffset(CameraGetTarget(1), -2.0, 0.0), null);

    libNtve_gf_CreateUnitsWithDefaultFacing(1, "ItemSoulPickupFive", 0, 11, PointWithOffset(CameraGetTarget(1), 0.0, 0.0), null);

    libNtve_gf_CreateUnitsWithDefaultFacing(1, "ItemSoulPickupTwenty", 0, 11, PointWithOffset(CameraGetTarget(1), 2.0, 0.0), null);

    libNtve_gf_CreateUnitsWithDefaultFacing(1, "ItemSoulPickup", 0, 12, PointWithOffset(CameraGetTarget(1), -2.0, -4.0), null);

    libNtve_gf_CreateUnitsWithDefaultFacing(1, "ItemSoulPickupFive", 0, 12, PointWithOffset(CameraGetTarget(1), 0.0, -4.0), null);

    libNtve_gf_CreateUnitsWithDefaultFacing(1, "ItemSoulPickupTwenty", 0, 12, PointWithOffset(CameraGetTarget(1), 2.0, -4.0), null);

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenDebugGemsSpawn_Init () {

    libMSOC_gt_MMTombSpiderQueenDebugGemsSpawn = TriggerCreate("libMSOC_gt_MMTombSpiderQueenDebugGemsSpawn_Func");

    TriggerAddEventChatMessage(libMSOC_gt_MMTombSpiderQueenDebugGemsSpawn, c_playerAny, "-gems", true);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Debug Gems No Death

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenDebugGemsNoDeath_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_x;



    // Automatic Variable Declarations

    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libNtve_gf_CreateUnitsWithDefaultFacing(1, "ItemSoulPickup", 0, 11, PointWithOffset(CameraGetTarget(1), -2.0, 0.0), null);

    UnitBehaviorRemove(UnitLastCreated(), "RegenGlobeTimedLife", 1);

    libNtve_gf_CreateUnitsWithDefaultFacing(1, "ItemSoulPickupFive", 0, 11, PointWithOffset(CameraGetTarget(1), 0.0, 0.0), null);

    UnitBehaviorRemove(UnitLastCreated(), "RegenGlobeTimedLife", 1);

    libNtve_gf_CreateUnitsWithDefaultFacing(1, "ItemSoulPickupTwenty", 0, 11, PointWithOffset(CameraGetTarget(1), 2.0, 0.0), null);

    UnitBehaviorRemove(UnitLastCreated(), "RegenGlobeTimedLife", 1);

    libNtve_gf_CreateUnitsWithDefaultFacing(1, "ItemSoulPickup", 0, 12, PointWithOffset(CameraGetTarget(1), -2.0, -4.0), null);

    UnitBehaviorRemove(UnitLastCreated(), "RegenGlobeTimedLife", 1);

    libNtve_gf_CreateUnitsWithDefaultFacing(1, "ItemSoulPickupFive", 0, 12, PointWithOffset(CameraGetTarget(1), 0.0, -4.0), null);

    UnitBehaviorRemove(UnitLastCreated(), "RegenGlobeTimedLife", 1);

    libNtve_gf_CreateUnitsWithDefaultFacing(1, "ItemSoulPickupTwenty", 0, 12, PointWithOffset(CameraGetTarget(1), 2.0, -4.0), null);

    UnitBehaviorRemove(UnitLastCreated(), "RegenGlobeTimedLife", 1);

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenDebugGemsNoDeath_Init () {

    libMSOC_gt_MMTombSpiderQueenDebugGemsNoDeath = TriggerCreate("libMSOC_gt_MMTombSpiderQueenDebugGemsNoDeath_Func");

    TriggerAddEventChatMessage(libMSOC_gt_MMTombSpiderQueenDebugGemsNoDeath, c_playerAny, "-gemsnodeath", true);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Debug Show Souls Collected

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenDebugShowSoulsCollected_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Conditions

    if (testConds) {

        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    DialogControlHookupUnitStatus(c_triggerControlTypeImage, "HeroUnitStatusParentFrame/CarriedMechanicScoreValueFrame/ScoreValueFrame0/Image", libGame_gv_players[1].lv_heroUnit);

    while (true) {

        libNtve_gf_SetDialogItemImage(DialogControlLastCreated(), "Assets\\Textures\\ui_ingame_bas_icons_skulls.dds", PlayerGroupAll());

        Wait(0.0625, c_timeGame);

    }

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenDebugShowSoulsCollected_Init () {

    libMSOC_gt_MMTombSpiderQueenDebugShowSoulsCollected = TriggerCreate("libMSOC_gt_MMTombSpiderQueenDebugShowSoulsCollected_Func");

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenDebugShowSoulsCollected, false);

    TriggerAddEventChatMessage(libMSOC_gt_MMTombSpiderQueenDebugShowSoulsCollected, c_playerAny, "-souls", true);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Debug Kill Souleaters

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenDebugKillSouleaters_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_iSouleaters;



    // Automatic Variable Declarations

    const int auto9107D1E2_ae = libMSOC_gv_mMTombSpiderQueenSoulEatersMaxCount_C;

    const int auto9107D1E2_ai = 1;



    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((libMSOC_gf_MMTombSpiderQueenSoulEatersCountAlive() > 0))) {

            return false;

        }



        if (!((GameCheatsEnabled(c_gameCheatCategoryDevelopment) == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_iSouleaters = 1;

    for ( ; ( (auto9107D1E2_ai >= 0 && lv_iSouleaters <= auto9107D1E2_ae) || (auto9107D1E2_ai < 0 && lv_iSouleaters >= auto9107D1E2_ae) ) ; lv_iSouleaters += auto9107D1E2_ai ) {

        if ((UnitIsAlive(libMSOC_gv_mMTombSpiderQueenSoulEaters[lv_iSouleaters]) == true)) {

            UnitKill(libMSOC_gv_mMTombSpiderQueenSoulEaters[lv_iSouleaters]);

        }



    }

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenDebugKillSouleaters_Init () {

    libMSOC_gt_MMTombSpiderQueenDebugKillSouleaters = TriggerCreate("libMSOC_gt_MMTombSpiderQueenDebugKillSouleaters_Func");

    TriggerEnable(libMSOC_gt_MMTombSpiderQueenDebugKillSouleaters, false);

    TriggerAddEventChatMessage(libMSOC_gt_MMTombSpiderQueenDebugKillSouleaters, c_playerAny, "-Souleaters", true);

}



//--------------------------------------------------------------------------------------------------

// Trigger: MMTombSpiderQueen Debug Neutral Soul

//--------------------------------------------------------------------------------------------------

bool libMSOC_gt_MMTombSpiderQueenDebugNeutralSoul_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_globe;

    int lv_player;

    int lv_team;



    // Automatic Variable Declarations

    // Variable Initialization



    // Actions

    if (!runActions) {

        return true;

    }



    lv_globe = EventPlayerEffectUsedUnit(c_effectUnitCaster);

    lv_player = EventPlayerEffectUsedUnitOwner(c_effectPlayerTarget);

    lv_team = libGame_gf_TeamNumberOfPlayer(lv_player);

    if ((lv_team == 0)) {

        return true;

    }



    UnitSetOwner(lv_globe, libGame_gv_teams[lv_team].lv_nPCPlayer, false);

    return true;

}



//--------------------------------------------------------------------------------------------------

void libMSOC_gt_MMTombSpiderQueenDebugNeutralSoul_Init () {

    libMSOC_gt_MMTombSpiderQueenDebugNeutralSoul = TriggerCreate("libMSOC_gt_MMTombSpiderQueenDebugNeutralSoul_Func");

    TriggerAddEventPlayerEffectUsed(libMSOC_gt_MMTombSpiderQueenDebugNeutralSoul, c_playerAny, "ItemSoulPickupNeutralTriggerDummy");

}



void libMSOC_InitTriggers () {

    libMSOC_gt_MMTombSpiderQueenAnnouncerInit_Init();

    libMSOC_gt_MMTombSpiderQueenInit_Init();

    libMSOC_gt_MMTombSpiderQueenPingDataInit_Init();

    libMSOC_gt_MMTombSpiderQueenUILightingInit_Init();

    libMSOC_gt_MMTombSpiderQueenGateOpen_Init();

    libMSOC_gt_MMTombSpiderQueenGameOver_Init();

    libMSOC_gt_MMTombSpiderQueenSandGolemDefenderSpawns_Init();

    libMSOC_gt_MMTombSpiderQueenSandGolemLanerSpawns_Init();

    libMSOC_gt_MMTombSpiderQueenSandGolemDeathTimerExpires_Init();

    libMSOC_gt_MMTombSpiderQueenSoulEatersDied_Init();

    libMSOC_gt_MMTombSpiderQueenSpawnSoulsCarrierDies_Init();

    libMSOC_gt_MMTombSpiderQueenSpawnSoulsNPCMindControlled_Init();

    libMSOC_gt_MMTombSpiderQueenSpawnSoulsHeroDies_Init();

    libMSOC_gt_MMTombSpiderQueenSoulSpawned_Init();

    libMSOC_gt_MMTombSpiderQueenSoulPickUp_Init();

    libMSOC_gt_MMTombSpiderQueenSoulStacksChange_Init();

    libMSOC_gt_MMTombSpiderQueenHandInSouls_Init();

    libMSOC_gt_MMTombSpiderQueenStartLightTransition_Init();

    libMSOC_gt_MMTombSpiderQueenSoulEaterImpactsATarget_Init();

    libMSOC_gt_MMTombSpiderQueenSoulEatersActive_Init();

    libMSOC_gt_MMTombSpiderQueenSoulEaterDies_Init();

    libMSOC_gt_MMTombSpiderQueenSoulEatersareDead_Init();

    libMSOC_gt_MMTombSpiderQueenAuraStartLightTransition_Init();

    libMSOC_gt_MMTombSpiderQueenSoulEaterSpawnXP_Init();

    libMSOC_gt_MMTombSpiderQueenScalingTimer_Init();

    libMSOC_gt_MMTombSpiderQueenUIModInitialize_Init();

    libMSOC_gt_MMTombSpiderQueenUIHandler_Init();

    libMSOC_gt_MMTombSpiderQueenHarrisonJonesProcced_Init();

    libMSOC_gt_HarrisonJonesVictory_Init();

    libMSOC_gt_MMTombSpiderQueenDebugEventStart_Init();

    libMSOC_gt_MMTombSpiderQueenDebugEnemyEventStart_Init();

    libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnRunMode_Init();

    libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnActive_Init();

    libMSOC_gt_MMTombSpiderQueenDebugSpiderSpawnRunModeEnemy_Init();

    libMSOC_gt_MMTombSpiderQueenDebugGemsSpawn_Init();

    libMSOC_gt_MMTombSpiderQueenDebugGemsNoDeath_Init();

    libMSOC_gt_MMTombSpiderQueenDebugShowSoulsCollected_Init();

    libMSOC_gt_MMTombSpiderQueenDebugKillSouleaters_Init();

    libMSOC_gt_MMTombSpiderQueenDebugNeutralSoul_Init();

}



//--------------------------------------------------------------------------------------------------

// Library Initialization

//--------------------------------------------------------------------------------------------------

bool libMSOC_InitLib_completed = false;



void libMSOC_InitLib () {

    if (libMSOC_InitLib_completed) {

        return;

    }



    libMSOC_InitLib_completed = true;



    libMSOC_InitLibraries();

    libMSOC_InitVariables();

    libMSOC_InitTriggers();

}