political_actions = {


	targeted_race_for_the_bomb = {

		icon = generic_research

		allowed = {
			always = yes
		}

		available = {
			#Target is FROM
			has_tech = atomic_research
			NOT = { has_global_flag = first_nuke_dropped }
			NOT = { has_idea = race_for_the_bomb }
		}

		target_root_trigger = {
            has_tech = atomic_research
            NOT = { has_global_flag = first_nuke_dropped }
            NOT = { has_idea = race_for_the_bomb }
		}

		#If this trigger matches a country.
		target_trigger = {
			#Target is FROM
			FROM = {
        		NOT = { is_in_faction_with = ROOT }
				has_tech = nuclear_reactor
				any_owned_state = {
					nuclear_reactor > 0
				}
			}
		}

		visible = {
            #Target is FROM
            has_tech = atomic_research
            NOT = { has_global_flag = first_nuke_dropped }
            NOT = { has_idea = race_for_the_bomb }
            FROM = {
        		NOT = { is_in_faction_with = ROOT }
				has_tech = nuclear_reactor
				any_owned_state = {
					nuclear_reactor > 0
				}
			}
		}

		complete_effect = {
			set_country_flag = racing_for_the_bomb
			add_ideas = race_for_the_bomb
		}

		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				any_other_country = { has_tech = nukes }
			}
		}
	}

	improved_worker_conditions = {

		icon = hol_exchange_intelligence_data

		available = {
			has_stability < 1.0
			if = {
				limit = {
					tag = SPR
				}
				NOT = {
					has_idea = SPR_political_violence
				}
			}
		}

		visible = { # R56 - invisible for anarchists stuck at 0% stability anyway
			NOT = {
				has_country_leader = {
					name = "Anarchist Commune"
					ruling_only = yes
				}
			}
		}

		fire_only_once = no

		modifier = {
			stability_weekly = 0.005
			consumer_goods_factor = 0.10
			industrial_capacity_factory = -0.1
		}

		days_remove = 180
		days_re_enable = 540

		cost = 100

		complete_effect = {

		}

		ai_will_do = {
			base = 0
			modifier = {
				add = 1
				has_stability < 0.6
				has_political_power > 155 #Spend on other things first
			}
			modifier = {
				original_tag = MEX
				has_civil_war = no
				add = 5
				has_stability < 0.75
				has_political_power > 155 #Spend on other things first
			}
			modifier = {
				original_tag = MEX
				has_civil_war = no
				add = 5
				has_stability < 0.8
				has_political_power > 155 #Spend on other things first
			}
			modifier = {
				original_tag = POR
				OR = {
					has_idea = POR_unstable_republic
					has_idea = POR_unstable_monarchy
				}
				
				has_civil_war = no
				add = 5
				has_stability < 0.75
				has_political_power > 105 #Spend on other things first
			}			
			modifier = {
				factor = 0
				original_tag = SPR
				OR = {
					NOT = { has_global_flag = spanish_civil_war }
					has_idea = SPR_anarchist_society_1
					has_idea = SPR_anarchist_society_2
					has_idea = SPR_anarchist_society_3
					has_idea = SPR_anarchist_society_4
					has_idea = SPR_anarchist_society_5
					has_idea = SPR_anarchist_society_6
					has_idea = SPR_anarchist_society_7
					has_idea = SPR_anarchist_society_8
					has_idea = SPR_anarchist_society_9
					has_idea = SPR_anarchist_society_10
					has_idea = SPR_anarchist_society_11
					has_idea = SPR_anarchist_society_12
					has_idea = SPR_anarchist_society_13
					has_idea = SPR_anarchist_society_14
					has_idea = SPR_anarchist_society_15
					has_idea = SPR_anarchist_society_16
					has_idea = SPR_anarchist_society_17
					has_idea = SPR_anarchist_society_18
					has_idea = SPR_anarchist_society_19
				}

			}
		}
	}
}

economy_decisions = {

	build_volga_don_canal = { # R56 addition
		icon = generic_construction

		allowed = {
			always = yes
		}

		cost = 50
		fire_only_once = yes

		days_remove = 180

		available = {
			has_tech = construction4
		}

		visible = {
			controls_state = 218
			controls_state = 245
			controls_state = 217
			controls_state = 236
			has_global_flag = VOLGA_DON_NOT_BUILT
		}

		modifier = {
			civilian_factory_use = 5
		}

		complete_effect = {
			clr_global_flag = VOLGA_DON_NOT_BUILT
			custom_effect_tooltip = VOLGA_DON_BUILT_tt
		}
	}
	dismantle_maginot = {

		icon = generic_construction

		allowed = {
			NOT = { OR = { original_tag = GER original_tag = FRA } }
		}

		cost = 50
		fire_only_once = yes

		days_remove = 200

		available = {
			controls_state = 28
			if = {
				limit = {
					FRA = { has_completed_focus = FRA_extend_the_maginot_line }
				}
				controls_state = 18
				controls_state = 29
			}
		}

		visible = {
			FRA = {
				any_owned_state = {
					is_controlled_by = ROOT
				}
			}
			NOT = { is_in_faction_with = FRA }
		}

		modifier = {
			civilian_factory_use = 5
		}

		complete_effect = {
			28 = {
				set_building_level = {
					type = bunker
					level = 2
					province = {
						all_provinces = yes
						level > 2
					}
				}
			}
			FRA = {
				if = {
					limit = {
						has_completed_focus = FRA_extend_the_maginot_line
					}
					18 = {
						set_building_level = {
							type = bunker
							level = 2
							province = {
								all_provinces = yes
								level > 2
							}
						}
					}
					29 = {
						set_building_level = {
							type = bunker
							level = 2
							province = {
								all_provinces = yes
								level > 2
							}
						}
					}
				}
				if = {
					limit = {
						has_idea = FRA_protected_by_the_maginot_line
					}
					remove_ideas = FRA_protected_by_the_maginot_line
				}
				# R56
				if = { limit = { has_idea = FRA_protected_by_the_maginot_line_defense }
					remove_ideas = FRA_protected_by_the_maginot_line_defense
				}
				if = { limit = { has_idea = FRA_protected_by_the_maginot_line_attack }
					remove_ideas = FRA_protected_by_the_maginot_line_attack
				}
				###
			}
		}
	}
	restructure_supply_system = { #one time boost to get a few cheap supply hubs

		icon = supplies

		visible = {
			OR = {
				is_major = no
				AND = {
					is_faction_leader = yes
					num_of_factories < 51 #would be a minor if it wasn't for faction leader status
				}
			}
		}
		fire_only_once = yes

		days_remove = 120

		ai_will_do = {
			factor = 1
			modifier = {
				num_of_factories < 30
				factor = 0
			}
		}

		modifier = {
			production_speed_supply_node_factor = 3
		}

		complete_effect = {
			set_variable = { node_goal = num_of_supply_nodes }
			add_to_variable = { node_goal = 3 } #maximum 3 additional nodes
		}

		cancel_trigger = {

			 check_variable = { node_goal < num_of_supply_nodes } #if the number of supply nodes exceeds the old number by +3, immediately cancel
		}
	}
	seize_some_trains_woo = { #repeating train seize

		icon = railroads

		visible = {
			num_of_factories < 60
		}

		available = {
			has_equipment = { train_equipment < 101 }
			has_tech = basic_train
		}

		days_remove = 180

		ai_will_do = {
			factor = 1
			modifier = {
				has_stability < 0.56
				factor = 0
			}
		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = train_equipment_1 # R56
				amount = 15
			}
			add_stability = -0.05
		}
	}
}

