include "TriggerLibs/NativeLib"

include "TriggerLibs/HeroesLib"

include "TriggerLibs/GameLib"

include "TriggerLibs/UILib"

include "TriggerLibs/SoundLib"

include "TriggerLibs/GameDataHelperLib"



include "LibHAUR_h"



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

// Library: Auriel

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

// External Library Initialization

void libHAUR_InitLibraries () {

    libNtve_InitVariables();

    libCore_InitVariables();

    libGame_InitVariables();

    libUIUI_InitVariables();

    libSond_InitVariables();

    libGDHL_InitVariables();

}



// Variable Initialization

bool libHAUR_InitVariables_completed = false;



void libHAUR_InitVariables () {

    int init_i;

    int init_j;



    if (libHAUR_InitVariables_completed) {

        return;

    }



    libHAUR_InitVariables_completed = true;



    libHAUR_gv_aurielUI.lv_traitPanel = c_invalidDialogControlId;

    libHAUR_gv_aurielUI.lv_traitLabel = c_invalidDialogControlId;

    libHAUR_gv_aurielUI.lv_aurielBestowHopeTargetStatus = c_invalidDialogControlId;

    libHAUR_gv_aurielUI.lv_aurielBestowHopeTargetDisplayName = c_invalidDialogControlId;

    libHAUR_gv_aurielUI.lv_aurielBestowHopeTargetPortrait = c_invalidDialogControlId;

    libHAUR_gv_aurielUI.lv_traitImageBar = c_invalidDialogControlId;

    libHAUR_gv_aurielUI.lv_traitImageMaxBar = c_invalidDialogControlId;

    libHAUR_gv_heroAurielBestowHopeNonHeroicDamageStoredFraction = 0.1;

    libHAUR_gv_heroAurielBestowHopeHeroicDamageStoredFraction = 0.3;

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

        for (init_j = 0; init_j <= 3; init_j += 1) {

            libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[init_i][init_j] = c_textTagNone;

        }

    }

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

        for (init_j = 0; init_j <= 3; init_j += 1) {

            libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[init_i][init_j] = c_textTagNone;

        }

    }

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

        libHAUR_gv_heroAurielResurrectRevivingNotification[init_i] = c_textTagNone;

    }

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

        libHAUR_gv_heroAurielResurrectCastingTimer[init_i] = TimerCreate();

    }

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

        libHAUR_gv_heroAurielResurrectRevivingDialog[init_i] = c_invalidDialogId;

    }

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

        libHAUR_gv_heroAurielResurrectFrameRecords[init_i].lv_heroAurielResurrectProgressTimer = TimerCreate();

    }

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

        libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[init_i] = TimerCreate();

    }

}



// Functions

void libHAUR_gf_HeroAurielIncrementHeroCountFunction () {

    // Automatic Variable Declarations

    // Implementation

    libHAUR_gv_heroAurielTriggerRegistrationVariable += 1;

    if ((libHAUR_gv_heroAurielTriggerRegistrationVariable == 1)) {

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeBestowHopeCast, true);

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeSetProxy, true);

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeRemoveProxy, true);

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeToggleBestowHopeProxyDamageDealtTrigger, true);

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeProxyUnitSwapped, true);

        TriggerEnable(libHAUR_gt_HeroAurielCrystalAegisOverlayController, true);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectPlayerUnlocksResurrect, true);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectPlayerRespecs, true);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectPlayerRespawns, true);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectEndofGameHideRevivingDialog, true);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainStart, true);

        libHAUR_gf_HeroAurielRayofHeavenPopulateValuesfromData();

    }



}



void libHAUR_gf_HeroAurielDecrementHeroCountFunction () {

    // Automatic Variable Declarations

    // Implementation

    libHAUR_gv_heroAurielTriggerRegistrationVariable -= 1;

    if ((libHAUR_gv_heroAurielTriggerRegistrationVariable < 0)) {

        libHAUR_gv_heroAurielTriggerRegistrationVariable = 0;

    }



    if ((libHAUR_gv_heroAurielTriggerRegistrationVariable == 0)) {

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeBestowHopeCast, false);

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeSetProxy, false);

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeRemoveProxy, false);

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeToggleBestowHopeProxyDamageDealtTrigger, false);

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageDealt, false);

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken, false);

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeProxyUnitSwapped, false);

        TriggerEnable(libHAUR_gt_HeroAurielCrystalAegisOverlayController, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectPlayerUnlocksResurrect, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectCreateSpirit, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectMurkyEggDeathSpiritReveal, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectRevivePlayer, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectPlayerRespawns, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainComplete, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveStart, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterrupted, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectSpiritTimerController, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectPlayerRespecs, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectEndofGameHideRevivingDialog, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainStart, false);

    }



}



string libHAUR_gf_BestowHopeGetPortraitPathforUnit (unit lp_unit) {

    // Automatic Variable Declarations

    string auto889C7C47_val;



    // Implementation

    auto889C7C47_val = UnitGetType(lp_unit);

    if (auto889C7C47_val == "HeroChenStorm") {

        return "Assets\\Textures\\storm_ui_ingame_targetinfopanel_unit_chen_storm.dds";

    }

    else if (auto889C7C47_val == "HeroChenEarth") {

        return "Assets\\Textures\\storm_ui_ingame_targetinfopanel_unit_chen_earth.dds";

    }

    else if (auto889C7C47_val == "HeroChenFire") {

        return "Assets\\Textures\\storm_ui_ingame_targetinfopanel_unit_chen_fire.dds";

    }

    else {

        return libUIUI_gf_KillLogGetPortraitPathforUnit(lp_unit);

    }

}



void libHAUR_gf_AurielUIBestowHope (int lp_aurielPlayer, unit lp_bestowHopeTarget) {

    // Automatic Variable Declarations

    // Implementation

    libNtve_gf_SetDialogItemUnit(libHAUR_gv_aurielUI.lv_aurielBestowHopeTargetStatus, lp_bestowHopeTarget, libCore_gv_playerGroupFromPlayer[lp_aurielPlayer]);

    DialogControlSetVisible(libHAUR_gv_aurielUI.lv_aurielBestowHopeTargetStatus, libCore_gv_playerGroupFromPlayer[lp_aurielPlayer], true);

    libNtve_gf_SetDialogItemText(libHAUR_gv_aurielUI.lv_aurielBestowHopeTargetDisplayName, libHAUR_gf_AurielUIUnitDisplayName(lp_bestowHopeTarget), PlayerGroupSingle(lp_aurielPlayer));

    libNtve_gf_SetDialogItemImage(libHAUR_gv_aurielUI.lv_aurielBestowHopeTargetPortrait, libHAUR_gf_BestowHopeGetPortraitPathforUnit(lp_bestowHopeTarget), PlayerGroupSingle(lp_aurielPlayer));

}



text libHAUR_gf_AurielUIUnitDisplayName (unit lp_unit) {

    // Variable Declarations

    int lv_unitOwner;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_unitOwner = UnitGetOwner(lp_unit);



    // Implementation

    if ((UnitGetType(lp_unit) == "HeroCho")) {

        return StringExternal("Param/Value/lib_HAUR_1EB9CC4B");

    }

    else {

        return UnitGetName(lp_unit);

    }

}



void libHAUR_gf_HeroAurielRayofHeavenPopulateValuesfromData () {

    // Automatic Variable Declarations

    // Implementation

    libHAUR_gv_heroAurielRayofHeavenHeroicDamageStoredFraction = StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "AurielDamageVsHeroicTargetParent", "LeechFraction[" + IntToString(2) + "]", c_playerAny));

    libHAUR_gv_heroAurielRayofHeavenNonHeroicDamageStoredFraction = StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "AurielDamageVsNonHeroicTargetParent", "LeechFraction[" + IntToString(2) + "]", c_playerAny));

    libHAUR_gv_heroAurielRayofHeavenReservoirofHopeHealingPerStack = StringToFixed(CatalogFieldValueGet(c_gameCatalogAccumulator, "AurielRayOfHeavenReservoirOfHopeAccumulator", "Scale", c_playerAny));

}



void libHAUR_gf_HeroAurielResurrectRevealSpirittoAurielandDeadPlayer (int lp_deadPlayer, unit lp_deadHero) {

    // Variable Declarations

    int lv_deadPlayerTeam;

    int lv_aurielPlayer;

    int lv_additionalPlayer;



    // Automatic Variable Declarations

    const int autoA5AA3F32_ae = libCore_gv_bALMaxPlayers;

    const int autoA5AA3F32_ai = 1;

    string autoEE4E787F_val;



    // Variable Initialization



    // Implementation

    lv_deadPlayerTeam = libGame_gf_TeamNumberOfPlayer(lp_deadPlayer);

    lv_aurielPlayer = 1;

    for ( ; ( (autoA5AA3F32_ai >= 0 && lv_aurielPlayer <= autoA5AA3F32_ae) || (autoA5AA3F32_ai < 0 && lv_aurielPlayer >= autoA5AA3F32_ae) ) ; lv_aurielPlayer += autoA5AA3F32_ai ) {

        if (((UnitGetType(libGame_gv_players[lv_aurielPlayer].lv_heroUnit) == "HeroAuriel") && (libGame_gf_TeamNumberOfPlayer(lv_aurielPlayer) == lv_deadPlayerTeam) && (UnitBehaviorCount(libGame_gv_players[lv_aurielPlayer].lv_heroUnit, "Ultimate1Unlocked") > 0) && (lv_aurielPlayer != lp_deadPlayer))) {

            ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lp_deadPlayer]), libNtve_gf_Signal(("Auriel" + IntToString(lv_aurielPlayer))));

        }



    }

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

        lv_additionalPlayer = libGDHL_gv_chogallPairs[lv_deadPlayerTeam].lv_gallPlayer;

        ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lp_deadPlayer]), libNtve_gf_Signal(("Auriel" + IntToString(lv_additionalPlayer))));

        libHAUR_gv_heroAurielResurrectShowSpiritTimer[lv_additionalPlayer] = true;

    }



    ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lp_deadPlayer]), libNtve_gf_Signal(("Auriel" + IntToString(lp_deadPlayer))));

    autoEE4E787F_val = UnitGetType(lp_deadHero);

    if (autoEE4E787F_val == "HeroAlexstraszaDragon") {

        ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lp_deadPlayer]), libNtve_gf_ModelSwap(libCore_gf_GetModelLinkForUnitType("HeroAlexstrasza"), 0));

    }

    else {

        ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lp_deadPlayer]), libNtve_gf_ModelSwap(libCore_gf_GetModelLinkForUnitType(UnitGetType(lp_deadHero)), 0));

    }

    ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lp_deadPlayer]), libNtve_gf_Signal("Taunt"));

    libHAUR_gv_heroAurielResurrectShowSpiritTimer[lp_deadPlayer] = true;

}



void libHAUR_gf_HeroAurielResurrectCheckActiveSpirits (bool lp_targetHeroDead) {

    // Automatic Variable Declarations

    // Implementation

    if ((lp_targetHeroDead == true)) {

        libHAUR_gv_heroAurielResurrectActiveSpirits += 1;

    }

    else {

        libHAUR_gv_heroAurielResurrectActiveSpirits -= 1;

    }

    if ((libHAUR_gv_heroAurielResurrectActiveSpirits < 0)) {

        libHAUR_gv_heroAurielResurrectActiveSpirits = 0;

    }



    if ((libHAUR_gv_heroAurielResurrectActiveSpirits == 0)) {

        TriggerEnable(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveStart, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterrupted, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectSpiritTimerController, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainComplete, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectLeoricSpiritFollow, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectMurkyEggDeathSpiritReveal, false);

    }

    else {

        TriggerEnable(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveStart, true);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired, true);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectSpiritTimerController, true);

    }

}



int libHAUR_gf_HeroAurielResurrectCreateDeadPlayerSpiritTimer (int lp_aurielPlayer, int lp_deadPlayer, int lp_vikingNumber) {

    // Automatic Variable Declarations

    // Implementation

    if ((UnitIsAlive(libGame_gv_players[lp_aurielPlayer].lv_heroUnit) == true)) {

        if ((UnitGetType(libGame_gv_players[lp_deadPlayer].lv_heroUnit) != "HeroLostVikingsController")) {

            if ((libCore_gf_IsAbilityOnCooldown(libGame_gv_players[lp_aurielPlayer].lv_heroUnit, "AurielResurrect") == true)) {

                TextExpressionSetToken("Param/Expression/lib_HAUR_8881BDD0", "A", FixedToText(UnitGetCooldown(libGame_gv_players[lp_aurielPlayer].lv_heroUnit, CatalogFieldValueGet(c_gameCatalogAbil, "AurielResurrect", "Cost[" + IntToString(0) + "].Cooldown.Link", lp_aurielPlayer)), 0));

                TextExpressionSetToken("Param/Expression/lib_HAUR_8881BDD0", "B", FixedToText(TimerGetRemaining(libGame_gv_players[lp_deadPlayer].lv_respawnTimer), 0));

                TextTagCreate(TextExpressionAssemble("Param/Expression/lib_HAUR_8881BDD0"), 36, UnitGetPosition(libHAUR_gv_heroAurielResurrectSpirit[lp_deadPlayer]), 4.0, true, false, PlayerGroupSingle(lp_deadPlayer));

                return TextTagLastCreated();

            }

            else {

                TextTagCreate((StringExternal("Param/Value/lib_HAUR_9C54CB75") + FixedToText(TimerGetRemaining(libGame_gv_players[lp_deadPlayer].lv_respawnTimer), 0)), 36, UnitGetPosition(libHAUR_gv_heroAurielResurrectSpirit[lp_deadPlayer]), 4.0, true, false, PlayerGroupSingle(lp_deadPlayer));

                return TextTagLastCreated();

            }

        }

        else {

            if ((lp_vikingNumber == 1)) {

                if ((libCore_gf_IsAbilityOnCooldown(libGame_gv_players[lp_aurielPlayer].lv_heroUnit, "AurielResurrect") == true)) {

                    TextExpressionSetToken("Param/Expression/lib_HAUR_52754345", "A", FixedToText(UnitGetCooldown(libGame_gv_players[lp_aurielPlayer].lv_heroUnit, CatalogFieldValueGet(c_gameCatalogAbil, "AurielResurrect", "Cost[" + IntToString(0) + "].Cooldown.Link", lp_aurielPlayer)), 0));

                    TextExpressionSetToken("Param/Expression/lib_HAUR_52754345", "B", FixedToText(TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lp_deadPlayer].lv_baleogDeathTimer), 0));

                    TextTagCreate(TextExpressionAssemble("Param/Expression/lib_HAUR_52754345"), 36, UnitGetPosition(libHAUR_gv_heroAurielResurrectSpirit[lp_deadPlayer]), 4.0, true, false, PlayerGroupSingle(lp_deadPlayer));

                    return TextTagLastCreated();

                }

                else {

                    TextTagCreate((StringExternal("Param/Value/lib_HAUR_8F9E5B15") + FixedToText(TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lp_deadPlayer].lv_baleogDeathTimer), 0)), 36, UnitGetPosition(libHAUR_gv_heroAurielResurrectSpirit[lp_deadPlayer]), 4.0, true, false, PlayerGroupSingle(lp_deadPlayer));

                    return TextTagLastCreated();

                }

            }

            else {

                if ((lp_vikingNumber == 2)) {

                    if ((libCore_gf_IsAbilityOnCooldown(libGame_gv_players[lp_aurielPlayer].lv_heroUnit, "AurielResurrect") == true)) {

                        TextExpressionSetToken("Param/Expression/lib_HAUR_2C638B40", "A", FixedToText(UnitGetCooldown(libGame_gv_players[lp_aurielPlayer].lv_heroUnit, CatalogFieldValueGet(c_gameCatalogAbil, "AurielResurrect", "Cost[" + IntToString(0) + "].Cooldown.Link", lp_aurielPlayer)), 0));

                        TextExpressionSetToken("Param/Expression/lib_HAUR_2C638B40", "B", FixedToText(TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lp_deadPlayer].lv_erikDeathTimer), 0));

                        TextTagCreate(TextExpressionAssemble("Param/Expression/lib_HAUR_2C638B40"), 36, UnitGetPosition(libHAUR_gv_heroAurielResurrectSpirit[lp_deadPlayer]), 4.0, true, false, PlayerGroupSingle(lp_deadPlayer));

                        return TextTagLastCreated();

                    }

                    else {

                        TextTagCreate((StringExternal("Param/Value/lib_HAUR_F323B22D") + FixedToText(TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lp_deadPlayer].lv_erikDeathTimer), 0)), 36, UnitGetPosition(libHAUR_gv_heroAurielResurrectSpirit[lp_deadPlayer]), 4.0, true, false, PlayerGroupSingle(lp_deadPlayer));

                        return TextTagLastCreated();

                    }

                }

                else {

                    if ((lp_vikingNumber == 3)) {

                        if ((libCore_gf_IsAbilityOnCooldown(libGame_gv_players[lp_aurielPlayer].lv_heroUnit, "AurielResurrect") == true)) {

                            TextExpressionSetToken("Param/Expression/lib_HAUR_33DF3109", "A", FixedToText(UnitGetCooldown(libGame_gv_players[lp_aurielPlayer].lv_heroUnit, CatalogFieldValueGet(c_gameCatalogAbil, "AurielResurrect", "Cost[" + IntToString(0) + "].Cooldown.Link", lp_aurielPlayer)), 0));

                            TextExpressionSetToken("Param/Expression/lib_HAUR_33DF3109", "B", FixedToText(TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lp_deadPlayer].lv_olafDeathTimer), 0));

                            TextTagCreate(TextExpressionAssemble("Param/Expression/lib_HAUR_33DF3109"), 36, UnitGetPosition(libHAUR_gv_heroAurielResurrectSpirit[lp_deadPlayer]), 4.0, true, false, PlayerGroupSingle(lp_deadPlayer));

                            return TextTagLastCreated();

                        }

                        else {

                            TextTagCreate((StringExternal("Param/Value/lib_HAUR_AC15E6DE") + FixedToText(TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lp_deadPlayer].lv_olafDeathTimer), 0)), 36, UnitGetPosition(libHAUR_gv_heroAurielResurrectSpirit[lp_deadPlayer]), 4.0, true, false, PlayerGroupSingle(lp_deadPlayer));

                            return TextTagLastCreated();

                        }

                    }

                    else {

                        return c_textTagNone;

                    }

                }

            }

        }

    }

    else {

        return c_textTagNone;

    }

}



