namespace = kccpersecute

### Religious Persecutions

# Persecute Catholics?
character_event = {
	id = kccpersecute.0001
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = catholics_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = catholic } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = catholic
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = catholic
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = catholic_china_three
					has_global_flag = catholic_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = catholic
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				OR = {
					offmap_china = { offmap_ruler = { religion = cathar } }
					offmap_china = { offmap_ruler = { religion = fraticelli } }
					offmap_china = { offmap_ruler = { religion = waldensian } }
					offmap_china = { offmap_ruler = { religion = lollard } }
				}
			}
			modifier = {
				factor = 1.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				kcc_latin_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_catholics" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_catholics years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_catholics
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_persecute_latins_effect = yes
			set_global_flag = kcc_china_bullseye_latins
		}
		else = {
			kcc_persecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = catholic_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = catholic_china_three
						has_global_flag = catholic_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = catholic_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = catholic_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = catholic_china_three
						has_global_flag = catholic_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = catholic_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_catholic_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = catholic
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 8.5
				OR = {
					offmap_china = { offmap_ruler = { religion = cathar } }
					offmap_china = { offmap_ruler = { religion = fraticelli } }
					offmap_china = { offmap_ruler = { religion = waldensian } }
					offmap_china = { offmap_ruler = { religion = lollard } }
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				kcc_latin_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_catholics" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_catholics years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_catholics
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_overpersecute_latins_effect = yes
			set_global_flag = kcc_china_bullseye_latins
		}
		else = {
			kcc_overpersecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = catholic_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = catholic_china_three
						has_global_flag = catholic_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = catholic_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = catholic_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = catholic_china_three
						has_global_flag = catholic_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = catholic_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_catholic_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = catholic
				}
			}
			modifier = {
				factor = 40
				OR = {
					offmap_china = { offmap_ruler = { religion = cathar } }
					offmap_china = { offmap_ruler = { religion = fraticelli } }
					offmap_china = { offmap_ruler = { religion = waldensian } }
					offmap_china = { offmap_ruler = { religion = lollard } }
				}
			}
			modifier = {
				factor = 0.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
}

# Persecute Cathars?
character_event = {
	id = kccpersecute.0002
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = cathars_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = cathar } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = cathar
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = cathar
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = cathar_china_three
					has_global_flag = cathar_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = cathar
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				OR = {
					offmap_china = { offmap_ruler = { religion = catholic } }
					offmap_china = { offmap_ruler = { religion = fraticelli } }
					offmap_china = { offmap_ruler = { religion = waldensian } }
					offmap_china = { offmap_ruler = { religion = lollard } }
				}
			}
			modifier = {
				factor = 1.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				kcc_latin_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_cathars" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_cathars years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_cathars
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_persecute_latins_effect = yes
			set_global_flag = kcc_china_bullseye_latins
		}
		else = {
			kcc_persecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = cathar_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = cathar_china_three
						has_global_flag = cathar_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = cathar_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = cathar_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = cathar_china_three
						has_global_flag = cathar_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = cathar_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_cathar_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = cathar
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 8.5
				OR = {
					offmap_china = { offmap_ruler = { religion = catholic } }
					offmap_china = { offmap_ruler = { religion = fraticelli } }
					offmap_china = { offmap_ruler = { religion = waldensian } }
					offmap_china = { offmap_ruler = { religion = lollard } }
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				kcc_latin_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_cathars" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_cathars years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_cathars
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_overpersecute_latins_effect = yes
			set_global_flag = kcc_china_bullseye_latins
		}
		else = {
			kcc_overpersecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = cathar_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = cathar_china_three
						has_global_flag = cathar_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = cathar_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = cathar_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = cathar_china_three
						has_global_flag = cathar_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = cathar_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_cathar_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = cathar
				}
			}
			modifier = {
				factor = 40
				OR = {
					offmap_china = { offmap_ruler = { religion = catholic } }
					offmap_china = { offmap_ruler = { religion = fraticelli } }
					offmap_china = { offmap_ruler = { religion = waldensian } }
					offmap_china = { offmap_ruler = { religion = lollard } }
				}
			}
			modifier = {
				factor = 0.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
}

# Persecute Fraticellis?
character_event = {
	id = kccpersecute.0003
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = fraticellis_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = fraticelli } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = fraticelli
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = fraticelli
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = fraticelli_china_three
					has_global_flag = fraticelli_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = fraticelli
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				OR = {
					offmap_china = { offmap_ruler = { religion = catholic } }
					offmap_china = { offmap_ruler = { religion = cathar } }
					offmap_china = { offmap_ruler = { religion = waldensian } }
					offmap_china = { offmap_ruler = { religion = lollard } }
				}
			}
			modifier = {
				factor = 1.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				kcc_latin_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_fraticellis" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_fraticellis years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_fraticellis
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_persecute_latins_effect = yes
			set_global_flag = kcc_china_bullseye_latins
		}
		else = {
			kcc_persecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = fraticelli_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = fraticelli_china_three
						has_global_flag = fraticelli_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = fraticelli_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = fraticelli_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = fraticelli_china_three
						has_global_flag = fraticelli_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = fraticelli_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_fraticelli_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = fraticelli
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 8.5
				OR = {
					offmap_china = { offmap_ruler = { religion = catholic } }
					offmap_china = { offmap_ruler = { religion = cathar } }
					offmap_china = { offmap_ruler = { religion = waldensian } }
					offmap_china = { offmap_ruler = { religion = lollard } }
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				kcc_latin_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_fraticellis" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_fraticellis years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_fraticellis
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_overpersecute_latins_effect = yes
			set_global_flag = kcc_china_bullseye_latins
		}
		else = {
			kcc_overpersecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = fraticelli_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = fraticelli_china_three
						has_global_flag = fraticelli_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = fraticelli_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = fraticelli_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = fraticelli_china_three
						has_global_flag = fraticelli_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = fraticelli_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_fraticelli_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = fraticelli
				}
			}
			modifier = {
				factor = 40
				OR = {
					offmap_china = { offmap_ruler = { religion = catholic } }
					offmap_china = { offmap_ruler = { religion = cathar } }
					offmap_china = { offmap_ruler = { religion = waldensian } }
					offmap_china = { offmap_ruler = { religion = lollard } }
				}
			}
			modifier = {
				factor = 0.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
}

# Persecute Waldensians?
character_event = {
	id = kccpersecute.0004
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = waldensians_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = waldensian } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = waldensian
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = waldensian
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = waldensian_china_three
					has_global_flag = waldensian_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = waldensian
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				OR = {
					offmap_china = { offmap_ruler = { religion = catholic } }
					offmap_china = { offmap_ruler = { religion = cathar } }
					offmap_china = { offmap_ruler = { religion = fraticelli } }
					offmap_china = { offmap_ruler = { religion = lollard } }
				}
			}
			modifier = {
				factor = 1.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				kcc_latin_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_waldensians" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_waldensians years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_waldensians
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_persecute_latins_effect = yes
			set_global_flag = kcc_china_bullseye_latins
		}
		else = {
			kcc_persecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = waldensian_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = waldensian_china_three
						has_global_flag = waldensian_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = waldensian_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = waldensian_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = waldensian_china_three
						has_global_flag = waldensian_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = waldensian_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_waldensian_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = waldensian
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 8.5
				OR = {
					offmap_china = { offmap_ruler = { religion = catholic } }
					offmap_china = { offmap_ruler = { religion = cathar } }
					offmap_china = { offmap_ruler = { religion = fraticelli } }
					offmap_china = { offmap_ruler = { religion = lollard } }
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				kcc_latin_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_waldensians" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_waldensians years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_waldensians
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_overpersecute_latins_effect = yes
			set_global_flag = kcc_china_bullseye_latins
		}
		else = {
			kcc_overpersecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = waldensian_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = waldensian_china_three
						has_global_flag = waldensian_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = waldensian_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = waldensian_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = waldensian_china_three
						has_global_flag = waldensian_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = waldensian_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_waldensian_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = waldensian
				}
			}
			modifier = {
				factor = 40
				OR = {
					offmap_china = { offmap_ruler = { religion = catholic } }
					offmap_china = { offmap_ruler = { religion = cathar } }
					offmap_china = { offmap_ruler = { religion = fraticelli } }
					offmap_china = { offmap_ruler = { religion = lollard } }
				}
			}
			modifier = {
				factor = 0.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
}

# Persecute Lollards?
character_event = {
	id = kccpersecute.0005
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = lollards_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = lollard } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = lollard
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = lollard
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = lollard_china_three
					has_global_flag = lollard_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = lollard
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				OR = {
					offmap_china = { offmap_ruler = { religion = catholic } }
					offmap_china = { offmap_ruler = { religion = cathar } }
					offmap_china = { offmap_ruler = { religion = fraticelli } }
					offmap_china = { offmap_ruler = { religion = waldensian } }
				}
			}
			modifier = {
				factor = 1.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				kcc_latin_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_lollards" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_lollards years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_lollards
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_persecute_latins_effect = yes
			set_global_flag = kcc_china_bullseye_latins
		}
		else = {
			kcc_persecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = lollard_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = lollard_china_three
						has_global_flag = lollard_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = lollard_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = lollard_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = lollard_china_three
						has_global_flag = lollard_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = lollard_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_lollard_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = lollard
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 8.5
				OR = {
					offmap_china = { offmap_ruler = { religion = catholic } }
					offmap_china = { offmap_ruler = { religion = cathar } }
					offmap_china = { offmap_ruler = { religion = fraticelli } }
					offmap_china = { offmap_ruler = { religion = waldensian } }
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				kcc_latin_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_lollards" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_lollards years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_lollards
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_overpersecute_latins_effect = yes
			set_global_flag = kcc_china_bullseye_latins
		}
		else = {
			kcc_overpersecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = lollard_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = lollard_china_three
						has_global_flag = lollard_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = lollard_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = lollard_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = lollard_china_three
						has_global_flag = lollard_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = lollard_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_lollard_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = lollard
				}
			}
			modifier = {
				factor = 40
				OR = {
					offmap_china = { offmap_ruler = { religion = catholic } }
					offmap_china = { offmap_ruler = { religion = cathar } }
					offmap_china = { offmap_ruler = { religion = fraticelli } }
					offmap_china = { offmap_ruler = { religion = waldensian } }
				}
			}
			modifier = {
				factor = 0.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
}

# Persecute Orthodoxy?
character_event = {
	id = kccpersecute.0006
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = orthodoxy_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = orthodox } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = orthodox
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = orthodox
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = orthodox_china_three
					has_global_flag = orthodox_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = orthodox
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				OR = {
					offmap_china = { offmap_ruler = { religion = bogomilist } }
					offmap_china = { offmap_ruler = { religion = monothelite } }
					offmap_china = { offmap_ruler = { religion = iconoclast } }
					offmap_china = { offmap_ruler = { religion = paulician } }
				}
			}
			modifier = {
				factor = 1.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				kcc_byzantine_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_orthodoxs" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_orthodoxy years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_orthodoxy
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_persecute_byzantines_effect = yes
			set_global_flag = kcc_china_bullseye_byzantines
		}
		else = {
			kcc_persecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = orthodox_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = orthodox_china_three
						has_global_flag = orthodox_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = orthodox_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = orthodox_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = orthodox_china_three
						has_global_flag = orthodox_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = orthodox_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_orthodox_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = orthodox
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 8.5
				OR = {
					offmap_china = { offmap_ruler = { religion = bogomilist } }
					offmap_china = { offmap_ruler = { religion = monothelite } }
					offmap_china = { offmap_ruler = { religion = iconoclast } }
					offmap_china = { offmap_ruler = { religion = paulician } }
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				kcc_byzantine_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_orthodoxs" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_orthodoxy years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_orthodoxy
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_overpersecute_byzantines_effect = yes
			set_global_flag = kcc_china_bullseye_byzantines
		}
		else = {
			kcc_overpersecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = orthodox_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = orthodox_china_three
						has_global_flag = orthodox_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = orthodox_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = orthodox_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = orthodox_china_three
						has_global_flag = orthodox_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = orthodox_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_orthodox_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = orthodox
				}
			}
			modifier = {
				factor = 40
				OR = {
					offmap_china = { offmap_ruler = { religion = bogomilist } }
					offmap_china = { offmap_ruler = { religion = monothelite } }
					offmap_china = { offmap_ruler = { religion = iconoclast } }
					offmap_china = { offmap_ruler = { religion = paulician } }
				}
			}
			modifier = {
				factor = 0.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
}

# Persecute Bogomilists?
character_event = {
	id = kccpersecute.0007
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = bogomilists_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = bogomilist } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = bogomilist
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = bogomilist
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = bogomilist_china_three
					has_global_flag = bogomilist_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = bogomilist
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				OR = {
					offmap_china = { offmap_ruler = { religion = orthodox } }
					offmap_china = { offmap_ruler = { religion = monothelite } }
					offmap_china = { offmap_ruler = { religion = iconoclast } }
					offmap_china = { offmap_ruler = { religion = paulician } }
				}
			}
			modifier = {
				factor = 1.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				kcc_byzantine_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_bogomilists" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_bogomilists years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_bogomilists
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_persecute_byzantines_effect = yes
			set_global_flag = kcc_china_bullseye_byzantines
		}
		else = {
			kcc_persecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = bogomilist_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = bogomilist_china_three
						has_global_flag = bogomilist_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = bogomilist_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = bogomilist_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = bogomilist_china_three
						has_global_flag = bogomilist_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = bogomilist_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_bogomilist_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = bogomilist
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 8.5
				OR = {
					offmap_china = { offmap_ruler = { religion = orthodox } }
					offmap_china = { offmap_ruler = { religion = monothelite } }
					offmap_china = { offmap_ruler = { religion = iconoclast } }
					offmap_china = { offmap_ruler = { religion = paulician } }
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				kcc_byzantine_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_bogomilists" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_bogomilists years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_bogomilists
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_overpersecute_byzantines_effect = yes
			set_global_flag = kcc_china_bullseye_byzantines
		}
		else = {
			kcc_overpersecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = bogomilist_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = bogomilist_china_three
						has_global_flag = bogomilist_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = bogomilist_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = bogomilist_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = bogomilist_china_three
						has_global_flag = bogomilist_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = bogomilist_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_bogomilist_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = bogomilist
				}
			}
			modifier = {
				factor = 40
				OR = {
					offmap_china = { offmap_ruler = { religion = orthodox } }
					offmap_china = { offmap_ruler = { religion = monothelite } }
					offmap_china = { offmap_ruler = { religion = iconoclast } }
					offmap_china = { offmap_ruler = { religion = paulician } }
				}
			}
			modifier = {
				factor = 0.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
}

# Persecute Iconoclasts?
character_event = {
	id = kccpersecute.0008
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = iconoclasts_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = iconoclast } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = iconoclast
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = iconoclast
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = iconoclast_china_three
					has_global_flag = iconoclast_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = iconoclast
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				OR = {
					offmap_china = { offmap_ruler = { religion = orthodox } }
					offmap_china = { offmap_ruler = { religion = monothelite } }
					offmap_china = { offmap_ruler = { religion = bogomilist } }
					offmap_china = { offmap_ruler = { religion = paulician } }
				}
			}
			modifier = {
				factor = 1.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				kcc_byzantine_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_iconoclasts" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_iconoclasts years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_iconoclasts
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_persecute_byzantines_effect = yes
			set_global_flag = kcc_china_bullseye_byzantines
		}
		else = {
			kcc_persecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = iconoclast_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = iconoclast_china_three
						has_global_flag = iconoclast_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = iconoclast_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = iconoclast_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = iconoclast_china_three
						has_global_flag = iconoclast_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = iconoclast_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_iconoclast_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = iconoclast
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 8.5
				OR = {
					offmap_china = { offmap_ruler = { religion = orthodox } }
					offmap_china = { offmap_ruler = { religion = monothelite } }
					offmap_china = { offmap_ruler = { religion = bogomilist } }
					offmap_china = { offmap_ruler = { religion = paulician } }
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				kcc_byzantine_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_iconoclasts" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_iconoclasts years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_iconoclasts
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_overpersecute_byzantines_effect = yes
			set_global_flag = kcc_china_bullseye_byzantines
		}
		else = {
			kcc_overpersecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = iconoclast_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = iconoclast_china_three
						has_global_flag = iconoclast_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = iconoclast_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = iconoclast_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = iconoclast_china_three
						has_global_flag = iconoclast_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = iconoclast_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_iconoclast_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = iconoclast
				}
			}
			modifier = {
				factor = 40
				OR = {
					offmap_china = { offmap_ruler = { religion = orthodox } }
					offmap_china = { offmap_ruler = { religion = monothelite } }
					offmap_china = { offmap_ruler = { religion = bogomilist } }
					offmap_china = { offmap_ruler = { religion = paulician } }
				}
			}
			modifier = {
				factor = 0.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
}

# Persecute Monothelites?
character_event = {
	id = kccpersecute.0009
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = monothelites_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = monothelite } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = monothelite
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = monothelite
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = monothelite_china_three
					has_global_flag = monothelite_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = monothelite
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				OR = {
					offmap_china = { offmap_ruler = { religion = orthodox } }
					offmap_china = { offmap_ruler = { religion = iconoclast } }
					offmap_china = { offmap_ruler = { religion = bogomilist } }
					offmap_china = { offmap_ruler = { religion = paulician } }
				}
			}
			modifier = {
				factor = 1.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				kcc_byzantine_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_monothelites" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_monothelites years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_monothelites
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_persecute_byzantines_effect = yes
			set_global_flag = kcc_china_bullseye_byzantines
		}
		else = {
			kcc_persecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = monothelite_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = monothelite_china_three
						has_global_flag = monothelite_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = monothelite_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = monothelite_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = monothelite_china_three
						has_global_flag = monothelite_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = monothelite_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_monothelite_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = monothelite
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 8.5
				OR = {
					offmap_china = { offmap_ruler = { religion = orthodox } }
					offmap_china = { offmap_ruler = { religion = iconoclast } }
					offmap_china = { offmap_ruler = { religion = bogomilist } }
					offmap_china = { offmap_ruler = { religion = paulician } }
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				kcc_byzantine_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_monothelites" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_monothelites years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_monothelites
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_overpersecute_byzantines_effect = yes
			set_global_flag = kcc_china_bullseye_byzantines
		}
		else = {
			kcc_overpersecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = monothelite_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = monothelite_china_three
						has_global_flag = monothelite_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = monothelite_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = monothelite_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = monothelite_china_three
						has_global_flag = monothelite_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = monothelite_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_monothelite_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = monothelite
				}
			}
			modifier = {
				factor = 40
				OR = {
					offmap_china = { offmap_ruler = { religion = orthodox } }
					offmap_china = { offmap_ruler = { religion = iconoclast } }
					offmap_china = { offmap_ruler = { religion = bogomilist } }
					offmap_china = { offmap_ruler = { religion = paulician } }
				}
			}
			modifier = {
				factor = 0.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
}

