//==========================================================================================
//
//	monte_cassino.gm
//
//	Who                    	When		What
//------------------------------------------------------------------------------------------
//	^1{WeB}^7*^4GA^1NG$^4TA^7*	16 September 2016	incomplete waypoints
//	palota                    	25 January 2025  	routes, ladders, paths through the tunnels and the eastside window, MOUNTMG42, priorities, more DEFEND goals
//==========================================================================================
//

global Map =
{
	Debug = 0,

	Ramp_Built = function(trigger)
	{
		Wp.CheckBlockable();
		SetAvailableMapGoals(TEAM.ALLIES, true, {
			"DEFEND_dyna_.*",
			"CHECKPOINT_depot_flag",
		});
	},

	West_Ramp_Built = function(trigger)
	{
		Map.Ramp_Built();
		Util.MapDebugPrint("West_Ramp_Built");
	},

	East_Ramp_Built = function(trigger)
	{
		Map.Ramp_Built();
		Util.MapDebugPrint("East_Ramp_Built");
	},

	Water_Pump_Built = function(trigger)
	{
		Util.EnableGoal("ROUTE_water");
		Util.MapDebugPrint("Water_Pump_Built");
	},

	Water_Pump_Destroyed = function(trigger)
	{
		Util.DisableGoal("ROUTE_water");
		Util.MapDebugPrint("Water_Pump_Destroyed");
	},

	Tunneldoor_Destroyed = function(trigger)
	{
		Util.EnableGoal("ROUTE_tunnel");
		Util.MapDebugPrint("Tunneldoor_Destroyed");
	},

	Main_Entrance_Destroyed = function(trigger)
	{
		Wp.CheckBlockable();
		Util.EnableGoal("ROUTE_entrance");

		SetAvailableMapGoals(TEAM.ALLIES, false, {
			"DEFEND_dyna_.*",
			"MOUNTMG42_allies.*",
		});
		SetAvailableMapGoals(TEAM.ALLIES, true, {
			".*_Command_Post",
		});
		SetAvailableMapGoals(TEAM.AXIS, false, {
			"DEFEND_wall.*",
		});
		SetAvailableMapGoals(TEAM.AXIS, true, {
			"DEFEND_gold.*",
		});

		Util.SetMaxUsersInProgress(10, "CHECKPOINT_depot_flag");

		Util.MapDebugPrint("Main_Entrance_Destroyed");
	},

	depot_flag_Axis_Captured = function(trigger)
	{
		SetAvailableMapGoals(TEAM.ALLIES, false, "FLAG_radarbox.*");
		Util.MapDebugPrint("depot_flag_Axis_Captured");
	},

	depot_flag_Allies_Captured = function(trigger)
	{
		SetAvailableMapGoals(TEAM.ALLIES, true, "FLAG_radarbox.*");
		Util.MapDebugPrint("depot_flag_Allies_Captured");
	},

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

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

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

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

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

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

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

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

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

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

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

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

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

};

