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


FIN_nokia_tires_after_tech_effect = {
	if = {
		limit = {
			927 = {
				free_building_slots = {
					building = synthetic_refinery
					size > 1
					include_locked = yes
				}
			}
		}
		927 = { #HÄME (Tampere - Nokia)
			add_extra_state_shared_building_slots = 3
			add_building_construction = {
				type = synthetic_refinery
				level = 2
				instant_build = yes
			}
		}
	}
	else_if = {
		limit = {
			927 = {
				free_building_slots = {
					building = synthetic_refinery
					size > 0
					include_locked = yes
				}
			}
		}
		927 = { #HÄME (Tampere - Nokia)
			add_extra_state_shared_building_slots = 2
			add_building_construction = {
				type = synthetic_refinery
				level = 1
				instant_build = yes
			}
		}
		random_core_state = {
			limit = {
				is_fully_controlled_by = ROOT
				free_building_slots = {
					building = synthetic_refinery
					size > 0
					include_locked = yes
				}
			}
			add_extra_state_shared_building_slots = 1
			add_building_construction = {
				type = synthetic_refinery
				level = 1
				instant_build = yes
			}
		}
	}
	else = {
		random_core_state = {
			limit = {
				is_fully_controlled_by = ROOT
				free_building_slots = {
					building = synthetic_refinery
					size > 0
					include_locked = yes
				}
			}
			add_extra_state_shared_building_slots = 3
			add_building_construction = {
				type = synthetic_refinery
				level = 2
				instant_build = yes
			}
		}
	}

	if = {
		limit = {
			has_idea = FIN_nokia
		}
		swap_ideas = {
			remove_idea = FIN_nokia
			add_idea = FIN_nokia_improved
		}
	}
}

### OPERATIVES
FIN_create_operative_hella_wuolijok = { # Focus The Red Watch & Focus Trade Agreements
	create_operative_leader = {
		name = "Hella Wuolijok"
		GFX = GFX_portrait_FIN_hella_wuolijok
		traits = { operative_well_groomed operative_escape_artist }
		bypass_recruitment = no
		available_to_spy_master = yes
		nationalities = { FIN EST }
	}
}

FIN_create_operative_vilho_pentikainen = { # Focus The Red Watch
	create_operative_leader = {
		name = "Vilho Pentikäinen"
		GFX = GFX_portrait_FIN_vilho_pentikainen
		traits = { operative_safe_cracker operative_master_interrogator }
		bypass_recruitment = no
		available_to_spy_master = yes
		nationalities = { FIN SOV }
	}
}


### DECISIONS

FIN_seize_weapon_caches = { #Used on the state scope
	remove_dynamic_modifier = { modifier = FIN_weapon_caches_modifier }
	ROOT = {
		random_list = {
			#log = yes
			25 = {
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = 15
					producer = FIN
				}
			}
			25 = {
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = 35
					producer = FIN
				}
			}
			25 = {
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = 50
					producer = FIN
				}
			}
			25 = {
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = 65
					producer = FIN
				}
				add_equipment_to_stockpile = {
					type = support_equipment
					amount = 35
					producer = FIN
				}
			}
		}
	}
}


### CONTINUATION WAR

FIN_pact_for_continuation_war_start = { #To be used on FIN's scope - Used immediately upon signing agreement
	FIN = {
		if = {
			limit = {
				NOT = { gives_military_access_to = GER }
			}
			give_military_access = GER
		}
		diplomatic_relation = { 
			country = GER
			relation = docking_rights 
			active = yes
		}
		if = {
			limit = {
				NOT = { has_non_aggression_pact_with = GER }
			}
			diplomatic_relation = { 
				country = GER
				relation = non_aggression_pact 
				active = yes
			}
		}
	}
	if = {
		limit = {
			GER = { NOT = { has_guaranteed = FIN } }
		}
		GER = { give_guarantee = FIN }
	}
}

### STATE CHANGES AND NAMES ###

