//==========================================================================================
//
//	warmissile_beta1.gm
//
//	Who                    	When		What
//------------------------------------------------------------------------------------------
//	^1{WeB}^7*^4GA^1NG$^4TA^7*	31 May 2016	Initial Script
//
//==========================================================================================
//

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

	Allied_Command_Post_Built = function( trigger )
	{

		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"PLANT_generator_door_constructible",
			"DEFEND_Main_Generator_5",
			"DEFEND_Main_Generator_6",
			"DEFEND_Main_Generator_7",
			"DEFEND_Main_Generator_8",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Main_Generator_1",
			"DEFEND_Main_Generator_2",
			"DEFEND_Main_Generator_3",
			"DEFEND_Main_Generator_4",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_Outside_Fence_8",
			"DEFEND_Command_Post_1",
			"DEFEND_Command_Post_2",
			"DEFEND_Command_Post_3",
			"DEFEND_Command_Post_4",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Command_Post_1",
			"DEFEND_Command_Post_2",
			"DEFEND_Command_Post_3",
			"DEFEND_Command_Post_4",
		});

		Util.MapDebugPrint( "Allied_Command_Post_Built" );
	},

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

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

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

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

	Main_Generator_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"PLANT_generator_door_constructible",
			"DEFEND_Main_Generator_5",
			"DEFEND_Main_Generator_6",
			"DEFEND_Main_Generator_7",
			"DEFEND_Main_Generator_8",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"DEFEND_Missile_3",
			"DEFEND_Missile_4",
			"DEFEND_Missile_5",
			"FLAG_keycard",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"BUILD_generator_door_constructible",
			"PLANT_Allied_Command_Post",
			"DEFEND_Main_Generator_1",
			"DEFEND_Main_Generator_2",
			"DEFEND_Main_Generator_3",
			"DEFEND_Main_Generator_4",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Missile_1_1",
			"DEFEND_Missile_2",
			"DEFEND_Missile_3",
			"DEFEND_Missile_4",
			"DEFEND_Keycard_1",
			"DEFEND_Keycard_2",
		});

		Util.MapDebugPrint( "Main_Generator_Destroyed" );
	},

	generator_door_constructible_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Main_Generator" );

		Util.MapDebugPrint( "generator_door_constructible_Destroyed" );
	},

	keycard_Taken = function( trigger )
	{

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Keycard_1",
			"DEFEND_Keycard_2",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_keycard" );

		Util.MapDebugPrint( "keycard_Taken" );
	},

	keycard_Returned = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Keycard_1",
			"DEFEND_Keycard_2",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_keycard" );

		Util.MapDebugPrint( "keycard_Returned" );
	},

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

	Outdoor_Fence_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"BUILD_Allied_Command_Post",
			"DEFEND_Command_Post_1",
			"DEFEND_Command_Post_2",
			"DEFEND_Command_Post_3",
			"DEFEND_Command_Post_4",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_Outside_Fence_5",
			"DEFEND_Outside_Fence_6",
			"DEFEND_Outside_Fence_7",
			"DEFEND_Outside_Fence_8",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Outside_Fence_1",
			"DEFEND_Outside_Fence_2",
			"DEFEND_Outside_Fence_3",
			"DEFEND_Outside_Fence_4",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Command_Post_1",
			"DEFEND_Command_Post_2",
			"DEFEND_Command_Post_3",
			"DEFEND_Command_Post_4",
		});

		Util.MapDebugPrint( "Outdoor_Fence_Destroyed" );
	},

	Generator_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"PLANT_Outdoor_Fence",
			"DEFEND_Outside_Fence_5",
			"DEFEND_Outside_Fence_6",
			"DEFEND_Outside_Fence_7",
			"DEFEND_Outside_Fence_8",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Outside_Fence_1",
			"DEFEND_Outside_Fence_2",
			"DEFEND_Outside_Fence_3",
			"DEFEND_Outside_Fence_4",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Generator_1",
			"DEFEND_Generator_2",
			"DEFEND_Generator_3",
			"DEFEND_Generator_4",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_Generator_1",
			"DEFEND_Generator_2",
			"DEFEND_Generator_3",
			"DEFEND_Generator_4",
		});

		Util.MapDebugPrint( "Generator_Destroyed" );
	},

	Forward_Spawn_Captured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "CHECKPOINT_flag" );

		Util.MapDebugPrint( "Forward_Spawn_Captured" );
	},

	Axis_Forward_Spawn_Captured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT_flag" );

		Util.MapDebugPrint( "Axis_Forward_Spawn_Captured" );
	},

};