propaganda_efforts = {
	war_propaganda = {

		icon = generic_prepare_civil_war

		available = {
			NOT = { has_country_flag = war_propaganda_campaign_running }
			has_war_support < 0.5

			if = {
				limit = {
					tag = SPR
					has_dlc = "La Resistance"
				}
				NOT = {
					has_idea = SPR_political_violence
				}
			}
			if = {
				limit = {
					original_tag = SPR
					has_dlc = "La Resistance"
				}
				has_global_flag = scw_over
			}
		}

		visible = {
			OR = {
				has_war_with_non_exiled_country = yes
				any_neighbor_country = {
					AND = {
						NOT = { has_government = ROOT }
						has_offensive_war = yes
						has_added_tension_amount > 10
					}
				}
			}
		}

		fire_only_once = no

		days_remove = 90
		days_re_enable = 180

		cost = 150

		modifier = {
			war_support_weekly = 0.005
		}

		complete_effect = {
			set_country_flag = war_propaganda_campaign_running
		}
		remove_effect = {
			clr_country_flag = war_propaganda_campaign_running
		}

		ai_will_do = {
			base = 0
			modifier = {
				add = 1
				has_war_support < 0.4
				has_war = yes
			}
		}
	}

	war_propaganda_casualties = {

		icon = generic_prepare_civil_war

		available = {
			#NOT = { has_country_flag = war_propaganda_campaign_running }
			has_casualties_war_support < 0
		}

		visible = {
			# has_war = yes
			has_war_with_non_exiled_country = yes
		}

		fire_only_once = no

		days_remove = 180

		remove_trigger = {
			has_war = no
        }

		cost = 100

		modifier = {
			weekly_casualties_war_support = 0.006
		}

		#complete_effect = {
		#	set_country_flag = war_propaganda_campaign_running
		#}
		#remove_effect = {
		#	clr_country_flag = war_propaganda_campaign_running
		#}

		ai_will_do = {
			base = 0
			modifier = {
				add = 10 #AI should probably just choose this one for general purposes.
				has_war = yes
				has_war_support < 0.7
			}
			modifier = {
				add = 20
				has_war = yes
				has_war_support < 0.5
			}
			modifier = {
				add = 30
				has_war = yes
				has_war_support < 0.3
			}
			modifier = {
				add = 201 #ie; consider prio idea
				has_war = yes
				has_casualties_war_support < -0.25
			}
			modifier = {
				factor = 0
				has_manpower < 100000
				has_political_power < 250
				OR = {
					has_idea = volunteer_only
					has_idea = limited_conscription
					has_idea = extensive_conscription
				}
			}
		}
	}

	war_propaganda_convoys = {

		icon = GFX_decision_generic_naval

		available = {
			#NOT = { has_country_flag = war_propaganda_campaign_running }
			has_convoys_war_support < 0
		}

		visible = {
			# has_war = yes
			has_war_with_non_exiled_country = yes
		}

		fire_only_once = no

		days_remove = 180

		remove_trigger = {
			has_war = no
        }

		cost = 100

		modifier = {
			weekly_convoys_war_support = 0.006
		}

		#complete_effect = {
		#	set_country_flag = war_propaganda_campaign_running
		#}
		#remove_effect = {
		#	clr_country_flag = war_propaganda_campaign_running
		#}

		ai_will_do = {
			base = 0
			modifier = {
				add = 201 #ie; consider prio idea
				has_war = yes
				has_convoys_war_support < -0.29
			}
			modifier = {
				factor = 0
				has_manpower < 100000
				has_political_power < 250
				OR = {
					has_idea = volunteer_only
					has_idea = limited_conscription
					has_idea = extensive_conscription
				}
			}
		}
	}

	war_propaganda_bombing = {

		icon = GFX_decision_generic_air

		available = {
		#	NOT = { has_country_flag = war_propaganda_campaign_running }
			has_bombing_war_support < 0
		}

		visible = {
			# has_war = yes
			has_war_with_non_exiled_country = yes
		}

		fire_only_once = no

		days_remove = 180

		remove_trigger = {
			has_war = no
        }

		cost = 100

		modifier = {
			weekly_bombing_war_support = 0.006
		}

		#complete_effect = {
		#	set_country_flag = war_propaganda_campaign_running
		#}
		#remove_effect = {
		#	clr_country_flag = war_propaganda_campaign_running
		#}

		ai_will_do = {
			base = 0
			modifier = {
				add = 10 #AI should probably just choose this one for general purposes.
				has_war = yes
				has_war_support < 0.65
			}
			modifier = {
				add = 20
				has_war = yes
				has_war_support < 0.50
			}
			modifier = {
				add = 30
				has_war = yes
				has_war_support < 0.35
			}
			modifier = {
				add = 201 #ie; consider prio idea
				has_war = yes
				has_bombing_war_support < -0.20
			}
			modifier = {
				factor = 0
				has_manpower < 100000
				has_political_power < 250
				OR = {
					has_idea = volunteer_only
					has_idea = limited_conscription
					has_idea = extensive_conscription
				}
			}
		}
	}
	
	war_propaganda_radio_industry = { 

		icon = hol_radio_oranje

		available = {
			# IF = {
			# 	limit = {
			# 		tag = BRA
			# 	}
			# 	threat > 0.25
			# 	#has_tech = radio
			# 	has_completed_focus = BRA_radio_nacional
			# }
			# ELSE = {
				threat > 0.25
				has_tech = radio
			# }
		}

		visible = {
			if = {
				limit = {
					tag = SPR
					has_dlc = "La Resistance"
				}
				NOT = {
					has_idea = SPR_political_violence
				}
			}
			if = {
				limit = {
					original_tag = SPR
					has_dlc = "La Resistance"
				}
				has_global_flag = scw_over
			}
		}

		fire_only_once = yes

		cost = 75

		complete_effect = {
			add_war_support = 0.05
		}

		ai_will_do = {
			base = 0
			modifier = {
				add = 201
				has_war_support < 0.6
			}
		}
	}
	
	war_propaganda_film_industry = { 

		icon = generic_prepare_civil_war

		available = { 
			has_war_with_non_exiled_country = yes
			OR = {
				is_major = yes
				any_allied_country = {
					is_major = yes
				}
			}
			if = {
				limit = {
					NOT = { has_government = fascism }
				}
				threat > 0.5
			}
			else = {
				threat > 0.30
			}
		}

		visible = {
			if = {
				limit = {
					tag = SPR
					has_dlc = "La Resistance"
				}
				NOT = {
					has_idea = SPR_political_violence
				}
			}
			if = {
				limit = {
					original_tag = SPR
					has_dlc = "La Resistance"
				}
				has_global_flag = scw_over
			}
		}

		fire_only_once = yes

		cost = 100 

		complete_effect = {
			effect_tooltip = {
				add_war_support = 0.10
			}
			hidden_effect = {
				country_event = political.33
			}
		}

		ai_will_do = {
			base = 0
			modifier = {
				add = 201
				has_war_support < 0.6
			}
		}
	}

	##Propaganda campaign against a country in offensive that has caused a lot of tension and started a war
	#war_propaganda_against_warmonger = {
	#
	#	icon = generic_prepare_civil_war
	#
	#	available = {
	#		NOT = { has_country_flag = war_propaganda_campaign_running }
	#		FROM = {
	#			OR = {
	#				is_justifying_wargoal_against = ROOT
	#				AND = {
	#					has_war_with = ROOT
	#					is_neighbor_of = ROOT
	#				}
	#				has_offensive_war = yes
	#			}
	#		}
	#		if = {
	#			limit = {
	#				tag = SPR
	#				has_dlc = "La Resistance"
	#			}
	#			NOT = {
	#				has_idea = SPR_political_violence
	#			}
	#		}
	#		if = {
	#			limit = {
	#				original_tag = SPR
	#				has_dlc = "La Resistance"
	#			}
	#			has_global_flag = scw_over
	#		}
	#
	#		# lower the cost for neighbors
	#		if = {
	#			limit = {
	#				FROM = {
	#					is_neighbor_of = ROOT
	#				}
	#				set_temp_variable = { war_propaganda_cost = 50 }
	#			}
	#		}
	#	}
	#
	#	visible = {
	#		FROM = {
	#			NOT = { is_in_faction_with = ROOT }
	#			OR = {
	#				is_justifying_wargoal_against = ROOT
	#				AND = {
	#					is_neighbor_of = ROOT
	#					OR = {
	#						has_war_with = ROOT
	#						AND = {
	#							NOT = { has_government = ROOT }
	#							has_offensive_war = yes
	#							has_added_tension_amount > 5
	#						}
	#					}
	#				}
	#				AND = {
	#					NOT = { is_neighbor_of = ROOT }
	#					OR = {
	#						has_offensive_war_with = ROOT
	#						AND = {
	#							NOT = { has_government = ROOT }
	#							has_offensive_war = yes
	#							has_added_tension_amount > 30
	#						}
	#					}
	#				}
	#			}
	#		}
	#	}
	#
	#	target_trigger = {
	#		FROM = {
	#			NOT = { is_in_faction_with = ROOT }
	#			OR = {
	#				is_justifying_wargoal_against = ROOT
	#				AND = {
	#					is_neighbor_of = ROOT
	#					OR = {
	#						has_war_with = ROOT
	#						AND = {
	#							NOT = { has_government = ROOT }
	#							has_offensive_war = yes
	#							has_added_tension_amount > 5
	#						}
	#					}
	#				}
	#				AND = {
	#					NOT = { is_neighbor_of = ROOT }
	#					OR = {
	#						has_offensive_war_with = ROOT
	#						AND = {
	#							NOT = { has_government = ROOT }
	#							has_offensive_war = yes
	#							has_added_tension_amount > 30
	#						}
	#					}
	#				}
	#			}
	#		}
	#	}
	#
	#	days_remove = 90
	#	days_re_enable = 180
	#
	#	fire_only_once = yes
	#
	#	cost = var:war_propaganda_cost?75
	#
	#	modifier = {
	#		war_support_weekly = 0.01
	#	}
	#
	#	complete_effect = {
	#		set_country_flag = { flag = war_propaganda_campaign_running value = 1 days = 90 } #TODO_Manu: This is a nasty fix so that the flag gets eventually removed if the target is annexed. days = days_remove
	#	}
	#	remove_effect = {
	#		clr_country_flag = war_propaganda_campaign_running
	#	}
	#
	#	ai_will_do = {
	#		factor = 1
	#		modifier = {
	#			factor = 0
	#			has_war_support > 0.9
	#		}
	#	}
	#}
}

