# befriend
# conquer
# antagonize
# build_ship
# build_army
# unit_ratio
# build_building
# research_tech
# garrison
# protect
# influence

# ai_strategy = {
#	type = strategic_air_importance
#	id = 1 #Strategic Region ID - Southern England
#	value = 10000 #value of stocked main front in active combat is usually around 35,000
# }

SOV_dont_naval_invade = {
	allowed = {
		OR = {
			tag = SOV
		}

	}
	enable = {
		date > 1945.1.1
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = invade
		id = "BLR"
		value = -9999
	}
	ai_strategy = {
		type = invade
		id = "HOL"
		value = -9999
	}
	ai_strategy = {
		type = invade
		id = "GER"
		value = -9999
	}
	ai_strategy = {
		type = invade
		id = "NOR"
		value = -9999
	}
	ai_strategy = {
		type = invade
		id = "ITA"
		value = -9999
	}
}

SOV_dont_naval_invade_2 = {
	allowed = {
		tag = SOV
	}
	enable = {
		date < 1947.6.1
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = invade
		id = "JAP"
		value = -9999
	}
}

SOV_garrison_MOD = {
	allowed = {
		original_tag = SOV
	}

	enable = {
		has_war_with = GER
		NOT = { has_global_flag = scenario_debuffs_off }
	}

	abort = {
		OR = {
			has_global_flag = scenario_debuffs_off
			SOV = {
				controls_province = 6521			
			}
			USA = {
				controls_province = 6521			
			}		
		}
	}

	ai_strategy = {
    	type = garrison
    	value = -50000
	}
	ai_strategy = {
    	type = garrison_reinforcement_priority
    	value = -50000
	}

	ai_strategy = {
    	type = front_unit_request
    	tag = GER
    	value = 500
		}
	ai_strategy = {
    	type = front_unit_request
    	tag = BLR
    	value = 200
		}
}

ROM_defend_budapest = {
	allowed = {
		original_tag = ROM
	}
	enable = {
		is_in_faction_with = SOV
	}

	abort = {
		NOT = {
			HUN = {
				controls_province = 13369
				controls_province = 13370
			}
		}
	}

	ai_strategy = {
    	type = front_unit_request
    	tag = HUN
    	value = 10000
	}
	ai_strategy = {
    	type = garrison
    	value = -50000
	}
	ai_strategy = {
    	type = garrison_reinforcement_priority
    	value = -50000
	}
}

SOV_leave_yugoslavia_alone = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		is_in_faction_with = YUG
	}

	abort = {
		NOT = {
			YUG = {
				controls_state = 107
			}
		}
	}

	ai_strategy = {
		type = dont_defend_ally_borders
		id = "YUG"
		value = 500
	}
}

SOV_wait_for_ve_day = {
	allowed = {
		original_tag = SOV
	}

	enable = {
		date < 1945.7.1
		has_war_with = GER
	}

	abort_when_not_enabled = yes

	ai_strategy = {
    	type = declare_war
    	id = JAP
    	value = -10000
	}
}