# Persecute Paulicians?
character_event = {
	id = kccpersecute.0010
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = paulicians_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = paulician } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = paulician
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = paulician
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = paulician_china_three
					has_global_flag = paulician_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = paulician
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				OR = {
					offmap_china = { offmap_ruler = { religion = orthodox } }
					offmap_china = { offmap_ruler = { religion = iconoclast } }
					offmap_china = { offmap_ruler = { religion = bogomilist } }
					offmap_china = { offmap_ruler = { religion = monothelite } }
				}
			}
			modifier = {
				factor = 1.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				kcc_byzantine_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_paulicians" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_paulicians years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_paulicians
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_persecute_byzantines_effect = yes
			set_global_flag = kcc_china_bullseye_byzantines
		}
		else = {
			kcc_persecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = paulician_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = paulician_china_three
						has_global_flag = paulician_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = paulician_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = paulician_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = paulician_china_three
						has_global_flag = paulician_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = paulician_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_paulician_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = paulician
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 8.5
				OR = {
					offmap_china = { offmap_ruler = { religion = orthodox } }
					offmap_china = { offmap_ruler = { religion = iconoclast } }
					offmap_china = { offmap_ruler = { religion = bogomilist } }
					offmap_china = { offmap_ruler = { religion = monothelite } }
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				kcc_byzantine_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_paulicians" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_paulicians years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_paulicians
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_overpersecute_byzantines_effect = yes
			set_global_flag = kcc_china_bullseye_byzantines
		}
		else = {
			kcc_overpersecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = paulician_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = paulician_china_three
						has_global_flag = paulician_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = paulician_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = paulician_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = paulician_china_three
						has_global_flag = paulician_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = paulician_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_paulician_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = paulician
				}
			}
			modifier = {
				factor = 40
				OR = {
					offmap_china = { offmap_ruler = { religion = orthodox } }
					offmap_china = { offmap_ruler = { religion = iconoclast } }
					offmap_china = { offmap_ruler = { religion = bogomilist } }
					offmap_china = { offmap_ruler = { religion = monothelite } }
				}
			}
			modifier = {
				factor = 0.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
}

# Persecute Miaphysites?
character_event = {
	id = kccpersecute.0011
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = miaphysites_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = miaphysite } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = miaphysite
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = miaphysite
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = miaphysite_china_three
					has_global_flag = miaphysite_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = miaphysite
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				offmap_china = { offmap_ruler = { religion = monophysite } }
			}
			modifier = {
				factor = 1.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				kcc_nonchalcedonian_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_miaphysites" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_miaphysites years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_miaphysites
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_persecute_nonchalcedonians_effect = yes
			set_global_flag = kcc_china_bullseye_nonchalcedonians
		}
		else = {
			kcc_persecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = miaphysite_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = miaphysite_china_three
						has_global_flag = miaphysite_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = miaphysite_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = miaphysite_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = miaphysite_china_three
						has_global_flag = miaphysite_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = miaphysite_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_miaphysite_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = miaphysite
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 8.5
				offmap_china = { offmap_ruler = { religion = monophysite } }
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				kcc_nonchalcedonian_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_miaphysites" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_miaphysites years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_miaphysites
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_overpersecute_nonchalcedonians_effect = yes
			set_global_flag = kcc_china_bullseye_nonchalcedonians
		}
		else = {
			kcc_overpersecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = miaphysite_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = miaphysite_china_three
						has_global_flag = miaphysite_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = miaphysite_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = miaphysite_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = miaphysite_china_three
						has_global_flag = miaphysite_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = miaphysite_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_miaphysite_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = miaphysite
				}
			}
			modifier = {
				factor = 40
				offmap_china = { offmap_ruler = { religion = monophysite } }
			}
			modifier = {
				factor = 0.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
}

# Persecute Monophysites?
character_event = {
	id = kccpersecute.0012
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = monophysites_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = monophysite } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = monophysite
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = monophysite
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = monophysite_china_three
					has_global_flag = monophysite_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = monophysite
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				offmap_china = { offmap_ruler = { religion = miaphysite } }
			}
			modifier = {
				factor = 1.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				kcc_nonchalcedonian_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_monophysites" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_monophysites years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_monophysites
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_persecute_nonchalcedonians_effect = yes
			set_global_flag = kcc_china_bullseye_nonchalcedonians
		}
		else = {
			kcc_persecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = monophysite_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = monophysite_china_three
						has_global_flag = monophysite_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = monophysite_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = monophysite_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = monophysite_china_three
						has_global_flag = monophysite_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = monophysite_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_monophysite_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = monophysite
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 8.5
				offmap_china = { offmap_ruler = { religion = miaphysite } }
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				kcc_nonchalcedonian_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_monophysites" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_monophysites years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_monophysites
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_overpersecute_nonchalcedonians_effect = yes
			set_global_flag = kcc_china_bullseye_nonchalcedonians
		}
		else = {
			kcc_overpersecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = monophysite_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = monophysite_china_three
						has_global_flag = monophysite_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = monophysite_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = monophysite_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = monophysite_china_three
						has_global_flag = monophysite_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = monophysite_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_monophysite_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = monophysite
				}
			}
			modifier = {
				factor = 40
				offmap_china = { offmap_ruler = { religion = miaphysite } }
			}
			modifier = {
				factor = 0.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
}

# Persecute Nestorians?
character_event = {
	id = kccpersecute.0013
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = nestorians_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = nestorian } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = nestorian
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = nestorian
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = nestorian_china_three
					has_global_flag = nestorian_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = nestorian
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				offmap_china = { offmap_ruler = { religion = messalian } }
			}
			modifier = {
				factor = 1.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				kcc_nonchalcedonian_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_nestorians" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_nestorians years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_nestorians
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_persecute_nonchalcedonians_effect = yes
			set_global_flag = kcc_china_bullseye_nonchalcedonians
		}
		else = {
			kcc_persecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = nestorian_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = nestorian_china_three
						has_global_flag = nestorian_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = nestorian_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = nestorian_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = nestorian_china_three
						has_global_flag = nestorian_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = nestorian_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_nestorian_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = nestorian
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 8.5
				offmap_china = { offmap_ruler = { religion = messalian } }
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				kcc_nonchalcedonian_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_nestorians" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_nestorians years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_nestorians
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_overpersecute_nonchalcedonians_effect = yes
			set_global_flag = kcc_china_bullseye_nonchalcedonians
		}
		else = {
			kcc_overpersecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = nestorian_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = nestorian_china_three
						has_global_flag = nestorian_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = nestorian_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = nestorian_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = nestorian_china_three
						has_global_flag = nestorian_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = nestorian_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_nestorian_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = nestorian
				}
			}
			modifier = {
				factor = 40
				offmap_china = { offmap_ruler = { religion = messalian } }
			}
			modifier = {
				factor = 0.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
}

# Persecute Messalians?
character_event = {
	id = kccpersecute.0014
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = messalians_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = messalian } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = messalian
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = messalian
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = messalian_china_three
					has_global_flag = messalian_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = messalian
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				offmap_china = { offmap_ruler = { religion = nestorian } }
			}
			modifier = {
				factor = 1.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				kcc_nonchalcedonian_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_messalians" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_messalians years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_messalians
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_persecute_nonchalcedonians_effect = yes
			set_global_flag = kcc_china_bullseye_nonchalcedonians
		}
		else = {
			kcc_persecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = messalian_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = messalian_china_three
						has_global_flag = messalian_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = messalian_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = messalian_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = messalian_china_three
						has_global_flag = messalian_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = messalian_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_messalian_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = messalian
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 8.5
				offmap_china = { offmap_ruler = { religion = nestorian } }
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				kcc_nonchalcedonian_christians_trigger = yes
			}
			change_variable = { which = "global_chinese_messalians" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_messalians years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_messalians
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = christian } }
			}
			kcc_overpersecute_nonchalcedonians_effect = yes
			set_global_flag = kcc_china_bullseye_nonchalcedonians
		}
		else = {
			kcc_overpersecute_christians_effect = yes
			set_global_flag = kcc_china_bullseye_christians
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = messalian_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = messalian_china_three
						has_global_flag = messalian_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = messalian_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = messalian_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = messalian_china_three
						has_global_flag = messalian_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = messalian_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_messalian_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_christians }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_christians }
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = messalian
				}
			}
			modifier = {
				factor = 40
				offmap_china = { offmap_ruler = { religion = nestorian } }
			}
			modifier = {
				factor = 0.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							religion = manichean
						}
					}
				}
			}
		}
	}
}

# Persecute Sunnis?
character_event = {
	id = kccpersecute.0015
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = sunnis_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = sunni } }
				offmap_china = { offmap_ruler = { religion = zikri } }
				offmap_china = { offmap_ruler = { religion = yarsan } }
				AND = {
					NOT = { has_global_flag = EMF }
					has_game_rule = {
						name = kcc_who_can_preach
						value = kcc_preach_yes
					}
					offmap_china = { offmap_ruler = { religion = yazidi } }
				}
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_muslims }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = sunni
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = sunni
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = sunni_china_three
					has_global_flag = sunni_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						OR = {
							has_religion_feature = religion_jizya
							has_religion_feature = religion_feature_west_african
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = sunni
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = shiite
							religion = qarmatian
							religion = hurufi
							AND = {
								has_game_rule = {
									name = kcc_who_can_preach
									value = kcc_preach_yes
								}
								religion = druze
							}
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = muslim } }
			}
			kcc_persecute_sunnis_effect = yes
			set_global_flag = kcc_china_bullseye_sunnis
		}
		else = {
			kcc_persecute_muslims_effect = yes
			set_global_flag = kcc_china_bullseye_muslims
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					OR = {
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_four
						}
					}
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = sunni_china_three
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_three
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_three
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							OR = {
								has_global_flag = yazidi_china_three
								has_global_flag = yazidi_china_four
							}
						}
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					OR = {
						has_global_flag = sunni_china_three
						has_global_flag = zikri_china_three
						has_global_flag = yarsan_china_three
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_three
						}
					}
				}
				modifier = {
					factor = 0
					OR = {
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_four
						}
					}
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = sunni_china_three
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_three
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_three
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							OR = {
								has_global_flag = yazidi_china_three
								has_global_flag = yazidi_china_four
							}
						}
					}
				}
				modifier = {
					factor = 0.1
					NOR = {
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_four
						}
					}
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_sunni_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_muslims }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = sunni
				}
			}
			modifier = {
				factor = 8.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = shiite
							religion = qarmatian
							religion = hurufi
							AND = {
								has_game_rule = {
									name = kcc_who_can_preach
									value = kcc_preach_yes
								}
								religion = druze
							}
						}
					}
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = muslim } }
			}
			kcc_overpersecute_sunnis_effect = yes
			set_global_flag = kcc_china_bullseye_sunnis
		}
		else = {
			kcc_overpersecute_muslims_effect = yes
			set_global_flag = kcc_china_bullseye_muslims
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					OR = {
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_four
						}
					}
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = sunni_china_three
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_three
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_three
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							OR = {
								has_global_flag = yazidi_china_three
								has_global_flag = yazidi_china_four
							}
						}
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					OR = {
						has_global_flag = sunni_china_three
						has_global_flag = zikri_china_three
						has_global_flag = yarsan_china_three
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_three
						}
					}
				}
				modifier = {
					factor = 0
					OR = {
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_four
						}
					}
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = sunni_china_three
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_three
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_three
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							OR = {
								has_global_flag = yazidi_china_three
								has_global_flag = yazidi_china_four
							}
						}
					}
				}
				modifier = {
					factor = 0.1
					NOR = {
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_four
						}
					}
				}
				set_global_flag = kcc_sunni_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_muslims }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_muslims }
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = sunni
				}
			}
			modifier = {
				factor = 40
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = shiite
							religion = qarmatian
							religion = hurufi
							AND = {
								has_game_rule = {
									name = kcc_who_can_preach
									value = kcc_preach_yes
								}
								religion = druze
							}
						}
					}
				}
			}
		}
	}
}

# Persecute Zikris?
character_event = {
	id = kccpersecute.0016
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = zikris_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = sunni } }
				offmap_china = { offmap_ruler = { religion = zikri } }
				offmap_china = { offmap_ruler = { religion = yarsan } }
				AND = {
					NOT = { has_global_flag = EMF }
					has_game_rule = {
						name = kcc_who_can_preach
						value = kcc_preach_yes
					}
					offmap_china = { offmap_ruler = { religion = yazidi } }
				}
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_muslims }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = zikri
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = zikri
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = zikri_china_three
					has_global_flag = zikri_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						OR = {
							has_religion_feature = religion_jizya
							has_religion_feature = religion_feature_west_african
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = zikri
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = shiite
							religion = qarmatian
							religion = hurufi
							AND = {
								has_game_rule = {
									name = kcc_who_can_preach
									value = kcc_preach_yes
								}
								religion = druze
							}
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = muslim } }
			}
			kcc_persecute_sunnis_effect = yes
			set_global_flag = kcc_china_bullseye_sunnis
		}
		else = {
			kcc_persecute_muslims_effect = yes
			set_global_flag = kcc_china_bullseye_muslims
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					OR = {
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_four
						}
					}
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = sunni_china_three
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_three
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_three
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							OR = {
								has_global_flag = yazidi_china_three
								has_global_flag = yazidi_china_four
							}
						}
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					OR = {
						has_global_flag = sunni_china_three
						has_global_flag = zikri_china_three
						has_global_flag = yarsan_china_three
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_three
						}
					}
				}
				modifier = {
					factor = 0
					OR = {
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_four
						}
					}
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = sunni_china_three
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_three
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_three
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							OR = {
								has_global_flag = yazidi_china_three
								has_global_flag = yazidi_china_four
							}
						}
					}
				}
				modifier = {
					factor = 0.1
					NOR = {
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_four
						}
					}
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_zikri_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_muslims }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = zikri
				}
			}
			modifier = {
				factor = 8.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = shiite
							religion = qarmatian
							religion = hurufi
							AND = {
								has_game_rule = {
									name = kcc_who_can_preach
									value = kcc_preach_yes
								}
								religion = druze
							}
						}
					}
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = muslim } }
			}
			kcc_overpersecute_sunnis_effect = yes
			set_global_flag = kcc_china_bullseye_sunnis
		}
		else = {
			kcc_overpersecute_muslims_effect = yes
			set_global_flag = kcc_china_bullseye_muslims
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					OR = {
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_four
						}
					}
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = sunni_china_three
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_three
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_three
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							OR = {
								has_global_flag = yazidi_china_three
								has_global_flag = yazidi_china_four
							}
						}
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					OR = {
						has_global_flag = sunni_china_three
						has_global_flag = zikri_china_three
						has_global_flag = yarsan_china_three
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_three
						}
					}
				}
				modifier = {
					factor = 0
					OR = {
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_four
						}
					}
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = sunni_china_three
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_three
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_three
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							OR = {
								has_global_flag = yazidi_china_three
								has_global_flag = yazidi_china_four
							}
						}
					}
				}
				modifier = {
					factor = 0.1
					NOR = {
						has_global_flag = sunni_china_four
						has_global_flag = zikri_china_four
						has_global_flag = yarsan_china_four
						AND = {
							NOT = { has_global_flag = EMF }
							has_global_flag = yazidi_china_four
						}
					}
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_zikri_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_muslims }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_muslims }
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = zikri
				}
			}
			modifier = {
				factor = 40
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = shiite
							religion = qarmatian
							religion = hurufi
							AND = {
								has_game_rule = {
									name = kcc_who_can_preach
									value = kcc_preach_yes
								}
								religion = druze
							}
						}
					}
				}
			}
		}
	}
}

# Persecute Shias?
character_event = {
	id = kccpersecute.0017
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = shiites_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = shiite } }
				offmap_china = { offmap_ruler = { religion = qarmatian } }
				offmap_china = { offmap_ruler = { religion = hurufi } }
				AND = {
					has_game_rule = {
						name = kcc_who_can_preach
						value = kcc_preach_yes
					}
					offmap_china = { offmap_ruler = { religion = druze } }
				}
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_muslims }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = shiite
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = shiite
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = shiite_china_three
					has_global_flag = shiite_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						OR = {
							has_religion_feature = religion_jizya
							has_religion_feature = religion_feature_west_african
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = shiite
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = sunni
							religion = zikri
							religion = yarsan
							AND = {
								NOT = { has_global_flag = EMF }
								has_game_rule = {
									name = kcc_who_can_preach
									value = kcc_preach_yes
								}
								religion = yazidi
							}
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = muslim } }
			}
			kcc_persecute_shias_effect = yes
			set_global_flag = kcc_china_bullseye_shias
		}
		else = {
			kcc_persecute_muslims_effect = yes
			set_global_flag = kcc_china_bullseye_muslims
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					OR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = shiite_china_three
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_three
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_three
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_three
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					OR = {
						has_global_flag = shiite_china_three
						has_global_flag = qarmatian_china_three
						has_global_flag = hurufi_china_three
						has_global_flag = druze_china_three
					}
				}
				modifier = {
					factor = 0
					OR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = shiite_china_three
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_three
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_three
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_three
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_shiite_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_muslims }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = shiite
				}
			}
			modifier = {
				factor = 8.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = sunni
							religion = zikri
							religion = yarsan
							AND = {
								NOT = { has_global_flag = EMF }
								has_game_rule = {
									name = kcc_who_can_preach
									value = kcc_preach_yes
								}
								religion = yazidi
							}
						}
					}
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = muslim } }
			}
			kcc_overpersecute_shias_effect = yes
			set_global_flag = kcc_china_bullseye_shias
		}
		else = {
			kcc_overpersecute_muslims_effect = yes
			set_global_flag = kcc_china_bullseye_muslims
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					OR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = shiite_china_three
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_three
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_three
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_three
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					OR = {
						has_global_flag = shiite_china_three
						has_global_flag = qarmatian_china_three
						has_global_flag = hurufi_china_three
						has_global_flag = druze_china_three
					}
				}
				modifier = {
					factor = 0
					OR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = shiite_china_three
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_three
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_three
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_three
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_shiite_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_muslims }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_muslims }
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = shiite
				}
			}
			modifier = {
				factor = 40
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = sunni
							religion = zikri
							religion = yarsan
							AND = {
								NOT = { has_global_flag = EMF }
								has_game_rule = {
									name = kcc_who_can_preach
									value = kcc_preach_yes
								}
								religion = yazidi
							}
						}
					}
				}
			}
		}
	}
}

# Persecute qarmatian?
character_event = {
	id = kccpersecute.0018
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = qarmatian_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = shiite } }
				offmap_china = { offmap_ruler = { religion = qarmatian } }
				offmap_china = { offmap_ruler = { religion = hurufi } }
				AND = {
					has_game_rule = {
						name = kcc_who_can_preach
						value = kcc_preach_yes
					}
					offmap_china = { offmap_ruler = { religion = druze } }
				}
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_muslims }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = qarmatian
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = qarmatian
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = qarmatian_china_three
					has_global_flag = qarmatian_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						OR = {
							has_religion_feature = religion_jizya
							has_religion_feature = religion_feature_west_african
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = qarmatian
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = sunni
							religion = zikri
							religion = yarsan
							AND = {
								NOT = { has_global_flag = EMF }
								has_game_rule = {
									name = kcc_who_can_preach
									value = kcc_preach_yes
								}
								religion = yazidi
							}
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = muslim } }
			}
			kcc_persecute_shias_effect = yes
			set_global_flag = kcc_china_bullseye_shias
		}
		else = {
			kcc_persecute_muslims_effect = yes
			set_global_flag = kcc_china_bullseye_muslims
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					OR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = shiite_china_three
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_three
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_three
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_three
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					OR = {
						has_global_flag = shiite_china_three
						has_global_flag = qarmatian_china_three
						has_global_flag = hurufi_china_three
						has_global_flag = druze_china_three
					}
				}
				modifier = {
					factor = 0
					OR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = shiite_china_three
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_three
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_three
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_three
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_qarmatian_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_muslims }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = qarmatian
				}
			}
			modifier = {
				factor = 8.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = sunni
							religion = zikri
							religion = yarsan
							AND = {
								NOT = { has_global_flag = EMF }
								has_game_rule = {
									name = kcc_who_can_preach
									value = kcc_preach_yes
								}
								religion = yazidi
							}
						}
					}
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = muslim } }
			}
			kcc_overpersecute_shias_effect = yes
			set_global_flag = kcc_china_bullseye_shias
		}
		else = {
			kcc_overpersecute_muslims_effect = yes
			set_global_flag = kcc_china_bullseye_muslims
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					OR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = shiite_china_three
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_three
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_three
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_three
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					OR = {
						has_global_flag = shiite_china_three
						has_global_flag = qarmatian_china_three
						has_global_flag = hurufi_china_three
						has_global_flag = druze_china_three
					}
				}
				modifier = {
					factor = 0
					OR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = shiite_china_three
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_three
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_three
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_three
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_qarmatian_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_muslims }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_muslims }
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = qarmatian
				}
			}
			modifier = {
				factor = 40
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = sunni
							religion = zikri
							religion = yarsan
							AND = {
								NOT = { has_global_flag = EMF }
								has_game_rule = {
									name = kcc_who_can_preach
									value = kcc_preach_yes
								}
								religion = yazidi
							}
						}
					}
				}
			}
		}
	}
}