operations = {
	#MTG_TEST_NAVAL_MIXED_VS_MIXED_EARLY = { #MTG_TODO_GABRIEL: remove before launch (no seriously do not ship with this (hehe get it don't SHIP with it))
#
	#	icon = generic
	#	name = "TEST: Mix vs Mix"
	#
	#	allowed = {
	#		tag = CUB
	#	}
#
	#	available = {
	#
	#	}
	#
	#	cost = 0
	#
	#	ai_will_do = {
	#		factor = 0
	#	}
	#	days_remove = -1
	#
	#	complete_effect = {
	#		set_technology = {
	#			early_battleship = 1
	#			early_heavy_cruiser = 1
	#			early_light_cruiser = 1
	#			early_destroyer = 1
	#			early_carrier = 1
	#			early_submarine = 1
	#			cv_fighter1 = 1
	#			cv_CAS1 = 1
	#			cv_naval_bomber1 = 1
	#		}
	#		load_oob = "MTG_NAVAL_TEST_OOB_MIXED_VS_MIXED_EARLY_BLUE"
	#		add_ideas = {
	#			MTG_TEST_NAVAL_IDEA
	#		}
	#		add_fuel = 10000000
	#		DOM = {
	#			set_technology = {
	#				early_battleship = 1
	#				early_heavy_cruiser = 1
	#				early_light_cruiser = 1
	#				early_destroyer = 1
	#				early_carrier = 1
	#				early_submarine = 1
	#				cv_fighter1 = 1
	#				cv_CAS1 = 1
	#				cv_naval_bomber1 = 1
	#			}
	#			load_oob = "MTG_NAVAL_TEST_OOB_MIXED_VS_MIXED_EARLY_RED"
	#			add_fuel = 10000000
	#			add_ideas = {
	#				MTG_TEST_NAVAL_IDEA
	#			}
	#			set_stability = 1
	#			set_war_support = 1
	#		}
	#		declare_war_on = { target = DOM type = annex_everything }
	#		set_stability = 1
	#		set_war_support = 1
	#	}
	#}
	#MTG_TEST_NAVAL_MIXED_VS_CV_MIXED_EARLY = { #MTG_TODO_GABRIEL: remove before launch (no seriously do not ship with this (hehe get it don't SHIP with it))
#
	#	icon = generic
	#	name = "TEST: Mix vs Mix (with CVs)"
	#
	#	allowed = {
	#		tag = CUB
	#	}
#
	#	available = {
	#
	#	}
	#
	#	cost = 0
	#
	#	ai_will_do = {
	#		factor = 0
	#	}
	#	days_remove = -1
	#
	#	complete_effect = {
	#		set_technology = {
	#			early_battleship = 1
	#			early_heavy_cruiser = 1
	#			early_light_cruiser = 1
	#			early_destroyer = 1
	#			early_carrier = 1
	#			early_submarine = 1
	#			cv_fighter1 = 1
	#			cv_CAS1 = 1
	#			cv_naval_bomber1 = 1
	#		}
	#		load_oob = "MTG_NAVAL_TEST_OOB_MIXED_VS_MIXED_EARLY_BLUE"
	#		add_ideas = {
	#			MTG_TEST_NAVAL_IDEA
	#		}
	#		add_fuel = 10000000
	#		DOM = {
	#			set_technology = {
	#				early_battleship = 1
	#				early_heavy_cruiser = 1
	#				early_light_cruiser = 1
	#				early_destroyer = 1
	#				early_carrier = 1
	#				early_submarine = 1
	#				cv_fighter1 = 1
	#				cv_CAS1 = 1
	#				cv_naval_bomber1 = 1
	#			}
	#			load_oob = "MTG_NAVAL_TEST_OOB_CV_MIXED_VS_CV_MIXED_EARLY_RED"
	#			add_fuel = 10000000
	#			add_ideas = {
	#				MTG_TEST_NAVAL_IDEA
	#			}
	#			set_stability = 1
	#			set_war_support = 1
	#		}
	#		declare_war_on = { target = DOM type = annex_everything }
	#		set_stability = 1
	#		set_war_support = 1
	#	}
	#}
	#MTG_TEST_NAVAL_MIXED_VS_MIXED_SUBS_EARLY = { #MTG_TODO_GABRIEL: remove before launch (no seriously do not ship with this (hehe get it don't SHIP with it))
#
	#	icon = generic
	#	name = "TEST: Mix vs Mix (with subs)"
#
	#	allowed = {
	#		tag = CUB
	#	}
#
	#	available = {
	#
	#	}
	#
	#	cost = 0
	#
	#	ai_will_do = {
	#		factor = 0
	#	}
	#	days_remove = -1
	#	modifier = {
	#		navy_fuel_consumption_factor = -1
	#	}
	#	complete_effect = {
	#		set_technology = {
	#			early_battleship = 1
	#			early_heavy_cruiser = 1
	#			early_light_cruiser = 1
	#			early_destroyer = 1
	#			early_carrier = 1
	#			early_submarine = 1
	#			cv_fighter1 = 1
	#			cv_CAS1 = 1
	#			cv_naval_bomber1 = 1
	#		}
	#		load_oob = "MTG_NAVAL_TEST_OOB_MIXED_VS_MIXED_SUBS_EARLY_BLUE"
	#		add_ideas = {
	#			MTG_TEST_NAVAL_IDEA
	#		}
	#		add_fuel = 10000000
	#		DOM = {
	#			set_technology = {
	#				early_battleship = 1
	#				early_heavy_cruiser = 1
	#				early_light_cruiser = 1
	#				early_destroyer = 1
	#				early_carrier = 1
	#				early_submarine = 1
	#				cv_fighter1 = 1
	#				cv_CAS1 = 1
	#				cv_naval_bomber1 = 1
	#			}
	#			load_oob = "MTG_NAVAL_TEST_OOB_MIXED_VS_MIXED_SUBS_EARLY_RED"
	#			add_fuel = 10000000
	#			set_stability = 1
	#			set_war_support = 1
	#			add_ideas = {
	#				MTG_TEST_NAVAL_IDEA
	#			}
	#		}
	#		declare_war_on = { target = DOM type = annex_everything }
	#		set_stability = 1
	#		set_war_support = 1
	#	}
	#}
	#MTG_TEST_NAVAL_SCREENS_VS_MIXED_EARLY = { #MTG_TODO_GABRIEL: remove before launch (no seriously do not ship with this (hehe get it don't SHIP with it))
#
	#	icon = generic
	#	name = "TEST: Screens vs Mix"
#
	#	allowed = {
	#		tag = CUB
	#	}
#
	#	available = {
	#
	#	}
	#
	#	cost = 0
	#
	#	ai_will_do = {
	#		factor = 0
	#	}
	#	days_remove = -1
	#
	#	complete_effect = {
	#		set_technology = {
	#			early_battleship = 1
	#			early_battlecruiser = 1
	#			early_heavy_cruiser = 1
	#			early_light_cruiser = 1
	#			early_destroyer = 1
	#			early_carrier = 1
	#			early_submarine = 1
	#			cv_fighter1 = 1
	#			cv_CAS1 = 1
	#			cv_naval_bomber1 = 1
	#		}
	#		load_oob = "MTG_NAVAL_TEST_OOB_SCREENS_EARLY_BLUE"
	#		add_ideas = {
	#			MTG_TEST_NAVAL_IDEA
	#		}
	#		add_fuel = 10000000
	#		DOM = {
	#			set_technology = {
	#				early_battleship = 1
	#				early_battlecruiser = 1
	#				early_heavy_cruiser = 1
	#				early_light_cruiser = 1
	#				early_destroyer = 1
	#				early_carrier = 1
	#				early_submarine = 1
	#				cv_fighter1 = 1
	#				cv_CAS1 = 1
	#				cv_naval_bomber1 = 1
	#			}
	#			load_oob = "MTG_NAVAL_TEST_OOB_MIXED_VS_MIXED_EARLY_RED"
	#			add_fuel = 10000000
	#			set_stability = 1
	#			set_war_support = 1
	#			add_ideas = {
	#				MTG_TEST_NAVAL_IDEA
	#			}
	#		}
	#		declare_war_on = { target = DOM type = annex_everything }
	#		set_stability = 1
	#		set_war_support = 1
	#	}
	#}
	#MTG_TEST_NAVAL_SCREENS_VS_CV_MIXED_EARLY = { #MTG_TODO_GABRIEL: remove before launch (no seriously do not ship with this (hehe get it don't SHIP with it))
#
	#	icon = generic
	#	name = "TEST: Screens vs Mix (with CV)"
#
	#	allowed = {
	#		tag = CUB
	#	}
#
	#	available = {
	#
	#	}
	#
	#	cost = 0
	#
	#	ai_will_do = {
	#		factor = 0
	#	}
	#	days_remove = -1
	#
	#	complete_effect = {
	#		set_technology = {
	#			early_battleship = 1
	#			early_battlecruiser = 1
	#			early_heavy_cruiser = 1
	#			early_light_cruiser = 1
	#			early_destroyer = 1
	#			early_carrier = 1
	#			early_submarine = 1
	#			cv_fighter1 = 1
	#			cv_CAS1 = 1
	#			cv_naval_bomber1 = 1
	#		}
	#		load_oob = "MTG_NAVAL_TEST_OOB_SCREENS_EARLY_BLUE"
	#		add_ideas = {
	#			MTG_TEST_NAVAL_IDEA
	#		}
	#		add_fuel = 10000000
	#		DOM = {
	#			set_technology = {
	#				early_battleship = 1
	#				early_battlecruiser = 1
	#				early_heavy_cruiser = 1
	#				early_light_cruiser = 1
	#				early_destroyer = 1
	#				early_carrier = 1
	#				early_submarine = 1
	#				cv_fighter1 = 1
	#				cv_CAS1 = 1
	#				cv_naval_bomber1 = 1
	#			}
	#			load_oob = "MTG_NAVAL_TEST_OOB_CV_MIXED_VS_CV_MIXED_EARLY_RED"
	#			add_fuel = 10000000
	#			set_stability = 1
	#			set_war_support = 1
	#			add_ideas = {
	#				MTG_TEST_NAVAL_IDEA
	#			}
	#		}
	#		declare_war_on = { target = DOM type = annex_everything }
	#		set_stability = 1
	#		set_war_support = 1
	#	}
	#}
	#MTG_TEST_NAVAL_SCREENS_VS_CAPITALS_EARLY = { #MTG_TODO_GABRIEL: remove before launch (no seriously do not ship with this (hehe get it don't SHIP with it))
#
	#	icon = generic
	#	name = "TEST: Screens vs Capitals"
#
	#	allowed = {
	#		tag = CUB
	#	}
#
	#	available = {
	#
	#	}
	#
	#	cost = 0
	#
	#	ai_will_do = {
	#		factor = 0
	#	}
	#	days_remove = -1
	#	complete_effect = {
	#		set_technology = {
	#			early_battleship = 1
	#			early_battlecruiser = 1
	#			early_heavy_cruiser = 1
	#			early_light_cruiser = 1
	#			early_destroyer = 1
	#			early_carrier = 1
	#			early_submarine = 1
	#			cv_fighter1 = 1
	#			cv_CAS1 = 1
	#			cv_naval_bomber1 = 1
	#		}
	#		load_oob = "MTG_NAVAL_TEST_OOB_SCREENS_EARLY_BLUE"
	#		add_ideas = {
	#			MTG_TEST_NAVAL_IDEA
	#		}
	#		add_fuel = 10000000
	#		DOM = {
	#			set_technology = {
	#				early_battleship = 1
	#				early_battlecruiser = 1
	#				early_heavy_cruiser = 1
	#				early_light_cruiser = 1
	#				early_destroyer = 1
	#				early_carrier = 1
	#				early_submarine = 1
	#				cv_fighter1 = 1
	#				cv_CAS1 = 1
	#				cv_naval_bomber1 = 1
	#			}
	#			load_oob = "MTG_NAVAL_TEST_OOB_CAPITAL_EARLY_RED"
	#			add_ideas = {
	#				MTG_TEST_NAVAL_IDEA
	#			}
	#			add_fuel = 10000000
	#			set_stability = 1
	#			set_war_support = 1
	#		}
	#		declare_war_on = { target = DOM type = annex_everything }
	#		set_stability = 1
	#		set_war_support = 1
	#	}
	#}
	#MTG_TEST_NAVAL_CAPITALS_VS_MIXED_EARLY = { #MTG_TODO_GABRIEL: remove before launch (no seriously do not ship with this (hehe get it don't SHIP with it))
#
	#	icon = generic
	#	name = "TEST: Capitals vs Mix"
	#
	#	allowed = {
	#		tag = CUB
	#	}
#
	#	available = {
	#
	#	}
	#
	#	cost = 0
	#
	#	ai_will_do = {
	#		factor = 0
	#	}
	#	days_remove = -1
	#	complete_effect = {
	#		set_technology = {
	#			early_battleship = 1
	#			early_battlecruiser = 1
	#			early_heavy_cruiser = 1
	#			early_light_cruiser = 1
	#			early_destroyer = 1
	#			early_carrier = 1
	#			early_submarine = 1
	#			cv_fighter1 = 1
	#			cv_CAS1 = 1
	#			cv_naval_bomber1 = 1
	#		}
	#		load_oob = "MTG_NAVAL_TEST_OOB_CAPITAL_EARLY_BLUE"
	#		add_ideas = {
	#			MTG_TEST_NAVAL_IDEA
	#		}
	#		add_fuel = 10000000
	#		DOM = {
	#			set_technology = {
	#				early_battleship = 1
	#				early_battlecruiser = 1
	#				early_heavy_cruiser = 1
	#				early_light_cruiser = 1
	#				early_destroyer = 1
	#				early_carrier = 1
	#				early_submarine = 1
	#				cv_fighter1 = 1
	#				cv_CAS1 = 1
	#				cv_naval_bomber1 = 1
	#			}
	#			load_oob = "MTG_NAVAL_TEST_OOB_MIXED_VS_MIXED_EARLY_RED"
	#			add_ideas = {
	#				MTG_TEST_NAVAL_IDEA
	#			}
	#			add_fuel = 10000000
	#			set_stability = 1
	#			set_war_support = 1
	#		}
	#		declare_war_on = { target = DOM type = annex_everything }
	#		set_stability = 1
	#		set_war_support = 1
	#	}
	#}
	#MTG_TEST_NAVAL_CAPITALS_VS_CV_MIXED_EARLY = { #MTG_TODO_GABRIEL: remove before launch (no seriously do not ship with this (hehe get it don't SHIP with it))
#
	#	icon = generic
#
	#	name = "TEST: Capitals vs Mix (with CV)"
	#
	#	allowed = {
	#		tag = CUB
	#	}
#
	#	available = {
	#
	#	}
	#
	#	cost = 0
	#
	#	ai_will_do = {
	#		factor = 0
	#	}
	#	days_remove = -1
	#	complete_effect = {
	#		set_technology = {
	#			early_battleship = 1
	#			early_battlecruiser = 1
	#			early_heavy_cruiser = 1
	#			early_light_cruiser = 1
	#			early_destroyer = 1
	#			early_carrier = 1
	#			early_submarine = 1
	#			cv_fighter1 = 1
	#			cv_CAS1 = 1
	#			cv_naval_bomber1 = 1
	#		}
	#		load_oob = "MTG_NAVAL_TEST_OOB_CAPITAL_EARLY_BLUE"
	#		add_ideas = {
	#			MTG_TEST_NAVAL_IDEA
	#		}
	#		add_fuel = 10000000
	#		DOM = {
	#			set_technology = {
	#				early_battleship = 1
	#				early_battlecruiser = 1
	#				early_heavy_cruiser = 1
	#				early_light_cruiser = 1
	#				early_destroyer = 1
	#				early_carrier = 1
	#				early_submarine = 1
	#				cv_fighter1 = 1
	#				cv_CAS1 = 1
	#				cv_naval_bomber1 = 1
	#			}
	#			load_oob = "MTG_NAVAL_TEST_OOB_CV_MIXED_VS_CV_MIXED_EARLY_RED"
	#			add_ideas = {
	#				MTG_TEST_NAVAL_IDEA
	#			}
	#			add_fuel = 10000000
	#			set_stability = 1
	#			set_war_support = 1
	#		}
	#		declare_war_on = { target = DOM type = annex_everything }
	#		set_stability = 1
	#		set_war_support = 1
	#	}
	#}

	blow_suez_canal = {

		icon = GFX_decision_generic_ignite_civil_war
		available = {
			controls_state = 911
			controls_state = 995
			OR = {
				NOT = {
					owns_state = 911
					owns_state = 995
				}
				any_enemy_country = {
					OR = {
						controls_state = 453
						controls_state = 447
						controls_state = 907
						controls_state = 457
						controls_state = 456
					}
				}
			}
		}

		visible = {
			has_war = yes
			NOT = { has_global_flag = SUEZ_CANAL_BLOCKED }
			any_controlled_state = {
				OR = {
					region = 232
					region = 128
				}
			}
		}

		fire_only_once = no

		days_remove = 30

		cost = 75

		modifier = {
			civilian_factory_use = 5
		}

		complete_effect = {
			hidden_effect = {
				if = {
					limit = {
						NOT = {
							owns_state = 911
							owns_state = 995
						}
					}
					random_country = {
						limit = {
							owns_state = 911
							owns_state = 995
						}
						country_event = { id = generic.12 days = 1 }
					}
				}
			}
		}

		remove_effect = {
			if = {
				limit = {
					OR = {
						has_full_control_of_state = 911
						has_full_control_of_state = 995
					}
				}
				set_country_flag = blew_up_suez
				set_global_flag = SUEZ_CANAL_BLOCKED
				# country_event = { id = wtt_news.40 hours = 6}
				news_event = { id = wtt_news.40 hours = 6 } # R56
			}
			effect_tooltip = {
				if = {
					limit = {
						ENG = {
							owns_state = 911
							owns_state = 995
						}
					}
					add_war_support = -0.05
					add_stability = -0.05
				}
			}
		}
		ai_will_do = {
			base = 1
			modifier = {
				add = 200 # Try to cut the enemy off from the mediterranean if you also occupy Gibraltar
				OR = {
					has_full_control_of_state = 118
					any_allied_country = {
						has_full_control_of_state = 118
					}
				}
				has_war = yes
				NOT = { tag = ENG }
			}
			modifier = {
				factor = 0
				NOT = {
					any_enemy_country = {
						OR = {
							controls_state = 453
							controls_state = 447
							controls_state = 907
							controls_state = 457
							controls_state = 456
							OR = {
								divisions_in_state = { state = 453 size > 2 }
								divisions_in_state = { state = 447 size > 2 }
								divisions_in_state = { state = 907 size > 2 }
								divisions_in_state = { state = 457 size > 2 }
								divisions_in_state = { state = 456 size > 2 }
							}
						}
					}
				}
			}
			modifier = {
				factor = 0 # Don't blow the canal when you've got troops needing supplies in the Horn of Africa, and no land route has been established there
				any_allied_country = {
					NOT = {	#Egypt
						OR = {
							has_full_control_of_state = 457
							has_full_control_of_state = 456
						}
					}
					NOT = {	#Northern Sudan
						OR = {
							has_full_control_of_state = 551
							has_full_control_of_state = 883
						}
					}
					OR = {
						divisions_in_state = { state = 269 size > 0 }
						divisions_in_state = { state = 559 size > 0 }
						divisions_in_state = { state = 844 size > 0 }
						divisions_in_state = { state = 268 size > 0 }
						divisions_in_state = { state = 550 size > 0 }
					}
				}
			}
		}
	}

	blow_panama_canal = {

		icon = GFX_decision_generic_ignite_civil_war
		available = {
			has_full_control_of_state = 685
		}

		visible = {
			has_war = yes
			NOT = { has_global_flag = PANAMA_CANAL_BLOCKED }
			any_controlled_state = {
				OR = {
					region = 34
					region = 124
				}
			}
		}

		fire_only_once = no

		days_remove = 30

		cost = 75

		modifier = {
			civilian_factory_use = 5
		}

		complete_effect = {
			hidden_effect = {
				if = {
					limit = {
						NOT = {
							owns_state = 685
						}
					}
					random_country = {
						limit = {
							owns_state = 685
						}
						country_event = { id = generic.13 days = 1 }
					}
				}
			}
		}

		remove_effect = {
			if = {
				limit = {
					OR = {
						has_full_control_of_state = 685
						has_full_control_of_state = 304
						has_full_control_of_state = 937
					}
				}
				set_country_flag = blew_up_panama
				set_global_flag = PANAMA_CANAL_BLOCKED
				# country_event = { id = wtt_news.41 hours = 6}
				news_event = { id = wtt_news.41 hours = 6 } # R56
			}
			effect_tooltip = {
				if = {
					limit = {
						USA = { owns_state = 685 }
					}
					add_war_support = -0.05
					add_stability = -0.05
				}
			}
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0 # Don't blow up the canal as USA. Ever.
				tag = USA
			}
			modifier = {
				factor = 0 # Don't blow up the canal if enemies have weak navies but you are a strong naval power
				has_navy_size = {
					size > 50
				}
				NOT = {
					any_enemy_country = {
						has_navy_size = {
							size > 50
						}
					}
				}
			}
			modifier = {
				factor = 200 # Always blow up the canal as JAP or GER when at war with USA (priority)
				OR = {
					is_in_faction_with = JAP
					is_in_faction_with = GER
				}
				has_war_with = USA
			}
		}
	}
}

