
debug_decisions = {
	CHI_Dannes_debugg_fiesta = {
		icon = generic_nationalism

		allowed = {
			tag = CHI
		}

		visible = {
			
		}
		complete_effect = {
			
		}	
	}
}
#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
			}
			OR = {
				has_completed_focus = CHI_commit_to_korean_independence
				has_completed_focus = CHI_sea_commit_to_korean_independence
			}
		}

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

CHI_warlord_core_territories_cat = {
	
	CHI_warlord_core_territories = {
	
			icon = GFX_decision_generic_form_nation
	
			ai_will_do = {
				base = 50
			}
	
			priority = 25
	
			#highlight_states = {
			#	highlight_state_targets = {
			#		state = FROM 
			#	} 
			#}
		
			allowed = {
			}
			
			visible = {
				has_completed_focus = CHI_sea_one_china_policy
			}
			
			available = {
				FROM = {
					NOT = { has_state_flag = CHI_coring_state_in_progress_flag }
				}
				FROM = {
					compliance > 40
				}
			}
	
			state_target = any_controlled_state
		    
		    target_trigger = {
		        FROM = {
		        	NOT = { is_core_of = ROOT }
		        	is_fully_controlled_by = ROOT
		        	OR = {
		        		state = 330
						state = 817
						state = 818
						state = 819
						state = 820
						state = 329
						state = 1457
						state = 1460
						state = 1461
						state = 1462
						state = 1463
						state = 1464
						state = 1465
						state = 1466
						state = 1467
						state = 1468
						state = 1469
						state = 1470
						state = 1471
						state = 1472
						state = 1473
		        		state = 322
		        		state = 757
		        		state = 758
		        		state = 434
		        	}
		        }
		    }
		    on_map_mode = map_only
	
		    cost = 50		
	
			fire_only_once = yes
	
			days_remove = 35
	
			complete_effect = {
				hidden_effect = {
					FROM = {
						set_state_flag = { flag = CHI_coring_state_in_progress_flag value = 1 	days = 31 }
					}
				}
			}
	
			remove_effect = {
				hidden_effect = {
					FROM = {
						clr_state_flag = CHI_coring_state_in_progress_flag
					}
				}
	
				FROM = {
					add_core_of = ROOT
				}
				
			}
	
			cancel_trigger = {
				FROM = {
					NOT = { is_fully_controlled_by = ROOT }
				}
			}
	
			cancel_effect = {
				hidden_effect = {
					FROM = {
						clr_state_flag = CHI_coring_state_in_progress_flag
					}
				}
			}
		}

		CHI_warlord_core_manchuria = {
	
			icon = GFX_decision_generic_form_nation
	
			ai_will_do = {
				base = 50
			}
	
			priority = 25
	
			#highlight_states = {
			#	highlight_state_targets = {
			#		state = FROM 
			#	} 
			#}
		
			allowed = {
				
			}
			
			visible = {
				has_completed_focus = CHI_sea_push_into_manchuria
			}
			
			available = {
				FROM = {
					NOT = { has_state_flag = CHI_coring_state_in_progress_flag }
				}
				FROM = {
					compliance > 45
				}
			}
	
			state_target = any_controlled_state
		    
		    target_trigger = {
		        FROM = {
		        	NOT = { is_core_of = ROOT }
		        	is_fully_controlled_by = ROOT
		        	OR = {
						state = 408
						state = 409
						state = 657
						state = 560
						state = 561
						state = 1332
						state = 1333
						state = 1334
						state = 1335
						state = 1336
						state = 1338
		        	}
		        }
		    }
		    on_map_mode = map_only
	
		    cost = 50		
	
			fire_only_once = yes
	
			days_remove = 35
	
			complete_effect = {
				hidden_effect = {
					FROM = {
						set_state_flag = { flag = CHI_coring_state_in_progress_flag value = 1 	days = 31 }
					}
				}
			}
	
			remove_effect = {
				hidden_effect = {
					FROM = {
						clr_state_flag = CHI_coring_state_in_progress_flag
					}
				}
	
				FROM = {
					add_core_of = ROOT
				}
				
			}
	
			cancel_trigger = {
				FROM = {
					NOT = { is_fully_controlled_by = ROOT }
				}
			}
	
			cancel_effect = {
				hidden_effect = {
					FROM = {
						clr_state_flag = CHI_coring_state_in_progress_flag
					}
				}
			}
		}

}


#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 = {
			hidden_trigger = {
				has_army_experience > 74
			}
			hidden_trigger = {
				OR = {
					has_completed_focus = CHI_army_reform
					has_completed_focus = CHI_sea_army_reform
				}
			}
			custom_trigger_tooltip = {
				tooltip = CHI_army_reform_tt
				OR = {
					has_completed_focus = CHI_army_reform
					has_completed_focus = CHI_sea_army_reform
				}
			}
			
		}

		custom_cost_trigger = {
			has_army_experience > 74
		}
		custom_cost_text = decision_cost_ArmXP_75

		cost = 0
		ai_will_do = {
			base = 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 = {
			hidden_effect = {
				army_experience = -75	
			}				
		}	

	}

	CHI_lessons_of_war = {
		icon = generic_army_support
		available = {
			hidden_trigger = {
				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 }
			}
		}

		custom_cost_trigger = {
			has_army_experience > 199
		}
		custom_cost_text = decision_cost_ArmXP_200

		cost = 0
		ai_will_do = {
			base = 100
		}
		fire_only_once = yes

		visible = {
			has_idea = CHI_incompetent_officers
			OR = {
				has_completed_focus = CHI_army_reform
				has_completed_focus = CHI_sea_army_reform
			}
		}

		complete_effect = {
			hidden_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 = {
			base = 1
		}
		fire_only_once = yes

		visible = {
			OR = {
				has_completed_focus = CHI_60_divisions_plan
				has_completed_focus = CHI_sea_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 = {
			base = 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 = {
			OR = {
				has_completed_focus = CHI_forced_loans
				has_completed_focus = CHI_sea_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

		allowed = {
			original_tag = CHI
		}

		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 = {
			base = 1
		}

		visible = {			
			OR = {
				has_completed_focus = CHI_scorched_earth_tactics
				has_completed_focus = CHI_sea_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_state = { 
		icon = generic_scorched_earth
		allowed = {
			has_dlc = "No Compromise, No Surrender"
			original_tag = CHI
		}

		state_target = yes

		target_array = ROOT.core_states

		target_root_trigger = {
			has_completed_focus = CHI_relocate_factories_from_the_coast
		}

		visible = {
			any_controlled_state = { #If you don't control anyother state than FROM, you can't move the factories
				NOT = { state = FROM }
			}
			FROM = {
				is_controlled_by = ROOT
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}			
		}

		available = {
		}

		highlight_states = {
			highlight_state_targets = {
				state = FROM
			} 
		}

		cancel_if_not_visible = yes

		fire_only_once = no

		cost = 25

		days_remove = 15

		modifier = {}

		remove_effect = {
			FROM = {
				CHI_move_factories	= yes
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 2
				FROM = {
					OR = {
						AND = {
							OR = {
								arms_factory > 1
								industrial_complex > 1
							}
						}
						AND = {
							arms_factory > 0
							industrial_complex > 0
						}
					}
				}
			}
			modifier = {
				factor = 2.5
				FROM = {
					is_coastal = yes
				}
			}
			modifier = {
				factor = 2.5
				FROM = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 2
				FROM = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.2
				ROOT = {
					original_tag = CHI
				}
				is_historical_focus_on = yes
				date > 1941.1.1
			}
			modifier = {
				factor = 0.2
				FROM = {
					OR = {
						state = 750
						state = 605
						state = 603
						state = 748
						state = 1037
						state = 1041
						state = 752
						state = 751
					}
				}
				is_historical_focus_on = yes
			} 
		}
	}
	CHI_industrial_evacuations_from_gansu = { #283 #gansu
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			283 = { #283 #gansu
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 283
			} 
		}
		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				283 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				283 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_hainan = { #591 #hainan
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			591 = { #591 #hainan
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 591
			} 
		}
		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				591 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				591 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_guangzhou = { #592 #guangzhou
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			592 = { #592 #guangzhou
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 592
			} 
		}

		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				592 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				592 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_guangdong = { #593 #guangdong
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			593 = { #593 #guangdong
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 593
			} 
		}

		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				593 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				593 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_nanning = { #594 #nanning
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			594 = { #594 #nanning
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 594
			} 
		}

		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				594 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				594 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_fujian = { #595 #fujian
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			595 = { #595 #fujian
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 595
			} 
		}

		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				595 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				595 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_zhejiang = { #596 #zhejiang
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			596 = { #596 #zhejiang
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 596
			} 
		}

		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				596 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				596 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_shandong = { #597 #shandong
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			597 = { #597 #shandong
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 597
			} 
		}

		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				597 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				597 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_jiangsu = { #598 #jiangsu
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			598 = { #598 #jiangsu
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 598
			} 
		}
		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				598 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				598 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_guangxi = { #599 #guangxi
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			599 = { #599 #guangxi
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 599
			} 
		}

		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				599 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				599 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_jiangxi = { #600 #jiangxi
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			600 = { #600 #jiangxi
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 600
			} 
		}

		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				600 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				600 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_hunan = { #602 #hunan
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			602 = { #602 #hunan
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}	
		highlight_states = {
			highlight_state_targets = {
				state = 602
			} 
		}
		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				602 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				602 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_anhui = { #606 #anhui
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			606 = { #606 #anhui
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}

		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				606 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				606 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_henan = { #607 #henan
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			607 = { #607 #henan
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 607
			} 
		}
		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				607 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				607 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_beijing = { #608 #beijing
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			608 = { #608 #beijing
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 608
			} 
		}

		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				608 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				608 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_shanghai = { #613 #shanghai
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			613 = { #613 #shanghai
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 613
			} 
		}
		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				613 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				613 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_hebei = { #614 #hebei
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			614 = { #614 #hebei
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 614
			} 
		}
		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				614 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				614 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_ningxia = { #616 #ningxia
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			616 = { #616 #ningxia
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 616
			} 
		}
		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				616 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				616 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_hubei = { #620 #hubei
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			620 = { #620 #hubei
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 620
			} 
		}
		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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 = {
					CHI_move_factories	= yes
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				620 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				620 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}

	CHI_industrial_evacuations_from_qingdao = { #743 #qingdao
		icon = generic_scorched_earth

		allowed = {
			OR = {
				NOT = { has_dlc = "No Compromise, No Surrender" }
				AND = {
					NOT = { original_tag = CHI }
					has_dlc = "No Compromise, No Surrender"
				}
			}
		}
		available = {
			743 = { #743 #qingdao
				OR = {
					arms_factory > 0
					industrial_complex > 0
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 743
			} 
		}
		visible = {
			OR = {
				has_completed_focus = CHI_industrial_evacuations
				has_completed_focus = CHI_sea_industrial_evacuations
				has_completed_focus = CHI_relocate_factories_from_the_coast
			}
			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
					CHI_move_factories = yes		
				}
			}
		}

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				743 = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 5
				743 = {
					any_neighbor_state = {
						any_neighbor_state = {
							controller = {
								has_war_with = ROOT
							}
						}
					}
				}
			}
		}
	}
}

#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 = {
			OR = {
				has_completed_focus = CHI_subjugate_the_warlords
				has_completed_focus = CHI_sea_subjugate_the_warlords
			}
		}
		target_array = subjects


		target_trigger = {
			FROM = {
				is_subject_of = ROOT
				OR = {
					tag = GXC
					tag = YUN
					tag = SHX
					tag = XSM
					tag = SIK
					tag = SND
					tag = GDC
					tag = SIC
					tag = XIC
					tag = NXM
					tag = GSM
					tag = KHM
					tag = HBC
				}
			}
		}

		days_remove = 90
		fire_only_once = yes
		ai_will_do = {
			base = 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
					}
				}
			}
			else_if = {
				limit = { FROM = { tag = SND } }
				if = {
					limit = {
						FROM = {
							not = {
								has_completed_focus = CHI_personal_leadership
							}
						}
					}
					SND = {
						SND_han_fuju = {
							add_corps_commander_role = {
								traits = { }
								attack_skill = 3
								defense_skill = 2
								planning_skill = 2
								logistics_skill = 3
								skill = 3
								legacy_id=-1
							}
						}
					}
					
				}
				FROM = {
					every_unit_leader = {
						set_nationality = ROOT
					}
				}
			}
			else_if = {
				limit = { FROM = { tag = GDC } }
				if = {
					limit = {
						FROM = {
							not = {
								has_completed_focus = CHI_personal_leadership
							}
						}
					}
					GDC = {
						GXC_chen_jitang = {
							add_corps_commander_role = {
								traits = { }
								attack_skill = 4
								defense_skill = 1
								planning_skill = 3
								logistics_skill = 2
								skill = 3
								legacy_id=-1
							}
						}
					}
					
				}
				FROM = {
					every_unit_leader = {
						set_nationality = ROOT
					}
				}
			}
			else_if = {
				limit = { FROM = { tag = HBC } }
				FROM = {
					every_unit_leader = {
						set_nationality = ROOT
					}
				}
			}
			else_if = {
				limit = { FROM = { tag = SIC } }
				if = {
					limit = {
						FROM = {
							not = {
								has_completed_focus = CHI_personal_leadership
							}
						}
					}
					SIC = {
						SIC_liu_xiang = {
							add_corps_commander_role = {
								traits = { }
								attack_skill = 2
								defense_skill = 5
								planning_skill = 1
								logistics_skill = 2
								skill = 3
								legacy_id=-1
							}
						}
					}
					
				}
				FROM = {
					every_unit_leader = {
						set_nationality = ROOT
					}
				}
			}
			else_if = {
				limit = { FROM = { tag = XIC } }
				if = {
					limit = {
						FROM = {
							not = {
								has_completed_focus = CHI_personal_leadership
							}
						}
					}
					XIC = {
						CHI_zhang_xueliang = {
							add_corps_commander_role = {
								traits = { }
								attack_skill = 5
								defense_skill = 2
								planning_skill = 1
								logistics_skill = 2
								skill = 3
								legacy_id=-1
							}
						}
					}
					
				}
				FROM = {
					every_unit_leader = {
						set_nationality = ROOT
					}
				}
			}
			else_if = {
				limit = { FROM = { tag = NXM } }
				if = {
					limit = {
						FROM = {
							not = {
								has_completed_focus = CHI_personal_leadership
							}
						}
					}
					NXM = {
						XSM_ma_hongkui = {
							add_corps_commander_role = {
								traits = { }
								attack_skill = 4
								defense_skill = 2
								planning_skill = 1
								logistics_skill = 3
								skill = 3
								legacy_id=-1
							}
						}
					}
					
				}
				FROM = {
					every_unit_leader = {
						set_nationality = ROOT
					}
				}
			}
			else_if = {
				limit = { FROM = { tag = GSM } }
				if = {
					limit = {
						FROM = {
							not = {
								has_completed_focus = CHI_personal_leadership
							}
						}
					}
					GSM = {
						XSM_ma_buqing = {
							add_corps_commander_role = {
								traits = { }
								attack_skill = 1
								defense_skill = 3
								planning_skill = 3
								logistics_skill = 3
								skill = 3
								legacy_id=-1
							}
						}
					}
					
				}
				FROM = {
					every_unit_leader = {
						set_nationality = ROOT
					}
				}
			}
			else_if = {
				limit = { FROM = { tag = KHM } }
				if = {
					limit = {
						FROM = {
							not = {
								has_completed_focus = CHI_personal_leadership
							}
						}
					}
					KHM = {
						KHM_ma_hushan = {
							add_corps_commander_role = {
								traits = { }
								attack_skill = 3
								defense_skill = 3
								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
					tag = SND
					tag = GDC
					tag = SIC
					tag = XIC
					tag = NXM
					tag = GSM
					tag = KHM
					tag = HBC
				}
			}
		}
		fire_only_once = yes
		ai_will_do = {
			base = 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
					tag = SND
					tag = GDC
					tag = SIC
					tag = XIC
					tag = NXM
					tag = GSM
					tag = KHM
					tag = HBC
				}
			}
		}
		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 = {
			base = 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 < 200
				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 }
						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 > 999 }
		}
		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 = 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 = {
			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_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 = {
			base = 1
		}
		fire_only_once = yes
		days_remove = -1
		complete_effect = {
			random_country = {
				limit = {
					OR ={
						has_completed_focus = CHI_invite_the_flying_tigers
						has_completed_focus = CHI_international_squadron
					}
				}
				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 = {
			base = 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_focus_tree = china_communist_warlord_focus 
						has_focus_tree = china_nationalist_warlord_focus 
					}
				}
				OR = {
					has_completed_focus = CHI_burma_road
					has_completed_focus = CHI_sea_burma_road
				}
			}
			if = {
				limit = {
					has_focus_tree = british_focus
				}
				has_completed_focus = uk_burma_focus
			}
			any_state_of = {
				target = { 288 640 325 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
							has_completed_focus = CHI_sea_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
										has_completed_focus = CHI_sea_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 = china_communist_warlord_focus 
					has_focus_tree = china_nationalist_warlord_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_current_level > 0 } }
				add_to_variable = { var = CHI_burma_road_current_level 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_with_original_tag_of = {
				tooltip = TRIGGER_ANY_COUNTRY_STARTS
				target  = constant:country_groups.literally_china
				OR = {
					has_completed_focus = CHI_ledo_road
					has_completed_focus = CHI_sea_ledo_road
				}
			}
			OR = {
				controls_state = 640
				640 = {
					CONTROLLER = {
						is_in_faction_with = ROOT
					}
				}
				controls_state = 325
				325 = {
					CONTROLLER = {
						OR = {
							AND = {
								is_subject = yes
								OVERLORD = {
									OR = {
										has_completed_focus = CHI_ledo_road
										has_completed_focus = CHI_sea_ledo_road
									}
								}
							}
							AND = {
								is_in_faction_with = event_target:WTT_current_china_leader
								event_target:WTT_current_china_leader = {
									OR = {
										has_completed_focus = CHI_ledo_road
										has_completed_focus = CHI_sea_ledo_road
									}
								}
							}
						}
					}
				}
			}
		}
		visible = {
			OR = {
				has_completed_focus = CHI_ledo_road
				has_completed_focus = CHI_sea_ledo_road
				controls_state = 640
				640 = {
					CONTROLLER = {
						is_in_faction_with = ROOT
					}
				}
			}
			NOT = {
				has_global_flag = CHI_ledo_3
			}
			any_country = {
				OR = {
					has_completed_focus = CHI_ledo_road
					has_completed_focus = CHI_sea_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_current_level > 0 } }
				add_to_variable = { var = CHI_ledo_road_current_level 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
							has_completed_focus = CHI_sea_the_hump
							is_in_faction_with = ROOT
						}
					}
				}
			}
		}
		visible = {
			OR = { 
				AND = {
					OR = {
						has_completed_focus = CHI_the_hump
						has_completed_focus = CHI_sea_the_hump
					}
					OR = {
						controls_state = 601
						601 = {
							CONTROLLER = {
								is_in_faction_with = ROOT
							}
						}
					}
				}
				AND = {
					controls_state = 434
					any_country = {
						OR = {
							has_completed_focus = CHI_the_hump
							has_completed_focus = CHI_sea_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_current_level 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 = {
			OR = {
				is_literally_china = yes
				original_tag = MEN
			}
			CHI = {
				is_in_faction_with = PRC
			}
			is_in_faction = no
			is_subject = no
			NOT = {
				has_country_flag = warlord_has_asked_to_join_CUF_but_refused
			}
		}

		available = {
			OR = {
				is_literally_china = yes
				original_tag = MEN
			}

			NOT = {
				has_idea = SIK_battle_for_sinkiang
			}
			
			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
				}
			}

			OR = {
				AND = {
					ROOT = {
						has_war = yes
					}
					CHI = {
						has_war = yes
					}
				}
				AND = {
					ROOT = {
						has_war = no
					}
					CHI = {
						has_war = no
					}
				}
				AND = {
					ROOT = {
						has_war = no
					}
					CHI = {
						has_war = yes
					}
				}
			}

		}
		
		cost = 5

		ai_will_do = {

			base = 2

			modifier = {
				JAP = {
					OR = {
						has_war_with = CHI
						has_war_with = PRC
					}
				}
				factor = 15
			}

			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
			}

			# Hebei Chahar don't care
			modifier = {
				original_tag = HBC
				is_subject = no
				has_war = no
				CHI = {
					NOT = {
						has_war_with = JAP
						has_war_with = MAN
					}
				}
				factor = 0
			}

			modifier = {
				# Should join the CUF almost immediatly after creation if possible 
				original_tag = SIC
				has_country_leader = {
					ruling_only = yes
					character = SIC_liu_xiang
				}	
				factor = 20 
			}

		}

		complete_effect = {

			IF = {
				limit = {
					CHI = {
						is_faction_leader = yes
					}
				}
				CHI = {
					country_event = SEA_PRC_faction_events.60
				}
				add_ai_strategy = {
					type = alliance
					id = CHI
					value = 200
				}
			}
			ELSE_IF = {
				limit = {
					PRC = {
						is_faction_leader = yes
					}
				}
				PRC = {
					country_event = SEA_PRC_faction_events.60
				}
				add_ai_strategy = {
					type = alliance
					id = PRC
					value = 200
				}
			}

			hidden_effect = {
				set_country_flag = warlord_has_asked_to_join_CUF_but_refused
				country_event = { ## Clear country flag
					id =  SEA_PRC_faction_events.100
					days = 180
				}
			}
		}

	}

	CHI_move_the_capital = {
		allowed = {
			OR = {
				AND = {
					is_literally_china = yes
					has_dlc = "Waking the Tiger"
					NOT = {
						has_dlc = "No Compromise, No Surrender"
					}
				}
				AND = {
					has_dlc = "No Compromise, No Surrender"
					is_literally_china_not_prc = yes 
				}
			}
		}
		available = {
			has_war = no
			OR = {
				has_full_control_of_state = 608 # Beijing
				has_full_control_of_state = 1035 # Nanjing
			}
			capital_scope = {
				NOT = {
					OR = {
						state = 608 # Beijing
						state = 1035 # Nanjing
					}
				}
			}
		}
		visible = {
			has_war = no
			is_subject = no
			OR = {
				has_full_control_of_state = 608 # Beijing
				has_full_control_of_state = 1035 # Nanjing
			}
			capital_scope = {
				NOT = {
					OR = {
						state = 608 # Beijing
						state = 1035 # Nanjing
					}
				}
			}
		}
		cost = 50
		ai_will_do = {
			base = 1
		}
		complete_effect = {
			country_event = wtt_china.204
		}
	}
}

