korea_nomad_group = {
	slot = 1
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	kor_conquer_changbai = {
		icon = mission_korean_castle_assault		#MMETR just adds new icons, because aesthetic
		required_missions = { }
		position = 1
		
		ai_weight = {
			factor = 0.75
		}
		
		provinces_to_highlight = {
			province_id = 4201
			OR = {
				NOT = { owned_by = ROOT }
				NOT = { is_core = ROOT }
			}
		}
		
		trigger = {
			4201 = {
				owned_by = ROOT
				is_core = ROOT
			}
		}
		
		effect = {
			add_prestige = 15
			add_legitimacy = 10
		
			ningguta_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			jilin_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			liaoning_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			furdan_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	
	kor_seize_southern_manchuria = {
		icon = mission_manchu_warrior
		required_missions = { kor_conquer_changbai }
		position = 3
		
		ai_weight = {
			factor = 0.5
		}
		
		provinces_to_highlight = {
			ROOT = {
				NOT = {
					num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
						OR = {
							area = ningguta_area
							area = jilin_area
							area = liaoning_area
							area = furdan_area
						}
						value = 6
					}
				}
			}
			OR = {
				area = ningguta_area
				area = jilin_area
				area = liaoning_area
				area = furdan_area
			}
			NOT = { country_or_non_sovereign_subject_holds = root }
		}
		
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = ningguta_area
					area = jilin_area
					area = liaoning_area
					area = furdan_area
				}
				value = 8
			}
		}
		
		effect = {
			add_prestige = 15
			add_adm_power = 50
			
			hebei_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = root
			}
			south_hebei_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = root
			}
			shandong_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = root
			}
		}
	}
	
	goguryeo_restoration = {
		icon = mission_chinese_monarch_horseback
		required_missions = { kor_seize_southern_manchuria }
		position = 4
		
		provinces_to_highlight = {
			OR = {
				area = ningguta_area
				area = jilin_area
				area = liaoning_area
			}
			OR = {
				NOT = { owned_by = root }
				NOT = { is_core = root }
			}
		}
		
		trigger = { #not including Furdan is deliberate as it isn't on the maps of historical Goguryeo
			ningguta_area = {
				type = all
				owned_by = root
				is_core = root
			}
			jilin_area = {
				type = all
				owned_by = root
				is_core = root
			}
			liaoning_area = {
				type = all
				owned_by = root
				is_core = root
			}
		}
		
		effect = {
			add_prestige = 25
			korea_region = {
				limit = {
					owned_by = ROOT
				}
				add_province_modifier = {
					name = "three_koreas_mod"
					duration = 18250
				}
			}
			manchuria_region = {
				limit = {
					owned_by = ROOT
					NOT = { culture = korean }
				}
				add_province_modifier = {
					name = "kor_manchurian_korea"
					duration = 18250
				}
			}
			manchuria_region = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = root
			}
		}
	}

	kor_end_manchuria = {
		icon = mission_tumu_crisis
		required_missions = { goguryeo_restoration }
		position = 5
		
		provinces_to_highlight = {
			OR = {
				AND = {
					NOT = {
						central_jilin_area = {
							country_or_non_sovereign_subject_holds = root
						}
					}
					area = central_jilin_area
				}
				AND = {
					NOT = {
						ilan_hala_area = {
							country_or_non_sovereign_subject_holds = root
						}
					}
					area = ilan_hala_area
				}
				AND = {
					NOT = {
						furdan_area = {
							country_or_non_sovereign_subject_holds = root
						}
					}
					area = furdan_area
				}
				AND = {
					NOT = {
						heilongjiang_area = {
							country_or_non_sovereign_subject_holds = root
						}
					}
					area = heilongjiang_area
				}
				AND = {
					NOT = {
						central_heilongjiang_area = {
							country_or_non_sovereign_subject_holds = root
						}
					}
					area = central_heilongjiang_area
				}
				AND = {
					NOT = {
						east_heilongjiang_area = {
							country_or_non_sovereign_subject_holds = root
						}
					}
					area = east_heilongjiang_area
				}
				AND = {
					NOT = {
						ningguta_area = {
							country_or_non_sovereign_subject_holds = root
						}
					}
					area = ningguta_area
				}
				AND = {
					NOT = {
						jilin_area = {
							country_or_non_sovereign_subject_holds = root
						}
					}
					area = jilin_area
				}
				AND = {
					NOT = {
						liaoning_area = {
							country_or_non_sovereign_subject_holds = root
						}
					}
					area = liaoning_area
				}
			}
		}
		
		trigger = {
			custom_trigger_tooltip = {
				tooltip = end_manchuria_tooltip #hold a province in every Manchurian area

				central_jilin_area = {
					country_or_non_sovereign_subject_holds = root
				}
				ilan_hala_area = {
					country_or_non_sovereign_subject_holds = root
				}
				furdan_area = {
					country_or_non_sovereign_subject_holds = root
				}
				heilongjiang_area = {
					country_or_non_sovereign_subject_holds = root
				}
				central_heilongjiang_area = {
					country_or_non_sovereign_subject_holds = root
				}
				east_heilongjiang_area = {
					country_or_non_sovereign_subject_holds = root
				}
				liaoning_area = {
					country_or_non_sovereign_subject_holds = root
				}
				jilin_area = {
					country_or_non_sovereign_subject_holds = root
				}
				ningguta_area = {
					country_or_non_sovereign_subject_holds = root
				}
			}
		}
		
		effect = {
			add_adm_power = 100
			custom_tooltip = kor_end_manchu.tooltip
			hidden_effect = {
				every_owned_province = {
					limit = { region = manchuria_region }
					add_province_modifier = {
						name = "kor_conquest_manchuria"
						duration = 7300
					}
				}
			}
		}
	}
}

kor_military_missions = {
	slot = 2
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
	}
	
	#duplicate of generic mission
	kor_build_army_mission = {
		icon = mission_chinese_army_mobilization_medieval
		position = 1
		required_missions = {  }
		trigger = {
			army_size_percentage = 1
		}
		effect = {
			add_country_modifier = {
				name = "thriving_arms_industry"
				duration = 9125 #25 years
			}
			if = {
				limit = {
					ai = no
					has_country_flag = starts_with_inwards_perfection
					has_estate_privilege = estate_church_inwards_perfection
				}
				remove_estate_privilege = estate_church_inwards_perfection
				clr_country_flag = starts_with_inwards_perfection
			}
		}
	}
}

kor_military_missions_2 = {
	slot = 2
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
		
	kor_harness_seokleon = {
		icon = mission_chinese_training
		position = 2
		required_missions = { kor_build_army_mission }
		trigger = {
			custom_trigger_tooltip = {
				tooltip = have_at_least_7point5_more_discipline
				has_global_modifier_value = {
					which = discipline
					value = 0.075
				}
			}
		}
		effect = {
			capital_scope = { add_base_manpower = 1 }
			create_general = {
				tradition = 80
			}
		}
	}
	kor_expand_hwacha = {
		icon = mission_asian_cannon
		position = 3
		required_missions = { kor_harness_seokleon }
		trigger = {
			num_of_artillery = 3
			artillery_fraction = 0.3
			num_of_owned_provinces_with = {
				value = 2
				OR = {
					has_building = regimental_camp
					has_building = conscription_center
				}
			}
		}
		effect = {
			add_mil_power = 50
			add_country_modifier = {
				name = hwacha_firepower_bonus
				duration = 7300
			}
		}
	}
}