SOV_prepare_for_manchuria_offensive = {
	allowed = {
		original_tag = SOV
	}

	enable = {
		NOT = {
			has_war_with = GER
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
    	type = prepare_for_war
    	id = JAP
    	value = 10000
	}	
}

SOV_pommerania_offensive  = {
	allowed = {
		original_tag = SOV
	}

	enable = {
		date > 1945.2.28
		date < 1945.3.16
		has_war_with = GER
	}

	abort = {
		date > 1945.3.16
	#	OR = {
	#		has_global_flag = scenario_debuffs_off
	#		date > 1945.5.25
    #
	#	}
	}

	ai_strategy = {
    	type = front_armor_score
    	id = GER
    	value = 1000
	}

	ai_strategy = {
    	type = front_unit_request
    	state = 63
    	value = 500
		}
	ai_strategy = {
    	type = front_unit_request
    	state = 68
    	value = 500
		}

	ai_strategy = {
		type = front_control
		state = 63
		priority = 150
		ratio = 0.2
		ordertype = front
		execution_type = rush
		execute_order = yes
	}
	ai_strategy = {
		type = front_control
		state = 68
		priority = 150
		ratio = 0.2
		ordertype = front
		execution_type = rush
		execute_order = yes
	}

	ai_strategy = {
    	type = ignore_army_incompetence
    	value = 1000
	}
}

SOV_wait_for_vienna  = {
	allowed = {
		original_tag = SOV
	}

	enable = {
		date < 1945.3.16
		has_war_with = GER
	}

	abort = {
		date > 1945.3.15
	}

	ai_strategy = {
		type = front_control
		id = 22
		id = 21
		priority = 1000
		ordertype = front
		execution_type = careful
		execute_order = no
	}
	ai_strategy = {
		type = front_unit_request
		strategic_region = 21
		value = -100
	}
	ai_strategy = {
		type = front_unit_request
		strategic_region = 22
		value = -100
	}
}


SOV_prepare_for_berlin  = {
	allowed = {
		original_tag = SOV
	}

	enable = {
		date > 1945.3.15
		date < 1945.4.5
		has_war_with = GER
	}

	abort = {
		controls_state = 68
	}

	ai_strategy = {
    	type = front_armor_score
    	id = GER
    	value = 1000
	}

	ai_strategy = {
    	type = front_unit_request
    	state = 68
    	value = 500
	}

	ai_strategy = {
		type = front_control
		state = 68
		ratio = 0.2
		priority = 10000
		ordertype = front
		execution_type = rush
		execute_order = yes
	}

	ai_strategy = {
    	type = ignore_army_incompetence
    	value = 1000
	}

}


SOV_battle_of_berlin  = {
	allowed = {
		original_tag = SOV
	}

	enable = {
		date > 1945.4.13
		has_war_with = GER
	}

	abort = {
		OR = {
			SOV = {
				controls_province = 6521	
				controls_state = 970		
			}
			ENG = {
				controls_province = 6521	
				controls_state = 970		
			}	
			USA = {
				controls_province = 6521	
				controls_state = 970		
			}	
			FRA = {
				controls_province = 6521	
				controls_state = 970		
			}		
		}
		OR = {
			has_global_flag = scenario_debuffs_off
			date > 1945.5.25

		}
	}

	ai_strategy = {
    	type = front_armor_score
    	id = GER
    	value = 1000
	}

	ai_strategy = {
    	type = front_unit_request
    	state = 971
    	value = 500
		}

	ai_strategy = {
		type = front_control
		state = 971
		ratio = 0.01
		priority = 1000
		ordertype = front
		execution_type = rush
		execute_order = yes
	}

	ai_strategy = {
    	type = ignore_army_incompetence
    	value = 1000
	}

}


#SOV_blitzkrieg  = {
#	allowed = {
#		original_tag = SOV
#	}
#
#	enable = {
#		date > 1944.4.13 
#		has_war_with = GER
#	}
#
#	abort = {
#		SOV = {
#			controls_province = 6521			
#		}
#
#	}
#
#	ai_strategy = {
#		type = front_control
#
#		state = 4
#
#		ratio = 0.5
#
#		priority = 100
#		ordertype = front
#		execution_type = rush
#		execute_order = yes
#	}
#
#}

#SOV_blitzkrieg_2  = {
#	allowed = {
#		original_tag = SOV
#	}
#
#	enable = {
#		date > 1943.4.13 
#		has_war_with = GER
#	}
#
#	abort = {
#		SOV = {
#			controls_province = 11666
#		}
#
#	}
#
#	ai_strategy = {
#		type = front_control
#
#		state = 64
#
#		ratio = 0.5
#
#		priority = 100
#		ordertype = front
#		execution_type = rush
#		execute_order = yes
#	}
#
#}

SOV_unit_production = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		always = yes
	}
	abort = {
		always = no
	}

	ai_strategy = {
		type = role_ratio
		id = garrison
		value = 1
	}

	# Old garrison system against resistance
	# ai_strategy = {
	# 	type = role_ratio
	# 	id = suppression
	# 	value = 3
	# }

	ai_strategy = {
		type = role_ratio
		id = paratroopers
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = mountaineers
		value = 2
	}

	ai_strategy = {
		type = role_ratio
		id = marines
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = cavalry
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = motorized
		value = 1
	}

	ai_strategy = {
		type = role_ratio
		id = mechanized
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 5
	}

	ai_strategy = {
		type = role_ratio
		id = infantry
		value = 70 #because doctrine 70
	}

	#Air unit factors
	ai_strategy = {
		type = unit_ratio
		id = fighter
		value = 20
	}

	ai_strategy = {
		type = unit_ratio
		id = cas
		value = 2 #because doctrine this = 15
	}

	ai_strategy = {
		type = unit_ratio
		id = tactical_bomber
		value = 5
	}

	ai_strategy = {
		type = unit_ratio
		id = strategic_bomber
		value = -50 # we can add a strategy later to increase this once Germany is beaten
	}

	ai_strategy = {
		type = unit_ratio
		id = naval_bomber
		value = 4
	}


	# Naval unit factors
	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = 1
	}
	ai_strategy = {
		type = unit_ratio
		id = carrier
		value = 1
	}
	ai_strategy = {
		type = unit_ratio
		id = submarine
		value = 30
	}

	ai_strategy = {
		type = unit_ratio
		id = screen_ship
		value = 20
	}

	ai_strategy = {
		type = unit_ratio
		id = convoy
		value = 20
	}

	ai_strategy = {
		type = equipment_production_factor
		id = tactical_bomber
		value = -20
	}

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -60 #Accounted for
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = -30
	}

	ai_strategy = {
		type = equipment_production_factor
		id = naval_bomber
		value = -100
	}

	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 15
	}

	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = 80
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = 4
	}

	ai_strategy = {
		type = equipment_production_factor
		id = armor
		value = 5
	}
}

SOV_anti_armor = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		ai_wants_divisions > 5 #Decreasing the amount of motorized the AI wants

		any_enemy_country = {
			ROOT = {
				estimated_intel_max_armor = {
					tag = PREV
					value > 25
				}
			}
		}
	}
	abort = {
		ai_wants_divisions < 6 #Decreasing the amount of motorized the AI wants
	}

	ai_strategy = {
		type = role_ratio
		id = motorized
		value = 5
	}
}

southern_thrust = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_completed_focus = SOV_the_southern_thrust
		OR = {
			country_exists = IRQ
			country_exists = PER
			country_exists = AFG
		}
	}
	abort = {
		NOT = {
			country_exists = IRQ
			country_exists = PER
			country_exists = AFG
		}
	}

	ai_strategy = {
		type = antagonize
		id = "PER"
		value = 200
	}
	ai_strategy = {
		type = antagonize
		id = "AFG"
		value = 150
	}
	ai_strategy = {
		type = antagonize
		id = "IRQ"
		value = 100
	}
}

claims_on_poland = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_completed_focus = SOV_claims_on_poland
		country_exists = POL
	}
	abort = {
		NOT = {
			country_exists = POL
		}
	}

	ai_strategy = {
		type = antagonize
		id = "POL"
		value = 200
	}
}

claims_on_finland = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_completed_focus = SOV_secure_leningrad
		country_exists = FIN
		NOT = { controls_state = 146 } #Karelija
		date > 1940.8.1
	}
	abort = {
		OR = {
			NOT = {
				country_exists = FIN
			}
			FIN = {
				has_government = ROOT
			}
			controls_state = 146 #Karelija
		}
	}

	ai_strategy = {
		type = antagonize
		id = "FIN"
		value = 200
	}
}

claims_on_sinkiang = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_completed_focus = SOV_spheres_of_influence_in_china
		country_exists = CHI
	}
	abort = {
		NOT = {
			country_exists = CHI
		}
	}

	ai_strategy = {
		type = antagonize
		id = "CHI"
		value = 200
	}
}

