#Category only allowed for GER
GER_mefo_bills_category = {

	GER_mefo_bills_mission = {

		allowed = { always = no }

		icon = ger_mefo_bills

		available = {
			NOT = { has_government = democratic }
			GER_can_delay_mefo_payment = yes
			has_political_power > 0
			hidden_trigger = { always = no }
		}

		#cost = GER_mefo_bill_counter?10

		days_mission_timeout = 180
		is_good = yes
		fire_only_once = yes

		cancel_trigger = {
			hidden_trigger = {
				OR = {
					NOT = { GER_has_mefo_bills = yes }
					has_idea = GER_mefo_bills_ended
				}
			}
		}

		days_remove = GER_extend_mefo_bills_days?0
		remove_effect = {
		}

		complete_effect = {
		}

		timeout_effect = {
			if = {
				limit = {
					has_country_flag = ger_has_cancelled_mefo
				}
				GER_remove_mefo_bills = yes
				#1
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 15 compare = less_than }
					}
					add_political_power = -20
					add_timed_idea = { idea = GER_mefo_bills_ended days = 60 }
				}
				#2
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 20 compare = equals }
					}
					add_political_power = -40
					add_timed_idea = { idea = GER_mefo_bills_ended days = 80 }
				}
				#3
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 30 compare = equals }
					}
					add_political_power = -60
					add_timed_idea = { idea = GER_mefo_bills_ended days = 100 }
				}
				#4
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 40 compare = equals }
					}
					add_political_power = -80
					add_timed_idea = { idea = GER_mefo_bills_ended days = 120 }
				}
				#5
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 50 compare = equals }
					}
					add_political_power = -100
					add_timed_idea = { idea = GER_mefo_bills_ended days = 140 }
				}
				#6
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 60 compare = equals }
					}
					add_political_power = -120
					add_timed_idea = { idea = GER_mefo_bills_ended days = 160 }
				}
				#7
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 70 compare = equals }
					}
					add_political_power = -140
					add_timed_idea = { idea = GER_mefo_bills_ended days = 180 }
				}
				#8
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 80 compare = equals }
					}
					add_political_power = -160
					add_timed_idea = { idea = GER_mefo_bills_ended days = 200 }
				}
				#9
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 90 compare = equals }
					}
					add_political_power = -180
					add_timed_idea = { idea = GER_mefo_bills_ended days = 220 }
				}
				#10
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 100 compare = equals }
					}
					add_political_power = -200
					add_timed_idea = { idea = GER_mefo_bills_ended days = 240 }
				}
				#11
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 110 compare = equals }
					}
					add_political_power = -220
					add_timed_idea = { idea = GER_mefo_bills_ended days = 260 }
				}
				#12
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 120 compare = equals }
					}
					add_political_power = -240
					add_timed_idea = { idea = GER_mefo_bills_ended days = 280 }
				}
				#13
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 130 compare = equals }
					}
					add_political_power = -260
					add_timed_idea = { idea = GER_mefo_bills_ended days = 300 }
				}
				#14
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 140 compare = equals }
					}
					add_political_power = -280
					add_timed_idea = { idea = GER_mefo_bills_ended days = 320 }
				}
				#15
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 150 compare = equals }
					}
					add_political_power = -300
					add_timed_idea = { idea = GER_mefo_bills_ended days = 340 }
				}
				#16
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 160 compare = equals }
					}
					add_political_power = -320
					add_timed_idea = { idea = GER_mefo_bills_ended days = 360 }
				}
				#17
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 170 compare = equals }
					}
					add_political_power = -340
					add_timed_idea = { idea = GER_mefo_bills_ended days = 380 }
				}
				#18
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 180 compare = equals }
					}
					add_political_power = -360
					add_timed_idea = { idea = GER_mefo_bills_ended days = 400 }
				}
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 180 compare = greater_than }
					}
					add_political_power = -380
					add_timed_idea = { idea = GER_mefo_bills_ended days = 420 }
				}
			}
			else = {
				custom_effect_tooltip = GER_mefo_bills_mission_tt
				custom_effect_tooltip = GER_mefo_bills_effect_in_days
				hidden_effect = {
					set_variable = { GER_extend_mefo_bills_days = days_mission_timeout@GER_mefo_bills_mission }
					set_country_flag = paid_for_mefo
				}
				GER_mefo_bills_level_up = yes
				if = {
					limit = {
						check_variable = { var = GER_mefo_bill_counter value = 15 compare = less_than }
					}
					hidden_effect = { set_variable = { var = GER_mefo_bill_counter value = 10 } }
				}
				add_to_variable = { var = GER_mefo_bill_counter value = 10 }

				hidden_effect = {
					activate_mission = GER_mefo_bills_mission
				}
			}
		}

		ai_will_do = {
			factor = 200
		}
	}

	GER_cancel_mefos = {

		icon = ger_mefo_bills

		available = {
			hidden_trigger = {
				NOT = { has_country_flag = ger_has_cancelled_mefo }
				NOT = {
					OR = {
						NOT = { GER_has_mefo_bills = yes }
						has_idea = GER_mefo_bills_ended
					}
				}
			}
		}

		cost = 0

		fire_only_once = no

		visible = {
			hidden_trigger = {
				NOT = { has_country_flag = ger_has_cancelled_mefo }
				NOT = {
					OR = {
						NOT = { GER_has_mefo_bills = yes }
						has_idea = GER_mefo_bills_ended
					}
				}
			}
		}

		cancel_if_not_visible = yes

		remove_effect = {
			set_country_flag = ger_has_cancelled_mefo
		}

		ai_will_do = {
			factor = 0
		}
	}

	GER_renew_mefos = {

		icon = ger_mefo_bills

		available = {
			hidden_trigger = {
				has_country_flag = ger_has_cancelled_mefo
				NOT = {
					OR = {
						NOT = { GER_has_mefo_bills = yes }
						has_idea = GER_mefo_bills_ended
					}
				}
			}
		}

		cost = 0

		fire_only_once = no

		visible = {
			hidden_trigger = {
				has_country_flag = ger_has_cancelled_mefo
				NOT = {
					OR = {
						NOT = { GER_has_mefo_bills = yes }
						has_idea = GER_mefo_bills_ended
					}
				}
			}
		}

		cancel_if_not_visible = yes

		remove_effect = {
			clr_country_flag = ger_has_cancelled_mefo
		}

		ai_will_do = {
			factor = 200
		}
	}
}