// Triggers

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

// Trigger: Auriel UI Initialize

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

bool libHAUR_gt_AurielUIInitialize_Func (bool testConds, bool runActions) {

    int init_i;



    // Variable Declarations

    int[6] lv_panels;

    int lv_currentPanelLayer;



    // Automatic Variable Declarations

    // Variable Initialization

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

        lv_panels[init_i] = c_invalidDialogControlId;

    }



    // Actions

    if (!runActions) {

        return true;

    }



    DialogControlHookup(libUIUI_gv_heroSpecificStatusContainer, c_triggerControlTypeImage, "AurielBestowHopeFrame/TargetStatus/HeroPortraitContainer/HeroPortrait");

    libHAUR_gv_aurielUI.lv_aurielBestowHopeTargetPortrait = DialogControlLastCreated();

    DialogControlHookup(libUIUI_gv_heroSpecificStatusContainer, c_triggerControlTypeLabel, "AurielBestowHopeFrame/TargetStatus/UnitDisplayName");

    libHAUR_gv_aurielUI.lv_aurielBestowHopeTargetDisplayName = DialogControlLastCreated();

    DialogControlHookup(libUIUI_gv_heroSpecificStatusContainer, c_triggerControlTypeUnitStatus, "AurielBestowHopeFrame/TargetStatus");

    libHAUR_gv_aurielUI.lv_aurielBestowHopeTargetStatus = DialogControlLastCreated();

    lv_currentPanelLayer += 1;

    lv_panels[lv_currentPanelLayer] = DialogControlLastCreated();



    return true;

}



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

void libHAUR_gt_AurielUIInitialize_Init () {

    libHAUR_gt_AurielUIInitialize = TriggerCreate("libHAUR_gt_AurielUIInitialize_Func");

    libCore_gf_IncludeModInitialization(libHAUR_gt_AurielUIInitialize);

}



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

// Trigger: Hero - Auriel - Shield of Hope - Set Shield Strength

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

bool libHAUR_gt_HeroAurielShieldofHopeSetShieldStrength_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_caster;

    int lv_casterPlayer;

    unit lv_target;

    fixed lv_targetMissingHealth;

    const fixed lv_shieldFraction = 0.5;

    fixed lv_shieldValue;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_caster = EventPlayerEffectUsedUnit(c_effectUnitCaster);

    lv_casterPlayer = UnitGetOwner(lv_caster);

    lv_target = EventPlayerEffectUsedUnit(c_effectUnitTarget);

    lv_targetMissingHealth = (UnitGetPropertyFixed(lv_target, c_unitPropLifeMax, c_unitPropCurrent) - UnitGetPropertyFixed(lv_target, c_unitPropLife, c_unitPropCurrent));

    lv_shieldValue = (lv_targetMissingHealth * lv_shieldFraction);



    // Conditions

    if (testConds) {

        if (!((lv_targetMissingHealth > 0.0))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    CatalogFieldValueSetFixed(c_gameCatalogBehavior, "AurielShieldOfHopeShieldBehavior", "DamageResponse.ModifyLimit", lv_casterPlayer, lv_shieldValue);

    UnitCreateEffectUnit(lv_caster, "AurielShieldOfHopeApplyShieldBehavior", lv_target);

    return true;

}



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

void libHAUR_gt_HeroAurielShieldofHopeSetShieldStrength_Init () {

    libHAUR_gt_HeroAurielShieldofHopeSetShieldStrength = TriggerCreate("libHAUR_gt_HeroAurielShieldofHopeSetShieldStrength_Func");

    TriggerEnable(libHAUR_gt_HeroAurielShieldofHopeSetShieldStrength, false);

    TriggerAddEventPlayerEffectUsed(libHAUR_gt_HeroAurielShieldofHopeSetShieldStrength, c_playerAny, "AurielShieldOfHopeImpactSet");

}



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

// Trigger: Hero - Auriel - Bestow Hope - Bestow Hope Cast

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

bool libHAUR_gt_HeroAurielBestowHopeBestowHopeCast_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_auriel;

    int lv_aurielPlayer;

    int lv_proxyOwner;

    unit lv_proxy;

    int lv_iPlayer;

    unit lv_previousProxy;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_iPlayer = 1;



    // Conditions

    if (testConds) {

        if (!((UnitIsValid(EventPlayerEffectUsedUnit(c_effectUnitTarget)) == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_auriel = EventPlayerEffectUsedUnit(c_effectUnitCaster);

    lv_aurielPlayer = UnitGetOwner(lv_auriel);

    lv_proxy = EventPlayerEffectUsedUnit(c_effectUnitTarget);

    lv_proxyOwner = UnitGetOwner(lv_proxy);

    lv_previousProxy = libHAUR_gv_heroAurielBestowHopeProxy[lv_aurielPlayer];

    if ((UnitIsValid(lv_previousProxy) == true)) {

        UnitCreateEffectUnit(lv_auriel, "AurielBestowHopeRemovalSet", lv_previousProxy);

        lv_previousProxy = null;

        Wait(0.125, c_timeGame);

    }



    if ((UnitIsValid(lv_auriel) == true) && (UnitIsValid(lv_proxy) == true)) {

        UnitCreateEffectUnit(lv_auriel, "AurielBestowHopeApplicationSet", lv_proxy);

    }



    return true;

}



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

void libHAUR_gt_HeroAurielBestowHopeBestowHopeCast_Init () {

    libHAUR_gt_HeroAurielBestowHopeBestowHopeCast = TriggerCreate("libHAUR_gt_HeroAurielBestowHopeBestowHopeCast_Func");

    TriggerEnable(libHAUR_gt_HeroAurielBestowHopeBestowHopeCast, false);

    TriggerAddEventPlayerEffectUsed(libHAUR_gt_HeroAurielBestowHopeBestowHopeCast, c_playerAny, "AurielBestowHopeInitialSet");

}



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

// Trigger: Hero - Auriel - Bestow Hope - Set Proxy

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

bool libHAUR_gt_HeroAurielBestowHopeSetProxy_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_auriel;

    int lv_aurielPlayer;

    unit lv_proxy;

    int lv_proxyOwner;

    int lv_iPlayer;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_proxy = EventPlayerEffectUsedUnit(c_effectUnitTarget);

    lv_proxyOwner = UnitGetOwner(lv_proxy);

    lv_iPlayer = 1;



    // Actions

    if (!runActions) {

        return true;

    }



    lv_auriel = EventPlayerEffectUsedUnit(c_effectUnitCaster);

    lv_aurielPlayer = UnitGetOwner(lv_auriel);

    if ((UnitIsValid(lv_auriel) == true) && (UnitIsValid(lv_proxy) == true) && (lv_aurielPlayer <= libCore_gv_bALMaxEnginePlayerCount) && (lv_proxyOwner <= libCore_gv_bALMaxEnginePlayerCount)) {

        libHAUR_gv_heroAurielBestowHopeProxy[lv_aurielPlayer] = lv_proxy;

        libHAUR_gv_heroAurielBestowHopeProxyOwner[lv_proxyOwner] = lv_aurielPlayer;

        libHAUR_gv_heroAurielBestowHopeNumberofActiveProxies += 1;

        libHAUR_gf_AurielUIBestowHope(lv_aurielPlayer, lv_proxy);

        if (((UnitGetType(lv_proxy) == "HeroCho") && (UnitHasBehavior2(lv_proxy, "AbathurUltimateEvolutionControlBehavior") == false))) {

            UnitCreateEffectUnit(lv_auriel, "AurielBestowHopeApplyProxyBehavior", libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(lv_proxyOwner)].lv_gallUnit);

        }



    }



    TriggerExecute(libHAUR_gt_HeroAurielBestowHopeToggleBestowHopeProxyDamageDealtTrigger, true, false);

    return true;

}



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

void libHAUR_gt_HeroAurielBestowHopeSetProxy_Init () {

    libHAUR_gt_HeroAurielBestowHopeSetProxy = TriggerCreate("libHAUR_gt_HeroAurielBestowHopeSetProxy_Func");

    TriggerEnable(libHAUR_gt_HeroAurielBestowHopeSetProxy, false);

    TriggerAddEventPlayerEffectUsed(libHAUR_gt_HeroAurielBestowHopeSetProxy, c_playerAny, "AurielBestowHopeApplyCasterBehavior");

}



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

// Trigger: Hero - Auriel - Bestow Hope - Remove Proxy

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

bool libHAUR_gt_HeroAurielBestowHopeRemoveProxy_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_iPlayer;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_iPlayer = 1;



    // Conditions

    if (testConds) {

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

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    libHAUR_gv_heroAurielBestowHopeNumberofActiveProxies -= 1;

    TriggerExecute(libHAUR_gt_HeroAurielBestowHopeToggleBestowHopeProxyDamageDealtTrigger, true, false);

    return true;

}



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

void libHAUR_gt_HeroAurielBestowHopeRemoveProxy_Init () {

    libHAUR_gt_HeroAurielBestowHopeRemoveProxy = TriggerCreate("libHAUR_gt_HeroAurielBestowHopeRemoveProxy_Func");

    TriggerEnable(libHAUR_gt_HeroAurielBestowHopeRemoveProxy, false);

    TriggerAddEventUnitBehaviorChange(libHAUR_gt_HeroAurielBestowHopeRemoveProxy, null, "AurielBestowHopeProxyBehavior", c_unitBehaviorChangeDecrease);

}



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

// Trigger: Hero - Auriel - Bestow Hope - Toggle Bestow Hope Proxy Damage Dealt Trigger

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

bool libHAUR_gt_HeroAurielBestowHopeToggleBestowHopeProxyDamageDealtTrigger_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    // Actions

    if (!runActions) {

        return true;

    }



    if ((libHAUR_gv_heroAurielBestowHopeNumberofActiveProxies > 0)) {

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageDealt, true);

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken, true);

    }

    else {

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageDealt, false);

        TriggerEnable(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken, false);

    }

    return true;

}



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

void libHAUR_gt_HeroAurielBestowHopeToggleBestowHopeProxyDamageDealtTrigger_Init () {

    libHAUR_gt_HeroAurielBestowHopeToggleBestowHopeProxyDamageDealtTrigger = TriggerCreate("libHAUR_gt_HeroAurielBestowHopeToggleBestowHopeProxyDamageDealtTrigger_Func");

    TriggerEnable(libHAUR_gt_HeroAurielBestowHopeToggleBestowHopeProxyDamageDealtTrigger, false);

}



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

// Trigger: Hero - Auriel - Bestow Hope - Healing Stored From Proxy Damage Dealt

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

