include "TriggerLibs/NativeLib"

include "TriggerLibs/HeroesLib"

include "TriggerLibs/GameLib"

include "TriggerLibs/MapMechanicsLib"

include "TriggerLibs/AILib"

include "TriggerLibs/UILib"

include "TriggerLibs/StartingExperienceLib"

include "TriggerLibs/SoundLib"

include "TriggerLibs/GameDataHelperLib"

include "TriggerLibs/SupportLib"



include "LibHCHO_h"



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

// Library: Cho'Gall

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

// External Library Initialization

void libHCHO_InitLibraries () {

    libNtve_InitVariables();

    libCore_InitVariables();

    libGame_InitVariables();

    libMapM_InitVariables();

    libAIAI_InitVariables();

    libUIUI_InitVariables();

    libStEx_InitVariables();

    libSond_InitVariables();

    libGDHL_InitVariables();

    libSprt_InitVariables();

}



// Variable Initialization

bool libHCHO_InitVariables_completed = false;



void libHCHO_InitVariables () {

    int init_i;



    if (libHCHO_InitVariables_completed) {

        return;

    }



    libHCHO_InitVariables_completed = true;



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

        libHCHO_gv_shadowBoltVolleyMousePosition[init_i] = RegionGetCenter(RegionPlayableMap());

    }

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

        libHCHO_gv_surgingFistMousePosition[init_i] = RegionGetCenter(RegionPlayableMap());

    }

    libHCHO_gv_tryMe_ChoGall_PairedPlayer_C = 3;

}



// Functions

void libHCHO_gf_HeroChoGallIncrementHeroCountFunction () {

    // Automatic Variable Declarations

    // Implementation

    libHCHO_gv_heroChoGallTriggerRegistrationVariable += 1;

    if ((libHCHO_gv_heroChoGallTriggerRegistrationVariable == 1)) {

        TriggerEnable(libHCHO_gt_ChoGallHearthstoneSpecialCase, true);

        TriggerEnable(libHCHO_gt_HeroGallShadowBoltVolleyCast, true);

        TriggerEnable(libHCHO_gt_HeroGallShadowBoltVolleyEnd, true);

        TriggerEnable(libHCHO_gt_HeroGallPsychoticBreakRespawnTimerAdjustmentBase, true);

        TriggerEnable(libHCHO_gt_SurgingFistFakeCastActivated, true);

        TriggerEnable(libHCHO_gt_SurgingFistRootsOnMonitor, true);

        TriggerEnable(libHCHO_gt_SurgingFistRootsOffMonitor, true);

        TriggerEnable(libHCHO_gt_HeroChoSurgingFistDistanceTracker, true);

        TriggerEnable(libHCHO_gt_GallRuneBombBehaviorTimerControllerTrigger, true);

        TriggerEnable(libHCHO_gt_ChoRuneBombSpawn, true);

        TriggerEnable(libHCHO_gt_GallRuneBombDetonationCooldownControl, true);

        TriggerEnable(libHCHO_gt_DEBUGChoGallVideoSwapCheat, true);

        TriggerEnable(libHCHO_gt_HeroChoGallSwapandRespawn, true);

        TriggerEnable(libHCHO_gt_DEBUGShowGall, true);

        TriggerEnable(libHCHO_gt_DEBUGAIGall, true);

        TriggerEnable(libHCHO_gt_DEBUGSwapChoGallCheat, true);

        TriggerEnable(libHCHO_gt_CCRecognitionRoot, true);

        TriggerEnable(libHCHO_gt_CCRecognitionVoidPrisonStasisOverlay, true);

        TriggerEnable(libHCHO_gt_HeroChogallChoSpawnedviaAbathurUltimateEvolution, true);

        TriggerEnable(libHCHO_gt_HeroChogallHauntedMinescameraplanechange, true);

        TriggerEnable(libHCHO_gt_HeroChogallChoDiesKillGall, true);

        TriggerEnable(libHCHO_gt_HeroChogallChoRespawnsRespawnGall, true);

        TriggerEnable(libHCHO_gt_HeroChogallGallStunnedorSilencedStop, true);

        TriggerEnable(libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOn, true);

        TriggerEnable(libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOff, true);

        TriggerEnable(libHCHO_gt_HeroChogallStasisBehaviorForwarding, true);

        TriggerEnable(libHCHO_gt_HeroChogallMoltenBlock, true);

        TriggerEnable(libHCHO_gt_HeroChogallHealingFountainCooldownforGall, true);

        TriggerEnable(libHCHO_gt_HeroChogallChoEntersTransport, true);

        TriggerEnable(libHCHO_gt_HeroChogallChoExitsTransport, true);

        TriggerEnable(libHCHO_gt_HeroChogallVehicleStart, true);

        TriggerEnable(libHCHO_gt_HeroChogallVehicleStop, true);

        TriggerEnable(libHCHO_gt_HeroChoGallDeathRecapSpecialCaseforGallChoDies, true);

        TriggerEnable(libHCHO_gt_HeroChoShadowBoltVolleyVehicleActorHook, true);

        TriggerEnable(libHCHO_gt_HeroChoMoltenBlockOverlayOn, true);

        TriggerEnable(libHCHO_gt_HeroChoMoltenBlockOverlayOff, true);

        TriggerEnable(libHCHO_gt_HeroGallShoveRootOff, true);

        TriggerEnable(libHCHO_gt_HeroGallShoveRootOn, true);

        TriggerEnable(libHCHO_gt_HeroChoTheWillofChoHeroTakedownProc, true);

        TriggerEnable(libHCHO_gt_HeroGallTheWillofGallTakedownProc, true);

        TriggerEnable(libHCHO_gt_HeroChoHourofTwilightDeathTimerReduction, true);

        TriggerEnable(libHCHO_gt_HeroChoGallTryMeModeSetLevelSpecialCase, true);

        TriggerEnable(libHCHO_gt_HeroChoRuneBombRunicFeedbackDamageResponses, true);

        TriggerEnable(libHCHO_gt_HeroGallDreadOrbEnragedRegenerationDamageResponse, true);

        TriggerEnable(libHCHO_gt_HeroChoTheWillofChoMinionTakedownProc, true);

    }



}



void libHCHO_gf_HeroChoGallDecrementHeroCountFunction () {

    // Automatic Variable Declarations

    // Implementation

    libHCHO_gv_heroChoGallTriggerRegistrationVariable -= 1;

    if ((libHCHO_gv_heroChoGallTriggerRegistrationVariable < 0)) {

        libHCHO_gv_heroChoGallTriggerRegistrationVariable = 0;

    }



    if ((libHCHO_gv_heroChoGallTriggerRegistrationVariable == 0)) {

        TriggerEnable(libHCHO_gt_ChoGallHearthstoneSpecialCase, false);

        TriggerEnable(libHCHO_gt_HeroGallShadowBoltVolleyCast, false);

        TriggerEnable(libHCHO_gt_HeroGallShadowBoltVolleyEnd, false);

        TriggerEnable(libHCHO_gt_HeroGallPsychoticBreakRespawnTimerAdjustmentBase, false);

        TriggerEnable(libHCHO_gt_SurgingFistFakeCastActivated, false);

        TriggerEnable(libHCHO_gt_SurgingFistMouseTracker, false);

        TriggerEnable(libHCHO_gt_SurgingFistExecuteChargetomouse, false);

        TriggerEnable(libHCHO_gt_SurgingFistRootsOnMonitor, false);

        TriggerEnable(libHCHO_gt_SurgingFistRootsOffMonitor, false);

        TriggerEnable(libHCHO_gt_HeroChoSurgingFistDistanceTracker, false);

        TriggerEnable(libHCHO_gt_GallRuneBombBehaviorTimerControllerTrigger, false);

        TriggerEnable(libHCHO_gt_ChoRuneBombSpawn, false);

        TriggerEnable(libHCHO_gt_GallRuneBombDetonationCooldownControl, false);

        TriggerEnable(libHCHO_gt_DEBUGChoGallVideoSwapCheat, false);

        TriggerEnable(libHCHO_gt_HeroChoGallSwapandRespawn, false);

        TriggerEnable(libHCHO_gt_DEBUGShowGall, false);

        TriggerEnable(libHCHO_gt_DEBUGAIGall, false);

        TriggerEnable(libHCHO_gt_DEBUGSwapChoGallCheat, false);

        TriggerEnable(libHCHO_gt_CCRecognitionRoot, false);

        TriggerEnable(libHCHO_gt_CCRecognitionVoidPrisonStasisOverlay, false);

        TriggerEnable(libHCHO_gt_HeroChogallChoSpawnedviaAbathurUltimateEvolution, false);

        TriggerEnable(libHCHO_gt_HeroChogallHauntedMinescameraplanechange, false);

        TriggerEnable(libHCHO_gt_HeroChogallChoDiesKillGall, false);

        TriggerEnable(libHCHO_gt_HeroChoGallChoRemovedRemoveGall, false);

        TriggerEnable(libHCHO_gt_HeroChogallChoRespawnsRespawnGall, false);

        TriggerEnable(libHCHO_gt_HeroChogallGallStunnedorSilencedStop, false);

        TriggerEnable(libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOn, false);

        TriggerEnable(libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOff, false);

        TriggerEnable(libHCHO_gt_HeroChogallStasisBehaviorForwarding, false);

        TriggerEnable(libHCHO_gt_HeroChogallMoltenBlock, false);

        TriggerEnable(libHCHO_gt_HeroChogallHealingFountainCooldownforGall, false);

        TriggerEnable(libHCHO_gt_HeroChogallChoEntersTransport, false);

        TriggerEnable(libHCHO_gt_HeroChogallChoExitsTransport, false);

        TriggerEnable(libHCHO_gt_HeroChogallVehicleStart, false);

        TriggerEnable(libHCHO_gt_HeroChogallVehicleStop, false);

        TriggerEnable(libHCHO_gt_HeroChoGallDeathRecapSpecialCaseforGallChoDies, false);

        TriggerEnable(libHCHO_gt_HeroChoShadowBoltVolleyVehicleActorHook, false);

        TriggerEnable(libHCHO_gt_HeroChoMoltenBlockOverlayOn, false);

        TriggerEnable(libHCHO_gt_HeroChoMoltenBlockOverlayOff, false);

        TriggerEnable(libHCHO_gt_HeroGallShoveRootOff, false);

        TriggerEnable(libHCHO_gt_HeroGallShoveRootOn, false);

        TriggerEnable(libHCHO_gt_HeroChoTheWillofChoHeroTakedownProc, false);

        TriggerEnable(libHCHO_gt_HeroGallTheWillofGallTakedownProc, false);

        TriggerEnable(libHCHO_gt_HeroChoHourofTwilightDeathTimerReduction, false);

        TriggerEnable(libHCHO_gt_HeroChoGallTryMeModeSetLevelSpecialCase, false);

        TriggerEnable(libHCHO_gt_HeroChoRuneBombRunicFeedbackDamageResponses, false);

        TriggerEnable(libHCHO_gt_HeroGallDreadOrbEnragedRegenerationDamageResponse, false);

        TriggerEnable(libHCHO_gt_HeroChoTheWillofChoMinionTakedownProc, false);

    }



}



trigger auto_libHCHO_gf_GallRuneBombBeahviorTimerController_Trigger = null;

int auto_libHCHO_gf_GallRuneBombBeahviorTimerController_lp_PlayerNumber;

unit auto_libHCHO_gf_GallRuneBombBeahviorTimerController_lp_OrbUnit;



void libHCHO_gf_GallRuneBombBeahviorTimerController (int lp_PlayerNumber, unit lp_OrbUnit) {

    auto_libHCHO_gf_GallRuneBombBeahviorTimerController_lp_PlayerNumber = lp_PlayerNumber;

    auto_libHCHO_gf_GallRuneBombBeahviorTimerController_lp_OrbUnit = lp_OrbUnit;



    if (auto_libHCHO_gf_GallRuneBombBeahviorTimerController_Trigger == null) {

        auto_libHCHO_gf_GallRuneBombBeahviorTimerController_Trigger = TriggerCreate("auto_libHCHO_gf_GallRuneBombBeahviorTimerController_TriggerFunc");

    }



    TriggerExecute(auto_libHCHO_gf_GallRuneBombBeahviorTimerController_Trigger, false, false);

}



bool auto_libHCHO_gf_GallRuneBombBeahviorTimerController_TriggerFunc (bool testConds, bool runActions) {

    int lp_PlayerNumber = auto_libHCHO_gf_GallRuneBombBeahviorTimerController_lp_PlayerNumber;

    unit lp_OrbUnit = auto_libHCHO_gf_GallRuneBombBeahviorTimerController_lp_OrbUnit;



    // Variable Declarations

    fixed lv_runeBombDistanceToCho;

    fixed lv_runeBombSpeed;

    fixed lv_timeToImpact;

    int lv_choGallPairsTeamID;

    unit lv_runeBomb;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_choGallPairsTeamID = libGame_gf_TeamNumberOfPlayer(lp_PlayerNumber);

    lv_runeBomb = lp_OrbUnit;



    // Implementation

    lv_runeBombSpeed = CatalogReferenceGetAsInt("Mover,ChoRuneBombReturnMissile,MotionPhases[0].Speed", libGDHL_gv_chogallPairs[lv_choGallPairsTeamID].lv_choPlayer);

    lv_runeBombDistanceToCho = DistanceBetweenPoints(UnitGetPosition(lv_runeBomb), UnitGetPosition(libGDHL_gv_chogallPairs[lv_choGallPairsTeamID].lv_choUnit));

    lv_timeToImpact = (lv_runeBombDistanceToCho / lv_runeBombSpeed);

    if ((lv_timeToImpact > UnitBehaviorDuration(lp_OrbUnit, "ChoRuneBombTalentRollbackTimedLife"))) {

        lv_timeToImpact = UnitBehaviorDuration(lp_OrbUnit, "ChoRuneBombTalentRollbackTimedLife");

    }



    UnitBehaviorSetDuration(libGDHL_gv_chogallPairs[lv_choGallPairsTeamID].lv_gallUnit, "GallRunicBlastOrbActive", lv_timeToImpact);

    while (((UnitIsAlive(lp_OrbUnit) == true) && (UnitIsAlive(libGDHL_gv_chogallPairs[lv_choGallPairsTeamID].lv_gallUnit) == true) && (UnitHasBehavior2(lv_runeBomb, "ChoRuneBombDetonationImmunity") == false) && (UnitHasBehavior2(lv_runeBomb, "ChoRuneBombDetonated") == false))) {

        lv_runeBombSpeed = CatalogReferenceGetAsInt("Mover,ChoRuneBombReturnMissile,MotionPhases[0].Speed", libGDHL_gv_chogallPairs[lv_choGallPairsTeamID].lv_choPlayer);

        lv_runeBombDistanceToCho = DistanceBetweenPoints(UnitGetPosition(lv_runeBomb), UnitGetPosition(libGDHL_gv_chogallPairs[lv_choGallPairsTeamID].lv_choUnit));

        lv_timeToImpact = (lv_runeBombDistanceToCho / lv_runeBombSpeed);

        if ((UnitBehaviorDuration(lv_runeBomb, "ChoRuneBombTalentRollbackTimedLife") < lv_timeToImpact)) {

            UnitBehaviorSetDurationRemaining(libGDHL_gv_chogallPairs[lv_choGallPairsTeamID].lv_gallUnit, "GallRunicBlastOrbActive", UnitBehaviorDuration(lv_runeBomb, "ChoRuneBombTalentRollbackTimedLife"));

        }

        else {

            UnitBehaviorSetDurationRemaining(libGDHL_gv_chogallPairs[lv_choGallPairsTeamID].lv_gallUnit, "GallRunicBlastOrbActive", lv_timeToImpact);

        }

        Wait(0.0625, c_timeGame);

    }

    UnitBehaviorRemove(libGDHL_gv_chogallPairs[lv_choGallPairsTeamID].lv_gallUnit, "GallRunicBlastOrbActive", 1);

    return true;

}



void libHCHO_gf_ChoGallSwapandRespawnApplySavedTalents (int lp_playerID) {

    // Variable Declarations

    int lv_itTalent;

    int lv_numberOfPreviousTalents;



    // Automatic Variable Declarations

    const int auto5805408A_ae = 7;

    const int auto5805408A_ai = 1;



    // Variable Initialization



    // Implementation

    lv_itTalent = 1;

    for ( ; ( (auto5805408A_ai >= 0 && lv_itTalent <= auto5805408A_ae) || (auto5805408A_ai < 0 && lv_itTalent >= auto5805408A_ae) ) ; lv_itTalent += auto5805408A_ai ) {

        if ((libHCHO_gv_choGallSwapandRespawnSavedTalents[lv_itTalent] != 0) && (UnitGetPropertyFixed(libGame_gv_players[lp_playerID].lv_heroUnit, c_unitPropLevel, c_unitPropCurrent) >= libGame_gv_players[lp_playerID].lv_talents_TierLevels[lv_itTalent].lv_level)) {

            lv_numberOfPreviousTalents += libGame_gv_talents_TalentChoices[lp_playerID][(lv_itTalent - 1)].lv_numberOfTalentsForThisTier;

            libGame_gf_TalentsChooseTalentForPlayer(lv_itTalent, libHCHO_gv_choGallSwapandRespawnSavedTalents[lv_itTalent], lp_playerID);

        }

        else {

            break;

        }

    }

}



