#	Example:
#
#	example_effect = {
#		add_political_power = 66
#		add_popularity = {
#			ideology = fascism
#			popularity = 0.33
#		}
#	}
#
#
#	In a script file:
#
#	effect = {
#		example_effect = yes
#	}
#

##########################
##########################
#### BALANCE OF POWER ####
##########################
##########################

DEN_bop_absurdly_high_increase_effect = {
	add_power_balance_value = {
		id = DEN_balance_of_power
		value = 1
	}
}

DEN_bop_very_high_increase_effect = {
	add_power_balance_value = {
		id = DEN_balance_of_power
		value = 0.25
	}
}

DEN_bop_high_increase_effect = {
	add_power_balance_value = {
		id = DEN_balance_of_power
		value = 0.2
	}
}

DEN_bop_medium_increase_effect = {
	add_power_balance_value = {
		id = DEN_balance_of_power
		value = 0.15
	}
}

DEN_bop_low_increase_effect = {
	add_power_balance_value = {
		id = DEN_balance_of_power
		value = 0.1
	}
}

DEN_bop_very_low_increase_effect = {
	add_power_balance_value = {
		id = DEN_balance_of_power
		value = 0.05
	}
}

DEN_bop_absurdly_high_decrease_effect = {
	add_power_balance_value = {
		id = DEN_balance_of_power
		value = -1
	}
}

DEN_bop_very_high_decrease_effect = {
	add_power_balance_value = {
		id = DEN_balance_of_power
		value = -0.25
	}
}

DEN_bop_high_decrease_effect = {
	add_power_balance_value = {
		id = DEN_balance_of_power
		value = -0.2
	}
}

DEN_bop_medium_decrease_effect = {
	add_power_balance_value = {
		id = DEN_balance_of_power
		value = -0.15
	}
}

DEN_bop_low_decrease_effect = {
	add_power_balance_value = {
		id = DEN_balance_of_power
		value = -0.1
	}
}

DEN_bop_very_low_decrease_effect = {
	add_power_balance_value = {
		id = DEN_balance_of_power
		value = -0.05
	}
}

### OCCUPATION ###
DEN_bop_occupation_absurdly_high_increase_effect = {
	add_power_balance_value = {
		id = DEN_occupation_balance
		value = 1
	}
}

DEN_bop_occupation_very_high_increase_effect = {
	add_power_balance_value = {
		id = DEN_occupation_balance
		value = 0.25
	}
}

DEN_bop_occupation_high_increase_effect = {
	add_power_balance_value = {
		id = DEN_occupation_balance
		value = 0.2
	}
}

DEN_bop_occupation_medium_increase_effect = {
	add_power_balance_value = {
		id = DEN_occupation_balance
		value = 0.15
	}
}

DEN_bop_occupation_low_increase_effect = {
	add_power_balance_value = {
		id = DEN_occupation_balance
		value = 0.1
	}
}

DEN_bop_occupation_very_low_increase_effect = {
	add_power_balance_value = {
		id = DEN_occupation_balance
		value = 0.05
	}
}

DEN_bop_occupation_absurdly_high_decrease_effect = {
	add_power_balance_value = {
		id = DEN_occupation_balance
		value = -1
	}
}

DEN_bop_occupation_very_high_decrease_effect = {
	add_power_balance_value = {
		id = DEN_occupation_balance
		value = -0.25
	}
}

DEN_bop_occupation_high_decrease_effect = {
	add_power_balance_value = {
		id = DEN_occupation_balance
		value = -0.2
	}
}

DEN_bop_occupation_medium_decrease_effect = {
	add_power_balance_value = {
		id = DEN_occupation_balance
		value = -0.15
	}
}

DEN_bop_occupation_low_decrease_effect = {
	add_power_balance_value = {
		id = DEN_occupation_balance
		value = -0.1
	}
}

DEN_bop_occupation_very_low_decrease_effect = {
	add_power_balance_value = {
		id = DEN_occupation_balance
		value = -0.05
	}
}

#INDUSTRIAL CONCERNS
DEN_replaced_designers_with_improved_version = {
	if = {
		limit = {
			has_idea = DEN_aalborg_portland
		}
		swap_ideas = {
			remove_idea = DEN_aalborg_portland
			add_idea = DEN_aalborg_portland_improved
		}
	}
}

#POLITICAL DECISIONS
DEN_available_candidates = {
	if = {
		limit = {
			check_variable = { DEN_democratic_popularity > 29 }
			NOT = { 
				has_character = DEN_thorvald_stauning
				has_country_leader =  {
					ruling_only = yes 
					character = DEN_vilhelm_buhl
				}
			}
		}
		custom_effect_tooltip = DEN_vilhelm_buhl
	}
	if = {
		limit = {
			check_variable = { DEN_democratic_popularity > 29 }
			has_character = DEN_thorvald_stauning
			NOT = { 
				has_country_leader =  {
					ruling_only = yes 
					character = DEN_thorvald_stauning
				}
			}
		}
		custom_effect_tooltip = DEN_thorvald_stauning
	}
	if = {
		limit = {
			check_variable = { DEN_democratic_popularity > 29 }
			NOT = { 
				has_country_leader =  {
					ruling_only = yes 
					character = DEN_knud_kristensen
				}
			}
		}
		custom_effect_tooltip = DEN_knud_kristensen
	}
	if = {
		limit = {
			check_variable = { DEN_democratic_popularity > 29 }
			NOT = { 
				has_country_leader =  {
					ruling_only = yes 
					character = DEN_christmas_moller
				}
			}
		}
		custom_effect_tooltip = DEN_christmas_moller
	}
	if = {
		limit = {
			check_variable = { DEN_communism_popularity > 19 }
			NOT = { 
				has_country_leader =  {
					ruling_only = yes 
					character = DEN_aksel_larsen
				}
			}
		}
		custom_effect_tooltip = DEN_aksel_larsen
	}
	if = {
		limit = {
			check_variable = { DEN_neutrality_popularity > 19 }
			NOT = { 
				has_country_leader =  {
					ruling_only = yes 
					character = DEN_knud_bach
				}
			}
		}
		custom_effect_tooltip = DEN_knud_bach
	}
}

DEN_socialdemokratiet_takes_over = {
	if = {
		limit = {
			NOT = { has_government = democratic }
		}
		if = {
			limit = {
				NOT = { has_character = DEN_thorvald_stauning } #He be dead
			}
			set_politics = {
				ruling_party = democratic
				elections_allowed = yes
				long_name = DEN_democratic_party
				name = DEN_democratic_party_long
			}
			DEN_vilhelm_buhl = {
				add_country_leader_role = {
					promote_leader = yes
					country_leader = {
						ideology = socialism
						expire = "1965.1.1.1"
						traits = { DEN_socialdemokrat }
					}
				}
			}
		}
		else = {
			set_politics = {
				ruling_party = democratic
				elections_allowed = yes
				long_name = DEN_democratic_party
				name = DEN_democratic_party_long
			}
			DEN_thorvald_stauning = {
				add_country_leader_role = {
					promote_leader = yes
					country_leader = {
						ideology = socialism
						expire = "1965.1.1.1"
						traits = { DEN_socialdemokrat }
					}
				}
			}
		}
	}
	else_if = {
		limit = {
			DEN_thorvald_stauning = { is_country_leader = no }
		}
		if = {
			limit = {
				NOT = { has_character = DEN_thorvald_stauning } #He be dead
			}
			DEN_remove_democratic_leader = yes
			set_party_name = {
				ideology = democratic
				name = DEN_democratic_party
				long_name = DEN_democratic_party_long
			}
			DEN_vilhelm_buhl = {
				add_country_leader_role = {
					promote_leader = yes
					country_leader = {
						ideology = socialism
						expire = "1965.1.1.1"
						traits = { DEN_socialdemokrat }
					}
				}
			}
		}
		else = {
			DEN_remove_democratic_leader = yes
			set_party_name = {
				ideology = democratic
				name = DEN_democratic_party
				long_name = DEN_democratic_party_long
			}
			DEN_thorvald_stauning = {
				add_country_leader_role = {
					promote_leader = yes
					country_leader = {
						ideology = socialism
						expire = "1965.1.1.1"
						traits = { DEN_socialdemokrat }
					}
				}
			}
		}
	}
}

DEN_venstre_takes_over = {	
	if = {
		limit = {
			NOT = { has_government = democratic }
		}
		set_politics = {
			ruling_party = democratic
			elections_allowed = yes
			long_name = DEN_democratic_venstre_party
			name = DEN_democratic_venstre_party_long
		}
		DEN_knud_kristensen = {
			add_country_leader_role = {
				promote_leader = yes
				country_leader = {
					ideology = liberalism
					traits = { DEN_venstre }
					expire = "1965.1.1.1"
				}
			}
		}
	}
	else_if = {
		limit = {
			DEN_knud_kristensen = { is_country_leader = no }
		}
		DEN_remove_democratic_leader = yes
		set_party_name = {
			ideology = democratic
			name = DEN_democratic_venstre_party
			long_name = DEN_democratic_venstre_party_long
		}
		DEN_knud_kristensen = {
			add_country_leader_role = {
				promote_leader = yes
				country_leader = {
					ideology = liberalism
					traits = { DEN_venstre }
					expire = "1965.1.1.1"
				}
			}
		}
	}
}

DEN_communists_takes_over = {
	if = {
		limit = {
			NOT = { has_government = communism }
		}

		set_politics = { #Aksel Larsen already has a country leader role
			ruling_party = communism
			elections_allowed = yes
		}
	}
}