special_projects = {

	rebuild_suez_canal = {

		icon = generic_factory

		available = {
			has_full_control_of_state = 995
			has_full_control_of_state = 911
			num_of_civilian_factories > 15
		}

		visible = {
			has_global_flag = SUEZ_CANAL_BLOCKED
		}

		fire_only_once = no

		days_remove = 365

		cost = 120

		modifier = {
			civilian_factory_use = 15
		}

		remove_effect = {
			if = {
				limit = {
					has_full_control_of_state = 995
					has_full_control_of_state = 911
				}
				set_country_flag = rebuilt_suez
				clr_global_flag = SUEZ_CANAL_BLOCKED
				# country_event = { id = wtt_news.42 hours = 6}
				news_event = { id = wtt_news.42 hours = 6 } # R56
			}
		}

		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0 # Don't bother if your navy is weak AND not ENG
				has_navy_size = { size < 100 }
				NOT = { tag = ENG }
			}
			modifier = {
				factor = 200 # Prioritize if Italy is being invaded and you can't get to the battlefront (no control of Gibraltar strait)
				NOT = {
					OR = {
						has_full_control_of_state = 118
						any_allied_country = {
							has_full_control_of_state = 118
						}
					}
				}
				has_war_with = ITA
				ITA = { surrender_progress > 0.1 }
				has_full_control_of_state = 447
				has_full_control_of_state = 907
				has_full_control_of_state = 453
				has_full_control_of_state = 456
				has_full_control_of_state = 457
				NOT = { has_country_flag = blew_up_suez }
			}
			modifier = {
				factor = 200 # Prioritize if UK
				tag = ENG
			}
			modifier = {
				factor = 10 # Prioritize if not at war
				has_war = no
			}
		}
	}

	rebuild_panama_canal = {

		icon = generic_factory

		available = {
			has_full_control_of_state = 685
			NOT = {
				any_enemy_country = {
					OR = {
						controls_state = 304
						controls_state = 937
					}
				}
			}
			num_of_civilian_factories > 25
		}

		visible = {
			has_global_flag = PANAMA_CANAL_BLOCKED
		}

		fire_only_once = no

		days_remove = 180

		cost = 400

		modifier = {
			civilian_factory_use = 25
		}

		remove_effect = {
			if = {
				limit = {
					has_full_control_of_state = 685
					NOT = {
						any_enemy_country = {
							OR = {
								controls_state = 304
								controls_state = 937
							}
						}
					}
				}
				set_country_flag = rebuilt_panama
				clr_global_flag = PANAMA_CANAL_BLOCKED
				# country_event = { id = wtt_news.43 hours = 6 }
				news_event = { id = wtt_news.43 hours = 6 }	# R56
			}
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0 # Don't bother if your navy is weak AND not USA
				has_navy_size = { size < 50 }
				NOT = { tag = USA }
				has_war = yes
			}
			modifier = {
				factor = 200 # Prioritize if you decisively beat USA's navy
				has_war_with = USA
				USA = { has_navy_size = { size < 50 } }
				has_navy_size = { size > 100 }
			}
			modifier = {
				factor = 200 # Prioritize if USA
				tag = USA
			}
			modifier = {
				factor = 10 # Prioritize if not at war
				has_war = no
			}
		}
	}
}