japan_ally = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_completed_focus = SOV_reconcile_japan
		country_exists = JAP
	}
	abort = {
		NOT = { country_exists = JAP }
	}

	ai_strategy = {
		type = befriend
		id = "JAP"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "JAP"
		value = 200
	}
}

germany_enemy = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_completed_focus = SOV_anti_fascist_policies
		country_exists = GER
		OR = {
			date > 1942.1.1
			has_war_with = GER
		}
	}
	abort = {
		NOT = { country_exists = GER }
	}

	ai_strategy = {
		type = antagonize
		id = "GER"
		value = 200
	}
}

spanish_civil_war_SOV = {
	allowed = {
		original_tag = SOV
		NOT = { has_dlc = "La Resistance" }
	}
	enable = {
		has_government = communism
		has_global_flag = spanish_civil_war
		NOT = { has_global_flag = scw_over }
	}

	abort = {
		OR = {
			SPR = { has_civil_war = no }
			has_global_flag = scw_over
		}
	}

	ai_strategy = {
		type = befriend
		id = "SPR"
		value = 100
	}
}

spanish_civil_war_SOV_resistance = {
	allowed = {
		original_tag = SOV
		has_dlc = "La Resistance"
	}
	enable = {
		has_government = communism
		country_exists = SPD
		has_global_flag = spanish_civil_war
		NOT = { has_global_flag = scw_over }
	}

	abort = {
		has_global_flag = scw_over
	}

	ai_strategy = {
		type = befriend
		id = "SPD"
		value = 100
	}
	ai_strategy = {
		type = support
		id = "SPD"
		value = 100
	}
	ai_strategy = {
		type = send_volunteers_desire
		id = "SPD"
		value = 100
	}
}

SOV_template_design_1 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date < 1940.1.1
	}
	abort = {
		date > 1940.1.1
	}

	ai_strategy = {
		type = template_prio
		id = motorized
		value = 10
	}

	ai_strategy = {
		type = template_prio
		id = cavalry
		value = -100
	}

	ai_strategy = {
		type = template_prio
		id = light_armor
		value = 50
	}

	ai_strategy = {
		type = template_prio
		id = medium_armor
		value = -10
	}

	ai_strategy = {
		type = template_prio
		id = heavy_armor
		value = -50
	}

	ai_strategy = {
		type = template_prio
		id = paratroopers
		value = -50
	}

	ai_strategy = {
		type = template_prio
		id = infantry
		value = 50
	}
}

SOV_template_design_2 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1940.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = template_prio
		id = mechanized
		value = 20
	}

	ai_strategy = {
		type = template_prio
		id = cavalry
		value = -100
	}

	ai_strategy = {
		type = template_prio
		id = light_armor
		value = 10
	}

	ai_strategy = {
		type = template_prio
		id = medium_armor
		value = 50
	}

	ai_strategy = {
		type = template_prio
		id = modern_armor
		value = 60
	}

	ai_strategy = {
		type = template_prio
		id = heavy_armor
		value = 20
	}

	ai_strategy = {
		type = template_prio
		id = paratroopers
		value = -50
	}

	ai_strategy = {
		type = template_prio
		id = infantry
		value = 10
	}
}

SOV_pp_spending = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_manpower < 100000
		has_political_power < 200
	}
	abort = {
		OR = {
			has_manpower > 100000
			has_political_power > 200
			date > 1944.1.1
		}
	}

	ai_strategy = { # dont burn PP on admirals if you need manpower laws
		type = pp_spend_priority
		id = admiral
		value = -100
	}
}

SOV_decision_pp_spending = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			has_manpower < 100000
			AND = {
				has_war = yes
				has_manpower < 1000000
			}
		}
		has_political_power < 200
		OR = {
			has_idea = volunteer_only
			has_idea = limited_conscription
			has_idea = extensive_conscription
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = { # dont burn PP on decisions and other shit when we are desparate for manpower laws
		type = pp_spend_priority
		id = decision
		value = -100
	}
	ai_strategy = {
		type = pp_spend_priority
		id = guarantee
		value = -200
	}
	ai_strategy = {
		type = pp_spend_priority
		id = relation
		value = -200
	}
}

SOV_play_nice_with_ribbentrop_pact = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_global_flag = sov_yes_pact
		GER = { has_war_with = POL }
		date < 1941.1.1
	}
	abort = {
		OR ={
			GER = { has_war_with = SOV }
			NOT = { GER = { has_war_with = POL } }
			date > 1941.1.1
		}
	}

	# respect the spirit of the law ;)
	ai_strategy = {
		type = send_volunteers_desire
		id = "POL"
		value = -100
	}
}
SOV_naval_role_ratios_historical = {
	allowed = {
		has_dlc = "Man the Guns"
		original_tag = SOV
	}

	enable = {
		always = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bb
		value = -25
	}

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bc
		value = -100
	}

	ai_strategy = {
		type = role_ratio
		id = naval_carrier
		value = -5
	}

	ai_strategy = {
		type = role_ratio
		id = naval_submarine
		value = 150
	}

	ai_strategy = {
		type = role_ratio
		id = naval_screen
		value = 150
	}

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_light
		value = 15
	}

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_heavy
		value = -15
	}

	ai_strategy = {
		type = role_ratio
		id = naval_mine_sweeper
		value = 15
	}

	ai_strategy = {
		type = role_ratio
		id = naval_mine_layer
		value = 80
	}
}


#SOV_dont_upgrade_to_weapons_2_too_early = {
#	allowed = {
#		original_tag = SOV
#	}
#	enable = {
#		OR = {
#			date < "1943.1.1" # stock up on lots of rifles, we got the manpower
#			AND = {
#				date > "1943.8.1"
#				surrender_progress < 0.1 # if we arent losing badly its ok now
#			}
#		}
#	}
#
#	abort_when_not_enabled = yes
#
#	ai_strategy = {
#		type = production_upgrade_desire_offset
#		id = infantry_equipment_2
#		value = -100
#	}
#}

