on_actions = {
	#### TSD PEACE/WAR VICTORY ON_CAPITULATION BLOCK ####
	# FROM = winner
	# ROOT = country being capitulated/loser
	on_capitulation = {
		effect = {
			if = {
				limit = {
					OR = {
						ROOT = { is_in_faction = no }
						ROOT = {
							all_allied_country = {
								if = {
									limit = {
										has_war_with = FROM
										is_major = yes
									}
									has_capitulated = yes
								}
							}
						}
					}
				}

				### Gansu Proxy War
				if = { # Japanese Victory
					limit = {
						FROM = { original_tag = GAN }
						ROOT = { original_tag = QIN }
					}
					FROM = {
						annex_country = {
							target = QIN
							transfer_troops = no
						}
						every_country = {
							limit = { is_ai = no }
							news_event = { id = TSD_NEWS.2 hours = 12 }
						}
					}
					JAP = {
						add_to_faction = GAN
					}
					set_global_flag = GAN_victory_no_QIN
					set_global_flag = skip_default_capitulation
				}
				else_if = { # Free Chinese Victory
					limit = {
						FROM = { original_tag = QIN }
						ROOT = { original_tag = GAN }
					}
					FROM = {
						annex_country = {
							target = GAN
							transfer_troops = no
						}
						remove_mission = QIN_GAN_war
						if = {
							limit = {
								NOT = { has_country_flag = QIN_VICTORY }
							}
							set_country_flag = QIN_VICTORY
							country_event = { id = nwrg_military.2 hours = 1 }
							add_political_power = 100
							add_stability = 0.25
							add_war_support = 0.30
						}
						every_country = {
							limit = { is_ai = no }
							news_event = { id = TSD_NEWS.1 hours = 12 }
						}
						country_event = { id = nwrg_congress.14 hours = 72 }
						set_capital = {
							state = 1302
							remember_old_capital = no
						}
					}
					set_global_flag = QIN_victory_no_GAN
					set_global_flag = skip_default_capitulation
				}

				### East Turkestan Liberation War
				else_if = { # Uyghur Victory
					limit = {
						FROM = { original_tag = ETR }
						ROOT = {
							OR = {
								original_tag = XIN
								original_tag = ILI
							}
						}
					}
					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						if = {
							limit = {
								NOT = { has_global_flag = ETR_victory }
								OR = {
									NOT = { country_exists = XIN }
									XIN = { has_capitulated = yes }
								}
								OR = {
									NOT = { country_exists = ILI }
									ILI = { has_capitulated = yes }
								}
							}
							set_global_flag = ETR_victory
							every_country = {
								limit = { is_ai = no }
								news_event = { id = TSD_NEWS.3 hours = 12 }
							}
						}
					}
					
					set_global_flag = skip_default_capitulation
				}
				else_if = { # Chinese Nationalist Victory
					limit = {
						FROM = { original_tag = XIN }
						ROOT = {
							OR = {
								original_tag = ETR
								original_tag = ILI
							}
						}
					}
					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						if = {
							limit = {
								NOT = { has_global_flag = XIN_victory }
								OR = {
									NOT = { country_exists = ETR }
									ETR = { has_capitulated = yes }
								}
								OR = {
									NOT = { country_exists = ILI }
									ILI = { has_capitulated = yes }
								}
							}
							set_global_flag = XIN_victory
							every_country = {
								limit = { is_ai = no }
								news_event = { id = TSD_NEWS.4 hours = 12 }
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = { # Chinese Communist Victory
					limit = {
						FROM = { original_tag = ILI }
						ROOT = {
							OR = {
								original_tag = ETR
								original_tag = XIN
							}
						}
					}
					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						if = {
							limit = {
								NOT = { has_global_flag = ILI_victory }
								OR = {
									NOT = { country_exists = ETR }
									ETR = { has_capitulated = yes }
								}
								OR = {
									NOT = { country_exists = XIN }
									XIN = { has_capitulated = yes }
								}
							}
							set_global_flag = ILI_victory
							add_popularity = {
								ideology = communist
								popularity = 0.05
							}
							set_cosmetic_tag = ILI_MAO_XINJIANG
							country_event = { id = xinjiang.3 hours = 48 }
							add_popularity = {
								ideology = socialist
								popularity = 0.05
							}
							every_country = {
								limit = { is_ai = no }
								news_event = { id = TSD_NEWS.5 hours = 12 }
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}
			}
			clr_global_flag = skip_default_capitulation
		}
	}
}