war_measures = {

	emergency_factory_conversion_defensive = {

		icon = generic_industry
		allowed = {
			is_ai1 = yes
		}
		available = {
			num_of_civilian_factories > 5 #Change this if amount of factories change
		}

		visible = {
			has_defensive_war = yes
			has_offensive_war = no
			# num_of_controlled_states > 0			
		}

		fire_only_once = no

		days_re_enable = 90

		cost = 100

		complete_effect = {
			replace_civ_with_arms_factories = yes
			add_war_support = -0.05
		}
		ai_will_do = {
			factor = 0
		}
	}

	emergency_factory_conversion_offensive = {

		icon = generic_industry
		allowed = {
			is_ai1 = yes
		}
		available = {
			num_of_civilian_factories > 5 #Change this if amount of factories change
		}

		visible = {
			has_offensive_war = yes
		}

		fire_only_once = no

		days_re_enable = 90

		cost = 100

		complete_effect = {
			replace_civ_with_arms_factories = yes
			add_war_support = -0.05
			add_stability = -0.03
		}
		ai_will_do = {
			factor = 0
		}
	}

	desperate_defense = {

		icon = generic_prepare_civil_war

		available = {
			surrender_progress > 0.5
		}

		visible = {
			surrender_progress > 0
		}

		fire_only_once = no

		days_remove = 45
		days_re_enable = 360

		cost = 50
		ai_will_do = {
			factor = 1
			modifier = {
				surrender_progress > 0.6
				factor = 10
			}
			modifier = {
				has_capitulated = yes
				factor = 0
			}
		}

		modifier = {
			defence = 0.2
			dig_in_speed_factor = 0.5
		}

		complete_effect = {

		}
	}

	women_in_the_workforce = {

		icon = generic_industry

        allowed = {
            always = yes
        }

        available = {
            has_war = yes
            if = {
				limit = {
					NOT = { original_tag = GER }
				}
            has_idea = tot_economic_mobilisation
			}
			else_if = {
				limit = {
					original_tag = GER
				}
				OR = {
        			has_idea = tot_economic_mobilisation
					has_idea = totaler_krieg_economy
				}
				NOT = { has_completed_focus = GER_womens_rights_and_equality }
			}
            OR = {
                AND = {
                    has_government = democratic
                    has_war_support > 0.79
                }
                AND = {
                    has_government = communism
                    has_war_support > 0.79
                }
                AND = {
                    has_government = fascism
                    OR = {
                        has_war_support > 0.89
                        surrender_progress > 0
                    }
                }
                AND = {
                    has_government = neutrality
                    has_war_support > 0.84
                    has_stability > 0.7
                }
            }
        }
        visible = {
            has_war = yes
            if = {
            	limit = {
            		original_tag = GER
            	}
            	NOT = { has_completed_focus = GER_womens_rights_and_equality }
            }
        }
        cost = 100
        days_remove = -1
        remove_trigger = {
            if = {
            	limit = {
            		original_tag = GER
            	}
				OR = {
					has_war = no
        			AND = {
        				NOT = { has_idea = tot_economic_mobilisation }
        				NOT = { has_idea = totaler_krieg_economy }
        			}
        			has_completed_focus = GER_womens_rights_and_equality
        		}
            }
        	else = {
	        	OR = {
	            	has_war = no
	            	NOT = { has_idea = tot_economic_mobilisation }
	            }
            }
        }
        modifier = {
            conscription = 0.03
            stability_factor = -0.05
        }
        ai_will_do = {
			factor = 1

			modifier = {
				factor = 3
				has_manpower < 100000
			}
		}
		complete_effect = {
			if = {
				limit = {
					tag = CAN
				}
				country_event = { id = canada_vanilla.1 hours = 6 } # Ronnie the Bren Gun Girl
			}
        }
   }

    war_bonds = {

    	icon = hol_attract_foreign_investors

    	allowed = {
            always = yes
        }

        available = {
            has_war = yes
            OR = {
                AND = {
                    has_government = democratic
                    has_war_support > 0.79
                }
                AND = {
                    has_government = communism
                    has_war_support > 0.79
                }
                AND = {
                    has_government = fascism
                    OR = {
                        has_war_support > 0.89
                        surrender_progress > 0
                    }
                }
                AND = {
                    has_government = neutrality
                    has_war_support > 0.84
                    has_stability > 0.7
                }
            }
        }
        visible = {
            has_war = yes
            NOT = { tag = SPC }
        }

        fire_only_once = no

		days_remove = 180

		cost = GER_war_bonds_var?50

		modifier = {
			consumer_goods_factor = -0.15
		}

		ai_will_do = {
			factor = 1
			modifier = {
				has_political_power < 100
				factor = 0 #use as pp dump
			}

			modifier = {
				factor = 0
				original_tag = SOV
				SOV_save_pp_for_manpower_trouble = yes
			}
		}

		remove_effect = {

		}

		complete_effect = {
			if = {
				limit = {
					check_variable = {
						var = GER_war_bonds_var
						value = 50
						compare = less_than
					}
				}
				set_variable = {
					var = GER_war_bonds_var
					value = 50
				}
			}
			add_to_variable = {
				var = GER_war_bonds_var
				value = 25
			}
			if = {
				limit = {
					check_variable = {
						var = GER_war_bonds_var
						value = 100
						compare = greater_than_or_equals
					}
					check_variable = {
						var = GER_war_bonds_war_support_var
						value = -0.025
						compare = greater_than
					}
				}
				set_variable = {
					var = GER_war_bonds_war_support_var
					value = -0.025
				}
			}
			if = {
				limit = {
					check_variable = {
						var = GER_war_bonds_war_support_var
						value = -0.025
						compare = less_than_or_equals
					}
				}
				add_to_variable = {
					var = GER_war_bonds_war_support_var
					value = -0.025
				}
				add_war_support = GER_war_bonds_war_support_var
			}
		}
    }

	diversify_special_forces = {

		icon = GFX_decision_generic_military

		allowed = {
			has_dlc = "Arms Against Tyranny"
			NOT = {	#r56 note: moved here from visible, some majors dont have this unlock ported yet
				original_tag = SOV
				AND = {
					has_dlc = "Trial of Allegiance"
					OR = {
						original_tag = CHL
						original_tag = BRA
						original_tag = ARG
						#original_tag = URG #currently uses R56 tree, but might be supplemented with DLC branches
						original_tag = PAR
					}
				}
			}
		}

		available = {
			date > 1940.1.1
		}

		visible = {
			date > 1939.1.1		#R56 addition - avoid long lists of unavailable decisions
		}

		fire_only_once = yes

		cost = 50

		complete_effect = {
			add_potential_special_forces_tree = yes
		}
		ai_will_do = {
			factor = 201
			modifier = {
				factor = 0
				is_major = no
			}
		}
	}
	
}

foreign_politics = {
	object_to_attaches = {

        cost = 50
        fire_only_once = no

        days_re_enable = 30

        available = {
        }

        visible = {
        	FROM = {
        		NOT = { has_country_flag = rejected_withdrawing_attache }
        		NOT = { has_country_flag = rejected_withdrawing_attache@ROOT }
        		NOT = { has_country_flag = object_attache_going_on }
        	}
        	has_war = yes
        	has_capitulated = no
        	NOT = { has_war_with = FROM }
        	any_enemy_country = {
				has_attache_from = FROM
			}
			NOT = {
				AND = {
					original_tag = SPR
					has_completed_focus = SPR_regional_defense_council_of_aragon
				}
			}
		}

		target_root_trigger = {
			has_war = yes
			has_capitulated = no
		}

		target_trigger = {
			NOT = { has_war_with = FROM }
			#FROM = { has_sent_attache = yes } # Make such trigger to optimize if it becomes a performance problem again.
			any_enemy_country = {
				has_attache_from = FROM
			}
		}

        complete_effect = {
			FROM = { country_event = { id = generic.14 hours = 6 } }
			hidden_effect = {
				FROM = { set_country_flag = object_attache_going_on }
			}
		}
		ai_will_do = {
			factor = 0.1
		}
	}
}

economy_decisions = {

	infrastructure_building_slot = {

		icon = generic_construction

        allowed = {
            always = yes
        }

        cost = 100
        fire_only_once = no

        days_re_enable = 30

		available = {
		}

		visible = {
			any_owned_state = {
				NOT = { has_state_flag = infrastructure_building_slot_flag }
				
				free_building_slots = {
					building = infrastructure
					size < 1
				}
			}
		}

        complete_effect = {
			random_owned_state = {
				limit = {
					is_fully_controlled_by = ROOT
            		free_building_slots = {
						building = industrial_complex
						size > 1
						include_locked = yes
					}
					free_building_slots = {
						building = infrastructure
						size < 1
					}
					NOT = { has_state_flag = infrastructure_building_slot_flag }
				}
				add_extra_state_shared_building_slots = 1
				set_state_flag = infrastructure_building_slot_flag
			}
		}
		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				any_owned_state = { free_building_slots = { building = industrial_complex size < 1 include_locked = no } }
			}
		}
    }

    war_building_slot = {

    	icon = generic_construction

        allowed = {
            always = yes
        }

        cost = 50
        fire_only_once = no

        available = {
            has_war = yes
            any_owned_state = {
            	NOT = { has_state_flag = war_building_slot_flag }
            	is_fully_controlled_by = ROOT
            }
        }

        visible = {
			has_war = yes
			any_owned_state = {
				NOT = { has_state_flag = war_building_slot_flag }
				is_fully_controlled_by = ROOT
			}
		}

        complete_effect = {
        	add_war_support = -0.025
			add_stability = -0.025
			if = {
				limit = {
					any_owned_state = {
						is_fully_controlled_by = ROOT
            			free_building_slots = {
							building = industrial_complex
							size > 1
							include_locked = yes
						}
						NOT = { has_state_flag = war_building_slot_flag }
						infrastructure > 4
					}
				}
				random_owned_state = {
					limit = {
						is_fully_controlled_by = ROOT
            			free_building_slots = {
							building = industrial_complex
							size > 1
							include_locked = yes
						}
						NOT = { has_state_flag = war_building_slot_flag }
						infrastructure > 4
					}
					add_extra_state_shared_building_slots = 1
					set_state_flag = war_building_slot_flag
				}
			}
			else_if = {
				limit = {
					any_owned_state = {
						is_fully_controlled_by = ROOT
            			free_building_slots = {
							building = industrial_complex
							size > 1
							include_locked = yes
						}
						NOT = { has_state_flag = war_building_slot_flag }
						infrastructure > 2
					}
				}
				random_owned_state = {
					limit = {
						is_fully_controlled_by = ROOT
            			free_building_slots = {
							building = industrial_complex
							size > 1
							include_locked = yes
						}
						NOT = { has_state_flag = war_building_slot_flag }
						infrastructure > 2
					}
					add_extra_state_shared_building_slots = 1
					set_state_flag = war_building_slot_flag
				}
			}
			else = {
				random_owned_state = {
					limit = {
						is_fully_controlled_by = ROOT
            			free_building_slots = {
							building = industrial_complex
							size > 1
							include_locked = yes
						}
						NOT = { has_state_flag = war_building_slot_flag }
						infrastructure > 4
					}
					add_extra_state_shared_building_slots = 1
					set_state_flag = war_building_slot_flag
				}
			}
		}
		ai_will_do = {
			base = 0
			modifier = {
				factor = 10
				all_owned_state = { free_building_slots = { building = industrial_complex size < 1 include_locked = no } }
			}
			modifier = {
				any_owned_state = {
					infrastructure > 3
					free_building_slots = { building = industrial_complex size > 0 include_locked = no }
				}
				factor = 0
			}
		}
    }
}

