wei_tk_missions_1 = {
	slot = 1
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = WEI
			was_tag = WEI
		}
		NOT = { started_in = 350.1.1 }			#before Ran Wei
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	wei_tk_the_azure_sky_is_dead_mission = {
		icon = mission_chinese_imperial_seal
		required_missions = {  }
		position = 1
		provinces_to_highlight = {
			OR = {
				province_id = 1836	#Luoyang
				province_id = 700	#Chang'an
			}
			has_discovered = ROOT
		}
		trigger = {
			prestige = 50
			owns_core_province = 1836
			owns_core_province = 700
			HND = { 
				NOT = { army_size = ROOT } 
				NOT = { total_development = ROOT }
			}
		}
		effect = {
			add_adm_power = 50
			add_country_modifier = {
				name = "me_wei_custodian_of_the_han_capitals"
				duration = 10950
			}
		}
	}
	wei_tk_emperor_of_wei_mission = {
		icon = mission_chinese_edict
		required_missions = { wei_tk_the_azure_sky_is_dead_mission wei_tk_restoration_of_luoyang_mission }
		position = 2
		trigger = {
			prestige = 70
			custom_trigger_tooltip = {		#fixed script since did not work properly in vanilla
				tooltip = chi_strongest_warlord_tt
				NOT = {
					any_country = { 
						capital_scope = { superregion = china_superregion }
						army_size = ROOT
						total_development = ROOT
					}	
				}
			}
			if = {
				limit = {
					NOT = { started_in = 220.3.16 }
				}
				OR = {
					is_emperor_of_china = yes
					custom_trigger_tooltip = {
						tooltip = genchinese_emulate_wen_of_zhou_mission.tt
						has_country_flag = established_claimant_empire_dec_flag
					}
					has_reform = chinese_claimant_empire_reform
					has_reform = celestial_empire
					government_rank = 3
				}
			}
			else = {
				legitimacy_equivalent = 90
			}
		}
		effect = {
			add_country_modifier = {
				name = "me_wei_wei_emperor"
				duration = 10950
			}
		}
	}
	wei_tk_the_mandate_of_heaven_mission = {
		icon = mission_chinese_son_of_heaven
		required_missions = { wei_tk_emperor_of_wei_mission }
		position = 3
		trigger = {
			OR = { 
				is_emperor_of_china = yes
				custom_trigger_tooltip = {
					tooltip = genchinese_fate_of_the_imperial_seal_mission.tt
					has_country_flag = restored_mandate_of_heaven_mmetr_dec_flag
				}
			}
			legitimacy_equivalent = 90
			empire_of_china_num_reforms_passed = 4
		}
		effect = {
			add_adm_power = 50
			add_country_modifier = {
				name = "me_shu_son_of_heaven"
				duration = -1
			}
		}
	}
	wei_tk_chain_down_the_chanyu_mission = {
		icon = jap_fate_mandate
		required_missions = {  }
		position = 4
		provinces_to_highlight = {
			OR = {
				area = ordos_area
				province_id = 4670
				province_id = 2747
				province_id = 702
				province_id = 2181
				province_id = 2179
				province_id = 698
			}
			NOT = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			ordos_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			owns_or_non_sovereign_subject_of = 4670
			owns_or_non_sovereign_subject_of = 2747
			owns_or_non_sovereign_subject_of = 702
			owns_or_non_sovereign_subject_of = 2181
			owns_or_non_sovereign_subject_of = 2179
			owns_or_non_sovereign_subject_of = 698
			OR = {
				overlord_of = SXI
				NOT = { exists = SXI }
				alliance_with = SXI
			}
		}
		effect = {
			add_mil_power = 50
			add_country_modifier = {
				name = "me_wei_hu_subjects"
				duration = 10950
			}
		}
	}
	wei_tk_humble_the_barbarians_mission = {
		icon = mission_xianbei_desert_warriors
		required_missions = { wei_tk_chain_down_the_chanyu_mission }
		position = 5
		provinces_to_highlight = {
			OR = {
				area = ordos_area
				area = inner_mongolia_area
				area = chahar_area
				area = central_mongolia_area
			}
			OR = {
				NOT = {
					country_or_non_sovereign_subject_holds = ROOT
				}
				NOT = {
					owner = {
						is_subject_of_type_with_overlord = { who = ROOT type = tributary_state }
						has_opinion = { who = ROOT value = 120 }
					}
				}
			}
			has_discovered = ROOT
		}
		trigger = {
			inner_mongolia_area = {
				type = all
				OR = {
					country_or_non_sovereign_subject_holds = ROOT
					custom_trigger_tooltip = {
						tooltip = genchinese_tribute_from_the_five_hu_mission.tt
						owner = {
							is_subject_of_type_with_overlord = { who = ROOT type = tributary_state }
							has_opinion = { who = ROOT value = 120 }
						}
					}
				}
			}
			chahar_area = {
				type = all
				OR = {
					country_or_non_sovereign_subject_holds = ROOT
					custom_trigger_tooltip = {
						tooltip = genchinese_tribute_from_the_five_hu_mission.tt
						owner = {
							is_subject_of_type_with_overlord = { who = ROOT type = tributary_state }
							has_opinion = { who = ROOT value = 120 }
						}
					}
				}
			}
			ordos_area = {
				type = all
				OR = {
					country_or_non_sovereign_subject_holds = ROOT
					custom_trigger_tooltip = {
						tooltip = genchinese_tribute_from_the_five_hu_mission.tt
						owner = {
							is_subject_of_type_with_overlord = { who = ROOT type = tributary_state }
							has_opinion = { who = ROOT value = 120 }
						}
					}
				}
			}
			central_mongolia_area = {
				type = all
				OR = {
					country_or_non_sovereign_subject_holds = ROOT
					custom_trigger_tooltip = {
						tooltip = genchinese_tribute_from_the_five_hu_mission.tt
						owner = {
							is_subject_of_type_with_overlord = { who = ROOT type = tributary_state }
							has_opinion = { who = ROOT value = 120 }
						}
					}
				}
			}
			OR = {
				NOT = { exists = XIB }
				overlord_of = XIB
			}
		}
		effect = {
			add_army_tradition = 20
			add_country_modifier = {
				name = "me_genchnw_five_hu_subjugated"
				duration = 10950
			}
		}
	}
	wei_tk_warlords_of_liangzhou_mission = {
		icon = mission_chinese_monarch_horseback
		required_missions = { wei_tk_control_changan_mission }
		position = 6
		provinces_to_highlight = {
			area = west_gansu_area
			NOT = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			west_gansu_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			add_manpower = 2
			west_gansu_area = {
				limit = {
					country_or_non_sovereign_subject_holds = ROOT
				}
				add_province_modifier = {
					name = "me_wei_xiliang_frontier"
					duration = 10950
				}
			}
		}
	}
	wei_tk_tame_the_western_hu_mission = {
		icon = mission_mongol_charge
		required_missions = { wei_tk_warlords_of_liangzhou_mission }
		position = 8
		provinces_to_highlight = {
			area = amdo_area
			NOT = {
				country_or_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			OR = {
				overlord_of = QIA	#Qiang
				amdo_area = {
					type = all
					country_or_subject_holds = ROOT
				}
				AND = {
					alliance_with = QIA
					reverse_has_opinion = {
						who = QIA
						value = 150
					}
				}
			}
		}
		effect = {
			add_country_modifier = {
				name = "me_wei_hu_negotiator"
				duration = 10950
			}
			define_advisor = {
				type = commandant
				skill = 2
				discount = yes
				culture = tangut
			}
		}
	}
	wei_tk_secure_the_jade_gate_mission = {
		icon = mission_silk_road
		required_missions = { wei_tk_tame_the_western_hu_mission }
		position = 9
		provinces_to_highlight = {
			OR = {
				AND = {
					OR = {
						area = kashgaria_area
						area = tarim_basin_area		#North Altishahr
						area = shanshan_area
					}
					NOT = {
						country_or_non_sovereign_subject_holds = ROOT
					}
				}
				AND = {
					province_id = 707	#Yumen trade node
					NOT = {
						is_strongest_trade_power = ROOT
					}
				}
			}
			has_discovered = ROOT
		}
		trigger = {
			owns_core_province = 707
			707 = {
				is_strongest_trade_power = ROOT
			}
			kashgaria_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			tarim_basin_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			shanshan_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			add_dip_power = 75
			add_mercantilism_or_monarch_power = { amount = 2 }
			define_advisor = {
				type = trader
				skill = 3
				discount = yes
				culture = tocharian
				religion = dharmaguptaka
			}
			if = {
				limit = {
					OR = {
						NOT = { exists = WP1 }
						overlord_of = WP1
					}
				}
				country_event = {
					id = mmetr_HND_mission_events.7		#Can spawn Western Protectorate subject
				}
			}
		}
	}
	wei_tk_silk_road_hegemon_mission = {
		icon = mission_chinese_market
		required_missions = { wei_tk_secure_the_jade_gate_mission }
		position = 11
		provinces_to_highlight = {
			if = {
				limit = {
					ROOT = {
						NOT = { silk = 8 }
					}
				}
				trade_goods = silk
				has_discovered = ROOT
			}
			else = {
				always = no
			}
		}
		trigger = {
			production_leader = {
				trade_goods = silk
			}
			silk = 8
		}
		effect = {
			add_prestige = 15
			add_mercantilism_or_monarch_power = { amount = 2 }
			add_country_modifier = {
				name = "silk_road_modifier"
				duration = 9125
			}
			define_advisor = {
				type = trader
				skill = 2
				discount = yes
			}
		}
	}
}

