

#Category only allowed for CHI
CHI_anti_imperialism = {
	
	CHI_release_korea = {

		icon = generic_nationalism

		available = {
			country_exists = KOR
		}

		days_mission_timeout = 180

		fire_only_once = yes
		activation = {			
			owns_state = 525
			owns_state = 527
			KOR = {
				exists = no
			}
			has_completed_focus = CHI_commit_to_korean_independence
		}

		visible = {
			owns_state = 525
			owns_state = 527
			KOR = {
				exists = no
			}
			has_completed_focus = CHI_commit_to_korean_independence
		}
		complete_effect = {
			add_political_power = 50
		}
		timeout_effect = {
			add_stability = -0.1 #naughty
		}
	}
}


#Category allowed for all potential nationalist china
#Category visible when CHI_army_reform focus is completed
CHI_army_reform = {

	CHI_army_reform = {

		icon = generic_prepare_civil_war

		available = {
			has_army_experience > 99
			has_completed_focus = CHI_army_reform
		}

		cost = 0
		ai_will_do = {
			factor = 500
		}
		days_remove = 90

		visible = {
			OR = {
				has_idea = CHI_army_corruption_1
				has_idea = CHI_army_corruption_2
				has_idea = CHI_army_corruption_3
			}
		}
		remove_effect = {
			if = {
				limit = { has_idea = CHI_army_corruption_1 }
				swap_ideas = {
					remove_idea = CHI_army_corruption_1
					add_idea = CHI_army_corruption_2
				}
			}
			else_if = {
				limit = { has_idea = CHI_army_corruption_2 }
				swap_ideas = {
					remove_idea = CHI_army_corruption_2
					add_idea = CHI_army_corruption_3
				}
			}
			else_if = {
				limit = { has_idea = CHI_army_corruption_3 }
				remove_ideas = CHI_army_corruption_3
			}
		}
		complete_effect = {
			army_experience = -100						
		}		
	}

	CHI_lessons_of_war = {
		icon = generic_army_support
		available = {
			has_army_experience > 199
			has_idea = CHI_incompetent_officers
			if = {
				limit = { has_idea = CHI_army_corruption_1 }
				NOT = { has_idea = CHI_army_corruption_1 }
			}

			if = {
				limit = { has_idea = CHI_army_corruption_2 }
				NOT = { has_idea = CHI_army_corruption_2 }
			}

			if = {
				limit = { has_idea = CHI_army_corruption_3 }
				NOT = { has_idea = CHI_army_corruption_3 }
			}

			if = {
				limit = {
					NOT = { has_idea = CHI_army_corruption_1 }
					NOT = { has_idea = CHI_army_corruption_2 }
					NOT = { has_idea = CHI_army_corruption_3 }
				}
				NOT = { has_idea = CHI_army_corruption_3 }
			}
		}

		cost = 0
		ai_will_do = {
			factor = 10
		}
		fire_only_once = yes

		visible = {
			has_idea = CHI_incompetent_officers
			has_completed_focus = CHI_army_reform
		}

		complete_effect = {
			army_experience = -200
			remove_ideas = CHI_incompetent_officers
			set_country_flag = CHI_lessons_of_war_completed
		}		
	}

	#Activates when the player picks CHI_60_divisions_plan decision
	CHI_bolster_our_ranks = {

		icon = generic_prepare_civil_war

		available = {
			num_divisions > 60
			has_army_manpower = { size > 549999 }
		}

		fire_only_once = yes
		
		days_mission_timeout = 180

		is_good = no

		activation = {
			always = no #Triggered from effect in CHI_60_divisions_plan
		}

		complete_effect = {
			add_war_support = 0.1
		}

		timeout_effect = {

		}
	}

	CHI_60_divisions_plan = {

		icon = generic_operation

		available = {
			
		}

		cost = 90
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes

		visible = {
			has_completed_focus = CHI_60_divisions_plan
		}

		days_remove = 180

		modifier = {
			training_time_army_factor = -0.25
		}

		complete_effect = {
			activate_mission = CHI_bolster_our_ranks
		}		
	}

}

economy_decisions = {
	CHI_forced_loans = {

		icon = ger_mefo_bills

		available = {
			has_hyper_inflation = yes
		}

		cost = 100
		ai_will_do = {
			factor = 1
			modifier = {
				OR = {
					has_idea = CHI_hyper_inflation_none
					has_idea = CHI_hyper_inflation_1
				}
				factor = 0
			}
			modifier = {
				has_idea = CHI_hyper_inflation_3
				factor = 2
			}
			modifier = {
				has_idea = CHI_hyper_inflation_4
				factor = 5
			}
			modifier = {
				has_idea = CHI_hyper_inflation_5
				factor = 10
			}
		}

		visible = {
			has_completed_focus = CHI_forced_loans
		}

		days_re_enable = 90

		complete_effect = {
			CHI_hyper_inflation_level_down = yes
			add_stability = -0.03
			add_war_support = -0.03
		}		
	}
}

war_measures = {

	CHI_scorched_earth_tactics = {
		icon = generic_scorched_earth
		available = {
			any_owned_state = {
				is_controlled_by = ROOT
				infrastructure > 0
				any_neighbor_state = {
					NOT = { is_fully_controlled_by = ROOT }
					controller = { has_war_with = CHI }
				}
			}
		}

		cost = 25

		ai_will_do = {
			factor = 1
		}

		visible = {			
			has_completed_focus = CHI_scorched_earth_tactics
		}

		days_re_enable = 30

		complete_effect = {
			every_owned_state = {
				limit = {
					is_controlled_by = ROOT
					infrastructure > 0
					any_neighbor_state = {
						NOT = { is_fully_controlled_by = ROOT }
						controller = { has_war_with = CHI }
					}
				}
				damage_building = {
					type = infrastructure
					damage = 3
				}
			}
			random_country = {
				limit = {
					PRC_has_low_popular_support = yes
				}

				PRC_low_popular_support_level_down = yes
			}			
		}
	}
}


### #  # ###  #  #  ### ### ###  #   #    #### #   #  ##   ##  #  #  ##  ### ###  ##  #  #
 #  ## # #  # #  # #     #  #  #  # #     #    #   # #  # #  # #  # #  #  #   #  #  # ## #
 #  # ## #  # #  #   #   #  ###    #      ##    # #  #### #    #  # ####  #   #  #  # # ##
 #  #  # #  # #  #    #  #  #  #   #      #     # #  #  # #  # #  # #  #  #   #  #  # #  #
### #  # ###   ##  ###   #  #  #   #      ####   #   #  #  ##   ##  #  #  #  ###  ##  #  #