#Change name of States and VPs when appropriate. Expected to be used inside on_state_control_changed. FROM.FROM is state / ROOT is new controller / FROM is former controller
FIN_change_name_of_state_or_vp = {
	IF = { # Petrozavodsk / Äänislinna
		limit = {
			FROM.FROM = {
				state = 216 #OLONETS
			}
		}
		IF = { #FINLAND CONTROLLER
			limit = {
				OR = {
					ROOT = { original_tag = FIN }
					ROOT = { original_tag = KAR }
				}
			}
			set_province_name = { id = 11159 name = VICTORY_POINTS_11159_FIN }
		}
		ELSE_IF = { #OTHER CONTROLLER
			limit = {
				OR = {
					FROM = { original_tag = FIN }
					FROM = { original_tag = KAR }
				}
				ROOT = {
					NOT = {
						OR = {
							original_tag = FIN
							original_tag = KAR
						}
					}
				}
			}
			reset_province_name = 11159
		}
	}
	ELSE_IF = { # MURMANSK / KUOLAN NIEMIMAA // (Murmansk / Muurmanski) (Kandalaksha / Kantalahti)
		limit = {
			FROM.FROM = {
				state = 213 #MURMANSK
			}
		}
		IF = { #FINLAND CONTROLLER
			limit = {
				OR = {
					ROOT = { original_tag = FIN }
					ROOT = { original_tag = KAR }
				}
			}
			FROM.FROM = { set_state_name = STATE_213_FIN }
			set_province_name = { id = 3134 name = VICTORY_POINTS_3134_FIN } #Murmansk
		}
		ELSE_IF = { #OTHER CONTROLLER
			limit = {
				OR = {
					FROM = { original_tag = FIN }
					FROM = { original_tag = KAR }
				}
				ROOT = {
					NOT = {
						OR = {
							original_tag = FIN
							original_tag = KAR
						}
					}
				}
			}
			FROM.FROM = { reset_state_name = yes }
			reset_province_name = 3134
		}
	}
	ELSE_IF = { # Kantalahti
		limit = {
			FROM.FROM = {
				state = 1031
			}
		}
		IF = { #FINLAND CONTROLLER
			limit = {
				OR = {
					ROOT = { original_tag = FIN }
					ROOT = { original_tag = KAR }
				}
			}
			FROM.FROM = { set_state_name = STATE_970_FIN }
			set_province_name = { id = 6181 name = VICTORY_POINTS_6181_FIN } #Kandalaksha
		}
		ELSE_IF = { #OTHER CONTROLLER
			limit = {
				OR = {
					FROM = { original_tag = FIN }
					FROM = { original_tag = KAR }
				}
				ROOT = {
					NOT = {
						OR = {
							original_tag = FIN
							original_tag = KAR
						}
					}
				}
			}
			FROM.FROM = { reset_state_name = yes }
			reset_province_name = 6181
		}
	}
	ELSE_IF = { # LENINGRAD / PIETARI // (Leningrad / Pietari)
		limit = {
			FROM.FROM = {
				state = 195 #LENINGRAD
			}
		}
		IF = { #FINLAND CONTROLLER
			limit = {
				OR = {
					ROOT = { original_tag = FIN }
					ROOT = { original_tag = KAR }
				}
			}
			FROM.FROM = { set_state_name = STATE_195_FIN }
			set_province_name = { id = 3151 name = VICTORY_POINTS_3151_FIN } #Leningrad
		}
		ELSE_IF = { #OTHER CONTROLLER
			limit = {
				OR = {
					FROM = { original_tag = FIN }
					FROM = { original_tag = KAR }
				}
				ROOT = {
					NOT = {
						OR = {
							original_tag = FIN
							original_tag = KAR
						}
					}
				}
			}
			FROM.FROM = { reset_state_name = yes }
			reset_province_name = 3151
		}
	}
}

