WoC_yuan_flavor_1 = {
	slot = 1
	generic = no
	ai = yes
	has_country_shield = yes
	potential_on_load = {
		has_dlc = "Winds of Change"
	}
	potential = { 
		OR = {
			tag = YUA 
			AND = {
				tag = MGE
				was_tag = YUA
			}
		}
		has_dlc = "Winds of Change"
	} 

	yua_expand_han_army = {
		icon = mission_chinese_general_riding
		position = 11
		provinces_to_highlight = {  } 

		trigger = {  
			army_size = 15 # modified
			army_tradition = 30
			num_of_generals = 2
		} 

		effect = {  
			add_mil_power = 100
			
			custom_tooltip = SEPERATOR_TOOLTIP
			
			define_advisor = {
				type = commandant
				skill = 2
				culture = mongol
				cost_multiplier = 0.5
			}
		} 
	}

	yua_emperors_guard = {
		icon = mission_non-western_cavalry_raid
		position = 12
		required_missions = { yua_expand_han_army }
	
		trigger = {  
			custom_trigger_tooltip = {
				tooltip = YUA_WON_10_BATTLES_RULER
				check_variable = {
					which = num_of_battles_won_ruler
					value = 10
				}
			}
			is_in_deficit = no
			development_in_provinces = {
				value = 75
				has_manpower_building_trigger = yes
				culture = altaic_new
			}
		} 
	
		effect = {
			if = {
				limit = {
					has_dlc = "Cradle of Civilization"
				}
				custom_tooltip = YUA_UNLOCK_KESHIG_MERCENARY_COMPANY
			}
			else = {
				custom_tooltip = YUA_UNLOCK_KESHIG_MERCENARY_COMPANY_NO_DLC
			}
			set_country_flag = keshig_mercenary_company_flag
			
			custom_tooltip = SEPERATOR_TOOLTIP
			
			add_country_modifier = {
				name = yua_blessed_ones
				duration = 9125
			}
		} 
	}

	yua_southern_army = {
		icon = qng_conquer_south_china
		position = 13
		required_missions = { yua_civil_and_military_affairs } 
		provinces_to_highlight = {  
			region = south_china_region
			country_or_non_sovereign_subject_holds = ROOT
			NOT = { has_forcelimit_building_trigger = yes }
		} 

		trigger = {  
			army_tradition = 40
			army_size = 45 # modified
			num_of_wars = { amount = 15 }
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value = 10
				has_forcelimit_building_trigger = yes
				region = south_china_region
			}
		}

		effect = {  
			change_ruler_stat = {
				type = mil
				amount = 1
			}
			
			custom_tooltip = SEPERATOR_TOOLTIP
			
			distribute_development = {
				amount = 10
				type = manpower
				limit = "
					region = south_china_region
					has_forcelimit_building_trigger = yes
				"
				tooltip = YUA_ONLY_IN_SOUTHERN_CHINA
			}
		}
	}
}
WoC_yuan_flavor_2 = {
	slot = 2
	generic = no
	ai = yes
	has_country_shield = yes
	potential_on_load = {
		has_dlc = "Winds of Change"
	}
	potential = { 
		OR = {
			tag = YUA 
			AND = {
				tag = MGE
				was_tag = YUA
			}
		}
		has_dlc = "Winds of Change"
	}  

	yua_civil_and_military_affairs = {
		icon = mng_survey_ocean_shores
		position = 12
		required_missions = {
			yua_expand_han_army
		}
		provinces_to_highlight = {  
			OR = {
				region = north_china_region
				region = south_china_region
				region = xinan_region
			}
			country_or_non_sovereign_subject_holds = ROOT
			OR = {
				NOT = { has_courthouse_building_trigger = yes }
				NOT = { has_manpower_building_trigger = yes }
			}
		} 

		trigger = {  
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					region = north_china_region
					region = south_china_region
					region = xinan_region
				}
				has_courthouse_building_trigger = yes
				has_manpower_building_trigger = yes
				value = 10
			}
			if = {
				limit = {
					has_dlc = "Mandate of Heaven"
				}
				OR = {
					empire_of_china_reform_passed = reform_civil_registration_decision
					custom_trigger_tooltip = {
						tooltip = YUA_NO_CHINA_PROVINCE_HAS_UNREST
						NOT = {
							any_owned_province = {
								OR = {
									region = north_china_region
									region = south_china_region
									region = xinan_region
								}
								unrest = 0.01
							}
						}
					}
				}
			}
			else = {
				custom_trigger_tooltip = {
					tooltip = YUA_NO_CHINA_PROVINCE_HAS_UNREST
					NOT = {
						any_owned_province = {
							OR = {
								region = north_china_region
								region = south_china_region
								region = xinan_region
							}
							unrest = 0.01
						}
					}
				}
			}
		}   

		effect = {  
			add_country_modifier = {
				name = yua_overlapping_civil_and_military_affairs
				duration = 5475
			}
			add_years_of_owned_provinces_manpower = {
				years = 2
				trigger = {
					OR = {
						is_capital = yes
						AND = {
							OR = {
								region = north_china_region
								region = south_china_region
								region = xinan_region
							}
							has_courthouse_building_trigger = yes
							has_manpower_building_trigger = yes
						}
					}
				}
				custom_tooltip = YUA_FROM_CHINESE_PROVINCES
			}
		} 
	}

	yua_four_great_schools = {
		icon = mission_scholar_officials
		position = 14
		required_missions = {
			yua_censorate
			yua_southern_army
		}
		provinces_to_highlight = {  
			country_or_non_sovereign_subject_holds = ROOT
			NOT = { has_courthouse_building_trigger = yes }
		} 

		trigger = {  
            reform_level = 6
            num_of_owned_provinces_with = {
                has_courthouse_building_trigger = yes
                value = 35
            }
            legitimacy_equivalent = 95
            if = {
                limit = { has_dlc = "Mandate of Heaven" }
                OR = {
                    full_idea_group = innovativeness_ideas
                    monthly_adm = 12
                    empire_of_china_has_active_decree = fund_new_centers_of_education_decree
                }
            }
            else = {
                OR = {
                    full_idea_group = innovativeness_ideas
                    monthly_adm = 12
                }
            }
        } 

		effect = {  
			add_country_modifier = {
				name = yua_four_great_schools_modifier
				duration = -1
			}
			
			custom_tooltip = YUA_GRANT_ADM_POWER_PER_COURTHOUSE_MAX_40
			hidden_effect = {
				if = {
					limit = {
						num_of_owned_provinces_with = {
							has_courthouse_building_trigger = yes
							value = 40
						}
					}
					add_adm_power = 200
				}
				else = {
					every_owned_province = {
						limit = {
							has_courthouse_building_trigger = yes
						}
						owner = {
							add_adm_power = 5
						}
					}
				}
			}
		} 
	}
}
WoC_yuan_flavor_3 = {
	slot = 3
	generic = no
	ai = yes
	has_country_shield = yes
	potential_on_load = {
		has_dlc = "Winds of Change"
	}
	potential = { 
		OR = {
			tag = YUA 
			AND = {
				tag = MGE
				was_tag = YUA
			}
		}
		has_dlc = "Winds of Change"
	} 

	yua_censorate = {
		icon = mission_censorate
		position = 13
		required_missions = {
			yua_sinicizition
			yua_civil_and_military_affairs
		}

		trigger = {  
			has_adm_advisor_2 = yes
			has_dip_advisor_2 = yes
			has_mil_advisor_2 = yes
			NOT = { corruption = 2 }
			NOT = { average_unrest = 1 }
			stability = 2
		} 

		effect = {  
			add_years_of_income = 1
			if = {
				limit = {
					has_estate = estate_eunuchs
				}
				custom_tooltip = YUA_UNLOCK_EYES_AND_EARS_OF_THE_EMPEROR
				set_country_flag = yua_eyes_and_ears_of_the_emperor_flag
			}
			else = {
				add_country_modifier = {
					name = yua_eyes_and_ears_of_the_emperor
					duration = -1
				}
			}
		}
	}
}
WoC_yuan_flavor_4 = {
	slot = 4
	generic = no
	ai = yes
	has_country_shield = yes
	potential_on_load = {
		has_dlc = "Winds of Change"
	}
	potential = { 
		OR = {
			tag = YUA 
			AND = {
				tag = MGE
				was_tag = YUA
			}
		}
		has_dlc = "Winds of Change"
	} 

	yua_sinicizition = {
		icon = mng_form_depots
		position = 12
		required_missions = {
			yua_reestablish_zongshu_sheng
		}

		trigger = {  
			num_of_provinces_developed = { amount = 30 }
			OR = {
				full_idea_group = humanist_ideas
				num_accepted_cultures = 5
				num_of_different_cultures_in_court = 3
			}
		} 

		effect = {  
			add_accepted_culture_or_dip_power = { culture = miao }
			add_accepted_culture_or_dip_power = { culture = yi }
			
			custom_tooltip = SEPERATOR_TOOLTIP
			
			custom_tooltip = YUA_UNLOCK_FOUR_CLASS_SYSTEM_NOBLES_PRIVILEGE
			set_country_flag = yua_four_class_system_flag
			
			custom_tooltip = SEPERATOR_TOOLTIP
			
			complex_dynamic_effect = {
				first_custom_tooltip = YUA_IF_HUMANIST_IDEAS
				first_limit = "
					full_idea_group = humanist_ideas
				"
				first_effect = "
					add_adm_power = 100
					add_estate_loyalty = {
						estate = all
						loyalty = 10
					}
				"
			}
		} 
	}

	yua_inward_perfection = {
		icon = mng_inward_perfection
		position = 14
		required_missions = {
			yua_censorate
			yua_naadam_festivals
		}
		
		provinces_to_highlight = {
			country_or_non_sovereign_subject_holds = ROOT
			OR = {
				region = north_china_region
				region = south_china_region
				region = xinan_region
			}
			OR = {
				NOT = { development = 30 }
				NOT = { num_of_buildings_in_province = 3 }
			}
		}

		trigger = {  
			total_development = 1500
			num_of_owned_provinces_with = {
				OR = {
					region = north_china_region
					region = south_china_region
					region = xinan_region
				}
				development = 30
				num_of_buildings_in_province = 3
				value = 10
			}
		} 

		effect = {
			if = {
				limit = { has_dlc = "Rights of Man" }
				custom_tooltip = YUA_INCREASE_SCHOLAR_CHANCE
				custom_tooltip = SEPERATOR_TOOLTIP
			}
			set_country_flag = hsn_scholar_trait
			
			
			add_prestige_or_monarch_power = { amount = 25 }
			
			custom_tooltip = SEPERATOR_TOOLTIP
			
			complex_dynamic_effect = {
				first_custom_tooltip = YUA_IF_WE_LOCKED_TO_CONFUCIAN_BRANCH
				first_limit = "
					has_country_flag = hordes_confucian_branch_flag
					has_estate = estate_church
				"
				first_effect = "
					add_estate_loyalty_modifier = {
						estate = estate_church
						desc = EST_VAL_INWARD_PERFECTION
						loyalty = 10
						duration = -1
					}
					
					custom_tooltip = YUA_GRANT_10_LAND_TO_CLERGY
					hidden_effect = { grant_estate_10_crown_land = { estate = church } }
				"
			}
		} 
	}
}
WoC_yuan_flavor_5 = {
	slot = 5
	generic = no
	ai = yes
	has_country_shield = yes
	potential_on_load = {
		has_dlc = "Winds of Change"
	}
	potential = { 
		OR = {
			tag = YUA 
			AND = {
				tag = MGE
				was_tag = YUA
			}
		}
		has_dlc = "Winds of Change"
	} 

	yua_reestablish_zongshu_sheng = {
		icon = mng_shengshi_zhishi
		position = 11
		provinces_to_highlight = {  
			NOT = { owned_by = ROOT }
			OR = {
				region = north_china_region
				region = south_china_region
				region = xinan_region
			}
		} 

		trigger = {  
			development_in_provinces = {
				OR = {
					region = north_china_region
					region = south_china_region
					region = xinan_region
				}
				value = 400
			}
			has_adm_advisor_2 = yes
			if = {
				limit = {
					is_emperor_of_china = yes
				}
				imperial_mandate = 60
				custom_trigger_tooltip = {
					tooltip = YUA_NUM_OF_REFORMS_PASSED
					OR = {
						empire_of_china_reform_passed = establish_gaituguiliu_decision
						empire_of_china_reform_passed = seaban_decision
						empire_of_china_reform_passed = reform_land_tax_decision
						empire_of_china_reform_passed = military_governors_decision
						empire_of_china_reform_passed = centralizing_top_government_decision
						empire_of_china_reform_passed = vassalize_tributaries_decision
						empire_of_china_reform_passed = codify_single_whip_law_decision
						empire_of_china_reform_passed = reign_in_estates_decision
						empire_of_china_reform_passed = reform_civil_registration_decision
						empire_of_china_reform_passed = establish_silver_standard_decision
						empire_of_china_reform_passed = kanhe_certificate_decision
						empire_of_china_reform_passed = new_keju_formats_decision
						empire_of_china_reform_passed = inclusive_monarchy_decision
						empire_of_china_reform_passed = promote_bureaucratic_faction_decision
						empire_of_china_reform_passed = promote_military_faction_decision
						empire_of_china_reform_passed = unifed_trade_market_decision
						empire_of_china_reform_passed = reform_the_military_branch_decision
						empire_of_china_reform_passed = modernize_the_banners_decision
						empire_of_china_reform_passed = study_foreign_ship_designs_decision
						empire_of_china_reform_passed = tributary_embassies_decision
						empire_of_china_reform_passed = new_world_discovery_decision
					}
				}
			}
		} 

		effect = {  
			capital_scope = {
				add_or_upgrade_courthouse_building = yes
				add_base_tax = 2
			}
			
			custom_tooltip = SEPERATOR_TOOLTIP
			
			distribute_development = {
				type = tax
				amount = 10
			}
		} 
	}

	yua_printing_press = {
		icon = mng_expand_yongle_dadian
		position = 12
		required_missions = { yua_reestablish_zongshu_sheng } 
		provinces_to_highlight = {  } 

		trigger = {  
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				trade_goods = paper
				has_courthouse_building_trigger = yes
				value = 5
			}
			if = {
				limit = { has_dlc = "Rights of Man" }
				OR = {
					has_institution = printing_press
					has_adm_advisor_3 = yes
					ruler_has_personality = scholar_personality
				}
			}
			else = {
				OR = {
					has_institution = printing_press
					has_adm_advisor_3 = yes
				}
			}
		} 

		effect = {  
			change_innovativeness = 5
			add_country_modifier = {
				name = yua_simplify_printing_press
				duration = 7300
			}
			
			complex_dynamic_effect = {
				first_custom_tooltip = YUA_IF_NO_PRINTING_PRESS
				first_limit = "
					NOT = { is_institution_enabled = printing_press }
				"
				first_effect = "
					custom_tooltip = YUA_CAPITAL_WILL_GAIN_PRINTING_PRESS_WHEN_INSTITUTION_FIRES
					set_country_flag = yua_guaranteed_printing_press
				"
			}
		} 
	}

	yua_naadam_festivals = {
		icon = mission_tribal_wargames
		position = 13
		required_missions = { yua_sinicizition }

		trigger = {  
			num_of_battles = { amount = 100 }
			legitimacy_equivalent = 90
			num_of_cavalry = 20 # modified
		} 

		effect = {  
			add_prestige_or_monarch_power = { amount = 15 }
			
			custom_tooltip = SEPERATOR_TOOLTIP
			
			custom_tooltip = YUA_UNLOCK_NAADAM_FESTIVAL_DECISION
			set_country_flag = yua_naadam_flag
		} 
	}
}
