###DEBUG STUFF

debug_decisions = {
	DEBUG_MIO_SHOW_DEBUG_MIO_ARCHETYPES = {
		priority = 100
		allowed = {
			always = yes
		}

		visible = {
			is_ai = no
			is_debug = yes
			NOT = { has_country_flag = mio_show_all_archetypes_flag }
		}
		complete_effect = {
			set_country_flag = mio_show_all_archetypes_flag
		}
	}

	DEBUG_MIO_HIDE_DEBGU_MIO_ARCHETYPES = {
		priority = 100
		allowed = {
			always = yes
		}

		visible = {
			is_ai = no
			is_debug = yes
			has_country_flag = mio_show_all_archetypes_flag
		}
		complete_effect = {
			clr_country_flag = mio_show_all_archetypes_flag
		}
	}
}

FIN_balance_of_power_category = {
	DEBUG_FIN_deactivate_BOP = {
		priority = 91
		visible = {
			is_debug = yes
		}
		complete_effect = {
			remove_power_balance = { id = FIN_power_balance }
		}
	}

	DEBUG_FIN_bop_make_decisions_faster_and_free = {
		priority = 90
		visible = {
			is_debug = yes
			NOT = { has_country_flag = FIN_debug_bop_decisions_faster_and_free_flag }
		}
		complete_effect = {
			set_country_flag = FIN_debug_bop_decisions_faster_and_free_flag
			#set_variable = { FIN_bop_take_over_ministry_cost = 0 }
			#set_variable = { FIN_bop_resign_ministry_cost = 0 }
		}
	}

	DEBUG_FIN_bop_make_decisions_go_back_to_normal = {
		priority = 90
		visible = {
			is_debug = yes
			has_country_flag = FIN_debug_bop_decisions_faster_and_free_flag
		}
		complete_effect = {
			clr_country_flag = FIN_debug_bop_decisions_faster_and_free_flag
			#set_variable = { FIN_bop_take_over_ministry_cost = 50 }
			#set_variable = { FIN_bop_resign_ministry_cost = 15 }
		}
	}

	DEBUG_FIN_bop_absurdly_high_increase_value = {
		priority = 20
		visible = {
			is_debug = yes
		}
		complete_effect = {
			FIN_bop_absurdly_high_increase_effect = yes
		}
	}

	DEBUG_FIN_bop_high_increase_value = {
		priority = 19
		visible = {
			is_debug = yes
		}
		complete_effect = {
			FIN_bop_high_increase_effect = yes
		}
	}

	DEBUG_FIN_bop_medium_increase_value = {
		priority = 18
		visible = {
			is_debug = yes
		}
		complete_effect = {
			FIN_bop_medium_increase_effect = yes
		}
	}

	DEBUG_FIN_bop_low_increase_value = {
		priority = 17
		visible = {
			is_debug = yes
		}
		complete_effect = {
			FIN_bop_low_increase_effect = yes
		}
	}

	DEBUG_FIN_bop_very_low_increase_value = {
		priority = 16
		visible = {
			is_debug = yes
		}
		complete_effect = {
			FIN_bop_very_low_increase_effect = yes
		}
	}

	DEBUG_FIN_bop_absurdly_high_decrease_value = {
		priority = 15
		visible = {
			is_debug = yes
		}
		complete_effect = {
			FIN_bop_absurdly_high_decrease_effect = yes
		}
	}

	DEBUG_FIN_bop_high_decrease_value = {
		priority = 14
		visible = {
			is_debug = yes
		}
		complete_effect = {
			FIN_bop_high_decrease_effect = yes
		}
	}

	DEBUG_FIN_bop_medium_decrease_value = {
		priority = 13
		visible = {
			is_debug = yes
		}
		complete_effect = {
			FIN_bop_medium_decrease_effect = yes
		}
	}

	DEBUG_FIN_bop_low_decrease_value = {
		priority = 12
		visible = {
			is_debug = yes
		}
		complete_effect = {
			FIN_bop_low_decrease_effect = yes
		}
	}

	DEBUG_FIN_bop_very_low_decrease_value = {
		priority = 11
		visible = {
			is_debug = yes
		}
		complete_effect = {
			FIN_bop_very_low_decrease_effect = yes
		}
	}

	DEBUG_FIN_set_max_bop = {
		priority = -1
		visible = {
			is_debug = yes
		}
		complete_effect = {
			set_power_balance = {
				id = FIN_power_balance
				set_value = 1
			}
		}
	}

	DEBUG_FIN_set_min_bop = {
		priority = -2
		visible = {
			is_debug = yes
		}
		complete_effect = {
			set_power_balance = {
				id = FIN_power_balance
				set_value = -1
			}
		}
	}

}



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