CHI_xian_incident = {

 	CHI_instigate_xian_incident = {

		icon = generic_political_discourse

		visible = {
			if = {
				limit = {
					has_dlc = "No Compromise, No Surrender"
				}
				NOT = {
					CHI = {
						has_faction_template = faction_template_chinese_united_front
					}
					PRC = {
						has_faction_template = faction_template_chinese_united_front
					}
				}	
			}
			NOT = {
				has_global_flag = CHI_xian_fired
				has_global_flag = early_united_front
			}
			CHI = {
				has_country_leader = {
					ruling_only = yes
					character = CHI_chiang_kaishek
				}
				is_subject = no
				NOT = {
					is_in_faction_with = PRC
				}
			}
			PRC = {
				exists = yes
				is_subject = no
				NOT = {
					has_war_with = CHI
				}
			}
			is_literally_china = yes
			NOT = {
				OR = {
					original_tag = CHI
					original_tag = PRC
				}
			}
			event_target:WTT_current_china_leader = { tag = CHI }
		}

		available = {			
			NOT = {
				has_global_flag = CHI_xian_fired
			}
			CHI = {
				has_country_leader = {
					ruling_only = yes
					character = CHI_chiang_kaishek
				}
				NOT = {
					is_in_faction_with = PRC
				}
				NOT = {
					has_war_with = PRC
				}
				NOT = {
					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
			}
			IF = {
				limit = {
					has_dlc = "No Compromise, No Surrender"
				}
				OR = {
					XIC = {
						exists = no
					}
					date > 1936.12.1
					XIC = {
						has_completed_focus = XIC_sixth_encirclement_campaign
					}
				}
			}
		}

		cost = 25

		fire_only_once = yes

		ai_will_do = {

			base = 5

			modifier = {
				threat > 0.15
				factor = 3
			}

			modifier = {
				threat > 0.1
				factor = 2
			}

			modifier = {
				threat > 0.05
				factor = 1.5
			}


			modifier = {
				date < 1936.12.8
				factor = 0.1
			}

			modifier = {
				date > 1937.1.1
				factor = 10
			}

			modifier = { # If influenced by Soviets, Sinkiang has no interest in this.
				factor = 0
				original_tag = SIK
				has_government = communism
			}

			modifier = { # The Japanese need to have begun down an agressive routue 
				JAP = { 	
					NOT = {
						has_completed_focus = JAP_revisit_the_thirteen_demands
						has_completed_focus = JAP_new_order_in_east_asia
					}
				}
				factor = 0.1
			}

			modifier = { # Japanese needs to be one of the imperialist ideologies
				JAP = {
					NOT = {
						has_government = fascism
						has_government = neutrality
					}
				}
				factor = 0
			}

			modifier = { # They are less scared if Japan has yet to subjugate the Inner Mongolians
				JAP = {
					NOT = {
						has_subject = MEN
					}
				}
				factor = 0.5
			}

			modifier = { # They are much more scared if Japan has attacked China
				JAP = {
					has_war_with = CHI
				}
				factor = 10
			}

		}

		complete_effect = {
			set_country_flag = CHI_xian_instigator_flag
			set_global_flag = CHI_xian_fired

			CHI = {
				country_event = { id = wtt_xian_incident.1 hours = 1 }
			}
		}
	}
}

operations = {
	
	CHI_overlordship_over_indochina = {
		icon = generic_operation

		allowed = {
			OR = {
				is_literally_china = yes
				original_tag = MAN
			}
		}

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

		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
		}
	}

	CHI_overlordship_over_indochina_tsr = {
		icon = generic_operation

		allowed = {
			OR = {
				is_literally_china = yes
				original_tag = MAN
			}
		}

		visible = {
			has_completed_focus = CHI_sea_overlordship_over_indochina
		} 

		available = {
			has_completed_focus = CHI_sea_overlordship_over_indochina
			671 = {
				OR = {
					is_controlled_by = ROOT
					CONTROLLER = {
						is_subject_of = ROOT
					}
				}
			}
			741 = {
				OR = {
					is_controlled_by = ROOT
					CONTROLLER = {
						is_subject_of = ROOT
					}
				}
			}
			670 = {
				OR = {
					is_controlled_by = ROOT
					CONTROLLER = {
						is_subject_of = ROOT
					}
				}
			}
			286 = {
				OR = {
					is_controlled_by = ROOT
					CONTROLLER = {
						is_subject_of = ROOT
					}
				}
			}
			1017 = {
				OR = {
					is_controlled_by = ROOT
					CONTROLLER = {
						is_subject_of = ROOT
					}
				}
			}
		}

		cost = 50

		fire_only_once = yes
		
		complete_effect = {
			add_political_power = 50
			add_war_support = 0.05
			add_stability = 0.05
			every_enemy_country = {
				limit = {
					OR = {
						owns_state = 671
						owns_state = 741
						owns_state = 670
						owns_state = 286
						owns_state = 1017
						671 = {
							OWNER = {
								is_in_faction_with = PREV
							}
						}
						741 = {
							OWNER = {
								is_in_faction_with = PREV
							}
						}
						670 = {
							OWNER = {
								is_in_faction_with = PREV
							}
						}
						286 = {
							OWNER = {
								is_in_faction_with = PREV
							}
						}
						1017 = {
							OWNER = {
								is_in_faction_with = PREV
							}
						}
					}
				}
				ROOT = {
					white_peace = {
						tag = PREV
					}
				}
			}
			1017 = {
				transfer_state_to = ROOT
			}
			671 = {
				transfer_state_to = ROOT
			}
			741 = {
				transfer_state_to = ROOT
			}
			670 = {
				transfer_state_to = ROOT
			}
			286 = {
				transfer_state_to = ROOT
			}
		}
	}

	CHI_free_indochina_tsr = {
		icon = generic_operation

		allowed = {
			OR = {
				is_literally_china = yes
				original_tag = MAN
			}
		}

		visible = {
			has_completed_focus = CHI_sea_guidance_and_support
		}

		available = {
			has_completed_focus = CHI_sea_guidance_and_support
			671 = {
				OR = {
					is_controlled_by = ROOT
					CONTROLLER = {
						is_subject_of = ROOT
					}
				}
			}
			741 = {
				OR = {
					is_controlled_by = ROOT
					CONTROLLER = {
						is_subject_of = ROOT
					}
				}
			}
			670 = {
				OR = {
					is_controlled_by = ROOT
					CONTROLLER = {
						is_subject_of = ROOT
					}
				}
			}
			286 = {
				OR = {
					is_controlled_by = ROOT
					CONTROLLER = {
						is_subject_of = ROOT
					}
				}
			}
			1017 = {
				OR = {
					is_controlled_by = ROOT
					CONTROLLER = {
						is_subject_of = ROOT
					}
				}
			}
		} 

		cost = 50

		fire_only_once = yes
		
		complete_effect = {
			every_enemy_country = {
				limit = {
					OR = {
						owns_state = 671
						owns_state = 741
						owns_state = 670
						owns_state = 286
						owns_state = 1017
						671 = {
							OWNER = {
								is_in_faction_with = PREV
							}
						}
						741 = {
							OWNER = {
								is_in_faction_with = PREV
							}
						}
						670 = {
							OWNER = {
								is_in_faction_with = PREV
							}
						}
						286 = {
							OWNER = {
								is_in_faction_with = PREV
							}
						}
						1017 = {
							OWNER = {
								is_in_faction_with = PREV
							}
						}
					}
				}
				ROOT = {
					white_peace = {
						tag = PREV
					}
				}
			}
			1017 = {
				transfer_state_to = ROOT
			}
			671 = {
				transfer_state_to = ROOT
			}
			741 = {
				transfer_state_to = ROOT
			}
			670 = {
				transfer_state_to = ROOT
			}
			286 = {
				transfer_state_to = ROOT
			}
			release_autonomy = { 
				target = CAM  
				autonomy_state = autonomy_puppet 
				freedom_level = 0.5
			}
			release_autonomy = { 
				target = CHM  
				autonomy_state = autonomy_puppet 
				freedom_level = 0.5
			}
			release_autonomy = { 
				target = VIN  
				autonomy_state = autonomy_puppet 
				freedom_level = 0.5
			}
			release_autonomy = { 
				target = LAO  
				autonomy_state = autonomy_puppet 
				freedom_level = 0.5
			}
		}
	}
}

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 = {
			IF = {
				limit = {
					has_dlc = "No Compromise, No Surrender"
				}
				controls_state = 607
				has_completed_focus = CHI_defence_in_depth
				has_war_with = JAP
				OR = {
					608 = { is_controlled_by_ROOT_or_ally = no } # Beijing
					614 = { is_controlled_by_ROOT_or_ally = no } # Hebei
					615 = { is_controlled_by_ROOT_or_ally = no } # Shanxi
					597 = { is_controlled_by_ROOT_or_ally = no } # Shandong
					598 = { is_controlled_by_ROOT_or_ally = no } # Jiangsu
					606 = { is_controlled_by_ROOT_or_ally = no } # Anhui
					749 = { is_controlled_by_ROOT_or_ally = no } # Huangshan
					1038 = { is_controlled_by_ROOT_or_ally = no } # Jinan
					1035 = { is_controlled_by_ROOT_or_ally = no } # Nanjing
				}
			}
			ELSE = {
				controls_state = 607
				has_war_with = JAP
				OR = {
					NOT = { controls_state = 608 }
					NOT = { controls_state = 614 }
					NOT = { controls_state = 615 }
					NOT = { controls_state = 597 }
					NOT = { controls_state = 598 }
					NOT = { controls_state = 606 }
					NOT = { controls_state = 1038 }
					NOT = { controls_state = 1035 }
					NOT = { controls_state = 749 }
				}
			}
		}
		highlight_states = {
			highlight_state_targets = {
				state = 606
				state = 607
				state = 598
			} 
		}
		
		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 = 1
			#Pretty damn important
			modifier = {
				factor = 1.5
				has_defensive_war = yes 
			}
			modifier = {
				factor = 2
				615 = { # Shanxi
					controller = {
						has_war_with = ROOT
						is_literally_china = no
					}
				}
			}
			modifier = {
				factor = 3
				614 = { # Hebei
					controller = {
						has_war_with = ROOT
						is_literally_china = no
					}
				}
			}
			modifier = {
				factor = 3
				1038 = { # Jinan
					controller = {
						has_war_with = ROOT
						is_literally_china = no
					}
				}
			}
			modifier = {
				factor = 3
				598 = { # Jiangsu
					controller = {
						has_war_with = ROOT
						is_literally_china = no
					}
				}
			}
			modifier = {
				factor = 3
				1035 = { # Nanjing
					controller = {
						has_war_with = ROOT
						is_literally_china = no
					}
				}
			}
			modifier = {
				factor = 3
				749 = { # Huangshan
					controller = {
						has_war_with = ROOT
						is_literally_china = no
					}
				}
			}
			modifier = {
				factor = 3
				600 = { # Jiangxi
					controller = {
						has_war_with = ROOT
						is_literally_china = no
					}
				}
			}
			modifier = {
				factor = 3
				1036 = { # Wuhan
					controller = {
						has_war_with = ROOT
						is_literally_china = no
					}
				}
			}
			modifier = {
				factor = 3
				620 = { # Hubei
					controller = {
						has_war_with = ROOT
						is_literally_china = no
					}
				}
			}
			modifier = {
				factor = 3
				744 = { # Xian
					controller = {
						has_war_with = ROOT
						is_literally_china = no
					}
				}
			}
			modifier = {
				factor = 1.5
				597 = { # Shandong
					controller = {
						has_war_with = ROOT
						is_literally_china = no
					}
				}
			}
			modifier = {
				factor = 1.5
				598 = { # Jiangsu
					controller = {
						has_war_with = ROOT
						is_literally_china = no
					}
				}
			}
			modifier = {
				factor = 1.5
				1034 = { # Suzhou
					controller = {
						has_war_with = ROOT
						is_literally_china = no
					}
				}
			}
			modifier = {
				factor = 1.5
				596 = { # Zhejiang
					controller = {
						has_war_with = ROOT
						is_literally_china = no
					}
				}
			}
			modifier = {
				factor = 1.5
				595 = { # Fujian
					controller = {
						has_war_with = ROOT
						is_literally_china = no
					}
				}
			}
			modifier = {
				factor = 0 #Don't blow up anything if we're doing fine
				607 = { # Henan
					all_neighbor_state = {
						OR = {
							is_controlled_by_ROOT_or_ally = yes
							controller = {
								NOT = { has_war_with = ROOT }
							}
						}
					}
				}
			}
		}
		
		complete_effect = {

			add_war_support = -0.05
			add_popularity = {
				ideology = communism
				popularity = 0.025
			}	

			custom_effect_tooltip = generic_skip_one_line_tt

			every_state = {
				limit = {
					is_on_continent = asia #just to limit the amount of states the game has to go through
					OR = {
						state = 606
						state = 607
						state = 598
					}
				}
				add_dynamic_modifier = {
					modifier = yellow_river_blown
					days = 730 
				}
			}
			hidden_effect = { 
				news_event = { id = news.409 } 
				set_global_flag = chi_yellow_river_blown
			}
		}
	}
	
}

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