SOV_home_land_is_safe = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		always = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = garrison
		value = -25
	}
}

SOV_the_nkvd_is_all_the_intel_we_need = {
	allowed = {
		original_tag = SOV
		has_dlc = "La Resistance"
	}
	enable = {
		has_government = communism
		num_of_civilian_factories < 90
		num_of_civilian_factories > 35
	}
	abort = {
		OR = {
			num_of_civilian_factories > 90
		}
	}
	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = -20
	}
}

SOV_dont_mess_with_volunteers_for_european_democratic_nations = { # Reverse strategy
	reversed = yes
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_government = democratic
		SOV = {
			has_government = communism
		}
		NOT = {
			original_tag = SPR
		}

		capital_scope = {
			is_on_continent = europe # lets not mess with europe
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_volunteers_desire
		id = "SOV"
		value = -500
	}
}

SOV_dont_send_volunteers_that_early_to_china = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		JAP = { has_war_with = CHI }
		country_exists = CHI
		CHI = {
			surrender_progress < 0.8
		}
	}

	abort = {
		CHI = {
			surrender_progress > 0.8
		}
		OR = {
			#Soviet focus plans are set so that they support a Chinese tag in 39-40
			AND = {
				has_completed_focus = SOV_the_gobi_gambit
				country_exists = SIK
				SIK = { has_war_with = JAP }
			}
			AND = {
				has_completed_focus = SOV_two_red_flags
				country_exists = PRC
				PRC = { has_war_with = JAP }
			}
			AND = {
				has_completed_focus = SOV_support_the_kuomintang
				country_exists = CHI
				CHI = { has_war_with = JAP }
			}
		}
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "CHI"
		value = -800
	}
	ai_strategy = {
		type = send_volunteers_desire
		id = "GXC"
		value = -800
	}
	ai_strategy = {
		type = send_volunteers_desire
		id = "PRC"
		value = -800
	}
}


SOV_dont_send_lend_lease_that_early_to_china = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		JAP = { has_war_with = CHI }
		country_exists = CHI
		CHI = {
			surrender_progress < 0.4
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_lend_lease_desire
		id = CHI
		value = -999
	}
}

SOV_have_some_train_production = {
	allowed = {
		original_tag = SOV
	}

	enable = {
		date > 1936.7.1
		num_of_military_factories > 50
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories
		id = train
		value = 3
	}
}

# Make people sceptic about sending support to the Whites - again
SOV_dont_support_whites = {

	allowed = { has_dlc = "No Step Back" }
	enable = {
		SOV = { SOV_is_exiles = yes}
		NOT = {
			tag = SOV
		}
	}

	abort = {
		has_global_flag = SOV_soviet_civil_war_over
	}

	ai_strategy = {
		type = alliance
		id = SOV
		value = -200
	}
	ai_strategy = {
		type = befriend
		id = SOV
		value = -100
	}
	ai_strategy = {
		type = support
		id = SOV
		value = -100
	}
	ai_strategy = {
		type = send_volunteers_desire
		id = SOV
		value = -200
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = SOV
		value = -200
	}
}

# Don't ally the Soviet Union if it has civil war
SOV_dont_ally_us_soviet_civil_was = {
	allowed = { always = yes }
	enable = {
		has_global_flag = SOV_soviet_civil_war
		NOT = {
			original_tag = SOV
		}
	}
	abort = {
		has_global_flag = SOV_soviet_civil_war_over
	}
	ai_strategy = {
		type = alliance
		id = SOU
		value = -500
	}
}

SOV_dont_join_wars_during_civil_war = {
	allowed = { always = yes }
	enable = {
		has_global_flag = SOV_soviet_civil_war
		NOT = {
			original_tag = SOV
		}
	}
	abort = {
		has_global_flag = SOV_soviet_civil_war_over
	}
	ai_strategy = {
		type = dont_join_wars_with
		id = SOU
		# target_country = SOV
		value = 200
	}
}

# Make countries want to support the opposition IF
SOV_support_opposition_with_arms = {

	allowed = { always = yes }
	enable = {
		OR = {
			AND = {
				tag = JAP
				SOV = { has_country_flag = SOV_CSW_transfer_vladivostok_flag }
			}
			AND = {
				tag = JAP
				SOV = { has_country_flag = SOV_CSW_transfer_sakhalin_flag }
			}
			AND = {
				tag = GER
				SOV = { has_country_flag = SOV_CSW_baku_oil_flag }
			}
			AND = {
				tag = GER
				SOV = { has_country_flag = SOV_CSW_ukraine_germany_flag }
			}
			AND = {
				tag = ENG
				SOV = { has_country_flag = SOV_CSW_belarus_uk_flag }
			}
			has_country_flag = SOV_supporting_trotsky_flag
		}
		NOT = {
			tag = SOV
		}
	}

	abort = {
		has_global_flag = SOV_soviet_civil_war_over
	}
	ai_strategy = {
		type = send_volunteers_desire
		id = SOV
		value = 100
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = SOV
		value = 300
	}
}

SOV_scorched_earth_german_front_baltics = {

	allowed = { original_tag = SOV }
	enable = {
		has_war_with = GER
		NOT = {
			has_country_flag = SOV_barbarossa_scorched_earth_delay #a 45 day delay at the start of the war before Soviets start doing this
		}
		NOT = { # please don't spend PP on blowing up your own stuff when you need it for manpower
			has_manpower < 1000000
			has_political_power < 200
			OR = {
				has_idea = volunteer_only
				has_idea = limited_conscription
				has_idea = extensive_conscription
			}
		}
		count_triggers = {
			amount = 4 #if 4 baltic states are owned by an enemy, burn the rest of the Baltics
			814 = { CONTROLLER = { has_war_with = SOV } }
			11 = { CONTROLLER = { has_war_with = SOV } }
			189 = { CONTROLLER = { has_war_with = SOV } }
			815 = { CONTROLLER = { has_war_with = SOV } }
			190 = { CONTROLLER = { has_war_with = SOV } }
			809 = { CONTROLLER = { has_war_with = SOV } }
			810 = { CONTROLLER = { has_war_with = SOV } }
			808 = { CONTROLLER = { has_war_with = SOV } }
			811 = { CONTROLLER = { has_war_with = SOV } }
			13 = { CONTROLLER = { has_war_with = SOV } }
			812 = { CONTROLLER = { has_war_with = SOV } }
			813 = { CONTROLLER = { has_war_with = SOV } }
			191 = { CONTROLLER = { has_war_with = SOV } }
		}
	}

	abort = {
		OR = {
			NOT = { has_war_with = GER }
			strength_ratio = { tag = GER ratio > 1.5 }
			date > 1944.1.1
		}
	}

	ai_strategy = {
		type = scorched_earth_prio
		id = SOV
		states = {
			814
			11
			189
			815
			190
			809
			810
			808
			811
			13
			812
			813
			191
		}
	}
}

