GER_spy_on_FRA = {
	allowed = {
		tag = GER
	}
	
	enable = {
		tag = GER
		date > 1937.1.1
		#NOT = { has_completed_focus = GER_the_four_year_plan }
		FRA = {
			exists = yes
			has_capitulated = no
			NOT = { is_ally_with = GER }
		}
		num_finished_operations = {
			operation = operation_collaboration_government
			target = FRA
			value < 3
		}
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 2000
		mission_target = FRA
	}
	
	ai_strategy = {
		type = operative_operation
		operation = operation_collaboration_government
		value = 2000
		operation_target = FRA
	}

	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = 50
	}
}

GER_spy_on_POL = {
	allowed = {
		tag = GER
	}
	
	enable = {
		tag = GER
		#NOT = { has_completed_focus = GER_the_four_year_plan }
		date > 1937.1.1
		num_finished_operations = {
			operation = operation_collaboration_government
			target = FRA
			value > 3
		}
		POL = {
			exists = yes
			has_capitulated = no
			NOT = { is_ally_with = GER }
		}
		num_finished_operations = {
			operation = operation_collaboration_government
			target = POL
			value < 2
		}
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 1000
		mission_target = POL
	}
	
	ai_strategy = {
		type = operative_operation
		operation = operation_collaboration_government
		value = 1000
		operation_target = POL
	}

	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = 50
	}
}

GER_spy_on_HOL = {
	allowed = {
		tag = GER
	}
	
	enable = {
		tag = GER
		#NOT = { has_completed_focus = GER_the_four_year_plan }
		date > 1938.1.1
		num_finished_operations = {
			operation = operation_collaboration_government
			target = FRA
			value > 3
		}
		num_finished_operations = {
			operation = operation_collaboration_government
			target = POL
			value > 1
		}
		HOL = {
			exists = yes
			has_capitulated = no
			NOT = { is_ally_with = GER }
		}
		num_finished_operations = {
			operation = operation_collaboration_government
			target = HOL
			value < 2
		}
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 1000
		mission_target = HOL
	}
	
	ai_strategy = {
		type = operative_operation
		operation = operation_collaboration_government
		value = 1000
		operation_target = HOL
	}

	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = 50
	}
}

GER_spy_on_BEL = {
	allowed = {
		tag = GER
	}
	
	enable = {
		tag = GER
		#NOT = { has_completed_focus = GER_the_four_year_plan }
		date > 1938.1.1
		num_finished_operations = {
			operation = operation_collaboration_government
			target = FRA
			value > 3
		}
		num_finished_operations = {
			operation = operation_collaboration_government
			target = POL
			value > 1
		}
		num_finished_operations = {
			operation = operation_collaboration_government
			target = HOL
			value > 1
		}
		BEL = {
			exists = yes
			has_capitulated = no
			NOT = { is_ally_with = GER }
		}
		num_finished_operations = {
			operation = operation_collaboration_government
			target = BEL
			value < 2
		}
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 1000
		mission_target = BEL
	}
	
	ai_strategy = {
		type = operative_operation
		operation = operation_collaboration_government
		value = 1000
		operation_target = BEL
	}

	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = 50
	}
}


JAP_spy_on_CHI = {
	allowed = {
		tag = JAP
	}
	
	enable = {
		tag = JAP
		has_government = fascism
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 9999
		mission_target = CHI
	}
	
	ai_strategy = {
		type = operative_operation
		operation = operation_collaboration_government
		value = 9999
		operation_target = CHI
	}
}

JAP_collaboration_on_CHI2 = {
	allowed = {
		tag = JAP
	}
	
	enable = {
		tag = JAP
		has_government = fascism
		num_finished_operations = {
			operation = operation_collaboration_government
			target = CHI
			value < 4
		}
		has_war_with = CHI
		CHI = { surrender_progress > 0.8 }
		date > 1942.1.1 #if we are still stuck
		OR = {
			any_country = {
				is_allied_ai = yes
				is_ai = no
			}
			NEP = { is_ai = yes }
		}
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_operation
		operation = operation_collaboration_government
		value = 9999
		operation_target = CHI
	}
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 1000
		mission_target = CHI
	}
}