CHI_war_of_resistance_cat = {

	CHI_demonstrate_our_resolve_decision = {

		icon = GFX_decision_generic_speech 

		visible = {
			has_completed_focus = CHI_demonstrate_our_resolve
			NOT = {
				has_country_flag = CHI_declared_defence
			}
			has_completed_focus = CHI_demonstrate_our_resolve
			has_war_with_major = yes 
		}

		state_target = yes
		target_array = ROOT.core_states

		on_map_mode = map_and_decisions_view

		target_trigger = {
			FROM = {
				is_controlled_by_ROOT_or_ally = yes
				NOT = {
					state_is_fully_controlled_by_ROOT_subject_or_faction_member = yes
					has_state_flag = CHI_declared_defence_recently
				}
			}
		}

		available = {
			NOT = {
				has_country_flag = CHI_declared_defence
			}
			FROM = { 
				is_controlled_by_ROOT_or_ally = yes
				NOT = {
					state_is_fully_controlled_by_ROOT_subject_or_faction_member = yes
				}
			}
		}
		
		cost = 25

		ai_will_do = {
			base = 1
			modifier = {
				factor = 5
				command_power > 24
			}
			modifier = {
				factor = 2
				FROM = {
					supply_node > 0
				}
			}
			modifier = {
				factor = 5
				FROM = {
					has_dynamic_modifier = { modifier = CHI_bog_defensive_modifier }
				}
			}
			modifier = { # Japan has an ongoing offensive, making this more risky than it's worth 
				factor = 0.5
				FROM = {
					has_dynamic_modifier = { modifier = JAP_chinese_offensive_military_offensive }
				}
			}
			modifier = {
				factor = 5
				FROM = {
					is_capital = yes
				}
			}
		}

		complete_effect = {
			custom_effect_tooltip = CHI_demonstrate_our_resolve_decision_tt
			effect_tooltip = {
				every_subject_country = {
					add_autonomy_score = { 
						value = -30 
						localization = CHI_holding_state_mission
					}
				}
			}
			activate_mission = CHI_holding_state_mission
			hidden_effect = {
				every_enemy_country = {
					limit = {
						is_major = yes
					}
					activate_mission = CHI_china_pledging_to_hold_state_mission
				}
			}
			
			set_country_flag = CHI_declared_defence
			FROM = {
				set_state_flag = CHI_holding_state_mission_flag
			}
			set_variable = { CHI_declare_defence_name_var = FROM }
		}

	}

	CHI_holding_state_mission = {

		icon = GFX_decision_generic_protection

		highlight_states = {
			highlight_states_trigger = {
				has_state_flag = CHI_holding_state_mission_flag
			} 
		}

		allowed = {
			always = no #overridden by activate_mission
		}

		available = {
			custom_trigger_tooltip = {
				tooltip = CHI_holding_state_mission_trigger
				any_core_state = {
					has_state_flag = CHI_holding_state_mission_flag
					is_controlled_by_ROOT_or_ally = no
				}
			}
			
			# hidden_trigger = {	#made it only fail if the state is lost and ROOT had capitulated
			# 	has_capitulated = yes
			# }
		}
		
		days_mission_timeout = CHI.CHI_holding_state_mission_time_var 

		complete_effect = {
			add_war_support = -0.05
			hidden_effect = {
				clr_country_flag = CHI_declared_defence
				clear_variable = CHI_defend_this_state
				every_core_state = {
					limit = {
						has_state_flag = CHI_holding_state_mission_flag
					}
					set_state_flag = {
						flag = CHI_declared_defence_recently
						days = 180
					}
				}
				every_core_state = {
					limit = {
						has_state_flag = CHI_holding_state_mission_flag
					}
					clr_state_flag = CHI_holding_state_mission_flag
				}
			}
		}

		is_good = yes

		timeout_effect = {
			add_war_support = 0.05
			add_cic = var:demonstrate_resolve_cic_reward
			if = {
				limit = {
					NOT = {
						has_dynamic_modifier = {
							modifier = CHI_american_support
						}
					}
				}

				add_equipment_to_stockpile = {
					type = artillery_equipment
					amount = var:demonstrate_resolve_art_reward
					producer = SOV
				}
			}
			else = {
				add_equipment_to_stockpile = {
					type = artillery_equipment
					amount = var:demonstrate_resolve_art_reward
					producer = USA
				}
			}
			every_subject_country = {
				add_autonomy_score = { 
					value = -30 
					localization = CHI_holding_state_mission
				}
			}
			hidden_effect = {
				clr_country_flag = CHI_declared_defence
				clear_variable = CHI_defend_this_state
				every_core_state = {
					limit = {
						has_state_flag = CHI_holding_state_mission_flag
					}
					set_state_flag = {
						flag = CHI_declared_defence_recently
						days = 180
					}
					clr_state_flag = CHI_holding_state_mission_flag
				}
			}
		}

	}

	CHI_declare_war_zone = { # Offensive
		icon = GFX_decision_jap_conquer_china
		ai_will_do = {
			base = 1
			modifier = {
				factor = 5
				command_power > 49
			}
			modifier = {
				factor = 2
				command_power > 74
			}
			modifier = {
				factor = 5
				FROM = {
					has_state_flag = CHI_holding_state_mission_flag
				}
			}
		}

		state_target = yes
		on_map_mode = map_only

		custom_cost_trigger = {
			command_power > 34
		}
		custom_cost_text = decision_cost_CP_35
		
		visible = {
			has_completed_focus = CHI_decisive_battles
			FROM = { 
				is_controlled_by_ROOT_or_ally = no 
				controller = {
					has_war_with = ROOT 
				}	
			}
		}
		available = { 
			custom_trigger_tooltip = {
				tooltip = CHI_declare_war_zone_flag_tt
				NOT = {	has_country_flag = CHI_declare_war_zone_flag }
			}
			has_completed_focus = CHI_prepare_the_war_zones
		}

		target_array = ROOT.core_and_claimed_states
		target_trigger = {
			if = {
				limit = {
					NOT = { has_completed_focus = CHI_eternal_revolution }
				}
				FROM = { is_core_of = ROOT }
			}
			else = {
				FROM = {
					OR = {
						is_core_of = ROOT
						is_claimed_by = ROOT
					}
				}
			}

			FROM = {
				CONTROLLER = {
					NOT = { is_ally_with = ROOT } 
				}
				any_neighbor_state = {
					is_controlled_by_ROOT_or_ally = yes
				}
			}
		}
			
		complete_effect = {
			hidden_effect = {
				add_command_power = var:CHI_declare_war_zone_cp_cost
				set_country_flag = { 
					flag = CHI_declare_war_zone_flag
					value = 1 
					days = 50
				}
			}
			FROM = {
				add_claim_by = ROOT
				add_dynamic_modifier = {
					modifier = CHI_declared_war_zone_idea
					scope = CHI
					days = 50
				}
			}
		}
		remove_effect = {
		}
	}

	CHI_bog_them_down = { # Defensive
		icon = GFX_decision_hol_draw_up_staff_plans
		ai_will_do = {
			base = 1
			modifier = {
				factor = 5
				command_power > 49
			}
			modifier = {
				factor = 2
				command_power > 74
			}
			modifier = {
				factor = 5
				FROM = {
					has_state_flag = CHI_holding_state_mission_flag
				}
			}
		}
		state_target = yes
		on_map_mode = map_only
		custom_cost_trigger = {
			command_power > 24
		}
		custom_cost_text = decision_cost_CP_25
		available = { #Can't be target_root_trigger
			custom_trigger_tooltip = {
				tooltip = CHI_bog_them_down_flag_tt
				NOT = {	has_country_flag = CHI_bog_them_down_flag }
			}
			FROM = {
				is_controlled_by_ROOT_or_ally = yes
				NOT = {
					state_is_fully_controlled_by_ROOT_subject_or_faction_member = yes
				}
			}
			has_completed_focus = CHI_bog_them_down_in_the_centre
		}
		visible = {
			has_completed_focus = CHI_defence_in_depth
			has_war_with_major = yes 
		}
		target_array = ROOT.core_and_claimed_states
		target_trigger = {
			FROM = {
				is_controlled_by_ROOT_or_ally = yes
				NOT = {
					state_is_fully_controlled_by_ROOT_subject_or_faction_member = yes
				}
			}
		}
		
		complete_effect = {
			hidden_effect = {
				add_command_power = -25
				set_country_flag = { 
					flag = CHI_bog_them_down_flag
					value = 1 
					days = 50
				}
			}
			FROM = {
				add_dynamic_modifier = {
					modifier = CHI_bog_defensive_modifier
					scope = CHI
					days = 50
				}
			}
		}
	}
}

CHI_lend_lease_missions_cat = {

	# The Northwestern Road 
	CHI_highlight_northwestern_road_fake_decision = {
	
		priority = 100
	
		icon = GFX_decision_generic_operation
	
		ai_will_do = {
			base = 0
		}

		highlight_states = {
			highlight_state_targets = {
				state = 617 # Urumqi
				state = 759 # Kunlun Shan
				state = 755 # Haixi
				state = 754 # Golog
				state = 283 # Gansu
			}
		}
	
		allowed = {  
			original_tag = CHI
		}
	
		visible = { 
			has_completed_focus = CHI_secure_the_soviet_border
		} 
	
		available = {
			hidden_trigger = {
				always = no
			}	
		}
	
		cost = 0

		complete_effect = {

			if = {
				limit = {
					617 = { controller = { NOT = { has_war_with = ROOT } } }	
					759 = { controller = { NOT = { has_war_with = ROOT } } }	
					755 = { controller = { NOT = { has_war_with = ROOT } } }
					754	= { controller = { NOT = { has_war_with = ROOT } } }
					283 = { controller = { NOT = { has_war_with = ROOT } } }
				}

				custom_effect_tooltip = CHI_highlight_the_northwest_highway_decision_tt
			}
			else = {
				if = {
					limit = {
						617 = { controller = { has_war_with = ROOT } } 
					}

					617 = { custom_effect_tooltip = CHI_lost_route_control }
				}

				if = {
					limit = {
						759 = { controller = { has_war_with = ROOT } } 
					}

					759 = { custom_effect_tooltip = CHI_lost_route_control }
				}

				if = {
					limit = {
						755 = { controller = { has_war_with = ROOT } } 
					}

					755 = { custom_effect_tooltip = CHI_lost_route_control }
				}

				if = {
					limit = {
						754 = { controller = { has_war_with = ROOT } } 
					}

					754 = { custom_effect_tooltip = CHI_lost_route_control }
				}

				if = {
					limit = {
						283 = { controller = { has_war_with = ROOT } } 
					}

					283 = { custom_effect_tooltip = CHI_lost_route_control }
				}
			}

		}
	
	}

	# The Hump
	CHI_highlight_the_hump_decision = {
	
		priority = 90
	
		icon = GFX_decision_generic_operation
	
		ai_will_do = {
			base = 0
		}

		highlight_states = {
			highlight_state_targets = {
				state = 601
				state = 434
				state = 747
			}
		}
	
		allowed = {  
			original_tag = CHI
		}
	
		visible = { 
			has_completed_focus = CHI_send_the_first_lady_abroad
		} 
	
		available = {
			hidden_trigger = {
				always = no
			}

		}

		complete_effect = {
			if = {
				limit = {
					601 = { controller = { NOT = { has_war_with = ROOT } } }	
					434 = { controller = { NOT = { has_war_with = ROOT } } }	
					747 = { controller = { NOT = { has_war_with = ROOT } } }	
				}

				custom_effect_tooltip = CHI_highlight_the_hump_decision_tt
			}
			else = {
				if = {
					limit = {
						601 = { controller = { has_war_with = ROOT } } 
					}

					601 = { custom_effect_tooltip = CHI_lost_route_control }
				}

				if = {
					limit = {
						434 = { controller = { has_war_with = ROOT } } 
					}

					434 = { custom_effect_tooltip = CHI_lost_route_control }
				}

				if = {
					limit = {
						747 = { controller = { has_war_with = ROOT } } 
					}

					747 = { custom_effect_tooltip = CHI_lost_route_control }
				}
			}
		}
	
		cost = 0
	
	}

	# The Hanoi Route
	CHI_highlight_hanoi_route_decision = {
	
		priority = 80
	
		icon = GFX_decision_generic_operation
	
		ai_will_do = {
			base = 0
		}

		highlight_states = {
			highlight_state_targets = {
				state = 325
				state = 671
			}
		}
	
		allowed = {  
			original_tag = CHI
		}
	
		visible = { 
			has_completed_focus = CHI_send_the_first_lady_abroad
		} 
	
		available = {
			custom_trigger_tooltip = {
				tooltip = CHI_route_safety_trigger
				
				325 = { controller = { NOT = { has_war_with = ROOT } } }	
				671 = { controller = { NOT = { has_war_with = ROOT } } }	
			}

			hidden_trigger = {
				always = no
			}	
		}
	
		cost = 0

		complete_effect = {

			if = {
				limit = {
					325 = { controller = { NOT = { has_war_with = ROOT } } }	
					671 = { controller = { NOT = { has_war_with = ROOT } } }	
				}

				custom_effect_tooltip = CHI_highlight_the_hanoi_decision_tt
			}
			else = {
				if = {
					limit = {
						325 = { controller = { has_war_with = ROOT } } 
					}

					325 = { custom_effect_tooltip = CHI_lost_route_control }
				}

				if = {
					limit = {
						671 = { controller = { has_war_with = ROOT } } 
					}

					671 = { custom_effect_tooltip = CHI_lost_route_control }
				}
				
			}

		}
	
	}

	# The Burma Road
	CHI_highlight_burma_road_decision = {
	
		priority = 70
	
		icon = GFX_decision_generic_operation
	
		ai_will_do = {
			base = 0
		}

		highlight_states = {
			highlight_state_targets = {
				state = 995
				state = 640
				state = 998
				state = 434
				state = 990
				state = 432
				state = 288
				state = 997
				state = 996
			}
		}
	
		allowed = {  
			original_tag = CHI
		}
	
		visible = { 
			has_completed_focus = CHI_send_the_first_lady_abroad
		} 
	
		available = {

			custom_trigger_tooltip = {
				tooltip = CHI_route_safety_trigger
				
				995 = { controller = { NOT = { has_war_with = ROOT } } }	
				640 = { controller = { NOT = { has_war_with = ROOT } } }	
				998 = { controller = { NOT = { has_war_with = ROOT } } }	
				434 = { controller = { NOT = { has_war_with = ROOT } } }	
				990 = { controller = { NOT = { has_war_with = ROOT } } }	
				432 = { controller = { NOT = { has_war_with = ROOT } } }	
				288 = { controller = { NOT = { has_war_with = ROOT } } }	
				997 = { controller = { NOT = { has_war_with = ROOT } } }	
				996 = { controller = { NOT = { has_war_with = ROOT } } }
			}
			hidden_trigger = {
				always = no
			}	
		}
	
		cost = 0

		complete_effect = {

			if = {
				limit = {
					995 = { controller = { NOT = { has_war_with = ROOT } } }	
					640 = { controller = { NOT = { has_war_with = ROOT } } }	
					998 = { controller = { NOT = { has_war_with = ROOT } } }	
					434 = { controller = { NOT = { has_war_with = ROOT } } }	
					990 = { controller = { NOT = { has_war_with = ROOT } } }	
					432 = { controller = { NOT = { has_war_with = ROOT } } }	
					288 = { controller = { NOT = { has_war_with = ROOT } } }	
					997 = { controller = { NOT = { has_war_with = ROOT } } }	
					996 = { controller = { NOT = { has_war_with = ROOT } } }
				}

				custom_effect_tooltip = CHI_highlight_burma_road_decision_tt
			}
			else = {
				if = {
				    limit = {
				        995 = { controller = { has_war_with = ROOT } }
				    }
				    995 = { custom_effect_tooltip = CHI_lost_route_control }
				}

				if = {
				    limit = {
				        640 = { controller = { has_war_with = ROOT } }
				    }
				    640 = { custom_effect_tooltip = CHI_lost_route_control }
				}

				if = {
				    limit = {
				        998 = { controller = { has_war_with = ROOT } }
				    }
				    998 = { custom_effect_tooltip = CHI_lost_route_control }
				}

				if = {
				    limit = {
				        434 = { controller = { has_war_with = ROOT } }
				    }
				    434 = { custom_effect_tooltip = CHI_lost_route_control }
				}

				if = {
				    limit = {
				        990 = { controller = { has_war_with = ROOT } }
				    }
				    990 = { custom_effect_tooltip = CHI_lost_route_control }
				}

				if = {
				    limit = {
				        432 = { controller = { has_war_with = ROOT } }
				    }
				    432 = { custom_effect_tooltip = CHI_lost_route_control }
				}

				if = {
				    limit = {
				        288 = { controller = { has_war_with = ROOT } }
				    }
				    288 = { custom_effect_tooltip = CHI_lost_route_control }
				}

				if = {
				    limit = {
				        997 = { controller = { has_war_with = ROOT } }
				    }
				    997 = { custom_effect_tooltip = CHI_lost_route_control }
				}

				if = {
				    limit = {
				        996 = { controller = { has_war_with = ROOT } }
				    }
				    996 = { custom_effect_tooltip = CHI_lost_route_control }
				}

			}

		}
	
	}

	# Request Russian Armored Support
	CHI_request_tank_aid_from_russia_decision = {

		icon = GFX_decision_generic_tank

		allowed = {
			original_tag = CHI
		}

		cost = 50

		fire_only_once = yes

		priority = 50

		ai_will_do = {
			base = 100
		}

		modifier = {
			
		}

		visible = {
			has_completed_focus = CHI_utilize_the_albazinian_contact
			SOV = {
				exists = yes
				NOT = {
					has_war_with = ROOT
					has_government = communism
				}
			}
		}

		available = {
			has_war = yes
		}

		cancel_trigger = {
			
		}

		complete_effect = {
			
			SOV = {
				country_event = {
					id = SEA_china.25
					days = 2 
					random_hours = 12 
				}
			}
			custom_effect_tooltip = CHI_modify_soviet_support_tt
			add_to_variable = { 
				CHI_soviet_support_army_armor_attack_factor = 0.05
				tooltip = army_armor_attack_factor_tt
			}
			add_to_variable = { 
				CHI_soviet_support_army_armor_speed_factor = 0.05
				tooltip = army_armor_speed_factor_tt
			}

		}

		remove_effect = {
			
			
			
		}

	}

	# Open the Northwest Highway
	CHI_open_the_north_west_highway_decision = {

		icon = GFX_decision_generic_trucks

		allowed = {
			original_tag = CHI
		}

		cost = 50

		fire_only_once = yes

		priority = 49

		ai_will_do = {
			base = 100
		}

		modifier = {
			
		}

		visible = {
			has_completed_focus = CHI_utilize_the_albazinian_contact
			SOV = {
				exists = yes
				NOT = {
					has_war_with = ROOT
					has_government = communism
				}
			}
		}

		available = {
			has_war = yes
			any_enemy_country = {
				NOT = {
					controls_state = 617 # Urumqi
					controls_state = 759 # Kunlun Shan
					controls_state = 755 # Haixi
					controls_state = 754 # Golog
					controls_state = 283 # Gansu
				}
			}
		}

		cancel_trigger = {
			
		}

		complete_effect = {
			
			custom_effect_tooltip = CHI_modify_soviet_support_tt
			show_ideas_tooltip = CHI_northwest_highway_hidden

		}

		remove_effect = {
			
			
			
		}

	}

	# Negotiate Economic Support from §Y[FROM.GetNameWithFlag]§!
	CHI_use_expat_community_for_more_cic_decision  = {

		priority = 45

		icon = GFX_decision_hol_exchange_intelligence_data

		target_trigger = {
			#Target is FROM
			FROM = {
				OR = {
					original_tag = SIA
					original_tag = MAL
					original_tag = SNG
					original_tag = BRM
					original_tag = CAN
					original_tag = USA
					original_tag = AST
					original_tag = INS
					original_tag = PHI
					original_tag = VIN
					original_tag = LAO
					original_tag = CAM
				}
				exists = yes
				NOT = {
					has_war_with = ROOT
				}
			}
		}

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_reach_out_to_expats
			has_dynamic_modifier = CHI_foreign_economic_support
			has_government = democratic
		}
	
		available = {
			
		}

		days_remove = 35

		#days_re_enable = 70

		cost = 75

		#war_with_on_remove = FROM

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 
	

		}

		fire_only_once = yes

		remove_effect = {

			FROM = {
				country_event = {
					id = SEA_china_democratic.13
					hours = 12
				}	
				custom_effect_tooltip = if_they_accept_tt
				effect_tooltip = {
					add_to_variable = { 
						CHI_foreign_economic_support_cic_amount = 150
						tooltip = add_cic_monthly_tt
					}
					custom_effect_tooltip = CHI_delivery_tt
				}
			}

		}

	}

	CHI_burma_campaign_mission = {

		icon = generic_tank

		allowed = {
			original_tag = CHI
			has_dlc = "No Compromise, No Surrender"
		}
		available = {
			BRM = {
				all_core_state = {
					OR = {
						is_fully_controlled_by = BRM
						state_is_fully_controlled_by_ROOT_subject_or_faction_member = yes
					}
				}
			}
		}
		activation = {
			always = no 
		}

		days_mission_timeout = 120
		fire_only_once = yes


		complete_effect = {
			add_offsite_building = {
				type = industrial_complex
				level = 1
			}

			add_offsite_building = {
				type = arms_factory
				level = 1
			}
			add_war_support = 0.03

			add_to_variable = { 
				CHI_american_support_cic_amount = 150
				tooltip = add_cic_monthly_tt
			}
		}

		is_good = no

		timeout_effect = {
			add_war_support = -0.05
		}
	}

	CHI_indo_chinese_campaign_mission = {

		icon = generic_tank

		allowed = {
			original_tag = CHI
			has_dlc = "No Compromise, No Surrender"
		}
		available = {
			741 = { # Cambodia
				controller = { 
					NOT = { has_war_with = ROOT } 
				}
			}
			286 = { # Champa
				controller = { 
					NOT = { has_war_with = ROOT } 
				}
			}
			670 = { # Laos
				controller = { 
					NOT = { has_war_with = ROOT } 
				}
			}
			1017 = { # Trung Bo
				controller = { 
					NOT = { has_war_with = ROOT } 
				}
			}
			671 = { # Tonkin
				controller = { 
					NOT = { has_war_with = ROOT } 
				}
			}
		}
		activation = {
			always = no
		}

		days_mission_timeout = 120
		fire_only_once = yes


		complete_effect = {
			add_offsite_building = {
				type = industrial_complex
				level = 1
			}

			add_offsite_building = {
				type = arms_factory
				level = 1
			}
			add_war_support = 0.03
			
			add_to_variable = { 
				CHI_american_support_cic_amount = 150
				tooltip = add_cic_monthly_tt
			}
		}

		is_good = no 

		timeout_effect = {
			add_war_support = -0.05
		}
	}

}