wei_tk_missions_2 = {
	slot = 2
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = WEI
			was_tag = WEI
		}
		NOT = { started_in = 350.1.1 }			#before Ran Wei
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	wei_tk_restoration_of_luoyang_mission = {
		icon = mng_tame_china_sorrow
		required_missions = {  }
		position = 1
		provinces_to_highlight = {
			province_id = 1836
			OR = {
				NOT = { num_of_times_improved_by_owner = 3 }
				devastation = 1
			}
		}
		trigger = {
			owns_core_province = 1836
			1836 = {
				num_of_times_improved_by_owner = 3
			}
			1836 = {
				NOT = { devastation = 1 }
			}
		}
		effect = {
			if = {
				limit = {
					NOT = { started_in = 220.1.1 }
					is_emperor_of_china = no
					NOT = { government_rank = 3 }
				}
				country_event = {
					id = mmetr_WEI_mission_events.1
				}
				tooltip = {
					add_legitimacy = 25
					add_country_modifier = {
						name = "me_wei_nine_bestowments"
						duration = 10950
					}
				}
			}
			else = {
				country_event = {
					id = mmetr_WEI_mission_events.2
				}
				tooltip = {
					add_legitimacy = 25
					add_country_modifier = {
						name = "me_wei_palace_renovations"
						duration = 10950
					}
				}
			}
		}
	}
	wei_tk_achieve_true_harmony_mission = {
		icon = mng_pure_land
		required_missions = { wei_tk_nine_rank_system_mission }
		position = 2
		trigger = {
			if = {
				limit = {
					has_dlc = "Mandate of Heaven"
					OR = {
						religion = confucianism
						religion = daoism
					}
				}
				harmony = 90
			}
			num_of_owned_provinces_with = {
				value = 20
				OR = {
					has_building = glorious_monument
					has_building = temple
					has_building = cathedral
				}
			}
			capital_scope = {
				OR = {
					has_building = glorious_monument
					has_building = temple
					has_building = cathedral
				}
			}
		}
		effect = {
			add_country_modifier = {
				name = "me_genchnw_temples_of_the_three_teachings"
				duration = 10950
			}
			if = {
				limit = {
					capital_scope = {
						has_building = glorious_monument
					}
				}
				remove_building = glorious_monument
				add_building = temple
			}
		}
	}
	wei_tk_long_divided_must_unite_mission = {
		icon = mng_heavens_will
		required_missions = { wei_tk_emperor_of_wei_mission }
		position = 3
		provinces_to_highlight = {
			superregion = china_superregion
			NOT = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			is_empty = no
			has_discovered = ROOT
		}
		trigger = {
			china_superregion = {
				type = all 
				OR = {
					country_or_non_sovereign_subject_holds = ROOT
					is_empty = yes
				}
			}
			if = {
				limit = { has_dlc = "Mandate of Heaven" } 
				OR = { 
					in_golden_age = yes
					monthly_income = 100
					is_emperor_of_china = yes
				}
			}
			prestige = 80
		}
		effect = {
			if = {
				limit = { is_emperor_of_china = yes } 
				add_country_modifier = {
					name = chi_rising_dynasty_modifier
					duration = -1
				}
			}
			else = {
				add_country_modifier = {
					name = chi_rising_dynasty_modifier2
					duration = -1 
				}
			}
			if = {
				limit = { in_golden_age = yes } 
				extend_golden_age = 120
			}
			else = {
				add_power_projection = { 
					type = 25_permanent_power_projection
					amount = 25 
				}
				custom_tooltip = chi_permanent_pp
			}
		}
	}
	wei_tk_control_changan_mission = {
		icon = qng_north_china
		required_missions = { wei_tk_cao_caos_ambition_mission }
		position = 5
		completed_by = 198.6.1		#Cao Cao takes Chang'an
		provinces_to_highlight = {
			OR = {
				province_id = 700	#Chang'an
				province_id = 1836	#Luoyang
			}
			NOT = {
				owned_by = ROOT
				is_core = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			owns_core_province = 700
			owns_core_province = 1836
		}
		effect = {
			if = {
				limit = {
					is_emperor_of_china = yes
				}
				add_mandate = 15
			}
			else = {
				add_legitimacy = 50
			}
			700 = {
				add_country_modifier = {
					name = "me_wei_tong_gate"
					duration = -1
				}
			}
		}
	}
	wei_tk_the_five_pecks_of_rice_mission = {
		icon = mission_japanese_warrior_monks
		required_missions = { wei_tk_control_changan_mission }
		position = 6
		provinces_to_highlight = {
			province_id = 689		#Hanzhong
			NOT = {
				owned_by = ROOT
				is_core = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			owns_core_province = 689
			OR = {
				NOT = { exists = HNZ }
				overlord_of = HNZ
			}
		}
		effect = {
			country_event = {
				id = mmetr_WEI_mission_events.8
			}
		}
	}
	wei_tk_conquest_of_shu_mission = {
		icon = mission_chu_shi_biao
		required_missions = { wei_tk_warlords_of_liangzhou_mission }
		position = 7
		provinces_to_highlight = {
			OR = {
				area = chuanbei_area
				area = sichuan_area
				area = chuannan_area
				area = yun_gui_area
			}
			NOT = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			owns_core_province = 679	#Chengdu
			chuanbei_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			sichuan_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			chuannan_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			yun_gui_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			OR = {
				NOT = { exists = SHU }
				overlord_of = SHU
			}
		}
		effect = {
			country_event = {
				id = mmetr_WEI_mission_events.9
			}
			tooltip = {
				add_adm_power = 100
				add_prestige = 15
				add_ruler_modifier = {
					name = "me_wei_great_conqueror"
					duration = -1
				}
			}
		}
	}
	wei_tk_jingzhou_campaign_mission = {
		icon = mng_tame_china_sorrow
		required_missions = { wei_tk_seize_shouchun_mission }
		position = 8
		provinces_to_highlight = {
			OR = {
				area = huguang_area		#Hubei
				area = hunan_area
			}
			NOT = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			huguang_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			hunan_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			add_army_tradition = 10
			add_adm_power = 50
			add_dip_power = 50
		}
	}
	wei_tk_the_famed_hanxuema_mission = {
		icon = mission_marwari_horses
		required_missions = { wei_tk_secure_the_jade_gate_mission }
		position = 10
		provinces_to_highlight = {
			area = ferghana_area
			NOT = {
				country_or_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			ferghana_area = {
				type = all
				OR = {
					country_or_non_sovereign_subject_holds = ROOT
					custom_trigger_tooltip = {
						tooltip = genchinese_subjugate_the_hanguo_mission.tt
						owner = {
							is_subject_of_type_with_overlord = { who = ROOT type = tributary_state }
							has_opinion = { who = ROOT value = 120 }
						}
					}
				}
			}
		}
		effect = {
			add_country_modifier = {
				name = "me_xib_heavenly_horses_of_ferghana"
				duration = 9125
			}
		}
	}
	wei_tk_universal_emperor_mission = {
		icon = mission_seize_the_dragon_throne
		required_missions = { wei_tk_pacify_the_south_mission }
		position = 12
		trigger = {
			custom_trigger_tooltip = {
				tooltip = genchinese_center_of_the_world_mission.tt
				capital_scope = {
					NOT = {
						any_province = {
							superregion = china_superregion
							higher_development_than = PREV
						}
					}
				}
			}
			calc_true_if = {
				custom_trigger_tooltip = {
					tooltip = genchinese_tribute_to_the_emperor_mission.tt
					all_subject_country = {
						is_subject_of_type_with_overlord = { who = ROOT type = tributary_state }
					}
				}
				amount = 10
			}
		}
		effect = {
			add_dip_power = 75
			add_country_modifier = {
				name = "me_genchnw_foreign_tribute"
				duration = 10950
			}
		}
	}
}

wei_tk_missions_3 = {
	slot = 3
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = WEI
			was_tag = WEI
		}
		NOT = { started_in = 350.1.1 }			#before Ran Wei
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	wei_tk_nine_rank_system_mission = {
		icon = mission_chinese_officials_in_line
		required_missions = {  }
		position = 1
		trigger = {
			NOT = { corruption = 1 }
			stability = 2
			government_reform_progress = 50
			custom_trigger_tooltip = {
				tooltip = has_two_hired_advisors.tt
				has_two_hired_advisors = yes
			}
		}
		effect = {
			add_country_modifier = {
				name = "me_wei_nine_rank_system"
				duration = 10950
			}
		}
	}
	wei_tk_check_the_wei_princes_mission = {
		icon = mission_chinese_recruitment
		required_missions = { wei_tk_nine_rank_system_mission }
		position = 2
		trigger = {
			has_regency = no
			if = {
				limit = { has_estate = estate_nobles }
				OR = {
					estate_loyalty = {
						estate = estate_nobles 
						loyalty = 65 
					}
					NOT = {
						estate_influence = {
							estate = estate_nobles
							influence = 20
						}
					}
				}
			}
			else = {
				stability = 3
				legitimacy_equivalent = 95
			}
		}
		effect = {
			country_event = {
				id = mmetr_WEI_mission_events.4
			}
			tooltip = {
				add_country_modifier = {
					name = "me_wei_cadet_branches_of_wei"
					duration = 10950
				}
			}
		}
	}
	wei_tk_cao_caos_ambition_mission = {
		icon = mission_chinese_ruler_in_hall
		required_missions = {  }
		position = 4
		trigger = {
			army_size_percentage = 0.8
			OR = { 
				has_reform = chinese_warlord
				has_reform = warlord_state
				is_subject = no 
				AND = { 
					is_subject = yes 
					num_of_allies = 3 
				}
			}
			if = {
				limit = { is_subject = yes } 
				overlord = { 
					OR = {
						has_opinion_modifier = {
							who = ROOT  
							modifier = insulted
						}
						has_opinion_modifier = {
							who = ROOT  
							modifier = scornfully_insulted
						}
					}
				}
			}
		}
		effect = {
			add_manpower = 2
			add_country_modifier = {
				name = "me_genchnw_just_cause_for_reunification"
				duration = 10950
			}
			north_henan_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			henan_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			shanxi_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			shaanxi_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			south_hebei_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			west_shandong_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			shandong_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			anhui_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			jiangsu_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			south_jiangsu_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			huguang_area = {		#Hubei
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	wei_tk_march_to_xu_province_mission = {
		icon = mission_chinese_army_mobilization_medieval
		required_missions = { wei_tk_cao_caos_ambition_mission }
		position = 5
		completed_by = 199.2.7
		provinces_to_highlight = {
			OR = {
				area = anhui_area
				area = jiangsu_area
				area = south_jiangsu_area
			}
			NOT = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			anhui_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			jiangsu_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			south_jiangsu_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			add_manpower = 2
			add_army_tradition = 10
			south_anhui_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	wei_tk_seize_shouchun_mission = {
		icon = mng_thirteen_provinces
		required_missions = { wei_tk_march_to_xu_province_mission }
		position = 7
		provinces_to_highlight = {
			area = south_anhui_area
			NOT = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			south_anhui_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			add_adm_power = 50
			add_army_tradition = 10
			huguang_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			hunan_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			jiangxi_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			zhejiang_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			fujian_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	wei_tk_avenge_red_cliffs_mission = {
		icon = mission_chinese_defeated_banner
		required_missions = { wei_tk_seize_shouchun_mission }
		position = 8
		provinces_to_highlight = {
			OR = {
				area = jiangxi_area
				area = zhejiang_area
				area = fujian_area
			}
			NOT = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			jiangxi_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			zhejiang_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			fujian_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			if = {
				limit = {
					started_in = 195.1.1
				}
				OR = {
					NOT = { exists = WUU }
					overlord_of = WUU
				}
			}
		}
		effect = {
			country_event = {
				id = mmetr_WEI_mission_events.5
			}
			add_navy_tradition = 10
			add_country_modifier = {
				name = "me_wei_wu_marines"
				duration = 10950
			}
			west_guangdong_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			guangzhou_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			guangxi_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			guangdong_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	wei_tk_jiaozhi_commandery_mission = {
		icon = mission_mnd_dai_temples
		required_missions = { wei_tk_avenge_red_cliffs_mission wei_tk_jingzhou_campaign_mission }
		position = 9
		provinces_to_highlight = {
			OR = {
				area = west_guangdong_area
				area = guangzhou_area
				area = guangxi_area
				area = guangdong_area
			}
			NOT = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			west_guangdong_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			guangzhou_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			guangxi_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			guangdong_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			add_country_modifier = {
				name = "me_shu_jiaozhi_shipyards"
				duration = 10950
			}
		}
	}
	wei_tk_pacify_the_south_mission = {
		icon = mission_conquer_burma
		required_missions = { wei_tk_jiaozhi_commandery_mission }
		position = 11
		provinces_to_highlight = {
			OR = {
				area = red_river_delta_area
				area = vietnam_area
			}
			NOT = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			red_river_delta_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
				NOT = { unrest = 5 }
			}
			vietnam_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
				NOT = { unrest = 5 }
			}
		}
		effect = {
			add_country_modifier = {
				name = "me_genchnw_chinese_war_elephants"
				duration = 10950
			}
		}
	}
	wei_tk_southern_tributaries_mission = {
		icon = mission_kowtow
		required_missions = { wei_tk_pacify_the_south_mission }
		position = 12
		trigger = {
			num_of_provinces_owned_or_owned_by_subjects_with = {
				value = 20
				OR = {
					region = indo_china_region
					region = burma_region
					region = malaya_region
				}
				OR = {
					country_or_non_sovereign_subject_holds = ROOT
					custom_trigger_tooltip = {
						tooltip = genchinese_tribute_from_the_five_hu_mission.tt
						owner = {
							is_subject_of_type_with_overlord = { who = ROOT type = tributary_state }
							has_opinion = { who = ROOT value = 120 }
						}
					}
				}
			}
		}
		effect = {
			add_prestige = 10
			add_navy_tradition = 10
			add_country_modifier = {
				name = "me_wei_southern_merchants"
				duration = -1
			}
		}
	}
}

wei_tk_missions_4 = {
	slot = 4
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = WEI
			was_tag = WEI
		}
		NOT = { started_in = 350.1.1 }			#before Ran Wei
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	wei_tk_cultivate_xuchang_mission = {
		icon = mng_outer_city_beijing
		required_missions = {  }
		position = 1
		provinces_to_highlight = {
			province_id = 688	#Kaifeng/Xuchang
			NOT = {
				num_of_times_improved_by_owner = 5
			}
			has_discovered = ROOT
		}
		trigger = {
			owns_core_province = 688
			688 = {
				num_of_times_improved_by_owner = 5
			}
		}
		effect = {
			688 = {
				add_province_modifier = {
					name = "me_wei_cao_clan_ancestral_capital"
					duration = 10950
				}
			}
		}
	}
	wei_tk_edict_for_talents_mission = {
		icon = mission_chinese_scholars_scrolls
		required_missions = { wei_tk_cultivate_xuchang_mission wei_tk_nine_rank_system_mission }
		position = 2
		trigger = {
			custom_trigger_tooltip = {
				tooltip = has_two_hired_skill_3_advisors.tt
				has_two_hired_skill_3_advisors = yes
			}
			if = {
				limit = {
					has_dlc = "Mandate of Heaven"
					is_emperor_of_china = yes
				}
				OR = {
					empire_of_china_has_active_decree = conduct_census_decree
					empire_of_china_has_active_decree = expand_bureaucracy_decree
					empire_of_china_has_active_decree = improved_conduct_census_decree
				}
			}
		}
		effect = {
			country_event = {
				id = mmetr_WEI_mission_events.3
			}
			tooltip = {
				add_country_modifier = {
					name = "me_wei_edict_for_talents"
					duration = -1
				}
				add_country_modifier = {
					name = "me_wei_meritocratic_education"
					duration = 10950
				}
			}
		}
	}
	wei_tk_three_caos_of_jianan_poetry_mission = {
		icon = mng_expand_yongle_dadian
		required_missions = { wei_tk_edict_for_talents_mission }
		position = 3
		trigger = {
			OR = {
				artist = 3
				ruler_has_personality = scholar_personality
				ruler_has_personality = patron_of_arts_personality
				heir_has_personality = scholar_personality
				heir_has_personality = patron_of_arts_personality
			}
		}
		effect = {
			add_prestige = 10
			add_dip_power = 75
		}
	}
	wei_tk_conquer_jizhou_mission = {
		icon = mission_chinese_fortress_siege
		required_missions = { wei_tk_cao_caos_ambition_mission }
		position = 5
		provinces_to_highlight = {
			OR = {
				province_id = 2177
				province_id = 693
				area = south_hebei_area
				area = west_shandong_area
				area = shandong_area
			}
			NOT = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			owns_or_non_sovereign_subject_of = 2177
			owns_or_non_sovereign_subject_of = 693
			south_hebei_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			west_shandong_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			shandong_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			country_event = {
				id = mmetr_WEI_mission_events.6
			}
			tooltip = {
				add_army_tradition = 15
				add_country_modifier = {
					name = "me_wei_officials_of_jizhou"
					duration = 10950
				}
			}
			hebei_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
			liaoning_area = {
				limit = {
					NOT = { owned_by = ROOT }
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	wei_tk_expansion_of_yecheng_mission = {
		icon = mng_jing_hang_grand_canal
		required_missions = { wei_tk_conquer_jizhou_mission }
		position = 6
		provinces_to_highlight = {
			province_id = 4195		#where Ye is
			NOT = {
				num_of_times_improved_by_owner = 3
				development = 12
			}
			has_discovered = ROOT
		}
		trigger = {
			south_hebei_area = {
				type = all
				owned_by = ROOT
			}
			owns_core_province = 4195
			4195 = {
				num_of_times_improved_by_owner = 3
			}
			4195 = {
				development = 12
			}
		}
		effect = {
			country_event = {
				id = mmetr_WEI_mission_events.7
			}
			tooltip = {
				south_hebei_area = {
					limit = {
						owned_by = ROOT
					}
					add_province_modifier = {
						name = "me_wei_yecheng_canals"
						duration = -1
					}
				}
				4195 = {
					add_province_modifier = {
						name = "me_wei_hall_of_civil_splendor"
						duration = -1
					}
				}
			}
		}
	}
	wei_tk_bronze_bird_pavilion_mission = {
		icon = mission_chinese_castle_tower
		required_missions = { wei_tk_expansion_of_yecheng_mission }
		position = 7
		provinces_to_highlight = {
			province_id = 4195
			OR = {
				NOT = { owned_by = ROOT }
				NOT = {
					has_great_project = {
						type = bronze_bird_terrace
						tier = 2
					}
				}
			}
			has_discovered = ROOT
		}
		trigger = {
			owns_core_province = ROOT
			4195 = {
				has_great_project = {
					type = bronze_bird_terrace
					tier = 2
				}
			}
		}
		effect = {
			country_event = {
				id = mmetr_WEI_mission_events.10
			}
			tooltip = {
				add_prestige = 15
				4195 = {
					add_province_modifier = {
						name = "me_wei_a_new_changan"
						duration = 10950
					}
				}
				if = {
					limit = { 
						has_dlc = "Rights of Man" 
						NOT = { num_of_ruler_traits = { amount = 3 } }
					}
					add_ruler_personality = architectural_visionary_personality
				}
			}
		}
	}
	wei_tk_hefei_xincheng_mission = {
		icon = mission_korean_hwaseong_fortress_18th
		required_missions = { wei_tk_seize_shouchun_mission }
		position = 8
		provinces_to_highlight = {
			province_id = 1838
			OR = {
				NOT = { owned_by = ROOT is_core = ROOT }
				NOT = { num_of_times_improved_by_owner = 3 }
				NOT = { fort_level = 1 }
			}
		}
		trigger = {
			owns_core_province = 1838
			1838 = { num_of_times_improved_by_owner = 3 }
			1838 = { fort_level = 1 }
		}
		effect = {
			1838 = {
				add_province_modifier = {
					name = "me_wei_hefei_xincheng"
					duration = -1
				}
			}
		}
	}
	wei_tk_a_great_wei_fleet_mission = {
		icon = mission_korean_naval_battle_panokseon
		required_missions = { wei_tk_hefei_xincheng_mission }
		position = 9
		trigger = {
			navy_size = 30
			num_of_owned_provinces_with = {
				value = 12
				has_port = yes
			}
		}
		effect = {
			add_navy_tradition = 10
			add_country_modifier = {
				name = "me_genchnw_tower_ship_fleet"
				duration = 10950
			}
			define_advisor = {
				type = naval_reformer
				skill = 2
				discount = yes
			}
		}
	}
	wei_tk_the_land_of_himiko_mission = {
		icon = mission_japanese_wa_himiko
		required_missions = { wei_tk_subdue_the_samhan_mission }
		position = 11
		trigger = {
			any_known_country = {
				capital_scope = {
					region = japan_region
				}
				OR = {
					has_opinion = { 
						who = ROOT
						value = 120
					}
					is_subject_of = ROOT
					alliance_with = ROOT
				}
			}
		}
		effect = {
			add_country_modifier = {
				name = "me_wei_overseas_embassies"
				duration = 10950
			}
		}
	}
	wei_tk_tribute_from_the_wajin_mission = {
		icon = mission_japanese_temple_gate
		required_missions = { wei_tk_the_land_of_himiko_mission }
		position = 12
		provinces_to_highlight = {
			region = japan_region
			NOT = {
				country_or_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_subjects_with = {
				value = 10
				region = japan_region
			}
		}
		effect = {
			add_country_modifier = {
				name = "me_genchnw_overseas_exchange"
				duration = 10950
			}
			custom_tooltip = genchinese_overseas_missions_mission.tt
			if = {
				limit = {
					is_emperor_of_china = yes
				}
				every_known_country = {
					limit = {
						capital_scope = {
							region = japan_region
						}
					}
					reverse_add_casus_belli = {
						target = ROOT
						type = cb_force_tributary
						months = 200
					}
				}
			}
		}
	}
}

wei_tk_missions_5 = {
	slot = 5
	generic = no
	ai = yes
	potential = {
		OR = {
			tag = WEI
			was_tag = WEI
		}
		NOT = { started_in = 350.1.1 }			#before Ran Wei
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	wei_tk_implement_tuntian_mission = {
		icon = mission_chinese_land_survey
		required_missions = {  }
		position = 1
		provinces_to_highlight = {
			owned_by = ROOT
			trade_goods = grain
			OR = {
				NOT = { fort_level = 1 }
				NOT = { has_building = armory }
				NOT = { has_building = barracks }
				NOT = { base_manpower = 4 }
				NOT = { base_production = 5 }
			}
		}
		trigger = {
			OR = {
				manpower_percentage = 0.25
				recruitmaster = 2
			}
			num_of_owned_provinces_with = {
				value = 5
				trade_goods = grain
				OR = {
					fort_level = 1
					has_building = armory
					has_building = barracks
					base_manpower = 4
					base_production = 5
				}
			}
		}
		effect = {
			add_country_modifier = {
				name = "me_shu_tuntian_system"
				duration = 10950
			}
		}
	}
	wei_tk_restore_the_iron_monopoly_mission = {
		icon = mission_chinese_merchant
		required_missions = { wei_tk_implement_tuntian_mission wei_tk_cultivate_xuchang_mission }
		position = 2
		provinces_to_highlight = {
			trade_goods = iron
			superregion = china_superregion
			NOT = {
				owned_by = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			num_of_owned_provinces_with = {
				value = 5
				trade_goods = iron
			}
			num_of_owned_provinces_with = {
				value = 3
				trade_goods = iron
				base_production = 5
			}
			if = {
				limit = { has_estate = estate_burghers } 
				OR = {
					estate_loyalty = {
						estate = estate_burghers
						loyalty = 60 
					}
					NOT = {
						estate_influence = {
							estate = estate_burghers
							influence = 10
						}
					}
				}
			}
		}
		effect = {
			add_country_modifier = {
				name = "me_genchnw_state_monopolies_policy"
				duration = 10950
			}
		}
	}
	wei_tk_era_of_the_yellow_dawn_mission = {
		icon = mng_inward_perfection
		required_missions = { wei_tk_restore_the_iron_monopoly_mission wei_tk_edict_for_talents_mission }
		position = 3
		trigger = {
			grown_by_development = 100
			num_of_owned_provinces_with = {
				value = 5
				has_center_of_trade_of_level = 1
				development = 12
			}
			OR = {
				treasury = 1000
				share_of_starting_income = 2.0
			}
		}
		effect = {
			add_country_modifier = {
				name = "me_genchnw_thriving_economy"
				duration = 10950
			}
		}
	}
	wei_tk_tiger_and_leopard_cavalry_mission = {
		icon = mission_chinese_cavalry_charge
		required_missions = {  }
		position = 4
		trigger = {
			num_of_battles = { amount = 20 }
			OR = {
				num_of_cavalry = 15
				cavalry_fraction = 0.15
			}
		}
		effect = {
			add_country_modifier = {
				name = "me_genchnw_tiger_and_leopard_cavalry"
				duration = 10950
			}
		}
	}
	wei_tk_annotate_the_art_of_war_mission = {
		icon = mission_han_army
		required_missions = { wei_tk_tiger_and_leopard_cavalry_mission wei_tk_cao_caos_ambition_mission }
		position = 5
		trigger = {
			is_at_war = no
			has_regency = no
			OR = {
				army_tradition = 65
				AND = {	
					monthly_mil = 9
					army_tradition = 50
				}
			}
		}
		effect = {
			country_event = {
				id = mmetr_Generic_Chinese_mission_events.1
			}
			tooltip = {
				add_country_modifier = {
					name = "me_genchnw_military_treatises"
					duration = 10950
				}
			}
		}
	}
	wei_tk_subjugate_youzhou_mission = {
		icon = mission_ancient_chinese_army_in_siege
		required_missions = { wei_tk_conquer_jizhou_mission }
		position = 6
		provinces_to_highlight = {
			OR = {
				area = hebei_area
				province_id = 4652
				province_id = 2113
				province_id = 2112
				province_id = 3010
				province_id = 2744
				province_id = 1845
				province_id = 733
				province_id = 4231
			}
			NOT = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			hebei_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			owns_or_non_sovereign_subject_of = 4652
			owns_or_non_sovereign_subject_of = 2113
			owns_or_non_sovereign_subject_of = 2112
			owns_or_non_sovereign_subject_of = 3010
			owns_or_non_sovereign_subject_of = 2744
			owns_or_non_sovereign_subject_of = 1845
			owns_or_non_sovereign_subject_of = 733
			owns_or_non_sovereign_subject_of = 4231
		}
		effect = {
			add_country_modifier = {
				name = "me_wei_wuhuan_auxiliaries"
				duration = 10950
			}
		}
	}
	wei_tk_goguryeo_campaign_mission = {
		icon = mission_korean_castle_assault
		required_missions = { wei_tk_subjugate_youzhou_mission }
		position = 8
		provinces_to_highlight = {
			OR = {
				area = hamgyeong_area
				province_id = 2111
				province_id = 4201
				province_id = 4653
				province_id = 2108
				province_id = 4232
			}
			NOT = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			hamgyeong_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			owns_or_non_sovereign_subject_of = 2111
			owns_or_non_sovereign_subject_of = 4201
			owns_or_non_sovereign_subject_of = 4653
			owns_or_non_sovereign_subject_of = 2108
			owns_or_non_sovereign_subject_of = 4232
			OR = {
				overlord_of = GOG
				NOT = { exists = GOG }
			}
		}
		effect = {
			country_event = {
				id = mmetr_WEI_mission_events.11
			}
		}
	}
	wei_tk_subdue_the_samhan_mission = {
		icon = mission_korean_manuscript_map
		required_missions = { wei_tk_goguryeo_campaign_mission }
		position = 10
		provinces_to_highlight = {
			region = korea_region
			NOT = {
				country_or_subject_holds = ROOT
			}
			has_discovered = ROOT
		}
		trigger = {
			korea_region = {
				type = all
				OR = {
					country_or_non_sovereign_subject_holds = ROOT
					custom_trigger_tooltip = {
						tooltip = genchinese_subjugate_the_hanguo_mission.tt
						owner = {
							is_subject_of_type_with_overlord = { who = ROOT type = tributary_state }
							has_opinion = { who = ROOT value = 120 }
						}
					}
				}
			}
		}
		effect = {
			add_sailors = 100
			define_advisor = {
				type = naval_reformer
				skill = 1
				discount = yes
				culture = korean
			}
			add_country_modifier = {
				name = "me_genchnw_korean_vassals"
				duration = 10950
			}
			korea_region = {
				limit = {
					country_or_non_sovereign_subject_holds = ROOT
				}
				add_province_modifier = {
					name = "me_genchnw_korean_integration"
					duration = 10950
				}
			}
		}
	}
	wei_tk_harmony_abroad_mission = {
		icon = mission_chinese_warlords_alliance
		required_missions = { wei_tk_subdue_the_samhan_mission }
		position = 12
		trigger = {
			num_of_owned_provinces_with = {
				value = 20
				has_owner_religion = yes
				OR = {
					region = korea_region
					region = japan_region
				}
			}
			num_of_owned_provinces_with = {
				value = 10
				OR = {
					has_building = glorious_monument
					has_building = temple
					has_building = cathedral
				}
			}
		}
		effect = {
			if = {
				limit = {
					OR = {
						religion = confucianism
						religion = daoism
					}
				}
				add_harmony = 10
			}
			add_adm_power = 60
			add_country_modifier = {
				name = "me_wei_harmonious_empire"
				duration = 10950
			}
		}
	}
}