JAP_collaboration_on_CHI = {
	allowed = {
		tag = JAP
	}
	
	enable = {
		tag = JAP
		has_government = fascism
		num_finished_operations = {
			operation = operation_collaboration_government
			target = CHI
			value < 3
		}
		OR = {
			any_country = {
				is_allied_ai = yes
				is_ai = no
			}
			AND = {
				has_war_with = CHI
				CHI = { surrender_progress  > 0.5 }
			}
			NEP = { is_ai = yes }
		}
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_operation
		operation = operation_collaboration_government
		value = 9999
		operation_target = CHI
	}
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 1000
		mission_target = CHI
	}

	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = 20
	}

}


JAP_speedrun_CHI = {
	allowed = {
		original_tag = JAP
		has_dlc = "La Resistance"
	}
	enable = {
		has_government = fascism
		NOT = { has_idea = JAP_ichi_go }
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = 15
	}
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 1000
		mission_target = CHI
	}
}

SOV_spy_on_GER = {
	
	enable = {
		OR = {
			tag = SOV
			AND = {
				has_war_with = GER
				GER = { has_war_with = SOV }
			}
		}
		GER = {
			has_war = yes
			is_ai = no
		}
	}
	
	abort = {
		202 = { controller = { has_war_with = SOV } }
		206 = { controller = { has_war_with = SOV } }
	}
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 2000
		mission_target = GER
		num_operatives = 4
		state = 10 
		state = 88
		state = 807
	}
}

SOV_spy_on_GER_2 = {
	allowed = {
		tag = SOV
	}
	
	enable = {
		tag = SOV
		GER = {
			has_war = yes
			is_ai = no
		}
	}
	
	abort = {
		202 = { controller = { has_war_with = SOV } }
		206 = { controller = { has_war_with = SOV } }
	}
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 1000
		mission_target = GER
		num_operatives = 4
		state = 10 
		state = 206
		state = 202
	}
}

allies_stack_up_on_GER_non_d_day = {
	
	enable = {
		OR = {
			tag = ENG
			is_in_faction_with = ENG
			is_subject_of = ENG
		}
		NOT = { 
			OR = {
				has_idea = d_day_preparation_1 
				has_idea = d_day_preparation_2
				has_idea = d_day_preparation_3
			} 
		}
		has_global_flag = FRA_already_surrended
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 1000
		mission_target = GER
		num_operatives = 2
		state = 10 
		state = 88
	}
}

allies_stack_up_on_ITA_d_day = {
	
	enable = {
		OR = {
			tag = ENG
			is_in_faction_with = ENG
			is_subject_of = ENG
		}
		OR = {
			has_idea = d_day_preparation_1 
			has_idea = d_day_preparation_2
			has_idea = d_day_preparation_3
		}
		has_global_flag = FRA_already_surrended
		NOT = {
			OR = {
				ITA = { surrender_progress > 0.2 }
				ITA = { has_civil_war = yes }
				date > 1943.6.1
			}
		}
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 1000
		mission_target = ITA
		num_operatives = 3
		state = 2 
		state = 162
		state = 115
	}
}

allies_stack_up_on_normandy_d_day = {
	
	enable = {
		OR = {
			tag = ENG
			is_in_faction_with = ENG
			is_subject_of = ENG
		}
		OR = {
			has_idea = d_day_preparation_1 
			has_idea = d_day_preparation_2
			has_idea = d_day_preparation_3
		}
		has_global_flag = FRA_already_surrended
		OR = {
			ITA = { surrender_progress > 0.2 }
			ITA = { has_civil_war = yes }
			date > 1943.3.1
		}
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 1000
		mission_target = VIC
		num_operatives = 3
		state = 16 
		state = 24
		state = 29
	}
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 1000
		mission_target = GER
		num_operatives = 3
		state = 16 
		state = 24
		state = 29
	}
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 1000
		num_operatives = 3
		state = 16 
		state = 24
		state = 29
	}
}
allies_stack_up_on_japan_z_day = {
	
	enable = {
		OR = {
			tag = ENG
			is_in_faction_with = ENG
			is_subject_of = ENG
		}
		has_war_with = JAP
		NOT = {
			any_country = {
				has_war_with = ENG
				capital_scope = { is_on_continent = europe }
			}
		}
		is_japanese_endsieg = yes
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 1000
		mission_target = JAP
		num_operatives = 3
		state = 529 
		state = 282
		state = 531
	}
}