operations = {

	GER_barbarossa_mission = {

		icon = generic_operation

		allowed = {
			always = no
			#added through on_action
		}

		available = {
			219 = { is_controlled_by_ROOT_or_ally = yes }
			195 = { is_controlled_by_ROOT_or_ally = yes }
			202 = { is_controlled_by_ROOT_or_ally = yes }
			217 = { is_controlled_by_ROOT_or_ally = yes }
		}

		days_mission_timeout = 180
		fire_only_once = yes

		activation = {

		}

		is_good = no

		complete_effect = {
			add_war_support = 0.1
			custom_effect_tooltip = barbarossa_mission_tt
		}

		timeout_effect = {

		}

		ai_will_do = {
			factor = 1
		}
	}
}

GER_case_anton_category = {

	GER_case_anton = {

		icon = generic_operation

		available = {
			original_tag = GER
			has_war = yes
			has_government = fascism
			any_country_with_original_tag = {
				original_tag_to_check = FRA
				has_government = fascism
				OR = {
					is_subject_of = GER
					has_focus_tree = vichy_french_focus
				}
				NOT = { has_war_with = GER }
				NOT = { has_country_flag = case_anton }
				custom_trigger_tooltip = {
					tooltip = GER_case_anton_tt2
					count_triggers = {
						amount = 3 # lost control of ca half french north africa
						458 = { CONTROLLER = { has_war_with = ROOT } }
						459 = { CONTROLLER = { has_war_with = ROOT } }
						460 = { CONTROLLER = { has_war_with = ROOT } }
						461 = { CONTROLLER = { has_war_with = ROOT } }
						462 = { CONTROLLER = { has_war_with = ROOT } }
						513 = { CONTROLLER = { has_war_with = ROOT } }
						665 = { CONTROLLER = { has_war_with = ROOT } }
					}
				}
			}
			divisions_in_state = { state = 31 size < 1 }
			divisions_in_state = { state = 25 size < 1 }
			divisions_in_state = { state = 22 size < 1 }
			divisions_in_state = { state = 21 size < 1 }
			divisions_in_state = { state = 851 size < 1 }
			divisions_in_state = { state = 32 size < 1 }
			divisions_in_state = { state = 22 size < 1 }
			divisions_in_state = { state = 26 size < 1 }
			divisions_in_state = { state = 33 size < 1 }
			divisions_in_state = { state = 20 size < 1 }
			OR = {
				ITA = { owns_state = 735 }
				divisions_in_state = { state = 735 size < 1 }
			}
		}

		cost = 50
		fire_only_once = yes

		visible = {
			original_tag = GER
			has_government = fascism
			any_country_with_original_tag = {
				original_tag_to_check = FRA
				has_government = fascism
				OR = {
					is_subject_of = GER
					has_focus_tree = vichy_french_focus
				}
				NOT = { has_war_with = GER }
			}
			is_ai = no
		}
		ai_will_do = {
			factor = 0 #it is better to keep Vichy alive than not

			modifier = {
				factor = 0
				VIC = { is_ai = no }
			}
		}
		complete_effect = {
			custom_effect_tooltip = GER_case_anton_tt
			hidden_effect = {
				random_other_country = {
					limit = {
						original_tag = FRA
						has_government = fascism
						OR = {
							is_subject_of = GER
							has_focus_tree = vichy_french_focus
						}
					}
					set_country_flag = case_anton
					activate_mission = FRA_case_anton_mission
				}
			}
		}
	}
}