# Persecute Hurufis?
character_event = {
	id = kccpersecute.0019
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = hurufis_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = shiite } }
				offmap_china = { offmap_ruler = { religion = qarmatian } }
				offmap_china = { offmap_ruler = { religion = hurufi } }
				AND = {
					has_game_rule = {
						name = kcc_who_can_preach
						value = kcc_preach_yes
					}
					offmap_china = { offmap_ruler = { religion = druze } }
				}
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_muslims }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = hurufi
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = hurufi
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = hurufi_china_three
					has_global_flag = hurufi_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						OR = {
							has_religion_feature = religion_jizya
							has_religion_feature = religion_feature_west_african
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = hurufi
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 0.176
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = sunni
							religion = zikri
							religion = yarsan
							AND = {
								NOT = { has_global_flag = EMF }
								has_game_rule = {
									name = kcc_who_can_preach
									value = kcc_preach_yes
								}
								religion = yazidi
							}
						}
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = muslim } }
			}
			kcc_persecute_shias_effect = yes
			set_global_flag = kcc_china_bullseye_shias
		}
		else = {
			kcc_persecute_muslims_effect = yes
			set_global_flag = kcc_china_bullseye_muslims
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					OR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = shiite_china_three
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_three
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_three
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_three
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					OR = {
						has_global_flag = shiite_china_three
						has_global_flag = qarmatian_china_three
						has_global_flag = hurufi_china_three
						has_global_flag = druze_china_three
					}
				}
				modifier = {
					factor = 0
					OR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = shiite_china_three
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_three
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_three
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_three
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_hurufi_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_muslims }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = hurufi
				}
			}
			modifier = {
				factor = 8.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = sunni
							religion = zikri
							religion = yarsan
							AND = {
								NOT = { has_global_flag = EMF }
								has_game_rule = {
									name = kcc_who_can_preach
									value = kcc_preach_yes
								}
								religion = yazidi
							}
						}
					}
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = muslim } }
			}
			kcc_overpersecute_shias_effect = yes
			set_global_flag = kcc_china_bullseye_shias
		}
		else = {
			kcc_overpersecute_muslims_effect = yes
			set_global_flag = kcc_china_bullseye_muslims
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					OR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = shiite_china_three
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_three
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_three
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_three
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					OR = {
						has_global_flag = shiite_china_three
						has_global_flag = qarmatian_china_three
						has_global_flag = hurufi_china_three
						has_global_flag = druze_china_three
					}
				}
				modifier = {
					factor = 0
					OR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = shiite_china_three
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_three
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_three
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_three
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOR = {
						has_global_flag = shiite_china_four
						has_global_flag = qarmatian_china_four
						has_global_flag = hurufi_china_four
						has_global_flag = druze_china_four
					}
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_hurufi_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_muslims }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_muslims }
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = hurufi
				}
			}
			modifier = {
				factor = 40
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = sunni
							religion = zikri
							religion = yarsan
							AND = {
								NOT = { has_global_flag = EMF }
								has_game_rule = {
									name = kcc_who_can_preach
									value = kcc_preach_yes
								}
								religion = yazidi
							}
						}
					}
				}
			}
		}
	}
}

# Persecute Ibadis?
character_event = {
	id = kccpersecute.0020
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = ibadis_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = ibadi } }
				offmap_china = { offmap_ruler = { religion = kharijite } }
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_muslims }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = ibadi
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = ibadi
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = ibadi_china_three
					has_global_flag = ibadi_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						OR = {
							has_religion_feature = religion_jizya
							has_religion_feature = religion_feature_west_african
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = ibadi
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = muslim } }
			}
			change_variable = { which = "global_chinese_ibadis" value = -30 }
			if = {
				limit = {
					has_global_flag = kharijites_in_china
				}
				change_variable = { which = "global_chinese_kharijites" value = -30 }
			}
			1513 = { add_province_modifier = { name = kcc_china_persecuted_ibadis years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_ibadis
		}
		else = {
			kcc_persecute_muslims_effect = yes
			set_global_flag = kcc_china_bullseye_muslims
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					OR = {
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_four
					}
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = ibadi_china_three
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_three
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					OR = {
						has_global_flag = ibadi_china_three
						has_global_flag = kharijite_china_three
					}
				}
				modifier = {
					factor = 0
					OR = {
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = ibadi_china_three
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_three
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOR = {
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_ibadi_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_muslims }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = ibadi
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = muslim } }
			}
			change_variable = { which = "global_chinese_ibadis" value = -45 }
			if = {
				limit = {
					has_global_flag = kharijites_in_china
				}
				change_variable = { which = "global_chinese_kharijites" value = -45 }
			}
			1513 = { add_province_modifier = { name = kcc_china_persecuted_ibadis years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_ibadis
		}
		else = {
			kcc_overpersecute_muslims_effect = yes
			set_global_flag = kcc_china_bullseye_muslims
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					OR = {
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_four
					}
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = ibadi_china_three
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_three
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					OR = {
						has_global_flag = ibadi_china_three
						has_global_flag = kharijite_china_three
					}
				}
				modifier = {
					factor = 0
					OR = {
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = ibadi_china_three
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_three
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOR = {
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_ibadi_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_muslims }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_muslims }
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = ibadi
				}
			}
		}
	}
}

# Persecute Kharijites?
character_event = {
	id = kccpersecute.0021
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = kharijites_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = ibadi } }
				offmap_china = { offmap_ruler = { religion = kharijite } }
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_muslims }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = kharijite
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = kharijite
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = kharijite_china_three
					has_global_flag = kharijite_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						OR = {
							has_religion_feature = religion_jizya
							has_religion_feature = religion_feature_west_african
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = kharijite
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = muslim } }
			}
			change_variable = { which = "global_chinese_kharijites" value = -30 }
			if = {
				limit = {
					has_global_flag = ibadis_in_china
				}
				change_variable = { which = "global_chinese_ibadis" value = -30 }
			}
			1513 = { add_province_modifier = { name = kcc_china_persecuted_ibadis years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_ibadis
		}
		else = {
			kcc_persecute_muslims_effect = yes
			set_global_flag = kcc_china_bullseye_muslims
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					OR = {
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_four
					}
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = ibadi_china_three
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_three
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					OR = {
						has_global_flag = ibadi_china_three
						has_global_flag = kharijite_china_three
					}
				}
				modifier = {
					factor = 0
					OR = {
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = ibadi_china_three
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_three
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOR = {
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_kharijite_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_muslims }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = kharijite
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = muslim } }
			}
			change_variable = { which = "global_chinese_kharijites" value = -45 }
			if = {
				limit = {
					has_global_flag = ibadis_in_china
				}
				change_variable = { which = "global_chinese_ibadis" value = -45 }
			}
			1513 = { add_province_modifier = { name = kcc_china_persecuted_ibadis years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_ibadis
		}
		else = {
			kcc_overpersecute_muslims_effect = yes
			set_global_flag = kcc_china_bullseye_muslims
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					OR = {
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_four
					}
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = ibadi_china_three
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_three
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					OR = {
						has_global_flag = ibadi_china_three
						has_global_flag = kharijite_china_three
					}
				}
				modifier = {
					factor = 0
					OR = {
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = ibadi_china_three
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_three
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOR = {
						has_global_flag = ibadi_china_four
						has_global_flag = kharijite_china_four
					}
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_kharijite_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_muslims }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_muslims }
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = kharijite
				}
			}
		}
	}
}

# Persecute Zoroastrians?
character_event = {
	id = kccpersecute.0022
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = zoroastrians_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = zoroastrian } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_mazdans }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = zoroastrian
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = zoroastrian
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = zoroastrian_china_three
					has_global_flag = zoroastrian_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = zoroastrian
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 1.2
				offmap_china = { offmap_ruler = { religion = manichean } }
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = zoroastrian_group } }
			}
			change_variable = { which = "global_chinese_zoroastrians" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_zoroastrians years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_zoroastrians
		}
		else = {
			kcc_persecute_mazdans_effect = yes
			set_global_flag = kcc_china_bullseye_mazdans

		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = zoroastrian_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = zoroastrian_china_three
						has_global_flag = zoroastrian_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = zoroastrian_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = zoroastrian_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = zoroastrian_china_three
						has_global_flag = zoroastrian_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = zoroastrian_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_zoroastrian_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_zoroastrians }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = zoroastrian
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				offmap_china = { offmap_ruler = { religion_group = zoroastrian_group } }
			}
			change_variable = { which = "global_chinese_zoroastrians" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_zoroastrians years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_zoroastrians
		}
		else = {
			kcc_overpersecute_mazdans_effect = yes
			set_global_flag = kcc_china_bullseye_mazdans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = zoroastrian_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = zoroastrian_china_three
						has_global_flag = zoroastrian_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = zoroastrian_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = zoroastrian_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = zoroastrian_china_three
						has_global_flag = zoroastrian_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = zoroastrian_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_zoroastrian_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_zoroastrians }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_mazdans }
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = zoroastrian
				}
			}
			modifier = {
				factor = 0.5
				offmap_china = { offmap_ruler = { religion = manichean } }
			}
		}
	}
}

# Persecute Mazdakis?
character_event = {
	id = kccpersecute.0023
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = mazdakis_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = mazdaki } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_mazdans }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = mazdaki
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = mazdaki
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = mazdaki_china_three
					has_global_flag = mazdaki_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = mazdaki
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				offmap_china = {
					offmap_ruler = {
						religion_group = zoroastrian_group
						NOT = { religion = zoroastrian }
					}
				}
			}
			change_variable = { which = "global_chinese_mazdakis" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_mazdakis years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_mazdakis
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion = zoroastrian } }
			}
			kcc_zoro_persecute_mazdans_effect = yes
			set_global_flag = kcc_zoro_china_bullseye_mazdans
		}
		else = {
			kcc_persecute_mazdans_effect = yes
			set_global_flag = kcc_china_bullseye_mazdans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = mazdaki_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = mazdaki_china_three
						has_global_flag = mazdaki_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = mazdaki_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = mazdaki_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = mazdaki_china_three
						has_global_flag = mazdaki_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = mazdaki_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_mazdaki_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_mazdakis }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = zoroastrian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = mazdaki
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				offmap_china = {
					offmap_ruler = {
						religion_group = zoroastrian_group
						NOT = { religion = zoroastrian }
					}
				}
			}
			change_variable = { which = "global_chinese_mazdakis" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_mazdakis years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_mazdakis
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion = zoroastrian } }
			}
			kcc_zoro_overpersecute_mazdans_effect = yes
			set_global_flag = kcc_zoro_china_bullseye_mazdans
		}
		else = {
			kcc_overpersecute_mazdans_effect = yes
			set_global_flag = kcc_china_bullseye_mazdans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = mazdaki_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = mazdaki_china_three
						has_global_flag = mazdaki_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = mazdaki_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = mazdaki_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = mazdaki_china_three
						has_global_flag = mazdaki_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = mazdaki_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_mazdaki_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_mazdakis }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_mazdans }
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = mazdaki
				}
			}
		}
	}
}

# Persecute Manicheans?
character_event = {
	id = kccpersecute.0024
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = manicheans_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = manichean } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_mazdans }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = manichean
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = zoroastrian
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = manichean
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = manichean_china_three
					has_global_flag = manichean_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = manichean
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				offmap_china = {
					offmap_ruler = {
						religion_group = zoroastrian_group
						NOT = { religion = zoroastrian }
					}
				}
			}
			change_variable = { which = "global_chinese_manicheans" value = -30 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_manicheans years = 40 hidden = yes } }
			set_global_flag = kcc_china_bullseye_manicheans
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion = zoroastrian } }
			}
			kcc_zoro_persecute_mazdans_effect = yes
			set_global_flag = kcc_zoro_china_bullseye_mazdans
		}
		else = {
			kcc_persecute_mazdans_effect = yes
			set_global_flag = kcc_china_bullseye_mazdans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = manichean_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = manichean_china_three
						has_global_flag = manichean_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = manichean_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = manichean_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = manichean_china_three
						has_global_flag = manichean_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = manichean_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_manichean_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_manicheans }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = zoroastrian
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = manichean
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				offmap_china = {
					offmap_ruler = {
						religion_group = zoroastrian_group
						NOT = { religion = zoroastrian }
					}
				}
			}
			change_variable = { which = "global_chinese_manicheans" value = -45 }
			1513 = { add_province_modifier = { name = kcc_china_persecuted_manicheans years = 60 hidden = yes } }
			set_global_flag = kcc_china_bullseye_manicheans
		}
		else_if = {
			limit = {
				offmap_china = { offmap_ruler = { religion = zoroastrian } }
			}
			kcc_zoro_overpersecute_mazdans_effect = yes
			set_global_flag = kcc_zoro_china_bullseye_mazdans
		}
		else = {
			kcc_overpersecute_mazdans_effect = yes
			set_global_flag = kcc_china_bullseye_mazdans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = manichean_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = manichean_china_three
						has_global_flag = manichean_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = manichean_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = manichean_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = manichean_china_three
						has_global_flag = manichean_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = manichean_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_manichean_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_manicheans }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_mazdans }
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = manichean
				}
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
}

# Persecute Buddhists?
character_event = {
	id = kccpersecute.0025
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = buddhists_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = buddhist } }
				offmap_china = { offmap_ruler = { religion = jain } }
				AND = {
					has_game_rule = {
						name = kcc_who_can_preach
						value = kcc_preach_yes
					}
					offmap_china = { offmap_ruler = { religion = hindu } }
				}
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_buddhists }
			}
			modifier = {
				factor = 0.66
				has_global_flag = jains_in_china
				offmap_china = { offmap_has_dislike = likes_jains }
			}
			modifier = {
				factor = 0.66
				has_global_flag = hindus_in_china
				offmap_china = { offmap_has_dislike = likes_hindus }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = buddhist
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = buddhist
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = buddhist_china_three
					has_global_flag = buddhist_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						OR = {
							has_religion_feature = religion_peaceful
							has_religion_feature = religion_cosmopolitan
							has_religion_feature = religion_syncretic
							has_religion_feature = religion_feature_hellenic
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = buddhist
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
			modifier = {
				factor = 1.2
				offmap_china = { offmap_ruler = { religion = manichean } }
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		kcc_persecute_dharmans_effect = yes
		set_global_flag = kcc_china_bullseye_dharmans
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = buddhist_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = buddhist_china_three
						has_global_flag = buddhist_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = buddhist_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = buddhist_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = buddhist_china_three
						has_global_flag = buddhist_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = buddhist_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_buddhist_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_buddhists }
			}
			modifier = {
				factor = 0.66
				has_global_flag = jains_in_china
				offmap_china = { offmap_has_like = likes_jains }
			}
			modifier = {
				factor = 0.66
				has_global_flag = hindus_in_china
				offmap_china = { offmap_has_like = likes_hindus }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = buddhist
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		kcc_overpersecute_dharmans_effect = yes
		set_global_flag = kcc_china_bullseye_dharmans
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = buddhist_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = buddhist_china_three
						has_global_flag = buddhist_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = buddhist_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = buddhist_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = buddhist_china_three
						has_global_flag = buddhist_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = buddhist_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_buddhist_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_buddhists }
			}
			modifier = {
				factor = 0.66
				has_global_flag = jains_in_china
				offmap_china = { offmap_has_like = likes_jains }
			}
			modifier = {
				factor = 0.66
				has_global_flag = hindus_in_china
				offmap_china = { offmap_has_like = likes_hindus }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_buddhists }
			}
			modifier = {
				factor = 2
				has_global_flag = jains_in_china
				offmap_china = { offmap_has_dislike = likes_jains }
			}
			modifier = {
				factor = 2
				has_global_flag = hindus_in_china
				offmap_china = { offmap_has_dislike = likes_hindus }
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = buddhist
				}
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
			modifier = {
				factor = 0.5
				offmap_china = { offmap_ruler = { religion = manichean } }
			}
		}
	}
}

# Persecute Jains?
character_event = {
	id = kccpersecute.0026
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = jains_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = buddhist } }
				offmap_china = { offmap_ruler = { religion = jain } }
				AND = {
					has_game_rule = {
						name = kcc_who_can_preach
						value = kcc_preach_yes
					}
					offmap_china = { offmap_ruler = { religion = hindu } }
				}
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0
				offmap_china = { offmap_has_dislike = likes_jains }
			}
			modifier = {
				factor = 0.66
				has_global_flag = buddhists_in_china
				offmap_china = { offmap_has_dislike = likes_buddhists }
			}
			modifier = {
				factor = 0.66
				has_global_flag = hindus_in_china
				offmap_china = { offmap_has_dislike = likes_hindus }
			}
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = jain
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = jain
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = jain_china_three
					has_global_flag = jain_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						OR = {
							has_religion_feature = religion_peaceful
							has_religion_feature = religion_cosmopolitan
							has_religion_feature = religion_syncretic
							has_religion_feature = religion_feature_hellenic
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = jain
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		kcc_persecute_dharmans_effect = yes
		set_global_flag = kcc_china_bullseye_dharmans
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = jain_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = jain_china_three
						has_global_flag = jain_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = jain_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = jain_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = jain_china_three
						has_global_flag = jain_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = jain_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_jain_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_jains }
			}
			modifier = {
				factor = 0.66
				has_global_flag = buddhists_in_china
				offmap_china = { offmap_has_like = likes_buddhists }
			}
			modifier = {
				factor = 0.66
				has_global_flag = hindus_in_china
				offmap_china = { offmap_has_like = likes_hindus }
			}
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						religion_group = pagan_group
						has_religion_feature = religion_dogmatic
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = jain
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_all_pagans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		kcc_overpersecute_dharmans_effect = yes
		set_global_flag = kcc_china_bullseye_dharmans
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = jain_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = jain_china_three
						has_global_flag = jain_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = jain_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = jain_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = jain_china_three
						has_global_flag = jain_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = jain_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_jain_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #All Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_all_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						AND = {
							offmap_china = { offmap_has_dislike = likes_tengris }
							has_global_flag = tengri_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_zunists }
							has_global_flag = zun_in_china
						}
						AND = {
							offmap_china = { offmap_has_dislike = likes_bon }
							has_global_flag = bon_in_china
						}
					}
				}
				kcc_persecute_all_pagans_effect = yes
				set_global_flag = kcc_china_collateral_pagans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				offmap_china = { offmap_has_like = likes_jains }
			}
			modifier = {
				factor = 0.66
				has_global_flag = buddhists_in_china
				offmap_china = { offmap_has_like = likes_buddhists }
			}
			modifier = {
				factor = 0.66
				has_global_flag = hindus_in_china
				offmap_china = { offmap_has_like = likes_hindus }
			}
			modifier = {
				factor = 10
				offmap_china = { offmap_has_dislike = likes_jains }
			}
			modifier = {
				factor = 2
				has_global_flag = buddhists_in_china
				offmap_china = { offmap_has_dislike = likes_buddhists }
			}
			modifier = {
				factor = 2
				has_global_flag = hindus_in_china
				offmap_china = { offmap_has_dislike = likes_hindus }
			}
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = jain
				}
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
}