trigger auto_libHCHO_gf_HeroChogallGallFollow_Trigger = null;

unit auto_libHCHO_gf_HeroChogallGallFollow_lp_gallUnit;



void libHCHO_gf_HeroChogallGallFollow (unit lp_gallUnit) {

    auto_libHCHO_gf_HeroChogallGallFollow_lp_gallUnit = lp_gallUnit;



    if (auto_libHCHO_gf_HeroChogallGallFollow_Trigger == null) {

        auto_libHCHO_gf_HeroChogallGallFollow_Trigger = TriggerCreate("auto_libHCHO_gf_HeroChogallGallFollow_TriggerFunc");

    }



    TriggerExecute(auto_libHCHO_gf_HeroChogallGallFollow_Trigger, false, false);

}



bool auto_libHCHO_gf_HeroChogallGallFollow_TriggerFunc (bool testConds, bool runActions) {

    unit lp_gallUnit = auto_libHCHO_gf_HeroChogallGallFollow_lp_gallUnit;



    // Variable Declarations

    int lv_gallPlayerID;

    int lv_choGallPairsTeam;



    // Automatic Variable Declarations

    // Variable Initialization



    // Implementation

    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(lp_gallUnit));

    lv_gallPlayerID = UnitGetOwner(lp_gallUnit);

    if (((lv_gallPlayerID == 0) || (lv_gallPlayerID > libCore_gv_bALMaxPlayers))) {

        return true;

    }



    while (((UnitGetType(libGame_gv_players[lv_gallPlayerID].lv_heroUnit) == "HeroGall") || (UnitGetType(libGame_gv_players[lv_gallPlayerID].lv_heroUnit) == "HeroCho")) && (libGame_gv_gameOver == false) && (UnitIsValid(lp_gallUnit) == true) && (UnitIsAlive(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit) == true) && (UnitIsAlive(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choUnit) == true)) {

        while ((UnitHasBehavior2(lp_gallUnit, "GallPsychoticBreakDyingBehavior") == true)) {

            Wait(0.0625, c_timeGame);

        }

        if ((DistanceBetweenPoints(UnitGetPosition(lp_gallUnit), UnitGetPosition(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallFollowUnit)) >= 4.0)) {

            UnitSetPosition(lp_gallUnit, UnitGetPosition(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallFollowUnit), false);

        }

        else {

            UnitSetPosition(lp_gallUnit, UnitGetPosition(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallFollowUnit), true);

        }

        UnitSetPropertyFixed(lp_gallUnit, c_unitPropLifeMax, UnitGetPropertyFixed(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choUnit, c_unitPropLifeMax, c_unitPropCurrent));

        UnitSetPropertyFixed(lp_gallUnit, c_unitPropLife, UnitGetPropertyFixed(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choUnit, c_unitPropLife, c_unitPropCurrent));

        Wait(0.0625, c_timeGame);

    }

    return true;

}



void libHCHO_gf_HeroGallStartAFKTimer (int lp_gallPlayer) {

    // Automatic Variable Declarations

    // Implementation

    Wait((libCore_gv_bALOpenTheGatesDelay + libGame_gv_afk_AfkInitialTimerStartDelay_C), c_timeGame);

    TimerStart(libGame_gv_afk_PlayerAfkWarningTimer[lp_gallPlayer], libGame_gv_afk_AfkWarningTimerDuration_C, false, c_timeGame);

}



// Triggers

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

// Trigger: Force Include Data Mods

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

bool libHCHO_gt_ForceIncludeDataMods_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Actions

    if (!runActions) {

        return true;

    }



    TriggerExecute(libAIAI_gt_IncludeAI, true, false);

    TriggerExecute(libGame_gt_IncludeGame, true, false);

    TriggerExecute(libGDHL_gt_IncludeGameDataHelper, true, false);

    TriggerExecute(libMapM_gt_IncludeMapMechanics, true, false);

    TriggerExecute(libSond_gt_IncludeSound, true, false);

    TriggerExecute(libSprt_gt_IncludeSupport, true, false);

    TriggerExecute(libUIUI_gt_IncludeUI, true, false);

    return true;

}



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

void libHCHO_gt_ForceIncludeDataMods_Init () {

    libHCHO_gt_ForceIncludeDataMods = TriggerCreate("libHCHO_gt_ForceIncludeDataMods_Func");

    TriggerAddEventMapInit(libHCHO_gt_ForceIncludeDataMods);

}



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

// Trigger: Cho'Gall Hearthstone Special Case

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

bool libHCHO_gt_ChoGallHearthstoneSpecialCase_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_portingPlayer;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_portingPlayer = libGame_gf_HeroPortedBackToTownPlayer();



    // Conditions

    if (testConds) {

        if (!((UnitGetType(libGame_gv_players[lv_portingPlayer].lv_heroUnit) == "HeroCho"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libGame_gf_CameraPanCameraForPlayerAndUpdateMapBoundsIfNecessary(libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(lv_portingPlayer)].lv_gallPlayer, UnitGetPosition(libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(lv_portingPlayer)].lv_gallFollowUnit), 0.0, -1, 0.0, false);

    return true;

}



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

void libHCHO_gt_ChoGallHearthstoneSpecialCase_Init () {

    libHCHO_gt_ChoGallHearthstoneSpecialCase = TriggerCreate("libHCHO_gt_ChoGallHearthstoneSpecialCase_Func");

    TriggerEnable(libHCHO_gt_ChoGallHearthstoneSpecialCase, false);

    libGame_gf_HeroPortedBackToTown(libHCHO_gt_ChoGallHearthstoneSpecialCase);

}



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

// Trigger: Hero - Gall - Shadow Bolt Volley Cast

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

bool libHCHO_gt_HeroGallShadowBoltVolleyCast_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Actions

    if (!runActions) {

        return true;

    }



    libHCHO_gv_shadowBoltVolleyFlag[EventPlayer()] = true;

    Wait(0.0625, c_timeGame);

    CatalogFieldValueSetFixed(c_gameCatalogUnit, "HeroGall", "StationaryTurningRate", EventPlayer(), 62.5);

    return true;

}



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

void libHCHO_gt_HeroGallShadowBoltVolleyCast_Init () {

    libHCHO_gt_HeroGallShadowBoltVolleyCast = TriggerCreate("libHCHO_gt_HeroGallShadowBoltVolleyCast_Func");

    TriggerEnable(libHCHO_gt_HeroGallShadowBoltVolleyCast, false);

    TriggerAddEventUnitBehaviorChange(libHCHO_gt_HeroGallShadowBoltVolleyCast, null, "GallShadowboltVolleyCaster", c_unitBehaviorChangeActivate);

}



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

// Trigger: Hero - Gall - Shadow Bolt Volley End

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

bool libHCHO_gt_HeroGallShadowBoltVolleyEnd_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_i;

    bool lv_infernoBreathAimTriggerEnabled;

    int lv_diabloIndex;

    int lv_triggeringDiabloPlayer;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_triggeringDiabloPlayer = EventPlayer();



    // Actions

    if (!runActions) {

        return true;

    }



    libHCHO_gv_shadowBoltVolleyFlag[lv_triggeringDiabloPlayer] = false;

    CatalogFieldValueSetFixed(c_gameCatalogUnit, "HeroGall", "StationaryTurningRate", lv_triggeringDiabloPlayer, 1760.0);

    return true;

}



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

void libHCHO_gt_HeroGallShadowBoltVolleyEnd_Init () {

    libHCHO_gt_HeroGallShadowBoltVolleyEnd = TriggerCreate("libHCHO_gt_HeroGallShadowBoltVolleyEnd_Func");

    TriggerEnable(libHCHO_gt_HeroGallShadowBoltVolleyEnd, false);

    TriggerAddEventUnitBehaviorChange(libHCHO_gt_HeroGallShadowBoltVolleyEnd, null, "GallShadowboltVolleyCaster", c_unitBehaviorChangeDeactivate);

}



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

// Trigger: Hero - Cho - Shadow Bolt Volley Vehicle Actor Hook

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

bool libHCHO_gt_HeroChoShadowBoltVolleyVehicleActorHook_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeam;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(EventPlayerEffectUsedUnitOwner(c_effectPlayerCaster));



    // Conditions

    if (testConds) {

        if (!((UnitHasBehavior2(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choUnit, "UsingVehicle") == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    UnitCreateEffectUnit(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, "GallShadowBoltVolleyChoAlertDummy", libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choUnit);

    return true;

}



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

void libHCHO_gt_HeroChoShadowBoltVolleyVehicleActorHook_Init () {

    libHCHO_gt_HeroChoShadowBoltVolleyVehicleActorHook = TriggerCreate("libHCHO_gt_HeroChoShadowBoltVolleyVehicleActorHook_Func");

    TriggerEnable(libHCHO_gt_HeroChoShadowBoltVolleyVehicleActorHook, false);

    TriggerAddEventPlayerEffectUsed(libHCHO_gt_HeroChoShadowBoltVolleyVehicleActorHook, c_playerAny, "GallShadowBoltVolleyPrepEffectChoSearch");

}



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

// Trigger: Hero - Gall - Shove Root On

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

bool libHCHO_gt_HeroGallShoveRootOn_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_gallPlayer;



    // Automatic Variable Declarations

    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((UnitGetOwner(EventUnit()) == libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()))].lv_choPlayer))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_gallPlayer = libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()))].lv_gallPlayer;

    return true;

}



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

void libHCHO_gt_HeroGallShoveRootOn_Init () {

    libHCHO_gt_HeroGallShoveRootOn = TriggerCreate("libHCHO_gt_HeroGallShoveRootOn_Func");

    TriggerEnable(libHCHO_gt_HeroGallShoveRootOn, false);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_HeroGallShoveRootOn, null, c_behaviorCategoryDebuffRoot, c_unitBehaviorChangeCreate);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_HeroGallShoveRootOn, null, c_behaviorCategoryDebuffRoot, c_unitBehaviorChangeRefresh);

}



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

// Trigger: Hero - Gall - Shove Root Off

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

bool libHCHO_gt_HeroGallShoveRootOff_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_gallPlayer;



    // Automatic Variable Declarations

    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((UnitGetOwner(EventUnit()) == libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()))].lv_choPlayer))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_gallPlayer = libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()))].lv_gallPlayer;

    return true;

}



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

void libHCHO_gt_HeroGallShoveRootOff_Init () {

    libHCHO_gt_HeroGallShoveRootOff = TriggerCreate("libHCHO_gt_HeroGallShoveRootOff_Func");

    TriggerEnable(libHCHO_gt_HeroGallShoveRootOff, false);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_HeroGallShoveRootOff, null, c_behaviorCategoryDebuffRoot, c_unitBehaviorChangeDeactivate);

}



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

// Trigger: Hero - Cho - Hour of Twilight Death Timer Reduction

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