korea_conquer_china_group = {
	slot = 2
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	kor_control_yellow_sea = {
		icon = mission_junk_boat
		required_missions = { kor_seize_southern_manchuria }
		position = 4
		
		provinces_to_highlight = {
			ROOT = {
				NOT = {
					num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
						OR = {
							area = hebei_area
							area = south_hebei_area
							area = shandong_area
						}
						value = 8
					}
				}
			}
			OR = {
				area = hebei_area
				area = south_hebei_area
				area = shandong_area
			}
			NOT = { country_or_non_sovereign_subject_holds = root }
		}
		
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = hebei_area
					area = south_hebei_area
					area = shandong_area
				}
				value = 8
			}
		}
		
		effect = {
			1376 = {
				add_trade_modifier = {
					who = root
					duration = 7300
					power = 30
					key = kor_yellow_sea					
				}
			}
			4233 = {
				add_trade_modifier = {
					who = root
					duration = 7300
					power = 30
					key = kor_yellow_sea					
				}
			}
			
			north_china_region = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = root
			}
			south_jiangsu_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = root
			}
			south_anhui_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = root
			}
			zhejiang_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = root
			}
		}
	}

	kor_seize_celestial_throne = {
		icon = mission_kowtow
		required_missions = { kor_control_yellow_sea }
		position = 5
		
		provinces_to_highlight = {
			OR = {
				AND = {
					province_id = 1816
					NOT = { owned_by = root }
					NOT = { is_core = root }
				}
				AND = {
					province_id = 1821
					NOT = { owned_by = root }
					NOT = { is_core = root }
				}
				AND = {
					root = {
						NOT = {
							num_of_owned_provinces_with = {
								superregion = china_superregion
								value = 30
							}
						}
					}
					superregion = china_superregion
				}
				AND = {
					NOT = {
						root = { is_emperor_of_china = yes }
					}
					owner = {
						is_emperor_of_china = yes
					}
					is_capital = yes
				}
			}
		}
		
		trigger = {
			if = {
				limit = {
					has_dlc = "Mandate of Heaven"
				}
				OR = {
					is_emperor_of_china = yes
					custom_trigger_tooltip = {
						tooltip = no_country_is_EoC
						NOT = {
							any_country = {
								is_emperor_of_china = yes
							}
						}
					}
				}
			}
			owns_core_province = 1816
			owns_core_province = 1821
			num_of_owned_provinces_with = {
				superregion = china_superregion
				value = 30
			}
		}
		
		effect = {
			add_country_modifier = {
				name = kor_emperor_of_china
				duration = 7300
			}

			china_superregion = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = root
			}
		}
	}
}

kor_diplo_missions = {
	slot = 3
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	kor_befriend_ming = {
		icon = mission_chinese_warlords_alliance
		required_missions = {  }
		trigger = {
			if = {
				limit = {
					has_dlc = "Mandate of Heaven"
				}
				OR = {
					any_country = {
						is_emperor_of_china = yes
						OR = {
							has_opinion = {
								who = root
								value = 175
							}
							AND = {
								custom_trigger_tooltip = {
									tooltip = rivalled_or_rival_of
									OR = {
										is_rival = root
										root = { is_rival = prev }
									}
								}
								custom_trigger_tooltip = {
									tooltip = has_been_insulted_by_root
									OR = {
										has_opinion_modifier = {
											who = ROOT
											modifier = insulted
										}
										has_opinion_modifier = {
											who = ROOT
											modifier = scornfully_insulted
										}
									}
								}
							}
						}
					}
					is_emperor_of_china = yes
					custom_trigger_tooltip = {
						tooltip = no_country_is_EoC
						NOT = {
							any_country = {
								is_emperor_of_china = yes
							}
						}
					}
				}
			}
			else = {
				OR = {
					AND = {
						exists = MNG
						OR = {
							MNG = {
								has_opinion = {
									who = root
									value = 175
								}
							}
							MNG = {
								custom_trigger_tooltip = {
									tooltip = rivalled_or_rival_of
									OR = {
										is_rival = root
										root = { is_rival = prev }
									}
								}
								custom_trigger_tooltip = {
									tooltip = has_been_insulted_by_root
									OR = {
										has_opinion_modifier = {
											who = ROOT
											modifier = insulted
										}
										has_opinion_modifier = {
											who = ROOT
											modifier = scornfully_insulted
										}
									}
								}
							}
						}
					}
					AND = {
						NOT = {
							exists = MNG
						}
						owns = 1816
					}
				}
			}
		}
		effect = {
			add_dip_power = 50
			add_country_modifier = {
				name = kor_chinese_patronage
				duration = 7300
			}
		}
	}
}


kor_fortify_missions = {
	slot = 3
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	kor_fortify_korea = {
		icon = mission_great_wall
		position = 2
		required_missions = { kor_build_army_mission }

		provinces_to_highlight = {
			OR = {
				province_id = 2744
				province_id = 4232
				province_id = 2743
				province_id = 2742
			}
		}
		
		trigger = {
			any_owned_province = {
				OR = {
					province_id = 2744
					province_id = 4232
					province_id = 2743
					province_id = 2742
				}
				OR = {
					has_building = fort_16th
					has_building = fort_17th
					has_building = fort_18th
				}
			}
		}
		effect = {
			if = {
				limit = {
					NOT = {
						any_owned_province = {
							OR = {
								province_id = 2744
								province_id = 4232
								province_id = 2743
								province_id = 2742
							}
							OR = {
								has_building = fort_16th
								has_building = fort_17th
								has_building = fort_18th
							}
						}
					}
				}
				custom_tooltip = kor_fortify_korea_tooltip
			}
			else = {
				random_owned_province = {
					limit = {
						OR = {
							province_id = 2744
							province_id = 4232
							province_id = 2743
							province_id = 2742
						}
						OR = {
							has_building = fort_16th
							has_building = fort_17th
							has_building = fort_18th
						}
					}
					add_province_modifier = {
						name = kor_built_the_wall
						duration = -1
					}
					add_base_manpower = 2
				}
			}
		}
	}
	kor_fortify_korea_2 = {
		icon = mng_kingdom_joseon
		position = 3
		required_missions = { kor_fortify_korea }
		
		trigger = {
			num_of_owned_provinces_with = {
				value = 5
				has_building = fort_18th
			}
		}
		effect = {
			add_country_modifier = {
				name = kor_built_the_wall_2
				duration = -1
			}
		}
	}
}

kor_righteous_army_tree = {
	slot = 4
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	kor_righteous_army = {
		icon = mission_korean_archer_defense
		position = 1
		required_missions = {  }

		trigger = {
			any_country = {
				war_with = root
				army_strength = {
					who = root
					value = 1.5
				}
			}
			if = {
				limit = {
					has_dlc = "Domination"
				}
				has_reform = the_righteous_army_reform
			}
		}
		effect = {
			add_yearly_manpower = 1.5
			add_war_exhaustion = -2
		}
	}
}

kor_japan_tree = {
	slot = 4
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	kor_japanese_piracy = {
		icon = mission_korean_naval_battle_panokseon
		position = 2
		required_missions = {  }

		trigger = {
			num_of_heavy_ship = 5
			num_of_galley = 30
		}
		effect = {
			create_admiral = {
				tradition = 60
			}

			1018 = {
				if = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = root
				}
			}
			4183 = {
				if = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = root
				}
			}
			1017 = {
				if = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = root
				}
			}
			1818 = {
				if = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = root
				}
			}
			4182 = {
				if = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = root
				}
			}
			4181 = {
				if = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = root
				}
			}
			1012 = {
				if = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = root
				}
			}
			4651 = {
				if = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = root
				}
			}
		}
	}

	kor_foothold_in_japan = {
		icon = mission_invade_island
		position = 3
		required_missions = { kor_japanese_piracy }
		
		provinces_to_highlight = {
			OR = {
				province_id = 1018
				province_id = 4183
				province_id = 1017
				province_id = 1818
				province_id = 4182
				province_id = 4181
				province_id = 1012
			}
			NOT = { owned_by = root }
		}

		trigger = { #Note: not including 4651 is deliberate as that small island is hardly a "foothold" in Japan.
			num_of_owned_provinces_with = {
				value = 2
				OR = {
					province_id = 1018
					province_id = 4183
					province_id = 1017
					province_id = 1818
					province_id = 4182
					province_id = 4181
					province_id = 1012
				}
			}
		}
		effect = {
			add_dip_power = 50
			
			shikoku_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = root
			}
			saigoku_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = root
			}
			sanindo_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = root
			}
			northern_kyushu = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = root
			}
			kyushu_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = root
			}
			kinai_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = root
			}
		}
	}
	
	kor_defeat_shogun = {
		icon = mission_korean_archer_imjin_war
		position = 5
		required_missions = { kor_foothold_in_japan }
		
		provinces_to_highlight = {
			province_id = 1020
		}

		trigger = {
			owns = 1020 #Kyoto
		}
		effect = {
			if = {
				limit = {
					has_dlc = "Mandate of Heaven"
					is_harmonizing_with = shinto
				}
				if = {
					limit = {
						is_harmonizing_with = shinto
					}
					add_harmonization_progress = 15
				}
				else_if = {
					limit = { has_harmonized_with = shinto }
					add_mil_power = 100
				}
				else = {
					custom_tooltip = kor_defeat_shogun_tt
				}
			}
			else = {
				add_mil_power = 100
			}

			country_event = { id = flavor_kor.7 }

			japan_region = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
					is_city = yes
				}
				add_permanent_claim = root
			}
		}
	}
}