# Persecute Norse?
character_event = {
	id = kccpersecute.0027
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = norse_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = norse_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = baltic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = finnish_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = slavic_pagan_reformed } }
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = norse_pagan_reformed
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = norse_pagan_reformed
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = norse_china_three
					has_global_flag = norse_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = norse_pagan_reformed
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_persecute_northern_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_northern_pagans
		}
		else = {
			kcc_persecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = norse_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = norse_china_three
						has_global_flag = norse_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = norse_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = norse_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = norse_china_three
						has_global_flag = norse_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = norse_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_norse_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = norse_pagan_reformed
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = norse_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_overpersecute_northern_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_northern_pagans
		}
		else = {
			kcc_overpersecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = norse_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = norse_china_three
						has_global_flag = norse_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = norse_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = norse_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = norse_china_three
						has_global_flag = norse_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = norse_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_norse_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = norse_pagan_reformed
				}
			}
			modifier = {
				factor = 4
				any_playable_ruler = {
					religion = norse_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
}

# Persecute Baltics?
character_event = {
	id = kccpersecute.0028
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = baltics_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = norse_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = baltic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = finnish_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = slavic_pagan_reformed } }
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = baltic_pagan_reformed
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = baltic_pagan_reformed
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = baltic_china_three
					has_global_flag = baltic_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = baltic_pagan_reformed
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_persecute_northern_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_northern_pagans
		}
		else = {
			kcc_persecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = baltic_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = baltic_china_three
						has_global_flag = baltic_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = baltic_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = baltic_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = baltic_china_three
						has_global_flag = baltic_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = baltic_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_baltic_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = baltic_pagan_reformed
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = baltic_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_overpersecute_northern_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_northern_pagans
		}
		else = {
			kcc_overpersecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = baltic_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = baltic_china_three
						has_global_flag = baltic_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = baltic_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = baltic_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = baltic_china_three
						has_global_flag = baltic_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = baltic_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_baltic_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = baltic_pagan_reformed
				}
			}
			modifier = {
				factor = 4
				any_playable_ruler = {
					religion = baltic_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
}

# Persecute Finnish?
character_event = {
	id = kccpersecute.0029
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = finnish_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = norse_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = baltic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = finnish_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = slavic_pagan_reformed } }
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = finnish_pagan_reformed
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = finnish_pagan_reformed
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = finnish_china_three
					has_global_flag = finnish_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = finnish_pagan_reformed
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_persecute_northern_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_northern_pagans
		}
		else = {
			kcc_persecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = finnish_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = finnish_china_three
						has_global_flag = finnish_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = finnish_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = finnish_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = finnish_china_three
						has_global_flag = finnish_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = finnish_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_finnish_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = finnish_pagan_reformed
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = finnish_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_overpersecute_northern_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_northern_pagans
		}
		else = {
			kcc_overpersecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = finnish_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = finnish_china_three
						has_global_flag = finnish_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = finnish_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = finnish_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = finnish_china_three
						has_global_flag = finnish_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = finnish_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_finnish_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = finnish_pagan_reformed
				}
			}
			modifier = {
				factor = 4
				any_playable_ruler = {
					religion = finnish_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
}

# Persecute Slavics?
character_event = {
	id = kccpersecute.0030
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = slavs_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = norse_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = baltic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = finnish_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = slavic_pagan_reformed } }
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = slavic_pagan_reformed
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = slavic_pagan_reformed
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = slavic_china_three
					has_global_flag = slavic_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = slavic_pagan_reformed
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_persecute_northern_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_northern_pagans
		}
		else = {
			kcc_persecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = slavic_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = slavic_china_three
						has_global_flag = slavic_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = slavic_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = slavic_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = slavic_china_three
						has_global_flag = slavic_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = slavic_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_slavic_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = slavic_pagan_reformed
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = slavic_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_overpersecute_northern_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_northern_pagans
		}
		else = {
			kcc_overpersecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = slavic_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = slavic_china_three
						has_global_flag = slavic_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = slavic_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = slavic_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = slavic_china_three
						has_global_flag = slavic_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = slavic_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_slavic_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = slavic_pagan_reformed
				}
			}
			modifier = {
				factor = 4
				any_playable_ruler = {
					religion = slavic_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
}

# Persecute Tengri?
character_event = {
	id = kccpersecute.0031
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = tengri_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = tengri_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = zun_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = bon_reformed } }
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = tengri_pagan_reformed
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = tengri_pagan_reformed
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = tengri_china_three
					has_global_flag = tengri_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = tengri_pagan_reformed
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_persecute_eastern_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_eastern_pagans
		}
		else = {
			kcc_persecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = tengri_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = tengri_china_three
						has_global_flag = tengri_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = tengri_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = tengri_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = tengri_china_three
						has_global_flag = tengri_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = tengri_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_tengri_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = tengri_pagan_reformed
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = tengri_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_overpersecute_eastern_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_eastern_pagans
		}
		else = {
			kcc_overpersecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = tengri_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = tengri_china_three
						has_global_flag = tengri_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = tengri_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = tengri_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = tengri_china_three
						has_global_flag = tengri_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = tengri_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_tengri_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = tengri_pagan_reformed
				}
			}
			modifier = {
				factor = 4
				any_playable_ruler = {
					religion = tengri_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
}

# Persecute Zun?
character_event = {
	id = kccpersecute.0032
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = zun_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = tengri_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = zun_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = bon_reformed } }
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = zun_pagan_reformed
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = zun_pagan_reformed
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = zun_china_three
					has_global_flag = zun_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = zun_pagan_reformed
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_persecute_eastern_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_eastern_pagans
		}
		else = {
			kcc_persecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = zun_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = zun_china_three
						has_global_flag = zun_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = zun_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = zun_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = zun_china_three
						has_global_flag = zun_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = zun_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_zun_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = zun_pagan_reformed
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = zun_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_overpersecute_eastern_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_eastern_pagans
		}
		else = {
			kcc_overpersecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = zun_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = zun_china_three
						has_global_flag = zun_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = zun_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = zun_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = zun_china_three
						has_global_flag = zun_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = zun_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_zun_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = zun_pagan_reformed
				}
			}
			modifier = {
				factor = 4
				any_playable_ruler = {
					religion = zun_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
}

# Persecute Bon?
character_event = {
	id = kccpersecute.0033
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = bon_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = tengri_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = zun_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = bon_reformed } }
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = bon_reformed
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = bon_reformed
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = bon_china_three
					has_global_flag = bon_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = bon_reformed
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_persecute_eastern_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_eastern_pagans
		}
		else = {
			kcc_persecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = bon_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = bon_china_three
						has_global_flag = bon_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = bon_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = bon_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = bon_china_three
						has_global_flag = bon_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = bon_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_bon_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = bon_reformed
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = bon_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_overpersecute_eastern_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_eastern_pagans
		}
		else = {
			kcc_overpersecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = bon_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = bon_china_three
						has_global_flag = bon_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = bon_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = bon_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = bon_china_three
						has_global_flag = bon_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = bon_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_bon_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = bon_reformed
				}
			}
			modifier = {
				factor = 4
				any_playable_ruler = {
					religion = bon_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
}

# Persecute Hellenics?
character_event = {
	id = kccpersecute.0034
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = hellenics_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = hellenic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = promethean_pagan } }
				offmap_china = { offmap_ruler = { religion = celtic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = britannic_pagan } }
				offmap_china = { offmap_ruler = { religion = egyptian_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = aten_pagan } }
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = hellenic_pagan_reformed
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = hellenic_pagan_reformed
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = hellenic_china_three
					has_global_flag = hellenic_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = hellenic_pagan_reformed
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_persecute_classical_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_classical_pagans
		}
		else = {
			kcc_persecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = hellenic_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = hellenic_china_three
						has_global_flag = hellenic_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = hellenic_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = hellenic_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = hellenic_china_three
						has_global_flag = hellenic_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = hellenic_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_hellenic_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = hellenic_pagan_reformed
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = hellenic_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_overpersecute_classical_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_classical_pagans
		}
		else = {
			kcc_overpersecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = hellenic_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = hellenic_china_three
						has_global_flag = hellenic_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = hellenic_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = hellenic_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = hellenic_china_three
						has_global_flag = hellenic_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = hellenic_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_hellenic_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = hellenic_pagan_reformed
				}
			}
			modifier = {
				factor = 4
				any_playable_ruler = {
					religion = hellenic_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
}

# Persecute Prometheans?
character_event = {
	id = kccpersecute.0035
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = prometheans_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = hellenic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = promethean_pagan } }
				offmap_china = { offmap_ruler = { religion = celtic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = britannic_pagan } }
				offmap_china = { offmap_ruler = { religion = egyptian_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = aten_pagan } }
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = promethean_pagan
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = promethean_pagan
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = promethean_china_three
					has_global_flag = promethean_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = promethean_pagan
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_persecute_classical_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_classical_pagans
		}
		else = {
			kcc_persecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = promethean_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = promethean_china_three
						has_global_flag = promethean_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = promethean_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = promethean_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = promethean_china_three
						has_global_flag = promethean_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = promethean_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_promethean_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = promethean_pagan
				}
			}
			modifier = {
				factor = 2
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_overpersecute_classical_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_classical_pagans
		}
		else = {
			kcc_overpersecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = promethean_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = promethean_china_three
						has_global_flag = promethean_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = promethean_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = promethean_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = promethean_china_three
						has_global_flag = promethean_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = promethean_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_promethean_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = promethean_pagan
				}
			}
			modifier = {
				factor = 4
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
}

# Persecute Celts?
character_event = {
	id = kccpersecute.0036
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = celts_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = hellenic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = promethean_pagan } }
				offmap_china = { offmap_ruler = { religion = celtic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = britannic_pagan } }
				offmap_china = { offmap_ruler = { religion = egyptian_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = aten_pagan } }
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = celtic_pagan_reformed
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = celtic_pagan_reformed
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = celtic_china_three
					has_global_flag = celtic_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = celtic_pagan_reformed
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_persecute_classical_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_classical_pagans
		}
		else = {
			kcc_persecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = celtic_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = celtic_china_three
						has_global_flag = celtic_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = celtic_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = celtic_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = celtic_china_three
						has_global_flag = celtic_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = celtic_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_celtic_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = celtic_pagan_reformed
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = celtic_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_overpersecute_classical_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_classical_pagans
		}
		else = {
			kcc_overpersecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = celtic_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = celtic_china_three
						has_global_flag = celtic_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = celtic_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = celtic_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = celtic_china_three
						has_global_flag = celtic_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = celtic_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_celtic_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = celtic_pagan_reformed
				}
			}
			modifier = {
				factor = 4
				any_playable_ruler = {
					religion = celtic_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
}

# Persecute Britannics?
character_event = {
	id = kccpersecute.0037
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = britannics_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = hellenic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = promethean_pagan } }
				offmap_china = { offmap_ruler = { religion = celtic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = britannic_pagan } }
				offmap_china = { offmap_ruler = { religion = egyptian_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = aten_pagan } }
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = britannic_pagan
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = britannic_pagan
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = britannic_china_three
					has_global_flag = britannic_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = britannic_pagan
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_persecute_classical_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_classical_pagans
		}
		else = {
			kcc_persecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = britannic_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = britannic_china_three
						has_global_flag = britannic_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = britannic_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = britannic_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = britannic_china_three
						has_global_flag = britannic_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = britannic_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_britannic_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = britannic_pagan
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_overpersecute_classical_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_classical_pagans
		}
		else = {
			kcc_overpersecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = britannic_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = britannic_china_three
						has_global_flag = britannic_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = britannic_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = britannic_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = britannic_china_three
						has_global_flag = britannic_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = britannic_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_britannic_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = britannic_pagan
				}
			}
		}
	}
}

# Persecute Egyptians?
character_event = {
	id = kccpersecute.0038
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = egyptians_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = hellenic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = promethean_pagan } }
				offmap_china = { offmap_ruler = { religion = celtic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = britannic_pagan } }
				offmap_china = { offmap_ruler = { religion = egyptian_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = aten_pagan } }
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = egyptian_pagan_reformed
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = egyptian_pagan_reformed
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = egyptian_china_three
					has_global_flag = egyptian_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = egyptian_pagan_reformed
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_persecute_classical_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_classical_pagans
		}
		else = {
			kcc_persecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = egyptian_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = egyptian_china_three
						has_global_flag = egyptian_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = egyptian_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = egyptian_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = egyptian_china_three
						has_global_flag = egyptian_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = egyptian_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_egyptian_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = egyptian_pagan_reformed
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = egyptian_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_overpersecute_classical_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_classical_pagans
		}
		else = {
			kcc_overpersecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = egyptian_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = egyptian_china_three
						has_global_flag = egyptian_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = egyptian_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = egyptian_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = egyptian_china_three
						has_global_flag = egyptian_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = egyptian_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_egyptian_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = egyptian_pagan_reformed
				}
			}
			modifier = {
				factor = 4
				any_playable_ruler = {
					religion = egyptian_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
}

# Persecute Atenics?
character_event = {
	id = kccpersecute.0039
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = atenics_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			OR = {
				offmap_china = { offmap_ruler = { religion = hellenic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = promethean_pagan } }
				offmap_china = { offmap_ruler = { religion = celtic_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = britannic_pagan } }
				offmap_china = { offmap_ruler = { religion = egyptian_pagan_reformed } }
				offmap_china = { offmap_ruler = { religion = aten_pagan } }
			}
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = aten_pagan
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = aten_pagan
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = atenic_china_three
					has_global_flag = atenic_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = aten_pagan
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_persecute_classical_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_classical_pagans
		}
		else = {
			kcc_persecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = atenic_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = atenic_china_three
						has_global_flag = atenic_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = atenic_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = atenic_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = atenic_china_three
						has_global_flag = atenic_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = atenic_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_atenic_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = aten_pagan
				}
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_overpersecute_classical_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_classical_pagans
		}
		else = {
			kcc_overpersecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = atenic_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = atenic_china_three
						has_global_flag = atenic_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = atenic_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = atenic_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = atenic_china_three
						has_global_flag = atenic_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = atenic_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_atenic_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = aten_pagan
				}
			}
		}
	}
}