FIN_motti_tactics_category = {
	FIN_prepare_motti_tactics_in_state = {
		icon = generic_operation

		priority = 10

		state_target = yes

		on_map_mode = map_and_decisions_view

		target_array = ROOT.core_states

		target_trigger = {
			FROM = {
				FIN_state_is_valid_for_motti_tactics = yes
				NOT = { has_dynamic_modifier = { modifier = FIN_motti_tactics_modifier } }
			}
		}

		visible = {
			FROM = {
				is_controlled_by = ROOT
			}
		}
		
		cancel_if_not_visible = yes

		custom_cost_trigger = {
			command_power > FIN_motti_decision_cost_for_trigger
			has_political_power > FIN_motti_decision_cost_for_trigger
		}
		custom_cost_text = FIN_motti_tactics_decision_cost_dynamic_cp_pp
		ai_hint_pp_cost = 25 #It increases every time this decision is taken though

		days_remove = 15

		available = {
			FROM = {
				NOT = { has_dynamic_modifier = { modifier = FIN_motti_tactics_modifier } }
				is_controlled_by = ROOT
			}
		}

		cancel_trigger = {
			FROM = {
				NOT = { is_controlled_by = ROOT }
			}
		}

		cancel_effect = {
			#Reset cost
			hidden_effect = {
				divide_variable = { FIN_motti_decision_cost = FIN_motti_decision_cost_increase }
				set_variable = { FIN_motti_decision_cost_for_trigger = FIN_motti_decision_cost } #For trigger purposes
				subtract_from_variable = { FIN_motti_decision_cost_for_trigger = 1 } 
			}
		}

		complete_effect = {
			#Cost increase
			hidden_effect = {
				set_temp_variable = { FIN_remove_mana_cost = FIN_motti_decision_cost }
				multiply_temp_variable = { FIN_remove_mana_cost = -1 }
				add_command_power = FIN_remove_mana_cost
				add_political_power = FIN_remove_mana_cost
				
				multiply_variable = { FIN_motti_decision_cost = FIN_motti_decision_cost_increase }
				set_variable = { FIN_motti_decision_cost_for_trigger = FIN_motti_decision_cost } #For trigger purposes
				subtract_from_variable = { FIN_motti_decision_cost_for_trigger = 1 } 
			}

			custom_effect_tooltip = FIN_motti_tactics_cost_increase_tt
		}

		remove_effect = {
			FROM = {	
				add_dynamic_modifier = { modifier = FIN_motti_tactics_modifier }
			}

			#Trigger event only once per country
			every_enemy_country = {
				limit = {
					NOT = { has_country_flag = FIN_aware_about_motti_tactics_flag }
				}
				country_event = { id = AAT_finland_motti.01 hours = 1 }
			}
		}

		ai_will_do = {
			base = 0.1
			modifier = {
				factor = 10
				FROM = {
					any_neighbor_state = {
						controller = {
							original_tag = SOV
						}
					}
				}
			}
			modifier = {
				factor = 10
				FROM = {
					any_neighbor_state = {
						controller = {
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 10
				FROM = {
					NOT = { is_fully_controlled_by = ROOT }
				}
			}
			modifier = { #Don't do this if historical Finland needs to ban communism tack
				factor = 0
				FIN_is_historical_ai = yes
				OR = {
					has_idea = communist_pressure
					communism > 0.08
				}
				NOT = { has_country_flag = banned_communism_flag }
				NOT = { has_completed_focus = FIN_the_lone_wolf }
			}
		}
	}

	FIN_cancel_motti_tactics_in_state = {
		icon = GFX_decision_FIN_stop_motti_tactics

		priority = 1

		state_target = yes

		on_map_mode = map_and_decisions_view

		target_array = ROOT.core_states

		target_trigger = {
			FROM = {
				has_dynamic_modifier = { modifier = FIN_motti_tactics_modifier }
			}
		}

		available = {
			FROM = {
				has_dynamic_modifier = { modifier = FIN_motti_tactics_modifier }
			}
		}

		complete_effect = {
			FROM = {	
				remove_dynamic_modifier = { modifier = FIN_motti_tactics_modifier }
			}

			#Cost decrease
			hidden_effect = {
				divide_variable = { FIN_motti_decision_cost = FIN_motti_decision_cost_increase }
				set_variable = { FIN_motti_decision_cost_for_trigger = FIN_motti_decision_cost } #For trigger purposes
				subtract_from_variable = { FIN_motti_decision_cost_for_trigger = 1 } 
			}

			custom_effect_tooltip = FIN_motti_tactics_cost_decrease_tt
		}

		ai_will_do = {
			base = 0.1
			modifier = {
				factor = 1000
				FROM = {
					is_fully_controlled_by = ROOT
					all_neighbor_state = {
						controller = {
							NOT = { has_war_with = ROOT }
						}
					}
				}
			}
		}
	}
}



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


FIN_national_defense_category = {
	FIN_set_up_weapon_caches_in_state = {
		priority = 5
		icon = GFX_decision_ger_military_buildup

		state_target = yes

		on_map_mode = map_only

		target_array = ROOT.core_states

		target_trigger = {
			FROM = {
				is_controlled_by = ROOT
				NOT = { has_dynamic_modifier = { modifier = FIN_weapon_caches_modifier } }
			}
		}

		custom_cost_trigger = {
			command_power > FIN_weapon_caches_decision_cost_for_trigger
			has_political_power > FIN_weapon_caches_decision_cost_for_trigger
			has_equipment = {
				infantry_equipment > 49
			}
		}
		custom_cost_text = FIN_weapon_caches_decision_cost_dynamic_ie_cp_pp
		ai_hint_pp_cost = 25 #It increases every time this decision is taken though

		days_remove = 30

		visible = {
			OR = {
				has_completed_focus = FIN_weapon_caches
				has_completed_focus = FIN_defensive_preparations
			}
		}

		available = {
			FROM = {
				NOT = { has_dynamic_modifier = { modifier = FIN_weapon_caches_modifier } }
				is_controlled_by = ROOT
			}
		}

		cancel_trigger = {
			FROM = {
				NOT = { is_controlled_by = ROOT }
			}
		}

		cancel_effect = {
			#Reset cost
			hidden_effect = {
				subtract_from_variable = { FIN_weapon_caches_decision_cost = FIN_weapon_caches_decision_cost_increase }
			}
		}

		complete_effect = {
			#Cost increase
			hidden_effect = {
				set_temp_variable = { FIN_remove_mana_cost = FIN_weapon_caches_decision_cost }
				multiply_temp_variable = { FIN_remove_mana_cost = -1 }
				add_command_power = FIN_remove_mana_cost
				add_political_power = FIN_remove_mana_cost
				add_equipment_to_stockpile = { 
					type = infantry_equipment
					amount = -50
				}

				add_to_variable = { FIN_weapon_caches_decision_cost = FIN_weapon_caches_decision_cost_increase }
				set_variable = { FIN_weapon_caches_decision_cost_for_trigger = FIN_weapon_caches_decision_cost } #For trigger purposes
				subtract_from_variable = { FIN_weapon_caches_decision_cost_for_trigger = 1 } 		
			}

			custom_effect_tooltip = FIN_weapon_caches_cost_increase_tt
		}

		remove_effect = {
			FROM = {	
				add_dynamic_modifier = { modifier = FIN_weapon_caches_modifier days = 1460 }
			}
		}

		ai_will_do = {
			base = 0.1
			modifier = {
				factor = 2
				is_historical_focus_on = yes
			}
			modifier = {
				factor = 5
				OR = {
					FIN_is_historical_ai = yes
					FIN_is_fascist_ai = yes
				}
			}
			modifier = {
				factor = 10
				OR = {
					FIN_is_historical_ai = yes
					FIN_is_fascist_ai = yes
				}
				FROM = {
					any_neighbor_state = {
						controller = {
							original_tag = SOV
						}
					}
				}
			}
			modifier = { #Don't do this if historical Finland needs to ban communism tack
				factor = 0
				FIN_is_historical_ai = yes
				OR = {
					has_idea = communist_pressure
					communism > 0.08
				}
				NOT = { has_country_flag = banned_communism_flag }
				NOT = { has_completed_focus = FIN_the_lone_wolf }
			}
		}
	}

	FIN_surrender_to_the_soviet_union = {
		priority = 20

		icon = GFX_decision_generic_form_nation

		ai_will_do = { #AI should just start peace negotiations via event
			base = 0.01
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_war_with = SOV
			surrender_progress > 0.25
			has_civil_war = no
			OR = {
				is_in_faction = no
				is_faction_leader = yes
			}
			NOT = { has_country_flag = FIN_reached_out_to_soviets_to_surrender_flag } #Tooltip purposes
		}

		visible = {
			has_war_with = SOV
			has_civil_war = no
			OR = {
				is_in_faction = no
				is_faction_leader = yes
			}
			NOT = { has_country_flag = FIN_reached_out_to_soviets_to_surrender_flag }
			has_country_flag = FIN_available_decision_to_surrender_to_soviets_flag
		}

		cost = 35

		complete_effect = {
			clr_country_flag = FIN_available_decision_to_surrender_to_soviets_flag
			set_country_flag = FIN_reached_out_to_soviets_to_surrender_flag

			SOV = {
				country_event = { id = finland.8 hours = 1 }
			}

			custom_effect_tooltip = if_they_accept_tt
			event_option_tooltip = finland.7.a
		}
	}

	FIN_demand_peace_negotiations = {
		priority = 21

		icon = GFX_decision_eng_trade_unions_support

		ai_will_do = {
			base = 0.5
		}

		fire_only_once = yes

		allowed = {
			original_tag = FIN
		}

		available = {
			has_war_with = SOV
			controls_state = 195 #LENINGRAD
			has_country_flag = FIN_can_demand_peace_negotiations_flag
			has_country_flag = FIN_winter_war_ongoing_flag
			has_civil_war = no
			OR = {
				is_in_faction = no
				is_faction_leader = yes
			}
		}

		visible = {
			has_war_with = SOV
			has_civil_war = no
			OR = {
				is_in_faction = no
				is_faction_leader = yes
			}
			has_country_flag = FIN_winter_war_ongoing_flag
			NOT = { has_country_flag = FIN_winter_war_peace_demanded_flag }
		}

		complete_effect = {
			#Controlling states in Kola or East Karelia allows for territorial demands
			if = {
				limit = {
					OR = {
						213 = { #MURMANSK
							is_owned_by = SOV
							is_controlled_by = FIN
						}
						215 = { #ONEGA
							is_owned_by = SOV
							is_controlled_by = FIN
						}
						216 = { #OLONETS
							is_owned_by = SOV
							is_controlled_by = FIN
						}
					}
				}
				#Apply state flags to keep track of the states that should be included (any state control hange after activating the decision will not count)
				#Done like this for tooltip purposes, otherwise it's problematic (adding flags and checking for them in the same decision)
				#MURMANSK
				if = {
					limit = {
						213 = {
							is_owned_by = SOV
							is_controlled_by = FIN
						}
					}
					213 = { set_state_flag = FIN_demanded_by_finland_in_winter_war_flag }
				}
				#ONEGA
				if = {
					limit = {
						215 = {
							is_owned_by = SOV
							is_controlled_by = FIN
						}
					}
					215 = { set_state_flag = FIN_demanded_by_finland_in_winter_war_flag }
				}
				#OLONETS
				if = {
					limit = {
						216 = {
							is_owned_by = SOV
							is_controlled_by = FIN
						}
					}
					216 = { set_state_flag = FIN_demanded_by_finland_in_winter_war_flag }
				}

				SOV = {
					country_event = { id = AAT_finland_winter_war.06 hours = 1 } #Territorial demands event
				}
				custom_effect_tooltip = if_they_accept_tt
				event_option_tooltip = AAT_finland_winter_war.06.a
			}
			else = {
				SOV = {
					country_event = { id = AAT_finland_winter_war.03 hours = 1 } #White peace event
				}
				custom_effect_tooltip = if_they_accept_tt
				event_option_tooltip = AAT_finland_winter_war.03.a

				custom_effect_tooltip = FIN_can_demand_territory_if_occupying_tt
			}

			#Manage flags
			clr_country_flag = FIN_can_demand_peace_negotiations_flag
			set_country_flag = FIN_winter_war_peace_demanded_flag
		}
	}

	FIN_hold_leningrad_mission = { #MISSION FOR FIN
		priority = 30
		icon = GFX_decision_hol_draw_up_staff_plans
		allowed = {
			tag = FIN
		}

		available = { #FAIL
			NOT = { controls_state = 195 }
		}

		activation = {
			has_country_flag = FIN_winter_war_ongoing_flag
			has_war_with = SOV
			controls_state = 195
			195 = { is_owned_by = SOV }
			NOT = { has_country_flag = FIN_winter_war_peace_demanded_flag }
			NOT = { has_country_flag = FIN_can_demand_peace_negotiations_flag }
			OR = {
				is_in_faction = no
				is_faction_leader = yes
			}
		}

		#cancel_if_not_visible = yes
		is_good = yes
		fire_only_once = no
		selectable_mission = no
		days_mission_timeout = 30

		cancel_trigger = {
			hidden_trigger = {
				OR = {
					NOT = { has_country_flag = FIN_winter_war_ongoing_flag }
					NOT = { has_war_with = SOV }
					has_capitulated = yes
				}
			}
		}

		cancel_effect = {

		}

		timeout_effect = { #MISSION SUCCEEDED
			set_country_flag = FIN_can_demand_peace_negotiations_flag
			country_event = AAT_finland_winter_war.02
		}

		complete_effect = { #MISSION FAILED
			
		}
	}

	FIN_coastal_garrisons = {
		priority = 6

		icon = GFX_decision_generic_military

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = FIN
		}

		visible = {
			OR = {
				has_completed_focus = FIN_coastal_defense
				has_completed_focus = FIN_defensive_preparations
			}
			OR = {
				has_full_control_of_state = 111
				has_full_control_of_state = 928
				has_full_control_of_state = 146
				has_full_control_of_state = 926
				has_full_control_of_state = 145
				has_full_control_of_state = 149
				has_full_control_of_state = 929
				has_full_control_of_state = 148
			}
		}

		available = {
			OR = {
				has_full_control_of_state = 111
				has_full_control_of_state = 928
				has_full_control_of_state = 146
				has_full_control_of_state = 926
				has_full_control_of_state = 145
				has_full_control_of_state = 149
				has_full_control_of_state = 929
				has_full_control_of_state = 148
			}
		}

		custom_cost_trigger = {
			has_political_power > FIN_coastal_garrisons_pp_xp_cost_trigger
			has_army_experience > FIN_coastal_garrisons_pp_xp_cost_trigger
			command_power > FIN_coastal_garrisons_cp_cost_trigger
		}
		custom_cost_text = FIN_coastal_garrisons_decision_cost_pp_xp_cp
		ai_hint_pp_cost = 60

		days_remove = FIN_coastal_garrisons_time

		fire_only_once = yes

		complete_effect = {
			hidden_effect = {
				set_temp_variable = { FIN_coastal_garrisons_pp_xp_remove_value = FIN_coastal_garrisons_pp_xp_cost }
				multiply_temp_variable = { FIN_coastal_garrisons_pp_xp_remove_value = -1 }
				add_political_power = FIN_coastal_garrisons_pp_xp_remove_value
				army_experience = FIN_coastal_garrisons_pp_xp_remove_value

				set_temp_variable = { FIN_coastal_garrisons_cp_remove_value = FIN_coastal_garrisons_cp_cost }
				multiply_temp_variable = { FIN_coastal_garrisons_cp_remove_value = -1 }
				add_command_power = FIN_coastal_garrisons_cp_remove_value

				set_country_flag = FIN_coastal_garrisons_deployed_flag #For loc purposes in focus tooltips
			}
		}

		remove_effect = {
			if = {
				limit = {
					has_completed_focus = FIN_winter_warfare
				}
				division_template = {
					name = "Rannikkorykmentti"
					is_locked = yes
					priority = 0
					template_counter = 6
					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }					
					}
					support = {
						engineer = { x = 0 y = 0 }
						artillery = { x = 0 y = 1 }
						winter_logistics_support = { x = 0 y = 2 }
					}
				}
			}
			else = {
				division_template = {
					name = "Rannikkorykmentti"
					is_locked = yes
					priority = 0
					template_counter = 6
					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }					
					}
					support = {
						engineer = { x = 0 y = 0 }
						artillery = { x = 0 y = 1 }
					}
				}
			}
			if = { #UUSIMAA (Helsinki)
				limit = {
					111 = {
						is_fully_controlled_by = ROOT
						naval_base > 0
					}
				}
				111 = {
					create_unit = {
						division = "name = \"Helsingin Rannikkorykmentti\" division_template = \"Rannikkorykmentti\" start_experience_factor = 0.3 start_equipment_factor = 1.0 start_manpower_factor = 1.0"
						owner = ROOT
						prioritize_location = 11105
						allow_spawning_on_enemy_provs = no  
						count = 1 
					}
				}
			}
			if = { #KYMI (Kotka)
				limit = {
					928 = {
						is_fully_controlled_by = ROOT
						naval_base > 0
					}
				}
				928 = {
					create_unit = {
						division = "name = \"Kotkan Rannikkorykmentti\" division_template = \"Rannikkorykmentti\" start_experience_factor = 0.3 start_equipment_factor = 1.0 start_manpower_factor = 1.0"
						owner = ROOT
						prioritize_location = 3061
						allow_spawning_on_enemy_provs = no  
						count = 1 
					}
				}
			}
			if = { #KARJALA (Viipuri)
				limit = {
					146 = {
						is_fully_controlled_by = ROOT
						naval_base > 0
					}
				}
				146 = {
					create_unit = {
						division = "name = \"Viipurin Rannikkorykmentti\" division_template = \"Rannikkorykmentti\" start_experience_factor = 0.3 start_equipment_factor = 1.0 start_manpower_factor = 1.0"
						owner = ROOT
						prioritize_location = 9206
						allow_spawning_on_enemy_provs = no  
						count = 1 
					}
				}
			}
			if = { #TURKU (Turku)
				limit = {
					926 = {
						is_fully_controlled_by = ROOT
						naval_base > 0
					}
				}
				926 = {
					create_unit = {
						division = "name = \"Turun Rannikkorykmentti\" division_template = \"Rannikkorykmentti\" start_experience_factor = 0.3 start_equipment_factor = 1.0 start_manpower_factor = 1.0"
						owner = ROOT
						prioritize_location = 3083
						allow_spawning_on_enemy_provs = no  
						count = 1 
					}
				}
			}
			if = { #VAASA (Vaasa)
				limit = {
					149 = {
						is_fully_controlled_by = ROOT
						naval_base > 0
					}
				}
				149 = {
					create_unit = {
						division = "name = \"Vaasan Rannikkorykmentti\" division_template = \"Rannikkorykmentti\" start_experience_factor = 0.3 start_equipment_factor = 1.0 start_manpower_factor = 1.0"
						owner = ROOT
						prioritize_location = 3122
						allow_spawning_on_enemy_provs = no  
						count = 1 
					}
				}
			}
			if = { #OULU (Oulu)
				limit = {
					929 = {
						is_fully_controlled_by = ROOT
						naval_base > 0
					}
				}
				929 = {
					create_unit = {
						division = "name = \"Oulun Rannikkorykmentti\" division_template = \"Rannikkorykmentti\" start_experience_factor = 0.3 start_equipment_factor = 1.0 start_manpower_factor = 1.0"
						owner = ROOT
						prioritize_location = 158
						allow_spawning_on_enemy_provs = no  
						count = 1 
					}
				}
			}
			if = { #LAPPI (Kemi)
				limit = {
					148 = {
						is_fully_controlled_by = ROOT
						naval_base > 0
					}
				}
				148 = {
					create_unit = {
						division = "name = \"Kemin Rannikkorykmentti\" division_template = \"Rannikkorykmentti\" start_experience_factor = 0.3 start_equipment_factor = 1.0 start_manpower_factor = 1.0"
						owner = ROOT
						prioritize_location = 11164
						allow_spawning_on_enemy_provs = no  
						count = 1 
					}
				}
			}
			if = { #Åland (Mariehamn I guess)
				limit = {
					145 = {
						is_fully_controlled_by = ROOT
						naval_base > 0
					}
				}
				145 = {
					create_unit = {
						division = "name = \"Maarianhaminan Rannikkorykmentti\" division_template = \"Rannikkorykmentti\" start_experience_factor = 0.3 start_equipment_factor = 1.0 start_manpower_factor = 1.0"
						owner = ROOT
						prioritize_location = 9228
						allow_spawning_on_enemy_provs = no  
						count = 1 
					}
				}
			}
		}
	}

	FIN_mining_the_sea = {
		priority = 5

		icon = GFX_decision_generic_naval_mine

		ai_will_do = {
			base = 0.25
		}

		allowed = {
			original_tag = FIN
			has_dlc = "Man the Guns"
		}

		visible = {
			OR = {
				has_completed_focus = FIN_sea_mines_strategy
				has_completed_focus = FIN_defensive_preparations
			}
			has_full_control_of_state = 111
		}

		available = {
			has_war = no
			has_full_control_of_state = 111
		}

		custom_cost_trigger = {
			has_political_power > FIN_mining_the_sea_pp_xp_cost_trigger
			has_navy_experience > FIN_mining_the_sea_pp_xp_cost_trigger
			command_power > FIN_mining_the_sea_cp_cost_trigger
		}
		custom_cost_text = FIN_mining_the_sea_decision_cost_pp_xp_cp
		ai_hint_pp_cost = 60

		days_remove = FIN_mining_the_sea_time

		fire_only_once = yes

		complete_effect = {
			hidden_effect = {
				set_temp_variable = { FIN_mining_the_sea_pp_xp_remove_value = FIN_mining_the_sea_pp_xp_cost }
				multiply_temp_variable = { FIN_mining_the_sea_pp_xp_remove_value = -1 }
				add_political_power = FIN_mining_the_sea_pp_xp_remove_value
				navy_experience = FIN_mining_the_sea_pp_xp_remove_value

				set_temp_variable = { FIN_mining_the_sea_cp_remove_value = FIN_mining_the_sea_cp_cost }
				multiply_temp_variable = { FIN_mining_the_sea_cp_remove_value = -1 }
				add_command_power = FIN_mining_the_sea_cp_remove_value

				set_country_flag = FIN_sea_mines_deployed_flag #For loc purposes in focus tooltips
			}
		}

		remove_effect = {
			add_mines = { 
				region = 9
				amount = 150
			}
			add_mines = { 
				region = 279
				amount = 100
			}
		}
	}
}