bool libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageDealt_Func (bool testConds, bool runActions) {

    // Variable Declarations

    fixed lv_damageDealt;

    unit lv_auriel;

    unit lv_proxy;

    int lv_proxyPlayer;

    int lv_aurielPlayer;

    unit lv_target;

    int lv_bestowHopeStacks;

    int lv_bestowHopeStackIteration;



    // Automatic Variable Declarations

    int auto1108B650_ae;

    const int auto1108B650_ai = 1;



    // Variable Initialization

    lv_damageDealt = (EventUnitDamageAmount() + EventUnitDamageBehaviorShield());

    lv_proxy = EventUnitDamageSourceUnit();

    lv_proxyPlayer = UnitGetOwner(lv_proxy);

    lv_target = EventUnit();



    // Conditions

    if (testConds) {

        if (!((lv_target != lv_proxy))) {

            return false;

        }



        if (!((UnitGetOwner(lv_target) != UnitGetOwner(lv_proxy)))) {

            return false;

        }



        if (!((UnitIsValid(lv_proxy) == true))) {

            return false;

        }



        if (!((UnitIsValid(lv_target) == true))) {

            return false;

        }



        if (!(((UnitHasBehavior2(lv_proxy, "AurielBestowHopeProxyBehavior") == true) || (UnitHasBehavior2(libGame_gv_players[lv_proxyPlayer].lv_heroUnit, "AurielBestowHopeProxyBehavior") == true)))) {

            return false;

        }



        if (!((EventUnitDamageEffect() != "BribeKillEffect"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    if ((UnitHasBehavior2(lv_proxy, "AurielBestowHopeProxyBehavior") == false) && (UnitHasBehavior2(libGame_gv_players[lv_proxyPlayer].lv_heroUnit, "AurielBestowHopeProxyBehavior") == true)) {

        lv_proxy = libGame_gv_players[lv_proxyPlayer].lv_heroUnit;

    }



    lv_bestowHopeStacks = UnitBehaviorCount(lv_proxy, "AurielBestowHopeProxyBehavior");

    auto1108B650_ae = lv_bestowHopeStacks;

    lv_bestowHopeStackIteration = 0;

    for ( ; ( (auto1108B650_ai >= 0 && lv_bestowHopeStackIteration <= auto1108B650_ae) || (auto1108B650_ai < 0 && lv_bestowHopeStackIteration >= auto1108B650_ae) ) ; lv_bestowHopeStackIteration += auto1108B650_ai ) {

        lv_auriel = UnitBehaviorEffectUnit(lv_proxy, "AurielBestowHopeProxyBehavior", c_effectUnitCaster, lv_bestowHopeStackIteration);

        lv_aurielPlayer = UnitGetOwner(lv_auriel);

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

            CatalogFieldValueSetFixed(c_gameCatalogEffect, "AurielBestowHopeRestoreHope", "RechargeVitalRate", lv_proxyPlayer, (lv_damageDealt * libHAUR_gv_heroAurielBestowHopeHeroicDamageStoredFraction));

            UnitCreateEffectUnit(lv_proxy, "AurielBestowHopeRestoreHopeSet", lv_auriel);

        }

        else {

            CatalogFieldValueSetFixed(c_gameCatalogEffect, "AurielBestowHopeRestoreHope", "RechargeVitalRate", lv_proxyPlayer, (lv_damageDealt * libHAUR_gv_heroAurielBestowHopeNonHeroicDamageStoredFraction));

            UnitCreateEffectUnit(lv_proxy, "AurielBestowHopeRestoreHopeSet", lv_auriel);

        }

    }

    return true;

}



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

void libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageDealt_Init () {

    libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageDealt = TriggerCreate("libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageDealt_Func");

    TriggerEnable(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageDealt, false);

    TriggerAddEventUnitDamaged(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageDealt, null, c_unitDamageTypeAny, c_unitDamageEither, null);

}



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

// Trigger: Hero - Auriel - Bestow Hope - Healing Stored From Proxy Damage Taken

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

bool libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken_Func (bool testConds, bool runActions) {

    // Variable Declarations

    fixed lv_damageTaken;

    unit lv_aurielProxy;

    unit lv_auriel;

    int lv_proxyPlayer;

    int lv_damagingPlayer;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_aurielProxy = EventUnit();

    lv_proxyPlayer = UnitGetOwner(lv_aurielProxy);

    lv_damagingPlayer = UnitGetOwner(EventUnitDamageSourceUnit());



    // Conditions

    if (testConds) {

        if (!((UnitBehaviorCount(lv_aurielProxy, "AurielBestowHopeProxyBehavior") > 0))) {

            return false;

        }



        if (!((lv_proxyPlayer != lv_damagingPlayer))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    if ((PlayerHasTalent(libHAUR_gv_heroAurielBestowHopeProxyOwner[lv_proxyPlayer], "AurielEmpathicLinkBestowHopeTalent") == true)) {

        lv_auriel = libGame_gv_players[libHAUR_gv_heroAurielBestowHopeProxyOwner[lv_proxyPlayer]].lv_heroUnit;

        lv_damageTaken = (EventUnitDamageAmount() + EventUnitDamageBehaviorShield());

        CatalogFieldValueSetFixed(c_gameCatalogEffect, "AurielBestowHopeEmpathicLinkRestoreHope", "RechargeVitalRate", lv_proxyPlayer, (lv_damageTaken * libHAUR_gv_heroAurielBestowHopeEmpathicLinkStoredPercentage));

        UnitCreateEffectUnit(lv_aurielProxy, "AurielBestowHopeRestoreHopeEmpathicLinkSet", lv_auriel);

    }



    if ((UnitIsAlive(EventUnit()) == false)) {

        UnitBehaviorRemove(EventUnit(), "AurielBestowHopeProxyBehavior", 1);

    }



    return true;

}



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

void libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken_Init () {

    libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken = TriggerCreate("libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken_Func");

    TriggerEnable(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken, false);

    TriggerAddEventUnitDamaged(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken, UnitRefFromVariable("libHAUR_gv_heroAurielBestowHopeProxy[1]"), c_unitDamageTypeAny, c_unitDamageEither, null);

    TriggerAddEventUnitDamaged(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken, UnitRefFromVariable("libHAUR_gv_heroAurielBestowHopeProxy[2]"), c_unitDamageTypeAny, c_unitDamageEither, null);

    TriggerAddEventUnitDamaged(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken, UnitRefFromVariable("libHAUR_gv_heroAurielBestowHopeProxy[3]"), c_unitDamageTypeAny, c_unitDamageEither, null);

    TriggerAddEventUnitDamaged(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken, UnitRefFromVariable("libHAUR_gv_heroAurielBestowHopeProxy[4]"), c_unitDamageTypeAny, c_unitDamageEither, null);

    TriggerAddEventUnitDamaged(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken, UnitRefFromVariable("libHAUR_gv_heroAurielBestowHopeProxy[5]"), c_unitDamageTypeAny, c_unitDamageEither, null);

    TriggerAddEventUnitDamaged(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken, UnitRefFromVariable("libHAUR_gv_heroAurielBestowHopeProxy[6]"), c_unitDamageTypeAny, c_unitDamageEither, null);

    TriggerAddEventUnitDamaged(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken, UnitRefFromVariable("libHAUR_gv_heroAurielBestowHopeProxy[7]"), c_unitDamageTypeAny, c_unitDamageEither, null);

    TriggerAddEventUnitDamaged(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken, UnitRefFromVariable("libHAUR_gv_heroAurielBestowHopeProxy[8]"), c_unitDamageTypeAny, c_unitDamageEither, null);

    TriggerAddEventUnitDamaged(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken, UnitRefFromVariable("libHAUR_gv_heroAurielBestowHopeProxy[9]"), c_unitDamageTypeAny, c_unitDamageEither, null);

    TriggerAddEventUnitDamaged(libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken, UnitRefFromVariable("libHAUR_gv_heroAurielBestowHopeProxy[10]"), c_unitDamageTypeAny, c_unitDamageEither, null);

}



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

// Trigger: Hero - Auriel - Bestow Hope - Proxy Unit Swapped

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

bool libHAUR_gt_HeroAurielBestowHopeProxyUnitSwapped_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_oldUnit;

    unit lv_newUnit;

    unit lv_aurielUnit;

    bool lv_preserveOnOld;



    // Automatic Variable Declarations

    const int auto9EA897AF_ae = libCore_gv_bALMaxPlayers;

    int auto9EA897AF_var;



    // Variable Initialization

    lv_oldUnit = libGame_gf_HeroUnitSwappedForPlayerOldUnit();

    lv_newUnit = libGame_gf_HeroUnitSwappedForPlayerNewUnit();

    lv_preserveOnOld = libGame_gf_HeroUnitSwappedForPlayerPreserveOnOld();



    // Conditions

    if (testConds) {

        if (!((lv_preserveOnOld == false))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    auto9EA897AF_var = 1;

    for ( ; auto9EA897AF_var <= auto9EA897AF_ae; auto9EA897AF_var += 1 ) {

        if ((libHAUR_gv_heroAurielBestowHopeProxy[auto9EA897AF_var] == lv_oldUnit)) {

            lv_aurielUnit = libGame_gv_players[auto9EA897AF_var].lv_heroUnit;

            UnitCreateEffectUnit(lv_aurielUnit, "AurielBestowHopeRemovalSet", lv_oldUnit);

            UnitCreateEffectUnit(lv_aurielUnit, "AurielBestowHopeApplicationSet", lv_newUnit);

        }



    }

    return true;

}



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

void libHAUR_gt_HeroAurielBestowHopeProxyUnitSwapped_Init () {

    libHAUR_gt_HeroAurielBestowHopeProxyUnitSwapped = TriggerCreate("libHAUR_gt_HeroAurielBestowHopeProxyUnitSwapped_Func");

    TriggerEnable(libHAUR_gt_HeroAurielBestowHopeProxyUnitSwapped, false);

    libGame_gf_HeroUnitSwappedForPlayer(libHAUR_gt_HeroAurielBestowHopeProxyUnitSwapped);

}



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

// Trigger: Hero - Auriel - Ray of Heaven - Ability Used

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

bool libHAUR_gt_HeroAurielRayofHeavenAbilityUsed_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_auriel;

    int lv_aurielPlayer;

    fixed lv_aurielCurrentEnergy_Raw;

    fixed lv_aurielCurrentEnergy_Percent;

    fixed lv_aurielBaseEnergyCap;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_auriel = EventUnit();

    lv_aurielPlayer = UnitGetOwner(lv_auriel);

    lv_aurielCurrentEnergy_Raw = UnitGetPropertyFixed(lv_auriel, c_unitPropEnergy, c_unitPropCurrent);

    lv_aurielCurrentEnergy_Percent = UnitGetPropertyFixed(lv_auriel, c_unitPropEnergyPercent, c_unitPropCurrent);



    // Actions

    if (!runActions) {

        return true;

    }



    if ((lv_aurielCurrentEnergy_Percent == 100.0) && (PlayerHasTalent(lv_aurielPlayer, "AurielReservoirofHopeRayOfHeavenTalent") == true)) {

        UnitCreateEffectUnit(lv_auriel, "AurielRayOfHeavenReservoirOfHopeQuestIncrementToken", lv_auriel);

    }



    if ((UnitHasBehavior2(lv_auriel, "AurielRayOfHeavenGlimmerofHopePrimed") == true)) {

        UnitSetPropertyFixed(lv_auriel, c_unitPropEnergy, (lv_aurielCurrentEnergy_Raw * libHAUR_gv_heroAurielRayofHeavenGlimmerofHopeStoredPercentage));

        UnitBehaviorRemove(lv_auriel, "AurielRayOfHeavenGlimmerofHopePrimed", 1);

    }

    else {

        UnitSetPropertyFixed(lv_auriel, c_unitPropEnergy, 0.0);

    }

    lv_aurielBaseEnergyCap = (UnitGetPropertyFixed(lv_auriel, c_unitPropEnergyMax, c_unitPropCurrent) - (libHAUR_gv_heroAurielRayofHeavenReservoirofHopeHealingPerStack * UnitGetTokenCount(lv_auriel, CatalogFieldValueGet(c_gameCatalogBehavior, "AurielRayOfHeavenReservoirOfHopeQuestToken", "TokenId", c_playerAny))));

    CatalogFieldValueSetFixed(c_gameCatalogEffect, "AurielRayOfHeavenCreateHealer", "RechargeVitalRate", lv_aurielPlayer, lv_aurielCurrentEnergy_Raw);

    if ((PlayerHasTalent(lv_aurielPlayer, "AurielSearingLightRayOfHeavenTalent") == true)) {

        CatalogFieldValueSetFixed(c_gameCatalogEffect, "AurielRayOfHeavenSearingLightHeroDamage", "Amount", lv_aurielPlayer, (lv_aurielCurrentEnergy_Raw * libHAUR_gv_heroAurielRayofHeavenSearingLightFractionOfEnergyConvertedToDamage));

        CatalogFieldValueSetFixed(c_gameCatalogEffect, "AurielRayOfHeavenSearingLightNonHeroDamage", "Amount", lv_aurielPlayer, (lv_aurielCurrentEnergy_Raw * libHAUR_gv_heroAurielRayofHeavenSearingLightFractionOfEnergyConvertedToDamage));

    }



    if ((lv_aurielCurrentEnergy_Raw < (lv_aurielBaseEnergyCap * 0.5))) {

        UnitCreateEffectPoint(lv_auriel, "AurielRayOfHeavenLowHealingStoredInitialSet", EventUnitTargetPoint());

    }

    else {

        if ((lv_aurielCurrentEnergy_Raw >= lv_aurielBaseEnergyCap)) {

            UnitCreateEffectPoint(lv_auriel, "AurielRayOfHeavenMaxHealingStoredInitialSet", EventUnitTargetPoint());

        }

        else {

            UnitCreateEffectPoint(lv_auriel, "AurielRayOfHeavenHighHealingStoredInitialSet", EventUnitTargetPoint());

        }

    }

    return true;

}



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

void libHAUR_gt_HeroAurielRayofHeavenAbilityUsed_Init () {

    libHAUR_gt_HeroAurielRayofHeavenAbilityUsed = TriggerCreate("libHAUR_gt_HeroAurielRayofHeavenAbilityUsed_Func");

    TriggerEnable(libHAUR_gt_HeroAurielRayofHeavenAbilityUsed, false);

    TriggerAddEventUnitAbility(libHAUR_gt_HeroAurielRayofHeavenAbilityUsed, null, AbilityCommand("AurielRayOfHeaven", 0), c_abilEffectStageCast, false);

}



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

// Trigger: Hero - Auriel - Crystal Aegis - Overlay Controller

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

bool libHAUR_gt_HeroAurielCrystalAegisOverlayController_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) && (UnitHasBehavior2(EventUnit(), "AurielCrystalAegisStasisBehavior") == true)) {

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

    }

    else {

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

    }

    return true;

}



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

void libHAUR_gt_HeroAurielCrystalAegisOverlayController_Init () {

    libHAUR_gt_HeroAurielCrystalAegisOverlayController = TriggerCreate("libHAUR_gt_HeroAurielCrystalAegisOverlayController_Func");

    TriggerEnable(libHAUR_gt_HeroAurielCrystalAegisOverlayController, false);

    TriggerAddEventUnitBehaviorChange(libHAUR_gt_HeroAurielCrystalAegisOverlayController, null, "AurielCrystalAegisStasisBehavior", c_unitBehaviorChangeActivate);

    TriggerAddEventUnitBehaviorChange(libHAUR_gt_HeroAurielCrystalAegisOverlayController, null, "AurielCrystalAegisStasisBehavior", c_unitBehaviorChangeDestroy);

}



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

// Trigger: Hero - Auriel - Resurrect - Player Unlocks Resurrect

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

bool libHAUR_gt_HeroAurielResurrectPlayerUnlocksResurrect_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_auriel;

    int lv_aurielPlayer;

    int lv_aurielTeam;



    // Automatic Variable Declarations

    // Variable Initialization

    lv_auriel = EventUnit();

    lv_aurielPlayer = UnitGetOwner(lv_auriel);



    // Conditions

    if (testConds) {

        if (!((UnitGetType(lv_auriel) == "HeroAuriel"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_aurielTeam = libGame_gf_TeamNumberOfPlayer(lv_aurielPlayer);

    if ((UnitBehaviorCount(lv_auriel, "Ultimate1Unlocked") > 0)) {

        libHAUR_gv_heroAurielResurrectRezzersOnTeam[lv_aurielTeam] += 1;

    }

    else {

        libHAUR_gv_heroAurielResurrectRezzersOnTeam[lv_aurielTeam] -= 1;

    }

    if (((libHAUR_gv_heroAurielResurrectRezzersOnTeam[libGame_gv_teamOrderIndex_C] >= 1) || (libHAUR_gv_heroAurielResurrectRezzersOnTeam[libGame_gv_teamChaosIndex_C] >= 1))) {

        TriggerEnable(libHAUR_gt_HeroAurielResurrectCreateSpirit, true);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectRevivePlayer, true);

    }

    else {

        TriggerEnable(libHAUR_gt_HeroAurielResurrectCreateSpirit, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectMurkyEggDeathSpiritReveal, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectRevivePlayer, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectPlayerRespawns, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainComplete, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveStart, false);

        TriggerEnable(libHAUR_gt_HeroAurielResurrectSpiritTimerController, false);

    }

    return true;

}



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

void libHAUR_gt_HeroAurielResurrectPlayerUnlocksResurrect_Init () {

    libHAUR_gt_HeroAurielResurrectPlayerUnlocksResurrect = TriggerCreate("libHAUR_gt_HeroAurielResurrectPlayerUnlocksResurrect_Func");

    TriggerEnable(libHAUR_gt_HeroAurielResurrectPlayerUnlocksResurrect, false);

    TriggerAddEventUnitBehaviorChange(libHAUR_gt_HeroAurielResurrectPlayerUnlocksResurrect, null, "Ultimate1Unlocked", c_unitBehaviorChangeCreate);

    TriggerAddEventUnitBehaviorChange(libHAUR_gt_HeroAurielResurrectPlayerUnlocksResurrect, null, "Ultimate1Unlocked", c_unitBehaviorChangeDestroy);

}



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

// Trigger: Hero - Auriel - Resurrect - Player Respecs

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

bool libHAUR_gt_HeroAurielResurrectPlayerRespecs_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_itPlayer;

    unit lv_itUnit;



    // Automatic Variable Declarations

    const int autoFF32B8CF_ae = libCore_gv_bALMaxPlayers;

    const int autoFF32B8CF_ai = 1;



    // Variable Initialization



    // Conditions

    if (testConds) {

        if (!((UnitGetType(libGame_gv_players[libGame_gf_HeroRespecsTalentsPlayer()].lv_heroUnit) == "HeroAuriel"))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    if ((libHAUR_gv_heroAurielResurrectRezzersOnTeam[libGame_gf_TeamNumberOfPlayer(libGame_gf_HeroRespecsTalentsPlayer())] == 0)) {

        lv_itPlayer = 1;

        for ( ; ( (autoFF32B8CF_ai >= 0 && lv_itPlayer <= autoFF32B8CF_ae) || (autoFF32B8CF_ai < 0 && lv_itPlayer >= autoFF32B8CF_ae) ) ; lv_itPlayer += autoFF32B8CF_ai ) {

            if ((libHAUR_gv_heroAurielResurrectSpirit[lv_itPlayer] != null)) {

                UnitRemove(libHAUR_gv_heroAurielResurrectSpirit[lv_itPlayer]);

                libHAUR_gv_heroAurielResurrectSpirit[lv_itPlayer] = null;

            }



            if ((libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_itPlayer][1].lv_spiritUnit != null)) {

                UnitRemove(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_itPlayer][1].lv_spiritUnit);

                libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_itPlayer][1].lv_spiritUnit = null;

            }



            if ((libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_itPlayer][2].lv_spiritUnit != null)) {

                UnitRemove(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_itPlayer][2].lv_spiritUnit);

                libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_itPlayer][2].lv_spiritUnit = null;

            }



            if ((libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_itPlayer][3].lv_spiritUnit != null)) {

                UnitRemove(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_itPlayer][3].lv_spiritUnit);

                libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_itPlayer][3].lv_spiritUnit = null;

            }



            TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_itPlayer][0]);

            TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_itPlayer][1]);

            TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_itPlayer][2]);

            TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_itPlayer][3]);

            TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_itPlayer][0]);

            TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_itPlayer][1]);

            TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_itPlayer][2]);

            TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_itPlayer][3]);

        }

    }



    return true;

}



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