CHI_internal_politics_cat = {

	CHI_improving_neglected_countryside_mission = {
		icon = GFX_decision_generic_research
		available = {
			hidden_trigger = { always = no }
		}

		activation = {
			has_completed_focus = CHI_extend_compulsory_education
			has_dynamic_modifier = { modifier = CHI_neglected_countryside }
		}

		cancel_trigger = {
			AND = {
				check_variable = {
					var = CHI_neglected_countryside_communism_drift
					value = 0
					compare = less_than_or_equals
				}
				check_variable = {
					var = CHI_neglected_countryside_research_speed_factor
					value = 0
					compare = greater_than_or_equals
				}
			}
		}
		cancel_effect = {
			hidden_effect = {
				remove_dynamic_modifier = { modifier = CHI_neglected_countryside }
			}
		}

		days_mission_timeout = var:CHI_improving_neglected_countryside_mission_time
		timeout_effect = {
			custom_effect_tooltip = CHI_modify_neglected_countryside_tt
			IF = {
				limit = {
					check_variable = {
						var = CHI_neglected_countryside_communism_drift
						value = 0
						compare = greater_than
					}
				}
				add_to_variable = { 
					CHI_neglected_countryside_communism_drift = -0.01
					tooltip = communism_drift_tt
				}
			}
			IF = {
				limit = {
					check_variable = {
						var = CHI_neglected_countryside_research_speed_factor
						value = 0
						compare = less_than
					}
				}
				add_to_variable = { 
					CHI_neglected_countryside_research_speed_factor = 0.01
					tooltip = research_speed_factor_tt
				}
			}

			random_list = {
				log = no 
				seed = random 
				
				25 = {  
					add_tech_bonus = {
						name = CHI_improving_neglected_countryside_mission
						bonus = 0.25
						uses = 1
						category = cat_production
					}
				} 
				25 = {  
					add_tech_bonus = {
						name = CHI_improving_neglected_countryside_mission
						bonus = 0.25
						uses = 1
						category = infantry_weapons
					}
				} 
				25 = {  
					add_tech_bonus = {
						name = CHI_improving_neglected_countryside_mission
						bonus = 0.25
						uses = 1
						category = construction_tech 
					}
				}
				25 = {
					add_tech_bonus = {
						name = CHI_improving_neglected_countryside_mission
						bonus = 0.25
						uses = 1
						category = electronics 
					}
				}
			}
		}
	}

	CHI_improving_inefficient_economy_mission = {
		icon = GFX_decision_generic_merge_plant_materiel
		available = {
			hidden_trigger = { always = no }
		}

		activation = {
			OR = {
				AND = {
					has_completed_focus = CHI_maintain_adequate_currency_reserves
					has_dynamic_modifier = { modifier = CHI_inefficient_economy }
				}
				AND = {
					has_dynamic_modifier = { modifier = CHI_inefficient_economy }
					check_variable = {
						var = CHI_inefficient_economy_factory_max_efficiency_factor
						value = 0
						compare = greater_than_or_equals
					}
					check_variable = {
						var = CHI_inefficient_economy_factory_efficiency_gain_factor
						value = 0
						compare = greater_than_or_equals
					}
					check_variable = {
						var = CHI_inefficient_economy_base_fuel_gain_factor
						value = 0
						compare = greater_than_or_equals
					}
				}
			}
		}

		cancel_trigger = {
			AND = {
				check_variable = {
					var = CHI_inefficient_economy_factory_max_efficiency_factor
					value = 0
					compare = greater_than_or_equals
				}
				check_variable = {
					var = CHI_inefficient_economy_factory_efficiency_gain_factor
					value = 0
					compare = greater_than_or_equals
				}
				check_variable = {
					var = CHI_inefficient_economy_base_fuel_gain_factor
					value = 0
					compare = greater_than_or_equals
				}
			}
		}
		cancel_effect = {
			hidden_effect = {
				remove_dynamic_modifier = { modifier = CHI_inefficient_economy }
			}
		}

		days_mission_timeout = var:CHI_improving_inefficient_economy_mission_time
		timeout_effect = {
			custom_effect_tooltip = CHI_modify_inefficient_economy_tt
			IF = {
				limit = {
					check_variable = {
						var = CHI_inefficient_economy_factory_max_efficiency_factor
						value = 0
						compare = less_than
					}
				}
				add_to_variable = { 
					CHI_inefficient_economy_factory_max_efficiency_factor = 0.01
					tooltip = production_factory_max_efficiency_factor_tt
				}
			}
			IF = {
				limit = {
					check_variable = {
						var = CHI_inefficient_economy_factory_efficiency_gain_factor
						value = 0
						compare = less_than
					}
				}
				add_to_variable = { 
					CHI_inefficient_economy_factory_efficiency_gain_factor = 0.01
					tooltip = production_factory_efficiency_gain_factor_tt
				}
			}
			IF = {
				limit = {
					check_variable = {
						var = CHI_inefficient_economy_base_fuel_gain_factor
						value = 0
						compare = less_than
					}
				}
				add_to_variable = {
					CHI_inefficient_economy_base_fuel_gain_factor =  0.1
					tooltip = fuel_gain_factor_tt
				}
			}
		}
	}

	CHI_reeducate_bai_chonxi_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			GXC = {
				has_character = GXC_bai_chongxi
			}
		}
	
		available = {
			GXC = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			GXC = {
				GXC_bai_chongxi = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_reeducate_yu_hanmou_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			GDC = {
				has_character = GND_yu_hanmou
			}
		}
	
		available = {
			GDC = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			GDC = {
				GND_yu_hanmou = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_reeducate_sun_tongxuan_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			SND = {
				has_character = CHI_sun_tongxuan
			}
		}
	
		available = {
			SND = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			SND = {
				CHI_sun_tongxuan = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_reeducate_song_zheyuan_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			HBC = {
				has_character = CHI_song_zheyuan
			}
		}
	
		available = {
			HBC = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			HBC = {
				CHI_song_zheyuan = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_reeducate_wang_jingguo_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			SHX = {
				has_character = SHX_wang_jingguo
			}
		}
	
		available = {
			SHX = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			SHX = {
				SHX_wang_jingguo = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_reeducate_hu_ruoyu_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			YUN = {
				has_character = YUN_hu_ruoyu
			}
		}
	
		available = {
			YUN = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			YUN = {
				YUN_hu_ruoyu = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_reeducate_gu_zhutong_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			SIC = {
				has_character = CHI_gu_zhutong
			}
		}
	
		available = {
			SIC = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			SIC = {
				CHI_gu_zhutong = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_reeducate_zhang_xueliang_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			XIC = {
				has_character = CHI_zhang_xueliang
			}
		}
	
		available = {
			XIC = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			XIC = {
				CHI_zhang_xueliang = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_reeducate_ma_bufang_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			XSM = {
				has_character = XSM_ma_bufang
			}
		}
	
		available = {
			XSM = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			XSM = {
				XSM_ma_bufang = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_reeducate_ma_hongkui_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			NXM = {
				has_character = XSM_ma_hongkui
			}
		}
	
		available = {
			NXM = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			NXM = {
				XSM_ma_hongkui = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_reeducate_ma_buqing_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			GSM = {
				has_character = XSM_ma_buqing
			}
		}
	
		available = {
			GSM = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			GSM = {
				XSM_ma_buqing = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_reeducate_ma_zhancang_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			KHM = {
				has_character = KHM_ma_zhancang
			}
		}
	
		available = {
			KHM = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			KHM = {
				KHM_ma_zhancang = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_reeducate_yulbars_khan_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			KUM = {
				has_character = KUM_yulbars_khan
			}
		}
	
		available = {
			KUM = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			KUM = {
				KUM_yulbars_khan = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_reeducate_sheng_shiqi_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			SIK = {
				has_character = SIK_sheng_shiqi
			}
		}
	
		available = {
			SIK = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			SIK = {
				SIK_sheng_shiqi = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_reeducate_altanochir_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			MEN = {
				has_character = MEN_altanochir
			}
		}
	
		available = {
			MEN = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			MEN = {
				MEN_altanochir = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_reeducate_yu_zhishan_decision  = {

		priority = 15

		icon = GFX_decision_generic_army_support

		ai_will_do = {
			base = 50
		}
	
		allowed = {  
			original_tag = CHI 
		}

		visible = { 
			has_completed_focus = CHI_postpone_the_tutelage
			MAN = {
				has_character = MAN_yu_zishan
			}
		}
	
		available = {
			MAN = {
				exists = no
				any_core_state = {
					is_owned_by = ROOT
				}
			}
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 25

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			MAN = {
				MAN_yu_zishan = {
					set_nationality = ROOT
				}
			}

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	CHI_core_asian_state = {

		icon = GFX_decision_generic_form_nation

		priority = 20

		#highlight_states = {
		#	highlight_state_targets = {
		#		state = FROM 
		#	} 
		#}
	
		allowed = {
			original_tag = CHI
		}
		
		visible = {
			has_completed_focus = CHI_cradle_of_civilization
		}
		
		available = {
			FROM = {
				NOT = { has_state_flag = CHI_coring_this_asian_state_in_progress_flag }
			}
			FROM = {
				compliance > 50
			}
		}

		state_target = any_controlled_state
	    
	    target_trigger = {
	        FROM = {
	        	NOT = { is_core_of = ROOT }
	        	is_fully_controlled_by = ROOT
	        	has_state_flag = CHI_has_claimed_this_state_flag 
	        	OR = {
	        		is_on_continent = asia
	        		is_on_continent = middle_east
	        		is_on_continent = australia
	        	}
	        	OR = {
	        		any_neighbor_state = {
	        			is_core_of = ROOT
	        		}
	        		is_coastal = yes
	        	}
	        }
	    }
	    on_map_mode = map_only

	    cost = 30		

		fire_only_once = yes

		days_remove = 70

		complete_effect = {
			hidden_effect = {
				FROM = {
					set_state_flag = { flag = CHI_coring_this_asian_state_in_progress_flag value = 1 days = 31 }
				}
			}
		}

		remove_effect = {
			hidden_effect = {
				FROM = {
					clr_state_flag = CHI_coring_this_asian_state_in_progress_flag
				}
			}

			FROM = {
				add_core_of = ROOT
			}
			
		}

		cancel_trigger = {
			FROM = {
				NOT = { is_fully_controlled_by = ROOT }
			}
		}

		cancel_effect = {
			hidden_effect = {
				FROM = {
					clr_state_flag = CHI_coring_this_asian_state_in_progress_flag
				}
			}
		}
	}

}

CHI_integrate_the_warlords_sea_cat = {

	CHI_press_warlord_to_become_puppet = {
		icon = GFX_decision_eng_trade_unions_demand

		priority = 10

		ai_will_do = {
			base = 5
			modifier = {
				factor = 0
				FROM = {
					is_ai = no
				}
			}
			modifier = {
				factor = 2
				is_faction_leader = yes
			}
			modifier = {
				factor = 1.5
				has_political_power > 200
			}
			modifier = {
				factor = 0.5
				has_political_power < 150
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 4
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 7
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 10
				}
			}
			modifier = {
				factor = 1.5
				is_neighbor_of = FROM
			}
			modifier = {
				factor = 0.5
				NOT = {
					any_neighbor_country = {
						is_neighbor_of = FROM
					}
				}
			}
			modifier = {
				factor = 0.5
				FROM = {
					NOT = {
						has_government = ROOT
					}
				}
			}
			modifier = {
				factor = 1.5
				num_subjects < 5
			}
			modifier = {
				factor = 0
				faction_influence_ratio < 0.2
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.24
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.29
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.39
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.49
			}
			modifier = {
				factor = 0.5
				is_historical_focus_on = yes
				date < 1939.6.1
			}
			#Prioritize your advisors first!
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 2
					slots = {
						political_advisor
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 3
					slots = {
						political_advisor
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						high_command
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						theorist
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						army_chief
					}
				}
			}
		}

		available = {
			NOT = {
				has_country_flag = is_pressing_warlord
			}
			#faction_influence_ratio > var:FROM.press_warlord_to_become_puppet_influence_points_trigger
			set_temp_variable = { CHI_get_warlord_influence = FROM.faction_influence_ratio }
			multiply_temp_variable = { CHI_get_warlord_influence = 2 }
			faction_influence_ratio > CHI_get_warlord_influence
		}

		target_root_trigger = {
			is_in_faction = yes
			OR = {
				has_faction_template = faction_template_wang_front
				has_faction_template = faction_template_chinese_united_front
				has_faction_template = faction_template_PRC_the_peoples_front
			}
		}

		ai_hint_pp_cost = 125
		custom_cost_trigger = {
			faction_influence_ratio > 0.1499 # If changing this, remember to update refunds in the events found in SEA_warlords.txt 
			has_political_power > 124
		}
		custom_cost_text = decision_cost_faction_influence_15_PP_125

		target_array = global.is_chinese_warlord

		target_trigger = {
			FROM = {
				is_in_faction_with = ROOT
				is_subject = no
				exists = yes
				OR = {
					has_faction_template = faction_template_wang_front
					has_faction_template = faction_template_chinese_united_front
					has_faction_template = faction_template_PRC_the_peoples_front
				}
			}
			if = {
				limit = {
					has_completed_focus = CHI_tour_the_north
				}
				FROM = {
					CHI_northern_warlords = no
				}
			}
			if = {
				limit = {
					has_completed_focus = CHI_tour_the_west
				}
				FROM = {
					CHI_western_warlords = no
				}
			}
			if = {
				limit = {
					has_completed_focus = CHI_tour_the_south
				}
				FROM = {
					CHI_southern_warlords = no
				}
			}
			CHI = {
				NOT = {
					has_completed_focus = CHI_affirm_civilian_primacy
				}
			}
		}

		fire_only_once = yes

		complete_effect = {
			hidden_effect = {
				add_faction_influence_ratio = -0.15
				add_political_power = -125
			}
			custom_effect_tooltip = if_they_accept_tt
			
			FROM = {
				country_event = {
					id = SEA_china_warlords.1
					hours = 2 
					random_hours = 16 
				}
			}
			effect_tooltip = {
				set_autonomy = {
					target=FROM
					autonomy_state = autonomy_sea_warlord_subject
					freedom_level = 0.8 # 0-1 
					end_wars  = no 
					end_civil_wars = no 
				}
			}
			custom_effect_tooltip = newline_tt
			set_country_flag = {
				flag = is_pressing_warlord
				days = 90 #max in case something goes badly it would still time out eventually
				value = 1
			}
		}
	}

	CHI_press_warlord_to_become_puppet_upgrade = {
		icon = GFX_decision_eng_trade_unions_demand

		ai_will_do = {
			base = 5
			modifier = {
				factor = 0
				FROM = {
					is_ai = no
				}
			}
			modifier = {
				factor = 2
				is_faction_leader = yes
			}
			modifier = {
				factor = 1.5
				has_political_power > 200
			}
			modifier = {
				factor = 0.5
				has_political_power < 75
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 4
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 7
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 10
				}
			}
			modifier = {
				factor = 1.5
				is_neighbor_of = FROM
			}
			modifier = {
				factor = 0.5
				NOT = {
					any_neighbor_country = {
						is_neighbor_of = FROM
					}
				}
			}
			modifier = {
				factor = 0.5
				FROM = {
					NOT = {
						has_government = ROOT
					}
				}
			}
			modifier = {
				factor = 1.5
				num_subjects < 5
			}
			modifier = {
				factor = 0
				faction_influence_ratio < 0.2
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.24
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.29
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.39
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.49
			}
			modifier = {
				factor = 0.5
				is_historical_focus_on = yes
				date < 1939.6.1
			}
			#Prioritize your advisors first!
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 2
					slots = {
						political_advisor
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 3
					slots = {
						political_advisor
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						high_command
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						theorist
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						army_chief
					}
				}
			}
		}

		available = {
			NOT = {
				has_country_flag = is_pressing_warlord
			}
			#faction_influence_ratio > var:FROM.press_warlord_to_become_puppet_influence_points_trigger
			set_temp_variable = { CHI_get_warlord_influence = FROM.faction_influence_ratio }
			multiply_temp_variable = { CHI_get_warlord_influence = 2 }
			faction_influence_ratio > CHI_get_warlord_influence
		}

		target_root_trigger = {
			OR = {
				has_completed_focus = CHI_tour_the_north
				has_completed_focus = CHI_tour_the_west
				has_completed_focus = CHI_tour_the_south
			}
			is_in_faction = yes
			OR = {
				has_faction_template = faction_template_wang_front
				has_faction_template = faction_template_chinese_united_front
			}
		}

		ai_hint_pp_cost = 75
		custom_cost_trigger = {
			faction_influence_ratio > 0.099 # If changing this, remember to update refunds in the events found in SEA_warlords.txt 
			has_political_power > 74
		}
		custom_cost_text = decision_cost_faction_influence_10_PP_75

		target_array = global.is_chinese_warlord

		target_trigger = {
			FROM = {
				is_in_faction_with = ROOT
				is_subject = no
				exists = yes
				OR = {
					has_faction_template = faction_template_wang_front
					has_faction_template = faction_template_chinese_united_front
				}
				OR = {
					AND = {
						ROOT = { has_completed_focus = CHI_tour_the_north }
						CHI_northern_warlords = yes
					}
					AND = {
						ROOT = { has_completed_focus = CHI_tour_the_west }
						CHI_western_warlords = yes
					}
					AND = {
						ROOT = { has_completed_focus = CHI_tour_the_south }
						CHI_southern_warlords = yes
					}
				}
			}
			CHI = {
				NOT = {
					has_completed_focus = CHI_affirm_civilian_primacy
				}
			}
		}

		fire_only_once = yes

		complete_effect = {
			hidden_effect = {
				add_faction_influence_ratio = -0.1
				add_political_power = -75
			}
			custom_effect_tooltip = if_they_accept_tt
			
			FROM = {
				country_event = {
					id = SEA_china_warlords.1
					hours = 2 
					random_hours = 16 
				}
			}
			effect_tooltip = {
				set_autonomy = {
					target=FROM
					autonomy_state = autonomy_sea_warlord_subject
					freedom_level = 0.8 # 0-1 
					end_wars  = no 
					end_civil_wars = no 
				}
			}
			custom_effect_tooltip = newline_tt
			set_country_flag = {
				flag = is_pressing_warlord
				days = 90 #max in case something goes badly it would still time out eventually
				value = 1
			}
		}
	}

	CHI_press_warlord_to_become_puppet_with_affirm_civilian_primacy = {
		icon = GFX_decision_eng_trade_unions_demand

		priority = 10

		ai_will_do = {
			base = 5
			modifier = {
				factor = 0
				FROM = {
					is_ai = no
				}
			}
			modifier = {
				factor = 2
				is_faction_leader = yes
			}
			modifier = {
				factor = 1.5
				has_political_power > 200
			}
			modifier = {
				factor = 0.5
				has_political_power < 150
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 4
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 7
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 10
				}
			}
			modifier = {
				factor = 1.5
				is_neighbor_of = FROM
			}
			modifier = {
				factor = 0.5
				NOT = {
					any_neighbor_country = {
						is_neighbor_of = FROM
					}
				}
			}
			modifier = {
				factor = 0.5
				FROM = {
					NOT = {
						has_government = ROOT
					}
				}
			}
			modifier = {
				factor = 0
				faction_influence_ratio < 0.2
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.24
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.29
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.39
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.49
			}
			modifier = {
				factor = 0.5
				is_historical_focus_on = yes
				date < 1939.6.1
			}
			#Prioritize your advisors first!
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 2
					slots = {
						political_advisor
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 3
					slots = {
						political_advisor
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						high_command
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						theorist
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						army_chief
					}
				}
			}
		}

		available = {
			NOT = {
				has_country_flag = is_pressing_warlord
			}
			#faction_influence_ratio > var:FROM.press_warlord_to_become_puppet_influence_points_trigger
			set_temp_variable = { CHI_get_warlord_influence = FROM.faction_influence_ratio }
			multiply_temp_variable = { CHI_get_warlord_influence = 2 }
			faction_influence_ratio > CHI_get_warlord_influence
		}

		target_root_trigger = {
			is_in_faction = yes
			OR = {
				has_faction_template = faction_template_wang_front
				has_faction_template = faction_template_chinese_united_front
				has_faction_template = faction_template_PRC_the_peoples_front
			}
			has_completed_focus = CHI_affirm_civilian_primacy
		}

		ai_hint_pp_cost = 75
		custom_cost_trigger = {
			faction_influence_ratio > 0.099 # If changing this, remember to update refunds in the events found in SEA_warlords.txt 
			has_political_power > 74
		}
		custom_cost_text = decision_cost_faction_influence_10_PP_75

		target_array = global.is_chinese_warlord

		target_trigger = {
			FROM = {
				is_in_faction_with = ROOT
				is_subject = no
				exists = yes
				OR = {
					has_faction_template = faction_template_wang_front
					has_faction_template = faction_template_chinese_united_front
					has_faction_template = faction_template_PRC_the_peoples_front
				}
			}
			if = {
				limit = {
					has_completed_focus = CHI_tour_the_north
				}
				FROM = {
					CHI_northern_warlords = no
				}
			}
			if = {
				limit = {
					has_completed_focus = CHI_tour_the_west
				}
				FROM = {
					CHI_western_warlords = no
				}
			}
			if = {
				limit = {
					has_completed_focus = CHI_tour_the_south
				}
				FROM = {
					CHI_southern_warlords = no
				}
			}
		}

		fire_only_once = yes

		complete_effect = {
			hidden_effect = {
				add_faction_influence_ratio = -0.1
				add_political_power = -75
			}
			custom_effect_tooltip = if_they_accept_tt
			
			FROM = {
				country_event = {
					id = SEA_china_warlords.1
					hours = 2 
					random_hours = 16 
				}
			}
			effect_tooltip = {
				set_autonomy = {
					target=FROM
					autonomy_state = autonomy_sea_warlord_subject
					freedom_level = 0.8 # 0-1 
					end_wars  = no 
					end_civil_wars = no 
				}
			}
			custom_effect_tooltip = newline_tt
			set_country_flag = {
				flag = is_pressing_warlord
				days = 90 #max in case something goes badly it would still time out eventually
				value = 1
			}
		}
	}

	CHI_press_warlord_to_become_puppet_upgrade_with_affirm_civilian_primacy = {
		icon = GFX_decision_eng_trade_unions_demand

		ai_will_do = {
			base = 5
			modifier = {
				factor = 0
				FROM = {
					is_ai = no
				}
			}
			modifier = {
				factor = 2
				is_faction_leader = yes
			}
			modifier = {
				factor = 1.5
				has_political_power > 200
			}
			modifier = {
				factor = 0.5
				has_political_power < 150
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 4
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 7
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 10
				}
			}
			modifier = {
				factor = 1.5
				is_neighbor_of = FROM
			}
			modifier = {
				factor = 0.5
				NOT = {
					any_neighbor_country = {
						is_neighbor_of = FROM
					}
				}
			}
			modifier = {
				factor = 0.5
				FROM = {
					NOT = {
						has_government = ROOT
					}
				}
			}
			modifier = {
				factor = 0
				faction_influence_ratio < 0.2
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.24
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.29
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.39
			}
			modifier = {
				factor = 1.5
				faction_influence_ratio > 0.49
			}
			modifier = {
				factor = 0.5
				is_historical_focus_on = yes
				date < 1939.6.1
			}
			#Prioritize your advisors first!
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 2
					slots = {
						political_advisor
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 3
					slots = {
						political_advisor
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						high_command
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						theorist
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						army_chief
					}
				}
			}
		}

		available = {
			NOT = {
				has_country_flag = is_pressing_warlord
			}
			#faction_influence_ratio > var:FROM.press_warlord_to_become_puppet_influence_points_trigger
			set_temp_variable = { CHI_get_warlord_influence = FROM.faction_influence_ratio }
			multiply_temp_variable = { CHI_get_warlord_influence = 2 }
			faction_influence_ratio > CHI_get_warlord_influence
		}

		target_root_trigger = {
			OR = {
				has_completed_focus = CHI_tour_the_north
				has_completed_focus = CHI_tour_the_west
				has_completed_focus = CHI_tour_the_south
			}
			has_completed_focus = CHI_affirm_civilian_primacy
			is_in_faction = yes
			OR = {
				has_faction_template = faction_template_wang_front
				has_faction_template = faction_template_chinese_united_front
			}
		}

		ai_hint_pp_cost = 25
		custom_cost_trigger = {
			faction_influence_ratio > 0.049 # If changing this, remember to update refunds in the events found in SEA_warlords.txt 
			has_political_power > 25
		}
		custom_cost_text = decision_cost_faction_influence_5_PP_25

		target_array = global.is_chinese_warlord

		target_trigger = {
			FROM = {
				is_in_faction_with = ROOT
				is_subject = no
				exists = yes
				OR = {
					has_faction_template = faction_template_wang_front
					has_faction_template = faction_template_chinese_united_front
				}
				OR = {
					AND = {
						ROOT = { has_completed_focus = CHI_tour_the_north }
						CHI_northern_warlords = yes
					}
					AND = {
						ROOT = { has_completed_focus = CHI_tour_the_west }
						CHI_western_warlords = yes
					}
					AND = {
						ROOT = { has_completed_focus = CHI_tour_the_south }
						CHI_southern_warlords = yes
					}
				}
			}
		}

		fire_only_once = yes

		complete_effect = {
			hidden_effect = {
				add_faction_influence_ratio = -0.05
				add_political_power = -25
			}
			custom_effect_tooltip = if_they_accept_tt
			
			FROM = {
				country_event = {
					id = SEA_china_warlords.1
					hours = 2 
					random_hours = 16 
				}
			}
			effect_tooltip = {
				set_autonomy = {
					target=FROM
					autonomy_state = autonomy_sea_warlord_subject
					freedom_level = 0.8 # 0-1 
					end_wars  = no 
					end_civil_wars = no 
				}
			}
			custom_effect_tooltip = newline_tt
			set_country_flag = {
				flag = is_pressing_warlord
				days = 90 #max in case something goes badly it would still time out eventually
				value = 1
			}
		}
	}

	CHI_warlord_autonomy_drift_decision = {
		icon = GFX_decision_eng_trade_unions_support

		ai_will_do = {
			base = 5
			modifier = {
				factor = 2
				is_faction_leader = yes
			}
			modifier = {
				factor = 1.5
				has_political_power > 75
				command_power > 75
			}
			modifier = {
				factor = 0.5
				has_political_power < 75
				command_power < 75
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 4
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 7
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 10
				}
			}
			#Prioritize your advisors first!
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 2
					slots = {
						political_advisor
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 3
					slots = {
						political_advisor
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						high_command
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						theorist
					}
				}
			}
		}

		target_root_trigger = {
			OR = {
				has_faction_template = faction_template_wang_front
				has_faction_template = faction_template_chinese_united_front
			}
		}

		visible = {
			NOT = { has_completed_focus = CHI_impair_the_control_yuan }
		} 

		ai_hint_pp_cost = 50
		custom_cost_trigger = {
			command_power > 24
			has_political_power > 49
		}
		custom_cost_text = decision_cost_CP_25_pp_50

		target_array = warlord_subjects 

		target_trigger = {
			FROM = {
				is_subject_of = ROOT
				NOT = {
					has_idea = idea_CHI_central_government_integration_pressure
					has_idea = idea_CHI_central_government_integration_pressure_upgraded
				}
				OR = {
					has_autonomy_state = autonomy_sea_warlord_subject
					has_autonomy_state = autonomy_sea_integrated_warlord_subject
					
				}
				OR = {
					has_faction_template = faction_template_wang_front
					has_faction_template = faction_template_chinese_united_front
				}
			}
			if = {
				limit = {
					has_completed_focus = CHI_tour_the_north
				}
				FROM = {
					CHI_northern_warlords = no
				}
			}
			if = {
				limit = {
					has_completed_focus = CHI_tour_the_west
				}
				FROM = {
					CHI_western_warlords = no
				}
			}
			if = {
				limit = {
					has_completed_focus = CHI_tour_the_south
				}
				FROM = {
					CHI_southern_warlords = no
				}
			}
		}

		fire_only_once = no

		complete_effect = {
			hidden_effect = {
				add_political_power = -50
				add_command_power = -25
			}

			#change CHI_impair_the_control_yuan_tt_2 if changing this!
			FROM = {
				add_timed_idea = {
					idea = idea_CHI_central_government_integration_pressure
					days = 365
				}
			}
		}

		cancel_trigger = {
			FROM = {
				OR = {
					has_war_with = ROOT
					exists = no
					NOT = {
						is_subject_of = ROOT
					}
				}
			}
		}
	}

	CHI_warlord_autonomy_drift_decision_upgrade = {
		icon = GFX_decision_eng_trade_unions_support

		ai_will_do = {
			base = 5
			modifier = {
				factor = 2
				is_faction_leader = yes
			}
			modifier = {
				factor = 1.5
				has_political_power > 75
				command_power > 75
			}
			modifier = {
				factor = 0.5
				has_political_power < 75
				command_power < 75
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 4
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 7
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 10
				}
			}
			#Prioritize your advisors first!
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 2
					slots = {
						political_advisor
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 3
					slots = {
						political_advisor
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						high_command
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						theorist
					}
				}
			}
		}

		available = {
		}

		target_root_trigger = {
			OR = {
				has_completed_focus = CHI_tour_the_north
				has_completed_focus = CHI_tour_the_west
				has_completed_focus = CHI_tour_the_south
				has_completed_focus = CHI_impair_the_control_yuan	
			}
			OR = {
				has_faction_template = faction_template_wang_front
				has_faction_template = faction_template_chinese_united_front
			}
		} 

		ai_hint_pp_cost = 25
		custom_cost_trigger = {
			command_power > 24
			has_political_power > 24
		}
		custom_cost_text = decision_cost_CP_25_pp_25

		target_array = warlord_subjects 

		target_trigger = {
			FROM = {
				is_subject_of = ROOT
				NOT = {
					has_idea = idea_CHI_central_government_integration_pressure
					has_idea = idea_CHI_central_government_integration_pressure_upgraded
				}
				OR = {
					has_autonomy_state = autonomy_sea_warlord_subject
					has_autonomy_state = autonomy_sea_integrated_warlord_subject
					
				}
				OR = {
					has_faction_template = faction_template_wang_front
					has_faction_template = faction_template_chinese_united_front
				}
				OR = {
					ROOT = { has_completed_focus = CHI_impair_the_control_yuan }
					AND = {
						ROOT = { has_completed_focus = CHI_tour_the_north }
						CHI_northern_warlords = yes
					}
					AND = {
						ROOT = { has_completed_focus = CHI_tour_the_west }
						CHI_western_warlords = yes
					}
					AND = {
						ROOT = { has_completed_focus = CHI_tour_the_south }
						CHI_southern_warlords = yes
					}
				}
			}
		}

		fire_only_once = no

		complete_effect = {
			hidden_effect = {
				add_political_power = -25
				add_command_power = -25
			}

			FROM = {
				#change CHI_impair_the_control_yuan_tt_2 if changing this!
				add_timed_idea = {
					idea = idea_CHI_central_government_integration_pressure_upgraded
					days = 480
				}
			}
		}

		cancel_trigger = {
			FROM = {
				OR = {
					has_war_with = ROOT
					exists = no
					NOT = {
						is_subject_of = ROOT
					}
				}
			}
		}
	}

	##
	CHI_warlord_autonomy_allocate_lend_lease_decision = {
		icon = generic_prepare_civil_war

		ai_will_do = {
			base = 5
			modifier = {
				factor = 2
				is_faction_leader = yes
			}
			modifier = {
				factor = 1.5
				has_equipment = { infantry_equipment > 1999 }
			}
			modifier = {
				factor = 1.5
				has_equipment = { infantry_equipment > 2999 }
			}
			modifier = {
				factor = 0.5
				has_equipment = { infantry_equipment < 1499 }
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 4
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 7
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 10
				}
			}
		}

		available = {

		}

		target_root_trigger = {
			is_in_faction = yes
			OR = {
				has_faction_template = faction_template_wang_front
				has_faction_template = faction_template_chinese_united_front
			}
			has_completed_focus = CHI_allocate_lend_lease
		} 

		target_array = warlord_subjects 

		target_trigger = {
			FROM = {
				is_subject_of = ROOT
				OR = {
					has_autonomy_state = autonomy_sea_warlord_subject
					has_autonomy_state = autonomy_sea_integrated_warlord_subject
					
				}
				exists = yes
				OR = {
					has_faction_template = faction_template_wang_front
					has_faction_template = faction_template_chinese_united_front
				}
			}
		}

		fire_only_once = no
		custom_cost_trigger = {
			has_equipment = { infantry_equipment > 999 }
		}
		custom_cost_text = decision_cost_ie_1000
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -1000
			}
			FROM = {
				add_autonomy_ratio = { 
					value = -0.1
					localization = CHI_warlord_autonomy_allocate_lend_lease_decision
				}

				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = 1000
					producer = CHI
				}
			}
		}
	}

	CHI_warlord_autonomy_offer_economic_support_decision = {
		icon = GFX_decision_generic_consumer_goods

		ai_will_do = {
			base = 2
			modifier = {
				factor = 2
				is_faction_leader = yes
			}
			
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 4
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 7
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 10
				}
			}
			modifier = {
				factor = 0.5
				any_subject_country = {
					has_idea = CHI_chinese_economic_support_idea
				}
			}
		}

		target_root_trigger = {
			has_dynamic_modifier = { modifier = CHI_american_support }
			is_in_faction = yes
			OR = {
				has_faction_template = faction_template_wang_front
				has_faction_template = faction_template_chinese_united_front
			}
		}

		available = {
			if = {
				limit = {
					NOT = {	has_country_flag = CHI_warlord_economic_support_flag }
				}
				NOT = {	has_country_flag = CHI_warlord_economic_support_flag }
			}
			else = {
				limit = {
					has_country_flag = CHI_warlord_economic_support_flag
				}
				custom_trigger_tooltip = {
					tooltip = CHI_warlord_economic_support_reset_tt
					NOT = {	has_country_flag = CHI_warlord_economic_support_flag }
				}
			}
		}

		visible = {
			has_dynamic_modifier = { modifier = CHI_american_support }
		}
		cancel_if_not_visible = yes
 

		target_array = warlord_subjects 

		target_trigger = {
			FROM = {
				is_subject_of = ROOT
				OR = {
					has_autonomy_state = autonomy_sea_warlord_subject
					has_autonomy_state = autonomy_sea_integrated_warlord_subject
					
				}
				exists = yes
				OR = {
					has_faction_template = faction_template_wang_front
					has_faction_template = faction_template_chinese_united_front
				}
			}
		}

		fire_only_once = no

		days_remove = 180
		
		cost = FROM.CHI_warlord_integration_pp_cost

		modifier = {
			consumer_goods_factor = 0.1
		}
		
		complete_effect = {
			set_country_flag = {
				flag = CHI_warlord_economic_support_flag
				value = 1
				days = 90
			}
			set_country_flag = flag_id
			FROM = {
				add_timed_idea = {
					idea = CHI_chinese_economic_support_idea
					days = 180
				}
			}
		}

		remove_effect = {
			
		}

		cancel_trigger = {
			NOT = { has_dynamic_modifier = { modifier = CHI_american_support } }
			FROM = {
				OR = {
					exists = no
					NOT = { is_subject_of = ROOT }
					has_capitulated = yes
				}
			}
		}

		cancel_effect = {
			FROM = {
				remove_ideas = CHI_chinese_economic_support_idea
			}
		}
	}

	CHI_warlord_autonomy_offer_industrial_support_decision = {
		icon = GFX_decision_generic_industry

		ai_will_do = {
			base = 2
			modifier = {
				factor = 2
				is_faction_leader = yes
			}
			
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 4
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 7
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					num_of_factories > 10
				}
			}
			modifier = {
				factor = 0.5
				any_subject_country = {
					has_idea = CHI_chinese_industrial_support_idea
				}
			}
		}

		target_root_trigger = {
			has_dynamic_modifier = { modifier = CHI_american_support }
			is_in_faction = yes
			OR = {
				has_faction_template = faction_template_wang_front
				has_faction_template = faction_template_chinese_united_front
			}
		}

		available = {
			if = {
				limit = {
					NOT = {	has_country_flag = CHI_warlord_industrial_support_flag }
				}
				NOT = {	has_country_flag = CHI_warlord_industrial_support_flag }
			}
			else = {
				limit = {
					has_country_flag = CHI_warlord_industrial_support_flag
				}
				custom_trigger_tooltip = {
					tooltip = CHI_warlord_industrial_support_reset_tt
					NOT = {	has_country_flag = CHI_warlord_industrial_support_flag }
				}
			}
		}

		visible = {
			has_dynamic_modifier = { modifier = CHI_american_support }
		}
		cancel_if_not_visible = yes
 

		target_array = warlord_subjects 

		target_trigger = {
			FROM = {
				is_subject_of = ROOT
				OR = {
					has_autonomy_state = autonomy_sea_warlord_subject
					has_autonomy_state = autonomy_sea_integrated_warlord_subject
					
				}
				exists = yes
				OR = {
					has_faction_template = faction_template_wang_front
					has_faction_template = faction_template_chinese_united_front
				}
			}
		}

		fire_only_once = no

		days_remove = 180
		
		cost = FROM.CHI_warlord_integration_pp_cost

		modifier = {
			industrial_capacity_factory = -0.05
		}
		
		complete_effect = {
			set_country_flag = {
				flag = CHI_warlord_industrial_support_flag
				value = 1
				days = 90
			}
			FROM = {
				add_timed_idea = {
					idea = CHI_chinese_industrial_support_idea
					days = 180
				}
			}
		}

		remove_effect = {
			
		}

		cancel_trigger = {
			NOT = { has_dynamic_modifier = { modifier = CHI_soviet_support } }
			FROM = {
				OR = {
					exists = no
					NOT = { is_subject_of = ROOT }
					has_capitulated = yes
				}
			}
		}

		cancel_effect = {
			FROM = {
				remove_ideas = CHI_chinese_industrial_support_idea
			}
		}
	}
	##

	CHI_integrating_states = {
		icon = GFX_decision_generic_political_address
		allowed = {
			original_tag = CHI
		}

		visible = {
			has_completed_focus = CHI_empower_the_mtac
		}

		available = { 
			FROM = {
				is_fully_controlled_by = CHI 
			}
		}

		cost = 100

		days_remove = 50

		ai_will_do = {
			base = 100
		}

		state_target = yes

		on_map_mode = map_only 

		target_array = CHI.mtac_core_states

		target_trigger = {
			
			FROM = {
				NOT = {
					is_core_of = CHI
				}
			}	
		}

		complete_effect = {
		}

		remove_effect = {
			FROM = {
				add_core_of = CHI
			}
		}
	}

}