FIN_finnish_resistance_category = {
	FIN_search_for_weapon_caches_in_state = {
		icon = GFX_decision_FIN_weapon_caches

		state_target = yes

		on_map_mode = map_and_decisions_view

		target_array = FIN.core_states

		target_trigger = {
			FROM = {
				is_controlled_by = ROOT
				has_dynamic_modifier = { modifier = FIN_weapon_caches_modifier }
			}
		}

		custom_cost_trigger = {
			command_power > FIN.FIN_search_for_weapon_caches_decision_cost_for_trigger
		}
		custom_cost_text = FIN_search_for_weapon_caches_decision_cost_cp

		days_remove = 90

		target_root_trigger = {
			any_controlled_state = {
				is_core_of = FIN
				has_dynamic_modifier = { modifier = FIN_weapon_caches_modifier }
			}
		}

		available = {
			FROM = {
				has_dynamic_modifier = { modifier = FIN_weapon_caches_modifier }
				is_controlled_by = ROOT
			}
		}

		cancel_trigger = {
			FROM = {
				NOT = { is_controlled_by = ROOT }
			}
		}

		complete_effect = {
			#Cost
			hidden_effect = {			
				set_temp_variable = { FIN_remove_cp_cost = FIN.FIN_search_for_weapon_caches_decision_cost }
				multiply_temp_variable = { FIN_remove_cp_cost = -1 }
				add_command_power = FIN_remove_cp_cost
			}
		}

		remove_effect = {
			if = {
				limit = {
					NOT = { has_country_flag = FIN_weapon_caches_no_more_spam_tack_flag }
				}
				effect_tooltip = {
					FROM = { FIN_seize_weapon_caches = yes }		
				}
				hidden_effect = {
					country_event = AAT_finland_national_defense.02
				}
			}
			else = {
				FROM = { FIN_seize_weapon_caches = yes }
			}

			hidden_effect = {
				if = {
					limit = {
						FIN = {
							NOT = { has_country_flag = FIN_weapon_caches_finland_no_more_spam_tack_flag }
						}
					}
					FIN = { country_event = { id = AAT_finland_national_defense.03 hours = 6 random_hours = 3 } }
				}
			}
		}

		ai_will_do = {
			base = 0.1
			modifier = {
				factor = 20
				command_power > 19
			}
			modifier = {
				factor = 50
				command_power > 49
			}
		}
	}
}

war_measures = {
	FIN_retake_leningrad_mission = { #MISSION FOR SOV
		icon = GFX_decision_hol_draw_up_staff_plans
		allowed = {
			tag = SOV
		}

		available = { #SUCCEED
			controls_state = 195
		}

		activation = {
			FIN = { has_country_flag = FIN_winter_war_ongoing_flag }
			has_war_with = FIN
			FIN = { controls_state = 195 }
			owns_state = 195
			FIN = { NOT = { has_country_flag = FIN_winter_war_peace_demanded_flag } }
		}

		#cancel_if_not_visible = yes
		is_good = no
		fire_only_once = no
		selectable_mission = no
		days_mission_timeout = 30

		cancel_trigger = {
			hidden_trigger = {
				FIN = {
					OR = {
						NOT = { has_country_flag = FIN_winter_war_ongoing_flag }
						NOT = { has_war_with = SOV }
						has_capitulated = yes
					}
				}
			}
		}

		cancel_effect = {
		}

		timeout_effect = { #MISSION SUCCEEDED
		}

		complete_effect = { #MISSION FAILED
			custom_effect_tooltip = FIN_finland_can_send_peace_demands_tt
		}
	}
}

