gen_europe = {

	slot = 5
	generic = yes
	ai = yes
	
	potential = {
		capital_scope = {
			continent = europe
		}
	}
	has_country_shield = no
	
	gen_eur_trade_node = {
		icon = mission_war_chest
		required_missions = { }
		position = 1
		
		trigger = {
			home_trade_node = {
				highest_value_trade_node = yes
				is_strongest_trade_power = ROOT
			}
			
		}
		
		effect = {
			add_country_modifier = {
				name = "gen_eur_trade_node_mod"
				duration = 7300
			}
			add_prestige_or_monarch_power = { amount = 30 }
		}
	}
	
	gen_eur_defender_faith = {
		icon = mission_european_church
		required_missions = { }
		position = 2
		
		trigger = {
			NOT = { current_age = age_of_discovery }
			is_defender_of_faith = yes
			religious_unity = 1
		}
		
		effect = {
			add_country_modifier = {
				name = "gen_eur_defender"
				duration = 5475
			}
			define_advisor = {
				type = theologian
				skill = 3
				culture = ROOT
				religion = ROOT
				cost_multiplier = 0.5
			}
		}
	}
}

gen_europe_hre = {

	slot = 5
	generic = yes
	ai = yes
	
	potential = {
		capital_scope = {
			continent = europe
		}
		is_part_of_hre = yes
		NOT = {
			is_emperor = yes
		}
		NOT = { government = theocracy }
		NOT = { government = republic }
	}
	has_country_shield = no
	
	gen_hre_electors = {
		icon = mission_alliances
		required_missions = { }
		position = 3
		
		trigger = {
			if = {
				limit = {
					hre_size = 1
				}
				calc_true_if = {
					desc = gen_hre_electors.tooltip
					all_elector = {
						preferred_emperor = ROOT
					}
					amount = 2
				}
			}
			else = {
				num_of_allies = 3
			}
		}
		
		effect = {
			add_prestige_or_monarch_power = { amount = 10 }
			add_country_modifier = {
				name = "gen_hre_diplomacy_mod"
				duration = 5475
			}
		}
	}
	
	gen_hre_emperor = {
		icon = mission_empire
		required_missions = { gen_hre_electors }
		position = 4
		
		trigger = {
			if = {
				limit = {
					hre_size = 1
				}
				is_emperor = yes
			}
			else = {
				government_rank = 3
			}
		}
		
		effect = {
			add_country_modifier = {
				name = "gen_hre_emperor_mod"
				duration = 5475
			}
			define_advisor = {
				type = statesman
				skill = 2
				culture = ROOT
				religion = ROOT
				cost_multiplier = 0.5
			}
		}
	}
}

gen_europe_hre_ban = {

	slot = 5
	generic = yes
	ai = yes
	
	potential = {
		capital_scope = {
			continent = europe
		}
		is_part_of_hre = yes
		NOT = {
			is_emperor = yes
		}
		NOT = { government = theocracy }
		NOT = { government = republic }
	}
	has_country_shield = no
	
	gen_hre_imperial_ban = {
		icon = mission_cannons_firing
		required_missions = { gen_hre_emperor }
		position = 5
		
		provinces_to_highlight = {
			AND = {
				is_part_of_hre = yes
				owner = {
					is_part_of_hre = no
				}
			}
		}
		
		trigger = {
			if = {
				limit = {
					hre_size = 1
					NOT = { has_dlc = "Emperor" }
				}
				hre_reform_passed = reichsreform
				is_emperor = yes
				NOT = { num_of_foreign_hre_provinces = 1 }
			}
			else_if = {
				limit = {
					hre_size = 1
					has_dlc = "Emperor"
				}
				hre_reform_passed = emperor_reichsreform
				is_emperor = yes
				NOT = { num_of_foreign_hre_provinces = 1 }
			}
			else = {
				custom_trigger_tooltip = {
					tooltip = imperial_ban_fallback_tt
					NOT = {
						any_core_province = {
							NOT = { owned_by = ROOT }
						}
					}
				}
			}
		}
		
		effect = {
			add_prestige = 10
			if = {
				limit = {
					hre_size = 1
				}
				add_imperial_influence = 10
				add_country_modifier = {
					name = "gen_hre_imperial_ban_mod"
					duration = 5475
				}
			}
		}
	}
}

