
SWE_hungershield_cat = {

	SWE_hungershield_dummy = { #To warn
		icon = generic_civil_support

		available = {
			has_idea = SWE_hungershield
			has_stability < 0.68 #For Balance: Change 1
			has_stability > 0.35
			hidden_trigger = { always = no } 
		}

		days_remove = 150

		allowed = {
			original_tag = SWE
		}

		visible = {
			has_idea = SWE_hungershield

			#has_stability < 0.63
		}

		fire_only_once = no

		is_good = no

		remove_effect = {
			add_timed_idea = {
				idea = SWE_minor_hungershield_strike
				days = 180
			}
		}
	}

	SWE_hungershield_worse_dummy = { #To warn
		icon = generic_civil_support

		available = {
			has_idea = SWE_hungershield
			has_stability < 0.35
			hidden_trigger = { always = no } #just to show
		}

		days_remove = 150

		allowed = {
			original_tag = SWE
		}

		visible = {
			has_idea = SWE_hungershield

			#has_stability < 0.63
		}
		fire_only_once = no

		is_good = no

		remove_effect = {
			add_timed_idea = {
				idea = SWE_major_hungershield_strike
				days = 180
			}
		}
	}

	SWE_hungershield_mission = {

		icon = generic_civil_support

		allowed = {
			original_tag = SWE
		}
		
		available = {
			hidden_trigger = {
				always = no
			}	
		}

		days_mission_timeout = 150
		#days_remove = 1

		activation = {
			has_idea = SWE_hungershield
			has_stability < 0.68 #For Balance: Change 1
		}

		cancel_trigger = {
			OR = {
				has_stability > 0.68 #For Balance: Change 1
				NOT = { has_idea = SWE_hungershield }
			}
		}

		fire_only_once = no

		is_good = no

		timeout_effect = {
			if = {
				limit = {
					has_stability < 0.35
				}
				add_timed_idea = {
					idea = SWE_major_hungershield_strike
					days = 180
				}
			}
			else = {
				add_timed_idea = {
					idea = SWE_minor_hungershield_strike
					days = 180
				}
			}
		}
	}
}

#CUT
#SWE_rearnament_system = {
#	SWE_time_to_rearnament_discussions = {
#	
#		icon = decision_generic_nationalism
#		selectable_mission = no
#		allowed = {
#			original_tag = SWE
#		}
#		cancel_trigger = { has_country_flag = turn_of_rearnament_system }
#		available = {
#			hidden_trigger = {
#				always = no
#			}
#		}
#		
#		visible = {
#			NOT = {
#				has_country_flag = turn_of_rearnament_system
#			}
#
#		}
#		activation = {
#			always = no
#		}
#		is_good = yes
#		days_mission_timeout = 335
#		fire_only_once = yes
#		
#		timeout_effect = {
#			activate_mission = SWE_rearnament_discussions_are_active
#			hidden_effect = {
#				if = {
#					limit = { has_country_flag = remind_me_about_rearnament_flag }
#					country_event = { id = Sweden_rearnament.4 }
#				}
#			}
#		}	
#	}
#
#	SWE_rearnament_discussions_are_active = {
#	
#		icon = decision_generic_nationalism
#		selectable_mission = no
#		allowed = {
#			original_tag = SWE
#		}
#		cancel_trigger = {  hidden_trigger = { has_country_flag = turn_of_rearnament_system }}
#		available = {
#			hidden_trigger = {
#				always = no
#			}
#		}
#		activation = {
#			always = no
#		}
#		fire_only_once = yes
#		is_good = yes
#		days_mission_timeout = 30
#		
#		timeout_effect = {
#			if = {
#				limit = { NOT = { has_country_flag = turn_of_rearnament_system } }
#				activate_mission = SWE_time_to_rearnament_discussions
#			}
#		}	
#	}
#
#
#	SWE_set_army_budget = {
#	
#		icon = decision_generic_nationalism
#		allowed = {
#			original_tag = SWE
#		}
#		available = {
#			has_active_mission = SWE_rearnament_discussions_are_active
#			NOT = { 
#				has_country_flag = army_budget_event_active 
#				has_country_flag = navy_budget_event_active 
#				has_country_flag = air_budget_event_active 
#			}
#		}
#		
#		visible = {
#			always = yes
#			NOT = { has_country_flag = army_budget_event_active }
#		}
#
#		complete_effect = {
#			country_event = { id = Sweden_rearnament.1 } 
#			set_country_flag = army_budget_event_active
#		}	
#	}
#
#	SWE_set_air_budget = {
#	
#		icon = decision_generic_nationalism
#		allowed = {
#			original_tag = SWE
#		}
#		available = {
#			has_active_mission = SWE_rearnament_discussions_are_active
#			NOT = { 
#				has_country_flag = army_budget_event_active 
#				has_country_flag = navy_budget_event_active 
#				has_country_flag = air_budget_event_active 
#			}
#		}
#		
#		visible = {
#			always = yes
#			NOT = { has_country_flag = air_budget_event_active }
#		}
#
#		complete_effect = {
#			country_event = { id = Sweden_rearnament.2 } 
#			set_country_flag = air_budget_event_active
#		}	
#	}
#
#	SWE_set_navy_budget = {
#	
#		icon = decision_generic_nationalism
#		allowed = {
#			original_tag = SWE
#		}
#		available = {
#			has_active_mission = SWE_rearnament_discussions_are_active
#			NOT = { 
#				has_country_flag = army_budget_event_active 
#				has_country_flag = navy_budget_event_active 
#				has_country_flag = air_budget_event_active 
#			}
#		}
#		
#		visible = {
#			always = yes
#			NOT = { 
#				has_country_flag = navy_budget_event_active 
#			}
#		}
#
#		complete_effect = {
#			country_event = { id = Sweden_rearnament.3 } 
#			set_country_flag = navy_budget_event_active
#		}	
#	}
#
#	remind_me_about_rearnament_decisions = {
#	
#		icon = decision_generic_nationalism
#		allowed = {
#			original_tag = SWE
#		}
#		available = {
#			hidden_trigger = {
#				always = yes
#			}
#		}
#		
#		visible = {
#			always = yes
#		}
#
#		complete_effect = {
#			if = {
#				limit = { NOT = { has_country_flag = remind_me_about_rearnament } }
#				set_country_flag = remind_me_about_rearnament_flag
#			}
#			else = {
#				clr_country_flag = remind_me_about_rearnament_flag
#			}
#			
#		}	
#	}
#}




