#Gotland Monarchy missions
got_monarchy_slot_1 = {
	slot = 1
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Lions of the North"
	}
	potential = {
		tag = GOT
		has_dlc = "Lions of the North"
		NOT = { map_setup = map_setup_random }
		has_country_flag = got_monarchy_missions
		NOT = { has_country_flag = got_republican_missions }
		NOT = { has_country_flag = got_pirate_missions }
	}
	has_country_shield = yes

	got_monarchy_emperor = {
		icon = mission_african_gold
		position = 1
		required_missions = {}
		provinces_to_highlight = {
			is_capital = yes
			owner = {
				is_emperor = yes
			}
		}
		trigger = {
			OR = {
				NOT = { hre_size = 1 }
				is_emperor = yes
				reverse_has_opinion = {
					who = emperor
					value = 100
				}
			}
		}
		effect = {
			if = {
				limit = {
					hre_size = 1
					is_emperor = no
				}
				country_event = {
					id = flavor_got.2
				}
			}
			else_if = {
				limit = {
					hre_size = 1
					is_emperor = yes
				}
				add_treasury = 5000
			}
			else = {
				add_mil_power = 75
			}
		}
	}

	got_monarchy_estates = {
		icon = balance_the_estates
		position = 2
		required_missions = {}
		provinces_to_highlight = {
		}
		trigger = {
			if = {
				limit = {
					has_estate = estate_nobles
				}
				estate_loyalty = {
					estate = estate_nobles
					loyalty = 60
				}
				NOT = {
					estate_influence = {
						estate = estate_nobles
						influence = 50
					}
				}
			}
			else = {
				NOT = { has_estate = estate_nobles }
			}
			if = {
				limit = {
					has_estate = estate_burghers
				}
				estate_loyalty = {
					estate = estate_burghers
					loyalty = 60
				}
				NOT = {
					estate_influence = {
						estate = estate_burghers
						influence = 50
					}
				}
			}
			else = {
				NOT = { has_estate = estate_burghers }
			}
			if = {
				limit = {
					has_estate = estate_church
				}
				estate_loyalty = {
					estate = estate_church
					loyalty = 60
				}
				NOT = {
					estate_influence = {
						estate = estate_church
						influence = 50
					}
				}
			}
			else = {
				NOT = { has_estate = estate_church }
			}
			crown_land_share = 40
		}
		effect = {
			add_country_modifier = {
				name = got_curtailing_the_estates
				duration = -1
			}
		}
	}

	got_monarchy_norwegian_opinion = {
		icon = mission_crown_of_norway
		position = 3
		required_missions = {}
		provinces_to_highlight = {
			is_capital_of = NOR
		}
		trigger = {
			OR = {
				NOT = { exists = NOR }
				reverse_has_opinion = {
					who = NOR
					value = 75
				}
				if = {
					limit = {
						NOR = { is_free_or_tributary_trigger = yes }
					}
					has_spy_network_in = {
						who = NOR
						value = 25
					}
				}
				else = {
					NOR = {
						overlord = {
							has_spy_network_from = {
								who = ROOT
								value = 25
							}
						}
					}
				}
			}
		}
		effect = {
			if = {
				limit = { 
					exists = NOR 
					NOR = {
						is_subject = yes
						NOT = { is_subject_of = ROOT }
					}
				}
				country_event = {
					id = flavor_got.16
				}
			}
			else = {
				add_adm_power = 100
				add_sailors = 2000
				if = {
					limit = {
						exists = NOR
					}
					add_historical_friend = NOR
					NOR = { add_historical_friend = ROOT }
				}
			}
		}
	}
}