DEN_konservative_takes_over = {
	if = {
		limit = {
			NOT = { has_government = democratic }
		}
		set_politics = {
			ruling_party = democratic
			elections_allowed = yes
			long_name = DEN_democratic_konservative_party
			name = DEN_democratic_konservative_party_long
		}
		DEN_christmas_moller = {
			add_country_leader_role = {
				promote_leader = yes
				country_leader = {
					ideology = conservatism
					traits = { DEN_konservativ }
					expire = "1965.1.1.1"
				}
			}
		}
	}
	else_if = {
		limit = {
			DEN_christmas_moller = { is_country_leader = no }
		}
		DEN_remove_democratic_leader = yes
		set_party_name = {
			ideology = democratic
			name = DEN_democratic_konservative_party
			long_name = DEN_democratic_konservative_party_long
		}
		DEN_christmas_moller = {
			add_country_leader_role = {
				promote_leader = yes
				country_leader = {
					ideology = conservatism
					traits = { DEN_konservativ }
					expire = "1965.1.1.1"
				}
			}
		}
	}
}

DEN_bondepartiet_takes_over = {
	if = {
		limit = {
			NOT = { has_government = neutrality }
		}

		set_politics = { #Knud Bach already has a country leader role
			ruling_party = neutrality
			elections_allowed = yes
			long_name = DEN_neutrality_party_long
 			name =	DEN_neutrality_party
 		}	
	}
}

DEN_fascists_takes_over = {
	if = {
		limit = {
			NOT = { has_government = fascism }
		}

		set_politics = { #Fritz Clausen already has a country leader role
			ruling_party = fascism
			elections_allowed = yes
		}	
	}
}

DEN_erik_scavenius_takes_over = {	
	if = {
		limit = {
			NOT = { has_government = democratic }
		}
		set_politics = {
			ruling_party = democratic
			elections_allowed = yes
			long_name = DEN_democratic_venstre_party
			name = DEN_democratic_venstre_party_long
		}
		DEN_erik_scavenius = {
			add_country_leader_role = {
				promote_leader = yes
				country_leader = {
					ideology = liberalism
					traits = { DEN_venstre }
					expire = "1965.1.1.1"
				}
			}
		}
	}
	else_if = {
		limit = {
			DEN_erik_scavenius = { is_country_leader = no }
		}
		DEN_remove_democratic_leader = yes
		set_party_name = {
			ideology = democratic
			name = DEN_democratic_venstre_party
			long_name = DEN_democratic_venstre_party_long
		}
		DEN_erik_scavenius = {
			add_country_leader_role = {
				promote_leader = yes
				country_leader = {
					ideology = liberalism
					traits = { DEN_venstre }
					expire = "1965.1.1.1"
				}
			}
		}
	}
}

DEN_the_king_takes_over = {	
	if = {
		limit = {
			NOT = { has_government = neutrality }
		}
		if = {
			limit = {
				NOT = { has_character = DEN_christian_x } #He be dead
			}
			set_politics = {
				ruling_party = neutrality
				long_name = DEN_neutrality_monarchist_party_long
				name = DEN_neutrality_monarchist_party
			}
			DEN_frederik_ix = {
				add_country_leader_role = {
					promote_leader = yes
					country_leader = {
						ideology = despotism
						expire = "1965.1.1.1"
						traits = { DEN_the_king }
					}
				}
			}
		}
		else = {
			set_politics = {
				ruling_party = neutrality
				long_name = DEN_neutrality_monarchist_party_long
				name = DEN_neutrality_monarchist_party
			}
			DEN_christian_x = {
				add_country_leader_role = {
					promote_leader = yes
					country_leader = {
						ideology = despotism
						expire = "1965.1.1.1"
						traits = { DEN_the_king }
					}
				}
			}
		}
	}
	else_if = {
		if = {
			limit = {
				NOT = { has_character = DEN_christian_x } #He be dead
				#DEN_frederik_ix = { is_country_leader = no }
			}
			DEN_remove_neutral_leader = yes
			set_politics = {
				ruling_party = neutrality
				long_name = DEN_neutrality_monarchist_party_long
				name = DEN_neutrality_monarchist_party
			}
			DEN_frederik_ix = {
				add_country_leader_role = {
					promote_leader = yes
					country_leader = {
						ideology = despotism
						expire = "1965.1.1.1"
						traits = { DEN_the_king }
					}
				}
			}
		}
		else = {
			DEN_remove_neutral_leader = yes
			set_party_name = {
				ideology = neutrality
				name = DEN_neutrality_monarchist_party_long
				long_name = DEN_neutrality_monarchist_party
			}
			DEN_christian_x = {
				add_country_leader_role = {
					promote_leader = yes
					country_leader = {
						ideology = despotism
						expire = "1965.1.1.1"
						traits = { DEN_the_king }
					}
				}
			}
		}
	}
}

DEN_freedom_council_takes_over = {	
	set_politics = {
		ruling_party = neutrality
		elections_allowed = yes
		long_name = DEN_neutrality_freedom_council_party_long
		name = DEN_neutrality_freedom_council_party
	}
	promote_character = {
		character = DEN_freedom_council
		ideology = centrism
	}
}

DEN_ruling_party_loses_popularity = {
	add_popularity = {
  		ideology = ROOT
   		popularity = -0.05
 	}
}

DEN_remove_democratic_leader = {
	if = {
		limit = {
			has_country_leader = {
				character = DEN_thorvald_stauning
				ruling_only = yes
			}
		}
		DEN_thorvald_stauning  = {
			remove_country_leader_role = {
			ideology = socialism
			}
		}
	}
	else_if = {
		limit = {
			has_country_leader = {
				character = DEN_vilhelm_buhl
				ruling_only = yes
			}
		}
		remove_country_leader_role = {
			character = DEN_vilhelm_buhl
			ideology = socialism
		}
	}
	else_if = {
		limit = {
			has_country_leader = {
				character = DEN_knud_kristensen
				ruling_only = yes
			}
		}
		remove_country_leader_role = {
			character = DEN_knud_kristensen
			ideology = liberalism
		}
	}
	else_if = {
		limit = {
			has_country_leader = {
				character = DEN_christmas_moller
				ruling_only = yes
			}
		}
		remove_country_leader_role = {
			character = DEN_christmas_moller
			ideology = conservatism
		}
	}
}

DEN_remove_neutral_leader = {
	if = {
		limit = {
			has_country_leader = {
				character = DEN_knud_bach
				ruling_only = yes
			}
		}
		DEN_knud_bach  = {
			remove_country_leader_role = {
				ideology = oligarchism
			}
		}
	}
	if = {
		limit = {
			has_country_leader = {
				character = DEN_knud_bach_2
				ruling_only = yes
			}
		}
		DEN_knud_bach_2  = {
			remove_country_leader_role = {
				ideology = oligarchism
			}
		}
	}
	if = {
		limit = {
			has_country_leader = {
				character = DEN_knud_bach_3
				ruling_only = yes
			}
		}
		DEN_knud_bach_3  = {
			remove_country_leader_role = {
				ideology = oligarchism
			}
		}
	}
	else_if = {
		limit = {
			has_country_leader = {
				character = DEN_freedom_council
				ruling_only = yes
			}
		}
		remove_country_leader_role = {
			character = DEN_freedom_council
			ideology = centrism
		}
	}
}

DEN_warhawk_is_removed_from_power = {
	if = {
		limit = {
			OR = {
				DEN_knud_bach = { is_country_leader = yes }
				DEN_christmas_moller = { is_country_leader = yes }
			}
		}
		DEN_bop_low_decrease_effect = yes
	}
}

DEN_dove_is_removed_from_power = {
	if = {
		limit = {
			OR = {
				DEN_thorvald_stauning = { is_country_leader = yes }
				DEN_vilhelm_buhl = { is_country_leader = yes }
				DEN_knud_kristensen = { is_country_leader = yes }
				DEN_aksel_larsen = { is_country_leader = yes }
			}
		}
		DEN_bop_low_increase_effect = yes
	}
}

DEN_advisor_low_BOP_decrease_effect = {
	if = {
		limit = {
			is_subject = no
		}
		DEN_bop_low_decrease_effect = yes
	}
}

DEN_advisor_low_BOP_increase_effect = {
	if = {
		limit = {
			is_subject = no
		}
		DEN_bop_low_increase_effect = yes
	}
}

DEN_advisor_medium_BOP_decrease_effect = {
	if = {
		limit = {
			is_subject = no
		}
		DEN_bop_medium_decrease_effect = yes
	}
}

DEN_advisor_medium_BOP_increase_effect = {
	if = {
		limit = {
			is_subject = no
		}
		DEN_bop_medium_increase_effect = yes
	}
}


DEN_limited_manpower = { 
	if = {
		limit = { 
			has_idea = volunteer_only
		}
		set_country_flag = DEN_had_volunteer_only_flag #used when restoring consription law
	}
	else_if = {
		limit = { 
			has_idea = limited_conscription
		}
		add_ideas = volunteer_only
		set_country_flag = DEN_had_limited_conscription_flag #used when restoring consription law
	}
	else_if = {
		limit = { 
			has_idea = extensive_conscription
		}
		add_ideas = volunteer_only
		set_country_flag = DEN_had_extensive_conscription_flag #used when restoring consription law
	}
	else_if = {
		limit = { 
			has_idea = service_by_requirement
		}
		add_ideas = volunteer_only
		set_country_flag = DEN_had_service_by_requirement_flag #used when restoring consription law
	}
	else_if = {
		limit = { 
			has_idea = all_adults_serve
		}
		add_ideas = volunteer_only
		set_country_flag = DEN_had_all_adults_serve_flag #used when restoring consription law
	}
	else_if = {
		limit = { 
			has_idea = scraping_the_barrel
		}
		add_ideas = volunteer_only
		set_country_flag = DEN_had_scraping_the_barrel_flag #used when restoring consription law
	}
	set_country_flag = DEN_cannot_increase_conscription_law
}