kor_turtle_ships_tree = {
	slot = 5
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	kor_turtle_ships = {
		icon = mission_korean_turtleship
		position = 3
		required_missions = { kor_japanese_piracy }

		trigger = {
			has_global_modifier_value = {
				which = ship_durability
				value = 0.15
			}
		}
		effect = {
			add_country_modifier = {
				name = kor_turtle_fleets
				duration = 7300
			}
		}
	}
}


kor_settle_land = {
	slot = 5
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	kor_settle_north = {
		icon = mission_chinese_land_survey
		position = 4
		required_missions = {  }
		
		provinces_to_highlight = {
			OR = {
				AND = {
					province_id = 2742
					NOT = { culture = korean }
				}
				AND = {
					province_id = 2743
					NOT = { culture = korean }
				}
			}
		}

		trigger = {
			2742 = {
				culture = korean
			}
			2743 = {
				culture = korean
			}
		}
		effect = {
			add_prestige = 25
			add_dip_power = 25
		}
	}
	kor_settle_general = {
		icon = mission_colonial
		position = 5
		required_missions = { kor_settle_north }
		
		provinces_to_highlight = {
			owned_by = root
			NOT = { culture = korean }
		}

		trigger = {
			OR = {
				num_of_owned_provinces_with = {
					value = 30
					culture = korean
				}
				development_in_provinces = {
					culture = korean
					value = 300
				}
			}
		}
		effect = {
			add_prestige = 50
			add_dip_power = 50
		}
	}
}


kor_harmony_with_japan = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Mandate of Heaven"
	}
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "Mandate of Heaven"
	}
	has_country_shield = yes
	
	kor_harmonise_shinto = {
		icon = mission_japanese_temple_gate
		position = 6
		required_missions = { kor_defeat_shogun }

		provinces_to_highlight = {
			region = japan_region
			ROOT = { NOT = { religion = confucianism } }
			is_city = yes
			NOT = { religion = root }
		}

		trigger = {
			if = {
				limit = {
					religion = confucianism
				}
				has_harmonized_with = shinto
			}
			else = {
				japan_region = {
					type = all
					OR = {
						religion = root
						is_city = no
					}
				}
			}
		}
		effect = {
			add_stability_or_adm_power = yes
			define_advisor = {
				type = theologian
				religion = shinto
				skill = 3
				cost_multiplier = 0.25
			}
		}
	}
}

korea_economic_social_political_path_0 = {
	slot = 3
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
	}
	
	kor_higher_income = {
		icon = mission_high_income
		required_missions = {  }
		position = 4
		
		trigger = {
			treasury = 250
			share_of_starting_income = 1.5
		}
		
		effect = {
			add_country_modifier = {
				name = "kor_growing_economy"
				duration = 9125 #25 years
			}
		}
	}
}

korea_economic_social_political_path_1 = {
	slot = 3
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	kor_peasant_struggles = {
		icon = mission_rice_field
		required_missions = { kor_higher_income }
		position = 6

		provinces_to_highlight = {
			region = korea_region
			NOT = { development = 6 }
		}
		
		trigger = {
			korea_region = {
				type = all
				development = 6
			}
		}
		
		effect = {
			add_stability_or_adm_power = yes
			if = {
				limit = {
					NOT = {
						has_country_flag = kor_peasant_struggles
					}
				}
				custom_tooltip = kor_peasant_struggles_mission_tt1
				hidden_effect = {
					set_country_flag = kor_peasant_struggles_resolved
				}
			}
			else_if = {
				limit = {
					has_country_modifier = kor_peasant_struggles
				}
				remove_country_modifier = kor_peasant_struggles
				custom_tooltip = kor_peasant_struggles_mission_tt2
				hidden_effect = {
					set_country_flag = kor_peasant_struggles_resolved
				}
			}
			else = {
				add_legitimacy = 15
			}
		}
	}
	kor_develop_korea = {
		icon = mission_have_manufactories
		required_missions = { kor_peasant_struggles }
		position = 7
		
		trigger = {
			development_in_provinces = {
				value = 200
				region = korea_region
			}
		}
		
		effect = {
			korea_region = {
				limit = { owned_by = root }
				add_province_modifier = {
					name = kor_prosperous_korea
					duration = 7300
				}
			}
		}
	}
	kor_achieve_juche = {
		icon = mission_asian_city
		required_missions = { kor_develop_korea kor_develop_capital kor_end_factional_strife }
		position = 8
		
		provinces_to_highlight = {
			region = korea_region
			OR = {
				NOT = { owned_by = root }
				NOT = { is_core = root }
				NOT = { culture = korean }
				NOT = { development = 8 }
				has_manufactory_trigger = no
			}
		}
		
		trigger = {
			is_subject = no
			
			korea_region = {
				type = all
				owned_by = root
				is_core = root
				culture = korean
				development = 8
				has_manufactory_trigger = yes
			}
			OR = {
				army_size = 100
				AND = {
					army_size_percentage = 1
					army_size = 60
				}
			}
		}
		
		effect = {
			add_country_modifier = {
				name = korea_in_balance
				duration = -1
			}
		}
	}
}

korea_economic_social_political_path_2 = {
	slot = 2
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	kor_develop_capital = {
		icon = mission_korean_hwaseong_fortress_18th
		required_missions = { kor_peasant_struggles }
		position = 7
		
		provinces_to_highlight = {
			is_capital_of = root
		}

		trigger = {
			capital_scope = {
				culture = korean
				development = 30
			}
		}
		
		effect = {
			add_country_modifier = {
				name = kor_developed_capital
				duration = 7300
			}
			capital_scope = {
				add_province_modifier = {
					name = kor_expanded_capital
					duration = -1
				}
			}
		}
	}
}


korea_economic_social_political_path_3 = {
	slot = 4
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	kor_end_factional_strife = {
		icon = mission_scholar_officials
		required_missions = { kor_peasant_struggles }
		position = 7
		
		trigger = {
			custom_trigger_tooltip = {
				tooltip = KOR_has_factional_upheaval_tooltip
				has_country_modifier = kor_factional_upheaval
			}
			custom_trigger_tooltip = {
				tooltip = KOR_has_factional_upheaval_tooltip2
				has_country_flag = kor_third_literati_purge
			}
			OR = {
				crown_land_share = 90
				custom_trigger_tooltip = {
					tooltip = KOR_two_pleased_estates_tooltip #Two §Yestates§! have at least §Y70 loyalty§!, the other has at least §Y50 loyalty§!.
					OR = {
						AND = {
							estate_loyalty = {
								estate = estate_burghers
								loyalty = 60
							}
							estate_loyalty = {
								estate = estate_church
								loyalty = 40
							}
							estate_loyalty = {
								estate = estate_nobles
								loyalty = 40
							}
						}
						AND = {
							estate_loyalty = {
								estate = estate_burghers
								loyalty = 40
							}
							estate_loyalty = {
								estate = estate_church
								loyalty = 60
							}
							estate_loyalty = {
								estate = estate_nobles
								loyalty = 40
							}
						}
						AND = {
							estate_loyalty = {
								estate = estate_burghers
								loyalty = 40
							}
							estate_loyalty = {
								estate = estate_church
								loyalty = 40
							}
							estate_loyalty = {
								estate = estate_nobles
								loyalty = 60
							}
						}
						AND = {
							has_parliament = yes
							estate_loyalty = {
								estate = estate_church
								loyalty = 60
							}
							estate_loyalty = {
								estate = estate_burghers
								loyalty = 40
							}
						}
						AND = {
							has_parliament = yes
							estate_loyalty = {
								estate = estate_church
								loyalty = 40
							}
							estate_loyalty = {
								estate = estate_burghers
								loyalty = 60
							}
						}
					}
				}
            }
        }
		
		effect = {
			if = {
				limit = {
					crown_land_share = 90
				}
				add_stability_or_adm_power = yes
			}
			else = {
				hidden_effect = {
					add_estate_loyalty_modifier = {
						estate = estate_nobles
						desc = EST_KOR_FACTIONAL_UNITY
						loyalty = 15
						duration = 7300
					}
					add_estate_loyalty_modifier = {
						estate = estate_church
						desc = EST_KOR_FACTIONAL_UNITY
						loyalty = 15
						duration = 7300
					}
					add_estate_loyalty_modifier = {
						estate = estate_burghers
						desc = EST_KOR_FACTIONAL_UNITY
						loyalty = 15
						duration = 7300
					}
				}
				add_country_modifier = {
					name = kor_factional_unity
					duration = 7300
					
				}
				custom_tooltip = kor_end_factional_strife_tt
			}
			remove_country_modifier = kor_factional_upheaval
			remove_faction = nc_westerners
			remove_faction = nc_easterners
			remove_faction = nc_southerners
		}
	}
}