#Category only allowed for GER
GER_reichskommissariats = {
	GER_reichskommissariat_norwegen = {

		icon = ger_reichskommissariats

		available = {
			has_completed_focus = GER_form_the_reichskommissariats
			has_government = fascism
			controls_state = 110
			controls_state = 142
			controls_state = 143
			controls_state = 144
			controls_state = 920
			controls_state = 921
			controls_state = 922
			controls_state = 923
			controls_state = 924
			controls_state = 925
		}

		cost = 0
		ai_will_do = {
			factor = 0
			modifier = {
				add = 1
				ENG = { has_capitulated = yes }
			}
		}

		visible = {
			NOT = { has_aat = yes }
			has_completed_focus = GER_form_the_reichskommissariats
			has_government = fascism
		}

		complete_effect = {
			if = {
				limit = {
					country_exists = NOR
					NOT = { NOR = { has_government = fascism } }
				}
				hidden_effect = {
					NOR = {
						set_state_controller = 110
						set_state_controller = 142
						set_state_controller = 143
						set_state_controller = 144
						set_state_controller = 914
						set_state_controller = 920
						set_state_controller = 921
						set_state_controller = 922
						set_state_controller = 923
						set_state_controller = 924
						set_state_controller = 925
					}
				}
				NOR = {
					start_civil_war = {
						ideology = fascism
						size = 1
						transfer_state = 110
						transfer_state = 142
						transfer_state = 143
						transfer_state = 144
						transfer_state = 914
						transfer_state = 920
						transfer_state = 921
						transfer_state = 922
						transfer_state = 923
						transfer_state = 924
						transfer_state = 925
						GER = {
							puppet = PREV
							set_autonomy = { target = PREV autonomy_state = autonomy_integrated_puppet }
						}
						set_cosmetic_tag = NOR_GER_fascism
						create_country_leader = {
							name = "Josef Terboven"
							desc = "POLITICS_JOSEF_TERBOVEN_DESC"
							picture = GFX_portrait_Josef_Terboven
							expire = "1965.1.1"
							ideology = nazism
							traits = {
							}
						}
					}
				}
			}
			else = {
				NOR = {
					transfer_state = 110
					transfer_state = 142
					transfer_state = 143
					transfer_state = 144
					transfer_state = 920
					transfer_state = 921
					transfer_state = 922
					transfer_state = 923
					transfer_state = 924
					transfer_state = 925
					if = {
						limit = {
							GER = {
								controls_state = 914
							}
						}
						transfer_state = 914
					}
					set_cosmetic_tag = NOR_GER_fascism
					create_country_leader = {
						name = "Josef Terboven"
						desc = "POLITICS_JOSEF_TERBOVEN_DESC"
						picture = GFX_portrait_Josef_Terboven
						expire = "1965.1.1"
						ideology = nazism
						traits = {
						}
					}
				}
				set_autonomy = { target = NOR autonomy_state = autonomy_integrated_puppet }
			}
		}
	}

	GER_reichskommissariat_niederlande = {

		icon = ger_reichskommissariats

		available = {
			has_completed_focus = GER_form_the_reichskommissariats
			has_government = fascism
			controls_state = 7
			controls_state = 35
			controls_state = 36
		}

		cost = 0

		ai_will_do = {
			factor = 0
			modifier = {
				add = 1
				ENG = { has_capitulated = yes }
			}
		}

		visible = {
			has_completed_focus = GER_form_the_reichskommissariats
			has_government = fascism
		}

		complete_effect = {
			if = {
				limit = {
					country_exists = HOL
					NOT = { HOL = { has_government = fascism } }
				}
				hidden_effect = {
					HOL = {
						set_state_controller = 7
						set_state_controller = 35
						set_state_controller = 36
					}
				}
				HOL = {
					start_civil_war = { ideology = fascism size = 1 }
				}
				random_country = {
					limit= {
						original_tag = HOL
						has_government = fascism
					}
					transfer_state = 7
					transfer_state = 35
					transfer_state = 36
					GER = {
						puppet = PREV
						set_autonomy = { target = PREV autonomy_state = autonomy_integrated_puppet }
					}

					set_cosmetic_tag = HOL_reichskommissariat
					create_country_leader = {
						name = "Arthur Seyss-Inquart"
						desc = "POLITICS_ARTHUR_SEYSS_INQUART_DESC"
						picture = GFX_portrait_Arthur_Seyss_Inquart
						expire = "1965.1.1"
						ideology = nazism
						traits = {
						}
					}
					if = {
						limit = {
							has_war = yes
						}
						add_ideas = GER_KR_limit
					}
				}
			}
			else = {
				HOL = {
					transfer_state = 7
					transfer_state = 35
					transfer_state = 36
					set_cosmetic_tag = HOL_reichskommissariat
					create_country_leader = {
						name = "Arthur Seyss-Inquart"
						desc = "POLITICS_ARTHUR_SEYSS_INQUART_DESC"
						picture = GFX_portrait_Arthur_Seyss_Inquart
						expire = "1965.1.1"
						ideology = nazism
						traits = {
						}
					}
					GER = { set_autonomy = { target = HOL autonomy_state = autonomy_integrated_puppet } }
					if = {
						limit = {
							has_war = yes
						}
						add_ideas = GER_KR_limit
					}
				}
			}
		}
	}

	GER_reichskommissariat_belgien_nordfrankreich = {

		icon = ger_reichskommissariats

		available = {
			has_completed_focus = GER_form_the_reichskommissariats
			has_government = fascism
			controls_state = 6
			controls_state = 29
			controls_state = 34
		}

		cost = 0

		ai_will_do = {
			factor = 0
			modifier = {
				add = 1
				ENG = { has_capitulated = yes }
			}
		}

		visible = {
			has_completed_focus = GER_form_the_reichskommissariats
			has_government = fascism
		}

		complete_effect = {
			if = {
				limit = {
					country_exists = BEL
					NOT = { BEL = { has_government = fascism } }
				}
				hidden_effect = {
					BEL = {
						set_state_controller = 6
						set_state_controller = 34
					}
				}
				BEL = {
					start_civil_war = { ideology = fascism size = 1 }
				}
				random_country = {
					limit= {
						original_tag = BEL
						has_government = fascism
					}
					transfer_state = 6
					transfer_state = 29
					transfer_state = 34
					GER = {
						puppet = PREV
						set_autonomy = { target = PREV autonomy_state = autonomy_integrated_puppet }
					}
					set_cosmetic_tag = BEL_reichskommissariat
					create_country_leader = {
						name = "Josef Grohe"
						desc = "POLITICS_JOSEF_GROHE_DESC"
						picture = GFX_portrait_Josef_Grohe
						expire = "1965.1.1"
						ideology = nazism
						traits = {
						}
					}
					hidden_effect = {
						29 = { add_core_of = PREV }
					}
					if = {
						limit = {
							has_war = yes
						}
						add_ideas = GER_KR_limit
					}
				}
			}
			else = {
				BEL = {
					transfer_state = 6
					transfer_state = 29
					transfer_state = 34
					set_cosmetic_tag = BEL_reichskommissariat
					create_country_leader = {
						name = "Josef Grohe"
						desc = "POLITICS_JOSEF_GROHE_DESC"
						picture = GFX_portrait_Josef_Grohe
						expire = "1965.1.1"
						ideology = nazism
						traits = {
						}
					}
					GER = { set_autonomy = { target = BEL autonomy_state = autonomy_integrated_puppet } }
					if = {
						limit = {
							has_war = yes
						}
						add_ideas = GER_KR_limit
					}
				}
			}
		}
	}

	GER_reichskommissariat_ostland = {

		icon = ger_reichskommissariats

		available = {
			has_completed_focus = GER_form_the_reichskommissariats
			has_government = fascism
			controls_state = 97
			controls_state = 94
			controls_state = 95
			controls_state = 96
			controls_state = 194
			controls_state = 204
			controls_state = 206
			controls_state = 207
			controls_state = 241
			controls_state = 11
			controls_state = 784
			controls_state = 189
			controls_state = 12
			controls_state = 190
			controls_state = 13
			controls_state = 191
			controls_state = 814
			controls_state = 815
			controls_state = 809
			controls_state = 808
			controls_state = 810
			controls_state = 813
			controls_state = 812
			controls_state = 811
		}

		cost = 0

		ai_will_do = {
			factor = 0
			modifier = {
				add = 1
				SOV = { has_capitulated = yes }
			}
		}

		visible = {
			has_completed_focus = GER_form_the_reichskommissariats
			has_government = fascism
		}

		complete_effect = {
			hidden_effect = {
					every_state = {
						limit = {
							OR = {
								state = 11
								state = 189
								state = 12
								state = 190
								state = 13
								state = 191
								state = 784
								state = 97
								state = 814
								state = 815
								state = 809
								state = 808
								state = 810
								state = 813
								state = 812
								state = 811
							}
							is_owned_by = GER
						}
						BLR = {
							transfer_state = PREV
						}
					}
					11 = { add_core_of = BLR }
					97 = { add_core_of = BLR }
					189 = { add_core_of = BLR }
					12 = { add_core_of = BLR }
					190 = { add_core_of = BLR }
					13 = { add_core_of = BLR }
					191 = { add_core_of = BLR }
					814 = { add_core_of = BLR }
					815 = { add_core_of = BLR }
					809 = { add_core_of = BLR }
					808 = { add_core_of = BLR }
					810 = { add_core_of = BLR }
					813 = { add_core_of = BLR }
					812 = { add_core_of = BLR }
					811 = { add_core_of = BLR }
					784 = { add_core_of = BLR }
			}
			release_on_controlled = BLR
			BLR = {
				set_state_controller = 11
				set_state_controller = 784
				set_state_controller = 189
				set_state_controller = 12
				set_state_controller = 190
				set_state_controller = 13
				set_state_controller = 191
				set_state_controller = 97
				set_state_controller = 94
				set_state_controller = 95
				set_state_controller = 96
				set_state_controller = 194
				set_state_controller = 204
				set_state_controller = 206
				set_state_controller = 207
				set_state_controller = 241
				set_state_controller = 784
				set_state_controller = 814
				set_state_controller = 815
				set_state_controller = 809
				set_state_controller = 808
				set_state_controller = 810
				set_state_controller = 813
				set_state_controller = 812
				set_state_controller = 811
				GER = {
					puppet = PREV
					if = {
						limit = {
							NOT = { has_dlc = "Death or Dishonor" }
						}
						set_autonomy = { target = PREV autonomy_state = autonomy_integrated_puppet end_wars = no end_civil_wars = no }
					}
					else = {
						set_autonomy = { target = PREV autonomy_state = autonomy_reichskommissariat  end_wars = no end_civil_wars = no }
					}
				}

				set_cosmetic_tag = BLR_reichskommissariat
				create_country_leader = {
					name = "Hinrich Lohse"
					desc = "POLITICS_HINRICH_LOHSE_DESC"
					picture = GFX_portrait_Hinrich_Lohse
					expire = "1965.1.1"
					ideology = nazism
					traits = {
					}
				}
					if = {
						limit = {
							has_war = yes
						}
						add_ideas = GER_KR_limit_2
					}
			}
		}
	}

	GER_reichskommissariat_ukraine = {

		icon = ger_reichskommissariats

		available = {
			has_completed_focus = GER_form_the_reichskommissariats
			has_government = fascism
			controls_state = 93
			controls_state = 91
			controls_state = 89
			controls_state = 199
			controls_state = 201
			controls_state = 198
			controls_state = 202
			controls_state = 193
			controls_state = 192
			controls_state = 203
			controls_state = 197
			controls_state = 225
			controls_state = 259
			controls_state = 226
			controls_state = 196
			controls_state = 200
			controls_state = 221
			controls_state = 228
			controls_state = 227
		}

		cost = 0

		ai_will_do = {
			factor = 0
			modifier = {
				add = 1
				SOV = { has_capitulated = yes }
			}
		}

		visible = {
			has_completed_focus = GER_form_the_reichskommissariats
			has_government = fascism
		}

		complete_effect = {
			release_on_controlled = UKR
			UKR = {
				set_state_controller = 93
				set_state_controller = 91
				set_state_controller = 89
				set_state_controller = 199
				set_state_controller = 201
				set_state_controller = 198
				set_state_controller = 202
				set_state_controller = 193
				set_state_controller = 192
				set_state_controller = 203
				set_state_controller = 197
				set_state_controller = 225
				set_state_controller = 259
				set_state_controller = 226
				set_state_controller = 196
				set_state_controller = 200
				set_state_controller = 221
				set_state_controller = 228
				set_state_controller = 227
				GER = {
					puppet = PREV
					set_autonomy = { target = PREV autonomy_state = autonomy_integrated_puppet }
				}
				set_cosmetic_tag = UKR_reichskommissariat
				create_country_leader = {
					name = "Erich Koch"
					desc = "POLITICS_HINRICH_LOHSE_DESC"
					picture = GFX_portrait_Erich_Koch
					expire = "1965.1.1"
					ideology = nazism
					traits = {
					}
				}
					if = {
						limit = {
							has_war = yes
						}
						add_ideas = GER_KR_limit_2
					}
			}
		}
	}
}