void libHAUR_gt_HeroAurielResurrectPlayerRespecs_Init () {

    libHAUR_gt_HeroAurielResurrectPlayerRespecs = TriggerCreate("libHAUR_gt_HeroAurielResurrectPlayerRespecs_Func");

    TriggerEnable(libHAUR_gt_HeroAurielResurrectPlayerRespecs, false);

    libGame_gf_HeroRespecsTalents(libHAUR_gt_HeroAurielResurrectPlayerRespecs);

}



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

// Trigger: Hero - Auriel - Resurrect - Create Spirit

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

bool libHAUR_gt_HeroAurielResurrectCreateSpirit_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_deadHero;

    int lv_deadPlayer;

    int lv_deadPlayersTeam;

    int lv_iPlayer;

    point lv_lastKnownPosition;



    // Automatic Variable Declarations

    string autoDD7969E0_val;

    const int auto6C97AF6C_ae = libCore_gv_bALMaxPlayers;

    const int auto6C97AF6C_ai = 1;

    const int auto24B82E18_ae = libCore_gv_bALMaxPlayers;

    const int auto24B82E18_ai = 1;



    // Variable Initialization

    lv_deadHero = EventUnit();

    lv_deadPlayer = UnitGetOwner(lv_deadHero);

    lv_deadPlayersTeam = libGame_gf_TeamNumberOfPlayer(lv_deadPlayer);

    lv_iPlayer = 1;

    lv_lastKnownPosition = UnitGetPosition(EventUnit());



    // Conditions

    if (testConds) {

        if (!((libHAUR_gv_heroAurielResurrectRezzersOnTeam[lv_deadPlayersTeam] >= 1))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    autoDD7969E0_val = UnitGetType(lv_deadHero);

    if (autoDD7969E0_val == "HeroBaleog") {

        if ((libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_checkpointReachedDeathTimerActive == false)) {

            CatalogFieldValueSet(c_gameCatalogUnit, "AurielResurrectSpirit", "Name", lv_deadPlayer, CatalogFieldValueGet(c_gameCatalogUnit, UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit), "Name", lv_deadPlayer));

            UnitCreate(1, "AurielResurrectSpirit", 0, lv_deadPlayer, UnitGetPosition(lv_deadHero), 270.0, lv_deadHero);

            libHAUR_gv_heroAurielResurrectShowSpiritTimer[lv_deadPlayer] = true;

            libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer] = UnitLastCreated();

            libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][1].lv_spiritUnit = UnitLastCreated();

            libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][1].lv_vikingUnit = lv_deadHero;

            UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][1].lv_spiritUnit, "AurielResurrectRezzable", libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][1].lv_spiritUnit, 1);

            UnitBehaviorSetDuration(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][1].lv_spiritUnit, "AurielResurrectRezzable", (TimerGetDuration(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_baleogDeathTimer) - libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime));

            libHAUR_gf_HeroAurielResurrectRevealSpirittoAurielandDeadPlayer(lv_deadPlayer, lv_deadHero);

            TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, true);

            TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainComplete, true);

        }

        else {

            return true;

        }

    }

    else if (autoDD7969E0_val == "HeroFaerieDragon") {

        CatalogFieldValueSet(c_gameCatalogUnit, "AurielResurrectSpirit", "Name", lv_deadPlayer, CatalogFieldValueGet(c_gameCatalogUnit, UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit), "Name", lv_deadPlayer));

        UnitCreate(1, "AurielResurrectSpirit", 0, lv_deadPlayer, UnitGetPosition(lv_deadHero), 270.0, lv_deadHero);

        libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer] = UnitLastCreated();

        UnitSetHeight(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], 1.0, 0.0);

        UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], 1);

        UnitBehaviorSetDuration(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", (TimerGetDuration(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) - libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime));

        libHAUR_gf_HeroAurielResurrectRevealSpirittoAurielandDeadPlayer(lv_deadPlayer, lv_deadHero);

    }

    else if (autoDD7969E0_val == "HeroDiablo") {

        Wait(0.125, c_timeGame);

        if ((TimerGetDuration(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) <= libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime)) {

        }

        else {

            CatalogFieldValueSet(c_gameCatalogUnit, "AurielResurrectSpirit", "Name", lv_deadPlayer, CatalogFieldValueGet(c_gameCatalogUnit, UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit), "Name", lv_deadPlayer));

            UnitCreate(1, "AurielResurrectSpirit", 0, lv_deadPlayer, UnitGetPosition(lv_deadHero), 270.0, lv_deadHero);

            libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer] = UnitLastCreated();

            UnitSetPosition(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], lv_lastKnownPosition, false);

            UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], 1);

            UnitBehaviorSetDuration(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", (TimerGetDuration(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) - libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime));

            libHAUR_gf_HeroAurielResurrectRevealSpirittoAurielandDeadPlayer(lv_deadPlayer, lv_deadHero);

        }

    }

    else if (autoDD7969E0_val == "HeroErik") {

        if ((libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_checkpointReachedDeathTimerActive == false)) {

            CatalogFieldValueSet(c_gameCatalogUnit, "AurielResurrectSpirit", "Name", lv_deadPlayer, CatalogFieldValueGet(c_gameCatalogUnit, UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit), "Name", lv_deadPlayer));

            UnitCreate(1, "AurielResurrectSpirit", 0, lv_deadPlayer, UnitGetPosition(lv_deadHero), 270.0, lv_deadHero);

            libHAUR_gv_heroAurielResurrectShowSpiritTimer[lv_deadPlayer] = true;

            libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer] = UnitLastCreated();

            libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][2].lv_spiritUnit = UnitLastCreated();

            libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][2].lv_vikingUnit = lv_deadHero;

            UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][2].lv_spiritUnit, "AurielResurrectRezzable", libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][2].lv_spiritUnit, 1);

            UnitBehaviorSetDuration(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][2].lv_spiritUnit, "AurielResurrectRezzable", (TimerGetDuration(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_erikDeathTimer) - libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime));

            libHAUR_gf_HeroAurielResurrectRevealSpirittoAurielandDeadPlayer(lv_deadPlayer, lv_deadHero);

            TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, true);

            TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainComplete, true);

        }

        else {

            return true;

        }

    }

    else if (autoDD7969E0_val == "HeroL90ETC") {

        if ((UnitHasBehavior2(lv_deadHero, "L90ETCDeathMetalCarryBehavior") == false)) {

            CatalogFieldValueSet(c_gameCatalogUnit, "AurielResurrectSpirit", "Name", lv_deadPlayer, CatalogFieldValueGet(c_gameCatalogUnit, UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit), "Name", lv_deadPlayer));

            UnitCreate(1, "AurielResurrectSpirit", 0, lv_deadPlayer, UnitGetPosition(lv_deadHero), 270.0, lv_deadHero);

            libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer] = UnitLastCreated();

            UnitSetPosition(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], lv_lastKnownPosition, false);

            UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], 1);

            UnitBehaviorSetDuration(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", (TimerGetDuration(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) - libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime));

            libHAUR_gf_HeroAurielResurrectRevealSpirittoAurielandDeadPlayer(lv_deadPlayer, lv_deadHero);

        }

        else {

            UnitCreate(1, "AurielResurrectSpirit", 0, UnitGetOwner(lv_deadHero), UnitGetPosition(lv_deadHero), 270.0, lv_deadHero);

            libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer] = UnitLastCreated();

            UnitSetPosition(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], lv_lastKnownPosition, false);

            UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], 1);

            UnitBehaviorSetDuration(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", (TimerGetDuration(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) - libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime));

            Wait(CatalogFieldValueGetAsFixed(c_gameCatalogBehavior, "L90ETCDeathMetalTimedLife", "Duration", UnitGetOwner(lv_deadHero)), c_timeGame);

            libHAUR_gf_HeroAurielResurrectRevealSpirittoAurielandDeadPlayer(lv_deadPlayer, lv_deadHero);

        }

    }

    else if (autoDD7969E0_val == "HeroFalstad") {

        CatalogFieldValueSet(c_gameCatalogUnit, "AurielResurrectSpirit", "Name", lv_deadPlayer, CatalogFieldValueGet(c_gameCatalogUnit, UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit), "Name", lv_deadPlayer));

        UnitCreate(1, "AurielResurrectSpirit", 0, lv_deadPlayer, UnitGetPosition(lv_deadHero), 270.0, lv_deadHero);

        libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer] = UnitLastCreated();

        UnitSetHeight(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], 2.0, 0.0);

        UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], 1);

        UnitBehaviorSetDuration(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", (TimerGetDuration(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) - libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime));

        libHAUR_gf_HeroAurielResurrectRevealSpirittoAurielandDeadPlayer(lv_deadPlayer, lv_deadHero);

    }

    else if (autoDD7969E0_val == "HeroGall") {

        return true;

    }

    else if (autoDD7969E0_val == "HeroLeoric") {

        libHAUR_gv_heroAurielResurrectLeoricUnit[lv_deadPlayer] = lv_deadHero;

        CatalogFieldValueSet(c_gameCatalogUnit, "AurielResurrectSpirit", "Name", lv_deadPlayer, CatalogFieldValueGet(c_gameCatalogUnit, UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit), "Name", lv_deadPlayer));

        UnitCreate(1, "AurielResurrectSpirit", 0, lv_deadPlayer, UnitGetPosition(lv_deadHero), 270.0, lv_deadHero);

        libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer] = UnitLastCreated();

        UnitSetPosition(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], lv_lastKnownPosition, false);

        UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], 1);

        UnitBehaviorSetDuration(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", (TimerGetDuration(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) - libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime));

        TriggerEnable(libHAUR_gt_HeroAurielResurrectLeoricSpiritFollow, true);

        lv_iPlayer = 1;

        for ( ; ( (auto6C97AF6C_ai >= 0 && lv_iPlayer <= auto6C97AF6C_ae) || (auto6C97AF6C_ai < 0 && lv_iPlayer >= auto6C97AF6C_ae) ) ; lv_iPlayer += auto6C97AF6C_ai ) {

            if (((UnitGetType(libGame_gv_players[lv_iPlayer].lv_heroUnit) == "HeroAuriel") && (libGame_gf_TeamNumberOfPlayer(lv_deadPlayer) == libGame_gf_TeamNumberOfPlayer(lv_iPlayer)))) {

                ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), libNtve_gf_Signal(("Auriel" + IntToString(lv_iPlayer))));

            }



        }

        ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), libNtve_gf_ModelSwap("HitTestFuzzy_Cyliner", 0));

        ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), libNtve_gf_SetOpacity(0.0, 0));

        ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), libNtve_gf_SetScale(2.0, 2.0, 4.5, 0.0));

        ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), libNtve_gf_SetHeight(1.0));

    }

    else if (autoDD7969E0_val == "HeroMurky") {

        CatalogFieldValueSet(c_gameCatalogUnit, "AurielResurrectSpirit", "Name", lv_deadPlayer, CatalogFieldValueGet(c_gameCatalogUnit, UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit), "Name", lv_deadPlayer));

        UnitCreate(1, "AurielResurrectSpirit", 0, lv_deadPlayer, UnitGetPosition(lv_deadHero), 270.0, lv_deadHero);

        libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer] = UnitLastCreated();

        UnitSetPosition(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], lv_lastKnownPosition, false);

        UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], 1);

        UnitBehaviorSetDuration(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", (TimerGetDuration(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) - libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime));

        ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), libNtve_gf_ModelSwap(libCore_gf_GetModelLinkForUnitType(UnitGetType(lv_deadHero)), 0));

        if ((UnitIsAlive(libGame_gv_heroDeathMurkyRespawnEggs[lv_deadPlayer]) == true)) {

            TriggerEnable(libHAUR_gt_HeroAurielResurrectMurkyEggDeathSpiritReveal, true);

            return true;

        }

        else {

            lv_iPlayer = 1;

            for ( ; ( (auto24B82E18_ai >= 0 && lv_iPlayer <= auto24B82E18_ae) || (auto24B82E18_ai < 0 && lv_iPlayer >= auto24B82E18_ae) ) ; lv_iPlayer += auto24B82E18_ai ) {

                if (((UnitGetType(libGame_gv_players[lv_iPlayer].lv_heroUnit) == "HeroAuriel") && (libGame_gf_TeamNumberOfPlayer(lv_deadPlayer) == libGame_gf_TeamNumberOfPlayer(lv_iPlayer)))) {

                    ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), libNtve_gf_Signal(("Auriel" + IntToString(lv_iPlayer))));

                    ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), libNtve_gf_Signal(("Auriel" + IntToString(lv_deadPlayer))));

                    ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), libNtve_gf_Signal("Taunt"));

                    libHAUR_gv_heroAurielResurrectShowSpiritTimer[lv_deadPlayer] = true;

                }



            }

        }

    }

    else if (autoDD7969E0_val == "HeroOlaf") {

        if ((libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_checkpointReachedDeathTimerActive == false)) {

            CatalogFieldValueSet(c_gameCatalogUnit, "AurielResurrectSpirit", "Name", lv_deadPlayer, CatalogFieldValueGet(c_gameCatalogUnit, UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit), "Name", lv_deadPlayer));

            UnitCreate(1, "AurielResurrectSpirit", 0, lv_deadPlayer, UnitGetPosition(lv_deadHero), 270.0, lv_deadHero);

            libHAUR_gv_heroAurielResurrectShowSpiritTimer[lv_deadPlayer] = true;

            libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer] = UnitLastCreated();

            libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][3].lv_spiritUnit = UnitLastCreated();

            libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][3].lv_vikingUnit = lv_deadHero;

            UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][3].lv_spiritUnit, "AurielResurrectRezzable", libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][3].lv_spiritUnit, 1);

            UnitBehaviorSetDuration(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][3].lv_spiritUnit, "AurielResurrectRezzable", (TimerGetDuration(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_olafDeathTimer) - libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime));

            libHAUR_gf_HeroAurielResurrectRevealSpirittoAurielandDeadPlayer(lv_deadPlayer, lv_deadHero);

            TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, true);

            TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainComplete, true);

        }

        else {

            return true;

        }

    }

    else if (autoDD7969E0_val == "HeroTyrael") {

        CatalogFieldValueSet(c_gameCatalogUnit, "AurielResurrectSpirit", "Name", lv_deadPlayer, CatalogFieldValueGet(c_gameCatalogUnit, UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit), "Name", lv_deadPlayer));

        UnitCreate(1, "AurielResurrectSpirit", 0, lv_deadPlayer, UnitGetPosition(lv_deadHero), 270.0, lv_deadHero);

        libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer] = UnitLastCreated();

        while ((UnitHasBehavior2(lv_deadHero, "TyraelArchangelsWrathDeathActiveBuff") == true)) {

            lv_lastKnownPosition = UnitGetPosition(lv_deadHero);

            Wait(0.0625, c_timeGame);

        }

        UnitSetPosition(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], lv_lastKnownPosition, false);

        UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], 1);

        UnitBehaviorSetDuration(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", (TimerGetDuration(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) - (libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime + CatalogFieldValueGetAsFixed(c_gameCatalogBehavior, "TyraelArchangelsWrathDeathActiveBuff", "Duration", lv_deadPlayer))));

        libHAUR_gf_HeroAurielResurrectRevealSpirittoAurielandDeadPlayer(lv_deadPlayer, lv_deadHero);

    }

    else if (autoDD7969E0_val == "HeroUther") {

        if (((PlayerHasTalent(lv_deadPlayer, "UtherMasteryRedemption") == true) && (UnitHasBehavior2(lv_deadHero, "RedemptionCooldown") == false))) {

        }

        else {

            CatalogFieldValueSet(c_gameCatalogUnit, "AurielResurrectSpirit", "Name", lv_deadPlayer, CatalogFieldValueGet(c_gameCatalogUnit, UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit), "Name", lv_deadPlayer));

            UnitCreate(1, "AurielResurrectSpirit", 0, lv_deadPlayer, UnitGetPosition(lv_deadHero), 270.0, lv_deadHero);

            libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer] = UnitLastCreated();

            while (((UnitHasBehavior2(lv_deadHero, "SpiritOfRedemptionSpiritFormBuff") == true) || (UnitHasBehavior2(lv_deadHero, "UtherEternalVanguardRezDelay") == true))) {

                Wait(0.0625, c_timeGame);

                lv_lastKnownPosition = UnitGetPosition(lv_deadHero);

            }

            UnitSetPosition(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], lv_lastKnownPosition, false);

            UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], 1);

            UnitBehaviorSetDuration(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", (TimerGetDuration(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) - (libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime + (CatalogFieldValueGetAsFixed(c_gameCatalogBehavior, "SpiritOfRedemptionSpiritFormBuff", "Duration", lv_deadPlayer) + CatalogFieldValueGetAsFixed(c_gameCatalogBehavior, "UtherEternalVanguardRezDelay", "Duration", lv_deadPlayer)))));

            libHAUR_gf_HeroAurielResurrectRevealSpirittoAurielandDeadPlayer(lv_deadPlayer, lv_deadHero);

        }

    }

    else if (autoDD7969E0_val == "HeroVarian") {

        CatalogFieldValueSet(c_gameCatalogUnit, "AurielResurrectSpirit", "Name", lv_deadPlayer, CatalogFieldValueGet(c_gameCatalogUnit, UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit), "Name", lv_deadPlayer));

        UnitCreate(1, "AurielResurrectSpirit", 0, lv_deadPlayer, UnitGetPosition(lv_deadHero), 270.0, lv_deadHero);

        libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer] = UnitLastCreated();

        UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], 1);

        UnitBehaviorSetDuration(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", (TimerGetDuration(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) - libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime));

        libHAUR_gf_HeroAurielResurrectRevealSpirittoAurielandDeadPlayer(lv_deadPlayer, lv_deadHero);

        if ((UnitHasBehavior2(lv_deadHero, "Ultimate1Unlocked") == true)) {

            ActorSendAsText(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), StringExternal("Param/Value/lib_HAUR_01A53FA0"));

            ActorSendAsText(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), StringExternal("Param/Value/lib_HAUR_2B5616E7"));

        }



        if ((UnitHasBehavior2(lv_deadHero, "Ultimate2Unlocked") == true)) {

            ActorSendAsText(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), StringExternal("Param/Value/lib_HAUR_8820D07D"));

            ActorSendAsText(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), StringExternal("Param/Value/lib_HAUR_60FB7DE7"));

            ActorSendAsText(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), StringExternal("Param/Value/lib_HAUR_69526BC8"));

        }



        if ((UnitHasBehavior2(lv_deadHero, "Ultimate3Unlocked") == true)) {

            ActorSendAsText(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), StringExternal("Param/Value/lib_HAUR_08EA24F8"));

            ActorSendAsText(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), StringExternal("Param/Value/lib_HAUR_36739258"));

        }



        if ((UnitHasBehavior2(lv_deadHero, "Ultimate1Unlocked") == false) && (UnitHasBehavior2(lv_deadHero, "Ultimate2Unlocked") == false) && (UnitHasBehavior2(lv_deadHero, "Ultimate3Unlocked") == false)) {

            ActorSendAsText(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), StringExternal("Param/Value/lib_HAUR_A5770B1C"));

            ActorSendAsText(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer]), StringExternal("Param/Value/lib_HAUR_7A962816"));

        }



    }

    else if (autoDD7969E0_val == "RexxarMisha") {

        return true;

    }

    else if (autoDD7969E0_val == "HeroDeathwing") {

        return true;

    }

    else if (autoDD7969E0_val == "BaleogsGravestone") {

        return true;

    }

    else if (autoDD7969E0_val == "EriksGravestone") {

        return true;

    }

    else if (autoDD7969E0_val == "OlafsGravestone") {

        return true;

    }

    else {

        CatalogFieldValueSet(c_gameCatalogUnit, "AurielResurrectSpirit", "Name", lv_deadPlayer, CatalogFieldValueGet(c_gameCatalogUnit, UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit), "Name", lv_deadPlayer));

        UnitCreate(1, "AurielResurrectSpirit", 0, lv_deadPlayer, UnitGetPosition(lv_deadHero), 270.0, lv_deadHero);

        libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer] = UnitLastCreated();

        UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], 1);

        UnitBehaviorSetDuration(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectRezzable", (TimerGetDuration(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) - libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime));

        libHAUR_gf_HeroAurielResurrectRevealSpirittoAurielandDeadPlayer(lv_deadPlayer, lv_deadHero);

    }

    libHAUR_gf_HeroAurielResurrectCheckActiveSpirits(true);

    return true;

}



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

