SWE_bofors_aa_production = {
	allowed = {
		original_tag = SWE
	}
	enable = {
		num_of_military_factories > 4  # It's early but still later than IRL. Let's try.
		has_completed_focus = SWE_bofors_fly_swatter
		has_tech = interwar_antiair
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = anti_air_equipment
		value = 2
	}
	ai_strategy = {
		type = equipment_production_factor
		id = anti_air
		value = 50
	}
	ai_strategy = {
		type = equipment_market_for_sale_factor
		id = anti_air
		value = 200
	}
}

SWE_bofors_at_production = {
	allowed = {
		original_tag = SWE
	}
	enable = {
		num_of_military_factories > 5  # It's early but still later than IRL. Let's try.
		has_completed_focus = SWE_bofors_anti_tank_gun
		has_tech = interwar_antitank
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_tank
		value = 1
	}
	ai_strategy = {
		type = equipment_market_for_sale_factor
		id = anti_tank
		value = 100
	}
}

SWE_armored_production = {
	enable = {
				original_tag = SWE
	}
	abort_when_not_enabled = yes

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

	ai_strategy = {
		type = equipment_production_min_factories
		id = armor
		value = 1
	}
	ai_strategy = {
		type = equipment_market_for_sale_factor
		id = armor
		value = 200
	}
	ai_strategy = {
		type = equipment_market_spend_factories
		id = armor
		value = 1
	}
	ai_strategy = {
		type = equipment_market_max_for_sale
		id = armor
		value = 200
	}
	
}

SWE_trade_with_poland = {
	# Poland has a mirrored version of this
	allowed = {
		original_tag = SWE
	}
	enable = {
		OR = {
			POL = { has_government = neutrality }
			POL = { has_government = democratic }
		}
		has_government = democratic
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_market_trade_desire
		id = POL
		value = 60
	}
}