######## ##     ## ########    ########     ###    ######## ##     ##    ########  #######      ######   #######   ######  ####    ###    ##       ####  ######  ##     ## 
   ##    ##     ## ##          ##     ##   ## ##      ##    ##     ##       ##    ##     ##    ##    ## ##     ## ##    ##  ##    ## ##   ##        ##  ##    ## ###   ### 
   ##    ##     ## ##          ##     ##  ##   ##     ##    ##     ##       ##    ##     ##    ##       ##     ## ##        ##   ##   ##  ##        ##  ##       #### #### 
   ##    ######### ######      ########  ##     ##    ##    #########       ##    ##     ##     ######  ##     ## ##        ##  ##     ## ##        ##   ######  ## ### ## 
   ##    ##     ## ##          ##        #########    ##    ##     ##       ##    ##     ##          ## ##     ## ##        ##  ######### ##        ##        ## ##     ## 
   ##    ##     ## ##          ##        ##     ##    ##    ##     ##       ##    ##     ##    ##    ## ##     ## ##    ##  ##  ##     ## ##        ##  ##    ## ##     ## 
   ##    ##     ## ########    ##        ##     ##    ##    ##     ##       ##     #######      ######   #######   ######  #### ##     ## ######## ####  ######  ##     ## 


FIN_purchase_soviet_equipment_for_cw = {
	add_equipment_to_stockpile = { 
		type = infantry_equipment_0
		amount = 6000 
		producer = SOV
	}

	add_equipment_to_stockpile = { 
		type = support_equipment
		amount = 600
		producer = SOV
	}

	add_equipment_to_stockpile = { 
		type = motorized_equipment_1
		amount = 200
		producer = SOV
	}

	if = {
		limit = {
			has_dlc = "La Resistance"
		}
		create_equipment_variant = {
			name = "BA-20"
			type = gw_armored_car_equipment
			allow_without_tech = yes
			model = "SOV_armored_car_0_entity"
			icon = "GFX_SOV_armored_car1_medium"
			#design_team = mio:my_mio_token # Optional. accepts mio:token, variable or keyword #TODO_Manu
		}
		add_equipment_to_stockpile = { 
			type = gw_armored_car_equipment
			amount = 50
			producer = SOV
			variant_name = "BA-20"
		}
	}

	if = {
		limit = {
			has_dlc = "No Step Back"
		}
		if = {
			limit = {
				NOT = { has_tech = gwtank_chassis }
			}
			set_technology = {
				gwtank_chassis = 1
				popup = yes
			}
		}
		create_equipment_variant = { #Copy of T-27 variant in Soviet history file
			name = "T-27"
			type = light_tank_chassis_0
			allow_without_tech = yes # Tooltip purposes, tech will be granted anyways
			modules = {
				main_armament_slot = tank_heavy_machine_gun
				turret_type_slot = tank_light_fixed_superstructure_turret
				suspension_type_slot = tank_bogie_suspension
				armor_type_slot = tank_riveted_armor
				engine_type_slot = tank_gasoline_engine
			}
			upgrades = {
				tank_nsb_engine_upgrade = 1
				tank_nsb_armor_upgrade = 1
			}
			obsolete = yes
			icon = "GFX_generic_gw_light_tank_medium"
		}
		add_equipment_to_stockpile = { 
			type = light_tank_chassis_0
			amount = 50
			producer = SOV
			variant_name = "T-27"
		}
	}
	else = {
		create_equipment_variant = {
			name = "T-18"
			type = gw_tank_equipment
			allow_without_tech = yes
			obsolete = yes
			icon = "GFX_gwtank_medium"
		}
		add_equipment_to_stockpile = { 
			type = gw_tank_equipment
			amount = 50
			producer = SOV
			variant_name = "T-18"
		}
	}

	if = {
		limit = {
			has_dlc = "By Blood Alone"
		}
		if = {
			limit = {
				NOT = { has_tech = iw_small_airframe }
			}
			set_technology = {
				iw_small_airframe = 1
				popup = yes
			}
		}
		create_equipment_variant = { #Copy of I-15 variant in Soviet history file
			name = "I-15"
			type = small_plane_airframe_0
			allow_without_tech = yes # Tooltip purposes, tech will be granted anyways
			modules = {
				fixed_main_weapon_slot = light_mg_4x
				engine_type_slot = engine_1_1x
				special_type_slot_1 = empty
			}
			obsolete = yes
			icon = "GFX_SOV_early_fighter_medium"
			model = "SOV_fighter_equipment_0_entity"
		}
		add_equipment_to_stockpile = { 
			type = small_plane_airframe_0
			amount = 30
			producer = SOV
			variant_name = "I-15"
		}
	}
	else = {
		create_equipment_variant = {
			name = "I-15"
			type = fighter_equipment_0
			allow_without_tech = yes
			obsolete = yes
			icon = "GFX_SOV_early_fighter_medium"
			model = "SOV_fighter_equipment_0_entity"
		}
		add_equipment_to_stockpile = { 
			type = fighter_equipment_0
			amount = 30
			producer = SOV
			variant_name = "I-15"
		}
	}
}




