GER_spy_on_FRA = {
	allowed = {
		tag = GER
	}
	
	enable = {
		tag = GER
		FRA = {
			exists = yes
			has_capitulated = no
			NOT = { is_ally_with = GER }
		}
		num_finished_operations = {
			operation = operation_collaboration_government
			target = FRA
			value < 4
		}
	}
	
	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
		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
		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
		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
		any_country = {
			is_allied_ai = yes
			is_ai = no
		}
	}
	
	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 }
			}
		}
	}
	
	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_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
	}
}

GER_spy_on_SOV = {
	
	enable = {
		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
		any_country = {
			is_allied_ai = yes
			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
	}
}

GER_collaboration_on_SOVss = {
	allowed = {
		tag = GER
	}
	
	enable = {
		date > 1940.1.1
		OR = {
			any_country = {
				is_allied_ai = yes
				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
	}
}