CHI_avoid_another_crisis_cat = {
	CHI_kwantung_army_impatience_dummy = { # Fake mission to show how long until war

		activation = {
			always = no
		}
		available = {
			hidden_trigger = { always = no }
		}
		visible = {
			original_tag = CHI
			is_subject = no 
			NOT = { has_war_with = JAP }
			JAP = {
				NOT = {
					has_completed_focus = JAP_subdue_the_kwantung_army
				}
			}
		}

		is_good = no

		days_mission_timeout = JAP.kwantung_army_timeout_dummy_time_var #JAP.JAP_marco_polo_remaining_days:days_left

		cancel_if_not_visible = yes 

		timeout_effect = {

			effect_tooltip = {
				IF = {
					limit = {
						CHI = { #if CHI owns one of these states, they get the event
							OR = {
								controls_state = 608
								controls_state = 597
								controls_state = 614
							}
						}
					}
					CHI = {
						country_event = {
							id = china.1
							days = 1
							random_days = 3
						}	
					}
				}
				ELSE_IF = {
					limit = {
						PRC = { #only fires the event for PRC if they control ALL of the states (to ensure that only one of them gets it, to avoid issues when one selects to turn over the states and the other doesn't)
							AND = {
								controls_state = 608
								controls_state = 597
								controls_state = 614
							}
						}
					}
					PRC = {
						country_event = {
							id = china.1
							days = 1
							random_days = 3
						}	
					}
				}
				ELSE_IF = {
					limit = {
						SHX = { #only fires the event for SHX if they control ALL of the states (to ensure that only one of them gets it, to avoid issues when one selects to turn over the states and the other doesn't)
							AND = {
								controls_state = 608
								controls_state = 597
								controls_state = 614
							}
						}
					}
					SHX = {
						country_event = {
							id = china.1
							days = 1
							random_days = 3
						}	
					}
				}
				ELSE_IF = {
					limit = {
						SND = { #only fires the event for SND if they control ALL of the states (to ensure that only one of them gets it, to avoid issues when one selects to turn over the states and the other doesn't)
							AND = {
								controls_state = 608
								controls_state = 597
								controls_state = 614
							}
						}
					}
					SND = {
						country_event = {
							id = china.1
							days = 1
							random_days = 3
						}	
					}
				}
				add_named_threat = { threat = 2 name = JAP_intervene_in_china } # From threat = 1 to 2 due to no escalation tension
			}
		}
	}

	CHI_concessions_docking_rights = {
		visible = {
			NOT = {
				has_war_with = JAP
			}
		}
		available = {
            has_completed_focus = CHI_avoid_another_crisis
            hidden_trigger = {
            	NOT = { has_country_flag = CHI_concessions_docking_rights_taken }
            }
        }
		cost = 25
		fire_only_once = yes
		ai_will_do = {
			base = 10
		}
		complete_effect = {
			diplomatic_relation = { 
				country = JAP
				relation = OFFER_docking_rights 
				active = yes
			}
			CHI_concessions_add_small_amount_of_days = yes
			set_country_flag = CHI_concessions_docking_rights_taken
		}
	}

	CHI_concessions_airbase_rights = {
		visible = {
			NOT = {
				has_war_with = JAP
			}
		}
		available = {
            has_completed_focus = CHI_avoid_another_crisis
            hidden_trigger = {
            	NOT = { has_country_flag = CHI_concessions_airbase_rights_taken }
            }
        }
        ai_will_do = {
			base = 5
		}
		cost = 25
		fire_only_once = yes
		complete_effect = {
			diplomatic_relation = { 
				country = JAP
				relation = OFFER_AIR_BASE_ACCESS 
				active = yes
			}
			CHI_concessions_add_small_amount_of_days = yes
			hidden_effect = {
				set_country_flag = CHI_concessions_airbase_rights_taken
			}
		}
	}

	CHI_concessions_give_resource_rights = {

		visible = {
			NOT = {
				has_war_with = JAP
			}
		}

		available = {
            has_completed_focus = CHI_avoid_another_crisis
        }
        ai_will_do = {
			base = 5
			modifier = {
				factor = 0.5
				FROM = {
					has_resources_amount = {
						resource = steel
						amount > 0
					}
				}
			}
			modifier = {
				factor = 0.5
				FROM = {
					has_resources_amount = {
						resource = tungsten
						amount > 0
					}
				}
			}
		}
		state_target = yes
		on_map_mode = map_only
		target_trigger = {
			FROM = {
				is_fully_controlled_by = ROOT
				state_has_any_resource = yes
				NOT = {
					has_resources_rights = {
						receiver = JAP
					}
				}
			}
		}


		cost = 25
		complete_effect = {
			give_resource_rights = {
				receiver = JAP
				state = FROM
			}
			CHI_concessions_add_medium_amount_of_days = yes
		}
	}

	CHI_concessions_give_coastal_states = {
		icon = GFX_decision_eng_trade_unions_support

		visible = {
			NOT = {
				has_war_with = JAP
			}
		}
		available = {
            has_completed_focus = CHI_avoid_another_crisis
        }
		ai_will_do = {
			base = 0
		}
       	
		state_target = yes
		on_map_mode = map_only
		target_trigger = {
			FROM = {
				is_fully_controlled_by = ROOT
				is_coastal = yes
				naval_base > 0
			}
		}


		cost = 50
		complete_effect = {
			JAP = {
				transfer_state = FROM
			}
			CHI_concessions_add_large_amount_of_days = yes
		}
	}

	CHI_concessions_give_puppet = {
		icon = GFX_decision_eng_trade_unions_support

		visible = {
			NOT = {
				has_war_with = JAP
			}
		}

		available = {
            has_completed_focus = CHI_avoid_another_crisis
        }
        ai_will_do = {
			base = 1
			modifier = {
				factor = 2
				FROM = {
					num_of_factories < 10
				}
			}
		}
       	
		target_trigger = {
			FROM = {
				is_chinese_warlord = yes
				is_subject_of = CHI
				any_controlled_state = {
					is_coastal = yes
				}
			}
		}

		cost = 50

		complete_effect = {
			FROM = {
				country_event = {
					id = SEA_china.14
					days = 1
				}
			}
			CHI_concessions_add_large_amount_of_days = yes
		}
	}
}