got_monarchy_slot_2 = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Lions of the North"
	}
	potential = {
		tag = GOT
		has_dlc = "Lions of the North"
		NOT = { map_setup = map_setup_random }
		has_country_flag = got_monarchy_missions
		NOT = { has_country_flag = got_republican_missions }
		NOT = { has_country_flag = got_pirate_missions }
	}
	has_country_shield = yes

	got_monarchy_enemy_of_my_enemy = {
		icon = friends_in_high_places
		position = 1
		required_missions = {}
		provinces_to_highlight = {
			is_capital = yes
			owner = {
				OR = {
					is_rival = DAN
					is_enemy = DAN
				}
				NOT = {
					has_opinion = {
						who = ROOT
						value = 100
					}
				}
			}
		}
		trigger = {
			OR = {
				NOT = { exists = DAN }
				any_known_country = {
					OR = {
						is_rival = DAN
						is_enemy = DAN
					}
					has_opinion = {
						who = ROOT
						value = 75
					}
				}
			}
			is_at_war = no
		}
		effect = {
			define_advisor = {
				type = statesman
				cost_multiplier = 0.25
				skill = 1
			}
			custom_tooltip = got_monarchy_enemy_of_my_enemy_tt
			hidden_effect = {
				every_known_country = {
					limit = {
						OR = {
							is_rival = DAN
							is_enemy = DAN
						}
						has_opinion = {
							who = ROOT
							value = 75
						}
					}
					country_event = {
						id = flavor_got.18
					}
				}
			}
		}
	}

	got_monarchy_declare_war = {
		icon = mission_war_for_the_crown
		position = 2
		required_missions = { 
		}
		provinces_to_highlight = {
			is_capital_of = DAN
		}
		trigger = {
			OR = {
				NOT = { exists = DAN }
				has_casus_belli_against = DAN
			}
		}
		effect = {
			add_army_tradition = 15
			add_navy_tradition = 15
			add_country_modifier = {
				name = got_war_against_the_danes
				duration = 9125
			}
			if = {
				limit = { valid_for_personal_unions_trigger = yes DAN = { valid_for_personal_unions_trigger = yes } }
				add_casus_belli = {
					type = cb_restore_personal_union
					target = DAN
					months = 240
				}
			}
			else = {
				jutland_area = {
					limit = {
						NOT = { is_core = ROOT }
					}
					add_core = ROOT
				}
				denmark_area = {
					limit = {
						NOT = { is_core = ROOT }
					}
					add_core = ROOT
				}
				skaneland_area = {
					limit = {
						NOT = { is_core = ROOT }
					}
					add_core = ROOT
				}
			}
			set_country_flag = got_no_longer_eligible_to_switch_mission_tree
		}
	}

	got_monarchy_occupy_koppenhagen = {
		icon = mission_end_the_sound_toll
		position = 3
		required_missions = { got_monarchy_declare_war }
		provinces_to_highlight = {
			is_capital_of = DAN
		}
		trigger = {
			if = {
				limit = {
					exists = DAN
				}
				DAN = {
					capital_scope = {
						NOT = { controlled_by = DAN }
						controller = {
							OR = {
								tag = ROOT
								is_subject_of = ROOT
							}
						}
					}
				}
			}
			else = {
				stability = 1
			}
		}
		effect = {
			if = {
				limit = { exists = DAN }
				country_event = {
					id = flavor_got.34
				}
			}
			else = {
				add_war_exhaustion = -10
				add_stability = 2
			}
		}
	}

	got_monarchy_execute_the_wrong_king = {
		icon = weaken_france
		position = 4
		required_missions = { 
			got_monarchy_norwegian_opinion
			got_monarchy_occupy_koppenhagen
			got_monarchy_swedish_opinion
		}
		provinces_to_highlight = {
			OR = {
				is_capital_of = DAN
				province_id = 12
			}
		}
		trigger = {
			OR = {
				NOT = { exists = DAN }
				AND = {
					custom_trigger_tooltip = {
						tooltip = got_monarchy_execute_the_wrong_king_tt
						OR = {
							is_in_war = {
								attackers = ROOT
								defenders = DAN
								duration = 1095
							}
							is_in_war = {
								attackers = DAN
								defenders = ROOT
								duration = 1095
							}
						}
					}
					war_score_against = {
						who = DAN
						value = 50
					}
					DAN = {
						capital_scope = {
							controlled_by = ROOT
						}
					}
				}
				AND = {
					is_at_war = no
					OR = {
						senior_union_with = DAN
						owns_core_province = 12
					}
				}
			}
		}
		effect = {
			if = {
				limit = {
					exists = DAN
				}
				if = {
					limit = {
						OR = {
							AND = {
								war_with = DAN
								DAN = {
									capital_scope = {
										controlled_by = ROOT
									}
								}
							}
							senior_union_with = DAN
						}
					}
					country_event = {
						id = flavor_got.14
					}
				}
				else_if = {
					limit = {
						is_at_war = no
						owns_or_non_sovereign_subject_of = 12
					}
					if = {
						limit = {
							DAN = { is_subject_of = ROOT }
						}
						DAN = {
							add_liberty_desire = -100
							add_country_modifier = {
								name = got_return_of_the_king
								duration = 5475
							}
						}
					}
					if = {
						limit = {
							valid_for_personal_unions_trigger = yes
						}
						if = {
							limit = {
								DAN = { valid_for_personal_unions_trigger = yes }
							}
							add_casus_belli = {
								type = cb_restore_personal_union
								target = DAN
								months = 240
							}
						}
						if = {
							limit = {
								NOR = { valid_for_personal_unions_trigger = yes }
							}
							add_casus_belli = {
								type = cb_restore_personal_union
								target = NOR
								months = 240
							}
						}
						if = {
							limit = {
								SWE = { valid_for_personal_unions_trigger = yes }
							}
							add_casus_belli = {
								type = cb_restore_personal_union
								target = SWE
								months = 240
							}
						}
					}
					if = {
						limit = { NOT = { government_rank = 2 } }
						set_government_rank = 2
					}
					add_prestige = 100
				}
				else = {
					custom_tooltip = got_monarchy_execute_the_wrong_king_ct
				}
			}
			else = {
				add_legitimacy = 100
				add_splendor = 800
				add_adm_power = 100
				add_dip_power = 100
				add_mil_power = 100
			}
		}
	}

	got_monarchy_king_of_denmark = {
		icon = mission_crown_of_denmark
		position = 5
		required_missions = { 
			got_monarchy_execute_the_wrong_king
		}
		provinces_to_highlight = {
			OR = {
				owned_by = DAN
				owned_by = NOR
				owned_by = SWE
			}
			owner = {
				OR = {
					NOT = { is_subject_of = ROOT }
					liberty_desire = 50
				}
			}
		}
		trigger = {
			legitimacy = 95
			stability = 2
			DAN = {
				OR = {
					exists = no
					is_subject_of = ROOT
				}
			}
			NOR = {
				OR = {
					exists = no
					is_subject_of = ROOT
				}
			}
			SWE = {
				OR = {
					exists = no
					is_subject_of = ROOT
				}
			}
		}
		effect = {
			country_event = {
				id = flavor_got.15
			}
		}
	}
}

got_monarchy_slot_3 = {
	slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Lions of the North"
	}
	potential = {
		tag = GOT
		has_dlc = "Lions of the North"
		NOT = { map_setup = map_setup_random }
		has_country_flag = got_monarchy_missions
		NOT = { has_country_flag = got_republican_missions }
		NOT = { has_country_flag = got_pirate_missions }
	}
	has_country_shield = yes

	got_monarchy_pomerania = {
		icon = mission_the_gryf
		position = 1
		required_missions = {}
		provinces_to_highlight = {
			owner = {
				dynasty = ROOT
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			OR = {
				custom_trigger_tooltip = {
					tooltip = got_monarchy_pomerania_tt
					NOT = {
						any_known_country = {
							dynasty = ROOT
							NOT = { tag = ROOT }
							NOT = { is_subject_of = ROOT }
						}
					}
				}
				custom_trigger_tooltip = {
					tooltip = got_monarchy_pomerania_bt
					any_known_country = {
						dynasty = ROOT
						NOT = { tag = ROOT }
						NOT = { is_subject_of = ROOT }
						has_opinion = {
							who = ROOT
							value = 100
						}
					}
				}
			}
		}
		effect = {
			if = {
				limit = {
					NOT = {
						any_known_country = {
							dynasty = ROOT
							NOT = { tag = ROOT }
							NOT = { is_subject_of = ROOT }
						}
					}
				}
				add_country_modifier = {
					name = got_rise_of_a_new_dynasty
					duration = 9125
				}
			}
			else = {
				custom_tooltip = got_monarchy_pomerania_ct
				hidden_effect = {
					every_known_country = {
						limit = {
							dynasty = ROOT
							NOT = { tag = ROOT }
							NOT = { is_subject_of = ROOT }
							has_opinion = {
								who = ROOT
								value = 100
							}
						}
						ROOT = {
							add_manpower = 10
						}
					}
				}
			}
		}
	}

	got_monarchy_develop_visby = {
		icon = mission_develop_visby
		position = 2
		required_missions = {}
		provinces_to_highlight = {
			province_id = 25
			OR = {
				NOT = { is_core = ROOT }
				NOT = { owned_by = ROOT }
				NOT = { development = 20 }
			}
		}
		trigger = {
			owns_core_province = 25
			25 = {
				development = 15
			}
		}
		effect = {
			25 = {
				set_center_level_2_center_of_trade = yes
				add_province_modifier = {
					name = got_expanded_port
					duration = 9125
				}
			}
		}
	}

	got_monarchy_swedish_opinion = {
		icon = mission_crown_of_sweden
		position = 3
		required_missions = {}
		provinces_to_highlight = {
			is_capital_of = SWE
		}
		trigger = {
			OR = {
				NOT = { exists = SWE }
				reverse_has_opinion = {
					who = SWE
					value = 100
				}
				if = {
					limit = {
						SWE = { is_free_or_tributary_trigger = yes }
					}
					has_spy_network_in = {
						who = SWE
						value = 50
					}
				}
				else = {
					SWE = {
						overlord = {
							has_spy_network_from = {
								who = ROOT
								value = 50
							}
						}
					}
				}
			}
		}
		effect = {
			if = {
				limit = { exists = SWE }
				country_event = {
					id = flavor_got.17
				}
			}
			else = {
				add_mil_power = 75
			}
		}
	}
}