SWE_politics = {

	SWE_gateway_to_peace_decision = {
		icon = generic_prepare_civil_war
	
		allowed = {
			original_tag = SWE
		}
		cost = 0
		visible = {
			has_completed_focus = SWE_finlands_cause_is_ours
			NOT = { has_war_with = ROOT }
		}

		available = {
			NOT = {
				has_war_with = SOV
				has_war_with = FIN
			}
			FIN = {
				has_defensive_war = yes
				has_war_with = SOV
			}
		}

		complete_effect = {
			declare_war_on = {
				target = SOV
				type = liberate_wargoal
			}
			add_ideas = SWE_gateway_to_peace
			add_timed_idea = { idea = SWE_with_finland_for_sweden days = 180  }
			FIN = { 
				add_timed_idea = { idea = SWE_with_finland_for_sweden_fin days = 180 }
				add_ideas = SWE_gateway_to_peace
			}

			give_military_access = FIN
			FIN = { give_military_access = ROOT }


			custom_effect_tooltip = SWE_gateway_to_peace_decision_tt
		}
	}

	SWE_urbanization_decision = {
	
		icon = decision_generic_construction
	
		allowed = {
			original_tag = SWE
		}
	
		available = {
			FROM = {
				OR = {
					has_dynamic_modifier = { modifier = SWE_hygenic_housing_output_bonus }
					hidden_trigger = { has_dynamic_modifier = { modifier = SWE_hygenic_housing_resource_bonus }}
				}
			}
		}
		
		visible = {
			has_completed_focus = SWE_urbanization
		}

		state_target = yes
		targets = { 138 140 141 }
		target_root_trigger = {
			has_completed_focus = SWE_urbanization
		}
		target_trigger = {
			FROM = {
				is_core_of = ROOT
				is_fully_controlled_by = ROOT
				NOT = { has_state_flag = SWE_has_urbanized }
			}
		}

	    on_map_mode = map_only 

		cost = 120
		
		#fire_only_once = yes
		days_remove = 80

		#cancel_trigger = {
		#	NOT = { is_fully_controlled_by = ROOT }
		#}

		remove_effect = {
			FROM = {
				set_state_flag = SWE_has_urbanized
				increase_state_category = yes
			}
		}
	
		ai_will_do = {
			factor = 20
		}
	
	}

	#SWE_hygenic_housing_mission = {
	#
	#	icon = decision_generic_nationalism
	#	activation = { always = no }
	#	allowed = {
	#		always = no
	#	}
	#	is_good = yes
	#
	#	available = {
	#		hidden_trigger = {
	#			always = no
	#		}
	#	}
	#	
	#	visible = {
	#		has_completed_focus = SWE_hygenic_housing
	#		#any_core_state = {}
#
#		}
		
		#fire_only_once = yes
#		days_mission_timeout = 60

#		timeout_effect = {
#			custom_effect_tooltip = SWE_hygenic_housing_mission_tt
#			for_each_scope_loop = {
#				array = game_start_core_states #array of all starting core states at game start for Sweden, used to limit the bonus in case you earn extra core states later
#				if = {
#					limit = {
#						OR = {
#							has_dynamic_modifier = { modifier = SWE_hygenic_housing_output_bonus }
#							has_dynamic_modifier = { modifier = SWE_hygenic_housing_resource_bonus } 
#						}
#						is_core_of = ROOT #In case you somehow loose cores
#					}
#					random_neighbor_state = {
#						limit = {
#							NOT = {
#								has_dynamic_modifier = { modifier = SWE_hygenic_housing_output_bonus }
#								has_dynamic_modifier = { modifier = SWE_hygenic_housing_resource_bonus } 
#							}
#							is_in_array = { ROOT.game_start_core_states = THIS }
#						}
#
#						if = { #add resource state modifier if output is at 8 civs worht of resources or above
#							limit = {
#								OR = {
#									check_variable = {resource@steel > 7 }
#									check_variable = {resource@aluminium > 7 }
#									check_variable = {resource@oil > 7 }
#									check_variable = {resource@rubber > 7 }
#									check_variable = {resource@chromium > 7 }
#									check_variable = {resource@tungsten > 7 }
#								}
#							}
#							add_dynamic_modifier = { modifier = SWE_hygenic_housing_resource_bonus }
#						}
#						else = {
#							add_dynamic_modifier = { modifier = SWE_hygenic_housing_output_bonus }
#						}
#						if = {
#							limit = {
#								NOT = { is_in_array = { ROOT.core_states_with_housing_modifier = THIS } }
#							}

#							add_to_array = { ROOT.core_states_with_housing_modifier = THIS }
#						}

#						if = {
#							limit = {
#								state = 914 #<- Öland. This gives Gotland the modifier as well if Öland is picked, since Gotland is a special case and is surrounded by a glass of water and has no neighbours 
#							}
#							124 = { 
#								if = {
#									limit = {
#										NOT = { is_in_array = { ROOT.core_states_with_housing_modifier = THIS } }
#									}
#
#									add_to_array = { ROOT.core_states_with_housing_modifier = THIS }
#								}
#								add_dynamic_modifier = { modifier = SWE_hygenic_housing_output_bonus }
#							}
#						}
#					}
#				}
#				if = {
#					limit = {
#						 check_variable = { ROOT.core_states_with_housing_modifier^num < ROOT.game_start_core_states^num }
						#if the original core states array length is not the same as the core states with modifiers we can assume that not every original core state has it yet
#					
#					ROOT = { activate_mission = SWE_hygenic_housing_mission }
#				}
#			}
#		}
#	}


	restore_radiotjanst_to_democratic = {
		icon = decision_generic_political_discourse
		allowed = { 
			original_tag = SWE 
		}


		visible = {
			OR = {
				has_idea = SWE_radiotjanst_fascism
				has_idea = SWE_radiotjanst_communism
				has_idea = SWE_radiotjanst_unaligned
			}
		}
		cost = 50
		days_remove = 120

		#modifier = {
			#civilian_factory_use = 4
		#}

		remove_effect = {
			if = {
				limit = {
					has_idea = SWE_radiotjanst_fascism 
				}
				swap_ideas = {
					add_idea = SWE_radiotjanst_democratic
					remove_idea = SWE_radiotjanst_fascism
				}
			}
			else_if = {
				limit = {
					has_idea = SWE_radiotjanst_communism 
				}
				swap_ideas = {
					add_idea = SWE_radiotjanst_democratic
					remove_idea = SWE_radiotjanst_communism
				}
			}
			else_if = {
				limit = {
					has_idea = SWE_radiotjanst_unaligned
				}
				swap_ideas = {
					add_idea = SWE_radiotjanst_democratic
					remove_idea = SWE_radiotjanst_unaligned
				}
			}
		}
	}


	pervert_radiotjanst_fascism = {
		icon = decision_generic_political_discourse
		allowed = { 
			original_tag = SWE 
		}


		visible = {
			OR = {
				has_idea = SWE_radiotjanst_democratic
				has_idea = SWE_radiotjanst_communism
				has_idea = SWE_radiotjanst_unaligned
			}
		}
		cost = 50
		days_remove = 120

		#modifier = {
			#civilian_factory_use = 4
		#}

		ai_will_do = {
			factor = 0
			modifier = {
				add = 150
				OR = {
					has_country_flag = SWE_AI_RANDOM_FASCIST_PUPPET
					has_country_flag = SWE_AI_RANDOM_PUPPET_BACKSTABBER
					has_country_flag = SWE_AI_RANDOM_FASCIST_INDEPENDENT
					has_game_rule = {
						rule = SWE_ai_behavior
						option = SWE_FASCIST_INDEPENDENT
					}

					has_game_rule = {
						rule = SWE_ai_behavior
						option = SWE_FASCIST_PUPPET
					}

					has_game_rule = {
						rule = SWE_ai_behavior
						option = SWE_FASCIST_PUPPET_BACKSTABBER
					}
				}
			}
		}

		remove_effect = {
			if = {
				limit = {
					has_idea = SWE_radiotjanst_democratic 
				}
				swap_ideas = {
					add_idea = SWE_radiotjanst_fascism
					remove_idea = SWE_radiotjanst_democratic
				}
			}
			else_if = {
				limit = {
					has_idea = SWE_radiotjanst_communism 
				}
				swap_ideas = {
					add_idea = SWE_radiotjanst_fascism
					remove_idea = SWE_radiotjanst_communism
				}
			}
			else_if = {
				limit = {
					has_idea = SWE_radiotjanst_unaligned
				}
				swap_ideas = {
					add_idea = SWE_radiotjanst_fascism
					remove_idea = SWE_radiotjanst_unaligned
				}
			}
		}
	}

	pervert_radiotjanst_communism = {
		icon = decision_generic_political_discourse
		allowed = { 
			original_tag = SWE 
		}


		visible = {
			OR = {
				has_idea = SWE_radiotjanst_democratic
				has_idea = SWE_radiotjanst_fascism
				has_idea = SWE_radiotjanst_unaligned
			}
		}


		cost = 50
		days_remove = 120

		#modifier = {
			#civilian_factory_use = 4
		#}

		remove_effect = {
			if = {
				limit = {
					has_idea = SWE_radiotjanst_democratic 
				}
				swap_ideas = {
					add_idea = SWE_radiotjanst_communism
					remove_idea = SWE_radiotjanst_democratic
				}
			}
			else_if = {
				limit = {
					has_idea = SWE_radiotjanst_fascism
				}
				swap_ideas = {
					add_idea = SWE_radiotjanst_communism
					remove_idea = SWE_radiotjanst_fascism
				}
			}
			else_if = {
				limit = {
					has_idea = SWE_radiotjanst_unaligned
				}
				swap_ideas = {
					add_idea = SWE_radiotjanst_communism
					remove_idea = SWE_radiotjanst_unaligned
				}
			}
		}

		ai_will_do = {
			base = 0
			modifier = {
				OR = {
					has_country_flag = SWE_AI_RANDOM_COMMUNISM
					has_game_rule = {
						rule = SWE_ai_behavior
						option = SWE_COMMUNISM
					}
				}
				add = 170
			}
		}
	}

	pervert_radiotjanst_unaligned = {
		icon = decision_generic_political_discourse
		allowed = { 
			original_tag = SWE 
		}


		visible = {
			OR = {
				has_idea = SWE_radiotjanst_democratic
				has_idea = SWE_radiotjanst_fascism
				has_idea = SWE_radiotjanst_communism
			}
		}
		cost = 50
		days_remove = 120

		#modifier = {
			#civilian_factory_use = 4
		#}
		ai_will_do ={
			base = 0
			modifier = {
				OR = {
					has_country_flag = SWE_AI_RANDOM_UNALIGNED
					has_game_rule = {
						rule = SWE_ai_behavior
						option = SWE_UNALIGNED
					}
				}
				add = 170
			}
		}
		remove_effect = {
			if = {
				limit = {
					has_idea = SWE_radiotjanst_democratic 
				}
				swap_ideas = {
					add_idea = SWE_radiotjanst_unaligned
					remove_idea = SWE_radiotjanst_democratic
				}
			}
			else_if = {
				limit = {
					has_idea = SWE_radiotjanst_fascism
				}
				swap_ideas = {
					add_idea = SWE_radiotjanst_unaligned
					remove_idea = SWE_radiotjanst_fascism
				}
			}
			else_if = {
				limit = {
					has_idea = SWE_radiotjanst_communism
				}
				swap_ideas = {
					add_idea = SWE_radiotjanst_unaligned
					remove_idea = SWE_radiotjanst_communism
				}
			}
		}
	}

	#CUT
	SWE_poverty_reduction = {
		icon = decision_generic_nationalism	
        allowed = {
            always = no
            #tag = SWE
        }

		available = {
			always = no
			#any_core_state = {
			#	is_fully_controlled_by = ROOT
			#}
			#power_balance_value = {
			#	id = SWE_riksdag_political_balance
			#	value  < 0 # Use < or >
			#}
		}
		
		visible = {
			always = no
			#has_completed_focus = SWE_individual_liberty_and_prosperity_for_all
			#check_variable = { poverty_reduction_count < 2 }

		}
		cost = 50
		modifier = { consumer_goods_factor = 0.05 }
		
		#fire_only_once = yes
		days_remove = 365

		remove_effect = {
			random_core_state = {
				limit = {
					is_fully_controlled_by = ROOT
				}
				add_extra_state_shared_building_slots = 1
				add_building_construction = {
					type = industrial_complex
					level = 1
					instant_build = yes
				}
			}
			add_to_variable = { poverty_reduction_count = 1 } 
			add_stability = 0.01
		}
	}
	#CUT
	SWE_concessions_for_defense_spending = { 
		icon = decision_generic_nationalism	
        allowed = {
           always = no
           # tag = SWE
        }

		available = {
			always = no
			#any_core_state = {
			#	is_fully_controlled_by = ROOT
			#}
			#power_balance_value = {
			#	id = SWE_riksdag_political_balance
			#	value > 0 # Use < or >
			#}
		}
		
		visible = {
			always = no
			#has_completed_focus = SWE_individual_liberty_and_prosperity_for_all
			#check_variable = { concessions_for_defense_spending < 2 }

		}
		cost = 35
		modifier = { consumer_goods_factor = 0.05 }
		
		#fire_only_once = yes
		days_remove = 270

		remove_effect = {
			random_core_state = {
				limit = {
					is_fully_controlled_by = ROOT
				}
				add_extra_state_shared_building_slots = 1
				add_building_construction = {
					type = arms_factory
					level = 1
					instant_build = yes
				}
			}
			add_to_variable = { concessions_for_defense_spending = 1 } #used to hide the other related decision
			add_war_support = 0.01
		}
	}

	SWE_integrate_fin = {
	
		icon = decision_eng_install_government
		allowed = {
			original_tag = SWE
		}
		cancel_trigger = {  
			has_capitulated = yes 
		}
		ai_will_do = {
			base = 140
		}
		available = {
	        FIN = {
	        	OR = {
	            	is_subject_of = ROOT
	            	AND = {
	            		any_core_state = {
	            			is_controlled_by = ROOT
	            		}
            			OR = {
	            			exists = no
	            			has_capitulated = yes
	            		}
	            	}
	        	}
	        }
		}
		
		visible = {
			has_completed_focus = SWE_greater_nordic_reich

		}
		activation = {
			always = no
		}
		is_good = yes
		days_remove = 180
		cost = 100
		fire_only_once = yes

		cancel_effect = {
		}

		remove_effect = {
			FIN = {
				for_each_scope_loop = {
					array = core_states_at_game_start
					add_core_of = ROOT
				}
			}
			if = {
				limit = {
					FIN = { is_subject_of = ROOT }
				}

				annex_country = {
					target = FIN
					transfer_troops = yes
				}
			}

		}	
	}


	SWE_integrate_nor = {
	
		icon = decision_eng_install_government
		allowed = {
			original_tag = SWE
		}
		cancel_trigger = {  
			has_capitulated = yes 
		}

		ai_will_do = {
			base = 140
		}
		available = {
	        NOR = {
	        	OR = {
	            	is_subject_of = ROOT
	            	AND = {
	            		any_core_state = {
	            			is_controlled_by = ROOT
	            		}
            			OR = {
	            			exists = no
	            			has_capitulated = yes
	            		}
	            	}
	        	}
	        }
		}
		
		visible = {
			has_completed_focus = SWE_greater_nordic_reich

		}
		activation = {
			always = no
		}
		is_good = yes
		days_remove = 180
		cost = 100
		fire_only_once = yes

		cancel_effect = {
		}

		remove_effect = {
			NOR = {
				for_each_scope_loop = {
					array = core_states_at_game_start
					add_core_of = ROOT
				}
			}
			if = {
				limit = {
					NOR = { is_subject_of = ROOT }
				}

				annex_country = {
					target = NOR
					transfer_troops = yes
				}
			}
		}	
	}

	SWE_integrate_den = {
	
		icon = decision_eng_install_government
		allowed = {
			original_tag = SWE
		}
		cancel_trigger = {  
			has_capitulated = yes 
		}
		available = {
	        DEN = {
	        	OR = {
	            	is_subject_of = ROOT
	            	AND = {
	            		any_core_state = {
	            			is_controlled_by = ROOT
	            		}
            			OR = {
	            			exists = no
	            			has_capitulated = yes
	            		}
	            	}
	        	}
	        }
		}

		ai_will_do = {
			base = 110
		}
		
		visible = {
			has_completed_focus = SWE_greater_nordic_reich

		}
		activation = {
			always = no
		}
		is_good = yes
		days_remove = 90
		cost = 80
		fire_only_once = yes

		cancel_effect = {
		}

		remove_effect = {
			DEN = {
				for_each_scope_loop = {
					array = core_states_at_game_start
					add_core_of = ROOT
				}
			}
			if = {
				limit = {
					DEN = { is_subject_of = ROOT }
				}

				annex_country = {
					target = DEN
					transfer_troops = yes
				}
			}
		}	
	}

	SWE_integrate_ice = {
	
		icon = decision_eng_install_government
		allowed = {
			original_tag = SWE
		}
		cancel_trigger = {  
			has_capitulated = yes 
		}
		ai_will_do = {
			base = 100
		}
		available = {
	        ICE = {
	        	OR = {
	            	is_subject_of = ROOT
	            	AND = {
	            		any_core_state = {
	            			is_controlled_by = ROOT
	            		}
            			OR = {
	            			exists = no
	            			has_capitulated = yes
	            		}
	            	}
	        	}
	        }
		}
		
		visible = {
			has_completed_focus = SWE_greater_nordic_reich

		}
		activation = {
			always = no
		}
		is_good = yes
		days_remove = 30
		cost = 50
		fire_only_once = yes

		cancel_effect = {
		}

		remove_effect = {
			ICE = {
				for_each_scope_loop = {
					array = core_states_at_game_start
					add_core_of = ROOT
				}
			}
			if = {
				limit = {
					ICE = { is_subject_of = ROOT }
				}

				annex_country = {
					target = ICE
					transfer_troops = yes
				}
			}
		}	
	}

	SWE_proclaim_eternal_sweden = {
		icon = decision_eng_install_government
		allowed = {
			original_tag = SWE
		}
		cancel_trigger = {  
			has_capitulated = yes 
		}

		available = {
			#custom_effect_tooltip = SWE_proclaim_eternal_sweden_tt
			custom_trigger_tooltip = {
				tooltip = SWE_proclaim_eternal_sweden_tt
				DEN = {
					hidden_trigger = {
						all_of_scopes = {

						 	array = core_states_at_game_start
						 	is_fully_controlled_by = ROOT
						 
						 } 
				 	}
				}

				ICE = {
					hidden_trigger = {
						all_of_scopes = {

						 	array = core_states_at_game_start
						 	is_fully_controlled_by = ROOT
						 
						 } 
					 } 
				}

				NOR = {
					hidden_trigger = {
						all_of_scopes = {

						 	array = core_states_at_game_start
						 	is_fully_controlled_by = ROOT
						 
						 } 
					 }
				}

				FIN = {
					hidden_trigger = {
						all_of_scopes = {
						 	array = core_states_at_game_start
						 	is_fully_controlled_by = ROOT
						 
						 } 
					 }
				}

				EST = {
					all_of_scopes = {
					 	array = core_states_at_game_start
					 	is_fully_controlled_by = ROOT
					 
					 }
				}


				LAT = {
					hidden_trigger = {
						all_of_scopes = {
						 	array = core_states_at_game_start
						 	is_fully_controlled_by = ROOT
						 
						 } 
					 }
				}
			}
			

			208 = { #Luga
				is_fully_controlled_by = ROOT
			}

			195 = { #Leningrad
				is_fully_controlled_by = ROOT
			}

			61 = { #Meckleburg
				is_fully_controlled_by = ROOT
			}

			59 = { #Hannover
				is_fully_controlled_by = ROOT
			}

			274 = { #
				is_fully_controlled_by = ROOT
			}

			359 = { #
				is_fully_controlled_by = ROOT
			}

			320 = { #
				is_fully_controlled_by = ROOT
			}

			694 = { #
				is_fully_controlled_by = ROOT
			}


			has_country_leader_with_trait = SWE_the_great

			
		}
		
		visible = {
			has_completed_focus = SWE_greater_nordic_reich
			has_country_leader = {
				character = SWE_king_gustaf_v
			}
			NOT = { has_country_leader_with_trait = SWE_the_eternal }
		}

		complete_effect = {
			208 = { #Luga
				add_core_of = ROOT
			}

			195 = { #Leningrad
				add_core_of = ROOT
			}

			61 = { #Meckleburg
				add_core_of = ROOT
			}

			59 = { #Hannover
				add_core_of = ROOT
			}

			274 = { 
				add_core_of = ROOT
			}

			359 = { 
				add_core_of = ROOT
			}

			320 = { 
				add_core_of = ROOT
			}

			694 = { 
				add_core_of = ROOT
			}

			SWE = {

				custom_effect_tooltip = SWE_proclaim_eternal_sweden_tt_name
				hidden_effect = {
					drop_cosmetic_tag = yes
					set_cosmetic_tag = ENE
				}

				SWE_king_gustaf_v = {
					swap_country_leader_traits = {
						remove = SWE_the_great
						add = SWE_the_eternal
					}
				}
			}
		}
	}

	SWE_proclaim_big_power_sweden = {
		icon = decision_eng_install_government
		allowed = {
			original_tag = SWE
		}
		cancel_trigger = {  
			has_capitulated = yes 
		}
		available = {
			DEN = {				
				custom_trigger_tooltip = {
				 	tooltip = SWE_proclaim_big_power_sweden_tt
				}
				hidden_trigger = {
					all_of_scopes = {

					 	array = core_states_at_game_start
					 	is_fully_controlled_by = ROOT
					 
					 } 
				 }
			}

			ICE = {
				custom_trigger_tooltip = {
				 	tooltip = SWE_proclaim_big_power_sweden_tt
				}
				hidden_trigger = {
					all_of_scopes = {

					 	array = core_states_at_game_start
					 	is_fully_controlled_by = ROOT
					 
					 } 
				 } 
			}

			NOR = {
				custom_trigger_tooltip = {
				 	tooltip = SWE_proclaim_big_power_sweden_tt
				}
				hidden_trigger = {
					all_of_scopes = {

					 	array = core_states_at_game_start
					 	is_fully_controlled_by = ROOT
					 
					 } 
				 }
			}

			FIN = {
				custom_trigger_tooltip = {
				 	tooltip = SWE_proclaim_big_power_sweden_tt
				}
				hidden_trigger = {
					all_of_scopes = {
					 	array = core_states_at_game_start
					 	is_fully_controlled_by = ROOT
					 
					 } 
				 }
			}

			EST = {
				custom_trigger_tooltip = {
				 	tooltip = SWE_proclaim_big_power_sweden_tt
				}
				all_of_scopes = {
				 	array = core_states_at_game_start
				 	is_fully_controlled_by = ROOT
				 
				 }
			}


			LAT = {
				custom_trigger_tooltip = {
				 	tooltip = SWE_proclaim_big_power_sweden_tt
				}
				hidden_trigger = {
					all_of_scopes = {
					 	array = core_states_at_game_start
					 	is_fully_controlled_by = ROOT
					 
					 } 
				 }
			}

			208 = { #Luga
				is_fully_controlled_by = ROOT
			}

			195 = { #Leningrad
				is_fully_controlled_by = ROOT
			}

			61 = { #Meckleburg
				is_fully_controlled_by = ROOT
			}

			59 = { #Hannover
				is_fully_controlled_by = ROOT
			}

		}
		
		visible = {
			has_completed_focus = SWE_greater_nordic_reich
			has_country_leader = {
				character = SWE_king_gustaf_v
			}
			NOT = {
				has_country_leader_with_trait = SWE_the_great
				has_country_leader_with_trait = SWE_the_eternal
			}
		}

		cost = 0
		complete_effect = {

			SWE_king_gustaf_v = {
				add_trait = {
					trait = SWE_the_great
					ideology = centrism #Only required for updating country leader 
				}

				set_character_name = {
					name = SWE_king_gustaf_v_the_great
				}

				EST = {
					for_each_scope_loop = {
					 	array = core_states_at_game_start
					 	add_compliance = 70
					 
					}
				}

				LAT = {
					for_each_scope_loop = {
					 	array = core_states_at_game_start
					 	add_compliance = 70
					 
					 }
				}

				59 = { #Hannover
					add_compliance = 70
				}

				61 = {  
					add_compliance = 70
				}
				208 = { #Luga
					add_compliance = 70
				}

				195 = { #Leningrad
					add_compliance = 70
				}

			}
		}
	}

	SWE_socialists_reforms_decision_efficiency_gain = {
		icon = decision_generic_nationalism
		allowed = {
			original_tag = SWE
		}
		visible = { has_completed_focus = SWE_socialist_reforms }
		available = {
			has_completed_focus = SWE_socialist_reforms
		}
		cancel_trigger = {  
			has_capitulated = yes 
		}

		is_good = yes
		days_remove = 365
		cost = 35

		modifier = {
			production_factory_efficiency_gain_factor = 0.1
			consumer_goods_factor = 0.1
		}

		remove_effect = {

		}
	}

}