# Persecute Africans?
character_event = {
	id = kccpersecute.0040
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = africans_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = west_african_pagan_reformed } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = west_african_pagan_reformed
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = west_african_pagan_reformed
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = african_china_three
					has_global_flag = african_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = west_african_pagan_reformed
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_persecute_africans_effect = yes
			set_global_flag = kcc_china_bullseye_africans
		}
		else = {
			kcc_persecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = african_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = african_china_three
						has_global_flag = african_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = african_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = african_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = african_china_three
						has_global_flag = african_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = african_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_african_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = west_african_pagan_reformed
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = west_african_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_aztecs_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_overpersecute_africans_effect = yes
			set_global_flag = kcc_china_bullseye_africans
		}
		else = {
			kcc_overpersecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = african_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = african_china_three
						has_global_flag = african_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = african_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = african_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = african_china_three
						has_global_flag = african_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = african_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_african_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Aztecs
				modifier = {
					factor = 0
					kcc_can_persecute_aztecs_trigger = no
				}
				kcc_persecute_aztecs_effect = yes
				set_global_flag = kcc_china_collateral_aztecs
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = west_african_pagan_reformed
				}
			}
			modifier = {
				factor = 4
				any_playable_ruler = {
					religion = west_african_pagan_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
}

# Persecute Aztecs?
character_event = {
	id = kccpersecute.0041
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		NOR = {
			offmap_china = { has_status = china_civil_war }
			offmap_china = { has_status = china_mongol_invasion }
			offmap_china = { has_status = china_jurchen_invasion }
		}
	}
	
	after = {
		kcc_post_persecution_effect = yes
	}
	
	weight_multiplier = {
		days = 153
		modifier = {
			factor = 0
			NOT = { has_global_flag = aztecs_in_china }
		}
		modifier = {
			factor = 0
			kcc_china_has_persecuted_trigger = yes
		}
		modifier = {
			factor = 0
			offmap_china = { offmap_ruler = { religion = aztec_reformed } }
		}
	}
	
	option = { #Nope
	
		ai_chance = {
			factor = 85
			modifier = {
				factor = 0.1
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = aztec_reformed
				}
			}
			modifier = {
				factor = 0.2
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					offmap_china = { has_status = china_unrest }
					offmap_china = { has_status = china_famine }
					offmap_china = { has_status = china_plague }
				}
			}
			modifier = {
				factor = 0.5
				any_playable_ruler = {
					religion = aztec_reformed
					OR = {
						independent = yes
						is_powerful_vassal = yes
					}
					OR = {
						has_character_modifier = angered_china_modifier
						has_character_modifier = war_with_china_modifier
						has_character_modifier = failed_invasion_of_china
						has_character_modifier = china_raid_active
						has_character_modifier = china_raid_grace_cd
						has_character_modifier = chinese_missionaries_bad
					}
					primary_title = { higher_real_tier_than = DUKE }
				}
			}
			modifier = {
				factor = 2
				NOT = { offmap_china = { has_status = china_golden_age } }
				OR = {
					has_global_flag = aztec_china_three
					has_global_flag = aztec_china_four
				}
			}
			modifier = {
				factor = 3
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion = jain
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_peaceful
									has_religion_feature = religion_cosmopolitan
									has_religion_feature = religion_syncretic
									has_religion_feature = religion_feature_hellenic
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.33
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = muslim
							AND = {
								religion_group = pagan_group
								OR = {
									has_religion_feature = religion_jizya
									has_religion_feature = religion_feature_west_african
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = aztec_reformed
					realm_size = 250
					any_realm_province = {
						region = custom_eastern_access
					}
					OR = {
						has_character_modifier = peace_deal_with_china
						has_character_modifier = chinese_imperial_trade_contract
						has_character_modifier = chinese_favored_in_trade
						has_offmap_currency = { offmap = offmap_china value = 1000 }
					}
				}
			}
		}
	}
	
	option = { #Persecute
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0001 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_persecute_aztecs_effect = yes
			set_global_flag = kcc_china_bullseye_aztecs
		}
		else = {
			kcc_persecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = aztec_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = aztec_china_three
						has_global_flag = aztec_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = aztec_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = aztec_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = aztec_china_three
						has_global_flag = aztec_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = aztec_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_aztec_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.5
				offmap_china = {
					offmap_ruler = {
						OR = {
							religion_group = christian
							AND = {
								religion_group = pagan_group
								has_religion_feature = religion_dogmatic
							}
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = aztec_reformed
				}
			}
			modifier = {
				factor = 2
				any_playable_ruler = {
					religion = aztec_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
	
	option = { #Great Purge
		trigger = {
			OR = {
				kcc_can_persecute_christians_trigger = yes
				kcc_can_persecute_latins_trigger = yes
				kcc_can_persecute_byzantines_trigger = yes
				kcc_can_persecute_nonchalcedonians_trigger = yes
				kcc_can_persecute_muslims_trigger = yes
				kcc_can_persecute_sunnis_trigger = yes
				kcc_can_persecute_shias_trigger = yes
				kcc_can_persecute_mazdans_trigger = yes
				kcc_zoro_can_persecute_mazdans_trigger = yes
				kcc_can_persecute_dharmans_trigger = yes
				kcc_can_persecute_northern_pagans_trigger = yes
				kcc_can_persecute_eastern_pagans_trigger = yes
				kcc_can_persecute_classical_pagans_trigger = yes
				kcc_can_persecute_africans_trigger = yes
				kcc_can_persecute_jews_trigger = yes
			}
		}
	
		any_playable_ruler = { narrative_event = { id = kccpnews.0002 days = 1 } }
		if = {
			limit = {
				NOR = {
					offmap_china = { offmap_ruler = { religion_group = christian } }
					offmap_china = { offmap_ruler = { religion_group = muslim } }
				}
			}
			kcc_overpersecute_aztecs_effect = yes
			set_global_flag = kcc_china_bullseye_aztecs
		}
		else = {
			kcc_overpersecute_all_pagans_effect = yes
			set_global_flag = kcc_china_bullseye_pagans
		}
		random_list = {
			40 = { #No Effect
				modifier = {
					factor = 2
					offmap_china = { has_status = china_golden_age }
				}
				modifier = {
					factor = 0.5
					has_global_flag = aztec_china_four
				}
			}
			20 = { #Unrest
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = aztec_china_three
						has_global_flag = aztec_china_four
					}
				}
				modifier = {
					factor = 0
					offmap_china = { has_status = china_unrest }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.3 days = 11 } } }
			}
			5 = { #Fix Unrest, Scapegoating was true after all
				modifier = {
					factor = 0.6
					has_global_flag = aztec_china_three
				}
				modifier = {
					factor = 0
					has_global_flag = aztec_china_four
				}
				modifier = {
					factor = 0
					NOT = { offmap_china = { has_status = china_unrest } }
				}
				offmap_china = { governor = { character_event = { id = kccdragontamer.4 days = 21 } } }
			}
			40 = { #Civil War
				modifier = {
					factor = 0
					NOR = {
						has_global_flag = aztec_china_three
						has_global_flag = aztec_china_four
					}
				}
				modifier = {
					factor = 0.1
					NOT = { has_global_flag = aztec_china_four }
				}
				modifier = {
					factor = 3
					offmap_china = { has_status = china_unrest }
				}
				set_global_flag = kcc_aztec_civil_war
				offmap_china = { governor = { character_event = { id = kccdragontamer.5 days = 11 } } }
			}
		}
		random_list = {
			10 = { #Christians
				modifier = {
					factor = 0
					kcc_can_persecute_christians_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_christians }
				}
				kcc_persecute_christians_effect = yes
				set_global_flag = kcc_china_collateral_christians
			}
			10 = { #Latins
				modifier = {
					factor = 0
					kcc_can_persecute_latins_trigger = no
				}
				kcc_persecute_latins_effect = yes
				set_global_flag = kcc_china_collateral_latins
			}
			10 = { #Byzantines
				modifier = {
					factor = 0
					kcc_can_persecute_byzantines_trigger = no
				}
				kcc_persecute_byzantines_effect = yes
				set_global_flag = kcc_china_collateral_byzantines
			}
			10 = { #Non-Chalcedonian
				modifier = {
					factor = 0
					kcc_can_persecute_nonchalcedonians_trigger = no
				}
				kcc_persecute_nonchalcedonians_effect = yes
				set_global_flag = kcc_china_collateral_nonchalcedonians
			}
			10 = { #Muslims
				modifier = {
					factor = 0
					kcc_can_persecute_muslims_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_muslims }
				}
				kcc_persecute_muslims_effect = yes
				set_global_flag = kcc_china_collateral_muslims
			}
			10 = { #Sunnis
				modifier = {
					factor = 0
					kcc_can_persecute_sunnis_trigger = no
				}
				kcc_persecute_sunnis_effect = yes
				set_global_flag = kcc_china_collateral_sunnis
			}
			10 = { #Shias
				modifier = {
					factor = 0
					kcc_can_persecute_shias_trigger = no
				}
				kcc_persecute_shias_effect = yes
				set_global_flag = kcc_china_collateral_shias
			}
			10 = { #Mazdans
				modifier = {
					factor = 0
					kcc_can_persecute_mazdans_trigger = no
				}
				modifier = {
					factor = 3
					offmap_china = { offmap_has_dislike = likes_mazdans }
				}
				kcc_persecute_mazdans_effect = yes
				set_global_flag = kcc_china_collateral_mazdans
			}
			20 = { #Zoro China Mazdans
				modifier = {
					factor = 0
					kcc_zoro_can_persecute_mazdans_trigger = no
				}
				kcc_zoro_persecute_mazdans_effect = yes
				set_global_flag = kcc_zoro_china_collateral_mazdans
			}
			10 = { #Dharmans
				modifier = {
					factor = 0
					kcc_can_persecute_dharmans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_buddhists }
						offmap_china = { offmap_has_dislike = likes_jains }
						AND = {
							has_game_rule = {
								name = kcc_who_can_preach
								value = kcc_preach_yes
							}
							offmap_china = { offmap_has_dislike = likes_hindus }
						}
					}
				}
				kcc_persecute_dharmans_effect = yes
				set_global_flag = kcc_china_collateral_dharmans
			}
			10 = { #Northern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_northern_pagans_trigger = no
				}
				kcc_persecute_northern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_northern_pagans
			}
			10 = { #Eastern Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_eastern_pagans_trigger = no
				}
				modifier = {
					factor = 3
					OR = {
						offmap_china = { offmap_has_dislike = likes_tengris }
						offmap_china = { offmap_has_dislike = likes_zunists }
						offmap_china = { offmap_has_dislike = likes_bon }
					}
				}
				kcc_persecute_eastern_pagans_effect = yes
				set_global_flag = kcc_china_collateral_eastern_pagans
			}
			10 = { #Classical Pagans
				modifier = {
					factor = 0
					kcc_can_persecute_classical_pagans_trigger = no
				}
				kcc_persecute_classical_pagans_effect = yes
				set_global_flag = kcc_china_collateral_classical_pagans
			}
			10 = { #Africans
				modifier = {
					factor = 0
					kcc_can_persecute_africans_trigger = no
				}
				kcc_persecute_africans_effect = yes
				set_global_flag = kcc_china_collateral_africans
			}
			20 = { #Jews
				modifier = {
					factor = 0
					kcc_can_persecute_jews_trigger = no
				}
				kcc_persecute_jews_effect = yes
				set_global_flag = kcc_china_collateral_jews
			}
		}
	
		ai_chance = {
			factor = 5
			modifier = {
				factor = 3
				any_province = {
					de_jure_liege = d_jiuquan
					NOT = { culture_group = chinese_group }
					religion = aztec_reformed
				}
			}
			modifier = {
				factor = 4
				any_playable_ruler = {
					religion = aztec_reformed
					OR = {
						has_religion_feature = religion_monastic
						has_religion_feature = religion_feature_west_african
					}
				}
				kcc_unmonastic_china_trigger = yes
			}
		}
	}
}