CHI_build_up_our_faction_cat = {
	CHI_invite_free_countries = {
		icon = GFX_decision_eng_trade_unions_support
		available = {
            has_completed_focus = CHI_start_looking_outwards
        }
        visible = {
        }
        ai_will_do = {
			base = 5
			modifier = {
				factor = 2
				FROM = {
					num_of_factories > 10
				}
			}
			modifier = {
				factor = 2
				FROM = {
					num_of_factories > 20
				}
			}
			modifier = {
				factor = 2
				FROM = {
					has_opinion = {
						target = CHI
						value > 30
					}
				}
			}
		}
		target_trigger = {
			FROM = {
				is_subject = no
				NOT = { 
					has_war_with = ROOT 
					is_in_faction_with = ROOT 
					has_government = communism 
				}
				OR = {
					capital_scope = { is_on_continent = asia } 
					AND = {
						has_completed_focus = CHI_bring_the_revolution_further
						capital_scope = { is_on_continent = australia } 
					}
				}
			}
		}


		cost = 50
		complete_effect = {
			FROM = {
				country_event = {
					id = generic.5
					days = 1
				}
			}
		}
	}

	CHI_set_up_puppet = {
		icon = generic_prepare_civil_war

		cost = 0

		available = {
			has_core_occupation_modifier = {
				occupied_country_tag = FROM
				modifier = compliance_40
			}
		}
        visible = {
        	OR = {
				AND = {
					ROOT = { has_completed_focus = CHI_bring_the_revolution_further }
					FROM = { 
						capital_scope = { is_on_continent = australia } 
					}
				}
        		FROM = { capital_scope = { is_on_continent = asia } } 
        	}
			has_completed_focus = CHI_liberate_the_peoples_of_asia
        }

		complete_effect = {
			set_temp_variable = { country_to_initiate = FROM }
			CHI_setting_upp_colony = yes
		}

		target_non_existing = yes
		target_array = occupied_countries

		ai_will_do = {
			base = 10
			# priotize larger countries

			modifier = {
				# calculating cores we control
				set_temp_variable = { num_cores_we_control = 0 }
				all_of_scopes = {
					array = FROM.core_states

					if = {
						limit = { is_controlled_by = PREV }
						add_to_temp_variable = { num_cores_we_control = 1 }
					}
				}

				# more score if more cores are controlled by us
				add = num_cores_we_control
			}

			# dont make too many collaboratios
			modifier = {
				# as number of collaboration subjects increases
				# only accept subjects with more cores
				set_temp_variable = { num_min_cores = 1.5 }
				all_of_scopes = {
					array = subjects
					if = {
						limit = {
							has_autonomy_state = autonomy_collaboration_government
						}
						add_to_temp_variable = { num_min_cores = 0.7 }
					}
				}

				check_variable = { num_cores_we_control < num_min_cores }

				factor = 0
			}
			# don't create Puppet governments if you have contested cores
			modifier = {
				any_core_state = {
					OR = {
						is_controlled_by = ROOT
						is_owned_by = ROOT
					}
					is_core_of = FROM
				}
				factor = 0
			}
		}
	}
}

CHI_tsr_renegotiating_with_warlords_cat = {
	
	CHI_renegotiate_with_warlord = {
		icon = GFX_decision_generic_decision
		available = {
        }
        visible = {
        }

		target_array = global.is_chinese_warlord

		target_trigger = {
			FROM = {
				is_subject = no
				exists = yes
				has_war_with = ROOT
				NOT = {
					has_country_flag = CHI_asked_for_separate_peace
				}
			}
		}

		cost = 25

		ai_will_do = {
			base = 0
			#strong enemy
			modifier = {
				add = 100
				FROM = {
					has_army_manpower = {
					size > 197000
					}
				}
				any_enemy_country = {
					is_major = yes
				}
			}
		}

		complete_effect = {
			FROM = {
				country_event = {
					id = SEA_warlords.29
					days = 1
				}
				set_country_flag = CHI_asked_for_separate_peace
			}
		}
	}
}

CHI_the_lingguang_incident_cat = {
		
	CHI_intervene_in_guangdong = {

		icon = generic_nationalism

		fire_only_once = yes

		allowed = {
			original_tag = CHI
		}

		available = {
			
		}

		ai_will_do = {
			base = 0
			modifier = {
				add = 100
				GDC = {
					is_ai = yes
				}
			}
		}

		cost = 100

		visible = {
			GDC = {
				has_country_flag = GDC_civil_war
			}
		}
		
		complete_effect = {
			random_country = {
				limit = {
					has_country_flag = GDC_civil_war_hanmou
				}
				ROOT = {
					set_autonomy = {
						target=PREV
						autonomy_state = autonomy_sea_warlord_subject
						freedom_level = 0.5
						end_wars  = no
						end_civil_wars = no
					}
				}
			}
			declare_war_on = {
				target = GDC
				type = annex_everything
			}
		}
	}

	GDC_restore_order = {

		icon = generic_nationalism

		available = {
			
		}

		ai_will_do = {
			base = 100
		}

		cost = 10

		visible = {
			GDC = {
				has_country_flag = GDC_civil_war
			}
			tag = GDC
			has_civil_war = no
		}
		
		complete_effect = {
			add_political_power = 60
			add_stability = 0.1
			hidden_effect = {
				IF = {
					limit = {
						GXC = {
							NOT = {
								has_country_flag = GXC_the_struggle_for_independence
							}
						}
					}
					clr_global_flag = lingguang_incident_active	
				}
				clr_country_flag = GDC_civil_war
			}
		}
	}

	CHI_growing_impatience_dummy = { 

		available = {
			#hidden_trigger = {
			#	always = no 
			#}
			GXC = {
				has_country_flag = GXC_fortify_the_border
				has_country_flag = GXC_sent_out_the_japanese
				has_country_flag = GXC_persuaded_warlords
				has_country_flag = GXC_negotiated_with_chiang
			}
		}

		visible = {
			GXC = {
				exists = yes
			}
			NOT = {
				has_war_with = GXC
			}
			hidden_trigger = {
				GXC = {
					has_country_flag = GXC_the_struggle_for_independence
				}
				NOT = {
					has_global_flag = GXC_negotiated_with_chiang_flag 
				}
			}
		}

		activation = {			
			always = no
		}

		is_good = no

		priority = 100

		days_mission_timeout = 160

		cancel_if_not_visible = yes

		timeout_effect = {
			effect_tooltip = {
				CHI = {
					declare_war_on = {
						target = GXC
						type = annex_everything
					}
				}
			}
		}

	}

	CHI_growing_impatience = { 

		available = {
			GXC = {
				has_country_flag = GXC_fortify_the_border
				has_country_flag = GXC_sent_out_the_japanese
				has_country_flag = GXC_persuaded_warlords
				has_country_flag = GXC_negotiated_with_chiang
			}
		}
		visible = {
			CHI = { NOT = { has_war_with = GXC } }
			GXC = {
				exists = yes
				has_country_flag = GXC_the_struggle_for_independence
			}
		}

		activation = {			
			always = no
		}

		is_good = no

		priority = 100

		days_mission_timeout = 160

		cancel_if_not_visible = yes

		timeout_effect = {
			CHI = {
				declare_war_on = {
					target = GXC
					type = annex_everything
				}
			}
			hidden_effect = {
				IF = {
					limit = {
						GDC = {
							NOT = {
								has_country_flag = GDC_civil_war
							}
						}
					}
					clr_global_flag = lingguang_incident_active	
				}
				clr_country_flag = GXC_the_struggle_for_independence
				clr_country_flag = GXC_fortify_the_border
				clr_country_flag = GXC_sent_out_the_japanese
				clr_country_flag = GXC_persuaded_warlords
				clr_country_flag = GXC_negotiated_with_chiang
			}	
		}

		complete_effect = {
			hidden_effect = {
				IF = {
					limit = {
						GDC = {
							NOT = {
								has_country_flag = GDC_civil_war
							}
						}
					}
					clr_global_flag = lingguang_incident_active	
				}
				clr_country_flag = GXC_the_struggle_for_independence
				clr_country_flag = GXC_fortify_the_border
				clr_country_flag = GXC_sent_out_the_japanese
				clr_country_flag = GXC_persuaded_warlords
				clr_country_flag = GXC_negotiated_with_chiang
			}	
		}
	}

	GXC_fortify_our_borders = {

		icon = GFX_decision_generic_mountain_fortification

		fire_only_once = yes

		available = {
			
		}

		ai_will_do = {
			base = 200
			modifier = {
				factor = 10
				has_country_flag = GXC_the_struggle_for_independence
			}
		}

		cost = 20

		days_remove = 20

		visible = {
			has_country_flag = GXC_the_struggle_for_independence
			tag = GXC
			has_civil_war = no
		}

		complete_effect = {

			army_experience = 15

			hidden_effect = {
			division_template = {
				name = "Border Militia"
				priority = 1
				division_names_group = CHI_INF_01
				regiments = {
					infantry = { x = 0 y = 0 }
					infantry = { x = 0 y = 1 }
					infantry = { x = 0 y = 2 }
    	   		 	infantry = { x = 1 y = 0 }
					infantry = { x = 1 y = 1 }
				}
			}
			}
			random_owned_controlled_state = {
				limit = { ROOT = { has_full_control_of_state = PREV } }
				prioritize = { 594 }
				create_unit = {
					division = "name = \"1. Border Militia\" division_template = \"Border Militia\" start_experience_factor = 0.5" 
					owner = GXC
				}
				create_unit = {
					division = "name = \"2. Border Militia\" division_template = \"Border Militia\" start_experience_factor = 0.5" 
					owner = GXC
				}
				create_unit = {
					division = "name = \"3. Border Militia\" division_template = \"Border Militia\" start_experience_factor = 0.5" 
					owner = GXC
				}
				create_unit = {
					division = "name = \"4. Border Militia\" division_template = \"Border Militia\" start_experience_factor = 0.5" 
					owner = GXC
				}
			}			
		}
		
		remove_effect = {
			
			hidden_effect = {
				set_country_flag = GXC_fortify_the_border
			}
		}
	}

	GXC_anti_japanese_demonstration = {

		icon = GFX_decision_eng_blackshirt_march

		fire_only_once = yes

		available = {
			has_country_flag = GXC_fortify_the_border
		}

		ai_will_do = {
			base = 200
			modifier = {
				factor = 10
				has_country_flag = GXC_the_struggle_for_independence
			}
		}

		cost = 20

		days_remove = 20

		visible = {
			has_country_flag = GXC_the_struggle_for_independence
			tag = GXC
			has_civil_war = no
		}
		
		complete_effect = {

			add_war_support = 0.05

			custom_effect_tooltip = generic_skip_one_line_tt

			JAP = {
				add_opinion_modifier = {
					target = ROOT
					modifier = large_decrease
				}
			}

		}

		remove_effect = {
			hidden_effect = {
				set_country_flag = GXC_sent_out_the_japanese
			}
		}
	}

	GXC_persuade_the_warlords = {

		icon = GFX_decision_generic_political_discourse

		fire_only_once = yes

		available = {
			has_country_flag = GXC_sent_out_the_japanese
		}

		ai_will_do = {
			base = 200
			modifier = {
				factor = 10
				has_country_flag = GXC_the_struggle_for_independence
			}
		}

		cost = 20

		days_remove = 20

		visible = {
			has_country_flag = GXC_the_struggle_for_independence
			tag = GXC
			has_civil_war = no
		}

		complete_effect = {
			every_other_country = {
				limit = {
					is_chinese_warlord = yes
				}
				add_opinion_modifier = {
					target = ROOT
					modifier = large_increase
				}
			}
		}
		
		remove_effect = {
			hidden_effect = {
				set_country_flag = GXC_persuaded_warlords
			}
		}
	}

	GXC_further_negotiation = {

		icon = GFX_decision_hol_exchange_intelligence_data

		fire_only_once = yes

		available = {
			has_country_flag = GXC_persuaded_warlords
		}

		ai_will_do = {
			base = 200
			modifier = {
				factor = 10
				has_country_flag = GXC_the_struggle_for_independence
			}
		}

		cost = 20

		days_remove = 20

		visible = {
			has_country_flag = GXC_the_struggle_for_independence
			tag = GXC
			has_civil_war = no
		}

		complete_effect = {
			add_political_power = 100
			add_stability = 0.05
		}
		
		remove_effect = {
			
			hidden_effect = {
				set_country_flag = GXC_negotiated_with_chiang
				set_global_flag = GXC_negotiated_with_chiang_flag
				clr_country_flag = GXC_the_struggle_for_independence
			}
		}
	}

}

