//==========================================================================================
//
//  Berghof Assault (Alpha 3) - berghof_assault.gm
//
//  Who         When                What
//------------------------------------------------------------------------------------------
//  Mateos      15 December 2016    Initial Script
//
//==========================================================================================
//

global Map =
{
    Main_Entrance_Destroyed = function()
    {
        Util.EnableGoal( "CAMP_Bravo.*" );

        SetAvailableMapGoals( TEAM.ALLIES, true, {
            "PLANT_Radar_Controls",
        });

        Util.MapDebugPrint( "Main_Entrance_Destroyed" );
    },

    Radar_Controls_Destroyed = function()
    {
        Util.MapDebugPrint( "Radar_Controls_Destroyed" );
    },

    Rock_Destroyed = function()
    {
        Util.EnableGoal( "CAMP_Bravo.*" );

        SetAvailableMapGoals( TEAM.ALLIES, true, {
            "PLANT_Radar_Controls",
        });

        Util.MapDebugPrint( "Rock_Destroyed" );
    },

    Side_Breach_Destroyed = function()
    {
        Util.EnableGoal( "CAMP_Bravo.*" );

        SetAvailableMapGoals( TEAM.ALLIES, true, {
            "PLANT_Radar_Controls",
        });

        Util.MapDebugPrint( "Side_Breach_Destroyed" );
    },
};

global OnMapLoad = function()
{
    // *** TRIGGERS ***
    // The announcements are trimmed to 71 chars, the maximum supported by Omni-Bot
    OnTrigger( "Allies have breached the Main Entrance!", Map.Main_Entrance_Destroyed );
    OnTrigger( "MISSING_STRING", Map.Radar_Controls_Destroyed );
    OnTrigger( "Allies have destroyed the rock! The tree can now be used to get inside!", Map.Rock_Destroyed );
    OnTrigger( "Allies have breached the Side Breach!", Map.Side_Breach_Destroyed );

    // *** CLEAR ALL GOALS FOR BOTH TEAMS ***
    Util.DisableGoal( ".*"/*, true*/ ); // All but Routes

    // *** AXIS GOALS ***
    SetAvailableMapGoals( TEAM.AXIS, true, {
        "DEFEND_Alpha.*",
        "MOUNTMG42_BunkerMG42",
        "REPAIRMG42_BunkerMG42",
    });

    // *** ALLIED GOALS ***
    SetAvailableMapGoals( TEAM.ALLIES, true, {
        "ATTACK_Alpha.*",
        "PLANT_Main_Entrance",
        "PLANT_Rock",
        "PLANT_Side_Breach",
    });

    // *** GOALS PROPERTIES ***

    // Priorities
    SetGoalPriority( "CAMP_Bravo.*", 0.51 );

    // Camp times
    SetMapGoalProperties( "ATTACK.*",       { mincamptime = 60, maxcamptime = 120 } );
    SetMapGoalProperties( "DEFEND_.*",      { mincamptime = 60, maxcamptime = 120 } );
    SetMapGoalProperties( "MOUNTMG42_.*",   { mincamptime = 60, maxcamptime = 120 } );

    // Use points
    Util.AddUsePoint( "PLANT_Rock",         Vec3(  1480, 715, 1590 ) );
    Util.AddUsePoint( "PLANT_Side_Breach",  Vec3( -1050, 525, 1290 ) );

    Util.MapDebugPrint( "Omni-bot 0.8x map script for Berghof Assault (Alpha 3) by Mateos" );
};

global OnBotJoin = function( bot )
{
    bot.MaxViewDistance = 2000;
};