DEN_restore_manpower = { 
	if = {
		limit = { 
			has_country_flag = DEN_had_volunteer_only_flag
		}
		add_ideas = volunteer_only
		clr_country_flag = DEN_had_volunteer_only_flag
	}
	if = {
		limit = { 
			has_country_flag = DEN_had_limited_conscription_flag
		}
		add_ideas = limited_conscription
		clr_country_flag = DEN_had_limited_conscription_flag
	}
	else_if = {
		limit = { 
			has_country_flag = DEN_had_extensive_conscription_flag
		}
		add_ideas = extensive_conscription
		clr_country_flag = DEN_had_extensive_conscription_flag
	}
	else_if = {
		limit = { 
			has_country_flag = DEN_had_service_by_requirement_flag
		}
		add_ideas = service_by_requirement
		clr_country_flag = DEN_had_service_by_requirement_flag
	}
	else_if = {
		limit = { 
			has_country_flag = DEN_had_all_adults_serve_flag
		}
		add_ideas = all_adults_serve
		clr_country_flag = DEN_had_all_adults_serve_flag
	}
	else_if = {
		limit = { 
			has_country_flag = DEN_had_scraping_the_barrel_flag
		}
		add_ideas = scraping_the_barrel
		clr_country_flag = DEN_had_scraping_the_barrel_flag
	}
	clr_country_flag = DEN_cannot_increase_conscription_law
}

DEN_modify_overlord_relations_small = {
	add_to_variable = { DEN_overlord_opinion = 5 }
	if = {
		limit = {
			check_variable = { DEN_overlord_opinion < 15 }
		}
		custom_effect_tooltip = DEN_deteriorating_overlord_relations
	}
	else_if = { #For tooltip purposes
		limit = {
			check_variable = { DEN_overlord_opinion > 14 }
			check_variable = { DEN_overlord_opinion < 20 }
		}
		effect_tooltip = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_very_low }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_very_low
						target = DEN
					}
				}
			}
		}
	}
	else_if = { #Add Opinion Modifier if variable crosses over 20
		limit = {
			check_variable = { DEN_overlord_opinion > 19 }
			check_variable = { DEN_overlord_opinion < 35 }
		}
		#hidden_effect = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_very_low }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_very_low
						target = DEN
					}
				}
			}
			else = {
				custom_effect_tooltip = DEN_deteriorating_overlord_relations
			}
	}
	else_if = { #For tooltip purposes
		limit = {
			check_variable = { DEN_overlord_opinion > 34 }
			check_variable = { DEN_overlord_opinion < 40 }
		}
		effect_tooltip = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_low }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_low
						target = DEN
	
					}
		
				}
			}
		}
	}
	else_if = { #Add Opinion Modifier if variable crosses over 40
		limit = {
			check_variable = { DEN_overlord_opinion > 39 }
			check_variable = { DEN_overlord_opinion < 55 }
		}
		#hidden_effect = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						has_opinion_modifier = DEN_unruly_subject_very_low
					}
				}
				OVERLORD = {
					remove_opinion_modifier = {
						modifier = DEN_unruly_subject_very_low
						target = DEN
					}
				}
			}
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_low }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_low
						target = DEN
	
					}
		
				}
			}
		#}
		else = {
				custom_effect_tooltip = DEN_deteriorating_overlord_relations
			}
	}
	else_if = { #For tooltip purposes
		limit = {
			check_variable = { DEN_overlord_opinion > 54 }
			check_variable = { DEN_overlord_opinion < 59 }
		}
		effect_tooltip = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_medium }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_medium
						target = DEN
					}
				}
			}
		}
	}
	else_if = { #Add Opinion Modifier if variable crosses over 60
		limit = {
			check_variable = { DEN_overlord_opinion > 59 }
			check_variable = { DEN_overlord_opinion < 75 }
		}
		#hidden_effect = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						has_opinion_modifier = DEN_unruly_subject_low
					}
				}
				OVERLORD = {
					remove_opinion_modifier = {
						modifier = DEN_unruly_subject_low
						target = DEN
					}
				}
			}
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_medium }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_medium
						target = DEN
					}
				}
			}
			else = {
				custom_effect_tooltip = DEN_deteriorating_overlord_relations
			}
		#}
	}
	else_if = { #For tooltip purposes
		limit = {
			check_variable = { DEN_overlord_opinion > 74 }
			check_variable = { DEN_overlord_opinion < 79 }
		}
		effect_tooltip = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_high }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_high
						target = DEN
					}
				}
			}
		}
	}
	else_if = { #Add Opinion Modifier if variable crosses over 80
		limit = {
			check_variable = { DEN_overlord_opinion > 79 }
			check_variable = { DEN_overlord_opinion < 95 }
		}
		#hidden_effect = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						has_opinion_modifier = DEN_unruly_subject_medium
					}
				}
				OVERLORD = {
					remove_opinion_modifier = {
						modifier = DEN_unruly_subject_medium
						target = DEN
					}
				}
			}
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_high }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_high
						target = DEN
					}
				}
			}
			else = {
				custom_effect_tooltip = DEN_deteriorating_overlord_relations
			}
		#}
	}
	else_if = { #For tooltip purposes
		limit = {
			check_variable = { DEN_overlord_opinion > 94 }
			check_variable = { DEN_overlord_opinion < 99 }
		}
		effect_tooltip = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_very_high }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_very_high
						target = DEN
					}
				}
			}
		}
	}
	else_if = { #Add Opinion Modifier if variable crosses over 100
		limit = {
			check_variable = { DEN_overlord_opinion > 99 }
		}
		#hidden_effect = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						has_opinion_modifier = DEN_unruly_subject_high
					}
				}
				OVERLORD = {
					remove_opinion_modifier = {
						modifier = DEN_unruly_subject_high
						target = DEN
					}
				}
			}
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_very_high }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_very_high
						target = DEN
					}
				}
			}
			else = {
				custom_effect_tooltip = DEN_deteriorating_overlord_relations
			}
		#}
	}	
}

DEN_modify_overlord_relations_big = {
	add_to_variable = { DEN_overlord_opinion = 10 }
	if = {
		limit = {
			check_variable = { DEN_overlord_opinion < 10 }
		}
		custom_effect_tooltip = DEN_deteriorating_overlord_relations
	}
	else_if = { #For tooltip purposes
		limit = {
			check_variable = { DEN_overlord_opinion > 9 }
			check_variable = { DEN_overlord_opinion < 20 }
		}
		effect_tooltip = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_very_low }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_very_low
						target = DEN
					}
				}
			}
		}
	}
	else_if = { #Add Opinion Modifier if variable crosses over 20
		limit = {
			check_variable = { DEN_overlord_opinion > 19 }
			check_variable = { DEN_overlord_opinion < 30 }
		}
		#hidden_effect = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_very_low }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_very_low
						target = DEN
					}
				}
			}
			else = {
				custom_effect_tooltip = DEN_deteriorating_overlord_relations
			}
	}
	else_if = { #For tooltip purposes
		limit = {
			check_variable = { DEN_overlord_opinion > 29 }
			check_variable = { DEN_overlord_opinion < 40 }
		}
		effect_tooltip = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_low }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_low
						target = DEN
	
					}
		
				}
			}
		}
	}
	else_if = { #Add Opinion Modifier if variable crosses over 40
		limit = {
			check_variable = { DEN_overlord_opinion > 39 }
			check_variable = { DEN_overlord_opinion < 50 }
		}
		#hidden_effect = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						has_opinion_modifier = DEN_unruly_subject_very_low
					}
				}
				OVERLORD = {
					remove_opinion_modifier = {
						modifier = DEN_unruly_subject_very_low
						target = DEN
					}
				}
			}
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_low }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_low
						target = DEN
	
					}
		
				}
			}
			else = {
				custom_effect_tooltip = DEN_deteriorating_overlord_relations
			}
		#}
	}
	else_if = { #For tooltip purposes
		limit = {
			check_variable = { DEN_overlord_opinion > 49 }
			check_variable = { DEN_overlord_opinion < 60 }
		}
		effect_tooltip = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_medium }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_medium
						target = DEN
					}
				}
			}
		}
	}
	else_if = { #Add Opinion Modifier if variable crosses over 60
		limit = {
			check_variable = { DEN_overlord_opinion > 59 }
			check_variable = { DEN_overlord_opinion < 70 }
		}
		#hidden_effect = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						has_opinion_modifier = DEN_unruly_subject_low
					}
				}
				OVERLORD = {
					remove_opinion_modifier = {
						modifier = DEN_unruly_subject_low
						target = DEN
					}
				}
			}
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_medium }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_medium
						target = DEN
					}
				}
			}
			else = {
				custom_effect_tooltip = DEN_deteriorating_overlord_relations
			}
		#}
	}
	else_if = { #For tooltip purposes
		limit = {
			check_variable = { DEN_overlord_opinion > 69 }
			check_variable = { DEN_overlord_opinion < 80 }
		}
		effect_tooltip = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_high }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_high
						target = DEN
					}
				}
			}
		}
	}
	else_if = { #Add Opinion Modifier if variable crosses over 80
		limit = {
			check_variable = { DEN_overlord_opinion > 79 }
			check_variable = { DEN_overlord_opinion < 90 }
		}
		#hidden_effect = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						has_opinion_modifier = DEN_unruly_subject_medium
					}
				}
				OVERLORD = {
					remove_opinion_modifier = {
						modifier = DEN_unruly_subject_medium
						target = DEN
					}
				}
			}
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_high }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_high
						target = DEN
					}
				}
			}
			else = {
				custom_effect_tooltip = DEN_deteriorating_overlord_relations
			}
		#}
	}
	else_if = { #For tooltip purposes
		limit = {
			check_variable = { DEN_overlord_opinion > 89 }
			check_variable = { DEN_overlord_opinion < 100 }
		}
		effect_tooltip = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_very_high }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_very_high
						target = DEN
					}
				}
			}
		}
	}
	else_if = { #Add Opinion Modifier if variable crosses over 100
		limit = {
			check_variable = { DEN_overlord_opinion > 99 }
		}
		#hidden_effect = {
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						has_opinion_modifier = DEN_unruly_subject_high
					}
				}
				OVERLORD = {
					remove_opinion_modifier = {
						modifier = DEN_unruly_subject_high
						target = DEN
					}
				}
			}
			if = {
				limit = {
					is_subject = yes
					OVERLORD = {
						NOT = { has_opinion_modifier = DEN_unruly_subject_very_high }
					}
				}
				OVERLORD = {
					add_opinion_modifier = {
						modifier = DEN_unruly_subject_very_high
						target = DEN
					}
				}
			}
			else = {
				custom_effect_tooltip = DEN_deteriorating_overlord_relations
			}
		#}
	}	
}