###################################
### FINNISH DEMOCRATIC REPUBLIC ###
###################################

FIN_form_finnish_democratic_republic = {
	if = {
		limit = {
			NOT = { has_country_flag = FIN_finish_democratic_republic_formed_flag }
		}
		promote_character = FIN_otto_wille_kuusinen
		set_cosmetic_tag = FIN_finnish_democratic_republic
		random_other_country = {
			limit = {
				original_tag = SOV
				has_country_leader = {
					ruling_only = yes
					character = SOV_iosif_stalin
				}
			}
			add_timed_idea = {
				idea = FIN_finnish_goods
				days = 730
			}
		}
		set_country_flag = FIN_finish_democratic_republic_formed_flag
	}
}


########    ###     ######   ######  ####  ######  ########     ######   #######  ##     ## ########  
##         ## ##   ##    ## ##    ##  ##  ##    ##    ##       ##    ## ##     ## ##     ## ##     ## 
##        ##   ##  ##       ##        ##  ##          ##       ##       ##     ## ##     ## ##     ## 
######   ##     ##  ######  ##        ##   ######     ##       ##       ##     ## ##     ## ########  
##       #########       ## ##        ##        ##    ##       ##       ##     ## ##     ## ##        
##       ##     ## ##    ## ##    ##  ##  ##    ##    ##       ##    ## ##     ## ##     ## ##        
##       ##     ##  ######   ######  ####  ######     ##        ######   #######   #######  ##        