#Gotland Merchant Republic missions
got_republic_slot_1 = {
	slot = 1
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Lions of the North"
	}
	potential = {
		tag = GOT
		has_dlc = "Lions of the North"
		NOT = { map_setup = map_setup_random }
		has_country_flag = got_republican_missions
		NOT = { has_country_flag = got_monarchy_missions }
		NOT = { has_country_flag = got_pirate_missions }
	}
	has_country_shield = yes

	got_join_the_empire = {
		icon = lead_the_empire
		position = 1
		required_missions = {  }
		provinces_to_highlight = {
			is_capital_of = emperor
		}
		trigger = {
			OR = {
				NOT = { hre_size = 1 }
				reverse_has_opinion = {
					who = emperor
					value = 100
				}
			}
		}
		effect = {
			if = {
				limit = { hre_size = 1 }
				set_in_empire = yes
			}
			else = {
				add_adm_power = 75
				add_dip_power = 75
				add_mil_power = 75
			}
			hinter_pommern_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			vorpommern_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			add_permanent_claim_province = {
				province = 38
			}
		}
	}

	got_republic_trade_federation = {
		icon = the_london_steelyard
		position = 2
		required_missions = { got_join_the_empire }
		provinces_to_highlight = {
			OR = {
				has_river_estuary_trigger = yes
				province_has_center_of_trade_of_level = 1
				has_province_modifier = sound_toll
			}
			NOT = { owned_by = ROOT }
		}
		trigger = {
			if = {
				limit = { has_dlc = "Mare Nostrum" }
				OR = {
					is_trade_league_leader = yes
					num_of_owned_provinces_with = {
						OR = {
							has_river_estuary_trigger = yes
							province_has_center_of_trade_of_level = 1
							has_province_modifier = sound_toll
						}
						value = 3
					}
				}
			}
			else = {
				num_of_owned_provinces_with = {
					OR = {
						has_river_estuary_trigger = yes
						province_has_center_of_trade_of_level = 1
						has_province_modifier = sound_toll
					}
					value = 3
				}
			}
		}
		effect = {
			add_mercantilism = 5
			1926 = {
				add_trade_modifier = {
					who = ROOT
					duration = 9125
					power = 20
					key = got_republic_trade_federation_tt
				}
			}
			45 = {
				add_trade_modifier = {
					who = ROOT
					duration = 9125
					power = 20
					key = got_republic_trade_federation_tt
				}
			}
		}
	}

	got_republic_dominate_the_baltic_trace = {
		icon = reform_the_monte
		position = 3
		required_missions = { got_republic_trade_federation }
		provinces_to_highlight = {
			OR = {
				AND = {
					province_id = 1926
					NOT = {
						trade_share = {
							country = ROOT
							share = 20
						}
					}
				}
				AND = {
					province_id = 25
					OR = {
						NOT = { owned_by = ROOT }
						NOT = { is_core = ROOT }
						NOT = { development = 15 }
					}
				}
			}
		}
		trigger = {
			1926 = {
				trade_share = {
					country = ROOT
					share = 20
				}
			}
			owns_core_province = 25
			25 = {
				development = 15
			}
		}
		effect = {
			25 = {
				add_province_modifier = {
					name = got_investment_into_capital
					duration = -1
				}
			}
			mecklenburg_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			holstein_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}

	got_republic_dominate_lubeck_trace = {
		icon = return_visby_to_the_league
		position = 4
		required_missions = { got_republic_dominate_the_baltic_trace }
		provinces_to_highlight = {
			province_id = 45
			OR = {
				NOT = { country_or_non_sovereign_subject_holds = ROOT }
				NOT = {
					trade_share = {
						country = ROOT
						share = 15
					}
				}
			}
		}
		trigger = {
			45 = {
				country_or_non_sovereign_subject_holds = ROOT
				trade_share = {
					country = ROOT
					share = 15
				}
			}
		}
		effect = {
			add_mercantilism = 5
			define_advisor = {
				type = trader
				skill = 3
				cost_multiplier = 0.1
			}
			add_country_modifier = {
				name = got_lubeck_trade_fleet
				duration = -1
			}
		}
	}

	got_republic_beyond_lubeck = {
		icon = mission_control_the_channel
		position = 5
		required_missions = { got_republic_dominate_lubeck_trace }

		provinces_to_highlight = {
			province_id = 1269
		}

		trigger = {
			OR = {
				1269 = {
					trade_share = {
						country = root
						share = 25
					}
				}
				1269 = {
					privateer_power = {
						country = root
						share = 25
					}
				}
			}
		}

		effect = {
			add_mercantilism = 10
			1269 = {
				add_trade_modifier = {
					who = root
					duration = -1
					power = 25
					key = got_republic_beyond_lubeck_tt
				}
			}
		}
	}
}