void libHAUR_gt_HeroAurielResurrectCreateSpirit_Init () {

    libHAUR_gt_HeroAurielResurrectCreateSpirit = TriggerCreate("libHAUR_gt_HeroAurielResurrectCreateSpirit_Func");

    TriggerEnable(libHAUR_gt_HeroAurielResurrectCreateSpirit, false);

    TriggerAddEventUnitBehaviorChange(libHAUR_gt_HeroAurielResurrectCreateSpirit, null, "Dead", c_unitBehaviorChangeIncrease);

}



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

// Trigger: Hero - Auriel - Resurrect - Murky Egg Death Spirit Reveal

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

bool libHAUR_gt_HeroAurielResurrectMurkyEggDeathSpiritReveal_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_murkyPlayer;

    int lv_murkyPlayersTeam;

    unit lv_murky;

    unit lv_murkyEgg;

    unit lv_murkySpirit;

    int lv_iPlayer;



    // Automatic Variable Declarations

    const int autoF754AA34_ae = libCore_gv_bALMaxPlayers;

    const int autoF754AA34_ai = 1;



    // Variable Initialization

    lv_murkyPlayersTeam = libGame_gf_TeamNumberOfPlayer(UnitGetOwner(EventUnit()));

    lv_iPlayer = 1;



    // Conditions

    if (testConds) {

        if (!(((UnitGetType(EventUnit()) == "MurkyRespawnEgg") && (libHAUR_gv_heroAurielResurrectRezzersOnTeam[lv_murkyPlayersTeam] >= 1)))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_murkyEgg = EventUnit();

    lv_murkyPlayer = UnitGetOwner(EventUnit());

    lv_murkySpirit = libHAUR_gv_heroAurielResurrectSpirit[lv_murkyPlayer];

    lv_murky = libGame_gv_players[lv_murkyPlayer].lv_heroUnit;

    if ((UnitHasBehavior2(lv_murky, "Dead") == true)) {

        lv_iPlayer = 1;

        for ( ; ( (autoF754AA34_ai >= 0 && lv_iPlayer <= autoF754AA34_ae) || (autoF754AA34_ai < 0 && lv_iPlayer >= autoF754AA34_ae) ) ; lv_iPlayer += autoF754AA34_ai ) {

            if (((UnitGetType(libGame_gv_players[lv_iPlayer].lv_heroUnit) == "HeroAuriel") && (libGame_gf_TeamNumberOfPlayer(lv_iPlayer) == libGame_gf_TeamNumberOfPlayer(lv_murkyPlayer)))) {

                ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_murkyPlayer]), libNtve_gf_Signal(("Auriel" + IntToString(lv_iPlayer))));

                ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_murkyPlayer]), libNtve_gf_Signal(("Auriel" + IntToString(lv_murkyPlayer))));

                ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_murkyPlayer]), libNtve_gf_Signal("Taunt"));

                libHAUR_gv_heroAurielResurrectShowSpiritTimer[lv_murkyPlayer] = true;

                libHAUR_gf_HeroAurielResurrectCheckActiveSpirits(true);

            }



        }

    }



    return true;

}



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

void libHAUR_gt_HeroAurielResurrectMurkyEggDeathSpiritReveal_Init () {

    libHAUR_gt_HeroAurielResurrectMurkyEggDeathSpiritReveal = TriggerCreate("libHAUR_gt_HeroAurielResurrectMurkyEggDeathSpiritReveal_Func");

    TriggerEnable(libHAUR_gt_HeroAurielResurrectMurkyEggDeathSpiritReveal, false);

    TriggerAddEventUnitDied(libHAUR_gt_HeroAurielResurrectMurkyEggDeathSpiritReveal, null);

}



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

// Trigger: Hero - Auriel - Resurrect - Leoric Spirit Follow

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

bool libHAUR_gt_HeroAurielResurrectLeoricSpiritFollow_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_iPlayer;

    int lv_deadLeorics;

    fixed lv_unrezzableTimeDifference;

    unit lv_leoric;



    // Automatic Variable Declarations

    const int auto01D5D958_ae = libCore_gv_bALMaxPlayers;

    const int auto01D5D958_ai = 1;



    // Variable Initialization

    lv_iPlayer = 1;

    lv_unrezzableTimeDifference = 3.25;



    // Actions

    if (!runActions) {

        return true;

    }



    lv_iPlayer = 1;

    for ( ; ( (auto01D5D958_ai >= 0 && lv_iPlayer <= auto01D5D958_ae) || (auto01D5D958_ai < 0 && lv_iPlayer >= auto01D5D958_ae) ) ; lv_iPlayer += auto01D5D958_ai ) {

        lv_leoric = libGame_gv_players[lv_iPlayer].lv_heroUnit;

        if (((UnitGetType(lv_leoric) == "HeroLeoric") && (UnitHasBehavior2(lv_leoric, "LeoricUndying") == true))) {

            UnitSetPosition(libHAUR_gv_heroAurielResurrectSpirit[lv_iPlayer], UnitGetPosition(libHAUR_gv_heroAurielResurrectLeoricUnit[lv_iPlayer]), false);

            UnitSetFacing(libHAUR_gv_heroAurielResurrectSpirit[lv_iPlayer], UnitGetFacing(libHAUR_gv_heroAurielResurrectLeoricUnit[lv_iPlayer]), 0.0);

            UnitBehaviorSetDurationRemaining(libHAUR_gv_heroAurielResurrectSpirit[lv_iPlayer], "AurielResurrectRezzable", (TimerGetRemaining(libGame_gv_players[lv_iPlayer].lv_respawnTimer) - lv_unrezzableTimeDifference));

            lv_deadLeorics += 1;

        }



    }

    if ((lv_deadLeorics == 0)) {

        TriggerEnable(TriggerGetCurrent(), false);

    }



    return true;

}



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

void libHAUR_gt_HeroAurielResurrectLeoricSpiritFollow_Init () {

    libHAUR_gt_HeroAurielResurrectLeoricSpiritFollow = TriggerCreate("libHAUR_gt_HeroAurielResurrectLeoricSpiritFollow_Func");

    TriggerEnable(libHAUR_gt_HeroAurielResurrectLeoricSpiritFollow, false);

    TriggerAddEventTimePeriodic(libHAUR_gt_HeroAurielResurrectLeoricSpiritFollow, 0.25, c_timeGame);

}



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

// Trigger: Hero - Auriel - Resurrect - Revive Player

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