bool libHCHO_gt_HeroChoHourofTwilightDeathTimerReduction_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeam;

    int lv_choPlayer;

    fixed lv_choTimer;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(libGame_gf_HeroKilledPlayer());

    lv_choPlayer = libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choPlayer;



    // Conditions

    if (testConds) {

        if (!(((libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(libGame_gf_HeroKilledPlayer())].lv_gallUnit == libGame_gf_HeroKilledUnit()) || (libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(libGame_gf_HeroKilledPlayer())].lv_choUnit == libGame_gf_HeroKilledUnit())))) {

            return false;

        }



        if (!((PlayerHasTalent(lv_choPlayer, "ChoHourofTwilight") == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    if ((libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(libGame_gf_HeroKilledPlayer())].lv_gallUnit == libGame_gf_HeroKilledUnit())) {

        lv_choTimer = TimerGetRemaining(libGame_gv_players[lv_choPlayer].lv_respawnTimer);

        libGame_gf_HeroDeathUpdateRespawnTimer(libGame_gf_HeroKilledPlayer(), lv_choTimer);

    }

    else {

        lv_choTimer = (TimerGetRemaining(libGame_gv_players[lv_choPlayer].lv_respawnTimer) * libHCHO_gv_heroChoHourofTwilightTalentDeathTimerReductionScale);

        libGame_gf_HeroDeathUpdateRespawnTimer(libGame_gf_HeroKilledPlayer(), lv_choTimer);

    }

    return true;

}



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

void libHCHO_gt_HeroChoHourofTwilightDeathTimerReduction_Init () {

    libHCHO_gt_HeroChoHourofTwilightDeathTimerReduction = TriggerCreate("libHCHO_gt_HeroChoHourofTwilightDeathTimerReduction_Func");

    TriggerEnable(libHCHO_gt_HeroChoHourofTwilightDeathTimerReduction, false);

    libGame_gf_HeroKilled(libHCHO_gt_HeroChoHourofTwilightDeathTimerReduction);

}



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

// Trigger: Hero - Gall - Psychotic Break Respawn Timer Adjustment Base

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

bool libHCHO_gt_HeroGallPsychoticBreakRespawnTimerAdjustmentBase_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choPlayer;

    unit lv_choUnit;

    fixed lv_choTimer;

    int lv_choGallPairsTeam;



    // Automatic Variable Declarations

    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(libGame_gf_HeroKilledPlayer())].lv_gallUnit == libGame_gf_HeroKilledUnit()))) {

            return false;

        }



        if (!((PlayerHasTalent(libGame_gf_HeroKilledPlayer(), "GallPsychoticBreak") == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(libGame_gf_HeroKilledPlayer());

    lv_choPlayer = libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choPlayer;

    lv_choUnit = libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit;

    lv_choTimer = TimerGetRemaining(libGame_gv_players[lv_choPlayer].lv_respawnTimer);

    Wait(0.0625, c_timeGame);

    libGame_gf_HeroDeathUpdateRespawnTimer(libGame_gf_HeroKilledPlayer(), lv_choTimer);

    while ((UnitBehaviorCount(lv_choUnit, "GallPsychoticBreakDyingBehavior") == 1)) {

        lv_choTimer = TimerGetRemaining(libGame_gv_players[lv_choPlayer].lv_respawnTimer);

        libGame_gf_HeroDeathUpdateRespawnTimer(libGame_gf_HeroKilledPlayer(), lv_choTimer);

        Wait(0.5, c_timeGame);

    }

    return true;

}



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

void libHCHO_gt_HeroGallPsychoticBreakRespawnTimerAdjustmentBase_Init () {

    libHCHO_gt_HeroGallPsychoticBreakRespawnTimerAdjustmentBase = TriggerCreate("libHCHO_gt_HeroGallPsychoticBreakRespawnTimerAdjustmentBase_Func");

    TriggerEnable(libHCHO_gt_HeroGallPsychoticBreakRespawnTimerAdjustmentBase, false);

    libGame_gf_HeroKilled(libHCHO_gt_HeroGallPsychoticBreakRespawnTimerAdjustmentBase);

}



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

// Trigger: Hero - Cho - The Will of Cho - Hero Takedown Proc

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

bool libHCHO_gt_HeroChoTheWillofChoHeroTakedownProc_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choPlayer;

    unit lv_cho;



    // Automatic Variable Declarations

    const int auto05A6B816_n = 10;

    int auto05A6B816_i;



    // Variable Initialization

    lv_choPlayer = libGame_gf_HeroParticipatedInTakedownKillingPlayer();

    lv_cho = libGame_gv_players[lv_choPlayer].lv_heroUnit;



    // Conditions

    if (testConds) {

        if (!((lv_choPlayer >= 1))) {

            return false;

        }



        if (!((lv_choPlayer <= libCore_gv_bALMaxPlayers))) {

            return false;

        }



        if (!((PlayerHasTalent(lv_choPlayer, "ChoTheWillofCho") == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    for (auto05A6B816_i = 1; auto05A6B816_i <= auto05A6B816_n; auto05A6B816_i += 1) {

        UnitCreateEffectUnit(lv_cho, "ChoWillofChoModifyToken", lv_cho);

    }

    return true;

}



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

void libHCHO_gt_HeroChoTheWillofChoHeroTakedownProc_Init () {

    libHCHO_gt_HeroChoTheWillofChoHeroTakedownProc = TriggerCreate("libHCHO_gt_HeroChoTheWillofChoHeroTakedownProc_Func");

    TriggerEnable(libHCHO_gt_HeroChoTheWillofChoHeroTakedownProc, false);

    libGame_gf_HeroParticipatedInTakedown(libHCHO_gt_HeroChoTheWillofChoHeroTakedownProc);

}



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

// Trigger: Hero - Cho - The Will of Cho - Minion Takedown Proc

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

bool libHCHO_gt_HeroChoTheWillofChoMinionTakedownProc_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_killingPlayer;

    unit lv_killingHero;

    unit lv_minion;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_killingPlayer = libGame_gf_HeroParticipatedInNPCTakedownKillingPlayer();

    lv_killingHero = libGame_gv_players[lv_killingPlayer].lv_heroUnit;

    lv_minion = libGame_gf_HeroParticipatedInNPCTakedownMinion();



    // Conditions

    if (testConds) {

        if (!((PlayerHasTalent(lv_killingPlayer, "ChoTheWillofCho") == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    if (((UnitTypeTestAttribute(UnitGetType(lv_minion), c_unitAttributeSummoned) == true) || (UnitTypeTestAttribute(UnitGetType(lv_minion), c_unitAttributeUser1) == true) || (UnitTypeTestAttribute(UnitGetType(lv_minion), c_unitAttributeMapBoss) == true))) {

        return true;

    }



    if ((UnitTypeTestAttribute(UnitGetType(lv_minion), c_unitAttributeMinion) == true) && (UnitFilterMatch(lv_minion, lv_killingPlayer, UnitFilter(0, 0, (1 << c_targetFilterCreep) | (1 << c_targetFilterMerc), 0)) == true)) {

        UnitCreateEffectUnit(lv_killingHero, "ChoWillofChoModifyToken", lv_killingHero);

    }



    return true;

}



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

void libHCHO_gt_HeroChoTheWillofChoMinionTakedownProc_Init () {

    libHCHO_gt_HeroChoTheWillofChoMinionTakedownProc = TriggerCreate("libHCHO_gt_HeroChoTheWillofChoMinionTakedownProc_Func");

    TriggerEnable(libHCHO_gt_HeroChoTheWillofChoMinionTakedownProc, false);

    libGame_gf_HeroParticipatedInNPCTakedown(libHCHO_gt_HeroChoTheWillofChoMinionTakedownProc);

}



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

// Trigger: Hero - Gall - The Will of Gall - Takedown Proc

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

bool libHCHO_gt_HeroGallTheWillofGallTakedownProc_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_gallPlayer;

    unit lv_gall;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_gallPlayer = libGame_gf_HeroParticipatedInTakedownKillingPlayer();

    lv_gall = libGame_gv_players[lv_gallPlayer].lv_heroUnit;



    // Conditions

    if (testConds) {

        if (!((lv_gallPlayer >= 1))) {

            return false;

        }



        if (!((lv_gallPlayer <= libCore_gv_bALMaxPlayers))) {

            return false;

        }



        if (!((PlayerHasTalent(lv_gallPlayer, "GallTheWillofGall") == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    UnitCreateEffectUnit(lv_gall, "GallWillofGallModifyTokenPersistent", lv_gall);

    return true;

}



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

void libHCHO_gt_HeroGallTheWillofGallTakedownProc_Init () {

    libHCHO_gt_HeroGallTheWillofGallTakedownProc = TriggerCreate("libHCHO_gt_HeroGallTheWillofGallTakedownProc_Func");

    TriggerEnable(libHCHO_gt_HeroGallTheWillofGallTakedownProc, false);

    libGame_gf_HeroParticipatedInTakedown(libHCHO_gt_HeroGallTheWillofGallTakedownProc);

}



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

// Trigger: Hero - Cho - Molten Block Overlay On

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

bool libHCHO_gt_HeroChoMoltenBlockOverlayOn_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Actions

    if (!runActions) {

        return true;

    }



    if ((UnitIsAlive(EventUnit()) == true) && (UnitTestState(EventUnit(), c_unitStateHallucination) == false) && (UnitHasBehavior2(EventUnit(), "HeroGenericIgnoreFullscreenOverlay") == false)) {

        libUIUI_gf_FullscreenOverlayAddItemForPlayer(EventPlayer(), libUIUI_ge_FullscreenOverlayPriorities_Stasis, "Cutscenes\\GameUI_StasisOverlay.StormCutscene", EventUnitBehavior());

    }



    return true;

}



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

void libHCHO_gt_HeroChoMoltenBlockOverlayOn_Init () {

    libHCHO_gt_HeroChoMoltenBlockOverlayOn = TriggerCreate("libHCHO_gt_HeroChoMoltenBlockOverlayOn_Func");

    TriggerEnable(libHCHO_gt_HeroChoMoltenBlockOverlayOn, false);

    TriggerAddEventUnitBehaviorChange(libHCHO_gt_HeroChoMoltenBlockOverlayOn, null, "GallMoltenBlockStasis", c_unitBehaviorChangeActivate);

}



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

// Trigger: Hero - Cho - Molten Block Overlay Off

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

bool libHCHO_gt_HeroChoMoltenBlockOverlayOff_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Actions

    if (!runActions) {

        return true;

    }



    if ((UnitHasBehavior2(EventUnit(), "HeroGenericIgnoreFullscreenOverlay") == false)) {

        libUIUI_gf_FullscreenOverlayRemoveItemFromQueueForPlayer(EventPlayer(), "Cutscenes\\GameUI_StasisOverlay.StormCutscene", EventUnitBehavior());

    }



    return true;

}



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

void libHCHO_gt_HeroChoMoltenBlockOverlayOff_Init () {

    libHCHO_gt_HeroChoMoltenBlockOverlayOff = TriggerCreate("libHCHO_gt_HeroChoMoltenBlockOverlayOff_Func");

    TriggerEnable(libHCHO_gt_HeroChoMoltenBlockOverlayOff, false);

    TriggerAddEventUnitBehaviorChange(libHCHO_gt_HeroChoMoltenBlockOverlayOff, null, "GallMoltenBlockStasis", c_unitBehaviorChangeDestroy);

}



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

// Trigger: Hero - Cho - Rune Bomb - Runic Feedback Damage Responses

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

bool libHCHO_gt_HeroChoRuneBombRunicFeedbackDamageResponses_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_unit;

    unit lv_gall;

    int lv_gallPlayer;

    unit lv_cho;

    int lv_choPlayer;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_unit = EventUnit();

    lv_gall = EventUnitDamageSourceUnit();

    lv_gallPlayer = UnitGetOwner(lv_gall);

    lv_cho = libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(lv_gallPlayer)].lv_choUnit;

    lv_choPlayer = UnitGetOwner(lv_cho);



    // Conditions

    if (testConds) {

        if (!((PlayerHasTalent(lv_choPlayer, "ChoRunicFeedback") == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    if ((UnitTypeTestAttribute(UnitGetType(lv_unit), c_unitAttributeHeroic) == true)) {

        UnitCreateEffectUnit(lv_cho, "ChoRuneBombRunicFeedbackTalentModifyCooldownHeroTarget", lv_cho);

    }

    else {

        UnitCreateEffectUnit(lv_cho, "ChoRuneBombRunicFeedbackTalentModifyCooldown", lv_cho);

    }

    return true;

}



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

void libHCHO_gt_HeroChoRuneBombRunicFeedbackDamageResponses_Init () {

    libHCHO_gt_HeroChoRuneBombRunicFeedbackDamageResponses = TriggerCreate("libHCHO_gt_HeroChoRuneBombRunicFeedbackDamageResponses_Func");

    TriggerEnable(libHCHO_gt_HeroChoRuneBombRunicFeedbackDamageResponses, false);

    TriggerAddEventUnitDamaged(libHCHO_gt_HeroChoRuneBombRunicFeedbackDamageResponses, null, c_unitDamageTypeAbility, c_unitDamageEither, "GallRunicBlastImpactDamage");

}



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

// Trigger: Hero - Gall - Dread Orb - Enraged Regeneration Damage Response

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

bool libHCHO_gt_HeroGallDreadOrbEnragedRegenerationDamageResponse_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_unit;

    unit lv_gall;

    int lv_gallPlayer;

    unit lv_cho;

    int lv_choPlayer;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_unit = EventUnit();

    lv_gall = EventUnitDamageSourceUnit();

    lv_gallPlayer = UnitGetOwner(lv_gall);

    lv_cho = libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(lv_gallPlayer)].lv_choUnit;

    lv_choPlayer = UnitGetOwner(lv_cho);



    // Conditions

    if (testConds) {

        if (!((PlayerHasTalent(lv_choPlayer, "ChoEnragedRegeneration") == true))) {

            return false;

        }



        if (!((UnitTypeTestAttribute(UnitGetType(lv_unit), c_unitAttributeHeroic) == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    UnitCreateEffectUnit(lv_gall, "GallDreadOrbEnragedRegenerationTalentApplyHealingDebuff", lv_unit);

    return true;

}



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

void libHCHO_gt_HeroGallDreadOrbEnragedRegenerationDamageResponse_Init () {

    libHCHO_gt_HeroGallDreadOrbEnragedRegenerationDamageResponse = TriggerCreate("libHCHO_gt_HeroGallDreadOrbEnragedRegenerationDamageResponse_Func");

    TriggerEnable(libHCHO_gt_HeroGallDreadOrbEnragedRegenerationDamageResponse, false);

    TriggerAddEventUnitDamaged(libHCHO_gt_HeroGallDreadOrbEnragedRegenerationDamageResponse, null, c_unitDamageTypeAbility, c_unitDamageEither, "GallDreadOrbImpactDamage01");

    TriggerAddEventUnitDamaged(libHCHO_gt_HeroGallDreadOrbEnragedRegenerationDamageResponse, null, c_unitDamageTypeAbility, c_unitDamageEither, "GallDreadOrbImpactDamage02");

    TriggerAddEventUnitDamaged(libHCHO_gt_HeroGallDreadOrbEnragedRegenerationDamageResponse, null, c_unitDamageTypeAbility, c_unitDamageEither, "GallDreadOrbImpactDamage03");

}



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

// Trigger: Surging Fist - Fake Cast Activated

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

bool libHCHO_gt_SurgingFistFakeCastActivated_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_cho;



    // Automatic Variable Declarations

    // Variable Initialization



    // Actions

    if (!runActions) {

        return true;

    }



    lv_cho = EventPlayerEffectUsedUnit(c_effectUnitCaster);

    libHCHO_gv_surgingFistActiveFlag[UnitGetOwner(lv_cho)] = true;

    libHCHO_gv_surgingFistActiveCasters = (libHCHO_gv_surgingFistActiveCasters + 1);

    TriggerAddEventMouseMoved(libHCHO_gt_SurgingFistMouseTracker, EventPlayer());

    TriggerEnable(libHCHO_gt_SurgingFistMouseTracker, true);

    while ((UnitHasBehavior2(lv_cho, "ChoSurgingFistInitialFakeCast") == true)) {

        Wait(0.0625, c_timeGame);

    }

    TriggerEnable(libHCHO_gt_SurgingFistExecuteChargetomouse, true);

    while ((UnitHasBehavior2(lv_cho, "ChoSurgingFistFakeChannel") == true)) {

        Wait(0.0625, c_timeGame);

    }

    libHCHO_gv_surgingFistActiveFlag[UnitGetOwner(lv_cho)] = false;

    libHCHO_gv_surgingFistActiveCasters = (libHCHO_gv_surgingFistActiveCasters - 1);

    if ((libHCHO_gv_surgingFistActiveCasters == 0)) {

        TriggerEnable(libHCHO_gt_SurgingFistMouseTracker, false);

        TriggerEnable(libHCHO_gt_SurgingFistExecuteChargetomouse, false);

    }



    return true;

}



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

void libHCHO_gt_SurgingFistFakeCastActivated_Init () {

    libHCHO_gt_SurgingFistFakeCastActivated = TriggerCreate("libHCHO_gt_SurgingFistFakeCastActivated_Func");

    TriggerEnable(libHCHO_gt_SurgingFistFakeCastActivated, false);

    TriggerAddEventPlayerEffectUsed(libHCHO_gt_SurgingFistFakeCastActivated, c_playerAny, "ChoSurgingFistApplyFakeChannelBehavior");

}



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

// Trigger: Surging Fist - Mouse Tracker

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

bool libHCHO_gt_SurgingFistMouseTracker_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Actions

    if (!runActions) {

        return true;

    }



    libHCHO_gv_surgingFistMousePosition[EventPlayer()] = Point(EventMouseMovedPosXWorld(), EventMouseMovedPosYWorld());

    return true;

}



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

void libHCHO_gt_SurgingFistMouseTracker_Init () {

    libHCHO_gt_SurgingFistMouseTracker = TriggerCreate("libHCHO_gt_SurgingFistMouseTracker_Func");

    TriggerEnable(libHCHO_gt_SurgingFistMouseTracker, false);

}



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

// Trigger: Surging Fist Execute Charge to mouse

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

bool libHCHO_gt_SurgingFistExecuteChargetomouse_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_player;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_player = EventPlayer();



    // Conditions

    if (testConds) {

        if (!(((UnitBehaviorCount(libGame_gv_players[lv_player].lv_heroUnit, "ChoSurgingFistFakeChannel") == 1) || (UnitBehaviorCount(libGame_gv_players[lv_player].lv_activeVehicle, "ChoSurgingFistFakeChannel") == 1)))) {

            return false;

        }



        if (!((libHCHO_gv_surgingFistActiveFlag[lv_player] == true))) {

            return false;

        }



        if (!((UnitHasBehaviorWithCategoryFlag(libGame_gv_players[lv_player].lv_activeVehicle, c_behaviorCategoryDebuffRoot) == false))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    if ((UnitGetType(libGame_gv_players[lv_player].lv_heroUnit) == "HeroAbathur")) {

        UnitIssueOrder(libGame_gv_players[lv_player].lv_activeVehicle, OrderTargetingPoint(AbilityCommand("ChoSurgingFistExecute", 0), libHCHO_gv_surgingFistMousePosition[lv_player]), c_orderQueueReplace);

    }

    else {

        UnitIssueOrder(libGame_gv_players[lv_player].lv_heroUnit, OrderTargetingPoint(AbilityCommand("ChoSurgingFistExecute", 0), libHCHO_gv_surgingFistMousePosition[lv_player]), c_orderQueueReplace);

    }

    TriggerRemoveEventMouseMoved(libHCHO_gt_SurgingFistMouseTracker, EventPlayer());

    return true;

}



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

void libHCHO_gt_SurgingFistExecuteChargetomouse_Init () {

    libHCHO_gt_SurgingFistExecuteChargetomouse = TriggerCreate("libHCHO_gt_SurgingFistExecuteChargetomouse_Func");

    TriggerEnable(libHCHO_gt_SurgingFistExecuteChargetomouse, false);

}



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

// Trigger: Hero - Cho - Surging Fist Distance Tracker

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

bool libHCHO_gt_HeroChoSurgingFistDistanceTracker_Func (bool testConds, bool runActions) {

    // Variable Declarations

    fixed lv_base;

    fixed lv_i;

    fixed lv_scale;

    fixed lv_surgingDashTalentScale;

    unit lv_cho;

    int lv_player;

    fixed lv_maxScale;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_base = -4.0;

    lv_i = lv_base;

    lv_scale = 0.375;

    lv_surgingDashTalentScale = 0.3125;

    lv_cho = EventUnit();

    lv_player = UnitGetOwner(lv_cho);

    lv_maxScale = -10.0;



    // Actions

    if (!runActions) {

        return true;

    }



    while ((UnitBehaviorCount(lv_cho, "ChoSurgingFistFakeChannel") == 1)) {

        if ((UnitHasBehaviorWithCategoryFlag(lv_cho, c_behaviorCategoryTimeStop) == false)) {

            if ((lv_i <= lv_maxScale)) {

                lv_i = lv_maxScale;

            }

            else {

                lv_i -= lv_scale;

            }

            CatalogFieldValueSet(c_gameCatalogEffect, "ChoSurgingFistInitialOffsetPersistent", "PeriodicOffsetArray[" + IntToString(0) + "]", lv_player, ("0," + FixedToString(lv_i, c_fixedPrecisionAny) + ",0"));

        }



        Wait(0.125, c_timeGame);

    }

    return true;

}



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

void libHCHO_gt_HeroChoSurgingFistDistanceTracker_Init () {

    libHCHO_gt_HeroChoSurgingFistDistanceTracker = TriggerCreate("libHCHO_gt_HeroChoSurgingFistDistanceTracker_Func");

    TriggerEnable(libHCHO_gt_HeroChoSurgingFistDistanceTracker, false);

    TriggerAddEventUnitBehaviorChange(libHCHO_gt_HeroChoSurgingFistDistanceTracker, null, "ChoSurgingFistFakeChannel", c_unitBehaviorChangeCreate);

}



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

// Trigger: Surging Fist - Roots On - Monitor

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

bool libHCHO_gt_SurgingFistRootsOnMonitor_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_pairsTeamID;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_pairsTeamID = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()));



    // Conditions

    if (testConds) {

        if (!((UnitGetOwner(EventUnit()) > 0))) {

            return false;

        }



        if (!((UnitGetOwner(EventUnit()) <= libCore_gv_bALMaxPlayers))) {

            return false;

        }



        if (!((libHCHO_gv_surgingFistActiveFlag[UnitGetOwner(EventUnit())] == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    UnitAbilityEnable(EventUnit(), "ChoSurgingFistTrigger", false);

    libHCHO_gv_surgingFistActiveFlag[UnitGetOwner(EventUnit())] = false;

    return true;

}



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

void libHCHO_gt_SurgingFistRootsOnMonitor_Init () {

    libHCHO_gt_SurgingFistRootsOnMonitor = TriggerCreate("libHCHO_gt_SurgingFistRootsOnMonitor_Func");

    TriggerEnable(libHCHO_gt_SurgingFistRootsOnMonitor, false);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_SurgingFistRootsOnMonitor, null, c_behaviorCategoryDebuffRoot, c_unitBehaviorChangeActivate);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_SurgingFistRootsOnMonitor, null, c_behaviorCategoryDebuffRoot, c_unitBehaviorChangeRefresh);

}



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

// Trigger: Surging Fist - Roots Off - Monitor

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

bool libHCHO_gt_SurgingFistRootsOffMonitor_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_pairsTeamID;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_pairsTeamID = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()));



    // Conditions

    if (testConds) {

        if (!((UnitGetOwner(EventUnit()) > 0))) {

            return false;

        }



        if (!((UnitGetOwner(EventUnit()) <= libCore_gv_bALMaxPlayers))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    if (((UnitHasBehavior2(EventUnit(), "ChoSurgingFistFakeChannel") == true) || (UnitHasBehavior2(EventUnit(), "ChoSurgingFistInitialFakeCast") == true))) {

        libHCHO_gv_surgingFistActiveFlag[UnitGetOwner(EventUnit())] = true;

    }



    UnitAbilityEnable(EventUnit(), "ChoSurgingFistTrigger", true);

    return true;

}



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

void libHCHO_gt_SurgingFistRootsOffMonitor_Init () {

    libHCHO_gt_SurgingFistRootsOffMonitor = TriggerCreate("libHCHO_gt_SurgingFistRootsOffMonitor_Func");

    TriggerEnable(libHCHO_gt_SurgingFistRootsOffMonitor, false);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_SurgingFistRootsOffMonitor, null, c_behaviorCategoryDebuffRoot, c_unitBehaviorChangeDeactivate);

}



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

// Trigger: Gall - Rune Bomb - Behavior Timer Controller

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

bool libHCHO_gt_GallRuneBombBehaviorTimerControllerTrigger_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_runeBomb;

    int lv_playerNumber;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_runeBomb = EventPlayerEffectUsedUnit(c_effectUnitSource);

    lv_playerNumber = UnitGetOwner(EventPlayerEffectUsedUnit(c_effectUnitCaster));



    // Conditions

    if (testConds) {

        if (!((libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(lv_playerNumber)].lv_gallUnit != null))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libHCHO_gf_GallRuneBombBeahviorTimerController(lv_playerNumber, lv_runeBomb);

    return true;

}



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

void libHCHO_gt_GallRuneBombBehaviorTimerControllerTrigger_Init () {

    libHCHO_gt_GallRuneBombBehaviorTimerControllerTrigger = TriggerCreate("libHCHO_gt_GallRuneBombBehaviorTimerControllerTrigger_Func");

    TriggerEnable(libHCHO_gt_GallRuneBombBehaviorTimerControllerTrigger, false);

    TriggerAddEventPlayerEffectUsed(libHCHO_gt_GallRuneBombBehaviorTimerControllerTrigger, c_playerAny, "ChoTalentRollbackReturnMissileSearchPersistent");

}



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

// Trigger: Cho - Rune Bomb - Spawn

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

bool libHCHO_gt_ChoRuneBombSpawn_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeam;



    // Automatic Variable Declarations

    // Variable Initialization



    // Actions

    if (!runActions) {

        return true;

    }



    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventPlayerEffectUsedUnit(c_effectUnitCaster)));

    if ((UnitGetOwner(EventPlayerEffectUsedUnit(c_effectUnitCaster)) == libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choPlayer)) {

        UnitCreateEffectUnit(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, "GallRunicBlastRuneBombVisibilityLink", EventPlayerEffectUsedUnit(c_effectUnitSource));

    }

    else {

        UnitCreateEffectUnit(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, "ChoRuneBombApplyDetonationImmunity", EventPlayerEffectUsedUnit(c_effectUnitSource));

    }

    return true;

}



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

void libHCHO_gt_ChoRuneBombSpawn_Init () {

    libHCHO_gt_ChoRuneBombSpawn = TriggerCreate("libHCHO_gt_ChoRuneBombSpawn_Func");

    TriggerEnable(libHCHO_gt_ChoRuneBombSpawn, false);

    TriggerAddEventPlayerEffectUsed(libHCHO_gt_ChoRuneBombSpawn, c_playerAny, "ChoRuneBombFindGallSetupOrbDetonation");

    TriggerAddEventPlayerEffectUsed(libHCHO_gt_ChoRuneBombSpawn, c_playerAny, "ChoRuneBombTalentRollbackFindGallSetupReturnOrbDetonation");

}



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

// Trigger: Gall - Rune Bomb - Detonation - Cooldown Control

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

bool libHCHO_gt_GallRuneBombDetonationCooldownControl_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeam;

    fixed lv_time;

    string lv_cooldownLink;

    string lv_cooldownLink2;



    // Automatic Variable Declarations

    // Variable Initialization



    // Actions

    if (!runActions) {

        return true;

    }



    if ((EventPlayerEffectUsed() == "ChoRuneBombImpactDummy") && (PlayerHasTalent(EventPlayer(), "ChoRollback") == true)) {

    }

    else {

        lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventPlayerEffectUsedUnit(c_effectUnitCaster)));

        lv_cooldownLink = CatalogFieldValueGet(c_gameCatalogAbil, "ChoRuneBomb", "Cost[" + IntToString(0) + "].Cooldown.Link", libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choPlayer);

        lv_time = UnitGetCooldown(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choUnit, lv_cooldownLink);

        lv_cooldownLink2 = CatalogFieldValueGet(c_gameCatalogAbil, "GallRunicBlast", "Cost[" + IntToString(0) + "].Cooldown.Link", libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallPlayer);

    }

    return true;

}



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

void libHCHO_gt_GallRuneBombDetonationCooldownControl_Init () {

    libHCHO_gt_GallRuneBombDetonationCooldownControl = TriggerCreate("libHCHO_gt_GallRuneBombDetonationCooldownControl_Func");

    TriggerEnable(libHCHO_gt_GallRuneBombDetonationCooldownControl, false);

    TriggerAddEventPlayerEffectUsed(libHCHO_gt_GallRuneBombDetonationCooldownControl, c_playerAny, "GallRunicBlastOrbImpactSet");

    TriggerAddEventPlayerEffectUsed(libHCHO_gt_GallRuneBombDetonationCooldownControl, c_playerAny, "ChoTalentRollbackReturnMissileImpactDummy");

    TriggerAddEventPlayerEffectUsed(libHCHO_gt_GallRuneBombDetonationCooldownControl, c_playerAny, "ChoRuneBombRunicFeedbackTalentModifyCooldown");

    TriggerAddEventPlayerEffectUsed(libHCHO_gt_GallRuneBombDetonationCooldownControl, c_playerAny, "ChoRuneBombImpactDummy");

}



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

// Trigger: Init - Misc Mod Initialization

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

bool libHCHO_gt_InitMiscModInitialization_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Actions

    if (!runActions) {

        return true;

    }



    libCore_gf_DataHeroesAddManualSpawnHero(libCore_gf_GetIndexFromHero("Gall"), true, false);

    return true;

}



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

void libHCHO_gt_InitMiscModInitialization_Init () {

    libHCHO_gt_InitMiscModInitialization = TriggerCreate("libHCHO_gt_InitMiscModInitialization_Func");

    libCore_gf_IncludeModInitialization(libHCHO_gt_InitMiscModInitialization);

}



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

// Trigger: DEBUG - Cho'Gall - Video Swap Cheat

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

bool libHCHO_gt_DEBUGChoGallVideoSwapCheat_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_initialGallPlayerID;

    int lv_initialChoPlayerID;

    unit lv_gallUnit;

    unit lv_choUnit;

    int lv_choGallTeamID;

    int[8] lv_savedTalentsCho;

    int[8] lv_savedTalentsGall;

    int lv_itTalent;

    int lv_numberOfPreviousTalents;

    int lv_savedScore;



    // Automatic Variable Declarations

    const int auto585F311C_ae = 7;

    const int auto585F311C_ai = 1;



    // Variable Initialization

    lv_choGallTeamID = libGame_gf_TeamNumberOfPlayer(EventPlayer());



    // Conditions

    if (testConds) {

        if (!((libCore_gv_dEBUGDebuggingEnabled == true))) {

            return false;

        }



        if (!((libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_choUnit != null))) {

            return false;

        }



        if (!((libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_gallUnit != null))) {

            return false;

        }



        if (!(((UnitGetType(libGame_gv_players[EventPlayer()].lv_heroUnit) == "HeroCho") || (UnitGetType(libGame_gv_players[EventPlayer()].lv_heroUnit) == "HeroGall")))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_choGallTeamID = libGame_gf_TeamNumberOfPlayer(lv_choGallTeamID);

    lv_initialChoPlayerID = libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_choPlayer;

    lv_initialGallPlayerID = libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_gallPlayer;

    lv_gallUnit = libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_gallUnit;

    lv_choUnit = libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_choUnit;

    libGame_gv_players[lv_initialChoPlayerID].lv_heroUnit = lv_gallUnit;

    libGame_gv_players[lv_initialGallPlayerID].lv_heroUnit = lv_choUnit;

    libGame_gv_players[lv_initialChoPlayerID].lv_heroIndex = libCore_gf_GetIndexFromHero("Gall");

    libGame_gv_players[lv_initialChoPlayerID].lv_heroRequiresCustomRespawn = true;

    libGame_gv_players[lv_initialGallPlayerID].lv_heroIndex = libCore_gf_GetIndexFromHero("Cho");

    libGame_gv_players[lv_initialGallPlayerID].lv_heroRequiresCustomRespawn = false;

    lv_itTalent = 1;

    for ( ; ( (auto585F311C_ai >= 0 && lv_itTalent <= auto585F311C_ae) || (auto585F311C_ai < 0 && lv_itTalent >= auto585F311C_ae) ) ; lv_itTalent += auto585F311C_ai ) {

        lv_savedTalentsGall[lv_itTalent] = libGame_gv_talents_TalentChoices[lv_initialGallPlayerID][lv_itTalent].lv_selection;

        lv_savedTalentsCho[lv_itTalent] = libGame_gv_talents_TalentChoices[lv_initialChoPlayerID][lv_itTalent].lv_selection;

    }

    PlayerSetHero(lv_initialGallPlayerID, "Cho");

    UnitSetOwner(lv_choUnit, lv_initialGallPlayerID, true);

    UnitGroupClear(libGame_gv_players[lv_initialGallPlayerID].lv_heroUnitGroup);

    UnitGroupAdd(libGame_gv_players[lv_initialGallPlayerID].lv_heroUnitGroup, lv_choUnit);

    UnitSelect(lv_gallUnit, lv_initialGallPlayerID, false);

    UnitSelect(libGame_gv_players[lv_initialGallPlayerID].lv_heroUnit, lv_initialGallPlayerID, true);

    libGame_gv_players[lv_initialGallPlayerID].lv_heroIndex = libCore_gf_GetIndexFromHero("Cho");

    libUIUI_gf_HeroConsoleUnitStatusBarsSetUnitForBars(libGame_gv_players[lv_initialGallPlayerID].lv_heroUnit, lv_initialGallPlayerID);

    libUIUI_gf_UIHeroConsoleSetUpForPlayer(libGame_gv_players[lv_initialGallPlayerID].lv_heroUnit, lv_initialGallPlayerID);

    libGame_gf_TalentsSetupTalentChoicesFromHeroDataForPlayer(libGame_gv_players[lv_initialGallPlayerID].lv_heroIndex, lv_initialGallPlayerID);

    UISetCommandAllowed(PlayerGroupSingle(lv_initialGallPlayerID), c_uiCommandAllowQueue, true);

    PlayerSetHero(lv_initialChoPlayerID, "Gall");

    UnitSetOwner(lv_gallUnit, lv_initialChoPlayerID, true);

    UnitGroupClear(libGame_gv_players[lv_initialChoPlayerID].lv_heroUnitGroup);

    UnitGroupAdd(libGame_gv_players[lv_initialChoPlayerID].lv_heroUnitGroup, lv_gallUnit);

    UnitSelect(lv_choUnit, lv_initialChoPlayerID, false);

    UnitSelect(libGame_gv_players[lv_initialChoPlayerID].lv_heroUnit, lv_initialChoPlayerID, true);

    libGame_gv_players[lv_initialChoPlayerID].lv_heroIndex = libCore_gf_GetIndexFromHero("Gall");

    libUIUI_gf_UIHeroConsoleSetUpForPlayer(libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_choUnit, lv_initialChoPlayerID);

    if ((libUIUI_gv_uIHeroStatusFrames[lv_initialChoPlayerID].lv_unitCount > 0)) {

        libUIUI_gv_uIHeroStatusFrames[lv_initialChoPlayerID].lv_unitCount -= 1;

    }



    libUIUI_gf_UIUnitStatusFramesUpdateUnitStatusFramesForUnit(lv_initialChoPlayerID, lv_choUnit);

    libGame_gv_players[lv_initialChoPlayerID].lv_unitStatusBarsMonitorUnit_StunDeath = lv_choUnit;

    libNtve_gf_SetDialogItemUnit(libUIUI_gv_heroConsoleUnitStatusBars.lv_stunDeathBarParentFrame, libGame_gv_players[lv_initialChoPlayerID].lv_unitStatusBarsMonitorUnit_StunDeath, libCore_gv_playerGroupFromPlayer[lv_initialChoPlayerID]);

    libGame_gv_players[lv_initialChoPlayerID].lv_unitStatusBarsMonitorUnit_Channel = lv_gallUnit;

    libNtve_gf_SetDialogItemUnit(libUIUI_gv_heroConsoleUnitStatusBars.lv_castChannelBarParentFrame, libGame_gv_players[lv_initialChoPlayerID].lv_unitStatusBarsMonitorUnit_Channel, libCore_gv_playerGroupFromPlayer[lv_initialChoPlayerID]);

    libGame_gv_players[lv_initialChoPlayerID].lv_unitStatusBarsMonitorUnit_Behavior = lv_gallUnit;

    libNtve_gf_SetDialogItemUnit(libUIUI_gv_heroConsoleUnitStatusBars.lv_behaviorChannelBarParentFrame, libGame_gv_players[lv_initialChoPlayerID].lv_unitStatusBarsMonitorUnit_Behavior, libCore_gv_playerGroupFromPlayer[lv_initialChoPlayerID]);

    libNtve_gf_SetDialogItemUnit(libUIUI_gv_heroConsoleUnitStatusBars.lv_behaviorChannelBarParentFrameRight, libGame_gv_players[lv_initialChoPlayerID].lv_unitStatusBarsMonitorUnit_Behavior, libCore_gv_playerGroupFromPlayer[lv_initialChoPlayerID]);

    libUIUI_gf_UIHeroConsoleShowHideForPlayer(true, lv_initialChoPlayerID);

    UISetCommandAllowed(PlayerGroupSingle(lv_initialChoPlayerID), c_uiCommandAllowQueue, false);

    libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_choPlayer = lv_initialGallPlayerID;

    libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_gallPlayer = lv_initialChoPlayerID;

    UnitCreateEffectUnit(libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_gallUnit, "ChoGallLinkUnitsDummyEffect", lv_choUnit);

    PlayerScoreValueSetFromInt(lv_initialChoPlayerID, "GenericHeroTalentStackCounter", PlayerScoreValueGetAsInt(lv_initialGallPlayerID, "GenericHeroTalentStackCounter"));

    PlayerScoreValueSetFromInt(lv_initialGallPlayerID, "GenericHeroTalentStackCounter", 0);

    libGame_gf_TalentsRespecHeroForPlayer(lv_initialGallPlayerID);

    libGame_gf_TalentsRespecHeroForPlayer(lv_initialChoPlayerID);

    return true;

}



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

void libHCHO_gt_DEBUGChoGallVideoSwapCheat_Init () {

    libHCHO_gt_DEBUGChoGallVideoSwapCheat = TriggerCreate("libHCHO_gt_DEBUGChoGallVideoSwapCheat_Func");

    TriggerEnable(libHCHO_gt_DEBUGChoGallVideoSwapCheat, false);

    TriggerAddEventChatMessage(libHCHO_gt_DEBUGChoGallVideoSwapCheat, c_playerAny, "swapchogall", true);

}



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

// Trigger: Hero - Cho'Gall - Try Me Mode Set Level Special Case

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

bool libHCHO_gt_HeroChoGallTryMeModeSetLevelSpecialCase_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_player;

    int lv_aIPlayer;

    int lv_choGallTeamID;

    int lv_itTalent;

    fixed lv_xP;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_player = libGame_gf_CustomTryMeModeSetLevelPlayer();

    lv_choGallTeamID = libGame_gf_TeamNumberOfPlayer(lv_player);



    // Conditions

    if (testConds) {

        if (!(((libCore_gv_dEBUGDebuggingEnabled == true) || (libCore_gv_sYSGameMode == libCore_ge_GameModes_TryMe)))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    if (((UnitGetType(libGame_gv_players[libGame_gf_CustomTryMeModeSetLevelPlayer()].lv_heroUnit) == "HeroCho") || (UnitGetType(libGame_gv_players[libGame_gf_CustomTryMeModeSetLevelPlayer()].lv_heroUnit) == "HeroGall"))) {

        libHCHO_gv_tryMeChoGallIsSwapping = false;

        lv_xP = libGame_gf_CustomTryMeModeSetLevelXPValue();

        if ((libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_choPlayer == lv_player)) {

            lv_aIPlayer = libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_gallPlayer;

        }

        else {

            lv_aIPlayer = libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_choPlayer;

        }

        libAIAI_gf_HeroAIDisableAIForPlayer(lv_aIPlayer);

        libGame_gf_RemoveLevelUpHeroStatsForPlayer("HeroGall", libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_gallPlayer);

        libUIUI_gf_UIDebugPanelSpawnOrSwapHeroForPlayer(libCore_gf_GetIndexFromHero("Gall"), libGame_gv_players[lv_player].lv_selectedSkin, libGame_gv_players[lv_player].lv_selectedMount, lv_xP, libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_gallPlayer, 0);

        libGame_gf_RemoveLevelUpHeroStatsForPlayer("HeroCho", libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_choPlayer);

        libUIUI_gf_UIDebugPanelSpawnOrSwapHeroForPlayer(libCore_gf_GetIndexFromHero("Cho"), libGame_gv_players[lv_player].lv_selectedSkin, libGame_gv_players[lv_player].lv_selectedMount, lv_xP, libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_choPlayer, 0);

    }



    return true;

}



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

void libHCHO_gt_HeroChoGallTryMeModeSetLevelSpecialCase_Init () {

    libHCHO_gt_HeroChoGallTryMeModeSetLevelSpecialCase = TriggerCreate("libHCHO_gt_HeroChoGallTryMeModeSetLevelSpecialCase_Func");

    TriggerEnable(libHCHO_gt_HeroChoGallTryMeModeSetLevelSpecialCase, false);

    libGame_gf_CustomTryMeModeSetLevel(libHCHO_gt_HeroChoGallTryMeModeSetLevelSpecialCase);

}



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

// Trigger: Hero - Cho'Gall - Swap and Respawn

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

bool libHCHO_gt_HeroChoGallSwapandRespawn_Func (bool testConds, bool runActions) {

    // Variable Declarations

    bool lv_aIRequiresRestart;

    int lv_choGallTeamID;

    int lv_itTalent;

    int lv_localPlayer;

    int lv_nonLocalPlayer;

    fixed lv_xPValue;

    int lv_numberOfPreviousTalents;



    // Automatic Variable Declarations

    const int auto9411708E_ae = 7;

    const int auto9411708E_ai = 1;



    // Variable Initialization

    lv_choGallTeamID = libGame_gf_TeamNumberOfPlayer(libGame_gf_TryMeCustomButton1PressedPlayer());

    lv_localPlayer = libGame_gf_TryMeCustomButton1PressedPlayer();



    // Conditions

    if (testConds) {

        if (!(((libCore_gv_dEBUGDebuggingEnabled == true) || (libCore_gv_sYSGameMode == libCore_ge_GameModes_TryMe)))) {

            return false;

        }



        if (!(((PlayerHero(lv_localPlayer) == "Cho") || (PlayerHero(lv_localPlayer) == "Gall")))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libHCHO_gv_tryMeChoGallIsSwapping = true;

    if ((libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_choPlayer == lv_localPlayer)) {

        lv_nonLocalPlayer = libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_gallPlayer;

    }

    else {

        lv_nonLocalPlayer = libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_choPlayer;

    }

    libAIAI_gf_HeroAIDisableAIForPlayer(lv_nonLocalPlayer);

    lv_itTalent = 1;

    for ( ; ( (auto9411708E_ai >= 0 && lv_itTalent <= auto9411708E_ae) || (auto9411708E_ai < 0 && lv_itTalent >= auto9411708E_ae) ) ; lv_itTalent += auto9411708E_ai ) {

        libHCHO_gv_choGallSwapandRespawnSavedTalents[lv_itTalent] = libGame_gv_talents_TalentChoices[lv_localPlayer][lv_itTalent].lv_selection;

    }

    lv_xPValue = UnitGetPropertyFixed(libGame_gv_players[lv_localPlayer].lv_heroUnit, c_unitPropXP, c_unitPropCurrent);

    libGame_gf_RemoveLevelUpHeroStatsForPlayer("HeroGall", libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_gallPlayer);

    libUIUI_gf_UIDebugPanelSpawnOrSwapHeroForPlayer(libCore_gf_GetIndexFromHero("Cho"), libGame_gv_players[lv_localPlayer].lv_selectedSkin, libGame_gv_players[lv_localPlayer].lv_selectedMount, lv_xPValue, libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_gallPlayer, 0);

    libGame_gf_RemoveLevelUpHeroStatsForPlayer("HeroGall", libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_choPlayer);

    libUIUI_gf_UIDebugPanelSpawnOrSwapHeroForPlayer(libCore_gf_GetIndexFromHero("Gall"), libGame_gv_players[lv_localPlayer].lv_selectedSkin, libGame_gv_players[lv_localPlayer].lv_selectedMount, lv_xPValue, libGDHL_gv_chogallPairs[lv_choGallTeamID].lv_choPlayer, 0);

    libHCHO_gv_tryMeChoGallIsSwapping = false;

    return true;

}



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

void libHCHO_gt_HeroChoGallSwapandRespawn_Init () {

    libHCHO_gt_HeroChoGallSwapandRespawn = TriggerCreate("libHCHO_gt_HeroChoGallSwapandRespawn_Func");

    TriggerEnable(libHCHO_gt_HeroChoGallSwapandRespawn, false);

    libGame_gf_TryMeCustomButton1Pressed(libHCHO_gt_HeroChoGallSwapandRespawn);

}



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

// Trigger: Hero - Cho'gall - Cho Spawn

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

bool libHCHO_gt_HeroChogallChoSpawn_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_playerID;

    int lv_itPlayer;

    bool lv_gallFound;



    // Automatic Variable Declarations

    int auto1D2EA5CE_n;

    int auto1D2EA5CE_i;

    playergroup autoBC35E908_g;



    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!(((UnitGetType(libGame_gv_players[libGame_gf_HeroSpawnPlayer()].lv_heroUnit) == "HeroCho") || (UnitGetType(libGame_gv_players[libGame_gf_HeroSpawnPlayer()].lv_heroUnit) == "HeroAbathur")))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_playerID = libGame_gf_HeroSpawnPlayer();

    TriggerAddEventMouseClicked(libHCHO_gt_SurgingFistExecuteChargetomouse, lv_playerID, c_mouseButtonLeft,true);

    TriggerAddEventPlayerEffectUsed(libHCHO_gt_SurgingFistExecuteChargetomouse, lv_playerID,"ChoSurgingFistTriggerDummyEffect");

    if (((UnitGetType(libGame_gv_players[lv_playerID].lv_activeVehicle) == "HeroCho") || (UnitGetType(libGame_gv_players[lv_playerID].lv_heroUnit) == "HeroCho"))) {

        libGame_gv_players[lv_playerID].lv_heroUsesAnnouncementAlias = true;

        libGame_gv_players[lv_playerID].lv_heroAnnouncementAliasText = StringExternal("Param/Value/lib_HCHO_6C6EBBEC");

        libGame_gv_players[lv_playerID].lv_heroAnnouncementAliasIcon = "Assets\\Textures\\storm_ui_icon_cho_twoheaded.dds";

    }



    if ((UnitGetType(libGame_gv_players[libGame_gf_HeroSpawnPlayer()].lv_heroUnit) == "HeroAbathur")) {

        return true;

    }



    if ((libHCHO_gv_tryMeChoGallIsSwapping == false) && (libCore_gv_sYSGameMode == libCore_ge_GameModes_TryMe) && (lv_playerID == 1)) {

        libGame_gv_players[3].lv_selectedSkin = libGame_gv_players[lv_playerID].lv_selectedSkin;

        libGame_gv_players[3].lv_selectedMount = libGame_gv_players[lv_playerID].lv_selectedMount;

        if ((libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(lv_playerID)].lv_gallUnit != null)) {

            libGame_gf_RemoveLevelUpHeroStatsForPlayer("HeroGall", libHCHO_gv_tryMe_ChoGall_PairedPlayer_C);

        }



        libGame_gf_SendEventManualHeroSpawn(3, libCore_gf_GetIndexFromHero("Gall"), UnitGetPropertyFixed(libGame_gv_players[libGame_gf_HeroSpawnPlayer()].lv_heroUnit, c_unitPropXP, c_unitPropCurrent), libGame_gv_players[libGame_gf_HeroSpawnPlayer()].lv_spawnPoint);

        lv_gallFound = true;

    }



    if ((lv_playerID == libHCHO_gv_tryMe_ChoGall_PairedPlayer_C) && (libCore_gv_sYSGameMode == libCore_ge_GameModes_TryMe) && ((libHCHO_gv_tryMeChoGallIsSwapping == false) || (libHCHO_gv_tryMeChoGallAIRequiresRestart == true))) {

        lv_gallFound = true;

        libHCHO_gf_ChoGallSwapandRespawnApplySavedTalents(3);

        libAIAI_gf_HeroAIEnableAIForPlayer(3);

        libHCHO_gv_tryMeChoGallAIRequiresRestart = false;

    }



    if ((libCore_gv_sYSGameMode != libCore_ge_GameModes_TryMe) && (lv_gallFound == false) && (libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(lv_playerID)].lv_gallPlayer == 0)) {

        auto1D2EA5CE_n = (libCore_gv_bALMaxPlayersOnATeam + 1);

        for (auto1D2EA5CE_i = 1; auto1D2EA5CE_i <= auto1D2EA5CE_n; auto1D2EA5CE_i += 1) {

            autoBC35E908_g = libGame_gv_teams[libGame_gf_TeamNumberOfPlayer(lv_playerID)].lv_teamPlayerGroup;

            lv_itPlayer = -1;

            while (true) {

                	lv_itPlayer = PlayerGroupNextPlayer(autoBC35E908_g, lv_itPlayer);

                	if (lv_itPlayer<0) { break; }

                	if ((UnitGetType(libGame_gv_players[lv_itPlayer].lv_heroUnit) == "HeroGall")) {

                    lv_gallFound = true;

                    break;

                }



            }

            if ((lv_gallFound == true)) {

                break;

            }

            else {

                Wait(libGame_gv_individualHeroSpawnMiniDelay_C, c_timeGame);

            }

        }

    }



    if ((libCore_gv_sYSGameMode != libCore_ge_GameModes_TryMe) && (libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(lv_playerID)].lv_gallPlayer == 0) && (lv_gallFound == false)) {

        if ((libCore_gv_dEBUGDebuggingEnabled == true)) {

            TriggerDebugOutput(1, StringExternal("Param/Value/lib_HCHO_884CA74A"), true);

        }

        else {

            StatEventCreate("ChoGall Cho Spawn Error");

            StatEventAddDataInt(StatEventLastCreated(), "PlayerID", lv_playerID);

            StatEventSend(StatEventLastCreated());

        }

    }



    return true;

}



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

void libHCHO_gt_HeroChogallChoSpawn_Init () {

    libHCHO_gt_HeroChogallChoSpawn = TriggerCreate("libHCHO_gt_HeroChogallChoSpawn_Func");

    libGame_gf_HeroSpawn(libHCHO_gt_HeroChogallChoSpawn);

}



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

// Trigger: Hero - Cho'gall - Gall Spawn

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

bool libHCHO_gt_HeroChogallGallSpawn_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_numberOfPreviousTalents;

    int[8] lv_tryMeSavedChoTalents;

    int lv_itTalent;

    fixed lv_debugXPValue;

    int lv_itAlliedPlayer;

    playergroup lv_gallAlliedPlayerGroup;

    int lv_chogallTeam;

    int lv_choPlayer;

    int lv_gallPlayer;

    unit lv_choUnit;

    bool lv_choUnitFound;

    int lv_choMountCount;

    int lv_itMount;

    int[33] lv_choMountArray;

    int lv_gallIndex;



    // Automatic Variable Declarations

    const int auto2CC7223C_ae = 7;

    const int auto2CC7223C_ai = 1;

    int auto0DD2DD44_n;

    int auto0DD2DD44_i;

    playergroup auto62352D2D_g;



    // Variable Initialization

    lv_debugXPValue = libGame_gf_ManualHeroSpawnDebugXP();

    lv_gallAlliedPlayerGroup = PlayerGroupEmpty();



    // Conditions

    if (testConds) {

        if (!((libGame_gf_ManualHeroSpawnHeroID() == libCore_gf_GetIndexFromHero("Gall")))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_gallPlayer = libGame_gf_ManualHeroSpawnPlayer();

    lv_chogallTeam = libGame_gf_TeamNumberOfPlayer(lv_gallPlayer);

    lv_gallAlliedPlayerGroup = libGame_gv_teams[lv_chogallTeam].lv_teamPlayerGroup;

    libGame_gv_players[lv_gallPlayer].lv_heroUsesAnnouncementAlias = true;

    libGame_gv_players[lv_gallPlayer].lv_heroAnnouncementAliasText = StringExternal("Param/Value/lib_HCHO_82C571F6");

    libGame_gv_players[lv_gallPlayer].lv_heroAnnouncementAliasIcon = "Assets\\Textures\\storm_ui_icon_cho_twoheaded.dds";

    libUIUI_gf_UIDisableMapMechanicButtonForPlayer(lv_gallPlayer);

    if ((libCore_gv_sYSGameMode == libCore_ge_GameModes_TryMe) && (lv_gallPlayer == 1) && (libGDHL_gv_chogallPairs[lv_chogallTeam].lv_choUnit == null) && (libHCHO_gv_tryMeChoGallIsSwapping == false)) {

        lv_choPlayer = libHCHO_gv_tryMe_ChoGall_PairedPlayer_C;

        libUIUI_gf_UIDebugPanelSpawnOrSwapHeroForPlayer(libCore_gf_GetIndexFromHero("Cho"), libGame_gv_players[lv_gallPlayer].lv_selectedSkin, libGame_gv_players[lv_gallPlayer].lv_selectedMount, lv_debugXPValue, lv_choPlayer, 0);

        lv_choUnitFound = true;

    }



    if ((libCore_gv_sYSGameMode == libCore_ge_GameModes_TryMe) && (lv_gallPlayer == 1) && (libGDHL_gv_chogallPairs[lv_chogallTeam].lv_choUnit != null) && (lv_debugXPValue != UnitGetPropertyFixed(libGDHL_gv_chogallPairs[lv_chogallTeam].lv_choUnit, c_unitPropXP, c_unitPropCurrent)) && (libHCHO_gv_tryMeChoGallIsSwapping == false)) {

        lv_choPlayer = libHCHO_gv_tryMe_ChoGall_PairedPlayer_C;

        lv_itTalent = 1;

        for ( ; ( (auto2CC7223C_ai >= 0 && lv_itTalent <= auto2CC7223C_ae) || (auto2CC7223C_ai < 0 && lv_itTalent >= auto2CC7223C_ae) ) ; lv_itTalent += auto2CC7223C_ai ) {

            lv_tryMeSavedChoTalents[lv_itTalent] = libGame_gv_talents_TalentChoices[lv_choPlayer][lv_itTalent].lv_selection;

        }

        libUIUI_gf_UIDebugPanelSpawnOrSwapHeroForPlayer(libCore_gf_GetIndexFromHero("Cho"), libGame_gv_players[lv_gallPlayer].lv_selectedSkin, libGame_gv_players[lv_gallPlayer].lv_selectedMount, lv_debugXPValue, lv_choPlayer, 0);

        lv_choUnitFound = true;

    }



    if ((libCore_gv_sYSGameMode == libCore_ge_GameModes_TryMe) && (lv_gallPlayer == 1) && (libGDHL_gv_chogallPairs[lv_chogallTeam].lv_choUnit != null) && (lv_debugXPValue == UnitGetPropertyFixed(libGDHL_gv_chogallPairs[lv_chogallTeam].lv_choUnit, c_unitPropXP, c_unitPropCurrent)) && (libHCHO_gv_tryMeChoGallIsSwapping == true)) {

        libGame_gf_RemoveLevelUpHeroStatsForPlayer("HeroGall", lv_gallPlayer);

        libGame_gf_RemoveLevelUpHeroStatsForPlayer("HeroCho", lv_gallPlayer);

        libGame_gf_RemoveLevelUpHeroStatsForPlayer("HeroGall", lv_choPlayer);

        libGame_gf_RemoveLevelUpHeroStatsForPlayer("HeroCho", lv_choPlayer);

        lv_choPlayer = libHCHO_gv_tryMe_ChoGall_PairedPlayer_C;

        lv_choUnitFound = true;

    }



    if ((libCore_gv_sYSGameMode == libCore_ge_GameModes_TryMe) && (lv_gallPlayer == libHCHO_gv_tryMe_ChoGall_PairedPlayer_C)) {

        lv_choPlayer = 1;

        lv_choUnitFound = true;

    }



    if ((lv_choUnitFound == false)) {

        auto0DD2DD44_n = (libCore_gv_bALMaxPlayersOnATeam + 1);

        for (auto0DD2DD44_i = 1; auto0DD2DD44_i <= auto0DD2DD44_n; auto0DD2DD44_i += 1) {

            auto62352D2D_g = lv_gallAlliedPlayerGroup;

            lv_itAlliedPlayer = -1;

            while (true) {

                	lv_itAlliedPlayer = PlayerGroupNextPlayer(auto62352D2D_g, lv_itAlliedPlayer);

                	if (lv_itAlliedPlayer<0) { break; }

                	if (((UnitGetType(libGame_gv_players[lv_itAlliedPlayer].lv_heroUnit) == "HeroCho") && (lv_itAlliedPlayer != lv_gallPlayer))) {

                    lv_choPlayer = lv_itAlliedPlayer;

                    lv_choUnitFound = true;

                    break;

                }



            }

            if ((lv_choUnitFound == true)) {

                break;

            }

            else {

                Wait(libGame_gv_individualHeroSpawnMiniDelay_C, c_timeGame);

            }

        }

    }



    if ((lv_choUnitFound == false)) {

        libCore_gf_DataClearHeroDataAtIndex(lv_gallPlayer);

        libCore_gf_DataLoadHeroDataIntoIndex(libCore_gf_GetHeroFromIndex(libGame_gf_HeroSelectionRandomlyPickAnyUnusedHero(lv_gallPlayer, true, false)), lv_gallPlayer);

        libGame_gf_SpawnHero(lv_gallPlayer, lv_gallPlayer, libGame_gv_players[lv_gallPlayer].lv_spawnPoint);

        StatEventCreate("ChoGall Gall Spawn Error");

        StatEventAddDataInt(StatEventLastCreated(), "PlayerID", lv_gallPlayer);

        StatEventSend(StatEventLastCreated());

        if ((PlayerType(lv_gallPlayer) == c_playerTypeComputer)) {

            libAIAI_gf_HeroAIEnableAIForPlayer(lv_gallPlayer);

        }



        return true;

    }



    if ((UnitIsValid(libGame_gv_players[lv_gallPlayer].lv_heroUnit) == true) && (UnitGetType(libGame_gv_players[lv_gallPlayer].lv_heroUnit) == "HeroGall")) {

        UnitRemove(libGame_gv_players[lv_gallPlayer].lv_heroUnit);

    }



    libGame_gv_players[lv_gallPlayer].lv_playerIgnoresAFKSystem = true;

    lv_choUnit = libGame_gv_players[lv_choPlayer].lv_heroUnit;

    libGDHL_gv_chogallPairs[lv_chogallTeam].lv_choPlayer = lv_choPlayer;

    libGDHL_gv_chogallPairs[lv_chogallTeam].lv_gallPlayer = lv_gallPlayer;

    libGDHL_gv_chogallPairs[lv_chogallTeam].lv_choUnit = lv_choUnit;

    libNtve_gf_CreateUnitsAtPoint2(1, "HeroGall", 0, lv_gallPlayer, UnitGetPosition(lv_choUnit), lv_choUnit);

    libGame_gv_players[lv_gallPlayer].lv_heroUnit = UnitLastCreated();

    PlayerSetHeroUnit(lv_gallPlayer, libGame_gv_players[lv_gallPlayer].lv_heroUnit);

    libAIAI_gv_aIHeroes[lv_gallPlayer].lv_currentHeroUnit = libGame_gv_players[lv_gallPlayer].lv_heroUnit;

    libGDHL_gv_chogallPairs[lv_chogallTeam].lv_gallUnit = UnitLastCreated();

    libGame_gv_players[lv_gallPlayer].lv_heroRequiresCustomRespawn = true;

    UnitGroupClear(libGame_gv_players[lv_gallPlayer].lv_heroUnitGroup);

    UnitGroupAdd(libGame_gv_players[lv_gallPlayer].lv_heroUnitGroup, libGame_gv_players[lv_gallPlayer].lv_heroUnit);

    libGame_gv_players[lv_gallPlayer].lv_heroIndex = lv_gallPlayer;

    libGame_gv_players[lv_gallPlayer].lv_portraitIcon = libGame_gv_players[lv_gallPlayer].lv_heroData.lv_portrait;

    UnitGroupAdd(libGame_gv_heroes, libGame_gv_players[lv_gallPlayer].lv_heroUnit);

    AIAddPlayerUnit(libGame_gv_players[lv_gallPlayer].lv_heroUnit);

    UnitSelect(libGDHL_gv_chogallPairs[lv_chogallTeam].lv_gallUnit, lv_gallPlayer, true);

    libGame_gv_players[lv_gallPlayer].lv_playerStatus = libGame_ge_PlayerStatusStorm_Playing;

    libNtve_gf_SimpleLookAtStart(libGDHL_gv_chogallPairs[lv_chogallTeam].lv_choUnit, "FastHeadOnly", libNtve_gf_LookAtTargetFromUnitAttachPoint(libGDHL_gv_chogallPairs[lv_chogallTeam].lv_choUnit, "Ref_Attacher"));

    UnitCreateEffectUnit(lv_choUnit, "ChoGallLinkUnitsDummyEffect", libGDHL_gv_chogallPairs[lv_chogallTeam].lv_gallUnit);

    libSprt_gf_ChoGallHeroMasteryRing(lv_choPlayer);

    UnitCreateEffectUnit(lv_choUnit, "HeroGenericTimeStopListenerApplyBehavior", libGDHL_gv_chogallPairs[lv_chogallTeam].lv_gallUnit);

    libNtve_gf_SendActorMessageToUnit(lv_choUnit, "Signal GallReady");

    libCore_gf_DataHeroVOReloadHeroVODataForHero(lv_gallPlayer);

    libUIUI_gf_UIHeroConsoleSetUpForPlayer(libGDHL_gv_chogallPairs[lv_chogallTeam].lv_choUnit, lv_gallPlayer);

    if ((libUIUI_gv_uIHeroStatusFrames[lv_gallPlayer].lv_unitCount > 0)) {

        libUIUI_gv_uIHeroStatusFrames[lv_gallPlayer].lv_unitCount -= 1;

    }



    libUIUI_gf_UIUnitStatusFramesUpdateUnitStatusFramesForUnit(lv_gallPlayer, lv_choUnit);

    libGame_gv_players[lv_gallPlayer].lv_unitStatusBarsMonitorUnit_StunDeath = libGDHL_gv_chogallPairs[lv_chogallTeam].lv_choUnit;

    libNtve_gf_SetDialogItemUnit(libUIUI_gv_heroConsoleUnitStatusBars.lv_stunDeathBarParentFrame, libGame_gv_players[lv_gallPlayer].lv_unitStatusBarsMonitorUnit_StunDeath, libCore_gv_playerGroupFromPlayer[lv_gallPlayer]);

    libGame_gv_players[lv_gallPlayer].lv_unitStatusBarsMonitorUnit_Channel = libGDHL_gv_chogallPairs[lv_chogallTeam].lv_gallUnit;

    libNtve_gf_SetDialogItemUnit(libUIUI_gv_heroConsoleUnitStatusBars.lv_castChannelBarParentFrame, libGame_gv_players[lv_gallPlayer].lv_unitStatusBarsMonitorUnit_Channel, libCore_gv_playerGroupFromPlayer[lv_gallPlayer]);

    libGame_gv_players[lv_gallPlayer].lv_unitStatusBarsMonitorUnit_Behavior = libGDHL_gv_chogallPairs[lv_chogallTeam].lv_gallUnit;

    libNtve_gf_SetDialogItemUnit(libUIUI_gv_heroConsoleUnitStatusBars.lv_behaviorChannelBarParentFrame, libGame_gv_players[lv_gallPlayer].lv_unitStatusBarsMonitorUnit_Behavior, libCore_gv_playerGroupFromPlayer[lv_gallPlayer]);

    libNtve_gf_SetDialogItemUnit(libUIUI_gv_heroConsoleUnitStatusBars.lv_behaviorChannelBarParentFrameRight, libGame_gv_players[lv_gallPlayer].lv_unitStatusBarsMonitorUnit_Behavior, libCore_gv_playerGroupFromPlayer[lv_gallPlayer]);

    libUIUI_gf_UIHeroConsoleShowHideForPlayer(true, lv_gallPlayer);

    libUIUI_gf_UIPartyFrameAddPlayerToPartyFrame(lv_gallPlayer);

    if ((libNtve_gf_PlayerInCinematicMode(lv_gallPlayer) == false)) {

        UISetMode(libCore_gv_playerGroupFromPlayer[lv_gallPlayer], c_uiModeConsole, c_transitionDurationImmediate);

        libUIUI_gf_UIPartyFrameShowHidePartyFramePanelForPlayer(true, lv_gallPlayer);

        libUIUI_gf_UIGameUIShowHideConsolePanelForPlayer(true, lv_gallPlayer);

    }



    lv_gallIndex = lv_gallPlayer;

    PlayerSetHero(lv_gallPlayer, libGame_gv_players[lv_gallIndex].lv_heroData.lv_heroCatalogLink);

    StatEventCreate("PlayerSpawned");

    StatEventAddDataInt(StatEventLastCreated(), "PlayerID", lv_gallPlayer);

    StatEventAddDataString(StatEventLastCreated(), "Hero", (libGame_gv_players[lv_gallIndex].lv_heroData.lv_unitType));

    StatEventSend(StatEventLastCreated());

    libGame_gv_players[lv_gallPlayer].lv_cameraPlayerUnitGroupToFocusOn = libGame_gv_players[lv_gallPlayer].lv_heroUnitGroup;

    libGame_gf_CameraUpdateCameraForPlayer(lv_gallPlayer);

    libGame_gf_GrantXPToPlayer(UnitGetPropertyFixed(libGame_gv_players[lv_choPlayer].lv_heroUnit, c_unitPropXP, c_unitPropCurrent), lv_gallPlayer, libGame_ge_XPSources_Debug);

    libGame_gf_TalentsSetupTalentChoicesFromHeroDataForPlayer(libGame_gv_players[lv_gallPlayer].lv_heroIndex, lv_gallPlayer);

    SetTalentTreeHeroLevel(lv_gallPlayer, 0);

    libGame_gf_LevelUpHero(libGame_gv_players[lv_gallPlayer].lv_heroUnit);

    libUIUI_gf_UIObserverUIAddPlayerToObserverUI(lv_gallPlayer);

    libGDHL_gv_chogallPairs[lv_chogallTeam].lv_gallFollowUnit = lv_choUnit;

    libHCHO_gf_HeroChogallGallFollow(libGDHL_gv_chogallPairs[lv_chogallTeam].lv_gallUnit);

    UISetCommandAllowed(PlayerGroupSingle(lv_gallPlayer), c_uiCommandAllowQueue, false);

    TriggerAddEventMouseMoved(libHCHO_gt_SurgingFistMouseTracker, lv_gallPlayer);

    TriggerAddEventMouseClicked(libHCHO_gt_SurgingFistExecuteChargetomouse, lv_gallPlayer, c_mouseButtonLeft,true);

    TriggerAddEventPlayerEffectUsed(libHCHO_gt_SurgingFistExecuteChargetomouse, lv_gallPlayer,"ChoSurgingFistTriggerDummyEffect");

    libGame_gv_players[lv_gallPlayer].lv_suppressHeroAnnouncements = true;

    libCore_gf_SetTalentsTierLevels(lv_gallPlayer);

    libCore_gf_SetHeroicTalentTier(lv_gallPlayer);

    if ((PlayerType(lv_gallPlayer) == c_playerTypeComputer)) {

        libAIAI_gf_HeroAIEnableAIForPlayer(lv_gallPlayer);

    }



    libAIAI_gf_AITeamDelegateModifyHeroStatusTokensforTeam(libAIAI_ge_AITeamDelegateAddRemoveLaneValue_Add, libGame_gv_players[lv_gallPlayer].lv_aIHeroDelegateTokenValue, lv_chogallTeam, libAIAI_ge_AITeamDelegateLivingDeadHeroStatusUpdates_HeroAlive);

    if ((lv_gallPlayer == libHCHO_gv_tryMe_ChoGall_PairedPlayer_C) && (libCore_gv_sYSGameMode == libCore_ge_GameModes_TryMe) && ((libHCHO_gv_tryMeChoGallIsSwapping == false) || (libHCHO_gv_tryMeChoGallAIRequiresRestart == true))) {

        libHCHO_gf_ChoGallSwapandRespawnApplySavedTalents(libHCHO_gv_tryMe_ChoGall_PairedPlayer_C);

        libAIAI_gf_HeroAIEnableAIForPlayer(libHCHO_gv_tryMe_ChoGall_PairedPlayer_C);

        libHCHO_gv_tryMeChoGallAIRequiresRestart = false;

    }



    return true;

}



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

void libHCHO_gt_HeroChogallGallSpawn_Init () {

    libHCHO_gt_HeroChogallGallSpawn = TriggerCreate("libHCHO_gt_HeroChogallGallSpawn_Func");

    libGame_gf_ManualHeroSpawn(libHCHO_gt_HeroChogallGallSpawn);

}



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

// Trigger: Hero - Cho'gall - Cho Spawned via Abathur Ultimate Evolution

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

bool libHCHO_gt_HeroChogallChoSpawnedviaAbathurUltimateEvolution_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_spawnedUnit;

    int lv_spawnedUnitPlayer;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_spawnedUnit = EventUnitCreatedUnit();

    lv_spawnedUnitPlayer = UnitGetOwner(lv_spawnedUnit);



    // Conditions

    if (testConds) {

        if (!((UnitGetType(lv_spawnedUnit) == "HeroCho"))) {

            return false;

        }



        if (!((UnitGetType(libGame_gv_players[lv_spawnedUnitPlayer].lv_heroUnit) == "HeroAbathur"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    UnitBehaviorAdd(lv_spawnedUnit, "ChoOgreHide", lv_spawnedUnit, 1);

    return true;

}



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

void libHCHO_gt_HeroChogallChoSpawnedviaAbathurUltimateEvolution_Init () {

    libHCHO_gt_HeroChogallChoSpawnedviaAbathurUltimateEvolution = TriggerCreate("libHCHO_gt_HeroChogallChoSpawnedviaAbathurUltimateEvolution_Func");

    TriggerEnable(libHCHO_gt_HeroChogallChoSpawnedviaAbathurUltimateEvolution, false);

    TriggerAddEventUnitCreated(libHCHO_gt_HeroChogallChoSpawnedviaAbathurUltimateEvolution, null, null, null);

}



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

// Trigger: DEBUG - Show Gall

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

bool libHCHO_gt_DEBUGShowGall_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    playergroup autoF7435EF9_g;

    int autoF7435EF9_var;



    // Conditions

    if (testConds) {

        if (!((libCore_gv_dEBUGDebuggingEnabled == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    autoF7435EF9_g = PlayerGroupAll();

    autoF7435EF9_var = -1;

    while (true) {

        	autoF7435EF9_var = PlayerGroupNextPlayer(autoF7435EF9_g, autoF7435EF9_var);

        	if (autoF7435EF9_var<0) { break; }

        	if ((UnitGetType(libGame_gv_players[autoF7435EF9_var].lv_heroUnit) == "HeroGall")) {

            libNtve_gf_SendActorMessageToUnit(libGame_gv_players[autoF7435EF9_var].lv_heroUnit, "ModelSwap Sphere");

        }



    }

    return true;

}



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

void libHCHO_gt_DEBUGShowGall_Init () {

    libHCHO_gt_DEBUGShowGall = TriggerCreate("libHCHO_gt_DEBUGShowGall_Func");

    TriggerEnable(libHCHO_gt_DEBUGShowGall, false);

    TriggerAddEventChatMessage(libHCHO_gt_DEBUGShowGall, c_playerAny, "showgall", true);

}



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

// Trigger: DEBUG - AIGall

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

bool libHCHO_gt_DEBUGAIGall_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    playergroup auto2C128C6D_g;

    int auto2C128C6D_var;



    // Conditions

    if (testConds) {

        if (!((libCore_gv_dEBUGDebuggingEnabled == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    TriggerDebugOutput(1, StringExternal("Param/Value/lib_HCHO_DF2D8B42"), true);

    auto2C128C6D_g = PlayerGroupAll();

    auto2C128C6D_var = -1;

    while (true) {

        	auto2C128C6D_var = PlayerGroupNextPlayer(auto2C128C6D_g, auto2C128C6D_var);

        	if (auto2C128C6D_var<0) { break; }

        	if ((UnitGetType(libGame_gv_players[auto2C128C6D_var].lv_heroUnit) == "HeroGall")) {

            UnitCreateAIThinkTree(libGame_gv_players[auto2C128C6D_var].lv_heroUnit);

            if ((libAIAI_gf_HeroAIIsAIEnabledForPlayer(auto2C128C6D_var) == false)) {

                libAIAI_gf_HeroAITakeOverHeroForPlayer(auto2C128C6D_var);

                TriggerDebugOutput(1, StringExternal("Param/Value/lib_HCHO_879BF01E"), true);

                TriggerDebugOutput(1, IntToText(auto2C128C6D_var), true);

            }

            else {

                libAIAI_gf_HeroAIReleaseHeroControl(auto2C128C6D_var);

                TriggerDebugOutput(1, StringExternal("Param/Value/lib_HCHO_C8E7E5D1"), true);

            }

        }



    }

    return true;

}



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

void libHCHO_gt_DEBUGAIGall_Init () {

    libHCHO_gt_DEBUGAIGall = TriggerCreate("libHCHO_gt_DEBUGAIGall_Func");

    TriggerEnable(libHCHO_gt_DEBUGAIGall, false);

    TriggerAddEventChatMessage(libHCHO_gt_DEBUGAIGall, c_playerAny, "aigall", true);

}



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

// Trigger: DEBUG - SwapChoGall Cheat

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

bool libHCHO_gt_DEBUGSwapChoGallCheat_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeamID;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_choGallPairsTeamID = libGame_gf_TeamNumberOfPlayer(EventPlayer());



    // Conditions

    if (testConds) {

        if (!((libCore_gv_dEBUGDebuggingEnabled == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    if (((UnitIsAlive(libGDHL_gv_chogallPairs[lv_choGallPairsTeamID].lv_choUnit) == false) || (UnitIsAlive(libGDHL_gv_chogallPairs[lv_choGallPairsTeamID].lv_gallUnit) == false))) {

        libNtve_gf_UIErrorMessage(PlayerGroupSingle(EventPlayer()), StringExternal("Param/Value/lib_HCHO_35C15FA3"), SoundLink("UI_GenericError_Heroes", -1));

    }

    else {

        libGame_gf_SendEventTryMeCustomButton1Pressed(EventPlayer());

    }

    return true;

}



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

void libHCHO_gt_DEBUGSwapChoGallCheat_Init () {

    libHCHO_gt_DEBUGSwapChoGallCheat = TriggerCreate("libHCHO_gt_DEBUGSwapChoGallCheat_Func");

    TriggerEnable(libHCHO_gt_DEBUGSwapChoGallCheat, false);

    TriggerAddEventChatMessage(libHCHO_gt_DEBUGSwapChoGallCheat, c_playerAny, "ChoGallTryMeSwap", true);

}



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

// Trigger: CC Recognition - Root

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

bool libHCHO_gt_CCRecognitionRoot_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_unit;

    string lv_behavior;

    int lv_gallPlayer;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_unit = EventUnit();

    lv_behavior = EventUnitBehavior();



    // Conditions

    if (testConds) {

        if (!((UnitGetOwner(EventUnit()) == libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()))].lv_choPlayer))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_gallPlayer = libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()))].lv_gallPlayer;

    UIAlert("YourHeroHasBeenRooted", lv_gallPlayer, StringToText(""), null);

    return true;

}



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

void libHCHO_gt_CCRecognitionRoot_Init () {

    libHCHO_gt_CCRecognitionRoot = TriggerCreate("libHCHO_gt_CCRecognitionRoot_Func");

    TriggerEnable(libHCHO_gt_CCRecognitionRoot, false);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_CCRecognitionRoot, null, c_behaviorCategoryDebuffRoot, c_unitBehaviorChangeCreate);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_CCRecognitionRoot, null, c_behaviorCategoryDebuffRoot, c_unitBehaviorChangeRefresh);

}



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

// Trigger: CC Recognition - Void Prison Stasis Overlay

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

bool libHCHO_gt_CCRecognitionVoidPrisonStasisOverlay_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_unit;

    string lv_behavior;

    int lv_gallPlayer;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_unit = EventUnit();

    lv_behavior = EventUnitBehavior();



    // Conditions

    if (testConds) {

        if (!((UnitGetOwner(EventUnit()) == libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()))].lv_choPlayer))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_gallPlayer = libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()))].lv_gallPlayer;

    libUIUI_gf_FullscreenOverlaysCreateCCEffectFlashForPlayer(lv_gallPlayer, UnitBehaviorDuration(lv_unit, lv_behavior));

    return true;

}



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

void libHCHO_gt_CCRecognitionVoidPrisonStasisOverlay_Init () {

    libHCHO_gt_CCRecognitionVoidPrisonStasisOverlay = TriggerCreate("libHCHO_gt_CCRecognitionVoidPrisonStasisOverlay_Func");

    TriggerEnable(libHCHO_gt_CCRecognitionVoidPrisonStasisOverlay, false);

    TriggerAddEventUnitBehaviorChange(libHCHO_gt_CCRecognitionVoidPrisonStasisOverlay, null, "VoidPrisonDisplay", c_unitBehaviorChangeCreate);

}



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

// Trigger: Hero - Cho'gall - Haunted Mines camera plane change

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

bool libHCHO_gt_HeroChogallHauntedMinescameraplanechange_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeamID;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_choGallPairsTeamID = libGame_gf_TeamNumberOfPlayer(libGame_gf_MapHauntedMinesPlayerChangesPlanePlayer());



    // Conditions

    if (testConds) {

        if (!((libGDHL_gv_chogallPairs[lv_choGallPairsTeamID].lv_choPlayer == libGame_gf_MapHauntedMinesPlayerChangesPlanePlayer()))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libGame_gf_CameraPanCameraForPlayerAndUpdateMapBoundsIfNecessary(libGDHL_gv_chogallPairs[lv_choGallPairsTeamID].lv_gallPlayer, UnitGetPosition(libGDHL_gv_chogallPairs[lv_choGallPairsTeamID].lv_gallFollowUnit), 0.0, -1, 0.0, false);

    return true;

}



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

void libHCHO_gt_HeroChogallHauntedMinescameraplanechange_Init () {

    libHCHO_gt_HeroChogallHauntedMinescameraplanechange = TriggerCreate("libHCHO_gt_HeroChogallHauntedMinescameraplanechange_Func");

    TriggerEnable(libHCHO_gt_HeroChogallHauntedMinescameraplanechange, false);

    libGame_gf_MapHauntedMinesPlayerChangesPlane(libHCHO_gt_HeroChogallHauntedMinescameraplanechange);

}



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

// Trigger: Hero - Cho'gall - Cho Dies - Kill Gall

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

bool libHCHO_gt_HeroChogallChoDiesKillGall_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeam;

    unit lv_deadUnit;

    int lv_deadPlayer;

    int lv_killingPlayer;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_killingPlayer = libGame_gf_HeroKilledKillingPlayer();



    // Conditions

    if (testConds) {

        if (!((libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(libGame_gf_HeroKilledPlayer())].lv_choUnit == libGame_gf_HeroKilledUnit()))) {

            return false;

        }



        if (!((UnitGetType(libGame_gv_players[libGame_gf_HeroKilledPlayer()].lv_heroUnit) == "HeroCho"))) {

            return false;

        }



        if (!((UnitGetType(libGame_gv_players[UnitGetOwner(libGame_gf_HeroKilledUnit())].lv_heroUnit) != "HeroAbathur"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(libGame_gf_HeroKilledPlayer());

    if (((lv_killingPlayer < 0) || (lv_killingPlayer > 15))) {

        TextExpressionSetToken("Param/Expression/lib_HCHO_03A3A210", "A", IntToText(lv_killingPlayer));

        TriggerDebugOutput(1, TextExpressionAssemble("Param/Expression/lib_HCHO_03A3A210"), true);

        libGame_gv_players[UnitGetOwner(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit)].lv_playerIgnoresAFKSystem = false;

        UnitKill(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit);

        return true;

    }



    if (((lv_killingPlayer <= 0) || (lv_killingPlayer > libCore_gv_bALMaxPlayers) || (libGame_gv_gameOver == false))) {

        PlayerCreateEffectUnit(lv_killingPlayer, "GallDeathSwitch", libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit);

    }

    else {

        UnitCreateEffectUnit(libGame_gv_players[lv_killingPlayer].lv_heroUnit, "GallDeathSwitch", libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit);

    }

    lv_deadPlayer = UnitGetOwner(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit);

    if (((lv_deadPlayer < 0) || (lv_deadPlayer > 15))) {

        return true;

    }



    lv_deadUnit = libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit;

    libGame_gv_players[lv_deadPlayer].lv_lastKillingPlayer = lv_killingPlayer;

    libGame_gf_SendEventHeroKilled(lv_killingPlayer, lv_deadUnit);

    libGame_gf_CameraPanCameraForPlayerAndUpdateMapBoundsIfNecessary(lv_deadPlayer, UnitGetPosition(lv_deadUnit), 0.25, -1, 0.0, false);

    libGame_gf_HeroDeathStartRespawnTimer(lv_deadPlayer, libCore_gf_HeroDeathTime(lv_deadPlayer, UnitLevel(libGame_gv_players[lv_deadPlayer].lv_heroUnit)));

    libGame_gf_HeroDeathUpdateUIElementsForDeath(true, true, true, lv_deadPlayer, lv_killingPlayer);

    libAIAI_gf_AITeamDelegateModifyHeroStatusTokensforTeam(libAIAI_ge_AITeamDelegateAddRemoveLaneValue_Remove, libGame_gv_players[lv_deadPlayer].lv_aIHeroDelegateTokenValue, libGame_gf_TeamNumberOfPlayer(lv_deadPlayer), libAIAI_ge_AITeamDelegateLivingDeadHeroStatusUpdates_HeroAlive);

    libAIAI_gf_AITeamDelegateModifyHeroStatusTokensforTeam(libAIAI_ge_AITeamDelegateAddRemoveLaneValue_Add, libGame_gv_players[lv_deadPlayer].lv_aIHeroDelegateTokenValue, libGame_gf_TeamNumberOfPlayer(lv_deadPlayer), libAIAI_ge_AITeamDelegateLivingDeadHeroStatusUpdates_HeroDead);

    return true;

}



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

void libHCHO_gt_HeroChogallChoDiesKillGall_Init () {

    libHCHO_gt_HeroChogallChoDiesKillGall = TriggerCreate("libHCHO_gt_HeroChogallChoDiesKillGall_Func");

    TriggerEnable(libHCHO_gt_HeroChogallChoDiesKillGall, false);

    libGame_gf_HeroKilled(libHCHO_gt_HeroChogallChoDiesKillGall);

}



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

// Trigger: Hero - Cho'Gall - Cho Removed - Remove Gall

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

bool libHCHO_gt_HeroChoGallChoRemovedRemoveGall_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeam;

    int lv_choPlayer;

    int lv_gallPlayer;



    // Automatic Variable Declarations

    // Variable Initialization



    // Conditions

    if (testConds) {

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

            return false;

        }



        if (!((UnitGetType(libGame_gv_players[UnitGetOwner(EventUnit())].lv_heroUnit) != "HeroAbathur"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(EventPlayer());

    lv_choPlayer = libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choPlayer;

    lv_gallPlayer = libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallPlayer;

    libAIAI_gf_HeroAIDisableAIForPlayer(lv_gallPlayer);

    if (((libCore_gv_sYSGameMode == libCore_ge_GameModes_TryMe) || (libCore_gv_sYSGameMode == libCore_ge_GameModes_Sandbox))) {

    }

    else {

        if ((TimerIsPaused(libGame_gv_players[lv_gallPlayer].lv_respawnTimer) == true)) {

            libAIAI_gf_AITeamDelegateModifyHeroStatusTokensforTeam(libAIAI_ge_AITeamDelegateAddRemoveLaneValue_Remove, libGame_gv_players[lv_gallPlayer].lv_aIHeroDelegateTokenValue, libGame_gf_TeamNumberOfPlayer(lv_gallPlayer), libAIAI_ge_AITeamDelegateLivingDeadHeroStatusUpdates_HeroAlive);

        }

        else {

            libAIAI_gf_AITeamDelegateModifyHeroStatusTokensforTeam(libAIAI_ge_AITeamDelegateAddRemoveLaneValue_Remove, libGame_gv_players[lv_gallPlayer].lv_aIHeroDelegateTokenValue, libGame_gf_TeamNumberOfPlayer(lv_gallPlayer), libAIAI_ge_AITeamDelegateLivingDeadHeroStatusUpdates_HeroDead);

        }

        UnitRemove(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit);

    }

    libGame_gv_players[lv_choPlayer].lv_heroUsesAnnouncementAlias = false;

    libGame_gv_players[lv_choPlayer].lv_heroAnnouncementAliasText = null;

    libGame_gv_players[lv_choPlayer].lv_heroAnnouncementAliasIcon = null;

    libGame_gv_players[lv_gallPlayer].lv_suppressHeroAnnouncements = false;

    return true;

}



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

void libHCHO_gt_HeroChoGallChoRemovedRemoveGall_Init () {

    libHCHO_gt_HeroChoGallChoRemovedRemoveGall = TriggerCreate("libHCHO_gt_HeroChoGallChoRemovedRemoveGall_Func");

    TriggerEnable(libHCHO_gt_HeroChoGallChoRemovedRemoveGall, false);

    TriggerAddEventUnitRemoved(libHCHO_gt_HeroChoGallChoRemovedRemoveGall, null);

}



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

// Trigger: Hero - Cho'gall - Cho Respawns - Respawn Gall

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

bool libHCHO_gt_HeroChogallChoRespawnsRespawnGall_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_gallPlayer;



    // Automatic Variable Declarations

    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(libGame_gf_HeroRespawnPlayer())].lv_choPlayer == libGame_gf_HeroRespawnPlayer()))) {

            return false;

        }



        if (!((UnitGetType(libGame_gv_players[libGame_gf_HeroRespawnPlayer()].lv_heroUnit) == "HeroCho"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_gallPlayer = libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(libGame_gf_HeroRespawnPlayer())].lv_gallPlayer;

    if ((UnitHasBehavior2(libGame_gv_players[lv_gallPlayer].lv_heroUnit, "GallPsychoticBreakDyingBehavior") == true)) {

        UnitBehaviorRemove(libGame_gv_players[lv_gallPlayer].lv_heroUnit, "GallPsychoticBreakDyingBehavior", 1);

        libNtve_gf_SendActorMessageToGameRegion(RegionCircle(UnitGetPosition(libGame_gv_players[lv_gallPlayer].lv_heroUnit), 0.5), "Signal RezDestroy");

        Wait(0.0625, c_timeGame);

    }



    libNtve_gf_StopTimer(libGame_gv_players[lv_gallPlayer].lv_respawnSoundCueTimer);

    libGame_gf_HeroDeathRespawnHeroforPlayer(false, lv_gallPlayer, libGame_gv_players[lv_gallPlayer].lv_spawnPoint, 100);

    libGame_gv_players[lv_gallPlayer].lv_playerIgnoresAFKSystem = true;

    UnitCreateEffectUnit(libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(lv_gallPlayer)].lv_choUnit, "HeroGenericTimeStopListenerApplyBehavior", libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(lv_gallPlayer)].lv_gallUnit);

    libHCHO_gf_HeroChogallGallFollow(libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(lv_gallPlayer)].lv_gallUnit);

    return true;

}



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

void libHCHO_gt_HeroChogallChoRespawnsRespawnGall_Init () {

    libHCHO_gt_HeroChogallChoRespawnsRespawnGall = TriggerCreate("libHCHO_gt_HeroChogallChoRespawnsRespawnGall_Func");

    TriggerEnable(libHCHO_gt_HeroChogallChoRespawnsRespawnGall, false);

    libGame_gf_HeroRespawn(libHCHO_gt_HeroChogallChoRespawnsRespawnGall);

}



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

// Trigger: Hero - Cho'gall - Gall Stunned or Silenced Stop

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

bool libHCHO_gt_HeroChogallGallStunnedorSilencedStop_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_pairsTeamID;



    // Automatic Variable Declarations

    // Variable Initialization



    // Conditions

    if (testConds) {

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

            return false;

        }



        if (!((UnitBehaviorCount(EventUnit(), "AbathurUltimateEvolutionControlBehavior") == 0))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_pairsTeamID = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()));

    UnitBehaviorRemove(libGDHL_gv_chogallPairs[lv_pairsTeamID].lv_gallUnit, "ChogallGallSilence", 1);

    return true;

}



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