FIN_purchase_german_equipment_for_cw = {
	add_equipment_to_stockpile = { 
		type = infantry_equipment_0
		amount = 6000 
		producer = GER
	}

	add_equipment_to_stockpile = { 
		type = support_equipment
		amount = 600
		producer = GER
	}

	add_equipment_to_stockpile = { 
		type = motorized_equipment_1
		amount = 200
		producer = GER
	}

	if = {
		limit = {
			has_dlc = "La Resistance"
		}
		create_equipment_variant = {
			name = "Sdkfz 222"
			type = gw_armored_car_equipment
			allow_without_tech = yes
			model = "GER_armored_car_0_entity"
			icon = "GFX_GER_armored_car1_medium"
			#design_team = mio:my_mio_token # Optional. accepts mio:token, variable or keyword #TODO_Manu
		}
		add_equipment_to_stockpile = { 
			type = gw_armored_car_equipment
			amount = 50
			producer = GER
			variant_name = "Sdkfz 222"
		}
	}

	if = {
		limit = {
			has_dlc = "No Step Back"
		}
		if = {
			limit = {
				NOT = { has_tech = gwtank_chassis }
			}
			set_technology = {
				gwtank_chassis = 1
				popup = yes
			}
		}
		create_equipment_variant = { #Copy of Leichttraktor variant in German history file
			name = "Leichttraktor"
			type = light_tank_chassis_0
			allow_without_tech = yes # Tooltip purposes, tech will be granted anyways
			modules = {
				main_armament_slot = tank_small_cannon
				turret_type_slot = tank_light_two_man_tank_turret
				suspension_type_slot = tank_christie_suspension
				armor_type_slot = tank_riveted_armor
				engine_type_slot = tank_gasoline_engine
				special_type_slot_1 = tank_radio_1
			}
			upgrades = {
				tank_nsb_engine_upgrade = 2
				tank_nsb_armor_upgrade = 2
			}
			obsolete = yes
			icon = "GFX_gwtank_medium"
		}
		add_equipment_to_stockpile = { 
			type = light_tank_chassis_0
			amount = 50
			producer = GER
			variant_name = "Leichttraktor"				
		}
	}
	else = {
		create_equipment_variant = {
			name = "Leichttraktor"
			type = gw_tank_equipment
			allow_without_tech = yes
			obsolete = yes
			icon = "GFX_gwtank_medium"
		}
		add_equipment_to_stockpile = { 
			type = gw_tank_equipment
			amount = 50
			producer = GER
			variant_name = "Leichttraktor"	
		}
	}

	if = {
		limit = {
			has_dlc = "By Blood Alone"
		}
		if = {
			limit = {
				NOT = { has_tech = iw_small_airframe }
			}
			set_technology = {
				iw_small_airframe = 1
				popup = yes
			}
		}
		create_equipment_variant = { #Copy of I-15 variant in German history file
			name = "He 51" #also covers Ar 68
			type = small_plane_airframe_0
			modules = {
				fixed_main_weapon_slot = light_mg_2x
				engine_type_slot = engine_1_1x
				special_type_slot_1 = empty
			}
			obsolete = yes
			icon = "GFX_GER_early_fighter_medium"
			model = "GER_fighter_equipment_0_entity"
		}
		add_equipment_to_stockpile = { 
			type = small_plane_airframe_0
			amount = 30
			producer = GER
			variant_name = "He 51"
		}
	}
	else = {
		create_equipment_variant = {
			name = "He 51"
			type = fighter_equipment_0
			allow_without_tech = yes
			obsolete = yes
			icon = "GFX_GER_early_fighter_medium"
			model = "GER_fighter_equipment_0_entity"
		}
		add_equipment_to_stockpile = { 
			type = fighter_equipment_0
			amount = 30
			producer = GER
			variant_name = "He 51"
		}
	}
}




########   #######  ########
##     ## ##     ## ##     ##
##     ## ##     ## ##     ##
########  ##     ## ########
##     ## ##     ## ##
##     ## ##     ## ##
########   #######  ##


FIN_increase_sisu_ns_effect = {
	if = {
		limit = {
			has_idea = FIN_sisu_1
		}
		swap_ideas = {
			remove_idea = FIN_sisu_1
			add_idea = FIN_sisu_2
		}
	}
	else_if = {
		limit = {
			has_idea = FIN_sisu_2
		}
		swap_ideas = {
			remove_idea = FIN_sisu_2
			add_idea = FIN_sisu_3
		}
	}
	else_if = {
		limit = {
			has_idea = FIN_sisu_3
		}
		swap_ideas = {
			remove_idea = FIN_sisu_3
			add_idea = FIN_sisu_4
		}
	}
	else_if = {
		limit = {
			has_idea = FIN_sisu_4
		}
		swap_ideas = {
			remove_idea = FIN_sisu_4
			add_idea = FIN_sisu_5
		}
	}
}

FIN_decrease_sisu_ns_effect = {
	if = {
		limit = {
			has_idea = FIN_sisu_5
		}
		swap_ideas = {
			remove_idea = FIN_sisu_5
			add_idea = FIN_sisu_4
		}
	}
	else_if = {
		limit = {
			has_idea = FIN_sisu_4
		}
		swap_ideas = {
			remove_idea = FIN_sisu_4
			add_idea = FIN_sisu_3
		}
	}
	else_if = {
		limit = {
			has_idea = FIN_sisu_3
		}
		swap_ideas = {
			remove_idea = FIN_sisu_3
			add_idea = FIN_sisu_2
		}
	}
	else_if = {
		limit = {
			has_idea = FIN_sisu_2
		}
		swap_ideas = {
			remove_idea = FIN_sisu_2
			add_idea = FIN_sisu_1
		}
	}
}