CHI_industrial_evacuations = {

	CHI_industrial_evacuations_from_gansu = { #283 #gansu
		icon = generic_scorched_earth
		available = {
			283 = { #283 #gansu
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 283
		} 
}
		visible = {
			has_completed_focus = CHI_industrial_evacuations
			283 = { #283 #gansu
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes
		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 283
				}
				283 = { #283 #gansu
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_hainan = { #591 #hainan
		icon = generic_scorched_earth
		available = {
			591 = { #591 #hainan
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 591
		} 
}
		visible = {
			has_completed_focus = CHI_industrial_evacuations
			591 = { #591 #hainan
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 591
				}
				591 = { #591 #hainan
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_guangzhou = { #592 #guangzhou
		icon = generic_scorched_earth
		available = {
			592 = { #592 #guangzhou
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 592
		} 
}

		visible = {
			has_completed_focus = CHI_industrial_evacuations
			592 = { #592 #guangzhou
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 592
				}
				592 = { #592 #guangzhou
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_guangdong = { #593 #guangdong
		icon = generic_scorched_earth
		available = {
			593 = { #593 #guangdong
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 593
		} 
}

		visible = {
			has_completed_focus = CHI_industrial_evacuations
			593 = { #593 #guangdong
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 593
				}
				593 = { #593 #guangdong
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_nanning = { #594 #nanning
		icon = generic_scorched_earth
		available = {
			594 = { #594 #nanning
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 594
		} 
}

		visible = {
			has_completed_focus = CHI_industrial_evacuations
			594 = { #594 #nanning
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 594
				}
				594 = { #594 #nanning
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_fujian = { #595 #fujian
		icon = generic_scorched_earth
		available = {
			595 = { #595 #fujian
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 595
		} 
}

		visible = {
			has_completed_focus = CHI_industrial_evacuations
			595 = { #595 #fujian
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 595
				}
				595 = { #595 #fujian
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_zhejiang = { #596 #zhejiang
		icon = generic_scorched_earth
		available = {
			596 = { #596 #zhejiang
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 596
		} 
}

		visible = {
			has_completed_focus = CHI_industrial_evacuations
			596 = { #596 #zhejiang
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 596
				}
				596 = { #596 #zhejiang
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_shandong = { #597 #shandong
		icon = generic_scorched_earth
		available = {
			597 = { #597 #shandong
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 597
		} 
}

		visible = {
			has_completed_focus = CHI_industrial_evacuations
			597 = { #597 #shandong
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 597
				}
				597 = { #597 #shandong
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_jiangsu = { #598 #jiangsu
		icon = generic_scorched_earth
		available = {
			598 = { #598 #jiangsu
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 598
		} 
}
		visible = {
			has_completed_focus = CHI_industrial_evacuations
			598 = { #598 #jiangsu
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 598
				}
				598 = { #598 #jiangsu
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_guangxi = { #599 #guangxi
		icon = generic_scorched_earth
		available = {
			599 = { #599 #guangxi
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 599
		} 
}

		visible = {
			has_completed_focus = CHI_industrial_evacuations
			599 = { #599 #guangxi
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 599
				}
				599 = { #599 #guangxi
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_jiangxi = { #600 #jiangxi
		icon = generic_scorched_earth
		available = {
			600 = { #600 #jiangxi
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 600
		} 
}

		visible = {
			has_completed_focus = CHI_industrial_evacuations
			600 = { #600 #jiangxi
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 600
				}
				600 = { #600 #jiangxi
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_hunan = { #602 #hunan
		icon = generic_scorched_earth
		available = {
			602 = { #602 #hunan
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}	
		highlight_states = {
 highlight_state_targets = {
			state = 602
		} 
}
		visible = {
			has_completed_focus = CHI_industrial_evacuations
			602 = { #602 #hunan
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 602
				}
				602 = { #602 #hunan
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_anhui = { #606 #anhui
		icon = generic_scorched_earth
		available = {
			606 = { #606 #anhui
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}

		visible = {
			has_completed_focus = CHI_industrial_evacuations
			606 = { #606 #anhui
				is_controlled_by = ROOT
			}			
		}
		highlight_states = {
 highlight_state_targets = {
			state = 606
		} 
}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 606
				}
				606 = { #606 #anhui
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_henan = { #607 #henan
		icon = generic_scorched_earth
		available = {
			607 = { #607 #henan
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 607
		} 
}
		visible = {
			has_completed_focus = CHI_industrial_evacuations
			607 = { #607 #henan
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 607
				}
				607 = { #607 #henan
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_beijing = { #608 #beijing
		icon = generic_scorched_earth
		available = {
			608 = { #608 #beijing
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 608
		} 
}

		visible = {
			has_completed_focus = CHI_industrial_evacuations
			608 = { #608 #beijing
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 608
				}
				608 = { #608 #beijing
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_shanghai = { #613 #shanghai
	icon = generic_scorched_earth
		available = {
			613 = { #613 #shanghai
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 613
		} 
}
		visible = {
			has_completed_focus = CHI_industrial_evacuations
			613 = { #613 #shanghai
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 613
				}
				613 = { #613 #shanghai
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_hebei = { #614 #hebei
		icon = generic_scorched_earth
		available = {
			614 = { #614 #hebei
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 614
		} 
}
		visible = {
			has_completed_focus = CHI_industrial_evacuations
			614 = { #614 #hebei
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 614
				}
				614 = { #614 #hebei
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_ningxia = { #616 #ningxia
		icon = generic_scorched_earth
		available = {
			616 = { #616 #ningxia
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 616
		} 
}
		visible = {
			has_completed_focus = CHI_industrial_evacuations
			616 = { #616 #ningxia
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 616
				}
				616 = { #616 #ningxia
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_hubei = { #620 #hubei
		icon = generic_scorched_earth
		available = {
			620 = { #620 #hubei
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 620
		} 
}
		visible = {
			has_completed_focus = CHI_industrial_evacuations
			620 = { #620 #hubei
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 620
				}
				620 = { #620 #hubei
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	CHI_industrial_evacuations_from_qingdao = { #743 #qingdao
		icon = generic_scorched_earth
		available = {
			743 = { #743 #qingdao
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 743
		} 
}
		visible = {
			has_completed_focus = CHI_industrial_evacuations
			743 = { #743 #qingdao
				is_controlled_by = ROOT
			}			
		}

		fire_only_once = yes

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			if = {
				limit = {
					controls_state = 743
				}
				743 = { #743 #qingdao
					set_variable = {
						var = af_level
						value = arms_factory_level
					}
					set_variable = {
						var = af_to_move
						value = arms_factory_level
					}
					multiply_variable = {
						var = af_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					set_variable = {
						var = ic_level
						value = industrial_complex_level
					}
					set_variable = {
						var = ic_to_move
						value = industrial_complex_level
					}
					multiply_variable = {
						var = ic_to_move
						value = global.CHI_industrial_evacuations_amount_factor
					}
	
					custom_effect_tooltip = CHI_industrial_evacuations_remove_AF
					custom_effect_tooltip = CHI_industrial_evacuations_remove_IC
					hidden_effect = {				
						remove_building = {
							type = arms_factory
							level = af_level
						}
						remove_building = {
							type = industrial_complex
							level = ic_level
						}
					}
	
					#Move AF
					CONTROLLER = {
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = arms_factory
									size > 2
									include_locked = yes
								}
							}
	
							custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
							hidden_effect = {
								add_extra_state_shared_building_slots = af_to_move
								add_building_construction = {
									type = arms_factory
									level = af_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_AF }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_AF }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = arms_factory
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = arms_factory
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_AF						
								hidden_effect = {
									add_extra_state_shared_building_slots = af_to_move
									add_building_construction = {
										type = arms_factory
										level = af_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_AF
	
	
						#Move IC
						random_owned_controlled_state = {
							prioritize = { 605 603 601 }
							limit = {
								is_fully_controlled_by = ROOT
								any_neighbor_state = {
									is_controlled_by = ROOT
								}
								free_building_slots = {
									building = industrial_complex
									size > 2
									include_locked = yes
								}
							}
							
							custom_effect_tooltip = CHI_industrial_evacuations_add_IC
							hidden_effect = {
								add_extra_state_shared_building_slots = ic_to_move
								add_building_construction = {
									type = industrial_complex
									level = ic_to_move
									instant_build = yes
								}
								CONTROLLER = { set_country_flag = CHI_industrial_evacuations_moved_IC }
							}
						}
	
						#If no states are really safe or all safe are filled
						#Move to random controlled state
						if = {
							limit = {
								NOT = { has_country_flag = CHI_industrial_evacuations_moved_IC }
								NOT = {
									any_controlled_state = {
										is_fully_controlled_by = ROOT
										any_neighbor_state = {
											is_controlled_by = ROOT
										}
										free_building_slots = {
											building = industrial_complex
											size > 2
											include_locked = yes
										}
									}
								}
							}
							random_owned_controlled_state = {
								prioritize = { 605 603 601 }
								limit = {
									is_controlled_by = ROOT
									free_building_slots = {
										building = industrial_complex
										size > 2
										include_locked = yes
									}
								}
	
								custom_effect_tooltip = CHI_industrial_evacuations_add_IC
								hidden_effect = {
									add_extra_state_shared_building_slots = ic_to_move
									add_building_construction = {
										type = industrial_complex
										level = ic_to_move
										instant_build = yes
									}
								}
							}
						}
						clr_country_flag = CHI_industrial_evacuations_moved_IC
					}			
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}
}

#Category allowed for all potential nationalist china
#Visible for nationalist china if has warlords as subjects
CHI_integrate_the_warlords = {
	
	CHI_integrate_the_army = {
		icon = generic_prepare_civil_war
		available = {
			FROM = { compare_autonomy_state < autonomy_colony }
			#NOT = {
			#	has_country_flag = CHI_integrate_the_army
			#}
		}

		visible = {
			FROM = { is_subject_of = ROOT }
			NOT = {
				has_country_flag = CHI_integrate_the_army
			}
		}
		cancel_if_not_visible = yes

		cost = 150

		target_root_trigger = {
			has_completed_focus = CHI_subjugate_the_warlords
		}
		target_array = subjects


		target_trigger = {
			FROM = {
				is_subject_of = ROOT
				OR = {
					tag = GXC
					tag = YUN
					tag = SHX
					tag = XSM
					tag = SIK
				}
			}
		}

		days_remove = 90
		fire_only_once = yes
		ai_will_do = {
			factor = 10
			modifier = {
				OR = {
					has_idea = CHI_warlord_integration_3
					has_idea = CHI_warlord_integration_4
					has_idea = CHI_warlord_integration_5
				}
				factor = 0
				#TODO_WTT_CODE need a trigger for daily increase of PP to see if it's okay to reduce	
			}
		}

		remove_effect = {
			FROM = { set_country_flag = CHI_integrate_the_army }

			CHI_warlord_integration_up = yes
			if = {
				limit = { FROM = { tag = GXC } }
				if = {
					limit = {
						FROM = {
							not = {
								has_completed_focus = CHI_personal_leadership
							}
						}
					}
					GXC = {
						add_corps_commander_role = {
							character = GXC_li_zongren
							traits = { }
							skill = 3
							attack_skill = 3
							defense_skill = 3
							planning_skill = 2
							logistics_skill = 2
						}
					}
					
				}
				FROM = {
					every_unit_leader = {
						set_nationality = ROOT
					}
				}
			}
			else_if = {
				limit = { FROM = { tag = YUN } }
				if = {
					limit = {
						FROM = {
							not = {
								has_completed_focus = CHI_personal_leadership
							}
						}
					}
					YUN = {
						YUN_long_yun = {
							add_corps_commander_role = {
								traits = { }
								attack_skill = 2
								defense_skill = 3
								planning_skill = 3
								logistics_skill = 2
								skill = 3
								legacy_id=-1
							}					
						
						}
					}
				}
				FROM = {
					every_unit_leader = {
						set_nationality = ROOT
					}
				}
			}
			else_if = {
				limit = { FROM = { tag = SHX } }
				if = {
					limit = {
						FROM = {
							not = {
								has_completed_focus = CHI_personal_leadership
							}
						}
					}
					SHX = {
						SHX_yan_xishan = {
							add_corps_commander_role = {
								traits = { }
								attack_skill = 2
								defense_skill = 3
								planning_skill = 3
								logistics_skill = 2
								skill = 3
								legacy_id=-1
							}
						}
					}
				}
				FROM = {
					every_unit_leader = {
						set_nationality = ROOT
					}
				}
			}
			else_if = {
				limit = { FROM = { tag = XSM } }
				if = {
					limit = {
						FROM = {
							not = {
								has_completed_focus = CHI_personal_leadership
							}
						}
					}
					XSM = {
						XSM_ma_bufang = {
							add_corps_commander_role = {
								traits = { }
								attack_skill = 4
								defense_skill = 2
								planning_skill = 2
								logistics_skill = 2
								skill = 3
								legacy_id=-1
							}
						}
					}
				}
				FROM = {
					every_unit_leader = {
						set_nationality = ROOT
					}
				}
			}
			else_if = {
				limit = { FROM = { tag = SIK } }
				if = {
					limit = {
						FROM = {
							not = {
								has_completed_focus = CHI_personal_leadership
							}
						}
					}
					SIK = {
						SIK_sheng_shicai = {
							add_corps_commander_role = {
								traits = { }
								attack_skill = 2
								defense_skill = 4
								planning_skill = 2
								logistics_skill = 2
								skill = 3
								legacy_id=-1
							}
						}
					}
					
				}
				FROM = {
					every_unit_leader = {
						set_nationality = ROOT
					}
				}
			}
		}
	}	

	CHI_integrate_the_administration = {
		icon = generic_political_discourse
		available = {
			FROM = { 
				compare_autonomy_state < autonomy_colony 
			}
		}

		visible = {
			FROM = { 
				is_subject_of = ROOT 
				has_country_flag = CHI_integrate_the_army
				NOT = { has_country_flag = CHI_integrate_the_administration}
			}
		}
		cancel_if_not_visible = yes

		cost = 150

		target_array = subjects

		target_trigger = {
			FROM = {
				has_country_flag = CHI_integrate_the_army
				is_subject_of = ROOT
				OR = {
					tag = GXC
					tag = YUN
					tag = SHX
					tag = XSM
					tag = SIK
				}
			}
		}
		fire_only_once = yes
		ai_will_do = {
			factor = 10
			modifier = {
				OR = {
					has_idea = CHI_warlord_integration_3
					has_idea = CHI_warlord_integration_4
					has_idea = CHI_warlord_integration_5
				}
				factor = 0
				#TODO_WTT_CODE need a trigger for daily increase of PP to see if it's okay to reduce
			}
		}

		days_remove = 90
		remove_effect = {
			FROM = {
				set_country_flag = CHI_integrate_the_administration
			}

			FROM = {
				every_state = {
					limit = { is_core_of = FROM }
					FROM = { remove_state_core = PREV }
				}
			}
		}
	}

	CHI_full_integration = {
		icon = oppression
		available = {
			FROM = {
				FROM = { compare_autonomy_state < autonomy_colony }
			}
		}

		visible = {
			FROM = { is_subject_of = ROOT }
		}
		cancel_if_not_visible = yes

		cost = 150

		target_array = subjects

		target_trigger = {
			FROM = {
				has_country_flag = CHI_integrate_the_administration
				is_subject_of = ROOT
				OR = {
					tag = GXC
					tag = YUN
					tag = SHX
					tag = XSM
					tag = SIK
				}
			}
		}
		days_remove = 90

		remove_effect = {
			CHI_warlord_integration_down = yes
			if = {
				limit = {
					FROM = {
						OR = {
							tag = YUN
							tag = GXC
						}
					}
				}
				set_country_flag = achievement_romance_of_the_three_kingdoms_@FROM
			}
			annex_country = { target = FROM transfer_troops = yes }
		}
		fire_only_once = yes
		ai_will_do = {
			factor = 10			
		}
	}
}


### #  # ### ### #  ### ###   ##  ### ###  ##  #  #
 #  ## # #    #  #   #  #  # #  #  #   #  #  # ## #
 #  # ## ##   #  #   #  ###  ####  #   #  #  # # ##
 #  #  # #    #  #   #  #  # #  #  #   #  #  # #  #
### #  # #   ### ### #  #  # #  #  #  ###  ##  #  #

#Category allowed for all potential nationalist china
#Visible when another country had completed focus PRC_infiltration
@REMOVE_INFILTRATION_PP_COST = 10
CHI_communist_infiltration = {

	CHI_detect_infiltration = {
		icon = oppression
		available = {

		}	


		days_remove = 0
		days_re_enable = 30

		fixed_random_seed = no
	
		cost = 100

		ai_will_do = {
			base = 0
			modifier = {
				has_political_power < 150
				factor = 0
			}
			#Focus on political struggle first
			modifier = {
				factor = 0
				any_other_country = {
					has_country_flag = wtt_political_struggle
				}
			}
			modifier = {
				add = 75
				any_other_country = {
					is_potentially_communist_china = yes
					has_completed_focus = PRC_infiltration
					NOT = { has_country_flag = CHI_delay_sweep_for_communists }
				}
			}

			#Surely there must be commies somewhere
			modifier = {
				add = 85
				NOT = {
					OR = {
						283 = { has_state_flag = discovered_infiltration }
						597 = { has_state_flag = discovered_infiltration }
						1494 = { has_state_flag = discovered_infiltration }
						1495 = { has_state_flag = discovered_infiltration }
						1496 = { has_state_flag = discovered_infiltration }
						1497 = { has_state_flag = discovered_infiltration }
						1498 = { has_state_flag = discovered_infiltration }
						1499 = { has_state_flag = discovered_infiltration }
						1500 = { has_state_flag = discovered_infiltration }
						1501 = { has_state_flag = discovered_infiltration }
						1502 = { has_state_flag = discovered_infiltration }
						1503 = { has_state_flag = discovered_infiltration }
						1504 = { has_state_flag = discovered_infiltration }
						1505 = { has_state_flag = discovered_infiltration }
						598 = { has_state_flag = discovered_infiltration }
						607 = { has_state_flag = discovered_infiltration }
						608 = { has_state_flag = discovered_infiltration }
						614 = { has_state_flag = discovered_infiltration }
						615 = { has_state_flag = discovered_infiltration }
						621 = { has_state_flag = discovered_infiltration }
						744 = { has_state_flag = discovered_infiltration }
						746 = { has_state_flag = discovered_infiltration }
					}
				}
			}
		}
	
		complete_effect = {
			custom_effect_tooltip = CHI_detect_infiltration_tooltip
			hidden_effect = {
				country_event = wtt_infiltration.1
			}
		}
	}

	CHI_communist_infiltration_in_gansu = {
		icon = infiltrate_state
		visible = { #TODO_WTT_CD merge the 2 visible triggers for all of these. Maybe for JAP as well.
			283 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 999 }
		}

		highlight_states = {
 highlight_state_targets = {
			state = 283
		} 
}
		
		visible = {
			283 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 30
		days_re_enable = 0
		

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}

		cost = @REMOVE_INFILTRATION_PP_COST
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -1000
			}
		}

		remove_effect = {
			283 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}

	CHI_communist_infiltration_in_shandong = {
		icon = infiltrate_state
		visible = {
			597 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 249 }
		}
		highlight_states = {
 highlight_state_targets = {
			state = 597
		} 
}
		
		visible = {
			597 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 14
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -250
			}
		}

		remove_effect = {
			597 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}
	
	CHI_communist_infiltration_in_1494 = {
		icon = infiltrate_state
		visible = {
			1494 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 249 }
		}
		highlight_states = {
			highlight_state_targets = {
				state = 1494
			} 
		}
		
		visible = {
			1494 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 14
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -250
			}
		}

		remove_effect = {
			1494 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}
	
	CHI_communist_infiltration_in_1495 = {
		icon = infiltrate_state
		visible = {
			1495 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 249 }
		}
		highlight_states = {
			highlight_state_targets = {
				state = 1495
			} 
		}
		
		visible = {
			1495 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 14
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -250
			}
		}

		remove_effect = {
			1495 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}
	
	CHI_communist_infiltration_in_1496 = {
		icon = infiltrate_state
		visible = {
			1496 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 249 }
		}
		highlight_states = {
			highlight_state_targets = {
				state = 1496
			} 
		}
		
		visible = {
			1496 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 14
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -250
			}
		}

		remove_effect = {
			1496 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}
	
	CHI_communist_infiltration_in_1497 = {
		icon = infiltrate_state
		visible = {
			1497 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 249 }
		}
		highlight_states = {
			highlight_state_targets = {
				state = 1497
			} 
		}
		
		visible = {
			1497 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 14
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -250
			}
		}

		remove_effect = {
			1497 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}
	
	CHI_communist_infiltration_in_1498 = {
		icon = infiltrate_state
		visible = {
			1498 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 249 }
		}
		highlight_states = {
			highlight_state_targets = {
				state = 1498
			} 
		}
		
		visible = {
			1498 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 14
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -250
			}
		}

		remove_effect = {
			1498 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}
	
	CHI_communist_infiltration_in_1499 = {
		icon = infiltrate_state
		visible = {
			1499 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 249 }
		}
		highlight_states = {
			highlight_state_targets = {
				state = 1499
			} 
		}
		
		visible = {
			1499 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 14
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -250
			}
		}

		remove_effect = {
			1499 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}
	
	CHI_communist_infiltration_in_1500 = {
		icon = infiltrate_state
		visible = {
			1500 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 249 }
		}
		highlight_states = {
			highlight_state_targets = {
				state = 1500
			} 
		}
		
		visible = {
			1500 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 14
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -250
			}
		}

		remove_effect = {
			1500 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}
	
	CHI_communist_infiltration_in_1501 = {
		icon = infiltrate_state
		visible = {
			1501 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 249 }
		}
		highlight_states = {
			highlight_state_targets = {
				state = 1501
			} 
		}
		
		visible = {
			1501 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 14
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -250
			}
		}

		remove_effect = {
			1501 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}
	
	CHI_communist_infiltration_in_1502 = {
		icon = infiltrate_state
		visible = {
			1502 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 249 }
		}
		highlight_states = {
			highlight_state_targets = {
				state = 1502
			} 
		}
		
		visible = {
			1502 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 14
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -250
			}
		}

		remove_effect = {
			1502 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}
	
	CHI_communist_infiltration_in_1503 = {
		icon = infiltrate_state
		visible = {
			1503 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 249 }
		}
		highlight_states = {
			highlight_state_targets = {
				state = 1503
			} 
		}
		
		visible = {
			1503 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 14
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -250
			}
		}

		remove_effect = {
			1503 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}
	
	CHI_communist_infiltration_in_1504 = {
		icon = infiltrate_state
		visible = {
			1504 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 249 }
		}
		highlight_states = {
			highlight_state_targets = {
				state = 1504
			} 
		}
		
		visible = {
			1504 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 14
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -250
			}
		}

		remove_effect = {
			1504 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}
	
	CHI_communist_infiltration_in_1505 = {
		icon = infiltrate_state
		visible = {
			1505 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 249 }
		}
		highlight_states = {
			highlight_state_targets = {
				state = 1505
			} 
		}
		
		visible = {
			1505 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 14
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -250
			}
		}

		remove_effect = {
			1505 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}

	CHI_communist_infiltration_in_jiangsu = {
		icon = infiltrate_state
		visible = {
			598 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 999 }
		}

		highlight_states = {
			highlight_state_targets = {
				state = 598
			} 
		}
		
		visible = {
			598 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 30
		days_re_enable = 0
		

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		cost = @REMOVE_INFILTRATION_PP_COST
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -1000
			}
		}

		remove_effect = {
			598 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}

	CHI_communist_infiltration_in_henan = {
		icon = infiltrate_state
		visible = {
			607 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 999 }
		}
		
		visible = {
			607 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}
		highlight_states = {
 highlight_state_targets = {
			state = 607
		} 
}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 30
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -1000
			}
		}

		remove_effect = {
			607 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}

	CHI_communist_infiltration_in_beijing = {
		icon = infiltrate_state
		visible = {
			608 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 999 }
		}
		highlight_states = {
 highlight_state_targets = {
			state = 608
		} 
}
		
		visible = {
			608 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 30
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -1000
			}
		}

		remove_effect = {
			608 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}

	CHI_communist_infiltration_in_hebei = {
		icon = infiltrate_state
		visible = {
			614 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 999 }
		}
		highlight_states = {
 highlight_state_targets = {
			state = 614
		} 
}
		
		visible = {
			614 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 30
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -1000
			}
		}

		remove_effect = {
			614 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}

	CHI_communist_infiltration_in_shanxi = {
		icon = infiltrate_state
		visible = {
			615 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 999 }
		}
		highlight_states = {
 highlight_state_targets = {
			state = 615
		} 
}
		
		visible = {
			615 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 30
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -1000
			}
		}

		remove_effect = {
			615 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}

	CHI_communist_infiltration_in_suiyuan = {
		icon = infiltrate_state
		visible = {
			621 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 999 }
		}
		highlight_states = {
 highlight_state_targets = {
			state = 621
		} 
}
		
		visible = {
			621 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 30
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -1000
			}
		}

		remove_effect = {
			621 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 } 
		}
	}	

	CHI_communist_infiltration_in_xian = {
		icon = infiltrate_state
		visible = {
			744 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 999 }
		}
		highlight_states = {
		 	highlight_state_targets = {
				state = 744
			} 
		}
		
		visible = {
			744 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 30
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -1000
			}
		}

		remove_effect = {
			744 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 }
		}
	}

	CHI_communist_infiltration_in_ordos = {
		icon = infiltrate_state
		visible = {
			746 = {
				is_controlled_by = ROOT
				has_any_PRC_infiltration_flag = yes
			}
		}
		available = {
			has_equipment = { infantry_equipment > 999 }
		}
		highlight_states = {
		 	highlight_state_targets = {
				state = 746
			} 
		}
		
		visible = {
			746 = {
				is_controlled_by = ROOT
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		
		modifier = {
			command_power_gain = -0.1
		}
		
		days_remove = 30
		days_re_enable = 0
		
		cost = @REMOVE_INFILTRATION_PP_COST

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -1000
			}
		}

		remove_effect = {
			746 = {
				CHI_show_state_uprising_effect_after_infiltration_level_down = yes
				save_event_target_as = infiltrated_state
				CHI_infiltration_flag_down_2 = yes
			}
			event_target:WTT_communist_china = { country_event = wtt_infiltration.6 }
		}
	}
}


###  ##  ###  ### ###  ##  #  #      ## #  # ###  ###   ##  ###  ### 
#   #  # #  # #    #  #    ## #     #   #  # #  # #  # #  # #  #  #  
##  #  # ###  ##   #  # ## # ##      #  #  # ###  ###  #  # ###   #  
#   #  # #  # #    #  #  # #  #       # #  # #    #    #  # #  #  #  
#    ##  #  # ### ###  ##  #  #     ##   ##  #    #     ##  #  #  #  

foreign_support = {
	CHI_flying_tigers = {
		icon = generic_air
		allowed = {
			original_tag = USA
		}
		available = {
			OR = {
				has_equipment = { small_plane_airframe > 99 }
				has_tech = improved_small_airframe
			}
		}
		visible = {
			has_country_flag = CHI_flying_tigers
		}
		cost = 25
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		days_remove = -1
		complete_effect = {
			random_country = {
				limit = {
					has_completed_focus = CHI_invite_the_flying_tigers
				}
				custom_effect_tooltip = flying_tigers_tt
				hidden_effect = {
					if = {
						limit = {
							NOT = { has_dlc = "By Blood Alone" }
						}
						add_equipment_to_stockpile = {
							producer = USA
							type = fighter_equipment_1
							amount = 100
						}
					}
					else = {
						USA = {
							create_equipment_variant = {
								name = "P-40" #
								type = small_plane_airframe_2
								allow_without_tech = yes #For tooltip purposes, doesn't affect anything really
								modules = {
									fixed_main_weapon_slot = heavy_mg_4x
									fixed_auxiliary_weapon_slot_1 = heavy_mg_2x
									fixed_auxiliary_weapon_slot_2 = bomb_locks
									engine_type_slot = engine_3_1x
									special_type_slot_1 = drop_tanks
								}
							}
						}
						add_equipment_to_stockpile = {
							producer = USA
							type = small_plane_airframe_2
							amount = 100
							variant_name = "P-40"
						}
					}
				}
			}
			add_war_support = 0.05
		}
		modifier = {
			air_volunteer_cap = 1
		}
	}

	CHI_soviet_volunteer_group = {
		icon = generic_air
		allowed = {
			original_tag = SOV
		}
		available = {
			has_equipment = { small_plane_airframe > 99 }
			has_equipment = { medium_plane_airframe > 49 }
		}
		visible = {
			has_country_flag = CHI_soviet_volunteer_group
		}
		cost = 25
		ai_will_do = {
			factor = 1
		}
		days_remove = -1
		fire_only_once = yes
		complete_effect = {
			random_country = {
				limit = {
					has_completed_focus = CHI_the_soviet_volunteer_group
				}
				custom_effect_tooltip = soviet_volunteers_tt
				hidden_effect = {
					if = {
						limit = {
							NOT = {
								has_dlc = "By Blood Alone"
							}
						}
						add_equipment_to_stockpile = {
							producer = SOV
							type = fighter_equipment_1
							amount = 100
						}
						add_equipment_to_stockpile = {
							producer = SOV
							type = tac_bomber_equipment_1
							amount = 50
						}	
					}
					else = {
						add_equipment_to_stockpile = {
							producer = SOV
							type = small_plane_airframe_1
							amount = 100
							variant_name = "I-16"
						}
						add_equipment_to_stockpile = {
							producer = SOV
							type = medium_plane_airframe_0
							amount = 50
							variant_name = "DB-3"
						}	
					}
				}
			}
			add_war_support = 0.05	
		}
		modifier = {
			air_volunteer_cap = 1
		}
	}

	CHI_expand_the_burma_road = {
		icon = generic_construction
		allowed = {
			OR = {
				original_tag = ENG
				is_literally_china = yes
			}
		}

		available = {
			if = {
				limit = {
					OR = {
						has_focus_tree = china_nationalist_focus
						has_focus_tree = china_communist_focus 
					}
				}
				has_completed_focus = CHI_burma_road
			}
			if = {
				limit = {
					has_focus_tree = british_focus
				}
				has_completed_focus = uk_burma_focus
			}
			any_state = {
				OR = {
					state = 288
					state = 640
					state = 325
					state = 747
				}
				CONTROLLER = {
					NOT = { has_War_with = ROOT }
					custom_trigger_tooltip = {
						tooltip = burma_road_expansion_tt
						OR = {
							has_completed_focus = uk_burma_focus
							has_completed_focus = CHI_burma_road
							AND = {
								OR = {
									is_in_faction_with = ROOT
									is_subject_of = ROOT
								}
								ROOT = {
									OR = {
										has_completed_focus = uk_burma_focus
										has_completed_focus = CHI_burma_road
									}
								}
							}
						}
					}
				}
			}
		}
		visible = {
			NOT = { has_global_flag = CHI_burma_3 }
			OR = {
				has_focus_tree = china_nationalist_focus
				has_focus_tree = china_communist_focus 
				has_focus_tree = british_focus
			}
			OR = {
				325 = {
					CONTROLLER = {
						OR = {
							tag = ROOT
							is_subject_of = ROOT
							is_in_faction_with = ROOT
						}
					}
				}
				AND = {
					controls_state = 288
					controls_state = 640
				}
				AND = {
					288 = { CONTROLLER = { is_in_faction_with = ROOT } }
					640 = { CONTROLLER = { is_in_faction_with = ROOT } }
				}
			}
		}
		days_re_enable = 360
		ai_will_do = {
			base = 1
		}
		cost = 25
		days_remove = 60
		modifier = {
			civilian_factory_use = 2
		}
		complete_effect = {
			if = {
				limit = {
					AND = {
						has_war = no
						has_war_support < 0.6
					}
				}
				add_war_support = 0.05
			}
		}
		remove_effect = {
			288 = {
				add_building_construction = {
					type = infrastructure
					level = 1
					instant_build = yes
				}
			}
			640 = {
				add_building_construction = {
					type = infrastructure
					level = 1
					instant_build = yes
				}
			}
			325 = {
				add_building_construction = {
					type = infrastructure
					level = 1
					instant_build = yes
				}
			}
			if = {
				limit = {
					has_global_flag = CHI_burma_2
				}
				set_global_flag = CHI_burma_3
			}
			if = {
				limit = {
					NOT = { has_global_flag = CHI_burma_2} # 
				}
				set_global_flag = CHI_burma_2
			}
			
			random_country = {
				limit = { check_variable = { CHI_burma_road > 0 } }
				add_to_variable = { var = CHI_burma_road value = 1 }

				#Country that had the burma road open
				add_offsite_building = { type = arms_factory level = 1 }
			}
		}
	}
	CHI_expand_the_ledo_road = {
		icon = generic_construction
		available = {
			any_country = {
				has_completed_focus = CHI_ledo_road
			}
			OR = {
				controls_state = 640
				640 = {
					CONTROLLER = {
						is_in_faction_with = ROOT
					}
				}
				controls_state = 325
				325 = {
					CONTROLLER = {
						OR = {
							AND = {
								is_subject = yes
								OVERLORD = {
									has_completed_focus = CHI_ledo_road
								}
							}
							AND = {
								is_in_faction_with = event_target:WTT_current_china_leader
								event_target:WTT_current_china_leader = {
									has_completed_focus = CHI_ledo_road
								}
							}
						}
					}
				}
			}
		}
		visible = {
			OR = {
				has_completed_focus = CHI_ledo_road
				controls_state = 640
				640 = {
					CONTROLLER = {
						is_in_faction_with = ROOT
					}
				}
			}
			NOT = {
				has_global_flag = CHI_ledo_3
			}
			any_country = {
				has_completed_focus = CHI_ledo_road
			}
		}
		days_re_enable = 360
		ai_will_do = {
			base = 1
		}
		cost = 25
		days_remove = 60
		modifier = {
			civilian_factory_use = 2
		}

		remove_effect = {
			if = {
				limit = {
					has_global_flag = CHI_ledo_2
				}
				set_global_flag = CHI_ledo_3
			}
			if = {
				limit = {
					NOT = { has_global_flag = CHI_ledo_2} # 
				}
				set_global_flag = CHI_ledo_2
			}

			random_country = {
				limit = { check_variable = { CHI_ledo_road > 0 } }
				add_to_variable = { var = CHI_ledo_road value = 1 }

				#Country that had the ledo road open
				add_offsite_building = { type = arms_factory level = 1 }
			}
		}
	}
	CHI_expand_the_airlift = {
		icon = generic_construction
		available = {	
			OR = {
				434 = {
					CONTROLLER = {
						NOT = {
							has_war_with = CHI
						}
						is_in_faction_with = ROOT
					}
				}
				601 = {
					CONTROLLER = {
						OR = {
							has_completed_focus = CHI_the_hump
							is_in_faction_with = ROOT
						}
					}
				}
			}
		}
		visible = {
			OR = { 
				AND = {
					has_completed_focus = CHI_the_hump
					OR = {
						controls_state = 601
						601 = {
							CONTROLLER = {
								is_in_faction_with = ROOT
							}
						}
					}
				}
				AND = {
					controls_state = 434
					any_country = {
						has_completed_focus = CHI_the_hump
					}
				}
			}
			NOT = {
				has_global_flag = CHI_hump_3
			}
		}
		cost = 25
		days_re_enable = 360
		ai_will_do = {
			base = 1
		}
		days_remove = 60
		modifier = {
			civilian_factory_use = 2
		}
		complete_effect = {
			if = {
				limit = {
					AND = {
						has_war = no
						has_war_support < 0.6
					}
				}
				add_war_support = 0.05
			}
		}
		remove_effect = {
			434 = {
				add_building_construction = {
					type = air_base
					level = 1
					instant_build = yes
				}
			}
			601 = {
				add_building_construction = {
					type = air_base
					level = 1
					instant_build = yes
				}
			}
			if = {
				limit = {
					has_global_flag = CHI_hump_2
				}
				set_global_flag = CHI_hump_3 # Hump 3: Revenge of the Hump: The Humpening
			}
			if = {
				limit = {
					NOT = { has_global_flag = CHI_hump_2} # Hump 2: Hump Harder
				}
				set_global_flag = CHI_hump_2
			}
			601 = {
				CONTROLLER = {
					add_to_variable = { var = CHI_the_hump value = 1 }
					add_offsite_building = { type = arms_factory level = 1 }
				}
			}
		}
	}
}

political_actions = {

	CHI_suspend_the_inter_party_coordination_council = {
		icon = oppression
		available = {
			has_idea = CHI_inter_party_coordination_council
		}
		visible = {
			has_idea = CHI_inter_party_coordination_council
		}
		cost = 25
		complete_effect = {
			if = {
				limit = {
					NOT = {
						has_government = democratic
					}
				}
				add_stability = -0.05
			}
			remove_ideas = CHI_inter_party_coordination_council
		}
	}
	CHI_reinstate_the_inter_party_coordination_council = {
		icon = generic_political_discourse
		available = {
			NOT = { has_idea = CHI_inter_party_coordination_council }
			NOT = {
				has_government = democratic
			}
			has_completed_focus = CHI_inter_party_coordination_council
		}
		visible = {
			NOT = { has_idea = CHI_inter_party_coordination_council }
			NOT = {
				has_government = democratic
			}
			has_completed_focus = CHI_inter_party_coordination_council
		}
		cost = 25
		complete_effect = {
			add_ideas = CHI_inter_party_coordination_council
		}
	}

	CHI_join_united_front = {

		visible = {
			is_literally_china = yes
			CHI = {
				is_in_faction_with = PRC
			}
			is_in_faction = no
		}

		available = {
			is_literally_china = yes
			CHI = {
				is_in_faction_with = PRC
			}
			OR = {
				PRC = {
					is_faction_leader = yes
				}
				CHI = {
					is_faction_leader = yes
				}
			}
			NOT = {
				OR = {
					has_war_with = CHI
					has_war_with = PRC
				}
			}
			is_in_faction = no
			NOT = {
				has_completed_focus = CHI_opposition
			}
			OR = {
				is_subject = no
				OVERLORD = {
					is_in_faction_with = event_target:WTT_current_china_leader
				}
			}
		}
		
		cost = 25

		ai_will_do = {
			base = 1
			modifier = {
				JAP = {
					OR = {
						has_war_with = CHI
						has_war_with = PRC
					}
				}
				factor = 10
			}
			modifier = {
				has_war_with = JAP
				factor = 500
			}
			# Sheng Shicai doesn't want to join until he has dealt with Tunganistan and the KMT general Ma Hushan
			modifier = {
				original_tag = SIK
				is_subject = no
				date < 1937.10.15
				factor = 0
			}
		}

		complete_effect = {
			If = {
				limit = {
					CHI = {
						is_faction_leader = yes
					}
				}
				CHI = {
					country_event = generic.2
				}
				add_ai_strategy = {
					type = alliance
					id = "CHI"
					value = 200
				}
			}
			else_if = {
				limit = {
					PRC = {
						is_faction_leader = yes
					}
				}
				PRC = {
					country_event = generic.2
				}
				add_ai_strategy = {
					type = alliance
					id = "PRC"
					value = 200
				}
			}
		}
	}

	CHI_move_the_capital = {
		allowed = {
			is_literally_china = yes
			has_dlc = "Waking the Tiger"
		}
		available = {
			has_war = no
			OR = {
				has_full_control_of_state = 608
				has_full_control_of_state = 613
			}
			capital_scope = {
				NOT = {
					OR = {
						state = 608
						state = 613
					}
				}
			}
		}
		visible = {
			has_war = no
			is_subject = no
			OR = {
				has_full_control_of_state = 608
				has_full_control_of_state = 613
			}
			capital_scope = {
				NOT = {
					OR = {
						state = 608
						state = 613
					}
				}
			}
		}
		cost = 50
		ai_will_do = {
			factor = 1
		}
		complete_effect = {
			country_event = wtt_china.204
		}
	}
}

CHI_xian_incident = {

	CHI_instigate_xian_incident = {
		icon = generic_political_discourse
		available = {			
			NOT = {
				has_global_flag = CHI_xian_fired
			}
			CHI = {
				NOT = {
					is_in_faction_with = PRC
				}
				NOT = {
					has_war_with = PRC
				}
				NOT = {
					OR = {
						has_completed_focus = CHI_foreign_threats
						has_completed_focus = CHI_prioritize_the_interior
					}
				}
			}
			PRC = {
				NOT = {
					has_war_with = CHI
				}
				is_in_faction = no
			}
			NOT = {
				has_war_with = CHI
			}
			NOT = {
				has_war_with = PRC
			}
		}

		visible = {
			NOT = {
				has_global_flag = CHI_xian_fired
			}
			CHI = {
				NOT = {
					is_in_faction_with = PRC
				}
			}
			PRC = {
				NOT = {
					has_war_with = PRC
				}
			}
			is_literally_china = yes
			NOT = {
				OR = {
					original_tag = CHI
					original_tag = PRC
				}
			}
			event_target:WTT_current_china_leader = { tag = CHI }
		}
		cost = 25
		fire_only_once = yes
		ai_will_do = {
			factor = 1
			modifier = {
				threat > 0.1
				factor = 2
			}
			modifier = { # If influenced by Soviets, Sinkiang has no interest in this.
				factor = 0
				original_tag = SIK
				has_government = communism
			}
			modifier = {
				NOT = { 	
					JAP = {
						has_completed_focus = JAP_greater_east_asian_co_prosperity_sphere
					}
				}
				factor = 0
			}
			modifier = {
				JAP = {
					NOT = {
						has_government = fascism
					}
				}
				factor = 0
			}
		}
		complete_effect = {
			set_country_flag = CHI_xian_instigator_flag
			set_global_flag = CHI_xian_fired
			CHI = {
				country_event = wtt_xian_incident.1
			}
		}
	}
}

operations = {
	
	CHI_overlordship_over_indochina = {
		icon = generic_operation

		allowed = {
			is_literally_china = yes
		}

		available = {
			controls_state = 671
			controls_state = 670
			controls_state = 286
			controls_state = 741
		} 

		days_mission_timeout = 360

		fire_only_once = yes

		activation = {
			has_completed_focus = CHI_overlordship_over_indochina
		}
		
		complete_effect = {
			add_political_power = 50
			add_war_support = 0.05
			add_stability = 0.05
		}

		timeout_effect = {
			add_war_support = -0.1
		}
	}
}

prestigious_projects = {
	CHI_build_a_carrier = {
		allowed = {
			is_literally_china = yes
		}
		icon = generic_naval
		available = {
			has_navy_size = { unit = carrier size > 0 }
		}

		days_mission_timeout = 720

		fire_only_once = yes
		is_good = no
		activation = {
			has_completed_focus = CHI_naval_aviation
		}
		
		complete_effect = {
			add_political_power = 100
			navy_experience = 30
			add_war_support = 0.05
		}

		timeout_effect = {
		
		}
	}
}

CHI_occupation_actions = { 


	CHI_breach_the_yellow_river = { 
		icon = GFX_decision_hol_inundate_water_lines
		
		available = {
			controls_state = 607
			has_war_with = JAP
			OR = {
				NOT = { controls_state = 608 }
				NOT = { controls_state = 614 }
				NOT = { controls_state = 597 }
				NOT = { controls_state = 1494 }
				NOT = { controls_state = 1495 }
				NOT = { controls_state = 1496 }
				NOT = { controls_state = 1497 }
				NOT = { controls_state = 1498 }
				NOT = { controls_state = 1499 }
				NOT = { controls_state = 1500 }
				NOT = { controls_state = 1501 }
				NOT = { controls_state = 1502 }
				NOT = { controls_state = 1503 }
				NOT = { controls_state = 1504 }
				NOT = { controls_state = 1505 }
				NOT = { controls_state = 598 }
				NOT = { controls_state = 606 }
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 607
			} 
		}
		
		visible = {
			controls_state = 607
			is_literally_china = yes
			NOT = { has_global_flag = chi_yellow_river_blown } #So warlords don't do this too
		}
		
		fire_only_once = yes
		
		cost = 20

		ai_will_do = {
			base = 0
			#Pretty damn important
			modifier = {
				add = 25
				NOT = { controls_state = 608 }
			}
			modifier = {
				add = 25
				NOT = { controls_state = 614 }
			}
			modifier = {
				add = 5
				NOT = { controls_state = 597 }
			}
			modifier = {
				add = 5
				NOT = { controls_state = 1494 }
			}
			modifier = {
				add = 5
				NOT = { controls_state = 1495 }
			}
			modifier = {
				add = 5
				NOT = { controls_state = 1496 }
			}
			modifier = {
				add = 5
				NOT = { controls_state = 1497 }
			}
			modifier = {
				add = 5
				NOT = { controls_state = 1498 }
			}
			modifier = {
				add = 5
				NOT = { controls_state = 1499 }
			}
			modifier = {
				add = 5
				NOT = { controls_state = 1500 }
			}
			modifier = {
				add = 5
				NOT = { controls_state = 1501 }
			}
			modifier = {
				add = 5
				NOT = { controls_state = 1502 }
			}
			modifier = {
				add = 5
				NOT = { controls_state = 1503 }
			}
			modifier = {
				add = 5
				NOT = { controls_state = 1504 }
			}
			modifier = {
				add = 5
				NOT = { controls_state = 1505 }
			}
			modifier = {
				add = 25
				NOT = { controls_state = 598 }
			}
			modifier = {
				add = 25
				NOT = { controls_state = 606 }
			}
		}
		
		complete_effect = {
			add_war_support = -0.05
			every_owned_state = {
				limit = {
					OR = {
						state = 606
						state = 607
						state = 598
						state = 597
						state = 1494
						state = 1495
						state = 1496
						state = 1497
						state = 1498
						state = 1499
						state = 1500
						state = 1501
						state = 1502
						state = 1503
						state = 1504
						state = 1505
					}
				}
				add_dynamic_modifier = {
					modifier = yellow_river_blown
					days = 730 
				}
			}
			hidden_effect = { 
				news_event = { id = news.409 } 
				set_global_flag = chi_yellow_river_blown
			}
		}
	}
	
}
