
hannoverian_group_1 = {
	slot = 1
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = BRU
			tag = LUN
			tag = CLB
			tag = HAN
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	han_unite_the_welfs = {
		icon = mission_noble_council
		required_missions = { }

		ai_weight = {
			factor = 5
		}
		
		provinces_to_highlight = {
			OR = {
				province_id = 53
				province_id = 4772
				province_id = 1758
				province_id = 57
				province_id = 4773
				AND = {
					owned_by = BRU
					root = { NOT = { tag = BRU } }
				}
				AND = {
					owned_by = LUN
					root = { NOT = { tag = LUN } }
				}
				AND = {
					owned_by = CLB
					root = { NOT = { tag = CLB } }
				}
				AND = {
					owned_by = HAN
					root = { NOT = { tag = HAN } }
				}
			}
			OR = {
				NOT = { owned_by = root }
				NOT = { is_core = root }
			}
		}
		
		trigger = {
			if = {
				limit = {
					exists = BRU
					NOT = { tag = BRU }
				}
				NOT = { exists = BRU }
			}
			if = {
				limit = {
					exists = LUN
					NOT = { tag = LUN }
				}
				NOT = { exists = LUN }
			}
			if = {
				limit = {
					exists = CLB
					NOT = { tag = CLB }
				}
				NOT = { exists = CLB }
			}
			if = {
				limit = {
					exists = HAN
					NOT = { tag = HAN }
				}
				NOT = { exists = HAN }
			}
			owns_core_province = 53
			owns_core_province = 4772
			owns_core_province = 1758
			owns_core_province = 57
			owns_core_province = 4773
		}

		effect = {
			add_prestige = 15
			weser_area = {
				limit = {
					NOT = { is_permanent_claim = root }
					NOT = { is_core = root }
				}
				add_permanent_claim = root
			}
			lower_saxony_area = {
				limit = {
					NOT = { is_permanent_claim = root }
					NOT = { is_core = root }
				}
				add_permanent_claim = root
			}
		}
	}
	
	han_defend_against_neighbors = {
		icon = mission_assemble_an_army
		required_missions = { han_unite_the_welfs }

		provinces_to_highlight = {
			OR = {
				owned_by = PRU
				owned_by = BRA
				owned_by = SAX
				owned_by = THU
			}
			is_capital = yes
			owner = {
				root = {
					NOT = { army_size = prev }
				}
			}
		}
		
		trigger = {
			if = {
				limit = {
					exists = BRA
				}
				army_size = BRA
			}
			else_if = {
				limit = {
					exists = PRU
				}
				army_size = PRU
			}
			if = {
				limit = {
					exists = SAX
				}
				army_size = SAX
			}
			if = {
				limit = {
					exists = THU
				}
				army_size = THU
			}
			if = {
				limit = {
					NOT = { exists = PRU }
					NOT = { exists = BRA }
					NOT = { exists = SAX }
					NOT = { exists = THU }
				}
				army_size = 10 # modified
			}
		}

		effect = {
			northern_saxony_area = {
				limit = {
					NOT = { is_permanent_claim = root }
					NOT = { is_core = root }
				}
				add_permanent_claim = root
			}
			south_saxony_area = {
				limit = {
					NOT = { is_permanent_claim = root }
					NOT = { is_core = root }
				}
				add_permanent_claim = root
			}
			thuringia_area = {
				limit = {
					NOT = { is_permanent_claim = root }
					NOT = { is_core = root }
				}
				add_permanent_claim = root
			}
		}
	}
	
	han_expand_into_saxony = {
		icon = mission_have_two_subjects
		required_missions = { han_defend_against_neighbors }

		provinces_to_highlight = {
			OR = {
				area = northern_saxony_area
				area = south_saxony_area
				area = thuringia_area
			}
			NOT = { country_or_non_sovereign_subject_holds = root }
			NOT = {
				root = {
					num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
						value = 10 #out of 12
						OR = {
							area = northern_saxony_area
							area = south_saxony_area
							area = thuringia_area
						}
					}
				}
			}
		}
		
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value = 10 #out of 12
				OR = {
					area = northern_saxony_area
					area = south_saxony_area
					area = thuringia_area
				}
			}
		}

		effect = {
			mittelmark_area = {
				limit = {
					NOT = { is_permanent_claim = root }
					NOT = { is_core = root }
				}
				add_permanent_claim = root
			}
			neumark_area = {
				limit = {
					NOT = { is_permanent_claim = root }
					NOT = { is_core = root }
				}
				add_permanent_claim = root
			}
			if = {
				limit = {
					exists = BRA
				}
				BRA = {
					every_owned_province = {
						limit = {
							NOT = { area = mittelmark_area }
							NOT = { area = neumark_area }
							NOT = { is_permanent_claim = root }
							NOT = { is_core = root }
						}
						add_claim = root
					}
				}
			}
			else_if = {
				limit = {
					exists = PRU
				}
				PRU = {
					every_owned_province = {
						limit = {
							NOT = { area = mittelmark_area }
							NOT = { area = neumark_area }
							NOT = { is_permanent_claim = root }
							NOT = { is_core = root }
						}
						add_claim = root
					}
				}
			}
		}
	}
	
	han_subdue_brandenburg = {
		icon = mission_unite_home_region
		required_missions = { han_expand_into_saxony }

		provinces_to_highlight = {
			OR = {
				area = mittelmark_area
				area = neumark_area
				owned_by = BRA
				owned_by = PRU
			}
			NOT = { country_or_non_sovereign_subject_holds = root }
		}
		
		trigger = {
			mittelmark_area = {
				type = all
				country_or_non_sovereign_subject_holds = root
			}
			neumark_area = {
				type = all
				country_or_non_sovereign_subject_holds = root
			}
			if = {
				limit = {
					exists = BRA
				}
				OR = {
					NOT = { exists = BRA }
					BRA = { is_subject_of = root }
				}
			}
			if = {
				limit = {
					exists = PRU
				}
				OR = {
					NOT = { exists = PRU }
					PRU = { is_subject_of = root }
				}
			}
		}

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

hannoverian_group_2 = {
	slot = 1
	generic = no
	ai = yes
	potential = {
		tag = HAN
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	han_herrenhausen_gardens_mission = {
		icon = mission_early_modern_university
		position = 5
		required_missions = { }

		provinces_to_highlight = {
			is_capital_of = root
			NOT = { development = 25 }
		}
		
		trigger = {
			capital_scope = {
				development = 25
			}
			total_development = 200
			prestige = 80
		}

		effect = {
			add_country_modifier = {
				name = han_herrenhausen_gardens_mod
				duration = 7300
			}

			if = {
				limit = {
					valid_for_personal_unions_trigger = yes
					exists = GBR
					GBR = {
						valid_for_personal_unions_trigger = yes
					}
				}
				if = {
					limit = {
						mission_completed = han_rule_the_waves
						GBR = {
							OR = {
								religion = root
								AND = {
									religion = anglican
									ROOT = { religion = protestant }
								}
							}
						}
					}
					add_casus_belli = {
						type = cb_restore_personal_union
						months = 300
						target = GBR
					}
				}
				else = {
					custom_tooltip = han_herrenhausen_pu_gbr_effect_tooltip
					if = {
						limit = {
							GBR = { religion = anglican }
						}
						custom_tooltip = han_herrenhausen_pu_gbr_anglican_effect_tooltip
					}
				}
			}
			else_if = {
				limit = {
					valid_for_personal_unions_trigger = yes
					exists = ENG
					ENG = {
						valid_for_personal_unions_trigger = yes
					}
				}
				if = {
					limit = {
						mission_completed = han_rule_the_waves
						ENG = {
							OR = {
								religion = root
								AND = {
									religion = anglican
									ROOT = { religion = protestant }
								}
							}
						}
					}
					add_casus_belli = {
						type = cb_restore_personal_union
						months = 300
						target = ENG
					}
				}
				else = {
					custom_tooltip = han_herrenhausen_pu_eng_effect_tooltip
					if = {
						limit = {
							ENG = { religion = anglican }
						}
						custom_tooltip = han_herrenhausen_pu_eng_anglican_effect_tooltip
					}
				}
			}
			if = {
				limit = {
					OR = {
						valid_for_personal_unions_trigger = no
						AND = {
							OR = {
								NOT = { exists = GBR }
								GBR = {
									OR = {
										valid_for_personal_unions_trigger = no
										AND = {
											NOT = { religion = root }
											NOT = {
												AND = {
													religion = anglican
													ROOT = { religion = protestant }
												}
											}
										}
									}
								}
							}
							OR = {
								NOT = { exists = ENG }
								ENG = {
									OR = {
										valid_for_personal_unions_trigger = no
										AND = {
											NOT = { religion = root }
											NOT = {
												AND = {
													religion = anglican
													ROOT = { religion = protestant }
												}
											}
										}
									}
								}
							}
						}
					}
				}
				if = {
					limit = {
						mission_completed = han_rule_the_waves
					}
					east_anglia_area = {
						limit = {
							NOT = { is_permanent_claim = root }
							NOT = { is_core = root }
						}
						add_permanent_claim = root
					}
					home_counties_area = {
						limit = {
							NOT = { is_permanent_claim = root }
							NOT = { is_core = root }
						}
						add_permanent_claim = root
					}
					wessex_area = {
						limit = {
							NOT = { is_permanent_claim = root }
							NOT = { is_core = root }
						}
						add_permanent_claim = root
					}
					east_midlands_area = {
						limit = {
							NOT = { is_permanent_claim = root }
							NOT = { is_core = root }
						}
						add_permanent_claim = root
					}
					west_midlands_area = {
						limit = {
							NOT = { is_permanent_claim = root }
							NOT = { is_core = root }
						}
						add_permanent_claim = root
					}
					yorkshire_area = {
						limit = {
							NOT = { is_permanent_claim = root }
							NOT = { is_core = root }
						}
						add_permanent_claim = root
					}
				}
				else_if = {
					limit = {
						OR = {
							valid_for_personal_unions_trigger = no
							AND = {
								OR = {
									NOT = { exists = GBR }
									GBR = { valid_for_personal_unions_trigger = no }
								}
								OR = {
									NOT = { exists = ENG }
									ENG = { valid_for_personal_unions_trigger = no }
								}
							}
						}
					}
					custom_tooltip = han_herrenhausen_claims_eng_effect_tooltip
				}
			}
		}
	}
}


hannoverian_group_3 = {
	slot = 2
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = BRU
			tag = LUN
			tag = CLB
			tag = HAN
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	han_hansa_cities = {
		icon = mission_hanseatic_city
		position = 2
		required_missions = { han_unite_the_welfs }

		provinces_to_highlight = {
			OR = {
				province_id = 1874 #Bremen
				province_id = 44 #Hamburg
				province_id = 45 #Lubeck
			}
			OR = {
				NOT = { owned_by = root }
				NOT = { is_core = root }
			}
		}
		
		trigger = {
			owns_core_province = 1874
			owns_core_province = 44
			owns_core_province = 45
		}

		effect = {
			if = {
				limit = {
					NOT = { max_sailors = 1000 }
				}
				add_sailors = 1000
			}
			else = {
				add_yearly_sailors = 10
			}
			add_country_modifier = {
				name = han_hansa_cities_mod
				duration = 7300
			}
		}
	}
}
	
hannoverian_group_4 = {
	slot = 2
	generic = no
	ai = yes
	potential = {
		tag = HAN
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	han_rule_the_waves = {
		icon = mission_sea_battles
		required_missions = { han_hansa_cities }
		position = 4

		provinces_to_highlight = {
			is_capital = yes
			owner = {
				any_owned_province = {
					has_port = yes
					sea_zone = {
						area = north_sea_area
					}
				}
				navy_size = root
				NOT = { tag = HAN }
			}
		}
		
		trigger = {
			custom_trigger_tooltip = {
				tooltip = han_rule_the_waves_trigger_tooltip
				NOT = {
					any_known_country = {
						any_owned_province = {
							has_port = yes
							sea_zone = {
								area = north_sea_area
							}
						}
						navy_size = root
					}
				}
			}
		}

		effect = {
			45 = {
				add_trade_modifier = {
					who = root
					duration = 7300
					power = 35
					key = han_naval_dominance_trade_mod
				}
			}
			if = {
				limit = {
					valid_for_personal_unions_trigger = yes
					exists = GBR
					GBR = {
						valid_for_personal_unions_trigger = yes
					}
				}
				if = {
					limit = {
						mission_completed = han_herrenhausen_gardens_mission
						GBR = {
							OR = {
								religion = root
								AND = {
									religion = anglican
									ROOT = { religion = protestant }
								}
							}
						}
					}
					add_casus_belli = {
						type = cb_restore_personal_union
						months = 300
						target = GBR
					}
				}
				else = {
					custom_tooltip = han_rule_the_waves_pu_gbr_effect_tooltip
					if = {
						limit = {
							GBR = { religion = anglican }
						}
						custom_tooltip = han_rule_the_waves_pu_gbr_anglican_effect_tooltip
					}
				}
			}
			else_if = {
				limit = {
					valid_for_personal_unions_trigger = yes
					exists = ENG
					ENG = {
						valid_for_personal_unions_trigger = yes
					}
				}
				if = {
					limit = {
						mission_completed = han_herrenhausen_gardens_mission
						ENG = {
							OR = {
								religion = root
								AND = {
									religion = anglican
									ROOT = { religion = protestant }
								}
							}
						}
					}
					add_casus_belli = {
						type = cb_restore_personal_union
						months = 300
						target = ENG
					}
				}
				else = {
					custom_tooltip = han_rule_the_waves_pu_eng_effect_tooltip
					if = {
						limit = {
							ENG = { religion = anglican }
						}
						custom_tooltip = han_rule_the_waves_pu_eng_anglican_effect_tooltip
					}
				}
			}
			if = {
				limit = {
					OR = {
						valid_for_personal_unions_trigger = no
						AND = {
							OR = {
								NOT = { exists = GBR }
								GBR = {
									OR = {
										valid_for_personal_unions_trigger = no
										AND = {
											NOT = { religion = root }
											NOT = {
												AND = {
													religion = anglican
													ROOT = { religion = protestant }
												}
											}
										}
									}
								}
							}
							OR = {
								NOT = { exists = ENG }
								ENG = {
									OR = {
										valid_for_personal_unions_trigger = no
										AND = {
											NOT = { religion = root }
											NOT = {
												AND = {
													religion = anglican
													ROOT = { religion = protestant }
												}
											}
										}
									}
								}
							}
						}
					}
				}
				if = {
					limit = {
						mission_completed = han_herrenhausen_gardens_mission
					}
					east_anglia_area = {
						limit = {
							NOT = { is_permanent_claim = root }
							NOT = { is_core = root }
						}
						add_permanent_claim = root
					}
					home_counties_area = {
						limit = {
							NOT = { is_permanent_claim = root }
							NOT = { is_core = root }
						}
						add_permanent_claim = root
					}
					wessex_area = {
						limit = {
							NOT = { is_permanent_claim = root }
							NOT = { is_core = root }
						}
						add_permanent_claim = root
					}
					east_midlands_area = {
						limit = {
							NOT = { is_permanent_claim = root }
							NOT = { is_core = root }
						}
						add_permanent_claim = root
					}
					west_midlands_area = {
						limit = {
							NOT = { is_permanent_claim = root }
							NOT = { is_core = root }
						}
						add_permanent_claim = root
					}
					yorkshire_area = {
						limit = {
							NOT = { is_permanent_claim = root }
							NOT = { is_core = root }
						}
						add_permanent_claim = root
					}
				}
				else_if = {
					limit = {
						OR = {
							valid_for_personal_unions_trigger = no
							AND = {
								OR = {
									NOT = { exists = GBR }
									GBR = { valid_for_personal_unions_trigger = no }
								}
								OR = {
									NOT = { exists = ENG }
									ENG = { valid_for_personal_unions_trigger = no }
								}
							}
						}
					}
					custom_tooltip = han_rule_the_waves_claims_eng_effect_tooltip
				}
			}
		}
	}
	han_english_crown = {
		icon = mission_monarch_in_throne_room
		required_missions = { han_rule_the_waves han_herrenhausen_gardens_mission }
		position = 6

		provinces_to_highlight = {
			OR = {
				province_id = 236
				AND = {
					OR = {
						area = east_anglia_area
						area = home_counties_area
						area = wessex_area
						area = east_midlands_area
						area = west_midlands_area
						area = yorkshire_area
					}
					NOT = {
						ROOT = {
							num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
								value = 15 #out of 20
								OR = {
									area = east_anglia_area
									area = home_counties_area
									area = wessex_area
									area = east_midlands_area
									area = west_midlands_area
									area = yorkshire_area
								}
							}
						}
					}
				}
			}
			NOT = { country_or_non_sovereign_subject_holds = root }
		}
		
		trigger = {
			owns_or_non_sovereign_subject_of = 236 #London
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value = 15 #out of 20
				OR = {
					area = east_anglia_area
					area = home_counties_area
					area = wessex_area
					area = east_midlands_area
					area = west_midlands_area
					area = yorkshire_area
				}
			}
		}

		effect = {
			add_country_modifier = {
				name = han_kings_of_england
				duration = 7300
			}
		}
	}
	han_anglo_german_unity = {
		icon = mission_alliances
		required_missions = { han_english_crown }

		provinces_to_highlight = {
			OR = {
				AND = {
					owner = {
						is_emperor = yes
						NOT = { tag = HAN }
					}
				}
				AND = {
					region = north_german_region
					OR = {
						NOT = { owned_by = root }
						unrest = 1
					}
					ROOT = {
						NOT = {
							num_of_owned_provinces_with = {
								value = 20
								region = north_german_region
								NOT = { unrest = 1 }
							}
						}
					}
				}
				AND = {
					region = british_isles_region
					OR = {
						NOT = { owned_by = root }
						unrest = 1
					}
					ROOT = {
						NOT = {
							num_of_owned_provinces_with = {
								value = 20
								region = british_isles_region
								NOT = { unrest = 1 }
							}
						}
					}
				}
			}
		}
		
		trigger = {
			OR = {
				is_emperor = yes
				custom_trigger_tooltip = {
					tooltip = swa_supremacy_trigger_tooltip2
					NOT = { hre_size = 1 }
					NOT = { exists = HLR }
				}
			}
			num_of_owned_provinces_with = {
				value = 20
				region = north_german_region
				NOT = { unrest = 1 }
			}
			num_of_owned_provinces_with = {
				value = 15
				region = british_isles_region
				NOT = { unrest = 1 }
			}
		}

		effect = {
			add_country_modifier = {
				name = han_anglo_german_unity
				duration = -1
			}
		}
	}
}