bool libHAUR_gt_HeroAurielResurrectRevivePlayer_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_resurrectingTimer;

    int lv_timerTextTag;

    unit lv_auriel;

    unit lv_target;

    int lv_aurielPlayer;

    int lv_targetPlayer;

    unit lv_targetHero;

    point lv_targetPosition;

    int lv_additionalPlayer;

    playergroup lv_vOGroup;

    unit lv_deadHero;

    int lv_itViking;



    // Automatic Variable Declarations

    int auto3502FC51_ae;

    string auto3E028A26_val;

    int auto45FC9C2D_ae;



    // Variable Initialization

    lv_resurrectingTimer = FixedToInt(libHAUR_gv_heroAurielResurrectResurrectTime);

    lv_timerTextTag = c_textTagNone;

    lv_auriel = EventPlayerEffectUsedUnit(c_effectUnitCaster);

    lv_target = EventPlayerEffectUsedUnit(c_effectUnitTarget);

    lv_aurielPlayer = UnitGetOwner(lv_auriel);

    lv_targetPlayer = UnitGetOwner(lv_target);

    lv_targetPosition = UnitGetPosition(lv_target);

    lv_vOGroup = PlayerGroupEmpty();



    // Actions

    if (!runActions) {

        return true;

    }



    if ((EventPlayerEffectUsed() == "AurielResurrectInitialDummy")) {

        lv_targetHero = libGame_gv_players[lv_targetPlayer].lv_heroUnit;

    }

    else {

        lv_targetHero = libGame_gv_players[lv_aurielPlayer].lv_heroUnit;

        lv_target = EventPlayerEffectUsedUnit(c_effectUnitCaster);

        lv_targetPosition = UnitGetPosition(libHAUR_gv_heroAurielResurrectSpirit[lv_aurielPlayer]);

        UnitCreateEffectUnit(lv_target, "AurielResurrectApplyActivelyResurrecting", libHAUR_gv_heroAurielResurrectSpirit[lv_aurielPlayer]);

        UnitCreateEffectUnit(lv_target, "AurielResurrectApplySelfMarkerBehavior", libHAUR_gv_heroAurielResurrectSpirit[lv_aurielPlayer]);

    }

    if ((UnitHasBehavior2(lv_targetHero, "LeoricUndying") == true)) {

        UnitCreateEffectUnit(lv_targetHero, "LeoricUndyingApplySuppressHealing5Seconds", lv_targetHero);

    }



    if ((UnitGetType(libGame_gv_players[lv_targetPlayer].lv_heroUnit) == "HeroLostVikingsController")) {

        auto3502FC51_ae = 3;

        lv_itViking = 1;

        for ( ; lv_itViking <= auto3502FC51_ae ; lv_itViking += 1 ) {

            if ((lv_target == libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_targetPlayer][lv_itViking].lv_spiritUnit)) {

                lv_targetHero = libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_targetPlayer][lv_itViking].lv_vikingUnit;

                UnitCreateEffectUnit(lv_targetHero, "LostVikingsPlayAgainApplySuppressResurrection5Seconds", lv_targetHero);

                auto3E028A26_val = UnitGetType(lv_targetHero);

                if (auto3E028A26_val == "HeroErik") {

                    libGDHL_gf_VikingDownStartRespawnTimer(lv_targetHero, libGDHL_gv_lostVikingsPlayer[lv_targetPlayer].lv_erikDeathTimer, true, lv_resurrectingTimer, UnitGetType(lv_targetHero));

                    break;

                }

                else if (auto3E028A26_val == "HeroBaleog") {

                    libGDHL_gf_VikingDownStartRespawnTimer(lv_targetHero, libGDHL_gv_lostVikingsPlayer[lv_targetPlayer].lv_baleogDeathTimer, true, lv_resurrectingTimer, UnitGetType(lv_targetHero));

                    break;

                }

                else if (auto3E028A26_val == "HeroOlaf") {

                    libGDHL_gf_VikingDownStartRespawnTimer(lv_targetHero, libGDHL_gv_lostVikingsPlayer[lv_targetPlayer].lv_olafDeathTimer, true, lv_resurrectingTimer, UnitGetType(lv_targetHero));

                    break;

                }

                else {

                }

            }



        }

    }

    else {

        libGame_gf_HeroDeathUpdateRespawnTimer(lv_targetPlayer, lv_resurrectingTimer);

    }

    DialogDestroy(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_targetPlayer]);

    libUIUI_gf_UIPartyFrameSpecialCaseAurielRevivesHero(lv_targetPlayer, lv_targetHero);

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

        lv_additionalPlayer = libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(lv_targetPlayer)].lv_gallPlayer;

        DialogDestroy(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_additionalPlayer]);

        TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_additionalPlayer][0]);

        TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_additionalPlayer][1]);

        TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_additionalPlayer][2]);

        TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_additionalPlayer][3]);

    }



    TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_targetPlayer][0]);

    TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_targetPlayer][1]);

    TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_targetPlayer][2]);

    TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_targetPlayer][3]);

    TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_targetPlayer][0]);

    TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_targetPlayer][1]);

    TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_targetPlayer][2]);

    TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_targetPlayer][3]);

    TextExpressionSetToken("Param/Expression/lib_HAUR_67088ACF", "A", StringExternal("Param/Value/lib_HAUR_41A946DA"));

    TextExpressionSetToken("Param/Expression/lib_HAUR_67088ACF", "B", IntToText(lv_resurrectingTimer));

    TextTagCreate(TextExpressionAssemble("Param/Expression/lib_HAUR_67088ACF"), 24, lv_targetPosition, 3.0, true, true, PlayerGroupAll());

    lv_timerTextTag = TextTagLastCreated();

    while ((lv_resurrectingTimer > 0)) {

        TextExpressionSetToken("Param/Expression/lib_HAUR_EEA6032B", "A", StringExternal("Param/Value/lib_HAUR_147401C8"));

        TextExpressionSetToken("Param/Expression/lib_HAUR_EEA6032B", "B", IntToText(lv_resurrectingTimer));

        TextTagSetText(lv_timerTextTag, TextExpressionAssemble("Param/Expression/lib_HAUR_EEA6032B"));

        lv_resurrectingTimer -= 1;

        Wait(1.0, c_timeGame);

    }

    TextTagDestroy(lv_timerTextTag);

    if ((UnitGetType(lv_targetHero) == "HeroMurky")) {

        UnitSetPosition(lv_targetHero, lv_targetPosition, false);

    }



    if ((libGame_gv_players[lv_targetPlayer].lv_heroRequiresCustomRespawn == true)) {

        libGame_gf_SendEventRequestCustomRespawn(lv_targetPlayer, false, lv_targetPosition, libHAUR_gv_heroAurielResurrectVitalScale);

        UnitRemove(libHAUR_gv_heroAurielResurrectSpirit[lv_targetPlayer]);

        libHAUR_gv_heroAurielResurrectSpirit[lv_targetPlayer] = null;

    }

    else {

        if ((UnitGetType(libGame_gv_players[lv_targetPlayer].lv_heroUnit) == "HeroLostVikingsController")) {

            auto45FC9C2D_ae = 3;

            lv_itViking = 1;

            for ( ; lv_itViking <= auto45FC9C2D_ae ; lv_itViking += 1 ) {

                if ((lv_target == libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_targetPlayer][lv_itViking].lv_spiritUnit)) {

                    libGDHL_gf_VikingDownRespawnVikingforPlayer(lv_targetHero);

                    UnitSetPosition(lv_targetHero, lv_targetPosition, false);

                    UnitSetPropertyFixed(lv_targetHero, c_unitPropLifePercent, libHAUR_gv_heroAurielResurrectVitalScale);

                    UnitRemove(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_targetPlayer][lv_itViking].lv_spiritUnit);

                    libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_targetPlayer][lv_itViking].lv_spiritUnit = null;

                }



            }

        }

        else {

            libGame_gf_HeroDeathRespawnHeroforPlayer(false, lv_targetPlayer, lv_targetPosition, libHAUR_gv_heroAurielResurrectVitalScale);

            UnitRemove(libHAUR_gv_heroAurielResurrectSpirit[lv_targetPlayer]);

            libHAUR_gv_heroAurielResurrectSpirit[lv_targetPlayer] = null;

        }

    }

    UnitBehaviorRemove(libGame_gv_players[lv_targetPlayer].lv_heroUnit, "AurielResurrectPendingResurrect", 1);

    if (((PlayerHasTalent(lv_aurielPlayer, "AurielLightSpeedResurrectTalent") == true) && (UnitHasBehavior2(lv_targetHero, "LeoricUndying") == false))) {

        UnitCreateEffectUnit(lv_auriel, "AurielResurrectLightSpeedApplyControllerBehavior", lv_targetHero);

        UnitCreateEffectUnit(lv_auriel, "AurielResurrectLightSpeedApplySpeedBehavior", lv_targetHero);

    }



    libNtve_gf_StopTimer(libGame_gv_players[lv_targetPlayer].lv_respawnSoundCueTimer);

    libNtve_gf_StopTimer(libGame_gv_players[lv_targetPlayer].lv_respawnTimer);

    UnitCreateEffectUnit(lv_auriel, "AurielResurrectWingsDummy", lv_targetHero);

    UnitBehaviorRemove(lv_targetHero, "HallOfStormsHealBuff", 1);

    UnitBehaviorRemove(lv_targetHero, "HallOfStormsProtectionBuff", 1);

    ActorSend(ActorFromActor(libNtve_gf_MainActorofUnit(lv_targetHero), "HallOfStormsHealBuffFX"), "Destroy Immediate");

    if ((UnitGetType(libGame_gv_players[lv_targetPlayer].lv_heroUnit) == "HeroLostVikingsController")) {

        if ((libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_targetPlayer][1].lv_spiritUnit == null) && (libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_targetPlayer][2].lv_spiritUnit == null) && (libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_targetPlayer][3].lv_spiritUnit == null)) {

            libHAUR_gv_heroAurielResurrectShowSpiritTimer[lv_targetPlayer] = false;

        }



    }

    else {

        libHAUR_gv_heroAurielResurrectShowSpiritTimer[lv_targetPlayer] = false;

    }

    if ((UnitHasBehavior2(lv_targetHero, "LeoricUndying") == true)) {

        UnitBehaviorAdd(lv_targetHero, "LeoricUndyingReviveHalfVitals", lv_targetHero, 1);

        UnitBehaviorRemove(lv_targetHero, "LeoricUndying", 1);

        UnitSetPropertyFixed(lv_targetHero, c_unitPropLifePercent, libHAUR_gv_heroAurielResurrectVitalScale);

        UnitSetPropertyFixed(lv_targetHero, c_unitPropEnergyPercent, libHAUR_gv_heroAurielResurrectEnergyPercentage);

        if ((PlayerHasTalent(lv_aurielPlayer, "AurielLightSpeedResurrectTalent") == true)) {

            UnitCreateEffectUnit(lv_auriel, "AurielResurrectLightSpeedApplyControllerBehavior", lv_targetHero);

            UnitCreateEffectUnit(lv_auriel, "AurielResurrectLightSpeedApplySpeedBehavior", lv_targetHero);

        }



    }



    libHAUR_gv_heroAurielResurrectTotalActiveResurrectActions -= 1;

    if ((libHAUR_gv_heroAurielResurrectTotalActiveResurrectActions <= 0)) {

    }



    libHAUR_gv_heroAurielResurrectFrameRecords[lv_aurielPlayer].lv_heroAurielResurrectTargetTeam = 0;

    libHAUR_gv_heroAurielResurrectFrameRecords[lv_aurielPlayer].lv_heroAurielResurrectTargetFrameIndex = 0;

    libGame_gf_HeroDeathEnableDisableDeadSoundStateForPlayer(false, lv_targetPlayer);

    PlayerGroupAdd(lv_vOGroup, lv_aurielPlayer);

    PlayerGroupAdd(lv_vOGroup, lv_targetPlayer);

    libSond_gf_HeroVOPlayResurrected(lv_targetPlayer, lv_vOGroup);

    libHAUR_gf_HeroAurielResurrectCheckActiveSpirits(false);

    return true;

}



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

void libHAUR_gt_HeroAurielResurrectRevivePlayer_Init () {

    libHAUR_gt_HeroAurielResurrectRevivePlayer = TriggerCreate("libHAUR_gt_HeroAurielResurrectRevivePlayer_Func");

    TriggerEnable(libHAUR_gt_HeroAurielResurrectRevivePlayer, false);

    TriggerAddEventPlayerEffectUsed(libHAUR_gt_HeroAurielResurrectRevivePlayer, c_playerAny, "AurielResurrectInitialDummy");

    TriggerAddEventPlayerEffectUsed(libHAUR_gt_HeroAurielResurrectRevivePlayer, c_playerAny, "AurielResurrectSelfDummy");

}



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

// Trigger: Hero - Auriel - Resurrect - Player Respawns

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

bool libHAUR_gt_HeroAurielResurrectPlayerRespawns_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_iPlayer;



    // Automatic Variable Declarations

    const int auto39C4077E_ae = libCore_gv_bALMaxPlayers;

    const int auto39C4077E_ai = 1;



    // Variable Initialization

    lv_iPlayer = 1;



    // Conditions

    if (testConds) {

        if (!((libGame_gv_gameOver == false))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_iPlayer = 1;

    for ( ; ( (auto39C4077E_ai >= 0 && lv_iPlayer <= auto39C4077E_ae) || (auto39C4077E_ai < 0 && lv_iPlayer >= auto39C4077E_ae) ) ; lv_iPlayer += auto39C4077E_ai ) {

        if ((EventTimer() == libGame_gv_players[lv_iPlayer].lv_respawnTimer) && (libHAUR_gv_heroAurielResurrectSpirit[lv_iPlayer] != null)) {

            UnitRemove(libHAUR_gv_heroAurielResurrectSpirit[lv_iPlayer]);

            DialogDestroy(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_iPlayer]);

            libHAUR_gv_heroAurielResurrectShowSpiritTimer[lv_iPlayer] = false;

            libHAUR_gf_HeroAurielResurrectCheckActiveSpirits(false);

            TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_iPlayer][0]);

            TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_iPlayer][1]);

            TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_iPlayer][2]);

            TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_iPlayer][3]);

            TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_iPlayer][0]);

            TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_iPlayer][1]);

            TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_iPlayer][2]);

            TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_iPlayer][3]);

        }



    }

    return true;

}



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

void libHAUR_gt_HeroAurielResurrectPlayerRespawns_Init () {

    libHAUR_gt_HeroAurielResurrectPlayerRespawns = TriggerCreate("libHAUR_gt_HeroAurielResurrectPlayerRespawns_Func");

    TriggerEnable(libHAUR_gt_HeroAurielResurrectPlayerRespawns, false);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectPlayerRespawns, libGame_gv_players[1].lv_respawnTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectPlayerRespawns, libGame_gv_players[2].lv_respawnTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectPlayerRespawns, libGame_gv_players[3].lv_respawnTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectPlayerRespawns, libGame_gv_players[4].lv_respawnTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectPlayerRespawns, libGame_gv_players[5].lv_respawnTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectPlayerRespawns, libGame_gv_players[6].lv_respawnTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectPlayerRespawns, libGame_gv_players[7].lv_respawnTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectPlayerRespawns, libGame_gv_players[8].lv_respawnTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectPlayerRespawns, libGame_gv_players[9].lv_respawnTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectPlayerRespawns, libGame_gv_players[10].lv_respawnTimer);

}



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

// Trigger: Hero - Auriel - Resurrect - Lost Viking Respawns

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