SWE_train_the_sheltered_cat = {
		SWE_train_the_sheltered_decision = {
		icon = decision_generic_nationalism
		selectable_mission = yes
		allowed = {
			original_tag = SWE
		}
		cancel_trigger = {  
				has_war_with = DEN
				has_war_with = FIN
				has_war_with = NOR
		}
#		available = {
#
		#	if = {
		#		limit = {
		#			check_variable = { SWE_sheltered_training_level < 2 }
		#		}
		#		command_power > 40
		#	}
		#	else = {
		#		has_army_experience > 15
		#	}
		#}
		
		visible = {
			has_completed_focus = SWE_train_the_sheltered
			check_variable = { SWE_sheltered_training_level < 4 }
		}
		custom_cost_text = SWE_train_the_sheltered_cost
		custom_cost_trigger = {
			if = {
				limit = {
					check_variable = { SWE_sheltered_training_level < 2 }
				}
				command_power > 40
			}
			else = {
				has_army_experience > 15
			}
		}		
		days_remove = 90
		complete_effect = {
			hidden_effect = {
				if = {
					limit = {
						check_variable = { SWE_sheltered_training_level < 2 }
					}
					add_command_power = -40
				}
				else = {
					army_experience = -15
				}

				
			}
			
			custom_effect_tooltip = SWE_train_the_sheltered_cat_add_cap_tt
			custom_effect_tooltip = SWE_the_cross_we_bear_tt_3
			SWE_increase_the_cross_we_bear  = yes
		}
		remove_effect = {
			add_to_variable = { SWE_train_the_sheltered_manpower_current_cap = SWE_train_the_sheltered_manpower_cap_increase }
			add_to_variable = { SWE_sheltered_training_level = 1 }
		}	
	}
}