got_republic_slot_2 = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Lions of the North"
	}
	potential = {
		tag = GOT
		has_dlc = "Lions of the North"
		NOT = { map_setup = map_setup_random }
		has_country_flag = got_republican_missions
		NOT = { has_country_flag = got_monarchy_missions }
		NOT = { has_country_flag = got_pirate_missions }
	}
	has_country_shield = yes

	got_republic_trade_fleet = {
		icon = mission_establish_high_seas_navy
		position = 1
		required_missions = {  }
		provinces_to_highlight = {
		}
		trigger = {
			num_of_light_ship = 10
		}
		effect = {
			if = {
				limit = {
					NOT = { has_faction = mr_aristocrats }
					NOT = { has_faction = mr_traders }
					NOT = { has_faction = mr_guilds }
				}
				create_admiral = {
					tradition = 50
				}
				add_navy_tradition = 15
			}
			else = {
				faction_in_power_effect = {
					faction = mr_aristocrats
					effect = "
						add_navy_tradition = 20
						add_country_modifier = {
							name = got_combat_fleet
							duration = 9125
						}
					"
				}
				faction_in_power_effect = {
					faction = mr_traders
					effect = "
						add_treasury = 100
						add_country_modifier = {
							name = got_merchants_of_the_baltics
							duration = 9125
						}
					"
				}
				faction_in_power_effect = {
					faction = mr_guilds
					effect = "
						capital_scope = { add_base_production = 2 }
						add_country_modifier = {
							name = got_artisan_fleet
							duration = 9125
						}
					"
				}
			}
		}
	}

	got_republic_strong_mercantilism = {
		icon = dominant_economy
		position = 3
		required_missions = {
			got_republic_trade_federation
			got_republic_trade_fleet
		}
		provinces_to_highlight = {
		}
		trigger = {
			if = {
				limit = {
					OR = {
						has_faction = mr_aristocrats
						has_faction = mr_guilds
						has_faction = mr_traders
					}
				}
				OR = {
					faction_influence = {
						faction = mr_aristocrats
						influence = 75
					}
					faction_influence = {
						faction = mr_guilds
						influence = 75
					}
					faction_influence = {
						faction = mr_traders
						influence = 75
					}
				}
			}
			mercantilism = 15
			OR = {
				treasurer = 1
				trader = 1
				master_of_mint = 1
			}
		}
		effect = {
			if = {
				limit = {
					NOT = { has_faction = mr_aristocrats }
					NOT = { has_faction = mr_traders }
					NOT = { has_faction = mr_guilds }
				}
				add_country_modifier = {
					name = got_trader_reign
					duration = 9125
				}
			}
			else = {
				faction_in_power_effect = {
					faction = mr_aristocrats
					effect = "
						add_country_modifier = {
							name = got_aristocratic_trade_focus
							duration = 9125
						}
					"
				}
				faction_in_power_effect = {
					faction = mr_traders
					effect = "
						add_country_modifier = {
							name = got_trader_reign
							duration = 9125
						}
					"
				}
				faction_in_power_effect = {
					faction = mr_guilds
					effect = "
						add_country_modifier = {
							name = got_oligarchic_guilds_rule
							duration = 9125
						}
					"
				}
			}
		}
	}

	got_republic_dominate_commerce = {
		icon = mission_seize_north_sea_trade
		position = 5
		required_missions = {
			got_republic_strong_mercantilism
			got_republic_russian_kontor
		}
		provinces_to_highlight = {
			province_id = 1926
			NOT = {
				trade_share = {
					country = root
					share = 70
				}
			}
		}
		trigger = {
			if = {
				limit = {
					has_dlc = "Mare Nostrum"
					is_trade_league_leader = yes
				}
				calc_true_if = {
					desc = advance_our_interests.tooltip
					all_known_country = { is_in_trade_league_with = ROOT }
					amount = 7 # 8 members include Lubeck
				}
			}
			else = {
				total_development = 200
			}
			1926 = {
				trade_share = {
					country = root
					share = 70
				}
			}
			num_of_merchants = 4
			naval_forcelimit = 60
		}
		effect = {
			if = {
				limit = {
					NOT = { has_faction = mr_aristocrats }
					NOT = { has_faction = mr_traders }
					NOT = { has_faction = mr_guilds }
				}
				add_country_modifier = {
					name = got_baltic_monopoly
					duration = -1
				}
			}
			else = {
				faction_in_power_effect = {
					faction = mr_aristocrats
					effect = "
						add_country_modifier = {
							name = got_baltic_military_power
							duration = -1
						}
					"
				}
				faction_in_power_effect = {
					faction = mr_traders
					effect = "
						add_country_modifier = {
							name = got_baltic_monopoly
							duration = -1
						}
					"
				}
				faction_in_power_effect = {
					faction = mr_guilds
					effect = "
						add_country_modifier = {
							name = got_baltic_maritime_empire
							duration = -1
						}
					"
				}
				custom_tooltip = got_republic_dominate_commerce_tt
			}
			hidden_effect = { set_country_flag = can_swap_merchant_faction_perma_bonus }
		}
	}
}