void libHCHO_gt_HeroChogallGallStunnedorSilencedStop_Init () {

    libHCHO_gt_HeroChogallGallStunnedorSilencedStop = TriggerCreate("libHCHO_gt_HeroChogallGallStunnedorSilencedStop_Func");

    TriggerEnable(libHCHO_gt_HeroChogallGallStunnedorSilencedStop, false);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_HeroChogallGallStunnedorSilencedStop, null, c_behaviorCategoryStun, c_unitBehaviorChangeDeactivate);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_HeroChogallGallStunnedorSilencedStop, null, c_behaviorCategoryDebuffStasis, c_unitBehaviorChangeDeactivate);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_HeroChogallGallStunnedorSilencedStop, null, c_behaviorCategoryDebuffSilence, c_unitBehaviorChangeDeactivate);

}



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

// Trigger: Hero - Cho'gall - Gall Ability Power Behavior Forwarding - On

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

bool libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOn_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeam;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()));



    // Conditions

    if (testConds) {

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

            return false;

        }



        if (!((UnitBehaviorCount(EventUnit(), "AbathurUltimateEvolutionControlBehavior") == 0))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    UnitBehaviorAdd(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, EventUnitBehavior(), UnitBehaviorEffectUnit(EventUnit(), EventUnitBehavior(), c_effectUnitCaster, 0), 1);

    return true;

}



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

void libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOn_Init () {

    libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOn = TriggerCreate("libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOn_Func");

    TriggerEnable(libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOn, false);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOn, null, c_behaviorCategoryBuffAbilityPower, c_unitBehaviorChangeCreate);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOn, null, c_behaviorCategoryBuffAbilityPower, c_unitBehaviorChangeRefresh);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOn, null, c_behaviorCategoryDebuffAbilityPower, c_unitBehaviorChangeCreate);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOn, null, c_behaviorCategoryDebuffAbilityPower, c_unitBehaviorChangeRefresh);

}



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

// Trigger: Hero - Cho'gall - Gall Ability Power Behavior Forwarding - Off

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

bool libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOff_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeam;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()));



    // Conditions

    if (testConds) {

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

            return false;

        }



        if (!((UnitBehaviorCount(EventUnit(), "AbathurUltimateEvolutionControlBehavior") == 0))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    UnitBehaviorRemove(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, EventUnitBehavior(), 1);

    return true;

}



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

void libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOff_Init () {

    libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOff = TriggerCreate("libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOff_Func");

    TriggerEnable(libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOff, false);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOff, null, c_behaviorCategoryBuffAbilityPower, c_unitBehaviorChangeDestroy);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOff, null, c_behaviorCategoryDebuffAbilityPower, c_unitBehaviorChangeDestroy);

}



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