bool libHAUR_gt_HeroAurielResurrectLostVikingRespawns_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_iPlayer;



    // Automatic Variable Declarations

    const int auto1DB0779E_ae = libCore_gv_bALMaxPlayers;

    const int auto1DB0779E_ai = 1;

    timer autoE60BF628_val;



    // Variable Initialization

    lv_iPlayer = 1;



    // Conditions

    if (testConds) {

        if (!((libGame_gv_gameOver == false))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_iPlayer = 1;

    for ( ; ( (auto1DB0779E_ai >= 0 && lv_iPlayer <= auto1DB0779E_ae) || (auto1DB0779E_ai < 0 && lv_iPlayer >= auto1DB0779E_ae) ) ; lv_iPlayer += auto1DB0779E_ai ) {

        autoE60BF628_val = EventTimer();

        if (autoE60BF628_val == libGDHL_gv_lostVikingsPlayer[lv_iPlayer].lv_baleogDeathTimer) {

            UnitRemove(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_iPlayer][1].lv_spiritUnit);

            libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_iPlayer][1].lv_spiritUnit = null;

            DialogDestroy(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_iPlayer]);

            break;

        }

        else if (autoE60BF628_val == libGDHL_gv_lostVikingsPlayer[lv_iPlayer].lv_erikDeathTimer) {

            UnitRemove(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_iPlayer][2].lv_spiritUnit);

            libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_iPlayer][2].lv_spiritUnit = null;

            DialogDestroy(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_iPlayer]);

            break;

        }

        else if (autoE60BF628_val == libGDHL_gv_lostVikingsPlayer[lv_iPlayer].lv_olafDeathTimer) {

            UnitRemove(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_iPlayer][3].lv_spiritUnit);

            libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_iPlayer][3].lv_spiritUnit = null;

            DialogDestroy(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_iPlayer]);

            break;

        }

        else {

        }

    }

    if ((libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_iPlayer][1].lv_spiritUnit == null) && (libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_iPlayer][2].lv_spiritUnit == null) && (libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_iPlayer][3].lv_spiritUnit == null)) {

        libHAUR_gv_heroAurielResurrectShowSpiritTimer[lv_iPlayer] = false;

    }



    libHAUR_gf_HeroAurielResurrectCheckActiveSpirits(false);

    return true;

}



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

void libHAUR_gt_HeroAurielResurrectLostVikingRespawns_Init () {

    libHAUR_gt_HeroAurielResurrectLostVikingRespawns = TriggerCreate("libHAUR_gt_HeroAurielResurrectLostVikingRespawns_Func");

    TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, false);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[1].lv_erikDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[1].lv_baleogDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[1].lv_olafDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[2].lv_erikDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[2].lv_baleogDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[2].lv_olafDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[3].lv_erikDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[3].lv_baleogDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[3].lv_olafDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[4].lv_erikDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[4].lv_baleogDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[4].lv_olafDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[5].lv_erikDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[5].lv_baleogDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[5].lv_olafDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[6].lv_erikDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[6].lv_baleogDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[6].lv_olafDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[7].lv_erikDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[7].lv_baleogDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[7].lv_olafDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[8].lv_erikDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[8].lv_baleogDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[8].lv_olafDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[9].lv_erikDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[9].lv_baleogDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[9].lv_olafDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[10].lv_erikDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[10].lv_baleogDeathTimer);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectLostVikingRespawns, libGDHL_gv_lostVikingsPlayer[10].lv_olafDeathTimer);

}



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

// Trigger: Hero - Auriel - Resurrect - Lost Vikings Play Again Complete

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

bool libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainComplete_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_lVPlayer;

    int lv_itViking;



    // Automatic Variable Declarations

    const int auto51E10A0D_ae = 3;

    const int auto51E10A0D_ai = 1;



    // Variable Initialization

    lv_lVPlayer = EventPlayerEffectUsedUnitOwner(c_effectPlayerCaster);



    // Actions

    if (!runActions) {

        return true;

    }



    DialogDestroy(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_lVPlayer]);

    libHAUR_gv_heroAurielResurrectShowSpiritTimer[lv_lVPlayer] = false;

    TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_lVPlayer][0]);

    TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_lVPlayer][1]);

    TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_lVPlayer][2]);

    TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_lVPlayer][3]);

    TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_lVPlayer][0]);

    TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_lVPlayer][1]);

    TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_lVPlayer][2]);

    TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_lVPlayer][3]);

    lv_itViking = 1;

    for ( ; ( (auto51E10A0D_ai >= 0 && lv_itViking <= auto51E10A0D_ae) || (auto51E10A0D_ai < 0 && lv_itViking >= auto51E10A0D_ae) ) ; lv_itViking += auto51E10A0D_ai ) {

        if ((UnitIsValid(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_lVPlayer][lv_itViking].lv_spiritUnit) == true) && (UnitBehaviorCount(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_lVPlayer][lv_itViking].lv_vikingUnit, "LostVikingsPlayAgainSuppressResurrection") == 0)) {

            UnitRemove(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_lVPlayer][lv_itViking].lv_spiritUnit);

            UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_lVPlayer][lv_itViking].lv_spiritUnit, "AurielResurrectNotRezzable", libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_lVPlayer][lv_itViking].lv_spiritUnit, 1);

            libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_lVPlayer][lv_itViking].lv_spiritUnit = null;

            libHAUR_gf_HeroAurielResurrectCheckActiveSpirits(false);

        }



    }

    return true;

}



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

void libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainComplete_Init () {

    libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainComplete = TriggerCreate("libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainComplete_Func");

    TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainComplete, false);

    TriggerAddEventPlayerEffectUsed(libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainComplete, c_playerAny, "LostVikingsPlayAgainFinalSet");

}



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

// Trigger: Hero - Auriel - Resurrect - Lost Vikings Play Again Start

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

bool libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainStart_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_i;

    unit lv_caster;

    int lv_lVPlayer;



    // Automatic Variable Declarations

    const int auto1618AADE_ae = 3;

    const int auto1618AADE_ai = 1;

    const int auto77871593_ae = 3;

    const int auto77871593_ai = 1;



    // Variable Initialization

    lv_caster = EventUnit();

    lv_lVPlayer = UnitGetOwner(EventUnit());



    // Conditions

    if (testConds) {

        if (!((UnitGetOwner(lv_caster) >= 1))) {

            return false;

        }



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

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    lv_i = 1;

    for ( ; ( (auto1618AADE_ai >= 0 && lv_i <= auto1618AADE_ae) || (auto1618AADE_ai < 0 && lv_i >= auto1618AADE_ae) ) ; lv_i += auto1618AADE_ai ) {

        if ((UnitIsValid(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_lVPlayer][lv_i].lv_spiritUnit) == true)) {

            UnitBehaviorAdd(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_lVPlayer][lv_i].lv_spiritUnit, "AurielResurrectNotRezzable", libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_lVPlayer][lv_i].lv_spiritUnit, 1);

        }



    }

    while ((UnitBehaviorCount(lv_caster, "LostVikingsPlayAgainActivelyCasting") == 1)) {

        Wait(0.0625, c_timeGame);

    }

    lv_i = 1;

    for ( ; ( (auto77871593_ai >= 0 && lv_i <= auto77871593_ae) || (auto77871593_ai < 0 && lv_i >= auto77871593_ae) ) ; lv_i += auto77871593_ai ) {

        if ((UnitIsValid(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_lVPlayer][lv_i].lv_spiritUnit) == true)) {

            UnitBehaviorRemove(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_lVPlayer][lv_i].lv_spiritUnit, "AurielResurrectNotRezzable", 1);

        }



    }

    return true;

}



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

void libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainStart_Init () {

    libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainStart = TriggerCreate("libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainStart_Func");

    TriggerEnable(libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainStart, false);

    TriggerAddEventUnitAbility(libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainStart, null, AbilityCommand("LostVikingsPlayAgain", 0), c_abilEffectStagePrep, false);

}



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

// Trigger: Hero - Auriel - Resurrect - Notify Target Player Revive Start

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

bool libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveStart_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_auriel;

    int lv_aurielPlayer;

    unit lv_target;

    int lv_targetPlayer;

    point lv_targetPoint;

    unit lv_spiritUnit;

    int lv_additionalPlayer;

    int lv_iPlayer;

    int lv_itViking;



    // Automatic Variable Declarations

    int auto223356F4_ae;

    const int auto734F05FC_ae = libCore_gv_bALMaxPlayers;

    const int auto734F05FC_ai = 1;



    // Variable Initialization

    lv_iPlayer = 1;

    lv_itViking = 1;



    // Conditions

    if (testConds) {

        if (!((UnitIsValid(EventPlayerEffectUsedUnit(c_effectUnitTarget)) == true))) {

            return false;

        }

    }



    // Actions

    if (!runActions) {

        return true;

    }



    TriggerEnable(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterrupted, true);

    lv_auriel = EventPlayerEffectUsedUnit(c_effectUnitCaster);

    lv_target = EventPlayerEffectUsedUnit(c_effectUnitTarget);

    lv_aurielPlayer = UnitGetOwner(lv_auriel);

    lv_targetPlayer = UnitGetOwner(lv_target);

    lv_targetPoint = UnitGetPosition(lv_target);

    CameraPan(lv_targetPlayer, lv_targetPoint, 1.0, -1, 10.0, false);

    UnitBehaviorAdd(libGame_gv_players[lv_targetPlayer].lv_heroUnit, "AurielResurrectPendingResurrect", lv_auriel, 1);

    DialogDestroy(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_targetPlayer]);

    DialogCreate(1920, 150, c_anchorCenter, 0, 0, true);

    libHAUR_gv_heroAurielResurrectRevivingDialog[lv_targetPlayer] = DialogLastCreated();

    DialogSetImageVisible(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_targetPlayer], false);

    DialogSetVisible(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_targetPlayer], PlayerGroupSingle(lv_targetPlayer), true);

    DialogControlCreateFromTemplate(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_targetPlayer], c_triggerControlTypeLabel, "Auriel/AurielResurrectionNotificationTemplate");

    TextExpressionSetToken("Param/Expression/lib_HAUR_7D4E4562", "AurielUnit", libHAUR_gf_AurielUIUnitDisplayName(lv_auriel));

    libNtve_gf_SetDialogItemText(DialogControlLastCreated(), TextExpressionAssemble("Param/Expression/lib_HAUR_7D4E4562"), PlayerGroupAll());

    if ((UnitGetType(libGame_gv_players[lv_targetPlayer].lv_heroUnit) == "HeroLostVikingsController")) {

        auto223356F4_ae = 3;

        lv_itViking = 1;

        for ( ; lv_itViking <= auto223356F4_ae ; lv_itViking += 1 ) {

            if ((lv_target == libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_targetPlayer][lv_itViking].lv_spiritUnit)) {

                lv_spiritUnit = libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_targetPlayer][lv_itViking].lv_spiritUnit;

            }



        }

    }

    else {

        lv_spiritUnit = libHAUR_gv_heroAurielResurrectSpirit[lv_targetPlayer];

    }

    lv_iPlayer = 1;

    for ( ; ( (auto734F05FC_ai >= 0 && lv_iPlayer <= auto734F05FC_ae) || (auto734F05FC_ai < 0 && lv_iPlayer >= auto734F05FC_ae) ) ; lv_iPlayer += auto734F05FC_ai ) {

        if (((lv_iPlayer != lv_aurielPlayer) && (lv_iPlayer != lv_targetPlayer))) {

            ActorSend(libNtve_gf_MainActorofUnit(lv_spiritUnit), libNtve_gf_Signal(("Auriel" + IntToString(lv_iPlayer))));

        }



    }

    ActorSend(libNtve_gf_MainActorofUnit(lv_spiritUnit), libNtve_gf_Signal("Cheer"));

    TimerPause(libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[lv_targetPlayer], true);

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

        lv_additionalPlayer = libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(lv_targetPlayer)].lv_gallPlayer;

        DialogDestroy(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_additionalPlayer]);

        CameraPan(lv_additionalPlayer, lv_targetPoint, 1.0, -1, 10.0, false);

        DialogSetVisible(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_targetPlayer], PlayerGroupSingle(lv_additionalPlayer), true);

        ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_targetPlayer]), libNtve_gf_Signal(("Auriel" + IntToString(lv_additionalPlayer))));

        TimerPause(libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[lv_additionalPlayer], true);

    }



    if ((UnitHasBehavior2(libGame_gv_players[lv_targetPlayer].lv_heroUnit, "LeoricUndying") == true)) {

        UnitBehaviorAdd(libGame_gv_players[lv_targetPlayer].lv_heroUnit, "AurielResurrectMobileSpiritRoot", lv_auriel, 1);

    }



    return true;

}



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

void libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveStart_Init () {

    libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveStart = TriggerCreate("libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveStart_Func");

    TriggerEnable(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveStart, false);

    TriggerAddEventPlayerEffectUsed(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveStart, c_playerAny, "AurielResurrectPrepareSet");

}



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

// Trigger: Hero - Auriel - Resurrect - Notify Target Player Revive Interrupted

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

bool libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterrupted_Func (bool testConds, bool runActions) {

    // Variable Declarations

    unit lv_auriel;

    int lv_aurielPlayer;

    unit lv_target;

    int lv_targetPlayer;

    point lv_targetPoint;

    int lv_additionalPlayer;

    unit lv_spiritUnit;

    int lv_iPlayer;

    int lv_itViking;



    // Automatic Variable Declarations

    int auto02F993A8_ae;

    const int auto641F5BCE_ae = libCore_gv_bALMaxPlayers;

    const int auto641F5BCE_ai = 1;



    // Variable Initialization

    lv_iPlayer = 1;

    lv_itViking = 1;



    // Actions

    if (!runActions) {

        return true;

    }



    lv_auriel = EventUnit();

    lv_target = EventUnitTargetUnit();

    lv_aurielPlayer = UnitGetOwner(lv_auriel);

    lv_targetPlayer = UnitGetOwner(lv_target);

    lv_targetPoint = UnitGetPosition(lv_target);

    if ((UnitGetType(libGame_gv_players[lv_targetPlayer].lv_heroUnit) == "HeroLostVikingsController")) {

        auto02F993A8_ae = 3;

        lv_itViking = 1;

        for ( ; lv_itViking <= auto02F993A8_ae ; lv_itViking += 1 ) {

            if ((lv_target == libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_targetPlayer][lv_itViking].lv_spiritUnit)) {

                lv_spiritUnit = libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_targetPlayer][lv_itViking].lv_spiritUnit;

            }



        }

    }

    else {

        lv_spiritUnit = libHAUR_gv_heroAurielResurrectSpirit[lv_targetPlayer];

    }

    lv_iPlayer = 1;

    for ( ; ( (auto641F5BCE_ai >= 0 && lv_iPlayer <= auto641F5BCE_ae) || (auto641F5BCE_ai < 0 && lv_iPlayer >= auto641F5BCE_ae) ) ; lv_iPlayer += auto641F5BCE_ai ) {

        if ((lv_iPlayer != lv_aurielPlayer) && (lv_iPlayer != lv_targetPlayer)) {

            ActorSend(libNtve_gf_MainActorofUnit(lv_spiritUnit), libNtve_gf_Signal(("Auriel" + IntToString(lv_iPlayer))));

        }



    }

    CameraPan(lv_targetPlayer, lv_targetPoint, 1.0, -1, 10.0, false);

    DialogDestroy(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_targetPlayer]);

    DialogCreate(1920, 150, c_anchorCenter, 0, 0, true);

    libHAUR_gv_heroAurielResurrectRevivingDialog[lv_targetPlayer] = DialogLastCreated();

    DialogSetImageVisible(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_targetPlayer], false);

    DialogSetVisible(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_targetPlayer], PlayerGroupSingle(lv_targetPlayer), true);

    DialogControlCreateFromTemplate(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_targetPlayer], c_triggerControlTypeLabel, "Auriel/AurielResurrectionNotificationTemplate");

    libNtve_gf_SetDialogItemText(DialogControlLastCreated(), StringExternal("Param/Value/lib_HAUR_ECD463CB"), PlayerGroupAll());

    TimerStart(libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[lv_targetPlayer], 2.0, false, c_timeGame);

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

        lv_additionalPlayer = libGDHL_gv_chogallPairs[libGame_gf_TeamNumberOfPlayer(lv_targetPlayer)].lv_gallPlayer;

        ActorSend(libNtve_gf_MainActorofUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_targetPlayer]), libNtve_gf_Signal(("Auriel" + IntToString(lv_additionalPlayer))));

        CameraPan(lv_additionalPlayer, lv_targetPoint, 1.0, -1, 10.0, false);

        DialogSetVisible(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_targetPlayer], PlayerGroupSingle(lv_additionalPlayer), true);

        TimerStart(libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[lv_additionalPlayer], 2.0, false, c_timeGame);

    }



    UnitBehaviorRemove(libHAUR_gv_heroAurielResurrectSpirit[lv_targetPlayer], "AurielResurrectMarkerBehavior", 1);

    if ((UnitHasBehavior2(libGame_gv_players[lv_targetPlayer].lv_heroUnit, "LeoricUndying") == true)) {

        UnitBehaviorRemove(libGame_gv_players[lv_targetPlayer].lv_heroUnit, "AurielResurrectMobileSpiritRoot", 1);

    }



    UnitBehaviorRemove(libGame_gv_players[lv_targetPlayer].lv_heroUnit, "AurielResurrectPendingResurrect", 1);

    TriggerEnable(TriggerGetCurrent(), false);

    return true;

}



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

void libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterrupted_Init () {

    libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterrupted = TriggerCreate("libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterrupted_Func");

    TriggerEnable(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterrupted, false);

    TriggerAddEventUnitAbility(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterrupted, null, AbilityCommand("AurielResurrect", 0), c_unitAbilStageCancel, false);

}



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

// Trigger: Hero - Auriel - Resurrect - Notify Target Player Revive Interrupted Timer Expired

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

bool libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_itPlayer;



    // Automatic Variable Declarations

    const int auto361A27A8_ae = libCore_gv_bALMaxPlayers;

    const int auto361A27A8_ai = 1;



    // Variable Initialization



    // Actions

    if (!runActions) {

        return true;

    }



    lv_itPlayer = 1;

    for ( ; ( (auto361A27A8_ai >= 0 && lv_itPlayer <= auto361A27A8_ae) || (auto361A27A8_ai < 0 && lv_itPlayer >= auto361A27A8_ae) ) ; lv_itPlayer += auto361A27A8_ai ) {

        if ((libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[lv_itPlayer] == EventTimer())) {

            DialogDestroy(libHAUR_gv_heroAurielResurrectRevivingDialog[lv_itPlayer]);

        }



    }

    return true;

}



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

void libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired_Init () {

    libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired = TriggerCreate("libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired_Func");

    TriggerEnable(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired, false);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired, libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[1]);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired, libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[2]);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired, libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[3]);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired, libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[4]);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired, libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[5]);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired, libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[6]);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired, libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[7]);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired, libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[8]);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired, libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[9]);

    TriggerAddEventTimer(libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired, libHAUR_gv_heroAurielResurrectNotifyTargetPlayerReviveInterruptedTimer[10]);

}



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

// Trigger: Hero - Auriel - Resurrect - Spirit Timer Controller

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

bool libHAUR_gt_HeroAurielResurrectSpiritTimerController_Func (bool testConds, bool runActions) {

    // Variable Declarations

    int lv_aurielPlayer;

    int lv_deadPlayer;

    int lv_deadPlayerTeam;



    // Automatic Variable Declarations

    const int autoF062E6D8_ae = libCore_gv_bALMaxPlayers;

    const int autoF062E6D8_ai = 1;

    const int autoD32A93E3_ae = libCore_gv_bALMaxPlayers;

    const int autoD32A93E3_ai = 1;

    string auto1A136385_val;



    // Variable Initialization

    lv_deadPlayer = 1;



    // Actions

    if (!runActions) {

        return true;

    }



    lv_deadPlayer = 1;

    for ( ; ( (autoF062E6D8_ai >= 0 && lv_deadPlayer <= autoF062E6D8_ae) || (autoF062E6D8_ai < 0 && lv_deadPlayer >= autoF062E6D8_ae) ) ; lv_deadPlayer += autoF062E6D8_ai ) {

        if (((TimerGetRemaining(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) != 0.0) || (TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_erikDeathTimer) != 0.0) || (TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_baleogDeathTimer) != 0.0) || (TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_olafDeathTimer) != 0.0))) {

            lv_deadPlayerTeam = libGame_gf_TeamNumberOfPlayer(lv_deadPlayer);

            lv_aurielPlayer = 1;

            for ( ; ( (autoD32A93E3_ai >= 0 && lv_aurielPlayer <= autoD32A93E3_ae) || (autoD32A93E3_ai < 0 && lv_aurielPlayer >= autoD32A93E3_ae) ) ; lv_aurielPlayer += autoD32A93E3_ai ) {

                if ((UnitGetType(libGame_gv_players[lv_aurielPlayer].lv_heroUnit) == "HeroAuriel") && (libGame_gf_TeamNumberOfPlayer(lv_deadPlayer) == libGame_gf_TeamNumberOfPlayer(lv_aurielPlayer)) && (libHAUR_gv_heroAurielResurrectShowSpiritTimer[lv_deadPlayer] == true) && (UnitBehaviorCount(libGame_gv_players[lv_aurielPlayer].lv_heroUnit, "Ultimate1Unlocked") > 0)) {

                    TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_deadPlayer][0]);

                    TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_deadPlayer][1]);

                    TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_deadPlayer][2]);

                    TextTagDestroy(libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_deadPlayer][3]);

                    TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_deadPlayer][0]);

                    TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_deadPlayer][1]);

                    TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_deadPlayer][2]);

                    TextTagDestroy(libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_deadPlayer][3]);

                    auto1A136385_val = UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit);

                    if (auto1A136385_val == "HeroGall") {

                        if ((TimerGetRemaining(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) > libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime)) {

                            libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_deadPlayer][0] = libHAUR_gf_HeroAurielResurrectCreateDeadPlayerSpiritTimer(lv_aurielPlayer, lv_deadPlayer, 0);

                        }



                    }

                    else if (auto1A136385_val == "HeroLostVikingsController") {

                        if ((TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_baleogDeathTimer) > libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime) && (libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][1].lv_spiritUnit != null)) {

                            TextTagCreate(FixedToText(TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_baleogDeathTimer), 0), 36, UnitGetPosition(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][1].lv_spiritUnit), 4.0, true, false, PlayerGroupSingle(lv_aurielPlayer));

                            libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_deadPlayer][1] = TextTagLastCreated();

                            libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_deadPlayer][1] = libHAUR_gf_HeroAurielResurrectCreateDeadPlayerSpiritTimer(lv_aurielPlayer, lv_deadPlayer, 1);

                        }



                        if ((TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_erikDeathTimer) > libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime) && (libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][2].lv_spiritUnit != null)) {

                            TextTagCreate(FixedToText(TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_erikDeathTimer), 0), 36, UnitGetPosition(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][2].lv_spiritUnit), 4.0, true, false, PlayerGroupSingle(lv_aurielPlayer));

                            libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_deadPlayer][2] = TextTagLastCreated();

                            libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_deadPlayer][2] = libHAUR_gf_HeroAurielResurrectCreateDeadPlayerSpiritTimer(lv_aurielPlayer, lv_deadPlayer, 2);

                        }



                        if ((TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_olafDeathTimer) > libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime) && (libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][3].lv_spiritUnit != null)) {

                            TextTagCreate(FixedToText(TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_olafDeathTimer), 0), 36, UnitGetPosition(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][3].lv_spiritUnit), 4.0, true, false, PlayerGroupSingle(lv_aurielPlayer));

                            libHAUR_gv_heroAurielResurrectAurielSpiritTimerTextTag[lv_deadPlayer][3] = TextTagLastCreated();

                            libHAUR_gv_heroAurielResurrectDeadPlayerSpiritTimerTextTag[lv_deadPlayer][3] = libHAUR_gf_HeroAurielResurrectCreateDeadPlayerSpiritTimer(lv_aurielPlayer, lv_deadPlayer, 3);

                        }



                    }

                    else {

                        if ((TimerGetRemaining(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) > libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime)) {

                        }



                    }

                    if ((TimerGetRemaining(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) > 4.0) && (TimerGetRemaining(libGame_gv_players[lv_deadPlayer].lv_respawnTimer) < libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime) && (UnitBehaviorCount(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "AurielResurrectActivelyResurrecting") == 0)) {

                        if (((UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit) == "HeroLeoric") || ((UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit) == "HeroMurky") && (UnitIsAlive(libGame_gv_heroDeathMurkyRespawnEggs[lv_deadPlayer]) == true)))) {

                        }

                        else {

                            libNtve_gf_SendActorMessageToUnit(libHAUR_gv_heroAurielResurrectSpirit[lv_deadPlayer], "Signal Fade");

                        }

                    }



                    if ((UnitGetType(libGame_gv_players[lv_deadPlayer].lv_heroUnit) == "HeroLostVikingsController")) {

                        if ((TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_baleogDeathTimer) > 4.0) && (TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_baleogDeathTimer) < libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime)) {

                            libNtve_gf_SendActorMessageToUnit(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][1].lv_spiritUnit, "Signal Fade");

                        }



                        if ((TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_erikDeathTimer) > 4.0) && (TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_erikDeathTimer) < libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime)) {

                            libNtve_gf_SendActorMessageToUnit(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][2].lv_spiritUnit, "Signal Fade");

                        }



                        if ((TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_olafDeathTimer) > 4.0) && (TimerGetRemaining(libGDHL_gv_lostVikingsPlayer[lv_deadPlayer].lv_olafDeathTimer) < libHAUR_gv_heroAurielResurrectTargetUnresurrectableTime)) {

                            libNtve_gf_SendActorMessageToUnit(libHAUR_gv_heroAurielResurrectLostVikingsArray[lv_deadPlayer][3].lv_spiritUnit, "Signal Fade");

                        }



                    }



                }



            }

        }



    }

    return true;

}



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

void libHAUR_gt_HeroAurielResurrectSpiritTimerController_Init () {

    libHAUR_gt_HeroAurielResurrectSpiritTimerController = TriggerCreate("libHAUR_gt_HeroAurielResurrectSpiritTimerController_Func");

    TriggerEnable(libHAUR_gt_HeroAurielResurrectSpiritTimerController, false);

    TriggerAddEventTimePeriodic(libHAUR_gt_HeroAurielResurrectSpiritTimerController, 0.5, c_timeGame);

}



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

// Trigger: Hero - Auriel - Resurrect - End of Game Hide Reviving Dialog

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

bool libHAUR_gt_HeroAurielResurrectEndofGameHideRevivingDialog_Func (bool testConds, bool runActions) {

    // Automatic Variable Declarations

    const int auto00066AEF_ae = libCore_gv_bALMaxPlayers;

    int auto00066AEF_var;



    // Actions

    if (!runActions) {

        return true;

    }



    auto00066AEF_var = 1;

    for ( ; auto00066AEF_var <= auto00066AEF_ae; auto00066AEF_var += 1 ) {

        if ((libHAUR_gv_heroAurielResurrectRevivingDialog[auto00066AEF_var] != c_invalidDialogId)) {

            DialogDestroy(libHAUR_gv_heroAurielResurrectRevivingDialog[auto00066AEF_var]);

        }



    }

    return true;

}



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

void libHAUR_gt_HeroAurielResurrectEndofGameHideRevivingDialog_Init () {

    libHAUR_gt_HeroAurielResurrectEndofGameHideRevivingDialog = TriggerCreate("libHAUR_gt_HeroAurielResurrectEndofGameHideRevivingDialog_Func");

    TriggerEnable(libHAUR_gt_HeroAurielResurrectEndofGameHideRevivingDialog, false);

    libGame_gf_GameOverEvent(libHAUR_gt_HeroAurielResurrectEndofGameHideRevivingDialog);

}



void libHAUR_InitTriggers () {

    libHAUR_gt_AurielUIInitialize_Init();

    libHAUR_gt_HeroAurielShieldofHopeSetShieldStrength_Init();

    libHAUR_gt_HeroAurielBestowHopeBestowHopeCast_Init();

    libHAUR_gt_HeroAurielBestowHopeSetProxy_Init();

    libHAUR_gt_HeroAurielBestowHopeRemoveProxy_Init();

    libHAUR_gt_HeroAurielBestowHopeToggleBestowHopeProxyDamageDealtTrigger_Init();

    libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageDealt_Init();

    libHAUR_gt_HeroAurielBestowHopeHealingStoredFromProxyDamageTaken_Init();

    libHAUR_gt_HeroAurielBestowHopeProxyUnitSwapped_Init();

    libHAUR_gt_HeroAurielRayofHeavenAbilityUsed_Init();

    libHAUR_gt_HeroAurielCrystalAegisOverlayController_Init();

    libHAUR_gt_HeroAurielResurrectPlayerUnlocksResurrect_Init();

    libHAUR_gt_HeroAurielResurrectPlayerRespecs_Init();

    libHAUR_gt_HeroAurielResurrectCreateSpirit_Init();

    libHAUR_gt_HeroAurielResurrectMurkyEggDeathSpiritReveal_Init();

    libHAUR_gt_HeroAurielResurrectLeoricSpiritFollow_Init();

    libHAUR_gt_HeroAurielResurrectRevivePlayer_Init();

    libHAUR_gt_HeroAurielResurrectPlayerRespawns_Init();

    libHAUR_gt_HeroAurielResurrectLostVikingRespawns_Init();

    libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainComplete_Init();

    libHAUR_gt_HeroAurielResurrectLostVikingsPlayAgainStart_Init();

    libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveStart_Init();

    libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterrupted_Init();

    libHAUR_gt_HeroAurielResurrectNotifyTargetPlayerReviveInterruptedTimerExpired_Init();

    libHAUR_gt_HeroAurielResurrectSpiritTimerController_Init();

    libHAUR_gt_HeroAurielResurrectEndofGameHideRevivingDialog_Init();

}



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

// Library Initialization

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

bool libHAUR_InitLib_completed = false;



void libHAUR_InitLib () {

    if (libHAUR_InitLib_completed) {

        return;

    }



    libHAUR_InitLib_completed = true;



    libHAUR_InitLibraries();

    libHAUR_InitVariables();

    libHAUR_InitTriggers();

}