SOV_scorched_earth_german_front_Poland = {

	allowed = { original_tag = SOV }
	enable = {
		has_war_with = GER
		NOT = {
			has_country_flag = SOV_barbarossa_scorched_earth_delay #a 45 day delay at the start of the war before Soviets start doing this
		}
		NOT = { # please don't spend PP on blowing up your own stuff when you need it for manpower
			has_manpower < 1000000
			has_political_power < 200
			OR = {
				has_idea = volunteer_only
				has_idea = limited_conscription
				has_idea = extensive_conscription
			}
		}
		count_triggers = {
			amount = 2 #if 2 states are owned by an enemy, burn the rest of the area
			784 = { CONTROLLER = { has_war_with = SOV } }
			96 = { CONTROLLER = { has_war_with = SOV } }
			95 = { CONTROLLER = { has_war_with = SOV } }
			94 = { CONTROLLER = { has_war_with = SOV } }
			93 = { CONTROLLER = { has_war_with = SOV } }
			91 = { CONTROLLER = { has_war_with = SOV } }
			89 = { CONTROLLER = { has_war_with = SOV } }

		}
	}

	abort = {
		OR = {
			NOT = { has_war_with = GER }
			strength_ratio = { tag = GER ratio > 1.5 }
			date > 1944.1.1
		}
	}

	ai_strategy = {
		type = scorched_earth_prio
		id = SOV
		states = {
			784
			96
			95
			94
			93
			91
			89
		}
	}
}

SOV_scorched_earth_german_front_north = {

	allowed = { original_tag = SOV }
	enable = {
		has_war_with = GER
		NOT = {
			has_country_flag = SOV_barbarossa_scorched_earth_delay #a 45 day delay at the start of the war before Soviets start doing this
		}
		NOT = { # please don't spend PP on blowing up your own stuff when you need it for manpower
			has_manpower < 1000000
			has_political_power < 200
			OR = {
				has_idea = volunteer_only
				has_idea = limited_conscription
				has_idea = extensive_conscription
			}
		}
		count_triggers = {
			amount = 2 #if 2 states are owned by an enemy, burn the rest of the area
			208 = { CONTROLLER = { has_war_with = SOV } }
			209 = { CONTROLLER = { has_war_with = SOV } }
			210 = { CONTROLLER = { has_war_with = SOV } }
			195 = { CONTROLLER = { has_war_with = SOV } }
			263 = { CONTROLLER = { has_war_with = SOV } }
			246 = { CONTROLLER = { has_war_with = SOV } }


		}
	}

	abort = {
		OR = {
			NOT = { has_war_with = GER }
			strength_ratio = { tag = GER ratio > 1.5 }
			date > 1944.1.1
		}
	}

	ai_strategy = {
		type = scorched_earth_prio
		id = SOV
		states = {
			208
			209
			210
			195
			263
			246
		}
	}
}

SOV_scorched_earth_german_front_center = {

	allowed = { original_tag = SOV }
	enable = {
		has_war_with = GER
		NOT = {
			has_country_flag = SOV_barbarossa_scorched_earth_delay #a 45 day delay at the start of the war before Soviets start doing this
		}
		NOT = { # please don't spend PP on blowing up your own stuff when you need it for manpower
			has_manpower < 1000000
			has_political_power < 200
			OR = {
				has_idea = volunteer_only
				has_idea = limited_conscription
				has_idea = extensive_conscription
			}
		}
		count_triggers = {
			amount = 4 #if 4 states are owned by an enemy, burn the rest of the area
			207 = { CONTROLLER = { has_war_with = SOV } }
			206 = { CONTROLLER = { has_war_with = SOV } }
			204 = { CONTROLLER = { has_war_with = SOV } }
			194 = { CONTROLLER = { has_war_with = SOV } }
			201 = { CONTROLLER = { has_war_with = SOV } }
			199 = { CONTROLLER = { has_war_with = SOV } }
			202 = { CONTROLLER = { has_war_with = SOV } }
			193 = { CONTROLLER = { has_war_with = SOV } }
			241 = { CONTROLLER = { has_war_with = SOV } }
			242 = { CONTROLLER = { has_war_with = SOV } }
			243 = { CONTROLLER = { has_war_with = SOV } }
			224 = { CONTROLLER = { has_war_with = SOV } }
		}
	}

	abort = {
		OR = {
			NOT = { has_war_with = GER }
			strength_ratio = { tag = GER ratio > 1.5 }
			date > 1944.1.1
		}
	}

	ai_strategy = {
		type = scorched_earth_prio
		id = SOV
		states = {
			207
			206
			204
			194
			201
			199
			202
			193
			241
			242
			243
			224
		}
	}
}