GER_spy_on_SOV = {
	
	enable = {
		is_historical_focus_on = yes
		OR = {
			tag = GER
			is_in_faction_with = GER
		}
		is_major = yes
		FRA = {
			OR = {
				exists = no
				has_capitulated = yes
				is_ally_with = GER 
			}
		}
		date > 1939.1.1
		OR = {
			any_country = {
				is_allied_ai = yes
				is_ai = no
			}
			any_country = {
				has_war_with = SOV
				is_ai = no
			}
		}
		SOV = { surrender_progress < 0.4 }
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 12000
		mission_target = SOV
		num_operatives = 3
		state = 202 
		state = 206
		state = 242
	}
	
	ai_strategy = {
		type = operative_operation
		operation = operation_infiltrate_armed_forces_army
		value = 2000
		operation_target = GER
	}
}

GER_collaboration_on_SOVss = {
	allowed = {
		tag = GER
	}
	
	enable = {
		date > 1940.1.1
		OR = {
			any_country = {
				is_allied_ai = yes
				is_ai = no
			}
			any_country = {
				has_war_with = SOV
				is_ai = no
			}
			SOV = { surrender_progress > 0.4 }
		}
		num_finished_operations = {
			operation = operation_collaboration_government
			target = SOV
			value < 4
		}
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_operation
		operation = operation_collaboration_government
		value = 2000
		operation_target = SOV
	}

	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = 100
	}
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 2000
		mission_target = SOV
	}
}


SOV_spy_on_EST = {
	allowed = {
		tag = SOV
	}
	
	enable = {
		is_historical_focus_on = yes
		NOT = { has_global_flag = SOV_welfare_disabled }
		num_finished_operations = {
			operation = operation_collaboration_government
			target = EST
			value < 3
		}
		EST = {
			exists = yes
			has_war = no
			is_in_faction = no
		}
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 1000
		mission_target = EST
	}
	
	ai_strategy = {
		type = operative_operation
		operation = operation_collaboration_government
		value = 1000
		operation_target = EST
	}

	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = 15
	}
}


SOV_spy_on_LAT = {
	allowed = {
		tag = SOV
	}
	
	enable = {
		is_historical_focus_on = yes
		NOT = { has_global_flag = SOV_welfare_disabled }
		num_finished_operations = {
			operation = operation_collaboration_government
			target = LAT
			value < 3
		}
		LAT = {
			exists = yes
			has_war = no
			is_in_faction = no
		}
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 500
		mission_target = LAT
	}
	
	ai_strategy = {
		type = operative_operation
		operation = operation_collaboration_government
		value = 500
		operation_target = LAT
	}

	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = 15
	}
}
SOV_spy_on_GER_infiltrate = {
	allowed = {
		original_tag = SOV
	}
	
	enable = {
		is_historical_focus_on = yes
		NOT = { has_global_flag = SOV_welfare_disabled }
		num_finished_operations = {
			operation = operation_collaboration_government
			target = LAT
			value > 2
		}
		num_finished_operations = {
			operation = operation_collaboration_government
			target = EST
			value > 2
		}
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 2000
		mission_target = GER
	}
	
	ai_strategy = {
		type = operative_operation
		operation = operation_infiltrate_armed_forces_army
		value = 2000
		operation_target = GER
	}

	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = 15
	}
}
SOV_JAP_means_nothing_to_us = {
	allowed = {
		tag = SOV
	}
	
	enable = {
		tag = SOV
		NOT = { has_war_with = JAP }
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = -3000
		mission_target = JAP
	}
}
JAP_SOV_means_nothing_to_us = {
	allowed = {
		tag = JAP
	}
	
	enable = {
		tag = JAP
		NOT = { has_war_with = SOV }
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = -3000
		mission_target = SOV
	}
}
ENG_minor_means_nothing_to_us = {
	reversed = yes
	allowed = {
		tag = ENG
	}
	
	enable = {
		is_major = no
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = -1000
		mission_target = ENG
	}
}
ENG_spy_on_GER = {
	allowed = {
		original_tag = ENG
	}
	
	enable = {
		is_historical_focus_on = yes
		GER = {
			exists = yes
			has_capitulated = no
			NOT = { is_ally_with = ENG }
		}
		num_finished_operations = {
			operation = operation_infiltrate_armed_forces_army
			target = GER
			value < 3
		}
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = operative_mission
		mission = build_intel_network
		value = 2000
		mission_target = GER
	}
	
	ai_strategy = {
		type = operative_operation
		operation = operation_infiltrate_armed_forces_army
		value = 2000
		operation_target = GER
	}

	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = 15
	}
}