// Trigger: Hero - Cho'gall - Stasis Behavior Forwarding

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

bool libHCHO_gt_HeroChogallStasisBehaviorForwarding_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeam;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()));



    // Conditions

    if (testConds) {

        if (!((EventUnitBehavior() != "ChoTalentMoltenBlock"))) {

            return false;

        }



        if (!((EventUnitBehavior() != "UsingVehicle"))) {

            return false;

        }



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

            return false;

        }



        if (!((UnitBehaviorCount(EventUnit(), "AbathurUltimateEvolutionControlBehavior") == 0))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    if ((EventUnitBehaviorChange() == c_unitBehaviorChangeCreate)) {

        UnitBehaviorAdd(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, "GallForwardedStasis", UnitBehaviorEffectUnit(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choUnit, EventUnitBehavior(), c_effectUnitCaster, 0), 1);

    }



    if ((EventUnitBehaviorChange() == c_unitBehaviorChangeDestroy)) {

        UnitBehaviorRemove(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, "GallForwardedStasis", 1);

    }



    return true;

}



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

void libHCHO_gt_HeroChogallStasisBehaviorForwarding_Init () {

    libHCHO_gt_HeroChogallStasisBehaviorForwarding = TriggerCreate("libHCHO_gt_HeroChogallStasisBehaviorForwarding_Func");

    TriggerEnable(libHCHO_gt_HeroChogallStasisBehaviorForwarding, false);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_HeroChogallStasisBehaviorForwarding, null, c_behaviorCategoryDebuffStasis, c_unitBehaviorChangeCreate);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_HeroChogallStasisBehaviorForwarding, null, c_behaviorCategoryDebuffStasis, c_unitBehaviorChangeRefresh);

    TriggerAddEventUnitBehaviorChangeFromCategory(libHCHO_gt_HeroChogallStasisBehaviorForwarding, null, c_behaviorCategoryDebuffStasis, c_unitBehaviorChangeDestroy);

}



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