# The Political Tutelage 
CHI_the_political_tutelage_cat = {
	
	# Expedite the Political Tutelage in §Y[FROM.GetName]§!
	CHI_accelerate_urban_tutelage_decision = {
		icon = GFX_decision_generic_political_rally 
	
		allowed = {
		}
		
		visible = {
			has_completed_focus = CHI_accelerate_the_tutelage
			OR = {
				has_dynamic_modifier = {
					modifier = CHI_the_political_tutelage_dm
				}	
				has_dynamic_modifier = {
					modifier = CHI_the_political_tutelage_upgraded_dm
				}
			}
		}
		
		available = {
		}
		ai_will_do = {
			base = 2
			modifier = {
				factor = 0.5
				FROM = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 0.5
				democratic > 0.5
			}
			modifier = {
				factor = 0.5
				democratic > 0.8
			}
		}

		state_target = yes

		target_array = ROOT.core_states
	    
	    target_trigger = {
	        FROM = {
	        	is_owned_and_controlled_by = ROOT
	        	OR = {
	        		has_state_category = large_town
	        		has_state_category = city
	        		has_state_category = metropolis
	        		has_state_category = large_city
	        	}
	        }
	    }
	    on_map_mode = map_and_decisions_view 

	    cost = CHI_accelerate_urban_tutelage_decision_cost	

		fire_only_once = yes # Can only be done once per state

		days_remove = CHI_accelerate_urban_tutelage_decision_removal_time

		priority = 100

		modifier = {
			
		}

		complete_effect = { 
		}

		remove_effect = {
			CHI_add_or_modify_political_tutelage = yes
			add_to_variable = { CHI_the_political_tutelage_dm_democratic_drift = 0.02 tooltip = democratic_drift_tt }
			add_to_variable = { CHI_the_political_tutelage_dm_research_speed_factor = 0.01 tooltip = research_speed_factor_tt }
			hidden_effect = {
				FROM = {
					set_state_flag = CHI_urban_political_tutelage_has_been_epedited_here_state_flag 
				}
			}
		}

		cancel_trigger = {
			FROM = {
				NOT = { is_controlled_by = ROOT }
			}
		}

		cancel_effect = {
		}

	}

	# Expedite the Political Tutelage in §Y[FROM.GetName]§!
	CHI_accelerate_rural_tutelage_decision = {
		icon = GFX_decision_generic_political_address
	
		allowed = {
		}
		
		visible = {
			has_completed_focus = CHI_accelerate_the_tutelage
			OR = {
				has_dynamic_modifier = {
					modifier = CHI_the_political_tutelage_dm
				}	
				has_dynamic_modifier = {
					modifier = CHI_the_political_tutelage_upgraded_dm
				}
			}
		}
		
		available = {
		}
		ai_will_do = {
			base = 5
			modifier = {
				factor = 0.5
				FROM = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 2
				has_completed_focus = CHI_rural_reconstruction_movement_sea
				FROM = {
					free_building_slots = {
						building = arms_factory
						size > 5
					}
				}
			}
			modifier = {
				factor = 0.5
				democratic > 0.5
			}
			modifier = {
				factor = 0.5
				democratic > 0.8
			}
		}

		state_target = yes

		target_array = ROOT.core_states
	    
	    target_trigger = {
	        FROM = {
	        	is_owned_and_controlled_by = ROOT
	        	OR = {
	        		has_state_category = wasteland
	        		has_state_category = pastoral
	        		has_state_category = rural
	        		has_state_category = town
	        		has_state_category = enclave
	        	}
	        }
	    }
	    on_map_mode = map_and_decisions_view 

	    cost = CHI_accelerate_rural_tutelage_decision_cost 	

		fire_only_once = yes # Can only be done once per state

		days_remove = CHI_accelerate_rural_tutelage_decision_removal_time 

		priority = 50

		modifier = {
			
		}

		complete_effect = {
		}

		remove_effect = {
			CHI_add_or_modify_political_tutelage = yes
			add_to_variable = { CHI_the_political_tutelage_dm_democratic_drift = 0.02 tooltip = democratic_drift_tt }
			add_to_variable = { CHI_the_political_tutelage_dm_production_speed_infrastructure_factor = 0.01 tooltip = production_speed_infrastructure_factor_tt }
			IF = {
				limit = {
					has_completed_focus = CHI_rural_reconstruction_movement_sea
				}
				custom_effect_tooltip = generic_skip_one_line_tt
				FROM = {
					add_dynamic_modifier = {
						modifier = CHI_local_rural_reconstruction_modifier
						scope = CHI
					}	
				}
			}
			hidden_effect = {
				FROM = {
					set_state_flag = CHI_rural_political_tutelage_has_been_epedited_here_state_flag 
				}
			}
		}

		cancel_trigger = {
			FROM = {
				NOT = { is_controlled_by = ROOT }
			}
		}

		cancel_effect = {
		}

	}




}

# Republican Interests 
CHI_republican_interests_cat = {
	
	# Invite Asian Nation to your faction decision 
	CHI_invite_demo_asian_nation_to_faction_decison = {
		icon = GFX_decision_hol_exchange_intelligence_data

		priority = 50
	
		allowed = {
		}

		ai_will_do = {
			base = 50
		}
		
		visible = {
			has_completed_focus = CHI_expand_the_faction
		}
		available = {
			
		}

		target_array = global.asian_and_oceanian_countries
	    
	    target_trigger = {
	        FROM = {
				NOT = {
					tag = ROOT
				}
	        	is_subject = no
	        	is_in_faction = no
	        	has_government = democratic
	        	NOT = {
	        		has_war_with = ROOT
	        	}
	        }
	    }

	    on_map_mode = decision_view_only 

	    cost = 50		
		fire_only_once = yes

		#days_remove = 30

		complete_effect = {

			FROM = {
				country_event = {
					id = SEA_china_democratic.2
					hours = 6
					random_hours = 12
				}	
			}
			custom_effect_tooltip = if_they_accept_tt
			effect_tooltip = {
				ROOT = {
					add_to_faction = FROM
				}
			}
			
		}

		remove_effect = {

		}

		cancel_trigger = {
			
		}

		cancel_effect = {
			
		}
	}

	# Stir Republican Sentiments in §Y[FROM.GetNameDef]§!
	CHI_stir_democratic_sentiments_in_asia_decison = {
		icon = GFX_decision_eng_propaganda_campaigns

		priority = 45
	
		allowed = {
		}

		ai_will_do = {
			base = 50
		}
		
		visible = {
			has_completed_focus = CHI_spreading_the_light_of_freedom
		}
		available = {
			
		}

		target_array = global.asian_and_oceanian_countries
	    
	    target_trigger = {
	        FROM = {
	        	NOT = {
	        		has_war_with = ROOT
	        	}
	        	NOT = {
	        		has_government = communism
	        	}
	        }
	    }

	    on_map_mode = decision_view_only 

	    cost = 25		
		fire_only_once = yes

		#days_remove = 30

		complete_effect = {

			FROM = {
				country_event = {
					id = SEA_china_democratic.6
					hours = 6
					random_hours = 12
				}	
			}
			custom_effect_tooltip = if_they_accept_tt
			effect_tooltip = {
				add_timed_idea = {
					idea = CHI_republican_agitation
					days = 720
				}
				add_stability = -0.05
			}
			
		}

		remove_effect = {

		}

		cancel_trigger = {
			
		}

		cancel_effect = {
			
		}
	}

	CHI_oust_the_empires_decision = {
		icon = GFX_decision_generic_political_rally
		target_array = CHI.asian_democracies_countries_to_liberate
		target_root_trigger = { original_tag = CHI }
		fire_only_once = no
		target_non_existing = yes

		allowed = {
			original_tag = CHI
		}

		available = {
			NOT = {
				has_country_flag = CHI_liberation_in_progress
			}
		}

		visible = {
			has_completed_focus = CHI_make_a_stand_against_the_colonialists
			FROM = {
				NOT = {
					has_country_flag = CHI_already_liberated_country
				}
			}
		}

		on_map_mode = decision_view_only
		
		cost = 50

		ai_will_do = {
			base = 50
		}

		days_remove = 35

		complete_effect = {
			hidden_effect = {
				CHI_setup_colonized_countries_to_liberate_array = yes #run again to see if there are any new countries that are occupied and needs liberation in south america, only shows up when decisions are reloaded
			}
			set_country_flag = CHI_liberation_in_progress #only one at a time, also to prevent weirdnes upon releasing countries
		}

		remove_effect = {
			FROM = { #country to be liberated
				save_global_event_target_as = CHI_country_to_be_liberated #since we remove from array, this is needed for the event that fires if they accept
				capital_scope = {
					OWNER = { #occupier 
						country_event = {
							id = SEA_china_democratic.7
							hours = 1
						}
					}
				}

				for_each_scope_loop = {
					array = CHI.asian_democracies_countries_to_liberate
					IF = {
						limit = {
							tag = FROM
						}
						remove_from_array = { #remove the country from the array so that 
							array = CHI.asian_democracies_countries_to_liberate
							value = THIS #optional, use index or this. if neither it removes last element
						}
					}
				}
				set_country_flag = CHI_already_liberated_country
			}

			clr_country_flag = CHI_liberation_in_progress #clear that flag once done
			custom_effect_tooltip = BRA_oust_the_empires_decision_tt
		}
	}


}

# Reunification Intiatives
CHI_integrate_the_warlords_democratic_sea_cat = {

	# Demand §Y[FROM.GetLeader]§! Submit to the Central Government
	CHI_press_warlord_to_become_puppet_democratic = {

		icon = GFX_decision_eng_trade_unions_demand

		priority = 50

		available = {
			
			FROM = { 
				democratic > 0.4
			}
			NOT = {
				has_country_flag = is_pressing_warlord
			}
		}

		visible = {
			is_subject = no
			has_government = democratic
			has_completed_focus = CHI_demand_regional_adherence
		}
		cancel_if_not_visible = yes

		cost = FROM.press_warlord_to_become_puppet_political_power_cost

		target_array = global.is_chinese_warlord

		target_trigger = {
			FROM = {
				is_subject = no
				exists = yes
				NOT = {
					has_war_with = ROOT
				}
			}
		}

		fire_only_once = yes

		complete_effect = {

			FROM = {
				country_event = {
					id = SEA_china_democratic.17
					hours = 2 
					random_hours = 16 
				}
			}
			custom_effect_tooltip = if_they_accept_tt
			effect_tooltip = {
				set_autonomy = {
					target = FROM
					autonomy_state = autonomy_sea_warlord_subject
					freedom_level = 0.2 # 0-1 
					end_wars = no 
					end_civil_wars = no 
				}
			}
			custom_effect_tooltip = generic_skip_one_line_tt
			set_country_flag = {
				flag = is_pressing_warlord
				days = 90 #max in case something goes badly it would still time out eventually
				value = 1
			}
			
		}

	}

	# §Y[FROM.GetNameWithFlag]§! Integration Efforts
	CHI_warlord_autonomy_drift_demcoratic_decision = {

		icon = generic_prepare_civil_war

		priority = 1

		visible = {
			any_subject_country = {
				OR = {
					has_autonomy_state = autonomy_sea_warlord_subject
					has_autonomy_state = autonomy_sea_integrated_warlord_subject
				}
			}	
			has_completed_focus = CHI_demand_regional_adherence
		}
		cancel_if_not_visible = yes
	
		available = {
			FROM = {
				NOT = {
					has_idea = idea_CHI_central_government_integration_pressure_democratic
				}
			}
		}

		ai_hint_pp_cost = 50
		custom_cost_trigger = {
			command_power > 49
			has_political_power > 49
		}
		custom_cost_text = decision_cost_CP_50_pp_50

		target_array = warlord_subjects 

		target_trigger = {
			FROM = {
				is_subject_of = ROOT
				exists = yes
				OR = {
					has_autonomy_state = autonomy_sea_warlord_subject
					has_autonomy_state = autonomy_sea_integrated_warlord_subject
				}
			}
		}

		fire_only_once = no

		complete_effect = {
			hidden_effect = {
				add_political_power = -50
				add_command_power = -50
			}
			FROM = {
				add_timed_idea = {
					idea = idea_CHI_central_government_integration_pressure_democratic
					days = 365
				}
			}
		}

		cancel_trigger = {
			FROM = {
				OR = {
					has_war_with = ROOT
					exists = no
					NOT = {
						is_subject_of = ROOT
					}
				}
			}
		}
	}

	# Demand §Y[FROM.GetLeader]§! Apply the Principle of Mínquán
	CHI_warlord_democratic_drift_minquan_decision = {

		icon = GFX_decision_SWI_swiss_democratic_tradition_campaign

		priority = 5

		target_array = global.is_chinese_warlord 

		target_trigger = {
			FROM = {
				NOT = {
					original_tag = CHI
					original_tag = PRC
					has_war_with = ROOT
					has_government = democratic
					has_idea = idea_CHI_central_government_minquan_pressure_democratic
					has_country_flag = CHI_currently_being_asked_about_minquan
					has_country_flag = CHI_rejected_minquan_alltogether_flag
				}
				is_subject = no
			}
		}

		visible = {
			has_completed_focus = CHI_demand_regional_adherence
		}
		cancel_if_not_visible = yes
	
		available = {
			FROM = {
				NOT = {
					has_idea = idea_CHI_central_government_minquan_pressure_democratic
				}
			}
		}

		ai_hint_pp_cost = 50
		custom_cost_trigger = {
			command_power > 24
			has_political_power > 24
		}
		custom_cost_text = decision_cost_CP_25_pp_25

		fire_only_once = no

		complete_effect = {
			hidden_effect = {
				add_political_power = -25
				add_command_power = -25
			}

			FROM = {
				country_event = { id = SEA_china_democratic.20 days = 1 } 
				set_country_flag = CHI_currently_being_asked_about_minquan
			}

			custom_effect_tooltip = if_they_accept_tt

			effect_tooltip = {
				FROM = {
					add_timed_idea = {
						idea = idea_CHI_central_government_minquan_pressure_democratic
						days = 365
					}
					clr_country_flag = CHI_currently_being_asked_about_minquan
				}
			}
		}

	}
	
	# Develop Welfare Systems and Public Works in §Y[FROM.GetNameDef]§!
	CHI_develop_warlord_industry_decision = {

		priority = 10

		icon = GFX_decision_hol_attract_foreign_investors 

		ai_will_do = {
			base = 10
		}

		target_array = global.is_chinese_warlord

		target_trigger = {
			FROM = {
				NOT = {
					original_tag = CHI
					original_tag = PRC
					has_war_with = ROOT
				}
				NOT = {
					AND = {
						is_subject = yes
						NOT = {
							is_subject_of = ROOT
						}
					}
				}
				NOT = {
					has_country_flag = CHI_has_developed_froms_industry_once_already_flag
				}
			}
		}

		available = {
			
		}

		visible = {	
			has_completed_focus = CHI_demand_regional_adherence
		}

		fire_only_once = yes

		cost = 50

		days_remove = 35

		modifier = {
			consumer_goods_factor = 0.1
		}

		complete_effect = {
			
		}

		remove_effect = {

			FROM = {
				country_event = { id = SEA_china_democratic.16 days = 1 } 
				set_country_flag = CHI_has_developed_froms_industry_once_already_flag
			}

			custom_effect_tooltip = if_they_accept_tt

			effect_tooltip = {
				FROM = {
					add_popularity = {
						ideology = democratic
						popularity = 0.1
					}	
				}
				random_state = {
					limit = {
						is_owned_and_controlled_by = FROM
						is_core_of = FROM
						free_building_slots = {
							building = industrial_complex
							size > 2
							include_locked = yes
						}	
					}
					add_extra_state_shared_building_slots = 2
					add_building_construction = {
						type = industrial_complex
						level = 2
						instant_build = yes
					}	
					IF = {
						limit = {
							infrastructure < 5
						}
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}	
					}
				}		 
			}
			
		}

	}

	# Reintegration Efforts in [FROM.GetName]
	CHI_integrating_states_democratic = {
		icon = GFX_decision_generic_political_address
		allowed = {
			original_tag = CHI
		}

		visible = {
			has_completed_focus = CHI_zhonghua_minzu_focus
		}

		available = { 
			FROM = {
				is_fully_controlled_by = CHI 
			}
		}

		cost = 75

		days_remove = 50

		ai_will_do = {
			base = 200
		}

		state_target = yes

		on_map_mode = map_only 

		target_array = CHI.mtac_core_states

		target_trigger = {
			FROM = {
				NOT = {
					is_core_of = CHI
				}
			}	
		}

		complete_effect = {
		}

		remove_effect = {
			FROM = {
				add_core_of = CHI
			}
		}
	}
}

CHI_x_y_force_cat = {
	CHI_form_x_force = {


		custom_cost_trigger = {
			command_power > 75
		}
		custom_cost_text = decision_cost_CP_75
		ai_will_do = {
			base = 10
			modifier = {
				factor = 2
				command_power > 75
			}
		}
		available = {
			NOT = { has_war_with = ENG }
			NOT = { has_war_with = BRM }
			BRM = {
				exists = yes
				any_core_state = {
					controller = {
						has_war_with = PREV


					}
				}
			}

			435 = {
				controller = {
					NOT = { has_war_with = ROOT }
					is_ally_with = BRM
				}
			}
		}

		complete_effect = {
			custom_effect_tooltip = CHI_form_x_force_tt
			hidden_effect = {
				add_command_power = -75
			}

			if = {
				limit = {
					YUN = {
						exists = yes
						NOT = { has_war_with = ROOT }
					}
				}

				YUN = {
					give_military_access = ROOT
				}
			}

			if = {
				limit = {
					SIC = {
						exists = yes
						NOT = { has_war_with = ROOT }
					}
				}

				SIC = {
					give_military_access = ROOT
				}
			}

			if = {
				limit = {
					BRM = {
						exists = yes
						NOT = { has_war_with = ROOT }
					}
				}

				BRM = {
					give_military_access = ROOT
				}
			}

			if = {
				limit = {
					RAJ = {
						exists = yes
						NOT = { has_war_with = ROOT }
					}
				}

				RAJ = {
					give_military_access = ROOT
				}
			}

			if = { #This should be RAJ 99% of the time but just in case
				limit = {
					435 = {
						controller = {
							NOT = { ROOT = { has_military_access_to = PREV } }
						}
					}
				}

				435 = {
					controller = {
						give_military_access = ROOT
					}
				}
			}

			division_template = {
				name = "X-Force"
				is_locked = no

				regiments = {
					infantry = { x = 0 y = 0 }
					infantry = { x = 0 y = 1 }
					infantry = { x = 0 y = 2 }
					infantry = { x = 0 y = 3 }

					infantry = { x = 1 y = 0 }
					infantry = { x = 1 y = 1 }
					infantry = { x = 1 y = 2 }
					infantry = { x = 1 y = 3 }

					infantry = { x = 2 y = 0 }
					infantry = { x = 2 y = 1 }
					infantry = { x = 2 y = 2 }
					infantry = { x = 2 y = 3 }

					infantry = { x = 3 y = 0 }
					infantry = { x = 3 y = 1 }
					infantry = { x = 3 y = 2 }
				}
				support = {
					
				}
			}

			if = {
				limit = {
					435 = {
						controller = {
							NOT = { has_war_with = ROOT }
							surrender_progress < 0.9
							ROOT = { has_military_access_to = PREV }
						}
					}
				}
				

				set_variable = { controller_435 = 435.controller }  

				transfer_state = 435
				435 = {
					create_unit = {
						division = "name = \"30th Division\" division_template = \"X-Force\" start_experience_factor = 0.4 start_equipment_factor = 0.5 start_manpower_factor = 1"
						owner = CHI
						prioritize_location = 4516 
					
						count = 1
					}

					create_unit = {
						division = "name = \"22nd Division\" division_template = \"X-Force\" start_experience_factor = 0.4 start_equipment_factor = 0.5 start_manpower_factor = 1"
						owner = CHI
						prioritize_location = 4516 
					
						count = 1
					}

					create_unit = {
						division = "name = \"38th Division\" division_template = \"X-Force\" start_experience_factor = 0.4 start_equipment_factor = 0.5 start_manpower_factor = 1"
						owner = CHI
						prioritize_location = 4516 
					
						count = 1
					}

					create_unit = {
						division = "name = \"14th Division\" division_template = \"X-Force\" start_experience_factor = 0.4 start_equipment_factor = 0.5 start_manpower_factor = 1"
						owner = CHI
						prioritize_location = 4516 
					
						count = 1
					}

					create_unit = {
						division = "name = \"50th Division\" division_template = \"X-Force\" start_experience_factor = 0.4 start_equipment_factor = 0.5 start_manpower_factor = 1"
						owner = CHI
						prioritize_location = 4516 
					
						count = 1
					}
				}
				var:controller_435 = { transfer_state = 435 }
				clear_variable = controller_435
			}
		}
	}

	CHI_form_y_force = {
		
		custom_cost_trigger = {
			has_political_power > 74 
			command_power > 99
		}
		custom_cost_text = decision_cost_CP_100_pp_75
		ai_will_do = {
			base = 10
			modifier = {
				factor = 2
				has_political_power > 100
				command_power > 75
			}
		}
		available = {
			NOT = { has_war_with = ENG }
			NOT = { has_war_with = BRM }
			
			YUN = {
				OR = { 
					is_subject_of = ROOT 
					AND = {
						325 = {
							OR = { 
								is_controlled_by = ROOT 
								AND = {
									is_controlled_by = YUN
									YUN = { is_subject_of = ROOT }
								}	
							}
						}
						747 = {
							OR = { 
								is_controlled_by = ROOT 
								AND = {
									is_controlled_by = YUN
									YUN = { is_subject_of = ROOT }
								}	
							}
						}
					}
				}
			}

			BRM = {	
				any_core_state = {
					controller = {
						has_war_with = ROOT
					}
				}
			}
		}

		complete_effect = {
			hidden_effect = {
				add_political_power = -75
				add_command_power = -100
			}
			custom_effect_tooltip = CHI_form_y_force_tt
			division_template = {
				name = "Y-Force"
				is_locked = no

				regiments = {
					infantry = { x = 0 y = 0 }
					infantry = { x = 0 y = 1 }
					infantry = { x = 0 y = 2 }
					infantry = { x = 0 y = 3 }

					infantry = { x = 1 y = 0 }
					infantry = { x = 1 y = 1 }
					infantry = { x = 1 y = 2 }
					infantry = { x = 1 y = 3 }

					infantry = { x = 2 y = 0 }
					infantry = { x = 2 y = 1 }
					infantry = { x = 2 y = 2 }
				}
				support = {
					
				}
			}
			hidden_effect = {
				325 = {
					create_unit = {
					    division = "name = \"9th Division\" division_template = \"Y-Force\" start_experience_factor = 0.5 start_equipment_factor = 0.6 start_manpower_factor = 1"
					    owner = CHI
					}
					create_unit = {
					    division = "name = \"New 33rd Division\" division_template = \"Y-Force\" start_experience_factor = 0.5 start_equipment_factor = 0.6 start_manpower_factor = 1"
					    owner = CHI
					}
					create_unit = {
					    division = "name = \"76th Division\" division_template = \"Y-Force\" start_experience_factor = 0.5 start_equipment_factor = 0.6 start_manpower_factor = 1"
					    owner = CHI
					}
					create_unit = {
					    division = "name = \"Reserve 2nd Division\" division_template = \"Y-Force\" start_experience_factor = 0.5 start_equipment_factor = 0.6 start_manpower_factor = 1"
					    owner = CHI
					}
					create_unit = {
					    division = "name = \"New 39th Division\" division_template = \"Y-Force\" start_experience_factor = 0.5 start_equipment_factor = 0.6 start_manpower_factor = 1"
					    owner = CHI
					}
					create_unit = {
					    division = "name = \"New 28th Division\" division_template = \"Y-Force\" start_experience_factor = 0.5 start_equipment_factor = 0.6 start_manpower_factor = 1"
					    owner = CHI
					}
					create_unit = {
					    division = "name = \"87th Division\" division_template = \"Y-Force\" start_experience_factor = 0.5 start_equipment_factor = 0.6 start_manpower_factor = 1"
					    owner = CHI
					}
					create_unit = {
					    division = "name = \"88th Division\" division_template = \"Y-Force\" start_experience_factor = 0.5 start_equipment_factor = 0.6 start_manpower_factor = 1"
					    owner = CHI
					}
					create_unit = {
					    division = "name = \"116th Division\" division_template = \"Y-Force\" start_experience_factor = 0.5 start_equipment_factor = 0.6 start_manpower_factor = 1"
					    owner = CHI
					}
					create_unit = {
					    division = "name = \"130th Division\" division_template = \"Y-Force\" start_experience_factor = 0.5 start_equipment_factor = 0.6 start_manpower_factor = 1"
					    owner = CHI
					}
					create_unit = {
					    division = "name = \"36th Division\" division_template = \"Y-Force\" start_experience_factor = 0.5 start_equipment_factor = 0.6 start_manpower_factor = 1"
					    owner = CHI
					}
					create_unit = {
					    division = "name = \"198th Division\" division_template = \"Y-Force\" start_experience_factor = 0.5 start_equipment_factor = 0.6 start_manpower_factor = 1"
					    owner = CHI
					}
					create_unit = {
					    division = "name = \"Honorable 1st Division\" division_template = \"Y-Force\" start_experience_factor = 0.5 start_equipment_factor = 0.6 start_manpower_factor = 1"
					    owner = CHI
					}
					create_unit = {
					    division = "name = \"82nd Division\" division_template = \"Y-Force\" start_experience_factor = 0.5 start_equipment_factor = 0.6 start_manpower_factor = 1"
					    owner = CHI
					}
					create_unit = {
					    division = "name = \"103rd Division\" division_template = \"Y-Force\" start_experience_factor = 0.5 start_equipment_factor = 0.6 start_manpower_factor = 1"
					    owner = CHI
					}
				}
			}
		}
	}
}