SOV_scorched_earth_german_front_moscow = {

	allowed = { original_tag = SOV }
	enable = {
		has_war_with = GER
		NOT = {
			has_country_flag = SOV_barbarossa_scorched_earth_delay #a 45 day delay at the start of the war before Soviets start doing this
		}
		NOT = { # please don't spend PP on blowing up your own stuff when you need it for manpower
			has_manpower < 1000000
			has_political_power < 200
			OR = {
				has_idea = volunteer_only
				has_idea = limited_conscription
				has_idea = extensive_conscription
			}
		}
		count_triggers = {
			amount = 1 #if 1 states are owned by an enemy, burn the rest of the area
			219 = { CONTROLLER = { has_war_with = SOV } }
			246 = { CONTROLLER = { has_war_with = SOV } }
			242 = { CONTROLLER = { has_war_with = SOV } }
			205 = { CONTROLLER = { has_war_with = SOV } }
			223 = { CONTROLLER = { has_war_with = SOV } }

		}
	}

	abort = {
		OR = {
			NOT = { has_war_with = GER }
			strength_ratio = { tag = GER ratio > 1.5 }
			date > 1944.1.1
		}
		controls_state = 220
		controls_state = 224
		controls_state = 243
		controls_state = 207
		controls_state = 210
	}

	ai_strategy = {
		type = scorched_earth_prio
		id = SOV
		states = {
			219
			246
			242
			205
			223
		}
	}
}

SOV_scorched_earth_german_front_stalingrad = {

	allowed = { original_tag = SOV }
	enable = {
		has_war_with = GER
		NOT = {
			has_country_flag = SOV_barbarossa_scorched_earth_delay #a 45 day delay at the start of the war before Soviets start doing this
		}
		NOT = { # please don't spend PP on blowing up your own stuff when you need it for manpower
			has_manpower < 1000000
			has_political_power < 200
			OR = {
				has_idea = volunteer_only
				has_idea = limited_conscription
				has_idea = extensive_conscription
			}
		}
		count_triggers = {
			amount = 1 #if 1 states are owned by an enemy, burn the rest of the area
			217 = { CONTROLLER = { has_war_with = SOV } }
			265 = { CONTROLLER = { has_war_with = SOV } }
			245 = { CONTROLLER = { has_war_with = SOV } }
			238 = { CONTROLLER = { has_war_with = SOV } }
			829 = { CONTROLLER = { has_war_with = SOV } }

		}
	}

	abort = {
		OR = {
			NOT = { has_war_with = GER }
			strength_ratio = { tag = GER ratio > 1.5 }
			date > 1944.1.1
		}
		controls_state = 218
		controls_state = 228
		controls_state = 260
		controls_state = 239
	}

	ai_strategy = {
		type = scorched_earth_prio
		id = SOV
		states = {
			217
			265
			245
			238
			829
		}
	}
}

SOV_dont_do_so_many_naval_invasions_please = {
	allowed = { original_tag = SOV }

	enable = {
		always = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = invasion_unit_request
		tag = GER
		value = -50
	}
	ai_strategy = {
		type = invasion_unit_request
		tag = FIN
		value = -50
	}
}

###########################
### MOLOTOV IN DA HOUSE ###
###########################
#Soviets
SOV_molotov_active_sov = {
	allowed = { original_tag = SOV }

	enable = {
		has_idea = SOV_vyacheslav_molotov
	}

	abort = {
		NOT = { has_idea = SOV_vyacheslav_molotov }
	}

	ai_strategy = {
		type = befriend
		id = GER
		value = 35
	}

	ai_strategy = {
		type = befriend
		id = JAP
		value = 20
	}

	ai_strategy = {
		type = antagonize
		id = POL
		value = 25
	}

	ai_strategy = {
		type = antagonize
		id = FIN
		value = 25
	}

	ai_strategy = {
		type = antagonize
		id = ENG
		value = 15
	}

	ai_strategy = {
		type = antagonize
		id = USA
		value = 15
	}

	ai_strategy = {
		type = antagonize
		id = FRA
		value = 15
	}
}

#Countries that like Molotov
SOV_molotov_active_friendly_others = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = JAP
		}
	}

	enable = {
		SOV = { has_idea = SOV_vyacheslav_molotov }
	}

	abort = {
		OR = {
			SOV = { NOT = { has_idea = SOV_vyacheslav_molotov } }
			has_capitulated = yes
			is_in_faction_with = SOV
		}
	}

	ai_strategy = {
		type = befriend
		id = SOV
		value = 25
	}
}

#Countries that dislike Molotov
SOV_molotov_active_hostile_others = {
	allowed = {
		OR = {
			original_tag = ENG
			original_tag = FRA
			original_tag = USA
			original_tag = POL
			original_tag = FIN
			original_tag = SAU #Khakimov incident
		}
	}

	enable = {
		SOV = { has_idea = SOV_vyacheslav_molotov }
	}

	abort = {
		OR = {
			SOV = { NOT = { has_idea = SOV_vyacheslav_molotov } }
			has_capitulated = yes
			is_in_faction_with = SOV
		}
	}

	ai_strategy = {
		type = antagonize
		id = SOV
		value = 25
	}
}


############################
### LITVINOV IN DA HOUSE ###
############################
#Soviets
SOV_litvinov_active_sov = {
	allowed = { original_tag = SOV }

	enable = {
		has_idea = SOV_maksim_litvinov
		is_subject = no
	}

	abort = {
		NOT = { has_idea = SOV_maksim_litvinov }
		is_subject = yes
	}

	ai_strategy = {
		type = befriend
		id = ENG
		value = 25
	}

	ai_strategy = {
		type = befriend
		id = USA
		value = 15
	}

	ai_strategy = {
		type = befriend
		id = FRA
		value = 35
	}

	ai_strategy = {
		type = befriend
		id = POL
		value = 25
	}

	ai_strategy = {
		type = antagonize
		id = GER
		value = 25
	}

	ai_strategy = {
		type = antagonize
		id = JAP
		value = 25
	}

	ai_strategy = {
		type = diplo_action_desire
		id = FRA
		target = improve_relation
		value = 25
	}

	ai_strategy = {
		type = diplo_action_desire
		id = POL
		target = improve_relation
		value = 15
	}
}