got_republic_slot_3 = {
	slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Lions of the North"
	}
	potential = {
		tag = GOT
		has_dlc = "Lions of the North"
		NOT = { map_setup = map_setup_random }
		has_country_flag = got_republican_missions
		NOT = { has_country_flag = got_monarchy_missions }
		NOT = { has_country_flag = got_pirate_missions }
	}
	has_country_shield = yes

	got_republic_mercenaries = {
		icon = mission_hessian_jaeger_corps
		position = 1
		required_missions = {  }
		provinces_to_highlight = {
		}
		trigger = {
			num_of_hired_mercenary_companies = 2
		}
		effect = {
			add_army_professionalism = 5
			add_army_tradition = 10
			denmark_area = {
				limit = {
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			jutland_area = {
				limit = {
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			skaneland_area = {
				limit = {
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}

	got_republic_get_the_sound_toll = {
		icon = mission_the_sound_toll
		position = 2
		required_missions = {
			got_republic_trade_fleet
			got_republic_mercenaries
		}
		provinces_to_highlight = {
			province_id = 12
			OR = {
				NOT = { is_core = ROOT }
				NOT = { owned_by = ROOT }
			}
		}
		trigger = {
			owns_core_province = 12
		}
		effect = {
			set_country_flag = dan_completed_mission_dan_the_sound_toll
			12 = { 
				add_building = coastal_defence
				add_building = marketplace
				add_province_triggered_modifier = sound_toll_protection_modifier 
			}
			add_years_of_income = 2
		}
	}

	got_republic_compete_with_novgorod = {
		icon = mission_conquer_novgorod
		position = 3
		required_missions = {  }
		provinces_to_highlight = {
			province_id = 33
			owner = {
				NOT = {
					OR = {
						tag = ROOT
						is_subject_of = ROOT
						ROOT = {
							has_casus_belli_against = PREV
						}
					}
				}
			}
		}
		trigger = {
			33 = {
				owner = {
					OR = {
						tag = ROOT
						is_subject_of = ROOT
						ROOT = {
							has_casus_belli_against = PREV
						}
					}
				}
			}
		}
		effect = {
			karelia_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			novgorod_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}

	got_republic_russian_kontor = {
		icon = mission_novgorod_the_great
		position = 4
		required_missions = { got_republic_compete_with_novgorod }

		provinces_to_highlight = {
			province_id = 310 # Novgorod
		}

		trigger = {
			OR = {
				if = {
					limit = {
						has_dlc = "Res Publica"
					}
					owns_core_province = 310
					310 = { has_province_modifier = trade_post_modifier }
				}
				else = {
					owns_core_province = 310
					310 = { development = 20 }
				}
				if = {
					limit = {
						has_dlc = "Mare Nostrum"
					}
					310 = {
						owner = {
							is_in_trade_league_with = ROOT
						}
					}
				}
				else = {
					310 = {
						country_or_non_sovereign_subject_holds = root
					}
				}
			}
		}

		effect = {
			add_mercantilism = 5
			310 = {
				add_trade_modifier = {
					who = root
					duration = 7300
					power = 50
					key = got_republic_russian_kontor_tt
				}
			}
		}
	}
}

#Gotland Pirate missions
got_pirate_slot_1 = {
	slot = 1
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Lions of the North"
	}
	potential = {
		tag = GOT
		has_dlc = "Lions of the North"
		NOT = { map_setup = map_setup_random }
		has_country_flag = got_pirate_missions
		NOT = { has_country_flag = got_republican_missions }
		NOT = { has_country_flag = got_monarchy_missions }
	}
	has_country_shield = yes

	got_pirate_renowned_pirate_king = {
		icon = mission_eric_the_pirate
		position = 2
		required_missions = {  }
		provinces_to_highlight = {
		}
		
		trigger = {
			has_leader_with = { admiral = yes total_pips = 12 }
			is_monarch_leader = yes
			republican_tradition = 95
			navy_tradition = 50
			ADM = 4
			DIP = 4
			MIL = 4
		}
		
		effect = {
			custom_tooltip = got_pirate_renowned_pirate_king_tt
			set_country_flag = can_gain_legendary_pirates_flag
			random_list = {
				1 = { trigger = { NOT = { ADM = 6 } } change_adm = 1 }
				1 = { trigger = { NOT = { DIP = 6 } } change_dip = 1 }
				1 = { trigger = { NOT = { MIL = 6 } } change_mil = 1 }
			}
		}
	}
}

got_pirate_slot_1_new_world = {
	slot = 1
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Lions of the North"
	}
	potential = {
		tag = GOT
		has_dlc = "Lions of the North"
		NOT = { map_setup = map_setup_random }
		has_country_flag = got_pirate_missions
		NOT = { has_country_flag = got_republican_missions }
		NOT = { has_country_flag = got_monarchy_missions }
		is_random_new_world = no
	}
	has_country_shield = yes

	got_pirate_beyond_the_sound_toll = {
		icon = mission_exploration
		position = 3
		required_missions = { got_pirate_sink_the_danes }
		provinces_to_highlight = {
			OR = {
				province_id = 481
				colonial_region = colonial_the_carribean
			}
			NOT = { has_discovered = ROOT }
		}
		trigger = {
			has_discovered = 481
			colonial_the_carribean = {
				has_discovered = ROOT
			}
		}
		effect = {
			create_colony_mission_reward = {
				province = 481
			}
			custom_tooltip = swe_colonize_delaware_tt
			hidden_effect = {
				colonial_the_carribean = {
					limit = {
						OR = {
							has_river_estuary_trigger = yes
							province_has_center_of_trade_of_level = 1
						}
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
						NOT = { owner = { is_subject_of = ROOT } }
						has_port = yes
					}
					add_permanent_claim = ROOT
				}
			}
		}
	}

	got_pirate_take_over_the_caribbeans = {
		icon = mission_caribbean_cn
		position = 4
		required_missions = { got_pirate_beyond_the_sound_toll }
		provinces_to_highlight = {
			OR = {
				province_id = 481
				colonial_region = colonial_the_carribean
			}
			OR = {
				NOT = { country_or_non_sovereign_subject_holds = ROOT }
				is_city = no
			}
		}
		trigger = {
			481 = {
				country_or_non_sovereign_subject_holds = ROOT
				is_city = yes
			}
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				colonial_region = colonial_the_carribean
				value = 5
			}
		}
		effect = {
			if = {
				limit = {
					any_subject_country = {
						capital_scope = {
							colonial_region = colonial_the_carribean
						}
						OR = {
							is_subject_of_type = colony
							is_subject_of_type = crown_colony
							is_subject_of_type = self_governing_colony
							is_subject_of_type = private_enterprise
						}
					}
				}
				country_event = {
					id = flavor_got.39
				}
			}
			else = {
				country_event = {
					id = flavor_got.40
				}
			}
		}
	}

	got_pirate_the_worst_pirate = {
		icon = mission_sponsor_piracy
		position = 5
		required_missions = { got_pirate_take_over_the_caribbeans }
		provinces_to_highlight = {
			province_id = 489
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			owns_or_non_sovereign_subject_of = 489
		}
		effect = {
			add_country_modifier = {
				name = got_the_art_of_insults
				duration = -1
			}
			489 = {
				set_center_level_2_center_of_trade = yes
				if = {
					limit = {
						has_dlc = "Leviathan"
					}
					set_great_project_tier_2 = {
						type = tortuga_island
					}
				}
				else = {
					add_base_production = 2
				}
			}
		}
	}
}

got_pirate_slot_2 = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Lions of the North"
	}
	potential = {
		tag = GOT
		has_dlc = "Lions of the North"
		NOT = { map_setup = map_setup_random }
		has_country_flag = got_pirate_missions
		NOT = { has_country_flag = got_republican_missions }
		NOT = { has_country_flag = got_monarchy_missions }
	}
	has_country_shield = yes

	got_pirate_the_pirate_fleet = {
		icon = mission_pirate_fleet
		position = 1
		required_missions = {}
		provinces_to_highlight = {
		}
		trigger = {
			naval_forcelimit = 20
			navy_size_percentage = 1
			num_of_light_ship = 6
		}
		effect = {
			add_country_modifier = {
				name = pirate_a_pirate_fleet
				duration = 9125
			}
			skaneland_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			denmark_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			jutland_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}

	got_pirate_sink_the_danes = {
		icon = mission_disrupt_portuguese_trade
		position = 2
		required_missions = { got_pirate_the_pirate_fleet }
		provinces_to_highlight = {
			is_capital_of = DAN
		}
		trigger = {
			OR = {
				NOT = { exists = DAN }
				AND = {
					navy_size = DAN
					DAN = {
						OR = {
							current_war_losses = {
								who_with = ROOT
								type = ships
								cause = battle
								amount = 20
							}
							NOT = { navy_size = 5 }
						}
					}
				}
			}
		}
		effect = {
			add_country_modifier = {
				name = got_dread_of_the_baltic_sea
				duration = 9125
			}
			add_power_projection = {
				type = mission_rewards_power_projection
				amount = 30
			}
		}
	}

	got_pirate_kronborg_the_pirate_castle = {
		icon = mission_the_sound_toll
		position = 3
		required_missions = { got_pirate_sink_the_danes }
		provinces_to_highlight = {
			province_id = 12
			OR = {
				NOT = { owned_by = ROOT }
				NOT = { is_core = ROOT }
			}
		}
		trigger = {
			owns_core_province = 12
		}
		effect = {
			12 = {
				add_base_manpower = 2
				set_center_level_2_center_of_trade = yes
				set_great_project_tier_2 = {
					type = kronborg
				}
			}
		}
	}

	got_pirate_loot_london = {
		icon = mission_fire_of_london
		position = 4
		required_missions = { got_pirate_raid_the_north_sea }
		provinces_to_highlight = {
			province_id = 236
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
			NOT = { controlled_by = ROOT }
		}
		trigger = {
			OR = {
				owns_or_non_sovereign_subject_of = 236
				controls = 236
			}
		}
		effect = {
			if = {
				limit = {
					owns_or_non_sovereign_subject_of = 236
				}
				236 = {
					add_province_modifier = {
						name = got_pirate_port_of_london
						duration = -1
					}
				}
			}
			else_if = {
				limit = {
					controls = 236
				}
				236 = {
					add_loot_from_rich_province_general_effect = {
						LOOTER = ROOT
					}
				}
			}
			else = {
				custom_tooltip = got_pirate_loot_london_tt
			}
			add_power_projection = {
				type = mission_rewards_power_projection
				amount = 25
			}
		}
	}

	got_pirate_raid_the_berbers = {
		icon = mission_raid_the_berbers
		position = 5
		required_missions = { got_pirate_reach_the_mediterrenean_sea }
		provinces_to_highlight = {
			OR = {
				AND = {
					OR = {
						province_id = 1110
						province_id = 341
					}
					NOT = {
						privateer_power = {
							country = ROOT
							share = 20
						}
					}
				}
				AND = {
					region = maghreb_region
					has_port = yes
					NOT = { has_province_modifier = slaves_raided }
					NOT = { country_or_non_sovereign_subject_holds = ROOT }
				}
			}
		}
		trigger = {
			calc_true_if = {
				all_province = {
					has_port = yes
					region = maghreb_region
					OR = {
						has_province_modifier = slaves_raided
						country_or_non_sovereign_subject_holds = ROOT
					}
				}
				amount = 15
			}
			1110 = {
				privateer_power = {
					country = ROOT
					share = 20
				}
			}
			341 = {
				privateer_power = {
					country = ROOT
					share = 20
				}
			}
			num_of_ports = 1
		}
		effect = {
			if = {
				limit = { NOT = { owns_or_non_sovereign_subject_of = 341 } }
				country_event = {
					id = flavor_got.41
				}
			}
			else = {
				random_owned_province = {
					limit = {
						has_port = yes
					}
					create_flagship = { 
						name = "Hayrettin Barbarossa"
						type = heavy_ship 
					}
				}
			}
			add_navy_tradition = 40
		}
	}
}

got_pirate_slot_3 = {
	slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Lions of the North"
	}
	potential = {
		tag = GOT
		has_dlc = "Lions of the North"
		NOT = { map_setup = map_setup_random }
		has_country_flag = got_pirate_missions
		NOT = { has_country_flag = got_republican_missions }
		NOT = { has_country_flag = got_monarchy_missions }
	}
	has_country_shield = yes

	got_pirate_the_lubeck_port = {
		icon = defend_the_city
		position = 2
		required_missions = { got_pirate_raid_the_baltics }
		provinces_to_highlight = {
			province_id = 45
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			owns_or_non_sovereign_subject_of = 45
		}
		effect = {
			add_mercantilism = 3
			45 = {
				set_center_level_2_center_of_trade = yes
				add_province_modifier = {
					name = got_free_pirate_port
					duration = -1
				}
			}
		}
	}

	got_pirate_raid_the_north_sea = {
		icon = mission_seize_north_sea_trade
		position = 3
		required_missions = {  }
		provinces_to_highlight = {
			OR = {
				AND = {
					province_id = 1975
					NOT = {
						privateer_power = {
							country = ROOT
							share = 25
						}
					}
				}
				AND = {
					province_id = 1269
					NOT = {
						privateer_power = {
							country = ROOT
							share = 10
						}
					}
				}
			}
		}
		trigger = {
			1975 = {
				privateer_power = {
					country = ROOT
					share = 25
				}
			}
			1269 = {
				privateer_power = {
					country = ROOT
					share = 10
				}
			}
		}
		effect = {
			add_years_of_income = 3
			holland_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			home_counties_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			flanders_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}

	got_pirate_loot_the_lowlands = {
		icon = chater_the_voc
		position = 4
		required_missions = { got_pirate_raid_the_north_sea }
		provinces_to_highlight = {
			region = low_countries_region
			trade_goods = cloth
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
			NOT = { controlled_by = ROOT }
			NOT = { has_province_modifier = slaves_raided }
		}
		trigger = {
			calc_true_if = {
				all_province = {
					region = low_countries_region
					trade_goods = cloth
					OR = {
						country_or_non_sovereign_subject_holds = ROOT
						controlled_by = ROOT
						has_province_modifier = slaves_raided
					}
				}
				amount = 10
			}
		}
		effect = {
			custom_tooltip = got_pirate_loot_the_lowlands_tt
			hidden_effect = {
				low_countries_region = {
					limit = {
						trade_goods = cloth
					}
					if = {
						limit = { country_or_non_sovereign_subject_holds = ROOT }
						add_province_modifier = {
							name = got_piratical_control
							duration = 9125
						}
					}
					else_if = {
						limit = { controlled_by = ROOT }
						remove_loot = {
							who = ROOT
							amount = 1000
						}
						ROOT = { add_treasury = 15 add_years_of_income = 0.05 }
						add_province_modifier = {
							name = got_heavily_looted
							duration = 9125
						}
					}
					else_if = {
						limit = { has_province_modifier = slaves_raided }
						ROOT = { add_treasury = 7.5 add_years_of_income = 0.025 }
						add_province_modifier = {
							name = got_quite_looted
							duration = 9125
						}
					}
				}
			}
			add_country_modifier = {
				name = got_finest_pirate_cloths
				duration = 9125
			}
			remove_country_modifier = poor_uniforms
		}
	}

	got_pirate_the_curia_treasure = {
		icon = mission_war_chest
		position = 5
		required_missions = { got_pirate_reach_the_mediterrenean_sea }
		provinces_to_highlight = {
			OR = {
				AND = {
					province_id = 118
					NOT = { country_or_non_sovereign_subject_holds = ROOT }
					NOT = { controlled_by = ROOT }
				}
				AND = {
					province_id = 1298
					NOT = {
						privateer_power = {
							country = ROOT
							share = 10
						}
					}
				}
			}
		}
		trigger = {
			118 = {
				OR = {
					country_or_non_sovereign_subject_holds = ROOT
					controlled_by = ROOT
				}
			}
			1298 = {
				privateer_power = {
					country = ROOT
					share = 10
				}
			}
		}
		effect = {
			if = {
				limit = { owns_or_non_sovereign_subject_of = 118 }
				add_treasury = 5000
			}
			else = {
				country_event = {
					id = flavor_got.42
				}
			}
			add_army_tradition = 30
		}
	}
}

got_pirate_slot_4 = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Lions of the North"
	}
	potential = {
		tag = GOT
		has_dlc = "Lions of the North"
		NOT = { map_setup = map_setup_random }
		has_country_flag = got_pirate_missions
		NOT = { has_country_flag = got_republican_missions }
		NOT = { has_country_flag = got_monarchy_missions }
	}
	has_country_shield = yes

	got_pirate_raid_the_baltics = {
		icon = mission_pirate_flag
		position = 1
		required_missions = {  }
		provinces_to_highlight = {
			OR = {
				AND = {
					province_id = 1926
					NOT = {
						privateer_power = {
							country = ROOT
							share = 15
						}
					}
				}
				AND = {
					OR = {
						region = scandinavia_region
						region = baltic_region
						region = north_german_region
						region = russia_region
					}
					has_port = yes
					NOT = { country_or_non_sovereign_subject_holds = ROOT }
					NOT = { has_province_modifier = slaves_raided }
				}
			}
		}
		trigger = {
			1926 = {
				privateer_power = {
					country = ROOT
					share = 15
				}
			}
			calc_true_if = {
				desc = got_pirate_raid_the_baltics_at
				all_province = {
					OR = {
						region = scandinavia_region
						region = baltic_region
						region = north_german_region
						region = russia_region
					}
					has_port = yes
					OR = {
						country_or_non_sovereign_subject_holds = ROOT
						has_province_modifier = slaves_raided
					}
				}
				amount = 20
			}
		}
		effect = {
			custom_tooltip = got_pirate_raid_the_baltics_tt
			hidden_effect = {
				europe = {
					limit = {
						OR = {
							area = karelia_area
							area = holstein_area
							area = mecklenburg_area
							area = hinter_pommern_area
							area = vorpommern_area
							area = estonia_ingria_area
							area = curonia_area
							area = livonia_area
							area = east_prussia_area
							area = west_prussia_area
						}
						OR = {
							province_has_center_of_trade_of_level = 1
							has_river_estuary_trigger = yes
						}
					}
					add_permanent_claim = ROOT
				}
			}
			add_prestige = 25
		}
	}

	got_pirate_the_danzig_port = {
		icon = mission_danzig_or_war
		position = 2
		required_missions = { got_pirate_raid_the_baltics }
		provinces_to_highlight = {
			province_id = 43
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			owns_or_non_sovereign_subject_of = 43
		}
		effect = {
			add_mercantilism = 3
			43 = {
				add_province_modifier = {
					name = got_free_pirate_port
					duration = -1
				}
				set_center_level_2_center_of_trade = yes
			}
		}
	}

	got_pirate_a_pirate_haven = {
		icon = mission_pirate_havens
		position = 3
		required_missions = {
			got_pirate_the_lubeck_port
			got_pirate_the_danzig_port
			got_pirate_the_riga_port
		}
		provinces_to_highlight = {
			continent = europe
			OR = {
				has_province_modifier = sound_toll
				has_river_estuary_trigger = yes
				province_has_center_of_trade_of_level = 1
			}
			has_port = yes
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_owned_provinces_with = {
				continent = europe
				OR = {
					has_province_modifier = sound_toll
					has_river_estuary_trigger = yes
					province_has_center_of_trade_of_level = 1
				}
				has_port = yes
				value = 10
			}
		}
		effect = {
			faction_in_power_effect = {
				faction = pr_buccaneers
				effect = "
					add_country_modifier = {
						name = got_the_buccaneers_focus
						duration = -1
					}
				"
			}
			faction_in_power_effect = {
				faction = pr_smugglers
				effect = "
					add_country_modifier = {
						name = got_the_smugglers_focus
						duration = -1
					}
				"
			}
			faction_in_power_effect = {
				faction = pr_captains
				effect = "
					add_country_modifier = {
						name = got_the_captains_focus
						duration = -1
					}
				"
			}
			custom_tooltip = got_republic_dominate_commerce_tt
			set_country_flag = got_unlock_pirate_faction_decisions
		}
	}

	got_pirate_reach_the_mediterrenean_sea = {
		icon = mission_dominate_the_mediterranean
		position = 4
		required_missions = {  }
		provinces_to_highlight = {
			OR = {
				province_id = 1295
				province_id = 1298
				province_id = 341
				province_id = 1308
				province_id = 137
				province_id = 358
				province_id = 1320
				province_id = 377
			}
			NOT = {
				privateer_power = {
					country = ROOT
					share = 5
				}
			}
		}
		trigger = {
			custom_trigger_tooltip = {
				tooltip = got_pirate_reach_the_mediterrenean_sea_tt
				OR = {
					1295 = { privateer_power = { country = ROOT share = 5 } }
					1298 = { privateer_power = { country = ROOT share = 5 } }
					341 = { privateer_power = { country = ROOT share = 5 } }
					1308 = { privateer_power = { country = ROOT share = 5 } }
					137 = { privateer_power = { country = ROOT share = 5 } }
					358 = { privateer_power = { country = ROOT share = 5 } }
					1320 = { privateer_power = { country = ROOT share = 5 } }
					377 = { privateer_power = { country = ROOT share = 5 } }
				}
			}
		}
		effect = {
			custom_tooltip = got_pirate_reach_the_mediterrenean_sea_ct
			hidden_effect = {
				baleares_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				corsica_sardinia_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				sicily_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				western_sicily_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				aegean_archipelago_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				add_permanent_claim_province = {
					province = 2954
				}
				add_permanent_claim_province = {
					province = 112
				}
				add_permanent_claim_province = {
					province = 163
				}
				add_permanent_claim_province = {
					province = 321
				}
				add_permanent_claim_province = {
					province = 4698
				}
				add_permanent_claim_province = {
					province = 142
				}
			}
		}
	}

	got_pirate_loot_venices_arsenal = {
		icon = mission_raid_on_venice
		position = 5
		required_missions = { got_pirate_reach_the_mediterrenean_sea }
		provinces_to_highlight = {
			OR = {
				AND = {
					province_id = 112
					NOT = { country_or_non_sovereign_subject_holds = ROOT }
					NOT = { controlled_by = ROOT }
				}
				AND = {
					province_id = 1308
					NOT = {
						privateer_power = {
							country = ROOT
							share = 10
						}
					}
				}
			}
		}
		trigger = {
			112 = {
				OR = {
					country_or_non_sovereign_subject_holds = ROOT
					controlled_by = ROOT
				}
			}
			1308 = {
				privateer_power = {
					country = ROOT
					share = 10
				}
			}
			num_of_ports = 1
		}
		effect = {
			if = {
				limit = { owns_or_non_sovereign_subject_of = 112 }
				add_country_modifier = {
					name = got_stolen_weapons_of_the_venetian_arsenal
					duration = -1
				}
			}
			else = {
				country_event = {
					id = flavor_got.43
				}
			}
			random_owned_province = {
				limit = {
					has_port = yes
				}
				create_units_of_type_in_province = {
					custom_tooltip = create_5_galleys_tt
					who = ROOT
					unit_type = galley
					amount = 5
				}
			}
		}
	}
}

got_pirate_slot_5 = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Lions of the North"
	}
	potential = {
		tag = GOT
		has_dlc = "Lions of the North"
		NOT = { map_setup = map_setup_random }
		has_country_flag = got_pirate_missions
		NOT = { has_country_flag = got_republican_missions }
		NOT = { has_country_flag = got_monarchy_missions }
	}
	has_country_shield = yes

	got_pirate_the_riga_port = {
		icon = mission_conquer_riga
		position = 2
		required_missions = { got_pirate_raid_the_baltics }
		provinces_to_highlight = {
			province_id = 38
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			owns_or_non_sovereign_subject_of = 38
		}
		effect = {
			add_mercantilism = 3
			38 = {
				set_center_level_2_center_of_trade = yes
				add_province_modifier = {
					name = got_free_pirate_port
					duration = -1
				}
			}
		}
	}

	got_pirate_create_the_pirate_federation = {
		icon = mission_alliances
		position = 3
		required_missions = {  }
		provinces_to_highlight = {
		}
		
		trigger = {
			OR = {
				any_subject_country = {
					has_reform = pirate_republic_reform
				}
				any_ally = {
					has_reform = pirate_republic_reform
				}
			}
		}
		
		effect = {
			add_country_modifier = {
				name = "pirate_federation"
				duration = 9125
			}
		}
	}

	got_pirate_free_ports = {
		icon = mission_raid_christian_trade
		position = 4
		required_missions = {  }
		provinces_to_highlight = {
			OR = {
				province_id = 4745
				province_id = 25
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			OR = {
				owns_or_non_sovereign_subject_of = 4745
				exists = RUG
			}
			owns_or_non_sovereign_subject_of = 25
		}
		effect = {
			create_admiral = {
				tradition = 75
			}
			create_general = {
				tradition = 75
			}
			if = {
				limit = {
					NOT = { exists = RUG }
				}
				if = {
					limit = {
						25 = { is_core = RUG }
					}
					25 = { add_core = RUG }
				}
				release = RUG
				RUG = {
					change_government = republic
					add_government_reform = pirate_republic_reform
					hidden_effect = {
						add_historical_friend = ROOT
						define_ruler = {
							force_republican_names = yes
							dynasty = "Strtebeker"
							culture = pommeranian
						}
						add_republican_tradition = 50
						swap_non_generic_missions = yes
				
						capital_scope = {
							galley = root
							galley = root
							galley = root
						}
					}
				}
				create_subject = {
					subject_type = vassal
					subject = RUG
				}
			}
		}
	}

	got_pirate_global_piracy = {
		icon = Burn_Wooden_Wall
		position = 5
		required_missions = {  }
		provinces_to_highlight = {
			is_trade_node_province = yes
			is_not_inland_trade_node_province = yes
			NOT = {
				privateer_power = {
					country = ROOT
					share = 15
				}
			}
			has_discovered = ROOT
		}
		
		trigger = {
			calc_true_if = {
				desc = got_pirate_global_piracy_tt
				all_trade_node = {
					privateer_power = {
						country = ROOT
						share = 15
					}
				}
				amount = 10
			}
		}
		
		effect = {
			add_country_modifier = {
				name = got_global_piracy
				duration = -1
			}
		}
	}
}