DEN_activate_bought_ships = {
	if = {
		limit = {
			OR = {
				SWE = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
				NOR = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
				HOL = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
				ENG = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
				USA = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
				FRA = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
				SOV = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
				GER = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
				ITA = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
				JAP = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
			}
		}
		custom_effect_tooltip = DEN_launches_destroyers_tt
	}
	hidden_effect = {
		if = { 
			limit = {
				SWE = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
			}
			if = {
				limit = {
					has_dlc = "Man the Guns"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Örnen Class"
					creator = SWE
					name = "Örnen Klasse I"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Örnen Class"
					creator = SWE
					name = "Örnen Klasse II"
				}
			}
			else = {
				create_ship = {
					type = destroyer_1
					creator = "SWE"
				}
				create_ship = {
					type = destroyer_1
					creator = "SWE"
				}
			}	
		}
		if = { 
			limit = {
				NOR = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
			}
			if = {
				limit = {
					has_dlc = "Man the Guns"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Draug Class"
					creator = NOR
					name = "Draug Klasse I"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Draug Class"
					creator = NOR
					name = "Draug Klasse II"
				}
			}
			else = {
				create_ship = {
					type = destroyer_1
					creator = "NOR"
				}
				create_ship = {
					type = destroyer_1
					creator = "NOR"
				}
			}	
		}
		if = { 
			limit = {
				HOL = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
			}
			if = {
				limit = {
					has_dlc = "Man the Guns"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Van Galen Class"
					creator = HOL
					name = "Van Galen KlasseKlasse I"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Van Galen Class"
					creator = HOL
					name = "Van Galen KlasseKlasse II"
				}
			}
			else = {
				create_ship = {
					type = destroyer_1
					creator = "HOL"
				}
				create_ship = {
					type = destroyer_1
					creator = "HOL"
				}
			}	
		}
		if = { 
			limit = {
				ENG = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
			}
			if = {
				limit = {
					has_dlc = "Man the Guns"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "S Class"
					creator = ENG
					name = "S Klasse I"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "S Class"
					creator = ENG
					name = "S Klasse II"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "S Class"
					creator = ENG
					name = "S Klasse III"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "S Class"
					creator = ENG
					name = "S Klasse IV"
				}
			}
			else = {
				create_ship = {
					type = destroyer_1
					creator = "ENG"
				}
				create_ship = {
					type = destroyer_1
					creator = "ENG"
				}
				create_ship = {
					type = destroyer_1
					creator = "ENG"
				}
				create_ship = {
					type = destroyer_1
					creator = "ENG"
				}
			}	
		}
		if = { 
			limit = {
				USA = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
			}
			if = {
				limit = {
					has_dlc = "Man the Guns"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Clemson Class"
					creator = USA
					name = "Clemson Klasse I"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Clemson Class"
					creator = USA
					name = "Clemson Klasse II"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Clemson Class"
					creator = USA
					name = "Clemson Klasse III"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Clemson Class"
					creator = USA
					name = "Clemson Klasse IV"
				}
			}
			else = {
				create_ship = {
					type = destroyer_1
					creator = "USA"
				}
				create_ship = {
					type = destroyer_1
					creator = "USA"
				}
				create_ship = {
					type = destroyer_1
					creator = "USA"
				}
				create_ship = {
					type = destroyer_1
					creator = "USA"
				}
			}	
		}
		if = { 
			limit = {
				FRA = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
			}
			if = {
				limit = {
					has_dlc = "Man the Guns"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Bourrasque Class"
					creator = FRA
					name = "Clemson Klasse I"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Bourrasque Class"
					creator = FRA
					name = "Bourrasque Klasse II"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Bourrasque Class"
					creator = FRA
					name = "Bourrasque Klasse III"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Bourrasque Class"
					creator = FRA
					name = "Bourrasque Klasse IV"
				}
			}
			else = {
				create_ship = {
					type = destroyer_1
					creator = "FRA"
				}
				create_ship = {
					type = destroyer_1
					creator = "FRA"
				}
				create_ship = {
					type = destroyer_1
					creator = "FRA"
				}
				create_ship = {
					type = destroyer_1
					creator = "FRA"
				}
			}	
		}
		if = { 
			limit = {
				SOV = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
			}
			if = {
				limit = {
					has_dlc = "Man the Guns"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Orfey Class"
					creator = SOV
					name = "Clemson Klasse I"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Orfey Class"
					creator = SOV
					name = "Orfey Klasse II"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Orfey Class"
					creator = SOV
					name = "Orfey Klasse III"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Orfey Class"
					creator = SOV
					name = "Orfey Klasse IV"
				}
			}
			else = {
				create_ship = {
					type = destroyer_1
					creator = "SOV"
				}
				create_ship = {
					type = destroyer_1
					creator = "SOV"
				}
				create_ship = {
					type = destroyer_1
					creator = "SOV"
				}
				create_ship = {
					type = destroyer_1
					creator = "SOV"
				}
			}	
		}
		if = { 
			limit = {
				GER = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
			}
			if = {
				limit = {
					has_dlc = "Man the Guns"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Zerstörer 1934 Class"
					creator = GER
					name = "Zerstörer Klasse I"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Zerstörer 1934 Class"
					creator = GER
					name = "Zerstörer Klasse II"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Zerstörer 1934 Class"
					creator = GER
					name = "Zerstörer Klasse III"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Zerstörer 1934 Class"
					creator = GER
					name = "Zerstörer Klasse IV"
				}
			}
			else = {
				create_ship = {
					type = destroyer_1
					creator = "GER"
				}
				create_ship = {
					type = destroyer_1
					creator = "GER"
				}
				create_ship = {
					type = destroyer_1
					creator = "GER"
				}
				create_ship = {
					type = destroyer_1
					creator = "GER"
				}
			}	
		}
		if = { 
			limit = {
				ITA = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
			}
			if = {
				limit = {
					has_dlc = "Man the Guns"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Curtatone Class"
					creator = ITA
					name = "Curtatone Klasse I"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Curtatone Class"
					creator = ITA
					name = "Curtatone Klasse II"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Curtatone Class"
					creator = ITA
					name = "Curtatone Klasse III"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Curtatone Class"
					creator = ITA
					name = "Curtatone Klasse IV"
				}
			}
			else = {
				create_ship = {
					type = destroyer_1
					creator = "ITA"
				}
				create_ship = {
					type = destroyer_1
					creator = "ITA"
				}
				create_ship = {
					type = destroyer_1
					creator = "ITA"
				}
				create_ship = {
					type = destroyer_1
					creator = "ITA"
				}
			}	
		}
		if = { 
			limit = {
				JAP = {
					has_country_flag = DEN_sold_ships_to_denmark_flag
				}
			}
			if = {
				limit = {
					has_dlc = "Man the Guns"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Mutsuki Class"
					creator = JAP
					name = "Mutsuki Klasse I"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Mutsuki Class"
					creator = JAP
					name = "Mutsuki Klasse II"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Mutsuki Class"
					creator = JAP
					name = "Mutsuki Klasse III"
				}
				create_ship = {
					type = ship_hull_light_1
					equipment_variant = "Mutsuki Class"
					creator = JAP
					name = "Mutsuki Klasse IV"
				}
			}
			else = {
				create_ship = {
					type = destroyer_1
					creator = "JAP"
				}
				create_ship = {
					type = destroyer_1
					creator = "JAP"
				}
				create_ship = {
					type = destroyer_1
					creator = "JAP"
				}
				create_ship = {
					type = destroyer_1
					creator = "JAP"
				}
			}	
		}
	}
}

DEN_upgrade_resistance_militia = { #this is meant to upgrade the militia division linearly, create thedivision if it hasn't been created already. 
	if = {
		limit = {
			NOT = { has_variable = DEN_militia_template_level }
		}
		custom_effect_tooltip = DEN_adds_units_to_resistance_tt
	}
	else_if = {
		limit = {
			has_variable = DEN_militia_template_level
			check_variable =  { DEN_militia_template_level = 1 }
		}
		add_units_to_division_template = {
			template_name = "Modstandsbevægelsen Militia"
			regiments = {
				militia = 0
				militia = 0
				militia = 1
				militia = 1 
			}
		}
	}
	else_if = {
		limit = {
			has_variable = DEN_militia_template_level
			check_variable =  { DEN_militia_template_level = 2 }
		}
		add_units_to_division_template = {
			template_name = "Modstandsbevægelsen Militia"
			regiments = {
				militia = 2
				militia = 2 
				militia = 2
				militia = 2
			}
		}
	}
	if = { #Increasing the Militia Level variable 
		limit = {
			has_variable = DEN_militia_template_level
		}
		add_to_variable = { DEN_militia_template_level = 1 }
	}
	if = {
		limit = {
			NOT = { has_variable = DEN_militia_template_level }  
		}
		division_template = {
			name = "Modstandsbevægelsen Militia"
			is_locked = yes
			#force_allow_recruiting = yes
			priority = 1
			template_counter = 60
			regiments = {
				militia = { x = 0 y = 0 }
				militia = { x = 0 y = 1 }
				militia = { x = 1 y = 0 }
				militia = { x = 1 y = 1 }
			}
			support = {
			}
			override_model = DEN_militia_entity
		}
		set_variable = { DEN_militia_template_level = 1 }
	}
}

