//==========================================================================================
//
//	battleship.gm
//
//	Who                    	When		What
//------------------------------------------------------------------------------------------
//	^1{WeB}^7*^4GA^1NG$^4TA^7*	12 September 2015	Initial Script
//	palota	16 April 2018	assault ramp
//
//==========================================================================================
//

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

	Allied_Command_Post_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"PLANT_harbour_Wall",
			"DEFEND_Harbour_1",
			"DEFEND_Harbour_2",
			"DEFEND_Harbour_3",
		});

		Util.MapDebugPrint( "Allied_Command_Post_Built" );
	},

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

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

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

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

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

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

	Ship_Engine_1_NEW_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Ship_Engine_1_NEW" );

		Util.MapDebugPrint( "Ship_Engine_1_NEW_Destroyed" );
	},

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

	Ship_Engine_2_NEW_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Ship_Engine_2_NEW" );

		Util.MapDebugPrint( "Ship_Engine_2_NEW_Destroyed" );
	},

	harbour_Wall_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"BUILD_Assault_Ramp",
			"SWITCH_Blast_Doors",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Harbour_4",
			"DEFEND_Harbour_5",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_Harbour_1",
			"DEFEND_Harbour_2",
			"DEFEND_Harbour_3",
		});

		Util.MapDebugPrint( "harbour_Wall_Destroyed" );
	},

	Blast_Doors_Open = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"PLANT_Ship_Engine_1_NEW",
			"PLANT_Ship_Engine_2_NEW",
			"DEFEND_Engine_1",
			"DEFEND_Engine_2",
			"DEFEND_Engine_3",
			"DEFEND_Engine_4",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_Blast_Doors" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Engine_1",
			"DEFEND_Engine_2",
			"DEFEND_Engine_3",
			"DEFEND_Engine_4",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Ship_1",
			"DEFEND_Ship_2",
			"DEFEND_Ship_3",
			"DEFEND_Ship_4",
		});

		Util.MapDebugPrint( "Blast_Doors_Open" );
	},

};

global OnMapLoad = function()
{
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built );
	OnTrigger( "Allied Team have built the assault ramp!", Map.Assault_Ramp_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Axis_Command_Post_Built );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "Axis have destroyed the assault ramp!", Map.Assault_Ramp_Destroyed );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Axis_Command_Post_Destroyed );
	OnTrigger( "The Allies have destroyed Engine One!", Map.Ship_Engine_One_Destroyed );
	OnTrigger( "The Allies have destroyed Engine One!", Map.Ship_Engine_1_NEW_Destroyed );
	OnTrigger( "The Allies have destroyed Engine Two!", Map.Ship_Engine_Two_Destroyed );
	OnTrigger( "The Allies have destroyed Engine Two!", Map.Ship_Engine_2_NEW_Destroyed );
	OnTrigger( "The Allies have destroyed the harbour wall!", Map.harbour_Wall_Destroyed );
	OnTrigger( "The Allies have opened the Engineroom Blast-Doors!", Map.Blast_Doors_Open );

	Util.SetMaxUsersInProgress(9, "SWITCH_Blast_Doors");
	SetGoalPriority( "PLANT_Ship_Engine_.*", 0.9 );

	SetAvailableMapGoals( TEAM.ALLIES, false, {
		"BUILD_Assault_Ramp",
		"PLANT_harbour_Wall",
		"PLANT_Ship_Engine_One",
		"PLANT_Ship_Engine_1_NEW",
		"PLANT_Ship_Engine_Two",
		"PLANT_Ship_Engine_2_NEW",
		"SWITCH_Blast_Doors",
	});
	SetAvailableMapGoals( TEAM.AXIS, false, {
		"PLANT_Allied_Command_Post",
		"DEFEND_Engine_1",
		"DEFEND_Engine_2",
		"DEFEND_Engine_3",
		"DEFEND_Engine_4",
	});
	SetAvailableMapGoals( TEAM.AXIS, true, {
		"DEFEND_Harbour_4",
		"DEFEND_Harbour_5",
		"DEFEND_Ship_1",
		"DEFEND_Ship_2",
		"DEFEND_Ship_3",
		"DEFEND_Ship_4",
	});
	SetAvailableMapGoals( TEAM.ALLIES, false, {
		"PLANT_Axis_Command_Post",
		"DEFEND_Harbour_1",
		"DEFEND_Harbour_2",
		"DEFEND_Harbour_3",
		"DEFEND_Engine_1",
		"DEFEND_Engine_2",
		"DEFEND_Engine_3",
		"DEFEND_Engine_4",
	});

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