#Taiping Rebellion
country_event = {
	id = 160001
	title = "EVTNAME160001"
	desc = "EVTDESC160001"
	picture = rebellion
	major = yes
	
	fire_only_once = yes

	major = yes	
	trigger = {
		tag = CHI
		year = 1847
		NOT = { has_global_flag = taiping_has_happened2 }
		OR = { average_consciousness = 3
		year = 1850 }
	}
	
	mean_time_to_happen = {
		months = 12
		modifier = {
			factor = 10
			year = 1845
			NOT = { year = 1850 }
		}
		modifier = {
			factor = 0.5
			year = 1855
			NOT = { year = 1860 }
		}
		modifier = {
			factor = 0.1
			year = 1860
		}
	}
	
	option = {
		name = "EVTOPTA160001"
		any_owned = {
			limit = {
				is_core = TPG
				not = { province_id = 1616 }
			}
			secede_province = TPG
		}
		TPG = { add_country_modifier = { name = religious_oppression duration = -1 } }
		1548 = { secede_province = TPG }
		1547 = { secede_province = TPG }
		1550 = { secede_province = TPG }
		1483 = { secede_province = TPG }
		1482 = { secede_province = TPG }
		1604 = { secede_province = TPG }
		TPG = {
			capital = 2221
			any_pop = {
				consciousness = -5
				militancy = -5
			}
		}
		soldiers = {
			militancy = 8
		}
		any_pop = {
			limit = {
				OR = {
					has_pop_religion = sunni
					has_pop_culture = nanfaren
					has_pop_culture = zhuang
					has_pop_culture = yue
				}
			}
			militancy = 5
		}
		war = {
			target = TPG
			attacker_goal = {
				casus_belli = civil_war
			}
			
			defender_goal = {
				casus_belli = civil_war
			}
		}
		set_global_flag = taiping_has_happened2
	}
	
	option = {
		name = "EVTOPTB160001"
		any_owned = {
			limit = {
				is_core = TPG
				not = { province_id = 1616 }
			}
			secede_province = TPG
		}
		1548 = { secede_province = TPG }
		1547 = { secede_province = TPG }
		1550 = { secede_province = TPG }
		1483 = { secede_province = TPG }
		1482 = { secede_province = TPG }
		1604 = { secede_province = TPG }
		TPG = { add_country_modifier = { name = religious_oppression duration = -1 } }
		TPG = {
			capital = 2221
			any_pop = {
				consciousness = -5
				militancy = -5
			}
		}
		soldiers = {
			militancy = 8
		}
		any_pop = {
			limit = {
				OR = {
					has_pop_religion = sunni
					has_pop_culture = nanfaren
					has_pop_culture = zhuang
					has_pop_culture = yue
				}
			}
			militancy = 5
		}		
		war = {
			target = TPG
			attacker_goal = {
				casus_belli = civil_war
			}
			
			defender_goal = {
				casus_belli = civil_war
			}
		}
		set_global_flag = taiping_has_happened2
		change_tag_no_core_switch = TPG
	}
}