#DECISION EFFECT
DEN_weapon_delivery_effect = {
	if = {
		limit = {
			check_variable = { DEN_times_weapons_was_delivered < 1 }
		}
		hidden_effect = {
			set_variable = { DEN_times_weapons_was_delivered = 1 }
		}
	}
	else = {
		add_to_variable = { DEN_times_weapons_was_delivered = 1 }
	}
	multiply_variable = { DEN_weapon_delivery_cost = DEN_double_cost_increase }
}

DEN_develop_state_effect = {
	add_extra_state_shared_building_slots = 1
	if = {
		limit = {
			check_variable = { DEN_times_state_was_developed < 1 }
		}
		custom_effect_tooltip = DEN_repeatable_three_times_tt
		hidden_effect = {
			set_variable = { DEN_times_state_was_developed = 1 }
		}
	}
	else = {
		add_to_variable = { DEN_times_state_was_developed = 1 }
		custom_effect_tooltip = DEN_times_state_has_been_developed_tt
	}
}

#NATIONAL SPIRITS and DYNAMIC MODIFIERS
DEN_improve_industrial_capabilities_NS = {
	custom_effect_tooltip = DEN_modify_industrial_capability_dynamic_modifier
	hidden_effect = {
		if = {
			limit = { #Improve the modifier
				check_variable = { DEN.DEN_industrial_improvement_tracker_var > 4 }
				OR = {
					has_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier }
					has_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_light_regulation }
				}
				NOT = { 
					has_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_improved }
					has_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_max_improved }
					has_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_light_regulation_improved }
					has_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_light_regulation_max_improved }
				}
			}
			if = {
				limit = {
					has_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier }
				}
				remove_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier }
				add_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_improved }
			}
			else_if = {
				limit = {
					has_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_light_regulation }
				}
				remove_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_light_regulation }
				add_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_light_regulation_improved }
			}
		}
		else_if = {
			limit = { #only improve to max once
				check_variable = { DEN.DEN_industrial_improvement_tracker_var > 9 }
				OR = {
					has_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_improved }
					has_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_light_regulation_improved }
				}
				NOT = {
					has_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_max_improved }
					has_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_light_regulation_max_improved }
				}
			}
			if = {
				limit = {
					has_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_improved }
				}
				remove_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_improved }
				add_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_max_improved }
			}
			else_if = {
				limit = {
					has_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_light_regulation_improved }
				}
				remove_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_light_regulation_improved }
				add_dynamic_modifier = { modifier = DEN_industrial_capability_dynamic_modifier_light_regulation_max_improved }
			}
		}
	}
}

DEN_trade_deal_effects = {
	#This is to show the player the effect no matter the focuses they've taken previously
	custom_effect_tooltip = DEN_modify_industrial_capability_dynamic_modifier
	add_to_variable = {
		DEN_industrial_capabilities_consumer_goods = -0.1
		tooltip = consumer_goods_factor_tt
	}
	if = { #This is to show the player that the different focuses below will modify Economic Crisis in different ways and is here purely for loc purposes
		limit = {
			NOT = {
				has_completed_focus = DEN_kanslergadeforliget
				has_completed_focus = DEN_fortify_our_borders
			}
		}
		custom_effect_tooltip = DEN_effects_after_fortify_our_borders_tt
		add_to_variable = { DEN_economic_crisis_neutrality_drift = -0.02 }
		custom_effect_tooltip = DEN_economic_crisis_neutrality_drift_modifier
	}
	if = { #This is to show the player the effects after completing Fortify Our Borders
		limit = {
			has_completed_focus = DEN_fortify_our_borders
			has_dynamic_modifier = { modifier = DEN_economic_crisis_dynamic_modifier }
		}
		add_to_variable = { DEN_economic_crisis_neutrality_drift = -0.02 }
		custom_effect_tooltip = DEN_economic_crisis_neutrality_drift_modifier
	}
}

#MILITARY EFFECTS
DEN_improve_haeren_NS = {
	add_to_variable = { DEN_haeren_improvement_tracker_var = 1 }
	effect_tooltip = {
		if = {
			limit = {
				DEN_has_haeren_dynamic_modifier = no
			}
			add_dynamic_modifier = { modifier = DEN_haeren_dynamic_modifier }
		}
		else = { custom_effect_tooltip = DEN_modify_haeren_dynamic_modifier }
	}
	hidden_effect = {
		if = {
			limit = { #Only add the modifier if there is no one
				check_variable = { DEN.DEN_haeren_improvement_tracker_var < 2 }
				NOT = { 
					has_dynamic_modifier = { modifier = DEN_haeren_dynamic_modifier }
					has_dynamic_modifier = { modifier = DEN_haeren_dynamic_modifier_improved }
					has_dynamic_modifier = { modifier = DEN_haeren_dynamic_modifier_max_improved }
				}
			}
			add_dynamic_modifier = { modifier = DEN_haeren_dynamic_modifier }
		}
		else_if = {
			limit = { #only improve to max once
				check_variable = { DEN.DEN_haeren_improvement_tracker_var > 4 }
				has_dynamic_modifier = { modifier = DEN_haeren_dynamic_modifier_improved }
				NOT = {
					has_dynamic_modifier = { modifier = DEN_haeren_dynamic_modifier_max_improved }
				}
			}
			remove_dynamic_modifier = { modifier = DEN_haeren_dynamic_modifier_improved }
			add_dynamic_modifier = { modifier = DEN_haeren_dynamic_modifier_max_improved }
		}
		else_if = {
			limit = { #Only improve if you have the basic version
				check_variable = { DEN.DEN_haeren_improvement_tracker_var > 2 }
				has_dynamic_modifier = { modifier = DEN_haeren_dynamic_modifier }
				NOT = {
					has_dynamic_modifier = { modifier = DEN_haeren_dynamic_modifier_improved }
				}
			}
			remove_dynamic_modifier = { modifier = DEN_haeren_dynamic_modifier }
			add_dynamic_modifier = { modifier = DEN_haeren_dynamic_modifier_improved }
		}
	}
}

DEN_improve_sovaernet_NS = {
	add_to_variable = { DEN_sovaernet_improvement_tracker_var = 1 }
	effect_tooltip = {
		if = {
			limit = {
				DEN_has_sovaernet_dynamic_modifier = no
			}
			add_dynamic_modifier = { modifier = DEN_sovaernet_dynamic_modifier }
		}
		else = { custom_effect_tooltip = DEN_modify_sovaernet_dynamic_modifier }
	}
	hidden_effect = {
		if = {
			limit = { #Only add the modifier if there is no one
				check_variable = { DEN.DEN_sovaernet_improvement_tracker_var < 2 }
				NOT = {
					has_dynamic_modifier = { modifier = DEN_sovaernet_dynamic_modifier }
					has_dynamic_modifier = { modifier = DEN_sovaernet_dynamic_modifier_improved }
					has_dynamic_modifier = { modifier = DEN_sovaernet_dynamic_modifier_max_improved }
				}
			}
			add_dynamic_modifier = { modifier = DEN_sovaernet_dynamic_modifier }
		}
		else_if = {
			limit = { #only improve to max once
				check_variable = { DEN.DEN_sovaernet_improvement_tracker_var > 4 }
				has_dynamic_modifier = { modifier = DEN_sovaernet_dynamic_modifier_improved }
				NOT = {
					has_dynamic_modifier = { modifier = DEN_sovaernet_dynamic_modifier_max_improved }
				}
			}
			remove_dynamic_modifier = { modifier = DEN_sovaernet_dynamic_modifier_improved }
			add_dynamic_modifier = { modifier = DEN_sovaernet_dynamic_modifier_max_improved }
		}
		else_if = {
			limit = { #Only improve if you have the basic version
				check_variable = { DEN.DEN_sovaernet_improvement_tracker_var > 2 }
				has_dynamic_modifier = { modifier = DEN_sovaernet_dynamic_modifier }
				NOT = {
					has_dynamic_modifier = { modifier = DEN_sovaernet_dynamic_modifier_improved }
				}
			}
			remove_dynamic_modifier = { modifier = DEN_sovaernet_dynamic_modifier }
			add_dynamic_modifier = { modifier = DEN_sovaernet_dynamic_modifier_improved }
		}
	}
}

DEN_improve_flyvevabnet_NS = { 
	add_to_variable = { DEN_flyvevabnet_improvement_tracker_var = 1 }
	if = {
		limit = {
			DEN_has_flyvevabnet_dynamic_modifier = no
		}
		add_dynamic_modifier = { modifier = DEN_flyvevabnet_dynamic_modifier }
	}
	else = { custom_effect_tooltip = DEN_modify_flyvevabnet_dynamic_modifier }
	hidden_effect = {
		if = {
			limit = { #Only add the modifier if there is no one
				check_variable = { DEN.DEN_flyvevabnet_improvement_tracker_var < 2 }
				NOT = {
					has_dynamic_modifier = { modifier = DEN_flyvevabnet_dynamic_modifier }
					has_dynamic_modifier = { modifier = DEN_flyvevabnet_dynamic_modifier_improved }
					has_dynamic_modifier = { modifier = DEN_flyvevabnet_dynamic_modifier_max_improved }
				}
			}
			add_dynamic_modifier = { modifier = DEN_flyvevabnet_dynamic_modifier }
		}
		else_if = {
			limit = { #only improve to max once
				check_variable = { DEN.DEN_flyvevabnet_improvement_tracker_var > 4 }
				has_dynamic_modifier = { modifier = DEN_flyvevabnet_dynamic_modifier_improved }
				NOT = {
					has_dynamic_modifier = { modifier = DEN_flyvevabnet_dynamic_modifier_max_improved }
				}
			}
			remove_dynamic_modifier = { modifier = DEN_flyvevabnet_dynamic_modifier_improved }
			add_dynamic_modifier = { modifier = DEN_flyvevabnet_dynamic_modifier_max_improved }
		}
		else_if = {
			limit = { #Only improve if you have the basic version
				check_variable = { DEN.DEN_flyvevabnet_improvement_tracker_var > 2 }
				has_dynamic_modifier = { modifier = DEN_flyvevabnet_dynamic_modifier }
				NOT = {
					has_dynamic_modifier = { modifier = DEN_flyvevabnet_dynamic_modifier_improved }
				}
			}
			remove_dynamic_modifier = { modifier = DEN_flyvevabnet_dynamic_modifier }
			add_dynamic_modifier = { modifier = DEN_flyvevabnet_dynamic_modifier_improved }
		}
	}
}