# Persecution Aftereffects
character_event = {
	id = kccpersecute.0042
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	only_playable = yes
	
	trigger = {
		has_landed_title = e_china_west_governor
		kcc_china_has_persecuted_trigger = yes
	}
	
	immediate = {
		if = {
			limit = {
				has_global_flag = catholics_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_latins
						has_province_modifier = kcc_china_persecuted_catholics
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_catholics" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = cathars_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_latins
						has_province_modifier = kcc_china_persecuted_cathars
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_cathars" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = fraticellis_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_latins
						has_province_modifier = kcc_china_persecuted_fraticellis
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_fraticellis" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = waldensians_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_latins
						has_province_modifier = kcc_china_persecuted_waldensians
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_waldensians" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = lollards_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_latins
						has_province_modifier = kcc_china_persecuted_lollards
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_lollards" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = orthodoxy_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_byzantines
						has_province_modifier = kcc_china_persecuted_orthodoxy
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_orthodoxs" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = bogomilists_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_byzantines
						has_province_modifier = kcc_china_persecuted_bogomilists
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_bogomilists" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = monothelites_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_byzantines
						has_province_modifier = kcc_china_persecuted_monothelites
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_monothelites" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = iconoclasts_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_byzantines
						has_province_modifier = kcc_china_persecuted_iconoclasts
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_iconoclasts" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = paulicians_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_byzantines
						has_province_modifier = kcc_china_persecuted_paulicians
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_paulicians" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = miaphysites_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_nonchalcedonians
						has_province_modifier = kcc_china_persecuted_miaphysites
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_miaphysites" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = monophysites_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_nonchalcedonians
						has_province_modifier = kcc_china_persecuted_monophysites
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_monophysites" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = nestorians_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_nonchalcedonians
						has_province_modifier = kcc_china_persecuted_nestorians
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_nestorians" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = messalians_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_nonchalcedonians
						has_province_modifier = kcc_china_persecuted_messalians
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_messalians" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = sunnis_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_muslims
						has_province_modifier = kcc_china_persecuted_sunnis
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_sunnis" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = zikris_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_muslims
						has_province_modifier = kcc_china_persecuted_sunnis
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_zikris" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = shiites_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_muslims
						has_province_modifier = kcc_china_persecuted_shiites
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_shiites" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = qarmatian_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_muslims
						has_province_modifier = kcc_china_persecuted_shiites
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_qarmatians" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = hurufis_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_muslims
						has_province_modifier = kcc_china_persecuted_shiites
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_hurufis" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = zoroastrians_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_mazdans
						has_province_modifier = kcc_china_persecuted_zoroastrians
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_zoroastrians" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = mazdakis_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_mazdans
						has_province_modifier = kcc_zoro_china_persecuted_mazdans
						has_province_modifier = kcc_china_persecuted_mazdakis
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_mazdakis" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = manicheans_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_mazdans
						has_province_modifier = kcc_zoro_china_persecuted_mazdans
						has_province_modifier = kcc_china_persecuted_manicheans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_manicheans" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = buddhists_in_china
				1513 = { has_province_modifier = kcc_china_persecuted_dharmans }
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_buddhists" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = jains_in_china
				1513 = { has_province_modifier = kcc_china_persecuted_dharmans }
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_jains" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = norse_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_pagans
						has_province_modifier = kcc_china_persecuted_northern_pagans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_norse_pagan_reformeds" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = baltics_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_pagans
						has_province_modifier = kcc_china_persecuted_northern_pagans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_baltic_pagan_reformeds" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = finnish_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_pagans
						has_province_modifier = kcc_china_persecuted_northern_pagans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_finnish_pagan_reformeds" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = slavs_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_pagans
						has_province_modifier = kcc_china_persecuted_northern_pagans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_slavic_pagan_reformeds" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = tengri_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_pagans
						has_province_modifier = kcc_china_persecuted_eastern_pagans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_tengri_pagan_reformeds" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = zun_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_pagans
						has_province_modifier = kcc_china_persecuted_eastern_pagans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_zun_pagan_reformeds" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = bon_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_pagans
						has_province_modifier = kcc_china_persecuted_eastern_pagans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_bon_reformeds" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = hellenics_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_pagans
						has_province_modifier = kcc_china_persecuted_classical_pagans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_hellenic_pagan_reformeds" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = prometheans_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_pagans
						has_province_modifier = kcc_china_persecuted_classical_pagans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_zalmoxian_reformeds" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = celts_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_pagans
						has_province_modifier = kcc_china_persecuted_classical_pagans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_druidic_pagan_reformeds" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = britannics_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_pagans
						has_province_modifier = kcc_china_persecuted_classical_pagans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_cybelene_reformeds" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = egyptians_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_pagans
						has_province_modifier = kcc_china_persecuted_classical_pagans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_kemetisms" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = atenics_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_pagans
						has_province_modifier = kcc_china_persecuted_classical_pagans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_megalithic_reformeds" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = africans_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_pagans
						has_province_modifier = kcc_china_persecuted_africans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_west_african_pagan_reformeds" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = aztecs_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_pagans
						has_province_modifier = kcc_china_persecuted_aztecs
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_aztec_reformeds" value = -1 } }
			}
		}
		#Christian Immersion
		if = {
			limit = {
				has_global_flag = adoptionists_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_latins
						has_province_modifier = kcc_china_persecuted_adoptionists
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_adoptionists" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = free_spirits_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_latins
						has_province_modifier = kcc_china_persecuted_free_spirits
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_free_spirits" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = barlaamites_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_byzantines
						has_province_modifier = kcc_china_persecuted_barlaamites
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_bogomilists" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = judaizers_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_nonchalcedonians
						has_province_modifier = kcc_china_persecuted_judaizers
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_judaizers" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = mandeans_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_nonchalcedonians
						has_province_modifier = kcc_china_persecuted_mandeans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_mandeans" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = chaldeans_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_nonchalcedonians
						has_province_modifier = kcc_china_persecuted_chaldeans
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_chaldeans" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = apollinarians_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_christians
						has_province_modifier = kcc_china_persecuted_nonchalcedonians
						has_province_modifier = kcc_china_persecuted_apollinarians
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_apollinarians" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = yarsans_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_muslims
						has_province_modifier = kcc_china_persecuted_sunnis
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_yarsans" value = -1 } }
			}
		}
		#Last Vanilla Religions
		if = {
			limit = {
				has_global_flag = yazidis_in_china
				NOT = { has_global_flag = EMF }
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_muslims
						has_province_modifier = kcc_china_persecuted_sunnis
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_yazidis" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = yazidis_in_china
				has_global_flag = EMF
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_mazdans
						has_province_modifier = kcc_zoro_china_persecuted_mazdans
						has_province_modifier = kcc_china_persecuted_yazidis
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_yazidis" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = druze_in_china
				1513 = { 
					OR = {
						has_province_modifier = kcc_china_persecuted_muslims
						has_province_modifier = kcc_china_persecuted_shiites
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_druzes" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = khurmaztas_in_china
				1513 = {
					OR = {
						has_province_modifier = kcc_china_persecuted_mazdans
						has_province_modifier = kcc_zoro_china_persecuted_mazdans
						has_province_modifier = kcc_china_persecuted_khurmaztas
					}
				}
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_khurmaztas" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = jews_in_china
				1513 = { has_province_modifier = kcc_china_persecuted_jews }
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_jewishs" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = samaritans_in_china
				1513 = { has_province_modifier = kcc_china_persecuted_jews }
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_samaritans" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = karaites_in_china
				1513 = { has_province_modifier = kcc_china_persecuted_jews }
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_karaites" value = -1 } }
			}
		}
		if = {
			limit = {
				has_global_flag = hindus_in_china
				1513 = { has_province_modifier = kcc_china_persecuted_dharmans }
			}
			random_list = {
				50 = { }
				50 = { change_variable = { which = "global_chinese_hindus" value = -1 } }
			}
		}
	}
	
	after = {
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_catholics" value = 0 } }
				has_global_flag = catholics_in_china
			}
			clr_global_flag = catholics_in_china
			clr_global_flag = catholic_china_one
			clr_global_flag = catholic_china_two
			set_variable = { which = "global_chinese_catholics" value = 0 }
			set_global_flag = kcc_ghosttown_catholics
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_catholics" value = 20 } }
				has_global_flag = catholic_china_one
			}
			clr_global_flag = catholic_china_one
			clr_global_flag = catholic_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_catholics" value = 40 } }
				has_global_flag = catholic_china_two
			}
			clr_global_flag = catholic_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_catholics" value = 100 } }
				has_global_flag = catholic_china_three
			}
			clr_global_flag = catholic_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_catholics" value = 120 } }
				has_global_flag = catholic_china_four
			}
			clr_global_flag = catholic_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_cathars" value = 0 } }
				has_global_flag = cathars_in_china
			}
			clr_global_flag = cathars_in_china
			clr_global_flag = cathar_china_one
			clr_global_flag = cathar_china_two
			set_variable = { which = "global_chinese_cathars" value = 0 }
			set_global_flag = kcc_ghosttown_cathars
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_cathars" value = 20 } }
				has_global_flag = cathar_china_one
			}
			clr_global_flag = cathar_china_one
			clr_global_flag = cathar_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_cathars" value = 40 } }
				has_global_flag = cathar_china_two
			}
			clr_global_flag = cathar_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_cathars" value = 100 } }
				has_global_flag = cathar_china_three
			}
			clr_global_flag = cathar_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_cathars" value = 120 } }
				has_global_flag = cathar_china_four
			}
			clr_global_flag = cathar_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_fraticellis" value = 0 } }
				has_global_flag = fraticellis_in_china
			}
			clr_global_flag = fraticellis_in_china
			clr_global_flag = fraticelli_china_one
			clr_global_flag = fraticelli_china_two
			set_variable = { which = "global_chinese_fraticellis" value = 0 }
			set_global_flag = kcc_ghosttown_fraticellis
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_fraticellis" value = 20 } }
				has_global_flag = fraticelli_china_one
			}
			clr_global_flag = fraticelli_china_one
			clr_global_flag = fraticelli_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_fraticellis" value = 40 } }
				has_global_flag = fraticelli_china_two
			}
			clr_global_flag = fraticelli_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_fraticellis" value = 100 } }
				has_global_flag = fraticelli_china_three
			}
			clr_global_flag = fraticelli_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_fraticellis" value = 100 } }
				has_global_flag = fraticelli_china_four
			}
			clr_global_flag = fraticelli_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_waldensians" value = 0 } }
				has_global_flag = waldensians_in_china
			}
			clr_global_flag = waldensians_in_china
			clr_global_flag = waldensian_china_one
			clr_global_flag = waldensian_china_two
			set_variable = { which = "global_chinese_waldensians" value = 0 }
			set_global_flag = kcc_ghosttown_waldensians
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_waldensians" value = 20 } }
				has_global_flag = waldensian_china_one
			}
			clr_global_flag = waldensian_china_one
			clr_global_flag = waldensian_china_two
			}
		else_if = {
				limit = {
				NOT = { check_variable = { which = "global_chinese_waldensians" value = 40 } }
				has_global_flag = waldensian_china_two
				}
			clr_global_flag = waldensian_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_waldensians" value = 100 } }
				has_global_flag = waldensian_china_three
			}
			clr_global_flag = waldensian_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_waldensians" value = 120 } }
				has_global_flag = waldensian_china_four
			}
			clr_global_flag = waldensian_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_lollards" value = 0 } }
				has_global_flag = lollards_in_china
			}
			clr_global_flag = lollards_in_china
			clr_global_flag = lollard_china_one
			clr_global_flag = lollard_china_two
			set_variable = { which = "global_chinese_lollards" value = 0 }
			set_global_flag = kcc_ghosttown_lollards
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_lollards" value = 20 } }
				has_global_flag = lollard_china_one
			}
			clr_global_flag = lollard_china_one
			clr_global_flag = lollard_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_lollards" value = 40 } }
				has_global_flag = lollard_china_two
			}
			clr_global_flag = lollard_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_lollards" value = 100 } }
				has_global_flag = lollard_china_three
			}
			clr_global_flag = lollard_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_lollards" value = 120 } }
				has_global_flag = lollard_china_four
			}
			clr_global_flag = lollard_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_orthodoxs" value = 0 } }
				has_global_flag = orthodoxy_in_china
			}
			clr_global_flag = orthodoxy_in_china
			clr_global_flag = orthodox_china_one
			clr_global_flag = orthodox_china_two
			set_variable = { which = "global_chinese_orthodoxs" value = 0 }
			set_global_flag = kcc_ghosttown_orthodoxy
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_orthodoxs" value = 20 } }
				has_global_flag = orthodox_china_one
			}
			clr_global_flag = orthodox_china_one
			clr_global_flag = orthodox_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_orthodoxs" value = 40 } }
				has_global_flag = orthodox_china_two
			}
			clr_global_flag = orthodox_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_orthodoxs" value = 100 } }
				has_global_flag = orthodox_china_three
			}
			clr_global_flag = orthodox_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_orthodoxs" value = 120 } }
				has_global_flag = orthodox_china_four
			}
			clr_global_flag = orthodox_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_bogomilists" value = 0 } }
				has_global_flag = bogomilists_in_china
			}
			clr_global_flag = bogomilists_in_china
			clr_global_flag = bogomilist_china_one
			clr_global_flag = bogomilist_china_two
			set_variable = { which = "global_chinese_bogomilists" value = 0 }
			set_global_flag = kcc_ghosttown_bogomilists
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_bogomilists" value = 20 } }
				has_global_flag = bogomilist_china_one
			}
			clr_global_flag = bogomilist_china_one
			clr_global_flag = bogomilist_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_bogomilists" value = 40 } }
				has_global_flag = bogomilist_china_two
			}
			clr_global_flag = bogomilist_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_bogomilists" value = 100 } }
				has_global_flag = bogomilist_china_three
			}
			clr_global_flag = bogomilist_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_bogomilists" value = 120 } }
				has_global_flag = bogomilist_china_four
			}
			clr_global_flag = bogomilist_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_monothelites" value = 0 } }
				has_global_flag = monothelites_in_china
			}
			clr_global_flag = monothelites_in_china
			clr_global_flag = monothelite_china_one
			clr_global_flag = monothelite_china_two
			set_variable = { which = "global_chinese_monothelites" value = 0 }
			set_global_flag = kcc_ghosttown_monothelites
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_monothelites" value = 20 } }
				has_global_flag = monothelite_china_one
			}
			clr_global_flag = monothelite_china_one
			clr_global_flag = monothelite_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_monothelites" value = 40 } }
				has_global_flag = monothelite_china_two
			}
			clr_global_flag = monothelite_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_monothelites" value = 100 } }
				has_global_flag = monothelite_china_three
			}
			clr_global_flag = monothelite_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_monothelites" value = 120 } }
				has_global_flag = monothelite_china_four
			}
			clr_global_flag = monothelite_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_iconoclasts" value = 0 } }
				has_global_flag = iconoclasts_in_china
			}
			clr_global_flag = iconoclasts_in_china
			clr_global_flag = iconoclast_china_one
			clr_global_flag = iconoclast_china_two
			set_variable = { which = "global_chinese_iconoclasts" value = 0 }
			set_global_flag = kcc_ghosttown_iconoclasts
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_iconoclasts" value = 20 } }
				has_global_flag = iconoclast_china_one
			}
			clr_global_flag = iconoclast_china_one
			clr_global_flag = iconoclast_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_iconoclasts" value = 40 } }
				has_global_flag = iconoclast_china_two
			}
			clr_global_flag = iconoclast_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_iconoclasts" value = 100 } }
				has_global_flag = iconoclast_china_three
			}
			clr_global_flag = iconoclast_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_iconoclasts" value = 120 } }
				has_global_flag = iconoclast_china_four
			}
			clr_global_flag = iconoclast_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_paulicians" value = 0 } }
				has_global_flag = paulicians_in_china
			}
			clr_global_flag = paulicians_in_china
			clr_global_flag = paulician_china_one
			clr_global_flag = paulician_china_two
			set_variable = { which = "global_chinese_paulicians" value = 0 }
			set_global_flag = kcc_ghosttown_paulicians
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_paulicians" value = 20 } }
				has_global_flag = paulician_china_one
			}
			clr_global_flag = paulician_china_one
			clr_global_flag = paulician_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_paulicians" value = 40 } }
				has_global_flag = paulician_china_two
			}
			clr_global_flag = paulician_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_paulicians" value = 100 } }
				has_global_flag = paulician_china_three
			}
			clr_global_flag = paulician_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_paulicians" value = 120 } }
				has_global_flag = paulician_china_four
			}
			clr_global_flag = paulician_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_miaphysites" value = 0 } }
				has_global_flag = miaphysites_in_china
			}
			clr_global_flag = miaphysites_in_china
			clr_global_flag = miaphysite_china_one
			clr_global_flag = miaphysite_china_two
			set_variable = { which = "global_chinese_miaphysites" value = 0 }
			set_global_flag = kcc_ghosttown_miaphysites
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_miaphysites" value = 20 } }
				has_global_flag = miaphysite_china_one
			}
			clr_global_flag = miaphysite_china_one
			clr_global_flag = miaphysite_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_miaphysites" value = 40 } }
				has_global_flag = miaphysite_china_two
			}
			clr_global_flag = miaphysite_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_miaphysites" value = 100 } }
				has_global_flag = miaphysite_china_three
			}
			clr_global_flag = miaphysite_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_miaphysites" value = 120 } }
				has_global_flag = miaphysite_china_four
			}
			clr_global_flag = miaphysite_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_monophysites" value = 0 } }
				has_global_flag = monophysites_in_china
			}
			clr_global_flag = monophysites_in_china
			clr_global_flag = monophysite_china_one
			clr_global_flag = monophysite_china_two
			set_variable = { which = "global_chinese_monophysites" value = 0 }
			set_global_flag = kcc_ghosttown_monophysites
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_monophysites" value = 20 } }
				has_global_flag = monophysite_china_one
			}
			clr_global_flag = monophysite_china_one
			clr_global_flag = monophysite_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_monophysites" value = 40 } }
				has_global_flag = monophysite_china_two
			}
			clr_global_flag = monophysite_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_monophysites" value = 100 } }
				has_global_flag = monophysite_china_three
			}
			clr_global_flag = monophysite_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_monophysites" value = 120 } }
				has_global_flag = monophysite_china_four
			}
			clr_global_flag = monophysite_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_nestorians" value = 0 } }
				has_global_flag = nestorians_in_china
			}
			clr_global_flag = nestorians_in_china
			clr_global_flag = nestorian_china_one
			clr_global_flag = nestorian_china_two
			set_variable = { which = "global_chinese_nestorians" value = 0 }
			set_global_flag = kcc_ghosttown_nestorians
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_nestorians" value = 20 } }
				has_global_flag = nestorian_china_one
			}
			clr_global_flag = nestorian_china_one
			clr_global_flag = nestorian_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_nestorians" value = 40 } }
				has_global_flag = nestorian_china_two
			}
			clr_global_flag = nestorian_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_nestorians" value = 100 } }
				has_global_flag = nestorian_china_three
			}
			clr_global_flag = nestorian_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_nestorians" value = 120 } }
				has_global_flag = nestorian_china_four
			}
			clr_global_flag = nestorian_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_messalians" value = 0 } }
				has_global_flag = messalians_in_china
			}
			clr_global_flag = messalians_in_china
			clr_global_flag = messalian_china_one
			clr_global_flag = messalian_china_two
			set_variable = { which = "global_chinese_messalians" value = 0 }
			set_global_flag = kcc_ghosttown_messalians
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_messalians" value = 20 } }
				has_global_flag = messalian_china_one
			}
			clr_global_flag = messalian_china_one
			clr_global_flag = messalian_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_messalians" value = 40 } }
				has_global_flag = messalian_china_two
			}
			clr_global_flag = messalian_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_messalians" value = 100 } }
				has_global_flag = messalian_china_three
			}
			clr_global_flag = messalian_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_messalians" value = 120 } }
				has_global_flag = messalian_china_four
			}
			clr_global_flag = messalian_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_sunnis" value = 0 } }
				has_global_flag = sunnis_in_china
			}
			clr_global_flag = sunnis_in_china
			clr_global_flag = sunni_china_one
			clr_global_flag = sunni_china_two
			set_variable = { which = "global_chinese_sunnis" value = 0 }
			set_global_flag = kcc_ghosttown_sunnis
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_sunnis" value = 20 } }
				has_global_flag = sunni_china_one
			}
			clr_global_flag = sunni_china_one
			clr_global_flag = sunni_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_sunnis" value = 40 } }
				has_global_flag = sunni_china_two
			}
			clr_global_flag = sunni_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_sunnis" value = 100 } }
				has_global_flag = sunni_china_three
			}
			clr_global_flag = sunni_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_sunnis" value = 120 } }
				has_global_flag = sunni_china_four
			}
			clr_global_flag = sunni_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zikris" value = 0 } }
				has_global_flag = zikris_in_china
			}
			clr_global_flag = zikris_in_china
			clr_global_flag = zikri_china_one
			clr_global_flag = zikri_china_two
			set_variable = { which = "global_chinese_zikris" value = 0 }
			set_global_flag = kcc_ghosttown_zikris
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zikris" value = 20 } }
				has_global_flag = zikri_china_one
			}
			clr_global_flag = zikri_china_one
			clr_global_flag = zikri_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zikris" value = 40 } }
				has_global_flag = zikri_china_two
			}
			clr_global_flag = zikri_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zikris" value = 100 } }
				has_global_flag = zikri_china_three
			}
			clr_global_flag = zikri_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zikris" value = 120 } }
				has_global_flag = zikri_china_four
			}
			clr_global_flag = zikri_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_shiites" value = 0 } }
				has_global_flag = shiites_in_china
			}
			clr_global_flag = shiites_in_china
			clr_global_flag = shiite_china_one
			clr_global_flag = shiite_china_two
			set_variable = { which = "global_chinese_shiites" value = 0 }
			set_global_flag = kcc_ghosttown_shiites
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_shiites" value = 20 } }
				has_global_flag = shiite_china_one
			}
			clr_global_flag = shiite_china_one
			clr_global_flag = shiite_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_shiites" value = 40 } }
				has_global_flag = shiite_china_two
			}
			clr_global_flag = shiite_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_shiites" value = 100 } }
				has_global_flag = shiite_china_three
			}
			clr_global_flag = shiite_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_shiites" value = 120 } }
				has_global_flag = shiite_china_four
			}
			clr_global_flag = shiite_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_qarmatians" value = 0 } }
				has_global_flag = qarmatian_in_china
			}
			clr_global_flag = qarmatian_in_china
			clr_global_flag = qarmatian_china_one
			clr_global_flag = qarmatian_china_two
			set_variable = { which = "global_chinese_qarmatians" value = 0 }
			set_global_flag = kcc_ghosttown_qarmatian
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_qarmatians" value = 20 } }
				has_global_flag = qarmatian_china_one
			}
			clr_global_flag = qarmatian_china_one
			clr_global_flag = qarmatian_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_qarmatians" value = 40 } }
				has_global_flag = qarmatian_china_two
			}
			clr_global_flag = qarmatian_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_qarmatians" value = 100 } }
				has_global_flag = qarmatian_china_three
			}
			clr_global_flag = qarmatian_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_qarmatians" value = 120 } }
				has_global_flag = qarmatian_china_four
			}
			clr_global_flag = qarmatian_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_hurufis" value = 0 } }
				has_global_flag = hurufis_in_china
			}
			clr_global_flag = hurufis_in_china
			clr_global_flag = hurufi_china_one
			clr_global_flag = hurufi_china_two
			set_variable = { which = "global_chinese_hurufis" value = 0 }
			set_global_flag = kcc_ghosttown_hurufis
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_hurufis" value = 20 } }
				has_global_flag = hurufi_china_one
			}
			clr_global_flag = hurufi_china_one
			clr_global_flag = hurufi_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_hurufis" value = 40 } }
				has_global_flag = hurufi_china_two
			}
			clr_global_flag = hurufi_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_hurufis" value = 100 } }
				has_global_flag = hurufi_china_three
			}
			clr_global_flag = hurufi_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_hurufis" value = 120 } }
				has_global_flag = hurufi_china_four
			}
			clr_global_flag = hurufi_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_ibadis" value = 0 } }
				has_global_flag = ibadis_in_china
			}
			clr_global_flag = ibadis_in_china
			clr_global_flag = ibadi_china_one
			clr_global_flag = ibadi_china_two
			set_variable = { which = "global_chinese_ibadis" value = 0 }
			set_global_flag = kcc_ghosttown_ibadis
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_ibadis" value = 20 } }
				has_global_flag = ibadi_china_one
			}
			clr_global_flag = ibadi_china_one
			clr_global_flag = ibadi_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_ibadis" value = 40 } }
				has_global_flag = ibadi_china_two
			}
			clr_global_flag = ibadi_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_ibadis" value = 100 } }
				has_global_flag = ibadi_china_three
			}
			clr_global_flag = ibadi_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_ibadis" value = 120 } }
				has_global_flag = ibadi_china_four
			}
			clr_global_flag = ibadi_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_kharijites" value = 0 } }
				has_global_flag = kharijites_in_china
			}
			clr_global_flag = kharijites_in_china
			clr_global_flag = kharijite_china_one
			clr_global_flag = kharijite_china_two
			set_variable = { which = "global_chinese_kharijites" value = 0 }
			set_global_flag = kcc_ghosttown_kharijites
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_kharijites" value = 20 } }
				has_global_flag = kharijite_china_one
			}
			clr_global_flag = kharijite_china_one
			clr_global_flag = kharijite_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_kharijites" value = 40 } }
				has_global_flag = kharijite_china_two
			}
			clr_global_flag = kharijite_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_kharijites" value = 100 } }
				has_global_flag = kharijite_china_three
			}
			clr_global_flag = kharijite_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_kharijites" value = 120 } }
				has_global_flag = kharijite_china_four
			}
			clr_global_flag = kharijite_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zoroastrians" value = 0 } }
				has_global_flag = zoroastrians_in_china
			}
			clr_global_flag = zoroastrians_in_china
			clr_global_flag = zoroastrian_china_one
			clr_global_flag = zoroastrian_china_two
			set_variable = { which = "global_chinese_zoroastrians" value = 0 }
			set_global_flag = kcc_ghosttown_zoroastrians
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zoroastrians" value = 20 } }
				has_global_flag = zoroastrian_china_one
			}
			clr_global_flag = zoroastrian_china_one
			clr_global_flag = zoroastrian_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zoroastrians" value = 40 } }
				has_global_flag = zoroastrian_china_two
			}
			clr_global_flag = zoroastrian_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zoroastrians" value = 100 } }
				has_global_flag = zoroastrian_china_three
			}
			clr_global_flag = zoroastrian_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zoroastrians" value = 120 } }
				has_global_flag = zoroastrian_china_four
			}
			clr_global_flag = zoroastrian_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_mazdakis" value = 0 } }
				has_global_flag = mazdakis_in_china
			}
			clr_global_flag = mazdakis_in_china
			clr_global_flag = mazdaki_china_one
			clr_global_flag = mazdaki_china_two
			set_variable = { which = "global_chinese_mazdakis" value = 0 }
			set_global_flag = kcc_ghosttown_mazdakis
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_mazdakis" value = 20 } }
				has_global_flag = mazdaki_china_one
			}
			clr_global_flag = mazdaki_china_one
			clr_global_flag = mazdaki_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_mazdakis" value = 40 } }
				has_global_flag = mazdaki_china_two
			}
			clr_global_flag = mazdaki_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_mazdakis" value = 100 } }
				has_global_flag = mazdaki_china_three
			}
			clr_global_flag = mazdaki_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_mazdakis" value = 120 } }
				has_global_flag = mazdaki_china_four
			}
			clr_global_flag = mazdaki_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_manicheans" value = 0 } }
				has_global_flag = manicheans_in_china
			}
			clr_global_flag = manicheans_in_china
			clr_global_flag = manichean_china_one
			clr_global_flag = manichean_china_two
			set_variable = { which = "global_chinese_manicheans" value = 0 }
			set_global_flag = kcc_ghosttown_manicheans
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_manicheans" value = 20 } }
				has_global_flag = manichean_china_one
			}
			clr_global_flag = manichean_china_one
			clr_global_flag = manichean_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_manicheans" value = 40 } }
				has_global_flag = manichean_china_two
			}
			clr_global_flag = manichean_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_manicheans" value = 100 } }
				has_global_flag = manichean_china_three
			}
			clr_global_flag = manichean_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_manicheans" value = 120 } }
				has_global_flag = manichean_china_four
			}
			clr_global_flag = manichean_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_buddhists" value = 0 } }
				has_global_flag = buddhists_in_china
			}
			clr_global_flag = buddhists_in_china
			clr_global_flag = buddhist_china_one
			clr_global_flag = buddhist_china_two
			set_variable = { which = "global_chinese_buddhists" value = 0 }
			set_global_flag = kcc_ghosttown_buddhists
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_buddhists" value = 20 } }
				has_global_flag = buddhist_china_one
			}
			clr_global_flag = buddhist_china_one
			clr_global_flag = buddhist_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_buddhists" value = 40 } }
				has_global_flag = buddhist_china_two
			}
			clr_global_flag = buddhist_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_buddhists" value = 100 } }
				has_global_flag = buddhist_china_three
			}
			clr_global_flag = buddhist_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_buddhists" value = 120 } }
				has_global_flag = buddhist_china_four
			}
			clr_global_flag = buddhist_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_jains" value = 0 } }
				has_global_flag = jains_in_china
			}
			clr_global_flag = jains_in_china
			clr_global_flag = jain_china_one
			clr_global_flag = jain_china_two
			set_variable = { which = "global_chinese_jains" value = 0 }
			set_global_flag = kcc_ghosttown_jains
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_jains" value = 20 } }
				has_global_flag = jain_china_one
			}
			clr_global_flag = jain_china_one
			clr_global_flag = jain_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_jains" value = 40 } }
				has_global_flag = jain_china_two
			}
			clr_global_flag = jain_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_jains" value = 100 } }
				has_global_flag = jain_china_three
			}
			clr_global_flag = jain_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_jains" value = 120 } }
				has_global_flag = jain_china_four
			}
			clr_global_flag = jain_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_norse_pagan_reformeds" value = 0 } }
				has_global_flag = norse_in_china
			}
			clr_global_flag = norse_in_china
			clr_global_flag = norse_china_one
			clr_global_flag = norse_china_two
			set_variable = { which = "global_chinese_norse_pagan_reformeds" value = 0 }
			set_global_flag = kcc_ghosttown_norse
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_norse_pagan_reformeds" value = 20 } }
				has_global_flag = norse_china_one
			}
			clr_global_flag = norse_china_one
			clr_global_flag = norse_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_norse_pagan_reformeds" value = 40 } }
				has_global_flag = norse_china_two
			}
			clr_global_flag = norse_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_norse_pagan_reformeds" value = 100 } }
				has_global_flag = norse_china_three
			}
			clr_global_flag = norse_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_norse_pagan_reformeds" value = 120 } }
				has_global_flag = norse_china_four
			}
			clr_global_flag = norse_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_tengri_pagan_reformeds" value = 0 } }
				has_global_flag = tengri_in_china
			}
			clr_global_flag = tengri_in_china
			clr_global_flag = tengri_china_one
			clr_global_flag = tengri_china_two
			set_variable = { which = "global_chinese_tengri_pagan_reformeds" value = 0 }
			set_global_flag = kcc_ghosttown_tengri
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_tengri_pagan_reformeds" value = 20 } }
				has_global_flag = tengri_china_one
			}
			clr_global_flag = tengri_china_one
			clr_global_flag = tengri_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_tengri_pagan_reformeds" value = 40 } }
				has_global_flag = tengri_china_two
			}
			clr_global_flag = tengri_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_tengri_pagan_reformeds" value = 100 } }
				has_global_flag = tengri_china_three
			}
			clr_global_flag = tengri_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_tengri_pagan_reformeds" value = 120 } }
				has_global_flag = tengri_china_four
			}
			clr_global_flag = tengri_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_baltic_pagan_reformeds" value = 0 } }
				has_global_flag = baltics_in_china
			}
			clr_global_flag = baltics_in_china
			clr_global_flag = baltic_china_one
			clr_global_flag = baltic_china_two
			set_variable = { which = "global_chinese_baltic_pagan_reformeds" value = 0 }
			set_global_flag = kcc_ghosttown_baltic
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_baltic_pagan_reformeds" value = 20 } }
				has_global_flag = baltic_china_one
			}
			clr_global_flag = baltic_china_one
			clr_global_flag = baltic_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_baltic_pagan_reformeds" value = 40 } }
				has_global_flag = baltic_china_two
			}
			clr_global_flag = baltic_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_baltic_pagan_reformeds" value = 100 } }
				has_global_flag = baltic_china_three
			}
			clr_global_flag = baltic_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_baltic_pagan_reformeds" value = 120 } }
				has_global_flag = baltic_china_four
			}
			clr_global_flag = baltic_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_finnish_pagan_reformeds" value = 0 } }
				has_global_flag = finnish_in_china
			}
			clr_global_flag = finnish_in_china
			clr_global_flag = finnish_china_one
			clr_global_flag = finnish_china_two
			set_variable = { which = "global_chinese_finnish_pagan_reformeds" value = 0 }
			set_global_flag = kcc_ghosttown_finnish
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_finnish_pagan_reformeds" value = 20 } }
				has_global_flag = finnish_china_one
			}
			clr_global_flag = finnish_china_one
			clr_global_flag = finnish_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_finnish_pagan_reformeds" value = 40 } }
				has_global_flag = finnish_china_two
			}
			clr_global_flag = finnish_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_finnish_pagan_reformeds" value = 100 } }
				has_global_flag = finnish_china_three
			}
			clr_global_flag = finnish_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_finnish_pagan_reformeds" value = 120 } }
				has_global_flag = finnish_china_four
			}
			clr_global_flag = finnish_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_slavic_pagan_reformeds" value = 0 } }
				has_global_flag = slavs_in_china
			}
			clr_global_flag = slavs_in_china
			clr_global_flag = slavic_china_one
			clr_global_flag = slavic_china_two
			set_variable = { which = "global_chinese_slavic_pagan_reformeds" value = 0 }
			set_global_flag = kcc_ghosttown_slavic
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_slavic_pagan_reformeds" value = 20 } }
				has_global_flag = slavic_china_one
			}
			clr_global_flag = slavic_china_one
			clr_global_flag = slavic_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_slavic_pagan_reformeds" value = 40 } }
				has_global_flag = slavic_china_two
			}
			clr_global_flag = slavic_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_slavic_pagan_reformeds" value = 100 } }
				has_global_flag = slavic_china_three
			}
			clr_global_flag = slavic_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_slavic_pagan_reformeds" value = 120 } }
				has_global_flag = slavic_china_four
			}
			clr_global_flag = slavic_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_aztec_reformeds" value = 0 } }
				has_global_flag = aztecs_in_china
			}
			clr_global_flag = aztecs_in_china
			clr_global_flag = aztec_china_one
			clr_global_flag = aztec_china_two
			set_variable = { which = "global_chinese_aztec_reformeds" value = 0 }
			set_global_flag = kcc_ghosttown_aztecs
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_aztec_reformeds" value = 20 } }
				has_global_flag = aztec_china_one
			}
			clr_global_flag = aztec_china_one
			clr_global_flag = aztec_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_aztec_reformeds" value = 40 } }
				has_global_flag = aztec_china_two
			}
			clr_global_flag = aztec_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_aztec_reformeds" value = 100 } }
				has_global_flag = aztec_china_three
			}
			clr_global_flag = aztec_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_aztec_reformeds" value = 120 } }
				has_global_flag = aztec_china_four
			}
			clr_global_flag = aztec_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_west_african_pagan_reformeds" value = 0 } }
				has_global_flag = africans_in_china
			}
			clr_global_flag = africans_in_china
			clr_global_flag = african_china_one
			clr_global_flag = african_china_two
			set_variable = { which = "global_chinese_west_african_pagan_reformeds" value = 0 }
			set_global_flag = kcc_ghosttown_africans
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_west_african_pagan_reformeds" value = 20 } }
				has_global_flag = african_china_one
			}
			clr_global_flag = african_china_one
			clr_global_flag = african_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_west_african_pagan_reformeds" value = 40 } }
				has_global_flag = african_china_two
			}
			clr_global_flag = african_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_west_african_pagan_reformeds" value = 100 } }
				has_global_flag = african_china_three
			}
			clr_global_flag = african_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_west_african_pagan_reformeds" value = 120 } }
				has_global_flag = african_china_four
			}
			clr_global_flag = african_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zun_pagan_reformeds" value = 0 } }
				has_global_flag = zun_in_china
			}
			clr_global_flag = zun_in_china
			clr_global_flag = zun_china_one
			clr_global_flag = zun_china_two
			set_variable = { which = "global_chinese_zun_pagan_reformeds" value = 0 }
			set_global_flag = kcc_ghosttown_zun
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zun_pagan_reformeds" value = 20 } }
				has_global_flag = zun_china_one
			}
			clr_global_flag = zun_china_one
			clr_global_flag = zun_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zun_pagan_reformeds" value = 40 } }
				has_global_flag = zun_china_two
			}
			clr_global_flag = zun_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zun_pagan_reformeds" value = 100 } }
				has_global_flag = zun_china_three
			}
			clr_global_flag = zun_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zun_pagan_reformeds" value = 120 } }
				has_global_flag = zun_china_four
			}
			clr_global_flag = zun_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_bon_reformeds" value = 0 } }
				has_global_flag = bon_in_china
			}
			clr_global_flag = bon_in_china
			clr_global_flag = bon_china_one
			clr_global_flag = bon_china_two
			set_variable = { which = "global_chinese_bon_reformeds" value = 0 }
			set_global_flag = kcc_ghosttown_bon
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_bon_reformeds" value = 20 } }
				has_global_flag = bon_china_one
			}
			clr_global_flag = bon_china_one
			clr_global_flag = bon_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_bon_reformeds" value = 40 } }
				has_global_flag = bon_china_two
			}
			clr_global_flag = bon_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_bon_reformeds" value = 100 } }
				has_global_flag = bon_china_three
			}
			clr_global_flag = bon_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_bon_reformeds" value = 120 } }
				has_global_flag = bon_china_four
			}
			clr_global_flag = bon_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_hellenic_pagan_reformeds" value = 0 } }
				has_global_flag = hellenics_in_china
			}
			clr_global_flag = hellenics_in_china
			clr_global_flag = hellenic_china_one
			clr_global_flag = hellenic_china_two
			set_variable = { which = "global_chinese_hellenic_pagan_reformeds" value = 0 }
			set_global_flag = kcc_ghosttown_hellenics
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_hellenic_pagan_reformeds" value = 20 } }
				has_global_flag = hellenic_china_one
			}
			clr_global_flag = hellenic_china_one
			clr_global_flag = hellenic_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_hellenic_pagan_reformeds" value = 40 } }
				has_global_flag = hellenic_china_two
			}
			clr_global_flag = hellenic_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_hellenic_pagan_reformeds" value = 100 } }
				has_global_flag = hellenic_china_three
			}
			clr_global_flag = hellenic_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_hellenic_pagan_reformeds" value = 120 } }
				has_global_flag = hellenic_china_four
			}
			clr_global_flag = hellenic_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zalmoxian_reformeds" value = 0 } }
				has_global_flag = prometheans_in_china
			}
			clr_global_flag = prometheans_in_china
			clr_global_flag = promethean_china_one
			clr_global_flag = promethean_china_two
			set_variable = { which = "global_chinese_zalmoxian_reformeds" value = 0 }
			set_global_flag = kcc_ghosttown_prometheans
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zalmoxian_reformeds" value = 20 } }
				has_global_flag = promethean_china_one
			}
			clr_global_flag = promethean_china_one
			clr_global_flag = promethean_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zalmoxian_reformeds" value = 40 } }
				has_global_flag = promethean_china_two
			}
			clr_global_flag = promethean_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zalmoxian_reformeds" value = 100 } }
				has_global_flag = promethean_china_three
			}
			clr_global_flag = promethean_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_zalmoxian_reformeds" value = 120 } }
				has_global_flag = promethean_china_four
			}
			clr_global_flag = promethean_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_druidic_pagan_reformeds" value = 0 } }
				has_global_flag = celts_in_china
			}
			clr_global_flag = celts_in_china
			clr_global_flag = celtic_china_one
			clr_global_flag = celtic_china_two
			set_variable = { which = "global_chinese_druidic_pagan_reformeds" value = 0 }
			set_global_flag = kcc_ghosttown_celtics
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_druidic_pagan_reformeds" value = 20 } }
				has_global_flag = celtic_china_one
			}
			clr_global_flag = celtic_china_one
			clr_global_flag = celtic_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_druidic_pagan_reformeds" value = 40 } }
				has_global_flag = celtic_china_two
			}
			clr_global_flag = celtic_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_druidic_pagan_reformeds" value = 100 } }
				has_global_flag = celtic_china_three
			}
			clr_global_flag = celtic_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_druidic_pagan_reformeds" value = 120 } }
				has_global_flag = celtic_china_four
			}
			clr_global_flag = celtic_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_cybelene_reformeds" value = 0 } }
				has_global_flag = britannics_in_china
			}
			clr_global_flag = britannics_in_china
			clr_global_flag = britannic_china_one
			clr_global_flag = britannic_china_two
			set_variable = { which = "global_chinese_cybelene_reformeds" value = 0 }
			set_global_flag = kcc_ghosttown_britannics
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_cybelene_reformeds" value = 20 } }
				has_global_flag = britannic_china_one
			}
			clr_global_flag = britannic_china_one
			clr_global_flag = britannic_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_cybelene_reformeds" value = 40 } }
				has_global_flag = britannic_china_two
			}
			clr_global_flag = britannic_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_cybelene_reformeds" value = 100 } }
				has_global_flag = britannic_china_three
			}
			clr_global_flag = britannic_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_cybelene_reformeds" value = 120 } }
				has_global_flag = britannic_china_four
			}
			clr_global_flag = britannic_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_kemetisms" value = 0 } }
				has_global_flag = egyptians_in_china
			}
			clr_global_flag = egyptians_in_china
			clr_global_flag = egyptian_china_one
			clr_global_flag = egyptian_china_two
			set_variable = { which = "global_chinese_kemetisms" value = 0 }
			set_global_flag = kcc_ghosttown_egyptians
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_kemetisms" value = 20 } }
				has_global_flag = egyptian_china_one
			}
			clr_global_flag = egyptian_china_one
			clr_global_flag = egyptian_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_kemetisms" value = 40 } }
				has_global_flag = egyptian_china_two
			}
			clr_global_flag = egyptian_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_kemetisms" value = 100 } }
				has_global_flag = egyptian_china_three
			}
			clr_global_flag = egyptian_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_kemetisms" value = 120 } }
				has_global_flag = egyptian_china_four
			}
			clr_global_flag = egyptian_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_megalithic_reformeds" value = 0 } }
				has_global_flag = atenics_in_china
			}
			clr_global_flag = atenics_in_china
			clr_global_flag = atenic_china_one
			clr_global_flag = atenic_china_two
			set_variable = { which = "global_chinese_megalithic_reformeds" value = 0 }
			set_global_flag = kcc_ghosttown_atenics
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_megalithic_reformeds" value = 20 } }
				has_global_flag = atenic_china_one
			}
			clr_global_flag = atenic_china_one
			clr_global_flag = atenic_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_megalithic_reformeds" value = 40 } }
				has_global_flag = atenic_china_two
			}
			clr_global_flag = atenic_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_megalithic_reformeds" value = 100 } }
				has_global_flag = atenic_china_three
			}
			clr_global_flag = atenic_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_megalithic_reformeds" value = 120 } }
				has_global_flag = atenic_china_four
			}
			clr_global_flag = atenic_china_four
		}
		#Christian Immersion
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_adoptionists" value = 0 } }
				has_global_flag = adoptionists_in_china
			}
			clr_global_flag = adoptionists_in_china
			clr_global_flag = adoptionist_china_one
			clr_global_flag = adoptionist_china_two
			set_variable = { which = "global_chinese_adoptionists" value = 0 }
			set_global_flag = kcc_ghosttown_adoptionists
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_adoptionists" value = 20 } }
				has_global_flag = adoptionist_china_one
			}
			clr_global_flag = adoptionist_china_one
			clr_global_flag = adoptionist_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_adoptionists" value = 40 } }
				has_global_flag = adoptionist_china_two
			}
			clr_global_flag = adoptionist_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_adoptionists" value = 100 } }
				has_global_flag = adoptionist_china_three
			}
			clr_global_flag = adoptionist_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_adoptionists" value = 120 } }
				has_global_flag = adoptionist_china_four
			}
			clr_global_flag = adoptionist_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_free_spirits" value = 0 } }
				has_global_flag = free_spirits_in_china
			}
			clr_global_flag = free_spirits_in_china
			clr_global_flag = free_spirits_china_one
			clr_global_flag = free_spirits_china_two
			set_variable = { which = "global_chinese_free_spirits" value = 0 }
			set_global_flag = kcc_ghosttown_free_spirits
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_free_spirits" value = 20 } }
				has_global_flag = free_spirits_china_one
			}
			clr_global_flag = free_spirits_china_one
			clr_global_flag = free_spirits_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_free_spirits" value = 40 } }
				has_global_flag = free_spirits_china_two
			}
			clr_global_flag = free_spirits_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_free_spirits" value = 100 } }
				has_global_flag = free_spirits_china_three
			}
			clr_global_flag = free_spirits_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_free_spirits" value = 120 } }
				has_global_flag = free_spirits_china_four
			}
			clr_global_flag = free_spirits_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_barlaamites" value = 0 } }
				has_global_flag = barlaamites_in_china
			}
			clr_global_flag = barlaamites_in_china
			clr_global_flag = barlaamite_china_one
			clr_global_flag = barlaamite_china_two
			set_variable = { which = "global_chinese_barlaamites" value = 0 }
			set_global_flag = kcc_ghosttown_barlaamites
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_barlaamites" value = 20 } }
				has_global_flag = barlaamite_china_one
			}
			clr_global_flag = barlaamite_china_one
			clr_global_flag = barlaamite_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_barlaamites" value = 40 } }
				has_global_flag = barlaamite_china_two
			}
			clr_global_flag = barlaamite_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_barlaamites" value = 100 } }
				has_global_flag = barlaamite_china_three
			}
			clr_global_flag = barlaamite_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_barlaamites" value = 120 } }
				has_global_flag = barlaamite_china_four
			}
			clr_global_flag = barlaamite_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_judaizers" value = 0 } }
				has_global_flag = judaizers_in_china
			}
			clr_global_flag = judaizers_in_china
			clr_global_flag = judaizer_china_one
			clr_global_flag = judaizer_china_two
			set_variable = { which = "global_chinese_judaizers" value = 0 }
			set_global_flag = kcc_ghosttown_judaizers
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_judaizers" value = 20 } }
				has_global_flag = judaizer_china_one
			}
			clr_global_flag = judaizer_china_one
			clr_global_flag = judaizer_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_judaizers" value = 40 } }
				has_global_flag = judaizer_china_two
			}
			clr_global_flag = judaizer_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_judaizers" value = 100 } }
				has_global_flag = judaizer_china_three
			}
			clr_global_flag = judaizer_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_judaizers" value = 120 } }
				has_global_flag = judaizer_china_four
			}
			clr_global_flag = judaizer_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_mandeans" value = 0 } }
				has_global_flag = mandeans_in_china
			}
			clr_global_flag = mandeans_in_china
			clr_global_flag = mandean_china_one
			clr_global_flag = mandean_china_two
			set_variable = { which = "global_chinese_mandeans" value = 0 }
			set_global_flag = kcc_ghosttown_mandeans
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_mandeans" value = 20 } }
				has_global_flag = mandean_china_one
			}
			clr_global_flag = mandean_china_one
			clr_global_flag = mandean_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_mandeans" value = 40 } }
				has_global_flag = mandean_china_two
			}
			clr_global_flag = mandean_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_mandeans" value = 100 } }
				has_global_flag = mandean_china_three
			}
			clr_global_flag = mandean_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_mandeans" value = 120 } }
				has_global_flag = mandean_china_four
			}
			clr_global_flag = mandean_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_chaldeans" value = 0 } }
				has_global_flag = chaldeans_in_china
			}
			clr_global_flag = chaldeans_in_china
			clr_global_flag = chaldean_china_one
			clr_global_flag = chaldean_china_two
			set_variable = { which = "global_chinese_chaldeans" value = 0 }
			set_global_flag = kcc_ghosttown_chaldeans
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_chaldeans" value = 20 } }
				has_global_flag = chaldean_china_one
			}
			clr_global_flag = chaldean_china_one
			clr_global_flag = chaldean_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_chaldeans" value = 40 } }
				has_global_flag = chaldean_china_two
			}
			clr_global_flag = chaldean_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_chaldeans" value = 100 } }
				has_global_flag = chaldean_china_three
			}
			clr_global_flag = chaldean_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_chaldeans" value = 120 } }
				has_global_flag = chaldean_china_four
			}
			clr_global_flag = chaldean_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_apollinarians" value = 0 } }
				has_global_flag = apollinarians_in_china
			}
			clr_global_flag = apollinarians_in_china
			clr_global_flag = apollinarian_china_one
			clr_global_flag = apollinarian_china_two
			set_variable = { which = "global_chinese_apollinarians" value = 0 }
			set_global_flag = kcc_ghosttown_apollinarians
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_apollinarians" value = 20 } }
				has_global_flag = apollinarian_china_one
			}
			clr_global_flag = apollinarian_china_one
			clr_global_flag = apollinarian_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_apollinarians" value = 40 } }
				has_global_flag = apollinarian_china_two
			}
			clr_global_flag = apollinarian_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_apollinarians" value = 100 } }
				has_global_flag = apollinarian_china_three
			}
			clr_global_flag = apollinarian_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_apollinarians" value = 120 } }
				has_global_flag = apollinarian_china_four
			}
			clr_global_flag = apollinarian_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_yarsans" value = 0 } }
				has_global_flag = yarsans_in_china
			}
			clr_global_flag = yarsans_in_china
			clr_global_flag = yarsan_china_one
			clr_global_flag = yarsan_china_two
			set_variable = { which = "global_chinese_yarsans" value = 0 }
			set_global_flag = kcc_ghosttown_yarsans
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_yarsans" value = 20 } }
				has_global_flag = yarsan_china_one
			}
			clr_global_flag = yarsan_china_one
			clr_global_flag = yarsan_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_yarsans" value = 40 } }
				has_global_flag = yarsan_china_two
			}
			clr_global_flag = yarsan_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_yarsans" value = 100 } }
				has_global_flag = yarsan_china_three
			}
			clr_global_flag = yarsan_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_yarsans" value = 120 } }
				has_global_flag = yarsan_china_four
			}
			clr_global_flag = yarsan_china_four
		}
		#Last Vanilla Religions
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_yazidis" value = 0 } }
				has_global_flag = yazidis_in_china
			}
			clr_global_flag = yazidis_in_china
			clr_global_flag = yazidi_china_one
			clr_global_flag = yazidi_china_two
			set_variable = { which = "global_chinese_yazidis" value = 0 }
			set_global_flag = kcc_ghosttown_yazidis
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_yazidis" value = 20 } }
				has_global_flag = yazidi_china_one
			}
			clr_global_flag = yazidi_china_one
			clr_global_flag = yazidi_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_yazidis" value = 40 } }
				has_global_flag = yazidi_china_two
			}
			clr_global_flag = yazidi_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_yazidis" value = 100 } }
				has_global_flag = yazidi_china_three
			}
			clr_global_flag = yazidi_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_yazidis" value = 120 } }
				has_global_flag = yazidi_china_four
			}
			clr_global_flag = yazidi_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_druzes" value = 0 } }
				has_global_flag = druze_in_china
			}
			clr_global_flag = druze_in_china
			clr_global_flag = druze_china_one
			clr_global_flag = druze_china_two
			set_variable = { which = "global_chinese_druzes" value = 0 }
			set_global_flag = kcc_ghosttown_druze
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_druzes" value = 20 } }
				has_global_flag = druze_china_one
			}
			clr_global_flag = druze_china_one
			clr_global_flag = druze_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_druzes" value = 40 } }
				has_global_flag = druze_china_two
			}
			clr_global_flag = druze_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_druzes" value = 100 } }
				has_global_flag = druze_china_three
			}
			clr_global_flag = druze_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_druzes" value = 120 } }
				has_global_flag = druze_china_four
			}
			clr_global_flag = druze_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_khurmaztas" value = 0 } }
				has_global_flag = khurmaztas_in_china
			}
			clr_global_flag = khurmaztas_in_china
			clr_global_flag = khurmazta_china_one
			clr_global_flag = khurmazta_china_two
			set_variable = { which = "global_chinese_khurmaztas" value = 0 }
			set_global_flag = kcc_ghosttown_khurmaztas
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_khurmaztas" value = 20 } }
				has_global_flag = khurmazta_china_one
			}
			clr_global_flag = khurmazta_china_one
			clr_global_flag = khurmazta_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_khurmaztas" value = 40 } }
				has_global_flag = khurmazta_china_two
			}
			clr_global_flag = khurmazta_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_khurmaztas" value = 100 } }
				has_global_flag = khurmazta_china_three
			}
			clr_global_flag = khurmazta_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_khurmaztas" value = 120 } }
				has_global_flag = khurmazta_china_four
			}
			clr_global_flag = khurmazta_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_jewishs" value = 0 } }
				has_global_flag = jews_in_china
			}
			clr_global_flag = jews_in_china
			clr_global_flag = jewish_china_one
			clr_global_flag = jewish_china_two
			set_variable = { which = "global_chinese_jewishs" value = 0 }
			set_global_flag = kcc_ghosttown_jews
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_jewishs" value = 20 } }
				has_global_flag = jewish_china_one
			}
			clr_global_flag = jewish_china_one
			clr_global_flag = jewish_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_jewishs" value = 40 } }
				has_global_flag = jewish_china_two
			}
			clr_global_flag = jewish_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_jewishs" value = 100 } }
				has_global_flag = jewish_china_three
			}
			clr_global_flag = jewish_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_jewishs" value = 120 } }
				has_global_flag = jewish_china_four
			}
			clr_global_flag = jewish_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_samaritans" value = 0 } }
				has_global_flag = samaritans_in_china
			}
			clr_global_flag = samaritans_in_china
			clr_global_flag = samaritan_china_one
			clr_global_flag = samaritan_china_two
			set_variable = { which = "global_chinese_samaritans" value = 0 }
			set_global_flag = kcc_ghosttown_samaritans
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_samaritans" value = 20 } }
				has_global_flag = samaritan_china_one
			}
			clr_global_flag = samaritan_china_one
			clr_global_flag = samaritan_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_samaritans" value = 40 } }
				has_global_flag = samaritan_china_two
			}
			clr_global_flag = samaritan_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_samaritans" value = 100 } }
				has_global_flag = samaritan_china_three
			}
			clr_global_flag = samaritan_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_samaritans" value = 120 } }
				has_global_flag = samaritan_china_four
			}
			clr_global_flag = samaritan_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_karaites" value = 0 } }
				has_global_flag = karaites_in_china
			}
			clr_global_flag = karaites_in_china
			clr_global_flag = karaite_china_one
			clr_global_flag = karaite_china_two
			set_variable = { which = "global_chinese_karaites" value = 0 }
			set_global_flag = kcc_ghosttown_karaites
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_karaites" value = 20 } }
				has_global_flag = karaite_china_one
			}
			clr_global_flag = karaite_china_one
			clr_global_flag = karaite_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_karaites" value = 40 } }
				has_global_flag = karaite_china_two
			}
			clr_global_flag = karaite_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_karaites" value = 100 } }
				has_global_flag = karaite_china_three
			}
			clr_global_flag = karaite_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_karaites" value = 120 } }
				has_global_flag = karaite_china_four
			}
			clr_global_flag = karaite_china_four
		}
		if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_hindus" value = 0 } }
				has_global_flag = hindus_in_china
			}
			clr_global_flag = hindus_in_china
			clr_global_flag = hindu_china_one
			clr_global_flag = hindu_china_two
			set_variable = { which = "global_chinese_hindus" value = 0 }
			set_global_flag = kcc_ghosttown_hindus
			any_playable_ruler = { narrative_event = { id = kccpnews.0003 days = 1 } }
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_hindus" value = 20 } }
				has_global_flag = hindu_china_one
			}
			clr_global_flag = hindu_china_one
			clr_global_flag = hindu_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_hindus" value = 40 } }
				has_global_flag = hindu_china_two
			}
			clr_global_flag = hindu_china_two
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_hindus" value = 100 } }
				has_global_flag = hindu_china_three
			}
			clr_global_flag = hindu_china_three
		}
		else_if = {
			limit = {
				NOT = { check_variable = { which = "global_chinese_hindus" value = 120 } }
				has_global_flag = hindu_china_four
			}
			clr_global_flag = hindu_china_four
		}
	}
}