#Taiwanese rebellion
country_event = {
	id = 160002
	title = "Taiwanese rebellion"
	desc = "With a loose control over sotuhern China, The Taiwanese Min are now seeking to secede from our Empire."
	picture = rebellion
	news = yes
	news_desc_long = "EVTDESC160001_NEWS_LONG"
	news_desc_medium = "EVTDESC160001_NEWS_MEDIUM"
	news_desc_short = "EVTDESC160001_NEWS_SHORT"
	
	fire_only_once = yes
	
	trigger = {
		tag = CHI
		has_global_flag = taiping_has_happened2
		owns = 1485
	}
	mean_time_to_happen = { days = 15 }
	
	option = {
		name = "EVTOPTA160001"
		any_owned = {
			limit = {
				is_core = TAI
				not = { province_id = 1616 }
			}
			secede_province = TAI
		}
		TAI = {
			capital = 1485
			any_pop = {
				consciousness = -5
				militancy = -5
			}
		}
		soldiers = {
			militancy = 8
		}
		any_pop = {
			limit = {
				OR = {
					has_pop_religion = sunni
					has_pop_culture = nanfaren
					has_pop_culture = zhuang
					has_pop_culture = yue
				}
			}
			militancy = 5
		}
		war = {
			target = TAI
			attacker_goal = {
				casus_belli = civil_war
			}
			
			defender_goal = {
				casus_belli = status_quo
			}
		}
	}
	
	option = {
		name = "Fight alongside the rebels"
		any_owned = {
			limit = {
				is_core = TAI
				not = { province_id = 1616 }
			}
			secede_province = TAI
		}
		TAI = {
			capital = 1485
			any_pop = {
				consciousness = -5
				militancy = -5
			}
		}
		any_pop = {
			limit = {
				OR = {
					has_pop_religion = sunni
					has_pop_culture = nanfaren
					has_pop_culture = zhuang
					has_pop_culture = yue
				}
			}
			militancy = 5
		}	
		war = {
			target = TAI
			attacker_goal = {
				casus_belli = civil_war
			}
			
			defender_goal = {
				casus_belli = status_quo
			}
		}
		change_tag_no_core_switch = TAI
	}
}

#Dungan rebellion
country_event = {
	id = 1600031
	title = "Dungan revolt"
	desc = "The Empire is collapsing, and the Uighur now have taken up arms to fight against our rule."
	picture = rebellion
	
	fire_only_once = yes
	
	trigger = {
		tag = CHI
		has_global_flag = taiping_has_happened2
		XIN = { vassal_of = THIS } } 
	
	
	mean_time_to_happen = { days = 15 }
	
	option = {
		name = "EVTOPTA160001"
		set_country_flag = dungan
		release_vassal = XIN
		XIN = { government =  democracy  }
		XIN = {
			any_pop = {
				consciousness = -5
				militancy = -5
			}
		}
		soldiers = {
			militancy = 8
		}
		any_pop = {
			limit = {
				OR = {
					has_pop_religion = sunni
					has_pop_culture = nanfaren
					has_pop_culture = zhuang
					has_pop_culture = yue
				}
			}
			militancy = 5
		}
		war = {
			target = XIN
			attacker_goal = {
				casus_belli = civil_war
			}
			
			defender_goal = {
				casus_belli = status_quo
			}
		}
	}
	
	option = {
		name = "EVTOPTA160001"
		set_country_flag = dungan
		release_vassal = XIN
		XIN = { government =  democracy }
		XIN = {
			any_pop = {
				consciousness = -5
				militancy = -5
			}
		}
		soldiers = {
			militancy = 8
		}
		any_pop = {
			limit = {
				OR = {
					has_pop_religion = sunni
					has_pop_culture = nanfaren
					has_pop_culture = zhuang
					has_pop_culture = yue
				}
			}
			militancy = 5
		}
		war = {
			target = XIN
			attacker_goal = {
				casus_belli = civil_war
			}
			
			defender_goal = {
				casus_belli = status_quo
			}
		}
		change_tag_no_core_switch = XIN
	}
}