#Countries that like Litvinov
SOV_litvinov_active_friendly_others = {
	allowed = {
		OR = {
			original_tag = ENG
			original_tag = FRA
			original_tag = USA
			original_tag = POL
			original_tag = FIN
			original_tag = SAU #Khakimov incident
		}
	}

	enable = {
		SOV = { has_idea = SOV_maksim_litvinov }
		is_subject = no
	}

	abort = {
		OR = {
			SOV = { NOT = { has_idea = SOV_maksim_litvinov } }
			has_capitulated = yes
			is_in_faction_with = SOV
			is_subject = yes
		}
	}

	ai_strategy = {
		type = befriend
		id = SOV
		value = 25
	}
}

#Countries that dislike Litvinov
SOV_litvinov_active_hostile_others = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = JAP
		}
	}

	enable = {
		SOV = { has_idea = SOV_maksim_litvinov }
		is_subject = no
	}

	abort = {
		OR = {
			SOV = { NOT = { has_idea = SOV_maksim_litvinov } }
			has_capitulated = yes
			is_in_faction_with = SOV
			is_subject = yes
		}
	}

	ai_strategy = {
		type = antagonize
		id = SOV
		value = 25
	}
}

#########################
### FOREIGN RELATIONS ###
#########################

#Soviets
SOV_khakimov_proposal_sov = {
	allowed = {
		original_tag = SOV
	}

	enable = {
		has_idea = SOV_maksim_litvinov
		has_completed_focus = SOV_the_khakimov_proposal
		SAU = {
			has_opinion = {
				target = SOV
				value < 0
			}
			is_subject = no
		}
		is_subject = no
	}

	abort = {
		OR = {
			NOT = { has_idea = SOV_maksim_litvinov }
			is_in_faction_with = SAU
			SAU = { has_capitulated = yes }
			SAU = { is_subject = no }
			SAU = {
				has_opinion = {
					target = SOV
					value > 75
				}
			}
			is_subject = yes
		}
	}

	ai_strategy = {
		type = diplo_action_desire
		id = SAU
		target = befriend
		value = 50
	}
	ai_strategy = {
		type = diplo_action_desire
		id = SAU
		target = improve_relation
		value = 50
	}
}

#Soviets
SOV_khakimov_proposal_sau = {
	allowed = {
		original_tag = SAU
	}

	enable = {
		SOV = {
			has_idea = SOV_maksim_litvinov
			has_completed_focus = SOV_the_khakimov_proposal
			is_subject = no
		}
		is_subject = no
	}

	abort = {
		OR = {
			SOV = { NOT = { has_idea = SOV_maksim_litvinov } }
			is_in_faction_with = SOV
			SOV = { has_capitulated = yes }
			is_subject = yes
		}
	}

	ai_strategy = {
		type = diplo_action_desire
		id = SOV
		target = befriend
		value = 25
	}
}

SOV_unit_buffer_for_asian_threat = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = { #Always have a small unit buffer along the railway, just in case asian fronts get dangerous
			has_war = no
			AND = {
				has_war = yes
				surrender_progress < 0.75
			}
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = put_unit_buffers

		# ratio of total armeis in country to be buffered
		ratio = 0.1

		# you can specify an order id. ratio of same orders ids will be share same ratio
		#order_id = 2

		# states to put garrison orders (if no state is friendly, strat is invalid)
		states = {
			564
			563
			566
			567
			561
			657
			408
			409
		}

		# ai areas that the orders will use these buffers in
		area = asia

		# by default if you have orders in target areas, the buffer will request less units.
		# you can override this to disable the feature
		subtract_invasions_from_need = no
		subtract_fronts_from_need = yes
	}
}

SOV_coming_to_getcha_iran = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_completed_focus = SOV_preemptive_invasion_of_iran
		PER = {
			exists = yes
			is_in_faction = no
			is_subject = no
			has_capitulated = no
		}
	}
	abort = {
		OR = {
			surrender_progress > 0.5 #we have bigger fish to fry
			PER = {
				OR = {
					exists = no
					is_in_faction = yes
					is_subject = yes
					has_capitulated = yes
				}
			}
		}
	}
	ai_strategy = {
		type = antagonize
		id = PER
		value = 200
	}
	ai_strategy = {
		type = conquer
		id = PER
		value = 200
	}
}

SOV_ENG_tagteam_iran = {
	allowed = {
		OR = {
			original_tag = SOV
			original_tag = ENG
			original_tag = RAJ
		}
	}
	enable = {
		has_completed_focus = SOV_preemptive_invasion_of_iran
		has_global_flag = SOV_agreed_anglo_soviet_invasion_of_iran_flag
		RAJ = {
			is_in_faction_with = ENG
		}
		PER = {
			exists = yes
			is_in_faction = no
			is_subject = no
		}
	}
	abort = {
		OR = {
			surrender_progress > 0.5 #we have bigger fish to fry
			PER = {
				OR = {
					exists = no
					is_in_faction = yes
					is_subject = yes
				}
			}
		}
	}
	ai_strategy = {
		type = conquer
		id = PER
		value = 200
	}
}

SOV_boost_div_upgrades = { #lets make sure sov upgrades divs when at war
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_war = yes

		date > 1941.1.1
	}

	abort = {
		has_war = no
		has_template_ai_majority_unit = medium_armor
	}

	# lets do changes more often during this period too
	ai_strategy = {
		type = land_xp_spend_priority
		id = division_template
		value = 100
	}
}

SOV_defend_blitzkrieg  = {#Only perform careful attacks, we want to defend while germany has buffs.
	allowed = {
		original_tag = SOV
	}

	enable = {
		date < 1943.1.1 #To space!
		has_war_with = GER
		GER = { has_idea = GER_barbarossa }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		tag = GER

		ratio = 0.5

		priority = 100
		ordertype = front
		execution_type = careful
		execute_order = no
	}

}