global OnMapLoad = function()
{
	OnTrigger("Axis have the Tower constructed.", Map.Axis_Tower_Built);
	OnTrigger("Allies have the East Fueltank constructed.", Map.East_Fueltank_Built);
	OnTrigger("Allies have the East Ramp constructed.", Map.East_Ramp_Built);
	OnTrigger("Allies have built the Water Pump!", Map.Water_Pump_Built);
	OnTrigger("Allies have the West Ramp constructed.", Map.West_Ramp_Built);
	OnTrigger("Allies have destroyed the Axis Tower.", Map.Axis_Tower_Destroyed);
	OnTrigger("Axis have destroyed the East Fueltank.", Map.East_Fueltank_Destroyed);
	OnTrigger("Axis have destroyed the East Ramp.", Map.East_Ramp_Destroyed);
	OnTrigger("The Main Entrance has been breached!", Map.Main_Entrance_Destroyed);
	OnTrigger("The Side Entrance has been breached!", Map.Tunneldoor_Destroyed);
	OnTrigger("Axis have damaged the Water Pump!", Map.Water_Pump_Destroyed);
	OnTrigger("Axis have destroyed the West Ramp.", Map.West_Ramp_Destroyed);
	OnTrigger("Allies have stolen the Gold Bars 1!", Map.Gold_Bars1_Taken);
	OnTrigger("Allies have stolen the Gold Bars 2!", Map.Gold_Bars2_Taken);
	OnTrigger("Axis have returned the Gold Bars 1!", Map.Gold_Bars1_Returned);
	OnTrigger("Axis have returned the Gold Bars 2!", Map.Gold_Bars2_Returned);
	OnTrigger("Allied team has secured the first Gold Crate!", Map.radarbox1_Secured);
	OnTrigger("Allied team has secured the second Gold Crate!", Map.radarbox2_Secured);
	OnTrigger("Axis reclaim the Forward Bunker!", Map.depot_flag_Axis_Captured);
	OnTrigger("Allies capture the Forward Bunker!", Map.depot_flag_Allies_Captured);

	Util.DisableGoal(".*", true);
	Util.DisableGoal({
		"ROUTE_entrance",
		"ROUTE_tunnel",
		"ROUTE_water",
	});

	SetAvailableMapGoals(TEAM.AXIS, true, {
		"AMMOCAB_north2_ammocabinet.*",
		"BUILD_Axis_Tower",
		".*_Command_Post",
		".*MG42_axis.*",
		"PLANT_East_Ramp",
		"PLANT_West_Ramp",
		"PLANT_Water_Pump",
		"HEALTHCAB_north2_healthcabinet.*",
		"CHECKPOINT_depot_flag",
		"DEFEND_wall.*",
	});
	SetAvailableMapGoals(TEAM.ALLIES, true, {
		"AMMOCAB_.*",
		"BUILD_East_Fueltank",
		"BUILD_East_Ramp",
		"BUILD_West_Ramp",
		"BUILD_Water_Pump",
		"CAPPOINT.*",
		"PLANT_Main_Entrance",
		"PLANT_Tunneldoor",
		"HEALTHCAB_.*",
		"MOUNTMG42_allies.*",
	});

	SetGoalPriority("BUILD_Water_Pump", 0.85);
	SetGoalPriority("BUILD_Command_Post", 0.83);
	SetGoalPriority("BUILD_East_Fueltank", 0.81);
	SetGoalPriority("BUILD_Axis_Tower", 0.8);
	SetGoalPriority("PLANT_.*", 0.7, TEAM.AXIS, CLASS.ENGINEER);

	Util.SetMaxUsers(1, "MOUNTMG42_.*");
	Util.SetMaxUsers(1, "PLANT_.*");
	Util.SetMaxUsers(1, "BUILD_.*");
	Util.SetMaxUsersInProgress(1, "CHECKPOINT_depot_flag");

	SetMapGoalProperties("DEFEND_.*", {MinCampTime=20, MaxCampTime=60});
	SetMapGoalProperties("MOUNTMG42_.*", {MinCampTime=30, MaxCampTime=100});

	Util.AddUsePoint( "PLANT_West_Ramp", Vec3(-2763, -4405, -486) );
	Util.AddUsePoint( "PLANT_East_Ramp", Vec3(909, -4880, -498) );

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

global OnBotJoin = function(bot)
{
	bot.TargetBreakableDist = 100.0;
};

global InitializeRoutes = function()
{
	MapRoutes =
	{
		CHECKPOINT_depot_flag = {
			ROUTE_allies_spawn = {
				ROUTE_entrance = { Weight=0.5 },
				ROUTE_tunnel = {},
				ROUTE_water = {},
				ROUTE_window = {},
			},
		},
		CAPPOINT_gold = {
			ROUTE_gold = {
				ROUTE_entrance = {},
				ROUTE_water = { Weight=2 },
				ROUTE_window = {},
			},
		},
	};
	Util.Routes(MapRoutes);
};
