//==========================================================================================
//
//	monastery.gm
//
//	Who              	When		What
//------------------------------------------------------------------------------------------
//	^4W^1olf ^4E^1nstein	18 September 2019	Initial Script
//
//==========================================================================================
//

global Map =
{
	Debug = 1, // please set to zero before distributing your script

	Allied_Assault_Ladders_Built = function( trigger )
	{
	
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_ladders_1" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_ladders_2" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_ladders_3" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_ladders_4" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "CHECKPOINT_courtyard_flag" );
	SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_meadow_1" );
	SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_meadow_2" );
	SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_meadow_3" );
	SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_meadow_4" );
	SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_meadow_5" );
	SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_meadow_6" );
	SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_monastery_1" );
	SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_monastery_2" );
		
		Util.MapDebugPrint( "Allied_Assault_Ladders_Built" );
	},

	Allied_Assault_Ramp_Built = function( trigger )
	{
	
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_ramp_1" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_ramp_2" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_ramp_3" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_ramp_4" );
		
		Util.MapDebugPrint( "Allied_Assault_Ramp_Built" );
	},

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

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

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

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

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

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

	map_Taken = function( trigger )
	{
	
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_monastery_1" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_monastery_2" );
		
		Util.MapDebugPrint( "map_Taken" );
	},

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

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

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

	courtyard_flag_Allies_Captured = function( trigger )
	{
	
	SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Command_Post" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_map" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_monastery_1" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_monastery_2" );
	SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT_meadow_flag" );
	SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Allied_Assault_Ladders" );
		
		Util.MapDebugPrint( "courtyard_flag_Allies_Captured" );
	},

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

	meadow_flag_Allies_Captured = function( trigger )
	{
	
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_ladders_1" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_ladders_2" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_ladders_3" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_ladders_4" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_Assault_Ladders" );
	SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Allied_Assault_Ramp" );
		
		Util.MapDebugPrint( "meadow_flag_Allies_Captured" );
	},

};

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "The Allied Assault Ladders has been constructed.", Map.Allied_Assault_Ladders_Built );
	OnTrigger( "The Allied Assault Ramp has been constructed.", Map.Allied_Assault_Ramp_Built );
	OnTrigger( "The Axis Church Door has been constructed.", Map.Axis_Church_Door_Built );
	OnTrigger( "MISSING_STRING", Map.Command_Post_Built );
	OnTrigger( "The Allied Assault Ladders has been DESTROYED!", Map.Allied_Assault_Ladders_Destroyed );
	OnTrigger( "The Allied Assault Ramp has been DESTROYED!", Map.Allied_Assault_Ramp_Destroyed );
	OnTrigger( "The Axis Church Door has been DESTROYED!", Map.Axis_Church_Door_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Command_Post_Destroyed );
	OnTrigger( "Allies have stolen the secret Map!", Map.map_Taken );
	OnTrigger( "Axis have returned the secret Map!", Map.map_Returned );
	OnTrigger( "Allies has secured the Secret Map", Map.map_Secured );
	OnTrigger( "Axis captured the Courtyard!", Map.courtyard_flag_Axis_Captured );
	OnTrigger( "Allies captured the Courtyard!", Map.courtyard_flag_Allies_Captured );
	OnTrigger( "Axis captured the Meadow!", Map.meadow_flag_Axis_Captured );
	OnTrigger( "Allies captured the Meadow!", Map.meadow_flag_Allies_Captured );
	
	SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_map" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_ladders_1" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_ladders_2" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_ladders_3" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_ladders_4" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "CHECKPOINT_courtyard_flag" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Command_Post" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_Assault_Ladders" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_monastery_1" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_monastery_2" );
	SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_monastery_1" );
	SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_monastery_2" );

	//~Util.DisableGoal( ".*", true ); // all but routes
	//~SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_.*" );
	//~SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_.*" );

	// Max users per goal
	//Util.SetMaxUsers( 1, "MOUNTMG42_.*" );

	// Camp times
	//SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=15, MaxCampTime=90} );


	Util.MapDebugPrint( "Omni-bot map script for " + GetMapName() + " executed." );
};

global OnBotJoin = function( bot )
{
         bot.TargetBreakableDist = 90.0;
	// Only set MaxViewDistance on maps with limited sight (e.g. fog)
	//~bot.MaxViewDistance = 2400;
};

global InitializeRoutes = function()
{
	MapRoutes =
	{
		FLAG_map =
		{
		},
		CHECKPOINT_meadow_flag =
		{
		},
		BUILD_Allied_Assault_Ramp =
		{
		},
		PLANT_Allied_Assault_Ramp =
		{
		},
		CHECKPOINT_courtyard_flag =
		{
		},
		BUILD_Allied_Assault_Ladders =
		{
		},
		PLANT_Allied_Assault_Ladders =
		{
		},
		BUILD_Command_Post =
		{
		},
		PLANT_Command_Post =
		{
		},
		BUILD_Axis_Church_Door =
		{
		},
		PLANT_Axis_Church_Door =
		{
		},
	};
	Util.Routes(MapRoutes);
};