global OnMapLoad = function()
{
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Axis_Command_Post_Built );
	OnTrigger( "The generator door has been constructed.", Map.generator_door_constructible_Built );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Axis_Command_Post_Destroyed );
	OnTrigger( "The Main Generator has been destroyed", Map.Main_Generator_Destroyed );
	OnTrigger( "The generator door has been destroyed.", Map.generator_door_constructible_Destroyed );
	OnTrigger( "The Outdoor Fence has been destroyed.", Map.Outdoor_Fence_Destroyed );
	OnTrigger( "The generator has been destroyed", Map.Generator_Destroyed );
	OnTrigger( "The Allies have captured the Forward Spawn !", Map.Forward_Spawn_Captured );
	OnTrigger( "The Axis have captured the Forward Spawn !", Map.Axis_Forward_Spawn_Captured );
	OnTrigger( "Allies have stolen the keycard!", Map.keycard_Taken );
	OnTrigger( "Axis have returned the keycard!", Map.keycard_Returned );


	SetAvailableMapGoals( TEAM.ALLIES, false, {
		"PLANT_generator_door_constructible",
		"PLANT_Outdoor_Fence",
		"BUILD_Allied_Command_Post",
		"FLAG_keycard",
		"MOUNTMG42_914",
		"MOUNTMG42_1171",
		"PLANT_Axis_Command_Post",
		"PLANT_Main_Generator",
		"DEFEND_Outside_Fence_5",
		"DEFEND_Outside_Fence_6",
		"DEFEND_Outside_Fence_7",
		"DEFEND_Outside_Fence_8",
		"DEFEND_Command_Post_1",
		"DEFEND_Command_Post_2",
		"DEFEND_Command_Post_3",
		"DEFEND_Command_Post_4",
		"DEFEND_Main_Generator_5",
		"DEFEND_Main_Generator_6",
		"DEFEND_Main_Generator_7",
		"DEFEND_Main_Generator_8",
		"DEFEND_Missile_3",
		"DEFEND_Missile_4",
		"DEFEND_Missile_5",
	});
	SetAvailableMapGoals( TEAM.AXIS, false, {
		"DEFEND_Command_Post_1",
		"DEFEND_Command_Post_2",
		"DEFEND_Command_Post_3",
		"DEFEND_Command_Post_4",
		"MOUNTMG42_914",
		"MOUNTMG42_1171",
		"CHECKPOINT_flag",
		"DEFEND_Outside_Fence_1",
		"DEFEND_Outside_Fence_2",
		"DEFEND_Outside_Fence_3",
		"DEFEND_Outside_Fence_4",
		"DEFEND_Main_Generator_1",
		"DEFEND_Main_Generator_2",
		"DEFEND_Main_Generator_3",
		"DEFEND_Main_Generator_4",
		"DEFEND_Missile_1_1",
		"DEFEND_Missile_2",
		"DEFEND_Missile_3",
		"DEFEND_Missile_4",
		"DEFEND_Keycard_1",
		"DEFEND_Keycard_2",
	});
	SetAvailableMapGoals( TEAM.AXIS, true, {
		"DEFEND_Generator_1",
		"DEFEND_Generator_2",
		"DEFEND_Generator_3",
		"DEFEND_Generator_4",
	});
	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"DEFEND_Generator_1",
		"DEFEND_Generator_2",
		"DEFEND_Generator_3",
		"DEFEND_Generator_4",
	});


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

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