korea_trade_group = {
	slot = 1
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = KOR
			tag = JOE
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	kor_korean_trade_ports = {
		icon = mission_chinese_market
		required_missions = {  }
		position = 6

		provinces_to_highlight = {
			province_id = 2745
			NOT = { owned_by = root }
		}
		trigger = {
			num_of_owned_provinces_with = {
				value = 6
				OR = {
					has_building = marketplace
					has_building = trade_depot
					has_building = stock_exchange
				}
			}
			owns = 2745
		}
		effect = {
			2745 = {
				add_base_production = 2
				add_trade_modifier = {
					who = root
					duration = 7300
					power = 30
					key = kor_traders_tm
				}
			}
		}
	}

	kor_japanese_trade = {
		icon = mission_japanese_western_trade
		required_missions = { kor_korean_trade_ports }
		position = 7

		provinces_to_highlight = {
			province_id = 1376
		}

		trigger = {
			1376 = {
				trade_share = {
					country = root
					share = 50
				}
			}
		}

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



korean_missions_eoc_1 = {
	slot = 1
	generic = no
	ai = yes
	potential = {
		has_dlc = "Domination"
		is_emperor_of_china = yes 
		OR = { 
			tag = KOR
			tag = JOE
		}
	}
	has_country_shield = yes 

	mng_cornerstone_empire3 = {
		icon = mission_cornerstone_empire 
		required_missions = {  }
		position = 9
		provinces_to_highlight = {
		}
		trigger = {
			OR = {
				AND = {
					estate_loyalty = {
						estate = estate_eunuchs 
						loyalty = 60 
					}
					num_of_estate_privileges = {
						estate = estate_eunuchs
						value = 5
					}
				}
				AND = { 
					custom_trigger_tooltip = {
						tooltip = mng_kept_restrictions_tt
						has_country_flag = mng_kept_restrictions_flag
					}
					has_adm_advisor = yes 
					has_dip_advisor = yes 
					has_mil_advisor = yes 
					crown_land_share = 40
				}
			}
		}
		
		effect = {
			custom_tooltip = mng_bow_to_eunuchs_tt
			tooltip = {
				add_country_modifier = { 
					name = mng_increased_eunuch_influence_modifier
					duration = 18250
				}
			}
			custom_tooltip = pol_alternatively_tt
			tooltip = { 
				if = {
					limit = { 
						has_dlc = "Mandate of Heaven" 
						is_emperor_of_china = yes 
					} 
					custom_tooltip = mng_palace_bureaucracy_benefits_tt
				}
				else = { 
					change_estate_land_share = {
						estate = all 
						share = -10
					}
					add_stability_or_adm_power = yes 
				}
			}
			hidden_effect = {
				if = {
					limit = { 
						has_country_flag = mng_kept_restrictions_flag
						has_adm_advisor = yes 
						has_dip_advisor = yes 
						has_mil_advisor = yes 
						crown_land_share = 40
						has_dlc = "Mandate of Heaven" 
						is_emperor_of_china = yes 
					}
					clr_country_flag = mng_kept_restrictions_flag 
					set_country_flag = mng_expanded_palace_bureaucracy_flag 
				}
				else_if = {
					limit = { 
						has_country_flag = mng_kept_restrictions_flag
						has_adm_advisor = yes 
						has_dip_advisor = yes 
						has_mil_advisor = yes 
						crown_land_share = 40
					}
					change_estate_land_share = {
						estate = all 
						share = -10
					}
					add_stability_or_adm_power = yes 
				}
				else = {
					add_country_modifier = { 
						name = mng_increased_eunuch_influence_modifier
						duration = 18250
					}
				}
			}
		}
	}
	
	mng_censorate3 = {
		icon = mission_censorate 
		required_missions = { mng_cornerstone_empire3 }
		position = 11
		
		trigger = {
			NOT = { corruption = 1 } 
			has_adm_advisor_3 = yes 
			has_dip_advisor_3 = yes 
			has_mil_advisor_3 = yes 
			stability = 3 
			NOT = { average_unrest = -5 }
			num_of_owned_provinces_with = { 
				has_courthouse_building_trigger = yes 
				value = 15 
			}
		}
		
		effect = {
			country_event = { id = flavor_mng.28 }
			custom_tooltip = mng_insight_28_tt
		}
	}
	
	mng_promote_grand_coordinators3 = {
		icon = mission_kowtow
		required_missions = { mng_censorate3 }
		position = 12 
		
		trigger = { 
			if = { 
				limit = { is_emperor_of_china = yes } 
				meritocracy = 90 
			}
			else = { legitimacy_equivalent = 90 } 
			if = {
				limit = { is_emperor_of_china = yes } 
				OR = {
					empire_of_china_has_active_decree = issue_the_great_warnings_decree
					AND = {
						monthly_adm = 10 
						estate_loyalty = {
							estate = estate_eunuchs
							loyalty = 60 
						}
						estate_influence = {
							estate = estate_eunuchs 
							influence = 60 
						}
					}
				}
			}
		}
		
		effect = {
			custom_tooltip = mng_enable_3_grand_coordinators_offices_tt
			set_country_flag = mng_enable_3_grand_coordinators_offices_flag 
		}
	}
}

korean_missions_eoc_2 = {
	slot = 2
	generic = no
	ai = yes
	potential = {
		has_dlc = "Domination"
		is_emperor_of_china = yes 
		OR = { 
			tag = KOR
			tag = JOE
		}
		capital_scope = { continent = asia }
	}
	has_country_shield = yes 
	
	mng_reform_civil_registration3 = {
		icon = mission_plc_governance_act 
		required_missions = { } 
		position = 9
		
		trigger = {
			if = {
				limit = {
					is_emperor_of_china = yes 
					has_dlc = "Mandate of Heaven" 
				}
				OR = { 
					empire_of_china_reform_passed = reform_civil_registration_decision
					imperial_mandate = 85 
				}
			}
			OR = {
				absolutism = 50
				custom_trigger_tooltip = {
					tooltip = mng_all_available_estates_granted_land_rights_tt
					if = {
						limit = { has_estate = estate_eunuchs } 
						has_estate_privilege = estate_eunuchs_land_rights_privilege
					}
					if = {
						limit = { has_estate = estate_burghers } 
						has_estate_privilege = estate_burghers_land_rights 
					}
					if = {
						limit = { has_estate = estate_nobles } 
						has_estate_privilege = estate_nobles_land_rights 
					}
					if = {
						limit = { has_estate = estate_church } 
						has_estate_privilege = estate_church_land_rights 
					}
					if = {
						limit = { has_estate = estate_nomadic_tribes } 
						has_estate_privilege = estate_nomadic_tribes_land_rights
					}
				}
				AND = {
					empire_of_china_has_active_decree = conduct_census_decree
					if = {
						limit = { has_estate = estate_eunuchs } 
						estate_loyalty = {
							estate = estate_eunuchs
							loyalty = 60 
						}
					}
					if = {
						limit = { has_estate = estate_burghers } 
						estate_loyalty = {
							estate = estate_burghers
							loyalty = 60 
						}
					}
					if = {
						limit = { has_estate = estate_nobles } 
						estate_loyalty = {
							estate = estate_nobles
							loyalty = 60 
						}
					}
					if = {
						limit = { has_estate = estate_church } 
						estate_loyalty = {
							estate = estate_church
							loyalty = 60 
						}
					}
					if = {
						limit = { has_estate = estate_nomadic_tribes } 
						estate_loyalty = {
							estate = estate_nomadic_tribes
							loyalty = 60 
						}
					}
					government_reform_progress = 150 
				}
			}
		}
		
		effect = {
			custom_tooltip = mng_estates_govcap_now_grants_another_50_gov_cap_tt
			tooltip = {
				add_ruler_modifier = {
					name = mng_cabinet_cooperation_modifier
					duration = -1 
				}
			}
			
			custom_tooltip = mng_alternatively_pop_census_improved
			tooltip = {
				if = {
					limit = { 
						has_dlc = "Rights of Man" 
						NOT = { num_of_ruler_traits = { amount = 3 } }
					}
					change_government_reform_progress = -150 
					add_ruler_personality = reformist_personality
				}
				else = { change_government_reform_progress = -100 }
			}
			
			hidden_effect = {
				if = {
					limit = {
						has_estate_privilege = estate_burghers_land_rights
						has_estate_privilege = estate_eunuchs_land_rights_privilege
						has_estate_privilege = estate_church_land_rights
						has_estate_privilege = estate_nobles_land_rights 
					}
					set_country_flag = mng_increased_land_rights_flag 
					add_ruler_modifier = {
						name = mng_cabinet_cooperation_modifier
						duration = -1 
					}
				}
				else_if = {
					limit = { 
						has_dlc = "Rights of Man" 
						has_dlc = "Mandate of Heaven" 
						NOT = { num_of_ruler_traits = { amount = 3 } }
					}
					change_government_reform_progress = -150 
					add_ruler_personality = reformist_personality
					set_country_flag = mng_empowered_pop_census_flag 
				}
				else = { 
					change_adm = 1 
					change_government_reform_progress = -100 
					set_country_flag = mng_empowered_pop_census_flag 
				}
			}
		}
	}
	
	mng_examination_system3 = {
		icon = mission_vedic_education 
		required_missions = { mng_cornerstone_empire3 mng_reform_civil_registration3 }
		position = 10
		
		trigger = {
			OR = {
				has_reform = examination_system_reform
				government_reform_progress = 250 
			}
			crown_land_share = 45 
			stability = 3 
			700 = { owned_by = ROOT }
		}
		
		effect = {
			custom_tooltip = mng_exam_system_reward_tt
			tooltip = { 
				country_event = { id = flavor_mng.30 } 
			}
			custom_tooltip = mng_insight_30_tt
			
			custom_tooltip = mng_cmb_reward_tt #Reduce Malus of the starting negative modifier by -10% 
			
			if = {
				limit = {
					NOT = { has_harmonized_with = pagan }
					NOT = { has_harmonized_with = vajrayana }
					religion = confucianism
				}
				custom_tooltip = mng_db_reward_1_tt
				tooltip = {
					add_harmonized_religion = pagan
					add_harmonized_religion = vajrayana
					add_harmony = 10
				}
			}
			else = {
				custom_tooltip = mng_db_reward_1_tt
				tooltip = {
					add_country_modifier = {
						name = mng_decentralized_migration_modifier
						duration = -1 
					}
				}
			}
			
			custom_tooltip = mng_erc_reward_tt #20 mana per Eunuch privilege 
			
			custom_tooltip = mng_rf_reward_tt 
			
			custom_tooltip = mng_rc_reward_tt
			
			custom_tooltip = mng_rotc_reward_tt
			tooltip = {
				if = {
					limit = { 
						has_dlc = "Rights of Man" 
						NOT = { num_of_ruler_traits = { amount = 3 } }
						NOT = { dip = 6 } 
					}
					change_dip = 1
					add_ruler_personality = silver_tongue_personality
				}
				else_if = { 
					limit = { 
						NOT = { dip = 5 } 
					}
					change_dip = 1
					add_dip_power = 100 
				} 
				else = { add_dip_power = 200 }
			}
			
			custom_tooltip = mng_cc_reward_tt
			tooltip = { 
				create_explorer = { tradition = 80 } 
				add_country_modifier = {
					name = mng_colonial_focus
					duration = 7300 
				}
			}
			hidden_effect = {
				if = {	
					limit = { has_reform = examination_system_reform }
					country_event = { id = flavor_mng.30 }
				}
				else = { change_government_reform_progress = -250 }
				
				if = {
					limit = { 
						has_country_modifier = mng_starting_malus_5_modifier 
						OR = {
							has_reform = centralize_empire_reform
							has_reform = centralize_reform 
						}
					}
					remove_country_modifier = mng_starting_malus_5_modifier 
					add_country_modifier = {
						name = mng_starting_malus_4_modifier
						duration = -1 
					}
				}
				else_if = {
					limit = { 
						has_country_modifier = mng_starting_malus_4_modifier 
						OR = {
							has_reform = centralize_empire_reform
							has_reform = centralize_reform 
						}
					}
					remove_country_modifier = mng_starting_malus_4_modifier
					add_country_modifier = {
						name = mng_starting_malus_3_modifier
						duration = -1 
					}
				}
				else_if = {
					limit = { 
						has_country_modifier = mng_starting_malus_3_modifier 
						OR = {
							has_reform = centralize_empire_reform
							has_reform = centralize_reform 
						}
					}
					remove_country_modifier = mng_starting_malus_3_modifier
					add_country_modifier = {
						name = mng_starting_malus_2_modifier
						duration = -1 
					}
				}
				else_if = {
					limit = { 
						has_country_modifier = mng_starting_malus_2_modifier 
						OR = {
							has_reform = centralize_empire_reform
							has_reform = centralize_reform 
						}
					}
					remove_country_modifier = mng_starting_malus_1_modifier
					add_country_modifier = {
						name = mng_starting_malus_2_modifier
						duration = -1 
					}
				}
				else_if = {
					limit = { 
						has_country_modifier = mng_starting_malus_1_modifier 
						OR = {
							has_reform = centralize_empire_reform
							has_reform = centralize_reform 
						}
					}
					remove_country_modifier = mng_starting_malus_1_modifier
				}
				else_if = {
					limit = { 
						is_emperor_of_china = yes 
						OR = {
							has_reform = centralize_empire_reform
							has_reform = centralize_reform 
						}
					} 
					add_mandate = 5
				}
				else_if = {
					limit = { 
						is_emperor_of_china = no 
						OR = {
							has_reform = centralize_empire_reform
							has_reform = centralize_reform 
						}
					}
					add_adm_power = 200
				}
				
				if = {
					limit = {
						OR = {
							NOT = { has_harmonized_with = pagan }
							NOT = { has_harmonized_with = vajrayana }
						}
						religion = confucianism
						has_reform = decentralize_reform
					}
					add_harmonized_religion = pagan
					add_harmonized_religion = vajrayana
					add_harmony = 10 
					change_government_reform_progress = -250
				}
				else_if = {
					limit = { has_reform = decentralize_reform } 
					add_country_modifier = {
						name = mng_decentralized_migration_modifier
						duration = -1 
					}
				}
				if = {
					limit = { has_reform = expand_imperial_court_reform }
					add_country_modifier = {
						name = mng_expanded_eunuch_palatial_rights_modifier  
						duration = -1 
					}
					set_estate_privilege = estate_eunuchs_bookkeepers_privilege
					if = {
						limit = { 
							num_of_estate_privileges = {
								estate = estate_eunuchs 
								value = 6 
							}
						}
						add_adm_power = 120 
						add_dip_power = 120 
						add_mil_power = 120 
					}
					else_if = {
						limit = { 
							num_of_estate_privileges = {
								estate = estate_eunuchs 
								value = 5 
							}
						}
						add_adm_power = 100
						add_dip_power = 100 
						add_mil_power = 100
					}
					else_if = {
						limit = { 
							num_of_estate_privileges = {
								estate = estate_eunuchs 
								value = 4 
							}
						}
						add_adm_power = 80
						add_dip_power = 80 
						add_mil_power = 80
					}
					else_if = {
						limit = { 
							num_of_estate_privileges = {
								estate = estate_eunuchs 
								value = 3 
							}
						}
						add_adm_power = 60
						add_dip_power = 60 
						add_mil_power = 60
					}
					else_if = {
						limit = { 
							num_of_estate_privileges = {
								estate = estate_eunuchs 
								value = 2 
							}
						}
						add_adm_power = 40
						add_dip_power = 40 
						add_mil_power = 40
					}
					else = {
						add_adm_power = 20
						add_dip_power = 20 
						add_mil_power = 20
					}
				}
				if = {
					limit = { has_reform = limit_imperial_court_reform }
					define_advisor = {
						type = natural_scientist
						cost_multiplier = 0.5 
						skill = 2
					}
					define_advisor = {
						type = trader
						cost_multiplier = 0.5 
						skill = 2
					}
					define_advisor = {
						type = quartermaster
						cost_multiplier = 0.5 
						skill = 2
					}
				}
				if = {
					limit = { has_reform = regional_council_reform }
					every_owned_province = {
						limit = { has_courthouse_building_trigger = yes development = 15 } 
						add_building = town_hall
						add_base_tax = 1 
					}
				}
				if = {
					limit = { 
						has_reform = representation_of_the_crown_reform
						has_dlc = "Rights of Man" 
						NOT = { num_of_ruler_traits = { amount = 3 } }
						NOT = { dip = 6 } 
					}
					every_subject_country = {
						add_trust = {
							who = ROOT 
							value = 20
							mutual = yes 
						}
						add_liberty_desire = -25 
					}
					change_dip = 1
					add_ruler_personality = silver_tongue_personality
				}
				else_if = { 
					limit = { 
						has_reform = representation_of_the_crown_reform
						NOT = { dip = 5 } 
					}
					change_dip = 1
					add_dip_power = 100 
				} 
				else_if = { 
					limit = { has_reform = representation_of_the_crown_reform } 
					add_dip_power = 200 
				}
				
				if = {
					limit = { has_reform = penal_colonies_reform } 
					create_explorer = { tradition = 80 } 
					add_country_modifier = {
						name = mng_colonial_focus
						duration = 7300 
					}
				}
			}
		}
	}
	
	mng_mutual_trade_system3 = {
		icon = mission_diplomatic_relation 
		required_missions = { mng_censorate3 mng_examination_system3 }
		position = 12
		
		trigger = {
			OR = {
				custom_trigger_tooltip = {
					tooltip = mng_5_tribs_with_opinion_and_lib_desire_tt
					calc_true_if = {
						all_subject_country = {
							is_subject_of_type_with_overlord = { who = ROOT type = tributary_state }
							NOT = { liberty_desire = 10 } 
							has_opinion = { 
								who = ROOT 
								value = 120 
							}
						}
						amount = 5
					}
				}
				calc_true_if = {
					all_ally = {
						has_opinion = {
							who = ROOT 
							value = 150 
						}
						trust = {
							who = ROOT 
							value = 70
						}
					}
					amount = 4 
				}
			}
			government_reform_progress = 150 
		}
		
		effect = { 
			custom_tooltip = mng_ally_reward_tt
			tooltip = {
				add_country_modifier = {
					name = mng_trade_access_in_china_modifier
					duration = -1 
					desc = as_long_as_we_stay_allies_desc
				}
			}
			
			if = { 
				limit = {
					has_dlc = "Mandate of Heaven" 
					is_emperor_of_china = yes 
				}
				custom_tooltip = mng_5_mandate_per_ally_tt
			}
			else = { custom_tooltip = mng_25_mp_per_ally_tt } 
			tooltip = {
				add_country_modifier = {
					name = mng_foreign_merchant_influx_modifier
					duration = 7300 
				}
			}
			
			custom_tooltip = mng_trib_reward_tt
			tooltip = { 
				country_event = { id = flavor_mng.31 }
			}
			custom_tooltip = mng_insight_31_tt
			hidden_effect = {
				if = {
					limit = { 
						calc_true_if = {
							all_ally = {
								has_opinion = {
									who = ROOT 
									value = 150 
								}
								trust = {
									who = ROOT 
									value = 70
								}
							}
							amount = 4 
						}
					}
					every_ally = { 
						limit = { 
							has_opinion = {
								who = ROOT 
								value = 150 
							}
							trust = {
								who = ROOT 
								value = 70
							}
						}
						add_country_modifier = {
							name = mng_trade_access_in_china_modifier
							duration = -1 
							desc = as_long_as_we_stay_allies_desc
						}
					}
					add_country_modifier = {
						name = mng_foreign_merchant_influx_modifier
						duration = 7300 
					}
					if = {
						limit = { has_dlc = "Mandate of Heaven" } 
						every_ally = { 
							limit = { 
								has_opinion = {
									who = ROOT 
									value = 150 
								}
								trust = {
									who = ROOT 
									value = 70
								}
							}
							ROOT = { add_mandate = 5 } 
						}
					}
					else = { 
						every_ally = { 
							limit = { 
								has_opinion = {
									who = ROOT 
									value = 150 
								}
								trust = {
									who = ROOT 
									value = 70
								}
							}
							ROOT = { 
								add_adm_power = 25 
								add_dip_power = 25 
								add_mil_power = 25 
							}
						}
					}
				}
				else = { 
					country_event = { id = flavor_mng.31 }
				}
			}
		}
	}
}

korean_missions_eoc_3 = {
	slot = 3
	generic = no
	ai = yes
	potential = {
		has_dlc = "Domination"
		is_emperor_of_china = yes 
		OR = { 
			tag = KOR
			tag = JOE
		}
	}
	has_country_shield = yes 
	
	mng_tame_china_sorrow3 = {
		icon = mng_tame_china_sorrow
		required_missions = { } 
		position = 9
		provinces_to_highlight = { 
			OR = {
				province_id = 2142
				province_id = 4196
				province_id = 2141
				province_id = 688
				province_id = 1836
			}
			OR = { 
				NOT = { controlled_by = ROOT }
				devastation = 1
				NOT = { num_of_times_improved = 3 } 
			}	
		}
		
		trigger = {
			2142 = { 
				num_of_times_improved = 3 
				owned_by = ROOT 
				if = {
					limit = { has_dlc = "Mandate of Heaven" }
					NOT = { devastation = 1 } 
				}
			}
			4196 = { 
				num_of_times_improved = 3 
				owned_by = ROOT 
				if = {
					limit = { has_dlc = "Mandate of Heaven" }
					NOT = { devastation = 1 } 
				}
			}
			2141 = { 
				num_of_times_improved = 3 
				owned_by = ROOT 
				if = {
					limit = { has_dlc = "Mandate of Heaven" }
					NOT = { devastation = 1 } 
				}
			}
			688 = { 
				num_of_times_improved = 3 
				owned_by = ROOT 
				if = {
					limit = { has_dlc = "Mandate of Heaven" }
					NOT = { devastation = 1 } 
				}
			}
			1836 = { 
				num_of_times_improved = 3 
				owned_by = ROOT 
				if = {
					limit = { has_dlc = "Mandate of Heaven" }
					NOT = { devastation = 1 } 
				}
			}
		}
		
		effect = { 
			country_event = { id = flavor_mng.35 }
			custom_tooltip = mng_insight_35_tt
		}
	}
	
	mng_single_whip_law3 = {
		icon = mission_african_gold 
		required_missions = { mng_examination_system3 }
		position = 11
		provinces_to_highlight = { 
			OR = {
				province_id = 2174 
				province_id = 2139 
			}
			NOT = { base_production = 12 }
		}
		
		trigger = {
			empire_of_china_reform_passed = reform_land_tax_decision
			2174 = { 
				owned_by = ROOT 
				base_production = 12 
			}
			2139 = { 
				owned_by = ROOT 
				base_production = 12 
			}
			has_idea = single_whip_law
			NOT = { inflation = 1 }
			NOT = { num_of_loans = 1 } 
			current_income_balance = 35
			OR = {
				has_estate_privilege = estate_eunuchs_single_whip_law_privilege 
				government_reform_progress = 250 
			}
		}
		
		effect = {
			country_event = { id = flavor_mng.36 }
			custom_tooltip = mng_insight_36_tt
		}
	}
	
	mng_pure_land3 = {
		icon = mng_pure_land 
		required_missions = { }
		position = 12
		provinces_to_highlight = { 
			province_id = 2140 
			OR = {
				NOT = { has_tax_building_trigger = yes } 
				NOT = { num_of_times_improved = 5 } 
			}
		}
		
		trigger = {
			num_of_owned_provinces_with = {
				has_tax_building_trigger = yes 
				value = 15 
			}
			2140 = {
				num_of_times_improved = 5 
				has_tax_building_trigger = yes 
			}
			if = {
				limit = { 
					has_dlc = "Mandate of Heaven" 
					religion = confucianism 
				} 
				harmony = 90 
			}
			else_if = {
				limit = { has_estate = estate_church } 
				estate_loyalty = {
					estate = estate_church 
					loyalty = 65 
				}
			}
			else = { prestige = 40 } 
		}
		
		effect = {
			if = {
				limit = { 
					has_dlc = "Leviathan" 
					2140 = {
						NOT = { 
							has_great_project = {
								type = temple_of_confucius 
								tier = 3 
							}
						}
					}
				}
				2140 = {
					add_great_project_tier = {
						type = temple_of_confucius 
						tier = 1 
					}
				}
			}
			else = {
				2140 = {
					add_base_tax = 3 
					add_base_production = 3 
				}
			}
			2140 = { 
				add_building = cathedral 
				remove_building = temple 
			}
			add_stability_or_adm_power = yes 
		}
	}
	
	mng_shengshi_zhishi3 = {
		icon = mng_shengshi_zhishi 
		required_missions = { mng_mutual_trade_system3 mng_pure_land3 mng_expand_yongle_dadian3 }
		position = 13		
		trigger = {
			if = {
				limit = { 
					has_dlc = "Mandate of Heaven" 
					is_emperor_of_china = yes 
				}
				imperial_mandate = 95 
			}
			else = { prestige = 90 } 
			if = {
				limit = { 
					has_dlc = "Mandate of Heaven" 
					is_emperor_of_china = yes 
				}
				empire_of_china_num_reforms_passed = 10
				imperial_mandate = 95 
			}
			else = { prestige = 90 } 
			NOT = { 
				num_of_estate_privileges = {	
					estate = estate_eunuchs 
					value = 1
				}
			}
			NOT = { 
				num_of_estate_privileges = {	
					estate = estate_nobles  
					value = 1 
				}
			}
			NOT = { 
				num_of_estate_privileges = {	
					estate = estate_burghers  
					value = 1 
				}
			}
			NOT = { 
				num_of_estate_privileges = {	
					estate = estate_church  
					value = 1 
				}
			}
			NOT = {
				estate_influence = {
					estate = estate_nobles 
					influence = 40 
				}
			}
			NOT = {
				estate_influence = {
					estate = estate_church 
					influence = 40 
				}
			}
			NOT = {
				estate_influence = {
					estate = estate_burghers  
					influence = 40 
				}
			}
			NOT = {
				estate_influence = {
					estate = estate_eunuchs  
					influence = 40 
				}
			}
			monthly_adm = 12 
			NOT = { num_of_loans = 1 } 
			OR = { 
				in_golden_age = yes  
				monthly_income = 500 
			}
		}
		
		effect = {
			custom_tooltip = mng_passing_reform_grants_10_estate_loyalty_tt
			add_power_projection = {
				type = 25_permanent_power_projection
				amount = 25
			}
			custom_tooltip = zim_amongst_the_great_powers_tt 
			add_country_modifier = { 
				name = mng_prosperous_era_modifier
				duration = -1 
			}
			if = { 
				limit = { has_dlc = "Mandate of Heaven" }
				if = {
					limit = { has_had_golden_age = yes } 
					reset_golden_age = yes 
				}
				else_if = {
					limit = { in_golden_age = yes } 
					extend_golden_age = 240
				}
			}
			set_country_flag = mng_shengshi_reward_flag 
			add_country_modifier = {
				name = mng_well_governed_era_modifier 
				duration = 9125 
			}
			change_ruler_stat = {
				type = adm
				amount = 1
			}
			change_ruler_stat = {
				type = dip
				amount = 1
			}
			change_ruler_stat = {
				type = mil
				amount = 1
			}
		}
	}	
}

korean_missions_eoc_4 = {
	slot = 4
	generic = no
	ai = yes
	potential = {
		has_dlc = "Domination"
		is_emperor_of_china = yes 
		OR = { 
			tag = KOR
			tag = JOE
		}
	}
	has_country_shield = yes 	
	
	mng_expand_bogue3 = {
		icon = mng_expand_bogue 
		required_missions = {  } 
		position = 9
		provinces_to_highlight = { 
			province_id = 667 
			NOT = { num_of_times_improved = 4 } 
			OR = {
				num_of_times_expanded_infrastructure = 1 
				has_trade_building_trigger = no 
			}
		} 
		
		trigger = { 
			667 = {
				num_of_times_improved = 4 
				OR = {
					num_of_times_expanded_infrastructure = 1 
					has_trade_building_trigger = yes 
				}
			}
			if = { 
				limit = { has_estate = estate_burghers }
				estate_loyalty = {
					estate = estate_burghers 
					loyalty = 60 
				}
			}
		}
		
		effect = {
			custom_tooltip = mng_pearly_estuary_upgraded_tt
			hidden_effect = {
				667 = {
					remove_province_modifier = pearl_estuary_modifier
					add_province_modifier = {
						name = mng_bogue_modifier 
						duration = -1 
					}
				}
				if = { 
					limit = { has_dlc = "Leviathan" }
					custom_tooltip = mng_10_loyalty_for_burghers_on_expand_infr_tt
					set_country_flag = mng_10_loyalty_for_burghers_on_expand_infr_flag
				}
				else = { add_adm_power = 100 }
			}
		}
	}
	
	mng_jing_hang_grand_canal3 = {
		icon = mng_jing_hang_grand_canal 
		required_missions = { mng_tame_china_sorrow3 mng_expand_bogue3 } 
		position = 10
		provinces_to_highlight = { 
			OR = { 
				province_id = 684 
				province_id = 1822 
				province_id = 2145 
				province_id = 1821
			}
			OR = { 
				NOT = { num_of_buildings_in_province = 3 }
				has_production_building_trigger = no 
				NOT = { num_of_times_expanded_infrastructure = 1 }
			}
		}
		
		trigger = {
			if = { 
				limit = { has_dlc = "Leviathan" }
				684 = {
					OR = { 
						has_great_project = {
							type = grand_canal_1
							tier = 2 
						}
						AND = {
							num_of_buildings_in_province = 3
							has_production_building_trigger = yes 
							num_of_times_expanded_infrastructure = 1 
						}
					}
				}
			}
			else = { 
				684 = { num_of_times_improved = 5 }
			} 
			if = {
				limit = { has_dlc = "Mandate of Heaven" }
				684 = {
					NOT = { devastation = 1 } 
				}
			}
			else = { 
				684 = {
					NOT = { local_autonomy_above_min = 5 } 
				}
			}
			if = { 
				limit = { has_dlc = "Leviathan" }
				1822 = { 
					OR = { 
						has_great_project = {
							type = grand_canal_2
							tier = 2 
						}
						AND = {
							num_of_buildings_in_province = 3
							has_production_building_trigger = yes 
							num_of_times_expanded_infrastructure = 1 
						}
					}
				}
			}
			else = { 
				1822 = { num_of_times_improved = 5 }
			} 
			if = {
				limit = { has_dlc = "Mandate of Heaven" }
				1822 = {
					NOT = { devastation = 1 } 
				}
			}
			else = { 
				1822 = {
					NOT = { local_autonomy_above_min = 5 } 
				}
			}
			if = { 
				limit = { has_dlc = "Leviathan" }
				2145 = { 
					OR = { 
						has_great_project = {
							type = grand_canal_3
							tier = 2 
						}
						AND = {
							num_of_buildings_in_province = 3
							has_production_building_trigger = yes 
							num_of_times_expanded_infrastructure = 1 
						}
					}
				}
			}
			else = { 
				2145 = { num_of_times_improved = 5 }
			} 
			if = {
				limit = { has_dlc = "Mandate of Heaven" }
				2145 = {
					NOT = { devastation = 1 } 
				}
			}
			else = { 
				2145 = {
					NOT = { local_autonomy_above_min = 5 } 
				}
			}
			if = { 
				limit = { has_dlc = "Leviathan" }
				1821 = { 
					OR = { 
						has_great_project = {
							type = grand_canal_4
							tier = 2 
						}
						AND = {
							num_of_buildings_in_province = 3
							has_production_building_trigger = yes 
							num_of_times_expanded_infrastructure = 1 
						}
					}
				}
			}
			else = { 
				1821 = { num_of_times_improved = 5 }
			} 
			if = {
				limit = { has_dlc = "Mandate of Heaven" }
				1821 = {
					NOT = { devastation = 1 } 
				}
			}
			else = { 
				1821 = {
					NOT = { local_autonomy_above_min = 5 } 
				}
			}
		}
		
		effect = { 
			country_event = { id = flavor_mng.34 }
			custom_tooltip = mng_insight_34_tt 
		}
	}
	
	mng_expand_yongle_dadian3 = {
		icon = mng_expand_yongle_dadian 
		required_missions = { mng_single_whip_law3 mng_fortify_coast3  } 
		position = 12
		provinces_to_highlight = {
			owned_by = ROOT 
			trade_goods = paper 
			OR = {
				NOT = { base_production = 10 }
				has_production_building_trigger = no
			}
		}
		
		trigger = {
			if = { 
				limit = { 
					has_dlc = "Mandate of Heaven" 
					is_emperor_of_china = yes 
				}
				imperial_mandate = 80 
			}
			else = { prestige = 40 }
			num_of_owned_provinces_with = { 
				trade_goods = paper 
				base_production = 10 
				has_production_building_trigger = yes 
				value = 4 
			}
			OR = { 
				if = { 
					limit = { has_dlc = "Rights of Man" }
					ruler_has_personality = free_thinker_personality 
				}
				else = { monthly_adm = 9 } 
				if = { 
					limit = { has_dlc = "Rights of Man" }
					ruler_has_personality = scholar_personality 
				}
				else = { has_adm_advisor_3 = yes }
				full_idea_group = innovativeness_ideas 
				has_institution = printing_press 
			}	
		}
		
		effect = {
			if = { 
				limit = { has_dlc = "Rule Britannia" }
				change_innovativeness = 5 
			}
			else = { add_adm_power = 50 add_dip_power = 50 add_mil_power = 50 } 
			
			custom_tooltip = mng_every_province_requirements_tt
			tooltip = { 
				add_province_modifier = { 
					name = mng_imperial_printing_center_modifier
					duration = -1 
				}
			}
			
			if = {
				limit = { 
					NOT = { is_institution_enabled = printing_press } 
				}
				custom_tooltip = mng_before_printing_press_embraced_tt
				hidden_effect = { 
					every_owned_province = { 
						limit = {
							trade_goods = paper 
							base_production = 10 
							has_production_building_trigger = yes 
						}
						add_institution_embracement = {
							which = printing_press 
							value = 100 
						}
					}
				}
			}
			hidden_effect = {
				every_owned_province = { 
					limit = {
						trade_goods = paper 
						base_production = 10 
						has_production_building_trigger = yes 
					}
					add_province_modifier = { 
						name = mng_imperial_printing_center_modifier
						duration = -1 
					}
				}
			}
		}
	}
}

korean_missions_eoc_5 = {
	slot = 5
	generic = no
	ai = yes
	potential = {
		has_dlc = "Domination"
		is_emperor_of_china = yes 
		OR = { 
			tag = KOR
			tag = JOE
		}
		capital_scope = { continent = asia }
	}
	has_country_shield = yes 
	
	mng_form_depots3 = {
		icon = mng_form_depots 
		required_missions = {  } 
		position = 9
		provinces_to_highlight = {
			OR = { 
				province_id = 696 
				province_id = 4194
			}
		} 
		trigger = { 
			OR = { 
				spymaster = 1 
				ruler_has_personality = intricate_web_weaver_personality
				dip = 5 
				has_idea = efficient_spies
				national_focus = DIP 
			}
			OR = { 
				696 = { 
					development = 15 
					owned_by = ROOT 
				}
				4194 = {
					development = 15 
					owned_by = ROOT 
				}
			}
			if = { 
				limit = { has_estate = estate_eunuchs } 
				estate_loyalty = {
					estate = estate_eunuchs 
					loyalty = 60 
				}
			}
		}
		
		effect = {
			country_event = { id = flavor_mng.40 }
			custom_tooltip = mng_insight_40_tt
		}
	}
	
	mng_outer_city_beijing3 = {
		icon = mng_outer_city_beijing 
		required_missions = { mng_form_depots3 } 
		position = 10
		provinces_to_highlight = { 
			province_id = 1816 
			OR = { 
				has_tax_building_trigger = no 
				has_production_building_trigger = no 
				has_trade_building_trigger = no 
				has_manpower_building_trigger = no 
			}
		} 
		
		trigger = { 
			1816 = { development = 35 }
			1816 = { 
				has_tax_building_trigger = yes
				has_production_building_trigger = yes  
				has_trade_building_trigger = yes  
				has_manpower_building_trigger = yes 
			}
			1816 = { 
				OR = { 
					if = {
						limit = { has_dlc = "Mandate of Heaven" } 
						prosperity = 50 
					}
					if = { 
						limit = { has_dlc = "Leviathan" } 
						num_of_times_expanded_infrastructure = 1
					}
					else = { num_of_times_improved = 5 } 
				}
			}
		}
		
		effect = {	
			if = {
				limit = { 
					1816 = { has_manufactory_trigger = no } 
				}
				1816 = {
					add_province_modifier = {
						name = mng_outer_wall_beijing_modifier
						duration = -1 
						desc = until_it_is_conquered_desc
					}
				}
				custom_tooltip = mng_can_build_imperial_granary_tt
			}
			else = {
				1816 = {
					add_province_modifier = {
						name = mng_outer_wall_beijing_and_imperial_granary_modifier
						duration = -1
					}
				}
			}
		}
	}
	
	mng_fortify_coast3 = {
		icon = mission_portuguese_malacca 
		required_missions = { mng_outer_city_beijing3 mng_jing_hang_grand_canal3 } 
		position = 11
		provinces_to_highlight = { 
			owned_by = ROOT 
			AND = {
				has_port = yes 
				has_coast_defense_building_trigger = no 
				NOT = { development = 20 }
			}
		} 
		
		trigger = { 
			if = {
				limit = { has_dlc = "Mandate of Heaven" } 
				NOT = { 
					num_of_owned_provinces_with = {
						devastation = 1 
						value = 1 
					}
				}
			}
			num_of_owned_provinces_with = { 
				has_coast_defense_building_trigger = yes 
				development = 20 
				value = 8 
			}
			OR = { 
				num_of_galley = 50 
				num_of_light_ship = 50
			}
			OR = {
				mission_completed = mng_repeal_haijin_policy
				mission_completed = mng_improve_haijin_policy
			}
		}
		
		effect = {
			custom_tooltip = mng_improve_haijin_policy_reward_tt
			tooltip = {
				if = {
					limit = { has_dlc = "Mandate of Heaven" }
					add_prosperity = 100 
					add_mandate = 5 
				}
				if = {
					limit = { has_dlc = "Mandate of Heaven" }
					add_mandate = 5 
				}
				else = { 
					add_base_production = 1 
					owner = { add_prestige_or_monarch_power = { amount = 35 } } 
				} 
				add_province_modifier = {
					name = mng_safe_coasts_modifier
					duration = 9125 
				}
			}
			
			custom_tooltip = mng_repeal_and_replace_reward_policy_tt
			tooltip = {
				define_advisor = {
					type = trader 
					cost_multiplier = 0.1 
				}
				if = { 
					limit = { 
						is_emperor_of_china = yes
						has_dlc = "Mandate of Heaven" 
					}
					add_mandate = 10 
				}
				else = { add_prestige_or_monarch_power = { amount = 35 } }
				change_government_reform_progress = 100 
			}
			
			hidden_effect = { 
				if = {
					limit = { mission_completed = mng_repeal_haijin_policy }
					define_advisor = {
						type = trader 
						cost_multiplier = 0.1 
					}
					if = { 
						limit = { 
							is_emperor_of_china = yes
							has_dlc = "Mandate of Heaven" 
						}
						add_mandate = 10 
					}
					else = { 
						add_prestige_or_monarch_power = { amount = 35 }
					}
					change_government_reform_progress = 100 
					set_country_flag = mng_trade_eff_per_dip_advisor_level_flag
				}
				else = {
					add_province_modifier = {
						name = mng_safe_coasts_modifier
						duration = 9125 
					}
					set_country_flag = mng_dev_per_adm_advisor_level_flag
					if = {
						limit = { has_dlc = "Mandate of Heaven" }
						add_prosperity = 100 
						add_mandate = 5 
					}
					else = { 
						add_base_production = 1 
						owner = {
							add_prestige_or_monarch_power = { amount = 35 }
						}
					} 
				}
			}
		}
	}
}