political_actions = {

	# Reinstate Wilhelm IV into the line of succession
	reinstate_wilhelm_iv_succession_rights = {

		allowed = {
			original_tag = GER
		}

		available = {

		}

		cost = 100

		fire_only_once = yes

		ai_will_do = {
			factor = 9999
		}

		visible = {
			has_war = no
			has_government = neutrality
			has_country_flag = backed_down_netherlands_kaiser
		}

		complete_effect = {
			if = {
				limit = { ENG_is_monarchist = no }
				add_stability = -0.10
				add_popularity = { ideology = neutrality popularity = -0.05 }
			}
			if = {
				limit = { ENG_is_monarchist = yes }
				add_stability = 0.10
				add_popularity = { ideology = neutrality popularity = 0.05 }
			}
			custom_effect_tooltip = reinstate_wilhelm_iv_succession_rights_tt
			hidden_effect = {
				set_country_flag = reinstated_wilhelm_iv_succession_rights
			}
		}
	}

	# Agnatic-Cognatic Primogeniture
	modernize_the_succession_laws = {

		allowed = {
			original_tag = GER
		}

		available = {

		}

		cost = 150

		fire_only_once = yes

		ai_will_do = {
			factor = 9999
		}

		visible = {
			has_war = no
			has_government = neutrality
			has_country_flag = reinstated_wilhelm_iv_succession_rights
		}

		complete_effect = {
			if = {
				limit = { ENG_is_monarchist = yes }
				add_stability = 0.10
			}
			if = {
				limit = { ENG_is_monarchist = no }
				add_stability = 0.05
			}
			custom_effect_tooltip = modernize_the_succession_laws_tt
			hidden_effect = {
				set_country_flag = modernized_succession_laws
			}
		}
	}

	recall_von_lettow_vorbeck = {

		allowed = {
			original_tag = GER
		}
		available = {
			has_civil_war = no
		}
		visible = {
			OR = {
				has_country_leader = { ruling_only = yes character = GER_wilhelm_ii }
				has_country_leader = { ruling_only = yes character = GER_wilhelm_iii }
				has_country_leader = { ruling_only = yes character = GER_victoria }
			}
			hidden_trigger = {
				NOT = { has_global_flag = von_lettow_is_in_a_country }
			}
		}
		cost = 25
		fire_only_once = yes
		ai_will_do = {
			factor = 1
		}
		complete_effect = {
			hidden_effect = {
				set_global_flag = von_lettow_is_in_a_country
			}
			create_corps_commander = {
				name = "Paul von Lettow-Vorbeck"
				gfx = GFX_portrait_ger_von_lettow_vorbeck
				traits = { trickster war_hero media_personality jungle_rat}
				skill = 4
				id = 499
				attack_skill = 3
				defense_skill = 3
				planning_skill = 2
				logistics_skill = 5
			}
		}
	}

	# Safety regulations
	GER_sharpen_air_safety_regulations = {

		allowed = {
			original_tag = GER
			has_dlc = "Waking the Tiger"
		}

		available = {

		}

		cost = 50

		fire_only_once = yes

		ai_will_do = {
			factor = 9999
		}

		visible = {
			has_government = neutrality
		}

		complete_effect = {
			if = {
				limit = { has_war = yes }
				add_stability = 0.05
			}
			add_timed_idea = { idea = GER_air_safety_regulations days = 1095 }
			set_global_flag = GER_air_safety_regulations_flag
		}
	}
}