FIN_reset_bop_for_new_leader = { #Reset BoP to 0 (only if lower than 0)
	if = {
		limit = {
			power_balance_value = {
				id = FIN_power_balance
				value < 0
			}
		}
		set_power_balance = {
			id = FIN_power_balance
			set_value = 0
		}
	}
}

FIN_kallio_becomes_country_leader = {
	retire_country_leader = yes
	effect_tooltip = { #Kyosti Kallio will automatically be the next in line after Svinhufvud, so this is just for tooltip purposes
		promote_character = FIN_kyosti_kallio
	}
	#Set Maalaisliitto (Agrarian League) as Non-Aligned party
	set_party_name = {
		ideology = neutrality
		name = FIN_neutrality_party
		long_name = FIN_neutrality_party_long
	}
	FIN_reset_bop_for_new_leader = yes
}

FIN_ryti_becomes_country_leader = {
	retire_country_leader = yes
	effect_tooltip = { #Risto Ryti will automatically be the next in line after Kallio, so this is just for tooltip purposes
		promote_character = FIN_risto_ryti
	}
	#Set National Progressive Party as Non-Aligned party
	set_party_name = {
		ideology = neutrality
		name = FIN_neutrality_party_progressive
		long_name = FIN_neutrality_party_progressive_long
	}
	FIN_reset_bop_for_new_leader = yes
}

FIN_paasikivi_becomes_country_leader = {
	if = {
		limit = {
			has_country_leader = {
				ruling_only = yes
				character = FIN_risto_ryti
			}
		}
		retire_country_leader = yes
	}
	else_if = {
		limit = {
			has_country_leader = {
				ruling_only = yes
				character = FIN_carl_mannerheim
			}
		}
		remove_country_leader_role = { #Removing country role on Mannerheim (instead of retiring) since he should still be a military guy.
			character = FIN_carl_mannerheim
			ideology = oligarchism
		}
	}

	#Paasikivi should usually be the next in line after Ryti or Mannerheim, but just in case due to Mannerheim intereference
	promote_character = FIN_juho_kusti_paasikivi

	#Set Kokoomus as Non-Aligned party
	set_party_name = {
		ideology = neutrality
		name = FIN_neutrality_party_kokoomus
		long_name = FIN_neutrality_party_kokoomus_long
	}
	FIN_reset_bop_for_new_leader = yes
}

FIN_mannerheim_becomes_country_leader = {
	#In this case we do want to keep the political leaders (Ryti or Paasikivi)
	promote_character = FIN_carl_mannerheim
	#Set National Progressive Party as Non-Aligned party
	set_party_name = {
		ideology = neutrality
		name = FIN_neutrality_party_military
		long_name = FIN_neutrality_party_military_long
	}
	if = {
		limit = {
			power_balance_value = {
				id = FIN_power_balance
				value < 0.1
			}
		}
		set_power_balance = {
			id = FIN_power_balance
			set_value = 0.1
		}
	}
}

FIN_check_and_manage_losing_cores_for_bop_effect = {
	if = {
		limit = {
			any_core_state = {
				is_owned_by = ROOT
				NOT = { is_controlled_by = ROOT }
			}
		}
		if = {
			limit = {
				NOT = {
					has_power_balance_modifier = {
						id = FIN_power_balance
						modifier = FIN_bop_modifier_finnish_sovereignty_threatened
					}
				}
			}
			add_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_finnish_sovereignty_threatened
			}
		}
	}
	else_if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_finnish_sovereignty_threatened
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_finnish_sovereignty_threatened
		}
	}
}