SWE_mines = {
	SWE_blow_up_the_mines = {
		allowed = { 
			tag = SWE 
		}

		visible = {
			NOT = {
				666 = {
					has_dynamic_modifier = { modifier = SWE_blown_up_mines }
				}
				837 = {
					has_dynamic_modifier = { modifier = SWE_blown_up_mines }
				}
			}
			has_capitulated = no
		}
		cost = 15
		available = {
			has_war = yes
			controls_province = 11155 #Gällivare
			controls_province = 3095 #Kiruna
		}

		cancel_trigger = {
			has_war = no
			NOT = {
				ROOT = {
					OR = {
						controls_province = 11155 #Gällivare 
						controls_province = 3095 #Kiruna
					}
				}
			}


		}

		days_remove = 20

		remove_effect = {
			666 = {
				if = {
					limit = { controller = { tag = SWE }}
					add_dynamic_modifier = {
						modifier = SWE_blown_up_mines
					}
				}
			}

			918 = {
				if = {
					limit = { controller = { tag = SWE } }
					add_dynamic_modifier = {
						modifier = SWE_blown_up_mines
					}
				}
			}
		}

		ai_will_do = {
			factor = 0
			modifier = {
				surrender_progress > 0.1
				add = 150
			}
		}
	}

	SWE_repair_the_mines = {

		visible = {
			controls_province = 11155 #Gällivare
			controls_province = 3095 #Kiruna
			controls_state = 918
			OR = {
				666 = {
					has_dynamic_modifier = { modifier = SWE_blown_up_mines }
				}

				918 = {
					has_dynamic_modifier = { modifier = SWE_blown_up_mines }
				}
			}
			has_capitulated = no
		}
		modifier = {
			civilian_factory_use = 15
		}
		available = {
			controls_province = 11155 #Gällivare
			controls_province = 3095 #Kiruna
			controls_state = 918
		}

		cancel_trigger = {
			NOT = {
				OR = {
					controls_province = 11155 #Gällivare
					controls_province = 3095 #Kiruna
					controls_state = 918
				}
			}
		}

		days_remove = 120

		remove_effect = {
			666 = {
				remove_dynamic_modifier = {
					modifier = SWE_blown_up_mines
				}
			}

			918 = {
				remove_dynamic_modifier = {
					modifier = SWE_blown_up_mines
				}
			}
		}
	}
}

SWE_ebba_palmstierna_cat = {
	SWE_ebba_add_research = {

		visible = {
			SWE_ebba_palmstierna = { 
				NOT = { has_trait = SWE_suffragette_research }
			}
		}
		cost = 60
		available = {
			hidden_trigger = {
				SWE_ebba_palmstierna = { 
					NOT = { has_trait = SWE_suffragette_research }
				}
			}
		}

		complete_effect = {
			SWE_ebba_palmstierna = {
				hidden_effect = {
					if = {
						limit = {
							has_trait = SWE_suffragette
						}
						remove_trait = {
							trait = SWE_suffragette
							slot = political_advisor 
						}
					}
				}
				add_trait = {
					slot = political_advisor
					trait = SWE_suffragette_research
				}
			}
		}
	}

	SWE_ebba_add_production = {

		visible = {
			SWE_ebba_palmstierna = { 
				NOT = { has_trait = SWE_suffragette_production }
			}
		}
		cost = 60
		available = {
			hidden_trigger = {
				SWE_ebba_palmstierna = { 
					NOT = { has_trait = SWE_suffragette_production }
				}
			}
		}

		complete_effect = {
			SWE_ebba_palmstierna = {
				add_trait = {
					slot = political_advisor
					trait = SWE_suffragette_production
				}
			}
		}
	}

	SWE_ebba_political_clout = {

		visible = {
			SWE_ebba_palmstierna = { 
				NOT = { has_trait = SWE_suffragette_clout }
			}
		}
		cost = 60
		available = {
			hidden_trigger = {
				SWE_ebba_palmstierna = { 
					NOT = { has_trait = SWE_suffragette_clout }
				}
			}
		}

		complete_effect = {
			SWE_ebba_palmstierna = {
				add_trait = {
					slot = political_advisor
					trait = SWE_suffragette_clout
				}
			}
		}
	}
}


#SWE_per_albin_bus = {
#	SWE_move_the_bus = {
#
#		on_map_mode = map_only
#		state_target = yes
#		#targets_dynamic = yes
#		visible = {
#			has_variable = SWE_bus_location 
#			NOT = { has_country_flag = SWE_moving_bus }
#		}
#
#		available = {
#			has_variable = SWE_bus_location
#			has_fuel > 1
#		}
#		days_re_enable = 35
#		days_remove = 35
#	    target_trigger = {
#	    	ROOT = {
#	    		has_variable = SWE_bus_location
#	        	var:SWE_bus_location = {
#	        		any_neighbor_state = {
#	        			state = FROM
#	        			is_controlled_by = ROOT
#	        		}
	#        	}
 #       	}
#	    }
#	    complete_effect = {
#	    	set_country_flag = SWE_moving_bus
#	    } 
#		remove_effect = {
#			add_fuel = -1
#			custom_effect_tooltip = SWE_move_the_bus_tt
#			hidden_effect = {
#				clr_country_flag = SWE_moving_bus
#				var:SWE_bus_location = {
#					remove_dynamic_modifier = { modifier = SWE_bus }
#				}
#				ROOT= {
#					set_variable = { SWE_bus_location = FROM }
#				}
#
#				var:SWE_bus_location = { add_dynamic_modifier = { modifier = SWE_bus } }
#			}
#		}
#	}
#}

#SWE_riksdag_balance_of_power_category = {
#	SWE_BoP_election_countdown = {
#		icon = GFX_decision_eng_propaganda_campaigns
#		priority = 100
#		available = {
#			has_country_flag = SWE_election_active
#		}
#
#		cancel_trigger = {
#			has_country_flag = SWE_elections_suspended 
#		}
#
#		# 4 Years
#		#days_mission_timeout = 1460
#		# Jan 1st - Sep 20th
#		#days_mission_timeout = 324
#		days_mission_timeout = var:SWE_election_countdown
#
#		fire_only_once = no
#
#		activation = {
#			#tag = SWE
#			#NOT = { has_country_flag = SWE_elections_suspended }
#			#NOT = { has_country_flag = SWE_election_active }
#		}
#
#		visible = {
#			tag = SWE
#			NOT = { has_country_flag = SWE_elections_suspended }
#		}
#
#		cancel_if_not_visible = yes
#
#		is_good = yes
#
#		complete_effect = {
#
#		}
#
#		timeout_effect = {
#			SWE = {
#				country_event = {
#					id = AAT_Sweden_BoP.10
#					hours = 1
#				}
#				set_country_flag = SWE_election_active
#			}
#		}
#	}
#}