foreign_politics = {

	# Titles Deprivation Act 1917
	request_restoration_of_british_titles = {

		allowed = {
			original_tag = GER
		}

		available = {
			OR = {
				ENG = { has_government = neutrality }
				ENG = { has_opinion = { target = GER value > 99 } }
			}
			custom_trigger_tooltip = {
				tooltip = hindenburg_destroyed_tt
				NOT = { has_global_flag = hindenburg_destroyed }
			}
		}

		cost = 150

		fire_only_once = yes

		ai_will_do = {
			factor = 9999
		}

		visible = {
			has_government = neutrality
			has_completed_focus = GER_ally_the_shade
			has_country_flag = modernized_succession_laws
		}

		complete_effect = {
			hidden_effect = { set_country_flag = GER_improve_relation_no_longer_needed }
			ENG = { country_event = { id = wtt_germany.999 days = 1 } }
			custom_effect_tooltip = request_restoration_of_british_titles_tt
			hidden_effect = { set_global_flag = hindenburg_event_in_progress }
		}
	}

	GER_request_polish_war_participation = {

		icon = generic_prepare_civil_war

		allowed = {
			original_tag = GER
		}

		available = {
			has_war_with = SOV
			NOT = { is_in_faction_with = POL }
		}

		cost = 50

		fire_only_once = yes

		ai_will_do = {
			factor = 200
		}

		visible = {
			has_country_flag = poland_traded_danzig
			has_completed_focus = GER_tackle_the_communist_threat
		}

		complete_effect = {
			POL = { country_event = { id = wtt_germany.65 hours = 6 } }
		}

	}
}