SWE_trade_with_czech = {
	allowed = {
		original_tag = SWE
	}
	enable = {
		has_government = democratic
		CZE = {
			exists = yes
			has_government = democratic
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_market_trade_desire
		id = CZE
		value = 40
	}
}

SWE_trade_with_italy = {
	allowed = {
		original_tag = SWE
	}
	enable = {
		ITA = { has_war_with_major = no }  # ignore Ethiopian war
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_market_trade_desire
		id = ITA
		value = 100  # We really like money
	}
}

SWE_trade_with_germany = {
	allowed = {
		original_tag = SWE
	}
	enable = {
		GER = { has_war = no }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_market_trade_desire
		id = GER
		value = 100  # We really like money
	}
}

SWE_avoid_axis_or_comintern = {
	allowed = { 
		original_tag = SWE 
		has_dlc = "By Blood Alone"
	}
	
	enable = {
		is_historical_focus_on = yes
	}
	
	abort = {
		date > 1945.1.1
	}

	ai_strategy = {
		type = alliance
		id = "JAP"
		value = -400
	}
	
	ai_strategy = {
		type = alliance
		id = "SOV"
		value = -400
	}
	
	ai_strategy = {
		type = alliance
		id = "GER"
		value = -400
	}
}

SWE_avoid_allies = {

	allowed = { 
		original_tag = SWE 
		has_dlc = "Arms Against Tyranny"
	}
	
	enable = {
		is_historical_focus_on = yes
		has_war = no
	}
	
	abort_when_not_enabled = yes

	ai_strategy = {
		type = alliance
		id = "ENG"
		value = -1000
	}
	
	ai_strategy = {
		type = alliance
		id = "USA"
		value = -1000
	}
	
	ai_strategy = {
		type = alliance
		id = "FRA"
		value = -1000
	}

	ai_strategy = {
		type = alliance
		id = "CAN"
		value = -1000
	}

	ai_strategy = {
		type = alliance
		id = "AST"
		value = -1000
	}

	ai_strategy = {
		type = alliance
		id = "SAF"
		value = -1000
	}

	ai_strategy = {
		type = alliance
		id = "ICE"
		value = -1000
	}

	ai_strategy = {
		type = alliance
		id = "NZL"
		value = -1000
	}

	ai_strategy = {
		type = alliance
		id = "HOL"
		value = -1000
	}

	ai_strategy = {
		type = alliance
		id = "LUX"
		value = -1000
	}

	ai_strategy = {
		type = alliance
		id = "BEL"
		value = -1000
	}

	ai_strategy = {
		type = alliance
		id = "DEN"
		value = -1000
	}

	ai_strategy = {
		type = alliance
		id = "NOR"
		value = -1000
	}

	ai_strategy = {
		type = alliance
		id = "MEX"
		value = -1000
	}
}

make_SWE_unpopular = { 

	allowed = { 
		has_dlc = "By Blood Alone"
		OR = {
			original_tag = JAP 
			original_tag = SOV 
			original_tag = GER 
		}
	}
	
	enable = {
		is_historical_focus_on = yes
		SWE = {
			NOT = { has_government = fascism }
			NOT = { has_government = neutrality }
		}
		date < 1946.1.1
		OR = {
			AND = {
				original_tag = GER
				SWE = { 
					NOT = { 
						has_completed_focus = SWE_join_the_anti_soviet_pact 
					}
				}
			}
			original_tag = SOV
			original_tag = JAP
		}
	}
	
	abort_when_not_enabled = yes

	ai_strategy = {
		type = alliance
		id = "SWE"
		value = -400
	}
}

SWE_war_with_ITA = {
	allowed = {
		original_tag = SWE
		has_dlc = "By Blood Alone"
	}
	enable = {
		check_variable = { ETH.host_nation = SWE }
		has_wargoal_against = ITA
	}
	abort = {
		NOT = { country_exists = ETH }
		NOT = { country_exists = ITA }
		NOT = { ETH = { is_government_in_exile = yes } }
	}

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

SWE_join_allies = {
	allowed = {
		original_tag = SWE
		has_dlc = "By Blood Alone"
	}
	enable = {
		check_variable = { ETH.host_nation = SWE }
		has_wargoal_against = ITA
	}
	abort = {
		NOT = { country_exists = ETH }
		NOT = { country_exists = ITA }
		NOT = { ETH = { is_government_in_exile = yes } }
	}

	ai_strategy = {
		type = alliance
		id = "ENG"
		value = 400
	}
	ai_strategy = {
		type = alliance
		id = "USA"
		value = 400
	}
}

SWE_NOR_nordic_defense_homeland_prio = {
	allowed = {
		original_tag = NOR
	}
	enable = {
		has_war = yes
		NOT = { has_war_with = GER } # Ragnarok added
		has_autonomy_state = autonomy_aat_defense_council_member
		SWE = { has_completed_focus = SWE_decentralized_nordic_army_command }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = area_priority
		id = just_norway
		value = 200
	}
}


SWE_FIN_nordic_defense_homeland_prio = {
	allowed = {
		original_tag = FIN
	}
	enable = {
		has_war = yes
		NOT = { has_war_with = GER } # Ragnarok added
		has_autonomy_state = autonomy_aat_defense_council_member
		SWE = { has_completed_focus = SWE_decentralized_nordic_army_command }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = area_priority
		id = just_finland
		value = 200
	}
}


SWE_ICE_nordic_defense_homeland_prio = {
	allowed = {
		original_tag = ICE
	}
	enable = {
		has_war = yes
		NOT = { has_war_with = GER } # Ragnarok added
		has_autonomy_state = autonomy_aat_defense_council_member
		SWE = { has_completed_focus = SWE_decentralized_nordic_army_command }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = area_priority
		id = just_iceland
		value = 200
	}
}


SWE_DEN_nordic_defense_homeland_prio = {
	allowed = {
		original_tag = DEN
	}
	enable = {
		has_war = yes
		NOT = { has_war_with = GER } # Ragnarok added
		has_autonomy_state = autonomy_aat_defense_council_member
		SWE = { has_completed_focus = SWE_decentralized_nordic_army_command }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = area_priority
		id = just_denmark_excluding_greenland
		value = 200
	}
}


SWE_helped_us_being_communist_so_we_like_them_NOR = {
	allowed = {
		original_tag = NOR
	}
	enable = {
		SWE = { has_country_flag = SWE_has_triggered_nor_com_uprising }
		NOR = { 
			has_government = communism
			NOT = { has_war_with = SWE }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = alliance
		id = SWE
		value = 500
	}

	ai_strategy = {
		type = befriend
		id = SWE
		value = 500
	}
}


SWE_helped_us_being_communist_so_we_like_them_DEN = {
	allowed = {
		original_tag = DEN
	}
	enable = {
		SWE = { has_country_flag = SWE_has_triggered_den_com_uprising }
		NOR = { 
			has_government = communism
			NOT = { has_war_with = SWE }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = alliance
		id = SWE
		value = 500
	}

	ai_strategy = {
		type = befriend
		id = SWE
		value = 500
	}
}


SWE_dont_guarantee_people_if_historical = {
	allowed = {
		original_tag = SWE
	}
	enable = {
		OR = {
			is_historical_focus_on = yes
			has_idea = neutrality_idea
		}
	}
	abort_when_not_enabled = yes
	 ai_strategy = {
		type = protect
		id = "NOR"
		value = -2000
	 }
 	 ai_strategy = {
		type = protect
		id = "FIN"
		value = -2000
	 }
 	 ai_strategy = {
		type = protect
		id = "DEN"
		value = -2000
	 }
  	 ai_strategy = {
		type = protect
		id = "DEN"
		value = -2000
	 }
 	 ai_strategy = {
		type = protect
		id = "ICE"
		value = -2000
	 }
	 ai_strategy = {
		type = protect
		id = "CZE"
		value = -2000
	 }

 	 ai_strategy = {
		type = protect
		id = "FRA"
		value = -2000
	 }

 	 ai_strategy = {
		type = protect
		id = "HOL"
		value = -2000
	 }

 	 ai_strategy = {
		type = protect
		id = "BEL"
		value = -2000
	 }

	 ai_strategy = {
		type = protect
		id = "ENG"
		value = -2000
	 }

 	 ai_strategy = {
		type = protect
		id = "YUG"
		value = -2000
	 }

	 ai_strategy = {
		type = protect
		id = "GRE"
		value = -2000
	 }

 	 ai_strategy = {
		type = protect
		id = "TUR"
		value = -2000
	 }

 	 ai_strategy = {
		type = protect
		id = "ENG"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "USA"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "CAN"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "SAF"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "BRA"
		value = -2000
	 }

	 ai_strategy = {
		type = protect
		id = "PER"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "CHI"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "ENG"
		value = -2000
	 }

}

SWE_nils_flyg_is_in_charge_and_he_is_a_weird_communist_that_does_not_like_stalin_so_we_like_him = {
	allowed = {
		original_tag = GER
	}
	enable = {
		country_exists = SWE
		SWE = {
			has_country_leader = {
				ruling_only = yes 
				character = SWE_nils_flyg 
			}
			has_government = communism
		}
	}
	abort = {
		SWE = {
			NOT = {
				has_government = communism
				has_country_leader = {
					ruling_only = yes 
					character = SWE_nils_flyg 
				}
			}
		}
	}	

	ai_strategy = {
		type = avoid_starting_wars
		id = "SWE"
		value = 200
	}

	ai_strategy = {
		type = befriend
		id = "SWE"
		value = 200
	}

	ai_strategy = {
		type = alliance
		id = "SWE"
		value = 1000
	}
}

SWE_kilbom_is_in_charge_and_he_is_a_weird_communist_that_does_not_like_stalin_or_hitler_so_we_like_him = {
	allowed = {
		OR = {
			original_tag = ENG
			original_tag = FRA
			original_tag = USA
		}
	}
	enable = {
		country_exists = SWE
		SWE = {
			has_country_leader = {
				ruling_only = yes 
				character = SWE_karl_kilbom 
			}
			has_government = communism
		}
	}
	abort = {
		SWE = {
			NOT = {
				has_government = communism
				has_country_leader = {
					ruling_only = yes 
					character = SWE_karl_kilbom 
				}
			}
		}
	}	

	ai_strategy = {
		type = avoid_starting_wars
		id = "SWE"
		value = 200
	}

	ai_strategy = {
		type = befriend
		id = "SWE"
		value = 200
	}

	ai_strategy = {
		type = alliance
		id = "SWE"
		value = 1000
	}
}

Sweden_pulled_the_trigger_so_we_like_them = {
		allowed = {
			OR = {
				original_tag = NOR
				original_tag = DEN
			}
		}

	enable = {
		country_exists = SWE
		OR = {
			NOR = {
				has_country_flag = SWE_has_triggered_nor_com_uprising
			}	
			DEN = {
				has_country_flag = SWE_has_triggered_den_com_uprising
			}
		}
	}

	abort = {
		SWE = {
			has_country_leader = {
				character = SWE_sven_linderot 
			}
		}
	}

	ai_strategy = {
		type = befriend
		id = "SWE"
		value = 250
	}

	ai_strategy = {
		type = alliance
		id = "SWE"
		value = 250
	}

	ai_strategy = {
		type = antagonize
		id = "SOV"
		value = 250
	}
}


