#Category only allowed for MAN MEN JAP
#Visible when other nation has completed PRC_anti_japanese_expedition and controls relevant states or puppet controls them
communist_infiltration = {

	detect_infiltration = {

		icon = generic_army_support
		
		available = {

		}

		days_remove = 0
		days_re_enable = 30
	
		cost = 100

		ai_will_do = {
			base = 0
			modifier = {
				has_political_power < 300 #EAI
				factor = 0
			}
			modifier = {
				add = 75
				any_other_country = {
					is_potentially_communist_china = yes
					has_completed_focus = PRC_anti_japanese_expedition
					NOT = { has_country_flag = JAP_delay_sweep_for_communists }
				}
			}
		}
	
		complete_effect = {
			hidden_effect = { country_event = wtt_infiltration.20 }
			custom_effect_tooltip = chinese_infiltration_tt
		}
	}

	#609 #"east_hebei"
	#610 #"jehol"
	#611 #"south_chahar"
	#612 #"chahar"
	#714 #"heilungkiang"
	#715 #"liaoning"

	communist_infiltration_in_east_hebei = { #609

		icon = generic_civil_support

		visible = {
			609 = {
				is_controlled_by_ROOT_or_subject = yes
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		highlight_states = {
			highlight_state_targets = {
				state = 609 
			} 
		}
		
		available = {
			has_equipment = { infantry_equipment > 999 }
		}

		modifier = {
			command_power_gain = -0.1
		}

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		days_remove = 30
		days_re_enable = 0
		
		cost = 10
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -500
			}
		}

		remove_effect = {
			609 = {
				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 } 
			custom_effect_tooltip = communist_infiltration_tt
			effect_tooltip = {
				every_country = {
					limit = {
						OR = {
							original_tag = PRC
							original_tag = GXC
							original_tag = YUN
							original_tag = SHX
							original_tag = XSM
							original_tag = SIK
						}
						has_government = communism
						any_state = {
							CONTROLLER = {
								OR = {
									tag = ROOT
									OVERLORD = {
										tag = ROOT
									}
								}
							}
							PRC_is_infiltrated_by_PREV = yes
						}
					}
					609 = {
						PRC_execute_infiltration_effects_for_PREV = yes
					}
				}
			}
		}
	}

	communist_infiltration_in_jehol = { #610

		icon = generic_civil_support

		visible = {
			610 = {
				is_controlled_by_ROOT_or_subject = yes
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		highlight_states = {
 			highlight_state_targets = {
				state = 610 
			} 
		}

		available = {
			has_equipment = { infantry_equipment > 999 }
		}

		modifier = {
			command_power_gain = -0.1
		}

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		days_remove = 30
		days_re_enable = 0
		
		cost = 10
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -500
			}
		}

		remove_effect = {
			610 = {
				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 }
			custom_effect_tooltip = communist_infiltration_tt
			effect_tooltip = {
				every_country = {
					limit = {
						OR = {
							original_tag = PRC
							original_tag = GXC
							original_tag = YUN
							original_tag = SHX
							original_tag = XSM
							original_tag = SIK
						}
						has_government = communism
						any_state = {
							CONTROLLER = {
								OR = {
									tag = ROOT
									OVERLORD = {
										tag = ROOT
									}
								}
							}
							PRC_is_infiltrated_by_PREV = yes
						}
					}
					610 = {
						PRC_execute_infiltration_effects_for_PREV = yes
					}
				}
			}
		}
	}

	communist_infiltration_in_south_chahar = { #611

		icon = generic_civil_support

		visible = {
			611 = {
				is_controlled_by_ROOT_or_subject = yes
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		highlight_states = {
 			highlight_state_targets = {
				state = 611 
			} 
		}

		available = {
			has_equipment = { infantry_equipment > 999 }
		}

		modifier = {
			command_power_gain = -0.1
		}

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		days_remove = 30
		days_re_enable = 0
		
		cost = 10
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -500
			}
		}

		remove_effect = {
			611 = {
				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 } 
			custom_effect_tooltip = communist_infiltration_tt
			effect_tooltip = {
				every_country = {
					limit = {
						OR = {
							original_tag = PRC
							original_tag = GXC
							original_tag = YUN
							original_tag = SHX
							original_tag = XSM
							original_tag = SIK
						}
						has_government = communism
						any_state = {
							CONTROLLER = {
								OR = {
									tag = ROOT
									OVERLORD = {
										tag = ROOT
									}
								}
							}
							PRC_is_infiltrated_by_PREV = yes
						}
					}
					611 = {
						PRC_execute_infiltration_effects_for_PREV = yes
					}
				}
			}
		}
	}

	communist_infiltration_in_chahar = { #612

		icon = generic_civil_support

		visible = {
			612 = {
				is_controlled_by_ROOT_or_subject = yes
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		highlight_states = {
 			highlight_state_targets = {
				state = 612 
			} 
		}

		available = {
			has_equipment = { infantry_equipment > 999 }
		}

		modifier = {
			command_power_gain = -0.1
		}

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		days_remove = 30
		days_re_enable = 0
		
		cost = 10
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -500
			}
		}

		remove_effect = {
			612 = {
				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 } 
			custom_effect_tooltip = communist_infiltration_tt
			effect_tooltip = {
				every_country = {
					limit = {
						OR = {
							original_tag = PRC
							original_tag = GXC
							original_tag = YUN
							original_tag = SHX
							original_tag = XSM
							original_tag = SIK
						}
						has_government = communism
						any_state = {
							CONTROLLER = {
								OR = {
									tag = ROOT
									OVERLORD = {
										tag = ROOT
									}
								}
							}
							PRC_is_infiltrated_by_PREV = yes
						}
					}
					612 = {
						PRC_execute_infiltration_effects_for_PREV = yes
					}
				}
			}
		}
	}

	communist_infiltration_in_heilungkiang = { #714

		icon = generic_civil_support

		visible = {
			714 = {
				is_controlled_by_ROOT_or_subject = yes
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		highlight_states = {
			highlight_state_targets = {
				state = 714 
			} 
		}

		available = {
			has_equipment = { infantry_equipment > 999 }
		}

		modifier = {
			command_power_gain = -0.1
		}

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		days_remove = 30
		days_re_enable = 0
		
		cost = 10
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -500
			}
		}

		remove_effect = {
			714 = {
				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 } 
			custom_effect_tooltip = communist_infiltration_tt
			effect_tooltip = {
				every_country = {
					limit = {
						OR = {
							original_tag = PRC
							original_tag = GXC
							original_tag = YUN
							original_tag = SHX
							original_tag = XSM
							original_tag = SIK
						}
						has_government = communism
						any_state = {
							CONTROLLER = {
								OR = {
									tag = ROOT
									OVERLORD = {
										tag = ROOT
									}
								}
							}
							PRC_is_infiltrated_by_PREV = yes
						}
					}
					714 = {
						PRC_execute_infiltration_effects_for_PREV = yes
					}
				}
			}
		}
	}

	communist_infiltration_in_liaoning = { #715

		icon = generic_civil_support

		visible = {
			715 = {
				is_controlled_by_ROOT_or_subject = yes
				has_state_flag = {
					flag = discovered_infiltration
					value > 0
				}
			}
		}

		highlight_states = {
 			highlight_state_targets = {
				state = 715 
			} 
		}

		available = {
			has_equipment = { infantry_equipment > 999 }
		}

		modifier = {
			command_power_gain = -0.1
		}

		ai_will_do = {
			base = 100
			#Pretty damn important
			modifier = {
				add = 100
				always = yes
			}
		}
		
		days_remove = 30
		days_re_enable = 0
		
		cost = 10
		
		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -500
			}
		}

		remove_effect = {
			715 = {
				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 } 
			custom_effect_tooltip = communist_infiltration_tt
			effect_tooltip = {
				every_country = {
					limit = {
						OR = {
							original_tag = PRC
							original_tag = GXC
							original_tag = YUN
							original_tag = SHX
							original_tag = XSM
							original_tag = SIK
						}
						has_government = communism
						any_state = {
							CONTROLLER = {
								OR = {
									tag = ROOT
									OVERLORD = {
										tag = ROOT
									}
								}
							}
							PRC_is_infiltrated_by_PREV = yes
						}
					}
					715 = {
						PRC_execute_infiltration_effects_for_PREV = yes
					}
				}
			}
		}
	}
}