#Category only allowed for GER
GER_military_buildup = {

	GER_plan_z = {

		icon = generic_naval

		available = {
			has_navy_size = {
				unit = battleship
				size > 9
			}
			has_navy_size = {
				unit = battle_cruiser
				size > 2
			}
			has_navy_size = {
				unit = carrier
				size > 3
			}
			has_navy_size = {
				unit = heavy_cruiser
				size > 19
			}
			has_navy_size = {
				unit = light_cruiser
				size > 19
			}
			has_navy_size = {
				unit = destroyer
				size > 99
			}
		}

		fire_only_once = yes
		days_mission_timeout = 1800
		is_good = no
		activation = {
			has_completed_focus = GER_plan_z
		}


		visible = {
			has_completed_focus = GER_plan_z
		}

		complete_effect = {
			add_war_support = 0.05
			navy_experience = 150
		}


	}

	GER_jaegernotprogramm = {

		icon = generic_air

		available = {
			has_war = yes
			AND = {
				has_deployed_air_force_size = {
					type = fighter
					size < 750
				}
				has_equipment = {
					small_plane_airframe < 250
				}
			}
			NOT = {
				has_idea = GER_jaegernotprogramm
			}
		}

		cost = 50
		fire_only_once = yes
		ai_will_do = {
			factor = 1
		}

		visible = {
			has_war = yes
			AND = {
				has_deployed_air_force_size = {
					type = fighter
					size < 750
				}
				has_equipment = {
					small_plane_airframe < 250
				}
			}
			NOT = {
				has_idea = GER_jaegernotprogramm
			}
		}

		complete_effect = {
			add_stability = -0.05
			add_war_support = -0.05
			add_timed_idea = { idea = GER_jaegernotprogramm days = 90 }
		}
	}
}