FIN_balance_of_power_category = {
	FIN_motion_of_no_confidence_against_leader = {
		priority = 50

		icon = GFX_decision_SWI_dismiss_council

		ai_will_do = {
			base = 0
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_government = neutrality
			power_balance_value = {
				id = FIN_power_balance
				value < 0.1
			}
			OR = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_pehr_evind_svinhufvud
				}
				has_country_leader = {
					ruling_only = yes
					character = FIN_kyosti_kallio
				}
				has_country_leader = {
					ruling_only = yes
					character = FIN_risto_ryti
				}
			}
		}

		visible = {
			OR = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_pehr_evind_svinhufvud
				}
				has_country_leader = {
					ruling_only = yes
					character = FIN_kyosti_kallio
				}
				has_country_leader = {
					ruling_only = yes
					character = FIN_risto_ryti
				}
			}
		}

		cost = FIN_motion_of_no_confidence_dec_cost

		complete_effect = {
			if = {
				limit = {
					has_country_leader = {
						ruling_only = yes
						character = FIN_pehr_evind_svinhufvud
					}
				}
				country_event = AAT_finland_political.01
				event_option_tooltip = AAT_finland_political.01.a
			}
			else_if = {
				limit = {
					has_country_leader = {
						ruling_only = yes
						character = FIN_kyosti_kallio
					}
				}
				country_event = AAT_finland_political.03
				event_option_tooltip = AAT_finland_political.03.a
			}
			else_if = {
				limit = {
					has_country_leader = {
						ruling_only = yes
						character = FIN_risto_ryti
					}
				}
				country_event = AAT_finland_political.06
				event_option_tooltip = AAT_finland_political.06.a
			}
		}
	}

	FIN_resignation_of_kallio = {
		priority = 49

		icon = GFX_decision_SWI_no_elected_president

		ai_will_do = {
			base = 0
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_country_leader = {
				ruling_only = yes
				character = FIN_kyosti_kallio
			}
			threat > 0.85
		}

		visible = {
			has_country_leader = {
				ruling_only = yes
				character = FIN_kyosti_kallio
			}
		}

		cost = 75

		complete_effect = {
			country_event = AAT_finland_political.05
			event_option_tooltip = AAT_finland_political.05.a
		}
	}

	FIN_form_a_military_government = {
		priority = 48

		icon = GFX_decision_gre_faction_management

		ai_will_do = {
			base = 0
			modifier = {
				add = 10
				FIN_is_historical_ai = yes
				has_country_leader = {
					ruling_only = yes
					character = FIN_risto_ryti
				}
				any_enemy_country = {
					original_tag = SOV
				}
			}
			modifier = {
				factor = 10
				is_historical_focus_on = yes
			}
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_war_with_major = yes
			has_government = neutrality
		}

		visible = {
			NOT = {
				OR = {
					has_country_leader = {
						ruling_only = yes
						character = FIN_prince_wolfgang_von_hesse
					}
					has_country_leader = {
						ruling_only = yes
						character = FIN_carl_mannerheim
					}
				}
			}
			has_government = neutrality
		}

		fire_only_once = yes

		cost = 150

		complete_effect = {
			country_event = AAT_finland_political.07
			event_option_tooltip = AAT_finland_political.07.a

			custom_effect_tooltip = decision_only_once_tt
		}
	}

	FIN_resignation_of_mannerheim = {
		priority = 49

		icon = GFX_decision_SWI_no_elected_president

		ai_will_do = {
			base = 0
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_country_leader = {
				ruling_only = yes
				character = FIN_carl_mannerheim
			}
			has_war = no
		}

		visible = {
			has_country_leader = {
				ruling_only = yes
				character = FIN_carl_mannerheim
			}
			has_country_flag = FIN_resignation_of_mannerheim_available_flag
		}

		fire_only_once = yes

		cost = 50

		complete_effect = {
			country_event = AAT_finland_political.09
			event_option_tooltip = AAT_finland_political.09.a

			clr_country_flag = FIN_resignation_of_mannerheim_available_flag
		}
	}

	FIN_appeal_to_the_finnish_spirit = {
		priority = 39

		icon = GFX_decision_generic_civil_support

		ai_will_do = {
			base = 0.5
			modifier = {
				factor = 10
				OR = {
					has_stability < 0.2
					power_balance_value = {
						id = FIN_power_balance
						value < -0.5
					}
				}
			}
			modifier = {
				factor = 0
				check_variable = { FIN_appeal_to_the_finnish_spirit_dec_cost > 200 }
				has_political_power < 400
			}
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_war = yes
		}

		visible = {

		}

		days_re_enable = 360

		days_remove = 180

		cost = FIN_appeal_to_the_finnish_spirit_dec_cost

		modifier = {
			mobilization_speed = 0.35
		}

		complete_effect = {
			FIN_bop_very_high_increase_effect = yes

			#Increase cost
			multiply_variable = { FIN_appeal_to_the_finnish_spirit_dec_cost = FIN_bop_decision_cost_multiplier }
			custom_effect_tooltip = FIN_appeal_to_the_finnish_spirit_cost_increase_tt
		}
	}

	FIN_entice_the_masses = {
		priority = 38

		icon = GFX_decision_eng_propaganda_campaigns

		ai_will_do = {
			base = 0.5
			modifier = {
				factor = 10
				OR = {
					FIN_is_historical_ai = yes
					AND = {
						FIN_is_fascist_ai = yes
						has_government = fascism
					}
					AND = {
						FIN_is_communist_ai = yes
						has_government = communism
					}
					AND = {
						FIN_is_democratic_ai = yes
						has_government = democratic
					}	
				}
				power_balance_value = {
					id = FIN_power_balance
					value < 0
				}
			}
			modifier = {
				add = 10
				FIN_is_historical_ai = yes
				NOT = { has_completed_focus = FIN_the_lone_wolf }
				has_government = neutrality
				NOT = {
					has_country_leader = {
						ruling_only = yes
						character = FIN_pehr_evind_svinhufvud
					}
				}
				neutrality < 0.85
			}
			modifier = {
				factor = 0
				check_variable = { FIN_entice_the_masses_dec_cost > 200 }
				has_political_power < 400
			}
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			
		}

		visible = {

		}

		days_re_enable = 360

		cost = FIN_entice_the_masses_dec_cost

		complete_effect = {
			add_popularity = {
				ideology = ROOT
				popularity = 0.1
			}
			FIN_bop_medium_increase_effect = yes

			#Increase cost
			multiply_variable = { FIN_entice_the_masses_dec_cost = FIN_bop_decision_cost_multiplier }
			custom_effect_tooltip = FIN_entice_the_masses_cost_increase_tt
		}
	}

	FIN_organize_the_opposition = {
		priority = 30

		icon = GFX_decision_generic_political_discourse

		ai_will_do = {
			base = 0
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_war = no
		}

		visible = {

		}

		days_re_enable = 360

		cost = FIN_organize_the_opposition_dec_cost

		complete_effect = {
			FIN_bop_high_decrease_effect = yes

			add_popularity = {
				ideology = ROOT
				popularity = -0.05
			}

			#Increase cost
			multiply_variable = { FIN_organize_the_opposition_dec_cost = FIN_bop_decision_cost_multiplier }
			custom_effect_tooltip = FIN_organize_the_opposition_cost_increase_tt
		}
	}

	FIN_appoint_yrjo_leino_as_president = {
		priority = 50

		icon = GFX_decision_generic_speech

		ai_will_do = {
			base = 0
		}

		allowed = {
			original_tag = FIN
			has_dlc = "Arms Against Tyranny"
		}

		available = {
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_otto_wille_kuusinen
				}
			}
		}

		visible = {
			has_government = communism
			has_completed_focus = FIN_the_red_watch
			NOT = {
				has_country_leader = {
					ruling_only = yes
					character = FIN_yrjo_leino
				}
			}
		}

		fire_only_once = yes

		cost = 15

		complete_effect = {
			promote_character = {
				character = FIN_yrjo_leino 
				ideology = marxism 
			}
		}
	}
}


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