SWE_rationing_policies = {

	SWE_swap_herman_eriksson = {
		icon = decision_generic_nationalism	
        allowed = {
            tag = SWE
        }

		available = {
			SWE_herman_eriksson = {
				is_character_slot = political_advisor
				NOT = { has_trait = SWE_minister_of_supply }
			}
		}
		
		visible = {
			has_completed_focus = SWE_rationing
			SWE_herman_eriksson = { NOT = { has_trait = SWE_minister_of_supply }}
		}
		cost = 75

		complete_effect = { 
			SWE_herman_eriksson = {
				add_trait = {
					slot = political_advisor
					trait = SWE_minister_of_supply
				}
			}
		}
	}
	
	SWE_seize_civilian_tires = {
		
		visible = { always = yes }

		available = { 
			has_full_control_of_state = 141 
			hidden_trigger = {
				NOT = { has_country_flag = SWE_civilian_tire_timeout }
			}
		}
		days_re_enable = 180
		cost = 0

		complete_effect = { 
			if = {
				limit = {
					NOT = { has_country_flag = SWE_has_seized_civilian_tires }
				}

				set_country_flag =  SWE_has_seized_civilian_tires 
				add_stability = -0.02
				add_war_support = -0.01

				141 = {
					add_resource = {
						type = rubber
						amount = 22
					}
				}
			}
			else = {
				clr_country_flag =  SWE_has_seized_civilian_tires 
				add_stability = 0.02
				add_war_support = 0.01

				141 = {
					add_resource = {
						type = rubber
						amount = -22
					}
				}
			}
			set_country_flag = SWE_civilian_tire_timeout
			custom_effect_tooltip = SWE_rationing_cooldown
		}
	}

	SWE_time_until_can_pick_civilian_tires  = {
		
		visible = { always = yes }
		activation = {
			has_country_flag = SWE_civilian_tire_timeout
		}
		available = {
			hidden_trigger = {
				always = no
			}
		}
		days_mission_timeout = 180
		timeout_effect = { 
			clr_country_flag = SWE_civilian_tire_timeout
		}
	}




	SWE_gengas = {
		
		visible = { always = yes }

		available = { 

			hidden_trigger = { NOT = { has_country_flag = SWE_gengas_timeout }}
		}
		cost = 0
		days_re_enable = 180
		complete_effect = { 
			if = {
				limit = {
					NOT = { has_country_flag = SWE_gengas }
				}
				custom_effect_tooltip = SWE_rationing_gengas_add_tt
				add_to_variable = { SWE_rationing_policies_count = 1 }
				set_variable = { SWE_rationing_fuel_gain = 0.3 }
				set_country_flag =  SWE_gengas  
				add_stability = -0.02
				add_war_support = -0.01
				SWE_add_rationing_modifier = yes

			}
			else = {
				custom_effect_tooltip = SWE_rationing_gengas_remove_tt
				clr_country_flag =  SWE_gengas 
				add_stability = 0.02
				add_war_support = 0.01
				subtract_from_variable = { SWE_rationing_policies_count = 1 }
				set_variable = { SWE_rationing_fuel_gain = 0 }
				SWE_remove_rationing_modifier = yes

			}
			set_country_flag = SWE_gengas_timeout
			custom_effect_tooltip = SWE_rationing_cooldown
		}
	}

	SWE_time_until_can_pick_gengas = {
		
		visible = { always = yes }
		activation = {
			has_country_flag = SWE_gengas_timeout
		}
		available = {
			hidden_trigger = {
				always = no
			}
		}
		days_mission_timeout = 180
		timeout_effect = { 
			clr_country_flag =  SWE_gengas_timeout 
		}
	}

	SWE_food_stamps = {
		
		visible = { always = yes }

		available = { 
			hidden_trigger = { NOT = { has_country_flag = SWE_food_stamps_timeout }}
		}
		days_re_enable = 180
		cost = 0

		complete_effect = { 
			if = {
				limit = {
					NOT = { has_country_flag = SWE_has_food_stamps }
				}
				custom_effect_tooltip = SWE_rationing_food_stamps_add_tt
				add_to_variable = { SWE_rationing_policies_count = 1 }
				set_variable = { SWE_rationing_war_stability_factor = 0.05 }
				set_country_flag =  SWE_has_food_stamps 
				add_war_support = -0.03
				SWE_add_rationing_modifier = yes

			}
			else = {
				custom_effect_tooltip = SWE_rationing_food_stamps_remove_tt
				clr_country_flag =  SWE_has_food_stamps 
				add_war_support = 0.03
				subtract_from_variable = { SWE_rationing_policies_count = 1 }
				set_variable = { SWE_rationing_war_stability_factor = 0 }
				SWE_remove_rationing_modifier = yes

			}
			set_country_flag = SWE_food_stamps_timeout 
			custom_effect_tooltip = SWE_rationing_cooldown
		}
	}

	SWE_time_until_can_pick_food_stamps = {
		
		visible = { always = yes }
		activation = {
			has_country_flag = SWE_food_stamps_timeout
		}
		available = {
			hidden_trigger = {
				always = no
			}
		}
		days_mission_timeout = 180
		timeout_effect = { 
			clr_country_flag = SWE_food_stamps_timeout 
		}
	}

	SWE_air_raid_shelters = {

		visible = { always = yes }

		available = { 
			hidden_trigger = {
				NOT = { has_country_flag = SWE_air_raid_shelter_timeout }
			}
		}
		cost = 0
		days_re_enable = 180
		complete_effect = { 
			if = {
				limit = {
					NOT = { has_country_flag = SWE_has_air_raid_shelters }
				}
				custom_effect_tooltip = SWE_air_raid_shelters_add_tt
				add_to_variable = { SWE_rationing_policies_count = 1 }
				set_variable = { SWE_rationing_bombing_war_support = 0.0003 }
				set_variable = { SWE_rationing_consumer_goods = 0.03 }
				set_country_flag =  SWE_has_air_raid_shelters  
				SWE_add_rationing_modifier = yes

			}
			else = {
				custom_effect_tooltip = SWE_air_raid_shelters_remove_tt
				clr_country_flag =  SWE_has_air_raid_shelters 
				subtract_from_variable = { SWE_rationing_policies_count = 1 }
				set_variable = { SWE_rationing_bombing_war_support = 0 }
				set_variable = { SWE_rationing_consumer_goods = 0 }
				SWE_remove_rationing_modifier = yes

			}
			set_country_flag = SWE_air_raid_shelter_timeout
			custom_effect_tooltip = SWE_rationing_cooldown
		}
	}

	SWE_time_until_can_pick_air_shelters = {
		
		visible = { always = yes }
		activation = {
			hidden_trigger = { has_country_flag = SWE_air_raid_shelter_timeout }
		}
		available = {
			hidden_trigger = {
				always = no
			}
		}
		days_mission_timeout = 180
		timeout_effect = { 
			clr_country_flag =  SWE_air_raid_shelter_timeout 
		}
	}

	SWE_bop_suspend_riksdag = {
		icon = GFX_decision_gre_faction_management
		available = {
			AND = {
				OR = {
					has_government = communism
					has_government = fascism
					has_government = neutrality
				}
				OR = {
					power_balance_value = {
						id = SWE_riksdag_political_balance
						value < -0.7
					}
					power_balance_value = {
						id = SWE_riksdag_political_balance
						value > 0.7
					}
					AND = {
						power_balance_value = {
							id = SWE_riksdag_political_balance
							value > 0.4
						}
						has_country_flag = SWE_return_of_the_king
					}
				}
			}
		}
		visible = {
			has_power_balance = {
				id = SWE_riksdag_political_balance
			}
		}
		cost = 150

		complete_effect = {
			remove_power_balance = {
				id = SWE_riksdag_political_balance
			}
			set_variable = {
				var = SWE_opposition_pop
				value = 0
			}
			IF = {
				limit = {
					has_government = fascism
				}
				add_to_variable = {
					var:SWE_opposition_pop = party_popularity@communism
				}
				add_to_variable = {
					var:SWE_opposition_pop = party_popularity@neutrality
				}
				add_to_variable = {
					var:SWE_opposition_pop = party_popularity@democratic
				}
			}
			ELSE_IF = {
				limit = {
					has_government = communism
				}
				add_to_variable = {
					var:SWE_opposition_pop = party_popularity@fascism
				}
				add_to_variable = {
					var:SWE_opposition_pop = party_popularity@neutrality
				}
				add_to_variable = {
					var:SWE_opposition_pop = party_popularity@democratic
				}
			}
			ELSE_IF = {
				limit = {
					has_government = neutrality
				}
				add_to_variable = {
					var:SWE_opposition_pop = party_popularity@communism
				}
				add_to_variable = {
					var:SWE_opposition_pop = party_popularity@fascism
				}
				add_to_variable = {
					var:SWE_opposition_pop = party_popularity@democratic
				}
			}
			multiply_variable = { SWE_opposition_pop = -1.00 }
			add_stability = SWE_opposition_pop
		}
	}
}

SWE_military_matters = {
	SWE_rangers_sabotage = {
		icon = decision_generic_nationalism
		allowed = {
			original_tag = SWE
		}
		available = {
			has_manpower > 1300
			NOT = { has_country_flag = SWE_rangers_sent_out }
		}
		
		visible = {
			has_completed_focus = SWE_jagartrupper
		}

		days_re_enable = 90
		on_map_mode = map_and_decisions_view
		state_target = yes
		target_root_trigger = {
			has_completed_focus = SWE_jagartrupper
		}
		target_trigger = {
			FROM = {
				NOT = { is_controlled_by = ROOT }
				controller = {
					has_war_with = ROOT
				}
				OR = {
					supply_node > 0
					naval_base > 0
				}
				any_neighbor_state = {
					is_controlled_by = ROOT
				}
			}
		}
		complete_effect = {

			FROM = {
				if = {
					limit = {
						supply_node > 0
					}
					damage_building = {
				 		type = supply_node 
				 		damage = 1.5
				 	}
				 	add_to_temp_variable = { PREV.supply_level = 8 }
				}
		 			 	log = "[?supply_level]"
				if = {
					limit = {
						naval_base > 0
					}

					damage_building = {
				 		type = naval_base 
				 		damage = 1.5
				 	}

				 	add_to_temp_variable = { PREV.supply_level = 5 }
				}
		 	}

		 	multiply_temp_variable = { supply_level = 100 }
		 	multiply_temp_variable = { supply_level = -1 }


			set_temp_variable_to_random = {
				var = SWE_manpower_loss_from_raid 
				min = supply_level
				max = 0
			}

			clamp_variable = {
				var = supply_level
				min = -1300
				max = 0
			}
			hidden_effect = {
				add_manpower = SWE_manpower_loss_from_raid
			}
			custom_effect_tooltip = SWE_rangers_tt
			set_country_flag = { flag = SWE_rangers_sent_out days = 90 value = 1 }
		}	
	}

	SWE_set_up_home_guard_forces = {
		allowed = { 
			tag = SWE 
		}

		visible = {
			has_completed_focus = SWE_hemvarnet
			FROM = {
				NOT = { has_state_flag = has_activated_home_guard }
			}
		}

		available = {
			FROM = {
				is_fully_controlled_by = ROOT
			}
		}

		cancel_trigger = {
			NOT = {
				FROM = {
					is_fully_controlled_by = ROOT
				}
			}
		}
		on_map_mode = map_and_decisions_view	
		state_target = yes

		custom_cost_trigger = {
			command_power > 35
		}
		custom_cost_text = decision_cost_CP_35
		days_remove = 35
		target_trigger = {
			FROM = {
				is_core_of = SWE
				controller = {
					tag = SWE
				}
				check_variable = { SWE_has_added_home_guard < 3 }
			}
		}

		complete_effect = {
			hidden_effect = { add_command_power = -35 }
		}

		remove_effect = {
			custom_effect_tooltip = SWE_set_up_home_guard_forces_tt
			FROM = {
				add_to_variable = { SWE_has_added_home_guard = 1 }
				add_to_variable = { SWE_shooting_movement_var = 1 }

			}
		}
	}

	SWE_activate_home_guard = {
		allowed = { 
			tag = SWE 
		}

		visible = {
			has_completed_focus = SWE_hemvarnet
			FROM = {
				NOT = { has_state_flag = has_activated_home_guard }
			}
		}

		available = {
			has_war = yes
			
			FROM = {
				controller = {
					tag = ROOT
				}
			}
		}


		on_map_mode = map_only	
		state_target = yes

		target_trigger = {
			FROM = {
				is_core_of = SWE

				check_variable = { SWE_has_added_home_guard > 0 }
			}
		}

		complete_effect = {
			custom_effect_tooltip = SWE_activate_home_guard_tt
			FROM = {
				while_loop_effect = {
					limit = { check_variable = { SWE_has_added_home_guard > 0 } }


					subtract_from_variable = { SWE_has_added_home_guard = 1 }
					if = {
						limit = {
							NOT = { SWE = { has_completed_focus = SWE_swedish_shooting_movement }}
						}
						create_unit = {
							division = "name = \"Hemvärn\" division_template = \"Hemvärn\" start_experience_factor = 0.1 start_equipment_factor = 0.6 start_manpower_factor = 0.7"
							allow_spawning_on_enemy_provs = no
							owner = ROOT
						}
					}
					else = {
						create_unit = {
							division = "name = \"Hemvärn\" division_template = \"Hemvärn\" start_experience_factor = 0.3 start_equipment_factor = 0.9 start_manpower_factor = 0.9"
							allow_spawning_on_enemy_provs = no
							owner = ROOT
						}
					}
				}

				set_state_flag = has_activated_home_guard
			}
		}
	}

	SWE_activate_all_home_guard = {
		allowed = { 
			tag = SWE 
		}

		visible = {
			has_completed_focus = SWE_hemvarnet
			any_core_state = {
				check_variable = { SWE_has_added_home_guard > 0 }
			}

			any_core_state = {
				NOT = { has_state_flag = has_activated_home_guard }
			}
		}

		available = {
			has_war = yes
			
		}

		complete_effect = {
			custom_effect_tooltip = SWE_activate_all_home_guard_tt
			every_core_state = {
				limit = {
					NOT = { has_state_flag = has_activated_home_guard }
				}
				set_state_flag = has_activated_home_guard
				while_loop_effect = {
					limit = { check_variable = { SWE_has_added_home_guard > 0 } }

					subtract_from_variable = { SWE_has_added_home_guard = 1 }
					if = {
						limit = {
							NOT = { SWE = { has_completed_focus = SWE_swedish_shooting_movement }}
						}
						create_unit = {
							division = "name = \"Hemvärn\" division_template = \"Hemvärn\" start_experience_factor = 0.1 start_equipment_factor = 0.6 start_manpower_factor = 0.7"
							allow_spawning_on_enemy_provs = no
							owner = ROOT
						}
					}
					else = {
						create_unit = {
							division = "name = \"Hemvärn\" division_template = \"Hemvärn\" start_experience_factor = 0.3 start_equipment_factor = 0.9 start_manpower_factor = 0.9"
							allow_spawning_on_enemy_provs = no
							owner = ROOT
						}
					}
				}
			}

			set_division_template_lock = {
				division_template = "Hemvärn"
				is_locked = no
			}
		}
	}
}