// Trigger: Hero - Cho'gall - Molten Block

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

bool libHCHO_gt_HeroChogallMoltenBlock_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeam;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()));



    // Conditions

    if (testConds) {

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

            return false;

        }



        if (!((UnitBehaviorCount(EventUnit(), "AbathurUltimateEvolutionControlBehavior") == 0))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    if ((EventUnitBehaviorChange() == c_unitBehaviorChangeCreate)) {

        UnitBehaviorAdd(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, "GallMoltenBlockStasis", libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choUnit, 1);

    }



    if ((EventUnitBehaviorChange() == c_unitBehaviorChangeDestroy)) {

        UnitBehaviorRemove(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, "GallMoltenBlockStasis", 1);

    }



    return true;

}



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

void libHCHO_gt_HeroChogallMoltenBlock_Init () {

    libHCHO_gt_HeroChogallMoltenBlock = TriggerCreate("libHCHO_gt_HeroChogallMoltenBlock_Func");

    TriggerEnable(libHCHO_gt_HeroChogallMoltenBlock, false);

    TriggerAddEventUnitBehaviorChange(libHCHO_gt_HeroChogallMoltenBlock, null, "GallMoltenBlockStasis", c_unitBehaviorChangeCreate);

    TriggerAddEventUnitBehaviorChange(libHCHO_gt_HeroChogallMoltenBlock, null, "GallMoltenBlockStasis", c_unitBehaviorChangeDestroy);

}



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