FIN_the_path_to_socialism = {
	######################
	##### COMMUNISTS #####
	######################
	FIN_gather_popular_support = {
		priority = 50

		icon = GFX_decision_generic_civil_support

		ai_will_do = {
			base = 200
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_idea = FIN_yrjo_leino
			has_completed_focus = FIN_towards_a_red_government
		}

		visible = {
			NOT = { has_completed_focus = FIN_social_democracy }
			NOT = { has_government = communism }
		}

		cancel_if_not_visible = yes

		fire_only_once = yes

		cost = 70

		days_remove = 30

		remove_effect = {
			set_country_flag = FIN_cw_popular_support_flag
			add_popularity = {
				ideology = communism
				popularity = 0.1
			}
			custom_effect_tooltip = when_civil_war_starts_tt
			custom_effect_tooltip = FIN_gather_popular_support_dec_tt
			effect_tooltip = {
				add_timed_idea = { idea = FIN_popular_support_for_the_revolution days = 365 }
			}
		}
	}

	FIN_crack_down_on_fascists = {
		priority = 50

		icon = GFX_decision_generic_police_action

		ai_will_do = {
			base = 200
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_idea = FIN_yrjo_leino
			has_completed_focus = FIN_towards_a_red_government
		}

		visible = {
			NOT = { has_completed_focus = FIN_social_democracy }
			NOT = { has_government = communism }
		}

		cancel_if_not_visible = yes

		fire_only_once = yes

		cost = 70

		days_remove = 20

		remove_effect = {
			set_country_flag = FIN_cw_crack_down_on_fascists_flag

			add_popularity = {
				ideology = communism
				popularity = 0.05
			}

			custom_effect_tooltip = FIN_crack_down_on_fascists_character_tt
			retire_character = FIN_vilho_annala
			retire_character = FIN_elias_simojoki
			retire_character = FIN_vilho_helanen
			retire_character = FIN_paavo_susitaival
			retire_character = FIN_reino_ala_kulju

			custom_effect_tooltip = when_civil_war_starts_tt
			custom_effect_tooltip = effects_applied_to_the_enemy_side_in_cw_tt
			effect_tooltip = {
				add_timed_idea = { idea = FIN_imprisoned_right_wing_leaders days = 365 }
			}
			custom_effect_tooltip = FIN_crack_down_on_fascists_militias_tt
		}
	}

	FIN_crack_down_on_the_military = {
		priority = 50

		icon = GFX_decision_generic_arrest

		ai_will_do = {
			base = 200
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_idea = FIN_yrjo_leino
			has_completed_focus = FIN_towards_a_red_government
		}

		visible = {
			NOT = { has_completed_focus = FIN_social_democracy }
			NOT = { has_government = communism }
		}

		cancel_if_not_visible = yes

		fire_only_once = yes

		cost = 70

		days_remove = 20

		remove_effect = {
			set_country_flag = FIN_cw_crack_down_on_the_military_flag

			add_popularity = {
				ideology = communism
				popularity = 0.05
			}

			custom_effect_tooltip = FIN_crack_down_on_the_military_character_tt
			retire_character = FIN_erik_heinrichs
			retire_character = FIN_juho_heiskanen
			retire_character = FIN_lauri_malmberg
			retire_character = FIN_hugo_osterman
			retire_character = FIN_alpo_marttinen

			custom_effect_tooltip = when_civil_war_starts_tt
			custom_effect_tooltip = effects_applied_to_the_enemy_side_in_cw_tt
			effect_tooltip = {
				add_timed_idea = { idea = FIN_low_army_morale days = 365 }
			}
			custom_effect_tooltip = FIN_crack_down_on_the_military_divs_tt
		}
	}

	FIN_prepare_construction_workers_actions = {
		priority = 50

		icon = GFX_decision_generic_construction

		ai_will_do = {
			base = 4
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_idea = FIN_aarne_saarinen
		}

		visible = {
			NOT = { has_completed_focus = FIN_social_democracy }
			NOT = { has_government = communism }
		}

		cancel_if_not_visible = yes

		fire_only_once = yes

		cost = 70

		days_remove = 20

		remove_effect = {
			set_country_flag = FIN_cw_construction_workers_flag

			add_popularity = {
				ideology = communism
				popularity = 0.05
			}

			custom_effect_tooltip = when_civil_war_starts_tt
			custom_effect_tooltip = FIN_prepare_construction_workers_actions_dec_tt
			effect_tooltip = {
				add_timed_idea = { idea = FIN_commitment_from_construction_workers days = 365 }
			}
			
			custom_effect_tooltip = effects_applied_to_the_enemy_side_in_cw_tt
			custom_effect_tooltip = FIN_prepare_construction_workers_actions_enemy_side_dec_tt
		}
	}

	FIN_align_the_trade_unions = {
		priority = 50

		icon = GFX_decision_generic_political_discourse

		ai_will_do = {
			base = 4
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_idea = FIN_aarne_saarinen
		}

		visible = {
			NOT = { has_completed_focus = FIN_social_democracy }
			NOT = { has_government = communism }
		}

		cancel_if_not_visible = yes

		fire_only_once = yes

		cost = 70

		days_remove = 20

		remove_effect = {
			set_country_flag = FIN_cw_trade_unions_flag

			add_popularity = {
				ideology = communism
				popularity = 0.05
			}

			custom_effect_tooltip = when_civil_war_starts_tt
			custom_effect_tooltip = FIN_prepare_construction_workers_actions_dec_tt #intentional (will have same effect as decision above)
			effect_tooltip = {
				add_timed_idea = { idea = FIN_commitment_from_the_trade_unions days = 365 }
			}

			custom_effect_tooltip = effects_applied_to_the_enemy_side_in_cw_tt
			custom_effect_tooltip = FIN_align_the_trade_unions_enemy_side_dec_tt
		}
	}

	FIN_purchase_soviet_equipment = {
		priority = 50

		icon = GFX_decision_generic_industry

		ai_will_do = {
			base = 100
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_idea = FIN_otto_wille_kuusinen
			country_exists = SOV
			SOV = { has_government = communism }
			NOT = { has_war_with = SOV }
			NOT = { has_completed_focus = FIN_antagonize_the_soviets }
		}

		visible = {
			NOT = { has_completed_focus = FIN_social_democracy }
			NOT = { has_completed_focus = FIN_antagonize_the_soviets }
			NOT = { has_government = communism }
		}

		cancel_if_not_visible = yes

		fire_only_once = yes

		cost = 150

		days_remove = 7

		remove_effect = {
			set_country_flag = FIN_cw_purchase_soviet_equipment_flag
			custom_effect_tooltip = when_civil_war_starts_tt
			effect_tooltip = {
				FIN_purchase_soviet_equipment_for_cw = yes
			}
		}
	}

	FIN_infiltrate_soviet_commandos = {
		priority = 50

		icon = GFX_decision_generic_military

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_idea = FIN_otto_wille_kuusinen
			country_exists = SOV
			SOV = { has_government = communism }
			NOT = { has_war_with = SOV }
			NOT = { has_completed_focus = FIN_antagonize_the_soviets }
		}

		visible = {
			NOT = { has_completed_focus = FIN_social_democracy }
			NOT = { has_completed_focus = FIN_antagonize_the_soviets }
			NOT = { has_government = communism }
		}

		cancel_if_not_visible = yes

		fire_only_once = yes

		cost = 70

		days_remove = 15

		remove_effect = {
			set_country_flag = FIN_cw_infiltrate_soviet_commandos_flag
			custom_effect_tooltip = when_civil_war_starts_tt
			custom_effect_tooltip = FIN_infiltrate_soviet_commandos_dec_tt
		}
	}

	#####################
	##### DEMOCRATS #####
	#####################
	FIN_call_to_union_activism = {
		priority = 50

		icon = GFX_decision_generic_political_rally

		ai_will_do = {
			base = 2
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_idea = FIN_karl_august_fagerholm
			has_completed_focus = FIN_social_democracy
		}

		visible = {
			NOT = { has_completed_focus = FIN_towards_a_red_government }
			NOT = { has_government = democratic }
		}

		cancel_if_not_visible = yes

		fire_only_once = yes

		cost = 15

		days_remove = 30

		modifier = {
			stability_weekly_factor = -0.005
		}

		remove_effect = {
			add_popularity = {
				ideology = democratic
				popularity = 0.1
			}
		}
	}

	FIN_push_for_cabinet_participation = {
		priority = 50

		icon = GFX_decision_generic_political_address

		ai_will_do = {
			base = 2
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_idea = FIN_vaino_tanner
		}

		visible = {
			NOT = { has_completed_focus = FIN_towards_a_red_government }
			NOT = { has_government = democratic }
		}

		cancel_if_not_visible = yes

		fire_only_once = yes

		cost = 35

		days_remove = 15

		modifier = {
			political_power_factor = -0.5
		}

		remove_effect = {
			add_popularity = {
				ideology = democratic
				popularity = 0.1
			}
		}
	}

	FIN_gather_funds_for_womens_shelters = {
		priority = 50

		icon = GFX_decision_generic_fundraising

		ai_will_do = {
			base = 2
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_idea = FIN_miina_sillanpaa
		}

		visible = {
			NOT = { has_completed_focus = FIN_towards_a_red_government }
			NOT = { has_government = democratic }
		}

		cancel_if_not_visible = yes

		fire_only_once = yes

		cost = 45

		days_remove = 7

		modifier = {
			consumer_goods_factor = -0.1
		}

		remove_effect = {
			add_popularity = {
				ideology = democratic
				popularity = 0.1
			}
		}
	}
}

political_actions = {
	FIN_request_extradition_of_kullervo_manner = {
		priority = 50

		icon = GFX_decision_eng_trade_unions_support

		ai_will_do = {
			base = 10
		}

		allowed = {
			original_tag = FIN
			has_dlc = "Arms Against Tyranny"
		}

		available = {
			NOT = { has_war_with = SOV }
			NOT = { date > 1939.01.31 }
		}

		visible = {
			has_completed_focus = FIN_approach_the_soviets
			NOT = { date > 1939.01.31 }
		}

		fire_only_once = yes

		cost = 25

		days_remove = 7

		complete_effect = {
			
		}

		remove_effect = {
			set_country_flag = FIN_kullervo_manner_extradited_flag
			if = {
				limit = {
					amount_taken_ideas = {
						amount < 3
						slots = { political_advisor }
					}
				}
				activate_advisor = FIN_kullervo_manner
			}
			else = {
				custom_effect_tooltip = available_political_advisor
				show_ideas_tooltip = FIN_kullervo_manner
			}
		}
	}
}

economy_decisions = {
	FIN_prioritize_light_industry = {
		priority = 50

		icon = GFX_decision_generic_consumer_goods

		ai_will_do = {
			base = 0
		}

		allowed = {
			original_tag = FIN
			has_dlc = "Arms Against Tyranny"
		}

		available = {
			NOT = { has_decision = FIN_prioritize_heavy_industry }
			NOT = { has_decision = FIN_rebalance_industrial_focus  }
		}

		visible = {
			has_completed_focus = FIN_finnish_federation_of_trade_unions
			OR = {
				has_idea = FIN_finnish_federation_of_trade_unions
				has_idea = FIN_finnish_federation_of_trade_unions_heavy_industry
			}
		}

		cost = FIN_prioritize_light_industry_dec_cost #50/100 (based on default NS or Heavy Industry version active)

		days_remove = 365

		complete_effect = {
			swap_ideas = {
				remove_idea = FIN_finnish_federation_of_trade_unions
				add_idea = FIN_finnish_federation_of_trade_unions_light_industry
			}

			#Increase Opposite decision cost
			set_variable = { FIN_prioritize_heavy_industry_dec_cost = 100 }

			set_variable = { FIN_prioritize_light_industry_dec_cost = 50 } #Make sure this decision's cost is reset to default

			custom_effect_tooltip = FIN_prioritize_light_industry_dec_cost_tt
		}

		remove_effect = {
			unlock_decision_tooltip = FIN_rebalance_industrial_focus
			unlock_decision_tooltip = FIN_prioritize_heavy_industry
		}
	}

	FIN_prioritize_heavy_industry = {
		priority = 50

		icon = GFX_decision_generic_factory

		ai_will_do = {
			base = 0
		}

		allowed = {
			original_tag = FIN
			has_dlc = "Arms Against Tyranny"
		}

		available = {
			NOT = { has_decision = FIN_prioritize_light_industry }
			NOT = { has_decision = FIN_rebalance_industrial_focus  }
		}

		visible = {
			has_completed_focus = FIN_finnish_federation_of_trade_unions
			OR = {
				has_idea = FIN_finnish_federation_of_trade_unions
				has_idea = FIN_finnish_federation_of_trade_unions_light_industry
			}
		}

		cost = FIN_prioritize_heavy_industry_dec_cost #50/100 (based on default NS or Light Industry version active)

		days_remove = 365

		complete_effect = {
			swap_ideas = {
				remove_idea = FIN_finnish_federation_of_trade_unions
				add_idea = FIN_finnish_federation_of_trade_unions_heavy_industry
			}

			#Increase Opposite decision cost
			set_variable = { FIN_prioritize_heavy_industry_dec_cost = 100 }

			set_variable = { FIN_prioritize_heavy_industry_dec_cost = 50 } #Make sure this decision's cost is reset to default

			custom_effect_tooltip = FIN_prioritize_heavy_industry_dec_cost_tt
		}

		remove_effect = {
			unlock_decision_tooltip = FIN_rebalance_industrial_focus
			unlock_decision_tooltip = FIN_prioritize_light_industry
		}
	}

	FIN_rebalance_industrial_focus  = {
		priority = 50

		icon = GFX_decision_generic_factory

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = FIN
			has_dlc = "Arms Against Tyranny"
		}

		available = {
			NOT = { has_decision = FIN_prioritize_heavy_industry }
			NOT = { has_decision = FIN_prioritize_light_industry }
		}

		visible = {
			has_completed_focus = FIN_finnish_federation_of_trade_unions
			OR = {
				has_idea = FIN_finnish_federation_of_trade_unions_light_industry
				has_idea = FIN_finnish_federation_of_trade_unions_heavy_industry
			}
		}

		cost = 25

		days_remove = 365

		complete_effect = {
			if = {
				limit = {
					has_idea = FIN_finnish_federation_of_trade_unions_light_industry
				}
				swap_ideas = {
					remove_idea = FIN_finnish_federation_of_trade_unions_light_industry
					add_idea = FIN_finnish_federation_of_trade_unions
				}
			}
			else = {
				swap_ideas = {
					remove_idea = FIN_finnish_federation_of_trade_unions_heavy_industry
					add_idea = FIN_finnish_federation_of_trade_unions
				}			
			}
			#Reset decision costs
			set_variable = { FIN_prioritize_light_industry_dec_cost = 50 }
			set_variable = { FIN_prioritize_heavy_industry_dec_cost = 50 }

			custom_effect_tooltip = FIN_rebalance_industrial_focus_dec_cost_tt
		}

		remove_effect = {
			unlock_decision_tooltip = FIN_prioritize_light_industry
			unlock_decision_tooltip = FIN_prioritize_heavy_industry
		}
	}
}


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


