on_actions = {
	#### PEACE/WAR VICTORY ON_CAPITULATION BLOCK ####
	#### PUT YOUR SHIT HERE
	# At the end of each global block, set the skip_default_capitulation GLOBAL flag
	# Otherwise shit will just get annexed
	# Really
	# It will.

	# FROM = winner
	# ROOT = country being capitulated/loser
	
	# Anytime y'all are triggering the popup manually, please add 1 to the dirty variable, `peace_popup_dirty`

	#See TNO_economy_scripted_effects regarding how transfer_GDP works
	on_capitulation = {
		effect = {
			log = "[GetDateText]: FROM: [From.GetName] ROOT: [Root.GetName] on_capitulation"

			if = {
				limit = {
					#ROOT = { TNO_anarchy_RUS_russian_anarchy = no }
					#FROM = { TNO_anarchy_RUS_russian_anarchy = no }
					
					ROOT = { TNO_anarchy_MCW_Dissapearance = no }
					FROM = { TNO_anarchy_MCW_Dissapearance = no }
				}

				every_country = {
					limit = {
						is_ai = no
						NOT = { has_country_flag = diplomatic_alerts_disabled }
					}
					set_country_flag = show_peace_popup_alert
					FROM = {
						save_global_event_target_as = winning_country
					}
					ROOT = {
						save_global_event_target_as = losing_country
					}
					log = "[GetDateText]: winner/loser: FROM: [winning_country.GetName] ROOT: [losing_country.GetName] on_capitulation"
					
					if = {
						limit = {
							event_target:losing_country = {
								any_allied_country = {
									has_war_together_with = event_target:losing_country
								}
							}
						}
						set_country_flag = losing_country_multiple
					}

					if = {
						limit = {
							event_target:winning_country = {
								any_allied_country = {
									has_war_together_with = event_target:winning_country
								}
							}
						}
						set_country_flag = winning_country_multiple
					}
					add_to_variable = { peace_popup_dirty = 1 }
				}
			}

			FROM = { # winner simply gets GDP recalculated :)
				recalculate_GDP_and_PUs_on_demand = yes
			}

			#Annexation block
			#This if block will only fire if FROM (capitulator) and ROOT (country being capitulated)
			#That is to say, if one side has completely lost (nobody left to fight on)

			if = {
				limit = {
					OR = {
						ROOT = { is_in_faction = no }
						ROOT = {
							all_allied_country = {
								if = {
									limit = {
										has_war_with = FROM
										is_major = yes
									}
									has_capitulated = yes
								}
							}
						}
					}
				}
				log = "war_won"
				set_global_flag = war_won

				if = {
					limit = {
						FROM = {
							is_russian_nation = yes
							NOT = {
								tag = ONG
								is_in_faction_with = ONG
							}
						}
						ROOT = {
							is_russian_nation = yes
						}
					}
					
					RUS_capitulation_effect = yes
				}

				else_if = { # WAC, when it feels like running through this block
					limit = {
						is_in_array = { global.WAC_contender = FROM.id }
						is_in_array = { global.WAC_contender = ROOT.id }
						has_global_flag = west_african_war_ongoing
						NOT = {
							any_country = {
								is_west_african_nation = yes
								has_war_with = GER
							}
						}
					}

					if = { # Removes ongoing flag, if war is already ending
						limit = {
							OR = {
								has_global_flag = WAC_scenario_1
								has_global_flag = WAC_scenario_3
								AND = {
									has_global_flag = WAC_scenario_2
									OR = {
										has_global_flag = WAC_scen2_WAA_fell
										has_global_flag = WAC_scen2_FMA_fell
										has_global_flag = WAC_scen2_PALF_fell
									}
								}
							}
						}
						clr_global_flag = west_african_war_ongoing
					}

					FROM = {
						every_enemy_country = {
							limit = {
								OR = {
									original_tag = ROOT
									is_in_faction_with = ROOT
									is_subject_of = ROOT
								}
							}
							FROM = {
								white_peace = PREV
								annex_country = {
									target = PREV
									transfer_troops = no
								}
							}
						}
					}
					log = "[GetDateText]: FROM: [From.GetName] ROOT: [Root.GetName] on_capitulation WAC"

					if = { # SCENARIO 1 / WAA vs. PALF
						limit = { has_global_flag = WAC_scenario_1 }
						if = { # WAA victory
							limit = { is_in_array = { global.WAC_WAA_faction = FROM.id } }
							ZZZ = {
								WAC_1_WAA_VICTORY = yes
							}
						}
						else_if = { # PALF victory
							limit = { is_in_array = { global.WAC_PALF_faction = FROM.id } }
							ZZZ = {
								WAC_1_PALF_VICTORY = yes
							}
						}
					}

					else_if = { # SCENARIO 2 / WAA vs. FMA vs. PALF
						limit = { has_global_flag = WAC_scenario_2 }

						if = { # WAA fell
							limit = {
								NOT = { has_global_flag = WAC_scen2_WAA_fell }
								all_of_scopes = {
									array = global.WAC_WAA_faction
									exists = no
								}
							}
							set_global_flag = WAC_scen2_WAA_fell
						}
						if = { # FMA fell
							limit = {
								NOT = { has_global_flag = WAC_scen2_FMA_fell }
								all_of_scopes = {
									array = global.WAC_FMA_faction
									exists = no
								}
							}
							set_global_flag = WAC_scen2_FMA_fell
							TNO_WAC_clear_decision_categories_scenario2usa = yes
						}
						if = { # PALF fell
							limit = {
								NOT = { has_global_flag = WAC_scen2_PALF_fell }
								all_of_scopes = {
									array = global.WAC_PALF_faction
									exists = no
								}
							}
							ZZZ = {
								WAC_2_PALF_BEATEN = yes
							}
						}

						if = { # WAA victory royale
							limit = {
								is_in_array = { global.WAC_WAA_faction = FROM.id }
								has_global_flag = WAC_scen2_FMA_fell
								has_global_flag = WAC_scen2_PALF_fell
							}
							ZZZ = {
								WAC_2_WAA_VICTORY = yes
							}
						}
						else_if = { # FMA victory royale
							limit = {
								is_in_array = { global.WAC_FMA_faction = FROM.id }
								has_global_flag = WAC_scen2_WAA_fell
								has_global_flag = WAC_scen2_PALF_fell
							}
							ZZZ = {
								WAC_2_FFR_VICTORY = yes
							}
						}
						else_if = { # PALF victory royale
							limit = {
								is_in_array = { global.WAC_PALF_faction = FROM.id }
								has_global_flag = WAC_scen2_WAA_fell
								has_global_flag = WAC_scen2_FMA_fell
							}
							ZZZ = {
								WAC_2_PALF_VICTORY = yes
							}
						}
					}

					else_if = { # SCENARIO 3 / FMA vs. PALF
						limit = { has_global_flag = WAC_scenario_3 }
						if = { # FMA victory
							limit = { is_in_array = { global.WAC_FMA_faction = FROM.id } }
							ZZZ = {
								WAC_3_FMA_VICTORY = yes
							}
						}
						else_if = { # PALF victory
							limit = { is_in_array = { global.WAC_PALF_faction = FROM.id } }
							ZZZ = {
								WAC_3_PALF_VICTORY = yes
							}
						}
					}

					set_global_flag = skip_default_capitulation
				}

				else_if = { # Mano, when it feels like running through this block
					limit = {
						is_in_array = { global.mano_campaign_contender = ROOT.id }
						has_global_flag = mano_campaign_ongoing
						NOT = { has_global_flag = mano_campaign_MRP_victory }
					}

					clr_global_flag = mano_campaign_ongoing

					FROM = {
						every_enemy_country = {
							limit = {
								OR = {
									original_tag = ROOT
									is_in_faction_with = ROOT
									is_subject_of = ROOT
								}
							}
							FROM = {
								white_peace = PREV
							}
						}
					}

					if = { # Mano Pact wins
						limit = {
							ROOT = {
								OR = {
									tag = LIB
									tag = MDI
								}
							}
						}
						ZZZ = {
							MANO_PALF_VICTORY = yes
						}
					}

					set_global_flag = skip_default_capitulation
				}
				
				#Second Triple Alliance War, Paraguay must accept its destiny.
				else_if = {
					limit = {
						ROOT = {
							original_tag = PAR
						}
						FROM = {
							OR = {
								original_tag = ARG
								original_tag = BRA
								original_tag = URG
							}
						}
					}

					clr_global_flag = PAR_invasion_ongoing

					every_country = {
						limit = { has_war_with = PAR }
						white_peace = PAR
					}

					FROM = {
						every_country = {
							limit = { is_ai = no }
							news_event = {
								id = LATAM_news.112
								hours = 4
							}
						}
						ARP = {
							add_state_core = 1622
							add_state_core = 1621
							add_state_core = 1617
							add_state_core = 1618
							transfer_state = 1622
							transfer_state = 1621
							transfer_state = 1617
							transfer_state = 1618

							if = {
								limit = { ARG = { has_country_flag = HAS_ECON_SPHERE } }
								econ_join_sphere_ARG = yes
							}
						}
						BRP = {
							if = {
								limit = {
									PAR = { owns_state = 1624 }
								}
								add_state_core = 1624
								add_state_core = 1649
								transfer_state = 1624
								transfer_state = 1649
							}
							else_if = {
								limit = { country_exists = PAC }
								country_event = { id = PAR_bolivia.5 days = 7 }
							}
							add_state_core = 301
							add_state_core = 1619
							add_state_core = 1620
							add_state_core = 688
							add_state_core = 1623
							transfer_state = 301
							transfer_state = 1619
							transfer_state = 1620
							transfer_state = 688
							transfer_state = 1623


							if = {
								limit = { BRA = { has_country_flag = HAS_ECON_SPHERE } }
								econ_join_sphere_BRA = yes
							}
							else_if = {
								limit = { BRA = { has_country_flag = joined_andean_pact } }
								econ_join_sphere_ADN = yes
							}
						}
						URP = {
							add_state_core = 1616
							transfer_state = 1616
							TNO_startup_nation = yes

							if = {
								limit = {
									URG = { has_country_leader = { character = URG_Gabriel_Terra_Ilarraz ruling_only = yes } }
								}
								econ_join_sphere_GER = yes
							}
							else = {
								econ_join_sphere_USA = yes
							}
							if = {
								limit = { URG = { has_idea = OFN_Partner } }
								add_ideas = OFN_Partner
							}
						}
						ARG = {
							set_autonomy = {
								target = ARP
								autonomy_state = autonomy_military_government
							}
						}
						BRA = {
							#country_event = PAR_invasion.11 - doesn't exist
							set_autonomy = {
								target = BRP
								autonomy_state = autonomy_military_government
							}
							if = {
								limit = { BRA = { is_in_faction_with = USA } }
								BRP = {
									USA = { add_to_faction = BRP }
									add_ideas = OFN_Military_Government
								}
							}
						}
						URG = {
							set_autonomy = {
								target = URP
								autonomy_state = autonomy_military_government
							}
						}
						GER = {
							if = {
								limit = {
									has_country_leader = {
										character = GER_albert_speer
										ruling_only = yes
									}
								}
								country_event = PAR_invasion.802
							}
						}
						URP = {
							set_politics = { ruling_party = despotism }
							set_popularities = { despotism = 100 }
						}
						BRP = {
							set_politics = { ruling_party = despotism }
							set_popularities = { despotism = 100 }
						}
						ARP = {
							set_politics = { ruling_party = despotism }
							set_popularities = { despotism = 100 }
						}
					}
					set_global_flag = skip_default_capitulation
				}
				#Second Triple Alliance War, a little easter egg + we have the loc :)
				else_if = {
					limit = {
						ROOT = {
							OR = {
								original_tag = ARG
								original_tag = BRA
								original_tag = URG
							}
						}
						FROM = {
							original_tag = PAR
						}
					}

					clr_global_flag = PAR_invasion_ongoing

					every_country = {
						limit = { has_war_with = PAR }
						white_peace = PAR
					}

					FROM = {
						every_country = {
							limit = { is_ai = no }
							news_event = {
								id = LATAM_news.113
								hours = 4
							}
						}
						add_popularity = {
							ideology = socialist
							popularity = 0.1
						}
						add_popularity = {
							ideology = communist
							popularity = 0.1
						}
					}
					BRA = {
						set_capital = { state = 1489 remember_old_capital = no }
					}
					ARG = {
						set_capital = { state = 1511 remember_old_capital = no }
					}
					URG = {
						set_capital = { state = 1629 remember_old_capital = no }
					}
					set_global_flag = skip_default_capitulation
				}

				else_if = { # Dissolution, clean up cores
					limit = {
						FROM = {
							is_in_array = { global.MSK_Dissolution_Tags = THIS }
						}
						ROOT = {
							is_in_array = { global.MSK_Dissolution_Tags = THIS }
						}
						has_global_flag = MSK_Dissolution_Ongoing
					}
					every_state = { # clean up cores
						limit = {
							is_core_of = ROOT
						}
						remove_core_of = ROOT
						add_core_of = FROM
					}
					FROM = {
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#Second Macedonian War: Cheren Offensive
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = BUL
								original_tag = MAC
							}
						}
						ROOT = {
							OR = {
								original_tag = BUL
								original_tag = MAC
							}
						}
					}

					FROM = {
						if = {
							limit = {
								original_tag = BUL
							}
							annex_country = {
								target = ROOT
								transfer_troops = no
							}
							country_event = { id = BUL.32 days = 180 }
							hidden_effect = {
								every_country = {
									limit = { is_ai = no }
									news_event = { id = BUL_NEWS.8 }
								}
							}
							reset_province_name = 3882
							reset_province_name = 974
						}
						else = {
							white_peace = ROOT
							country_event = { id = MAC.1 }
							ROOT = {
								country_event = { id = BUL.32 days = 180 }
							}
							hidden_effect = {
								every_country = {
									limit = { is_ai = no }
									news_event = { id = BUL_NEWS.9 }
								}
							}
						}
						if = {
							limit = {
								NOT = { has_global_flag = goering_betrayed_allies }
							}
							GER = { add_to_faction = BUL }
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#Serbian civil war
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = SER
								original_tag = GMS
							}
						}
						ROOT = {
							OR = {
								original_tag = SER
								original_tag = GMS
							}
						}

					}
					clr_global_flag = SER_TestGarrison

					FROM = {
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						if = {
							limit = {
								has_war = no
							}
							every_owned_state = { # clean up cores
								remove_core_of = GMS
							}
							if = {
								limit = { country_exists = GMS } # GMS wins
								# Move back collabs to SER
								GMS = {
									every_character = {
										limit = {
											NOT = {
												is_character = GMS_Generic_Vacant
											}
										}
										set_nationality = SER
									}
								}
								SER = {
									annex_country = {
										target = GMS
										transfer_troops = yes
									}
									set_global_flag = SER_collabs_won_civil_war
									set_cosmetic_tag = GMS_COLLAB
									promote_character = SER_Dragomir_Jovanovic
									promote_character = SER_Konstantin_Musicki
									set_politics = { ruling_party = ultranationalism }
									set_popularities = {
										ultranationalism = 40
										national_socialism = 35
										fascism = 17
										despotism = 8
									}
									remove_all_ministers = yes
									remove_ideas = {
										SER_Refugee_Question
										SER_A_Divided_Front
										SER_Death_To_Fascism_Freedom_To_The_People
										SER_Violence
									}
									add_ideas = {
										SER_Dragomir_Jovanovic_hog
										SER_Gunther_Altenburg_for
										SER_Milosav_Vasiljewic_eco
										SER_Konstantin_Musicki_sec
									}
									set_party_name = {
										ideology = fascism
										long_name = SER_collab_fascism_party_long
										name = SER_collab_fascism_party
									}
									set_party_name = {
										ideology = despotism
										long_name = SER_collab_despotism_party_long
										name = SER_collab_despotism_party
									}
									set_temp_variable = { TNO_economy_subtype_temp = token:Econ_Subtype_Gelenkte_Wirtschaft }
									econ_subtype_change = yes
									country_event = {
										id = serbia.4
										days = 30
									}
									if = {
										limit = { has_global_flag = german_civil_war_end } # SCW Dragged on till end of GCW
										if = {
											limit = {
												NOT = { has_global_flag = goering_betrayed_allies }
											}
											GER = { add_to_faction = SER }
										}
										if = {
											limit = { has_global_flag = german_civil_war_speervic }
											SER = { join_zollverein = yes }
										}
										SER = {
											econ_join_sphere_GER = yes
											add_ideas = Pakt_Mitstreiter
										}
									}
								}
							}
							else_if = {
								limit = { country_exists = SER } # ASNOS wins
								SER = {
									set_temp_variable = { TNO_economy_subtype_temp = token:Econ_Subtype_Worker_Directed }
									econ_subtype_change = yes
									set_global_flag = SER_communists_won_civil_war
									set_cosmetic_tag = SER_POST_WAR
									remove_ideas = {
										SER_Refugee_Question
									}
									set_politics = {
										ruling_party = communist
									}
									promote_character = {
										character = SER_Aleksandar_Rankovic
										ideology = communist_national_communism_subtype
									}
									country_event = {
										id = serbia.3
										days = 30
									}
								}
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#Indonesian Civil War: Duumvirate wins
				else_if = {
					limit = {
						FROM = {
							original_tag = INS
						}
						OR = {
							ROOT = {
								original_tag = DMS
							}
							ROOT = {
								original_tag = NII
							}
							ROOT = {
								original_tag = ABD
							}
							ROOT = {
								original_tag = SLS
							}
							ROOT = {
								original_tag = PMT
							}
							ROOT = {
								original_tag = BKB
							}
							ROOT = {
								original_tag = SRB
							}
							ROOT = {
								original_tag = MKS
							}
						}
						has_global_flag = TNO_INW_duumvirate
					}
					#Generic winner takes all claims and cores from loser
					every_state = {
						limit = {
							is_owned_by = ROOT
							OR = {
								is_claimed_by = FROM
								is_core_of = FROM
							}
						}
						FROM = {
							add_state_core = PREV
							transfer_state = PREV
						}
						ROOT = {
							remove_state_core = PREV
							remove_state_claim = PREV
						}
						FROM = { #Failsafe
							annex_country = {
								target = ROOT
								transfer_troops = no
							}
						}
					}
					set_global_flag = skip_default_capitulation
					if = {
						limit = {
							OR = {
								has_game_rule = {
									rule = INDONESIA_CIVIL_WAR_OUTCOME
									option = INDONESIA_CIVIL_WAR_OUTCOME_SUHARTO
								}
								has_game_rule = {
									rule = INDONESIA_CIVIL_WAR_OUTCOME
									option = INDONESIA_CIVIL_WAR_OUTCOME_LUBIS
								}
							}
						}
						INS = { remove_war_buff = yes }
					}
					every_country = {
						limit = {
							is_indonesia_tag = yes
						}
						leave_faction = yes
						white_peace = INS
					}
					INS = {
						ICW_victory_effect_DUUMVIRATE = yes
					}
					set_global_flag = skip_default_capitulation
				}

				#Indonesian Civil War: Duumvirate Loss
				else_if = {
					limit = {
						OR = {
							FROM = {
								original_tag = DMS
							}
							FROM = {
								original_tag = NII
							}
							FROM = {
								original_tag = ABD
							}
							FROM = {
								original_tag = SLS
							}
							FROM = {
								original_tag = PMT
							}
							FROM = {
								original_tag = PMT
							}
							FROM = {
								original_tag = BKB
							}
							FROM = {
								original_tag = SRB
							}
							FROM = {
								original_tag = MKS
							}
						}
						ROOT = {
							original_tag = INS
							OR = {
								has_country_flag = INS_suharto_duumvirate
								has_country_flag = INS_lubis_duumvirate
							}
						}
					}
					if = {
						limit = {
							OR = {
								has_game_rule = {
									rule = INDONESIA_CIVIL_WAR_OUTCOME
									option = INDONESIA_CIVIL_WAR_OUTCOME_SUHARTO_LOSE
								}
								has_game_rule = {
									rule = INDONESIA_CIVIL_WAR_OUTCOME
									option = INDONESIA_CIVIL_WAR_OUTCOME_LUBIS_LOSE
								}
							}
						}
						every_country = {
							limit = {
								has_idea = Custom_TNO_SFG_war_buff
								NOT = {
									has_war = yes
								}
							}
							remove_war_buff = yes
						}
					}
					every_country = {
						limit = {
							is_indonesia_tag = yes
						}
						leave_faction = yes
						white_peace = INS
					}
					INS = {
						ICW_defeat_effect_DUUMVIRATE = yes
					}
					#Generic winner takes all claims and cores from loser
					every_state = {
						limit = {
							is_owned_by = ROOT
							OR = {
								is_claimed_by = FROM
								is_core_of = FROM
							}
						}
						FROM = {
							add_state_core = PREV
							transfer_state = PREV
						}
						ROOT = {
							remove_state_core = PREV
							remove_state_claim = PREV
						}
						FROM = { #Failsafe
							annex_country = {
								target = ROOT
								transfer_troops = no
							}
							every_owned_state = {
								set_temp_variable = { temp_state_value_addition = -0.025 }
								econ_state_value_change_addition = yes
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#Indonesian Civil War: FRI win
				else_if = {
					limit = {
						OR = {
							FROM = {
								original_tag = FRI
							}
							FROM = {
								original_tag = NII
							}
							FROM = {
								original_tag = DMS
							}
							FROM = {
								original_tag = DMP
							}
							FROM = {
								original_tag = SLS
							}
							FROM = {
								original_tag = PMT
							}
							FROM = {
								original_tag = ABD
							}
						}
						OR = {
							ROOT = {
								original_tag = INS
							}
							ROOT = {
								original_tag = BKB
							}
							ROOT = {
								original_tag = MKS
							}
							ROOT = {
								original_tag = SRB
							}
						}
						NOT = {
							has_global_flag = TNO_INW_duumvirate
						}
					}
					if = {
						limit = {
							has_game_rule = {
								rule = INDONESIA_CIVIL_WAR_OUTCOME
								option = INDONESIA_CIVIL_WAR_OUTCOME_INS
							}
						}
						INS = { remove_war_buff = yes }
					}
					else_if = {
						limit = {
							has_game_rule = {
								rule = INDONESIA_CIVIL_WAR_OUTCOME
								option = INDONESIA_CIVIL_WAR_OUTCOME_FRI
							}
						}
						FRI = { remove_war_buff = yes }
					}
					for_each_scope_loop = {
						array = global.INS_hattaite_faction
						white_peace = INS
						white_peace = BKB
						white_peace = MKS
						white_peace = SRB
					}
					INS = {
						ICW_victory_effect_FRI = yes
					}
					#Generic winner takes all claims and cores from loser
					every_state = {
						limit = {
							is_owned_by = ROOT
							OR = {
								is_claimed_by = FROM
								is_core_of = FROM
							}
						}
						FROM = {
							add_state_core = PREV
							transfer_state = PREV
						}
						ROOT = {
							remove_state_core = PREV
							remove_state_claim = PREV
						}
						FROM = { #Failsafe
							annex_country = {
								target = ROOT
								transfer_troops = no
							}
							every_owned_state = {
								set_temp_variable = { temp_state_value_addition = -0.025 }
								econ_state_value_change_addition = yes
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#Indonesian Civil War: INS win
				else_if = {
					limit = {
						OR = {
							ROOT = {
								original_tag = FRI
							}
							ROOT = {
								original_tag = NII
							}
							ROOT = {
								original_tag = DMS
							}
							ROOT = {
								original_tag = DMP
							}
							ROOT = {
								original_tag = SLS
							}
							ROOT = {
								original_tag = PMT
							}
							ROOT = {
								original_tag = ABD
							}
						}
						OR = {
							FROM = {
								original_tag = INS
							}
							FROM = {
								original_tag = BKB
							}
							FROM = {
								original_tag = MKS
							}
							FROM = {
								original_tag = SRB
							}
						}
						NOT = {
							has_global_flag = TNO_INW_duumvirate
						}
					}
					if = {
						limit = {
							has_game_rule = {
								rule = INDONESIA_CIVIL_WAR_OUTCOME
								option = INDONESIA_CIVIL_WAR_OUTCOME_INS
							}
						}
						INS = { remove_war_buff = yes }
					}
					else_if = {
						limit = {
							has_game_rule = {
								rule = INDONESIA_CIVIL_WAR_OUTCOME
								option = INDONESIA_CIVIL_WAR_OUTCOME_FRI
							}
						}
						FRI = { remove_war_buff = yes }
					}
					for_each_scope_loop = {
						array = global.INS_hattaite_faction
						white_peace = INS
						white_peace = BKB
						white_peace = MKS
						white_peace = SRB
					}
					INS = {
						ICW_victory_effect_INS = yes
					}
					#Generic winner takes all claims and cores from loser
					every_state = {
						limit = {
							is_owned_by = ROOT
							OR = {
								is_claimed_by = FROM
								is_core_of = FROM
							}
						}
						FROM = {
							add_state_core = PREV
							transfer_state = PREV
						}
						ROOT = {
							remove_state_core = PREV
							remove_state_claim = PREV
						}
						FROM = { #Failsafe
							annex_country = {
								target = ROOT
								transfer_troops = no
							}
							every_owned_state = {
								set_temp_variable = { temp_state_value_addition = -0.025 }
								econ_state_value_change_addition = yes
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}

				## French Civil War ##
				else_if = {
					limit = {
						has_global_flag = FRA_civil_war_ongoing #should prevent trigger during non-CW Reclamation
						FROM = {
							OR = {
								original_tag = FRS
								original_tag = FRD
								original_tag = FRM
								original_tag = FRV
								original_tag = FMM
								original_tag = FGR
								original_tag = FIT
								original_tag = FFR
								is_in_faction_with = FFR
							}
						}
						ROOT = {
							OR = {
								original_tag = FRS
								original_tag = FRD
								original_tag = FRM
								original_tag = FRV
								original_tag = FMM
								original_tag = FGR
								original_tag = FIT
							}
						}
					}

					every_country = {
						limit = { has_war_with = ROOT }
						white_peace = ROOT
					}

					if = { # Reclamation defeated
						limit = {
							has_global_flag = FFR_reclamation_civil_war_happening
							ROOT = { original_tag = FRD }
						}

						FFR_reclamation_defeat = yes
					}

					every_state = {
						limit = {
							is_core_of = ROOT
						}
						remove_core_of = ROOT
					}

					FROM = {
						if = {
							limit = {
								OR = {
									original_tag = FFR
									is_in_faction_with = FFR
								}
								country_exists = FRD
							}
							FRD = {
								annex_country = {
									target = ROOT
									transfer_troops = no
								}
							}
						}
						else_if = {
							limit = {
								OR = {
									original_tag = FFR
									is_in_faction_with = FFR
								}
							}
							FFR = {
								annex_country = {
									target = ROOT
									transfer_troops = no
								}
							}
						}
						else = {
							annex_country = {
								target = ROOT
								transfer_troops = no
							}
						}

						if = {
							limit = {
								NOT = {
									count_triggers = {
										amount = 2
										country_exists = FRS
										country_exists = FRD
										country_exists = FRM
										country_exists = FRV
										country_exists = FMM
										country_exists = FGR
										country_exists = FIT
									}
								}
							}

							clr_global_flag = FRA_civil_war_sidos
							clr_global_flag = FRA_civil_war_poujade
							clr_global_flag = FRA_civil_war_ongoing
							set_global_flag = FRA_civil_war_over
							set_capital = { state = 19 remember_old_capital = no }

							if = { # Reclamation victorious
								limit = {
									has_global_flag = FFR_reclamation_civil_war_happening
									OR = {
										original_tag = FFR
										original_tag = FRD
										is_in_faction_with = FFR
									}
								}

								set_global_flag = FFR_reclamation_successful
								FFR_reclamation_victory = yes
							}
							else_if = {
								limit = { has_country_flag = FRA_sidos_elected }

								if = {
									limit = { 
										FRA = {
											check_variable = { ECON_SPHERE_LEADER = ITA } 
										}
									}
									ITA = { add_to_faction = FRA }
									ITA = { 
										set_temp_variable = { target = FRA }
										TNO_clear_and_recall_volunteers = yes
									}
									FRA = {
										if = {
											limit = { ITA = { has_idea = ITA_Mediterranean_Bloc_Leader } }
											add_ideas = ITA_Mediterranean_Bloc_Member
										}
										if = {
											limit = { ITA = { has_idea = ITA_Imperial_Alliance_Leader } }
											add_ideas = ITA_Imperial_Alliance_Member
										}
										if = {
											limit = { ITA = { has_idea = ITA_Rome_Pact_Leader } }
											add_ideas = ITA_Rome_Pact_Member
										}
									}
								}
								else_if = {
									limit = {
										FRA = {
											check_variable = { ECON_SPHERE_LEADER = GER }
										}
									}
									if = {
										limit = {
											NOT = { has_global_flag = goering_betrayed_allies }
										}
										GER = { add_to_faction = FRA }
									}
									GER = {
										set_temp_variable = { target = FRA }
										TNO_clear_and_recall_volunteers = yes
									}
								}
								else_if = {
									limit = { FRA = { has_idea = FRA_latin_bloc } }
									IBR = {
										set_temp_variable = { target = FRA }
										TNO_clear_and_recall_volunteers = yes
									}
								}
								every_country = {
									limit = { is_ai = no }
									news_event = { id = WORLD.30101 days = 1 }
								}
							}
							else_if = {
								limit = { has_country_flag = FRA_poujade_elected }

								if = {
									limit = {
										FRA = {
											check_variable = { ECON_SPHERE_LEADER = GER }
										}
									}
									GER = { add_to_faction = FRA }
								}

								every_country = {
									limit = { is_ai = no }
									news_event = { id = WORLD.30108 days = 1 }
								}
							}
							else_if = {
								limit = { country_exists = FRD }

								set_cosmetic_tag = FRA_postCW
								every_country = {
									limit = { is_ai = no }
									news_event = { id = WORLD.30102 days = 1 }
								}
							}
							else_if = {
								limit = { country_exists = FRV }
								
								set_cosmetic_tag = FRA_postCW
								every_country = {
									limit = { is_ai = no }
									news_event = { id = WORLD.30103 days = 1 }
								}
							}
							else_if = {
								limit = { country_exists = FRM }
								
								set_cosmetic_tag = FRA_postCW
								every_country = {
									limit = { is_ai = no }
									news_event = { id = WORLD.30104 days = 1 }
								}
								
								if = {
									limit = {
										NOT = { has_global_flag = goering_betrayed_allies }
									}
									GER = {
										add_to_faction = FRM
										set_temp_variable = { SeaZone_ID = 3 } # 3; North Atlantic
										Cold_War_GUI_PowerProjection_AddSeaZone = yes
										set_temp_variable = { SeaZone_ID = 5 } # 5: Med
										Cold_War_GUI_PowerProjection_AddSeaZone = yes
									}
									FRM = {
										add_ideas = Pakt_Bundnispartner
									}
									if = {
										limit = { has_global_flag = german_civil_war_speervic }
										join_zollverein = yes
										econ_join_sphere_GER = yes
									}
									else = {
										econ_join_sphere_GER = yes
									}
								}
							}
							else_if = {
								limit = { country_exists = FMM }
								
								set_cosmetic_tag = FRA_postCW
								every_country = {
									limit = { is_ai = no }
									news_event = { id = WORLD.30105 days = 1 }
								}
								
								if = {
									limit = {
										NOT = { has_global_flag = goering_betrayed_allies }
									}
									GER = {
										add_to_faction = FMM
										set_temp_variable = { SeaZone_ID = 3 } # 3; North Atlantic
										Cold_War_GUI_PowerProjection_AddSeaZone = yes
										set_temp_variable = { SeaZone_ID = 5 } # 5: Med
										Cold_War_GUI_PowerProjection_AddSeaZone = yes
									}
									FMM = {
										add_ideas = Pakt_Bundnispartner
									}
									if = {
										limit = { has_global_flag = german_civil_war_speervic }
										join_zollverein = yes
										econ_join_sphere_GER = yes
									}
									else = {
										econ_join_sphere_GER = yes
									}
								}
							}
							else_if = {
								limit = { country_exists = FGR }
								
								set_cosmetic_tag = FRA_postCW
								every_country = {
									limit = { is_ai = no }
									news_event = { id = WORLD.30106 days = 1 }
								}

								if = {
									limit = {
										NOT = { has_global_flag = goering_betrayed_allies }
									}
									GER = {
										add_to_faction = FGR
										set_temp_variable = { SeaZone_ID = 3 } # 3; North Atlantic
										Cold_War_GUI_PowerProjection_AddSeaZone = yes
										set_temp_variable = { SeaZone_ID = 5 } # 5: Med
										Cold_War_GUI_PowerProjection_AddSeaZone = yes
									}
									FGR = {
										add_ideas = Pakt_Bundnispartner
									}
									if = {
										limit = { has_global_flag = german_civil_war_speervic }
										join_zollverein = yes
										econ_join_sphere_GER = yes
									}
									else = {
										econ_join_sphere_GER = yes
									}
								}
							}
							else_if = {
								limit = { country_exists = FIT }
								
								set_cosmetic_tag = FRA_postCW
								every_country = {
									limit = { is_ai = no }
									news_event = { id = WORLD.30107 days = 1 }
								}

								set_country_flag = FRA_Italy_Aligned
								econ_join_sphere_ITA = yes
								FIT = {
									get_current_government_type = yes
									save_party_popularities = yes
								}
								ITA = {
									set_autonomy = {
										target = FIT
										autonomy_state = autonomy_italy_associate
									}
								}
								FIT = {
									restore_previous_government_type = yes
									apply_party_popularities = yes
								}

								if = {
									limit = {
										USA = { is_faction_leader = yes }
										ITA = { is_in_faction_with = USA }
									}
									USA = { add_to_faction = FIT }
									add_ideas = OFN_Independent_Member
								}
								else_if = {
									limit = {
										JAP = { is_faction_leader = yes }
										ITA = { is_in_faction_with = JAP }
									}
									JAP = { add_to_faction = FIT }
									add_ideas = Sphere_Coequal
								}
								econ_join_sphere_ITA = yes
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}

				# French Reclamation w/o Civil War
				else_if = { # Reclamation Victory, defeat covered in on state control action file
					limit = {
						NOT = { has_global_flag = FRA_civil_war_ongoing }
						FROM = {
							OR = {
								original_tag = FFR
								original_tag = FRD
								is_in_faction_with = FFR
							}
						}
						ROOT = {
							OR = {
								original_tag = FRS
								original_tag = FRM
								original_tag = FRV
								original_tag = FMM
								original_tag = FGR
								original_tag = FIT
							}
						}
					}

					every_country = {
						limit = { has_war_with = ROOT }
						white_peace = ROOT
					}

					if = {
						limit = { country_exists = FRD }
						every_state = {
							limit = {
								is_core_of = ROOT
							}
							remove_core_of = ROOT
							add_core_of = FRD
						}

						FRD = {
							annex_country = {
								target = ROOT
								transfer_troops = no
							}
						}
					}
						
					set_global_flag = FFR_reclamation_successful
					FFR_reclamation_victory = yes

					set_global_flag = skip_default_capitulation
				}

				### Burgundy AI Collapse
				else_if = {
					limit = {
						FROM = {
							OR = {
								is_in_faction_with = GER
								is_in_faction_with = USA
								original_tag = PIC
								original_tag = FLR
								original_tag = BEL
								original_tag = RPY
								original_tag = BRG
							}
						}
						ROOT = {
							OR = {
								original_tag = PIC
								original_tag = FLR
								original_tag = BEL
								original_tag = RPY
								original_tag = BRG
							}
						}
					}

					if = {
						limit = {
							ROOT = { tag = BRG }
						}
						BRG = { country_event = { id = BRG_collapse.103 } }
					}

					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						every_owned_state = { remove_core_of = ROOT }
					}

					if = {
						limit = {
							NOT = {
								country_exists = PIC
								country_exists = BRG
								country_exists = BEL
								country_exists = FLR
							}
							OR = {
								FRA = { is_in_faction_with = USA }
								NOT = { country_exists = RPY }
							}
						}

						FRA = {
							if = {
								limit = {
									is_in_faction_with = USA
									country_exists = RPY
								}
								country_event = BRG_ai_collapse.101
							}
						}
						if = {
							limit = {
								NOT = {
									has_global_flag = german_civil_war_goeringvic
								}
							}
							GER = { BRG_AI_Collapse_Determine_Outcome = yes }
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#OSTLAND
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = OST
								original_tag = MST
								original_tag = DST
								original_tag = JST
								original_tag = UPO
								original_tag = BLR
							}
						}
						ROOT = {
							OR = {
								original_tag = OST
								original_tag = MST
								original_tag = DST
								original_tag = JST
								original_tag = UPO
								original_tag = BLR
							}
						}
					}

					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						every_owned_state = {
							add_core_of = FROM
							remove_core_of = ROOT
						}
					}

					OST_off_a_fucker = yes
					OST_check_victor = yes

					set_global_flag = skip_default_capitulation
				}

				# UKRAINIAN CIVIL WAR
				else_if = {
					limit = {
						has_global_flag = UKR_UCW_ongoing
						FROM = {
							OR = {
								original_tag = UKR
								original_tag = FUK
								original_tag = UKS
								original_tag = BOV
							}
						}
						ROOT = {
							OR = {
								original_tag = UKR
								original_tag = FUK
								original_tag = UKS
								original_tag = BOV
							}
						}
					}

					UKR_UCW_someone_dead = yes
					UKR_UCW_check_victor = yes
					UKR_UCW_fire_capitulation_event = yes

					if = {
						limit = {
							FROM = { is_in_faction_with = GER}
						}
						ROOT = {
							if = {
								limit = { country_exists = POL }
								every_owned_state = {
									limit = { is_core_of = POL }
									POL = { transfer_state = PREV }
								}
							}
							else = {
								every_owned_state = {
									limit = { is_core_of = GGN }
									GGN = { transfer_state = PREV }
								}
							}
						}
					}

					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						every_owned_state = {
							add_core_of = FROM #Failsafe
							if = {
								limit = { NOT = { ROOT = { tag = UKR } } }
								remove_core_of = ROOT
							}
						}
					}
					CRI = { every_owned_state = { remove_core_of = ROOT } }
					
					set_global_flag = skip_default_capitulation
				}

				# Polish-Ukrainian War Over Galicia
				else_if = { # Ukrainian Victory
					limit = {
						FROM = {
							OR = {
								original_tag = UKS
								original_tag = BOV
							}
						}
						ROOT = {
							OR = {
								original_tag = POL
								original_tag = GGN
							}
						}
					}

					clr_global_flag = UKS_POL_GalicianWar
					clr_global_flag = BOV_POL_GalicianWar_Klyachkivsky
					clr_global_flag = BOV_POL_GalicianWar_Stetsko
					clr_global_flag = BOV_POL_GalicianWar_Shukhevych
					FROM = {
						white_peace = ROOT
					}
					ROOT = {
						every_owned_state = {
							limit = {
								OR = {
									check_variable = { nationality = 164 }
									check_variable = { nationality = 380 }
									check_variable = { nationality = 723 }
								}
							}
							FROM = { transfer_state = PREV }
							if = {
								limit = { check_variable = { nationality = 164 } }
								add_core_of = BOV
							}
							else = {
								set_compliance = 50
							}
						}
					}
					
					set_global_flag = skip_default_capitulation
				}
				else_if = { # Polish Victory
					limit = {
						FROM = {
							OR = {
								original_tag = POL
								original_tag = GGN
							}
						}
						ROOT = {
							OR = {
								original_tag = UKS
								original_tag = BOV
							}
						}
					}

					FROM = {
						white_peace = ROOT
					}
					ROOT = { # Poland takes all of Galicia
						if = {
							limit = { country_exists = POL }
							every_owned_state = {
								limit = { is_core_of = POL }
								POL = { transfer_state = PREV }
							}
						}
						else = {
							every_owned_state = {
								limit = { is_core_of = GGN }
								GGN = { transfer_state = PREV }
							}
						}
					}
					
					set_global_flag = skip_default_capitulation
				}
				else_if = { #Crimean War 
					limit = { 
						FROM = {
							OR = {
								original_tag = FUK
								original_tag = BOV
								original_tag = UKS
							}
						}
						ROOT = {
							original_tag = CRI
						}
					}
					CRI = { transfer_navy = { target = GER } }
				}
				#Legion defeats everyone
				else_if = {
					limit = {
						FROM = {
							original_tag = UTL
						}
						ROOT = {
							OR = {
								original_tag = KRK
								original_tag = UZB
								original_tag = KYR
								original_tag = TAJ
								original_tag = TRK
							}
						}
						has_global_flag = TNO_TURKES_KENES_OVER_GER_WINS
					}
					UTL = {
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						if = {
							limit = {
								NOT = {
									country_exists = KRK
								}
								NOT = {
									country_exists = UZB
								}
								NOT = {
									country_exists = KYR
								}
								NOT = {
									country_exists = TAJ
								}
								NOT = {
									country_exists = TRK
								}
							}
							UTL = {
								country_event = {
									id = CA_TK_skeleton.26
								}
								every_owned_state = {
									remove_core_of = KRK
									remove_core_of = UZB
									remove_core_of = KYR
									remove_core_of = TAJ
									remove_core_of = TRK
									add_core_of = PREV
								}
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}
				# Tajikistan and Kyrgyzstan kill Legion
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = KYR
								original_tag = TAJ
							}
						}
						ROOT = {
							original_tag = UTL
						}
						OR = {
							has_global_flag = TK_JAP_Victory
							has_global_flag = TNO_TURKES_KENES_OVER_NEUTRALITY
						}
					}
					KYR = {
						annex_country = {
							target = UTL
							transfer_troops = no
						}
						country_event = {
							id = CA_TK_skeleton.30
						}
					}
					set_global_flag = skip_default_capitulation
				}
				# Turkmenistan defeats legion
				else_if = {
					limit = {
						FROM = {
							original_tag = TRK
						}
						ROOT = {
							original_tag = UTL
						}
						has_global_flag = TNO_TURKES_KENES_OVER_USA_WINS
					}
					TRK = {
						country_event = {
							id = CA_TK_skeleton.33
						}
						annex_country = {
							target = UTL
							transfer_troops = no
						}
						every_owned_state = {
							remove_core_of = KRK
							remove_core_of = UZB
							remove_core_of = KYR
							remove_core_of = TAJ
							remove_core_of = UTL
							add_core_of = PREV
						}
					}
					set_global_flag = skip_default_capitulation
				}
				# Turkmenistan defeats TAJ/KYR
				else_if = {
					limit = {
						FROM = {
							original_tag = TRK
						}
						ROOT = {
							OR = {
								original_tag = TAJ
								original_tag = KYR
							}
						}
						has_global_flag = TNO_TURKES_KENES_OVER_USA_WINS
					}
					TRK = {
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						every_owned_state = {
							remove_core_of = KRK
							remove_core_of = UZB
							remove_core_of = KYR
							remove_core_of = TAJ
							remove_core_of = UTL
							add_core_of = PREV
						}
						if = {
							limit = {
								NOT = {
									country_exists = KYR
								}
								NOT = {
									country_exists = TAJ
								}
							}
							TRK = {
								country_event = {
									id = CA_TK_skeleton.34
								}
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}
				#Second Italo-Turkish War
				else_if = {
					limit = {
						FROM = {
							original_tag = IME
						}
						ROOT = {
							OR = {
								original_tag = SNS
								original_tag = BKU
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = {
					limit = {
						FROM = {
							original_tag = IME
						}
						ROOT = {
							original_tag = TUR
						}
					}

					FROM = {
						white_peace = ROOT
						TUR = {
							country_event = itatur.10
						}
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = {
					limit = {
						FROM = {
							original_tag = TUR
						}
						ROOT = {
							original_tag = IME
						}
					}

					FROM = {
						white_peace = ROOT
						ITA = {
							country_event = itatur.4
						}
					}
					set_global_flag = skip_default_capitulation
				}
				#Yemen Civil War
				else_if = {
					limit = {
						FROM = {
							original_tag = YEM
						}
						ROOT = {
							original_tag = NYM
						}
					}

					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						every_owned_state = {
							remove_core_of = ROOT
						}
						YEM = { country_event = { id = YEM.6 } }
					}
					set_global_flag = OC_Yemen_CW_over
					OIL_YEM_win_yemen = yes
					OIL_check_remove_forpol_tab = yes
					GNG = {
						clr_country_flag = GNG_OC_is_sending_volunteers_YEM
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = {
					limit = {
						FROM = {
							original_tag = NYM
						}
						ROOT = {
							original_tag = YEM
						}
					}

					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						NYM = { country_event = { id = YEM.7 } }
					}
					ITA = {
						if = {
							limit = {
								has_country_flag = ITA_ciano_wins
							}
							ITA_army_add_borghese_pop = yes
							ITA_airforce_add_borghese_pop = yes
							ITA_navy_add_borghese_pop = yes
							ITA_carabinieri_add_borghese_pop = yes
							set_global_flag = ITA_lost_oil_crisis
						}
						else_if = {
							limit = {
								has_country_flag = ITA_scorza_wins
							}
							ITA_army_add_sogno_pop = yes
							ITA_airforce_add_sogno_pop = yes
							ITA_navy_add_sogno_pop = yes
							ITA_carabinieri_add_sogno_pop = yes
							set_global_flag = ITA_lost_oil_crisis
						}
					}
					GNG = {
						clr_country_flag = GNG_OC_is_sending_volunteers_YEM
					}
					set_global_flag = skip_default_capitulation
				}
				#Saudi Arabian & Baathist epic showdown
				else_if = {
					limit = {
						FROM = {
							original_tag = NYM
						}
						ROOT = {
							original_tag = SAU
						}
					}

					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						every_owned_state = {
							remove_core_of = YEM
						}
						NYM = { country_event = { id = YEM.10 } }
					}
					set_global_flag = OC_Yemen_CW_over
					set_global_flag = OC_Yemen_NYM_won
					OIL_NYM_win_yemen = yes
					OIL_check_remove_forpol_tab = yes
					set_global_flag = skip_default_capitulation
				}
				else_if = {
					limit = {
						FROM = {
							original_tag = SAU
						}
						ROOT = {
							original_tag = NYM
						}
					}

					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						every_owned_state = {
							remove_core_of = NYM
						}
						SAU = { country_event = { id = YEM.9 } }
					}
					set_global_flag = OC_Yemen_CW_over
					set_global_flag = OC_Yemen_SAU_won
					OIL_SAU_win_yemen = yes
					OIL_check_remove_forpol_tab = yes
					set_global_flag = skip_default_capitulation
				}
				#Oman civil war
				else_if = {
					limit = {
						FROM = {
							OR = {
								tag = OMA
								tag = OMB
								tag = OMI
							}
						}
						ROOT = {
							OR = {
								tag = OMA
								tag = OMB
								tag = OMI
							}
						}
					}
					ROOT = {
						if = {
							limit = {
								tag = OMA
							}
							GNG = {
								clr_country_flag = GNG_OC_is_sending_volunteers_OMA
							}
						}
						else_if = {
							limit = {
								tag = OMI
							}
							GNG = {
								clr_country_flag = GNG_OC_is_sending_volunteers_OMI
							}
						}
					}
					FROM = {
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						if = {
							limit = {
								tag = OMA
								owns_state = 913 #NOT = { country_exists = OMB }
								owns_state = 914 #NOT = { country_exists = OMI }
							}
							every_owned_state = {
								remove_core_of = OMB
								remove_core_of = OMI
							}
							OMA = { country_event = { id = OMA.6 } }
							set_global_flag = OC_Oman_CW_over
							OIL_OMA_win_oman = yes
							OIL_check_remove_forpol_tab = yes
							GNG = {
								clr_country_flag = GNG_OC_is_sending_volunteers_OMA
							}
						}
						else_if = {
							limit = {
								tag = OMB
								owns_state = 294 #NOT = { country_exists = OMA }
								owns_state = 914 #NOT = { country_exists = OMI }
							}
							every_owned_state = {
								remove_core_of = OMA
								remove_core_of = OMI
							}
							OMB = { country_event = { id = OMA.8 } }
							set_global_flag = OC_Oman_CW_over
							OIL_OMB_win_oman = yes
							OIL_check_remove_forpol_tab = yes
						}
						else_if = {
							limit = {
								tag = OMI
								owns_state = 294 #NOT = { country_exists = OMA }
								owns_state = 913 #NOT = { country_exists = OMB }
							}
							every_owned_state = {
								remove_core_of = OMA
								remove_core_of = OMB
							}
							OMI = { country_event = { id = OMA.7 } }
							set_global_flag = OC_Oman_CW_over
							OIL_OMI_win_oman = yes
							OIL_check_remove_forpol_tab = yes
							GNG = {
								clr_country_flag = GNG_OC_is_sending_volunteers_OMI
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}
				#Egypt civil war
				else_if = {
					limit = {
						FROM = {
							OR = {
								tag = EGY
								tag = EGB
								tag = EGQ
							}
						}
						ROOT = {
							OR = {
								tag = EGY
								tag = EGB
								tag = EGQ
							}
						}
					}
					ROOT = {
						if = {
							limit = {
								tag = EGY
							}
							GNG = {
								clr_country_flag = GNG_OC_is_sending_volunteers_EGY
							}
						}
						else_if = {
							limit = {
								tag = EGQ
							}
							GNG = {
								clr_country_flag = GNG_OC_is_sending_volunteers_EGQ
							}
						}
					}
					FROM = {
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						if = {
							limit = {
								tag = EGB
								owns_state = 446 #NOT = { country_exists = EGY }
								owns_state = 457 #NOT = { country_exists = EGQ }
							}
							EGB = { country_event = { id = EGY.12 } }
							set_global_flag = OC_Egypt_CW_over
							OIL_EGB_win_egypt = yes
							OIL_check_remove_forpol_tab = yes
						}
						else_if = {
							limit = {
								tag = EGY
								owns_state = 456 #NOT = { country_exists = EGB }
								owns_state = 457 #NOT = { country_exists = EGQ }
								EGQ = { has_country_flag = EGQ_has_spawned }
							}
							EGY = { country_event = { id = EGY.11 } }
							set_global_flag = OC_Egypt_CW_over
							OIL_EGY_win_egypt = yes
							OIL_check_remove_forpol_tab = yes
							GNG = {
								clr_country_flag = GNG_OC_is_sending_volunteers_EGY
							}
						}
						else_if = {
							limit = {
								tag = EGQ
								owns_state = 446 #NOT = { country_exists = EGY }
								owns_state = 456 #NOT = { country_exists = EGB }
							}
							EGQ = { country_event = { id = EGY.13 } }
							set_global_flag = OC_Egypt_CW_over
							OIL_EGQ_win_egypt = yes
							OIL_check_remove_forpol_tab = yes
							GNG = {
								clr_country_flag = GNG_OC_is_sending_volunteers_EGQ
							}
						}
					}
					if = {
						limit = {
							ROOT = { original_tag = EGY }
						}
						ITA = {
							if = {
								limit = {
									has_country_flag = ITA_ciano_wins
								}
								ITA_army_add_borghese_pop = yes
								ITA_airforce_add_borghese_pop = yes
								ITA_navy_add_borghese_pop = yes
								ITA_carabinieri_add_borghese_pop = yes
								set_global_flag = ITA_lost_oil_crisis
							}
							else_if = {
								limit = {
									has_country_flag = ITA_scorza_wins
								}
								ITA_army_add_sogno_pop = yes
								ITA_airforce_add_sogno_pop = yes
								ITA_navy_add_sogno_pop = yes
								ITA_carabinieri_add_sogno_pop = yes
								set_global_flag = ITA_lost_oil_crisis
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}
				#Sudan civil war
				else_if = {
					limit = {
						FROM = {
							OR = {
								tag = RPS
								tag = SDS
								tag = SDF
							}
						}
						ROOT = {
							OR = {
								tag = RPS
								tag = SDS
								tag = SDF
							}
						}
					}
					ROOT = {
						if = {
							limit = {
								tag = SDF
							}
							GNG = {
								clr_country_flag = GNG_OC_is_sending_volunteers_SDF
							}
						}
					}
					FROM = {
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						if = {
							limit = {
								tag = RPS
								owns_state = 1123 #NOT = { country_exists = SDS }
								owns_state = 1128 #NOT = { country_exists = SDF }
							}
							RPS = { country_event = { id = sudan.2 } }
							set_global_flag = OC_Sudan_CW_over
							OIL_RPS_win_sudan = yes
							OIL_check_remove_forpol_tab = yes
						}
						else_if = {
							limit = {
								tag = SDS
								owns_state = 1120 #NOT = { country_exists = RPS }
								owns_state = 1128 #NOT = { country_exists = SDF }
							}
							SDS = { country_event = { id = sudan.3 } }
							set_global_flag = OC_Sudan_CW_over
							OIL_SDS_win_sudan = yes
							OIL_check_remove_forpol_tab = yes
						}
						else_if = {
							limit = {
								tag = SDF
								owns_state = 1120 #NOT = { country_exists = RPS }
								owns_state = 1123 #NOT = { country_exists = SDS }
							}
							SDF = { country_event = { id = sudan.4 } }
							set_global_flag = OC_Sudan_CW_over
							OIL_SDF_win_sudan = yes
							OIL_check_remove_forpol_tab = yes
							GNG = {
								clr_country_flag = GNG_OC_is_sending_volunteers_SDF
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}
				#South Sudan civil war
				else_if = {
					limit = {
						FROM = {
							OR = {
								tag = AZA
								tag = AYA
							}
						}
						ROOT = {
							OR = {
								tag = AZA
								tag = AYA
							}
						}
					}
					clr_global_flag = South_Sudan_CW
					set_global_flag = South_Sudan_CW_over
					FROM = {
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						if = {
							limit = {
								tag = AZA
							}
							AZA = { country_event = { id = sudan.5 } }
						}
						else_if = {
							limit = {
								tag = AYA
							}
							AYA = { country_event = { id = sudan.6 } }
						}
					}
					set_global_flag = skip_default_capitulation
				}
				#Iraq Civil War
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = IRQ
								original_tag = SNI
								original_tag = BIR
								original_tag = KUR
								original_tag = IRP
							}
						}
						ROOT = {
							OR = {
								original_tag = IRQ
								original_tag = SNI
								original_tag = BIR
								original_tag = KUR
								original_tag = IRP
							}
						}
					}
					ROOT = {
						if = {
							limit = {
								tag = IRQ
							}
							GNG = {
								clr_country_flag = GNG_OC_is_sending_volunteers_IRQ
							}
						}
						else_if = {
							limit = {
								tag = SNI
							}
							GNG = {
								clr_country_flag = GNG_OC_is_sending_volunteers_SNI
							}
						}
					}
					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
					}
					remove_from_array = { global.IRQ_contenders = ROOT }
					if = {
						limit = {
							check_variable = { global.IRQ_contenders^num = 1 }
						}
						clear_array = global.IRQ_contenders

						set_global_flag = OC_Iraq_CW_over
						OIL_check_remove_forpol_tab = yes

						FROM = {
							if = {
								limit = { original_tag = KUR }
								KUR = { country_event = { id = IraqCW.13 } }
								OIL_KUR_win_iraq = yes
							}
							else_if = {
								limit = { original_tag = IRQ }
								IRQ = { country_event = { id = IraqCW.10 } }
								OIL_IRQ_win_iraq = yes
								GNG = {
									clr_country_flag = GNG_OC_is_sending_volunteers_IRQ
								}
							}
							else_if = {
								limit = { original_tag = IRP }
								IRP = { country_event = { id = IraqCW.11 } }
								OIL_IRP_win_iraq = yes
							}
							else_if = {
								limit = { original_tag = BIR }
								BIR = { country_event = { id = IraqCW.9 } }
								OIL_BIR_win_iraq = yes
							}
							else_if = {
								limit = { original_tag = SNI }
								SNI = { country_event = { id = IraqCW.12 } }
								OIL_SNI_win_iraq = yes
								GNG = {
									clr_country_flag = GNG_OC_is_sending_volunteers_SNI
								}
							}
						}
					}
					if = {
						limit = {
							ROOT = { original_tag = IRQ }
						}
						ITA = {
							if = {
								limit = {
									has_country_flag = ITA_ciano_wins
								}
								ITA_army_add_borghese_pop = yes
								ITA_airforce_add_borghese_pop = yes
								ITA_navy_add_borghese_pop = yes
								ITA_carabinieri_add_borghese_pop = yes
								set_global_flag = ITA_lost_oil_crisis
							}
							else_if = {
								limit = {
									has_country_flag = ITA_scorza_wins
								}
								ITA_army_add_sogno_pop = yes
								ITA_airforce_add_sogno_pop = yes
								ITA_navy_add_sogno_pop = yes
								ITA_carabinieri_add_sogno_pop = yes
								set_global_flag = ITA_lost_oil_crisis
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#Iranian Civil War (added Walker added this so he could get a Burgundy thing working)
				else_if = {
					limit = {
						FROM = {
							OR = {
								tag = PER
								tag = IRL
								tag = IRC
								tag = IRB
								tag = IRA
								tag = IRI
							}
						}
						ROOT = {
							OR = {
								tag = PER
								tag = IRL
								tag = IRC
								tag = IRB
								tag = IRA
								tag = IRI
							}
						}
					}
					FROM = {
						every_enemy_country = {
							limit = {
								OR = {
									original_tag = ROOT
									is_in_faction_with = ROOT
								}
							}
							remove_from_array = { global.PER_contenders = THIS }
							FROM = {
								white_peace = PREV
								annex_country = {
									target = PREV
									transfer_troops = no
								}
							}
						}

						if = {
							limit = {
								check_variable = { global.PER_contenders^num = 1 }
							}
							clear_array = global.PER_contenders

							if = {
								limit = { country_exists = PER }
								GER = { country_event = { id = reich_shared.20 days = 2 } }
								news_event = { id = WORLD.18009 days = 1 }
								JAP = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -150 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								GER = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 4 }
									set_temp_variable = { Victory_Points = 150 }
									Cold_War_GUI_ManipulateVictory = yes
									set_temp_variable = { SeaZone_ID = 6 } # 6; Indian Ocean
									Cold_War_GUI_PowerProjection_AddSeaZone = yes
								}
								USA = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -150 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								every_owned_state = {
									add_core_of = FROM
									remove_core_of = IRL
									remove_core_of = IRI
									remove_core_of = IRC
									remove_core_of = IRB
									remove_core_of = IRA
								}
							}
							else_if = {
								limit = { country_exists = IRL }
								USA = { country_event = USA_IR.7 }
								news_event = { id = WORLD.18010 days = 1 }
								GER = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -150 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								USA = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 4 }
									set_temp_variable = { Victory_Points = 150 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								JAP = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -150 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								every_owned_state = {
									add_core_of = FROM
									remove_core_of = PER
									remove_core_of = IRI
									remove_core_of = IRC
									remove_core_of = IRB
									remove_core_of = IRA
								}
							}
							else_if = {
								limit = { country_exists = IRI }
								JAP = { country_event = jap_fopo.3 }
								news_event = { id = WORLD.18014 days = 1 }
								GER = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -150 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								JAP = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 4 }
									set_temp_variable = { Victory_Points = 150 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								USA = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -150 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								every_owned_state = {
									add_core_of = FROM
									remove_core_of = PER
									remove_core_of = IRL
									remove_core_of = IRC
									remove_core_of = IRB
									remove_core_of = IRA
								}
							}
							else_if = {
								limit = { country_exists = IRC }
								news_event = { id = WORLD.18011 days = 1 }
								GER = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -100 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								JAP = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -100 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								USA = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -100 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								every_owned_state = {
									add_core_of = FROM
									remove_core_of = PER
									remove_core_of = IRL
									remove_core_of = IRI
									remove_core_of = IRB
									remove_core_of = IRA
								}
							}
							else_if = {
								limit = { country_exists = IRA }
								news_event = { id = WORLD.18013 days = 1 }
								GER = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -100 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								JAP = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -100 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								USA = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -100 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								every_owned_state = {
									add_core_of = FROM
									remove_core_of = PER
									remove_core_of = IRL
									remove_core_of = IRI
									remove_core_of = IRC
									remove_core_of = IRB
								}
							}
							else_if = {
								limit = { country_exists = IRB }
								news_event = { id = WORLD.18012 days = 1 }
								GER = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -100 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								JAP = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -100 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								USA = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -100 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								every_owned_state = {
									add_core_of = FROM
									remove_core_of = PER
									remove_core_of = IRL
									remove_core_of = IRI
									remove_core_of = IRC
									remove_core_of = IRA
								}
							}
							remove_ideas = PER_The_Iranian_Civil_War
							FROM = {
								set_capital = { state = 266 remember_old_capital = no }
							}
						}
						else_if = {
							limit = {
								check_variable = { global.PER_contenders^num = 2 }
								IRB = {
									exists = yes
									has_war = no
								}
								has_global_flag = TNO_IRA_collapsed_coalition
							}
							clear_array = global.PER_contenders

							if = {
								limit = { country_exists = IRL }
								USA = { country_event = USA_IR.7 }
								news_event = { id = WORLD.18010 days = 1 }
								GER = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -150 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								USA = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 4 }
									set_temp_variable = { Victory_Points = 150 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								JAP = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -150 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								every_owned_state = {
									add_core_of = FROM
									remove_core_of = PER
									remove_core_of = IRI
									remove_core_of = IRC
									remove_core_of = IRB
									remove_core_of = IRA
								}
							}
							else_if = {
								limit = { country_exists = IRC }
								news_event = { id = WORLD.18011 days = 1 }
								GER = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -100 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								JAP = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -100 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								USA = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -100 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								every_owned_state = {
									add_core_of = FROM
									remove_core_of = PER
									remove_core_of = IRL
									remove_core_of = IRI
									remove_core_of = IRB
									remove_core_of = IRA
								}
							}
							else_if = {
								limit = { country_exists = IRA }
								news_event = { id = WORLD.18013 days = 1 }
								GER = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -100 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								JAP = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -100 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								USA = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -100 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								every_owned_state = {
									add_core_of = FROM
									remove_core_of = PER
									remove_core_of = IRL
									remove_core_of = IRI
									remove_core_of = IRC
									remove_core_of = IRB
								}
							}
							else_if = {
								limit = { country_exists = IRI }
								JAP = { country_event = jap_fopo.3 }
								news_event = { id = WORLD.18014 days = 1 }
								GER = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -150 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								JAP = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 4 }
									set_temp_variable = { Victory_Points = 150 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								USA = {
									set_temp_variable = { Victory_ID = 12 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -150 }
									Cold_War_GUI_ManipulateVictory = yes
								}
								every_owned_state = {
									add_core_of = FROM
									remove_core_of = PER
									remove_core_of = IRL
									remove_core_of = IRC
									remove_core_of = IRB
									remove_core_of = IRA
								}
							}
							every_owned_state = {
								add_core_of = FROM
							}
							remove_ideas = PER_The_Iranian_Civil_War
							IRB = { remove_ideas = PER_The_Iranian_Civil_War }
							FROM = {
								set_capital = { state = 266 remember_old_capital = no }
							}
						}
					}

					# Loss events for superpowers, all fire_only_once, country exists triggers for if Persia crushes RILF before faction collapses
					if = { # USA Loses
						limit = { NOT = { country_exists = IRL } }
						USA = { country_event = USA_IR.6 }
					}
					if = { # JAP Loses
						limit = { NOT = { country_exists = IRI } }
						JAP = { country_event = jap_fopo.2 }
					}
					if = { # GER Loses
						limit = { NOT = { country_exists = PER } }
						GER = { country_event = { id = reich_shared.21 } }
					}

					set_global_flag = skip_default_capitulation
				}
				#War with Croatia
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = ITA
								is_in_faction_with = ITA
							}
						}
						ROOT = { original_tag = CRO }
					}
					CRO = {
						white_peace = ITA
						country_event = { id = cro.2 }
						set_variable = { CRO_ITA_Influence = 200 }
					}
					set_global_flag = skip_default_capitulation
				}
				#Greek Negotiations go to shit
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = ITA
								is_in_faction_with = ITA
								is_subject_of = ITA
							}
						}
						ROOT = { original_tag = GRE }
						NOT = {
							has_global_flag = EAM_Liberation_War
						}
					}
					ITA = {
						white_peace = GRE
						GRE = { save_party_popularities = yes }
						set_autonomy = {
							target = GRE
							autonomy_state = autonomy_italy_reliant
						}
						GRE = {
							apply_party_popularities = yes
							country_event = greece_path.6
							set_variable = { GRE_ITA_Influence = 200 }
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#EAM Liberation War - Total Greek Victory
				else_if = {
					limit = {
						FROM = {
							original_tag = GRE
						}
						ROOT = {
							original_tag = ITA
						}
						has_global_flag = EAM_Liberation_War
					}
					GRE = {
						white_peace = ITA
					}
					GRE = {
						every_country = {
							limit = { is_ai = no }
							news_event = { id = WORLD_GRE.1 days = 5 }
						}
						country_event = { id = greEAMWar.3 days = 7 }
						if = {
							limit = {
								NOT = {
									owns_state = 1264
								}
							}
							transfer_state = 1264
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#EAM Liberation War - Total Italian Victory
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = ITA
								is_subject_of = ITA
								is_in_faction_with = ITA
							}
						}
						ROOT = {
							original_tag = GRE
						}
						has_global_flag = EAM_Liberation_War
					}
					ITA = {
						white_peace = GRE
						GRE = {
							country_event = { id = greEAMWar.5 }
							set_variable = { GRE_ITA_Influence = 200 }
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#Scorza Middle East Funnies
				#Syria
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = ITA
								is_in_faction_with = ITA
							}
						}
						ROOT = {
							OR = {
								tag = SYR
								is_in_faction_with = SYR
							}
						}
					}
					for_each_scope_loop = {
						array = SYR.faction_members
						if = {
							limit = { NOT = { tag = SYR } }
							SYR = {
								annex_country = {
									target = PREV
									transfer_troops = no
								}
							}
						}
					}
					ITA = {
						white_peace = SYR
						puppet = SYR
					}
					SYR = {
						set_cosmetic_tag = ITA_middle_east_government

						promote_character = SYR_Italo_Balbo_Ruler_Of_Arabia

						set_politics = { ruling_party = despotism }
						set_popularities = {
							communist = 11
							socialist = 22
							anocracy = 7
							despotism = 13
							fascism = 37
							ultranationalism = 10
						}
						set_party_name = {
							ideology = despotism
							long_name = SAU_ITA_despotism_long
							name = SAU_ITA_despotism
						}
						set_party_name = {
							ideology = fascism
							long_name = SAU_ITA_despotism_long
							name = SAU_ITA_despotism
						}
						econ_join_sphere_ITA = yes
						set_temp_variable = { TNO_economy_type_temp = token:Econ_Type_Corporatism }
						econ_type_change = yes
					}
					set_global_flag = skip_default_capitulation
				}
				#Saudis
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = ITA
								is_in_faction_with = ITA
								is_subject_of = ITA
							}
						}
						ROOT = {
							OR = {
								tag = SAU
								is_in_faction_with = SAU
								is_subject_of = SAU
							}
						}
					}
					if = {
						limit = {
							YEM = {
								is_subject_of = SAU
							}
						}
						SAU = {
							annex_country = {
								target = YEM
								transfer_troops = no
							}
						}
					}
					if = {
						limit = {
							GUL = {
								is_subject_of = SAU
							}
						}
						SAU = {
							annex_country = {
								target = GUL
								transfer_troops = no
							}
						}
					}
					ITA = {
						white_peace = SAU
						set_autonomy = {
							target = SAU
							autonomy_state = autonomy_italy_governate
						}
					}
					SAU = {
						set_cosmetic_tag = ITA_middle_east_government_saudis

						promote_character = SAU_Italo_Balbo_Ruler_Of_Arabia

						set_politics = { ruling_party = despotism }
						set_popularities = {
							communist = 7
							socialist = 14
							anocracy = 4
							despotism = 13
							fascism = 37
							ultranationalism = 25
						}
						set_party_name = {
							ideology = despotism
							long_name = SAU_ITA_despotism_long
							name = SAU_ITA_despotism
						}
						set_party_name = {
							ideology = fascism
							long_name = SAU_ITA_despotism_long
							name = SAU_ITA_despotism
						}
						econ_join_sphere_ITA = yes
						set_temp_variable = { TNO_economy_type_temp = token:Econ_Type_Corporatism }
						econ_type_change = yes
					}
					set_global_flag = skip_default_capitulation
				}

				#Correntian War
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = ERT
								original_tag = SML
								original_tag = KEN
							}
						}
						ROOT = {
							original_tag = COR
						}
					}

					FROM = {
						white_peace = ROOT
						country_event = { id = IEA.124 }
					}
					set_global_flag = skip_default_capitulation
				}

				#Black Lions - Oromo War: Oromo Victory
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = ORM
								original_tag = ITA
								is_in_faction_with = ITA
							}
						}
						ROOT = {
							original_tag = ETB
						}
					}
					if = {
						limit = {
							ITA = {
								has_war_with = ROOT
							}
						}
						ITA = {
							white_peace = ROOT
							annex_country = {
								target = ROOT
								transfer_troops = no
							}
						}
					}
					else = {
						FROM = {
							white_peace = ROOT
							country_event = { id = IEA.125 }
						}
					}
					set_global_flag = skip_default_capitulation
				}
				#Black Lions - Oromo War: Bl Victory
				else_if = {
					limit = {
						FROM = {
							original_tag = ETB
						}
						ROOT = {
							original_tag = ORM
						}
					}

					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
					}
					set_global_flag = skip_default_capitulation
					every_owned_state = {
						hidden_effect = {
							add_core_of = FROM
							add_core_of = ROOT
						}
					}
				}
				#Oromo Uprising - EAMA defeated
				else_if = {
					limit = {
						FROM = {
							original_tag = ORM
						}
						ROOT = {
							original_tag = EAM
						}
					}

					FROM = {
						white_peace = ROOT
						country_event = { id = IEA.125 }
					}
					set_global_flag = skip_default_capitulation
					every_owned_state = {
						hidden_effect = {
							add_core_of = FROM
							add_core_of = ROOT
						}
					}
				}

				else_if = { ##Northern Ireland War
					limit = {
						FROM = {
							OR = {
								original_tag = IRE
								is_in_faction_with = IRE
							}
						}
						ROOT = { original_tag = ULS }
					}
					IRE = {
						white_peace = ROOT
						annex_country = { target = ROOT transfer_troops = no }
					}
					if = { # UVF
						limit = {
							IRE = { has_country_flag = IRE_UVF_uprising }
						}
						IRE = {
							clr_country_flag = IRE_UVF_uprising
							remove_ideas = IRE_irish_defense_forces
							country_event = {
								id = IRE_crisis.41
							}
						}
					}
					else_if = { # IRA
						limit = {
							IRE = { has_country_flag = IRE_IRA_war }
						}
						IRE = {
							clr_country_flag = IRE_IRA_war
							country_event = {
								id = IRE_crisis.43
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = { ##Northern Ireland War
					limit = {
						FROM = { original_tag = ULS }
						ROOT = { original_tag = IRE }
					}
					IRE = {
						white_peace = ROOT
					}
					if = { # UVF
						limit = {
							IRE = { has_country_flag = IRE_UVF_uprising }
						}
						IRE = {
							remove_ideas = IRE_irish_defense_forces
							add_days_mission_timeout = {
								mission = IRE_crush_the_UVF
								days = -60
							}
						}
					}
					else_if = { # IRA
						limit = {
							IRE = { has_country_flag = IRE_IRA_war }
						}
						IRE = {
							add_days_mission_timeout = {
								mission = IRE_crush_the_IRA
								days = -60
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}
				#South African War
				#OFN Loss
				else_if = {
					limit = {
						ROOT = { original_tag = SAF }
						OR = {
							FROM = { original_tag = COG }
							FROM = { original_tag = GRO }
							FROM = { original_tag = ANG }
							FROM = { original_tag = BOR }
						}
						MZB = {
							NOT = { has_cosmetic_tag = MZB_USA }
						}
						USC = { exists = no }
						has_global_flag = south_african_war_happening
						NOT = { has_global_flag = second_south_african_civil_war }
					}
					ZZZ = { set_cosmetic_tag = SAF }
					every_country = {
						limit = {
							is_ai = no
							NOT = { has_country_flag = diplomatic_alerts_disabled }
						}
						ZZZ = { save_global_event_target_as = losing_country }
					}
					GRO = {
						white_peace = SAF
						country_event = { id = SAFWAR.9 } #Distributes the territory
					}
					COG = {
						white_peace = SAF
						country_event = { id = SAFWAR.10 }
					}
					ANG = {
						white_peace = SAF
						country_event = { id = SAFWAR.11 }
					}
					BOR = {
						white_peace = SAF
						country_event = { id = SAFWAR.12 }
					}
					set_global_flag = skip_default_capitulation
				}
				#OFN Victory Moved Due To Faction Funnies
				#Schenck's Free Angola
				else_if = {
					limit = {
						has_global_flag = ANG_Free
						ROOT = { original_tag = ANG }
						OR = {
							FROM = { original_tag = COG }
							FROM = { original_tag = GRO }
							FROM = { original_tag = SAF }
							FROM = { original_tag = BOR }
						}
					}
					ANG = {
						white_peace = COG
						white_peace = GRO
						white_peace = SAF
						white_peace = BOR
						every_owned_state = {
							controller = {
								transfer_state = PREV
							}
						}
					}

					set_global_flag = skip_default_capitulation
				}
				#OFN Victory - Why the fuck does the on_capitulation action work here?????????? will it when pushed???? we'll find out
				else_if = {
					limit = {
						ROOT = {
							OR = {
								original_tag = GRO
								original_tag = ANG
								original_tag = COG
								original_tag = BOR
							}
						}
						FROM = {
							tag = SAF
						}
						has_global_flag = south_african_war_happening
					}
					SAF = {
						country_event = { id = SAFWAR.13 }
					}
					ZZZ = {
						meta_effect = {
							text = { set_cosmetic_tag = "[TAG]_GER" }
							TAG = "[ROOT.GetTag]"
						}
					}
					every_country = {
						limit = {
							is_ai = no
							NOT = { has_country_flag = diplomatic_alerts_disabled }
						}
						ZZZ = { save_global_event_target_as = losing_country }
						add_to_variable = { peace_popup_dirty = 1 }
					}
					set_global_flag = skip_default_capitulation
				}
				#Schenck's Free Angola
				else_if = {
					limit = {
						has_global_flag = ANG_Free
						ROOT = { original_tag = ANG }
						OR = {
							FROM = { original_tag = COG }
							FROM = { original_tag = GRO }
							FROM = { original_tag = SAF }
							FROM = { original_tag = BOR }
						}
					}
					ANG = {
						white_peace = COG
						white_peace = GRO
						white_peace = SAF
						white_peace = BOR
						every_owned_state = {
							controller = {
								transfer_state = PREV
							}
						}
					}

					set_global_flag = skip_default_capitulation
				}
				# Sam's Free Namibia
				else_if = {
					limit = {
						NAM = {
							has_country_leader = {
								character = NAM_Sam_Nujoma
								ruling_only = yes
							}
						}
						ROOT = { original_tag = NAM }
						OR = {
							FROM = { original_tag = COG }
							FROM = { original_tag = GRO }
							FROM = { original_tag = SAF }
							FROM = { original_tag = BOR }
						}
					}
					NAM = {
						white_peace = COG
						white_peace = GRO
						white_peace = SAF
						white_peace = BOR
						econ_join_sphere_USA = yes
					}
					USA = {
						add_to_faction = NAM
					}
					set_global_flag = skip_default_capitulation
				}
				# Schenck's Free Namibia
				else_if = {
					limit = {
						has_global_flag = ANG_Free
						ROOT = { original_tag = NAM }
						OR = {
							FROM = { original_tag = COG }
							FROM = { original_tag = GRO }
							FROM = { original_tag = SAF }
							FROM = { original_tag = BOR }
						}
					}
					NAM = {
						white_peace = COG
						white_peace = GRO
						white_peace = SAF
						white_peace = BOR
						every_owned_state = {
							controller = {
								transfer_state = PREV
							}
						}
					}
					ANG = {
						annex_country = {
							target = NAM
							transfer_troops = no
						}
					}
					set_global_flag = skip_default_capitulation
				}
				#Westmoreland's defeat (African Crisis)
				else_if = {
					limit = {
						ROOT = {
							original_tag = USC
						}
						OR = {
							FROM = { original_tag = GAB }
							FROM = { original_tag = CAF }
							FROM = { original_tag = CFS }
							FROM = { original_tag = KTG }
							FROM = { original_tag = ANG }
							FROM = { original_tag = GAZ }
							FROM = { original_tag = RMB }
							FROM = { original_tag = BRD }
							FROM = { original_tag = RWA }
							FROM = { original_tag = UGD }
							FROM = { original_tag = TNZ }
							FROM = { original_tag = LUO }
						}
					}
					USC = {
						USA_AFRICA_liberate_africa = yes
					}

					set_global_flag = skip_default_capitulation
				}
				#Second South African Civil War - Boers defeat SA
				else_if = {
					limit = {
						FROM = {
							original_tag = BOR
						}
						ROOT = { original_tag = SAF }
						has_global_flag = second_south_african_civil_war
					}
					BOR = {
						annex_country = {
							target = SAF
							transfer_troops = no
						}
					}
					set_global_flag = skip_default_capitulation
				}

				else_if = { #Angolan Civil War
					limit = {
						FROM = {
							OR = {
								tag = ANG
								tag = ANL
							}
							NOT = { has_war_with = GER }
						}
						ROOT = {
							OR = {
								tag = ANG
								tag = ANL
							}
							NOT = { has_war_with = GER }
						}
					}
					FROM = {
						every_state = {
							limit = { has_state_flag = angola_civil_war_please_dont_end_instantly_flag }
							add_core_of = FROM
							remove_core_of = ROOT
							remove_province_modifier = {
								static_modifiers = { angola_civil_war_please_dont_end_instantly }
								province = { all_provinces = yes }
							}
							clr_state_flag = angola_civil_war_please_dont_end_instantly_flag
						}
						USA = {
							set_temp_variable = { target = ANG }
							TNO_clear_num_volunteers = yes
							TNO_fopo_remove_angola_civil_war_tab = yes
						}
						JAP = {
							set_temp_variable = { target = ANL }
							TNO_clear_num_volunteers = yes
							TNO_fopo_remove_angola_civil_war_tab = yes
						}
						drop_cosmetic_tag = yes
						if = {
							limit = { original_tag = ANG }
							USA = { country_event = { id = ANG_PW.1 days = 1 } }
						}
						else = {
							JAP = { country_event = { id = ANG_PW.2 days = 1 } }
						}
					}
				}
				
				else_if = { # Pan-African Revolution in Namibia
					limit = {
						FROM = {
							OR = {
								tag = OVB
								tag = NAM
							}
							NOT = { has_war_with = GER }
						}
						ROOT = {
							OR = {
								tag = OVB
								tag = NAM
							}
							NOT = { has_war_with = GER }
						}
					}
					FROM = {
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						if = {
							limit = {
								tag = OVB
							}
							OVB = { country_event = { id = A_SPRING.18 } }
						}
						else_if = {
							limit = {
								tag = NAM
							}
							NAM = {
								every_state = {
									limit = {
										is_core_of = OVB
									}
									add_core_of = NAM
									remove_core_of = OVB
								}
							}
						}
						set_global_flag = skip_default_capitulation
					}
				}
				else_if = { # Tanganyika reclamation of the coast
					limit = {
						FROM = {
							OR = {
								tag = TNZ
								tag = ZZB
							}
							NOT = { has_war_with = GER }
						}
						ROOT = {
							OR = {
								tag = TNZ
								tag = ZZB
							}
							NOT = { has_war_with = GER }
						}
					}
					FROM = {
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						if = {
							limit = {
								tag = TNZ
							}
							TNZ = { country_event = { id = A_SPRING.32 } }
						}
						else_if = {
							limit = {
								tag = ZZB
							}
							ZZB = {
								every_state = {
									limit = {
										is_core_of = TNZ
									}
									add_core_of = ZZB
								}
							}
						}
						set_global_flag = skip_default_capitulation
					}
				}
				else_if = { # Zimbabwe invasion Botswana
					limit = {
						FROM = {
							OR = {
								tag = ZIM
								tag = BTS
							}
						}
						ROOT = {
							OR = {
								tag = ZIM
								tag = BTS
							}
						}
					}
					FROM = {
						white_peace = ROOT
						if = {
							limit = {
								tag = BTS
							}
							BTS = { country_event = { id = A_SPRING.28 } }
						}
						set_global_flag = skip_default_capitulation
					}
				}
				#Central African Mandate (Finally)
				else_if = {
					limit = {
						ROOT = {
							tag = USC
						}
					}
					every_country = {
						limit = { has_war_with = USC }
						white_peace = USC
					}
					MZB = {
						annex_country = {
							target = USC
							transfer_troops = no
						}
						every_state = {
							limit = { is_core_of = USC }
							remove_core_of = USC
						}
						set_global_flag = skip_default_capitulation
					}
				}
				else_if = { #Mozambican Civil War
					limit = {
						FROM = {
							OR = {
								tag = GAZ
								tag = GZO
								tag = GZS
							}
							NOT = { has_war_with = GER }
						}
						ROOT = {
							OR = {
								tag = GAZ
								tag = GZO
								tag = GZS
							}
							NOT = { has_war_with = GER }
						}
					}
					white_peace = ROOT
					FROM = {
						every_state = {
							limit = {
								is_core_of = ROOT
							}
							add_core_of = FROM
							remove_core_of = ROOT
						}
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
					}
					if = {
						limit = {
							NOT = {
								count_triggers = {
									amount = 2 #This checks if >=2, not ==2... thanks pdx
									country_exists = GZO
									country_exists = GAZ
									country_exists = GZS
								}
							}
						}
						FROM = {
							if = {
								limit = {
									tag = GZO
								}
								USA = {
									if = {
										limit = { has_country_flag = US_aid_mozambique_mondlane }
										country_event = { id = GAZ.4 days = 1 }
										JAP = { country_event = { id = GAZ.5 days = 1 } }
										news_event = { id = WORLD.18145 days = 1 }
									}
									else = {
										country_event = { id = GAZ.6 days = 1 }
										JAP = { country_event = { id = GAZ.7 days = 1 } }
									}
								}
							}
							else_if = {
								limit = { tag = GZS } #No need to check for flag since GZS only exists if US backs em
								USA = {
									country_event = { id = GAZ.8 days = 1 }
								}
								JAP = {
									country_event = { id = GAZ.9 days = 1 }
									news_event = { id = WORLD.18146 days = 1 }
								}
							}
							else = {
								JAP = { country_event = { id = GAZ.10 days = 1 } }
								USA = { country_event = { id = GAZ.11 days = 1 } }
								news_event = { id = WORLD.18144 days = 1 }
							}
							every_owned_state = { add_core_of = FROM }
							clr_global_flag = mozambique_civil_war_active
						}
						USA = {
							if = {
								limit = { has_country_flag = US_aid_mozambique_mondlane }
								set_temp_variable = { target = GZO }
								TNO_clear_num_volunteers = yes
							}
							else = {
								set_temp_variable = { target = GZS }
								TNO_clear_num_volunteers = yes
							}
						}
						JAP = {
							set_temp_variable = { target = GAZ }
							TNO_clear_num_volunteers = yes
						}
					}
					set_global_flag = skip_default_capitulation
				}

				##################### Congo PW Shenanigans ###########################
				else_if = {
					limit = {
						has_global_flag = CONGO_PW_HAPPENING
						FROM = {
							OR = {
								original_tag = CFS
								original_tag = CPR
								original_tag = AZD
								original_tag = KTG
								original_tag = GRO
								original_tag = COG
								original_tag = KSI
							}
							NOT = { has_war_with = GER }
						}
						ROOT = {
							OR = {
								original_tag = CFS
								original_tag = CPR
								original_tag = AZD
								original_tag = KTG
								original_tag = GRO
								original_tag = COG
								original_tag = KSI
							}
							NOT = { has_war_with = GER }
						}
					}
					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
					}
					if = {
						limit = {
							ROOT = { tag = AZD }
						}
						TNO_CCW_JAP_Faction_Gone = yes
					}
					if = {
						limit = {
							ROOT = { tag = GRO }
						}
						TNO_CCW_GER_Faction_Gone = yes
					}
					if = {
						limit = {
							OR = {
								AND = {
									USA = { has_country_flag = US_aid_CFS }
									ROOT = { tag = CFS }
								}
								AND = {
									USA = { has_country_flag = US_aid_COG }
									ROOT = { tag = COG }
								}
							}
						}
						TNO_CCW_USA_Faction_Gone = yes
					}

					## Congolese Republic got the number one victory royale
					if = {
						limit = {
							country_exists = CFS
							NOT = {
								country_exists = CPR
								country_exists = KTG
								country_exists = KSI
								country_exists = AZD
								AND = {
									has_global_flag = COG_PW_GRO_or_COG_in
									OR = {
										country_exists = GRO
										country_exists = COG
									}
								}
							}
						}
						if = {
							limit = {
								USA = { has_country_flag = US_aid_CFS }
							}
							USA = {
								country_event = {
									id = COG_PW.3
									days = 5
								}
							}
						}
						else = {
							CFS = {
								country_event = {
									id = COG_PW.13
									days = 5
								}
							}
							USA = {
								country_event = {
									id = COG_PW.99
									days = 5
								}
							}
						}
					}
					else_if = { ## Azandeland got the number one victory royale
						limit = {
							country_exists = AZD
							NOT = {
								country_exists = CFS
								country_exists = KTG
								country_exists = KSI
								country_exists = CPR
								AND = {
									has_global_flag = COG_PW_GRO_or_COG_in
									OR = {
										country_exists = GRO
										country_exists = COG
									}
								}
							}
						}
						JAP = {
							country_event = {
								id = COG_PW.9
								days = 5
							}
							set_temp_variable = { SeaZone_ID = 2 } # 2; South Atlantic
							Cold_War_GUI_PowerProjection_AddSeaZone = yes
							diplomatic_relation = {
								country = AZD
								relation = docking_rights
								active = yes
							}
						}
						USA = {
							country_event = {
								id = COG_PW.99
								days = 5
							}
						}
					}
					else_if = { # Congolese Popular Republic got the number one victory royale
						limit = {
							country_exists = CPR
							NOT = {
								country_exists = CFS
								country_exists = KTG
								country_exists = KSI
								country_exists = AZD
								AND = {
									has_global_flag = COG_PW_GRO_or_COG_in
									OR = {
										country_exists = GRO
										country_exists = COG
									}
								}
							}
						}
						CPR = {
							country_event = {
								id = COG_PW.4
								days = 5
							}
						}
						USA = {
							country_event = {
								id = COG_PW.99
								days = 5
							}
						}
					}
					else_if = { #Abwehrfront Wins
						limit = {
							country_exists = GRO
							has_global_flag = COG_PW_GRO_or_COG_in
							NOT = {
								GRO = { has_country_flag = GRO_cabal_victorious }
							}
							NOT = {
								country_exists = CFS
								country_exists = CPR
								country_exists = KTG
								country_exists = KSI
								country_exists = AZD
								country_exists = COG
							}
						}
						GRO = {
							remove_ideas = {
								GRO_REICHSSTAAT_exhausted_remnants
								GRO_REICHSSTAAT_the_abwehrfront_under_threats
								GRO_REICHSSTAAT_collapsed_oberkommando
							}
						}
								
						GER = {
							country_event = {
								id = COG_PW.5
								days = 5
							}
						}
						USA = {
							country_event = {
								id = COG_PW.99
								days = 5
							}
						}
					}
					else_if = { #Cabal Wins
						limit = {
							country_exists = GRO
							has_global_flag = COG_PW_GRO_or_COG_in
							GRO = { has_country_flag = GRO_cabal_victorious }
							NOT = {
								country_exists = CFS
								country_exists = CPR
								country_exists = KTG
								country_exists = KSI
								country_exists = AZD
								country_exists = COG
							}
						}
						GRO = {
							remove_ideas = {
								GRO_REICHSSTAAT_exhausted_remnants
								GRO_REICHSSTAAT_the_abwehrfront_under_threats
								GRO_REICHSSTAAT_collapsed_oberkommando
							}
						}
						GER = {
							country_event = {
								id = COG_PW.6
								days = 5
							}
						}
						USA = {
							country_event = {
								id = COG_PW.99
								days = 5
							}
						}
					}
					else_if = {
						limit = {
							country_exists = KTG
							NOT = {
								country_exists = CFS
								country_exists = CPR
								country_exists = AZD
								AND = {
									has_global_flag = COG_PW_GRO_or_COG_in
									OR = {
										country_exists = GRO
										country_exists = COG
									}
								}
							}
						}
						KTG = {
							country_event = {
								id = COG_PW.7
								days = 5
							}
						}
						USA = {
							country_event = {
								id = COG_PW.99
								days = 5
							}
						}
					}
					else_if = {
						limit = {
							country_exists = KSI
							NOT = {
								country_exists = CFS
								country_exists = CPR
								country_exists = KTG
								country_exists = AZD
								AND = {
									has_global_flag = COG_PW_GRO_or_COG_in
									OR = {
										country_exists = GRO
										country_exists = COG
									}
								}
							}
						}
						KSI = {
							country_event = {
								id = COG_PW.8
								days = 5
							}
						}
						USA = {
							country_event = {
								id = COG_PW.99
								days = 5
							}
						}
					}
					else_if = { #OFN Mandate Collapse remnant wins
						limit = {
							country_exists = COG
							has_global_flag = COG_PW_GRO_or_COG_in
							has_global_flag = SAF_OFN_Victory
							NOT = {
								country_exists = CFS
								country_exists = CPR
								country_exists = KTG
								country_exists = KSI
								country_exists = AZD
								country_exists = GRO
							}
						}
						USA = {
							country_event = {
								id = COG_PW.10
								days = 5
							}
						}
						COG = {
							clr_country_flag = OFN_COG_Congo_Crisis_flag
						}
						clr_global_flag = congo_mandate_collapsed
					}
					else_if = { # CAF beats AZD
						limit = {
							country_exists = CAF
							NOT = {
								country_exists = AZD
							}
						}
						CAF = {
							annex_country = {
								target = AZD
								transfer_troops = no
							}
						}
						clr_global_flag = congo_PW_CAF_joined
					}
					else_if = { # AZD beats CAF
						limit = {
							country_exists = AZD
							NOT = {
								country_exists = CAF
							}
						}
						CAF = {
							white_peace = AZD
						}
						clr_global_flag = congo_PW_CAF_joined
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = { # CAF beats CPR
					limit = {
						FROM = {
							original_tag = CAF
						}
						ROOT = { original_tag = CPR }
					}
					CAF = {
						white_peace = CPR
						add_state_core = 1182
						add_state_core = 1183
						add_state_core = 1185
						transfer_state = 1182
						transfer_state = 1183
						transfer_state = 1185
						hidden_effect = {
							ROOT = {
								every_owned_state = {
									remove_core_of = GRO
									remove_core_of = COG
									remove_core_of = CFS
									remove_core_of = CPR
									remove_core_of = AZD
									remove_core_of = KTG
									remove_core_of = KSI
									add_core_of = PREV
								}
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = { # CPR beats CAF
					limit = {
						FROM = {
							original_tag = CPR
						}
						ROOT = { original_tag = CAF }
					}
					CPR = {
						country_event = {
							id = COG_PW.19
						}
					}
					set_global_flag = skip_default_capitulation
				}
				
				#################################################
				##=|           Germany Peace Deals           |=##
				##======================| |====================##
				#################################################

				#Germany defeats Communist Serbia
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = GER
								is_in_faction_with = GER
							}
						}
						ROOT = { original_tag = SER }
						NOT = { has_global_flag = german_civil_war_goeringvic }
					}
					FROM = {
						white_peace = ROOT
						GER = {
							set_autonomy = {
								target = SER
								autonomy_state = autonomy_collaborator_puppet_state
							}
						}
					}
					SER = {
						set_politics = {
							ruling_party = fascism
						}
						set_popularities = {
							communist = 21
							socialist = 9
							anocracy = 13
							despotism = 14
							fascism = 29
							national_socialism = 14
						}
						set_party_name = {
							ideology = fascism
							long_name = SER_fascism_party_jonic_long
							name = SER_fascism_party_jonic
						}
						promote_character = {
							character = SER_Borivoje_Jonic
							ideology = fascism_eccliastical_nationalism_subtype
						}
						set_cosmetic_tag = SER_GER
						remove_ideas = {
							SER_A_Divided_Front
							SER_Death_To_Fascism_Freedom_To_The_People
							SER_Milos_against_Murad
							SER_Rebirth_of_a_Nation
						}
						add_ideas = {
							SER_Zealots_Conservatives_and_Conformists
							SER_majka_srbija
							Pakt_Marionettenstaat
						}
						set_temp_variable = { TNO_economy_subtype_temp = token:Econ_Subtype_Gelenkte_Wirtschaft }
						econ_subtype_change = yes
						if = {
							limit = { has_global_flag = german_civil_war_speervic }
							join_zollverein = yes
						}
						econ_join_sphere_GER = yes
					}
					GER = {
						country_event = { id = serbia.104 days = 3 }
					}
					set_global_flag = skip_default_capitulation
				}

				#Germany defeats Bohemia
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = GER
								is_in_faction_with = GER
							}
						}
						ROOT = { original_tag = CZE }
						NOT = { has_global_flag = german_civil_war }
					}
					GER = {
						annex_country = {
							target = CZE
							transfer_troops = no
						}
						add_state_core = 9
						add_state_core = 75
						CZE = {
							remove_state_core = 9
							remove_state_core = 75
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#Germany defeats the Netherlands
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = GER
								is_in_faction_with = GER
							}
						}
						ROOT = { original_tag = HOL }
					}
					GER = {
						white_peace = HOL
						HOL = { save_party_popularities = yes }
						set_autonomy = {
							target = HOL
							autonomy_state = autonomy_integrated_reichskommissariat
						}
						HOL = {
							apply_party_popularities = yes
							promote_character = HOL_occupational_authorities
							promote_character = HOL_provisional_government
							if = { # Bormann
								limit = { has_global_flag = german_civil_war_bormannvic }
								GER = { country_event = { id = bormann.652 days = 10 } }
							}
							else_if = { # Speer
								limit = { has_global_flag = german_civil_war_speervic }
								GER = { country_event = { id = speerholland.8 days = 7 } }
								set_party_name = {
									ideology = despotism
									long_name = UKR_speer_prov_government_national_socialism_long
									name = UKR_speer_prov_government_national_socialism
								}
								set_politics = { ruling_party = despotism }
								set_cosmetic_tag = SGR_HOL_provisional_government
								set_popularities = {
									fascism = 20
									despotism = 40
									national_socialism = 20
									anocracy = 15
									conservatism = 5
								}
							}
							else_if = { # Heydrich
								limit = { has_global_flag = german_civil_war_heydrichvic }
								set_country_leader_description = { desc = "" }
								set_variable = { HGR_Influence_Balance = 100 }
							}
							econ_join_sphere_GER = yes
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#Germany defeats Denmark
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = GER
								is_in_faction_with = GER
							}
						}
						ROOT = { original_tag = DEN }
					}
					GER = {
						white_peace = DEN
						add_to_faction = DEN
						DEN = {
							if = { # Bormann
								limit = { has_global_flag = german_civil_war_bormannvic }
								add_country_leader_role = {
									character = DEN_Occupational_Authorities
									country_leader = {
										desc = "POLITICS_OCCUPATIONAL_AUTHORITIES_DEN_DESC"
										ideology = national_socialism_subtype
										expire = "1983.1.1"
										id = -1
									}
								}
								promote_character = DEN_Occupational_Authorities
								GER = { country_event = { id = bormann.1009 days = 4 } }
							}
							else_if = { # Speer
								limit = { has_global_flag = german_civil_war_speervic }
								save_party_popularities = yes
								GER = {
									set_autonomy = {
										target = DEN
										autonomy_state = autonomy_collaborator_puppet_state
									}
								}
								apply_party_popularities = yes
								set_politics = { ruling_party = fascism }
								join_zollverein = yes
								remove_faction_status = yes
								add_ideas = Pakt_Mitstreiter
								add_popularity = {
									ideology = fascism
									popularity = 0.4
								}
							}
							econ_join_sphere_GER = yes
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#Germany defeats Slovakia
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = GER
								is_in_faction_with = GER
							}
						}
						ROOT = { original_tag = SLO }
						NOT = { has_global_flag = german_civil_war_goeringvic }
					}
					GER = {
						white_peace = SLO
						SLO = { save_party_popularities = yes }
						set_autonomy = {
							target = SLO
							autonomy_state = autonomy_collaborator_puppet_state
						}
						SLO = {
							SLO_Alexander_Mach = { promote_character = national_socialism_subtype }
							apply_party_popularities = yes
							add_popularity = {
								ideology = national_socialism
								popularity = 0.4
							}
							econ_join_sphere_GER = yes
							remove_all_ministers = yes
							fill_empty_minister_nochecks = yes
							remove_ideas = {
								SLO_Social_Liberalization
								SLO_Political_Liberalization
								SLO_Economical_Liberalization
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#Germany defeats Norway
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = GER
								is_in_faction_with = GER
							}
						}
						ROOT = { original_tag = NOR }
						NOT = { has_global_flag = german_civil_war_goeringvic }
					}
					GER = {
						white_peace = NOR
						NOR = { save_party_popularities = yes }
						set_autonomy = {
							target = NOR
							autonomy_state = autonomy_autonomous_reichskommissariat
						}
						add_state_core = 94
						transfer_state = 94
						GER_heinzgeorg_lemm = {
							set_nationality = NOR
						}
						NOR = {
							add_country_leader_role = {
								character = GER_heinzgeorg_lemm
								promote_leader = yes
								country_leader = {
									ideology = national_socialism_subtype
									expire = "1990.1.1"
									id = -1
								}
							}
							apply_party_popularities = yes
							add_popularity = {
								ideology = national_socialism
								popularity = 0.40
							}
							set_temp_variable = { TNO_economy_subtype_temp = token:Econ_Subtype_Gelenkte_Wirtschaft }
							econ_subtype_change = yes
							GER_apply_embargoes = yes
							set_cosmetic_tag = NOR_GER
							remove_ideas = {
								NOR_collab_purge
								NOR_Olav_V
								NOR_rebuilding_norway
								NOR_protect_norway
								NOR_elite_army_1
								NOR_elite_army_2
								NOR_american_advisors_idea
								NOR_coup_aftermath
							}
							load_focus_tree = ZZZ_blank_focus
							econ_join_sphere_GER = yes
							set_politics = {
								ruling_party = national_socialism
								elections_allowed = no
							}
						}	
					}
					set_global_flag = skip_default_capitulation
				}

				#Germany defeats Poland
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = GER
								is_in_faction_with = GER
							}
						}
						ROOT = { original_tag = POL }
						NOT = { has_global_flag = german_civil_war_goeringvic }
					}
					POL = { #Failsafe
						every_owned_state = {
							remove_core_of = FUK
							remove_core_of = UKR
							remove_core_of = BOV
							remove_core_of = UKS
						}
					}
					GER = {
						country_event = { id = reich_shared.22 days = 4 }
						white_peace = POL
						if = {
							limit = { country_exists = FSP }
							FSP = { white_peace = POL }
						}

						if = { # Führers that use GGN as tag
							limit = { NOT = { has_global_flag = german_civil_war_speervic } }
							GGN = {
								annex_country = {
									target = POL
									transfer_troops = no
								}
								every_owned_state = { remove_core_of = POL }
							}
							set_autonomy = {
								target = GGN
								autonomy_state = autonomy_integrated_reichskommissariat
							}
							GGN = {
								set_popularities = {
									national_socialism = 80
									fascism = 20
								}
								promote_character = GGN_interimregierung
								set_country_leader_description = {
									ideology = national_socialism
									desc = POLITICS_INTERIMREGIERUNG_DESC
								}
								econ_join_sphere_GER = yes
								remove_ideas = POL_underground_state
							}

							if = {
								limit = { has_global_flag = german_civil_war_bormannvic }
								country_event = { id = bormann.164 days = 31 }
							}
						}
						else = { # Führers that use POL as tag
							POL = { save_party_popularities = yes }
							set_autonomy = {
								target = POL
								autonomy_state = autonomy_autonomous_reichskommissariat
							}
							POL = {
								join_zollverein = yes
								apply_party_popularities = yes
								add_ideas = Pakt_Marionettenstaat
								set_cosmetic_tag = POL_SGR
								add_country_leader_role = {
									character = POL_Werner_Schrader
									country_leader = {
										ideology = national_socialism_reformed_national_socialism_subtype
										expire = "1990.1.1"
										id = -1
									}
								}
								promote_character = POL_Werner_Schrader
								set_politics = {
									ruling_party = national_socialism
								}
								add_popularity = {
									ideology = national_socialism
									popularity = 0.5
								}

								set_party_name = {
									ideology = national_socialism
									long_name = UKR_speer_prov_government_national_socialism_long
									name = UKR_speer_prov_government_national_socialism
								}
								every_owned_state = { remove_core_of = GGN } #Failsafe
								set_temp_variable = { TNO_economy_subtype_temp = token:Econ_Subtype_Gelenkte_Wirtschaft }
								econ_subtype_change = yes
								econ_join_sphere_GER = yes
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#Germany defeats a Ukraine faction
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = GER
								is_in_faction_with = GER
							}
						}
						ROOT = {
							OR = {
								# original_tag = UKR
								original_tag = FUK
								original_tag = UKS
								original_tag = BOV
							}
						}
					}
					GER = {
						white_peace = ROOT
						ROOT = {
							if = {
								limit = { country_exists = POL }
								every_owned_state = {
									limit = { is_core_of = POL }
									POL = { transfer_state = PREV }
								}
							}
							else = {
								every_owned_state = {
									limit = { is_core_of = GGN }
									GGN = { transfer_state = PREV }
								}
							}
							every_owned_state = { # If Gotenland has already been crushed
								limit = {
									is_core_of = CRI
								}
								remove_core_of = CRI
								add_core_of = GER
								GER = { transfer_state = PREV }
							}
						}
						if = {
							limit = { NOT = { country_exists = UKR } }
							UKR = {
								annex_country = { target = ROOT transfer_troops = no }
								save_party_popularities = yes
							}
							set_autonomy = {
								target = UKR
								autonomy_state = autonomy_autonomous_reichskommissariat
							}
							UKR = {
								apply_party_popularities = yes
								set_temp_variable = { TNO_economy_subtype_temp = token:Econ_Subtype_Gelenkte_Wirtschaft }
								econ_subtype_change = yes
								econ_join_sphere_GER = yes
								add_ideas = Pakt_Autonomous_Reichskommissariat

								if = {
									limit = { UKR = { is_ai = yes } }
									if = {
										limit = { has_global_flag = german_civil_war_bormannvic }
										GER = { GER_theodor_oberlander = { set_nationality = UKR } }
										GER_theodor_oberlander = { promote_character = { ideology = national_socialism_subtype } }
									}
									else_if = {
										limit = { has_global_flag = german_civil_war_speervic }
										GER = { GER_ewaldheinrich_von_kleistschmenzin = { set_nationality = UKR } }
										promote_character = GER_ewaldheinrich_von_kleistschmenzin
										set_party_name = {
											ideology = national_socialism
											long_name = UKR_speer_prov_government_national_socialism_long
											name = UKR_speer_prov_government_national_socialism
										}
										set_cosmetic_tag = Speer_UKR_rejoined_peacefully
										join_zollverein = yes
									}
									load_focus_tree = ZZZ_blank_focus
								}
								remove_ideas = {
									UKR_indecisive_council
									UKR_disjointed_forces
									UKR_paradise_undone
									UKR_to_the_strongest_idea
									UKR_in_this_together
									UKR_UCW_war_within
									UKR_UCW_all_alone
									UKR_the_ukrainian_civil_war
									UKR_the_ukrainian_civil_war_2
								}
								if = {
									limit = { has_idea = UKR_UCW_intel_based_partisan_warfare }
									remove_ideas = UKR_UCW_intel_based_partisan_warfare
								}
								remove_dynamic_modifier = { modifier = UKR_UCW_war_within_mod }
								remove_dynamic_modifier = { modifier = UKR_UCW_all_alone_mod }
								every_owned_state = { #resistance go away for real!
									force_disable_resistance = {
										clear = yes
										occupier = UKR
										occupied = FUK
									}
									force_disable_resistance = {
										clear = yes
										occupier = UKR
										occupied = UKS
									}
									force_disable_resistance = {
										clear = yes
										occupier = UKR
										occupied = BOV
									}
									force_disable_resistance = {
										clear = yes
										occupier = UKR
										occupied = UKR
									}
									add_core_of = UKR #Failsafe
									cancel_resistance = yes
									remove_core_of = UKS
									remove_core_of = BOV
									remove_core_of = FUK
								}
							}
						}
						else = {
							UKR = {
								annex_country = { target = ROOT transfer_troops = no }
								every_owned_state = { remove_core_of = ROOT add_core_of = UKR }
							}
						}
						UKR = {
							if = {
								limit = {
									NOT = {
										country_exists = FUK
										country_exists = UKS
										country_exists = BOV
									}
									has_global_flag = Kyiv_Nuked
								}
								add_ideas = UKR_ruin_of_the_breadbasket
								set_capital = { state = 1430 }
								every_owned_state = {
									remove_core_of = UKS
									remove_core_of = FUK
									remove_core_of = BOV
									remove_core_of = GER #for some reason Germany may get cores, this is to guarantee that it doesn't
									add_core_of = UKR
									force_disable_resistance = {
										clear = yes
										occupier = UKR
										occupied = FUK
									}
									force_disable_resistance = {
										clear = yes
										occupier = UKR
										occupied = UKS
									}
									force_disable_resistance = {
										clear = yes
										occupier = UKR
										occupied = BOV
									}
									force_disable_resistance = {
										clear = yes
										occupier = UKR
										occupied = UKR
									}
									cancel_resistance = yes
								}
								GER = {
									set_temp_variable = { Victory_ID = 10 }
									set_temp_variable = { Victory_Outcome = 2 }
									set_temp_variable = { Victory_Points = -150 }
									Cold_War_GUI_AddVictory = yes
								}
								clr_global_flag = Kyiv_Nuked
							}
						}
						if = { # Integrates CRI if invasion happens w/o RK
							limit = {
								NOT = {
									country_exists = FUK
									country_exists = UKS
									country_exists = BOV
								}
								country_exists = CRI
							}
							CRI = {
								transfer_navy = { target = GER }
								remove_state_core = 137
								remove_state_core = 196
								remove_state_core = 1532
							}
							add_state_core = 137
							add_state_core = 196
							add_state_core = 1532
							annex_country = { target = CRI transfer_troops = yes }
							every_owned_state = {
								remove_core_of = FUK
								remove_core_of = BOV
								remove_core_of = UKS
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#Germany defeats Ostland
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = GER
								is_in_faction_with = GER
							}
						}
						ROOT = {
							OR = {
								original_tag = OST
								original_tag = MST
								original_tag = DST
								original_tag = JST
								original_tag = UPO
								original_tag = BLR
							}
						}
						
					}
					GER = {
						white_peace = ROOT
						if = { # Bormann
							limit = { has_global_flag = german_civil_war_bormannvic }
							OST = { annex_country = { target = ROOT transfer_troops = no } }
							if = {
								limit = { NOT = { has_subject = OST } }
								set_autonomy = {
									target = OST
									autonomy_state = autonomy_integrated_reichskommissariat
								}
								OST = {
									set_popularities = { national_socialism = 100 }
									promote_character = OST_friedrich_karl_vialon
									econ_join_sphere_GER = yes
									remove_ideas = {
										OST_model_colony
										OST_model_colony2
										OST_unusual_quiet
										OST_No_head
										OST_crippled_military
										OST_stabbed_in_the_back
										OST_broken_nation
										OST_United_for_Ostland
										OST_Defend_Riga_idea
										OST_Haste_Makes_Waste
										OST_Prussian_Values
									}
									load_focus_tree = ZZZ_blank_focus
								}
							}
						}
						else_if = { # Speer
							limit = { has_global_flag = german_civil_war_speervic }
							if = { # Landrut is alive
								limit = {
									has_global_flag = OST_OCW_Ongoing
									country_exists = MST
								}
								OST_off_a_fucker = yes
								MST = { annex_country = { target = ROOT transfer_troops = no } }
								if = {
									limit = { check_variable = { global.OST_contenders^num = 1 } }
									clear_array = global.OST_contenders
									clr_global_flag = OST_OCW_Ongoing
									country_event = {
										id = speerostland.27
										days = 3
									}
								}
							}
							else_if = { # Landrut is dead :( sadge
								limit = {
									has_global_flag = OST_OCW_Ongoing
									NOT = { country_exists = MST }
								}
								annex_country = { target = ROOT transfer_troops = no }
								if = {
									limit = {
										NOT = {
											country_exists = OST
											country_exists = DST
											country_exists = JST
											country_exists = BLR
											country_exists = UPO
										}
									}
									clear_array = global.OST_contenders
									clr_global_flag = OST_OCW_Ongoing
									GER_alfred_zerbel = {
										set_nationality = OST
									}
									OST = {
										every_state = {
											limit = { Pakt_OST_Is_Ostland_State = yes }
											PREV = { transfer_state = PREV }
										}
										PREV = {
											set_autonomy = {
												target = OST
												autonomy_state = autonomy_integrated_reichskommissariat
											}
										}
										join_zollverein = yes
										load_focus_tree = ZZZ_blank_focus
										set_variable = { national_debt = 0 }
										remove_ideas = {
											OST_model_colony
											OST_model_colony2
											OST_unusual_quiet
											OST_No_head
											OST_crippled_military
											OST_stabbed_in_the_back
											OST_broken_nation
											OST_United_for_Ostland
											OST_Defend_Riga_idea
											OST_Prussian_Values
											OST_Haste_Makes_Waste
										}
										set_cosmetic_tag = ostland_occupation_authority

										set_popularities = {
											national_socialism = 80
											despotism = 5
											conservatism = 10
											socialist = 5
										}
										promote_character = GER_alfred_zerbel
										
										set_party_name = {
											ideology = national_socialism
											long_name = OST_speer_occupation_government_fascism_long
											name = OST_speer_occupation_government_fascism
										}
										set_party_name = {
											ideology = despotism
											long_name = OST_speer_belarus_liberation_front
											name = OST_speer_belarus_liberation_front_long
										}
										set_party_name = {
											ideology = conservatism
											long_name = OST_speer_united_baltic_army
											name = OST_speer_united_baltic_army_long
										}
										set_party_name = {
											ideology = conservatism
											long_name = OST_speer_united_baltic_army
											name = OST_speer_united_baltic_army_long
										}
										set_party_name = {
											ideology = socialist
											long_name = OST_speer_student_movement
											name = OST_speer_student_movement_long
										}
									}
								}
							}
							else = { # OCW is over
								OST = { annex_country = { target = ROOT transfer_troops = no } }
								set_autonomy = {
									target = OST
									autonomy_state = autonomy_integrated_reichskommissariat
								}
								GER_alfred_zerbel = {
									set_nationality = OST
								}
								OST = {
									join_zollverein = yes
									load_focus_tree = ZZZ_blank_focus
									set_variable = { national_debt = 0 }
									remove_ideas = {
										OST_model_colony
										OST_model_colony2
										OST_unusual_quiet
										OST_No_head
										OST_crippled_military
										OST_stabbed_in_the_back
										OST_broken_nation
										OST_United_for_Ostland
										OST_Defend_Riga_idea
										OST_Prussian_Values
										OST_Haste_Makes_Waste
									}
									every_owned_state = {
										remove_core_of = DST
										remove_core_of = JST
										remove_core_of = MST
										remove_core_of = BLR
										remove_core_of = UPO
										add_core_of = OST #Failsafe
									}
									set_cosmetic_tag = ostland_occupation_authority

									set_popularities = {
										national_socialism = 80
										despotism = 5
										conservatism = 10
										socialist = 5
									}
									promote_character = GER_alfred_zerbel

									set_party_name = {
										ideology = national_socialism
										long_name = OST_speer_occupation_government_fascism_long
										name = OST_speer_occupation_government_fascism
									}
									set_party_name = {
										ideology = despotism
										long_name = OST_speer_belarus_liberation_front
										name = OST_speer_belarus_liberation_front_long
									}
									set_party_name = {
										ideology = conservatism
										long_name = OST_speer_united_baltic_army
										name = OST_speer_united_baltic_army_long
									}
									set_party_name = {
										ideology = conservatism
										long_name = OST_speer_united_baltic_army
										name = OST_speer_united_baltic_army_long
									}
									set_party_name = {
										ideology = socialist
										long_name = OST_speer_student_movement
										name = OST_speer_student_movement_long
									}
								}
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#Germany defeats Kaukasien
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = GER
								is_in_faction_with = GER
							}
						}
						ROOT = { original_tag = CAU }
					}
					GER = {
						white_peace = CAU
						CAU = {
							save_party_popularities = yes
						}
						if = { # Bormann
							limit = { has_global_flag = german_civil_war_bormannvic }
							GGN = { GGN_eccard_freiherr_von_gablenz = { set_nationality = CAU } }
							CAU = {
								clr_country_flag = CAU_policy_josias_burgsys
								clr_country_flag = CAU_policy_josias_crowned
								promote_character = GGN_eccard_freiherr_von_gablenz
							}
							set_autonomy = {
								target = CAU
								autonomy_state = autonomy_autonomous_reichskommissariat
							}
						}
						else_if = { # Speer
							limit = { has_global_flag = german_civil_war_speervic }
							GER_friedrich_klausing = { set_nationality = CAU }
							CAU = {
								promote_character = GER_friedrich_klausing
								set_cosmetic_tag = SGR_CAU_provisional_government
								set_party_name = {
									ideology = national_socialism
									long_name = UKR_speer_prov_government_national_socialism_long
									name = UKR_speer_prov_government_national_socialism
								}
								remove_ideas = Pakt_Autonomous_Reichskommissariat
								add_ideas = Pakt_Military_Authority
								join_zollverein = yes
							}
							set_autonomy = {
								target = CAU
								autonomy_state = autonomy_military_government
							}
						}
						CAU = {
							apply_party_popularities = yes
							econ_join_sphere_GER = yes
							add_popularity = {
								ideology = national_socialism
								popularity = 0.4
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}
				### ===================== ###

				#Speer defeats DFK
				else_if = {
					limit = {
						FROM = {
							is_in_faction_with = GER
						}
						ROOT = { original_tag = DFK }
						has_global_flag = german_civil_war_speervic
						has_global_flag = SGR_Slave_Revolt
					}
					set_global_flag = skip_default_capitulation
				}
				#Speer defeats Moskowien Schörner (Slave Revolt)
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = GER
								is_in_faction_with = GER
							}
						}
						ROOT = { original_tag = MCW }
						has_global_flag = german_civil_war_speervic
						has_global_flag = SGR_Slave_Revolt
					}
					GER = {
						add_to_faction = PAU
						add_to_faction = CAU
						white_peace = MCW
						annex_country = {
							target = OKB
							transfer_troops = yes
						}
						set_country_flag = SGR_SR_good_end
						country_event = {
							id = speerreichsbanner.1
							days = 3
						}
						random_list = {
							50 = {
								country_event = {
									id = speer_slaverevolt.30
									days = 1
								}
							}
							50 = {
								country_event = {
									id = speer_slaverevolt.31
									days = 1
								}
							}
						}
						add_state_core = 195
						transfer_state = 195
					}
					OKB = {
						GER_alexis_von_roenne = {
							set_nationality = MCW
						}
					}
					MCW = {
						join_zollverein = yes
						retire_country_leader = yes
						remove_ideas = {
							MCW_The_Marshals_Fiefdom
							MCW_Brutal_Repression
							MCW_Schorners_Ambition
						}
						add_ideas = {
							MCW_Russia_in_ruins
							MCW_Pakt_Commission
						}
						set_cosmetic_tag = MCW_SGR
						GER = {
							set_autonomy = {
								target = MCW
								autonomy_state = autonomy_military_government
							}
						}
						set_politics = {
							ruling_party = despotism
							last_election = "1941.4.17"
							election_frequency = 48
							elections_allowed = no
						}
						GER_alexis_von_roenne = {
							promote_character = { ideology = despotism_interim_government_subtype }
						}
						GER_alexis_von_roenne = {
							promote_character = { ideology = national_socialism_reformed_national_socialism_subtype }
						}
						set_party_name = {
							ideology = despotism
							long_name = MCW_despotism_postSR_party
							name = MCW_despotism_postSR_party_long
						}
						set_popularities = {
							despotism = 33
							communist = 6
							socialist = 12
							progressivism = 5
							liberalism = 18
							liberal_conservatism = 0
							anocracy = 21
							national_socialism = 5
						}
						add_state_core = 217
						add_state_core = 237
						add_state_core = 238
						add_state_core = 244
						add_state_core = 245
						add_state_core = 401
						transfer_state = 209
						transfer_state = 210
						transfer_state = 217
						transfer_state = 219
						transfer_state = 222
						transfer_state = 224
						transfer_state = 237
						transfer_state = 238
						transfer_state = 241
						transfer_state = 242
						transfer_state = 243
						transfer_state = 244
						transfer_state = 245
						transfer_state = 246
						transfer_state = 247
						transfer_state = 257
						transfer_state = 260
						transfer_state = 263
						transfer_state = 264
						transfer_state = 401
						transfer_state = 1421
						transfer_state = 1434
						transfer_state = 1435
						transfer_state = 1436
						transfer_state = 1441
						transfer_state = 1442
						transfer_state = 1443
						every_owned_state = {
							add_core_of = MCW
						}
					}

					CAU = {
						annex_country = {
							target = DFK
							transfer_troops = yes
						}
					}
					every_country = {
						limit = { is_ai = no }
						news_event = {
							id = WORLD_REICH.213
						}
					}

					set_global_flag = skip_default_capitulation
				}

				#The Slave Revolt is defeated
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = GER
								original_tag = MCW
								is_in_faction_with = GER
							}
						}
						ROOT = { original_tag = SRT }
						has_global_flag = german_civil_war_speervic
						has_global_flag = SGR_Slave_Revolt
					}
					GER = {
						white_peace = SRT
						add_to_faction = MCW
						annex_country = {
							target = OKB
							transfer_troops = yes
						}
						set_country_flag = SGR_SR_bad_end
						clr_global_flag = SGR_Slave_Revolt
						country_event = {
							id = speer_slaverevolt.29
							days = 2
						}
						country_event = {
							id = speerflavor.77
							days = 4
						}
					}
					MCW = {
						white_peace = SRT
						annex_country = {
							target = PAU
							transfer_troops = no
						}
						add_state_core = 1421
						add_state_core = 1434
						add_state_core = 209
						transfer_state = 1421
						transfer_state = 1434
						transfer_state = 209
					}
					SRT = {
						#Poland
						every_controlled_state = {
							limit = { is_core_of = POL }
							POL = { transfer_state = PREV }
							remove_core_of = SRT
						}
						#Ukraine
						every_controlled_state = {
							limit = { is_core_of = UKR }
							UKR = { transfer_state = PREV }
							remove_core_of = SRT
						}
						#Baltikum
						every_controlled_state = {
							limit = { 
								is_core_of = OST 
								NOT = { is_core_of = BLR } 
							}
							OST = { transfer_state = PREV }
							remove_core_of = SRT
						}
						#Belarus
						every_controlled_state = {
							limit = { 
								is_core_of = BLR 
								NOT = { is_core_of = OST } 
							}
							BLR = { transfer_state = PREV }
							remove_core_of = SRT
						}
						#Kaukasien
						every_controlled_state = {
							limit = { is_core_of = CAU }
							CAU = { transfer_state = PREV }
							remove_core_of = SRT
						}
					}
					CAU = {
						annex_country = {
							target = DFK
							transfer_troops = yes
						}
					}
					GER = {
						if = {
							limit = {
								has_country_flag = SGR_collab_regimes
							}
							divide_ostland = yes
							collab_regime_in_poland = yes
							collab_regime_in_ukraine = yes
							collab_regime_in_kaukasien = yes
						}
						else = {
							divide_ostland2 = yes
							reichsland_in_poland = yes
							reichsland_in_ukraine = yes
							reichsprotektorat_in_kaukasia = yes
						}
						if = {
							limit = {
								FROM = { # Schörner vic
									original_tag = MCW
								}
							}
							hidden_effect = {
								set_global_flag = SGR_natsoc_collapse
								remove_all_ministers = yes
								BGR = {
									GER_heinrich_trettner = {
										set_nationality = GER
									}
								}
								GER_albert_speer = {
									set_portraits = {
										civilian = { large = "gfx/leaders/GER/Portrait_GER_Albert_Speer_natsoc.png" }
									}
									add_country_leader_role = {
										country_leader = {
											desc = "POLITICS_NATSOC_SPEER_DESC"
											expire = "1990.1.1"
											ideology = national_socialism_subtype
											traits = {
												dictator
											}
										}
										promote_leader = yes
									}
								}
								set_politics = {
									ruling_party = national_socialism
								}
								remove_ideas = {
									GER_SGR_the_lost_generation
									GER_SGR_wary_wehrmacht
									GER_SGR_gang_of_four
									GER_Henning_von_Tresckow_high_command
								}
								add_ideas = {
									GER_Eduard_Wagner_hog
									GER_Kurt_Schmucker_eco
									GER_Theodor_Oberlander_for
									GER_Theodor_Tolsdorff_sec
								}

								add_to_variable = {
									var = fashpoints
									value = 100
								}
								subtract_from_variable = {
									var = authpoints
									value = 100
								}
								check_speer_alignment_value = yes
								reload_GER_speer_post_cw_tree = yes
								TNO_fopo_remove_saw_tab = yes
								set_country_flag = SGR_schorner_takeover
								MCW = {
									save_party_popularities = yes
									get_current_government_type = yes
								}
								set_autonomy = {
									target = MCW
									autonomy_state = autonomy_military_government
								}
								MCW = {
									apply_party_popularities = yes
									restore_previous_government_type = yes
									join_zollverein = yes
								}
							}
						}
					}

					every_country = {
						limit = { is_ai = no }
						news_event = {
							id = WORLD_REICH.214
						}
					}

					if = {
						limit = {
							GER = {
								has_country_flag = SGR_oberlander_takeover
							}
						}
						every_country = {
							limit = { is_ai = no }
							news_event = {
								id = WORLD_REICH.220
								days = 5
							}
						}
					}
					else_if = {
						limit = {
							GER = {
								has_country_flag = SGR_schorner_takeover
							}
						}
						every_country = {
							limit = { is_ai = no }
							news_event = {
								id = WORLD_REICH.221
								days = 5
							}
						}
					}

					set_global_flag = skip_default_capitulation
				}

				#The Slave Revolt, somehow, manages to beat Schörner
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = SRT
								is_in_faction_with = SRT
							}
						}
						ROOT = { original_tag = MCW }
						has_global_flag = german_civil_war_speervic
						has_global_flag = SGR_Slave_Revolt
					}
					GER = {
						declare_war_on = {
							target = SRT
							type = annex_everything
						}
					}

					set_global_flag = skip_default_capitulation
				}

				#The Aryan People's Front beats Czechia
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = APF
								is_in_faction_with = GER
							}
						}
						ROOT = { original_tag = CZE }
						has_global_flag = german_civil_war_heydrichvic
					}
					APF = {
						white_peace = CZE
						annex_country = {
							target = CZE
							transfer_troops = no
						}
						set_variable = { HGR_Influence_Balance = 100 }
						set_cosmetic_tag = APF_CZECH
					}
					GER = {
						country_event = {
							id = HGR.223
							days = 7
						}
					}
					set_global_flag = skip_default_capitulation
				}
				#Czechia beats the Aryan People's Front
				else_if = {
					limit = {
						FROM = {
							original_tag = CZE
						}
						ROOT = { original_tag = APF }
						has_global_flag = german_civil_war_heydrichvic
					}
					CZE = {
						white_peace = APF
					}
					APF = {
						set_variable = { HGR_Influence_Balance = 5 }
					}
					set_global_flag = skip_default_capitulation
				}

				#GERMAN CIVIL WAR
				else_if = {
					limit = {
						has_global_flag = german_civil_war
						FROM = {
							OR = {
								is_in_array = { global.GCW_contenders = THIS }
								tag = CZE
							}
						}
						ROOT = { is_in_array = { global.GCW_contenders = THIS } }
					}
					ROOT = {
						if = {
							limit = {
								OR = {
									AND = {
										tag = BGR
										CAU = { has_country_flag = CAU_policy_business_bormann }
									}
									AND = {
										tag = GGR
										CAU = { has_country_flag = CAU_policy_business_goering }
									}
								}
							}
							remove_resource_rights = 229
							remove_resource_rights = 1552
							remove_resource_rights = 1554
						}
						else_if = {
							limit = { original_tag = HGR }
							BRG = { TNO_BRG_domestic_tree_swap = yes }
						}
						GER_GCW_off_a_fucker = yes
					}
					FROM = {
						if = {
							limit = { tag = CZE }
							OVERLORD = {
								white_peace = ROOT
								annex_country = {
									target = ROOT
									transfer_troops = no
								}
								GER_GCW_check_victor = yes
							}
						}
						else = {
							white_peace = ROOT
							annex_country = {
								target = ROOT
								transfer_troops = no
							}
							GER_GCW_check_victor = yes
						}
					}
					ENG = {
						country_event = { id = collab_cw.0 days = 60 } # if in 60 days the english CW is still going on, this will add a hiddden buff to the collabs
					}
					set_global_flag = skip_default_capitulation
				}

				#Polish Uprising - POL victory
				else_if = {
					limit = {
						FROM = { original_tag = POL }
						ROOT = { original_tag = GGN }
					}
					GGN = { remove_ideas = POL_underground_state }
					set_global_flag = POL_victory
				}
				#Polish Uprising - GGN victory
				else_if = {
					limit = {
						FROM = {
							OR = {
								original_tag = GGN
								is_in_faction_with = GGN
							}
						}
						ROOT = { original_tag = POL }
					}
					GGN = { remove_ideas = POL_underground_state }
					GER = {
						if = {
							limit = { has_country_flag = GER_BOR_intervened_in_poland }
							country_event = { id = bormann.1508 days = 7 }
							clr_country_flag = GER_BOR_intervened_in_poland
						}
					}
					set_global_flag = GGN_victory
				}
				### ===================== ###

				## Colombia ##
				else_if = {
					limit = {
						NOT = { has_global_flag = COL_nazis_won }
						FROM = {
							OR = {
								tag = COL
								tag = CLL
								tag = CLC
								tag = CLD
							}
						}
						ROOT = {
							OR = {
								tag = COL
								tag = CLL
								tag = CLC
								tag = CLD
							}
						}
					}

					FROM = {
						every_enemy_country = {
							limit = {
								OR = {
									original_tag = ROOT
									is_in_faction_with = ROOT
								}
							}
							FROM = {
								white_peace = PREV
								annex_country = {
									target = PREV
									transfer_troops = no
								}
								every_state = {
									remove_core_of = ROOT
								}
							}
						}
					}
					if = {
						limit = {
							ROOT = {
								original_tag = CLC
							}
						}
						JAP = {
							TNO_fopo_remove_colombian_civil_war_tab = yes
							set_temp_variable = { target = CLC }
							TNO_clear_num_volunteers = yes
						}
						ITA = {
							set_temp_variable = { target = CLC }
							TNO_clear_num_volunteers = yes
						}
						GNG = {
							GNG_PTRG_Colombia_END = yes
						}
						if = {
							limit = {
								check_variable = {
									global.IBR_COL_faction_support = CLC.id
								}
							}
							IBR = {
								TNO_fopo_remove_colombian_civil_war_tab = yes
								set_temp_variable = { target = CLC }
								TNO_clear_num_volunteers = yes
								if = {
									limit = { has_character = IBR_Antonio_Salazar }
									country_event = { id = IBR_colombia.6 }
								}
								else = { country_event = { id = IBR_colombia.7 } }
							}
						}
						set_global_flag = skip_default_capitulation
					}
					if = {
						limit = {
							ROOT = {
								original_tag = COL
							}
						}
						if = {
							limit = {
								check_variable = {
									global.IBR_COL_faction_support = COL.id
								}
							}
							IBR = {
								if = {
									limit = { has_character = IBR_Antonio_Salazar }
									country_event = { id = IBR_colombia.6 }
								}
								else = { country_event = { id = IBR_colombia.7 } }
								TNO_fopo_remove_colombian_civil_war_tab = yes
								set_temp_variable = { target = COL }
								TNO_clear_num_volunteers = yes
							}
						}
						if = {
							limit = {
								check_variable = {
									BRA.COL_faction_support = COL.id
								}
							}
							BRA = {
								country_event = { id = BRA_colombia.4 }
								TNO_fopo_remove_colombian_civil_war_tab = yes
								set_temp_variable = { target = COL }
								TNO_clear_num_volunteers = yes
							}
						}
						set_global_flag = skip_default_capitulation
					}
					if = {
						limit = {
							ROOT = {
								original_tag = CLL
							}
						}
						USA = {
							if = {
								limit = { FROM = { tag = CLC } }
								country_event = { id = USA_colombia.9 }
							}
							else = { country_event = { id = USA_colombia.8 } }
							TNO_fopo_remove_colombian_civil_war_tab = yes
							set_temp_variable = { target = CLL }
							TNO_clear_num_volunteers = yes
							clear_variable = USA_manpower_depletion_COLCW
						}
						if = {
							limit = {
								check_variable = {
									BRA.COL_faction_support = CLL.id
								}
							}
							BRA = {
								country_event = { id = BRA_colombia.4 }
								TNO_fopo_remove_colombian_civil_war_tab = yes
								set_temp_variable = { target = CLL }
								TNO_clear_num_volunteers = yes
							}
						}
						ITA = {
							set_temp_variable = { target = CLL }
							TNO_clear_num_volunteers = yes
						}
						set_global_flag = skip_default_capitulation
					}
					if = {
						limit = {
							ROOT = {
								original_tag = CLD
							}
						}
						GER = {
							TNO_fopo_remove_colombian_civil_war_tab = yes
							set_temp_variable = { target = CLD }
							TNO_clear_num_volunteers = yes
						}
						set_global_flag = skip_default_capitulation
					}
					if = {
						limit = {
							FROM = {
								original_tag = CLC
							}
							NOT = {
								country_exists = CLL
								country_exists = COL
								country_exists = CLD
							}
						}
						every_country = {
							limit = { is_ai = no }
							news_event = { id = WORLD.30111 days = 1 }
						}
						CLC = {
							set_capital = { state = 306 }
							set_cosmetic_tag = CLC_unification
							country_event = { id = CLC_post_war.1 days = 60 }
							if = {
								limit = {
									ITA = {
										has_country_leader = {
											character = ITA_Carlo_Scorza
											ruling_only = yes
										}
									}
								}
								econ_join_sphere_ITA = yes
							}
							else = {
								econ_leave_sphere = yes
							}
						}
						JAP = {
							TNO_fopo_remove_colombian_civil_war_tab = yes
							set_temp_variable = { target = CLC }
							TNO_clear_num_volunteers = yes
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 4 }
							set_temp_variable = { Victory_Points = 100 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						GER = {
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 2 }
							set_temp_variable = { Victory_Points = -100 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						USA = {
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 1 }
							set_temp_variable = { Victory_Points = -200 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						GNG_PTRG_Colombia_END = yes
						ITA = {
							set_temp_variable = { target = CLC }
							TNO_clear_num_volunteers = yes
						}
						if = {
							limit = {
								check_variable = {
									global.IBR_COL_faction_support = CLC.id
								}
							}
							IBR = {
								country_event = { id = IBR_colombia.8 }
								TNO_fopo_remove_colombian_civil_war_tab = yes
								set_temp_variable = { target = CLC }
								TNO_clear_num_volunteers = yes
							}
						}
						set_global_flag = COL_conservatives_won
						clr_global_flag = COL_civil_war_ongoing
					}
					if = {
						limit = {
							FROM = {
								original_tag = CLL
							}
							NOT = {
								country_exists = CLC
								country_exists = COL
								country_exists = CLD
							}
						}
						every_country = {
							limit = { is_ai = no }
							news_event = { id = WORLD.30110 days = 1 }
						}
						USA = {
							TNO_fopo_remove_colombian_civil_war_tab = yes
							set_temp_variable = { target = CLL }
							TNO_clear_num_volunteers = yes
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 4 }
							set_temp_variable = { Victory_Points = 100 }
							Cold_War_GUI_ManipulateVictory = yes

							country_event = { id = kirk.30 days = 2 random_days = 5 }
							country_event = { id = USA_colombia.7 }
						}
						GER = {
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 1 }
							set_temp_variable = { Victory_Points = -200 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						JAP = {
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 1 }
							set_temp_variable = { Victory_Points = -200 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						if = {
							limit = {
								check_variable = {
									BRA.COL_faction_support = CLL.id
								}
							}
							BRA = {
								country_event = { id = BRA_colombia.3 }
								TNO_fopo_remove_colombian_civil_war_tab = yes
								set_temp_variable = { target = CLL }
								TNO_clear_num_volunteers = yes
							}
						}
						CLL = {
							set_capital = { state = 306 }
							add_ideas = {
								OFN_Observer
							}
							set_cosmetic_tag = CLL_unification
							country_event = { id = CLL_post_war.1 days = 30 }
						}
						set_global_flag = COL_liberals_won
						clr_global_flag = COL_civil_war_ongoing
					}
					if = {
						limit = {
							FROM = {
								original_tag = CLD
							}
							NOT = {
								country_exists = CLC
								country_exists = COL
								country_exists = CLL
							}
						}
						every_country = {
							limit = { is_ai = no }
							news_event = { id = WORLD.30113 days = 1 }
						}
						GER = {
							TNO_fopo_remove_colombian_civil_war_tab = yes
							set_temp_variable = { target = CLD }
							TNO_clear_num_volunteers = yes
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 4 }
							set_temp_variable = { Victory_Points = 100 }
							Cold_War_GUI_ManipulateVictory = yes

							country_event = {
								id = goering.rockwell.13
							}
						}
						JAP = {
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 1 }
							set_temp_variable = { Victory_Points = -200 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						USA = {
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 2 }
							set_temp_variable = { Victory_Points = -100 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						CLD = {
							set_capital = { state = 306 }
							remove_ideas = {
								CLL_La_Violencia
								CLL_Shoulder_of_Giant
								CLL_Agrarian_Crisis
							}
							remove_dynamic_modifier = { modifier = CLD_German_Support_dm }
							add_ideas = {
								Pakt_Observer
							}
							econ_join_sphere_GER = yes
							set_cosmetic_tag = CLD_unification
							country_event = { id = colombia.20 months = 6 }
						}
						CLC = {
							set_capital = {
								state = 1659
								remember_old_capital = no
							}
							set_temp_variable = { TNO_economy_subtype_temp = token:Econ_Subtype_Gelenkte_Wirtschaft }
							econ_subtype_change = yes
							remove_ideas = {
								CLC_La_Violencia
								CLC_Shoulder_of_Giant
								CLC_Agrarian_Crisis
								CLC_Reactionary_Den
								CLC_Saints_Sinners
							}
							set_party_name = {
								ideology = national_socialism
								long_name = CLC_national_socialism_nazis_party_long
								name = CLC_national_socialism_nazis_party
							}
							set_party_name = {
								ideology = ultranationalism
								long_name = CLC_OKW
								name = CLC_OKW_party
							}
							remove_all_ministers = yes
							econ_leave_sphere = yes
							retire_country_leader = yes
							promote_character = CLC_Heriberto_Schwartau
							set_politics = {
								ruling_party = national_socialism
							}
							set_cosmetic_tag = CLC_CCW2
							set_variable = { national_debt = 0 }
						}
						CLL = {
							set_temp_variable = { TNO_economy_subtype_temp = token:Econ_Subtype_Military_Directed }
							econ_subtype_change = yes
							remove_ideas = {
								CLL_La_Violencia
								CLL_Shoulder_of_Giant
								CLL_Agrarian_Crisis
								CLL_OFN_Support
								CLL_Saints_Sinners
							}
							set_cosmetic_tag = CLL_Partisans
							remove_all_ministers = yes
							econ_leave_sphere = yes
							retire_country_leader = yes
							promote_character = CLL_Frente_Democratico_Unido
							set_politics = {
								ruling_party = despotism
							}
							set_variable = { national_debt = 0 }
						}
						set_global_flag = COL_nazis_won
						clr_global_flag = COL_civil_war_ongoing
					}
					if = {
						limit = {
							FROM = {
								original_tag = COL
							}
							NOT = {
								country_exists = CLC
								country_exists = CLL
								country_exists = CLD
							}
						}
						if = {
							limit = {
								COL = {
									has_country_leader = {
										character = COL_Gustavo_Rojas_Pinilla
										ruling_only = yes
									}
								}
							}
							every_country = {
								limit = { is_ai = no }
								news_event = { id = WORLD.30112 days = 1 }
							}
						}
						else = {
							every_country = {
								limit = { is_ai = no }
								news_event = { id = WORLD.30109 days = 1 }
							}
						}
						if = {
							limit = {
								check_variable = {
									global.IBR_COL_faction_support = COL.id
								}
							}
							IBR = {
								country_event = { id = IBR_colombia.5 }
								TNO_fopo_remove_colombian_civil_war_tab = yes
								set_temp_variable = { target = COL }
								TNO_clear_num_volunteers = yes
							}
						}
						GER = {
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 3 }
							set_temp_variable = { Victory_Points = -100 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						JAP = {
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 3 }
							set_temp_variable = { Victory_Points = -100 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						USA = {
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 3 }
							set_temp_variable = { Victory_Points = -100 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						if = {
							limit = {
								check_variable = {
									BRA.COL_faction_support = COL.id
								}
							}
							BRA = {
								country_event = { id = BRA_colombia.3 }
								TNO_fopo_remove_colombian_civil_war_tab = yes
								set_temp_variable = { target = COL }
								TNO_clear_num_volunteers = yes
							}
						}
						if = {
							limit = {
								COL = {
									has_country_leader = {
										character = COL_Alberto_Lleras_Camargo
										ruling_only = yes
									}
								}
							}
							COL = {
								country_event = { id = COL_post_war.1 days = 1460 }
							}
						}
						else_if = {
							limit = {
								COL = {
									has_country_leader = {
										character = COL_Guillermo_Leon_Valencia
										ruling_only = yes
									}
								}
							}
							COL = {
								country_event = { id = COL_post_war.2 days = 1460 }
							}
						}
						set_global_flag = COL_central_government_won
						clr_global_flag = COL_civil_war_ongoing
					}
					set_global_flag = skip_default_capitulation
					set_variable = { test_var = 1 }
					log = "[GetDateText]: [Root.GetName] peaced out [From.GetName]"
				}

				###CCW2###
				else_if = {
					limit = {
						has_global_flag = COL_Nazis_won
						NOT = { has_global_flag = COL_CCW3 }
						FROM = {
							OR = {
								tag = CLL
								tag = CLC
								tag = CLD
							}
						}
						ROOT = {
							OR = {
								tag = CLL
								tag = CLC
								tag = CLD
							}
						}
					}
					FROM = {
						every_enemy_country = {
							limit = {
								OR = {
									original_tag = ROOT
									is_in_faction_with = ROOT
								}
							}
							FROM = {
								white_peace = PREV
								annex_country = {
									target = PREV
									transfer_troops = no
								}
								every_state = {
									remove_core_of = ROOT
								}
							}
						}
					}
					if = {
						limit = {
							FROM = {
								original_tag = CLC
							}
							NOT = {
								country_exists = CLD
								country_exists = CLL
							}
						}
						CLC = {
							add_ideas = {
								Pakt_Observer
							}
							set_cosmetic_tag = CLC_Nazis
							set_capital = { state = 306 }
						}
						GER = {
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 5 }
							set_temp_variable = { Victory_Points = 200 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						USA = {
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 1 }
							set_temp_variable = { Victory_Points = -200 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						every_country = {
							limit = { is_ai = no }
							news_event = { id = WORLD.30118 days = 1 }
						}
					}
					if = {
						limit = {
							FROM = {
								OR = {
									original_tag = CLD
									original_tag = CLL
								}
							}
						}
						CLD = {
							set_capital = { state = 306 }
							set_cosmetic_tag = CLD_CCW3
							retire_character = CLD_Diogenes_Gil
							promote_character = CLD_Jose_Camacho_Carreno
							set_variable = { national_debt = 0 }
							add_ideas = {
								CLD_The_Free_Dissipation_of_Babylon
								CLD_Bolivarian_Evocations
							}
							diplomatic_relation = {
								country = CLL
								relation = military_access
								active = no
							}
							country_event = { id = colombia.22 months = 6 }
						}
						CLL = {
							set_temp_variable = { TNO_economy_type_temp = token:Econ_Type_Capitalism }
							econ_type_change = yes
							set_cosmetic_tag = CLL_CCW3
							econ_join_sphere_USA = yes
							promote_character = {
								character = CLL_Frente_Democratico_Unido
								ideology = anocracy_provisional_government_subtype
							}
						}
					}
					set_global_flag = skip_default_capitulation
					set_variable = { test_var = 1 }
					log="[GetDateText]: [Root.GetName] peaced out [From.GetName]"
				}

				###CCW3###
				else_if = {
					limit = {
						has_global_flag = COL_CCW3
						FROM = {
							OR = {
								tag = CLL
								tag = CLC
								tag = CLD
							}
							NOT = { has_war_with = GER }
						}
						ROOT = {
							OR = {
								tag = CLL
								tag = CLC
								tag = CLD
							}
							NOT = { has_war_with = GER }
						}
					}
					FROM = {
						every_enemy_country = {
							limit = {
								OR = {
									original_tag = ROOT
									is_in_faction_with = ROOT
								}
							}
							FROM = {
								white_peace = PREV
								annex_country = {
									target = PREV
									transfer_troops = no
								}
								every_state = {
									remove_core_of = ROOT
								}
							}
						}
					}
					if = {
						limit = {
							FROM = {
								original_tag = CLD
							}
							has_global_flag = COL_CCW3
						}
						USA = {
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 1 }
							set_temp_variable = { Victory_Points = -200 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						every_country = {
							limit = { is_ai = no }
							news_event = { id = WORLD.30119 days = 1 }
						}
					}
					if = {
						limit = {
							FROM = {
								original_tag = CLL
							}
							has_global_flag = COL_CCW3
							NOT = {
								country_exists = CLD
							}
						}
						CLL = {
							set_capital = { state = 306 }
							add_ideas = {
								OFN_Independent_Member
							}
							add_country_leader_role = {
								character = CLL_Consejo_Democratico_Colombiano
								promote_leader = yes
								country_leader = {
									expire = "1990.2.2"
									ideology = anocracy_transitioning_democracy_subtype
									traits = { }
									id = -1
								}
							}
						}
						USA = { add_to_faction = CLL }
						GER = {
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 2 }
							set_temp_variable = { Victory_Points = -100 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						USA = {
							set_temp_variable = { Victory_ID = 30 }
							set_temp_variable = { Victory_Outcome = 4 }
							set_temp_variable = { Victory_Points = 100 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						every_country = {
							limit = { is_ai = no }
							news_event = { id = WORLD.30120 days = 1 }
						}
					}
					set_global_flag = skip_default_capitulation
					set_variable = { test_var = 1 }
					log="[GetDateText]: [Root.GetName] peaced out [From.GetName]"
				}

				#YEMENI CIVIL WAR
				#NYM Victory
				else_if = {
					limit = {
						FROM = { original_tag = NYM }
						OR = {
							ROOT = { original_tag = OMA }
							ROOT = { original_tag = YEM }
						}
					}
					add_to_variable = {
						var = global.PanArabRadicalism
						value = 2
					}
					FROM = {
						white_peace = ROOT
						#white_peace = {
							#	tag = ROOT
							#	message = yemen_nym_wins_msg
							#}
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
					}
					set_global_flag = YemenCivilWarOver
					set_global_flag = skip_default_capitulation
				}
				#YEM Victory
				else_if = {
					limit = {
						ROOT = { original_tag = NYM }
						OR = {
							FROM = { original_tag = YEM }
							FROM = { original_tag = OMA }
						}
					}
					add_to_variable = {
						var = global.PanArabRadicalism
						value = 1
					}
					YEM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
					}
					if = {
						limit = { OMA = { has_war_with = NYM } }
						OMA = {
							white_peace = ROOT
						}
					}
					set_global_flag = YemenCivilWarOver
					set_global_flag = skip_default_capitulation
				}
				else_if = { # OLD ECW - HMMLR capitulated One Country
					limit = {
						has_game_rule = {
							rule = BRITAIN_CONTENT_STATUS
							option = BRITAIN_OLD
						}
						FROM = { original_tag = FEN }
						OR = {
							AND = {
								ROOT = { original_tag = CRN }
								ENG = { has_capitulated = no }
							}
							AND = {
								ROOT = { original_tag = ENG }
								CRN = { has_capitulated = no }
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = { # OLD ECW - HMMLR victory
					limit = {
						has_game_rule = {
							rule = BRITAIN_CONTENT_STATUS
							option = BRITAIN_OLD
						}
						FROM = { original_tag = FEN }
						OR = {
							AND = {
								ROOT = { original_tag = CRN }
								ENG = { has_capitulated = yes }
							}
							AND = {
								ROOT = { original_tag = ENG }
								CRN = { has_capitulated = yes }
							}
						}
					}
					clr_global_flag = ECW_ongoing
					set_global_flag = FEN_GF_WonEcw
					set_global_flag = ECW_Finished
					CRN = {
						hidden_effect = {
							remove_ideas = {
								CRN_nothing_without_us
								CRN_nothing_without_us_2
								CRN_accords_are_dead
								CRN_the_blitz_reborn
							}
						}
						transfer_navy = {
							target = GER
						}
						GER = {
							country_event = ENG_HMMLRECW.7
						}
					}
					ENG = {
						load_focus_tree = ZZZ_blank_focus
						hidden_effect = {
							set_temp_variable = { temp_poverty_change = 10 }
							TNO_change_poverty_rate_direct = yes
							remove_ideas = {
								ENG_Brutal_War
								ENG_Brutal_War_AI
								ENG_the_legitimate_government
								ENG_promises_of_change
								ENG_a_force_of_darkness
								ENG_a_force_of_darkness_2
								ENG_a_force_of_darkness_3
								ENG_new_model_army
								ENG_new_model_army_2
								ENG_holding_out
								ENG_pushing_forward
								ENG_desperate_measures
								ENG_desperate_measures_2
								ENG_a_dirty_war
								ENG_anti_terrorist_actions_idea
								TNO_ParliamentMechanic_Monarch_Edward_VIII
								TNO_ParliamentMechanic_OppLeader_Harold_Macmillan
								TNO_ParliamentMechanic_Speaker_Alec_Douglas_Home
							}

						}
						white_peace = CRN
						GER = {
							transfer_state = 1994
						}
						annex_country = {
							target = CRN
							transfer_troops = no
						}
						ENG_HMMLR_ECW_VictoryPreAnnex = yes
						white_peace = FEN
						annex_country = {
							target = FEN
							transfer_troops = yes
						}
						every_owned_state = {
							add_core_of = ENG
							remove_core_of = FEN
							remove_core_of = CRN
						}
						diplomatic_relation = {
							country = CRN
							relation = military_access
							active = no
						}
						country_event = {
							id = ENG_HMMLRECW.4
							days = 2
						}
						country_event = {
							id = ENG_flavor.56
							days = 2
						}
					}
					FEN = {
						hidden_effect = {
							remove_ideas = {
								ENG_the_last_battle
								ENG_the_last_battle_2
								ENG_the_last_battle_3
								ENG_who_dares_wins
								ENG_who_dares_wins_2
								ENG_who_dares_wins_3
								ENG_who_dares_wins_4
								ENG_who_dares_wins_5
								ENG_the_left_resistance
								ENG_the_left_resistance_2
								ENG_the_left_resistance_3
								ENG_the_left_resistance_4
							}
						}
					}
					CRN = {
						diplomatic_relation = {
							country = ENG
							relation = military_access
							active = no
						}
					}
					SCO = {
						set_temp_variable = { target = FEN }
						TNO_clear_num_volunteers = yes
						remove_ideas = {
							SCO_UPECW_Volunteers
						}
					}
					BLZ = {
						country_event = {
							id = BLZ_skeleton.4
							days = 1
						}
					}
					ENG = {
						if = {
							limit = {
								has_dynamic_modifier = {
									modifier = ENG_DYNMON_english_army
								}
							}
							remove_dynamic_modifier = { modifier = ENG_DYNMON_english_army }
						}
					}
					MEX = {
						remove_opinion_modifier = {
							target = ENG
							modifier = TNO_illegitimate_govt
						}
						set_variable = { trade_opinion_embargo@ENG = 0 }
						remove_opinion_modifier = {
							target = ENG
							modifier = TNO_embargo_50
						}
					}
					ENG = {
						remove_opinion_modifier = {
							target = MEX
							modifier = TNO_refused_to_recognize_us
						}
						remove_opinion_modifier = {
							target = MEX
							modifier = TNO_embargoed_us_50
						}
					}
					every_country = {
						limit = { is_ai = no }
						news_event = { id = WORLD.60000 }
					}
					set_global_flag = skip_default_capitulation
				}
				
				else_if = { # NEW ECW - HMMLR victory
					limit = {
						FROM = { original_tag = FEN }
						ROOT = { original_tag = ENG }	
					}
					clr_global_flag = TFL_ECW_ongoing
					set_global_flag = FEN_GF_WonEcw
					set_global_flag = ECW_Finished
					ENG = {
						load_focus_tree = ZZZ_blank_focus
						set_cosmetic_tag = ENG_transitional_govt
						hidden_effect = {
							set_temp_variable = { temp_poverty_change = 10 }
							TNO_change_poverty_rate_direct = yes
							BRI_Party_Disable = yes
							BRI_Mann_Disable = yes
							BRI_Midnight_Disable = yes
						}
						GER = {
							transfer_state = 1994
						}
						ENG_HMMLR_ECW_VictoryPreAnnex_NEW = yes
						white_peace = FEN
						annex_country = {
							target = FEN
							transfer_troops = yes
						}
						every_owned_state = {
							add_core_of = ENG
							remove_core_of = FEN
							remove_province_modifier = {
								static_modifiers = { ENG_uprising_combat_malus }
								province = { all_provinces = yes }
							}
						}
						if = {
							limit = { has_global_flag = german_civil_war_heydrichvic }
							country_event = {
								id = hmmlrSkeleton.1
								days = 50
							}
							meta_effect = { #sets up next election date in country ui
								text = {
									set_politics = {
										ruling_party = despotism
										last_election = "[current_election_date]"
										elections_allowed = yes
										election_frequency = 5
									}
								}
								current_election_date = "[?global.date.GetDateStringNoHour]"
							}
						}
						else_if = {
							limit = { has_global_flag = german_civil_war_end }
							country_event = {
								id = channelcrisis.1
								days = 7
							}
						}
						2002 = {
							if = {
								limit = { has_dynamic_modifier = { modifier = BRI_Hold_Birmingham } }
								remove_dynamic_modifier = {
									modifier = BRI_Hold_Birmingham
								}
							}
						}
					}
					FEN = {
						hidden_effect = {
							remove_ideas = {
								ENG_the_last_battle
								ENG_the_last_battle_2
								ENG_the_last_battle_3
								ENG_who_dares_wins
								ENG_who_dares_wins_2
								ENG_who_dares_wins_3
								ENG_who_dares_wins_4
								ENG_who_dares_wins_5
								ENG_the_left_resistance
								ENG_the_left_resistance_2
								ENG_the_left_resistance_3
								ENG_the_left_resistance_4
							}
							every_unit_leader = {
								set_nationality = ENG
							}
							BRI_Midnight_Disable = yes
						}
					}
					MEX = {
						remove_opinion_modifier = {
							target = ENG
							modifier = TNO_illegitimate_govt
						}
						set_variable = { trade_opinion_embargo@ENG = 0 }
						remove_opinion_modifier = {
							target = ENG
							modifier = TNO_embargo_50
						}
					}
					ENG = {
						remove_opinion_modifier = {
							target = MEX
							modifier = TNO_refused_to_recognize_us
						}
						remove_opinion_modifier = {
							target = MEX
							modifier = TNO_embargoed_us_50
						}
					}
					CAN = {
						set_temp_variable = { target = FEN }
						TNO_clear_num_volunteers = yes
					}
					AST = {
						set_temp_variable = { target = FEN }
						TNO_clear_num_volunteers = yes
					}
					NZL = {
						set_temp_variable = { target = FEN }
						TNO_clear_num_volunteers = yes
					}
					every_country = {
						limit = { is_ai = no }
						news_event = { id = WORLD_ENG.2 }
					}
					set_global_flag = skip_default_capitulation
				}
				
				else_if = { # OLD ECW - Collab victory
					limit = {
						has_game_rule = {
							rule = BRITAIN_CONTENT_STATUS
							option = BRITAIN_OLD
						}
						FROM = {
							OR = {
								original_tag = CRN
								original_tag = ENG
							}
						}
						ROOT = { original_tag = FEN }
					}
					clr_global_flag = ECW_ongoing
					CRN = {
						hidden_effect = {
							remove_ideas = {
								CRN_nothing_without_us
								CRN_nothing_without_us_2
								CRN_accords_are_dead
								CRN_the_blitz_reborn
							}
						}
						transfer_state = 123
						transfer_state = 1296
						transfer_state = 1375
						GER = {
							transfer_state = 1994
						}
						diplomatic_relation = {
							country = ENG
							relation = military_access
							active = no
						}
					}
					every_state = {
						remove_core_of = FEN
					}
					ENG = {
						load_focus_tree = ZZZ_blank_focus
						hidden_effect = {
							set_temp_variable = { temp_poverty_change = 10 }
							TNO_change_poverty_rate_direct = yes
							remove_ideas = {
								ENG_Brutal_War
								ENG_Brutal_War_AI
								ENG_the_legitimate_government
								ENG_promises_of_change
								ENG_a_force_of_darkness
								ENG_a_force_of_darkness_2
								ENG_a_force_of_darkness_3
								ENG_new_model_army
								ENG_new_model_army_2
								ENG_holding_out
								ENG_pushing_forward
								ENG_desperate_measures
								ENG_desperate_measures_2
								ENG_a_dirty_war
								ENG_anti_terrorist_actions_idea
							}
						}
						annex_country = {
							target = FEN
							transfer_troops = no
						}
						add_ideas = {
							ENG_reconstruction_of_England
							ENG_growing_hunger
							ENG_promising_future
						}
						TNO_Britain_ElectionSeason_Initialize_Post_ECW_Collab = yes
						country_event = {
							id = ENG_HMMLRECW.5
							days = 3
						}
						country_event = {
							id = ENG_flavor.57
							days = 2
						}
						diplomatic_relation = {
							country = CRN
							relation = military_access
							active = no
						}
					}
					FEN = {
						hidden_effect = {
							remove_ideas = {
								ENG_the_last_battle
								ENG_the_last_battle_2
								ENG_the_last_battle_3
								ENG_who_dares_wins
								ENG_who_dares_wins_2
								ENG_who_dares_wins_3
								ENG_who_dares_wins_4
								ENG_who_dares_wins_5
								ENG_the_left_resistance
								ENG_the_left_resistance_2
								ENG_the_left_resistance_3
								ENG_the_left_resistance_4
							}
						}
					}
					SCO = {
						set_temp_variable = { target = FEN }
						TNO_clear_num_volunteers = yes

						remove_ideas = {
							SCO_UPECW_Volunteers
						}
					}
					BLZ = {
						country_event = {
							id = BLZ_skeleton.5
							days = 1
						}
					}
					ENG = {
						if = {
							limit = {
								has_dynamic_modifier = {
									modifier = ENG_DYNMON_english_army
								}
							}
							remove_dynamic_modifier = { modifier = ENG_DYNMON_english_army }
						}
					}
					set_global_flag = skip_default_capitulation
					set_global_flag = ENG_GF_WonEcw
					set_global_flag = ECW_Finished
					every_country = {
						limit = { is_ai = no }
						news_event = { id = WORLD.50002 }
					}
					hidden_effect = { 
						SAF = {
							country_event = { id = HDV_SAF.120 days = 1 }
						}
					}
				}
				
				else_if = { # NEW ECW - Collab victory
					limit = {
						FROM = { original_tag = ENG }
						ROOT = { original_tag = FEN }
					}
					clr_global_flag = TFL_ECW_ongoing
					ENG = {
						load_focus_tree = ENG_Post_Civil_War
						set_popularities = {
							anocracy = 26
							anocracy_1 = 8
							anocracy_2 = 4
							despotism = 6
							liberal_conservatism = 2
							conservatism = 1
							fascism = 32
							fascism_2 = 16
							national_socialism = 5
						}
						hidden_effect = {
							set_temp_variable = { temp_poverty_change = 10 }
							TNO_change_poverty_rate_direct = yes
							remove_ideas = {
								ENG_Garrison_Support
								ENG_Simplified_Designs_1
								ENG_Simplified_Designs_2
								ENG_British_Fighting_Spirit
								ENG_Oil_Reserves
								ENG_A_Mere_Puppet
								ENG_British_Free_Corp_Influence_Low
								ENG_Garrison_Support
								ENG_Chaos_in_Production
								ENG_Big_Bad_Buff
							}
							BRI_Party_Show = yes
							BRI_Midnight_Disable = yes
							BRI_Mann_Disable = yes
							country_event = { id = britain_intros.16 days = 30 }
						}
						annex_country = {
							target = FEN
							transfer_troops = no
						}
						every_owned_state = {
							add_core_of = ENG
							remove_core_of = FEN
							remove_province_modifier = {
								static_modifiers = { ENG_uprising_combat_malus }
								province = { all_provinces = yes }
							}
						}
						add_ideas = {
							ENG_Britains_Economic_Ruin
							ENG_Fractured_Food_Supply
						#	ENG_promising_future
						}
						#country_event = {
						#	id = ENG_flavor.57
						#	days = 2
						#}
						2002 = {
							if = {
								limit = { has_dynamic_modifier = { modifier = BRI_Hold_Birmingham } }
								remove_dynamic_modifier = {
									modifier = BRI_Hold_Birmingham
								}
							}
						}
						if = {
							limit = { has_global_flag = german_civil_war_end }
							GER = { add_to_faction = ENG }
							if = {
								limit = { has_global_flag = german_civil_war_speervic }
								join_zollverein = yes
							}
							if = {
								limit = {
									NOT = {
										has_global_flag = german_civil_war_heydrichvic
									}
								}
								econ_join_sphere_GER = yes
							}
							if = {
								limit = {
									has_global_flag = german_civil_war_goeringvic
								}
								add_ideas = GGR_germany_build_for_us_pls
							}
							add_ideas = Pakt_Mitstreiter
						}
					}
					FEN = {
						hidden_effect = {
							remove_ideas = {
								ENG_The_Peoples_spirit
								ENG_A_Militia_Force
								ENG_For_Queen_and_Country
								ENG_Union_Supply_Line_Blockaded
							}
							BRI_Midnight_Disable = yes
						}
					}
					BLZ = {
						country_event = {
							id = BLZ_skeleton.5
							days = 1
						}
					}
					CAN = {
						set_temp_variable = { target = FEN }
						TNO_clear_num_volunteers = yes
					}
					AST = {
						set_temp_variable = { target = FEN }
						TNO_clear_num_volunteers = yes
					}
					NZL = {
						set_temp_variable = { target = FEN }
						TNO_clear_num_volunteers = yes
					}
					set_global_flag = skip_default_capitulation
					set_global_flag = ENG_GF_WonEcw
					set_global_flag = ECW_Finished
					every_country = {
						limit = { is_ai = no }
						news_event = { id = WORLD_ENG.1 }
					}
					hidden_effect = { 
						SAF = {
							country_event = { id = HDV_SAF.120 days = 1 }
						}
					}
				}

				else_if = { #Sealion II
					limit = {
						FROM = { 
							OR = {
								original_tag = GER
								is_in_faction_with = GER
							}
						}
						NOT = {
							has_global_flag = german_civil_war_goeringvic
						}
						ROOT = { original_tag = ENG }
					}
					ENG_CC_end_sealion_2 = yes
					set_global_flag = skip_default_capitulation
				}
				
				else_if = {
					limit = {
						FROM = { original_tag = ENG }
						ROOT = { original_tag = CRN }
					}
					CRN = {
						transfer_navy = {
							target = GER
						}
						GER = {
							country_event = ENG_HMMLRECW.7
							transfer_state = 1994
						}
					}
					ENG = {
						white_peace = CRN
						annex_country = {
							target = CRN
							transfer_troops = no
						}
					}
				}
				else_if = { #eng vs wales
					limit = {
						FROM = { original_tag = ENG }
						ROOT = { original_tag = WAL }
					}
					ENG = {
						annex_country = {
							target = WAL
							transfer_troops = no
						}
						if = {
							limit = {
								has_global_flag = ENG_GF_WonEcw
								has_government = conservatism
							}
							complete_national_focus = ENG_IT_Macmillan_forcing_them_back_in
						}
						else_if = {
							limit = {
								has_government = socialist
							}
							complete_national_focus = FEN_SLP_Int_y_mabb_darogans_pride
						}
						set_country_flag = ENG_Wales_Violent
						ENG_wales_setup = yes
					}
					set_global_flag = skip_default_capitulation
				}

				else_if = { #eng vs sco
					limit = {
						FROM = { original_tag = ENG }
						ROOT = { original_tag = SCO }
					}
					SCO = {
						transfer_navy = { target = ENG }
					}
					ENG = {
						annex_country = {
							target = SCO
							transfer_troops = no
						}
						if = {
							limit = {
								has_global_flag = ENG_GF_WonEcw
								has_government = conservatism
							}
							complete_national_focus = ENG_IT_Macmillan_a_loud_refusal
						}
						else_if = {
							limit = {
								has_government = socialist
							}
							complete_national_focus = FEN_SLP_Int_the_capitalists_hold_out
						}
						remove_ideas = ENG_Scottish_mountains
						set_country_flag = ENG_Scottish_Violent
						ENG_scotland_setup = yes
					}
					set_global_flag = skip_default_capitulation
				}

				else_if = { #eng loses to wales
					limit = {
						FROM = { original_tag = WAL }
						ROOT = { original_tag = ENG }
					}
					WAL = {
						annex_country = {
							target = ENG
							transfer_troops = no
						}
					}
					every_country = {
						limit = { is_ai = no }
						news_event = {
							id = WORLD.50012
							days = 1
						}
					}
					set_global_flag = skip_default_capitulation
				}

				else_if = { #eng loses to scotland
					limit = {
						FROM = { original_tag = SCO }
						ROOT = { original_tag = ENG }
					}
					SCO = {
						annex_country = {
							target = ENG
							transfer_troops = no
						}
						every_country = {
							limit = { is_ai = no }
							news_event = {
								id = WORLD.50011
								days = 1
							}
						}
						if = {
							limit = {
								NOT = { has_country_flag = SCO_UP_COUP }
							}
							set_cosmetic_tag = SCO_UoB
							release_puppet = WAL
							release_puppet = ENG
							ENG = {
								retire_country_leader = yes
								set_popularities = { despotism = 100 }
								set_politics = {
									ruling_party = despotism
									elections_allowed = no
									last_election = "1962.12.17"
									election_frequency = 48
								}
								set_party_name = {
									ideology = despotism
									long_name = ENG_lose_scotland_party_long
									name = ENG_lose_scotland_party
								}
								add_country_leader_role = {
									character = SCO_ENG_Reconstruction
									promote_leader = yes
									country_leader = {
										ideology = despotism_interim_government_subtype
										traits = { }
										expire = "1999.12.31"
										id = -1
									}
								}
								remove_all_ministers = yes
								fill_empty_minister_nochecks = yes
								remove_ideas = {
									WAL_Welsh_CounterCulture
									WAL_Free_Welsh_Army
									WAL_welsh_coal_income_idea
								}
								econ_join_sphere_USA = yes
							}
							WAL = {
								retire_country_leader = yes
								set_popularities = { despotism = 100 }
								set_politics = {
									ruling_party = despotism
									elections_allowed = no
									last_election = "1962.12.17"
									election_frequency = 48
								}
								set_party_name = {
									ideology = despotism
									long_name = WAL_lose_scotland_party_long
									name = WAL_lose_scotland_party
								}
								add_country_leader_role = {
									character = SCO_WAL_Reconstruction
									promote_leader = yes
									country_leader = {
										ideology = despotism_interim_government_subtype
										traits = { }
										expire = "1999.12.31"
										id = -1
									}
								}
								remove_all_ministers = yes
								fill_empty_minister_nochecks = yes
								econ_join_sphere_USA = yes
							}
							meta_effect = {
								text = {
									ENG = {
										set_cosmetic_tag = ENG_[SCO_Party]_UoB_start
										load_focus_tree = ZZZ_blank_focus
										set_country_flag = ENG_Parliament_Disabled
									}
									WAL = {
										set_cosmetic_tag = WAL_[SCO_Party]_UoB_start
										load_focus_tree = ZZZ_blank_focus
									}
								}
								SCO_Party = "[GetScoParty]"
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#MALAYA PROXY WAR
				#MALAYA VICTORY
				else_if = { #Total USA victory
					limit = {
						FROM = { original_tag = MLY }
						ROOT = { original_tag = SHO }
					}
					MLY = {
						white_peace = SHO
						annex_country = {
							target = SHO
							transfer_troops = no
						}
					}
					SHO = {
						transfer_state = 751
						set_politics = {
							ruling_party = despotism
						}
						set_party_name = {
							ideology = despotism
							long_name = SHO_despotism_party_long_SG
							name = SHO_despotism_party_SG
						}
						set_party_name = {
							ideology = ultranationalism
							long_name = SHO_ultranationalism_party_long_SG
							name = SHO_ultranationalism_party_SG
						}
						set_popularities = {
							despotism = 80
							ultranationalism = 20
						}
						promote_character = SHO_Takeo_Kurosawa
						set_cosmetic_tag = SHO_Singapore
						add_ideas = Sphere_Imp_Protectorate
					}
					USA = {
						country_event = sho.4
					}
					JAP = {
						country_event = sho.51
					}
					GNG = {
						if = {
							limit = {
								has_country_flag = GNG_PTRG_Malaya
							}
							GNG_PTRG_Malaya_END = yes
						}
					}
					SHO_war_end_effect = yes
					set_global_flag = skip_default_capitulation
				}
				#Shonan VICTORY
				else_if = { #Total Japanese victory
					limit = {
						FROM = { original_tag = SHO }
						ROOT = { original_tag = MLY }
					}
					SHO = {
						white_peace = MLY
						annex_country = {
							target = MLY
							transfer_troops = no
						}
						every_owned_state = {
							add_core_of = SHO #Failsafe
							remove_core_of = MLY
						}
						800 = {
							remove_core_of = MLY
						}
						802 = {
							remove_core_of = MLY
						}
						2237 = {
							remove_core_of = MLY
						}
						set_popularities = {
							communist = 10
							socialist = 20
							progressivism = 5
							conservatism = 15
							anocracy = 10
							despotism = 30
							fascism = 0
							national_socialism = 0
							ultranationalism = 10
						}
						set_cosmetic_tag = SHO_provisional_government
						diplomatic_relation = {
							country = THA
							relation = military_access
							active = no
						}
						diplomatic_relation = {
							country = JAP
							relation = docking_rights
							active = no
						}
					}
					JAP = {
						country_event = sho.5
						diplomatic_relation = {
							country = SHO
							relation = docking_rights
							active = no
						}
					}
					THA = {
						diplomatic_relation = {
							country = SHO
							relation = military_access
							active = no
						}
					}
					USA = {
						country_event = sho.41
					}
					GNG = {
						if = {
							limit = {
								has_country_flag = GNG_PTRG_Malaya
							}
							GNG_PTRG_Malaya_END = yes
						}
					}
					SHO_war_end_effect = yes
					set_global_flag = skip_default_capitulation
				}

				###PHILIPPINES WARS###

				else_if = { ###Second Philippines Republic Capitulation
					limit = {
						ROOT = { original_tag = PHI }
						has_global_flag = PHI_proxy_war
					}
					PHI = {
						remove_ideas = {
							balintawak_blitz_idea
							PHI_dummy_capitulation
							PHI_fraudulent_sovereignty
							PHI_paradoxical_government
							PHI_listless_spirit
						}
					}
					if = {
						limit = {
							SPH = {
								controls_state = 327
							}
						}
						TNO_Blitz_SPH_victory = yes
					}
					else = {
						TNO_Blitz_UPH_victory = yes
					}
					UPH = {
						remove_ideas = balintawak_blitz_idea
						white_peace = PHI
					}
					SPH = {
						remove_ideas = balintawak_blitz_idea
						white_peace = PHI
					}
					set_global_flag = skip_default_capitulation
					log = "[GetDateText]: [Root.GetName]: on_actions peace_on_actions PHI capitulate"
					clear_variable = PHI.PHI_fucking_surrender_limit
					clear_variable = UPH.UPH_fucking_surrender_limit
					clear_variable = SPH.SPH_fucking_surrender_limit
				}

				else_if = { ###UPH Capitulation to PHI
					limit = {
						FROM = { original_tag = PHI }
						ROOT = { original_tag = UPH }
						has_global_flag = PHI_proxy_war
					}
					PHI = {
						white_peace = UPH
						annex_country = {
							target = UPH
							transfer_troops = no
						}
						if = {
							limit = {
								NOT = { country_exists = SPH }
							}
							TNO_Blitz_PHI_Victory = yes
							clear_variable = PHI.PHI_fucking_surrender_limit
							clear_variable = UPH.UPH_fucking_surrender_limit
							clear_variable = SPH.SPH_fucking_surrender_limit
							USA = {
								set_temp_variable = { Victory_ID = 19 }
								set_temp_variable = { Victory_Outcome = 1 }
								set_temp_variable = { Victory_Points = -100 }
								Cold_War_GUI_ManipulateVictory = yes
							}
							JAP = {
								set_temp_variable = { Victory_ID = 19 }
								set_temp_variable = { Victory_Outcome = 5 }
								set_temp_variable = { Victory_Points = 100 }
								Cold_War_GUI_ManipulateVictory = yes
							}
						}
					}
					set_global_flag = skip_default_capitulation
					log = "[GetDateText]: [Root.GetName]: on_actions peace_on_actions UPH capitulate"
				}

				else_if = { ###SPH Capitulation to PHI
					limit = {
						FROM = { original_tag = PHI }
						ROOT = { original_tag = SPH }
						has_global_flag = PHI_proxy_war
					}
					PHI = {
						white_peace = SPH
						annex_country = {
							target = SPH
							transfer_troops = no
						}
						if = {
							limit = {
								NOT = { country_exists = UPH }
							}
							TNO_Blitz_PHI_Victory = yes
							clear_variable = PHI.PHI_fucking_surrender_limit
							clear_variable = UPH.UPH_fucking_surrender_limit
							clear_variable = SPH.SPH_fucking_surrender_limit
							USA = {
								set_temp_variable = { Victory_ID = 19 }
								set_temp_variable = { Victory_Outcome = 1 }
								set_temp_variable = { Victory_Points = -100 }
								Cold_War_GUI_ManipulateVictory = yes
							}
							JAP = {
								set_temp_variable = { Victory_ID = 19 }
								set_temp_variable = { Victory_Outcome = 5 }
								set_temp_variable = { Victory_Points = 100 }
								Cold_War_GUI_ManipulateVictory = yes
							}
						}
					}
					set_global_flag = skip_default_capitulation
					log = "[GetDateText]: [Root.GetName]: on_actions peace_on_actions SPH capitulate"
				}

				else_if = { ###14th Army completely dead
					limit = {
						FROM = {
							OR = {
								original_tag = UPH
								original_tag = SPH
							}
						}
						ROOT = {
							original_tag = FGB
						}
					}
					set_global_flag = skip_default_capitulation
					if = {
						limit = {
							SPH = { has_capitulated = no }
						}
						SPH = {
							annex_country = {
								target = FGB
								transfer_troops = no
							}
						}
					}
					else = {
						UPH = {
							annex_country = {
								target = FGB
								transfer_troops = no
							}
						}
					}
					if = {
						limit = {
							UPH = { is_in_faction_with = SPH }
						}
						USA = {
							country_event = {
								id = PHI_Blitz.17 # Coalition ending
								days = 1
							}
						}
						log = "[GetDateText]: [Root.GetName]: on_actions peace_on_actions coalition gov't won"
					}
					else_if = { ### checks if PRP is already dead
						limit = {
							SPH = { exists = no }
						}
						USA = {
							country_event = {
								id = PHI_Blitz.166 # FPR ending
								days = 1
							}
						}
						log = "[GetDateText]: [Root.GetName]: on_actions peace_on_actions OFN mandate won"
					}
					else_if = { ### checks if Mandate is already dead
						limit = {
							NOT = { country_exists = UPH }
							SPH = { has_cosmetic_tag = SPH_PRP }
						}
						USA = {
							country_event = {
								id = PHI_Blitz.18 # Commie Philippines ending
								days = 1
							}
						}
					}
				}
				else_if = { ###FPR kills SPH
					limit = {
						FROM = { original_tag = UPH }
						ROOT = { original_tag = SPH }
					}
					if = {
						limit = {
							NOT = { country_exists = FGB }
						}
						USA = {
							country_event = {
								id = PHI_Blitz.166 # FPR ending
								days = 1
							}
						}
					}
					# Annexation already handled with default effects
				}
				else_if = { ###SPH kills FPR
					limit = {
						FROM = { original_tag = SPH }
						ROOT = { original_tag = UPH }
					}
					if = {
						limit = {
							NOT = { country_exists = FGB }
						}
						USA = {
							country_event = {
								id = PHI_Blitz.18 # Commie Philippines ending
								days = 1
							}
						}
					}
					# Annexation already handled with default effects
				}

				else_if = { ###14th army murders everyone
					limit = {
						FROM = { original_tag = FGB }
						ROOT = {
							OR = {
								original_tag = UPH
								original_tag = SPH
							}
						}
					}
					FGB = {
						add_to_variable = { PHI_14th_invasion_SPH_UPH = 1 }
						if = {
							limit = {
								check_variable = {
									PHI_14th_invasion_SPH_UPH = 2
								}
							}
							JAP = { country_event = PHI_Blitz.15 }
						}
					}
				}

								## Indian Civil War ##
				else_if = { # Azad Hind victory
					limit = {
						FROM = { original_tag = AZH }
						ROOT = { original_tag = IND }
					}
					FROM = {
						every_country = {
							limit = { is_ai = no }
							news_event = {
								id = WORLD.31012
								hours = 1
							}
						}
					}
					ROOT = {
						every_state = {
							limit = { is_core_of = ROOT }
							remove_core_of = ROOT
							add_core_of = FROM
						}
						every_state = {
							limit = { is_claimed_by = ROOT }
							remove_claim_by = ROOT
						}
					}
					IND = { # in the event AZH caps ROI too quickly
						if = {
							limit = {
								NOT = {
									has_global_flag = PAK_obq_success
								}
								country_exists = PAK
							}
							PAK_obq_success_effect = yes
						}
					}
					AZH = {
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						set_cosmetic_tag = AZH_unification
						if = {
							limit = {
								has_country_leader = { character = AZH_Subhas_Chandra_Bose ruling_only = yes }
							}
							country_event = {
								id = AZH_skeleton.9
								days = 1
							}
						}
						else_if = {
							limit = {
								has_country_leader = { character = AZH_Nedyam_Raghavan ruling_only = yes }
							}
							country_event = {
								id = AZH_skeleton.14
								days = 1
							}
						}
						else_if = {
							limit = {
								has_country_leader = { character = AZH_AC_Chatterji ruling_only = yes }
							}
							country_event = {
								id = AZH_skeleton.19
								days = 1
							}
						}
						set_capital = { state = 980 }
						add_ideas = {
							Sphere_Coequal
						}
						set_temp_variable = { temp_econ_GDP_boost_flat = -5.0 }
						econ_GDP_boost_once_flat = yes
						hidden_effect = {
							remove_ideas = {
								AZH_pandoras_box_1
								AZH_pandoras_box_2
								AZH_pandoras_box_3
								AZH_pandoras_box_4
								AZH_pandoras_box_5
								AZH_blockade_1
								AZH_blockade_2
								AZH_blockade_3
								AZH_JAP_military_advisors_0
								AZH_JAP_military_advisors_1
								AZH_JAP_military_advisors_2
								AZH_JAP_military_advisors_3
								AZH_JAP_military_advisors_4
								AZH_JAP_administrative_assistance_0
								AZH_JAP_administrative_assistance_1
								AZH_JAP_administrative_assistance_2
								AZH_JAP_administrative_assistance_3
								AZH_JAP_administrative_assistance_4
							}
							remove_dynamic_modifier = { modifier = AZH_black_years_dynamic_modifier }
						}
						if = {
							limit = {
								has_game_rule = {
									rule = INDIAN_REUNIFICATION_WAR_OUTCOME
									option = INDIAN_REUNIFICATION_WAR_OUTCOME_AZH
								}
							}
							remove_war_buff = yes
						}
					}
					NEP = {
						econ_join_sphere_JAP = yes
					}
					GER = {
						if = {
							limit = {
								NOT = {
									has_global_flag = PAK_obq_success
								}
							}
							country_event = {
								id = PAK_Germany.5
								days = 1
							}
						}
					}
					JAP = {
						add_to_faction = AZH
						set_temp_variable = { Victory_ID = 39 }
						set_temp_variable = { Victory_Outcome = 5 }
						set_temp_variable = { Victory_Points = 375 }
						Cold_War_GUI_ManipulateVictory = yes

						TNO_fopo_remove_india_civil_war_tab = yes
						set_temp_variable = { target = AZH }
						TNO_clear_and_recall_volunteers = yes
						if = {
							limit = {
								has_global_flag = PAK_obq_success
							}
							country_event = {
								id = jap_india.23
								days = 3
							}
						}
						else_if = {
							limit = {
								NOT = {
									has_global_flag = PAK_obq_success
								}
							}
							country_event = {
								id = jap_india.22
								days = 3
							}
						}
					}
					USA = {
						set_temp_variable = { Victory_ID = 39 }
						set_temp_variable = { Victory_Outcome = 1 }
						set_temp_variable = { Victory_Points = -375 }
						Cold_War_GUI_ManipulateVictory = yes

						TNO_fopo_remove_india_civil_war_tab = yes
						set_temp_variable = { target = IND }
						TNO_clear_and_recall_volunteers = yes
						if = {
							limit = {
								has_global_flag = PAK_obq_success
							}
							country_event = {
								id = USA_IND.27
								days = 3
							}
							country_event = {
								id = USA_IND.29
								days = 6
							}
						}
						else_if = {
							limit = {
								NOT = {
									has_global_flag = PAK_obq_success
								}
							}
							country_event = {
								id = USA_IND.28
								days = 3
							}
						}
					}
					PAK = {
						if = {
							limit = {
								exists = yes
							}
							if = {
								limit = {
									check_variable = { global.year < 1967 }
								}
								set_temp_variable = { temp_days = 717955 }
								subtract_from_temp_variable = { temp_days = global.num_days }
							}
							if = {
								limit = {
									has_global_flag = TNO_AZH_won_too_hard
								}
								add_to_temp_variable = { temp_days = 180 }
							}
							if = { # Null coalescing with variable
								limit = {
									check_variable = { temp_days = 0 }
								}
								set_temp_variable = { temp_days = 60 }
							}
							set_variable_to_random = {
								var = temp_offset
								min = 0
								max = 60
								integer = yes
							}
							add_to_temp_variable = { temp_days = temp_offset }
							country_event = {
								id = subcontinentalcrisis.1
								days = temp_days
							}
							# Intelligence report - T-0 Days
							GER = {
								country_event = {
									id = subcontinentalcrisis.102
									days = temp_days
								}
							}
							JAP = {
								country_event = {
									id = subcontinentalcrisis.103
									days = temp_days
								}
							}
							subtract_from_temp_variable = { temp_days = 15 }
							# Go West, Young Man - T-15 Days
							GER = {
								country_event = {
									id = subcontinentalcrisis.101
									days = temp_days
								}
							}
							JAP = {
								country_event = {
									id = subcontinentalcrisis.101
									days = temp_days
								}
							}
							# From East to West - T-30 Days
							subtract_from_temp_variable = { temp_days = 15 }
							GER = {
								country_event = {
									id = subcontinentalcrisis.100
									days = temp_days
								}
							}
							JAP = {
								country_event = {
									id = subcontinentalcrisis.100
									days = temp_days
								}
							}
							if = {
								limit = {
									has_game_rule = {
										rule = OPERATION_BIN_QASIM_WAR_OUTCOME
										option = OPERATION_BIN_QASIM_WAR_OUTCOME_SUCCESS
									}
								}
								remove_ideas = Custom_TNO_CHI_war_debuff
							}
							else_if = {
								limit = {
									has_game_rule = {
										rule = OPERATION_BIN_QASIM_WAR_OUTCOME
										option = OPERATION_BIN_QASIM_WAR_OUTCOME_FAILURE
									}
								}
								remove_war_buff = yes
							}
						}
					}
					clr_global_flag = ind_civil_war_ongoing
					set_global_flag = skip_default_capitulation
				}
				else_if = { # Republic of India Victory
					limit = {
						FROM = { original_tag = IND }
						ROOT = { original_tag = AZH }
					}
					FROM = {
						every_country = {
							limit = { is_ai = no }
							news_event = {
								id = WORLD.31011
								hours = 1
							}
						}
					}
					ROOT = {
						every_state = {
							limit = { is_core_of = ROOT }
							remove_core_of = ROOT
							add_core_of = FROM
						}
						every_state = {
							limit = { is_claimed_by = ROOT }
							remove_claim_by = ROOT
						}
					}
					IND = {
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						BHU = { CHI_save_pre_puppet_politics = yes }
						SIK = { CHI_save_pre_puppet_politics = yes }
						set_autonomy = {
							target = BHU
							autonomous_state = autonomy_italy_reliant
						}
						set_autonomy = {
							target = SIK
							autonomous_state = autonomy_italy_reliant
						}
						BHU = { CHI_apply_pre_puppet_politics = yes }
						SIK = { CHI_apply_pre_puppet_politics = yes }
						set_politics = {
							ruling_party = progressivism
							last_election = "1962.7.25"
							election_frequency = 60
							elections_allowed = yes
						}
						if = {
							limit = {
								NOT = { 
									has_global_flag = PAK_obq_success
								} 
							}
							add_ideas = IND_The_Behemoth_Shastri
						}
						else = {
							add_ideas = IND_The_Behemoth_Shastri_OBQ
						}
						set_temp_variable = { temp_econ_GDP_boost_flat = -5.0 }
						econ_GDP_boost_once_flat = yes
						hidden_effect = {
							remove_ideas = {
								IND_pandoras_box_1
								IND_pandoras_box_2
								IND_pandoras_box_3
								IND_pandoras_box_4
								IND_pandoras_box_5
								IND_blockade_1
								IND_blockade_2
								IND_blockade_3
								IND_USA_pressured_military
								IND_USA_military_advisors
								IND_USA_administrative_assistance
								IND_Cry_Havoc
							}
							remove_dynamic_modifier = { modifier = IND_black_years_dynamic_modifier }
						}
						if = {
							limit = {
								has_game_rule = {
									rule = INDIAN_REUNIFICATION_WAR_OUTCOME
									option = INDIAN_REUNIFICATION_WAR_OUTCOME_IND
								}
							}
							remove_war_buff = yes
						}
					}
					BHU = {
						leave_faction = yes
						econ_leave_sphere = yes
						set_politics = {
							ruling_party = anocracy
						}
						set_popularities = {
							anocracy = 67
							despotism = 19
							conservatism = 14
						}
						remove_ideas = {
							BHU_In_Kolkatas_Shadow
							Sphere_Fully_Dependent
						}
					}
					SIK = {
						leave_faction = yes
						econ_leave_sphere = yes
						set_politics = {
							ruling_party = anocracy
						}
						set_popularities = {
							communist = 1
							socialist = 4
							liberalism = 10
							liberal_conservatism = 25
							conservatism = 20
							anocracy = 30
							despotism = 10
						}
						remove_ideas = {
							SIK_Legacy_of_Tumlong
							Sphere_Fully_Dependent
						}
					}
					USA = {
						set_temp_variable = { Victory_ID = 39 }
						set_temp_variable = { Victory_Outcome = 5 }
						set_temp_variable = { Victory_Points = 375 }
						Cold_War_GUI_ManipulateVictory = yes

						TNO_fopo_remove_india_civil_war_tab = yes
						set_temp_variable = { target = IND }
						TNO_clear_and_recall_volunteers = yes
						if = {
							limit = {
								has_global_flag = PAK_obq_success
							}
							country_event = {
								id = USA_IND.25
								days = 3
							}
						}
						else_if = {
							limit = {
								NOT = {
									has_global_flag = PAK_obq_success
								}
							}
							#country_event = { #Pending New Event
							#	id = USA_IND.26
							#	days = 3
							#}
						}
						country_event = {
							id = USA_IND.17
							days = 5
						}
					}
					JAP = {
						set_temp_variable = { Victory_ID = 39 }
						set_temp_variable = { Victory_Outcome = 1 }
						set_temp_variable = { Victory_Points = -375 }
						Cold_War_GUI_ManipulateVictory = yes

						TNO_fopo_remove_india_civil_war_tab = yes
						set_temp_variable = { target = AZH }
						TNO_clear_and_recall_volunteers = yes

						country_event = {
							id = jap_india.21
							days = 3
						}
					}
					clr_global_flag = ind_civil_war_ongoing
					set_global_flag = skip_default_capitulation
				}

				## Operation Bin Qasim ##
				else_if = { # Republic of India Victory
					limit = {
						NOT = {
							has_global_flag = IND_peaceful_reunification
						}
						FROM = { original_tag = IND }
						ROOT = { original_tag = PAK }
					}
					FROM = {
						every_country = {
							limit = { is_ai = no }
							news_event = {
								id = WORLD_PAK.40
								hours = 1
							}
						}
					}
					ROOT = {
						every_state = {
							limit = { is_core_of = ROOT }
							remove_core_of = ROOT
							add_core_of = FROM
						}
					}
					IND = {
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
					}
					USA = {
						if = {
							limit = { has_country_flag = USA_IND_staffers_captured }
							country_event = USA_IND.24
						}
						country_event = {
							id = USA_IND.26
							days = 3
						}
					}
					GER = {
						set_temp_variable = { Victory_ID = 40 }
						set_temp_variable = { Victory_Outcome = 1 }
						set_temp_variable = { Victory_Points = -50 }
						Cold_War_GUI_ManipulateVictory = yes
						TNO_fopo_remove_operation_bin_qasim_tab = yes 
						set_temp_variable = { target = PAK }
						TNO_clear_num_volunteers = yes
					}
					if = {
						limit = {
							has_game_rule = {
								rule = OPERATION_BIN_QASIM_WAR_OUTCOME
								option = OPERATION_BIN_QASIM_WAR_OUTCOME_SUCCESS
							}
						}
						PAK = {
							remove_ideas = Custom_TNO_CHI_war_debuff
						}
					}
					clr_global_flag = PAK_obq_ongoing
					PAK_remove_obq_claims = yes
					set_global_flag = skip_default_capitulation
				}
				else_if = { # Pakistan caps India somehow
					limit = {
						FROM = { original_tag = PAK }
						ROOT = { original_tag = IND }
					}
					if = {
						limit = {
							has_game_rule = {
								rule = OPERATION_BIN_QASIM_WAR_OUTCOME
								option = OPERATION_BIN_QASIM_WAR_OUTCOME_SUCCESS
							}
						}
						PAK = {
							remove_ideas = Custom_TNO_CHI_war_debuff
						}
					}
					else_if = {
						limit = {
							has_game_rule = {
								rule = OPERATION_BIN_QASIM_WAR_OUTCOME
								option = OPERATION_BIN_QASIM_WAR_OUTCOME_FAILURE
							}
						}
						PAK = {
							remove_war_buff = yes
						}
					}
					PAK_obq_success_effect = yes
					set_global_flag = skip_default_capitulation
				}
				
				## Invasion of Pakistan (Peaceful Indian Reunification) ##
				else_if = {
					limit = {
						FROM = { original_tag = IND }
						ROOT = { original_tag = PAK }
						has_global_flag = IND_peaceful_reunification
					}
					PAK = {
						442 = {
							add_core_of = AFG
							transfer_state_to = AFG
						}
						444 = {
							add_core_of = IND
							transfer_state_to = IND
						}
						445 = {
							add_core_of = IND
							transfer_state_to = IND
						}
						749 = {
							add_core_of = IND
							transfer_state_to = IND
						}
						929 = {
							add_core_of = AFG
							transfer_state_to = AFG
						}
						1533 = {
							add_core_of = IND
							transfer_state_to = IND
						}
						1534 = {
							add_core_of = IND
							transfer_state_to = IND
						}
						1889 = {
							add_core_of = AFG
							transfer_state_to = AFG
						}
						1890 = {
							add_core_of = AFG
							transfer_state_to = AFG
						}
						1891 = {
							add_core_of = IND
							transfer_state_to = IND
						}
						1892 = {
							add_core_of = IND
							transfer_state_to = IND
						}
						1893 = {
							add_core_of = IND
							transfer_state_to = IND
						}
						1894 = {
							add_core_of = AFG
							transfer_state_to = AFG
						}
						1895 = {
							add_core_of = AFG
							transfer_state_to = AFG
						}
						1896 = {
							add_core_of = AFG
							transfer_state_to = AFG
						}
						1897 = {
							add_core_of = AFG
							transfer_state_to = AFG
						}
						1898 = {
							add_core_of = AFG
							transfer_state_to = AFG
						}
						1899 = {
							add_core_of = AFG
							transfer_state_to = AFG
						}
					}
					AFG = { remove_ideas = AFG_The_Split_Pashtunkhwa }
					set_global_flag = skip_default_capitulation
				}

				## Invasion of Pakistan (Japanese Victory in Subcontinental Crisis) ##
				else_if = {
					limit = {
						FROM = { original_tag = AZH }
						ROOT = { original_tag = PAK }
					}
					ROOT = {
						every_state = {
							limit = { is_core_of = ROOT }
							remove_core_of = ROOT
							add_core_of = FROM
						}
					}
					AZH = {
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
					}
					clr_global_flag = AZH_PAK_war
					set_global_flag = skip_default_capitulation
					JAP = { country_event = { id = jap_india.29 days = 10 } }
				}

				### Madagaskar Peace Deals - i like to move it move it
				else_if = { # Rebel Victory
					limit = {
						FROM = { original_tag = MAD }
						ROOT = { original_tag = MDG }
					}
					MAD = {
						annex_country = {
							target = MDG
							transfer_troops = no
						}
					}
					MAD_Rebel_Victory = yes
					MAD_clear_proxy = yes
					set_global_flag = MAD_rebels_won
				}
				else_if = { # Colonial Victory
					limit = {
						FROM = { original_tag = MDG }
						ROOT = { original_tag = MAD }
					}
					MDG = {
						annex_country = {
							target = MAD
							transfer_troops = no
						}
					}
					MAD_Colonial_Victory = yes
					MAD_clear_proxy = yes
					set_global_flag = MAD_colony_won
				}

				#Western Insurrection
				else_if = {#NPA defeats China before Jaabn intervenes
					limit = {
						NOT = { has_global_flag = CHI_Western_Insurection_RoC_defeated }
						has_global_flag = CHI_Western_Insurrection_Crisis
						FROM = {
							OR = {
								original_tag = YUN
								has_idea = NLF_Member
							}
						}

						ROOT = {
							OR = {
								original_tag = CHI
								is_in_faction_with = CHI
							}
							NOT = { has_war_together_with = JAP }
						}
					}
					set_global_flag = YUN_WI_thx_paradox

					for_each_scope_loop = {
						array = YUN.WI_NCPC_state
						set_demilitarized_zone = no
						NCC = { transfer_state = PREV }
					}
					CHI = {
						every_unit_leader = {
							set_nationality = NCC
						}
					}
					NCC = {
						load_oob = "NCC_GAW"
						econ_join_sphere_JAP = yes
					}
					every_other_country = {
						limit = { is_in_faction_with = YUN }
						NCC = { set_embargo_PREV = yes }
						NCC = { PREV = { set_embargo_PREV = yes } }
					}

					YUN = {
						country_event = { id = yun_wi.30 }
						white_peace = CHI
						annex_country = {
							target = CHI
							transfer_troops = no
						}
					}
					JAP = {
						add_to_faction = NCC
						country_event = { id = japchiinteraction.3 days = 8 }
					}
					set_global_flag = CHI_Western_Insurection_RoC_defeated
					clr_global_flag = YUN_WI_thx_paradox
					set_global_flag = skip_default_capitulation
				}
				else_if = {#Other Chinese states are capitulated by Long Yun
					limit = {
						FROM = {
							OR = {
								original_tag = YUN
								has_idea = NLF_Member
							}
						}

						ROOT = {
							OR = {
								original_tag = MAN
								original_tag = MEN
								original_tag = GNG
								original_tag = GAN
								original_tag = GUX
								original_tag = SHX
								original_tag = XIK
								original_tag = QIN
								original_tag = TIB
								original_tag = XIN
								original_tag = NCC
							}
						}
					}
					set_global_flag = YUN_WI_thx_paradox

					YUN = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						if = {
							limit = {
								ROOT = { original_tag = NCC }
							}
							country_event = { id = yun_wi.36 }
						}
						else_if = {
							limit = {
								ROOT = { original_tag = MAN }
							}
							country_event = { id = yun_wi.37 }
						}
						else_if = {
							limit = {
								ROOT = { original_tag = TIB }
							}
							country_event = { id = yun_wi.38 }
						}
						else_if = {
							limit = {
								ROOT = { original_tag = GNG }
							}
							country_event = { id = yun_wi.39 }
						}
						else_if = {
							limit = {
								ROOT = { original_tag = MEN }
							}
							country_event = { id = yun.139 }
						}
					}
					if = {
						limit = {
							ROOT = {
								OR = {
									original_tag = NCC
									original_tag = GAN
									original_tag = MEN
									original_tag = GNG
									original_tag = MAN
								}
								NOT = { has_country_flag = YUN_NPA_despair_branch }
							}
						}
						YUN = {
							add_to_variable = { npagawprogress = 1 }
						}
						if = {
							limit = {
								check_variable = { YUN.npagawprogress = 5 }
							}
							JAP = {
								country_event = { id = japchiinteraction.12 }
								527 = { set_demilitarized_zone = no }
								1024 = { set_demilitarized_zone = no }
								1820 = { set_demilitarized_zone = no }
							}
						}
						else_if = {
							limit = {
								check_variable = { YUN.npagawprogress < 5 }
								NOT = { country_exists = GAN }
								NOT = { country_exists = NCC }
							}
							JAP = {
								country_event = { id = japchiinteraction.11 }
							}
						}
						if = {
							limit = {
								check_variable = { YUN.npagawprogress = 2 }
							}
							every_country = {
								limit = {
									has_idea = YUN_SEA_NOT_YOUR_BUSINESS_STOP
									is_in_faction_with = JAP
								}
								remove_ideas = YUN_SEA_NOT_YOUR_BUSINESS_STOP
								add_to_war = {
									targeted_alliance = JAP
									enemy = YUN
								}
							}
							VIN = {
								load_oob = "VIN_GAW"
								remove_ideas = VIN_japanese_army
							}
						}
					}
					clr_global_flag = YUN_WI_thx_paradox
					set_global_flag = skip_default_capitulation
				}

				else_if = {#Western Insurrection, Yunnan is defeated without Jaabnese help
					limit = {
						FROM = {
							is_in_faction_with = CHI
							NOT = { is_in_faction_with = JAP }
						}
						ROOT = {
							OR = {
								original_tag = YUN
								has_idea = NLF_Member
							}
						}
						has_global_flag = CHI_Western_Insurrection_Crisis
						NOT = { has_global_flag = JAP_Western_Insurrection_Intervention }
					}

					FROM = {
						white_peace = ROOT
					}

					YUN = {
						YUN_NPA_fails_effects = yes
						set_party_name = {
							ideology = despotism
							name = YUN_despotism_XRA_party
							long_name = YUN_despotism_XRA_party_long
						}
						YUN_zhou_longxiang = {
							add_country_leader_role = {
								country_leader = {
									desc = "POLITICS_ZHOU_LONGXIANG_DESC"
									ideology = despotism_interim_government_subtype
									traits = {  }
									expire = "1999.1.1.1"
									id = -1
								}
								promote_leader = yes
							}
						}
						set_politics = {
							ruling_party = despotism
							last_election = "1933.3.5"
							election_frequency = 48
							elections_allowed = no
						}
						set_popularities = {
							progressivism = 0
							liberalism = 0
							liberal_conservatism = 0
							despotism = 54
							conservatism = 4
							anocracy = 38
							fascism = 0
							national_socialism = 0
							ultranationalism = 4
						}
						add_ideas = Sphere_Economic_Dependent
						econ_join_sphere_JAP = yes
						set_cosmetic_tag = YUN_southwest_united_reconstruction
						CHI_save_pre_puppet_politics = yes
						CHI = {
							set_autonomy = {
								target = PREV
								autonomy_state = autonomy_satellite
							}
						}
						CHI_apply_pre_puppet_politics = yes
						clr_country_flag = YUN_long_yun_crusade
						if = {
							limit = { has_global_flag = WI_NPA_takes_Sichuan }
							country_event = { id = yun_zhengtong.15 days = 3 }
							country_event = { id = yun_zhengtong.22 days = 7 }
							CHI = {
								transfer_state = 605
								transfer_state = 1537
								transfer_state = 1538
								every_owned_state = {
									limit = {
										AND = {
											is_core_of = YUN
											is_core_of = CHI
										}
									}
									remove_core_of = YUN
								}
							}
						}
						if = {
							limit = { has_global_flag = GUX_joins_NPA }
							country_event = { id = yun_zhengtong.36 days = 4 }
						}
						country_event = { id = yun_zhengtong.29 days = 2 }
						country_event = { id = yun_zhengtong.43 days = 3 }
						country_event = { id = yun_zhengtong.50 days = 5 }
					}
					CHI = {
						country_event = { id = chi_wi.5 }
						if = {
							limit = {
								OR = {
									GUX = { has_idea = NLF_Member }
									SHX = { has_idea = NLF_Member }
								}
							}
							country_event = {
								id = chi.6674
								days = 365
							}
						}
						country_event = {
							id = chi.6672
							days = 730
						}
						set_temp_variable = { temp_credit_rating = 6 }
						set_temp_variable = { temp_credit_rating_min = 4 }
						set_temp_variable = { temp_credit_rating_max = 8 }
						econ_initialize_credit_rating_system = yes
					}
					for_each_scope_loop = {
						array = YUN.WI_NCPC_state
						set_demilitarized_zone = no
					}
					GNG = {
						country_event = { #Reaction Event
							id = GNG_Western_Insurrection.7
							hours = 6
						}
					}
					if = {
						limit = {
							XIK = {
								is_in_faction_with = CHI
								has_capitulated = yes
							}
							NOT = { country_exists = XIK }
						}
						every_state = {
							limit = { is_core_of = XIK }
							XIK = { transfer_state = PREV }
						}
					}
					else_if = {
						limit = {
							XIK = { has_idea = NLF_Member }
						}
						every_state = {
							limit = { is_core_of = XIK }
							YUN = { transfer_state = PREV }
							remove_core_of = XIK
						}
					}
					
					if = {
						limit = {
							GUX = {
								is_in_faction_with = CHI
								has_capitulated = yes
							}
						}
						every_state = {
							limit = { is_core_of = GUX }
							GUX = { transfer_state = PREV }
						}
					}
					else_if = {
						limit = {
							GUX = { has_idea = NLF_Member }
						}
						CHI = {
							annex_country = {
								target = GUX
								transfer_troops = no
							}
						}
					}

					if = {
						limit = {
							SHX = {
								is_in_faction_with = CHI
								has_capitulated = yes
							}
						}
						every_state = {
							limit = { is_core_of = SHX }
							SHX = { transfer_state = PREV }
						}
					}
					else_if = {
						limit = {
							SHX = { has_idea = NLF_Member }
						}
						CHI = {
							annex_country = {
								target = SHX
								transfer_troops = no
							}
						}
					}
					YUN = {
						every_owned_state = { add_core_of = PREV }
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = {#Western Insurrection, Yunnan is defeated with Jaabnese help
					limit = {
						FROM = {
							is_in_faction_with = CHI
							NOT = { is_in_faction_with = JAP }
						}
						ROOT = {
							OR = {
								original_tag = YUN
								has_idea = NLF_Member
							}
						}
						has_global_flag = CHI_Western_Insurrection_Crisis
						has_global_flag = JAP_WI_intervention_begun
					}

					FROM = {
						white_peace = ROOT
					}

					YUN = {
						YUN_NPA_fails_effects = yes
						set_party_name = {
							ideology = despotism
							name = YUN_despotism_XRA_party
							long_name = YUN_despotism_XRA_party_long
						}
						YUN_zhou_longxiang = {
							add_country_leader_role = {
								country_leader = {
									desc = "POLITICS_ZHOU_LONGXIANG_DESC"
									ideology = despotism_interim_government_subtype
									traits = {  }
									expire = "1999.1.1.1"
									id = -1
								}
								promote_leader = yes
							}
						}
						set_politics = {
							ruling_party = despotism
							last_election = "1933.3.5"
							election_frequency = 48
							elections_allowed = no
						}
						set_popularities = {
							progressivism = 0
							liberalism = 0
							liberal_conservatism = 0
							despotism = 54
							conservatism = 4
							anocracy = 38
							fascism = 0
							national_socialism = 0
							ultranationalism = 4
						}
						CHI_save_pre_puppet_politics = yes
						CHI = {
							set_autonomy = {
								target = PREV
								autonomy_state = autonomy_satellite
							}
						}
						CHI_apply_pre_puppet_politics = yes
						add_ideas = Sphere_Economic_Dependent
						econ_join_sphere_JAP = yes
						set_cosmetic_tag = YUN_southwest_united_reconstruction
						clr_country_flag = YUN_long_yun_crusade
						if = {
							limit = { has_global_flag = WI_NPA_takes_Sichuan }
							country_event = { id = yun_zhengtong.15 days = 3 }
							country_event = { id = yun_zhengtong.22 days = 7 }
							CHI = {
								transfer_state = 605
								transfer_state = 1537
								transfer_state = 1538
								every_owned_state = {
									limit = {
										AND = {
											is_core_of = YUN
											is_core_of = CHI
										}
									}
									remove_core_of = YUN
								}
							}
						}
						if = {
							limit = { has_global_flag = GUX_joins_NPA }
							country_event = { id = yun_zhengtong.36 days = 4 }
						}
						country_event = { id = yun_zhengtong.29 days = 2 }
						country_event = { id = yun_zhengtong.43 days = 3 }
						country_event = { id = yun_zhengtong.50 days = 5 }
					}
					if = {
						limit = {
							XIK = {
								is_in_faction_with = CHI
								has_capitulated = yes
							}
							NOT = { country_exists = XIK }
						}
						every_state = {
							limit = { is_core_of = XIK }
							XIK = { transfer_state = PREV }
						}
					}
					else_if = {
						limit = {
							XIK = { has_idea = NLF_Member }
						}
						every_state = {
							limit = { is_core_of = XIK }
							YUN = { transfer_state = PREV }
							remove_core_of = XIK
						}
					}

					if = {
						limit = {
							GUX = {
								is_in_faction_with = CHI
								has_capitulated = yes
							}
						}
						every_state = {
							limit = { is_core_of = GUX }
							GUX = { transfer_state = PREV }
						}
					}
					else_if = {
						limit = {
							GUX = { has_idea = NLF_Member }
						}
						CHI = {
							annex_country = {
								target = GUX
								transfer_troops = no
							}
						}
					}

					if = {
						limit = {
							SHX = {
								is_in_faction_with = CHI
								has_capitulated = yes
							}
						}
						every_state = {
							limit = { is_core_of = SHX }
							SHX = { transfer_state = PREV }
						}
					}
					else_if = {
						limit = {
							SHX = { has_idea = NLF_Member }
						}
						CHI = {
							annex_country = {
								target = SHX
								transfer_troops = no
							}
						}
					}
					CHI = {
						country_event = { id = chi_wi.6 }
						if = {
							limit = {
								OR = {
									GUX = { has_idea = NLF_Member }
									SHX = { has_idea = NLF_Member }
								}
							}
							country_event = {
								id = chi.6674
								days = 365
							}
						}
						country_event = {
							id = chi.6672
							days = 730
						}
						clr_country_flag = requested_help_Western_Insurrection
						set_temp_variable = { temp_credit_rating = 6 }
						set_temp_variable = { temp_credit_rating_min = 4 }
						set_temp_variable = { temp_credit_rating_max = 8 }
						econ_initialize_credit_rating_system = yes
					}
					for_each_scope_loop = {
						array = YUN.WI_NCPC_state
						set_demilitarized_zone = no
					}
					GNG = {
						country_event = { #Reaction Event
							id = GNG_Western_Insurrection.7
							hours = 6
						}
					}
					JAP = {
						clear_variable = JAP_advisor_level
						set_temp_variable = { target = CHI }
						TNO_clear_and_recall_volunteers = yes
					}
					YUN = {
						every_owned_state = { add_core_of = PREV }
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = {#Western Insurrection, Yunnan is defeated with direct IJA intervention
					limit = {
						FROM = {
							OR = {
								is_in_faction_with = JAP
								is_in_faction_with = CHI
							}
						}
						ROOT = { original_tag = YUN }
						has_global_flag = CHI_Western_Insurrection_Crisis
						has_global_flag = JAP_Western_Insurrection_Intervention
					}
					FROM = { white_peace = ROOT }
					YUN = {
						YUN_NPA_fails_effects = yes
						YUN_JAP_collab_effects = yes
					}
					if = {
						limit = {
							NOT = { XIK = { has_war_with = JAP } }
							NOT = { GUX = { has_war_with = JAP } }
							NOT = { SHX = { has_war_with = JAP } }
							NOT = { QIN = { has_war_with = JAP } }
							NOT = { XIN = { has_war_with = JAP } }
						}
						JAP = {
							country_event = {
								id = japchiinteraction.4
							}
							clear_variable = JAP_advisor_level
							set_temp_variable = { target = CHI }
							TNO_clear_and_recall_volunteers = yes
						}
						CHI = {
							clr_country_flag = requested_help_Western_Insurrection
							country_event = { id = chi.3000 }
						}
						clr_global_flag = CHI_Western_Insurrection_Crisis
					}
					clr_global_flag = CHI_Western_Insurection_RoC_defeated
					set_global_flag = skip_default_capitulation
				}
				else_if = {#Western Insurrection, warlord is defeated with direct IJA intervention
					limit = {
						FROM = {
							OR = {
								is_in_faction_with = JAP
								is_in_faction_with = CHI
							}
						}
						ROOT = { has_idea = NLF_Member }
						has_global_flag = CHI_Western_Insurrection_Crisis
						has_global_flag = JAP_Western_Insurrection_Intervention
					}
					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
					}
					if = {
						limit = { JAP = { has_war = no } }
						JAP = {
							country_event = {
								id = japchiinteraction.4
							}
							clear_variable = JAP_advisor_level
							set_temp_variable = { target = CHI }
							TNO_clear_and_recall_volunteers = yes
						}
						CHI = {
							clr_country_flag = requested_help_Western_Insurrection
							country_event = { id = chi.3000 }
						}
						clr_global_flag = CHI_Western_Insurrection_Crisis
					}
					clr_global_flag = CHI_Western_Insurection_RoC_defeated
					set_global_flag = skip_default_capitulation
				}
				else_if = {#GAW, China has fallen and Jaabn/Sphere troops capitulate NPA
					limit = {
						has_global_flag = CHI_Western_Insurection_RoC_defeated
						FROM = {
							is_in_faction_with = JAP
						}
						ROOT = {
							original_tag = YUN
						}
					}

					FROM = { white_peace = ROOT }
					if = {
						limit = {
							NOT = { XIK = { has_war_with = JAP } }
							NOT = { GUX = { has_war_with = JAP } }
							NOT = { SHX = { has_war_with = JAP } }
							NOT = { QIN = { has_war_with = JAP } }
							NOT = { XIN = { has_war_with = JAP } }
						}
						JAP = {
							country_event = {
								id = japchiinteraction.4
							}
							clear_variable = JAP_advisor_level
							set_temp_variable = { target = CHI }
							TNO_clear_and_recall_volunteers = yes
						}
						JAP = {
							set_temp_variable = { Victory_ID = 27 }
							set_temp_variable = { Victory_Outcome = 4 }
							set_temp_variable = { Victory_Points = 150 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						clr_global_flag = YUN_NPA_GAW_Crisis
					}
					GNG = {
						country_event = { #Reaction Event
							id = GNG_Western_Insurrection.12
							hours = 6
						}
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = {#GAW, China has fallen and Jaabn/Sphere troops capitulate warlords
					limit = {
						has_global_flag = CHI_Western_Insurection_RoC_defeated
						FROM = {
							is_in_faction_with = JAP
						}
						ROOT = {
							has_idea = NLF_Member
						}
					}

					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
					}
					if = {
						limit = { JAP = { has_war = no } }
						JAP = {
							country_event = {
								id = japchiinteraction.4
							}
							clear_variable = JAP_advisor_level
							set_temp_variable = { target = CHI }
							TNO_clear_and_recall_volunteers = yes
						}
						JAP = {
							set_temp_variable = { Victory_ID = 27 }
							set_temp_variable = { Victory_Outcome = 4 }
							set_temp_variable = { Victory_Points = 150 }
							Cold_War_GUI_ManipulateVictory = yes
						}
						clr_global_flag = YUN_NPA_GAW_Crisis
					}
					set_global_flag = skip_default_capitulation
				}

				#Yves gets curbestomped by Iberia
				else_if = {
					limit = {
						FROM = {
							tag = IBR
						}
						ROOT = {
							tag = SLG
						}
					}
					IBR = {
						country_event = {
							id = IBR.3005
						}
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = {
					limit = {
						FROM = {
							tag = IBR
						}
						ROOT = {
							tag = SPA
						}
					}
					IBR = {
						country_event = {
							id = IBR.819
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#IBERIAN WARS
				else_if = {
					limit = {
						FROM = {
							is_iberian_nation = yes
						}
						ROOT = {
							is_iberian_nation = yes
						}
					}
					# Deal with some special cases first
					# Morrocco
					if = {
						limit = {
							ROOT = {
								tag = MOR
							}
						}
						every_country = {
							limit = {
								is_iberian_nation = yes
								has_war_with = ROOT
							}
							ROOT = {
								white_peace = PREV
							}
						}
						ROOT = {
							every_owned_state = {
								limit = {
									check_variable = {
										THIS.controller = IBR
									}
								}
								IBR = {
									transfer_state = PREV
								}
							}
							every_owned_state = {
								limit = {
									OR = {
										is_claimed_by = TRZ
										is_core_of = TRZ
									}
									NOT = { is_owned_by = IBR }
								}
								TRZ = {
									add_state_core = PREV
									transfer_state = PREV
								}
							}
							every_owned_state = {
								limit = {
									OR = {
										is_claimed_by = RIF
										is_core_of = RIF
									}
									NOT = { is_owned_by = IBR }
								}
								RIF = {
									add_state_core = PREV
									transfer_state = PREV
								}
							}
						}
						TRZ = {
							set_cosmetic_tag = TRZ_iberian_war
							set_capital = { state = 1010 }
						}
						RIF = {
							set_cosmetic_tag = RIF_postwar
							set_capital = { state = 1150 }
							add_ideas = Sphere_Observer
							econ_join_sphere_JAP = yes
						}
					}
					else_if = {
						limit = {
							FROM = { tag = MOR }
							ROOT = { tag = RIF }
						}
						every_country = {
							limit = {
								is_iberian_nation = yes
								has_war_with = ROOT
							}
							ROOT = {
								white_peace = PREV
							}
						}
						MOR = {
							annex_country = {
								target = RIF
								transfer_troops = no
							}
							every_owned_state = {
								limit = { is_core_of = RIF }
								add_core_of = MOR
								remove_core_of = RIF
							}
						}
						MOR = { remove_state_core = 1546 }
					}
					else_if = {
						limit = {
							FROM = { tag = IBR }
							OR = {
								ROOT = { tag = RIF }
								ROOT = { tag = TRZ }
							}
						}
						every_state = {
							limit = {
								is_owned_by = ROOT
							}
							IBR = {
								transfer_state = PREV
							}
						}
					}
					# GNS
					else_if = {
						limit = {
							FROM = { tag = GNS }
						}
						every_state = {
							limit = {
								is_owned_by = ROOT
							}
							GNS = {
								transfer_state = PREV
							}
						}
					}
					# Everyone Else
					else = {
						# The winner could take states controlled by the capitulated country / them
						every_state = {
							limit = {
								is_owned_by = ROOT
								OR = {
									check_variable = {
										THIS.controller = FROM
									}
									check_variable = {
										THIS.controller = ROOT
									}
								}
								OR = {
									is_claimed_by = FROM
									is_core_of = FROM
								}
							}
							FROM = {
								add_state_core = PREV
								transfer_state = PREV
							}
						}
						# Every other country could take states controlled by them
						every_country = {
							limit = {
								is_iberian_nation = yes
								has_war_with = ROOT
							}
							every_state = {
								limit = {
									is_owned_by = ROOT
									check_variable = {
										THIS.controller = PREV
									}
									OR = {
										is_claimed_by = PREV
										is_core_of = PREV
									}
								}
								PREV = {
									add_state_core = PREV
									transfer_state = PREV
								}
							}
						}
						# Finally the winner can take states countrolled by other people
						every_state = {
							limit = {
								is_owned_by = ROOT
								OR = {
									is_claimed_by = FROM
									is_core_of = FROM
								}
							}
							FROM = {
								add_state_core = PREV
								transfer_state = PREV
							}
						}
					}
					every_country = {
						limit = {
							is_iberian_nation = yes
							has_war_with = ROOT
						}
						ROOT = {
							white_peace = PREV
						}
					}
					# Custom peacedeal if Spain take Portugal / Portugal take Spain
					if = {
						limit = {
							FROM = { tag = SPS }
							ROOT = {
								OR = {
									tag = POR
									tag = GNS
									tag = PPR
									tag = RPP
								}
							}
						}
						every_state = {
							limit = {
								is_portuguese_state = yes
								is_owned_by = ROOT
							}
							GNS = {
								add_state_core = PREV
								transfer_state = PREV
							}
						}
						SPS = {
							country_event = {
								id = iberiawars.35
							}
						}
					}
					else_if = {
						limit = {
							FROM = { tag = SPR }
							ROOT = {
								OR = {
									tag = POR
									tag = GNS
									tag = PPR
									tag = RPP
								}
							}
						}
						every_state = {
							limit = {
								is_portuguese_state = yes
								is_owned_by = ROOT
							}
							GNS = {
								add_state_core = PREV
								transfer_state = PREV
							}
						}
						SPR = {
							country_event = {
								id = iberiawars.34
							}
						}
					}
					else_if = {
						limit = {
							FROM = { tag = PPR }
							ROOT = {
								OR = {
									tag = IBR
									tag = FSR
									tag = FZL
									tag = SPR
									tag = SPA
									tag = SPS
								}
							}
						}
						every_state = {
							limit = {
								is_owned_by = ROOT
								is_spanish_state = yes
							}
							SPR = {
								add_state_core = PREV
								transfer_state = PREV
							}
						}
						PPR = {
							country_event = {
								id = iberiawars.37
							}
						}
					}
					else_if = {
						limit = {
							FROM = { tag = RPP }
							ROOT = {
								OR = {
									tag = IBR
									tag = FSR
									tag = FZL
									tag = SPR
									tag = SPA
									tag = SPS
								}
							}
						}
						every_state = {
							limit = {
								is_owned_by = ROOT
								is_spanish_state = yes
							}
							SPR = {
								add_state_core = PREV
								transfer_state = PREV
							}
						}
						RPP = {
							country_event = {
								id = iberiawars.36
							}
						}
					}
					else_if = {
						limit = {
							FROM = { tag = POR }
							ROOT = {
								OR = {
									tag = IBR
									tag = FSR
									tag = FZL
									tag = SPR
									tag = SPA
									tag = SPS
								}
							}
						}
						every_state = {
							limit = {
								is_owned_by = ROOT
								is_spanish_state = yes
							}
							SPR = {
								add_state_core = PREV
								transfer_state = PREV
							}
						}
						POR = {
							country_event = {
								id = iberiawars.36
							}
						}
					}
					every_country = {
						limit = {
							is_iberian_nation = yes
							is_puppet = no
							NOT = {
								OR = {
									has_cosmetic_tag = SPR_kingdom
									has_cosmetic_tag = IBR_WARS
									has_cosmetic_tag = SPR_military
									has_cosmetic_tag = TBA_GNS_district
									has_cosmetic_tag = CTL_GNS_district
									has_cosmetic_tag = SPS_GNS_district
									has_cosmetic_tag = RIF_postwar
									has_cosmetic_tag = TRZ_iberian_war
									has_cosmetic_tag = PPR_unified
									has_cosmetic_tag = SPR_puppet
								}
							}
						}
						drop_cosmetic_tag = yes
					}
					set_global_flag = skip_default_capitulation
					IBRWarsCheckPeace = yes
				}
				#Military Revolt wins in Iberia
				else_if = {
					limit = {
						FROM = {
							tag = SPA
						}
						ROOT = {
							tag = IBR
						}
					}
					SPA = {
						country_event = {
							id = IBR.818
						}
					}
					set_global_flag = skip_default_capitulation
				}
				#Iberia beat Military Revolt

				#Finland or Onega beats a Russian country
				else_if = {
					limit = {
						FROM = {
							OR = {
								tag = ONG
								tag = FIN
							}
						}
						ROOT = {
							OR = {
								tag = WSR
								tag = PRM
							}
						}
					}
					ROOT = { #Peaces out the South Urals as well as FIN + ONG
						every_enemy_country = {
							white_peace = FROM
						}
					}
					WSR = { # Prevents continuing on to invade South Urals
						clr_country_flag = BEGUN_SOUTHERN_URALS_CRISIS
						remove_mission = RUS_RFTU_war_mission
					}
					clear_global_event_target = RUS_western_unifier
					WRS_west_russian_collapse = yes
					#SWE_insurrection_FinlandWins = yes
					set_global_flag = skip_default_capitulation
				}
				#Onega beats West Siberia
				else_if = {
					limit = {
						has_global_flag = TNO_RUS_west_russia_collapse
						FROM = {
							OR = {
								tag = ONG
								tag = FIN
								is_central_russian_nation = yes
							}
						}
						ROOT = {
							tag = WSB
						}
					}
					ONG = {
						white_peace = ROOT
					}
					FIN = {
						white_peace = ROOT
					}
					every_country = {
						limit = {
							is_central_russian_nation = yes
						}
						white_peace = ROOT
					}
					clear_global_event_target = RUS_west_siberia_unifier
					WSB_ONG_west_siberia_collapse = yes
					set_global_flag = skip_default_capitulation
				}
				
				#Finland
				else_if = {
					limit = {
						FROM = { is_russian_nation = yes NOT = { original_tag = OMS } }
						MPR = { exists = no }
						ROOT = { original_tag = FIN }
					}
					FROM = {
						white_peace = ROOT
						add_state_core = 213
						add_state_core = 1359
						add_state_core = 1724
						transfer_state = 216
						transfer_state = 215
						transfer_state = 213
						transfer_state = 1359
						transfer_state = 1724
					}
					#SWE_insurrection_FinlandLoses = yes
					set_global_flag = skip_default_capitulation
				}

				else_if = {
					limit = {
						FROM = { is_russian_nation = yes NOT = { original_tag = OMS } }
						MPR = { exists = yes }
						ROOT = { original_tag = FIN }
					}
					FROM = {
						white_peace = ROOT
						add_state_core = 213
						add_state_core = 1359
						add_state_core = 1724
						transfer_state = 216
						transfer_state = 215
						transfer_state = 1359
					}
					MPR = {
						transfer_state = 213
						transfer_state = 1724
					}
					#SWE_insurrection_FinlandLoses = yes
					set_global_flag = skip_default_capitulation
				}
				
				else_if = {
					limit = {
						FROM = { original_tag = OMS }
						ROOT = { original_tag = FIN }
					}
					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
					}
					set_global_flag = skip_default_capitulation
				}
				
				else_if = { # Finland Civil War
					limit = {
						FROM = {
							OR = {
								original_tag = RFI
								original_tag = FIN
							}
						}
						ROOT = {
							OR = {
								original_tag = RFI
								original_tag = FIN
							}
						}
					}

					if = { # Red Finland Victory
						limit = {
							FROM = { original_tag = RFI }
						}
						FROM = {
							white_peace = ROOT
						}
						RFI = {
							annex_country = {
								target = FIN
								transfer_troops = no
							}
							every_state = { # For conquered states to swap cores
								limit = { is_core_of = FIN }
								add_core_of = RFI
								remove_core_of = FIN
							}
						}
						if = {
							limit = { WSR = { exists = yes } }
							WSR = {
								country_event = {
									id = murmansk_peace.1
									days = 3
								}
							}
						}
						else_if = {
							limit = {
								WSB = { exists = yes }
							}
							WSB = {
								country_event = {
									id = murmansk_peace.1
									days = 3
								}
							}
						}
						else = {
							SIB = {
								country_event = {
									id = murmansk_peace.1
									days = 3
								}
							}
						}
					}
					else = { # White Finland Victory
						limit = {
							FROM = { original_tag = FIN }
						}
						FIN = {
							country_event = { id = white_finland.2 days = 420 }
						}
						FROM = {
							white_peace = ROOT
						}
						FIN = {
							annex_country = {
								target = RFI
								transfer_troops = no
							}
							every_controlled_state = {
								remove_core_of = RFI
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = { # Kazakh Civil War
					limit = {
						FROM = {
							OR = {
								original_tag = KAZ
								original_tag = KZR
							}
							NOT = { has_war_with = KOM } # Check for Tabby, goes to default
						}
						ROOT = {
							OR = {
								original_tag = KAZ
								original_tag = KZR
							}
						}
					}

					if = { # Kazakh Victory
						limit = {
							FROM = { original_tag = KAZ }
						}
						FROM = {
							white_peace = ROOT
						}
						KAZ = {
							annex_country = {
								target = KZR
								transfer_troops = no
							}
							every_controlled_state = {
								add_core_of = KAZ
								remove_core_of = KZR
							}
							if = {
								limit = {
									has_country_leader = { character = KAZ_Zhumabek_Tashenev ruling_only = yes }
								}
								country_event = { id = KAZ_skeleton.8 }
							}
							else_if = {
								limit = {
									has_country_leader = { character = KAZ_Sagadat_Nurmagambetov ruling_only = yes }
								}
								country_event = { id = KAZ_skeleton.9 }
							}
						}
					}
					else = { # Russian Victory
						limit = {
							FROM = { original_tag = KZR }
						}
						FROM = {
							white_peace = ROOT
						}
						KZR = {
							annex_country = {
								target = KAZ
								transfer_troops = no
							}
							every_controlled_state = {
								add_core_of = KZR
								remove_core_of = KAZ
							}
							if = {
								limit = {
									has_country_leader = { character = KZR_Nikolai_Onoprienko ruling_only = yes }
								}
								country_event = { id = KAZ_skeleton.10 }
							}
							else_if = {
								limit = {
									has_country_leader = { character = KZR_Mikhail_Solomentsev ruling_only = yes }
								}
								country_event = { id = KAZ_skeleton.11 }
							}
						}
					}
					set_global_flag = skip_default_capitulation
				}

				#Central Asian shit oh dear god.
				else_if = {
					limit = {
						FROM = { tag = KYR }
						ROOT = { tag = UZB }
					}
					FROM = {
						white_peace = ROOT
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = {
					limit = {
						FROM = { tag = TRK }
						ROOT = { tag = KRK }
					}
					FROM = {
						white_peace = ROOT
					}
					UZB = {
						annex_country = {
							target = KRK
							transfer_troops = no
						}
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = {
					limit = {
						FROM = { tag = TAJ }
						ROOT = { tag = UZB }
					}
					FROM = {
						white_peace = ROOT
					}
					set_global_flag = skip_default_capitulation
				}
				else_if = {
					limit = {
						FROM = { tag = KRK }
						ROOT = { tag = UZB }
					}
					FROM = {
						white_peace = ROOT
					}
					UZB = {
						annex_country = {
							target = KRK
							transfer_troops = yes
						}
					}
					set_global_flag = skip_default_capitulation
				}

				else_if = {
					limit = {
						FROM = { original_tag = IME }
						ROOT = { original_tag = JOR }
					}
					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
						}
					}
					ITA = {
						puppet = IME
					}
					set_global_flag = skip_default_capitulation
				}

				else_if = { # Nukes
					limit = {
						NOT = { has_global_flag = nukes_disabled }
						FROM = {
							has_nuclear_arsenal = yes
						}
						ROOT = {
							has_nuclear_arsenal = yes
							NOT = { has_country_flag = TNO_nuke_disabled }
						}
					}
					ROOT = { country_event = { id = nuclearwar.6 days = 7 } }
					FROM = { country_event = { id = nuclearwar.6 days = 7 } }
					set_global_flag = skip_default_capitulation
				}

				## Bolivia-Santa Cruz (FULNA Victory) ##
				else_if = { # Santa Cruz victory
					limit = {
						has_global_flag = PAR_FULNA_victory
						FROM = {
							OR = {
								tag = STC
								tag = PAC
							}
						}
						ROOT = {
							tag = BOL
						}
					}

					every_country = {
						limit = { has_war_with = ROOT }
						white_peace = ROOT
					}

					if = {
						limit = {
							STC = { has_country_flag = STC_banzer }
						}
						STC = {
							STC_Hugo_Banzer = { set_nationality = BOL }
							if = {
								limit = {
									has_game_rule = {
										rule = BOL_STC_WAR_OUTCOME
										option =  BOL_STC_WAR_OUTCOME_STC
									}
								}
								remove_war_buff = yes
							}
						}
						BOL = {
							annex_country = { target = STC }
							set_cosmetic_tag = STC_banzer_peace

							remove_ideas = {
								BOL_patchwork_country
								BOL_century_of_humiliation
								BOL_boiling_point
							}

							retire_character = BOL_Armando_Alba_Zambrana
							promote_character = STC_Hugo_Banzer
							set_politics = { ruling_party = despotism }
							set_popularities = {
								despotism = 44
								anocracy = 36
								liberalism = 20
							}

							set_party_name = {
								ideology = despotism
								name = BOL_despotism_party_banzer
								long_name = BOL_despotism_party_banzer_long
							}
							set_party_name = {
								ideology = anocracy
								name = BOL_anocracy_party_banzer
								long_name = BOL_anocracy_party_banzer_long
							}
							set_party_name = {
								ideology = liberalism
								name = BOL_liberalism_party_banzer
								long_name = BOL_liberalism_party_banzer_long
							}
							econ_join_sphere_BRA = yes
						}
					}
					else = {
						every_country = {
							limit = { is_ai = no }
							news_event = {
								id = LATAM_news.179
								days = 1
							}
						}
						STC = {
							retire_character = STC_Carmelo_Ortiz_Taborga
							STC_Jose_Luis_Camacho_Parada = {
								add_country_leader_role = {
									country_leader = {
										desc = "POLITICS_CAMACHO_PARADA"
										ideology = anocracy_national_conservatism_subtype
										traits = {  }
										expire = "1999.1.1.1"
										id = -1
									}
									promote_leader = yes
								}
							}
							transfer_state = 487
							transfer_state = 1677
							transfer_state = 542
							add_state_core = 487
							add_state_core = 1677
							add_state_core = 542
							add_popularity = {
								ideology = anocracy
								popularity = 0.15
							}
							every_owned_state = {
								remove_core_of = BOL
								remove_core_of = PAR
							}
							diplomatic_relation = {
								country = PAC
								relation = military_access
								active = no
							}
							if = {
								limit = {
									has_game_rule = {
										rule = BOL_STC_WAR_OUTCOME
										option =  BOL_STC_WAR_OUTCOME_STC
									}
								}
								remove_war_buff = yes
							}
						}
						PAC = {
							diplomatic_relation = {
								country = STC
								relation = military_access
								active = no
							}
							country_event = {
								id = PAR_bolivia.4
								days = 3
							}
						}
					}

					set_global_flag = skip_default_capitulation
				}
				else_if = { # Bolivia victory
					limit = {
						has_global_flag = PAR_FULNA_victory
						FROM = {
							tag = BOL
						}
						ROOT = {
							tag = STC
						}
					}

					every_country = {
						limit = { has_war_with = ROOT }
						white_peace = ROOT
					}

					BOL = {
						annex_country = { target = STC }
						annex_country = { target = PAC }
						
						every_owned_state = {
							remove_core_of = STC
							remove_core_of = PAC
						}
						if = {
							limit = {
								has_game_rule = {
									rule = BOL_STC_WAR_OUTCOME
									option =  BOL_STC_WAR_OUTCOME_BOL
								}
							}
							remove_war_buff = yes
						}
					}

					every_country = {
						limit = { is_ai = no }
						news_event = {
							id = LATAM_news.178
							days = 1
						}
					}

					set_global_flag = skip_default_capitulation
				}

				## 12 Day War (FULNA Defeat) ##
				else_if = { # Bolivia cannot win this
					limit = {
						has_global_flag = PAR_FULNA_defeat
						FROM = {
							OR = {
								tag = STC
								tag = PAR
							}
						}
						ROOT = {
							tag = BOL
						}
					}
					PAR_end_twelve_day_war = yes
					set_global_flag = skip_default_capitulation
				}

				else_if = { # Puerto Plata Invasion
					limit = {
						OR = {
							has_global_flag = PPI_landing_ongoing
							has_global_flag = PPI_civil_war_ongoing
						}
						FROM = {
							OR = {
								original_tag = DOM
								original_tag = CAL
							}
						}
						ROOT = {
							OR = {
								original_tag = DOM
								original_tag = CAL
							}
						}
					}

					if = { # ceasefire collapsed
						limit = { has_global_flag = PPI_civil_war_ongoing }
						if = { # Balaguer Wins
							limit = {
								FROM = { original_tag = DOM }
								NOT = {
									DOM = {
										has_country_leader = {
											character = DOM_Ramfis_Trujillo
											ruling_only = yes
										}
									}
								}
							}
							
							TNO_PPI_DOM_victory_balaguer = yes
						}
						else_if = { # Ramfis Wins
							limit = {
								FROM = { original_tag = DOM }
							}

							TNO_PPI_DOM_victory_ramfis = yes
						}
						else = { # Rebels Win
							TNO_PPI_CAL_victory = yes
						}
					}
					else = { # before ceasefire
						if = { # Trujillo Wins
							limit = {
								FROM = { original_tag = DOM }
							}
							TNO_PPI_DOM_victory_trujillo = yes
						}
						else_if = { # Legion Wins -> Ceasefire
							limit = {
								FROM = { original_tag = CAL }
							}
							TNO_PPI_DOM_ceasefire = yes
						}
					}
					set_global_flag = skip_default_capitulation
				}

				else_if = { # Haitian Civil War - Uprising
					limit = {
						NOT = { has_global_flag = HIS_trujillo_blitz_ongoing }
						has_global_flag = TNO_HIS_HAI_uprising_ongoing
						FROM = {
							OR = {
								original_tag = DOM
								original_tag = HAI
								original_tag = HAC
							}
						}
						ROOT = {
							OR = {
								original_tag = DOM
								original_tag = HAI
								original_tag = HAC
							}
						}
					}
					TNO_HAI_civil_war_clear_proxy = yes
					if = {
						limit = { FROM = { original_tag = HAI } has_global_flag = HIS_revolutionary_front }
						HAI = { TNO_HAI_civil_war_HAI_victory_front = yes }
					}
					else_if = {
						limit = { FROM = { original_tag = HAI } }
						HAI = { TNO_HAI_civil_war_HAI_victory = yes }
					}
					else_if = {
						limit = { FROM = { original_tag = HAC } }
						HAC = { TNO_HAI_civil_war_HAC_victory = yes }
					}
					set_global_flag = skip_default_capitulation
				}

				else_if = { # Trujillo's Blitz
					limit = {
						has_global_flag = HIS_trujillo_blitz_ongoing
						FROM = {
							OR = {
								original_tag = DOM
								original_tag = HAI
								original_tag = HAC
							}
						}
						ROOT = {
							OR = {
								original_tag = DOM
								original_tag = HAI
								original_tag = HAC
							}
						}
					}

					if = {
						limit = {
							OR = {
								ROOT = { original_tag = HAI }
								ROOT = { original_tag = HAC }
							}
						}
						FROM = { white_peace = ROOT }
						ROOT = { dismantle_faction = yes }
						FROM = { annex_country = { target = ROOT transfer_troops = no } }
						if = {
							limit = { FROM = { original_tag = HAI } }
							HAI = { set_country_flag = HCW_awaiting_victory_HAI }
							clr_global_flag = TNO_HIS_HAI_uprising_ongoing
						}
						else_if = {
							limit = { FROM = { original_tag = HAC } }
							HAC = { set_country_flag = HCW_awaiting_victory_HAC }
							clr_global_flag = TNO_HIS_HAI_uprising_ongoing
						}
					}
					if = { # Trujillo Wins
						limit = {
							FROM = { original_tag = DOM }
							ROOT = { original_tag = HAI }
							NOT = { has_global_flag = HIS_trujillo_blitz_OFN_intevention }
						}
						
						TNO_HIS_blitz_clear_proxy = yes
						TNO_HIS_blitz_victory_trujillo = yes
						if = {
							limit = { HAI = { has_country_flag = HCW_awaiting_victory_HAI } }
							HAI = { clr_country_flag = HCW_awaiting_victory_HAI } # cleaning up the flag
						}
						else_if = {
							limit = { HAC = { has_country_flag = HCW_awaiting_victory_HAC } }
							HAC = { clr_country_flag = HCW_awaiting_victory_HAC } # cleaning up the flag
						}
					}
					else_if = { # Ceasefire - DR keeps Hinche
						limit = {
							FROM = { original_tag = DOM }
							ROOT = { original_tag = HAI }
							has_global_flag = HIS_trujillo_blitz_OFN_intevention
						}
						
						TNO_HIS_blitz_clear_proxy = yes
						TNO_HIS_blitz_ceasefire_trujillo = yes
						if = {
							limit = { HAI = { has_country_flag = HCW_awaiting_victory_HAI } }
							HAI = {
								TNO_HAI_civil_war_HAI_victory = yes
								clr_country_flag = HCW_awaiting_victory_HAI
							}
						}
						else_if = {
							limit = { HAC = { has_country_flag = HCW_awaiting_victory_HAC } }
							HAC = {
								TNO_HAI_civil_war_HAC_victory = yes
								clr_country_flag = HCW_awaiting_victory_HAC
							}
						}
					}
					else_if = { # Haiti Wins
						limit = { ROOT = { original_tag = DOM } }
						TNO_HIS_blitz_clear_proxy = yes
						TNO_HIS_blitz_victory_haiti = yes
						if = {
							limit = { HAI = { has_country_flag = HCW_awaiting_victory_HAI } }
							HAI = {
								TNO_HAI_civil_war_HAI_victory = yes
								clr_country_flag = HCW_awaiting_victory_HAI
							}
						}
						else_if = {
							limit = { HAC = { has_country_flag = HCW_awaiting_victory_HAC } }
							HAC = {
								TNO_HAI_civil_war_HAC_victory = yes
								clr_country_flag = HCW_awaiting_victory_HAC
							}
						}
					}

					set_global_flag = skip_default_capitulation
				}

				#DEFAULT CAPITULATION
				if = {
					limit = { NOT = { has_global_flag = skip_default_capitulation } }
					#Annex every country they've been fighting against
					log = "Default Capitulation"
					FROM = {
						every_enemy_country = {
							limit = {
								OR = {
									original_tag = ROOT
									is_in_faction_with = ROOT
									is_subject_of = ROOT
								}
							}
							FROM = {
								white_peace = PREV
								annex_country = {
									target = PREV
									transfer_troops = no
								}
							}
						}
					}
				}
			}
			else = {
				log = "war_goes_on"
				
				if = { #####Indonesia shit may redo later
					limit = {
						OR = {
							FROM = {
								original_tag = FRI
							}
							FROM = {
								original_tag = NII
							}
							FROM = {
								original_tag = DMS
							}
							FROM = {
								original_tag = DMP
							}
							FROM = {
								original_tag = SLS
							}
							FROM = {
								original_tag = PMT
							}
							FROM = {
								original_tag = ABD
							}
						}
						OR = {
							ROOT = {
								original_tag = INS
							}
						}
						NOT = {
							has_global_flag = TNO_INW_duumvirate
						}
					}
					set_global_flag = skip_default_capitulation
					if = {
						limit = {
							INS = {
								is_faction_leader = yes
							}
						}
						random_country = {
							limit = {
								is_in_faction_with = INS
							}
							set_faction_leader = yes
						}
					}
					INS = {
						every_owned_state = {
							transfer_state_to = FRI
						}
					}
					if = {
						limit = {
							FRI = {
								NOT = {
									is_in_faction_with = FROM
									original_tag = FROM
								}
							}
						}
						every_country = {
							limit = {
								AND = {
									OR = {
										has_war_with = INS
										has_war_with = SRB
										has_war_with = BKB
										has_war_with = MKS
									}
									is_faction_leader = yes
								}
							}
							add_to_faction = FRI
						}
					}
				}
				else_if = {
					limit = {
						OR = {
							FROM = {
								original_tag = FRI
							}
							FROM = {
								original_tag = NII
							}
							FROM = {
								original_tag = DMS
							}
							FROM = {
								original_tag = DMP
							}
							FROM = {
								original_tag = SLS
							}
							FROM = {
								original_tag = PMT
							}
							FROM = {
								original_tag = ABD
							}
						}
						OR = {
							ROOT = {
								original_tag = BKB
							}
						}
						NOT = {
							has_global_flag = TNO_INW_duumvirate
						}
					}
					set_global_flag = skip_default_capitulation
					if = {
						limit = {
							BKB = {
								is_faction_leader = yes
							}
						}
						random_country = {
							limit = {
								is_in_faction_with = BKB
							}
							set_faction_leader = yes
						}
					}
					BKB = {
						every_owned_state = {
							transfer_state_to = DMP
						}
					}
					if = {
						limit = {
							DMP = {
								NOT = {
									is_in_faction_with = FROM
									original_tag = FROM
								}
							}
						}
						every_country = {
							limit = {
								AND = {
									OR = {
										has_war_with = INS
										has_war_with = SRB
										has_war_with = BKB
										has_war_with = MKS
									}
									is_faction_leader = yes
								}
							}
							add_to_faction = DMP
						}
					}
				}
				else_if = {
					limit = {
						OR = {
							FROM = {
								original_tag = FRI
							}
							FROM = {
								original_tag = NII
							}
							FROM = {
								original_tag = DMS
							}
							FROM = {
								original_tag = DMP
							}
							FROM = {
								original_tag = SLS
							}
							FROM = {
								original_tag = PMT
							}
							FROM = {
								original_tag = ABD
							}
						}
						OR = {
							ROOT = {
								original_tag = SRB
							}
						}
						NOT = {
							has_global_flag = TNO_INW_duumvirate
						}
					}
					set_global_flag = skip_default_capitulation
					if = {
						limit = {
							SRB = {
								is_faction_leader = yes
							}
						}
						random_country = {
							limit = {
								is_in_faction_with = SRB
							}
							set_faction_leader = yes
						}
					}
					SRB = {
						every_owned_state = {
							transfer_state_to = FRI
						}
					}
					if = {
						limit = {
							FRI = {
								NOT = {
									is_in_faction_with = FROM
									original_tag = FROM
								}
							}
						}
						every_country = {
							limit = {
								AND = {
									OR = {
										has_war_with = INS
										has_war_with = SRB
										has_war_with = BKB
										has_war_with = MKS
									}
									is_faction_leader = yes
								}
							}
							add_to_faction = FRI
						}
					}
				}
				else_if = {
					limit = {
						OR = {
							FROM = {
								original_tag = FRI
							}
							FROM = {
								original_tag = NII
							}
							FROM = {
								original_tag = DMS
							}
							FROM = {
								original_tag = DMP
							}
							FROM = {
								original_tag = SLS
							}
							FROM = {
								original_tag = PMT
							}
							FROM = {
								original_tag = ABD
							}
						}
						OR = {
							ROOT = {
								original_tag = MKS
							}
						}
						NOT = {
							has_global_flag = TNO_INW_duumvirate
						}
					}
					set_global_flag = skip_default_capitulation
					if = {
						limit = {
							MKS = {
								is_faction_leader = yes
							}
						}
						random_country = {
							limit = {
								is_in_faction_with = MKS
							}
							set_faction_leader = yes
						}
					}
					MKS = {
						every_owned_state = {
							transfer_state_to = PMT
						}
					}
					if = {
						limit = {
							PMT = {
								NOT = {
									is_in_faction_with = FROM
									original_tag = FROM
								}
							}
						}
						every_country = {
							limit = {
								AND = {
									OR = {
										has_war_with = INS
										has_war_with = SRB
										has_war_with = BKB
										has_war_with = MKS
									}
									is_faction_leader = yes
								}
							}
							add_to_faction = PMT
						}
					}
				}
				else_if = {
					limit = {
						OR = {
							FROM = {
								original_tag = INS
							}
							FROM = {
								original_tag = BKB
							}
							FROM = {
								original_tag = SRB
							}
							FROM = {
								original_tag = MKS
							}
						}
						OR = {
							ROOT = {
								original_tag = FRI
							}
						}
						NOT = {
							has_global_flag = TNO_INW_duumvirate
						}
					}
					set_global_flag = skip_default_capitulation
					if = {
						limit = {
							FRI = {
								is_faction_leader = yes
							}
						}
						random_country = {
							limit = {
								is_in_faction_with = FRI
							}
							set_faction_leader = yes
						}
					}
					FRI = {
						every_owned_state = {
							transfer_state_to = INS
						}
					}
					if = {
						limit = {
							INS = {
								NOT = {
									is_in_faction_with = FROM
									original_tag = FROM
								}
							}
						}
						every_country = {
							limit = {
								AND = {
									OR = {
										has_war_with = DMP
										has_war_with = FRI
										has_war_with = NII
										has_war_with = ABD
										has_war_with = SLS
										has_war_with = PMT
										has_war_with = DMS
									}
									is_faction_leader = yes
								}
							}
							add_to_faction = INS
						}
					}
				}
				else_if = {
					limit = {
						OR = {
							FROM = {
								original_tag = INS
							}
							FROM = {
								original_tag = BKB
							}
							FROM = {
								original_tag = SRB
							}
							FROM = {
								original_tag = MKS
							}
						}
						OR = {
							ROOT = {
								original_tag = DMP
							}
						}
						NOT = {
							has_global_flag = TNO_INW_duumvirate
						}
					}
					set_global_flag = skip_default_capitulation
					if = {
						limit = {
							DMP = {
								is_faction_leader = yes
							}
						}
						random_country = {
							limit = {
								is_in_faction_with = DMP
							}
							set_faction_leader = yes
						}
					}
					DMP = {
						every_owned_state = {
							transfer_state_to = BKB
						}
					}
					if = {
						limit = {
							BKB = {
								NOT = {
									is_in_faction_with = FROM
									original_tag = FROM
								}
							}
						}
						every_country = {
							limit = {
								AND = {
									OR = {
										has_war_with = DMP
										has_war_with = FRI
										has_war_with = NII
										has_war_with = ABD
										has_war_with = SLS
										has_war_with = PMT
										has_war_with = DMS
									}
									is_faction_leader = yes
								}
							}
							add_to_faction = BKB
						}
					}
				}
				else_if = {
					limit = {
						OR = {
							FROM = {
								original_tag = INS
							}
							FROM = {
								original_tag = BKB
							}
							FROM = {
								original_tag = SRB
							}
							FROM = {
								original_tag = MKS
							}
						}
						OR = {
							ROOT = {
								original_tag = NII
							}
						}
						NOT = {
							has_global_flag = TNO_INW_duumvirate
						}
					}
					set_global_flag = skip_default_capitulation
					if = {
						limit = {
							NII = {
								is_faction_leader = yes
							}
						}
						random_country = {
							limit = {
								is_in_faction_with = NII
							}
							set_faction_leader = yes
						}
					}
					NII = {
						every_owned_state = {
							transfer_state_to = BKB
						}
					}
					if = {
						limit = {
							BKB = {
								NOT = {
									is_in_faction_with = FROM
									original_tag = FROM
								}
							}
						}
						every_country = {
							limit = {
								AND = {
									OR = {
										has_war_with = DMP
										has_war_with = FRI
										has_war_with = NII
										has_war_with = ABD
										has_war_with = SLS
										has_war_with = PMT
										has_war_with = DMS
									}
									is_faction_leader = yes
								}
							}
							add_to_faction = BKB
						}
					}
				}
				else_if = {
					limit = {
						OR = {
							FROM = {
								original_tag = INS
							}
							FROM = {
								original_tag = BKB
							}
							FROM = {
								original_tag = SRB
							}
							FROM = {
								original_tag = MKS
							}
						}
						OR = {
							ROOT = {
								original_tag = DMS
							}
						}
						NOT = {
							has_global_flag = TNO_INW_duumvirate
						}
					}
					set_global_flag = skip_default_capitulation
					if = {
						limit = {
							DMS = {
								is_faction_leader = yes
							}
						}
						random_country = {
							limit = {
								is_in_faction_with = DMS
							}
							set_faction_leader = yes
						}
					}
					DMS = {
						every_owned_state = {
							transfer_state_to = INS
						}
					}
					if = {
						limit = {
							INS = {
								NOT = {
									is_in_faction_with = FROM
									original_tag = FROM
								}
							}
						}
						every_country = {
							limit = {
								AND = {
									OR = {
										has_war_with = DMP
										has_war_with = FRI
										has_war_with = NII
										has_war_with = ABD
										has_war_with = SLS
										has_war_with = PMT
										has_war_with = DMS
									}
									is_faction_leader = yes
								}
							}
							add_to_faction = INS
						}
					}
				}
				else_if = {
					limit = {
						OR = {
							FROM = {
								original_tag = INS
							}
							FROM = {
								original_tag = BKB
							}
							FROM = {
								original_tag = SRB
							}
							FROM = {
								original_tag = MKS
							}
						}
						OR = {
							ROOT = {
								original_tag = ABD
							}
						}
						NOT = {
							has_global_flag = TNO_INW_duumvirate
						}
					}
					set_global_flag = skip_default_capitulation
					if = {
						limit = {
							ABD = {
								is_faction_leader = yes
							}
						}
						random_country = {
							limit = {
								is_in_faction_with = ABD
							}
							set_faction_leader = yes
						}
					}
					ABD = {
						every_owned_state = {
							transfer_state_to = SRB
						}
					}
					if = {
						limit = {
							SRB = {
								NOT = {
									is_in_faction_with = FROM
									original_tag = FROM
								}
							}
						}
						every_country = {
							limit = {
								AND = {
									OR = {
										has_war_with = DMP
										has_war_with = FRI
										has_war_with = NII
										has_war_with = ABD
										has_war_with = SLS
										has_war_with = PMT
										has_war_with = DMS
									}
									is_faction_leader = yes
								}
							}
							add_to_faction = SRB
						}
					}
				}
				else_if = {
					limit = {
						OR = {
							FROM = {
								original_tag = INS
							}
							FROM = {
								original_tag = BKB
							}
							FROM = {
								original_tag = SRB
							}
							FROM = {
								original_tag = MKS
							}
						}
						OR = {
							ROOT = {
								original_tag = SLS
							}
						}
						NOT = {
							has_global_flag = TNO_INW_duumvirate
						}
					}
					set_global_flag = skip_default_capitulation
					if = {
						limit = {
							SLS = {
								is_faction_leader = yes
							}
						}
						random_country = {
							limit = {
								is_in_faction_with = SLS
							}
							set_faction_leader = yes
						}
					}
					SLS = {
						every_owned_state = {
							transfer_state_to = MKS
						}
					}
					if = {
						limit = {
							MKS = {
								NOT = {
									is_in_faction_with = FROM
									original_tag = FROM
								}
							}
						}
						every_country = {
							limit = {
								AND = {
									OR = {
										has_war_with = DMP
										has_war_with = FRI
										has_war_with = NII
										has_war_with = ABD
										has_war_with = SLS
										has_war_with = PMT
										has_war_with = DMS
									}
									is_faction_leader = yes
								}
							}
							add_to_faction = MKS
						}
					}
				}
				else_if = {
					limit = {
						OR = {
							FROM = {
								original_tag = INS
							}
							FROM = {
								original_tag = BKB
							}
							FROM = {
								original_tag = SRB
							}
							FROM = {
								original_tag = MKS
							}
						}
						OR = {
							ROOT = {
								original_tag = PMT
							}
						}
						NOT = {
							has_global_flag = TNO_INW_duumvirate
						}
					}
					set_global_flag = skip_default_capitulation
					if = {
						limit = {
							PMT = {
								is_faction_leader = yes
							}
						}
						random_country = {
							limit = {
								is_in_faction_with = PMT
							}
							set_faction_leader = yes
						}
					}
					PMT = {
						every_owned_state = {
							transfer_state_to = INS
						}
					}
					if = {
						limit = {
							INS = {
								NOT = {
									is_in_faction_with = FROM
									original_tag = FROM
								}
							}
						}
						every_country = {
							limit = {
								AND = {
									OR = {
										has_war_with = DMP
										has_war_with = FRI
										has_war_with = NII
										has_war_with = ABD
										has_war_with = SLS
										has_war_with = PMT
										has_war_with = DMS
									}
									is_faction_leader = yes
								}
							}
							add_to_faction = INS
						}
					}
				}
				
				#Western Insurrection
				else_if = { #China-aligned warlord falls
					limit = {
						has_global_flag = CHI_Western_Insurrection_Crisis
						FROM = {
							is_in_faction_with = YUN
						}

						ROOT = {
							NOT = { original_tag = CHI }
							is_in_faction_with = CHI
						}
					}
					set_global_flag = YUN_WI_thx_paradox

					YUN = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
					}
					clr_global_flag = YUN_WI_thx_paradox
					set_global_flag = skip_default_capitulation
				}
				else_if = { #China falls before China-aligned warlords
					limit = {
						has_global_flag = CHI_Western_Insurrection_Crisis
						NOT = { has_global_flag = JAP_Western_Insurrection_Intervention }
						FROM = {
							is_in_faction_with = YUN
						}

						ROOT = {
							original_tag = CHI
						}
					}
					set_global_flag = YUN_WI_thx_paradox

					every_state = {
						limit = { is_core_of = NCC }
						NCC = { transfer_state = PREV }
					}
					NCC = {
						econ_join_sphere_JAP = yes
					}

					YUN = {
						white_peace = CHI
						annex_country = {
							target = CHI
							transfer_troops = no
						}
					}

					JAP = {
						add_to_faction = NCC
					}

					clr_global_flag = YUN_WI_thx_paradox
					set_global_flag = skip_default_capitulation
				}
				else_if = {#NPA defeats China after Jaabn intervenes
					limit = {
						NOT = { has_global_flag = CHI_Western_Insurection_RoC_defeated }
						has_global_flag = JAP_Western_Insurrection_Intervention
						FROM = {
							OR = {
								original_tag = YUN
								has_idea = NLF_Member
							}
						}
						ROOT = {
							original_tag = CHI
						}
					}
					set_global_flag = YUN_WI_thx_paradox
					every_state = {
						limit = { is_core_of = NCC }
						NCC = { transfer_state = PREV }
					}
					ROOT = {
						every_unit_leader = {
							set_nationality = NCC
						}
					}
					NCC = {
						load_oob = "NCC_GAW"
						econ_join_sphere_JAP = yes
					}
					every_other_country = {
						limit = { is_in_faction_with = YUN }
						NCC = { set_embargo_PREV = yes }
						NCC = { PREV = { set_embargo_PREV = yes } }
					}

					YUN = {
						country_event = { id = yun_wi.30 }
						white_peace = CHI
						annex_country = {
							target = CHI
							transfer_troops = no
						}
					}

					JAP = {
						add_to_faction = NCC
						country_event = { id = japchiinteraction.3 days = 8 }
					}
					set_global_flag = CHI_Western_Insurection_RoC_defeated
					clr_global_flag = YUN_WI_thx_paradox
					set_global_flag = skip_default_capitulation
				}
				else_if = { #Yunnan is defeated before all Yunnan-allied warlords
					limit = {
						FROM = {
							OR = {
								is_in_faction_with = CHI
								is_in_faction_with = JAP
							}
						}
						ROOT = {
							original_tag = YUN
						}
						OR = {
							has_global_flag = CHI_Western_Insurrection_Crisis
							has_global_flag = YUN_NPA_GAW_Crisis
						}
					}
					if = {
						limit = {
							has_global_flag = YUN_NPA_GAW_Crisis
						}
						FROM = {
							annex_country = {
								target = ROOT
								transfer_troops = no
							}
						}
						ROOT = {
							YUN_NPA_fails_effects = yes
							if = {
								limit = { check_variable = { YUN_WI_sun = 1 } }
								country_event = { id = yun_zhengtong.38 days = 2 }
							}
							if = {
								limit = { check_variable = { YUN_WI_cck = 1 } }
								country_event = { id = yun_zhengtong.45 days = 3 }
							}
							if = {
								limit = {
									check_variable = { YUN_WI_cck = 1 }
									check_variable = { YUN_WI_cwk = 1 }
								}
								country_event = { id = yun_zhengtong.52 days = 4 }
							}
							if = {
								limit = { check_variable = { YUN_WI_song = 1 } }
								country_event = { id = yun_zhengtong.17 days = 5 }
							}
							if = {
								limit = { check_variable = { YUN_WI_liu = 1 } }
								country_event = { id = yun_zhengtong.24 days = 6 }
							}
							YUN_JAP_collab_effects = yes
						}
					}
					else = {
						YUN = {
							YUN_NPA_fails_effects = yes
							set_party_name = {
								ideology = despotism
								name = YUN_despotism_XRA_party
								long_name = YUN_despotism_XRA_party_long
							}
							YUN_zhou_longxiang = {
								add_country_leader_role = {
									country_leader = {
										desc = "POLITICS_ZHOU_LONGXIANG_DESC"
										ideology = despotism_interim_government_subtype
										traits = {  }
										expire = "1999.1.1.1"
										id = -1
									}
									promote_leader = yes
								}
							}
							set_politics = {
								ruling_party = despotism
								last_election = "1933.3.5"
								election_frequency = 48
								elections_allowed = no
							}
							set_popularities = {
								progressivism = 0
								liberalism = 0
								despotism = 54
								conservatism = 4
								anocracy = 38
								fascism = 0
								national_socialism = 0
								ultranationalism = 4
							}
							add_ideas = Sphere_Economic_Dependent
							econ_join_sphere_JAP = yes
							set_cosmetic_tag = YUN_southwest_united_reconstruction
							CHI_save_pre_puppet_politics = yes
							CHI = {
								set_autonomy = {
									target = PREV
									autonomy_state = autonomy_satellite
								}
							}
							CHI_apply_pre_puppet_politics = yes
							clr_country_flag = YUN_long_yun_crusade
							if = {
								limit = { has_global_flag = WI_NPA_takes_Sichuan }
								country_event = { id = yun_zhengtong.15 days = 3 }
								country_event = { id = yun_zhengtong.22 days = 7 }
							}
							if = {
								limit = { has_global_flag = GUX_joins_NPA }
								country_event = { id = yun_zhengtong.36 days = 4 }
							}
							country_event = { id = yun_zhengtong.29 days = 2 }
							country_event = { id = yun_zhengtong.43 days = 3 }
							country_event = { id = yun_zhengtong.50 days = 5 }
						}
					}

					set_global_flag = skip_default_capitulation
				}
				else_if = { #Yunnan-aligned warlord falls
					limit = {
						FROM = {
							OR = {
								is_in_faction_with = CHI
								is_in_faction_with = JAP
							}
						}
						ROOT = {
							has_idea = NLF_Member
						}
						OR = {
							has_global_flag = CHI_Western_Insurrection_Crisis
							has_global_flag = YUN_NPA_GAW_Crisis
						}
					}
					if = {
						limit = {
							has_global_flag = YUN_NPA_GAW_Crisis
						}
						JAP = {
							annex_country = {
								target = ROOT
								transfer_troops = no
							}
						}
						if = {
							limit = { YUN = { has_country_flag = YUN_long_yun_crusade } }
							ROOT = {
								every_unit_leader = {
									set_nationality = YUN
								}
							}
						}
						YUN = {
							set_temp_variable = { YUN_WI_temp_warbuff = -30 }
							YUN_WI_morale_change = yes
							set_temp_variable = { YUN_temp_legitimacy = -30 }
							YUN_WI_legitimacy_change = yes
						}
					}
					else = {
						CHI = {
							annex_country = {
								target = ROOT
								transfer_troops = no
							}
						}
					}

					set_global_flag = skip_default_capitulation
				}
				else_if = {#Other Chinese states are capitulated by Long Yun
					limit = {
						FROM = {
							OR = {
								original_tag = YUN
								has_idea = NLF_Member
							}
						}

						ROOT = {
							OR = {
								original_tag = MAN
								original_tag = MEN
								original_tag = GNG
								original_tag = GAN
								original_tag = GUX
								original_tag = SHX
								original_tag = XIK
								original_tag = QIN
								original_tag = TIB
								original_tag = XIN
								original_tag = NCC
							}
						}
					}
					set_global_flag = YUN_WI_thx_paradox

					YUN = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						#if = {
						#	limit = {
						#		ROOT = { original_tag = GUX }
						#	}
						#	country_event = { id = yun.134 }
						#}
						#else_if = {
						#	limit = {
						#		ROOT = { original_tag = SHX }
						#	}
						#	country_event = { id = yun.136 }
						#}
						if = {
							limit = {
								ROOT = { original_tag = NCC }
							}
							country_event = { id = yun_wi.36 }
						}
						else_if = {
							limit = {
								ROOT = { original_tag = MAN }
							}
							country_event = { id = yun_wi.37 }
						}
						else_if = {
							limit = {
								ROOT = { original_tag = TIB }
							}
							country_event = { id = yun_wi.38 }
						}
						else_if = {
							limit = {
								ROOT = { original_tag = GNG }
							}
							country_event = { id = yun_wi.39 }
						}
						#else_if = {
						#	limit = {
						#		ROOT = { original_tag = GAN }
						#	}
						#	country_event = { id = yun.138 }
						#}
						else_if = {
							limit = {
								ROOT = { original_tag = MEN }
							}
							country_event = { id = yun.139 }
						}
					}
					if = {
						limit = {
							ROOT = {
								OR = {
									original_tag = NCC
									original_tag = GAN
									original_tag = MEN
									original_tag = GNG
									original_tag = MAN
								}
								NOT = { has_country_flag = YUN_NPA_despair_branch }
							}
						}
						YUN = {
							add_to_variable = { npagawprogress = 1 }
						}
						if = {
							limit = {
								check_variable = { YUN.npagawprogress = 5 }
							}
							JAP = {
								country_event = { id = japchiinteraction.12 }
								527 = { set_demilitarized_zone = no }
								1024 = { set_demilitarized_zone = no }
								1820 = { set_demilitarized_zone = no }
							}
						}
						else_if = {
							limit = {
								check_variable = { YUN.npagawprogress < 5 }
								NOT = { country_exists = GAN }
								NOT = { country_exists = NCC }
							}
							JAP = {
								country_event = { id = japchiinteraction.11 }
							}
						}
						if = {
							limit = {
								check_variable = { YUN.npagawprogress = 2 }
							}
							every_country = {
								limit = {
									has_idea = YUN_SEA_NOT_YOUR_BUSINESS_STOP
									is_in_faction_with = JAP
								}
								remove_ideas = YUN_SEA_NOT_YOUR_BUSINESS_STOP
								add_to_war = {
									targeted_alliance = JAP
									enemy = YUN
								}
							}
							VIN = {
								load_oob = "VIN_GAW"
								remove_ideas = VIN_japanese_army
							}
						}
					}
					clr_global_flag = YUN_WI_thx_paradox
					set_global_flag = skip_default_capitulation
				}
				else_if = {
					limit = {
						has_global_flag = anti_heydrich_pact_formed
						FROM = {
							OR = {
								original_tag = HGR
								# speidel bruh
								original_tag = GER
							}
						}
						ROOT = {
							OR = {
								original_tag = GGR
								original_tag = BGR
								original_tag = SGR
							}
						}
					}
					ROOT = {
						GER_GCW_off_a_fucker = yes
					}
					FROM = {
						white_peace = ROOT
						#message = gcw_capitulation_msg

						annex_country = {
							target = ROOT
							transfer_troops = no
						}
						#GER_GCW_check_victor = yes
					}
					set_global_flag = skip_default_capitulation
				}

				## Bolivia-Santa Cruz (FULNA Victory) ##
				else_if = { # Santa Cruz victory
					limit = {
						has_global_flag = PAR_FULNA_victory
						FROM = {
							OR = {
								tag = STC
								tag = PAC
							}
						}
						ROOT = {
							tag = BOL
						}
					}

					every_country = {
						limit = { has_war_with = ROOT }
						white_peace = ROOT
					}

					if = {
						limit = {
							STC = { has_country_flag = STC_banzer }
						}
						STC = {
							STC_Hugo_Banzer = { set_nationality = BOL }
							if = {
								limit = {
									has_game_rule = {
										rule = BOL_STC_WAR_OUTCOME
										option =  BOL_STC_WAR_OUTCOME_STC
									}
								}
								remove_war_buff = yes
							}
						}
						BOL = {
							annex_country = { target = STC }
							set_cosmetic_tag = STC_banzer_peace

							remove_ideas = {
								BOL_patchwork_country
								BOL_century_of_humiliation
								BOL_boiling_point
							}

							retire_character = BOL_Armando_Alba_Zambrana
							promote_character = STC_Hugo_Banzer
							set_politics = { ruling_party = despotism }
							set_popularities = {
								despotism = 44
								anocracy = 36
								liberalism = 20
							}

							set_party_name = {
								ideology = despotism
								name = BOL_despotism_party_banzer
								long_name = BOL_despotism_party_banzer_long
							}
							set_party_name = {
								ideology = anocracy
								name = BOL_anocracy_party_banzer
								long_name = BOL_anocracy_party_banzer_long
							}
							set_party_name = {
								ideology = liberalism
								name = BOL_liberalism_party_banzer
								long_name = BOL_liberalism_party_banzer_long
							}
						}
					}
					else = {
						every_country = {
							limit = { is_ai = no }
							news_event = {
								id = LATAM_news.179
								days = 1
							}
						}
						STC = {
							retire_character = STC_Carmelo_Ortiz_Taborga
							STC_Jose_Luis_Camacho_Parada = {
								add_country_leader_role = {
									country_leader = {
										desc = "POLITICS_CAMACHO_PARADA"
										ideology = anocracy_national_conservatism_subtype
										traits = {  }
										expire = "1999.1.1.1"
										id = -1
									}
									promote_leader = yes
								}
							}
							transfer_state = 487
							transfer_state = 1677
							add_state_core = 487
							add_state_core = 1677
							add_popularity = {
								ideology = anocracy
								popularity = 0.15
							}
							every_owned_state = {
								remove_core_of = BOL
								remove_core_of = PAR
							}
							diplomatic_relation = {
								country = PAC
								relation = military_access
								active = no
							}
							if = {
								limit = {
									has_game_rule = {
										rule = BOL_STC_WAR_OUTCOME
										option =  BOL_STC_WAR_OUTCOME_STC
									}
								}
								remove_war_buff = yes
							}
						}
						PAC = {
							diplomatic_relation = {
								country = STC
								relation = military_access
								active = no
							}
							country_event = {
								id = PAR_bolivia.4
								days = 3
							}
						}
					}

					set_global_flag = skip_default_capitulation
				}
				else_if = { # Bolivia victory
					limit = {
						has_global_flag = PAR_FULNA_victory
						FROM = {
							tag = BOL
						}
						ROOT = {
							tag = STC
						}
					}

					every_country = {
						limit = { has_war_with = ROOT }
						white_peace = ROOT
					}

					BOL = {
						annex_country = { target = STC }
						annex_country = { target = PAC }
						
						every_owned_state = {
							remove_core_of = STC
							remove_core_of = PAC
						}
						if = {
							limit = {
								has_game_rule = {
									rule = BOL_STC_WAR_OUTCOME
									option =  BOL_STC_WAR_OUTCOME_BOL
								}
							}
							remove_war_buff = yes
						}
					}

					every_country = {
						limit = { is_ai = no }
						news_event = {
							id = LATAM_news.178
							days = 1
						}
					}

					set_global_flag = skip_default_capitulation
				}

				## 12 Day War (FULNA Defeat) ##
				else_if = { # Bolivia cannot win this
					limit = {
						has_global_flag = PAR_FULNA_defeat
						FROM = {
							OR = {
								tag = STC
								tag = PAR
							}
						}
						ROOT = {
							tag = BOL
						}
					}
					PAR_end_twelve_day_war = yes
					set_global_flag = skip_default_capitulation
				}

				if = { # Fixing all wars vs puppets
					limit = {
						ROOT = {
							is_puppet = yes
							if = {
								limit = { is_puppet = yes }
								OVERLORD = { has_capitulated = no }
							}
						}
					}
					log = "endded puppet"
					ROOT = { OVERLORD = { end_puppet = PREV } }
				}

				if = { # Nukes
					limit = {
						NOT = { has_global_flag = nukes_disabled }
						FROM = {
							has_nuclear_arsenal = yes
						}
						ROOT = {
							has_nuclear_arsenal = yes
							NOT = { has_country_flag = TNO_nuke_disabled }
						}
					}
					ROOT = { country_event = { id = nuclearwar.6 days = 7 } }
					FROM = { country_event = { id = nuclearwar.6 days = 7 } }
				}

				# https://www.youtube.com/watch?v=P8xZe7W62WI -> battle cry of freedom is better, cope
				if = {
					limit = {
						FROM = {
							OR = {
								original_tag = USA
								is_in_faction_with = USA
							}
						}
						ROOT = {
							OR = {
								original_tag = GER
								original_tag = JAP
							}
						}
					}
					USA = {
						if = {
							limit = { has_global_flag = nukes_disabled }
							add_to_variable = { america_saves_the_world_counter = 1 }
							if = {
								limit = { check_variable = { america_saves_the_world_counter = 2 } }
								country_event = { id = USA.1776 days = 2 }
								clear_variable = america_saves_the_world_counter
							}
						}
						else = {
							country_event = { id = nuclearwar.6 days = 5 }
						}
					}
				}

				#Capitulation block
				set_global_flag = war_continuing
			}
			clr_global_flag = skip_default_capitulation
		}
	}
	#don't mind me just logging wars
	on_declare_war = {
		effect = {
			log="[GetDateText]: [Root.GetName] declared war on [From.GetName]"
		}
	}
}