gen_europe_hre_theocracy = {
	slot = 5
	generic = yes
	ai = yes
	potential = {
		capital_scope = {
			continent = europe
		}
		is_part_of_hre = yes
		NOT = {
			is_emperor = yes
		}
		government = theocracy
	}
	has_country_shield = no
	
	gen_hre_theocracy_house_of_god = {
		icon = mission_hands_praying
		required_missions = { }
		position = 3

		provinces_to_highlight = {
			owned_by = root
			has_tax_building_trigger = no
		}

		trigger = {
			if = {
				limit = { NOT = { num_of_cities = 10 } }
				all_owned_province = {
					has_tax_building_trigger = yes
				}
			}
			else = {
				capital_scope = {
					has_tax_building_trigger = yes
				}
				num_of_owned_provinces_with = {
					value = 10
					has_tax_building_trigger = yes
				}
			}
		}

		effect = {
			capital_scope = {
				add_or_upgrade_tax_building = yes
			}
			if = {
				limit = {
					NOT = { legitimacy_equivalent = 85 }
				}
				add_devotion = 20
				add_legitimacy = 20
			}
			else = {
				add_stability_or_adm_power = yes
			}
		}
	}
	gen_hre_theocracy_lords_army = {
		icon = mission_teutonic_knights
		required_missions = { gen_hre_theocracy_house_of_god }
		position = 4

		provinces_to_highlight = {
			owner = {
				is_neighbor_of = root
				army_size = root
			}
			root = {
				NOT = { army_size = 10 } # modified
			}
		}

		trigger = {
			OR = {
				army_size = 10 # modified
				all_neighbor_country = {
					NOT = { army_size = root }
				}
			}
		}

		effect = {
			add_country_modifier = {
				name = theocracy_lords_army_mod
				duration = 5475
			}
			if = {
				limit = {
					NOT = {
						army_tradition = 40
					}
				}
				create_general = { tradition = 40 }
			}
			else_if = {
				limit = {
					NOT = {
						army_tradition = 60
					}
				}
				create_general = { tradition = 60 }
			}
			else_if = {
				limit = {
					NOT = {
						army_tradition = 80
					}
				}
				create_general = { tradition = 80 }
			}
			else = {
				create_general = { tradition = 100 }
			}
		}
	}
	gen_hre_theocracy_divine_empire = {
		icon = mission_monarch_in_throne_room
		required_missions = { gen_hre_theocracy_lords_army }
		position = 5

		provinces_to_highlight = {
			OR = {
				region = north_german_region
				region = south_german_region
			}
			NOT = { religion = root }
			NOT = {
				root = {
					calc_true_if = {
						amount = 50
						all_province = {
							OR = {
								region = north_german_region
								region = south_german_region
							}
							religion = root
						}
					}
				}
			}
		}

		trigger = {
			custom_trigger_tooltip = {
				tooltip = emp_bav_center_of_counter_reformation_tooltip2
				had_global_flag = {
					flag = reformation_started
					days = 18250
				}
			}
			calc_true_if = {
				desc = gen_hre_theocracy_divine_empire_trigger_tooltip
				amount = 50
				all_province = {
					OR = {
						region = north_german_region
						region = south_german_region
					}
					religion = root
				}
			}
		}

		effect = {
			add_country_modifier = {
				name = theocracy_divine_empire_mod
				duration = 5475
			}
		}
	}
}


gen_europe_hre_republic = {
	slot = 5
	generic = yes
	ai = yes
	potential = {
		capital_scope = {
			continent = europe
		}
		is_part_of_hre = yes
		NOT = {
			is_emperor = yes
		}
		government = republic
	}
	has_country_shield = no
	
	gen_hre_relations_with_emperor = {
		icon = mission_monarch_in_throne_room
		required_missions = { }
		position = 3

		provinces_to_highlight = {
			is_capital_of = emperor
		}

		trigger = {
			alliance_with = emperor
			emperor = {
				has_opinion = {
					who = root
					value = 120
				}
			}
		}

		effect = {
			add_country_modifier = {
				name = imperial_beneficience
				duration = 5475
			}
		}
	}
	gen_hre_financial_centre = {
		icon = mission_high_income
		required_missions = { gen_hre_relations_with_emperor }
		position = 4

		provinces_to_highlight = {
			is_capital_of = root
		}

		trigger = {
			capital_scope = {
				development = 25
				has_tax_building_trigger = yes
				has_production_building_trigger = yes
				has_trade_building_trigger = yes
			}
		}

		effect = {
			add_country_modifier = {
				name = republic_bourgeois_center
				duration = 5475
			}
		}
	}
	gen_hre_republic_reform_government = {
		icon = mission_early_modern_university
		required_missions = { gen_hre_financial_centre }
		position = 5

		trigger = {
			reform_level = 7
			OR = {
				crown_land_share = 70
				AND = {
					estate_loyalty = {
						estate = estate_burghers
						loyalty = 60
					}
					estate_loyalty = {
						estate = estate_nobles
						loyalty = 60
					}
					estate_loyalty = {
						estate = estate_church
						loyalty = 60
					}
				}
			}
		}

		effect = {
			add_country_modifier = {
				name = republic_reformed_government
				duration = 10950
			}
		}
	}
}