FIN_foreign_politics_decision_category = {

	###################################
	### ENDING THE CONTINUATION WAR ###
	###################################

	# Request the Moscow Armistice
	FIN_request_an_armistice_with_moscow = {
		priority = 50

		icon = GFX_decision_hol_war_on_pacifism

		ai_will_do = { # This historically happnened on the 19th of September 1944
			base = 0
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_war_with = SOV
			GER = {
				has_war_with = SOV
			}
			OR = {
				surrender_progress > 0.05
				AND = {
					812 = {
						is_controlled_by = SOV
					}
					808 = {
						is_controlled_by = SOV
					}
					11 = {
						is_controlled_by = SOV
					}
					206 = {
						is_controlled_by = SOV
					}
					763 = {
						is_controlled_by = SOV
					}
				}
				SOV = {
					has_idea = SOV_the_rush_for_berlin
				} 
				SOV = {
					has_active_mission = SOV_operation_iskra_ongoing
				}
				any_owned_state = {
					NOT = { state = 145 } #ÅLAND
					is_core_of = ROOT
					NOT = {
						is_controlled_by = ROOT
					}
				}
			}
			has_civil_war = no
			is_in_faction = no
			has_completed_focus = FIN_cooperation_with_germany
		}

		visible = {
			has_war_with = SOV
			GER = {
				has_war_with = SOV
			}
			SOV = {
				has_country_flag = SOV_great_patriotic_war_flag
			}
			has_completed_focus = FIN_cooperation_with_germany
			has_civil_war = no
			is_in_faction = no
			NOT = {
				has_country_flag = FIN_already_attempted_an_armistice
			}
			NOT = { has_country_flag = FIN_negotiating_switching_sides_flag } # Used to prevent Finland to activate both Armistice and Switch sides decisions at the same time
		}

		cost = 35

		complete_effect = {
			hidden_effect = { # Used to prevent Finland to activate both Armistice and Switch sides decisions at the same time
				set_country_flag = FIN_negotiating_armistice_flag
			}

			SOV = {
				country_event = { 
					id = AAT_finland_continuation_war.08 
					days = 1 
					random_days = 3
				}
			}

			custom_effect_tooltip = if_they_accept_tt
			effect_tooltip = {

				SOV = {
					white_peace = FIN

					### TRANSFER STATES ###
					#KARJALA
					IF = {
						limit = {	
							146 = {
								is_owned_by = FIN
							}
						}
						SOV = {
							transfer_state = 146
						}
					}

					#SALLA
					IF = {
						limit = {
							147 = {
								is_owned_by = FIN
							}
						}
						SOV = {
							transfer_state = 147
						}
					}

					#PETSAMO
					IF = {
						limit = {
							722 = {	
								is_owned_by = FIN
							}
						}
						SOV = {
							transfer_state = 722
						}
					}
				}

				ROOT = {
					send_equipment = {
						equipment = infantry_equipment
						amount = 2500
						target = SOV
					}	
					send_equipment = {
						equipment = support_equipment
						amount = 500
						target = SOV
					}
					send_equipment = {
						equipment = artillery_equipment
						amount = 150
						target = SOV
					}
				}

				SOV = {
					army_experience = 25

					navy_experience = 25

					air_experience = 25

					add_political_power = 100
				}
			}

			hidden_effect = {
				set_country_flag = FIN_already_attempted_an_armistice
			}
		}
	}

	# Request to Join the Allies in return for peace
	FIN_request_to_switch_sides_in_the_war = {
		priority = 45

		icon = GFX_decision_generic_political_discourse

		ai_will_do = { # This should not happen on historical, but should still be a possibility otherwise
			base = 0.1
			modifier = {
				add = ROOT.surrender_progress
				always = yes 
			}
			modifier = { # Don't do on historical pliz
				factor = 0
				is_historical_focus_on = yes
			}
			modifier = { # You do not control "greater finnish territory"
				factor = 1.2
				NOT = {
					OR = {
						213 = {
							is_controlled_by = ROOT
						}
						215 = {
							is_controlled_by = ROOT
						}
						216 = {
							is_controlled_by = ROOT
						}
					}
				}
			}
			modifier = { # Germany is crumbling ooops
				factor = 2
				is_historical_focus_on = yes
				date > 1944.1.1
				GER = {
					has_war_with = SOV
					has_country_flag = FIN_pact_for_continuation_war_flag
					surrender_progress > 0.15
				}
			}
			modifier = { # If the Soviets have issued order 227, you start getting nervous
				factor = 1.2
				FROM = { has_country_flag = SOV_order_227_flag }
			}
			modifier = { # Don't Do it if you, Germany or any of their Allies hold Leningrad or Moscow
				factor = 0
				OR = {
					
					195 = { # Leningrad
						OR = { 
							
							is_controlled_by = ROOT

							is_controlled_by = GER
							
							any_country = {
								OR = {
									is_in_faction_with = GER
									is_subject_of = GER
								}
								controls_state = PREV
							}
						}
					}
					
					219 = { # Mocow
						OR = { 
							
							is_controlled_by = ROOT
							
							is_controlled_by = GER
							
							any_country = {
								OR = {
									is_in_faction_with = GER
									is_subject_of = GER
								}
								controls_state = PREV
							}
						}
					}
					
				}
			}
			modifier = { # Stalingrad feels a little less safe than the others
				factor = 0.5
				217 = { # Stalingrad
					OR = { 
						
						is_controlled_by = ROOT
						
						is_controlled_by = GER
						
						any_country = {
							OR = {
								is_in_faction_with = GER
								is_subject_of = GER
							}
							controls_state = PREV
						}
					}
				}
			}
			modifier = { # You have started to lose home territory again
				factor = 1.5
				any_owned_state = {
					is_core_of = ROOT
					NOT = {
						is_controlled_by = ROOT
					}
				}
			}
			modifier = { # You actually really like democracy (((o(°▽°)o)))
				factor = 1.5
				democratic > 0.4
			}
			modifier = { # Democarcy is for nerds <(￣︶￣)>
				factor = 0.2
				democratic < 0.1
			}
			modifier = { # Don't ruin a players game with this
				factor = 0
				SOV = {
					is_ai = no
				}
			}
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_war_with = SOV
			GER = {
				has_war_with = SOV
			}
			any_country = {
				has_government = democratic
				is_faction_leader = yes
				has_war_with = GER
			}
			722 = {
				is_owned_and_controlled_by = ROOT
			}
			OR = {
				surrender_progress > 0.05
				SOV = {
					has_idea = SOV_the_rush_for_berlin
				} 
				SOV = {
					has_active_mission = SOV_operation_iskra_ongoing
				}
				any_owned_state = {
					NOT = { state = 145 } #ÅLAND
					is_core_of = ROOT
					NOT = {
						is_controlled_by = ROOT
					}
				}
			}
			has_civil_war = no
			is_in_faction = no
			has_completed_focus = FIN_cooperation_with_germany
		}

		visible = {
			has_war_with = SOV
			GER = {
				has_war_with = SOV
			}
			SOV = {
				has_country_flag = SOV_great_patriotic_war_flag
			}
			has_completed_focus = FIN_cooperation_with_germany
			has_civil_war = no
			is_in_faction = no
			NOT = {
				has_country_flag = FIN_already_attempted_to_switch_sides
			}
			NOT = { has_country_flag = FIN_negotiating_armistice_flag }
		}

		cost = 35

		complete_effect = {
			hidden_effect = { # Used to prevent Finland to activate both Armistice and Switch sides decisions at the same time
				set_country_flag = FIN_negotiating_switching_sides_flag
			}

			add_war_support = -0.03

			add_popularity = {
				ideology = democratic
				popularity = 0.05
			}	

			add_popularity = {
				ideology = communism
				popularity = 0.05
			}

			random_country = {
				limit = {
					has_government = democratic
					is_faction_leader = yes
					has_war_with = GER
				}
				set_country_flag = FIN_major_democratic_leader_flag
				
				country_event = { 
					id = AAT_finland_continuation_war.12
					days = 3
					random_days = 5
				}
			}

			SOV = {
				country_event = { 
					id = AAT_finland_continuation_war.13
					days = 1
				}
			}

			custom_effect_tooltip = if_they_accept_tt
			effect_tooltip = {

				every_country = {
					limit = {
						has_war_with = ROOT
					}
					white_peace = ROOT
				}

				IF = {
					limit = {
						GER = {
							has_military_access_to = ROOT
						}
					}
					ROOT = {
						diplomatic_relation = { 
							country = GER
							relation = military_access 
							active = no
						}
						diplomatic_relation = { 
							country = GER
							relation = docking_rights 
							active = no
						}
						diplomatic_relation = { 
							country = GER
							relation = non_aggression_pact 
							active = no
						}
					}
					GER = {
						diplomatic_relation = { 
							country = ROOT
							relation = guarantee 
							active = no
						}
					}
				}

				SOV = {
					add_timed_idea = {
						idea = FIN_compensation_for_side_switch_good
						days = 365
					}	
				}
				ROOT = {
					add_timed_idea = {
						idea = FIN_compensation_for_side_switch_bad
						days = 365
					}
				}

				IF = {
					limit = {
						ROOT = {
							has_idea = FIN_the_lone_wolf
						}
					}
					ROOT = {
						remove_ideas = FIN_the_lone_wolf
					}
				}

				random_country = {
					limit = {
						has_country_flag = FIN_major_democratic_leader_flag
					}
					add_to_faction = ROOT
				}

				ROOT = {
					add_to_war = {
					    targeted_alliance = ENG
					    enemy = GER
					    hostility_reason = asked_to_join
					}
				}

				ROOT = {
					add_popularity = {
						ideology = democratic
						popularity = 0.1
					}	
				}

			}

			hidden_effect = {
				set_country_flag = FIN_already_attempted_to_switch_sides
			}
		}
	}

	###################
	##### BALTICS #####
	###################
	FIN_pressure_country_government_baltic = {
		priority = 50

		icon = generic_political_discourse

		ai_will_do = {
			base = 0.8
			modifier = {
				factor = 2
				has_political_power > 160
			}
			modifier = { #If ideological rallies happened, then it's better
				factor = 4
				FROM = { has_country_flag = FIN_ideological_rallies_promoted_flag }
			}
			modifier = { #Do it only once, don't spam
				factor = 0
				FROM = { has_country_flag = FIN_government_pressured_flag }
			}
		}

		targets = { EST LAT LIT POL }

		target_trigger = {
			SOV_basic_pressure_government_triggers = yes #Reusable
		}

		target_root_trigger = {
			has_completed_focus = FIN_finnish_influence_in_the_baltic
			is_subject = no
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			is_faction_leader = yes
			FROM = {
				has_opinion = {
					target = ROOT
					value > 49
				}
				SOV_is_valid_subject = yes # Reusable
				NOT = { has_war_with = ROOT }
			}
			NOT = { has_country_flag = FIN_pressure_government_active_flag }
		}

		visible = {
		}

		days_remove = FIN_pressure_government_days

		days_re_enable = FIN_pressure_government_cd

		cost = FIN_pressure_country_government_cost

		modifier = {
			political_power_gain = -0.25
		}

		complete_effect = {
			set_country_flag = FIN_pressure_government_active_flag
		}

		remove_effect = {
			FROM = {
				country_event = { id = NSB_soviet_foreign_politics_events.1 hours = 4 random_hours = 2 } #Reusable
				set_country_flag = FIN_government_pressured_flag #For AI weights - don't spam
			}
			clr_country_flag = FIN_pressure_government_active_flag
			custom_effect_tooltip = SOV_pressure_government_effects_tt
			custom_effect_tooltip = FIN_pressure_government_cd_tt
		}
	}

	FIN_promote_ideology_rallies_baltic = {
		priority = 50

		icon = generic_political_rally

		ai_will_do = {
			base = 1
			modifier = {
				factor = 2
				has_political_power > 160
			}
		}

		targets = { EST LAT LIT POL }

		target_trigger = {
			SOV_basic_promote_rallies_triggers = yes #Reusable
		}

		target_root_trigger = {
			has_completed_focus = FIN_finnish_influence_in_the_baltic
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			FROM = {
				SOV_is_valid_subject = yes #Reusable
				NOT = { has_war_with = ROOT }
			}
		}

		visible = {
		}

		days_remove = FIN_ideological_rallies_days

		fire_only_once = yes

		cost = FIN_promote_ideology_rallies_cost

		modifier = {
			political_power_gain = -0.25
		}

		complete_effect = {
		}

		remove_effect = {
			FROM = {
				country_event = { id = NSB_soviet_foreign_politics_events.2 hours = 4 random_hours = 2 }
			}
			custom_effect_tooltip = SOV_promote_rallies_effects_tt
			custom_effect_tooltip = SOV_promote_ideological_rallies_cd_tt
		}
	}

	FIN_fight_alongside_country_comrades_baltic = {
		priority = 100

		icon = generic_prepare_civil_war

		ai_will_do = {
			base = 0
			modifier = {
				add = 0.01
				has_stability > 0.4
				FROM = {  #Join if it will not lead to a new war against a major
					all_enemy_country = {
						OR = {
							is_major = no
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 2
				has_war = no
			}
			modifier = {
				factor = 1.5
				has_manpower > 100000
			}
			modifier = {
				factor = 10
				FROM = { is_neighbor_of = ROOT }
			}
		}

		targets = { EST LAT LIT POL }

		target_trigger = {
			SOV_basic_fight_alongside_comrades_triggers = yes #Reusable
		}

		target_root_trigger = {
			has_completed_focus = FIN_finnish_influence_in_the_baltic
			is_subject = no
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_war_support > 0.15
			has_stability > 0.25
			NOT = { has_war_with = FROM }
		}

		visible = {
		}

		complete_effect = {
			hidden_effect = {
				random_country = {
					limit = {
						original_tag = FROM
						has_civil_war = yes
						NOT = { has_government = ROOT }
					}
					ROOT = { add_to_war = { targeted_alliance = FROM enemy = PREV hostility_reason = asked_to_join } }
				}
			}
			custom_effect_tooltip = BUL_fight_alongside_country_comrades_join_cw_tt #This tt works just fine :)

			effect_tooltip = {
				give_military_access = FROM
				FROM = { give_military_access = ROOT }
			}
			hidden_effect = {
				diplomatic_relation = {
					country = FROM
					relation = military_access
					active = yes
				}
				FROM = {
					diplomatic_relation = {
						country = ROOT
						relation = military_access
						active = yes
					}
				}
			}
		}
	}

	###################
	##### NORDICS #####
	###################

	FIN_pressure_country_government_nordic = {
		priority = 50

		icon = generic_political_discourse

		ai_will_do = {
			base = 0.8
			modifier = {
				factor = 2
				has_political_power > 160
			}
			modifier = { #If ideological rallies happened, then it's better
				factor = 4
				FROM = { has_country_flag = FIN_ideological_rallies_promoted_flag }
			}
			modifier = { #Do it only once, don't spam
				factor = 0
				FROM = { has_country_flag = FIN_government_pressured_flag }
			}
		}

		targets = { SWE NOR DEN ICE SMI }

		target_trigger = {
			SOV_basic_pressure_government_triggers = yes #Reusable
		}

		target_root_trigger = {
			has_completed_focus = FIN_united_under_the_north_star
			is_subject = no
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			is_faction_leader = yes
			FROM = {
				has_opinion = {
					target = ROOT
					value > 49
				}
				SOV_is_valid_subject = yes # Reusable
				NOT = { has_war_with = ROOT }
			}
			NOT = { has_country_flag = FIN_pressure_government_active_flag }
		}

		visible = {
		}

		days_remove = FIN_pressure_government_days

		days_re_enable = FIN_pressure_government_cd

		cost = FIN_pressure_country_government_cost

		modifier = {
			political_power_gain = -0.25
		}

		complete_effect = {
			set_country_flag = FIN_pressure_government_active_flag
		}

		remove_effect = {
			FROM = {
				country_event = { id = NSB_soviet_foreign_politics_events.1 hours = 4 random_hours = 2 } #Reusable
				set_country_flag = FIN_government_pressured_flag #For AI weights - don't spam
			}
			clr_country_flag = FIN_pressure_government_active_flag
			custom_effect_tooltip = SOV_pressure_government_effects_tt
			custom_effect_tooltip = FIN_pressure_government_cd_tt
		}
	}

	FIN_promote_ideology_rallies_nordic = {
		priority = 50

		icon = generic_political_rally

		ai_will_do = {
			base = 1
			modifier = {
				factor = 2
				has_political_power > 160
			}
		}

		targets = { SWE NOR DEN ICE SMI }

		target_trigger = {
			SOV_basic_promote_rallies_triggers = yes #Reusable
		}

		target_root_trigger = {
			has_completed_focus = FIN_united_under_the_north_star
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			FROM = {
				SOV_is_valid_subject = yes #Reusable
				NOT = { has_war_with = ROOT }
			}
		}

		visible = {
		}

		days_remove = FIN_ideological_rallies_days

		fire_only_once = yes

		cost = FIN_promote_ideology_rallies_cost

		modifier = {
			political_power_gain = -0.25
		}

		complete_effect = {
		}

		remove_effect = {
			FROM = {
				country_event = { id = NSB_soviet_foreign_politics_events.2 hours = 4 random_hours = 2 }
			}
			custom_effect_tooltip = SOV_promote_rallies_effects_tt
			custom_effect_tooltip = SOV_promote_ideological_rallies_cd_tt
		}
	}

	FIN_fight_alongside_country_comrades_nordic = {
		priority = 100

		icon = generic_prepare_civil_war

		ai_will_do = {
			base = 0
			modifier = {
				add = 0.01
				has_stability > 0.4
				FROM = {  #Join if it will not lead to a new war against a major
					all_enemy_country = {
						OR = {
							is_major = no
							has_war_with = ROOT
						}
					}
				}
			}
			modifier = {
				factor = 2
				has_war = no
			}
			modifier = {
				factor = 1.5
				has_manpower > 100000
			}
			modifier = {
				factor = 10
				FROM = { is_neighbor_of = ROOT }
			}
		}

		targets = { SWE NOR DEN ICE SMI }

		target_trigger = {
			SOV_basic_fight_alongside_comrades_triggers = yes #Reusable
		}

		target_root_trigger = {
			has_completed_focus = FIN_united_under_the_north_star
			is_subject = no
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			has_war_support > 0.15
			has_stability > 0.25
			NOT = { has_war_with = FROM }
		}

		visible = {
		}

		complete_effect = {
			hidden_effect = {
				random_country = {
					limit = {
						original_tag = FROM
						has_civil_war = yes
						NOT = { has_government = ROOT }
					}
					ROOT = { add_to_war = { targeted_alliance = FROM enemy = PREV hostility_reason = asked_to_join } }
				}
			}
			custom_effect_tooltip = BUL_fight_alongside_country_comrades_join_cw_tt #This tt works just fine :)

			effect_tooltip = {
				give_military_access = FROM
				FROM = { give_military_access = ROOT }
			}
			hidden_effect = {
				diplomatic_relation = {
					country = FROM
					relation = military_access
					active = yes
				}
				FROM = {
					diplomatic_relation = {
						country = ROOT
						relation = military_access
						active = yes
					}
				}
			}
		}
	}
}


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


FIN_coup_preparations = {
	FIN_secure_the_military = {
		priority = 50

		icon = GFX_decision_generic_civil_support

		ai_will_do = {
			base = 200
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			fascism > 0.3
		}

		visible = {
		}

		fire_only_once = yes

		cost = 70

		complete_effect = {
			set_country_flag = FIN_cw_military_secured_flag
			hidden_effect = {
				FIN_carl_mannerheim = {
					clr_character_flag = FIN_anti_fascist_character_flag
				}
				FIN_aksel_airo = {
					clr_character_flag = FIN_anti_fascist_character_flag
				}
			}
			add_popularity = {
				ideology = fascism
				popularity = 0.1
			}
			custom_effect_tooltip = when_civil_war_starts_tt
			custom_effect_tooltip = FIN_secure_the_military_dec_tt
		}
	}

	FIN_purchase_german_equipment = {
		priority = 50

		icon = GFX_decision_generic_industry

		ai_will_do = {
			base = 200
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			country_exists = GER
			GER = {
				OR = {
					has_government = fascism
					has_government = neutrality
				}
			}
			NOT = { has_war_with = GER }
		}

		visible = {
		}

		fire_only_once = yes

		cost = 150

		complete_effect = {
			set_country_flag = FIN_cw_purchase_german_equipment_flag
			custom_effect_tooltip = when_civil_war_starts_tt
			effect_tooltip = {
				FIN_purchase_german_equipment_for_cw = yes
			}
		}
	}

	FIN_appeal_to_the_middle_class = {
		priority = 50

		icon = GFX_decision_generic_civil_support

		ai_will_do = {
			base = 200
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			fascism > 0.4
		}

		visible = {
		}

		fire_only_once = yes

		cost = 50

		complete_effect = {
			set_country_flag = FIN_cw_support_from_middle_class_flag
			add_popularity = {
				ideology = fascism
				popularity = 0.2
			}
			custom_effect_tooltip = when_civil_war_starts_tt
			custom_effect_tooltip = FIN_appeal_to_the_middle_class_dec_tt
		}
	}	
}


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


FIN_the_last_kinship_war = {
	FIN_stir_anti_soviet_sentiment_in_karelia = {
		priority = 50

		icon = GFX_decision_POL_organize_strike_two

		ai_will_do = {
			base = 0.01
		}

		allowed = {
			original_tag = FIN
		}

		visible = {
		}

		available = {
			KAR = {
				any_core_state = {
					controller = {
						original_tag = SOV
						NOT = { is_in_faction_with = ROOT }
					}
				}
			}
		}

		fire_only_once = yes

		cost = 50

		days_remove = 30

		remove_effect = {
			KAR = {
				every_core_state = {
					limit = {
						controller = {
							original_tag = SOV
							NOT = { is_in_faction_with = ROOT }
						}
					}
					add_dynamic_modifier = { modifier = FIN_anti_soviet_sentiment days = 365 }
					hidden_effect = {
						controller = {
							set_country_flag = FIN_heimosodat_event_sent_flag
							country_event = { id = AAT_finland_kinship_war.01 hours = 1 } #Event has a fire_only_once = yes
						}
					}
				}
			}
		}
	}

	FIN_instigate_a_new_karelian_uprising = {
		priority = 50

		icon = GFX_decision_generic_civil_support

		ai_will_do = {
			base = 0.1
		}

		allowed = {
			original_tag = FIN
		}

		visible = {
			KAR = {
				any_core_state = {
					has_dynamic_modifier = { modifier = FIN_anti_soviet_sentiment }
				}
			}
		}

		available = {
			KAR = {
				any_core_state = {
					controller = {
						original_tag = SOV
						NOT = { is_in_faction_with = ROOT }
					}
					has_dynamic_modifier = { modifier = FIN_anti_soviet_sentiment }
				}
			}
		}

		war_with_on_remove = SOV

		fire_only_once = yes

		custom_cost_trigger = {
			command_power > 29
			has_political_power > 69
			has_equipment = {
				infantry_equipment > 1499
			}
		}
		custom_cost_text = FIN_crush_the_karelian_insurrection_decision_cost_ie_cp_pp #Intentional to be the same as Soviet dec

		days_remove = 60

		remove_effect = {
			country_event = AAT_finland_kinship_war.02
		}
	}
}

#Soviet Decision to counter Finnish actions
FIN_finno_soviet_kinship_war = {
	FIN_crush_the_karelian_insurrection = {
		priority = 50

		icon = GFX_decision_generic_civil_support

		ai_will_do = {
			base = 0
		}

		allowed = {
			original_tag = SOV
		}

		visible = {
			KAR = {
				any_core_state = {
					has_dynamic_modifier = { modifier = FIN_anti_soviet_sentiment }
					is_controlled_by = ROOT
				}
			}
		}

		available = {
			KAR = {
				any_core_state = {
					has_dynamic_modifier = { modifier = FIN_anti_soviet_sentiment }
					is_controlled_by = ROOT
				}
			}
		}

		fire_only_once = yes

		custom_cost_trigger = {
			command_power > 29
			has_political_power > 69
			has_equipment = {
				infantry_equipment > 1499
			}
		}
		custom_cost_text = FIN_crush_the_karelian_insurrection_decision_cost_ie_cp_pp

		complete_effect = {
			hidden_effect = {
				add_command_power = -30
				add_political_power = -70
				add_equipment_to_stockpile = { 
					type = infantry_equipment
					amount = -1500
				}
			}

			KAR = {
				every_core_state = {
					limit = {
						has_dynamic_modifier = { modifier = FIN_anti_soviet_sentiment }
						is_controlled_by = ROOT
					}
					remove_dynamic_modifier = { modifier = FIN_anti_soviet_sentiment }
					hidden_effect = {
						ROOT = { country_event = AAT_finland_kinship_war.05 } 
						if = {
							limit = {
								country_exists = FIN
							}
							FIN = { country_event = { id = AAT_finland_kinship_war.04 hours = 1 } }
						}
					}
				}
			}

			custom_effect_tooltip = FIN_crush_the_karelian_insurrection_tt
		}
	}
}

FIN_confederated_finno_russian_republics_category = {
	FIN_integrate_karelia_puppet = {
		priority = 49

		icon = GFX_decision_generic_nationalism

		ai_will_do = {
			base = 0.1
		}

		on_map_mode = map_and_decisions_view

		targets = { KAR }

		target_trigger = { #If somehow Karelia is a player, let's not insta-annex it
			FROM = { is_ai = yes }
		}

		target_root_trigger = {
			has_completed_focus = FIN_confederated_finno_russian_republics
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			KAR = { is_subject_of = ROOT }
		}

		cost = 35

		modifier = {
			political_power_gain = -0.1
		}

		days_remove = 90

		remove_effect = {
			annex_country = {
				target = KAR
				transfer_troops = yes
			}
			hidden_effect = {
				KAR = {
					every_core_state = {
						limit = {
							is_controlled_by = ROOT
						}
						add_core_of = ROOT
					}
				}
			}
		}
	}

	FIN_integrate_karelia_states = {
		priority = 48

		icon = GFX_decision_infiltrate_state

		ai_will_do = {
			base = 0.1
		}

		state_target = yes

		on_map_mode = map_and_decisions_view

		target_array = KAR.core_states

		target_trigger = {
			FROM = {
				is_controlled_by = ROOT
				NOT = { is_core_of = ROOT }
			}
		}

		target_root_trigger = {
			has_completed_focus = FIN_confederated_finno_russian_republics
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			FROM = {
				compliance > 60
			}
		}

		modifier = {
			political_power_gain = -0.1
		}

		days_remove = 180

		remove_effect = {
			add_state_core = FROM
			hidden_effect = { #Also add Karelian core for flavor purposes
				add_state_core = KAR
			}
		}
	}

	FIN_integrate_karelia_additional_states = {
		priority = 47

		icon = GFX_decision_infiltrate_state

		ai_will_do = {
			base = 0.1
		}

		state_target = yes

		on_map_mode = map_and_decisions_view

		targets = { 879 }

		target_trigger = {
			FROM = {
				is_controlled_by = ROOT
				NOT = { is_core_of = ROOT }
			}
		}

		target_root_trigger = {
			has_completed_focus = FIN_confederated_finno_russian_republics
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			146 = { #KARJALA
				is_core_of = ROOT
				is_controlled_by = ROOT
			}
			215 = { #ONEGA
				is_core_of = ROOT
				is_controlled_by = ROOT
			}
			216 = { #OLONETS
				is_core_of = ROOT
				is_controlled_by = ROOT
			}
			FROM = {
				compliance > 60
			}
		}

		modifier = {
			political_power_gain = -0.1
		}

		days_remove = 180

		remove_effect = {
			add_state_core = FROM
		}
	}

	FIN_integrate_veps_states = {
		priority = 39

		icon = GFX_decision_infiltrate_state

		ai_will_do = {
			base = 0.1
		}

		state_target = yes

		on_map_mode = map_and_decisions_view

		targets = { 264 } #TIKHVIN

		target_trigger = {
			FROM = {
				is_controlled_by = ROOT
				NOT = { is_core_of = ROOT }
			}
		}

		target_root_trigger = {
			has_completed_focus = FIN_confederated_finno_russian_republics
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			FROM = {
				compliance > 60
			}
		}

		modifier = {
			political_power_gain = -0.1
		}

		days_remove = 180

		remove_effect = {
			add_state_core = FROM
		}
	}

	FIN_integrate_veps_additional_states = {
		priority = 38

		icon = GFX_decision_infiltrate_state

		ai_will_do = {
			base = 0.1
		}

		state_target = yes

		on_map_mode = map_and_decisions_view

		targets = { 244 351 } #VOLKHOV #VOLOGDA

		target_trigger = {
			FROM = {
				is_controlled_by = ROOT
				NOT = { is_core_of = ROOT }
			}
		}

		target_root_trigger = {
			has_completed_focus = FIN_confederated_finno_russian_republics
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			264 = { #VOLKHOV
				is_core_of = ROOT
				is_controlled_by = ROOT
			}
			FROM = {
				compliance > 60
			}
		}

		modifier = {
			political_power_gain = -0.1
		}

		days_remove = 180

		remove_effect = {
			add_state_core = FROM
		}
	}

	FIN_integrate_ingria_states = {
		priority = 29

		icon = GFX_decision_infiltrate_state

		ai_will_do = {
			base = 0.1
		}

		state_target = yes

		on_map_mode = map_and_decisions_view

		targets = { 208 } #LUGA

		target_trigger = {
			FROM = {
				is_controlled_by = ROOT
				NOT = { is_core_of = ROOT }
			}
		}

		target_root_trigger = {
			has_completed_focus = FIN_confederated_finno_russian_republics
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			FROM = {
				compliance > 60
			}
		}

		modifier = {
			political_power_gain = -0.1
		}

		days_remove = 180

		remove_effect = {
			add_state_core = FROM
		}
	}

	FIN_integrate_ingria_additional_states = {
		priority = 28

		icon = GFX_decision_infiltrate_state

		ai_will_do = {
			base = 0.1
		}

		state_target = yes

		on_map_mode = map_and_decisions_view

		targets = { 263 209 } #NOVGOROD PSKOV

		target_trigger = {
			FROM = {
				is_controlled_by = ROOT
				NOT = { is_core_of = ROOT }
			}
		}

		target_root_trigger = {
			has_completed_focus = FIN_confederated_finno_russian_republics
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			208 = { #LUGA
				is_core_of = ROOT
				is_controlled_by = ROOT
			}
			FROM = {
				compliance > 60
			}
		}

		modifier = {
			political_power_gain = -0.1
		}

		days_remove = 180

		remove_effect = {
			add_state_core = FROM
		}
	}

	FIN_integrate_leningrad = {
		priority = 27

		icon = GFX_decision_infiltrate_state

		ai_will_do = {
			base = 0.1
		}

		state_target = yes

		on_map_mode = map_and_decisions_view

		targets = { 195 }

		target_trigger = {
			FROM = {
				is_controlled_by = ROOT
				NOT = { is_core_of = ROOT }
			}
		}

		target_root_trigger = {
			has_completed_focus = FIN_confederated_finno_russian_republics
		}

		allowed = {
			original_tag = FIN
		}

		available = {
			208 = { #LUGA
				is_core_of = ROOT
				is_controlled_by = ROOT
			}
			FROM = {
				compliance > 60
			}
		}

		modifier = {
			political_power_gain = -0.1
		}

		days_remove = 360

		remove_effect = {
			add_state_core = FROM
		}
	}
}