DEN_get_converted_air_carriers = {
	if = { 
		limit = {
			has_dlc = "Man the Guns"
		}
		if = {
			limit = {
				NOT = { has_tech = early_ship_hull_carrier }
			}
			set_technology = { early_ship_hull_carrier = 1 }
		}
		#Equipment Variant
		create_equipment_variant = {
			name = "Prinsen Class - Converted Liner"
			type = ship_hull_carrier_conversion_ca
			name_group = DEN_CV_HISTORICAL
			parent_version = 0
			allow_without_tech = yes #Makes no difference since focus grants appropriate tech (	above), but it improves tooltip
			modules = {
				fixed_ship_deck_slot_1 = ship_deck_space
				fixed_ship_deck_slot_2 = ship_deck_space
				fixed_ship_anti_air_slot = ship_anti_air_1
				fixed_ship_radar_slot = empty
				fixed_ship_engine_slot = carrier_ship_engine_1
				fixed_ship_secondaries_slot = ship_secondaries_1
			}
		}
	
		#Line Production
		add_equipment_production = {
			equipment = {
				type = ship_hull_carrier_conversion_ca
				creator = "DEN"
				version_name = "Prinsen Class - Converted Liner"
			}
			name = "Prinsen"
			requested_factories = 1
			progress = 0.65
			amount = 1
		}
		#Line Production
		add_equipment_production = {
			equipment = {
				type = ship_hull_carrier_conversion_ca
				creator = "DEN"
				version_name = "Prinsen Class - Converted Liner"
			}
			name = "Herren"
			requested_factories = 1
			progress = 0.4
			amount = 1
		}
	}
	##############
	### NO MTG ###
	##############
	else = {
		if = {
			limit = {
				NOT = { has_tech = early_carrier }
			}
			set_technology = { early_carrier = 1 }
		}
		create_equipment_variant = {
			name = "Prinsen Class - Converted Liner"
			type = carrier_1
			allow_without_tech = yes #Makes no difference since focus grants appropriate tech (above), but it improves tooltip
			upgrades = {
				ship_deckspace_upgrade = 2
				carrier_armor_upgrade = 1
				ship_engine_upgrade = 1
				ship_reliability_upgrade = 1
			}
		}
		add_equipment_production = {
			equipment = {
				type = carrier_1
				creator = "DEN"
				version_name = "Prinsen Class - Converted Liner"
			}
			name = "Prinsen"
			requested_factories = 1
			progress = 0.65
			amount = 1
		}
		add_equipment_production = {
			equipment = {
				type = carrier_1
				creator = "DEN"
				version_name = "Prinsen Class - Converted Liner"
			}
			name = "Herren"
			requested_factories = 1
			progress = 0.4
			amount = 1
		}
	}
	add_tech_bonus = {
		name = DEN_north_sea_ambitions
		bonus = 0.5
		uses = 3
		category = ca_tech
		category = bb_tech
		category = cv_tech
	}
}

DEN_get_proper_air_carriers = {
	###########
	### MTG ###
	###########
	if = { 
		limit = {
			has_dlc = "Man the Guns"
		}
		if = {
			limit = {
				NOT = { has_tech = basic_ship_hull_carrier }
			}
			set_technology = { basic_ship_hull_carrier = 1 }
		}

		#Equipment Variant
		create_equipment_variant = {
			name = "Prinsen Class"
			type = ship_hull_carrier_1
			name_group = DEN_CV_HISTORICAL
			parent_version = 0
			allow_without_tech = yes #Makes no difference since focus grants appropriate tech (above), but it improves tooltip
			modules = {
				fixed_ship_deck_slot_1 = ship_deck_space
				fixed_ship_deck_slot_2 = ship_deck_space
				fixed_ship_anti_air_slot = ship_anti_air_1
				fixed_ship_radar_slot = empty
				fixed_ship_engine_slot = carrier_ship_engine_1
				fixed_ship_secondaries_slot = ship_secondaries_1
				front_1_custom_slot = ship_deck_space
			}
		}
		#Line Production
		add_equipment_production = {
			equipment = {
				type = ship_hull_carrier_1
				creator = "DEN"
				version_name = "Prinsen Class"
			}
			name = "Prinsen"
			requested_factories = 2
			progress = 0.5
			amount = 1
		}
	}

	##############
	### NO MTG ###
	##############
	else = {
		if = {
			limit = {
				NOT = { has_tech = basic_carrier }
			}
			set_technology = { basic_carrier = 1 }
		}
		create_equipment_variant = {
			name = "Prinsen Class"
			type = carrier_2
			allow_without_tech = yes #Makes no difference since focus grants appropriate tech (above), but it improves tooltip
			upgrades = {
				ship_deckspace_upgrade = 3
				carrier_armor_upgrade = 2
				ship_engine_upgrade = 1
				ship_reliability_upgrade = 1
			}
		}
		add_equipment_production = {
			equipment = {
				type = carrier_2
				creator = "DEN"
				version_name = "Prinsen Class"
			}
			name = "Prinsen"
			requested_factories = 2
			progress = 0.5
			amount = 1
		}
	}
	add_tech_bonus = {
		name = DEN_north_sea_ambitions
		bonus = 0.5
		uses = 2
		category = ca_tech
		category = bb_tech
		category = cv_tech
	}
}

DEN_non_aggression_pact_effect = {
	diplomatic_relation = {
		country = FROM
		relation = non_aggression_pact
		active = yes
	}
}

DEN_guarantee_tech_sharing = {
	if = {
		limit = {
			OR = {
				FROM = {
					original_tag = USA
				}
				check_variable = { DEN.DEN_guaranteeing_nation = USA }
			}
		}
		if = {
			limit = {
				has_tech_sharing_feature = yes
			}
			USA = {
				add_to_tech_sharing_group = DEN_danish_partnership_tech_sharing
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.15
					uses = 1
					category = armor
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.15
					uses = 1
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.15
					uses = 1
					category = infantry_weapons
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.15
					uses = 1
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.15
					uses = 1
					category = air_equipment
				}
			}
			DEN = {
				add_to_tech_sharing_group = DEN_danish_partnership_tech_sharing
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 1
					category = armor
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 1
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 1
					category = infantry_weapons
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 1
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 1
					category = air_equipment
				}
			}
		}
		else = {
			USA = {
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.15
					uses = 1
					category = armor
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.15
					uses = 1
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.15
					uses = 1
					category = infantry_weapons
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.15
					uses = 1
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.15
					uses = 1
					category = air_equipment
				}
			}
			DEN = {
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 1
					category = armor
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 1
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 1
					category = infantry_weapons
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 1
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 1
					category = air_equipment
				}
			}
		}
	}
	if = {
		limit = {
			OR = {
				FROM = {
					original_tag = ENG
				}
				check_variable = { DEN.DEN_guaranteeing_nation = ENG }
			}
		}
		if = {
			limit = {
				has_tech_sharing_feature = yes
			}
			ENG = {
				add_to_tech_sharing_group = DEN_danish_partnership_tech_sharing
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = air_equipment
				}
			}
			DEN = {
				add_to_tech_sharing_group = DEN_danish_partnership_tech_sharing
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.5
					uses = 2
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = air_equipment
				}
			}
		}
		else = {
			ENG = {
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = air_equipment
				}
			}
			DEN = {
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.5
					uses = 2
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = air_equipment
				}
			}
		}
	}
	if = {
		limit = {
			OR = {
				FROM = {
					original_tag = GER
				}
				check_variable = { DEN.DEN_guaranteeing_nation = GER }
			}
		}
		if = {
			limit = {
				has_tech_sharing_feature = yes
			}
			GER = {
				add_to_tech_sharing_group = DEN_danish_partnership_tech_sharing
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = armor
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = air_equipment
				}
			}
			DEN = {
				add_to_tech_sharing_group = DEN_danish_partnership_tech_sharing
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.5
					uses = 2
					category = armor
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = air_equipment
				}
			}
		}
		else = {
			GER = {
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = armor
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = air_equipment
				}
			}
			DEN = {
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.5
					uses = 2
					category = armor
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = air_equipment
				}
			}
		}
	}
	if = {
		limit = {
			OR = {
				FROM = {
					original_tag = SOV
				}
				check_variable = { DEN.DEN_guaranteeing_nation = SOV }
			}
		}
		if = {
			limit = {
				has_tech_sharing_feature = yes
			}
			SOV = {
				add_to_tech_sharing_group = DEN_danish_partnership_tech_sharing
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = infantry_weapons
				}
			}
			DEN = {
				add_to_tech_sharing_group = DEN_danish_partnership_tech_sharing
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.5
					uses = 2
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = infantry_weapons
				}
			}
		}
		else = {
			SOV = {
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = infantry_weapons
				}
			}
			DEN = {
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.5
					uses = 2
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_partnership_tech_sharing
					bonus = 0.25
					uses = 2
					category = infantry_weapons
				}
			}
		}
	}
}