special_projects = {
	GER_begin_heavy_water_production = {
		allowed = {
			original_tag = GER
			has_dlc = "La Resistance"
		}
		available = {
			110 = {
				CONTROLLER = {
					OR = {
						tag = ROOT
						is_subject_of = ROOT
					}
				}
			}
		}
		visible = { has_tech = atomic_research }
		cost = 0
		ai_will_do = {
			factor = 5
		}
		cancel_trigger = { NOT = { has_global_flag = GER_heavy_water_production_underway } } #can be removed via intelligence ops
		days_remove = 365
		remove_effect = {
			add_tech_bonus = {
				name = GER_heavy_water
				category = nuclear
				uses = 2
				bonus = 2
			}
		}
		complete_effect = { set_global_flag = GER_heavy_water_production_underway }
	}
	GER_dismantle_maginot = {

		icon = generic_construction

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

		cost = 50
		fire_only_once = yes

		ai_will_do = {
			factor = 0
		}
		visible = {
			#has_war = yes
			controls_state = 28
			if = {
				limit = {
					FRA = { has_completed_focus = FRA_extend_the_maginot_line }
				}
				controls_state = 18
				controls_state = 29
			}
		}
		days_remove = 180
		modifier = {
			civilian_factory_use = 5
		}
		remove_effect = {
			28 = {
				set_building_level = {
					type = bunker
					level = 2
					province = {
						all_provinces = yes
						limit_to_border = no
						level > 2
					}
				}
			}
			if = {
				limit = {
					FRA = { has_completed_focus = FRA_extend_the_maginot_line }
				}
				18 = {
					set_building_level = {
						type = bunker
						level = 2
						province = {
							all_provinces = yes
							limit_to_border = no
							level > 2
						}
					}
				}
				29 = {
					set_building_level = {
						type = bunker
						level = 2
						province = {
							all_provinces = yes
							limit_to_border = no
							level > 2
						}
					}
				}
			}
			if = {
				limit = {
					has_idea = FRA_protected_by_the_maginot_line
				}
				remove_ideas = FRA_protected_by_the_maginot_line
			}
		}
		complete_effect = {
			if = {
				limit = { FRA = { has_completed_focus = FRA_extend_the_maginot_line } }
				add_timed_idea = { idea = GER_dismantle_maginot days = 270 }
				else = {
					add_timed_idea = { idea = GER_dismantle_maginot days = 180 }
				}
			}
		}
	}
	GER_dismantle_czechoslovakian_forts = {

		icon = generic_construction

		available = {
			#has_war = yes
			controls_state = 69 # Sudetenland
			controls_state = 74 # Eastern Sudetenland
			controls_state = 9 # Bohemia
			controls_state = 75 # Moravia
		}

		cost = 50
		fire_only_once = yes

		ai_will_do = {
			factor = 0
		}
		visible = {
			#has_war = yes
			controls_state = 69 # Sudetenland
			controls_state = 74 # Eastern Sudetenland
			controls_state = 9 # Bohemia
			controls_state = 75 # Moravia
		}
		days_remove = 180
		modifier = {
			civilian_factory_use = 3
		}
		remove_effect = {
			69 = {
				set_building_level = {
					type = bunker
					level = 1
					province = {
						all_provinces = yes
						limit_to_border = no
						level > 1
					}
				}
			}
			74 = {
				set_building_level = {
					type = bunker
					level = 1
					province = {
						all_provinces = yes
						limit_to_border = no
						level > 1
					}
				}
			}
			9 = {
				set_building_level = {
					type = bunker
					level = 1
					province = {
						all_provinces = yes
						limit_to_border = no
						level > 1
					}
				}
			}
			75 = {
				set_building_level = {
					type = bunker
					level = 1
					province = {
						all_provinces = yes
						limit_to_border = no
						level > 1
					}
				}
			}
			if = {
				limit = {
					72 = {
						controller = {
							OR = {
								tag = ROOT
								is_subject_of = ROOT
							}
						}
					}
					71 = {
						controller = {
							OR = {
								tag = ROOT
								is_subject_of = ROOT
							}
						}
					}
				}
				72 = {
					set_building_level = {
						type = bunker
						level = 1
						province = {
							all_provinces = yes
							limit_to_border = no
							level > 1
						}
					}
				}
				71 = {
					set_building_level = {
						type = bunker
						level = 1
						province = {
							all_provinces = yes
							limit_to_border = no
							level > 1
						}
					}
				}
			}
			if = {
				limit = {
					70 = {
						controller = {
							OR = {
								tag = ROOT
								is_subject_of = ROOT
							}
						}
					}
				}
				70 = {
					set_building_level = {
						type = bunker
						level = 1
						province = {
							all_provinces = yes
							limit_to_border = no
							level > 1
						}
					}
				}
			}
			if = {
				limit = {
					73 = {
						controller = {
							OR = {
								tag = ROOT
								is_subject_of = ROOT
							}
						}
					}
					664 = {
						controller = {
							OR = {
								tag = ROOT
								is_subject_of = ROOT
							}
						}
					}
				}
				73 = {
					set_building_level = {
						type = bunker
						level = 1
						province = {
							all_provinces = yes
							limit_to_border = no
							level > 1
						}
					}
				}
				664 = {
					set_building_level = {
						type = bunker
						level = 1
						province = {
							all_provinces = yes
							limit_to_border = no
							level > 1
						}
					}
				}
			}
		}
		complete_effect = {
			add_timed_idea = { idea = GER_dismantle_czechoslovakian_forts days = 180 }
		}
	}
}