FIN_clean_all_obsolete_bop_modifiers_effect = {
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_eradicate_socialism
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_pehr_evind_svinhufvud
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_eradicate_socialism
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_eradicate_extremists
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_kyosti_kallio
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_eradicate_extremists
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_dream_of_greater_finland
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_risto_ryti
				}
				has_country_leader = {
					ruling_only = yes
					character = FIN_prince_wolfgang_von_hesse
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_dream_of_greater_finland
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_reliable_leader
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_carl_mannerheim
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_reliable_leader
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_realist_conservative
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_juho_kusti_paasikivi
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_realist_conservative
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_strong_nation
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_vilho_annala
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_strong_nation
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_united_nation
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_vaino_tanner
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_united_nation
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_anti_fascist_crusade
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_aimo_aaltonen
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_anti_fascist_crusade
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_obliterated_european_fascism
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_yrjo_leino
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_obliterated_european_fascism
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_a_solar_system_of_organizations
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_otto_wille_kuusinen
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_a_solar_system_of_organizations
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_finnish_sovereignty_threatened
			}
			has_country_leader = { #Everyone can have this modifier except Mannerheim
				ruling_only = yes
				character = FIN_carl_mannerheim
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_finnish_sovereignty_threatened
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_concerning_support_for_socialists
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_pehr_evind_svinhufvud
				}
				has_country_leader = {
					ruling_only = yes
					character = FIN_risto_ryti
				}
				has_country_leader = {
					ruling_only = yes
					character = FIN_prince_wolfgang_von_hesse
				}
				has_country_leader = {
					ruling_only = yes
					character = FIN_vilho_annala
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_concerning_support_for_socialists
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_concerning_support_for_extremists
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_kyosti_kallio
				}
				has_country_leader = {
					ruling_only = yes
					character = FIN_vaino_tanner
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_concerning_support_for_extremists
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_appointed_regent
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_carl_mannerheim
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_appointed_regent
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_caretaker
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_juho_kusti_paasikivi
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_caretaker
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_divided_proletariat
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_aimo_aaltonen
				}
				has_country_leader = {
					ruling_only = yes
					character = FIN_yrjo_leino
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_divided_proletariat
		}
	}
	if = {
		limit = {
			has_power_balance_modifier = {
				id = FIN_power_balance
				modifier = FIN_bop_modifier_forgotten_finno_karelians
			}
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_otto_wille_kuusinen
				}
			}
		}
		remove_power_balance_modifier = {
			id = FIN_power_balance
			modifier = FIN_bop_modifier_forgotten_finno_karelians
		}
	}
}

FIN_initiate_balance_of_power_effect = {
	set_power_balance = {
		id = FIN_power_balance
		set_default = yes
	}
}

FIN_bop_absurdly_high_increase_effect = {
	add_power_balance_value = {
		id = FIN_power_balance
		value = 1
	}
}

FIN_bop_very_high_increase_effect = {
	add_power_balance_value = {
		id = FIN_power_balance
		value = 0.25
	}
}

FIN_bop_high_increase_effect = {
	add_power_balance_value = {
		id = FIN_power_balance
		value = 0.2
	}
}

FIN_bop_medium_increase_effect = {
	add_power_balance_value = {
		id = FIN_power_balance
		value = 0.15
	}
}

FIN_bop_low_increase_effect = {
	add_power_balance_value = {
		id = FIN_power_balance
		value = 0.1
	}
}

FIN_bop_very_low_increase_effect = {
	add_power_balance_value = {
		id = FIN_power_balance
		value = 0.05
	}
}

FIN_bop_absurdly_high_decrease_effect = {
	add_power_balance_value = {
		id = FIN_power_balance
		value = -1
	}
}

FIN_bop_very_high_decrease_effect = {
	add_power_balance_value = {
		id = FIN_power_balance
		value = -0.25
	}
}

FIN_bop_high_decrease_effect = {
	add_power_balance_value = {
		id = FIN_power_balance
		value = -0.2
	}
}

FIN_bop_medium_decrease_effect = {
	add_power_balance_value = {
		id = FIN_power_balance
		value = -0.15
	}
}

FIN_bop_low_decrease_effect = {
	add_power_balance_value = {
		id = FIN_power_balance
		value = -0.1
	}
}

FIN_bop_very_low_decrease_effect = {
	add_power_balance_value = {
		id = FIN_power_balance
		value = -0.05
	}
}