DEN_sell_territory_for_guarantees = {
	if = {
		limit = {
			OR = {
				FROM = {
					original_tag = USA
				}
				check_variable = { DEN.DEN_guaranteeing_nation = USA }
			}
		}
		101 = { transfer_state_to = USA }
	}
	else_if = {
		limit = {
			OR = {
				FROM = {
					original_tag = ENG
				}
				check_variable = { DEN.DEN_guaranteeing_nation = ENG }
			}
		}
		337 = { transfer_state_to = ENG }
	}
	else_if = {
		limit = {
			OR = {
				FROM = {
					original_tag = GER
				}
				check_variable = { DEN.DEN_guaranteeing_nation = GER }
			}
		}
		912 = { transfer_state_to = GER }
	}
	else_if = {
		limit = {
			OR = {
				FROM = {
					original_tag = SOV
				}
				check_variable = { DEN.DEN_guaranteeing_nation = SOV }
			}
		}
		910 = { transfer_state_to = SOV }
	}
}

DEN_joint_military_cooperation = {
	if = {
		limit = {
			OR = {
				FROM = {
					original_tag = ENG
				}
				check_variable = { DEN.DEN_allied_nation = ENG }
			}
		}
		DEN_improve_sovaernet_NS = yes
		add_to_variable = { 
			DEN_sovaernet_navy_org = 0.05
			tooltip = navy_org_factor_tt
		}
		DEN_improve_flyvevabnet_NS = yes
		add_to_variable = { 
			DEN_flyvevabnet_air_agility = 0.05
			tooltip = air_agility_factor_tt
		}
	}
	else_if = {
		limit = {
			OR = {
				FROM = {
					original_tag = FRA
				}
				check_variable = { DEN.DEN_allied_nation = FRA }
			}
		}
		DEN_improve_haeren_NS = yes
		add_to_variable = { 
			DEN_haeren_army_org = 0.05
			tooltip = army_org_factor_tt
		}
		add_to_variable = { 
			DEN_haeren_army_armor_defence = 0.05
			tooltip = army_armor_defence_factor_tt
		}
	}
	else_if = {
		limit = {
			OR = {
				FROM = {
					original_tag = GER
				}
				check_variable = { DEN.DEN_allied_nation = GER }
			}
		}
		DEN_improve_haeren_NS = yes
		add_to_variable = { 
			DEN_haeren_army_armor_attack = 0.1
			tooltip = army_armor_attack_factor_tt
		}
	}
	else_if = {
		limit = {
			OR = {
				FROM = {
					original_tag = SOV
				}
				check_variable = { DEN.DEN_allied_nation = SOV }
			}
		}
		DEN_improve_haeren_NS = yes
		add_to_variable = { 
			DEN_haeren_army_artillery_attack = 0.05
			tooltip = army_artillery_attack_factor_tt 
		}
		add_to_variable = { 
			DEN_haeren_army_artillery_defence = 0.05
			tooltip = army_artillery_defence_factor_tt 
		}
	}
	else_if = {
		limit = {
			OR = {
				FROM = {
					OR = {
						original_tag = SWE
						original_tag = NOR
						original_tag = FIN
						original_tag = ICE
					}
				}
				check_variable = { DEN.DEN_allied_nation = SWE }
				check_variable = { DEN.DEN_allied_nation = NOR }
				check_variable = { DEN.DEN_allied_nation = FIN }
				check_variable = { DEN.DEN_allied_nation = ICE }
			}
		}
		DEN_improve_haeren_NS = yes
		add_to_variable = { 
			DEN_haeren_army_core_attack = 0.05 
			tooltip = army_core_attack_factor_tt
		}
		add_to_variable = { 
			DEN_haeren_army_core_defence = 0.05 
			tooltip = army_core_defence_factor_tt
		}
	}
}

DEN_alliance_tech_sharing = {
	if = {
		limit = {
			OR = {
				FROM = {
					original_tag = ENG
				}
				check_variable = { DEN.DEN_allied_nation = ENG }
			}
		}
		if = {
			limit = {
				has_tech_sharing_feature = yes
			}
			ENG = {
				add_to_tech_sharing_group = DEN_danish_military_cooperation_program
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = air_equipment
				}
			}
			DEN = {
				add_to_tech_sharing_group = DEN_danish_military_cooperation_program
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = air_equipment
				}
			}
		}
		else = {
			ENG = {
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = air_equipment
				}
			}
			DEN = {
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = air_equipment
				}
			}
		}
	}
	if = {
		limit = {
			OR = {
				FROM = { #For TT purposes
					original_tag = FRA
				}
				check_variable = { DEN.DEN_allied_nation = FRA }
			}
		}
		if = {
			limit = {
				has_tech_sharing_feature = yes
			}
			FRA = { #TODO_DANNE Do this for ALL instances in this scripted effect
				add_to_tech_sharing_group = DEN_danish_military_cooperation_program
			}
			DEN = {
				add_to_tech_sharing_group = DEN_danish_military_cooperation_program
			}
		}
		FRA = {
			add_tech_bonus = {
				name = DEN_danish_military_cooperation_program
				bonus = 0.25
				uses = 1
				category = armor
			}
			add_tech_bonus = {
				name = DEN_danish_military_cooperation_program
				bonus = 0.25
				uses = 1
				category = infantry_weapons
			}
		}
		DEN = {
			add_tech_bonus = {
				name = DEN_danish_military_cooperation_program
				bonus = 0.25
				uses = 1
				category = armor
			}
			add_tech_bonus = {
				name = DEN_danish_military_cooperation_program
				bonus = 0.25
				uses = 1
				category = infantry_weapons
			}
		}
	}
	if = {
		limit = {
			OR = {
				FROM = {
					original_tag = GER
				}
				check_variable = { DEN.DEN_allied_nation = GER }
			}
		}
		if = {
			limit = {
				has_tech_sharing_feature = yes
			}
			GER = {
				add_to_tech_sharing_group = DEN_danish_military_cooperation_program
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.5
					uses = 1
					category = armor
				}
			}
			DEN = {
				add_to_tech_sharing_group = DEN_danish_military_cooperation_program
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.5
					uses = 1
					category = armor
				}
			}
		}
		else = {
			GER = {
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.5
					uses = 1
					category = armor
				}
			}
			DEN = {
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.5
					uses = 1
					category = armor
				}
			}
		}
	}
	if = {
		limit = {
			OR = {
				FROM = {
					original_tag = SOV
				}
				check_variable = { DEN.DEN_allied_nation = SOV }
			}
		}
		if = {
			limit = {
				has_tech_sharing_feature = yes
			}
			SOV = {
				add_to_tech_sharing_group = DEN_danish_military_cooperation_program
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = infantry_weapons
				}
			}
			DEN = {
				add_to_tech_sharing_group = DEN_danish_military_cooperation_program
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = infantry_weapons
				}
			}
		}
		else = {
			SOV = {
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = infantry_weapons
				}
			}
			DEN = {
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.25
					uses = 1
					category = infantry_weapons
				}
			}
		}
	}
	if = {
		limit = {
			OR = {
				FROM = {
					OR = {
						original_tag = SWE
						original_tag = NOR
						original_tag = FIN
						original_tag = ICE
					}
				}
				check_variable = { DEN.DEN_allied_nation = SWE }
				check_variable = { DEN.DEN_allied_nation = NOR }
				check_variable = { DEN.DEN_allied_nation = FIN }
				check_variable = { DEN.DEN_allied_nation = ICE }
			}
		}
		if = {
			limit = {
				has_tech_sharing_feature = yes
			}
			ROOT = {
				add_to_tech_sharing_group = DEN_danish_military_cooperation_program
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = armor
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = infantry_weapons
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = air_equipment
				}
			}
			FROM = {
				add_to_tech_sharing_group = DEN_danish_military_cooperation_program
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = armor
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = infantry_weapons
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = air_equipment
				}
			}
		}
		else = {
			SWE = {
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = armor
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = infantry_weapons
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = air_equipment
				}
			}
			DEN = {
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = armor
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = artillery
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = infantry_weapons
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = naval_equipment
				}
				add_tech_bonus = {
					name = DEN_danish_military_cooperation_program
					bonus = 0.15
					uses = 1
					category = air_equipment
				}
			}
		}
	}
}

DEN_swedish_territory_wargoals = { #Set in an event
	if = {
		limit = {
			FROM = {
				controls_state = 138
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 138 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 139
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 139 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 140
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 140 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 915
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 915 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 913
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 913 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 919
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 919 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 141
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 141 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 916
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 916 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 38
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 38 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 917
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 917 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 918
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 918 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 666
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 666  }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 124
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 124 }
		}
	}
}

DEN_icelandic_territory_wargoals = { #Set in an event
	if = {
		limit = {
			FROM = {
				controls_state = 100
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 100 }
		}
	}
}

DEN_finnish_territory_wargoals = { #Set in an event
	if = {
		limit = {
			FROM = {
				controls_state = 111
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 111 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 145
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 145 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 148
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 148 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 149
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 149 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 150
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 150 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 926
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 926 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 927
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 927 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 928
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 928 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 929
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 929 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 930
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 930 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 918
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 918 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 666
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 666  }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 124
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 124 }
		}
	}
}

DEN_norwegian_territory_wargoals = { #Set in an event
	if = {
		limit = {
			FROM = {
				controls_state = 110
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 110 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 142
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 142 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 143
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 143 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 144
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 144 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 920
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 920 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 921
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 921 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 922
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 922 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 923
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 923 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 924
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 924 }
		}
	}
	if = {
		limit = {
			FROM = {
				controls_state = 925
			}
		}
		create_wargoal = {
			type = take_state_focus
			target = FROM
			generator = { 925 }
		}
	}
}

