//==========================================================================================
//
//	armada_b2.gm
//
//	Who                    	When		What
//------------------------------------------------------------------------------------------
//	^1{WeB}^7*^4GA^1NG$^4TA^7*	05 June 2017	Initial Script
//
//==========================================================================================
//

global Map =
{
	Assault_Ramp_Dyno = 0,
	Axis_MG_Dyno = 0,
	Command_Post_Dyno = 0,
	Hotel_Doors_Dyno = 0,
	South_East_Panzers_Dyno = 0,
	South_West_Panzer_Dyno = 0,

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

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

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

	Assault_Ramp_Planted = function()
	{
		Map.Assault_Ramp_Dyno += 1;
		Util.MapDebugPrint( "Assault_Ramp_Planted" );
	},

	Axis_MG_Planted = function()
	{
		Map.Axis_MG_Dyno += 1;
		Util.MapDebugPrint( "Axis_MG_Planted" );
	},

	Command_Post_Planted = function()
	{
		Map.Command_Post_Dyno += 1;
		Util.MapDebugPrint( "Command_Post_Planted" );
	},

	Hotel_Doors_Planted = function()
	{
		Map.Hotel_Doors_Dyno += 1;
		Util.MapDebugPrint( "Hotel_Doors_Planted" );
	},

	South_East_Panzers_Planted = function()
	{
		Map.South_East_Panzers_Dyno += 1;
		Util.MapDebugPrint( "South_East_Panzers_Planted" );
	},

	South_West_Panzer_Planted = function()
	{
		Map.South_West_Panzer_Dyno += 1;
		Util.MapDebugPrint( "South_West_Panzer_Planted" );
	},

	Assault_Ramp_Defused = function()
	{
		Map.Assault_Ramp_Dyno -= 1;
		Util.MapDebugPrint( "Assault_Ramp_Defused" );
	},

	Axis_MG_Defused = function()
	{
		Map.Axis_MG_Dyno -= 1;
		Util.MapDebugPrint( "Axis_MG_Defused" );
	},

	Command_Post_Defused = function()
	{
		Map.Command_Post_Dyno -= 1;
		Util.MapDebugPrint( "Command_Post_Defused" );
	},

	Hotel_Doors_Defused = function()
	{
		Map.Hotel_Doors_Dyno -= 1;
		Util.MapDebugPrint( "Hotel_Doors_Defused" );
	},

	South_East_Panzers_Defused = function()
	{
		Map.South_East_Panzers_Dyno -= 1;
		Util.MapDebugPrint( "South_East_Panzers_Defused" );
	},

	South_West_Panzer_Defused = function()
	{
		Map.South_West_Panzer_Dyno -= 1;
		Util.MapDebugPrint( "South_West_Panzer_Defused" );
	},

	Assault_Ramp_Destroyed = function()
	{


		Map.Assault_Ramp_Dyno = 0;

		Util.MapDebugPrint( "Assault_Ramp_Destroyed" );
	},

	Axis_MG_Destroyed = function()
	{
		Map.Axis_MG_Dyno = 0;

		Util.MapDebugPrint( "Axis_MG_Destroyed" );
	},

	Command_Post_Destroyed = function()
	{
		Map.Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Command_Post_Destroyed" );
	},

	Hotel_Doors_Destroyed = function()
	{

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Hotel_1",
			"DEFEND_Hotel_2",
			"DEFEND_Hotel_3",
			"DEFEND_Ramp_1",
			"DEFEND_Ramp_2",
			"DEFEND_Ramp_3",
			"BUILD_Axis_MG",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_SE_Panzers_1",
			"DEFEND_SE_Panzers_2",
			"DEFEND_SE_Panzers_3",
			"DEFEND_SE_Panzers_4",
			"DEFEND_SW_Panzer_1",
			"DEFEND_SW_Panzer_2",
		});
	      SetAvailableMapGoals( TEAM.ALLIES, true, {
	      	"PLANT_South_East_Panzers",
	      	"PLANT_South_West_Panzer",
	      	"BUILD_Assault_Ramp",
	      	"DEFEND_SE_Panzers_1",
	      	"DEFEND_SE_Panzers_2",
	      	"DEFEND_SE_Panzers_3",
	      	"DEFEND_SW_Panzer_1",
	      	"DEFEND_SW_Panzer_2",
	      });

		Map.Hotel_Doors_Dyno = 0;

		Util.MapDebugPrint( "Hotel_Doors_Destroyed" );
	},

	South_East_Panzers_Destroyed = function()
	{

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_SE_Panzers_1",
			"DEFEND_SE_Panzers_2",
			"DEFEND_SE_Panzers_3",
			"DEFEND_SE_Panzers_4",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_SE_Panzers_1",
			"DEFEND_SE_Panzers_2",
			"DEFEND_SE_Panzers_3",
		});

		Map.South_East_Panzers_Dyno = 0;

		Util.MapDebugPrint( "South_East_Panzers_Destroyed" );
	},

	South_West_Panzer_Destroyed = function()
	{

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_SW_Panzer_1",
			"DEFEND_SW_Panzer_2",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_SW_Panzer_1",
			"DEFEND_SW_Panzer_2",
		});

		Map.South_West_Panzer_Dyno = 0;

		Util.MapDebugPrint( "South_West_Panzer_Destroyed" );
	},

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

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

};

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "The Allies have built an Assault Ramp!", Map.Assault_Ramp_Built );
	OnTrigger( "Axis MG nest constructed!", Map.Axis_MG_Built );
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Command_Post_Built );
	OnTrigger( "The Axis have destroyed the Allied assault ramp!", Map.Assault_Ramp_Destroyed );
	OnTrigger( "Allied team has destroyed the Axis MG nest!", Map.Axis_MG_Destroyed );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Command_Post_Destroyed );
	OnTrigger( "Allies have breached the Hotel Doors and secured the Old City", Map.Hotel_Doors_Destroyed );
	OnTrigger( "Allies have destroyed the South-East Panzers!", Map.South_East_Panzers_Destroyed );
	OnTrigger( "Allies have destroyed the Sout-West Panzer!", Map.South_West_Panzer_Destroyed );
	OnTrigger( "Axis capture the forward spawn!", Map.oldcityflag_Axis_Captured );
	OnTrigger( "Allies capture the forward spawn!", Map.oldcityflag_Allies_Captured );

	SetAvailableMapGoals( TEAM.AXIS, true, {
		"DEFEND_Hotel_1",
		"DEFEND_Hotel_2",
		"DEFEND_Hotel_3",
		"DEFEND_Ramp_1",
		"DEFEND_Ramp_2",
		"DEFEND_Ramp_3",
	});
	SetAvailableMapGoals( TEAM.AXIS, false, {
		"DEFEND_SE_Panzers_1",
		"DEFEND_SE_Panzers_2",
		"DEFEND_SE_Panzers_3",
		"DEFEND_SE_Panzers_4",
		"DEFEND_SW_Panzer_1",
		"DEFEND_SW_Panzer_2",
	});
	SetAvailableMapGoals( TEAM.ALLIES, false, {
		"BUILD_Assault_Ramp",
		"PLANT_South_East_Panzers",
		"PLANT_South_West_Panzer",
		"DEFEND_SE_Panzers_1",
		"DEFEND_SE_Panzers_2",
		"DEFEND_SE_Panzers_3",
		"DEFEND_SW_Panzer_1",
		"DEFEND_SW_Panzer_2",
	});


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

	SetGoalPriority("PLANT_South_East_Panzers", 0.91);
	SetGoalPriority("PLANT_South_West_Panzer", 0.91);
	SetGoalPriority("BUILD_Assault_Ramp", 0.81);

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

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


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