// Trigger: Hero - Cho'gall - Healing Fountain Cooldown for Gall

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

bool libHCHO_gt_HeroChogallHealingFountainCooldownforGall_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeam;



    // Automatic Variable Declarations

    // Variable Initialization



    // Conditions

    if (testConds) {

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

            return false;

        }



        if (!((EventUnit() == libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()))].lv_choUnit))) {

            return false;

        }



        if (!((UnitBehaviorCount(EventUnit(), "AbathurUltimateEvolutionControlBehavior") == 0))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()));

    libUIUI_gv_uIHealingFountainsHelpTextHasFountainBeenUsed[libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallPlayer] = true;

    libUIUI_gf_UIHealingFountainsHelpTextShowHideForPlayer(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallPlayer, false);

    UnitBehaviorAdd(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, "HealingFountainCooldown", UnitBehaviorEffectUnit(EventUnit(), EventUnitBehavior(), c_effectUnitCaster, 0), 1);

    return true;

}



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

void libHCHO_gt_HeroChogallHealingFountainCooldownforGall_Init () {

    libHCHO_gt_HeroChogallHealingFountainCooldownforGall = TriggerCreate("libHCHO_gt_HeroChogallHealingFountainCooldownforGall_Func");

    TriggerEnable(libHCHO_gt_HeroChogallHealingFountainCooldownforGall, false);

    TriggerAddEventUnitBehaviorChange(libHCHO_gt_HeroChogallHealingFountainCooldownforGall, null, "HealingFountainCooldown", c_unitBehaviorChangeCreate);

}



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

// Trigger: Hero - Cho'gall - Cho Enters Transport

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

bool libHCHO_gt_HeroChogallChoEntersTransport_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeam;



    // Automatic Variable Declarations

    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((UnitGetType(libGame_gv_players[libGame_gf_HeroEnteredTransportPlayerEntering()].lv_heroUnit) == "HeroCho"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(libGame_gf_HeroEnteredTransportPlayerEntering());

    UnitBehaviorAdd(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, "ChogallGallSilence", libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, 1);

    libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallFollowUnit = UnitTransport(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choUnit);

    return true;

}



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

void libHCHO_gt_HeroChogallChoEntersTransport_Init () {

    libHCHO_gt_HeroChogallChoEntersTransport = TriggerCreate("libHCHO_gt_HeroChogallChoEntersTransport_Func");

    TriggerEnable(libHCHO_gt_HeroChogallChoEntersTransport, false);

    libGame_gf_HeroEnteredTransport(libHCHO_gt_HeroChogallChoEntersTransport);

}



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

// Trigger: Hero - Cho'gall - Cho Exits Transport

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

bool libHCHO_gt_HeroChogallChoExitsTransport_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeam;



    // Automatic Variable Declarations

    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((UnitGetType(libGame_gv_players[libGame_gf_HeroExitingTransportPlayerExiting()].lv_heroUnit) == "HeroCho"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(libGame_gf_HeroExitingTransportPlayerExiting());

    UnitBehaviorRemove(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, "ChogallGallSilence", 1);

    libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallFollowUnit = libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choUnit;

    return true;

}



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

void libHCHO_gt_HeroChogallChoExitsTransport_Init () {

    libHCHO_gt_HeroChogallChoExitsTransport = TriggerCreate("libHCHO_gt_HeroChogallChoExitsTransport_Func");

    TriggerEnable(libHCHO_gt_HeroChogallChoExitsTransport, false);

    libGame_gf_HeroExitedTransport(libHCHO_gt_HeroChogallChoExitsTransport);

}



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

// Trigger: Hero - Cho'gall - Vehicle Start

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

bool libHCHO_gt_HeroChogallVehicleStart_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_localTriggeringPlayer;

    int lv_choGallPairsTeam;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_localTriggeringPlayer = EventPlayer();

    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(lv_localTriggeringPlayer);



    // Conditions

    if (testConds) {

        if (!((UnitGetType(libGame_gv_players[lv_localTriggeringPlayer].lv_heroUnit) == "HeroCho"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    UnitBehaviorAdd(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, "GallVehicleRestrictions", libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, 1);

    Wait(0.125, c_timeGame);

    if ((UnitIsValid(libGame_gv_players[lv_localTriggeringPlayer].lv_activeVehicle) == true)) {

        libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallFollowUnit = libGame_gv_players[lv_localTriggeringPlayer].lv_activeVehicle;

    }

    else {

        libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallFollowUnit = libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choUnit;

    }

    return true;

}



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

void libHCHO_gt_HeroChogallVehicleStart_Init () {

    libHCHO_gt_HeroChogallVehicleStart = TriggerCreate("libHCHO_gt_HeroChogallVehicleStart_Func");

    TriggerEnable(libHCHO_gt_HeroChogallVehicleStart, false);

    TriggerAddEventPlayerEffectUsed(libHCHO_gt_HeroChogallVehicleStart, c_playerAny, "UseVehicleCastCompleteSet");

}



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

// Trigger: Hero - Cho'gall - Vehicle Stop

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

bool libHCHO_gt_HeroChogallVehicleStop_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_localTriggeringPlayer;

    int lv_choGallPairsTeam;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_localTriggeringPlayer = libGame_gf_UnitStopsOccupyingVehiclePlayer();

    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(lv_localTriggeringPlayer);



    // Conditions

    if (testConds) {

        if (!((UnitGetType(libGame_gv_players[lv_localTriggeringPlayer].lv_heroUnit) == "HeroCho"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    Wait(0.0625, c_timeGame);

    UnitBehaviorRemove(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallUnit, "GallVehicleRestrictions", 1);

    libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallFollowUnit = libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choUnit;

    return true;

}



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

void libHCHO_gt_HeroChogallVehicleStop_Init () {

    libHCHO_gt_HeroChogallVehicleStop = TriggerCreate("libHCHO_gt_HeroChogallVehicleStop_Func");

    TriggerEnable(libHCHO_gt_HeroChogallVehicleStop, false);

    libGame_gf_UnitStopsOccupyingVehicleInstant(libHCHO_gt_HeroChogallVehicleStop);

}



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

// Trigger: Hero - ChoGall - Death Recap - Special Case for Gall - Cho Dies

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

bool libHCHO_gt_HeroChoGallDeathRecapSpecialCaseforGallChoDies_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_choGallPairsTeam;



    // Automatic Variable Declarations

    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((UnitGetType(libGame_gv_players[libGame_gf_HeroKilledPlayer()].lv_heroUnit) == "HeroCho"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_choGallPairsTeam = libGame_gf_TeamNumberOfPlayer(libGame_gf_HeroKilledPlayer());

    libGame_gf_DeathRecapPopulateDeathRecapDataForPlayer(libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_choUnit, libGDHL_gv_chogallPairs[lv_choGallPairsTeam].lv_gallPlayer);

    return true;

}



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

void libHCHO_gt_HeroChoGallDeathRecapSpecialCaseforGallChoDies_Init () {

    libHCHO_gt_HeroChoGallDeathRecapSpecialCaseforGallChoDies = TriggerCreate("libHCHO_gt_HeroChoGallDeathRecapSpecialCaseforGallChoDies_Func");

    TriggerEnable(libHCHO_gt_HeroChoGallDeathRecapSpecialCaseforGallChoDies, false);

    libGame_gf_HeroKilled(libHCHO_gt_HeroChoGallDeathRecapSpecialCaseforGallChoDies);

}



void libHCHO_InitTriggers () {

    libHCHO_gt_ForceIncludeDataMods_Init();

    libHCHO_gt_ChoGallHearthstoneSpecialCase_Init();

    libHCHO_gt_HeroGallShadowBoltVolleyCast_Init();

    libHCHO_gt_HeroGallShadowBoltVolleyEnd_Init();

    libHCHO_gt_HeroChoShadowBoltVolleyVehicleActorHook_Init();

    libHCHO_gt_HeroGallShoveRootOn_Init();

    libHCHO_gt_HeroGallShoveRootOff_Init();

    libHCHO_gt_HeroChoHourofTwilightDeathTimerReduction_Init();

    libHCHO_gt_HeroGallPsychoticBreakRespawnTimerAdjustmentBase_Init();

    libHCHO_gt_HeroChoTheWillofChoHeroTakedownProc_Init();

    libHCHO_gt_HeroChoTheWillofChoMinionTakedownProc_Init();

    libHCHO_gt_HeroGallTheWillofGallTakedownProc_Init();

    libHCHO_gt_HeroChoMoltenBlockOverlayOn_Init();

    libHCHO_gt_HeroChoMoltenBlockOverlayOff_Init();

    libHCHO_gt_HeroChoRuneBombRunicFeedbackDamageResponses_Init();

    libHCHO_gt_HeroGallDreadOrbEnragedRegenerationDamageResponse_Init();

    libHCHO_gt_SurgingFistFakeCastActivated_Init();

    libHCHO_gt_SurgingFistMouseTracker_Init();

    libHCHO_gt_SurgingFistExecuteChargetomouse_Init();

    libHCHO_gt_HeroChoSurgingFistDistanceTracker_Init();

    libHCHO_gt_SurgingFistRootsOnMonitor_Init();

    libHCHO_gt_SurgingFistRootsOffMonitor_Init();

    libHCHO_gt_GallRuneBombBehaviorTimerControllerTrigger_Init();

    libHCHO_gt_ChoRuneBombSpawn_Init();

    libHCHO_gt_GallRuneBombDetonationCooldownControl_Init();

    libHCHO_gt_InitMiscModInitialization_Init();

    libHCHO_gt_DEBUGChoGallVideoSwapCheat_Init();

    libHCHO_gt_HeroChoGallTryMeModeSetLevelSpecialCase_Init();

    libHCHO_gt_HeroChoGallSwapandRespawn_Init();

    libHCHO_gt_HeroChogallChoSpawn_Init();

    libHCHO_gt_HeroChogallGallSpawn_Init();

    libHCHO_gt_HeroChogallChoSpawnedviaAbathurUltimateEvolution_Init();

    libHCHO_gt_DEBUGShowGall_Init();

    libHCHO_gt_DEBUGAIGall_Init();

    libHCHO_gt_DEBUGSwapChoGallCheat_Init();

    libHCHO_gt_CCRecognitionRoot_Init();

    libHCHO_gt_CCRecognitionVoidPrisonStasisOverlay_Init();

    libHCHO_gt_HeroChogallHauntedMinescameraplanechange_Init();

    libHCHO_gt_HeroChogallChoDiesKillGall_Init();

    libHCHO_gt_HeroChoGallChoRemovedRemoveGall_Init();

    libHCHO_gt_HeroChogallChoRespawnsRespawnGall_Init();

    libHCHO_gt_HeroChogallGallStunnedorSilencedStop_Init();

    libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOn_Init();

    libHCHO_gt_HeroChogallGallAbilityPowerBehaviorForwardingOff_Init();

    libHCHO_gt_HeroChogallStasisBehaviorForwarding_Init();

    libHCHO_gt_HeroChogallMoltenBlock_Init();

    libHCHO_gt_HeroChogallHealingFountainCooldownforGall_Init();

    libHCHO_gt_HeroChogallChoEntersTransport_Init();

    libHCHO_gt_HeroChogallChoExitsTransport_Init();

    libHCHO_gt_HeroChogallVehicleStart_Init();

    libHCHO_gt_HeroChogallVehicleStop_Init();

    libHCHO_gt_HeroChoGallDeathRecapSpecialCaseforGallChoDies_Init();

}



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

// Library Initialization

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

bool libHCHO_InitLib_completed = false;



void libHCHO_InitLib () {

    if (libHCHO_InitLib_completed) {

        return;

    }



    libHCHO_InitLib_completed = true;



    libHCHO_InitLibraries();

    libHCHO_InitVariables();

    libHCHO_InitTriggers();

}