DEN_create_the_plenipotentiary = { #This is set up in an event and will create a new country leader in the Overlord country, but retires that character immediately so that character doesn't assume power 
	if = {
		limit = {
			FROM = { #Overlord Scope
				original_tag = GER
				has_government = fascism
			}
		}
		DEN_werner_best = {
			add_country_leader_role = {
				country_leader = {
					ideology = nazism
					expire = "1965.1.1.1"
					id = -1
					traits = {
						DEN_plenipotentiary
					}
				}
			}
		}
	}
	else_if = {
		limit = {
			FROM = { #Overlord Scope
				NOT = { original_tag = GER }
				has_government = fascism
			}
		}
		FROM = {
			create_country_leader = {
				picture = GFX_portrait_Europe_Generic_1
				expire = "1965.1.1"
				ideology = fascism_ideology
				traits = {
					DEN_plenipotentiary
				}	
			}
			retire_country_leader = yes #Necessary to not install this character as the Overlord's new country leader
		}
	}
	else_if = {
		limit = {
			FROM = { #Overlord Scope
				has_government = communism
			}
		}
		FROM = {
			create_country_leader = {
				picture = GFX_portrait_Europe_Generic_1
				expire = "1965.1.1"
				ideology = stalinism
				traits = {
					DEN_plenipotentiary
				}	
			}
			retire_country_leader = yes #Necessary to not install this character as the Overlord's new country leader
		}
	}
	else_if = {
		limit = {
			FROM = { #Overlord Scope
				has_government = neutrality
			}
		}
		FROM = {
			create_country_leader = {
				picture = GFX_portrait_Europe_Generic_1
				expire = "1965.1.1"
				ideology = despotism
				traits = {
					DEN_plenipotentiary
				}	
			}
			retire_country_leader = yes #Necessary to not install this character as the Overlord's new country leader
		}
	}
	else_if = {
		limit = {
			FROM = { #Overlord Scope
				has_government = democratic
			}
		}
		FROM = {
			create_country_leader = {
				picture = GFX_portrait_Europe_Generic_1
				expire = "1965.1.1"
				ideology = conservatism
				traits = {
					DEN_plenipotentiary
				}	
			}
			retire_country_leader = yes #Necessary to not install this character as the Overlord's new country leader
		}
	}
}

DEN_install_a_plenipotentiary = {
	get_current_ruling_party = yes
	if = {
		limit = {
			FROM = { #Overlord Scope
				has_government = fascism
			}
		}
		set_politics = { #Denmark Scope
			ruling_party = fascism
		}
	}
	else_if = {
		limit = {
			FROM = { #Overlord Scope
				has_government = communism
			}
		}
		set_politics = { #Denmark Scope
			ruling_party = communism
		}
	}
	else_if = {
		limit = {
			FROM = { #Overlord Scope
				has_government = neutrality
			}
		}
		set_politics = { #Denmark Scope
			ruling_party = neutrality
		}
	}
	else_if = {
		limit = {
			FROM = { #Overlord Scope
				has_government = democratic
			}
		}
		set_politics = { #Denmark Scope
			ruling_party = democratic
		}
	}
	FROM = { #Overlord Scope. Transfer the newly created character to Denmark
		random_character = {
			limit = {
				has_trait = DEN_plenipotentiary
			}
			set_nationality = DEN
		}
	}
	every_character = { #Promote the newly created country leader to become the actual country leader of Denmark
		limit = {
			has_trait = DEN_plenipotentiary
		}
		promote_character = yes
	}

}

DEN_drop_occupation_tag = {
	if = {
		limit = {
			has_cosmetic_tag = DEN_occupied_denmark
		}
		drop_cosmetic_tag = yes
	}
}

DEN_independence_war_effects = {
	hidden_effect = { #Necessary to declare war, but helps TT readability if it's not seen
		if = {
			limit = {  #Necessary in case Overlord already declared war
				is_subject_of = DEN.DEN_overlord_nation
			}
			ROOT = { end_puppet = DEN.DEN_overlord_nation }
			IF = {
				limit = {
					is_in_faction_with = DEN.DEN_overlord_nation
				}
				ROOT = { leave_faction = yes }
			}
		}
		DEN_drop_occupation_tag = yes
	}

	if = {
		limit = {	
			has_country_flag = DEN_cannot_join_factions_flag
		}
		set_rule = { can_join_factions = yes }
		set_rule = { can_decline_call_to_war = no }
		clr_country_flag = DEN_cannot_join_factions_flag
	}

	if = {
		limit = {
			has_country_flag = DEN_is_protectorate_flag
		}
		clr_country_flag = DEN_is_protectorate_flag
	}
	
	if = {
		limit = {
			NOT = { #Necessary in case Overlord already declared war
				has_war_with = DEN.DEN_overlord_nation
			}
		}
		declare_war_on = {
			target = DEN.DEN_overlord_nation
			type = independence_wargoal 
		}
	}
	
	DEN_restore_manpower = yes

	if = {
		limit = {
			OR = {
				has_dynamic_modifier = { modifier = DEN_resistance_dynamic_modifier }
				has_dynamic_modifier = { modifier = DEN_resistance_dynamic_modifier_improved } 
			}
		}
		custom_effect_tooltip = DEN_modify_danish_resistance_dynamic_modifier
		add_to_variable = { 
			DEN_resistance_weekly_manpower = 1000
			tooltip = weekly_manpower_tt
		}
		add_to_variable = { 
			DEN_resistance_mobilization_speed = 0.25 
			tooltip = mobilization_speed_tt
		}
		add_to_variable = {
			DEN_resistance_target_on_our_occupied_states = 0.05
			tooltip = resistance_target_on_our_occupied_states_tt
		}
		add_to_variable = {
			DEN_resistance_compliance_growth_on_our_occupied_states = -0.05
			tooltip = compliance_growth_on_our_occupied_states_tt
		}
		clear_variable = DEN_resistance_power_balance_weekly
		custom_effect_tooltip = DEN_remove_resistance_in_365_days_tt
	}

	hidden_effect = {
		if = {
			limit = {
				has_dynamic_modifier = { modifier = DEN_resistance_dynamic_modifier_improved } 
			}
			remove_dynamic_modifier = { modifier = DEN_resistance_dynamic_modifier_improved }
			add_dynamic_modifier = { modifier = DEN_resistance_dynamic_modifier_improved days = 365 }
		}
		else_if = {
			limit = {
				has_dynamic_modifier = { modifier = DEN_resistance_dynamic_modifier } 
			}
			remove_dynamic_modifier = { modifier = DEN_resistance_dynamic_modifier }
			add_dynamic_modifier = { modifier = DEN_resistance_dynamic_modifier days = 365 }
		}
	}
	

	if = {
		limit = {
			has_dynamic_modifier = { modifier = DEN_neglected_military_dynamic_modifier } 
		}
		remove_dynamic_modifier = { modifier = DEN_neglected_military_dynamic_modifier }
	}		

	if = {
		limit = {
			has_dynamic_modifier = { modifier = DEN_occupation_laws_dynamic_modifier } 
		}
		remove_dynamic_modifier = { modifier = DEN_occupation_laws_dynamic_modifier }
	}

	if = {
		limit = {
			var:DEN.supporting_nation = { has_country_flag = DEN_supports_denmark_flag }
		}
		var:DEN.supporting_nation = { country_event = { id = denmark_resistance_event.7 hours = 4 } }
	}

	if = {
		limit = { #Mostly for TT purposes
			has_completed_focus = DEN_form_the_danish_freedom_council
		}
		37 = {
			create_unit = { 
				division = "name = \"1. Modstandsbevægelse Militia\" division_template = \"Modstandsbevægelsen Militia\" start_experience_factor = 0.5" 
				owner = ROOT
			}
			create_unit = { 
				division = "name = \"2. Modstandsbevægelse Militia\" division_template = \"Modstandsbevægelsen Militia\" start_experience_factor = 0.5" 
				owner = ROOT
			}
			create_unit = { 
				division = "name = \"3. Modstandsbevægelse Militia\" division_template = \"Modstandsbevægelsen Militia\" start_experience_factor = 0.5" 
				owner = ROOT
			}
			create_unit = { 
				division = "name = \"4. Modstandsbevægelse Militia\" division_template = \"Modstandsbevægelsen Militia\" start_experience_factor = 0.5" 
				owner = ROOT
			}
		}
	}

	if = {
		limit = {
			NOT = { has_rule = can_access_market }
		}
		set_rule = {
			can_access_market = yes
		}
	}
	
	set_power_balance = {
		id = DEN_balance_of_power
		left_side = DEN_welfare_side
		right_side = DEN_warfare_side
		set_value = 0.3
	}

	mark_focus_tree_layout_dirty = yes
}

DEN_puppet_on_action_effects = { #This is triggered when Denmark is set free or otherwise called through on_action, like peace conferences or being set free through other means than through the focus tree
	if = {
		limit = {
			DEN  = {
				has_cosmetic_tag = DEN_occupied_denmark
			}
		}
		DEN  = {	
			drop_cosmetic_tag = yes
		}
	}
	if = {
		limit = {
			DEN = {
				has_country_flag = DEN_is_protectorate_flag
			}
		}
		DEN = { clr_country_flag = DEN_is_protectorate_flag }
	}
	if = {
		limit = {	
			DEN = {
				has_country_flag = DEN_cannot_join_factions_flag
			}
		}
		DEN = {
			set_rule = { can_join_factions = yes }
			set_rule = { can_decline_call_to_war = no }
			clr_country_flag = DEN_cannot_join_factions_flag
		}
	}
	if = { #If the Overlord installed a country leader of their own, that dude needs to go for ever
		limit = {	
			DEN = {
				has_country_leader_with_trait = DEN_plenipotentiary
			}
		}
		DEN = {
			retire_country_leader = yes
			restore_ruling_party = yes
		}
	}
	if = {
		limit = {
			DEN = { is_subject = no	}
		}
		DEN = {
			set_power_balance = {
				id = DEN_balance_of_power
				left_side = DEN_welfare_side
				right_side = DEN_warfare_side
				set_value = 0
			}
		}
	}
}