SOV_defend_blitzkrieg_2  = {#Only perform careful attacks, we want to defend for a bit
	allowed = {
		original_tag = SOV
	}

	enable = {
		date < 1943.1.1 #To space!
		has_war_with = GER
		NOT = { GER = { has_idea = GER_barbarossa } }
		is_historical_focus_on = yes
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		tag = GER

		ratio = 0.5

		priority = 100
		ordertype = front
		execution_type = careful
	}

}

SOV_wants_civ = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date < 1939.1.1
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = industrial_complex
		value = 85
	}
}


###########################
### avoid attacking the baltics until we have sent ultimatums
###########################
SOV_ultimatum_LIT = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		is_historical_focus_on = yes
		LIT = {
			NOT = { has_country_flag = SOV_ultimatum_sent_flag }
		}
	}
	abort = {
		OR = {
			LIT = {
				has_country_flag = { flag = SOV_ultimatum_sent_flag value = 1 days > 15 }
			}
			date > 1941.12.31 #If it's late then it's fine
		}
	}

	ai_strategy = {
		type = antagonize
		id = LIT
		value = -50
	}
	ai_strategy = {
		type = conquer
		id = LIT
		value = -200
	}
}

SOV_ultimatum_LAT = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		is_historical_focus_on = yes
		LAT = {
			NOT = { has_country_flag = SOV_ultimatum_sent_flag }
		}
	}
	abort = {
		OR = {
			LAT = {
				has_country_flag = { flag = SOV_ultimatum_sent_flag value = 1 days > 15 }
			}
			date > 1941.12.31 #If it's late then it's fine
		}
	}

	ai_strategy = {
		type = antagonize
		id = LAT
		value = -50
	}
	ai_strategy = {
		type = conquer
		id = LAT
		value = -200
	}
}

SOV_ultimatum_EST = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		is_historical_focus_on = yes
		EST = {
			NOT = { has_country_flag = SOV_ultimatum_sent_flag }
		}
	}
	abort = {
		OR = {
			EST = {
				has_country_flag = { flag = SOV_ultimatum_sent_flag value = 1 days > 15 }
			}
			date > 1941.12.31 #If it's late then it's fine
		}
	}

	ai_strategy = {
		type = antagonize
		id = EST
		value = -50
	}
	ai_strategy = {
		type = conquer
		id = EST
		value = -200
	}
}

SOV_nothing_bad_could_possibly_happen_now = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		always = no #No longer necessary
		is_historical_focus_on = yes
		NOT = { has_war_with = GER }
		date < 1942.2.1
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request

		tag = GER

		value = -30 # we have a lovely non-aggression pact, so there's no reason to be worried. At all.
	}
}

###########################
### avoid attacking Romania until we have sent ultimatum
###########################

SOV_ultimatum_ROM = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		is_historical_focus_on = yes
		OR = {
			AND = {
				NOT = { has_government = communism } #Non-commies don't have access to focus Claim in Bessarabia
				date < 1940.1.31 #Do not do it too early buddy
			}
			NOT = { has_completed_focus = SOV_claim_on_bessarabia }
		}
		ROM = {
			NOT = { has_country_flag = SOV_added_claimed_bessarabia } #Added via focus Claim Bessarabia
		}
		OR = {
			NOT = { owns_state = 78 } #Bessarabia
			78 = {
				owner = { NOT = { is_in_faction_with = ROOT } }
			}
		}
		OR = {
			NOT = { owns_state = 80 } #Bucovina
			80 = {
				owner = { NOT = { is_in_faction_with = ROOT } }
			}
		}
		OR = {
			NOT = { owns_state = 766 } #Southern Bessarabia
			766 = {
				owner = { NOT = { is_in_faction_with = ROOT } }
			}
		}
	}
	abort = {
		OR = {
			ROM = {
				has_country_flag = { flag = SOV_added_claimed_bessarabia value = 1 days > 15 }
			}
			date > 1941.12.31 #If it's late then it's fine
			AND = {
				OR = {
					owns_state = 78 #Bessarabia
					78 = {
						owner = { is_in_faction_with = ROOT }
					}
				}
				OR = {
					owns_state = 80 #Bucovina
					80 = {
						owner = { is_in_faction_with = ROOT }
					}
				}
				OR = {
					owns_state = 766 #Southern Bessarabia
					766 = {
						owner = { is_in_faction_with = ROOT }
					}
				}
			}
		}
	}

	ai_strategy = {
		type = ignore
		id = "ROM"
		value = 100
	}

	ai_strategy = {
		type = antagonize
		id = "ROM"
		value = -10
	}
	ai_strategy = {
		type = conquer
		id = "ROM"
		value = -200
	}
}

###########################
### avoid attacking Finland until we have sent ultimatum
###########################

SOV_ultimatum_FIN = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		is_historical_focus_on = yes
		FIN = {
			NOT = { has_country_flag = SOV_ultimatum_sent_flag } #Added via focus Secure Leningrad
		}
		OR = {
			NOT = { owns_state = 146 } #Karjala
			146 = {
				owner = { NOT = { is_in_faction_with = ROOT } }
			}
		}
	}
	abort = {
		OR = {
			FIN = {
				has_country_flag = { flag = SOV_ultimatum_sent_flag value = 1 days > 15 }
			}
			date > 1941.12.31 #If it's late then it's fine
			OR = {
				owns_state = 146 #Karjala
				146 = {
					owner = { is_in_faction_with = ROOT }
				}
			}
		}
	}

	ai_strategy = {
		type = antagonize
		id = FIN
		value = -30
	}
	ai_strategy = {
		type = conquer
		id = FIN
		value = -200
	}
}

###### Don't start ww3 until Japan is defeated

ALLIES_avoid_enemies_for_a_while_ww3 = {
	allowed = {
		OR = {
			original_tag = ENG
			is_in_faction_with = ENG
		}
	}
	enable = {
		is_historical_focus_on = yes
		date > 1943.1.1
		OR = {
			has_war_with = GER
			has_war_with = JAP
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = conquer
		id = PER
		value = -200
	}
	ai_strategy = {
		type = conquer
		id = SOV
		value = -200
	}
}