SWE_ball_bearings_cat = {
	SWE_trade_ball_bearings = {

		on_map_mode = map_and_decisions_view
		#targets_dynamic = yes
		visible = {
			original_tag = SWE
			has_capitulated = no
		}
		cost = 30 #REMEMBER TO UPDATE AAT_Sweden_ball_bearing.1 to match!!!
		available = {
			NOT = { has_country_flag = SWE_waiting_for_ball_bearing_response }
		}
		days_re_enable = 50
	    target_trigger = {
	    	FROM = {
	    		is_major = yes
	    		NOT = { 
	    			has_war_with = ROOT 
	    			OR = {
	    				has_idea = SWE_ball_bearing_idea
	    				has_idea = SWE_ball_bearing_idea_food_partner
	    				has_idea = SWE_ball_bearing_idea_research_partner
	    			}
	    		}
        	}
	    }

	    ai_will_do = {
	    	base = 10

	    	modifier = {
	    		FROM = {
	    			is_ai = no
	    			NOT = { has_war_with = NOR }
	    			NOT = { has_war_with = FIN }
	    			NOT = { has_war_with = ICE }
	    			NOT = { has_war_with = DEN }
	    		}

	    		factor = 10
	    	}
	    }
	    complete_effect = {
	    	set_country_flag = {
    			flag = SWE_waiting_for_ball_bearing_response
    			days = 60 #just set to expire in 60 days in case something goes bad
    			value = 1
			}
	    	FROM = {
	    		set_variable = { PREV.ball_bearing_country_target = THIS }
	    	}
	    	country_event = { id = AAT_Sweden_ball_bearing.1 }
	    } 
	}

	SWE_revoke_food_trade = {
		visible = {
			has_idea = SWE_ball_bearing_idea_food_partner
		}
		cost = 35
	    complete_effect = {
	    	remove_ideas = SWE_ball_bearing_idea_food_partner

			SWE_reduce_or_remove_ball_bearing_food_trade_modifier = yes
	    } 
	}

	SWE_revoke_research_exchange = {
		visible = {
			has_idea = SWE_ball_bearing_idea_research_partner
		}
		cost = 0
	    complete_effect = {
	    	remove_ideas = SWE_ball_bearing_idea_research_partner
	    } 
	}
}

#SWE_fascism_buildup = {
#SWE_stormtrupper_recruitment = {
#	visible = {
#		has_completed_focus = SWE_revoke_anti_militia_laws
#		NOT = {
#			has_country_flag = SWE_manual_recruit_stormtruppers
#		}
#	}
#	cost = 30
#	icon = GFX_decision_generic_military
#	state_target = yes
#	target_trigger = {
#	    FROM = {
#	        is_core_of = ROOT
#	        is_fully_controlled_by = ROOT
#	        NOT = { has_state_flag = SWE_militia_established }
#	    }
#	    
#	}
#	on_map_mode = map_and_decisions_view 
#	days_remove = 10

#	remove_effect = {
#		FROM = {
#			set_state_flag = SWE_militia_established
#		}
#		add_stability = -0.01			
#		effect_tooltip = {
#			set_temp_variable = { SWE_new_militia_cap_for_tooltip = SWE_stormtrupper_division_cap }
#			add_to_temp_variable = { SWE_new_militia_cap_for_tooltip = 1 }
#			set_division_template_cap = { 
#				division_template = "Stormtrupper" 
#				division_cap = SWE_new_militia_cap_for_tooltip   
#			}
#		}

#		hidden_effect = {
#			add_to_variable = { SWE_stormtrupper_division_cap = 1 }
#			clamp_variable = {
#				var = SWE_stormtrupper_division_cap
#				min = 0 
#				max = SWE_max_stormtrupper_division_cap
#			}  
#			set_division_template_cap = { 
#				division_template = "Stormtrupper" 
#				division_cap = SWE_stormtrupper_division_cap  
#			}
#		}
#	}

#	ai_will_do = {
#		base = 80
#		modifier = {
#			OR = {
#				fascism > 0.5 
#				has_government = fascism
#			}

#			factor = 0
#		}
#	}
#}
#
#	SWE_fascist_march = {
#		visible = {
#			has_completed_focus = SWE_unify_the_national_socialist_movement
#		}
#		cost = 0
#		icon = GFX_decision_eng_blackshirt_march
#		state_target = yes
#		target_trigger = {
#		    FROM = {
#		        is_core_of = ROOT
#		        is_fully_controlled_by = ROOT
#		        has_state_flag = SWE_militia_established
#		        NOT = { has_state_flag = SWE_fascist_march_occured }
#		    }
#		    
#		}
#		on_map_mode = map_and_decisions_view 
#		days_remove = 7
#
#		remove_effect = {
#			FROM = {
#				set_state_flag = SWE_fascist_march_occured
#			}
#			random_list = {
#				# Bad march
#				25 = {
#					country_event = { id = AAT_Sweden_nationalists.5 days = 1 }
#					effect_tooltip = {
#						add_stability = -0.07
#						add_popularity = { ideology = fascism popularity = 0.03 }
#					}
#				}
#				# Average march
#				50 = {
#					country_event = { id = AAT_Sweden_nationalists.6 days = 1 }
#					effect_tooltip = {
#						add_stability = -0.04
#						add_popularity = { ideology = fascism popularity = 0.06 }
#					}
#				}
#				# Good march
#				25 = {
#					country_event = { id = AAT_Sweden_nationalists.7 days = 1 }
#					effect_tooltip = {
#						add_war_support = 0.07
#						add_stability = -0.02
#						add_popularity = { ideology = fascism popularity = 0.09 }
#					}
#				}
#			}
#		}
#
#		ai_will_do = {
#			base = 100
#			modifier = {
#
#				OR = {
#					fascism > 0.5 
#					has_government = fascism
#				}
#
#				factor = 0
#			}
#		}
#	}
#}