RNG_state_shintoism_decisions = {
	
	RNG_import_imperial_way_buddhism_decision  = {

		priority = 15

		icon = GFX_decision_hol_exchange_intelligence_data

		ai_will_do = {
			base = 25
		}
	
		allowed = {  
			is_literally_china = yes
			has_dlc = "No Compromise, No Surrender"
		}

		visible = { 
			has_completed_focus = CHI_tsr_embrace_japanese_cultural_institutions
		}
	
		available = {
		}

		#days_remove = 70

		#days_re_enable = 180

		cost = 50

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			RNG_add_or_modify_state_shintoism = yes

			add_to_variable = { ROOT.RNG_state_shintoism_pocket_penalty = -0.05 tooltip = pocket_penalty_tt }
			add_to_variable = { ROOT.RNG_state_shintoism_surrender_limit = 0.1 tooltip = surrender_limit_tt }

		}

		fire_only_once = yes

		remove_effect = {

		}

	}
	
	RNG_one_people_united_under_shinto_decision  = {

		priority = 14

		icon = GFX_decision_generic_civil_support

		ai_will_do = {
			base = 2
		}
	
		allowed = {  
			is_literally_china = yes
			has_dlc = "No Compromise, No Surrender"
		}

		visible = { 
			has_completed_focus = CHI_tsr_embrace_japanese_cultural_institutions
		}
	
		available = {
		}

		cost = 50

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			RNG_add_or_modify_state_shintoism = yes

			add_to_variable = { ROOT.RNG_state_shinotism_stability_factor = 0.075 tooltip = stability_factor_tt }

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

	RNG_state_shinto_in_education_decision  = {

		priority = 12

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = {
			base = 10
		}
	
		allowed = {  
			is_literally_china = yes
			has_dlc = "No Compromise, No Surrender"
		}

		visible = { 
			has_completed_focus = CHI_tsr_embrace_japanese_cultural_institutions
		}
	
		available = {
		}

		cost = 75

		cancel_trigger = {
		}

        cancel_effect = {
        }

		modifier = {
		}

		complete_effect = { 

			RNG_add_or_modify_state_shintoism = yes

			add_to_variable = { ROOT.RNG_state_shintoism_research_speed_factor = 0.05 tooltip = research_speed_factor_tt }

		}

		fire_only_once = yes

		remove_effect = {

		}

	}

}

PRC_infiltration_sea_cat = {
	CHI_fascist_infiltrate_state = {
		icon = {
			key = GFX_decisions_generic_infiltration_0
			trigger = {
				FROM = {
					NOT = {
						has_dynamic_modifier = {
							modifier = CHI_infiltrated_state_1
							scope = CHI
						}
						has_dynamic_modifier = {
							modifier = CHI_infiltrated_state_2
							scope = CHI
						}
						has_dynamic_modifier = {
							modifier = CHI_infiltrated_state_3
							scope = CHI
						}
					}
				}
			}
		}
		icon = {
			key = GFX_decisions_generic_infiltration_1
			trigger = {
				FROM = {
					has_dynamic_modifier = {
						modifier = CHI_infiltrated_state_1
						scope = CHI
					}
				}
			}
		}
		icon = {
			key = GFX_decisions_generic_infiltration_2
			trigger = {
				FROM = {
					has_dynamic_modifier = {
						modifier = CHI_infiltrated_state_2
						scope = CHI
					}
				}
			}
		}
		priority = 90
		allowed = {
			original_tag = CHI		
		}

		visible = {
			NOT = { has_completed_focus = CHI_a_new_middle_kingdom }
			has_completed_focus = CHI_a_chapter_in_every_village
			FROM = {
				controller = {
					NOT = {
						has_war_with = ROOT
					}
				}
			}
		}

		available = {
			NOT = {
				has_completed_focus = CHI_a_new_middle_kingdom #This is here to inform to the player
			}
			FROM = {
				NOT = {
					has_dynamic_modifier = {
						modifier = PRC_infiltrated_state_1
						scope = PRC
					}
					has_dynamic_modifier = {
						modifier = PRC_infiltrated_state_2
						scope = PRC
					}
					has_dynamic_modifier = {
						modifier = PRC_infiltrated_state_3
						scope = PRC
					}	
				}
			}
		}

		state_target = yes

		target_array = ROOT.core_states

		highlight_states = {
			highlight_state_targets = {
				state = FROM
			}
		}

		on_map_mode = map_and_decisions_view

		target_trigger = {
			FROM = {
				impassable = no
				controller = {
					is_literally_china = yes
					NOT = {
						has_war_with = ROOT
						has_government = communism
					}
				}
				OR = {
					has_dynamic_modifier = {
						modifier = CHI_infiltrated_state_1
						scope = CHI
					}
					has_dynamic_modifier = {
						modifier = CHI_infiltrated_state_2
						scope = CHI
					}
					any_neighbor_state = {
						OR = {
							has_dynamic_modifier = {
								modifier = CHI_infiltrated_state_1
								scope = CHI
							}
							has_dynamic_modifier = {
								modifier = CHI_infiltrated_state_2
								scope = CHI
							}
							has_dynamic_modifier = {
								modifier = CHI_infiltrated_state_3
								scope = CHI
							}
						}
					}
				}
				NOT = {
					has_dynamic_modifier = {
						modifier = CHI_infiltrated_state_3
						scope = CHI
					}
				}
			}
		}

		cost = CHI_infiltration_cost

		#fire_only_once = yes

		days_remove = 30

		ai_will_do = {
			base = 5
			modifier = {
				factor = 5
				FROM = {
					any_neighbor_state = {
						is_controlled_by = ROOT
					}
				}
			}
			modifier = {
				factor = 2
				FROM = {
					any_neighbor_state = {
						OR = {
							has_dynamic_modifier = {
								modifier = CHI_infiltrated_state_1
								scope = CHI #These modifiers should only apply to CHI
							}
							has_dynamic_modifier = {
								modifier = CHI_infiltrated_state_2
								scope = CHI #These modifiers should only apply to CHI
							}
							has_dynamic_modifier = {
								modifier = CHI_infiltrated_state_3
								scope = CHI #These modifiers should only apply to CHI
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				FROM = {
					controller = {
						NOT = { is_in_faction_with = ROOT }
					}
				}
			}
			modifier = {
				factor = 1.5
				has_political_power > 150
			}
			modifier = {
				factor = 1.5
				has_political_power > 200
			}
			modifier = {
				factor = 2
				fascism < 0.5
			}
			#Prioritize your advisors first!
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 2
					slots = {
						political_advisor
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 3
					slots = {
						political_advisor
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						high_command
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 2
					slots = {
						high_command
					}
				}
			}
			modifier = {
				factor = 0.5
				amount_taken_ideas = {
					amount < 1
					slots = {
						theorist
					}
				}
			}
		}

		cancel_trigger = {
			FROM = {
				controller = {
					has_war_with = ROOT
				}
			}
		}

		cancel_effect = {
		}

		complete_effect = {
		}

		remove_effect = {
			if = {
				limit = {
					FROM = {
						is_controlled_by = ROOT
					}
				}
				if = {
					limit = {
						fascism < 0.3
					}
					add_popularity = {
						ideology = fascism
						popularity = 0.02
					}
				}
				else_if = {
					limit = {
						fascism < 0.5
					}
					add_popularity = {
						ideology = fascism
						popularity = 0.01
					}
				}
			}
			FROM = {
				if = { #Add a cost variable to take the counter decisions for Warlords
					limit = {
						controller = {
							NOT = {
								original_tag = ROOT
								has_variable = CHI_counter_infiltration_cost
							}
						}
					}
					controller = {
						set_variable = { CHI_counter_infiltration_cost = 50 } 
					}
				}
				IF = { #this has to be done this way, updating the varibles on the modifiers will upddate for ALL states, not just the one state
					limit = {
						has_dynamic_modifier = {
							modifier = CHI_infiltrated_state_1
							scope = CHI #These modifiers should only apply to CHI
						}
					}
					add_dynamic_modifier = {
						modifier = CHI_infiltrated_state_2
						scope = CHI #These modifiers should only apply to CHI
					}

					remove_dynamic_modifier = {
						modifier = CHI_infiltrated_state_1
						scope = CHI #These modifiers should only apply to CHI
					}
				}

				ELSE_IF = {
					limit = {
						has_dynamic_modifier = {
							modifier = CHI_infiltrated_state_2
							scope = CHI
						}
						
					}
					custom_effect_tooltip = generic_skip_one_line_tt
					add_dynamic_modifier = {
						modifier = CHI_infiltrated_state_3
						scope = CHI #These modifiers should only apply to CHI
					}
					remove_dynamic_modifier = {
						modifier = CHI_infiltrated_state_2
						scope = CHI #These modifiers should only apply to CHI
					}
					IF = {
						limit = {
							is_fully_controlled_by = ROOT
						}
						custom_effect_tooltip = generic_skip_one_line_tt
						create_unit = {
						    division = "name = \"Blueshirt Militia\" division_template = \"Blueshirt Militia\" start_experience_factor = 0.3 start_equipment_factor = 1"
						    owner = ROOT
						}
					}
					ELSE_IF = {
						limit = {
							has_completed_focus = CHI_militarize
						}
						custom_effect_tooltip = CHI_militarize_tt
					}
				}

				ELSE = {
					add_dynamic_modifier = {
						modifier = CHI_infiltrated_state_1
						scope = CHI #These modifiers should only apply to CHI
					}
				}
			}
		}
	}

	CHI_counter_fascist_infiltration_measures = {
		icon = {
			key = GFX_decisions_generic_infiltration_2
			trigger = {
				FROM = {
					has_dynamic_modifier = {
						modifier = CHI_infiltrated_state_2
						scope = CHI
					}
				}
			}
		}
		icon = {
			key = GFX_decisions_generic_infiltration_1
			trigger = {
				FROM = {
					has_dynamic_modifier = {
						modifier = CHI_infiltrated_state_1
						scope = CHI
					}
				}
			}
		}
		
		priority = 90

		allowed = {
			NOT = { original_tag = CHI }
		}
		visible = {
			
		}

		available = {
			NOT = {
				has_country_flag = CHI_counter_infiltration_measures_flag
			}
		}

		state_target = yes

		target_array = CHI.core_states

		highlight_states = {
			highlight_state_targets = {
				state = FROM
			}
		}

		on_map_mode = map_and_decisions_view

		target_trigger = {
			FROM = {
				OR = {
					AND = {
						ROOT = {
							tag = event_target:WTT_current_china_leader
						}
						controller = {
							any_allied_country = {
								is_faction_leader = yes
								is_literally_china = yes
							}
						}
					}
					is_controlled_by = ROOT
				}
				OR = {
					has_dynamic_modifier = {
						modifier = CHI_infiltrated_state_1
						scope = CHI
					}
					has_dynamic_modifier = {
						modifier = CHI_infiltrated_state_2
						scope = CHI
					}
				}
			}
		}

		cost = ROOT.CHI_counter_infiltration_cost

		#fire_only_once = yes

		days_remove = 45

		ai_will_do = {
			base = 5
			modifier = {
				factor = 1.5
				OR = {
					is_faction_leader = yes
					original_tag = PRC
				}
			}
			modifier = {
				factor = 2
				FROM = {
					has_dynamic_modifier = {
						modifier = CHI_infiltrated_state_2
						scope = CHI
					}
				}
			}
			modifier = {
				factor = 2
				has_war = no
			}
			modifier = {
				factor = 1.5
				has_political_power > 150
			}
			modifier = {
				factor = 1.5
				has_political_power > 200
			}
			modifier = {
				factor = 0.5
				has_political_power < 100
			}
		}

		cancel_trigger = {
			FROM = {
				controller = {
					has_war_with = ROOT
				}
			}
		}

		cancel_effect = {
			clr_country_flag = CHI_counter_infiltration_measures_flag
		}

		complete_effect = {
			set_country_flag = CHI_counter_infiltration_measures_flag
		}

		remove_effect = {
			clr_country_flag = CHI_counter_infiltration_measures_flag

			FROM = {
				IF = {
					limit = {
						has_dynamic_modifier = {
							modifier = CHI_infiltrated_state_1
							scope = CHI
						}
					}
					remove_dynamic_modifier = {
						modifier = CHI_infiltrated_state_1
						scope = CHI
					}
				}
				IF = {
					limit = {
						has_dynamic_modifier = {
							modifier = CHI_infiltrated_state_2
							scope = CHI
						}
					}
					remove_dynamic_modifier = {
						modifier = CHI_infiltrated_state_2
						scope = CHI
					}
					add_dynamic_modifier = {
						modifier = CHI_infiltrated_state_1
						scope = CHI
					}
				}
			}
		}
	}

	CHI_counter_fascist_infiltration_measures_level_3 = {
		icon = GFX_decisions_generic_infiltration_3
		priority = 90
		allowed = {
			NOT = { original_tag = CHI }
		}
		visible = {
			
		}

		available = {
			NOT = {
				has_country_flag = CHI_counter_infiltration_measures_flag
			}
		}

		state_target = yes

		target_array = CHI.core_states

		highlight_states = {
			highlight_state_targets = {
				state = FROM
			}
		}

		on_map_mode = map_and_decisions_view

		target_trigger = {
			FROM = {
				OR = {
					AND = {
						ROOT = {
							tag = event_target:WTT_current_china_leader
						}
						controller = {
							any_allied_country = {
								is_faction_leader = yes
								is_literally_china = yes
							}
						}
					}
					is_controlled_by = ROOT
				}
				has_dynamic_modifier = {
					modifier = CHI_infiltrated_state_3
					scope = CHI
				}
			}
		}

		cost = 100 #CHI has infiltrated the state and cemented the people's support - it's hard and costly to root them out

		#fire_only_once = yes

		days_remove = 60 #CHI has infiltrated the state and cemented the people's support - it's hard and costly to root them out

		ai_will_do = {
			base = 5
			modifier = {
				factor = 1.5
				OR = {
					is_faction_leader = yes
					original_tag = PRC
				}
			}
			modifier = {
				factor = 1.5
				FROM = {
					has_dynamic_modifier = {
						modifier = CHI_infiltrated_state_3
						scope = CHI
					}
				}
			}
			modifier = {
				factor = 2
				has_war = no
			}
			modifier = {
				factor = 0.5
				has_political_power < 150
			}
			modifier = {
				factor = 1.5
				has_political_power > 200
			}
		}

		cancel_trigger = {
			if = {
				limit = {
					FROM = {
						NOT = {
							owner = {
								original_tag = ROOT
							}
						}
					}
				}
				FROM = {
					controller = {
						has_war_with = ROOT
					}
				}
			}
			else = {
				NOT = {
					FROM = {
						is_controlled_by = ROOT
					}
				}
			}
		}

		cancel_effect = {
			clr_country_flag = CHI_counter_infiltration_measures_flag
		}

		complete_effect = {
			set_country_flag = CHI_counter_infiltration_measures_flag
		}

		remove_effect = {
			clr_country_flag = CHI_counter_infiltration_measures_flag
			FROM = {
				remove_dynamic_modifier = {
					modifier = CHI_infiltrated_state_3
					scope = CHI
				}
				add_dynamic_modifier = {
					modifier = CHI_infiltrated_state_2
					scope = CHI
				}
			}
		}
	}
}