//==========================================================================================
//
//	wwgn3203.gm
//
//	Who                    	When		What
//------------------------------------------------------------------------------------------
//	^1{WeB}^7*^4GA^1NG$^4TA^7*	19 January 2016	Initial Script
//
//==========================================================================================
//

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

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

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

	gate_Planted = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"DEFEND_Gate_1",
			"DEFEND_Gate_2",
			"DEFEND_Gate_3",
			"DEFEND_Gate_4",
			"DEFEND_Gate_5",
		});

		Util.MapDebugPrint( "gate_Planted" );
	},

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

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

	stone_tunnel_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Tunnel_1",
			"DEFEND_Tunnel_2",
			"DEFEND_Tunnel_3",
			"DEFEND_Tunnel_4",
			"DEFEND_Tunnel_5",
			"DEFEND_Tunnel_6",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_Tunnel2_1",
			"DEFEND_Tunnel2_2",
			"DEFEND_Tunnel2_3",
			"DEFEND_Tunnel2_4",
		});

		Util.MapDebugPrint( "stone_tunnel_Destroyed" );
	},

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

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

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

	Main_Gate_destroyed = function( trigger )
	{
		sleep(2);
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"PLANT_Train_2",
			"DEFEND_Train2_1",
			"DEFEND_Train2_2",
			"DEFEND_Train2_3",
			"DEFEND_Train2_4",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_Gate_1",
			"DEFEND_Gate_2",
			"DEFEND_Gate_3",
			"DEFEND_Gate_4",
			"DEFEND_Gate_5",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Train_1",
			"DEFEND_Train_2",
			"DEFEND_Train_3",
			"DEFEND_Train_4",
			"DEFEND_Train_5",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"CHECKPOINT_forward_flag",
			"PLANT_Allied_Command_Post",
		});

		Util.MapDebugPrint( "Main_Gate_destroyed" );
	},

	Train_2_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"PLANT_stone_tunnel",
			"DEFEND_Tunnel2_1",
			"DEFEND_Tunnel2_2",
			"DEFEND_Tunnel2_3",
			"DEFEND_Tunnel2_4",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_Train2_1",
			"DEFEND_Train2_2",
			"DEFEND_Train2_3",
			"DEFEND_Train2_4",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Train_1",
			"DEFEND_Train_2",
			"DEFEND_Train_3",
			"DEFEND_Train_4",
			"DEFEND_Train_5",
			"BUILD_Axis_Command_Post",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Tunnel_1",
			"DEFEND_Tunnel_2",
			"DEFEND_Tunnel_3",
			"DEFEND_Tunnel_4",
			"DEFEND_Tunnel_5",
			"DEFEND_Tunnel_6",
		});

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

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( "Planted at Main gate.", Map.gate_Planted );
	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 Allies have destroyed the tunnel!", Map.stone_tunnel_Destroyed );
	OnTrigger( "The Allies have destroyed the train!", Map.train_Destroyed );
	OnTrigger( "The Allies have destroyed the train!", Map.Train_2_Destroyed );
	OnTrigger( "The Allies have destroyed the gate!", Map.Main_Gate_destroyed );
	OnTrigger( "Axis have captured the Forward Flag!", Map.forward_flag_Axis_Captured );
	OnTrigger( "Allies have captured the Forward Flag!", Map.forward_flag_Allies_Captured );

	SetAvailableMapGoals( TEAM.ALLIES, false, {
		"PLANT_train",
		"PLANT_Train_2",
		"PLANT_stone_tunnel",
		"PLANT_Axis_Command_Post",
	});
	SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Main_gate" );
	SetAvailableMapGoals( TEAM.ALLIES, false, {
		"DEFEND_Gate_1",
		"DEFEND_Gate_2",
		"DEFEND_Gate_3",
		"DEFEND_Gate_4",
		"DEFEND_Gate_5",
	});
	SetAvailableMapGoals( TEAM.AXIS, false, {
		"DEFEND_Train_1",
		"DEFEND_Train_2",
		"DEFEND_Train_3",
		"DEFEND_Train_4",
		"DEFEND_Train_5",
		"DEFEND_Tunnel_1",
		"DEFEND_Tunnel_2",
		"DEFEND_Tunnel_3",
		"DEFEND_Tunnel_4",
		"DEFEND_Tunnel_5",
		"DEFEND_Tunnel_6",
	});
	SetAvailableMapGoals( TEAM.ALLIES, false, {
		"DEFEND_Train2_1",
		"DEFEND_Train2_2",
		"DEFEND_Train2_3",
		"DEFEND_Train2_4",
		"DEFEND_Tunnel2_1",
		"DEFEND_Tunnel2_2",
		"DEFEND_Tunnel2_3",
		"DEFEND_Tunnel2_4",
	});

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