SWE_appeal_for_support_cat = {
	SWE_appeal_to_aristocracy = {
		visible = {
			has_completed_focus = SWE_appeal_for_support
			NOT = { 
				has_country_flag = SWE_aristocratic_support 
			}
		}
		available = {
			NOT = {
				has_country_flag = SWE_appeal_for_support_in_progress
			}
		}
		cost = 0
		icon = GFX_decision_generic_political_discourse
	

		days_remove = 14
		complete_effect = {
			set_country_flag = SWE_appeal_for_support_in_progress
		}
	
		remove_effect = {
			set_country_flag = SWE_aristocratic_support
			country_event = {
				id = AAT_Sweden_nationalists.8
				days = 1
			}
			event_option_tooltip = AAT_Sweden_nationalists.8.a 
		}

		ai_will_do = {
			base = 0
		}
	}

	SWE_appeal_to_industrialists = {
		visible = {
			has_completed_focus = SWE_appeal_for_support
			NOT = { 
				has_country_flag = SWE_appeal_to_industrialists_flag 
				#has_country_flag = SWE_appeal_for_support_in_progress
			}
		}
		available = {
			NOT = {
				has_country_flag = SWE_appeal_for_support_in_progress
			}
		}
		cost = 0
		icon = GFX_decision_category_gre_investment_decisions
	

		days_remove = 14
		complete_effect = {
			set_country_flag = SWE_appeal_for_support_in_progress
		}
		remove_effect = {
			set_country_flag = SWE_appeal_to_industrialists_flag
			country_event = {
				id = AAT_Sweden_nationalists.9
				days = 1
			}
			event_option_tooltip = AAT_Sweden_nationalists.9.a 
		}

		ai_will_do = {
			base = 0
		}
	}

	SWE_appeal_to_military = {
		visible = {
			has_completed_focus = SWE_appeal_for_support
			NOT = { 
				has_country_flag = SWE_appeal_to_military_flag 
				#has_country_flag = SWE_appeal_for_support_in_progress
			}
		}
		available = {
			NOT = {
				has_country_flag = SWE_appeal_for_support_in_progress
			}
		}
		cost = 0
		icon = GFX_decision_generic_military
	

		days_remove = 14
		complete_effect = {
			set_country_flag = SWE_appeal_for_support_in_progress
		}
		remove_effect = {
			set_country_flag = SWE_appeal_to_military_flag
			country_event = {
				id = AAT_Sweden_nationalists.10
				days = 1
			}
			event_option_tooltip = AAT_Sweden_nationalists.10.a 
		}

		ai_will_do = {
			base = 20
		}
	}

	SWE_appeal_to_rural_people = {
		visible = {
			has_completed_focus = SWE_appeal_for_support
			NOT = { 
				has_country_flag = SWE_appeal_to_rural_flag
				#has_country_flag = SWE_appeal_for_support_in_progress
			}
		}
		available = {
			NOT = {
				has_country_flag = SWE_appeal_for_support_in_progress
			}
		}
		cost = 0
		icon = GFX_decision_POL_looming_peasants_strike
	

		days_remove = 14
		complete_effect = {
			set_country_flag = SWE_appeal_for_support_in_progress
		}
		remove_effect = {
			set_country_flag = SWE_appeal_to_rural_flag
			country_event = {
				id = AAT_Sweden_nationalists.11
				days = 1
			}
			event_option_tooltip = AAT_Sweden_nationalists.11.a 
		}

		ai_will_do = {
			base = 20
		}
	}

	SWE_implement_aristocracy_reforms_countdown = {
	
		icon = GFX_decision_generic_political_discourse
		selectable_mission = no
		allowed = {
			original_tag = SWE
		}
		cancel_trigger = { has_country_flag = SWE_implemented_artistocratic_reforms }
		available = {
			hidden_trigger = {
				always = no
			}
		}
		
		visible = {
			has_country_flag = SWE_aristocratic_support
			has_completed_focus	= SWE_mythologize_swedish_history
		}
		activation = {
			always = no
		}
		is_good = no
		days_mission_timeout = 720
		fire_only_once = yes
		
		timeout_effect = {
			add_stability = -0.1
		}	
	}

	SWE_implement_industrialist_reforms_countdown = {

		icon = GFX_decision_category_gre_investment_decisions
		selectable_mission = no
		allowed = {
			original_tag = SWE
		}
		cancel_trigger = { has_country_flag = SWE_implemented_industrialist_reforms }
		available = {
			hidden_trigger = {
				always = no
			}
		}
		
		visible = {
			has_country_flag = SWE_appeal_to_industrialists_flag
			has_completed_focus	= SWE_mythologize_swedish_history
		}
		activation = {
			always = no
		}
		is_good = no
		days_mission_timeout = 720
		fire_only_once = yes
		
		timeout_effect = {
			add_stability = -0.1
		}	
	
	}

	SWE_implement_military_reforms_countdown = {
		icon = GFX_decision_generic_military
		selectable_mission = no
		allowed = {
			original_tag = SWE
		}
		cancel_trigger = { has_country_flag = SWE_implemented_military_reforms }
		available = {
			hidden_trigger = {
				always = no
			}
		}
		
		visible = {
			has_country_flag = SWE_appeal_to_military_flag
			has_completed_focus	= SWE_mythologize_swedish_history
		}
		activation = {
			always = no
		}
		is_good = no
		days_mission_timeout = 720
		fire_only_once = yes
		
		timeout_effect = {
			add_stability = -0.1
		}	
	}

	SWE_implement_rural_reforms_countdown = {
		icon = GFX_decision_POL_looming_peasants_strike
		selectable_mission = no
		allowed = {
			original_tag = SWE
		}
		cancel_trigger = { has_country_flag = SWE_implemented_rural_reforms }
		available = {
			hidden_trigger = {
				always = no
			}
		}
		
		visible = {
			has_country_flag = SWE_appeal_to_rural_flag
			has_completed_focus	= SWE_mythologize_swedish_history
		}
		activation = {
			always = no
		}
		is_good = no
		days_mission_timeout = 720
		fire_only_once = yes
		
		timeout_effect = {
			add_stability = -0.1
		}	
	}

	SWE_implement_aristocracy_reforms = {
	
		icon = GFX_decision_generic_political_discourse
		cost = 100
		allowed = {
			original_tag = SWE
		}
		available = {
			has_active_mission = SWE_implement_aristocracy_reforms_countdown
			NOT = { 
				has_country_flag = SWE_implemented_artistocratic_reforms
			}
		}
		
		visible = {
			has_active_mission = SWE_implement_aristocracy_reforms_countdown
		}

		complete_effect = {
			set_country_flag = SWE_implemented_artistocratic_reforms
			add_timed_idea = {
				idea = SWE_aristocracy_reforms
				days = 365
			}
			country_event = {
				id = AAT_Sweden_nationalists.12
				hours = 1
			}
		}	
	}

	SWE_implement_industrialist_reforms = {
	
		icon = GFX_decision_category_gre_investment_decisions
		cost = 100
		allowed = {
			original_tag = SWE
		}
		available = {
			has_active_mission = SWE_implement_industrialist_reforms_countdown
			NOT = { 
				has_country_flag = SWE_implemented_industrialist_reforms
			}
		}
		
		visible = {
			has_active_mission = SWE_implement_industrialist_reforms_countdown
		}

		complete_effect = {
			set_country_flag = SWE_implemented_industrialist_reforms
			add_timed_idea = {
				idea = SWE_unions_banned
				days = 365
			}
			IF = {
				limit = { has_idea = SWE_attack_unions }
				remove_ideas = SWE_attack_unions
			}
			country_event = {
				id = AAT_Sweden_nationalists.13
				hours = 1
			}
		}	
	}


	SWE_implement_military_reforms = {
	
		icon = GFX_decision_generic_military
		cost = 100
		allowed = {
			original_tag = SWE
		}
		available = {
			has_active_mission = SWE_implement_military_reforms_countdown
			NOT = { 
				has_country_flag = SWE_implemented_military_reforms
			}
		}
		
		visible = {
			has_active_mission = SWE_implement_military_reforms_countdown
		}

		complete_effect = {
			set_country_flag = SWE_implemented_military_reforms
			add_stability = 0.05
			add_timed_idea = {
				idea = SWE_increased_military_budget
				days = 365
			}
			country_event = {
				id = AAT_Sweden_nationalists.14
				hours = 1
			}
		}

		ai_will_do = {
			base = 20
		}	
	}

	SWE_implement_rural_reforms = {
		
		icon = GFX_decision_POL_looming_peasants_strike
		cost = 100
		allowed = {
			original_tag = SWE
		}
		available = {
			has_active_mission = SWE_implement_rural_reforms_countdown
			NOT = { 
				has_country_flag = SWE_implemented_rural_reforms
			}
		}
		
		visible = {
			has_active_mission = SWE_implement_rural_reforms_countdown
		}

		complete_effect = {
			custom_effect_tooltip = SWE_implemented_rural_reforms_tt
			add_stability = 0.05
			hidden_effect = {
				set_country_flag = SWE_implemented_rural_reforms
				random_owned_state = {
					limit = {
						is_controlled_by = ROOT
						OR = {
							has_state_category = wasteland
							has_state_category = pastoral
							has_state_category = rural
							has_state_category = town
						}
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
					add_extra_state_shared_building_slots = 1
				}
				random_owned_state = {
					limit = {
						is_controlled_by = ROOT
						OR = {
							has_state_category = wasteland
							has_state_category = pastoral
							has_state_category = rural
							has_state_category = town
						}
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
					add_extra_state_shared_building_slots = 1
				}
				random_owned_state = {
					limit = {
						is_controlled_by = ROOT
						OR = {
							has_state_category = wasteland
							has_state_category = pastoral
							has_state_category = rural
							has_state_category = town
						}
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
					add_extra_state_shared_building_slots = 1
				}
			}
			country_event = {
				id = AAT_Sweden_nationalists.15
				hours = 1
			}
		}

		ai_will_do = {
			base = 20
		}	
	}

}

SWE_royalist_buildup = {
	SWE_royal_visit = {
		visible = {
			has_completed_focus = SWE_meet_with_the_king
		    neutrality < 0.55
		}
		available = {
			NOT = { has_country_flag = SWE_royal_visit_in_progress }
		}
		cost = 10
		icon = GFX_decision_eng_support_imperialist_coup
		state_target = yes
		target_trigger = {
		    FROM = {
		        is_core_of = ROOT
		        is_fully_controlled_by = ROOT
		        NOT = { has_state_flag = SWE_royalist_march_occured }
				OR = {
					state = 140 #Göteborg
					state = 141 #Stockholm
					state = 138 #Skåne
				}
		    }
		}
		on_map_mode = map_and_decisions_view 
		days_remove = 7
		complete_effect = {
			set_country_flag = SWE_royal_visit_in_progress
		}

		remove_effect = {
			FROM = {
				set_state_flag = SWE_royalist_march_occured		
				add_dynamic_modifier = { modifier = SWE_royal_visit_modifier }
			}
			if = {
				limit = { is_ai = no }
				random_list = {
				# Bad march
					15 = {
						country_event = { id = AAT_Sweden_nationalists.16 days = 1 }
						event_option_tooltip = AAT_Sweden_nationalists.16.a
					}
				# Average march
					60 = {
						country_event = { id = AAT_Sweden_nationalists.17 days = 1 }
						event_option_tooltip = AAT_Sweden_nationalists.17.a
					}
				# Good march
					35 = {
						country_event = { id = AAT_Sweden_nationalists.18 days = 1 }
						event_option_tooltip = AAT_Sweden_nationalists.18.a
					}
				}
			}
			if = {
				limit = { is_ai = yes }
				random_list = {
				# Bad march
					5 = {
						country_event = { id = AAT_Sweden_nationalists.16 days = 1 }
						event_option_tooltip = AAT_Sweden_nationalists.16.a
					}
				# Average march
					5 = {
						country_event = { id = AAT_Sweden_nationalists.17 days = 1 }
						event_option_tooltip = AAT_Sweden_nationalists.17.a
					}
				# Good march
					90 = {
						country_event = { id = AAT_Sweden_nationalists.18 days = 1 }
						event_option_tooltip = AAT_Sweden_nationalists.18.a
					}
				}
			}
		}

		ai_will_do = {
			base = 20
		}
	}
}

SWE_communist_foreign_influence = {
		SWE_pull_the_trigger_nor = {
			icon = generic_civil_support
			visible = {
				has_completed_focus = SWE_support_norwegian_communists
				NOT = { has_country_flag = SWE_has_triggered_nor_com_uprising }
				NOR = { NOT = { has_completed_focus = NOR_a_resurgent_labor_movement }}
			}

			available = {
				#hidden_trigger = {
				#	NOR = {
				#		is_ai = no
				#	}
				#	is_ai = yes
				#}

				NOR = {
					NOT = { has_government = communism }
					communism > 0.3
				}
			}

			ai_will_do = {
				factor = 1
				modifier = {
					NOR = {
						is_ai = no
					}
					factor = 0
				}
			}

			complete_effect = {
				hidden_effect = {
					set_country_flag = SWE_has_triggered_nor_com_uprising
				}
				NOR = {
					NOR_character_flag_setup_for_cw = yes 
					set_temp_variable = { SWE_NOR_communist_support = party_popularity@communism }

					if = {
						limit = {
							has_government = democratic
						}

						start_civil_war = {
							ideology = communism
							ruling_party = democratic
							size = var:SWE_NOR_communist_support 
							keep_all_characters = yes
						}
						set_variable = { SWE.SWE_dem_norway = THIS } 
						random_other_country = {
							limit = {
								original_tag = NOR 
								has_government = communism 
							}
							set_variable = { SWE.SWE_com_norway = THIS }
						}
						every_character = {
							limit = {
								OR = {
									has_character_flag = NOR_anti_trostky
									has_character_flag = NOR_anti_stalin 
								}
							}
							set_nationality = var:SWE.SWE_com_norway
						}
						hidden_effect = {
							var:SWE.SWE_com_norway = {
								retire_country_leader = yes
								load_focus_tree = { 
									tree = generic_focus
									 keep_completed = no
								}
							}
						}
					}

					else_if = {
						limit = {
							has_government = fascism
						}

						start_civil_war = {
							ideology = communism
							ruling_party = fascism
							size = var:SWE_NOR_communist_support
							keep_all_characters = yes 
						}
						set_variable = { SWE.SWE_fas_norway = THIS }
						random_other_country = {
							limit = {
								original_tag = NOR 
								has_government = communism 
							}
							set_variable = { SWE.SWE_com_norway = THIS }
						}
						every_character = {
							limit = {
								OR = {
									AND = {
										has_character_flag = NOR_anti_fascist
										NOT = { has_character_flag = NOR_anti_communist }
									}
									has_character_flag = NOR_anti_trostky
									has_character_flag = NOR_anti_stalin
								}
							}
							set_nationality = var:SWE.SWE_com_norway
						}
						hidden_effect = {
							var:SWE.SWE_com_norway = {
								retire_country_leader = yes
								load_focus_tree = { 
									tree = generic_focus
									keep_completed = no
								}
							}
						}
					}

					else_if = {
						limit = {
							has_government = neutrality
						}

						start_civil_war = {
							ideology = communism
							ruling_party = neutrality
							size = var:SWE_NOR_communist_support
							keep_all_characters = yes 
						}
						set_variable = { SWE.SWE_mon_norway = THIS }
						random_other_country = {
							limit = {
								original_tag = NOR 
								has_government = communism 
							}
							set_variable = { SWE.SWE_com_norway = THIS }
						}
						every_character = {
							limit = {
								OR = {
									has_character_flag = NOR_anti_trostky
									has_character_flag = NOR_anti_stalin 							
								}
							}
							set_nationality = var:SWE.SWE_com_norway
						}
						hidden_effect = {
							var:SWE.SWE_com_norway = {
								retire_country_leader = yes
								load_focus_tree = { 
									tree = generic_focus
									keep_completed = no
								}
							}
						}
					}
				}
				custom_effect_tooltip = SWE_pull_the_trigger_tt
			}
		}

		SWE_pull_the_trigger_den = {
			icon = generic_civil_support
			visible = {
				has_completed_focus = SWE_support_danish_communists
				NOT = { has_country_flag = SWE_has_triggered_den_com_uprising }
			}

			available = {
				#hidden_trigger = {
				#	NOR = {
				#		is_ai = no
				#	}
				#	is_ai = yes
				#}

				DEN = {
					NOT = { has_government = communism }
					communism > 0.3
				}
			}

			ai_will_do = {
				factor = 1
				modifier = {
					DEN = {
						is_ai = no
					}
					factor = 0
				}
			}

			complete_effect = {
				hidden_effect = {
					set_country_flag = SWE_has_triggered_den_com_uprising
				}
				DEN = {
					set_temp_variable = { SWE_DEN_communist_support = party_popularity@communism }

					if = {
						limit = {
							has_government = democratic
						}

						start_civil_war = {
							ideology = communism
							ruling_party = democratic
							size = var:SWE_DEN_communist_support 
						}
					}

					else_if = {
						limit = {
							has_government = fascism
						}

						start_civil_war = {
							ideology = communism
							ruling_party = fascism
							size = var:SWE_DEN_communist_support
						}
					}

					else_if = {
						limit = {
							has_government = neutrality
						}

						start_civil_war = {
							ideology = communism
							ruling_party = neutrality
							size = var:SWE_DEN_communist_support
						}
					}
				}

				custom_effect_tooltip = SWE_pull_the_trigger_tt
			}
		}
}

SWE_coalition_war_cabinet_cat = {

	SWE_upgrade_current_trait = {
		available = {
			NOT = {
				has_country_flag = SWE_has_picked_war_cabinet_trait
			}
		}

		ai_will_do = {
			factor = 1
			modifier = {
				has_game_rule = {
					rule = SWE_ai_behavior
					option = SWE_DEMOCRATIC_DEM_ALT
				}

				factor = 6
			}
		}

		complete_effect = {
			set_country_flag = SWE_has_picked_war_cabinet_trait
			if = {
				limit = {
					has_country_leader_with_trait = SWE_solidified_mandate
				}


				swap_ruler_traits = { remove = SWE_solidified_mandate  add = SWE_solidified_mandate_upgraded  }
			}

			else_if = {
				limit = {
					has_country_leader_with_trait = SWE_rearnament_proponent
				}
				swap_ruler_traits = { remove = SWE_rearnament_proponent  add = SWE_rearnament_proponent_upgraded  }
				custom_effect_tooltip = SWE_rearnament_proponent_upgraded_tt
			}

			else_if = {
				limit = {
					has_country_leader_with_trait = minister_of_ecclesiastical_affairs
				}
				swap_ruler_traits = { remove = minister_of_ecclesiastical_affairs  add = minister_of_ecclesiastical_affairs_upgraded  }
			}

			else_if = {
				limit = {
					has_country_leader_with_trait = captain_of_industry
				}
				swap_ruler_traits = { remove = captain_of_industry  add = SWE_admiral_of_industry  }
			}

			custom_effect_tooltip = SWE_has_picked_war_cabinet_trait_tt
		}
	}

	SWE_upgrade_close_ties_to_the_military = {
		available = {
			NOT = {
				has_country_flag = SWE_has_picked_war_cabinet_trait
			}
		}
		ai_will_do = {
			factor = 1
		}
		complete_effect = {
			set_country_flag = SWE_has_picked_war_cabinet_trait
			add_country_leader_trait = SWE_close_ties_to_the_military
			custom_effect_tooltip = SWE_has_picked_war_cabinet_trait_tt
		}
	}

	SWE_upgrade_landsfader = {
		available = {
			NOT = {
				has_country_flag = SWE_has_picked_war_cabinet_trait
			}
		}

		ai_will_do = {
			factor = 1
		}

		complete_effect = {
			set_country_flag = SWE_has_picked_war_cabinet_trait
			add_country_leader_trait = SWE_landsfader
			custom_effect_tooltip = SWE_has_picked_war_cabinet_trait_tt
		}
	}

	SWE_upgrade_respectful_occupier = {
		available = {
			NOT = {
				has_country_flag = SWE_has_picked_war_cabinet_trait
			}

			has_completed_focus = SWE_sami_reconcilliation
		}

		ai_will_do = {
			factor = 1
		}

		complete_effect = {
			set_country_flag = SWE_has_picked_war_cabinet_trait
			add_country_leader_trait = SWE_respectful_occupier
			custom_effect_tooltip = SWE_has_picked_war_cabinet_trait_tt
		}
	}

	SWE_upgrade_education_for_all = {
		available = {
			NOT = {
				has_country_flag = SWE_has_picked_war_cabinet_trait
			}

			has_completed_focus = SWE_research_slot_1
		}
		ai_will_do = {
			factor = 1
		}
		complete_effect = {
			set_country_flag = SWE_has_picked_war_cabinet_trait
			add_country_leader_trait = SWE_education_for_all
			custom_effect_tooltip = SWE_has_picked_war_cabinet_trait_tt
		}
	}

	SWE_upgrade_every_barrel_counts = {
		available = {
			NOT = {
				has_country_flag = SWE_has_picked_war_cabinet_trait
			}

			has_completed_focus = SWE_rationing
		}

		ai_will_do = {
			factor = 1
		}
		complete_effect = {
			set_country_flag = SWE_has_picked_war_cabinet_trait
			add_country_leader_trait = SWE_every_barrel_counts

			custom_effect_tooltip = SWE_has_picked_war_cabinet_trait_tt
		}
	}
}

SWE_coax_nordic_defense_council_cat = {
	SWE_coax_countries_that_rejected = {
		allowed = { 
			tag = SWE 
		}

		visible = {
			OR = {
				is_ai = no
				has_game_rule = {
					rule = SWE_ai_behavior
					option = SWE_DEMOCRATIC_NORDIC_DEFENCE_COUNCIL
				}
			}
			has_completed_focus = SWE_central_nordic_army_command
		}

		ai_will_do ={
			base = 0
			modifier = {
				has_game_rule = {
					rule = SWE_ai_behavior
					option = SWE_DEMOCRATIC_NORDIC_DEFENCE_COUNCIL
				}
				add = 200
			}

			modifier = {
				FROM = {
					is_ai = no
				}
				factor = 0
			}
		}
		available = {
			FROM = {
				hidden_trigger = {
					OR = {
						has_country_flag = rejected_nordic_defense_council
						original_tag = ICE
					}
					is_ai = yes
				}
				
				is_subject = no
				exists = yes
				has_capitulated = no
			}
		}

		cost = 150
		days_remove = 90
		#on_map_mode = map_only	
		#state_target = yes

		target_trigger = {
			FROM = {
				OR = {
					has_country_flag = rejected_nordic_defense_council
					AND = {
						tag = ICE
						is_subject = no
					}
				}
				is_ai = yes
				is_subject = no
				exists = yes
				has_capitulated = no
			}
		}

		remove_effect = {
			if = {
				limit = {
					FROM = { is_ai = yes }
				}
				
				puppet = FROM
				set_autonomy = {
					target=FROM
					autonomy_state = autonomy_aat_defense_council_member
					freedom_level = 0 # 0-1 
					end_wars  = no # default yes. will not cancel non civil wars if set to no
					end_civil_wars = no # default yes. will not cancel civil wars if set to no
				}

				hidden_effect = {
					FROM = {
						load_focus_tree = { 
							tree = generic_focus
							 keep_completed = no
						}
					}
				}

				add_to_array = {
					array = SWE_nordic_defense_council_members
					value = FROM #optional, if not defined adds scope
				}

				hidden_effect = {
					#added for each member
					add_to_variable = { SWE_nordic_defense_council_military_overhead_pp = -0.08 }
					add_to_variable = { SWE_nordic_defense_council_military_overhead_cp_gain = -0.08 } 
					add_to_variable = { SWE_nordic_defense_council_military_overhead_cp_ability_cost = 0.08 }
					add_to_variable = { SWE_nordic_defense_council_military_overhead_planning_speed = -0.14 }
				}

				if = {
					limit = { 
						NOT = { has_dynamic_modifier = { modifier = SWE_nordic_defense_council_military_overhead }}
						NOT = { has_completed_focus = SWE_neither_death_nor_dishonor }
					}
					hidden_effect = {
						add_dynamic_modifier = { modifier = SWE_nordic_defense_council_military_overhead }
					}
				}

				if = {
					limit = {
						has_completed_focus = SWE_neither_death_nor_dishonor
					}

					for_each_scope_loop = {
						array = SWE_nordic_defense_council_members
						ROOT = {
							set_variable = { council_member_value = 0.04 }
							multiply_variable = { council_member_value = SWE_nordic_defense_council_members^num }
						}
					}


					hidden_effect = {
						for_each_scope_loop = {
							array = SWE_nordic_defense_council_members

			  				set_variable = { SWE_nordic_defense_council_military_core_defense_factor = ROOT.council_member_value }
			  				set_variable = { SWE_nordic_defense_council_military_core_attack_factor = ROOT.council_member_value }
			  				set_variable = { SWE_nordic_defense_council_factory_capacity_factor = ROOT.council_member_value }
			  				set_variable = { SWE_nordic_defense_council_dockyard_capacity_factor = ROOT.council_member_value }
							

							add_dynamic_modifier = {
								modifier = SWE_neither_death_nor_dishonor
							}
						}
					}
				}
			}
		}
	}	
} 