GER_aid_hun_rom_democratic_civil_war = {

	GER_aid_hun_democratic_civil_war = {

		icon = generic_prepare_civil_war

		available = {
			HUN = {
				NOT = { has_government = democratic }
				NOT = { has_war_with = GER }
				has_civil_war = yes
				exists = yes
				any_enemy_country = {
					original_tag = HUN
					has_government = democratic
				}
			}
		}

		cost = 0

		ai_will_do = {
			factor = 200
		}

		#Available if democratic civil war
		visible = {
			has_completed_focus = GER_align_hungary
			GER = { has_government = democratic }
		}

		complete_effect = {
			if = {
				limit = {
					HUN = { is_in_faction_with = GER }
				}
				remove_from_faction = HUN
				random_country = {
					limit = {
						original_tag = HUN
						has_government = democratic
						has_war_with = HUN
					}
					GER = { add_to_faction = PREV }
				}
			}
			random_country = {
				limit = {
					original_tag = HUN
					has_government = democratic
					has_war_with = HUN
				}
				GER = { add_to_war = { targeted_alliance = PREV enemy = HUN hostility_reason = asked_to_join } }
			}
		}
	}

	GER_aid_rom_democratic_civil_war = {

		icon = generic_prepare_civil_war

		available = {
			ROM = {
				NOT = { has_government = democratic }
				NOT = { has_war_with = GER }
				has_civil_war = yes
				exists = yes
				any_enemy_country = {
					original_tag = ROM
					has_government = democratic
				}
			}
		}

		cost = 0

		ai_will_do = {
			factor = 200
		}

		#Available if democratic civil war
		visible = {
			has_completed_focus = GER_align_romania
			GER = { has_government = democratic }
		}

		complete_effect = {
			if = {
				limit = {
					ROM = { is_in_faction_with = GER }
				}
				remove_from_faction = ROM
				random_country = {
					limit = {
						original_tag = ROM
						has_government = democratic
						has_war_with = ROM
					}
					GER = { add_to_faction = PREV }
				}
			}
			random_country = {
				limit = {
					original_tag = ROM
					has_government = democratic
					has_war_with = ROM
				}
				GER = { add_to_war = { targeted_alliance = PREV enemy = ROM hostility_reason = asked_to_join } }
			}
		}
	}

}

GER_austro_hungarian_empire = {

	GER_reform_austro_hungarian_empire = {

		allowed = {
			OR = {
				original_tag = AUS
				original_tag = HUN
				original_tag = CZE
			}
		}

		available = {
			AUS = {
				OR = {
					has_government = neutrality
					neutrality > 0.35
				}
			}
			HUN = {
				OR = {
					has_government = neutrality
					neutrality > 0.35
				}
			}
			CZE = {
				OR = {
					has_government = neutrality
					neutrality > 0.35
				}
			}
		}

		visible = {
			GER = {
				has_completed_focus = GER_rekindle_imperial_sentiment
				has_government = neutrality
			}
			AUS = {
				exists = yes
			}
			HUN = {
				exists = yes
			}
			CZE = {
				exists = yes
			}
			NOT = { has_global_flag = GER_reformed_austro_hungarian_empire }
		}

		cost = 0
		fire_only_once = yes

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 0
				tag = HUN
			}
			modifier = {
				factor = 0
				tag = CZE
			}
		}

		complete_effect = {
			custom_effect_tooltip = GER_reform_austro_hungarian_empire_tt
			hidden_effect = { set_global_flag = GER_reformed_austro_hungarian_empire }
			hidden_effect = {
				add_ideas = GER_align_hungary
			}
			if = {
				limit = {
					tag = AUS
				}
				HUN = { country_event = { id = wtt_germany.68 hours = 1 } }
				CZE = { country_event = { id = wtt_germany.68 hours = 3 } }
			}
			if = {
				limit = {
					tag = HUN
				}
				AUS = { country_event = { id = wtt_germany.68 hours = 1 } }
				CZE = { country_event = { id = wtt_germany.68 hours = 3 } }
			}
			if = {
				limit = {
					tag = CZE
				}
				HUN = { country_event = { id = wtt_germany.68 hours = 1 } }
				AUS = { country_event = { id = wtt_germany.68 hours = 3 } }
			}
		}
	}
}