#Guansu genocide
country_event = {
	id = 1610020
	title = "Han genocide"
	desc = "The Hui people in the northwest of China have caused a lot of damage and massacred a lot of Han people."
	picture = rebellion
	
	fire_only_once = yes
	
	trigger = {
		tag = CHI
		NOT = { has_global_flag = taiping_has_happened2 }
		year = 1849
		owns = 1488
	}
	mean_time_to_happen = { days = 15 }
	
	option = {
		name = "Destroy the ones who want to topple our Empire."
	  1488 = {
	  any_pop = {
	  reduce_pop = 0.60
	  }
	  }
	  1490 = {
	  any_pop = {
	  reduce_pop = 0.60
	  }
	  }
	  1491 = {
	  any_pop = {
	  reduce_pop = 0.60
	  }
	  }
	  1492 = {
	  any_pop = {
	  reduce_pop = 0.60
	  }
	  }
	  1489 = {
	  any_pop = {
	  reduce_pop = 0.60
	  }
	  }
      any_owned = {
                limit = { controlled_by = THIS }
                any_pop = {
                    limit = {
                        OR = {
                            has_pop_culture = beifaren
                            has_pop_culture = nanfaren
                        }
                    }
					consciousness = 5
                    militancy = 2
                }
            }
	}
}
country_event = {

	id = 16030200
	title = "The rebellion remains!"
	desc = "With the successful rebellion, the Qing Dynasty is no more."
	major = yes
	
	is_triggered_only = yes
		
	
	option = {
		name = "Now let's turn China into a republic."
		NLU = { government = democracy
		political_reform = wealth_voting
		political_reform = state_equal_weight
		political_reform = yes_meeting
		political_reform = party_appointed }
		ai_chance = {
			factor = 0 }
	}
}
country_event = {

	id = 16030201
	title = "Democratic China"
	desc = "With the successful rebellion, the Qing Dynasty is no more."
	
	trigger = { owns = 1612 
	tag = NLU }
		
    fire_only_once = yes
	
	option = {
		name = "Now let's turn China into a republic."
		change_tag = CHI
	}
}
#Anti-Manchu feeling
province_event = {
	id = 160502
	title = "EVTNAME160502"
	desc = "EVTDESC160502"
	picture = rebellion
	
	trigger = {
		owner = { tag = CHI }
		not = { average_consciousness = 3 }
		NOT = { has_global_flag = taiping_has_happened }
		year = 1840
	}
	
	mean_time_to_happen = {
		months = 360
		
		modifier = {
			factor = 0.7
			has_province_modifier = local_opium_habit
		}
		modifier = {
			factor = 0.7
			has_province_modifier = western_presence		
		}
		modifier = {
			factor = 0.7
			has_province_modifier = foreign_smugglers
		}
		modifier = {
			factor = 0.7
			has_province_modifier = foreign_trading_post
		}
		modifier = {
			factor = 0.7
			has_province_modifier = european_military_mission
		}
		modifier = {
			factor = 0.7
			has_province_modifier = legation_quarter
		}
		modifier = {
			factor = 0.7
			has_province_modifier = kettler_denkmal
		}
	}
	
	option = {
		name = "EVTOPTA160502"
		any_pop = {
			limit = { is_primary_culture = no }
			militancy = 5
			consciousness = 3
			reduce_pop = 0.98
		}
		ai_chance = {
			factor = 75
		}
	}
	
	option = {
		name = "EVTOPTB160502"
		any_pop = {
			limit = { is_primary_culture = no }
			consciousness = 5
			militancy = 3
		}
		ai_chance = {
			factor = 25
		}
	}
}

#Dungan becomes Xinjiang
country_event = {
	id = 1600032
	title = "Xinjian rule"
	desc = "The Empire will secede the rule to the always faithful Xinjian, and made sure Uighurs don't search for independence again."

	
	fire_only_once = yes
	
	trigger = {
		tag = CHI
		has_global_flag = taiping_has_happened2
		owns = 1600
		has_country_flag = dungan
		XIN = { exists = no }
	}
	
	mean_time_to_happen = { days = 15 }
	
	option = {
		name = "EVTOPTA160001"
		2607 = { secede_province = XIN  }
		1598 = { secede_province = XIN  }
		1594 = { secede_province = XIN  }
		1597 = { secede_province = XIN  }
		1595 = { secede_province = XIN  }
		1600 = { secede_province = XIN  }
		1599 = { secede_province = XIN  }
		1596 = { secede_province = XIN  }
		1188 = { secede_province = XIN  }
		1186 = { secede_province = XIN  }
		1190 = { secede_province = XIN  }
		2607 = { secede_province = XIN  }
		1598 = { secede_province = XIN  }
		1594 = { secede_province = XIN  }
		1597 = { secede_province = XIN  }
		1595 = { secede_province = XIN  }
		1600 = { secede_province = XIN  }
		1599 = { secede_province = XIN  }
		1596 = { secede_province = XIN  }
		1188 = { secede_province = XIN  }
		1186 = { secede_province = XIN  }
		1190 = { secede_province = XIN  }
		XIN = { government = absolute_monarchy  } 
		create_vassal = XIN
		badboy = -5
	}
}