# Persecution Cleanup on Conquest
province_event = {
	id = kccpersecute.0043
	hide_window = yes
	
	is_triggered_only = yes
	
	has_dlc = "Jade Dragon"
	
	trigger = {
		province_id = 1513
		kcc_china_has_persecuted_trigger = yes
	}
	
	immediate = {
		if = {
			limit = {
				OR = {
					FROM = { religion = catholic }
					offmap_china = { offmap_ruler = { religion = catholic } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_latins
				}
				remove_province_modifier = kcc_china_persecuted_latins
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_catholics
				}
				remove_province_modifier = kcc_china_persecuted_catholics
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = cathar }
					offmap_china = { offmap_ruler = { religion = cathar } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_latins
				}
				remove_province_modifier = kcc_china_persecuted_latins
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_cathars
				}
				remove_province_modifier = kcc_china_persecuted_cathars
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = fraticelli }
					offmap_china = { offmap_ruler = { religion = fraticelli } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_latins
				}
				remove_province_modifier = kcc_china_persecuted_latins
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_fraticellis
				}
				remove_province_modifier = kcc_china_persecuted_fraticellis
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = waldensian }
					offmap_china = { offmap_ruler = { religion = waldensian } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_latins
				}
				remove_province_modifier = kcc_china_persecuted_latins
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_waldensians
				}
				remove_province_modifier = kcc_china_persecuted_waldensians
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = lollard }
					offmap_china = { offmap_ruler = { religion = lollard } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_latins
				}
				remove_province_modifier = kcc_china_persecuted_latins
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_lollards
				}
				remove_province_modifier = kcc_china_persecuted_lollards
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = adoptionist }
					offmap_china = { offmap_ruler = { religion = adoptionist } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_latins
				}
				remove_province_modifier = kcc_china_persecuted_latins
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_adoptionists
				}
				remove_province_modifier = kcc_china_persecuted_adoptionists
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = free_spirits }
					offmap_china = { offmap_ruler = { religion = free_spirits } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_latins
				}
				remove_province_modifier = kcc_china_persecuted_latins
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_free_spirits
				}
				remove_province_modifier = kcc_china_persecuted_free_spirits
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = orthodox }
					offmap_china = { offmap_ruler = { religion = orthodox } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_byzantines
				}
				remove_province_modifier = kcc_china_persecuted_byzantines
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_orthodoxy
				}
				remove_province_modifier = kcc_china_persecuted_orthodoxy
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = bogomilist }
					offmap_china = { offmap_ruler = { religion = bogomilist } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_byzantines
				}
				remove_province_modifier = kcc_china_persecuted_byzantines
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_bogomilists
				}
				remove_province_modifier = kcc_china_persecuted_bogomilists
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = monothelite }
					offmap_china = { offmap_ruler = { religion = monothelite } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_byzantines
				}
				remove_province_modifier = kcc_china_persecuted_byzantines
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_monothelites
				}
				remove_province_modifier = kcc_china_persecuted_monothelites
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = iconoclast }
					offmap_china = { offmap_ruler = { religion = iconoclast } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_byzantines
				}
				remove_province_modifier = kcc_china_persecuted_byzantines
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_iconoclasts
				}
				remove_province_modifier = kcc_china_persecuted_iconoclasts
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = paulician }
					offmap_china = { offmap_ruler = { religion = paulician } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_byzantines
				}
				remove_province_modifier = kcc_china_persecuted_byzantines
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_paulicians
				}
				remove_province_modifier = kcc_china_persecuted_paulicians
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = barlaamite }
					offmap_china = { offmap_ruler = { religion = barlaamite } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_byzantines
				}
				remove_province_modifier = kcc_china_persecuted_byzantines
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_barlaamites
				}
				remove_province_modifier = kcc_china_persecuted_barlaamites
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = miaphysite }
					offmap_china = { offmap_ruler = { religion = miaphysite } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_nonchalcedonians
				}
				remove_province_modifier = kcc_china_persecuted_nonchalcedonians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_miaphysites
				}
				remove_province_modifier = kcc_china_persecuted_miaphysites
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = monophysite }
					offmap_china = { offmap_ruler = { religion = monophysite } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_nonchalcedonians
				}
				remove_province_modifier = kcc_china_persecuted_nonchalcedonians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_monophysites
				}
				remove_province_modifier = kcc_china_persecuted_monophysites
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = judaizer }
					offmap_china = { offmap_ruler = { religion = judaizer } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_nonchalcedonians
				}
				remove_province_modifier = kcc_china_persecuted_nonchalcedonians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_judaizers
				}
				remove_province_modifier = kcc_china_persecuted_judaizers
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = mandean }
					offmap_china = { offmap_ruler = { religion = mandean } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_nonchalcedonians
				}
				remove_province_modifier = kcc_china_persecuted_nonchalcedonians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_mandeans
				}
				remove_province_modifier = kcc_china_persecuted_mandeans
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = nestorian }
					offmap_china = { offmap_ruler = { religion = nestorian } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_nonchalcedonians
				}
				remove_province_modifier = kcc_china_persecuted_nonchalcedonians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_nestorians
				}
				remove_province_modifier = kcc_china_persecuted_nestorians
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = messalian }
					offmap_china = { offmap_ruler = { religion = messalian } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_nonchalcedonians
				}
				remove_province_modifier = kcc_china_persecuted_nonchalcedonians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_messalians
				}
				remove_province_modifier = kcc_china_persecuted_messalians
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = chaldean }
					offmap_china = { offmap_ruler = { religion = chaldean } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_nonchalcedonians
				}
				remove_province_modifier = kcc_china_persecuted_nonchalcedonians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_chaldeans
				}
				remove_province_modifier = kcc_china_persecuted_chaldeans
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = apollinarian }
					offmap_china = { offmap_ruler = { religion = apollinarian } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_christians
				}
				remove_province_modifier = kcc_china_persecuted_christians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_nonchalcedonians
				}
				remove_province_modifier = kcc_china_persecuted_nonchalcedonians
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_apollinarians
				}
				remove_province_modifier = kcc_china_persecuted_apollinarians
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = sunni }
					offmap_china = { offmap_ruler = { religion = sunni } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_muslims
				}
				remove_province_modifier = kcc_china_persecuted_muslims
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_sunnis
				}
				remove_province_modifier = kcc_china_persecuted_sunnis
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = zikri }
					offmap_china = { offmap_ruler = { religion = zikri } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_muslims
				}
				remove_province_modifier = kcc_china_persecuted_muslims
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_sunnis
				}
				remove_province_modifier = kcc_china_persecuted_sunnis
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = yarsan }
					offmap_china = { offmap_ruler = { religion = yarsan } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_muslims
				}
				remove_province_modifier = kcc_china_persecuted_muslims
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_sunnis
				}
				remove_province_modifier = kcc_china_persecuted_sunnis
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = shiite }
					offmap_china = { offmap_ruler = { religion = shiite } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_muslims
				}
				remove_province_modifier = kcc_china_persecuted_muslims
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_shiites
				}
				remove_province_modifier = kcc_china_persecuted_shiites
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = qarmatian }
					offmap_china = { offmap_ruler = { religion = qarmatian } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_muslims
				}
				remove_province_modifier = kcc_china_persecuted_muslims
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_shiites
				}
				remove_province_modifier = kcc_china_persecuted_shiites
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = hurufi }
					offmap_china = { offmap_ruler = { religion = hurufi } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_muslims
				}
				remove_province_modifier = kcc_china_persecuted_muslims
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_shiites
				}
				remove_province_modifier = kcc_china_persecuted_shiites
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = ibadi }
					offmap_china = { offmap_ruler = { religion = ibadi } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_muslims
				}
				remove_province_modifier = kcc_china_persecuted_muslims
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_ibadis
				}
				remove_province_modifier = kcc_china_persecuted_ibadis
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = kharijite }
					offmap_china = { offmap_ruler = { religion = kharijite } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_muslims
				}
				remove_province_modifier = kcc_china_persecuted_muslims
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_ibadis
				}
				remove_province_modifier = kcc_china_persecuted_ibadis
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = zoroastrian }
					offmap_china = { offmap_ruler = { religion = zoroastrian } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_mazdans
				}
				remove_province_modifier = kcc_china_persecuted_mazdans
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_zoroastrians
				}
				remove_province_modifier = kcc_china_persecuted_zoroastrians
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = mazdaki }
					offmap_china = { offmap_ruler = { religion = mazdaki } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_mazdans
				}
				remove_province_modifier = kcc_china_persecuted_mazdans
			}
			if = {
				limit = {
					has_province_modifier = kcc_zoro_china_persecuted_mazdans
				}
				remove_province_modifier = kcc_zoro_china_persecuted_mazdans
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_mazdakis
				}
				remove_province_modifier = kcc_china_persecuted_mazdakis
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = manichean }
					offmap_china = { offmap_ruler = { religion = manichean } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_mazdans
				}
				remove_province_modifier = kcc_china_persecuted_mazdans
			}
			if = {
				limit = {
					has_province_modifier = kcc_zoro_china_persecuted_mazdans
				}
				remove_province_modifier = kcc_zoro_china_persecuted_mazdans
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_manicheans
				}
				remove_province_modifier = kcc_china_persecuted_manicheans
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = buddhist }
					offmap_china = { offmap_ruler = { religion = buddhist } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_dharmans
				}
				remove_province_modifier = kcc_china_persecuted_dharmans
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion = jain }
					offmap_china = { offmap_ruler = { religion = jain } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_dharmans
				}
				remove_province_modifier = kcc_china_persecuted_dharmans
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion_group = pagan_group }
					offmap_china = { offmap_ruler = { religion_group = pagan_group } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_pagans
				}
				remove_province_modifier = kcc_china_persecuted_pagans
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_northern_pagans
				}
				remove_province_modifier = kcc_china_persecuted_northern_pagans
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_eastern_pagans
				}
				remove_province_modifier = kcc_china_persecuted_eastern_pagans
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_classical_pagans
				}
				remove_province_modifier = kcc_china_persecuted_classical_pagans
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_africans
				}
				remove_province_modifier = kcc_china_persecuted_africans
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_aztecs
				}
				remove_province_modifier = kcc_china_persecuted_aztecs
			}
		}
		#Last Vanilla Religions
		if = {
			limit = {
				has_game_rule = {
					name = kcc_who_can_preach
					value = kcc_preach_yes
				}
				NOT = { has_global_flag = EMF }
				OR = {
					FROM = { religion = yazidi }
					offmap_china = { offmap_ruler = { religion = yazidi } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_muslims
				}
				remove_province_modifier = kcc_china_persecuted_muslims
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_sunnis
				}
				remove_province_modifier = kcc_china_persecuted_sunnis
			}
		}
		if = {
			limit = {
				has_game_rule = {
					name = kcc_who_can_preach
					value = kcc_preach_yes
				}
				has_global_flag = EMF
				OR = {
					FROM = { religion = yazidi }
					offmap_china = { offmap_ruler = { religion = yazidi } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_mazdans
				}
				remove_province_modifier = kcc_china_persecuted_mazdans
			}
			if = {
				limit = {
					has_province_modifier = kcc_zoro_china_persecuted_mazdans
				}
				remove_province_modifier = kcc_zoro_china_persecuted_mazdans
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_yazidis
				}
				remove_province_modifier = kcc_china_persecuted_yazidis
			}
		}
		if = {
			limit = {
				has_game_rule = {
					name = kcc_who_can_preach
					value = kcc_preach_yes
				}
				OR = {
					FROM = { religion = druze }
					offmap_china = { offmap_ruler = { religion = druze } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_muslims
				}
				remove_province_modifier = kcc_china_persecuted_muslims
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_shiites
				}
				remove_province_modifier = kcc_china_persecuted_shiites
			}
		}
		if = {
			limit = {
				has_game_rule = {
					name = kcc_who_can_preach
					value = kcc_preach_yes
				}
				OR = {
					FROM = { religion = khurmazta }
					offmap_china = { offmap_ruler = { religion = khurmazta } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_mazdans
				}
				remove_province_modifier = kcc_china_persecuted_mazdans
			}
			if = {
				limit = {
					has_province_modifier = kcc_zoro_china_persecuted_mazdans
				}
				remove_province_modifier = kcc_zoro_china_persecuted_mazdans
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_khurmaztas
				}
				remove_province_modifier = kcc_china_persecuted_khurmaztas
			}
		}
		if = {
			limit = {
				OR = {
					FROM = { religion_group = jewish_group }
					offmap_china = { offmap_ruler = { religion_group = jewish_group } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_jews
				}
				remove_province_modifier = kcc_china_persecuted_jews
			}
		}
		if = {
			limit = {
				has_game_rule = {
					name = kcc_who_can_preach
					value = kcc_preach_yes
				}
				OR = {
					FROM = { religion = hindu }
					offmap_china = { offmap_ruler = { religion = hindu } }
				}
			}
			if = {
				limit = {
					has_province_modifier = kcc_china_persecuted_dharmans
				}
				remove_province_modifier = kcc_china_persecuted_dharmans
			}
		}
	}
}