foreign_support = {

###  #  # ###  #   #  ##      ###   ##   ##  ###
#  # #  # #  # ## ## #  #     #  # #  # #  # #  #
###  #  # ###  # # # ####     ###  #  # #### #  #
#  # #  # #  # #   # #  #     #  # #  # #  # #  #
###   ##  #  # #   # #  #     #  #  ##  #  # ###

	 ##  #    ##   ## ###
	#  # #   #  # #   #
	#    #   #  #  #  ##
	#  # #   #  #   # #
	 ##  ###  ##  ##  ###

	CHI_close_burma_road = {

		allowed = {
			#Everyone
		}

		available = {
			OR = {
				AND = {
					288 = { #Burma
						has_state_flag = CHI_needed_for_burma_road
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
				AND = {
					325 = { #Yunnan
						has_state_flag = CHI_needed_for_burma_road
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
				AND = {
					640 = { #Mandalay
						has_state_flag = CHI_needed_for_burma_road
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
			}
		}

		visible = {
			is_subject = no
			# NOT = {
			# 	OR = {
			# 		has_subject = CHI
			# 		has_war_with = CHI
			# 	}
			# }
			OR = {
				AND = {
					288 = { #Burma
						has_state_flag = CHI_needed_for_burma_road
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
				AND = {
					325 = { #Yunnan
						has_state_flag = CHI_needed_for_burma_road
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
				AND = {
					640 = { #Mandalay
						has_state_flag = CHI_needed_for_burma_road
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
			}
			any_other_country = {
				check_variable = { CHI_burma_road_current_level > 0 }
				NOT = { is_in_faction_with = ROOT }
			}
		}

		fire_only_once = no

		cost = 0

		# modifier = {

		# }

		ai_will_do = {
			base = 1
			modifier = {
				factor = 0
				any_country = {
					check_variable = { CHI_burma_road_current_level > 0 }
					OR = {
						is_subject = no
						is_subject_of = ROOT
						is_in_faction_with = ROOT
					}
					NOT = { has_war_with = ROOT }
				}
			}
			modifier = {
				factor = 200
				any_country = {
					check_variable = { CHI_burma_road_current_level > 0 }
					OR = {
						has_war_with = ROOT
						AND = {
							is_subject = yes
							NOT = { is_subject_of = ROOT }
							NOT = { is_in_faction_with = ROOT }
						}
					}
				}
			}
		}

		complete_effect = {
			hidden_effect = {
				every_state = {
					limit = {
						has_state_flag = CHI_needed_for_burma_road
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
					set_state_flag = CHI_burma_road_closed_state
				}
			}
			random_country = {
				#Country that had the route
				limit = { check_variable = { CHI_burma_road_current_level > 0 } }
				hidden_effect = {
					set_variable = { tempvar = 0 }
					subtract_from_variable = { var = tempvar value = CHI_burma_road_current_level }

					add_offsite_building = { type = arms_factory level = tempvar }
					#In case we need to reopen
					set_variable = { CHI_burma_road_closed_level = CHI_burma_road_current_level }
					set_variable = { CHI_burma_road_current_level = 0 }
					clear_variable = tempvar
				}
				country_event = { id = wtt_burma_road.2 }
				custom_effect_tooltip = close_burma_road_explanation # Prints the contents of the CHI_burma_road_current_level variable
			}
		}
	}

	###  ###  ##  ###  ### #  #
	#  # #   #  # #  # #   ## #
	###  ##  #  # ###  ##  # ##
	#  # #   #  # #    #   #  #
	#  # ###  ##  #    ### #  #
	CHI_reopen_burma_road = {

		allowed = {
			#Everyone
		}

		available = {
			OR = {
				AND = {
					288 = { #Burma
						has_state_flag = CHI_burma_road_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = {
								is_subject_of = ROOT
							}
						}
					}
				}
				AND = {
					325 = { #Yunnan
						has_state_flag = CHI_burma_road_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = {
								is_subject_of = ROOT
							}
						}
					}
				}
				AND = {
					640 = { #Mandalay
						has_state_flag = CHI_burma_road_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = {
								is_subject_of = ROOT
							}
						}
					}
				}
			}
		}

		visible = {
			is_subject = no
			# NOT = {
			# 	OR = {
			# 		has_subject = CHI
			# 		has_war_with = CHI
			# 	}
			# }
			OR = {
				AND = {
					288 = { #Burma
						has_state_flag = CHI_burma_road_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = {
								OR = {
									is_subject_of = ROOT
									check_variable = { CHI_burma_road_closed_level > 0 }
								}
							}
						}
					}
				}
				AND = {
					325 = { #Yunnan
						has_state_flag = CHI_burma_road_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = {
								OR = {
									is_subject_of = ROOT
									check_variable = { CHI_burma_road_closed_level > 0 }
								}
							}
						}
					}
				}
				AND = {
					640 = { #Mandalay
						has_state_flag = CHI_burma_road_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = {
								OR = {
									is_subject_of = ROOT
									check_variable = { CHI_burma_road_closed_level > 0 }
								}
							}
						}
					}
				}
			}
			any_country = {
				check_variable = { CHI_burma_road_closed_level > 0 }
				NOT = { has_war_with = ROOT }
			}
		}

		fire_only_once = no

		cost = 0

		# modifier = {

		# }

		ai_will_do = {
			base = 1
			modifier = {
				factor = 200
				any_country = {
					check_variable = { CHI_burma_road_closed_level > 0 }
					OR = {
						is_subject = no
						is_subject_of = ROOT
						is_in_faction_with = ROOT
					}
					NOT = { has_war_with = ROOT }
				}
			}
			modifier = {
				factor = 0
				any_country = {
					check_variable = { CHI_burma_road_closed_level > 0 }
					OR = {
						has_war_with = ROOT
						AND = {
							is_subject = yes
							NOT = { is_subject_of = ROOT }
							NOT = { is_in_faction_with = ROOT }
						}
					}
				}
			}
		}

		complete_effect = {
			every_state = {
				limit = {
					has_state_flag = CHI_burma_road_closed_state
					OR = {
						is_controlled_by = ROOT
						CONTROLLER = {
							OR = {
								is_subject_of = ROOT
								check_variable = { CHI_burma_road_closed_level > 0 }
							}
						}
					}
				}
				custom_effect_tooltip = CHI_burma_road_reopen_state
				clr_state_flag = CHI_burma_road_closed_state
			}

			random_country = {
				limit = { check_variable = { CHI_burma_road_closed_level > 0 } }
				if = {
					limit = {
						any_state = {
							has_state_flag = CHI_burma_road_closed_state
							NOT = { is_controlled_by = ROOT }
							CONTROLLER = {
								NOT = { is_subject_of = ROOT }
								NOT = { check_variable = { CHI_burma_road_closed_level > 0 } }
							}
						}
					}
					country_event = { id = wtt_burma_road.3 } #We opened our part of the road
				}
				else = {
					#Road is fully reopened
					if = {
						limit = { NOT = { tag = ROOT } }
						country_event = { id = wtt_burma_road.4 }
					}
					hidden_effect = {
						add_offsite_building = { type = arms_factory level = CHI_burma_road_closed_level }
						set_variable = { CHI_burma_road_current_level = CHI_burma_road_closed_level }
						clear_variable = CHI_burma_road_closed_level
					}
					custom_effect_tooltip = reopen_burma_road_explanation # Prints the contents of the CHI_burma_road_closed_level variable
				}
			}
		}
	}

#   ### ###   ##      ###   ##   ##  ###
#   #   #  # #  #     #  # #  # #  # #  #
#   ##  #  # #  #     ###  #  # #### #  #
#   #   #  # #  #     #  # #  # #  # #  #
### ### ###   ##      #  #  ##  #  # ###


	 ##  #    ##   ## ###
	#  # #   #  # #   #
	#    #   #  #  #  ##
	#  # #   #  #   # #
	 ##  ###  ##  ##  ###

	CHI_close_ledo_road = {

		allowed = {
			#Everyone
		}

		available = {
			OR = {
				AND = {
					432 = { #Assam
						has_state_flag = CHI_needed_for_ledo_road
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
				AND = {
					325 = { #Yunnan
						has_state_flag = CHI_needed_for_ledo_road
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
				AND = {
					640 = { #Mandalay
						has_state_flag = CHI_needed_for_ledo_road
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
			}
		}

		visible = {
			is_subject = no
			# NOT = {
			# 	OR = {
			# 		has_subject = CHI
			# 		has_war_with = CHI
			# 	}
			# }
			OR = {
				AND = {
					432 = { #Assam
						has_state_flag = CHI_needed_for_ledo_road
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
				AND = {
					325 = { #Yunnan
						has_state_flag = CHI_needed_for_ledo_road
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
				AND = {
					640 = { #Mandalay
						has_state_flag = CHI_needed_for_ledo_road
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
			}
			any_other_country = {
				check_variable = { CHI_ledo_road_current_level > 0 }
				NOT = { is_in_faction_with = ROOT }
			}
		}

		fire_only_once = no

		cost = 0

		# modifier = {

		# }

		ai_will_do = {
			base = 1
			modifier = {
				factor = 0
				any_country = {
					check_variable = { CHI_ledo_road_current_level > 0 }
					OR = {
						is_subject = no
						is_subject_of = ROOT
						is_in_faction_with = ROOT
					}
					NOT = { has_war_with = ROOT }
				}
			}
			modifier = {
				factor = 200
				any_country = {
					check_variable = { CHI_ledo_road_current_level > 0 }
					OR = {
						has_war_with = ROOT
						AND = {
							is_subject = yes
							NOT = { is_subject_of = ROOT }
							NOT = { is_in_faction_with = ROOT }
						}
					}
				}
			}
		}

		complete_effect = {
			hidden_effect = {
				every_state = {
					limit = {
						has_state_flag = CHI_needed_for_ledo_road
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
					set_state_flag = CHI_ledo_road_closed_state
				}
			}
			random_country = {
				#Country that had the route
				limit = { check_variable = { CHI_ledo_road_current_level > 0 } }
				hidden_effect = {
					set_variable = { tempvar = 0 }
					subtract_from_variable = { var = tempvar value = CHI_ledo_road_current_level }

					add_offsite_building = { type = arms_factory level = tempvar }
					#In case we need to reopen
					set_variable = { CHI_ledo_road_closed_level = CHI_ledo_road_current_level }
					set_variable = { CHI_ledo_road_current_level = 0 }
					clear_variable = tempvar
				}
				country_event = { id = wtt_ledo_road.2 }
				custom_effect_tooltip = close_ledo_road_explanation # Prints the contents of the CHI_ledo_road_current_level variable
			}
		}
	}

	###  ###  ##  ###  ### #  #
	#  # #   #  # #  # #   ## #
	###  ##  #  # ###  ##  # ##
	#  # #   #  # #    #   #  #
	#  # ###  ##  #    ### #  #
	CHI_reopen_ledo_road = {

		allowed = {
			#Everyone
		}

		available = {
			OR = {
				AND = {
					432 = { #Assam
						has_state_flag = CHI_ledo_road_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = {
								is_subject_of = ROOT
							}
						}
					}
				}
				AND = {
					325 = { #Yunnan
						has_state_flag = CHI_ledo_road_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = {
								is_subject_of = ROOT
							}
						}
					}
				}
				AND = {
					640 = { #Mandalay
						has_state_flag = CHI_ledo_road_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = {
								is_subject_of = ROOT
							}
						}
					}
				}
			}
		}

		visible = {
			is_subject = no
			# NOT = {
			# 	OR = {
			# 		has_subject = CHI
			# 		has_war_with = CHI
			# 	}
			# }
			OR = {
				AND = {
					432 = { #Assam
						has_state_flag = CHI_ledo_road_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = {
								OR = {
									is_subject_of = ROOT
									check_variable = { CHI_ledo_road_closed_level > 0 }
								}
							}
						}
					}
				}
				AND = {
					325 = { #Yunnan
						has_state_flag = CHI_ledo_road_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = {
								OR = {
									is_subject_of = ROOT
									check_variable = { CHI_ledo_road_closed_level > 0 }
								}
							}
						}
					}
				}
				AND = {
					640 = { #Mandalay
						has_state_flag = CHI_ledo_road_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = {
								OR = {
									is_subject_of = ROOT
									check_variable = { CHI_ledo_road_closed_level > 0 }
								}
							}
						}
					}
				}
			}
			any_country = {
				check_variable = { CHI_ledo_road_closed_level > 0 }
				NOT = { has_war_with = ROOT }
			}
			any_state = {
				has_state_flag = CHI_ledo_road_closed_state
				OR = {
					is_controlled_by = ROOT
					CONTROLLER = {
						OR = {
							is_subject_of = ROOT
							check_variable = { CHI_ledo_road_closed_level > 0 }
						}
					}
				}
			}
		}

		fire_only_once = no

		cost = 0

		# modifier = {

		# }

		ai_will_do = {
			base = 1
			modifier = {
				factor = 200
				any_country = {
					check_variable = { CHI_ledo_road_closed_level > 0 }
					OR = {
						is_subject = no
						is_subject_of = ROOT
						is_in_faction_with = ROOT
					}
					NOT = { has_war_with = ROOT }
				}
			}
			modifier = {
				factor = 0
				any_country = {
					check_variable = { CHI_ledo_road_closed_level > 0 }
					OR = {
						has_war_with = ROOT
						AND = {
							is_subject = yes
							NOT = { is_subject_of = ROOT }
							NOT = { is_in_faction_with = ROOT }
						}
					}
				}
			}
		}

		complete_effect = {
			every_state = {
				limit = {
					has_state_flag = CHI_ledo_road_closed_state
					OR = {
						is_controlled_by = ROOT
						CONTROLLER = {
							OR = {
								is_subject_of = ROOT
								check_variable = { CHI_ledo_road_closed_level > 0 }
							}
						}
					}
				}
				custom_effect_tooltip = CHI_ledo_road_reopen_state
				clr_state_flag = CHI_ledo_road_closed_state
			}

			random_country = {
				limit = { check_variable = { CHI_ledo_road_closed_level > 0 } }
				if = {
					limit = {
						any_state = {
							has_state_flag = CHI_ledo_road_closed_state
							NOT = { is_controlled_by = ROOT }
							CONTROLLER = {
								NOT = { is_subject_of = ROOT }
								NOT = { check_variable = { CHI_ledo_road_closed_level > 0 } }
							}
						}
					}
					country_event = { id = wtt_ledo_road.3 } #We opened our part of the road
				}
				else = {
					#Road is fully reopened
					if = {
						limit = { NOT = { tag = ROOT } }
						country_event = { id = wtt_ledo_road.4 }
					}
					hidden_effect = {
						add_offsite_building = { type = arms_factory level = CHI_ledo_road_closed_level }
						set_variable = { CHI_ledo_road_current_level = CHI_ledo_road_closed_level }
						clear_variable = CHI_ledo_road_closed_level
					}
					custom_effect_tooltip = reopen_ledo_road_explanation # Prints the contents of the CHI_ledo_road_closed_level variable
				}
			}
		}
	}

### #  # ###     #  # #  # #   # ###
 #  #  # #       #  # #  # ## ## #  #
 #  #### ##      #### #  # # # # ###
 #  #  # #       #  # #  # #   # #
 #  #  # ###     #  #  ##  #   # #

	 ##  #    ##   ## ###
	#  # #   #  # #   #
	#    #   #  #  #  ##
	#  # #   #  #   # #
	 ##  ###  ##  ##  ###
 	CHI_close_the_hump = {

 		allowed = {
 			#Everyone
 		}

 		available = {
			OR = {
				AND = {
					434 = { #Arunachal Pradesh
						has_state_flag = CHI_needed_for_the_hump
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
				AND = {
					601 = { #Xikang
						has_state_flag = CHI_needed_for_the_hump
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
			}
 		}

 		visible = {
 			is_subject = no
 			# NOT = {
 			# 	OR = {
 			# 		has_subject = CHI
 			# 		has_war_with = CHI
 			# 	}
 			# }
			OR = {
				AND = {
					434 = { #Arunachal Pradesh
						has_state_flag = CHI_needed_for_the_hump
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
				AND = {
					601 = { #Xikang
						has_state_flag = CHI_needed_for_the_hump
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
			}
 			any_other_country = {
 				check_variable = { CHI_the_hump_current_level > 0 }
 				NOT = { is_in_faction_with = ROOT }
 			}
 		}

 		fire_only_once = no

 		cost = 0

 		# modifier = {

 		# }

 		ai_will_do = {
 			base = 1
			modifier = {
				factor = 0
				any_country = {
					check_variable = { CHI_the_hump_current_level > 0 }
					OR = {
						is_subject = no
						is_subject_of = ROOT
						is_in_faction_with = ROOT
					}
					NOT = { has_war_with = ROOT }
				}
			}
			modifier = {
				factor = 200
				any_country = {
					check_variable = { CHI_the_hump_current_level > 0 }
					OR = {
						has_war_with = ROOT
						AND = {
							is_subject = yes
							NOT = { is_subject_of = ROOT }
							NOT = { is_in_faction_with = ROOT }
						}
					}
				}
			}
 		}

 		complete_effect = {
 			hidden_effect = {
 				every_state = {
 					limit = {
 						has_state_flag = CHI_needed_for_the_hump
 						OR = {
 							is_controlled_by = ROOT
 							CONTROLLER = { is_subject_of = ROOT }
 						}
 					}
 					set_state_flag = CHI_the_hump_closed_state
 				}
 			}
 			random_country = {
 				#Country that had the route
 				limit = { check_variable = { CHI_the_hump_current_level > 0 } }
 				hidden_effect = {
 					set_variable = { tempvar = 0 }
 					subtract_from_variable = { var = tempvar value = CHI_the_hump_current_level }

 					add_offsite_building = { type = arms_factory level = tempvar }
 					#In case we need to reopen
 					set_variable = { CHI_the_hump_closed_level = CHI_the_hump_current_level }
 					set_variable = { CHI_the_hump_current_level = 0 }
 					clear_variable = tempvar
 				}
 				country_event = { id = wtt_the_hump.2 }
				custom_effect_tooltip = close_the_hump_explanation # Prints the contents of the CHI_the_hump_current_level variable
 			}
 		}
 	}

 	###  ###  ##  ###  ### #  #
 	#  # #   #  # #  # #   ## #
 	###  ##  #  # ###  ##  # ##
 	#  # #   #  # #    #   #  #
 	#  # ###  ##  #    ### #  #
 	CHI_reopen_the_hump = {

 		allowed = {
 			#Everyone
 		}

 		available = {
			OR = {
				AND = {
					434 = { #Arunachal Pradesh
						has_state_flag = CHI_the_hump_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
				AND = {
					601 = { #Xikang
						has_state_flag = CHI_the_hump_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
			}
 		}

 		visible = {
 			is_subject = no
 			# NOT = {
 			# 	OR = {
 			# 		has_subject = CHI
 			# 		has_war_with = CHI
 			# 	}
 			# }
			OR = {
				AND = {
					434 = { #Arunachal Pradesh
						has_state_flag = CHI_the_hump_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = {
								OR = {
									is_subject_of = ROOT
									check_variable = { CHI_the_hump_closed_level > 0 }
								}
							}
						}
					}
				}
				AND = {
					601 = { #Xikang
						has_state_flag = CHI_the_hump_closed_state
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = {
								OR = {
									is_subject_of = ROOT
									check_variable = { CHI_the_hump_closed_level > 0 }
								}
							}
						}
					}
				}
			}
 			any_country = {
 				check_variable = { CHI_the_hump_closed_level > 0 }
 				NOT = { has_war_with = ROOT }
 			}
 		}

 		fire_only_once = no

 		cost = 0

 		# modifier = {

 		# }

 		ai_will_do = {
 			base = 1
			modifier = {
				factor = 200
				any_country = {
					check_variable = { CHI_the_hump_closed_level > 0 }
					OR = {
						is_subject = no
						is_subject_of = ROOT
						is_in_faction_with = ROOT
					}
					NOT = { has_war_with = ROOT }
				}
			}
			modifier = {
				factor = 0
				any_country = {
					check_variable = { CHI_the_hump_closed_level > 0 }
					OR = {
						has_war_with = ROOT
						AND = {
							is_subject = yes
							NOT = { is_subject_of = ROOT }
							NOT = { is_in_faction_with = ROOT }
						}
					}
				}
			}
 		}

 		complete_effect = {
 			every_state = {
 				limit = {
 					has_state_flag = CHI_the_hump_closed_state
 					OR = {
 						is_controlled_by = ROOT
 						CONTROLLER = {
 							OR = {
 								is_subject_of = ROOT
 								check_variable = { CHI_the_hump_closed_level > 0 }
 							}
 						}
 					}
 				}
 				custom_effect_tooltip = CHI_the_hump_reopen_state
 				clr_state_flag = CHI_the_hump_closed_state
 			}

 			random_country = {
 				limit = { check_variable = { CHI_the_hump_closed_level > 0 } }
 				if = {
 					limit = {
 						any_state = {
 							has_state_flag = CHI_the_hump_closed_state
 							NOT = { is_controlled_by = ROOT }
 							CONTROLLER = {
 								NOT = { is_subject_of = ROOT }
 								NOT = { check_variable = { CHI_the_hump_closed_level > 0 } }
 							}
 						}
 					}
 					country_event = { id = wtt_the_hump.3 } #We opened our part of the road
 				}
 				else = {
 					#Road is fully reopened
 					if = {
 						limit = { NOT = { tag = ROOT } }
 						country_event = { id = wtt_the_hump.4 }
 					}
 					hidden_effect = {
 						add_offsite_building = { type = arms_factory level = CHI_the_hump_closed_level }
 						set_variable = { CHI_the_hump_current_level = CHI_the_hump_closed_level }
 						clear_variable = CHI_the_hump_closed_level
 					}
					custom_effect_tooltip = reopen_the_hump_explanation # Prints the contents of the CHI_the_hump_closed_level variable
 				}
 			}
 		}
 	}


#  #  ##  #  #  ##  ###     ###   ##  #  # ### ###
#  # #  # ## # #  #  #      #  # #  # #  #  #  #
#### #### # ## #  #  #      ###  #  # #  #  #  ##
#  # #  # #  # #  #  #      #  # #  # #  #  #  #
#  # #  # #  #  ##  ###     #  #  ##   ##   #  ###

	 ##  #    ##   ## ###
	#  # #   #  # #   #
	#    #   #  #  #  ##
	#  # #   #  #   # #
	 ##  ###  ##  ##  ###

	CHI_close_hanoi_route = {

		allowed = {
			#Everyone
		}

		available = {
			OR = {
				AND = {
					671 = { #Tonkin
						has_state_flag = CHI_needed_for_hanoi_route
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
				AND = {
					325 = { #Yunnan
						has_state_flag = CHI_needed_for_hanoi_route
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
			}
		}

		visible = {
			is_subject = no
			# NOT = {
			# 	OR = {
			# 		has_subject = CHI
			# 		has_war_with = CHI
			# 	}
			# }
			OR = {
				AND = {
					671 = { #Tonkin
						has_state_flag = CHI_needed_for_hanoi_route
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
				AND = {
					325 = { #Yunnan
						has_state_flag = CHI_needed_for_hanoi_route
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
				}
			}
			any_other_country = {
				check_variable = { CHI_hanoi_route_current_level > 0 }
				NOT = { is_in_faction_with = ROOT }
			}
		}

		fire_only_once = no

		cost = 0

		# modifier = {

		# }

		ai_will_do = {
			base = 1
			modifier = {
				factor = 0
				any_country = {
					check_variable = { CHI_hanoi_route_current_level > 0 }
					OR = {
						is_subject = no
						is_subject_of = ROOT
						is_in_faction_with = ROOT
					}
					NOT = { has_war_with = ROOT }
				}
			}
			modifier = {
				factor = 200
				any_country = {
					check_variable = { CHI_hanoi_route_current_level > 0 }
					OR = {
						has_war_with = ROOT
						AND = {
							is_subject = yes
							NOT = { is_subject_of = ROOT }
							NOT = { is_in_faction_with = ROOT }
						}
					}
				}
			}
		}

		complete_effect = {
			hidden_effect = {
				every_state = {
					limit = {
						has_state_flag = CHI_needed_for_hanoi_route
						OR = {
							is_controlled_by = ROOT
							CONTROLLER = { is_subject_of = ROOT }
						}
					}
					set_state_flag = CHI_hanoi_route_closed_state
				}
			}
			random_country = {
				#Country that had the route
				limit = { check_variable = { CHI_hanoi_route_current_level > 0 } }
				hidden_effect = {
					set_variable = { tempvar = 0 }
					subtract_from_variable = { var = tempvar value = CHI_hanoi_route_current_level }

					add_offsite_building = { type = arms_factory level = tempvar }
					#In case we need to reopen
					set_variable = { CHI_hanoi_route_closed_level = CHI_hanoi_route_current_level }
					set_variable = { CHI_hanoi_route_current_level = 0 }
					clear_variable = tempvar
				}
				country_event = { id = wtt_hanoi_route.2 }
				custom_effect_tooltip = close_hanoi_route_explanation # Prints the contents of the CHI_hanoi_route_current_level variable
			}
		}
	}
}

generic_purchase_old_ships_category = {
	purchase_ships_eng = {
		cost = 50
		icon = GFX_decision_generic_naval
		fire_only_once = no
		visible = {
			has_country_flag = generic_purchase_old_ships_flag
			ENG = { 
				NOT = { 
					has_country_flag = sold_ships_to_us@ROOT
					has_country_flag = negotiating_ship_purchase_flag@ROOT 
				}
			}
			NOT = { has_war_with = ENG}
		}
		available = {
			NOT = {
				ENG = {
					OR = {
						has_civil_war = yes
						has_capitulated = yes
						has_opinion = {
							target = FROM
							value < 30
						}
					}					
				}
			}
			
		}
		days_remove = 14
		remove_effect = {
			ENG = {
				country_event = {
					id = generic_purchase_ships_events.01
					hours = 1
				}
				set_country_flag = negotiating_ship_purchase_flag@ROOT
			}			
		}
	}
	purchase_ships_sov = {
		cost = 50
		icon = GFX_decision_generic_naval
		fire_only_once = no
		visible = {
			has_country_flag = generic_purchase_old_ships_flag
			SOV = { 
					has_country_flag = sold_ships_to_us@ROOT
					has_country_flag = negotiating_ship_purchase_flag@ROOT 
			}

			NOT = { has_war_with = SOV}
		}
		available = {
			NOT = {
				SOV = {
					OR = {
						has_civil_war = yes
						has_capitulated = yes
						has_opinion = {
							target = FROM
							value < 30
						}
					}					
				}
			}
			
		}
		days_remove = 14
		remove_effect = {
			SOV = {
				country_event = {
					id = generic_purchase_ships_events.01
					hours = 1
				}
				set_country_flag = negotiating_ship_purchase_flag@ROOT
			}
		}
	}
	purchase_ships_ger = {
		cost = 50
		icon = GFX_decision_generic_naval
		fire_only_once = no
		visible = {
			has_country_flag = generic_purchase_old_ships_flag
			GER = { 
				NOT = { 
					has_country_flag = sold_ships_to_us@ROOT
					has_country_flag = negotiating_ship_purchase_flag@ROOT
				}

			}
			NOT = { has_war_with = GER}
		}
		available = {
			NOT = {
				GER = {
					OR = {
						has_civil_war = yes
						has_capitulated = yes
						has_opinion = {
							target = FROM
							value < 30
						}
					}					
				}
			}
			
		}
		days_remove = 14
		remove_effect = {
			GER = {
				country_event = {
					id = generic_purchase_ships_events.01
					hours = 1
				}
				set_country_flag = negotiating_ship_purchase_flag@ROOT
			}
		}
	}
	purchase_ships_usa = {
		cost = 50
		icon = GFX_decision_generic_naval
		fire_only_once = no
		visible = {
			has_country_flag = generic_purchase_old_ships_flag
			USA = { 
				NOT = { 
					has_country_flag = sold_ships_to_us@ROOT
					has_country_flag = negotiating_ship_purchase_flag@ROOT  
				}
			}
			NOT = { has_war_with = USA}
		}
		available = {
			NOT = {
				USA = {
					OR = {
						has_civil_war = yes
						has_capitulated = yes
						has_opinion = {
							target = FROM
							value < 30
						}
					}					
				}
			}
			
		}
		days_remove = 14
		remove_effect = {
			USA = {
				country_event = {
					id = generic_purchase_ships_events.01
					hours = 1
				}
				set_country_flag = negotiating_ship_purchase_flag@ROOT
			}
		}
	}
}

generic_refit_civilian_ships_category = {
	refit_to_destroyer = {
		cost = 15
		icon = GFX_decision_generic_merge_plant_ship
		fire_only_once = no
		visible = {
			has_country_flag = refit_convoy_ships_flag
		}
		available = {	
			has_equipment = {
   				convoy > 9
	  		}	
	  		if = {
				limit = {
					has_dlc = "Man the Guns"
				}
				has_tech = early_ship_hull_light
			}
			else = {
				has_tech = early_destroyer
			}
		}
		days_remove = 50

		complete_effect = {
			add_equipment_to_stockpile = { 
				type = convoy_1
				amount = -10 

			}
		}
		remove_effect = {
			if = {
				limit = {
					has_dlc = "Man the Guns"
				}
				if = {
					limit = {
						NOT = {	has_country_flag = refit_to_destroyer_flag } #FIN gets flag along with Ship variants via the focus that unlocks these decisions
					}			
					set_country_flag = refit_to_destroyer_flag
	
					create_equipment_variant = {	
						name = "Refitted Destroyer Class" 		
						type = ship_hull_light_1
						name_group = "DEN_DD_HISTORICAL" #Note: Doesn't matter if ROOT is not DEN, the effect will grab the appropriate country-specific name list anyways
						parent_version = 0
						modules = {
							fixed_ship_battery_slot = ship_light_battery_1
							fixed_ship_anti_air_slot = ship_anti_air_1
							fixed_ship_fire_control_system_slot = ship_fire_control_system_0
							fixed_ship_radar_slot = empty
							fixed_ship_engine_slot = light_ship_engine_1
							fixed_ship_torpedo_slot = ship_torpedo_1
							mid_1_custom_slot = empty
							rear_1_custom_slot = empty
						}
						obsolete = yes
					}
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Refitted Destroyer Class"
					creator = ROOT
					name = "Coastguard"
				}
			}
			#NO MTG
			else = {
				if = {
					limit = {
						NOT = {	has_country_flag = refit_to_destroyer_flag }
					}			
					set_country_flag = refit_to_destroyer_flag

					create_equipment_variant = {
						name = "Refitted Destroyer Class"
						type = destroyer_1
						upgrades = {
							ship_torpedo_upgrade = 0
							destroyer_engine_upgrade = 0
							ship_ASW_upgrade = 0
							ship_anti_air_upgrade = 0
						}
						obsolete = yes
					}
				}
				create_ship = {
					type = destroyer_1
					equipment_variant = "Refitted Destroyer Class"
					creator = ROOT
					name = "Coastguard"
				}		
			}
		}
	}
	refit_to_cruiser = {
		cost = 30
		icon = GFX_decision_generic_merge_plant_ship
		fire_only_once = no
		visible = {
			has_country_flag = refit_convoy_ships_flag
		}
		available = {	
			has_equipment = {
   				convoy > 19
	  		}
	  		if = {
				limit = {
					has_dlc = "Man the Guns"
				}
				has_tech = early_ship_hull_cruiser
			}
			else = {
				has_tech = early_light_cruiser
			}
		}
		days_remove = 100

		complete_effect = {
			add_equipment_to_stockpile = { 
				type = convoy_1
				amount = -25 
			}
		}
		remove_effect = {
			if = {
				limit = {
					has_dlc = "Man the Guns"
				}
				if = {
					limit = {
						NOT = {	has_country_flag = refit_to_cruiser_flag } #FIN gets flag along with Ship variants via the focus that unlocks these decisions
					}			
					set_country_flag = refit_to_cruiser_flag
	
					create_equipment_variant = {
						name = "Refitted Cruiser Class"				
						type = ship_hull_cruiser_1
						name_group = DEN_CL_HISTORICAL #Note: Doesn't matter if ROOT is not DEN, the effect will grab the appropriate country-specific name list anyways
						parent_version = 0
						modules = {
							fixed_ship_battery_slot = ship_light_medium_battery_1
							fixed_ship_anti_air_slot = ship_anti_air_1
							fixed_ship_fire_control_system_slot = ship_fire_control_system_0
							fixed_ship_radar_slot = empty
							fixed_ship_engine_slot = cruiser_ship_engine_1
							fixed_ship_armor_slot = ship_armor_cruiser_1
							fixed_ship_secondaries_slot = dp_ship_secondaries_1
							mid_1_custom_slot = empty
							mid_2_custom_slot = empty
							rear_1_custom_slot = empty
						}
						obsolete = yes
					}
				}
				create_ship = {
					type = ship_hull_cruiser_1
					equipment_variant = "Refitted Cruiser Class"
					creator = ROOT
					name = "Protector"
				}
			}
			else = {
				if = {
					limit = {
						NOT = {	has_country_flag = refit_to_cruiser_flag }
					}			
					set_country_flag = refit_to_cruiser_flag

					create_equipment_variant = {
						name = "Refitted Cruiser Class"
						type = light_cruiser_1
						upgrades = {
							ship_reliability_upgrade = 0
							ship_engine_upgrade = 0
							ship_gun_upgrade = 0
							ship_anti_air_upgrade = 0
						}
						obsolete = yes
					}
				}
				create_ship = {
					type = light_cruiser_1
					equipment_variant = "Refitted Cruiser Class"
					creator = ROOT
					name = "Protector"
				}	
			}
		}
	}
}