####### NO STEP BACK! #######
@DAYS_DETERMINED = 180 #Used for propaganda campaign SOV_heroes_forward -> Value should be the same as SOV_default_propaganda_campaign_duration

debug_decisions = { #TODO_Manu: Comment these out
	SOV_debug_show_paranoia_system = { #This is a duplicate of the decision present in the Paranoia category
		priority = 202

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			NOT = { has_country_flag = SOV_paranoia_system_active_flag }
		}

		cost = 0

		complete_effect = {
			custom_effect_tooltip = "This will make the Paranoia System visible in the tab. It does NOT activate the Paranoia system."
			set_country_flag = SOV_debug_show_paranoia_system_flag
		}
	}

	SOV_debug_show_propaganda_system = { #This is a duplicate of the decision present in the Paranoia category
		priority = 201

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			NOT = { has_country_flag = SOV_debug_show_propaganda_system_flag }
		}

		cost = 0

		complete_effect = {
			custom_effect_tooltip = "This will make the Propaganda system visible in the tab. It does NOT activate the Propaganda system."
			set_country_flag = SOV_debug_show_propaganda_system_flag
		}
	}

	SOV_TEST_ULTIMATE_CONTINENTS = {
		priority = 200

		icon = generic_prepare_civil_war

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			always = yes
		}

		cost = 0

		complete_effect = {
			custom_effect_tooltip = "WARNING: This takes a while"
			every_state = {	#if it is akready a meme, why not try and make it a fun one?
				limit = {
					is_on_continent = asia
				}
				MON = { transfer_state = PREV }
			}
			every_state = {
				limit = {
					is_on_continent = europe
				}
				SPR = { transfer_state = PREV }
			}
			every_state = {
				limit = {
					is_on_continent = middle_east
				}
				TUR = { transfer_state = PREV }
			}
			every_state = {
				limit = {
					is_on_continent = africa
				}
				ETH = { transfer_state = PREV }
			}
			every_state = {
				limit = {
					is_on_continent = australia
				}
				AST = { transfer_state = PREV }
			}
			every_state = {
				limit = {
					is_on_continent = north_america
				}
				MEX = { transfer_state = PREV }
			}
			every_state = {
				limit = {
					is_on_continent = south_america
				}
				VEN = { transfer_state = PREV }
			}
		}
	}
}



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


SOV_paranoia_system = {

	SOV_forge_production_reports = { #Repeatable decision to reduce Paranoia
		priority = 310

		icon = GFX_decision_eng_trade_unions_support

		ai_will_do = {
			base = 0
			modifier = {
				add = 5
				check_variable = { SOV_paranoia > 25 }
			}
			modifier = {
				add = 0.1
				check_variable = { SOV_paranoia > 20 }
			}
			modifier = {
				add = 600
				AND = {
					has_completed_focus = SOV_beaten_but_not_defeated
					check_variable = { SOV_paranoia > 20 }
				}
			}
			modifier = {
				add = 0.5
				check_variable = { SOV_paranoia > 55 }
			}
			modifier = {
				add = 100
				check_variable = { SOV_paranoia > 70 }
			}
			modifier = {
				factor = 2
				SOV_is_opposition = yes
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = SOV_paranoia_system_active_flag
		}

		visible = {
			has_country_flag = SOV_paranoia_system_active_flag
		}

		cost = SOV_paranoia_calm_down_stalin_decision_cost

		days_re_enable = SOV_paranoia_calm_down_stalin_re_enable_days

		days_remove = 90

		modifier = {
			consumer_goods_factor = 0.04
		}

		complete_effect = {
			SOV_paranoia_medium_decrease_effect = yes

			custom_effect_tooltip = SOV_paranoia_calm_down_stalin_cd_tt
		}
	}

	SOV_inspection_in_the_administration = { #Repeatable decision to reduce Paranoia // Target Administration
		priority = 309

		icon = GFX_decision_generic_political_discourse

		ai_will_do = {
			base = 0
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = SOV_paranoia_system_active_flag
			custom_trigger_tooltip = {
				tooltip = SOV_paranoia_administration_purgeable_tt
				OR = {
					any_character = {
						is_character_slot = political_advisor
						SOV_character_can_be_purged = yes
					}
					NOT = { has_idea = SOV_understaffed_bureaucracy }
					NOT = { has_idea = SOV_lavrenty_beriya }
				}
			}
			NOT = { has_country_flag = SOV_paranoia_conducting_inspection_flag }
		}

		visible = {
			has_country_flag = SOV_paranoia_system_active_flag
			OR = {
				any_character = {
					is_character_slot = political_advisor
					SOV_character_can_be_purged = yes
				}
				NOT = { has_idea = SOV_understaffed_bureaucracy }
				NOT = { has_idea = SOV_lavrenty_beriya }
			}
			SOV_is_stalinist = yes
		}

		cost = SOV_paranoia_inspection_decision_cost

		days_remove = SOV_paranoia_inspection_remove_days

		days_re_enable = SOV_paranoia_inspection_re_enable_days

		complete_effect = {
			set_country_flag = SOV_paranoia_conducting_inspection_flag #Used to prevent random purges from popping up while this is active
		}

		remove_effect = {
			clr_country_flag = SOV_paranoia_conducting_inspection_flag
			set_country_flag = { flag = SOV_paranoia_random_purge_cooldown_from_decision_flag days = 15 } #Used to prevent random purges from popping up immediately after this is completed

			SOV_pick_regular_purge_administration_type_effect = yes
			SOV_paranoia_low_decrease_effect = yes

			custom_effect_tooltip = SOV_paranoia_inspection_cd_tt
		}
	}

	SOV_inspection_in_the_army = { #Repeatable decision to reduce Paranoia // Target Army
		priority = 308

		icon = GFX_decision_generic_political_discourse

		ai_will_do = {
			base = 0
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = SOV_paranoia_system_active_flag
			custom_trigger_tooltip = {
				tooltip = SOV_paranoia_army_purgeable_tt
				OR = {
					any_army_leader = {
						SOV_character_can_be_purged = yes
					}
					NOT = { has_idea = SOV_anti_soviet_military_thinking_banned_army }
					NOT = { has_idea = SOV_training_activities_curtailed }
				}
			}
			NOT = { has_country_flag = SOV_paranoia_conducting_inspection_flag }
		}

		visible = {
			has_country_flag = SOV_paranoia_system_active_flag
			OR = {
				any_army_leader = {
					SOV_character_can_be_purged = yes
				}
				NOT = { has_idea = SOV_anti_soviet_military_thinking_banned_army }
				NOT = { has_idea = SOV_training_activities_curtailed }
			}
			SOV_is_stalinist = yes
		}

		cost = SOV_paranoia_inspection_decision_cost

		days_remove = SOV_paranoia_inspection_remove_days

		days_re_enable = SOV_paranoia_inspection_re_enable_days

		complete_effect = {
			set_country_flag = SOV_paranoia_conducting_inspection_flag #Used to prevent random purges from popping up while this is active
		}

		remove_effect = {
			clr_country_flag = SOV_paranoia_conducting_inspection_flag
			set_country_flag = { flag = SOV_paranoia_random_purge_cooldown_from_decision_flag days = 15 } #Used to prevent random purges from popping up immediately after this is completed

			SOV_pick_regular_purge_army_type_effect = yes
			SOV_paranoia_medium_decrease_effect = yes
			IF = {
				limit = { SOV_is_opposition = yes }
				SOV_decrease_all_opposition_army = yes
			}

			custom_effect_tooltip = SOV_paranoia_inspection_cd_tt
		}
	}

	SOV_inspection_in_the_navy = { #Repeatable decision to reduce Paranoia // Target Navy
		priority = 307

		icon = GFX_decision_generic_political_discourse

		ai_will_do = {
			base = 0
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = SOV_paranoia_system_active_flag
			custom_trigger_tooltip = {
				tooltip = SOV_paranoia_navy_purgeable_tt
				OR = {
					any_navy_leader = {
						SOV_character_can_be_purged = yes
					}
					NOT = { has_idea = SOV_anti_soviet_military_thinking_banned_navy }
					NOT = { has_idea = SOV_shipyard_staff_purged }
				}
			}
			NOT = { has_country_flag = SOV_paranoia_conducting_inspection_flag }
		}

		visible = {
			has_country_flag = SOV_paranoia_system_active_flag
			OR = {
				any_navy_leader = {
					SOV_character_can_be_purged = yes
				}
				NOT = { has_idea = SOV_anti_soviet_military_thinking_banned_navy }
				NOT = { has_idea = SOV_shipyard_staff_purged }
			}
			SOV_is_stalinist = yes
		}

		cost = SOV_paranoia_inspection_decision_cost

		days_remove = SOV_paranoia_inspection_remove_days

		days_re_enable = SOV_paranoia_inspection_re_enable_days

		complete_effect = {
			set_country_flag = SOV_paranoia_conducting_inspection_flag #Used to prevent random purges from popping up while this is active
		}

		remove_effect = {
			clr_country_flag = SOV_paranoia_conducting_inspection_flag
			set_country_flag = { flag = SOV_paranoia_random_purge_cooldown_from_decision_flag days = 15 } #Used to prevent random purges from popping up immediately after this is completed

			SOV_pick_regular_purge_navy_type_effect = yes
			SOV_paranoia_low_decrease_effect = yes
			IF = {
				limit = { SOV_is_opposition = yes }
				SOV_decrease_all_opposition_navy = yes
			}

			custom_effect_tooltip = SOV_paranoia_inspection_cd_tt
		}
	}

	SOV_inspection_in_the_airforce = { #Repeatable decision to reduce Paranoia // Target Airforce
		priority = 306

		icon = GFX_decision_generic_political_discourse

		ai_will_do = {
			base = 0
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = SOV_paranoia_system_active_flag
			custom_trigger_tooltip = {
				tooltip = SOV_paranoia_airforce_purgeable_tt
				OR = {
					NOT = { has_idea = SOV_anti_soviet_military_thinking_banned_airforce }
					NOT = { has_idea = SOV_ground_based_training }
				}
			}
			NOT = { has_country_flag = SOV_paranoia_conducting_inspection_flag }
		}

		visible = {
			has_country_flag = SOV_paranoia_system_active_flag
			OR = {
				NOT = { has_idea = SOV_anti_soviet_military_thinking_banned_airforce }
				NOT = { has_idea = SOV_ground_based_training }
			}
			SOV_is_stalinist = yes
		}

		cost = SOV_paranoia_inspection_decision_cost

		days_remove = SOV_paranoia_inspection_remove_days

		days_re_enable = SOV_paranoia_inspection_re_enable_days

		complete_effect = {
			set_country_flag = SOV_paranoia_conducting_inspection_flag #Used to prevent random purges from popping up while this is active
		}

		remove_effect = {
			clr_country_flag = SOV_paranoia_conducting_inspection_flag
			set_country_flag = { flag = SOV_paranoia_random_purge_cooldown_from_decision_flag days = 15 } #Used to prevent random purges from popping up immediately after this is completed

			SOV_pick_regular_purge_airforce_type_effect = yes
			SOV_paranoia_low_decrease_effect = yes
			IF = {
				limit = { SOV_is_opposition = yes }
				SOV_decrease_all_opposition_air = yes
			}
			custom_effect_tooltip = SOV_paranoia_inspection_cd_tt
		}
	}

	SOV_loosen_prohibitions_in_military_academies_dec = {
		priority = 300

		icon = generic_brainwash

		ai_will_do = {
			base = 1
			modifier = {
				factor = 2
				any_enemy_country = {
					is_major = yes
				}
			}
			modifier = {
				factor = 5
				has_idea = SOV_anti_soviet_military_thinking_banned_army
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = { flag = SOV_third_moscow_trial_flag days > 365 }
		}

		visible = {
			OR = {
				has_idea = SOV_anti_soviet_military_thinking_banned_army
				has_idea = SOV_anti_soviet_military_thinking_banned_navy
				has_idea = SOV_anti_soviet_military_thinking_banned_airforce
			}
			SOV_is_stalinist = yes
		}

		days_remove = 30

		cost = 50

		modifier = {
			command_power_gain = -0.2
			political_power_gain = -0.2
		}

		complete_effect = {
		}

		remove_effect = {
			if = {
				limit = {
					has_idea = SOV_anti_soviet_military_thinking_banned_army
				}
				remove_ideas = SOV_anti_soviet_military_thinking_banned_army
			}
			if = {
				limit = {
					has_idea = SOV_anti_soviet_military_thinking_banned_navy
				}
				remove_ideas = SOV_anti_soviet_military_thinking_banned_navy
			}
			if = {
				limit = {
					has_idea = SOV_anti_soviet_military_thinking_banned_airforce
				}
				remove_ideas = SOV_anti_soviet_military_thinking_banned_airforce
			}
		}
	}

	SOV_reinforce_army_officer_ranks_with_veterans_dec = {
		priority = 291

		icon = generic_prepare_civil_war

		ai_will_do = {
			base = 10
			modifier = {
				factor = 2
				has_war = yes
			}
			modifier = {
				factor = 5
				has_idea = SOV_purged_junior_army_officers_2
			}
			modifier = {
				factor = 10
				has_idea = SOV_purged_junior_army_officers_3
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = { flag = SOV_third_moscow_trial_flag days > 365 }
		}

		visible = {
			OR = {
				has_idea = SOV_purged_junior_army_officers_1
				has_idea = SOV_purged_junior_army_officers_2
				has_idea = SOV_purged_junior_army_officers_3
			}
			SOV_is_stalinist = yes
		}

		days_remove = SOV_reinforce_officer_ranks_days

		days_re_enable = 1

		ai_hint_pp_cost = 50
		custom_cost_trigger = {
			command_power > 49
			has_political_power > 49
			has_army_experience > 49
		}
		custom_cost_text = decision_cost_CP_50_pp_50_ArmXP_50

		complete_effect = {
			hidden_effect = {
				add_command_power = -50
				add_political_power = -50
				army_experience = -50
			}
		}

		remove_effect = {
			if = {
				limit = {
					has_idea = SOV_purged_junior_army_officers_3
				}
				swap_ideas = {
					remove_idea = SOV_purged_junior_army_officers_3
					add_idea = SOV_purged_junior_army_officers_2
				}
			}
			else_if = {
				limit = {
					has_idea = SOV_purged_junior_army_officers_2
				}
				swap_ideas = {
					remove_idea = SOV_purged_junior_army_officers_2
					add_idea = SOV_purged_junior_army_officers_1
				}
			}
			else_if = {
				limit = {
					has_idea = SOV_purged_junior_army_officers_1
				}
				remove_ideas = SOV_purged_junior_army_officers_1
			}
		}
	}

	SOV_reinforce_navy_officer_ranks_with_veterans_dec = {
		priority = 290

		icon = generic_naval

		ai_will_do = {
			base = 10
			modifier = {
				factor = 10
				has_war = yes
			}
			modifier = {
				factor = 10
				has_idea = SOV_purged_junior_navy_officers_2
			}
			modifier = {
				factor = 50
				has_idea = SOV_purged_junior_navy_officers_3
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = { flag = SOV_third_moscow_trial_flag days > 365 }
		}

		visible = {
			OR = {
				has_idea = SOV_purged_junior_navy_officers_1
				has_idea = SOV_purged_junior_navy_officers_2
				has_idea = SOV_purged_junior_navy_officers_3
			}
			SOV_is_stalinist = yes
		}

		days_remove = SOV_reinforce_officer_ranks_days

		days_re_enable = 1

		ai_hint_pp_cost = 50
		custom_cost_trigger = {
			command_power > 49
			has_political_power > 49
			has_navy_experience > 49
		}
		custom_cost_text = decision_cost_CP_50_pp_50_NavXP_50

		complete_effect = {
			hidden_effect = {
				add_command_power = -50
				add_political_power = -50
				navy_experience = -50
			}
		}

		remove_effect = {
			if = {
				limit = {
					has_idea = SOV_purged_junior_navy_officers_3
				}
				swap_ideas = {
					remove_idea = SOV_purged_junior_navy_officers_3
					add_idea = SOV_purged_junior_navy_officers_2
				}
			}
			else_if = {
				limit = {
					has_idea = SOV_purged_junior_navy_officers_2
				}
				swap_ideas = {
					remove_idea = SOV_purged_junior_navy_officers_2
					add_idea = SOV_purged_junior_navy_officers_1
				}
			}
			else_if = {
				limit = {
					has_idea = SOV_purged_junior_navy_officers_1
				}
				remove_ideas = SOV_purged_junior_navy_officers_1
			}
			else = {
				#log = "I CANNOT REMOVE A NS THAT DOESN'T EXIST!"
			}
		}
	}

	SOV_reinstate_mig_design_bureau = {
		priority = 285

		icon = generic_air

		ai_will_do = {
			base = 2
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = {
				flag = SOV_mig_design_bureau_dissolved_flag
				days > 365
			}
			num_of_civilian_factories_available_for_projects > 1
		}

		visible = {
			has_country_flag = SOV_mig_design_bureau_dissolved_flag
		}

		days_remove = SOV_reinstate_aircraft_designer_days

		days_re_enable = 1

		cost = 0

		modifier = {
			political_power_gain = -0.25
			civilian_factory_use = 2
		}

		remove_effect = {
			clr_country_flag = SOV_mig_design_bureau_dissolved_flag
		}
	}

	SOV_reinstate_ilyushin_design_bureau = {
		priority = 284

		icon = generic_air

		ai_will_do = {
			base = 2
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = {
				flag = SOV_ilyushin_design_bureau_dissolved_flag
				days > 365
			}
			num_of_civilian_factories_available_for_projects > 1
		}

		visible = {
			has_country_flag = SOV_ilyushin_design_bureau_dissolved_flag
		}

		days_remove = SOV_reinstate_aircraft_designer_days

		days_re_enable = 1

		cost = 0

		modifier = {
			political_power_gain = -0.25
			civilian_factory_use = 2
		}

		remove_effect = {
			clr_country_flag = SOV_ilyushin_design_bureau_dissolved_flag
		}
	}

	SOV_reinstate_tupolev_design_bureau = {
		priority = 283

		icon = generic_air

		ai_will_do = {
			base = 2
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = {
				flag = SOV_tupolev_design_bureau_dissolved_flag
				days > 365
			}
			num_of_civilian_factories_available_for_projects > 1
		}

		visible = {
			has_country_flag = SOV_tupolev_design_bureau_dissolved_flag
		}

		days_remove = SOV_reinstate_aircraft_designer_days

		days_re_enable = 1

		cost = 0

		modifier = {
			political_power_gain = -0.25
			civilian_factory_use = 2
		}

		remove_effect = {
			clr_country_flag = SOV_tupolev_design_bureau_dissolved_flag
		}
	}

	SOV_reinstate_yakovlev_design_bureau = {
		priority = 282

		icon = generic_air

		ai_will_do = {
			base = 2
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = {
				flag = SOV_yakovlev_design_bureau_dissolved_flag
				days > 365
			}
			num_of_civilian_factories_available_for_projects > 1
		}

		visible = {
			has_country_flag = SOV_yakovlev_design_bureau_dissolved_flag
		}

		days_remove = SOV_reinstate_aircraft_designer_days

		days_re_enable = 1

		cost = 0

		modifier = {
			political_power_gain = -0.25
			civilian_factory_use = 2
		}

		remove_effect = {
			clr_country_flag = SOV_yakovlev_design_bureau_dissolved_flag
		}
	}

	SOV_contact_lyushkov_group_in_far_east = {
		priority = 1

		icon = generic_spy

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_completed_focus = SOV_look_to_the_east
			any_neighbor_country = {
				original_tag = JAP
				NOT = {
					has_government = ROOT
				}
			}
		}

		visible = {
			has_completed_focus = SOV_look_to_the_east
			has_country_leader = {				#Stalin is out? Hied it then
				character = SOV_iosif_stalin
				ruling_only = yes
			}
		}

		fire_only_once = yes

		cost = 25

		days_remove = 90

		modifier = {
			command_power_gain = -0.3
		}

		remove_effect = {
			add_war_support = 0.03
			set_country_flag = SOV_lyushkov_informed_about_the_plan_flag
			custom_effect_tooltip = SOV_reduces_negative_effects_of_stalins_elimination_tt
		}
	}

	SOV_provide_intel_to_the_japanese = {
		priority = 1

		icon = hol_exchange_intelligence_data

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_completed_focus = SOV_look_to_the_east
			any_neighbor_country = {
				original_tag = JAP
				NOT = {
					has_government = ROOT
					has_war_with = ROOT
				}
			}
		}

		visible = {
			has_completed_focus = SOV_look_to_the_east
			has_country_leader = {				#Stalin is out? Hied it then
				character = SOV_iosif_stalin
				ruling_only = yes
			}
		}

		fire_only_once = yes

		custom_cost_text = r56_15_command_power_cost
		custom_cost_trigger = {
			command_power > 15
		}

		days_remove = 14

		modifier = {
			communism_drift = -0.02
			consumer_goods_factor = 0.06
		}

		remove_effect = {
			hidden_effect = {
				add_command_power = -15
			}
			JAP = {
				country_event = {
					id = r56.soviet.200
					hours = 12 random_hours = 6
				}
			}
			custom_effect_tooltip = if_they_accept
			effect_tooltip = {
				if = {
					limit = {
						has_dlc = "La Resistance"
					}
					JAP = {
						add_operation_token = {
							tag = SOV
							token = token_army
						}
						add_decryption = {
							target = SOV
							ratio = 0.15
						}
					}
				}
				else = {
					JAP = {
						add_tech_bonus = {
							name = SOV_strategic_intel_supplied
							bonus = 1
							uses = 1
							category = encryption_tech
						}
						add_tech_bonus = {
							name = SOV_strategic_intel_supplied
							bonus = 0.25
							uses = 1
							category = decryption_tech
						}
					}
				}
				custom_effect_tooltip = SOV_reduces_negative_effects_of_stalins_elimination_tt
			}
		}
	}

	SOV_recruit_white_emigres_in_manchuria = {
		priority = 1

		icon = GFX_decision_attache

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_completed_focus = SOV_look_to_the_east
			any_neighbor_country = {
				OR = {
					original_tag = JAP
					original_tag = MAN
				}
				NOT = {
					has_government = ROOT
				}
			}
		}

		visible = {
			has_completed_focus = SOV_look_to_the_east
			has_country_leader = {				#Stalin is out? Hied it then
				character = SOV_iosif_stalin
				ruling_only = yes
			}
		}

		fire_only_once = yes

		cost = 5

		days_remove = 60

		modifier = {
			consumer_goods_factor = 0.1
			weekly_manpower = 20
		}

		remove_effect = {
			add_stability = -0.05
			set_country_flag = SOV_white_russians_recruited_flag
			custom_effect_tooltip = SOV_reduces_negative_effects_of_stalins_elimination_tt
		}
	}

	SOV_craft_foreign_passports = {
		priority = 1

		icon = generic_book

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			count_triggers = {
				amount = 3
				has_country_flag = SOV_lyushkov_informed_about_the_plan_flag
				has_country_flag = SOV_provided_japanese_with_intelligence_flag
				has_country_flag = SOV_white_russians_recruited_flag
			}
		}

		visible = {
			count_triggers = {
				amount = 3
				has_country_flag = SOV_lyushkov_informed_about_the_plan_flag
				has_country_flag = SOV_provided_japanese_with_intelligence_flag
				has_country_flag = SOV_white_russians_recruited_flag
			}
			has_country_leader = {				#Stalin is out? Hied it then
				character = SOV_iosif_stalin
				ruling_only = yes
			}
		}

		fire_only_once = yes

		cost = 50

		days_remove = 7

		modifier = {
			consumer_goods_factor = 0.2
		}

		remove_effect = {
			random_owned_controlled_state = {
				limit = {
					industrial_complex > 0
				}
				damage_building = {
					type = industrial_complex
					damage = 1
				}
			}
			set_country_flag = SOV_passports_crafted_flag
			custom_effect_tooltip = SOV_reduces_negative_effects_of_stalins_elimination_tt
		}
	}

	SOV_hunt_down_the_bear_1_support = {
		priority = 1

		icon = generic_trucks

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		visible = {
			count_triggers = {
				amount < 2
				has_country_flag = SOV_lyushkov_informed_about_the_plan_flag
				has_country_flag = SOV_provided_japanese_with_intelligence_flag
				has_country_flag = SOV_white_russians_recruited_flag
				has_country_flag = SOV_passports_crafted_flag
			}
		}

		fire_only_once = yes

		days_remove = 60

		modifier = {
			political_power_gain = -0.5
			command_power_gain = -1
		}

		remove_effect = {
			add_stability = -0.15
			add_political_power = -100
			set_global_flag = stalin_dead
			add_country_leader_role = {
				character = SOV_georgy_malenkow
				country_leader = {
					ideology = marxism
					traits = { sov_power_truggle }
					expire = "1965.3.1.1"
				}
				promote_leader = yes 
			}
			hidden_effect = {
				news_event = {
					id = r56_kill_stalin.1
					days = 7 random_days = 2
				}
			}
		}
	}

	SOV_hunt_down_the_bear_2_support = {
		name = SOV_hunt_down_the_bear_1_support
		priority = 1

		icon = generic_assassination

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		visible = {
			count_triggers = {
				amount = 2
				has_country_flag = SOV_lyushkov_informed_about_the_plan_flag
				has_country_flag = SOV_provided_japanese_with_intelligence_flag
				has_country_flag = SOV_white_russians_recruited_flag
				has_country_flag = SOV_passports_crafted_flag
			}
		}

		fire_only_once = yes

		days_remove = 30

		modifier = {
			political_power_gain = -0.2
			command_power_gain = -0.75
		}

		remove_effect = {
			add_stability = -0.15
			set_global_flag = stalin_dead
			add_country_leader_role = {
				character = SOV_georgy_malenkow
				country_leader = {
					ideology = marxism
					traits = { sov_power_truggle }
					expire = "1965.3.1.1"
				}
				promote_leader = yes 
			}
			hidden_effect = {
				news_event = {
					id = r56_kill_stalin.2
					days = 7 random_days = 2
				}
			}
		}
	}

	SOV_hunt_down_the_bear_3_support = {
		name = SOV_hunt_down_the_bear_1_support
		priority = 1

		icon = SWI_expand_covert_operations

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		visible = {
			count_triggers = {
				amount = 3
				has_country_flag = SOV_lyushkov_informed_about_the_plan_flag
				has_country_flag = SOV_provided_japanese_with_intelligence_flag
				has_country_flag = SOV_white_russians_recruited_flag
				has_country_flag = SOV_passports_crafted_flag
			}
		}

		fire_only_once = yes

		days_remove = 15

		modifier = {
			political_power_gain = -0.1
			command_power_gain = -0.5
		}

		remove_effect = {
			add_stability = -0.1
			set_global_flag = stalin_dead
			add_country_leader_role = {
				character = SOV_georgy_malenkow
				country_leader = {
					ideology = marxism
					traits = { sov_power_truggle }
					expire = "1965.3.1.1"
				}
				promote_leader = yes 
			}
			hidden_effect = {
				news_event = {
					id = r56_kill_stalin.3
					days = 7 random_days = 2
				}
			}
		}
	}

	SOV_hunt_down_the_bear_4_support = {
		name = SOV_hunt_down_the_bear_1_support
		priority = 1

		icon = generic_naval

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		visible = {
			count_triggers = {
				amount > 3
				has_country_flag = SOV_lyushkov_informed_about_the_plan_flag
				has_country_flag = SOV_provided_japanese_with_intelligence_flag
				has_country_flag = SOV_white_russians_recruited_flag
				has_country_flag = SOV_passports_crafted_flag
			}
		}

		fire_only_once = yes

		days_remove = 7

		modifier = {
			political_power_gain = -0.05
			command_power_gain = -0.05
		}

		remove_effect = {
			add_war_support = -0.05
			set_global_flag = stalin_dead
			add_country_leader_role = {
				character = SOV_georgy_malenkow
				country_leader = {
					ideology = marxism
					traits = { sov_power_truggle }
					expire = "1965.3.1.1"
				}
				promote_leader = yes 
			}
			hidden_effect = {
				news_event = {
					id = r56_kill_stalin.4
					days = 7 random_days = 2
				}
			}
		}
	}

	SOV_DEBUG_ACTIVATE_PARANOIA = { #TODO_Manu: Comment out
		priority = 281

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			NOT = { has_country_flag = SOV_paranoia_system_active_flag }
			is_debug = yes
		}

		cost = 0

		complete_effect = {
			custom_effect_tooltip = "THIS ACTIVATES THE PARANOIA SYSTEM"
			SOV_initiate_paranoia_effect = yes
		}
	}

	SOV_DEBUG_DEACTIVATE_PARANOIA = { #TODO_Manu: Comment out
		priority = 281

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			has_country_flag = SOV_paranoia_system_active_flag
			is_debug = yes
		}

		cost = 0

		complete_effect = {
			custom_effect_tooltip = "THIS REMOVES THE PARANOIA SYSTEM"
			SOV_remove_paranoia_effect = yes
		}
	}

	SOV_DEBUG_show_debug_purge_decisions = { #TODO_Manu: Comment out
		priority = 281

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			NOT = { has_country_flag = SOV_TEST_show_debug_purge_decisions_flag }
			is_debug = yes
		}

		cost = 0

		complete_effect = {
			set_country_flag = SOV_TEST_show_debug_purge_decisions_flag
			#SOV_initiate_paranoia_effect = yes
		}
	}

	SOV_DEBUG_hide_debug_purge_decisions = { #TODO_Manu: Comment out
		priority = 201

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
			is_debug = yes
		}

		cost = 0

		complete_effect = {
			clr_country_flag = SOV_TEST_show_debug_purge_decisions_flag
			#SOV_remove_paranoia_effect = yes
		}
	}

	SOV_DEBUG_MAKE_PURGE_DECISIONS_FASTER_HERE = {
		priority = 151

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			NOT = {
				has_country_flag = SOV_debug_fast_purge_decisions_flag
			}
			is_debug = yes
		}

		cost = 0

		complete_effect = {
			set_country_flag = SOV_debug_fast_purge_decisions_flag
			set_variable = { SOV_reinforce_officer_ranks_days = 3 }
			set_variable = { SOV_reinstate_aircraft_designer_days = 3 }
		}
	}

	SOV_DEBUG_REGULAR_PURGE_DECISIONS_DURATION_HERE = {
		priority = 150

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			has_country_flag = SOV_debug_fast_purge_decisions_flag
			is_debug = yes
		}

		cost = 0

		complete_effect = {
			clr_country_flag = SOV_debug_fast_purge_decisions_flag
			set_variable = { SOV_reinforce_officer_ranks_days = 365 }
			set_variable = { SOV_reinstate_aircraft_designer_days = 180 }
		}
	}

	SOV_DEBUG_trigger_great_purge_trial_of_the_generals_dec = {
		priority = 99

		icon = generic_prepare_civil_war

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_great_purge_army_trial_of_the_generals_effect = yes
		}
	}

	SOV_DEBUG_trigger_great_purge_army_junior_officers_dec = {
		priority = 98

		icon = generic_prepare_civil_war

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_great_purge_army_junior_officers_effect = yes
		}
	}

	SOV_DEBUG_trigger_random_army_great_purge_dec = {
		priority = 97

		icon = generic_prepare_civil_war

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_pick_great_purge_army_type_effect = yes
		}
	}

	SOV_DEBUG_trigger_regular_purge_general_accused_dec = {
		priority = 96

		icon = generic_prepare_civil_war

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_regular_purge_general_accused_effect = yes
		}
	}

	SOV_DEBUG_trigger_regular_purge_conspiracy_in_the_academy_dec = {
		priority = 95

		icon = generic_prepare_civil_war

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_regular_purge_conspiracy_in_the_academy_effect = yes
		}
	}

	SOV_DEBUG_trigger_regular_purge_anti_saboteur_campaign_dec = {
		priority = 94

		icon = generic_prepare_civil_war

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_regular_purge_anti_saboteur_campaign_effect = yes
		}
	}

	SOV_DEBUG_trigger_regular_purge_general_accuses_general_dec = {
		priority = 93

		icon = generic_prepare_civil_war

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_regular_purge_general_accuses_general_effect = yes
		}
	}

	SOV_DEBUG_trigger_great_purge_moscow_trial_dec = {
		priority = 89

		icon = eng_trade_unions_support

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_trigger_great_purge_moscow_trial_effect = yes
		}
	}

	SOV_DEBUG_trigger_regular_purge_advisor_accused_dec = {
		priority = 83

		icon = eng_trade_unions_support

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_trigger_regular_purge_advisor_accused_effect = yes
		}
	}

	SOV_DEBUG_trigger_regular_purge_civil_servants_dec = {
		priority = 82

		icon = eng_trade_unions_support

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_trigger_regular_purge_civil_servants_purged_effect = yes
		}
	}

	SOV_DEBUG_trigger_regular_purge_nkvd_dec = {
		priority = 81

		icon = eng_trade_unions_support

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_trigger_regular_purge_nkvd_effect = yes
		}
	}



	SOV_DEBUG_trigger_great_purge_trial_of_the_admirals_dec = {
		priority = 79

		icon = generic_naval

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_trigger_great_purge_trial_of_the_admirals_effect = yes
		}
	}

	SOV_DEBUG_trigger_great_purge_junior_naval_officers_effect = {
		priority = 78

		icon = generic_naval

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_trigger_great_purge_junior_naval_officers_effect = yes
		}
	}

	SOV_DEBUG_trigger_regular_purge_admiral_accused_dec = {
		priority = 73

		icon = generic_naval

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_trigger_regular_purge_admiral_accused_effect = yes
		}
	}

	SOV_DEBUG_trigger_regular_purge_naval_conspiracy_in_the_academys_dec = {
		priority = 72

		icon = generic_naval

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_trigger_regular_purge_naval_conspiracy_in_the_academy_effect = yes
		}
	}

	SOV_DEBUG_trigger_regular_purge_naval_anti_saboteur_campaign_dec = {
		priority = 71

		icon = generic_naval

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_trigger_regular_purge_naval_anti_saboteur_campaign_effect = yes
		}
	}




	SOV_DEBUG_trigger_great_purge_airforce_chiefs_dec = {
		priority = 69

		icon = generic_air

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_trigger_great_purge_airforce_chiefs_effect = yes
		}
	}

	SOV_DEBUG_trigger_great_purge_airforce_design_bureau_dissolved_dec = {
		priority = 68

		icon = generic_air

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_trigger_great_purge_design_bureau_dissolved_effect = yes
		}
	}

	SOV_DEBUG_trigger_regular_purge_airforce_conspiracy_in_the_academys_dec = {
		priority = 62

		icon = generic_air

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_trigger_regular_purge_airforce_conspiracy_in_the_academy_effect = yes
		}
	}

	SOV_DEBUG_trigger_regular_purge_airforce_anti_saboteur_campaign_dec = {
		priority = 61

		icon = generic_air

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_trigger_regular_purge_airforce_anti_saboteur_campaign_effect = yes
		}
	}



	SOV_DEBUG_low_paranoia_increase_dec = {
		priority = 6

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = SOV_paranoia_system_active_flag
		}

		visible = {
			has_country_flag = SOV_paranoia_system_active_flag
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_paranoia_low_increase_effect = yes
		}
	}

	SOV_DEBUG_medium_paranoia_increase_dec = {
		priority = 5

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = SOV_paranoia_system_active_flag
		}

		visible = {
			has_country_flag = SOV_paranoia_system_active_flag
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_paranoia_medium_increase_effect = yes
		}
	}

	SOV_DEBUG_high_paranoia_increase_dec = {
		priority = 4

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = SOV_paranoia_system_active_flag
		}

		visible = {
			has_country_flag = SOV_paranoia_system_active_flag
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_paranoia_high_increase_effect = yes
		}
	}

	SOV_DEBUG_low_paranoia_decrease_dec = {
		priority = 3

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = SOV_paranoia_system_active_flag
		}

		visible = {
			has_country_flag = SOV_paranoia_system_active_flag
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_paranoia_low_decrease_effect = yes
		}
	}

	SOV_DEBUG_medium_paranoia_decrease_dec = {
		priority = 2

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = SOV_paranoia_system_active_flag
		}

		visible = {
			has_country_flag = SOV_paranoia_system_active_flag
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_paranoia_medium_decrease_effect = yes
		}
	}

	SOV_DEBUG_high_paranoia_decrease_dec = {
		priority = 1

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = SOV_paranoia_system_active_flag
		}

		visible = {
			has_country_flag = SOV_paranoia_system_active_flag
			has_country_flag = SOV_TEST_show_debug_purge_decisions_flag
		}

		cost = 0

		complete_effect = {
			SOV_paranoia_high_decrease_effect = yes
		}
	}

	SOV_DEBUG_show_all_purged_portraits = {
		priority = 1

		icon = eng_ally_imperialist_coup

		ai_will_do = {
			base = 0
		}

		allowed = {
			always = yes
		}

		available = {
			always = yes
		}

		visible = {
			is_debug = yes
		}

		days_re_enable = 1

		cost = 0

		complete_effect = {
			#Custom
			set_variable = { SOV.SOV_paranoia_photo_zinovyev = 8 }
			set_variable = { SOV.SOV_paranoia_photo_radek = 9 }
			set_variable = { SOV.SOV_paranoia_photo_bukharin = 10 }
			set_variable = { SOV.SOV_paranoia_photo_trotsky = 11 }
			set_variable = { SOV.SOV_paranoia_photo_tukhachevsky = 12 }

			#Generic
			set_variable = { SOV_paranoia_portrait_index = 1 }
			set_temp_variable = { i = 0 }
			while_loop_effect = {
				limit = {
					check_variable = { i = 12 compare = less_than }
				}
				set_temp_variable = { SOV_generic_portrait_frame = SOV_paranoia_portrait_index }
				if = { #There are 6 portraits and 12 slots, so second round of generic portraits
					limit = {
						check_variable = { SOV_paranoia_portrait_index = 6 compare = greater_than }
					}
					subtract_from_temp_variable = { SOV_generic_portrait_frame = 6 }
				}
				add_to_temp_variable = { SOV_generic_portrait_frame = 1 }
				#log = "Final FRAME is [?SOV_generic_portrait_frame]"

				add_to_array = {
					array = SOV_paranoia_generic_portraits_array
					value = SOV_generic_portrait_frame
					index = SOV_paranoia_portrait_index
				}

				add_to_variable = { SOV_paranoia_portrait_index = 1 }
				add_to_temp_variable = { i = 1 }
				#log = "New index is [?SOV_paranoia_portrait_index]"
			}
		}
	}
}



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


SOV_propaganda_campaigns = {
	SOV_debug_unlock_slot = {
		priority = 59

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			OR = {
				check_variable = { SOV_poster_left_icon_frame = SOV_propaganda_locked_slot_index }
				check_variable = { SOV_poster_center_icon_frame = SOV_propaganda_locked_slot_index }
				check_variable = { SOV_poster_right_icon_frame = SOV_propaganda_locked_slot_index }
			}
		}

		visible = {
			OR = {
				check_variable = { SOV_poster_left_icon_frame = SOV_propaganda_locked_slot_index }
				check_variable = { SOV_poster_center_icon_frame = SOV_propaganda_locked_slot_index }
				check_variable = { SOV_poster_right_icon_frame = SOV_propaganda_locked_slot_index }
			}
			is_debug = yes
		}

		cost = 0

		complete_effect = {
			SOV_unlock_propaganda_campaign_slot_effect = yes
		}
	}

	SOV_debug_MAKE_CAMPAIGNS_FASTER_HERE = {
		priority = 51

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			NOT = {
				has_country_flag = SOV_debug_fast_propaganda_campaigns_flag
			}
			is_debug = yes
		}

		cost = 0

		complete_effect = {
			set_country_flag = SOV_debug_fast_propaganda_campaigns_flag
			set_variable = { SOV_default_propaganda_campaign_duration = 5 }
			set_variable = { SOV_default_propaganda_campaign_cooldown = 1 }
			set_variable = { SOV_default_propaganda_campaign_old_days = 2 }
		}
	}

	SOV_debug_REGULAR_CAMPAIGN_DURATION_HERE = {
		priority = 51

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			has_country_flag = SOV_debug_fast_propaganda_campaigns_flag
			is_debug = yes
		}

		cost = 0

		complete_effect = {
			clr_country_flag = SOV_debug_fast_propaganda_campaigns_flag
			set_variable = { SOV_default_propaganda_campaign_duration = 180 }
			set_variable = { SOV_default_propaganda_campaign_cooldown = 90 }
			set_variable = { SOV_default_propaganda_campaign_old_days = 150 }
		}
	}

	SOV_debug_UNLOCK_ALL_CAMPAIGNS = {
		priority = 50

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			NOT = {
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag
			}
			is_debug = yes
		}

		cost = 0

		complete_effect = {
			set_country_flag = SOV_debug_unlock_propaganda_campaigns_flag
		}
	}

	SOV_propaganda_motherland_calls = { # ID = 3
		priority = 2

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 0
			modifier = {
				add = 1
				surrender_progress > 0.4
			}
			modifier = {
				add = 10
				has_manpower < 500000
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_motherland_calls_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_motherland_calls_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_motherland_calls_cost > 90 } #Shouldn't even consider doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			has_war = yes
			any_enemy_country = {
				is_major = yes
			}
		}

		visible = {
			OR = {
				has_completed_focus = SOV_expand_the_agitprop
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_motherland_calls_cost

		modifier = {
			weekly_manpower = 1000
			training_time_factor = -0.1
			minimum_training_level = -0.1
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 3 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 3 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			# Okay this looks dumb I know but it's better than having to change 24 operations each time we feel like tweaking how propaganda campaign's cost escalates
			set_variable = { SOV_propaganda_cost = SOV_propaganda_motherland_calls_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_motherland_calls_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_victory_at_hand = { # ID = 4
		priority = 3

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 1
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_victory_at_hand_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_victory_at_hand_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_victory_at_hand_cost > 90 } #Shouldn't even consider doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			has_war = yes
			surrender_progress < 0.01
			any_enemy_country = {
				is_major = yes
				ROOT = {
					any_controlled_state = {
						is_core_of = PREV.PREV
					}
				}
			}
			SOV_propaganda_victory_at_hand_available = yes
		}

		visible = {
			OR = {
				has_completed_focus = SOV_expand_the_agitprop
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_victory_at_hand_cost

		modifier = {
			army_attack_factor = 0.05
			army_speed_factor = 0.1
			org_loss_when_moving = -0.05
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 4 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 4 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_victory_at_hand_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_victory_at_hand_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_defend_moscow = { # ID = 5
		priority = 4

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 500
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_defend_moscow_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_defend_moscow_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_defend_moscow_cost > 90 } #Shouldn't even consider doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			controls_state = 219 #Moscow
			219 = {
				any_neighbor_state = {
					controller = {
						has_war_with = ROOT
					}
				}
			}
		}

		visible = {
			OR = {
				has_completed_focus = SOV_expand_the_agitprop
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_defend_moscow_cost

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 5 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes

			219 = { #Moscow
				add_dynamic_modifier = { modifier = SOV_defend_moscow scope = SOV }
				every_neighbor_state = {
					add_dynamic_modifier = { modifier = SOV_defend_moscow scope = SOV }
				}
			}
			custom_effect_tooltip = SOV_propaganda_defend_moscow_state_modifier_tt
		}

		remove_effect = {
			219 = { #Moscow
				remove_dynamic_modifier = { modifier = SOV_defend_moscow }
				every_neighbor_state = {
					remove_dynamic_modifier = { modifier = SOV_defend_moscow }
				}
			}

			set_variable = { SOV_propaganda_campaign_to_remove = 5 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_defend_moscow_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_defend_moscow_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_fight_to_the_last = { # ID = 6
		priority = 5

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 0.75
			modifier = {
				factor = 10
				OR = {
					AND = {
						stockpile_ratio = {
							archetype = train_equipment
							ratio < 0.75
						}
						stockpile_ratio = {
							archetype = motorized_equipment
							ratio < 0.75
						}
					}
					stockpile_ratio = {
						archetype = convoy
						ratio < 5
					}
				}
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_fight_to_the_last_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_fight_to_the_last_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_fight_to_the_last_cost > 90 } #Shouldn't even consider doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes
			has_war = yes
			surrender_progress > 0.1
		}

		visible = {
			OR = {
				has_completed_focus = SOV_expand_the_agitprop
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown


		cost = SOV_propaganda_fight_to_the_last_cost

		modifier = {
			army_org_factor = 0.05
			out_of_supply_factor = -0.1
			no_supply_grace = 70
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 6 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 6 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_fight_to_the_last_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_fight_to_the_last_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_hit_of_hammer = { # ID = 7
		priority = 6

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 10
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_hit_of_hammer_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_hit_of_hammer_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_hit_of_hammer_cost > 90 } #Shouldn't even consider doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			has_war = yes
		}

		visible = {
			OR = {
				has_completed_focus = SOV_expand_the_agitprop
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_hit_of_hammer_cost

		modifier = {
			industrial_capacity_factory = 0.05
			industrial_capacity_dockyard = 0.05
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 7 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 7 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_hit_of_hammer_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_hit_of_hammer_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_transport = { # ID = 8
		priority = 7

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 0.7
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_transport_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_transport_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_transport_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes
		}

		visible = {
			OR = {
				has_completed_focus = SOV_expand_the_agitprop
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_transport_cost

		modifier = {
			production_speed_supply_node_factor = 0.15
			production_speed_rail_way_factor = 0.15
			supply_consumption_factor = -0.1
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 8 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 8 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_transport_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_transport_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_oil_for_the_motherland = { # ID = 9
		priority = 8

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				fuel_ratio < 0.5
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_oil_for_the_motherland_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_oil_for_the_motherland_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_oil_for_the_motherland_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			any_controlled_state = {
				has_resources_amount = {
					resource = oil
					amount > 0
				}
			}
		}

		visible = {
			OR = {
				has_completed_focus = SOV_expand_the_agitprop
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_oil_for_the_motherland_cost

		modifier = {
			fuel_gain_factor = 0.1
			army_fuel_consumption_factor = -0.1
			air_fuel_consumption_factor = -0.1
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 9 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 9 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_oil_for_the_motherland_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_oil_for_the_motherland_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_more_metal = { # ID = 10
		priority = 9

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 0.8
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_more_metal_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_more_metal_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_more_metal_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			any_controlled_state = {
				OR = {
					has_resources_amount = {
						resource = steel
						amount > 0
					}
					has_resources_amount = {
						resource = aluminium
						amount > 0
					}
					has_resources_amount = {
						resource = chromium
						amount > 0
					}
					has_resources_amount = {
						resource = tungsten
						amount > 0
					}
				}
			}
		}

		visible = {
			OR = {
				has_completed_focus = SOV_expand_the_agitprop
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_more_metal_cost

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 10 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
			hidden_effect = {
				capital_scope = {
					set_variable = { SOV_steel_bonus = 0 }
					set_variable = { SOV_aluminium_bonus = 0 }
					set_variable = { SOV_chromium_bonus = 0 }
					set_variable = { SOV_tungsten_bonus = 0 }
				}
				every_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = steel
							amount > 0
						}
					}
					capital_scope = { add_to_variable = { SOV_steel_bonus = 1 } }
				}

				every_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = aluminium
							amount > 0
						}
					}
					capital_scope = { add_to_variable = { SOV_aluminium_bonus = 1 } }
				}

				every_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = chromium
							amount > 0
						}
					}
					capital_scope = { add_to_variable = { SOV_chromium_bonus = 1 } }
				}

				every_controlled_state = {
					limit = {
						has_resources_amount = {
							resource = tungsten
							amount > 0
						}
					}
					capital_scope = { add_to_variable = { SOV_tungsten_bonus = 1 } }
				}
			}

			capital_scope = {
				add_dynamic_modifier = { modifier = SOV_increased_metals_production }
			}

			custom_effect_tooltip = SOV_propaganda_more_metal_tt
		}

		remove_effect = {
			capital_scope = {
				remove_dynamic_modifier = { modifier = SOV_increased_metals_production }
			}

			set_variable = { SOV_propaganda_campaign_to_remove = 10 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_more_metal_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_more_metal_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_high_yield = { # ID = 11
		priority = 10

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 10
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_high_yield_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_high_yield_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_high_yield_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			surrender_progress < 0.15
		}

		visible = {
			OR = {
				has_completed_focus = SOV_expand_the_agitprop
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_high_yield_cost

		modifier = {
			consumer_goods_factor = -0.15
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 11 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 11 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_high_yield_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_high_yield_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_for_the_motherland = { # ID = 12
		priority = 11

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 1
			modifier = {
				factor = 10
				has_manpower < 300000
			}
			modifier = {
				factor = 2
				OR = {
					command_power < 25
					has_army_experience < 25
				}
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_for_the_motherland_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_for_the_motherland_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_for_the_motherland_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			has_war = yes
			any_enemy_country = {
				is_major = yes
			}
		}

		visible = {
			OR = {
				has_completed_focus = SOV_collectivist_propaganda
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_for_the_motherland_cost

		modifier = {
			experience_gain_army_factor = 0.1
			command_power_gain_mult = 0.15
			breakthrough_factor = 0.075
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 12 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 12 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_for_the_motherland_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_for_the_motherland_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_heroes_forward = { # ID = 13
		priority = 12

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 10
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_heroes_forward_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_heroes_forward_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_heroes_forward_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			has_war = yes
			any_unit_leader = {
				is_assigned = yes
			}
		}

		visible = {
			OR = {
				has_completed_focus = SOV_positive_heroism
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_heroes_forward_cost

		modifier = {
			army_morale_factor = 0.07
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 13 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes

			custom_effect_tooltip = SOV_propaganda_heroes_forward_tt

			set_temp_variable = { temp_targets_index = 0 }
			while_loop_effect = {
				limit = {
					check_variable = { temp_targets_index = 5 compare = less_than }
				}
				if = {
					limit = {
						any_unit_leader = {
							is_assigned = yes
							NOT = { has_trait = trait_SOV_determined }
						}
					}
					random_unit_leader = {
						limit = {
							is_assigned = yes
							NOT = { has_trait = trait_SOV_determined }
						}
						add_timed_unit_leader_trait = {
							trait = trait_SOV_determined
							days = @DAYS_DETERMINED #Does not seem to support vars
						}
					}
				}
				else = {
					random_unit_leader = {
						limit = {
							NOT = { has_trait = trait_SOV_determined }
						}
						add_timed_unit_leader_trait = {
							trait = trait_SOV_determined
							days = @DAYS_DETERMINED #Does not seem to support vars
						}
					}
				}
				add_to_temp_variable = { temp_targets_index = 1 }
			}
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 13 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_heroes_forward_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_heroes_forward_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_anti_capitalism = { # ID = 14
		priority = 13

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 1
			modifier = {
				factor = 5
				any_enemy_country = {
					is_major = yes
					has_government = democratic
				}
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_anti_capitalism_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_anti_capitalism_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_anti_capitalism_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			any_country = {
				has_government = democratic
				OR = {
					tag = ENG
					tag = FRA
					tag = GER
					tag = ITA
					tag = USA
					tag = JAP
				}
			}
		}

		visible = {
			OR = {
				has_completed_focus = SOV_anti_capitalist_policies
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_anti_capitalism_cost

		modifier = {
			opinion_gain_monthly_same_ideology_factor = 0.25
			democratic_acceptance = -100
			democratic_drift = -0.1
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 14 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
			custom_effect_tooltip = SOV_propaganda_anti_capitalism_tt
			set_variable = { SOV_anti_capitalist_target = 0 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
			#Choose the "most powerful" capitalist country based on num of factories
			if = {
				limit = {
					ENG = { has_government = democratic }
				}
				set_temp_variable = { SOV_max_factories = ENG.num_of_factories }
				set_variable = { SOV_anti_capitalist_target = 1 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
			}
			else_if = {
				limit = {
					FRA = { has_government = democratic }
				}
				set_temp_variable = { SOV_max_factories = FRA.num_of_factories }
				set_variable = { SOV_anti_capitalist_target = 2 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
			}
			else_if = {
				limit = {
					GER = { has_government = democratic }
				}
				set_temp_variable = { SOV_max_factories = GER.num_of_factories }
				set_variable = { SOV_anti_capitalist_target = 3 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
			}
			else_if = {
				limit = {
					ITA = { has_government = democratic }
				}
				set_temp_variable = { SOV_max_factories = ITA.num_of_factories }
				set_variable = { SOV_anti_capitalist_target = 4 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
			}
			else_if = {
				limit = {
					USA = { has_government = democratic }
				}
				set_temp_variable = { SOV_max_factories = USA.num_of_factories }
				set_variable = { SOV_anti_capitalist_target = 5 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
			}
			else_if = {
				limit = {
					JAP = { has_government = democratic }
				}
				set_temp_variable = { SOV_max_factories = JAP.num_of_factories }
				set_variable = { SOV_anti_capitalist_target = 6 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
			}

			if = {
				limit = {
					FRA = { has_government = democratic }
				}
				set_temp_variable = { SOV_compare_factories = FRA.num_of_factories }
				if = { #FIRST Vs FRA
					limit = {
						check_variable = { SOV_max_factories < SOV_compare_factories }
					}
					set_temp_variable = { SOV_max_factories = FRA.num_of_factories }
					set_variable = { SOV_anti_capitalist_target = 2 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
				}
			}

			if = {
				limit = {
					GER = { has_government = democratic }
				}
				set_temp_variable = { SOV_compare_factories = GER.num_of_factories }
				if = { #WINNER Vs GER
					limit = {
						check_variable = { SOV_max_factories < SOV_compare_factories }
					}
					set_temp_variable = { SOV_max_factories = GER.num_of_factories }
					set_variable = { SOV_anti_capitalist_target = 3 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
				}
			}

			if = {
				limit = {
					ITA = { has_government = democratic }
				}
				set_temp_variable = { SOV_compare_factories = ITA.num_of_factories }
				if = { #WINNER Vs ITA
					limit = {
						check_variable = { SOV_max_factories < SOV_compare_factories }
					}
					set_temp_variable = { SOV_max_factories = ITA.num_of_factories }
					set_variable = { SOV_anti_capitalist_target = 4 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
				}
			}

			if = {
				limit = {
					USA = { has_government = democratic }
				}
				set_temp_variable = { SOV_compare_factories = USA.num_of_factories }
				if = { #WINNER Vs USA
					limit = {
						check_variable = { SOV_max_factories < SOV_compare_factories }
					}
					set_temp_variable = { SOV_max_factories = USA.num_of_factories }
					set_variable = { SOV_anti_capitalist_target = 5 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
				}
			}

			if = {
				limit = {
					JAP = { has_government = democratic }
				}
				set_temp_variable = { SOV_compare_factories = JAP.num_of_factories }
				if = { #WINNER Vs JAP
					limit = {
						check_variable = { SOV_max_factories < SOV_compare_factories }
					}
					set_temp_variable = { SOV_max_factories = JAP.num_of_factories }
					set_variable = { SOV_anti_capitalist_target = 6 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
				}
			}

			if = {
				limit = {
					check_variable = { SOV_anti_capitalist_target = 1 }
				}
				add_timed_idea = {
					idea = SOV_anti_capitalist_campaign_eng
					days = SOV_default_propaganda_campaign_duration
				}
			}
			else_if = {
				limit = {
					check_variable = { SOV_anti_capitalist_target = 2 }
				}
				add_timed_idea = {
					idea = SOV_anti_capitalist_campaign_fra
					days = SOV_default_propaganda_campaign_duration
				}
			}
			else_if = {
				limit = {
					check_variable = { SOV_anti_capitalist_target = 3 }
				}
				add_timed_idea = {
					idea = SOV_anti_capitalist_campaign_ger
					days = SOV_default_propaganda_campaign_duration
				}
			}
			else_if = {
				limit = {
					check_variable = { SOV_anti_capitalist_target = 4 }
				}
				add_timed_idea = {
					idea = SOV_anti_capitalist_campaign_ita
					days = SOV_default_propaganda_campaign_duration
				}
			}
			else_if = {
				limit = {
					check_variable = { SOV_anti_capitalist_target = 5 }
				}
				add_timed_idea = {
					idea = SOV_anti_capitalist_campaign_usa
					days = SOV_default_propaganda_campaign_duration
				}
			}
			else_if = {
				limit = {
					check_variable = { SOV_anti_capitalist_target = 6 }
				}
				add_timed_idea = {
					idea = SOV_anti_capitalist_campaign_jap
					days = SOV_default_propaganda_campaign_duration
				}
			}
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 14 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_anti_capitalism_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_anti_capitalism_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_anti_fascism = { # ID = 15
		priority = 14

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 1
			modifier = {
				factor = 5
				any_enemy_country = {
					is_major = yes
					has_government = democratic
				}
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_anti_fascism_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_anti_fascism_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_anti_fascism_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			any_country = {
				has_government = fascism
				OR = {
					tag = ENG
					tag = FRA
					tag = GER
					tag = ITA
					tag = USA
					tag = JAP
				}
			}
		}

		visible = {
			OR = {
				has_completed_focus = SOV_anti_fascist_policies
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_anti_fascism_cost

		modifier = {
			opinion_gain_monthly_same_ideology_factor = 0.25
			fascism_acceptance = -100
			fascism_drift = -0.1
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 15 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
			custom_effect_tooltip = SOV_propaganda_anti_fascism_tt
			set_variable = { SOV_anti_fascist_target = 0 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
			#Choose the "most powerful" fascist country based on num of factories
			if = {
				limit = {
					ENG = { has_government = fascism }
				}
				set_temp_variable = { SOV_max_factories = ENG.num_of_factories }
				set_variable = { SOV_anti_fascist_target = 1 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
			}
			else_if = {
				limit = {
					FRA = { has_government = fascism }
				}
				set_temp_variable = { SOV_max_factories = FRA.num_of_factories }
				set_variable = { SOV_anti_fascist_target = 2 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
			}
			else_if = {
				limit = {
					GER = { has_government = fascism }
				}
				set_temp_variable = { SOV_max_factories = GER.num_of_factories }
				set_variable = { SOV_anti_fascist_target = 3 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
			}
			else_if = {
				limit = {
					ITA = { has_government = fascism }
				}
				set_temp_variable = { SOV_max_factories = ITA.num_of_factories }
				set_variable = { SOV_anti_fascist_target = 4 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
			}
			else_if = {
				limit = {
					USA = { has_government = fascism }
				}
				set_temp_variable = { SOV_max_factories = USA.num_of_factories }
				set_variable = { SOV_anti_fascist_target = 5 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
			}
			else_if = {
				limit = {
					JAP = { has_government = fascism }
				}
				set_temp_variable = { SOV_max_factories = JAP.num_of_factories }
				set_variable = { SOV_anti_fascist_target = 6 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
			}

			if = {
				limit = {
					FRA = { has_government = fascism }
				}
				set_temp_variable = { SOV_compare_factories = FRA.num_of_factories }
				if = { #FIRST Vs FRA
					limit = {
						check_variable = { SOV_max_factories < SOV_compare_factories }
					}
					set_temp_variable = { SOV_max_factories = FRA.num_of_factories }
					set_variable = { SOV_anti_fascist_target = 2 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
				}
			}

			if = {
				limit = {
					GER = { has_government = fascism }
				}
				set_temp_variable = { SOV_compare_factories = GER.num_of_factories }
				if = { #WINNER Vs GER
					limit = {
						check_variable = { SOV_max_factories < SOV_compare_factories }
					}
					set_temp_variable = { SOV_max_factories = GER.num_of_factories }
					set_variable = { SOV_anti_fascist_target = 3 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
				}
			}

			if = {
				limit = {
					ITA = { has_government = fascism }
				}
				set_temp_variable = { SOV_compare_factories = ITA.num_of_factories }
				if = { #WINNER Vs ITA
					limit = {
						check_variable = { SOV_max_factories < SOV_compare_factories }
					}
					set_temp_variable = { SOV_max_factories = ITA.num_of_factories }
					set_variable = { SOV_anti_fascist_target = 4 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
				}
			}

			if = {
				limit = {
					USA = { has_government = fascism }
				}
				set_temp_variable = { SOV_compare_factories = USA.num_of_factories }
				if = { #WINNER Vs USA
					limit = {
						check_variable = { SOV_max_factories < SOV_compare_factories }
					}
					set_temp_variable = { SOV_max_factories = USA.num_of_factories }
					set_variable = { SOV_anti_fascist_target = 5 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
				}
			}

			if = {
				limit = {
					JAP = { has_government = fascism }
				}
				set_temp_variable = { SOV_compare_factories = JAP.num_of_factories }
				if = { #WINNER Vs JAP
					limit = {
						check_variable = { SOV_max_factories < SOV_compare_factories }
					}
					set_temp_variable = { SOV_max_factories = JAP.num_of_factories }
					set_variable = { SOV_anti_fascist_target = 6 } #1=ENG / 2=FRA / 3=GER / 4=ITA / 5=USA / 6=JAP
				}
			}

			if = {
				limit = {
					check_variable = { SOV_anti_fascist_target = 1 }
				}
				add_timed_idea = {
					idea = SOV_anti_fascist_campaign_eng
					days = SOV_default_propaganda_campaign_duration
				}
			}
			else_if = {
				limit = {
					check_variable = { SOV_anti_fascist_target = 2 }
				}
				add_timed_idea = {
					idea = SOV_anti_fascist_campaign_fra
					days = SOV_default_propaganda_campaign_duration
				}
			}
			else_if = {
				limit = {
					check_variable = { SOV_anti_fascist_target = 3 }
				}
				add_timed_idea = {
					idea = SOV_anti_fascist_campaign_ger
					days = SOV_default_propaganda_campaign_duration
				}
			}
			else_if = {
				limit = {
					check_variable = { SOV_anti_fascist_target = 4 }
				}
				add_timed_idea = {
					idea = SOV_anti_fascist_campaign_ita
					days = SOV_default_propaganda_campaign_duration
				}
			}
			else_if = {
				limit = {
					check_variable = { SOV_anti_fascist_target = 5 }
				}
				add_timed_idea = {
					idea = SOV_anti_fascist_campaign_usa
					days = SOV_default_propaganda_campaign_duration
				}
			}
			else_if = {
				limit = {
					check_variable = { SOV_anti_fascist_target = 6 }
				}
				add_timed_idea = {
					idea = SOV_anti_fascist_campaign_jap
					days = SOV_default_propaganda_campaign_duration
				}
			}
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 15 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_anti_fascism_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_anti_fascism_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_treacherous_enemy = { # ID = 16
		priority = 15

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 1
			modifier = {
				factor = 5
				agency_upgrade_number > 4
			}
			modifier = {
				factor = 0
				has_intelligence_agency = no
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_treacherous_enemy_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_treacherous_enemy_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_treacherous_enemy_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes
		}

		visible = {
			OR = {
				has_completed_focus = SOV_smersh
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
			has_dlc = "La Resistance"
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_treacherous_enemy_cost

		modifier = {
			encryption = 1
			enemy_operative_detection_chance_factor = 0.75
			enemy_operative_capture_chance_factor = 0.75
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 16 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 16 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_treacherous_enemy_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_treacherous_enemy_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_do_not_blab = { # ID = 17
		priority = 16

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 1
			modifier = {
				factor = 5
				has_war = yes
			}
			modifier = {
				factor = 5
				any_enemy_country = {
					is_major = yes
				}
			}
			modifier = {
				factor = 0
				has_intelligence_agency = no
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_do_not_blab_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_do_not_blab_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_do_not_blab_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes
		}

		visible = {
			OR = {
				has_completed_focus = SOV_smersh
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_do_not_blab_cost

		modifier = {
			army_intel_to_others = -50
			navy_intel_to_others = -50
			airforce_intel_to_others = -50
			civilian_intel_to_others = -50
			foreign_subversive_activites = -0.25
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 17 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 17 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_do_not_blab_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_do_not_blab_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_sweep_scum_out = { # ID = 18
		priority = 17

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 0.5
			modifier = {
				add = 100
				has_country_flag = { flag = SOV_great_patriotic_war_flag days > 365 }
			}
			modifier = {
				factor = 0.1
				surrender_progress > 0.75
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_sweep_scum_out_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_sweep_scum_out_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_sweep_scum_out_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			has_war = yes
			any_enemy_country = {
				any_controlled_state = {
					is_core_of = ROOT
				}
			}
		}

		visible = {
			OR = {
				has_completed_focus = SOV_the_komsomol
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_sweep_scum_out_cost

		modifier = {
			army_core_attack_factor = 0.1
			army_core_defence_factor = 0.05
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 18 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 18 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_sweep_scum_out_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_sweep_scum_out_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_knowledge = { # ID = 19
		priority = 18

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 5
			modifier = {
				factor = 10
				has_war = no
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_knowledge_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_knowledge_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_knowledge_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes
		}

		visible = {
			OR = {
				has_completed_focus = SOV_the_komsomol
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_knowledge_cost

		modifier = {
			research_speed_factor = 0.05
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 19 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 19 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_knowledge_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_knowledge_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_builders_of_communism = { # ID = 20
		priority = 19

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 2
			modifier = {
				factor = 10
				has_war = no
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_builders_of_communism_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_builders_of_communism_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_builders_of_communism_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes
		}

		visible = {
			OR = {
				has_completed_focus = SOV_the_komsomol
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_builders_of_communism_cost

		modifier = {
			research_speed_factor = 0.02
			communism_drift = 0.1
			opinion_gain_monthly_same_ideology_factor = 0.25
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 20 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
			custom_effect_tooltip = SOV_propaganda_builders_of_communism_effect_tt
			if = {
				limit = {
					any_country = {
						is_subject_of = ROOT
					}
				}
				hidden_effect = {
					every_country = {
						limit = {
							is_subject_of = ROOT
						}
						country_event = NSB_soviet_propaganda_capmaign_events.1
					}
				}
			}
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 20 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_builders_of_communism_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_builders_of_communism_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_glory_to_partisans = { # ID = 21
		priority = 20

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 0.1
			modifier = {
				factor = 10
				agency_upgrade_number > 4
				any_enemy_country = {
					SOV_is_major_not_original_sov = yes
				}
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_glory_to_partisans_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_glory_to_partisans_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_glory_to_partisans_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			has_war = yes
			any_enemy_country = {
				NOT = { original_tag = SOV }
				any_controlled_state = {
					is_core_of = ROOT
				}
			}
		}

		visible = {
			OR = {
				has_completed_focus = SOV_organization_of_the_partisans
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_glory_to_partisans_cost

		modifier = {
			operation_targeted_sabotage_resources_outcome = 0.25
			operation_targeted_sabotage_infrastructure_outcome = 0.25
			operation_targeted_sabotage_industry_outcome = 0.25
			operation_make_resistance_contacts_outcome = 0.25
			operation_boost_resistance_outcome = 0.25
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 21 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 21 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_glory_to_partisans_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_glory_to_partisans_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_death_to_invaders = { # ID = 22
		priority = 21

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 1
			modifier = {
				factor = 5
				any_enemy_country = {
					SOV_is_major_not_original_sov = yes
				}
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_death_to_invaders_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_death_to_invaders_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_death_to_invaders_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			has_war = yes
			any_enemy_country = {
				NOT = { original_tag = SOV }
				any_controlled_state = {
					is_core_of = ROOT
				}
			}
		}

		visible = {
			OR = {
				has_completed_focus = SOV_organization_of_the_partisans
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_death_to_invaders_cost

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 22 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
			set_global_flag = SOV_propaganda_death_to_invaders_active_flag #This is used to dynamically add/remove the state modifier when a state is gained/lost by SOV

			if = {
				limit = {
					any_enemy_country = {
						any_controlled_state = {
							is_core_of = ROOT
						}
					}
				}
				every_enemy_country = {
					limit = {
						any_controlled_state = {
							is_core_of = ROOT
						}
					}
					every_controlled_state = {
						limit = {
							is_core_of = ROOT
						}
						add_dynamic_modifier = { modifier = SOV_invaders_must_die }
					}
				}
			}
			else = {
				custom_effect_tooltip = SOV_propaganda_death_to_invaders_no_invaders_tt
			}
			custom_effect_tooltip = SOV_propaganda_death_to_invaders_state_modifier_tt
		}

		remove_effect = {
			every_controlled_state = {
				limit = {
					has_dynamic_modifier = { modifier = SOV_invaders_must_die }
				}
				remove_dynamic_modifier = { modifier = SOV_invaders_must_die }
			}

			clr_global_flag = SOV_propaganda_death_to_invaders_active_flag

			set_variable = { SOV_propaganda_campaign_to_remove = 22 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_death_to_invaders_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_death_to_invaders_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_stalin = { # ID = 23
		priority = 22

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 5
			modifier = {
				factor = 2
				has_war = no
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_stalin_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_stalin_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_stalin_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes
		}

		visible = {
			OR = {
				has_completed_focus = SOV_stalins_cult_of_personality
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_stalin_cost

		modifier = {
			political_power_factor = 0.07
			command_power_gain_mult = 0.1
			war_support_weekly = 0.007
			communism_drift = 0.1
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 23 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 23 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_stalin_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_stalin_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_rebuild_to_glory = { # ID = 24
		priority = 23

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 3
			modifier = {
				factor = 2
				has_war = no
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_rebuild_to_glory_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_rebuild_to_glory_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_rebuild_to_glory_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes
		}

		visible = {
			OR = {
				has_completed_focus = SOV_restoration_and_development
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_rebuild_to_glory_cost

		modifier = {
			industry_repair_factor = 0.15
			production_speed_buildings_factor = 0.05
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 24 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 24 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_rebuild_to_glory_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_rebuild_to_glory_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_peace = { # ID = 25
		priority = 24

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 2
			modifier = {
				factor = 0
				any_country = {
					SOV = { is_justifying_wargoal_against = PREV }
				}
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_peace_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_peace_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_peace_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			has_war = no
			NOT = { has_country_flag = SOV_punished_for_breaking_flag }
		}

		visible = {
			OR = {
				has_completed_focus = SOV_restoration_and_development
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
			NOT = { has_country_flag = SOV_punished_for_breaking_flag }
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_peace_cost

		modifier = {
			stability_weekly = 0.005
			consumer_goods_factor = -0.12
			opinion_gain_monthly_factor = 0.25
			enemy_justify_war_goal_time = 0.50
			war_support_weekly = -0.005
			industrial_capacity_factory = -0.05
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 25 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
			set_rule = { can_send_volunteers = no }

			set_country_flag = SOV_propaganda_peace_active_flag
		}

		remove_effect = {
			set_rule = { can_send_volunteers = yes }

			clr_country_flag = SOV_propaganda_peace_active_flag

			set_variable = { SOV_propaganda_campaign_to_remove = 25 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_peace_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_peace_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}

	SOV_propaganda_happy_life = { # ID = 26
		priority = 25

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 3
			modifier = {
				factor = 2
				has_war = no
			}
			modifier = {
				factor = 10
				has_stability < 0.4
			}
			modifier = {
				factor = 10
				has_stability < 0.2
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_happy_life_cost > 30 } #Less likely to do it a third time
			}
			modifier = {
				factor = 0.1
				check_variable = { SOV_propaganda_happy_life_cost > 45 } #Even less likely to do it a fourth time
			}
			modifier = {
				factor = 0
				check_variable = { SOV_propaganda_happy_life_cost > 90 } #Shouldn't even considered doing it a fifth time
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SOV_propaganda_poster_slot_available = yes

			surrender_progress < 0.01
		}

		visible = {
			OR = {
				has_completed_focus = SOV_restoration_and_development
				has_country_flag = SOV_debug_unlock_propaganda_campaigns_flag #debug
			}
		}

		days_remove = SOV_default_propaganda_campaign_duration

		days_re_enable = SOV_default_propaganda_campaign_cooldown

		cost = SOV_propaganda_happy_life_cost

		modifier = {
			stability_weekly = 0.01
			compliance_growth = 0.05
			resistance_decay = 0.05
			resistance_damage_to_garrison = 0.15
			consumer_goods_factor = 0.06
		}

		complete_effect = {
			set_variable = { SOV_new_propaganda_campaign = 26 }
			SOV_pick_propaganda_campaign_slot_effect = yes
			SOV_achievement_propaganda_counter_effect = yes
		}

		remove_effect = {
			set_variable = { SOV_propaganda_campaign_to_remove = 26 }
			SOV_reset_propaganda_campaign_slot_effect = yes

			set_variable = { SOV_propaganda_cost = SOV_propaganda_happy_life_cost }
			SOV_increase_propaganda_campaign_cost_effect = yes
			set_variable = { SOV_propaganda_happy_life_cost = SOV_propaganda_cost }
			clear_variable = SOV_propaganda_cost

			custom_effect_tooltip = SOV_propaganda_campaign_cooldown_tt
		}
	}
}



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



SOV_gosproyektstroy_decision_category = {
	SOV_gosproyektstroy_bring_foreign_experts = {
		priority = 50

		icon = hol_attract_foreign_investors

		ai_will_do = {
			base = 10
		}

		targets = { USA ENG GER JAP }

		#target_trigger = {
		#	FROM = { SOV_is_valid_subject = yes }
		#}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_idea = SOV_gosproyektstroy_1
			NOT = { has_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag }
			FROM = {
				has_opinion = {
					target = ROOT
					value > 29
				}
				SOV_is_valid_subject = yes
				NOT = { has_war_with = ROOT }
			}
		}

		days_remove = SOV_gosproyektstroy_decision_time

		fire_only_once = yes

		visible = {
			has_idea = SOV_gosproyektstroy_1
			NOT = { has_country_flag = SOV_gosproyektstroy_level_2_flag }
			NOT = { has_country_flag = SOV_gosproyektstroy_level_3_flag }
			country_exists = FROM
			NOT = { has_war_with = FROM }
			FROM = { SOV_is_valid_subject = yes }
		}

		cost = SOV_gosproyektstroy_decision_cost

		modifier = {
			civilian_factory_use = 3
		}

		complete_effect = {
			set_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag
		}

		remove_effect = {
			if = {
				limit = {
					FROM = { tag = USA }
				}
				set_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 1 } #USA
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_1
					add_idea = SOV_gosproyektstroy_2_usa
				}
			}
			else_if = {
				limit = {
					FROM = { tag = ENG }
				}
				set_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 2 } #ENG
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_1
					add_idea = SOV_gosproyektstroy_2_eng
				}
			}
			else_if = {
				limit = {
					FROM = { tag = GER }
				}
				set_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 3 } #GER
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_1
					add_idea = SOV_gosproyektstroy_2_ger
				}
			}
			else_if = {
				limit = {
					FROM = { tag = JAP }
				}
				set_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 4 } #JAP
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_1
					add_idea = SOV_gosproyektstroy_2_jap
				}
			}

			clr_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag
		}
	}

	SOV_gosproyektstroy_focus_civ = {
		priority = 13

		icon = generic_construction

		ai_will_do = {
			base = 0.75
			modifier = {
				factor = 0
				OR = {
					has_war = yes
					any_other_country = {
						OR ={
							is_justifying_wargoal_against = ROOT
							ROOT = { is_justifying_wargoal_against = PREV }
						}
					}
				}
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			OR = {
				has_idea = SOV_gosproyektstroy_2_usa #Done like this for tooltip purposes
				hidden_trigger = {
					OR = {
						has_idea = SOV_gosproyektstroy_2_eng
						has_idea = SOV_gosproyektstroy_2_ger
						has_idea = SOV_gosproyektstroy_2_jap
					}
				}
			}
			NOT = { has_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag }
		}

		days_remove = SOV_gosproyektstroy_decision_time

		fire_only_once = yes

		visible = {
			OR = {
				has_idea = SOV_gosproyektstroy_2_usa
				has_idea = SOV_gosproyektstroy_2_eng
				has_idea = SOV_gosproyektstroy_2_ger
				has_idea = SOV_gosproyektstroy_2_jap
			}
			NOT = { has_country_flag = SOV_gosproyektstroy_level_3_flag }
		}

		cost = SOV_gosproyektstroy_decision_cost

		modifier = {
			civilian_factory_use = 3
		}

		complete_effect = {
			set_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag
		}

		remove_effect = {
			set_country_flag = { flag = SOV_gosproyektstroy_level_3_flag value = 1 } #CIV
			if = {
				limit = {
					has_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 1 } #USA
				}
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_2_usa
					add_idea = SOV_gosproyektstroy_3_usa_civ
				}
			}
			else_if = {
				limit = {
					has_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 2 } #ENG
				}
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_2_eng
					add_idea = SOV_gosproyektstroy_3_eng_civ
				}
			}
			else_if = {
				limit = {
					has_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 3 } #GER
				}
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_2_ger
					add_idea = SOV_gosproyektstroy_3_ger_civ
				}
			}
			else_if = {
				limit = {
					has_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 4 } #JAP
				}
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_2_jap
					add_idea = SOV_gosproyektstroy_3_jap_civ
				}
			}

			clr_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag
		}
	}

	SOV_gosproyektstroy_focus_mil = {
		priority = 12

		icon = generic_industry

		ai_will_do = {
			base = 1
			modifier = {
				factor = 5
				OR = {
					has_war = yes
					any_other_country = {
						OR ={
							is_justifying_wargoal_against = ROOT
							ROOT = { is_justifying_wargoal_against = PREV }
						}
					}
				}
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			OR = {
				has_idea = SOV_gosproyektstroy_2_usa #Done like this for tooltip purposes
				hidden_trigger = {
					OR = {
						has_idea = SOV_gosproyektstroy_2_eng
						has_idea = SOV_gosproyektstroy_2_ger
						has_idea = SOV_gosproyektstroy_2_jap
					}
				}
			}
			NOT = { has_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag }
		}

		days_remove = SOV_gosproyektstroy_decision_time

		fire_only_once = yes

		visible = {
			OR = {
				has_idea = SOV_gosproyektstroy_2_usa
				has_idea = SOV_gosproyektstroy_2_eng
				has_idea = SOV_gosproyektstroy_2_ger
				has_idea = SOV_gosproyektstroy_2_jap
			}
			NOT = { has_country_flag = SOV_gosproyektstroy_level_3_flag }
		}

		cost = SOV_gosproyektstroy_decision_cost

		modifier = {
			civilian_factory_use = 3
		}

		complete_effect = {
			set_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag
		}

		remove_effect = {
			set_country_flag = { flag = SOV_gosproyektstroy_level_3_flag value = 2 } #MIL
			if = {
				limit = {
					has_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 1 } #USA
				}
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_2_usa
					add_idea = SOV_gosproyektstroy_3_usa_mil
				}
			}
			else_if = {
				limit = {
					has_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 2 } #ENG
				}
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_2_eng
					add_idea = SOV_gosproyektstroy_3_eng_mil
				}
			}
			else_if = {
				limit = {
					has_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 3 } #GER
				}
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_2_ger
					add_idea = SOV_gosproyektstroy_3_ger_mil
				}
			}
			else_if = {
				limit = {
					has_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 4 } #JAP
				}
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_2_jap
					add_idea = SOV_gosproyektstroy_3_jap_mil
				}
			}

			clr_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag
		}
	}

	SOV_gosproyektstroy_focus_dock = {
		priority = 11

		icon = GFX_decision_generic_naval

		ai_will_do = {
			base = 0.5
			modifier = {
				factor = 2
				has_completed_focus = SOV_pc_of_the_ussr_navy
				has_completed_focus = SOV_expand_shipbuilding_plants
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			OR = {
				has_idea = SOV_gosproyektstroy_2_usa #Done like this for tooltip purposes
				hidden_trigger = {
					OR = {
						has_idea = SOV_gosproyektstroy_2_eng
						has_idea = SOV_gosproyektstroy_2_ger
						has_idea = SOV_gosproyektstroy_2_jap
					}
				}
			}
			NOT = { has_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag }
		}

		days_remove = SOV_gosproyektstroy_decision_time

		fire_only_once = yes

		visible = {
			OR = {
				has_idea = SOV_gosproyektstroy_2_usa
				has_idea = SOV_gosproyektstroy_2_eng
				has_idea = SOV_gosproyektstroy_2_ger
				has_idea = SOV_gosproyektstroy_2_jap
			}
			NOT = { has_country_flag = SOV_gosproyektstroy_level_3_flag }
		}

		cost = SOV_gosproyektstroy_decision_cost

		modifier = {
			civilian_factory_use = 3
		}

		complete_effect = {
			set_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag
		}

		remove_effect = {
			set_country_flag = { flag = SOV_gosproyektstroy_level_3_flag value = 3 } #DOCK
			if = {
				limit = {
					has_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 1 } #USA
				}
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_2_usa
					add_idea = SOV_gosproyektstroy_3_usa_dock
				}
			}
			else_if = {
				limit = {
					has_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 2 } #ENG
				}
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_2_eng
					add_idea = SOV_gosproyektstroy_3_eng_dock
				}
			}
			else_if = {
				limit = {
					has_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 3 } #GER
				}
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_2_ger
					add_idea = SOV_gosproyektstroy_3_ger_dock
				}
			}
			else_if = {
				limit = {
					has_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 4 } #JAP
				}
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_2_jap
					add_idea = SOV_gosproyektstroy_3_jap_dock
				}
			}

			clr_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag
		}
	}
}



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


###############################
### COVERT SUPPORT FOR POUM ###
###############################

SOV_soviet_aid_to_poum_decision_category = {
	SOV_organize_covert_depots_poum = { #DECISION AVAILABLE PRIOR TO THE POUM SPLIT
		priority = 50

		icon = ger_military_buildup

		ai_will_do = {
			base = 30
			modifier = {
				factor = 0.01
				has_war = yes
				command_power < 50
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_global_flag = spanish_civil_war
		}

		visible = {
			NOT = { has_global_flag = SPR_anarchist_uprising_flag }
			NOT = { has_global_flag = scw_over }
			is_subject = no
		}

		cancel_if_not_visible = yes

		fire_only_once = yes

		days_remove = SOV_default_poum_days

		custom_cost_trigger = {
			command_power > 74
		}
		custom_cost_text = decision_cost_CP_75

		complete_effect = {
			hidden_effect = {
				add_command_power = -75
			}
		}

		remove_effect = {
			set_global_flag = SOV_poum_has_covert_depots_from_soviets_flag
			effect_tooltip = {
				custom_effect_tooltip = SOV_organize_covert_depots_poum_tt
				SPC = {
					add_equipment_to_stockpile = {
						type = infantry_equipment
						amount = 6000
						producer = ROOT
					}
					add_equipment_to_stockpile = {
						type = support_equipment
						amount = 600
						producer = ROOT
					}
					add_equipment_to_stockpile = {
						type = artillery_equipment
						amount = 120
						producer = ROOT
					}
					add_equipment_to_stockpile = {
						type = motorized_equipment
						amount = 60
						producer = ROOT
					}
					add_equipment_to_stockpile = {
						type = train_equipment
						amount = 6
						producer = ROOT
					}
					add_opinion_modifier = {
						target = ROOT
						modifier = SOV_sent_us_weapons
					}
				}
			}
			custom_effect_tooltip = decision_only_once_tt
		}
	}

	SOV_send_infantry_equipment_poum = {
		priority = 50

		icon = generic_industry

		ai_will_do = {
			base = 1.2
			modifier = {
				factor = 0.1
				has_war = yes
				has_equipment = { infantry_equipment < 10000 }
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			SPR_scw_in_progress = yes
			country_exists = SPC
			SPC = { has_completed_focus = SPR_the_anti_fascist_workers_revolution }
			NOT = { has_war_with = SPC }
		}

		days_remove = SOV_default_poum_days

		days_re_enable = SOV_default_poum_cd

		custom_cost_trigger = {
			command_power > 24
		}
		custom_cost_text = decision_cost_CP_25

		complete_effect = {
			hidden_effect = {
				add_command_power = -25
			}
		}

		remove_effect = {
			effect_tooltip = {
				SPC = {
					add_equipment_to_stockpile = {
						type = infantry_equipment
						amount = 6000
						producer = FROM
					}
					add_opinion_modifier = {
						target = ROOT
						modifier = SOV_sent_us_weapons
					}
				}
			}
			hidden_effect = {
				SPC = {
					country_event = { id = NSB_soviet_foreign_politics_events.250 hours = 2 }
					add_ai_strategy = {
						type = befriend
						id = SOV
						value = 5
					}
				}
			}
			custom_effect_tooltip = SOV_default_poum_cd_tt
		}
	}

	SOV_organize_popular_brigades_poum = {
		priority = 50

		icon = generic_nationalism

		ai_will_do = {
			base = 1.2
		}

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			SPR_scw_in_progress = yes
			country_exists = SPC
			SPC = { has_completed_focus = SPR_the_anti_fascist_workers_revolution }
			NOT = { has_war_with = SPC }
		}

		days_remove = SOV_default_poum_days

		days_re_enable = SOV_default_poum_cd

		ai_hint_pp_cost = 25
		custom_cost_trigger = {
			command_power > 24
			has_political_power > 24
		}
		custom_cost_text = decision_cost_CP_25_pp_25

		complete_effect = {
			hidden_effect = {
				add_command_power = -25
				add_political_power = -25
			}
		}

		remove_effect = {
			effect_tooltip = {
				SPC ={
					division_template = {
						name = "International Marxist Brigades"
						is_locked = yes
						priority = 1
						regiments = {
							infantry = { x = 0 y = 0 }
							infantry = { x = 0 y = 1 }
							infantry = { x = 1 y = 0 }
							infantry = { x = 1 y = 1 }
						}
					}
					capital_scope = {
						create_unit = {
							division = "name = \"International Marxist Brigade\" division_template = \"International Marxist Brigades\" start_experience_factor = 0.1 start_equipment_factor = 1.0" owner = SPC count = 6
						}
					}
				}
			}
			hidden_effect = {
				SPC = {
					country_event = { id = NSB_soviet_spanish_civil_war.2 hours = 1 }
					add_ai_strategy = {
						type = befriend
						id = SOV
						value = 5
					}
				}
			}
			custom_effect_tooltip = SOV_default_poum_cd_tt
		}
	}

	SOV_send_elite_commandos_poum = {
		priority = 50

		icon = generic_military

		ai_will_do = {
			base = 1.2
		}

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			SPR_scw_in_progress = yes
			country_exists = SPC
			SPC = { has_completed_focus = SPR_the_anti_fascist_workers_revolution }
			NOT = { has_war_with = SPC }
		}

		days_remove = SOV_default_poum_days

		days_re_enable = SOV_long_poum_cd

		custom_cost_trigger = {
			command_power > 49
		}
		custom_cost_text = decision_cost_CP_50

		complete_effect = {
			hidden_effect = {
				add_command_power = -50
			}
		}

		remove_effect = {
			effect_tooltip = {
				SPC ={
					add_timed_idea = {
						idea = SOV_soviet_commandos_poum
						days = 180
					}
					division_template = {
						name = "Soviet Special Brigades"
						is_locked = yes
						priority = 1
						regiments = {
							infantry = { x = 0 y = 0 }
							infantry = { x = 0 y = 1 }
							infantry = { x = 0 y = 2 }
							infantry = { x = 1 y = 0 }
							infantry = { x = 1 y = 1 }
							infantry = { x = 1 y = 2 }
						}
						support = {
							engineer = { x = 0 y = 0 }
							recon = { x = 0 y = 1 }
							artillery = { x = 0 y = 2 }
							anti_tank = { x = 0 y = 3 }
						}
					}
					capital_scope = {
						create_unit = {
							division = "name = \"Soviet Special Brigade\" division_template = \"Soviet Special Brigades\" start_experience_factor = 0.7 start_equipment_factor = 1.0" owner = SPC count = 2
						}
					}
				}
			}
			hidden_effect = {
				SPC = {
					country_event = { id = NSB_soviet_spanish_civil_war.3 hours = 1 }
					add_ai_strategy = {
						type = befriend
						id = SOV
						value = 5
					}
				}
				if = {
					limit = {
						NOT = { has_country_flag = SOV_send_elite_commandos_poum_flag }
					}
					set_country_flag = SOV_send_elite_commandos_poum_flag
				}
			}
			custom_effect_tooltip = SOV_long_poum_cd_tt
		}
	}

	SOV_organize_popular_speeches_poum = {
		priority = 50

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 1.2
		}

		allowed = {
			original_tag = SOV
		}

		available = {
		}

		visible = {
			SPR_scw_in_progress = yes
			country_exists = SPC
			SPC = { has_completed_focus = SPR_the_anti_fascist_workers_revolution }
			NOT = { has_war_with = SPC }
		}

		days_remove = SOV_default_poum_days

		days_re_enable = SOV_default_poum_cd

		cost = 25

		remove_effect = {
			effect_tooltip = {
				SPC ={
					add_timed_idea = {
						idea = SOV_popular_speeches_poum
						days = 180
					}
					division_template = {
						name = "International Marxist Brigades"
						is_locked = yes
						priority = 1
						regiments = {
							infantry = { x = 0 y = 0 }
							infantry = { x = 0 y = 1 }
							infantry = { x = 1 y = 0 }
							infantry = { x = 1 y = 1 }
						}
					}
					capital_scope = {
						create_unit = {
							division = "name = \"International Marxist Brigade\" division_template = \"International Marxist Brigades\" start_experience_factor = 0.1 start_equipment_factor = 1.0" owner = SPC count = 2
						}
					}
				}
			}
			hidden_effect = {
				SPC = {
					country_event = { id = NSB_soviet_spanish_civil_war.4 hours = 1 }
					add_ai_strategy = {
						type = befriend
						id = SOV
						value = 5
					}
				}
			}
			custom_effect_tooltip = SOV_default_poum_cd_tt
		}
	}

	SOV_infiltrate_stalinist_plans_in_spain_poum = {
		priority = 50

		icon = eng_propaganda_campaigns

		ai_will_do = {
			base = 1.2
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_completed_focus = SOV_send_military_advisors_to_spain
			NOT = { has_completed_focus = SOV_coup_detat }
			has_country_flag = SOV_send_elite_commandos_poum_flag
		}

		visible = {
			SPR_scw_in_progress = yes
			country_exists = SPC
			country_exists = SPD
			NOT = { has_completed_focus = SOV_coup_detat }
			SPC = { has_completed_focus = SPR_the_anti_fascist_workers_revolution }
			NOT = { has_war_with = SPC }
			NOT = { is_in_faction_with = SPD }
		}

		cancel_if_not_visible = yes

		days_remove = SOV_default_poum_days

		fire_only_once = yes

		ai_hint_pp_cost = 15
		custom_cost_trigger = {
			command_power > 49
			has_political_power > 14
		}
		custom_cost_text = decision_cost_CP_50_pp_15

		complete_effect = {
			hidden_effect = {
				add_command_power = -50
				add_political_power = -15
			}
		}

		remove_effect = {
			effect_tooltip = {
				SPC ={
					add_timed_idea = {
						idea = SOV_agents_in_the_stalinist_command_poum
						days = 365
					}
				}
			}
			hidden_effect = {
				SPC = {
					country_event = { id = NSB_soviet_spanish_civil_war.5 hours = 1 }
					add_ai_strategy = {
						type = befriend
						id = SOV
						value = 5
					}
				}
			}
			custom_effect_tooltip = decision_only_once_tt
		}
	}
}



##############
### BALTIC ###
##############

SOV_diplomacy_baltic_decision_category = {
	SOV_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 = SOV_ideological_rallies_promoted_flag }
			}
			modifier = { #Do it only once, don't spam
				factor = 0
				FROM = { has_country_flag = SOV_government_pressured_flag }
			}
		}

		targets = {	EST LAT LIT	}

		target_trigger = {
			SOV_basic_pressure_government_triggers = yes
		}

		target_root_trigger = {
			has_completed_focus = SOV_respect_baltic_self_determination
			is_subject = no
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			is_faction_leader = yes
			FROM = {
				has_opinion = {
					target = ROOT
					value > 49
				}
				#SOV_is_valid_subject = yes # The Soviet Union might not give a sh*t about their petty overlord ;) # -> THE USSR does indeed not care about their petty overlord, for now.
				NOT = { has_war_with = ROOT }
			}
			NOT = { has_country_flag = SOV_pressure_government_active_flag }
		}

		days_remove = SOV_pressure_government_days

		days_re_enable = SOV_pressure_government_cd

		cost = SOV_pressure_country_government_cost

		modifier = {
			political_power_gain = -0.25
		}

		complete_effect = {
			set_country_flag = SOV_pressure_government_active_flag
		}

		remove_effect = {
			FROM = {
				country_event = { id = NSB_soviet_foreign_politics_events.1 hours = 4 random_hours = 2 }
				set_country_flag = SOV_government_pressured_flag #For AI weights - don't spam
			}
			clr_country_flag = SOV_pressure_government_active_flag
			custom_effect_tooltip = SOV_pressure_government_effects_tt
			custom_effect_tooltip = SOV_pressure_government_cd_tt
		}
	}

	SOV_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 }

		target_trigger = {
			SOV_basic_promote_rallies_triggers = yes
		}

		target_root_trigger = {
			has_completed_focus = SOV_respect_baltic_self_determination
			is_subject = no
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			FROM = {
				#SOV_is_valid_subject = yes # The Soviet Union might not give a sh*t about their petty overlord ;) # -> THE USSR does indeed not care about their petty overlord, for now.
				NOT = { has_war_with = ROOT }
			}
		}

		days_remove = SOV_ideological_rallies_days

		fire_only_once = yes

		cost = SOV_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 }
				set_country_flag = SOV_ideological_rallies_promoted_flag 
			}
			custom_effect_tooltip = SOV_promote_rallies_effects_tt
			custom_effect_tooltip = SOV_promote_ideological_rallies_cd_tt
		}
	}

	SOV_send_ultimatum_to_baltic_countries = {
		priority = 50

		icon = eng_trade_unions_demand

		ai_will_do = {
			base = 400
			modifier = {
				factor = 10
				has_political_power > 100
			}
			modifier = {
				factor = 10
				date > 1940.6.1
			}
			modifier = {
				factor = 0
				surrender_progress > 0.15
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			any_other_country = {
				OR = {
					original_tag = EST
					original_tag = LAT
					original_tag = LIT
				}
				NOT = { has_war_with = ROOT }
				is_subject = no
			}
		}

		visible = {
			has_completed_focus = SOV_claims_in_baltic
		}

		days_remove = SOV_ultimatum_days

		cost = SOV_send_ultimatum_to_country_cost

		remove_effect = {
			every_other_country = {
				limit = {
					OR = {
						original_tag = EST
						original_tag = LAT
						original_tag = LIT
					}
					NOT = { has_war_with = ROOT }		#from scripted triggers
					NOT = { is_in_faction_with = ROOT } #CAN'T SEND ULTIMATUMS TO ALLIES OR SUBJECTS
					#OR = { #Can send Ultimatum to non-allies or puppets (but not to faction allies)
					#	NOT = { is_in_faction_with = ROOT }
					#	is_Subject_of = ROOT
					#}
					NOT = { has_country_flag = SOV_ultimatum_sent_flag }
				}
				set_country_flag = SOV_ultimatum_sent_flag
				if = {
					limit = {
						original_tag = EST
					}
					country_event = { id = baltic.1 hours = 16 random_hours = 8 }
				}
				if = {
					limit = {
						original_tag = LAT
					}
					country_event = { id = baltic.2 hours = 16 random_hours = 8 }
				}
				if = {
					limit = {
						original_tag = LIT
					}
					country_event = { id = baltic.3 hours = 16 random_hours = 8 }
				}
			}
			custom_effect_tooltip = SOV_ultimatum_baltic_effects_tt

			custom_effect_tooltip = SOV_decision_will_be_locked_tt
		}
	}

	SOV_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
				NOT = { #Join if it will not lead to a new war against a major
					any_country = {
						is_major = yes
						has_war_with = FROM
						NOT = { 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 }

		target_trigger = {
			SOV_basic_fight_alongside_comrades_triggers = yes
		}

		target_root_trigger = {
			has_completed_focus = SOV_baltic_security
			is_subject = no
		}

		allowed = {
			original_tag = SOV
		}

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

		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
					}
				}
			}
		}
	}
}


##############
### NORDIC ###
##############

SOV_diplomacy_nordic_decision_category = {
	SOV_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 = SOV_ideological_rallies_promoted_flag }
			}
			modifier = { #Do it only once, don't spam
				factor = 0
				FROM = { has_country_flag = SOV_government_pressured_flag }
			}
		}

		targets = { FIN SWE NOR DEN KAR } #All Continental Nordic Countries

		target_trigger = {
			SOV_basic_pressure_government_triggers = yes
		}

		target_root_trigger = {
			has_completed_focus = SOV_control_scandinavia
			is_subject = no
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			is_faction_leader = yes
			FROM = {
				has_opinion = {
					target = ROOT
					value > 49
				}
				#SOV_is_valid_subject = yes # The Soviet Union might not give a sh*t about their petty overlord ;) # -> THE USSR does indeed not care about their petty overlord, for now.
				NOT = { has_war_with = ROOT }
			}
			NOT = { has_country_flag = SOV_pressure_government_active_flag }
		}

		days_remove = SOV_pressure_government_days

		days_re_enable = SOV_pressure_government_cd

		cost = SOV_pressure_country_government_cost

		modifier = {
			political_power_gain = -0.25
		}

		complete_effect = {
			set_country_flag = SOV_pressure_government_active_flag
		}

		remove_effect = {
			FROM = {
				country_event = { id = NSB_soviet_foreign_politics_events.1 hours = 4 random_hours = 2 }
				set_country_flag = SOV_government_pressured_flag #For AI weights - don't spam
			}
			clr_country_flag = SOV_pressure_government_active_flag
			custom_effect_tooltip = SOV_pressure_government_effects_tt
			custom_effect_tooltip = SOV_pressure_government_cd_tt
		}
	}

	SOV_promote_ideology_rallies_nordic = {
		priority = 50

		icon = generic_political_rally

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

		targets = { FIN SWE NOR DEN KAR } #All Continental Nordic Countries

		target_trigger = {
			SOV_basic_promote_rallies_triggers = yes
		}

		target_root_trigger = {
			has_completed_focus = SOV_control_scandinavia
			is_subject = no
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			FROM = {
				#SOV_is_valid_subject = yes # The Soviet Union might not give a sh*t about their petty overlord ;) # -> THE USSR does indeed not care about their petty overlord, for now.
				NOT = { has_war_with = ROOT }
			}
		}

		days_remove = SOV_ideological_rallies_days

		fire_only_once = yes

		cost = SOV_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
		}
	}

	SOV_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
				NOT = { #Join if it will not lead to a new war against a major
					any_country = {
						is_major = yes
						has_war_with = FROM
						NOT = { 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 = { FIN SWE NOR DEN }

		target_trigger = {
			SOV_basic_fight_alongside_comrades_triggers = yes
		}

		target_root_trigger = {
			has_completed_focus = SOV_control_scandinavia
			is_subject = no
		}

		allowed = {
			original_tag = SOV
		}

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

		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
					}
				}
			}
		}
	}
}


##############
### BALKAN ###
##############

SOV_diplomacy_balkan_decision_category = {
	SOV_pressure_country_government_balkan = {
		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 = SOV_ideological_rallies_promoted_flag }
			}
			modifier = { #Do it only once, don't spam
				factor = 0
				FROM = { has_country_flag = SOV_government_pressured_flag }
			}
		}

		targets = { BUL GRE YUG ALB ROM TUR SLV BOS HRZ MAC SER CRO KOS MNT TRA } #These are all tags included in scripted trigger "BUL_is_balkan_nation = yes"

		target_trigger = {
			SOV_basic_pressure_government_triggers = yes
		}

		target_root_trigger = {
			has_completed_focus = SOV_seek_balkan_cooperation
			is_subject = no
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			is_faction_leader = yes
			FROM = {
				has_opinion = {
					target = ROOT
					value > 49
				}
				SOV_is_valid_subject = yes# The Soviet Union might not give a sh*t about their petty overlord ;)
				NOT = { has_war_with = ROOT }
			}
			NOT = { has_country_flag = SOV_pressure_government_active_flag }
		}

		days_remove = SOV_pressure_government_days

		days_re_enable = SOV_pressure_government_cd

		cost = SOV_pressure_country_government_cost

		modifier = {
			political_power_gain = -0.25
		}

		complete_effect = {
			set_country_flag = SOV_pressure_government_active_flag
		}

		remove_effect = {
			FROM = {
				country_event = { id = NSB_soviet_foreign_politics_events.1 hours = 4 random_hours = 2 }
				set_country_flag = SOV_government_pressured_flag #For AI weights - don't spam
			}
			clr_country_flag = SOV_pressure_government_active_flag
			custom_effect_tooltip = SOV_pressure_government_effects_tt
			custom_effect_tooltip = SOV_pressure_government_cd_tt
		}
	}

	SOV_promote_ideology_rallies_balkan = {
		priority = 50

		icon = generic_political_rally

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

		targets = { BUL GRE YUG ALB ROM TUR SLV BOS HRZ MAC SER CRO KOS MNT TRA } #These are all tags included in scripted trigger "BUL_is_balkan_nation = yes"

		target_trigger = {
			SOV_basic_promote_rallies_triggers = yes
		}

		target_root_trigger = {
			has_completed_focus = SOV_seek_balkan_cooperation
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			FROM = {
				SOV_is_valid_subject = yes # The Soviet Union might not give a sh*t about their petty overlord ;)
				NOT = { has_war_with = ROOT }
			}
		}

		days_remove = SOV_ideological_rallies_days

		fire_only_once = yes

		cost = SOV_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
		}
	}

	SOV_send_ultimatum_to_country_balkan = {
		priority = 50

		icon = eng_trade_unions_demand

		ai_will_do = {
			base = 20
			modifier = {
				factor = 10
				has_political_power > 160
			}
			modifier = {
				factor = 10
				date > 1940.6.1
			}
			modifier = {
				factor = 0
				is_in_faction_with = FROM
			}
		}

		targets = { BUL GRE YUG ALB ROM TUR SLV BOS HRZ MAC SER CRO KOS MNT TRA } #These are all tags included in scripted trigger "BUL_is_balkan_nation = yes"

		target_trigger = {
			SOV_basic_ultimatum_triggers = yes
		}

		target_root_trigger = {
			has_completed_focus = SOV_demand_balkan_submission
			is_Subject = no
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			FROM = {
				NOT = { has_war_with = ROOT }
				is_subject = no
			}
		}

		cost = SOV_send_ultimatum_to_country_cost

		days_remove = SOV_ultimatum_days

		remove_effect = {
			FROM = {
				set_country_flag = SOV_ultimatum_sent_flag
				country_event = { id = NSB_soviet_foreign_politics_events.200 hours = 16 random_hours = 8 }
			}
			custom_effect_tooltip = SOV_ultimatum_generic_effects_tt
			custom_effect_tooltip = SOV_decision_will_be_locked_tt
		}
	}

	SOV_fight_alongside_country_comrades_balkan = {
		priority = 100

		icon = generic_prepare_civil_war

		ai_will_do = {
			base = 0
			modifier = {
				add = 0.01
				has_stability > 0.4
				NOT = { #Join if it will not lead to a new war against a major
					any_country = {
						is_major = yes
						has_war_with = FROM
						NOT = { 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 = { BUL GRE YUG ALB ROM TUR SLV BOS HRZ MAC SER CRO KOS MNT TRA } #These are all tags included in scripted trigger "BUL_is_balkan_nation = yes"

		target_trigger = {
			SOV_basic_fight_alongside_comrades_triggers = yes
		}

		target_root_trigger = {
			has_completed_focus = SOV_seek_balkan_cooperation
			is_subject = no
		}

		allowed = {
			original_tag = SOV
		}

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

		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
					}
				}
			}
		}
	}
}


###################
### MIDDLE EAST ###
###################

SOV_diplomacy_middle_east_decision_category = {
	SOV_pressure_country_government_middle_east = {
		priority = 50

		icon = hol_attract_foreign_investors

		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 = SOV_ideological_rallies_promoted_flag }
			}
			modifier = { #Do it only once, don't spam
				factor = 0
				FROM = { has_country_flag = SOV_government_pressured_flag }
			}
		}

		targets = { AFG SAU }

		target_trigger = {
			SOV_basic_pressure_government_triggers = yes
			OR = {
				AND = { #AFG
					FROM = { tag = AFG }
					has_completed_focus = SOV_support_afghan_ideology
				}
				AND = { #SAU
					FROM = { tag = SAU }
					has_completed_focus = SOV_the_khakimov_proposal
				}
			}
		}

		target_root_trigger = {
			OR = {
				has_completed_focus = SOV_support_afghan_ideology
				has_completed_focus = SOV_the_khakimov_proposal
			}
			is_subject = no
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			is_faction_leader = yes
			FROM = {
				has_opinion = {
					target = ROOT
					value > 49
				}
				#SOV_is_valid_subject = yes # The Soviet Union might not give a sh*t about their petty overlord ;) # -> THE USSR does indeed not care about their petty overlord, for now.
				NOT = { has_war_with = ROOT }
			}
			NOT = { has_country_flag = SOV_pressure_government_active_flag }
		}

		days_remove = SOV_pressure_government_days

		days_re_enable = SOV_pressure_government_cd

		cost = SOV_pressure_country_government_cost

		modifier = {
			political_power_gain = -0.25
		}

		complete_effect = {
			set_country_flag = SOV_pressure_government_active_flag
		}

		remove_effect = {
			FROM = {
				country_event = { id = NSB_soviet_foreign_politics_events.1 hours = 4 random_hours = 2 }
				set_country_flag = SOV_government_pressured_flag #For AI weights - don't spam
			}
			clr_country_flag = SOV_pressure_government_active_flag
			custom_effect_tooltip = SOV_pressure_government_effects_tt
			custom_effect_tooltip = SOV_pressure_government_cd_tt
		}
	}

	SOV_promote_ideology_rallies_middle_east = {
		priority = 50

		icon = hol_attract_foreign_investors

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

		targets = { AFG SAU }

		target_trigger = {
			SOV_basic_promote_rallies_triggers = yes
			OR = {
				AND = { #AFG
					FROM = { tag = AFG }
					has_completed_focus = SOV_support_afghan_ideology
				}
				AND = { #SAU
					FROM = { tag = SAU }
					has_completed_focus = SOV_the_khakimov_proposal
				}
			}
		}

		target_root_trigger = {
			OR = {
				has_completed_focus = SOV_support_afghan_ideology
				has_completed_focus = SOV_the_khakimov_proposal
			}
			is_subject = no
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			FROM = {
				#SOV_is_valid_subject = yes # The Soviet Union might not give a sh*t about their petty overlord ;) # -> THE USSR does indeed not care about their petty overlord, for now.
				NOT = { has_war_with = ROOT }
			}
		}

		days_remove = SOV_ideological_rallies_days

		fire_only_once = yes

		cost = SOV_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
		}
	}

	SOV_send_ultimatum_to_country_middle_east = {
		priority = 50

		icon = hol_attract_foreign_investors

		ai_will_do = {
			base = 20
			modifier = {
				factor = 10
				has_political_power > 160
			}
			modifier = {
				factor = 10
				date > 1940.6.1
			}
			modifier = {
				factor = 0
				is_in_faction_with = FROM
			}
		}

		targets = { PER }

		target_trigger = {
			SOV_basic_ultimatum_triggers = yes
		}

		target_root_trigger = {
			has_completed_focus = SOV_preemptive_invasion_of_iran
			is_Subject = no
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			FROM = {
				NOT = { has_war_with = ROOT }
				is_subject = no
			}
		}

		days_remove = SOV_ultimatum_days

		cost = SOV_send_ultimatum_to_country_cost

		remove_effect = {
			FROM = {
				set_country_flag = SOV_ultimatum_sent_flag
				country_event = { id = NSB_soviet_foreign_politics_events.210 hours = 16 random_hours = 8 }
			}
			custom_effect_tooltip = SOV_ultimatum_generic_effects_tt
			custom_effect_tooltip = SOV_decision_will_be_locked_tt
		}
	}

	SOV_fight_alongside_country_comrades_middle_east = {
		priority = 100

		icon = generic_prepare_civil_war

		ai_will_do = {
			base = 0
			modifier = {
				add = 0.01
				has_stability > 0.4
				NOT = { #Join if it will not lead to a new war against a major
					any_country = {
						is_major = yes
						has_war_with = FROM
						NOT = { 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 = { IRQ PER AFG SAU }

		target_trigger = {
			SOV_basic_fight_alongside_comrades_triggers = yes
		}

		target_root_trigger = {
			has_completed_focus = SOV_middle_east_diplomacy
			is_subject = no
		}

		allowed = {
			original_tag = SOV
		}

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

		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
					}
				}
			}
		}
	}

	SOV_preparations_for_operation_countenance = { # Mission for SOV (or SOV + ENG) to prepare the invasion of Iran
		priority = 50

		icon = hol_draw_up_staff_plans

		allowed = {
			OR = {
				original_tag = SOV
				original_tag = ENG
			}
		}

		available =  {
			hidden_trigger = { always = no }
		}

		activation = {
			always = no
		}

		cancel_trigger = {
			OR = {
				is_subject = yes
				NOT = { country_exists = PER }
				is_in_faction_with = PER
				has_war_with = PER
				has_guaranteed = PER
				has_non_aggression_pact_with = PER
				AND = {
					has_global_flag = SOV_agreed_anglo_soviet_invasion_of_iran_flag
					SOV = { has_war_with = ENG }
				}
			}
		}

		is_good = yes

		days_mission_timeout = SOV.SOV_operation_countenance_preparation_days

		timeout_effect = {
			if = { #SOV invading alone
				limit = {
					NOT = { has_global_flag = SOV_agreed_anglo_soviet_invasion_of_iran_flag }
				}
				declare_war_on = {
					target = PER
					type = puppet_wargoal_focus
				}
			}
			else = { #SOV + ENG invading together
				if = { #SOV triggers the actual effects
					limit = {
						original_tag = SOV
					}
					declare_war_on = {
						target = PER
						type = puppet_wargoal_focus
					}
					ENG = {
						add_to_war = { targeted_alliance = SOV enemy = PER hostility_reason = asked_to_join }
					}
				}
				else = { #ENG only sees a fake
					effect_tooltip = {
						SOV = {
							declare_war_on = {
								target = PER
								type = puppet_wargoal_focus
							}
						}
						add_to_war = { targeted_alliance = SOV enemy = PER hostility_reason = asked_to_join }
					}

					hidden_effect = { news_event = { id = nsb_news.104 days = 4 random_days = 2 } } #Only ENG sends the news event.
				}
			}
			activate_mission = SOV_operation_countenance
			if = { #Activate mission for ENG if joint operation
				limit = {
					has_global_flag = SOV_agreed_anglo_soviet_invasion_of_iran_flag
				}
				ENG = {
					activate_mission = SOV_operation_countenance
				}
			}
			custom_effect_tooltip = SOV_preparations_for_operation_countenance_mission_tt

			hidden_effect = { #Add all AI strategies
				SOV_anglo_soviet_invasion_add_ai_strategies_effect = yes
			}
		}
	}

	SOV_operation_countenance = { # Mission for SOV (or SOV + ENG) to capitulate Iran in time, before they seek foreign help
		priority = 50

		icon = generic_operation

		allowed = {
			OR = {
				original_tag = SOV
				original_tag = ENG
			}
		}

		available =  {
			custom_trigger_tooltip = {
				tooltip = r56_operation_countenance_tooltip
				OR = {
					PER = { has_capitulated = yes }
					has_global_flag = R56_PER_countenance_has_capitulated_flag
				}
			}
			PER = {	#replaces broken variable loop that went through starting states
				all_core_state = {
					OR = {
						owner = {
							NOT = {
								tag = PER
							}
						}
						controller = {
							OR = {
								is_ally_with = SOV
								AND = {
									ENG = {	#required for how the flag is written
										has_global_flag = SOV_agreed_anglo_soviet_invasion_of_iran_flag
									}
									is_ally_with = ENG
								}
							}
						}
					}
				}
			}
		}

		activation = {
			always = no
		}

		days_mission_timeout = SOV.SOV_operation_countenance_mission_days

		timeout_effect = { #FAIL -> Lose some stuff and Iran wants to enter an alliance
			add_political_power = -25
			add_command_power = -25
			add_war_support = -0.05

			hidden_effect = { #AI strategies
				if = {
					limit = {
						OR = {
							original_tag = SOV
							AND = {
								original_tag = ENG
								has_global_flag = SOV_agreed_anglo_soviet_invasion_of_iran_flag
								NOT = { country_exists = SOV }
							}
						}
					}
					SOV_failed_anglo_soviet_invasion_ai_strategies_effect = yes
				}
			}
		}

		complete_effect = {
			add_command_power = 50
			add_war_support = 0.1

			effect_tooltip = {
				if = { #Soviets alone (or joint but ENG died)
					limit = {
						OR = {
							has_global_flag = SOV_soviet_invasion_of_iran_flag
							AND = {
								has_global_flag = SOV_agreed_anglo_soviet_invasion_of_iran_flag
								NOT = { country_exists = ENG }
							}
						}
					}
					FROM = {
						puppet = ROOT #SOV puppet Iran
						transfer_state = 419 #Tibriz (AZB)
						transfer_state = 420 #Gilan (AZB)
						transfer_state = 983
						transfer_state = 984
						transfer_state = 987
						transfer_state = 988
					}
					give_resource_rights = { receiver = SOV state = 411 }
					give_resource_rights = { receiver = SOV state = 412 }
					give_resource_rights = { receiver = SOV state = 413 }
				}
				else_if = {
					limit = {
						has_global_flag = SOV_agreed_anglo_soviet_invasion_of_iran_flag
					}
					ENG = {
						puppet = ROOT #ENG gets to puppet Iran
					}
					SOV = {
						transfer_state = 419 #Tibriz (AZB)
						transfer_state = 420 #Gilan (AZB)
						transfer_state = 983
						transfer_state = 984
						transfer_state = 987
						transfer_state = 988
					}
					FROM = {
						give_resource_rights = { receiver = SOV state = 411 }
						give_resource_rights = { receiver = SOV state = 412 }
						give_resource_rights = { receiver = ENG state = 413 }
						give_military_access = ROOT
					}
				}
			}
		}
	}
}



############
### ASIA ###
############

SOV_diplomacy_asia_decision_category = {
	SOV_send_infantry_equipment_asia = {
		priority = 50

		icon = generic_industry

		ai_will_do = {
			base = 1.2
			modifier = {
				factor = 0.1
				has_war = yes
				OR = {
					has_equipment = { infantry_equipment < 3000 }
					has_equipment = { support_equipment < 600 }
				}
			}
		}

		targets = { PRC CHI }

		target_trigger = {

		}

		target_root_trigger = {
			is_subject = no
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			FROM = {
				SOV_is_valid_subject = yes
				NOT = { has_war_with = ROOT }
			}
			has_equipment = { infantry_equipment > 999 }
			has_equipment = { support_equipment > 199 }
		}

		visible = {
			country_exists = FROM
			NOT = { has_war_with = FROM }
			FROM = {
				SOV_is_valid_subject = yes
			}
			OR = {
				AND = {
					has_completed_focus = SOV_two_red_flags
					FROM = { tag = PRC }
				}
				AND = {
					has_completed_focus = SOV_support_the_kuomintang
					FROM = { tag = CHI }
				}
			}
		}

		days_re_enable = SOV_send_infantry_equipment_cd

		cost = SOV_send_infantry_equipment_cost

		complete_effect = {
			send_equipment = {
				type = infantry_equipment
				amount = 1000
				target = FROM
			}
			send_equipment = {
				type = support_equipment
				amount = 200
				target = FROM
			}
			FROM = {
				add_opinion_modifier = {
					target = ROOT
					modifier = SOV_sent_us_weapons
				}
			}
			hidden_effect = {
				FROM = {
					country_event = { id = NSB_soviet_foreign_politics_events.250 hours = 2 }
					add_ai_strategy = {
						type = befriend
						id = SOV
						value = 5
					}
				}
			}
			custom_effect_tooltip = SOV_send_equipment_cd_tt
		}
	}

	SOV_peace_deal_for_south_sakhalin_and_kuril_islands = {
		priority = 999

		icon = eng_trade_unions_support

		ai_will_do = {
			base = 2
			modifier = {
				factor = 0
				controls_state = 282
			}
		}

		targets = { JAP }

		target_trigger = {
			FROM = { tag = JAP }
		}

		target_root_trigger = {
			has_completed_focus = SOV_recover_the_kuril_islands
			country_exists = JAP
			has_war_with = JAP
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			controls_state = 537
			JAP = { owns_state = 537 }
			controls_state = 555
			JAP = { owns_state = 555 }
			surrender_progress < 0.01
		}

		fire_only_once = yes

		cost = SOV_peace_deal_cost

		complete_effect = {
			JAP = { country_event = { id = NSB_soviet_foreign_politics_events.260 hours = 4 random_hours = 2 } }
			custom_effect_tooltip = if_they_accept
			effect_tooltip = {
				JAP = {
					white_peace = FROM
				}
				537 = {
					add_core_of = ROOT
				}
				555 = {
					add_core_of = ROOT
				}
				transfer_state = 537
				transfer_state = 555
			}
		}
	}

	SOV_peace_deal_for_hokkaido = {
		priority = 999

		icon = eng_trade_unions_support

		ai_will_do = {
			base = 4
			modifier = {
				factor = 0
				controls_state = 282
			}
		}

		targets = { JAP }

		target_trigger = {
			FROM = { tag = JAP }
		}

		target_root_trigger = {
			has_completed_focus = SOV_recover_the_kuril_islands
			country_exists = JAP
			has_war_with = JAP
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			controls_state = 537
			JAP = { owns_state = 537 }
			controls_state = 555
			JAP = { owns_state = 555 }
			controls_state = 536
			JAP = { owns_state = 536 }
			surrender_progress < 0.01
		}

		fire_only_once = yes

		cost = SOV_peace_deal_cost

		complete_effect = {
			JAP = { country_event = { id = NSB_soviet_foreign_politics_events.261 hours = 4 random_hours = 2 } }
			custom_effect_tooltip = if_they_accept
			effect_tooltip = {
				JAP = {
					white_peace = FROM
				}
				537 = {
					add_core_of = ROOT
				}
				555 = {
					add_core_of = ROOT
				}
				536 = {
					add_core_of = ROOT
				}
				transfer_state = 537
				transfer_state = 555
				transfer_state = 536
			}
		}
	}

	SOV_sinkiang_mineral_prospection_sik = {
		priority = 50

		icon = generic_construction

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SIK = {
				SOV_is_valid_subject = yes
				NOT = { has_war_with = ROOT }
				has_full_control_of_state = 617 #URUMQI
				has_full_control_of_state = 619 #YARKAND
			}
			num_of_civilian_factories_available_for_projects > 0
			NOT = { has_country_flag = SOV_sinkiang_investment_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_the_gobi_gambit
			SIK = { #Relevant states under Sinkiang control
				SOV_is_valid_subject = yes
				NOT = { has_war_with = ROOT }
				has_full_control_of_state = 617 #URUMQI
				has_full_control_of_state = 619 #YARKAND
			}
			is_subject = no
			has_capitulated = no
			NOT = { has_country_flag = SOV_sinkiang_prospection_rejected_flag }
			NOT = { has_country_flag = SOV_sinkiang_prospection_flag } #Do not do this twice, one with SIK one without SIK
		}

		cancel_trigger = {
			OR = {
				SIK = { #Relevant states under Sinkiang control
					OR = {
						SOV_is_valid_subject = no
						has_war_with = ROOT
						NOT = { has_full_control_of_state = 617 } #URUMQI
						NOT = { has_full_control_of_state = 619 } #YARKAND
					}
				}
				is_subject = yes
				has_capitulated = yes
				has_country_flag = SOV_sinkiang_prospection_rejected_flag
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_sinkiang_investment_ongoing_flag
			hidden_effect = {
				SIK = {
					remove_mission = SOV_sinkiang_mineral_prospection_mission_dummy
				}
			}
		}

		days_remove = SOV_sinkiang_mineral_prospection_days

		cost = SOV_sinkiang_proposal_cost

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_sinkiang_investment_ongoing_flag
			SIK = {
				country_event = { id = NSB_soviet_foreign_politics_events.273 hours = 2 }
			}
			# IF THEY ACCEPT
			custom_effect_tooltip = if_they_accept_tt
			effect_tooltip = {
				add_opinion_modifier = {
					target = SIK
					modifier = SOV_complied_with_our_demands
				}
				custom_effect_tooltip = SOV_sinikiang_influence_cg_tt_sov
			}
			# IF THEY REFUSE
			custom_effect_tooltip = if_they_refuse_tt
			effect_tooltip = {
				add_opinion_modifier = {
					target = SIK
					modifier = SOV_rejected_our_demands
				}
				custom_effect_tooltip = SOV_sinikiang_influence_refuse_tt
			}
		}

		remove_effect = {
			hidden_effect = { #Decrease SIK's desire to join Chinese faction (and other AI strategies)
				SOV_approach_sinkiang_diplomacy_effect = yes
				SIK = {
					add_ai_strategy = { #This is added in Gobi Gambit + all 3 investment decisions
						type = alliance
						id = SOV
						value = 4
					}
				}
			}
			619 = { #YARKAND - Minerals and Infra
				add_resource = {
					type = aluminium
					amount = 3
				}
				add_resource = {
					type = chromium
					amount = 3
				}
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}
			617 = { #URUMQI
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}
			# Urumqi - Kashgar
			build_railway = {
				path = { 4709 4770 7702 4682 7949 2015 }
			}

			#Supply Hub in Kashgar
			619 = {
				add_building_construction = {
					type = supply_node
					level = 1
					province = 2015
					instant_build = yes
				}
			}

			clr_country_flag = SOV_sinkiang_investment_ongoing_flag
			set_country_flag = SOV_sinkiang_prospection_flag
		}
	}

	SOV_sinkiang_oil_prospection_sik = {
		priority = 50

		icon = generic_construction

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SIK = {
				SOV_is_valid_subject = yes
				NOT = { has_war_with = ROOT }
				has_full_control_of_state = 617 #URUMQI
				has_full_control_of_state = 618 #DZUNGARIA
			}
			num_of_civilian_factories_available_for_projects > 1
			NOT = { has_country_flag = SOV_sinkiang_investment_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_the_gobi_gambit
			SIK = { #Relevant states under Sinkiang control
				SOV_is_valid_subject = yes
				NOT = { has_war_with = ROOT }
				has_full_control_of_state = 617 #URUMQI
				has_full_control_of_state = 618 #DZUNGARIA
			}
			is_subject = no
			has_capitulated = no
			NOT = { has_country_flag = SOV_sinkiang_oil_prospection_rejected_flag }
			NOT = { has_country_flag = SOV_sinkiang_oil_prospection_flag } #Do not do this twice, one with SIK one without SIK
		}

		cancel_trigger = {
			OR = {
				SIK = { #Relevant states under Sinkiang control
					OR = {
						SOV_is_valid_subject = no
						has_war_with = ROOT
						NOT = { has_full_control_of_state = 617 } #URUMQI
						NOT = { has_full_control_of_state = 618 } #DZUNGARIA
					}
				}
				is_subject = yes
				has_capitulated = yes
				has_country_flag = SOV_sinkiang_oil_prospection_rejected_flag
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_sinkiang_investment_ongoing_flag
			hidden_effect = {
				SIK = {
					remove_mission = SOV_sinkiang_oil_prospection_mission_dummy
				}
			}
		}

		days_remove = SOV_sinkiang_oil_prospection_days

		cost = SOV_sinkiang_proposal_cost

		modifier = {
			civilian_factory_use = 2
		}

		complete_effect = {
			set_country_flag = SOV_sinkiang_investment_ongoing_flag
			SIK = {
				country_event = { id = NSB_soviet_foreign_politics_events.276 hours = 2 }
			}
			# IF THEY ACCEPT
			custom_effect_tooltip = if_they_accept_tt
			effect_tooltip = {
				add_opinion_modifier = {
					target = SIK
					modifier = SOV_complied_with_our_demands
				}
				custom_effect_tooltip = SOV_sinikiang_influence_cg_tt_sov
			}
			# IF THEY REFUSE
			custom_effect_tooltip = if_they_refuse_tt
			effect_tooltip = {
				add_opinion_modifier = {
					target = SIK
					modifier = SOV_rejected_our_demands
				}
				custom_effect_tooltip = SOV_sinikiang_influence_refuse_tt
			}
		}

		remove_effect = {
			hidden_effect = { #Decrease SIK's desire to join Chinese faction (and other AI strategies)
				SOV_approach_sinkiang_diplomacy_effect = yes
				SIK = {
					add_ai_strategy = { #This is added in Gobi Gambit + all 3 investment decisions
						type = alliance
						id = SOV
						value = 4
					}
				}
			}
			618 = { #DZUNGARIA - Minerals, oil and Infra
				add_resource = {
					type = aluminium
					amount = 3
				}
				add_resource = {
					type = tungsten
					amount = 3
				}
				add_resource = {
					type = oil
					amount = 6
				}
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}
			SIK = { give_resource_rights = { receiver = SOV state = 618 } } # Grant Resource rights to SOV
			617 = { #URUMQI - Infra
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}
			# Urumqi - Altay
			build_railway = {
				path = { 4709 10674 1783 1844 12737 4823 }
			}
			#Supply Hub in Altay
			618 = {
				add_building_construction = {
					type = supply_node
					level = 1
					province = 4823
					instant_build = yes
				}
			}

			SIK = { add_ideas = SOV_expanded_exploitation_of_gold_mines }

			clr_country_flag = SOV_sinkiang_investment_ongoing_flag
			set_country_flag = SOV_sinkiang_oil_prospection_flag
		}
	}

	SOV_sinkiang_military_aid_sik = {
		priority = 50

		icon = generic_military

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SIK = {
				SOV_is_valid_subject = yes
				NOT = { has_war_with = ROOT }
				has_full_control_of_state = 617 #URUMQI
				has_full_control_of_state = 618 #DZUNGARIA
			}
			num_of_civilian_factories_available_for_projects > 0
			has_equipment = { small_plane_airframe > 39 }
			has_equipment = { infantry_equipment > 499 }
			NOT = { has_country_flag = SOV_sinkiang_investment_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_the_gobi_gambit
			SIK = { #Relevant states under Sinkiang control
				SOV_is_valid_subject = yes
				NOT = { has_war_with = ROOT }
				has_full_control_of_state = 617 #URUMQI
				has_full_control_of_state = 759 #KUNLUN SHAN
			}
			is_subject = no
			has_capitulated = no
			NOT = { has_country_flag = SOV_sinkiang_military_aid_rejected_flag }
			NOT = { has_country_flag = SOV_sinkiang_military_aid_flag } #Do not do this twice, one with SIK one without SIK
		}

		cancel_trigger = {
			OR = {
				SIK = { #Relevant states under Sinkiang control
					OR = {
						SOV_is_valid_subject = no
						has_war_with = ROOT
						NOT = { has_full_control_of_state = 617 } #URUMQI
						NOT = { has_full_control_of_state = 759 } #KUNLUN SHAN
					}
				}
				is_subject = yes
				has_capitulated = yes
				has_country_flag = SOV_sinkiang_military_aid_rejected_flag
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_sinkiang_investment_ongoing_flag
			hidden_effect = {
				SIK = {
					remove_mission = SOV_sinkiang_military_aid_mission_dummy
				}
			}
		}

		days_remove = SOV_sinkiang_military_aid_days

		cost = SOV_sinkiang_proposal_cost

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_sinkiang_investment_ongoing_flag
			SIK = {
				country_event = { id = NSB_soviet_foreign_politics_events.278 hours = 2 }
			}
			# IF THEY ACCEPT
			custom_effect_tooltip = if_they_accept_tt
			effect_tooltip = {
				add_opinion_modifier = {
					target = SIK
					modifier = SOV_complied_with_our_demands
				}
				custom_effect_tooltip = SOV_sinikiang_influence_cg_tt_sov

				send_equipment = {
					type = small_plane_airframe
					amount = 40
					target = SIK
				}
				send_equipment = {
					type = infantry_equipment
					amount = 500
					target = SIK
				}
			}
			# IF THEY REFUSE
			custom_effect_tooltip = if_they_refuse_tt
			effect_tooltip = {
				add_opinion_modifier = {
					target = SIK
					modifier = SOV_rejected_our_demands
				}
				custom_effect_tooltip = SOV_sinikiang_influence_refuse_tt
			}
		}

		remove_effect = {
			hidden_effect = { #Decrease SIK's desire to join Chinese faction (and other AI strategies)
				SOV_approach_sinkiang_diplomacy_effect = yes
				SIK = {
					add_ai_strategy = { #This is added in Gobi Gambit + all 3 investment decisions
						type = alliance
						id = SOV
						value = 4
					}
				}
			}
			617 = { #URUMQI - Mil
				if = {
					limit = {
						free_building_slots = {
							building = arms_factory
							size > 0
							include_locked = yes
						}
					}
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = arms_factory
						level = 1
						instant_build = yes
					}
				}
			}
			759 = { #KUNLUN SHAN - Infra + Air base + Forts
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
				if = {
					limit = {
						air_base < 9
					}
					add_building_construction = {
						type = air_base
						level = 2
						instant_build = yes
					}
				}
				else_if = {
					limit = {
						air_base < 10
					}
					add_building_construction = {
						type = air_base
						level = 1
						instant_build = yes
					}
				}
				add_building_construction = {
					type = bunker
					level = 1
					province = {
						id = 10315
						id = 2074
						id = 1698
						id = 4947
					}
					instant_build = yes
				}
			}
			if = {  #DABANCHENG - Forts
				limit = {
					SIK = { has_full_control_of_state = 760 }
				}
				760 = {
					add_building_construction = {
						type = bunker
						level = 1
						province = {
							id = 1838
							id = 4843
						}
						instant_build = yes
					}
				}
			}

			SIK = {
				add_tech_bonus = {
					name = NSB_soviet_foreign_politics_events.278.t
					bonus = 1
					uses = 2
					category = air_equipment
				}
				air_experience = 50
				army_experience = 50
			}

			clr_country_flag = SOV_sinkiang_investment_ongoing_flag
			set_country_flag = SOV_sinkiang_military_aid_flag
		}
	}

	SOV_sinkiang_support_expansion_sik = {
		priority = 50

		icon = infiltrate_state

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			SIK = {
				SOV_is_valid_subject = yes
				is_in_faction_with = ROOT
				has_full_control_of_state = 604 #QINGHAI
				has_full_control_of_state = 755 #HAIXI
				has_full_control_of_state = 756 #JIUQUAN
				has_full_control_of_state = 754 #GOLOG
				has_full_control_of_state = 753 #GANNAN
				has_full_control_of_state = 1075 #GYARONG
				has_full_control_of_state = 283 #GANSU
				has_full_control_of_state = 616 #NINGXIA
			}
			num_of_civilian_factories_available_for_projects > 2
			has_equipment = { motorized_equipment > 299 }
			NOT = { has_country_flag = SOV_sinkiang_investment_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_the_gobi_gambit
			SIK = { #Relevant states under Sinkiang control
				SOV_is_valid_subject = yes
				NOT = { has_war_with = ROOT }
				has_full_control_of_state = 617 #URUMQI
				has_full_control_of_state = 759 #KUNLUN SHAN
			}
			is_subject = no
			has_capitulated = no
			NOT = { has_country_flag = SOV_sinkiang_support_expansion_rejected_flag }
			NOT = { has_country_flag = SOV_sinkiang_support_expansion_flag } #Do not do this twice, one with SIK one without SIK
		}

		cancel_trigger = {
			OR = {
				SIK = { #Relevant states under Sinkiang control
					OR = {
						SOV_is_valid_subject = no
						has_war_with = ROOT
						NOT = { is_in_faction_with = ROOT }
						NOT = { has_full_control_of_state = 604 } #QINGHAI
						NOT = { has_full_control_of_state = 755 } #HAIXI
						NOT = { has_full_control_of_state = 756 } #JIUQUAN
						NOT = { has_full_control_of_state = 754 } #GOLOG
						NOT = { has_full_control_of_state = 1075 } #GYARONG
						NOT = { has_full_control_of_state = 283 } #GANSU
						NOT = { has_full_control_of_state = 616 } #NINGXIA
					}
				}
				is_subject = yes
				has_capitulated = yes
				has_country_flag = SOV_sinkiang_support_expansion_rejected_flag
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_sinkiang_investment_ongoing_flag
			hidden_effect = {
				SIK = {
					remove_mission = SOV_sinkiang_support_expansion_mission_dummy
				}
			}
		}

		days_remove = SOV_sinkiang_support_expansion_days

		cost = SOV_sinkiang_proposal_cost

		modifier = {
			civilian_factory_use = 3
		}

		complete_effect = {
			set_country_flag = SOV_sinkiang_investment_ongoing_flag
			SIK = {
				country_event = { id = NSB_soviet_foreign_politics_events.280 hours = 2 }
			}
			# IF THEY ACCEPT
			custom_effect_tooltip = if_they_accept_tt
			effect_tooltip = {
				add_opinion_modifier = {
					target = SIK
					modifier = SOV_complied_with_our_demands
				}
				send_equipment = {
					type = motorized_equipment
					amount = 300
					target = SIK
				}
				custom_effect_tooltip = SOV_sinikiang_influence_cg_tt_sov
			}
			# IF THEY REFUSE
			custom_effect_tooltip = if_they_refuse_tt
			effect_tooltip = {
				add_opinion_modifier = {
					target = SIK
					modifier = SOV_rejected_our_demands
				}
				custom_effect_tooltip = SOV_sinikiang_influence_refuse_tt
			}
		}

		remove_effect = {
			hidden_effect = { #Decrease SIK's desire to join Chinese faction (and other AI strategies)
				SOV_approach_sinkiang_diplomacy_effect = yes
				SIK = {
					add_ai_strategy = { #This is added in Gobi Gambit + all 3 investment decisions
						type = alliance
						id = SOV
						value = 4
					}
				}
			}
			755 = { #HAIXI - Infra
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}
			756 = { #JIUQUAN - Infra + Oil
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
				add_resource = {
					type = oil
					amount = 12
				}
			}
			604 = { #QINGHAI (Golmud) - Infra
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
				add_building_construction = {
					type = bunker
					level = 1
					province = {
						id = 7940
					}
					instant_build = yes
				}
			}
			754 = { #GOLOG (Lanzhou) - Infra
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
				add_building_construction = {
					type = bunker
					level = 1
					province = {
						id = 12732
					}
					instant_build = yes
				}
			}
			283 = { #GANSU - Infra + Air Base + Fort
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
				if = {
					limit = {
						air_base < 9
					}
					add_building_construction = {
						type = air_base
						level = 2
						instant_build = yes
					}
				}
				else_if = {
					limit = {
						air_base < 10
					}
					add_building_construction = {
						type = air_base
						level = 1
						instant_build = yes
					}
				}
				add_building_construction = {
					type = bunker
					level = 1
					province = {
						id = 531
					}
					instant_build = yes
				}
			}

			clr_country_flag = SOV_sinkiang_investment_ongoing_flag
			set_country_flag = SOV_sinkiang_support_expansion_flag
		}
	}

	SOV_formalize_of_the_soviet_republic_of_sinkiang = {
		priority = 20

		icon = generic_nationalism

		ai_will_do = {
			base = 0.8
		}

		fire_only_once = yes

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = SOV_sinkiang_prospection_flag
			has_country_flag = SOV_sinkiang_oil_prospection_flag
			has_country_flag = SOV_sinkiang_military_aid_flag
			SIK = {
				is_in_faction_with = ROOT
				has_opinion = {
					target = ROOT
					value > 80
				}
				has_government = communism
			}
			has_country_flag = { flag = SOV_sinkiang_joined_comintern_counter_flag days > 730 }
			custom_trigger_tooltip = {
				tooltip = SOV_sinkiang_joined_comintern_days_tt
				has_country_flag = {
					flag = SOV_sinkiang_joined_comintern_counter_flag
					days > 730
				}
			}
			strength_ratio = {
			    tag = SIK
			    ratio > 2
			}
		}

		visible = {
			has_completed_focus = SOV_the_gobi_gambit
			country_exists = SIK
			SIK = {
				is_subject = no
			}
			NOT = { has_war_with = FROM }
		}

		cost = 100

		complete_effect = {
			SIK = {
				country_event = { id = NSB_soviet_foreign_politics_events.282 hours = 2 }
			}
			# IF THEY ACCEPT
			custom_effect_tooltip = if_they_accept_tt
			effect_tooltip = {
				puppet = SIK
				add_opinion_modifier = {
					target = SIK
					modifier = SOV_complied_with_our_demands
				}
			}

			# IF THEY REFUSE
			custom_effect_tooltip = if_they_refuse_tt
			add_opinion_modifier = {
				target = ROOT
				modifier = SOV_rejected_our_demands
			}

			custom_effect_tooltip = SOV_formalize_of_the_soviet_republic_of_sinkiang_only_once_tt
		}
	}
}


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


SOV_soviet_aid_decision_category = {
	SOV_sinkiang_mineral_prospection_mission_dummy = { # Fake "Mission" for Sinkiang so that they can see Soviet progress on this
		priority = 50

		icon = generic_construction

		allowed = {
			original_tag = SOV
		}

		available =  {
			hidden_trigger = { always = no }
		}

		activation = {
			always = no
		}

		cancel_trigger = {
			OR = {
				SOV_is_valid_subject = no
				has_war_with = SOV
				NOT = { has_full_control_of_state = 617 } #URUMQI
				NOT = { has_full_control_of_state = 619 } #YARKAND
				SOV = { is_subject = yes }
				SOV = { has_capitulated = yes }
			}
		}

		is_good = yes

		days_mission_timeout = SOV.SOV_sinkiang_mineral_prospection_days

		timeout_effect = {
			effect_tooltip = {
				619 = { #YARKAND - Minerals and Infra
					add_resource = {
						type = aluminium
						amount = 3
					}
					add_resource = {
						type = chromium
						amount = 3
					}
					if = {
						limit = {
							infrastructure < 5
						}
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}
					}
				}
				617 = { #URUMQI
					if = {
						limit = {
							infrastructure < 5
						}
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}
					}
				}
				# Urumqi - Kashgar
				build_railway = {
					path = { 4709 4770 7702 4682 7949 2015 }
				}

				#Supply Hub in Kashgar
				619 = {
					add_building_construction = {
						type = supply_node
						level = 1
						province = 2015
						instant_build = yes
					}
				}

				custom_effect_tooltip = SOV_sinikiang_influence_cg_tt_sik
			}
		}
	}

	SOV_sinkiang_oil_prospection_mission_dummy = { # Fake "Mission" for Sinkiang so that they can see Soviet progress on this
		priority = 50

		icon = generic_construction

		allowed = {
			original_tag = SOV
		}

		available =  {
			hidden_trigger = { always = no }
		}

		activation = {
			always = no
		}

		cancel_trigger = {
			OR = {
				SOV_is_valid_subject = no
				has_war_with = SOV
				NOT = { has_full_control_of_state = 617 } #URUMQI
				NOT = { has_full_control_of_state = 618 } #DZUNGARIA
				SOV = { is_subject = yes }
				SOV = { has_capitulated = yes }
			}
		}

		is_good = yes

		days_mission_timeout = SOV.SOV_sinkiang_oil_prospection_days

		timeout_effect = {
			effect_tooltip = {
				618 = { #DZUNGARIA - Minerals, oil and Infra
					add_resource = {
						type = aluminium
						amount = 3
					}
					add_resource = {
						type = tungsten
						amount = 3
					}
					add_resource = {
						type = oil
						amount = 6
					}
					if = {
						limit = {
							infrastructure < 5
						}
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}
					}
				}
				give_resource_rights = { receiver = SOV state = 618 } # Grant Resource rights to SOV
				617 = { #URUMQI - Infra
					if = {
						limit = {
							infrastructure < 5
						}
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}
					}
				}
				# Urumqi - Altay
				build_railway = {
					path = { 4709 10674 1783 1844 12737 4823 }
				}
				#Supply Hub in Altay
				618 = {
					add_building_construction = {
						type = supply_node
						level = 1
						province = 4823
						instant_build = yes
					}
				}

				add_ideas = SOV_expanded_exploitation_of_gold_mines
				custom_effect_tooltip = SOV_sinikiang_influence_cg_tt_sik
			}
		}
	}

	SOV_sinkiang_military_aid_mission_dummy = { # Fake "Mission" for Sinkiang so that they can see Soviet progress on this
		priority = 50

		icon = generic_military

		allowed = {
			original_tag = SOV
		}

		available =  {
			hidden_trigger = { always = no }
		}

		activation = {
			always = no
		}

		cancel_trigger = {
			OR = {
				SOV_is_valid_subject = no
				has_war_with = SOV
				NOT = { has_full_control_of_state = 617 } #URUMQI
				NOT = { has_full_control_of_state = 759 } #KUNLUN SHAN
				SOV = { is_subject = yes }
				SOV = { has_capitulated = yes }
			}
		}

		is_good = yes

		days_mission_timeout = SOV.SOV_sinkiang_military_aid_days

		timeout_effect = {
			effect_tooltip = {
				617 = { #URUMQI - Mil
					if = {
						limit = {
							free_building_slots = {
								building = arms_factory
								size > 0
								include_locked = yes
							}
						}
						add_extra_state_shared_building_slots = 1
						add_building_construction = {
							type = arms_factory
							level = 1
							instant_build = yes
						}
					}
				}
				759 = { #KUNLUN SHAN - Infra + Air base + Forts
					if = {
						limit = {
							infrastructure < 5
						}
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}
					}
					if = {
						limit = {
							air_base < 9
						}
						add_building_construction = {
							type = air_base
							level = 2
							instant_build = yes
						}
					}
					else_if = {
						limit = {
							air_base < 10
						}
						add_building_construction = {
							type = air_base
							level = 1
							instant_build = yes
						}
					}
					add_building_construction = {
						type = bunker
						level = 1
						province = {
							id = 10315
							id = 2074
							id = 1698
							id = 4947
						}
						instant_build = yes
					}
				}
				if = {  #DABANCHENG - Forts
					limit = {
						has_full_control_of_state = 760
					}
					760 = {
						add_building_construction = {
							type = bunker
							level = 1
							province = {
								id = 1838
								id = 4843
							}
							instant_build = yes
						}
					}
				}
				add_tech_bonus = {
					name = NSB_soviet_foreign_politics_events.278.t
					bonus = 1
					uses = 2
					category = air_equipment
				}
				air_experience = 50
				army_experience = 50
				custom_effect_tooltip = SOV_sinikiang_influence_cg_tt_sik
			}
		}
	}

	SOV_sinkiang_support_expansion_mission_dummy = { # Fake "Mission" for Sinkiang so that they can see Soviet progress on this
		priority = 50

		icon = infiltrate_state

		allowed = {
			original_tag = SOV
		}

		available =  {
			hidden_trigger = { always = no }
		}

		activation = {
			always = no
		}

		cancel_trigger = {
			OR = { #Relevant states under Sinkiang control
				SOV_is_valid_subject = no
				has_war_with = ROOT
				NOT = { is_in_faction_with = ROOT }
				NOT = { has_full_control_of_state = 604 } #QINGHAI
				NOT = { has_full_control_of_state = 755 } #HAIXI
				NOT = { has_full_control_of_state = 756 } #JIUQUAN
				NOT = { has_full_control_of_state = 754 } #GOLOG
				NOT = { has_full_control_of_state = 753 } #GANNAN
				NOT = { has_full_control_of_state = 1075 } #GYARONG
				NOT = { has_full_control_of_state = 283 } #GANSU
				NOT = { has_full_control_of_state = 616 } #NINGXIA
			}
			SOV = {
				OR = {
					is_subject = yes
					has_capitulated = yes
					has_country_flag = SOV_sinkiang_support_expansion_rejected_flag
				}
			}
		}

		is_good = yes

		days_mission_timeout = SOV.SOV_sinkiang_support_expansion_days

		timeout_effect = {
			effect_tooltip = {
				755 = { #HAIXI - Infra
					if = {
						limit = {
							infrastructure < 5
						}
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}
					}
				}
				756 = { #JIUQUAN - Infra + Oil
					if = {
						limit = {
							infrastructure < 5
						}
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}
					}
					add_resource = {
						type = oil
						amount = 12
					}
				}
				604 = { #QINGHAI (Golmud) - Infra
					if = {
						limit = {
							infrastructure < 5
						}
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}
					}
					add_building_construction = {
						type = bunker
						level = 1
						province = {
							id = 7940
						}
						instant_build = yes
					}
				}
				754 = { #GOLOG (Lanzhou) - Infra
					if = {
						limit = {
							infrastructure < 5
						}
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}
					}
					add_building_construction = {
						type = bunker
						level = 1
						province = {
							id = 12732
						}
						instant_build = yes
					}
				}
				283 = { #GANSU - Infra + Air Base + Fort
					if = {
						limit = {
							infrastructure < 5
						}
						add_building_construction = {
							type = infrastructure
							level = 1
							instant_build = yes
						}
					}
					if = {
						limit = {
							air_base < 9
						}
						add_building_construction = {
							type = air_base
							level = 2
							instant_build = yes
						}
					}
					else_if = {
						limit = {
							air_base < 10
						}
						add_building_construction = {
							type = air_base
							level = 1
							instant_build = yes
						}
					}
					add_building_construction = {
						type = bunker
						level = 1
						province = {
							id = 531
						}
						instant_build = yes
					}
				}
				custom_effect_tooltip = SOV_sinikiang_influence_cg_tt_sik
			}
		}
	}
}


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


prospect_for_resources = {
	SOV_sinkiang_mineral_prospection = { #Development in Sinkiang but without Sinkiang
		priority = 50

		icon = generic_construction

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_completed_focus = SOV_the_gobi_gambit
			has_full_control_of_state = 617 #URUMQI
			has_full_control_of_state = 619 #YARKAND
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			NOT = { has_country_flag = SOV_sinkiang_prospection_flag } #Do not do this twice, one with SIK one without SIK
			has_full_control_of_state = 617 #URUMQI
			has_full_control_of_state = 619 #YARKAND
		}

		cancel_if_not_visible = yes

		days_remove = SOV_sinkiang_mineral_prospection_days

		cost = SOV_sinkiang_proposal_cost

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			619 = { #YARKAND - Minerals and Infra
				add_resource = {
					type = aluminium
					amount = 3
				}
				add_resource = {
					type = chromium
					amount = 3
				}
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}
			617 = { #URUMQI
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}
			# Urumqi - Kashgar
			build_railway = {
				path = { 4709 4770 7702 4682 7949 2015 }
			}

			#Supply Hub in Kashgar
			619 = {
				add_building_construction = {
					type = supply_node
					level = 1
					province = 2015
					instant_build = yes
				}
			}

			set_country_flag = SOV_sinkiang_prospection_flag
		}
	}

	SOV_sinkiang_oil_prospection = { #Development in Sinkiang but without Sinkiang
		priority = 50

		icon = generic_construction

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_completed_focus = SOV_the_gobi_gambit
			has_full_control_of_state = 617 #URUMQI
			has_full_control_of_state = 618 #DZUNGARIA
			num_of_civilian_factories_available_for_projects > 1
		}

		visible = {
			NOT = { has_country_flag = SOV_sinkiang_oil_prospection_flag } #Do not do this twice, one with SIK one without SIK
			has_full_control_of_state = 617 #URUMQI
			has_full_control_of_state = 618 #DZUNGARIA
		}

		cancel_if_not_visible = yes

		days_remove = SOV_sinkiang_mineral_prospection_days

		cost = SOV_sinkiang_proposal_cost

		modifier = {
			civilian_factory_use = 2
		}

		remove_effect = {
			618 = { #DZUNGARIA - Minerals, oil and Infra
				add_resource = {
					type = aluminium
					amount = 3
				}
				add_resource = {
					type = tungsten
					amount = 3
				}
				add_resource = {
					type = oil
					amount = 6
				}
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}
			617 = { #URUMQI - Infra
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}
			# Urumqi - Altay
			build_railway = {
				path = { 4709 10674 1783 1844 12737 4823 }
			}
			#Supply Hub in Altay
			618 = {
				add_building_construction = {
					type = supply_node
					level = 1
					province = 4823
					instant_build = yes
				}
			}

			set_country_flag = SOV_sinkiang_oil_prospection_flag
		}
	}

	SOV_jiuquan_oil_prospection = { #Development in Jiuquan but without Sinkiang or XSM
		priority = 50

		icon = generic_construction

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_completed_focus = SOV_the_gobi_gambit
			has_full_control_of_state = 604 #QINGHAI
			has_full_control_of_state = 755 #HAIXI
			has_full_control_of_state = 756 #JIUQUAN
			has_full_control_of_state = 754 #GOLOG
			has_full_control_of_state = 753 #GANNAN
			has_full_control_of_state = 1075 #GYARONG
			has_full_control_of_state = 283 #GANSU
			has_full_control_of_state = 616 #NINGXIA
			num_of_civilian_factories_available_for_projects > 1
		}

		visible = {
			NOT = { has_country_flag = SOV_sinkiang_support_expansion_flag } #Do not do this twice, one with SIK one without SIK
			has_full_control_of_state = 604 #QINGHAI
			has_full_control_of_state = 755 #HAIXI
			has_full_control_of_state = 756 #JIUQUAN
			has_full_control_of_state = 754 #GOLOG
			has_full_control_of_state = 753 #GANNAN
			has_full_control_of_state = 1075 #GYARONG
			has_full_control_of_state = 283 #GANSU
			has_full_control_of_state = 616 #NINGXIA
		}

		cancel_if_not_visible = yes

		days_remove = SOV_sinkiang_support_expansion_days

		cost = SOV_sinkiang_proposal_cost

		modifier = {
			civilian_factory_use = 2
		}

		remove_effect = {
			755 = { #HAIXI - Infra
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}
			756 = { #JIUQUAN - Infra + Oil
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
				add_resource = {
					type = oil
					amount = 12
				}
			}
			604 = { #QINGHAI (Golmud) - Infra
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
				add_building_construction = {
					type = bunker
					level = 1
					province = {
						id = 7940
					}
					instant_build = yes
				}
			}
			754 = { #GOLOG (Lanzhou) - Infra
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
				add_building_construction = {
					type = bunker
					level = 1
					province = {
						id = 12732
					}
					instant_build = yes
				}
			}
			283 = { #GANSU - Infra + Air Base + Fort
				if = {
					limit = {
						infrastructure < 5
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
				if = {
					limit = {
						air_base < 9
					}
					add_building_construction = {
						type = air_base
						level = 2
						instant_build = yes
					}
				}
				else_if = {
					limit = {
						air_base < 10
					}
					add_building_construction = {
						type = air_base
						level = 1
						instant_build = yes
					}
				}
				add_building_construction = {
					type = bunker
					level = 1
					province = {
						id = 531
					}
					instant_build = yes
				}
			}
			set_country_flag = SOV_sinkiang_support_expansion_flag
		}
	}
}



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


SOV_merge_designers_dec_cat = {

	SOV_debug_merge_designers_FASTER_AND_FREE = {
		priority = 999

		icon = eng_ally_imperialist_coup

		ai_will_do = {
			base = 0
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			OR = {
				has_completed_focus = SOV_merge_tank_and_materiel_plants
				has_completed_focus = SOV_merge_naval_plants
				has_completed_focus = SOV_merge_aircraft_plants
			}
			NOT = {
				has_country_flag = SOV_debug_fast_merge_desingers_flag
			}
			is_debug = yes
		}

		cost = 0

		complete_effect = {
			set_country_flag = SOV_debug_fast_merge_desingers_flag
			set_variable = { SOV_merge_designers_cost = 0 }
			set_variable = { SOV_merge_designers_time = 3 }
		}
	}

	SOV_debug_merge_designers_BACK_TO_REGULAR_STUFF = {
		priority = 999

		icon = eng_ally_imperialist_coup

		ai_will_do = {
			base = 0
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			OR = {
				has_completed_focus = SOV_merge_tank_and_materiel_plants
				has_completed_focus = SOV_merge_naval_plants
				has_completed_focus = SOV_merge_aircraft_plants
			}
			has_country_flag = SOV_debug_fast_merge_desingers_flag
			is_debug = yes
		}

		cost = 0

		complete_effect = {
			clr_country_flag = SOV_debug_fast_merge_desingers_flag
			set_variable = { SOV_merge_designers_cost = 50 }
			set_variable = { SOV_merge_designers_time = 90 }
		}
	}

	#####################
	### TANK DESIGNER ###
	#####################
	SOV_merge_tank_plant = {
		priority = 53

		icon = GFX_decision_generic_merge_plant_tank

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 195 #LENINGRAD
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_tank_designer_any = yes
			NOT = { has_country_flag = SOV_merge_tank_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_tank_and_materiel_plants
			SOV_has_tank_merged_1 = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_tank_designer_any = no
				NOT = { has_full_control_of_state = 195 } #LENINGRAD
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_tank_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_tank_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_tank_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_tank_plant_tt
			hidden_effect = {
				SOV_upgrade_appropriate_tank_designer_1_effect = yes
			}
		}
	}

	SOV_merge_tank_plant_2 = {
		priority = 52

		icon = GFX_decision_generic_merge_plant_tank

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 252 #GORKY
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_tank_designer_any = yes
			NOT = { has_country_flag = SOV_merge_tank_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_tank_and_materiel_plants
			SOV_has_tank_merged_2 = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_tank_designer_any = no
				NOT = { has_full_control_of_state = 252 } #GORKY
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_tank_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_tank_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_tank_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_tank_plant_2_tt
			hidden_effect = {
				SOV_upgrade_appropriate_tank_designer_2_effect = yes
			}
		}
	}

	SOV_merge_tank_plant_3 = {
		priority = 51

		icon = GFX_decision_generic_merge_plant_tank

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 653 #SVERDLOVSK
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_tank_designer_any = yes
			NOT = { has_country_flag = SOV_merge_tank_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_tank_and_materiel_plants
			SOV_has_tank_merged_3 = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_tank_designer_any = no
				NOT = { has_full_control_of_state = 653 } #SVERDLOVSK
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_tank_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_tank_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_tank_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_tank_plant_3_tt
			hidden_effect = {
				SOV_upgrade_appropriate_tank_designer_3_effect = yes
			}
		}
	}


	######################
	### NAVAL DESIGNER ###
	######################

	SOV_merge_ship_plant_1_baltic = {
		priority = 24

		icon = GFX_decision_generic_merge_plant_ship

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 195 #LENINGRAD
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_ship_designer_any_baltic = yes
			NOT = { has_country_flag = SOV_merge_ship_decision_ongoing_flag }
		}

		visible = {
			has_dlc = "Man the Guns" #Coastal Defense Ships
			has_completed_focus = SOV_merge_naval_plants
			SOV_has_ship_merged_1_baltic = no
			SOV_has_active_ship_designer_any_black_sea = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_ship_designer_any_baltic = no
				NOT = { has_full_control_of_state = 195 } #LENINGRAD
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_ship_plant_1_tt
			hidden_effect = {
				SOV_upgrade_appropriate_ship_designer_1_baltic_effect = yes
			}
			set_technology = { coastal_defense_ships = 1 }
		}
	}

	SOV_merge_ship_plant_2_baltic = {
		priority = 23

		icon = GFX_decision_generic_merge_plant_ship

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 195 #LENINGRAD
			has_completed_focus = SOV_surface_warfare
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_ship_designer_any_baltic = yes
			NOT = { has_country_flag = SOV_merge_ship_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_naval_plants
			SOV_has_ship_merged_2_baltic = no
			NOT = { has_completed_focus = SOV_submarine_warfare }
			SOV_has_active_ship_designer_any_black_sea = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_ship_designer_any_baltic = no
				NOT = { has_full_control_of_state = 195 } #LENINGRAD
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_ship_plant_2_tt
			hidden_effect = {
				SOV_upgrade_appropriate_ship_designer_2_baltic_effect = yes
			}
		}
	}

	SOV_merge_ship_plant_3_baltic = {
		priority = 22

		icon = GFX_decision_generic_merge_plant_ship

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 195 #LENINGRAD
			has_completed_focus = SOV_submarine_warfare
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_ship_designer_any_baltic = yes
			NOT = { has_country_flag = SOV_merge_ship_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_naval_plants
			SOV_has_ship_merged_3_baltic = no
			NOT = { has_completed_focus = SOV_surface_warfare }
			SOV_has_active_ship_designer_any_black_sea = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_ship_designer_any_baltic = no
				NOT = { has_full_control_of_state = 195 } #LENINGRAD
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_ship_plant_3_tt
			hidden_effect = {
				SOV_upgrade_appropriate_ship_designer_3_baltic_effect = yes
			}
		}
	}

	SOV_merge_ship_plant_4_baltic = {
		priority = 21

		icon = GFX_decision_generic_merge_plant_ship

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 195 #LENINGRAD
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_ship_designer_any_baltic = yes
			NOT = { has_country_flag = SOV_merge_ship_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_naval_plants
			SOV_has_ship_merged_4_baltic = no
			SOV_has_active_ship_designer_any_black_sea = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_ship_designer_any_baltic = no
				NOT = { has_full_control_of_state = 195 } #LENINGRAD
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_ship_plant_4_tt
			hidden_effect = {
				SOV_upgrade_appropriate_ship_designer_4_baltic_effect = yes
			}
		}
	}

	SOV_merge_ship_plant_1_black_sea = {
		priority = 14

		icon = GFX_decision_generic_merge_plant_ship

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 197 #MYKOLAIV
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_ship_designer_any_black_sea = yes
			NOT = { has_country_flag = SOV_merge_ship_decision_ongoing_flag }
		}

		visible = {
			has_dlc = "Man the Guns" #Coastal Defense Ships
			has_completed_focus = SOV_merge_naval_plants
			SOV_has_ship_merged_1_black_sea = no
			SOV_has_active_ship_designer_any_baltic = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_ship_designer_any_black_sea = no
				NOT = { has_full_control_of_state = 197 } #MYKOLAIV
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_ship_plant_1_tt
			hidden_effect = {
				SOV_upgrade_appropriate_ship_designer_1_black_sea_effect = yes
			}
			set_technology = { coastal_defense_ships = 1 }
		}
	}

	SOV_merge_ship_plant_2_black_sea = {
		priority = 13

		icon = GFX_decision_generic_merge_plant_ship

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 202 #KIEV
			has_completed_focus = SOV_surface_warfare
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_ship_designer_any_black_sea = yes
			NOT = { has_country_flag = SOV_merge_ship_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_naval_plants
			SOV_has_ship_merged_2_black_sea = no
			NOT = { has_completed_focus = SOV_submarine_warfare }
			SOV_has_active_ship_designer_any_baltic = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_ship_designer_any_black_sea = no
				NOT = { has_full_control_of_state = 202 } #KIEV
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_ship_plant_2_tt
			hidden_effect = {
				SOV_upgrade_appropriate_ship_designer_2_black_sea_effect = yes
			}
		}
	}

	SOV_merge_ship_plant_3_black_sea = {
		priority = 12

		icon = GFX_decision_generic_merge_plant_ship

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 227 #STALINO
			has_completed_focus = SOV_submarine_warfare
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_ship_designer_any_black_sea = yes
			NOT = { has_country_flag = SOV_merge_ship_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_naval_plants
			SOV_has_ship_merged_3_black_sea = no
			NOT = { has_completed_focus = SOV_surface_warfare }
			SOV_has_active_ship_designer_any_baltic = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_ship_designer_any_black_sea = no
				NOT = { has_full_control_of_state = 227 } #STALINO
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_ship_plant_3_tt
			hidden_effect = {
				SOV_upgrade_appropriate_ship_designer_3_black_sea_effect = yes
			}
		}
	}

	SOV_merge_ship_plant_4_black_sea = {
		priority = 11

		icon = GFX_decision_generic_merge_plant_ship

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 195 #LENINGRAD
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_ship_designer_any_black_sea = yes
			NOT = { has_country_flag = SOV_merge_ship_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_naval_plants
			SOV_has_ship_merged_4_black_sea = no
			SOV_has_active_ship_designer_any_baltic = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_ship_designer_any_black_sea = no
				NOT = { has_full_control_of_state = 195 } #LENINGRAD
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_ship_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_ship_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_ship_plant_4_tt
			hidden_effect = {
				SOV_upgrade_appropriate_ship_designer_4_black_sea_effect = yes
			}
		}
	}


	#########################
	### AIRCRAFT DESIGNER ###
	#########################
	SOV_merge_aircraft_plant_1 = {
		priority = 33

		icon = GFX_decision_generic_merge_plant_aircraft

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 251 #KUYBYSHEV
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_aircraft_designer_any = yes
			NOT = { has_country_flag = SOV_merge_aircraft_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_aircraft_plants
			SOV_has_aircraft_merged_1 = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_aircraft_designer_any = no
				NOT = { has_full_control_of_state = 251 } #KUYBYSHEV
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_aircraft_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_aircraft_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_aircraft_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_aircraft_plant_1_tt
			hidden_effect = {
				SOV_upgrade_appropriate_aircraft_designer_1_effect = yes
			}
		}
	}

	SOV_merge_aircraft_plant_2 = {
		priority = 32

		icon = GFX_decision_generic_merge_plant_aircraft

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 219 #MOSCOW
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_aircraft_designer_any = yes
			NOT = { has_country_flag = SOV_merge_aircraft_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_aircraft_plants
			SOV_has_aircraft_merged_2 = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_aircraft_designer_any = no
				NOT = { has_full_control_of_state = 219 } #MOSCOW
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_aircraft_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_aircraft_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_aircraft_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_aircraft_plant_2_tt
			hidden_effect = {
				SOV_upgrade_appropriate_aircraft_designer_2_effect = yes
			}

			add_resource = {
				type = aluminium
				amount = 3
				state = 219
			}
		}
	}

	SOV_merge_aircraft_plant_3 = {
		priority = 31

		icon = GFX_decision_generic_merge_plant_aircraft

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 808 #RIGA
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_aircraft_designer_any = yes
			NOT = { has_country_flag = SOV_merge_aircraft_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_aircraft_plants
			SOV_has_aircraft_merged_3 = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_aircraft_designer_any = no
				NOT = { has_full_control_of_state = 808 } #RIGA
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_aircraft_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_aircraft_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_aircraft_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_aircraft_plant_3_tt
			hidden_effect = {
				SOV_upgrade_appropriate_aircraft_designer_3_effect = yes
			}
		}
	}


	#########################
	### MATERIEL DESIGNER ###
	#########################
	SOV_merge_materiel_plant_1_artillery = {
		priority = 45

		icon = GFX_decision_generic_merge_plant_materiel

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 398 #PERM
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_materiel_designer_grabin = yes
			NOT = { has_country_flag = SOV_merge_materiel_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_tank_and_materiel_plants
			SOV_has_materiel_merged_1_artillery = no
			SOV_has_active_materiel_designer_tula = no
			SOV_has_active_materiel_designer_gaz = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_materiel_designer_grabin = no
				NOT = { has_full_control_of_state = 398 } #PERM
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_materiel_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_materiel_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_materiel_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_materiel_plant_1_artillery_tt
			hidden_effect = {
				SOV_upgrade_appropriate_materiel_designer_1_artillery_effect = yes
			}
		}
	}

	SOV_merge_materiel_plant_1_infantry = {
		priority = 44

		icon = GFX_decision_generic_merge_plant_materiel

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 399 #IZHEVSK
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_materiel_designer_tula = yes
			NOT = { has_country_flag = SOV_merge_materiel_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_tank_and_materiel_plants
			SOV_has_materiel_merged_1_infantry = no
			SOV_has_active_materiel_designer_grabin = no
			SOV_has_active_materiel_designer_gaz = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_materiel_designer_tula = no
				NOT = { has_full_control_of_state = 399 } #IZHEVSK
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_materiel_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_materiel_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_materiel_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_materiel_plant_1_infantry_tt
			hidden_effect = {
				SOV_upgrade_appropriate_materiel_designer_1_infantry_effect = yes
			}
		}
	}

	SOV_merge_materiel_plant_1_motorized = {
		priority = 43

		icon = GFX_decision_generic_merge_plant_materiel

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 252 #GORKY
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_materiel_designer_gaz = yes
			NOT = { has_country_flag = SOV_merge_materiel_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_tank_and_materiel_plants
			SOV_has_materiel_merged_1_motorized = no
			SOV_has_active_materiel_designer_grabin = no
			SOV_has_active_materiel_designer_tula = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_materiel_designer_gaz = no
				NOT = { has_full_control_of_state = 252 } #GORKY
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_materiel_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_materiel_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_materiel_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_materiel_plant_1_motorized_tt
			hidden_effect = {
				SOV_upgrade_appropriate_materiel_designer_1_motorized_effect = yes
			}
		}
	}

	SOV_merge_materiel_plant_2 = {
		priority = 42

		icon = GFX_decision_generic_merge_plant_materiel

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 227 #STALINO
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_materiel_designer_any = yes
			NOT = { has_country_flag = SOV_merge_materiel_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_tank_and_materiel_plants
			SOV_has_materiel_merged_2 = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_materiel_designer_any = no
				NOT = { has_full_control_of_state = 227 } #STALINO
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_materiel_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_materiel_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_materiel_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_materiel_plant_2_tt
			hidden_effect = {
				SOV_upgrade_appropriate_materiel_designer_2_effect = yes
			}
		}
	}

	SOV_merge_materiel_plant_3 = {
		priority = 41

		icon = GFX_decision_generic_merge_plant_materiel

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 582 #MAGNITOGORSK
			num_of_civilian_factories_available_for_projects > 0
			SOV_has_active_materiel_designer_any = yes
			NOT = { has_country_flag = SOV_merge_materiel_decision_ongoing_flag }
		}

		visible = {
			has_completed_focus = SOV_merge_tank_and_materiel_plants
			SOV_has_materiel_merged_3 = no
		}

		cancel_trigger = {
			OR = {
				SOV_has_active_materiel_designer_any = no
				NOT = { has_full_control_of_state = 582 } #MAGNITOGORSK
			}
		}

		cancel_effect = {
			clr_country_flag = SOV_merge_materiel_decision_ongoing_flag
		}

		cost = SOV_merge_designers_cost

		days_remove = SOV_merge_designers_time

		modifier = {
			civilian_factory_use = 1
		}

		complete_effect = {
			set_country_flag = SOV_merge_materiel_decision_ongoing_flag
		}

		remove_effect = {
			clr_country_flag = SOV_merge_materiel_decision_ongoing_flag

			custom_effect_tooltip = SOV_merge_materiel_plant_3_tt
			hidden_effect = {
				SOV_upgrade_appropriate_materiel_designer_3_effect = yes
			}
		}
	}
}



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


SOV_national_academy_of_sciences_dec_cat = {
	SOV_debug_FASTER_AND_FREE = {
		priority = 51

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			is_debug = yes
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = {
				has_country_flag = SOV_debug_fast_national_academy_of_sicences_flag
			}
		}

		cost = 0

		complete_effect = {
			set_country_flag = SOV_debug_fast_national_academy_of_sicences_flag
			set_variable = { SOV_national_academy_of_sciences_construction_cost = 0 }
			set_variable = { SOV_national_academy_of_sciences_construction_time = 3 }
		}
	}

	SOV_debug_BACK_TO_REGULAR_STUFF = {
		priority = 51

		icon = eng_ally_imperialist_coup

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}

		visible = {
			is_debug = yes
			has_completed_focus = SOV_national_academies_of_sciences
			has_country_flag = SOV_debug_fast_national_academy_of_sicences_flag
		}

		cost = 0

		complete_effect = {
			clr_country_flag = SOV_debug_fast_national_academy_of_sicences_flag
			set_variable = { SOV_national_academy_of_sciences_construction_cost = 50 }
			set_variable = { SOV_national_academy_of_sciences_construction_time = 90 }
		}
	}

	SOV_build_national_academy_of_sciences_independent_republic = {
		priority = 2

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Puppets get prio so that they receive bonus too
			base = 0.9
		}

		target_trigger = {
			FROM = {
				SOV_is_valid_academy_of_sciences_target = yes
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			country_exists = FROM
			FROM = {
				SOV_is_valid_academy_of_sciences_target = yes
			}
			SOV_has_already_built_national_academy_of_sciences = no
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			SOV_build_national_academy_of_sciences_effect = yes #Tooltip + increase research speed in dynamic modifier

			SOV_set_appropriate_national_academy_of_sciences_flag_effect = yes #Set Appropriate flag to avoid duplicates with the other set of decisions for non-existing countries
			FROM = {
				country_event = NSB_soviet_academy_of_sciences.1
				effect_tooltip = {
					add_ideas = SOV_national_academy_of_sciences_puppet
				}
			}
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_BLR = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = BLR
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_BLR_flag }
			NOT = { country_exists = BLR }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			BLR = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_BLR_flag
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_UKR = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = UKR
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_UKR_flag }
			NOT = { country_exists = UKR }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			UKR = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_UKR_flag
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_KAZ = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = KAZ
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_KAZ_flag }
			NOT = { country_exists = KAZ }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			KAZ = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_KAZ_flag
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_GEO = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = GEO
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_GEO_flag }
			NOT = { country_exists = GEO }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			GEO = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_GEO_flag
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_ARM = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = ARM
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_ARM_flag }
			NOT = { country_exists = ARM }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			ARM = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_ARM_flag
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_AZR = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = AZR
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_AZR_flag }
			NOT = { country_exists = AZR }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			AZR = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_AZR_flag
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_UZB = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = UZB
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_UZB_flag }
			NOT = { country_exists = UZB }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			UZB = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_UZB_flag
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_TMS = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = TMS
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_TMS_flag }
			NOT = { country_exists = TMS }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			TMS = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_TMS_flag
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_KYR = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = KYR
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_KYR_flag }
			NOT = { country_exists = KYR }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			KYR = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_KYR_flag
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_TAJ = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = TAJ
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_TAJ_flag }
			NOT = { country_exists = TAJ }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			TAJ = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_TAJ_flag
		}
	}

	#Not gonna have these unless they're released, just like with the others
#	SOV_build_national_academy_of_sciences_integrated_republic_DON = {
#		priority = 1
#
#		icon = GFX_decision_SOV_academy_of_sciences
#
#		ai_will_do = { #Integrated republics go after puppets
#			base = 0.5
#		}
#
#		cosmetic_tag = DON
#		cosmetic_ideology = communism
#
#		allowed = {
#			original_tag = SOV
#		}
#
#		available = {
#			num_of_civilian_factories_available_for_projects > 0
#		}
#
#		visible = {
#			has_completed_focus = SOV_national_academies_of_sciences
#			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_DON_flag }
#			NOT = { country_exists = DON }
#		}
#
#		fire_only_once = yes
#
#		cost = SOV_national_academy_of_sciences_construction_cost
#
#		days_remove = SOV_national_academy_of_sciences_construction_time
#
#		modifier = {
#			civilian_factory_use = 1
#		}
#
#		remove_effect = {
#			DON = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
#			set_country_flag = SOV_national_academy_of_sciences_built_DON_flag
#		}
#	}
#
#	SOV_build_national_academy_of_sciences_integrated_republic_KUB = {
#		priority = 1
#
#		icon = GFX_decision_SOV_academy_of_sciences
#
#		ai_will_do = { #Integrated republics go after puppets
#			base = 0.5
#		}
#
#		cosmetic_tag = KUB
#		cosmetic_ideology = communism
#
#		allowed = {
#			original_tag = SOV
#		}
#
#		available = {
#			num_of_civilian_factories_available_for_projects > 0
#		}
#
#		visible = {
#			has_completed_focus = SOV_national_academies_of_sciences
#			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_KUB_flag }
#			NOT = { country_exists = KUB }
#		}
#
#		fire_only_once = yes
#
#		cost = SOV_national_academy_of_sciences_construction_cost
#
#		days_remove = SOV_national_academy_of_sciences_construction_time
#
#		modifier = {
#			civilian_factory_use = 1
#		}
#
#		remove_effect = {
#			KUB = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
#			set_country_flag = SOV_national_academy_of_sciences_built_KUB_flag
#		}
#	}

	SOV_build_national_academy_of_sciences_integrated_republic_EST = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = EST
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_EST_flag }
			NOT = { country_exists = EST }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			EST = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_EST_flag
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_LAT = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = LAT
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_LAT_flag }
			NOT = { country_exists = LAT }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			LAT = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_LAT_flag
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_LIT = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = LIT
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_LIT_flag }
			NOT = { country_exists = LIT }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			LIT = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_LIT_flag
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_POL = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = POL
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_POL_flag }
			NOT = { country_exists = POL }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			POL = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_POL_flag
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_FIN = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = FIN
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_FIN_flag }
			NOT = { country_exists = FIN }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			FIN = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_FIN_flag
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_TAN = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = TAN
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_TAN_flag }
			NOT = { country_exists = TAN }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			TAN = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier
			set_country_flag = SOV_national_academy_of_sciences_built_TAN_flag
		}
	}

	SOV_build_national_academy_of_sciences_integrated_republic_MON = {
		priority = 1

		icon = GFX_decision_SOV_academy_of_sciences

		ai_will_do = { #Integrated republics go after puppets
			base = 0.5
		}

		cosmetic_tag = MON
		cosmetic_ideology = communism

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
		}

		visible = {
			has_completed_focus = SOV_national_academies_of_sciences
			NOT = { has_country_flag = SOV_national_academy_of_sciences_built_MON_flag }
			NOT = { country_exists = MON }
		}

		fire_only_once = yes

		cost = SOV_national_academy_of_sciences_construction_cost

		days_remove = SOV_national_academy_of_sciences_construction_time

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			MON = { SOV_build_national_academy_of_sciences_effect = yes } #Tooltip + increase research speed in dynamic modifier // Done in this scope for tooltip reasons
			set_country_flag = SOV_national_academy_of_sciences_built_MON_flag
		}
	}
}


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


SOV_kill_trotsky_dec_cat = {
	SOV_raid_trotskys_villa = {
		priority = 2

		icon = generic_prepare_civil_war

		ai_will_do = {
			base = 0
			modifier = {
				add = 50
				date > 1940.2.1 #Historical 24/05/1940
				NOT = { has_country_flag = SOV_raided_trotskys_villa_flag }
			}
		}

		target_trigger = {
			FROM = {
				owns_state = 277
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_equipment = { infantry_equipment > 49 }
			has_equipment = { support_equipment > 49 }
			NOT = { has_country_flag = SOV_attempting_to_kill_trotsky_flag }
		}

		visible = {
			has_completed_focus = SOV_behead_the_snake
			OR = {
				has_global_flag = trotsky_exile_mexico
				has_global_flag = flag_mexico_invited_trotsky_to_government
			}
			NOT = { has_global_flag = flag_trotsky_dead }
			NOT = { has_global_flag = flag_trotsky_has_returned_to_ussr_from_mexico }
		}

		cost = 75

		days_remove = 60

		modifier = {
			political_power_factor = -0.1
		}

		complete_effect = {
			set_country_flag = SOV_attempting_to_kill_trotsky_flag
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -50
				producer = SOV
			}
			add_equipment_to_stockpile = {
				type = support_equipment
				amount = -50
				producer = SOV
			}
		}

		remove_effect = {
			hidden_effect = {
				clr_country_flag = SOV_attempting_to_kill_trotsky_flag
				set_country_flag = SOV_raided_trotskys_villa_flag
				random_list = {
					50 = {
						modifier = {
							factor = 2
							FROM = {
								communism > 0.5
							}
						}
						modifier = {
							factor = 5
							FROM = {
								is_in_faction_with = ROOT
							}
						}
						ROOT = { news_event = { id = nsb_news.100 } } #SUCCESS - Kill Trotsky and swap Trotskyite Plot NS
					}
					50 = {
						modifier = {
							factor = 0
							FROM = {
								is_subject_of = ROOT
							}
						}
						ROOT = { news_event = { id = nsb_news.101 } } #FAILURE - Trotsky still alive
					}
				}
			}
			custom_effect_tooltip = SOV_raid_trotskys_villa_tt
		}
	}

	SOV_carefully_planned_assassination = {
		priority = 1

		icon = GFX_decision_generic_assassination

		ai_will_do = {
			base = 0
			modifier = {
				add = 200
				date > 1940.6.1 #Historical 20/08/1940
				has_country_flag = SOV_raided_trotskys_villa_flag
			}
		}

		target_trigger = {
			FROM = {
				OR = {
					owns_state = 277
					owns_state = 110
				}
			}
		}

		target_root_trigger = {
			original_tag = SOV
			has_completed_focus = SOV_behead_the_snake
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			NOT = { has_country_flag = SOV_attempting_to_kill_trotsky_flag }
		}

		visible = {
			NOT = { has_global_flag = flag_trotsky_dead }
			NOT = { has_global_flag = flag_trotsky_has_returned_to_ussr_from_mexico }
			OR = {
				AND = {
					FROM = {
						controls_state = 277 #MEXICO CITY
					}
					OR = {
						has_global_flag = trotsky_exile_mexico
						has_global_flag = flag_mexico_invited_trotsky_to_government
					}
				}
				AND = {
					FROM = {
						controls_state = 110 #OSTLANDET (Oslo) -> Trotsky not accepted in Mexico (or Soviets being super fast to kill him, which should be impossible btw)
					}
					NOT = {
						has_global_flag = trotsky_exile_mexico
						has_global_flag = flag_mexico_invited_trotsky_to_government
					}
				}
			}
		}

		cost = 100

		fire_only_once = yes

		days_remove = 270

		modifier = {
			political_power_factor = -0.1
		}

		complete_effect = {
			set_country_flag = SOV_attempting_to_kill_trotsky_flag
		}

		remove_effect = {
			hidden_effect = {
				clr_country_flag = SOV_attempting_to_kill_trotsky_flag
				random_list = {
					50 = {
						modifier = {
							factor = 1.5
							FROM = {
								communism > 0.25
							}
						}
						modifier = {
							factor = 1.5
							FROM = {
								communism > 0.5
							}
						}
						modifier = {
							factor = 1.5
							FROM = {
								communism > 0.75
							}
						}
						modifier = {
							factor = 2
							FROM = {
								has_opinion = {
									target = ROOT
									value > 50
								}
							}
						}
						modifier = {
							factor = 2.5
							FROM = {
								is_in_faction_with = ROOT
							}
						}
						modifier = {
							factor = 2
							has_country_flag = SOV_raided_trotskys_villa_flag
						}
						ROOT = { news_event = { id = news.37 } } #SUCCESS - Kill Trotsky and swap Trotskyite Plot NS
					}
					50 = {
						modifier = {
							factor = 0.5
							FROM = {
								is_subject_of = ROOT
							}
						}
						ROOT = { news_event = { id = news.38 } } #FAILURE - Trotsky still alive
					}
				}
			}
			custom_effect_tooltip = SOV_carefully_planned_assassination_tt
		}
	}
}


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


#Category only allowed for SOV
SOV_industry_relocation = {

	SOV_generic_industry_relocation = {
		priority = 10

		icon = generic_construction

		ai_will_do = {
			factor = 0
			modifier = {
				add = 200 # oh shit they are getting close!
				FROM = {
					OR = {
						state = 219 #MOSCOW
						state = 195 #LENINGRAD
						state = 202 #KIEV
						state = 206 #MINSK
						state = 217 #STALINGRAD
					}
					any_neighbor_state = {
						NOT = { is_fully_controlled_by = ROOT }
					}
				}
			}
			modifier = {
				factor = 0
				SOV_save_pp_for_manpower_trouble = yes
			}
		}

		state_target = yes

		#targets = { core_states }

		target_trigger = {
			FROM = {
				is_owned_by = ROOT
				is_core_of = ROOT
				is_fully_controlled_by = ROOT
				is_on_continent = europe
				OR = {
					has_state_category = town
					has_state_category = large_town
					has_state_category = city
					has_state_category = large_city
					has_state_category = megalopolis
					has_state_category = metropolis
				}
				infrastructure > 2
			}
		}

		target_root_trigger = {
			original_tag = SOV
			has_completed_focus = SOV_move_industry_to_the_urals
			has_civil_war = no
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			FROM = {
				is_fully_controlled_by = ROOT
				infrastructure > 2
			}
			has_equipment = { train_equipment > 79 } #20 trains per factory
		}

		visible = {
			FROM = {
				OR = { #Has at least 2 factories
					arms_factory > 1
					industrial_complex > 1
					AND = {
						arms_factory > 0
						industrial_complex > 0
					}
				}
			}
		}

		cancel_if_not_visible = no

		cost = 25

		days_remove = SOV_industrial_relocation_days

		complete_effect = {  #Attempt to remove 2 CIVS & 2 MILS
			hidden_effect = {
				add_equipment_to_stockpile = {
					type = train_equipment
					amount = SOV_industrial_relocation_trains_decision_negative
					producer = SOV
				}
			}
			custom_effect_tooltip = SOV_industry_relocation_trains_tt
			custom_effect_tooltip = SOV_industry_relocation_complete_effect_tt
			#REMOVE factories
			FROM = {
				hidden_effect = {
					set_temp_variable = { SOV_factories_counter = 0 }

					#Attempt to relocate 50%-50% of mils-civs
					set_temp_variable = { SOV_half_the_factories_to_relocate = SOV.SOV_industrial_relocation_max_factories }
					divide_temp_variable = { SOV_half_the_factories_to_relocate = 2 }
					while_loop_effect = {
						limit = {
							check_variable = { SOV_factories_counter = SOV.SOV_industrial_relocation_max_factories compare = less_than }
						}
						if = { #GO MILS (if possible)
							limit = {
								check_variable = { SOV_factories_counter = SOV_half_the_factories_to_relocate compare = less_than }
							}
							if = {
								limit = {
									arms_factory > 0
								}
								remove_building = {
									type = arms_factory
									level = 1
								}
								if = {
									limit = {
										has_state_flag = SOV_mils_removed_flag
									}
									modify_state_flag = { flag = SOV_mils_removed_flag value = 1 }
								}
								else = {
									set_state_flag = SOV_mils_removed_flag
								}
							}
							else_if = {
								limit = {
									industrial_complex > 0
								}
								remove_building = {
									type = industrial_complex
									level = 1
								}
								if = {
									limit = {
										has_state_flag = SOV_civs_removed_flag
									}
									modify_state_flag = { flag = SOV_civs_removed_flag value = 1 }
								}
								else = {
									set_state_flag = SOV_civs_removed_flag
								}
							}
						}
						else = { #GO CIVS (if possible)
							if = {
								limit = {
									industrial_complex > 0
								}
								remove_building = {
									type = industrial_complex
									level = 1
								}
								if = {
									limit = {
										has_state_flag = SOV_civs_removed_flag
									}
									modify_state_flag = { flag = SOV_civs_removed_flag value = 1 }
								}
								else = {
									set_state_flag = SOV_civs_removed_flag
								}
							}
							else_if = {
								limit = {
									arms_factory > 0
								}
								remove_building = {
									type = arms_factory
									level = 1
								}
								if = {
									limit = {
										has_state_flag = SOV_mils_removed_flag
									}
									modify_state_flag = { flag = SOV_mils_removed_flag value = 1 }
								}
								else = {
									set_state_flag = SOV_mils_removed_flag
								}
							}
						}
						add_to_temp_variable = { SOV_factories_counter = 1 }
					}
				}
			}
		}

		remove_effect = {
			hidden_effect = {
				add_equipment_to_stockpile = {
					type = train_equipment
					amount = SOV_industrial_relocation_trains_decision
					producer = SOV
				}
			}
			custom_effect_tooltip = SOV_industry_relocation_remove_effect_tt
			#RELOCATE FACTORIES
			FROM = {
				set_temp_variable = { SOV_factories_counter = 0 }
				#Factories attempt to get relocated in 2 different states
				set_temp_variable = { SOV_half_the_factories_to_relocate = SOV.SOV_industrial_relocation_max_factories }
				divide_temp_variable = { SOV_half_the_factories_to_relocate = 2 }
				while_loop_effect = { #NOTE: Due to the seed not changing during the execution of this effect, the same state will always be chosen, UNLESS it runs out of slots -> That's the reason for this
					limit = {
						check_variable = { SOV_factories_counter = SOV_half_the_factories_to_relocate compare = less_than }
					}
					SOV_relocate_industry_in_appropriate_state_effect = yes
					add_to_temp_variable = { SOV_factories_counter = 1 }
				}
			}
			custom_effect_tooltip = SOV_relocate_industry_repair_tt
			custom_effect_tooltip = SOV_relocate_industry_lose_control_tt
		}
	}

	move_leningrad_aluminium_plant = { #195

		icon = aluminium

		highlight_states = {
			highlight_state_targets = {
				state = 195
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_full_control_of_state = 195
			has_full_control_of_state = 569
			has_equipment = { train_equipment > 19 } #20 trains per factory
		}

		visible = {
			has_completed_focus = SOV_move_industry_to_the_urals
			controls_state = 195
			controls_state = 569
			195 = { has_state_flag = leningrad_aluminium_developed }
			has_civil_war = no
		}

		fire_only_once = yes

		cost = 25
		days_remove = SOV_industrial_relocation_days

		modifier = {

		}

		ai_will_do = {
			factor = 0.5
			modifier = {
				factor = 200 # oh shit they are getting close!
				OR = {
					AND = {
						owns_state = 208
						NOT = { controls_state = 208 }
					}
					AND = {
						owns_state = 209
						NOT = { controls_state = 209 }
					}
					AND = {
						owns_state = 244
						NOT = { controls_state = 244 }
					}
					AND = {
						owns_state = 263
						NOT = { controls_state = 263 }
					}
					AND = {
						owns_state = 191
						NOT = { controls_state = 191 }
					}
					AND = {
						owns_state = 146
						NOT = { controls_state = 146 }
					}
				}
			}
			modifier = {
				factor = 0
				SOV_save_pp_for_manpower_trouble = yes
			}
		}

		complete_effect = {
			hidden_effect = {
				add_equipment_to_stockpile = {
					type = train_equipment
					amount = SOV_industrial_relocation_trains_decision_aluminium_negative
					producer = SOV
				}
			}
			195 = {
				add_resource = {
					type = aluminium
					amount = -12
				}
			}
			custom_effect_tooltip = SOV_industry_relocation_aluminium_plant_trains_tt
		}

		remove_effect = {
			hidden_effect = {
				add_equipment_to_stockpile = {
					type = train_equipment
					amount = SOV_industrial_relocation_trains_decision_aluminium
					producer = SOV
				}
			}
			if = {
				limit = {
					controls_state = 569
				}
				569 = {
					add_resource = {
						type = aluminium
						amount = 12
					}
				}
			}
			set_global_flag = relocate_industry_from_leningrad
			custom_effect_tooltip = SOV_relocate_industry_from_leningrad_tt
		}
	}
}


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


SOV_infiltrate_foreign_atomic_programs_dec_cat = {
	SOV_infiltrate_atomic_program = {
		priority = 1

		icon = GFX_decision_generic_political_discourse

		ai_will_do = {
			base = 0.2
			modifier = {
				factor = 20
				FROM = { original_tag = USA }
			}
			modifier = {
				factor = 0.5
				OR = {
					has_tech = nukes
					is_researching_technology = nukes
				}
			}
		}

		target_trigger = {
			FROM = {
				is_major = yes
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			NOT = { has_country_flag = SOV_nuclear_espionage_ongoing_flag }
			FROM = { has_tech = atomic_research }
		}

		visible = {
			has_completed_focus = SOV_soviet_atomic_bomb_project
			FROM = {
				NOT = { has_country_flag = SOV_nuclear_espionage_flag }
				NOT = { has_war_with = ROOT }
			}
		}

		cost = 100

		days_remove = 90

		modifier = {
			political_power_factor = -0.1
		}

		complete_effect = {
			set_country_flag = SOV_nuclear_espionage_ongoing_flag
		}

		remove_effect = {
			hidden_effect = {
				clr_country_flag = SOV_nuclear_espionage_ongoing_flag
				FROM = { set_country_flag = SOV_nuclear_espionage_flag }
				random_list = {
					50 = {
						modifier = {
							factor = 1.5
							FROM = {
								communism > 0.15
							}
						}
						modifier = {
							factor = 1.5
							FROM = {
								communism > 0.25
							}
						}
						modifier = {
							factor = 2
							FROM = {
								communism > 0.5
							}
						}
						ROOT = { country_event = NSB_soviet_atomic_bomb_project.1 } #SUCCESS - Get the bonus
					}
					50 = {
						ROOT = {
							country_event = NSB_soviet_atomic_bomb_project.2  #FAILURE - Get some penalties
							set_variable = { SOV_aggrieved_country_atomic_spies = FROM }
						}
						FROM = {
							country_event = NSB_soviet_atomic_bomb_project.3
						}
					}
				}
			}
			custom_effect_tooltip = SOV_infiltrate_atomic_program_tt
		}
	}
}


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


SOV_comecon_dec_cat = {
	SOV_comecon_give_puppet_idea = { #r56 new
		priority = 2

		icon = GFX_decision_generic_construction

		ai_will_do = {
			base = 0.5
			modifier = {
				factor = 4
				has_war = no
			}
		}

		target_array = subjects

		target_trigger = {
			FROM = {
				is_subject_of = ROOT
				SOV_puppet_is_in_comecon = no
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			FROM = {
				num_of_civilian_factories > 10
			}
			if = {
				limit = {
					has_government = communism
				}
				FROM = { communism > 0.5 }
			}
			if = {
				limit = {
					has_government = democratic
				}
				FROM = { democratic > 0.5 }
			}
			if = {
				limit = {
					has_government = neutrality
				}
				FROM = { neutrality > 0.5 }
			}
			if = {
				limit = {
					has_government = fascism
				}
				FROM = { fascism > 0.5 }
			}
			#NOT = { has_country_flag = SOV_comecon_joint_military_program_ongoing_flag }
			#NOT = { has_country_flag = SOV_comecon_industrialization_program_ongoing_flag }
			if = { #these are just to show the player why its available, the trigger checks the variants
				limit = {
					has_completed_focus = SOV_found_the_comecon
				}
				NOT = {
					has_idea = SOV_comecon_puppet_default
				}
			}
			if = {
				limit = {
					has_completed_focus = SOV_the_common_economic_space_initiative
				}
				NOT = {
					has_idea = SOV_common_economic_space_puppet_default
				}
			}
		}

		visible = {
			OR = {
				has_completed_focus = SOV_found_the_comecon
				has_completed_focus = SOV_the_common_economic_space_initiative
			}
			FROM = { is_puppet_of = ROOT }
		}

		cost = 30

		days_remove = 90

		cancel_trigger = {
			NOT = { FROM = { is_puppet_of = ROOT } }
		}

		remove_effect = {
			if = {
				limit = {
					has_completed_focus = SOV_the_common_economic_space_initiative
				}
				FROM = {
					add_ideas = SOV_common_economic_space_puppet_default
				}
			}
			else = {
				FROM = {
					add_ideas = SOV_comecon_puppet_default
				}
			}
		}
		
		modifier = {
			political_power_cost = 0.35 #likely getting a lot
		}
	}
	SOV_comecon_industrialization_program = {
		priority = 2

		icon = GFX_decision_generic_construction

		ai_will_do = {
			base = 0.5
			modifier = {
				factor = 4
				has_war = no
			}
		}

		target_array = subjects

		target_trigger = {
			FROM = {
				is_subject_of = ROOT
				SOV_puppet_is_in_comecon = yes
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
			if = {
				limit = {
					has_government = communism
				}
				FROM = { communism > 0.5 }
			}
			if = {
				limit = {
					has_government = democratic
				}
				FROM = { democratic > 0.5 }
			}
			if = {
				limit = {
					has_government = neutrality
				}
				FROM = { neutrality > 0.5 }
			}
			if = {
				limit = {
					has_government = fascism
				}
				FROM = { fascism > 0.5 }
			}
			NOT = { has_country_flag = SOV_comecon_joint_military_program_ongoing_flag }
			NOT = { has_country_flag = SOV_comecon_industrialization_program_ongoing_flag }
		}

		visible = {
			OR = {
				has_completed_focus = SOV_found_the_comecon
				has_completed_focus = SOV_the_common_economic_space_initiative
			}
			FROM = { is_puppet_of = ROOT }
		}

		cost = 100

		days_remove = 180

		cancel_trigger = {
			NOT = { FROM = { is_puppet_of = ROOT } }
		}

		cancel_effect = {
			hidden_effect = {
				clr_country_flag = SOV_comecon_industrialization_program_ongoing_flag
				swap_ideas = {
					remove_idea = SOV_comecon_sov_industrialization
					add_idea = SOV_comecon_sov_default
				}

				FROM = {
					swap_ideas = {
						remove_idea = SOV_comecon_puppet_industrialization
						add_idea = SOV_comecon_puppet_default
					}
				}
			}
		}

		modifier = {
			civilian_factory_use = 1
			custom_modifier_tooltip = SOV_comecon_industrialization_program_modifier_tt
		}

		complete_effect = {
			hidden_effect = {
				FROM = { country_event = { id = NSB_soviet_comecon.1 hours = 1 } }
				set_country_flag = SOV_comecon_industrialization_program_ongoing_flag
				if = {
					limit = {
						has_completed_focus = SOV_found_the_comecon
					}
					swap_ideas = {
						remove_idea = SOV_comecon_sov_default
						add_idea = SOV_comecon_sov_industrialization
					}
					FROM = {
						swap_ideas = {
							remove_idea = SOV_comecon_puppet_default
							add_idea = SOV_comecon_puppet_industrialization
						}
					}
				}
				else = {
					swap_ideas = {
						remove_idea = SOV_common_economic_space_sov_default
						add_idea = SOV_common_economic_space_sov_industrialization
					}
					FROM = {
						swap_ideas = {
							remove_idea = SOV_common_economic_space_puppet_default
							add_idea = SOV_common_economic_space_puppet_industrialization
						}
					}
				}
			}
		}

		remove_effect = {
			hidden_effect = {
				clr_country_flag = SOV_comecon_industrialization_program_ongoing_flag
				if = {
					limit = {
						has_completed_focus = SOV_found_the_comecon
					}
					swap_ideas = {
						remove_idea = SOV_comecon_sov_industrialization
						add_idea = SOV_comecon_sov_default
					}
					FROM = {
						swap_ideas = {
							remove_idea = SOV_comecon_puppet_industrialization
							add_idea = SOV_comecon_puppet_default
						}
					}
				}
				else = {
					swap_ideas = {
						remove_idea = SOV_common_economic_space_sov_industrialization
						add_idea = SOV_common_economic_space_sov_default
					}
					FROM = {
						swap_ideas = {
							remove_idea = SOV_common_economic_space_puppet_industrialization
							add_idea = SOV_common_economic_space_puppet_default
						}
					}
				}
			}
		}
	}

	SOV_comecon_joint_military_program = {
		priority = 1

		icon = GFX_decision_generic_construction

		ai_will_do = {
			base = 0.5
			modifier = {
				factor = 4
				any_enemy_country = {
					is_major = yes
				}
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			num_of_civilian_factories_available_for_projects > 0
			NOT = { has_country_flag = SOV_comecon_industrialization_program_ongoing_flag }
		}

		visible = {
			OR = {
				has_completed_focus = SOV_found_the_comecon
				has_completed_focus = SOV_the_common_economic_space_initiative
			}
			num_subjects > 0
		}

		cost = 100

		days_remove = 180

		modifier = {
			custom_modifier_tooltip = SOV_comecon_joint_military_program_modifier_tt
		}

		cancel_trigger = {
			num_subjects < 1
		}

		cancel_effect = {
			hidden_effect = {
				clr_country_flag = SOV_comecon_joint_military_program_ongoing_flag
				swap_ideas = {
					remove_idea = SOV_comecon_sov_military
					add_idea = SOV_comecon_sov_default
				}

				custom_effect_tooltip = SOV_found_the_comecon_subjects_tt
				every_other_country = {
					limit = {
						is_subject_of = ROOT
					}
					swap_ideas = {
						remove_idea = SOV_comecon_puppet_military
						add_idea = SOV_comecon_puppet_default
					}
				}
			}
		}

		complete_effect = {
			hidden_effect = {
				set_country_flag = SOV_comecon_joint_military_program_ongoing_flag

				custom_effect_tooltip = SOV_found_the_comecon_subjects_tt
				if = {
					limit = {
						has_completed_focus = SOV_found_the_comecon
					}
					swap_ideas = {
						remove_idea = SOV_comecon_sov_default
						add_idea = SOV_comecon_sov_military
					}
					every_other_country = {
						limit = {
							is_subject_of = ROOT
							SOV_puppet_is_in_comecon = yes
						}
						country_event = { id = NSB_soviet_comecon.2 hours = 1 }
						swap_ideas = {
							remove_idea = SOV_comecon_puppet_default
							add_idea = SOV_comecon_puppet_military
						}
					}
				}
				else = {
					swap_ideas = {
						remove_idea = SOV_common_economic_space_sov_default
						add_idea = SOV_common_economic_space_sov_military
					}
					every_other_country = {
						limit = {
							is_subject_of = ROOT
							SOV_puppet_is_in_comecon = yes
						}
						country_event = { id = NSB_soviet_comecon.2 hours = 1 }
						swap_ideas = {
							remove_idea = SOV_common_economic_space_puppet_default
							add_idea = SOV_common_economic_space_puppet_military
						}
					}
				}
			}
		}

		remove_effect = {
			hidden_effect = {
				clr_country_flag = SOV_comecon_joint_military_program_ongoing_flag
				swap_ideas = {
					remove_idea = SOV_comecon_sov_military
					add_idea = SOV_comecon_sov_default
				}

				custom_effect_tooltip = SOV_found_the_comecon_subjects_tt
				every_other_country = {
					limit = {
						is_subject_of = ROOT
					}
					swap_ideas = {
						remove_idea = SOV_comecon_puppet_military
						add_idea = SOV_comecon_puppet_default
					}
				}
			}
		}
	}
}


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


SOV_great_patriotic_war = {

	SOV_raise_penal_units = {
		priority = 21

		icon = GFX_decision_generic_arrest

		ai_will_do = {
			base = 5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			has_country_flag = { flag = SOV_penal_units_raised_flag days > 365 }
			custom_trigger_tooltip = {
				tooltip = SOV_raise_penal_units_days_tt
				has_country_flag = {
					flag = SOV_penal_units_raised_flag
					days > 365
				}
			}
			any_enemy_country = { SOV_is_major_not_original_sov = yes }
		}

		visible = {
			has_completed_focus = SOV_penal_battalions
			any_enemy_country = { SOV_is_major_not_original_sov = yes }
		}

		cost = 50

		days_remove = 35

		complete_effect = {
		}

		remove_effect = {
			clr_country_flag = SOV_penal_units_raised_flag
			SOV_spawn_penal_divisions_effect = yes
		}
	}

	SOV_factory_worker_militias = {
		priority = 20

		icon = generic_prepare_civil_war

		ai_will_do = {
			base = 0
			modifier = {
				add = 15
				FROM = {
					OR = {
						state = 219 #MOSCOW
						state = 195 #LENINGRAD
						state = 217 #STALINGRAD
						state = 137 #SEVASTOPOL
						state = 206 #MINSK
						state = 202 #KIEV
					}
				}
				#ROOT = { manpower_per_military_factory > 15000 } #Don't waste if we need better manpower laws
			}
		}

		state_target = yes

		target_trigger = {
			FROM = {
				is_core_of = ROOT
				OR = {
					industrial_complex > 0
					arms_factory > 0
					dockyard > 0
				}
			}
		}

		target_root_trigger = {
			has_completed_focus = SOV_desperate_measures
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			FROM = {
				NOT = { has_dynamic_modifier = { modifier = SOV_civilian_labor_in_defense_mod } }
			}
		}

		visible = {
			any_enemy_country = { SOV_is_major_not_original_sov = yes }
			NOT = { has_country_flag = SOV_order_227_flag }
			FROM = {
				is_controlled_by = ROOT
				any_neighbor_state = {
					controller = { has_war_with = ROOT }
				}
			}
		}

		ai_hint_pp_cost = 25
		custom_cost_trigger = {
			command_power > 24
			has_political_power > 24
		}
		custom_cost_text = decision_cost_CP_25_pp_25

		days_remove = 90

		cancel_if_not_visible = yes

		cancel_effect = {
			FROM = {
				remove_dynamic_modifier = { modifier = SOV_factory_worker_militias_raised }
			}
		}

		complete_effect = {
			hidden_effect = {
				#Cost
				add_command_power = -25
				add_political_power = -25

				FROM = {
					add_dynamic_modifier = {
						modifier = SOV_factory_worker_militias_raised
						scope = SOV
					}
				}
			}
			custom_effect_tooltip = SOV_factory_worker_militias_state_modifier_tt
		}

		remove_effect = {
			FROM = {
				remove_dynamic_modifier = { modifier = SOV_factory_worker_militias_raised }
			}
		}
	}

	SOV_civilian_labor_in_defense = {
		priority = 10

		icon = POL_organize_strike_two

		state_target = yes

		target_trigger = {
			FROM = {
				is_core_of = ROOT
				OR = {
					has_state_category = city
					has_state_category = large_city
					has_state_category = megalopolis
					has_state_category = metropolis
				}
			}
		}

		ai_will_do = {
			base = 0
			modifier = {
				add = 15
				FROM = {
					OR = {
						state = 219 #MOSCOW
						state = 195 #LENINGRAD
						state = 217 #STALINGRAD
						state = 137 #SEVASTOPOL
						state = 206 #MINSK
						state = 202 #KIEV
					}
				}
				#ROOT = { manpower_per_military_factory > 15000 } #Don't waste if we need better manpower laws
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			FROM = {
				NOT = { has_dynamic_modifier = { modifier = SOV_factory_worker_militias_raised } }
			}
		}

		visible = {
			has_completed_focus = SOV_desperate_measures
			any_enemy_country = { SOV_is_major_not_original_sov = yes }
			NOT = { has_country_flag = SOV_order_227_flag }
			FROM = {
				is_controlled_by = ROOT
				any_neighbor_state = {
					controller = { has_war_with = ROOT }
				}
			}
		}

		ai_hint_pp_cost = 25
		custom_cost_trigger = {
			command_power > 24
			has_political_power > 24
		}
		custom_cost_text = decision_cost_CP_25_pp_25

		days_remove = 90

		cancel_if_not_visible = yes

		cancel_trigger = {
			FROM = {
				OR = {
					NOT = { is_controlled_by = ROOT }
					NOT = {
						any_neighbor_state = {
							controller = { has_war_with = ROOT }
						}
					}
				}
			}
		}

		cancel_effect = {
			FROM = {
				remove_dynamic_modifier = { modifier = SOV_civilian_labor_in_defense_mod }
			}
		}

		complete_effect = {
			hidden_effect = {
				#Cost
				add_command_power = -25
				add_political_power = -25

				FROM = {
					add_dynamic_modifier = {
						modifier = SOV_civilian_labor_in_defense_mod
						scope = SOV
					}
				}
			}
			custom_effect_tooltip = SOV_civilian_labor_in_defense_state_modifier_tt
		}

		remove_effect = {
			FROM = {
				remove_dynamic_modifier = { modifier = SOV_civilian_labor_in_defense_mod }
			}
		}
	}

	SOV_staggered_retreat = {
		priority = 31

		icon = GFX_decision_generic_military

		ai_will_do = {
			base = 0.5
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			surrender_progress > 0.15
		}

		visible = {
			has_completed_focus = SOV_desperate_measures
			any_enemy_country = { SOV_is_major_not_original_sov = yes }
			NOT = { has_country_flag = SOV_order_227_flag }
		}

		ai_hint_pp_cost = 15
		custom_cost_trigger = {
			command_power > 49
			has_political_power > 14
		}
		custom_cost_text = decision_cost_CP_50_pp_15

		days_remove = 90

		cancel_trigger = {
			surrender_progress < 0.05
		}

		complete_effect = {
			hidden_effect = {
				add_command_power = -50
				add_political_power = -15
			}
		}

		modifier = {
			army_speed_factor = -0.1
			army_defence_factor = 0.05
			org_loss_when_moving = -0.1
		}
	}

	SOV_order_227 = {
		priority = 101

		icon = generic_army_support

		ai_will_do = {
			factor = 1
			modifier = {
				surrender_progress > 0.25
				factor = 10
			}
		}

		available = {
			any_enemy_country = {
				SOV_is_major_not_original_sov = yes
			}
			has_completed_focus = SOV_lessons_of_war
			surrender_progress > 0.15
		}

		ai_hint_pp_cost = 50
		custom_cost_trigger = {
			command_power > 49
			has_political_power > 49
		}
		custom_cost_text = decision_cost_CP_50_pp_50

		fire_only_once = yes
		visible = {
			has_war = yes
			any_enemy_country = {
				SOV_is_major_not_original_sov = yes
			}
			has_civil_war = no
		}

		days_remove = 720

		modifier = {
			army_core_defence_factor = 0.25
			mobilization_speed = 0.15
		}

		complete_effect = {
			hidden_effect = {
				add_command_power = -50
				add_political_power = -50
			}
			set_country_flag = SOV_order_227_flag
			custom_effect_tooltip = SOV_order_227_decisions_tt
			if = {
				limit = {
					NOT = { has_dlc = "No Step Back" }
				}
				custom_effect_tooltip = SOV_order_227_scorched_earth_decisions_tt
			}
		}
	}

	SOV_military_offensive_ongoing = {

		icon = hol_draw_up_staff_plans

		allowed = {
			original_tag = SOV
		}

		fire_only_once = yes

		days_mission_timeout = 30

		is_good = no

		activation = {
			always = no
		}

		cancel_trigger = {
			hidden_trigger = {
				has_war = no
			}
		}

		cancel_effect = {
			#log = "Mission cancelled"
			hidden_effect = {
				SOV_clean_military_offensive_effect = yes
			}
		}

		visible = {
			has_country_flag = SOV_order_227_flag
			has_war = yes
			has_country_flag = SOV_military_offensive_in_progress_flag
		}

		available = { #Conditions to succeed in the offensive
			custom_trigger_tooltip = {
				tooltip = SOV_military_offensive_ongoing_trigger_tt
				all_of_scopes = {
					array = SOV_military_offensive_states
					is_controlled_by = ROOT
				}
			}
		}

		timeout_effect = { #FAIL
			#log = "Var = [?SOV_offensive_main_objective.GetName] // Array = [?SOV_military_offensive_states^0.GetName]" #Debug
			if = {
				limit = {
					#var:SOV.SOV_military_offensive_states^0 = {
					var:SOV_offensive_main_objective = {
						is_controlled_by = ROOT
					}
				}
				custom_effect_tooltip = SOV_military_offensive_ongoing_holding_main_objective_tt
			}
			else = {
				custom_effect_tooltip = SOV_military_offensive_ongoing_not_holding_main_objective_tt
				hidden_effect = {
					add_war_support = -0.1
					add_political_power = -75
				}
			}

			custom_effect_tooltip = SOV_military_offensive_ongoing_failing_main_objective_tt
			effect_tooltip = {
				add_war_support = -0.1
				add_political_power = -75
			}

			SOV_clean_military_offensive_effect = yes
		}

		complete_effect = { #SUCCESS
			SOV_clean_military_offensive_effect = yes

			add_war_support = 0.1
			add_political_power = 50
		}
	}

	SOV_military_offensive = {
		priority = 30

		icon = GFX_decision_generic_operation

		ai_will_do = {
			base = 0.5
		}

		state_target = yes

		target_trigger = {
			FROM = {
				SOV_is_military_offensive_main_objective = yes
			}
		}

		target_root_trigger = {
			has_war = yes
			has_country_flag = SOV_order_227_flag
		}

		on_map_mode = map_and_decisions_view

		allowed = {
			original_tag = SOV
		}

		available = {
			NOT = { has_country_flag = SOV_military_offensive_in_progress_flag }
			command_power > 49
		}

		visible = {
			 FROM = {
			 	controller = {
			 		has_war_with = ROOT
			 	}
			 	any_neighbor_state = {
			 		is_controlled_by = ROOT
			 	}
			 }
		}

		cancel_if_not_visible = yes

		cancel_effect = {
			#log = "Preparations cancelled"
			hidden_effect = {
				SOV_clean_military_offensive_effect = yes
			}
		}

		ai_hint_pp_cost = 15
		custom_cost_trigger = {
			command_power > 49
			has_political_power > 14
		}
		custom_cost_text = decision_cost_CP_50_pp_15

		days_remove = 14

		modifier = {
			command_power_gain_mult = -0.5
		}

		complete_effect = {
			hidden_effect = {
				add_command_power = -50
				add_political_power = -15
			}
			set_country_flag = SOV_military_offensive_in_progress_flag
		}

		remove_effect = {
			custom_effect_tooltip = SOV_military_offensive_scope_tt
			custom_effect_tooltip = SOV_military_offensive_current_scope_main_objective_tt
			effect_tooltip = {
				FROM = { #RZHEV
					custom_effect_tooltip = SOV_military_offensive_current_scope_negihbors_tt
					every_neighbor_state = { #NEIGHBOR STATES
						limit = {
							controller = { has_war_with = ROOT }
						}
					}
				}
			}

			hidden_effect = {
				set_variable = { SOV_offensive_main_objective = FROM } #This variable exists because trying to scope to the element 0 of an array causes an error :D (!)
				FROM = {
					ROOT = { add_to_array = { SOV_military_offensive_states = PREV } }
					every_neighbor_state = { #NEIGHBOR STATES
						limit = {
							controller = { has_war_with = ROOT }
						}
						ROOT = { add_to_array = { SOV_military_offensive_states = PREV } }
					}
				}
				SOV_set_military_offensive_effect = yes

				activate_mission = SOV_military_offensive_ongoing
			}
			custom_effect_tooltip = SOV_military_offensive_activate_decision_tt
		}
	}

	SOV_operation_iskra_ongoing = {

		icon = hol_draw_up_staff_plans

		allowed = {
			original_tag = SOV
		}

		fire_only_once = yes

		days_mission_timeout = 30

		is_good = no

		activation = {
			always = no
		}

		cancel_trigger = {
			hidden_trigger = {
				has_war = no
			}
		}

		cancel_effect = {
			hidden_effect = {
				SOV_clean_military_offensive_effect = yes
			}
		}

		visible = {
			has_country_flag = SOV_order_227_flag
			has_war = yes
			has_country_flag = SOV_military_offensive_in_progress_flag
		}

		available = { #You succeed by having Leningrad being connected to the rest of the country at the end of the mission
			custom_trigger_tooltip = {
				tooltip = SOV_operation_iskra_ongoing_objective_tt
				195 = { is_in_home_area = yes }
			}
		}

		timeout_effect = {  #FAIL
			custom_effect_tooltip = SOV_operation_iskra_ongoing_success_effects_tt
			effect_tooltip = {
				add_war_support = 0.1
				add_political_power = 50
			}
			custom_effect_tooltip = SOV_operation_iskra_ongoing_failure_effects_tt
			effect_tooltip = {
				add_war_support = -0.1
				add_political_power = -75
			}

			if = {
				limit = {
					195 = { is_in_home_area = yes }
				}
				custom_effect_tooltip = SOV_operation_iskra_ongoing_success_tt
				hidden_effect = {
					add_war_support = 0.1
					add_political_power = 50
				}
			}
			else = {
				custom_effect_tooltip = SOV_operation_iskra_ongoing_failure_tt
				hidden_effect = {
					add_war_support = -0.1
					add_political_power = -75
				}
			}
			SOV_clean_military_offensive_effect = yes
		}

		complete_effect = {
			SOV_clean_military_offensive_effect = yes
		}
	}

	SOV_operation_iskra = { #SPECIAL OFFENSIVE - LENINGRAD HAS NOT FALLEN BUT IT IS SURROUNDED
		priority = 30

		icon = GFX_decision_generic_operation

		ai_will_do = {
			base = 1
		}

		highlight_states = {
			highlight_state_targets = {
				state = 208 #LUGA
				state = 244 #VOLKHOV
			}
		}

		on_map_mode = map_and_decisions_view

		allowed = {
			original_tag = SOV
		}

		available = {
			NOT = { has_country_flag = SOV_military_offensive_in_progress_flag }
			command_power > 49
			OR = {
				controls_state = 263 #NOVGOROD
				controls_state = 264 #TIKHVIN
			}
		}

		visible = {
			has_war = yes
			has_country_flag = SOV_order_227_flag
			244 = {
				controller = { has_war_with = ROOT }
			}
			208 = {
				controller = { has_war_with = ROOT }
			}
			195 = { is_controlled_by = ROOT }
		}

		ai_hint_pp_cost = 15
		custom_cost_trigger = {
			command_power > 49
			has_political_power > 14
		}
		custom_cost_text = decision_cost_CP_50_pp_15

		fire_only_once = yes

		days_remove = 14

		modifier = {
			command_power_gain_mult = -0.5
		}

		complete_effect = {
			hidden_effect = {
				add_command_power = -50
				add_political_power = -15
			}
			set_country_flag = SOV_military_offensive_in_progress_flag
		}

		remove_effect = {
			custom_effect_tooltip = SOV_operation_iskra_tt
			hidden_effect = {
				195 = {
					ROOT = { add_to_array = { SOV_military_offensive_states = PREV } }
				}
				208 = {
					ROOT = { add_to_array = { SOV_military_offensive_states = PREV } }
				}
				244 = {
					ROOT = { add_to_array = { SOV_military_offensive_states = PREV } }
				}
				SOV_set_military_offensive_effect = yes

				activate_mission = SOV_operation_iskra_ongoing
			}
			custom_effect_tooltip = SOV_operation_iskra_activate_decision_tt
		}
	}

	SOV_the_rush_for_berlin = {
		priority = 100

		icon = GFX_decision_generic_nationalism

		ai_will_do = {
			base = 1
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			any_controlled_state = {
				is_core_of = GER
				NOT = { state = 763 }
				NOT = { state = 5 }
				NOT = { state = 85 }
			}
			any_other_country = {
				is_major = yes
				NOT = { is_in_faction_with = ROOT }
				has_war_with = GER
				any_controlled_state = {
					is_core_of = GER
				}
			}
			has_completed_focus = SOV_lessons_of_war
			has_country_flag = SOV_great_patriotic_war_flag
		}

		visible = {
			has_war_with = GER
			any_controlled_state = {
				is_core_of = GER
			}
			any_other_country = {
				is_major = yes
				NOT = { is_in_faction_with = ROOT }
				has_war_with = GER
			}
		}

		fire_only_once = yes

		ai_hint_pp_cost = 50
		custom_cost_trigger = {
			command_power > 49
			has_political_power > 49
		}
		custom_cost_text = decision_cost_CP_50_pp_50

		complete_effect = {
			hidden_effect = {
				add_command_power = -50
				add_political_power = -50
			}
			add_timed_idea = {
				idea = SOV_the_rush_for_berlin
				days = 365
			}
		}
	}
	
	#added in r56, needed with NSB? -Fantom
	#strengthen_the_state = {
	#	allowed = {
	#		original_tag = SOV
	#	}
	#	available = {
	#		has_defensive_war_with = GER
	#		has_stability < 0.50
	#	}
	#	cost = 0
	#	visible = {
	#		has_government = communism
	#		is_ai = yes
	#	}
	#	
	#	ai_will_do = {
	#		base = 1000
	#	}
	#	fire_only_once = yes
	#	complete_effect = {
	#		add_stability = 0.20                
	#	}
	#}

	#217 "Stalingrad"
	SOV_hold_stalingrad = {

		icon = generic_civil_support

		allowed = {
			original_tag = SOV
		}

		#Fail trigger
		available = {
			NOT = { controls_state = 217 }
		}

		days_mission_timeout = 180

		fire_only_once = yes

		is_good = yes

		activation = {
			has_war = yes
			has_civil_war = no
			217 = {
				is_controlled_by = ROOT
				OR = {
					any_neighbor_state = {
						CONTROLLER = {
							has_war_with = ROOT
						}
						OWNER = { tag = ROOT }
					}
					NOT = { is_fully_controlled_by = ROOT }
				}
			}
		}

		#Success
		timeout_effect = {
			add_stability = 0.05
			add_war_support = 0.05
			217 = { save_event_target_as = state }
			country_event = wtt_soviet_hold_city.1
		}
		#Fail
		complete_effect = {
			217 = { save_event_target_as = state }
			country_event = wtt_soviet_hold_city.2
		}
	}

	#195 "Leningrad"
	SOV_hold_leningrad = {

		icon = generic_civil_support

		allowed = {
			original_tag = SOV
		}

		#Fail trigger
		available = {
			NOT = { controls_state = 195 }
		}

		days_mission_timeout = 180

		fire_only_once = yes

		is_good = yes

		activation = {
			has_war = yes
			has_civil_war = no
			any_enemy_country = {
				is_major = yes
			}
			195 = {
				is_controlled_by = ROOT
				OR = {
					any_neighbor_state = {
						CONTROLLER = {
							has_war_with = ROOT
						}
						OWNER = { tag = ROOT }
					}
					NOT = { is_fully_controlled_by = ROOT }
				}
			}
		}

		#Success
		timeout_effect = {
			add_stability = 0.05
			add_war_support = 0.05
			195 = { save_event_target_as = state }
			country_event = wtt_soviet_hold_city.3
		}
		#Fail
		complete_effect = {
			195 = { save_event_target_as = state }
			country_event = wtt_soviet_hold_city.4
		}
	}

	#219 "Moscow"
	SOV_hold_moscow = {

		icon = generic_civil_support

		allowed = {
			original_tag = SOV
		}

		#Fail trigger
		available = {
			NOT = { controls_state = 219 }
		}

		days_mission_timeout = 180

		fire_only_once = yes

		is_good = yes

		activation = {
			has_war = yes
			has_civil_war = no
			219 = {
				is_controlled_by = ROOT
				OR = {
					any_neighbor_state = {
						CONTROLLER = {
							has_war_with = ROOT
						}
						OWNER = { tag = ROOT }
					}
					NOT = { is_fully_controlled_by = ROOT }
				}
			}
		}

		#Success
		timeout_effect = {
			add_stability = 0.05
			add_war_support = 0.05
			219 = { save_event_target_as = state }
			country_event = wtt_soviet_hold_city.5
		}
		#Fail
		complete_effect = {
			219 = { save_event_target_as = state }
			country_event = wtt_soviet_hold_city.6
		}
	}

	##########################
	##### SCORCHED EARTH #####
	##########################

	SOV_scorched_earth = {

		icon = generic_scorched_earth
		allowed = {
			NOT = {
				has_dlc = "No Step Back"
			}
		}
		available = {
			has_war = yes
			any_enemy_country = {
				SOV_is_major_not_original_sov = yes
			}
			surrender_progress > 0
			NOT = { has_country_flag = SOV_order_227_flag }
		}

		cost = 50
		fire_only_once = yes
		visible = {
			has_completed_focus = SOV_desperate_measures
			NOT = { has_country_flag = SOV_order_227_flag }
		}

		complete_effect = {
			set_country_flag = SOV_scorched_earth
			unlock_decision_tooltip = SOV_scorched_earth_baltics
			unlock_decision_tooltip = SOV_scorched_earth_byelorussia
			unlock_decision_tooltip = SOV_scorched_earth_ukraine
			unlock_decision_tooltip = SOV_scorched_earth_stalingrad
			unlock_decision_tooltip = SOV_scorched_earth_caucasus
			unlock_decision_tooltip = SOV_scorched_earth_moscow
		}

		ai_will_do = {
			factor = 1

			modifier = {
				factor = 0
				SOV_save_pp_for_manpower_trouble = yes
			}
		}
	}

	SOV_scorched_earth_baltics = {

		icon = generic_scorched_earth
		allowed = {
			NOT = {
				has_dlc = "No Step Back"
			}
		}
		available = {
			has_war = yes
			has_country_flag = SOV_scorched_earth
			has_equipment = {
				support_equipment > 24
			}
			NOT = { has_country_flag = SOV_order_227_flag }
		}

		cost = 50
		fire_only_once = yes
		visible = {
			has_country_flag = SOV_scorched_earth
			NOT = { has_country_flag = SOV_order_227_flag }
			OR = {
				#LIT
				controls_state = 188
				controls_state = 814
				controls_state = 189
				controls_state = 11
				controls_state = 815
				#LAT
				controls_state = 190
				controls_state = 12
				controls_state = 809
				controls_state = 810
				controls_state = 808
				#EST
				controls_state = 191
				controls_state = 13
				controls_state = 811
				controls_state = 812
				controls_state = 813
			}

		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = support_equipment_1
				amount = -25
			}
			every_controlled_state = {
				limit = {
					OR = {
						#LIT
						state = 188
						state = 814
						state = 189
						state = 11
						state = 815
						#LAT
						state = 190
						state = 12
						state = 809
						state = 810
						state = 808
						#EST
						state = 191
						state = 13
						state = 811
						state = 812
						state = 813
					}
				}
				damage_building = {
					type = infrastructure
					damage = 3
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	SOV_scorched_earth_byelorussia = {

		icon = generic_scorched_earth
		allowed = {
			NOT = {
				has_dlc = "No Step Back"
			}
		}
		available = {
			has_war = yes
			has_country_flag = SOV_scorched_earth
			has_equipment = {
				support_equipment > 49
			}
			NOT = { has_country_flag = SOV_order_227_flag }
		}

		cost = 75
		fire_only_once = yes
		visible = {
			has_country_flag = SOV_scorched_earth
			NOT = { has_country_flag = SOV_order_227_flag }
			any_of = {
				array = BLR.core_states
				var:v = { is_controlled_by = SOV }
			}
		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = support_equipment_1
				amount = -50
			}
			every_state = {
				limit = {
					is_core_of = BLR
					is_controlled_by = SOV
				}
				damage_building = {
					type = infrastructure
					damage = 3
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	SOV_scorched_earth_ukraine = {

		icon = generic_scorched_earth
		allowed = {
			NOT = {
				has_dlc = "No Step Back"
			}
		}
		available = {
			has_war = yes
			has_country_flag = SOV_scorched_earth
			has_equipment = {
				support_equipment > 74
			}
		}

		cost = 75
		fire_only_once = yes
		visible = {
			has_country_flag = SOV_scorched_earth
			any_of = {
				array = UKR.core_states
				var:v = { is_controlled_by = SOV }
			}
		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = support_equipment_1
				amount = -75
			}
			every_state = {
				limit = {
					is_core_of = UKR
					is_controlled_by = SOV
				}
				damage_building = {
					type = infrastructure
					damage = 3
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	SOV_scorched_earth_caucasus = {

		icon = generic_scorched_earth
		allowed = {
			NOT = {
				has_dlc = "No Step Back"
			}
		}
		available = {
			has_war = yes
			has_country_flag = SOV_scorched_earth
			has_equipment = {
				support_equipment > 49
			}
			NOT = { has_country_flag = SOV_order_227_flag }
		}

		cost = 75
		fire_only_once = yes
		visible = {
			has_country_flag = SOV_scorched_earth
			NOT = { has_country_flag = SOV_order_227_flag }
			OR = {
				controls_state = 229
				controls_state = 230
				controls_state = 231
				controls_state = 232
				controls_state = 233
				controls_state = 234
				controls_state = 235
				controls_state = 821
				controls_state = 826
				controls_state = 827
				controls_state = 828
			}

		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = support_equipment_1
				amount = -50
			}
			every_controlled_state = {
				limit = {
					OR ={
						state = 229
						state = 230
						state = 231
						state = 232
						state = 233
						state = 234
						state = 235
						state = 821
						state = 826
						state = 827
						state = 828
					}
				}
				damage_building = {
					type = infrastructure
					damage = 3
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	SOV_scorched_earth_stalingrad = {

		icon = generic_scorched_earth
		allowed = {
			NOT = {
				has_dlc = "No Step Back"
			}
		}
		available = {
			has_war = yes
			has_country_flag = SOV_scorched_earth
			has_equipment = {
				support_equipment > 49
			}
			NOT = { has_country_flag = SOV_order_227_flag }
		}

		cost = 75
		fire_only_once = yes
		visible = {
			has_country_flag = SOV_scorched_earth
			NOT = { has_country_flag = SOV_order_227_flag }
			OR = {
				controls_state = 245
				controls_state = 217
				controls_state = 218
				controls_state = 238
				controls_state = 237
				controls_state = 236
				controls_state = 265
				controls_state = 829
			}
		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = support_equipment_1
				amount = -50
			}
			every_controlled_state = {
				limit = {
					OR ={
						state = 245
						state = 217
						state = 218
						state = 238
						state = 237
						state = 236
						state = 265
						state = 829
					}
				}
				damage_building = {
					type = infrastructure
					damage = 3
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	SOV_scorched_earth_moscow = {

		icon = generic_scorched_earth
		allowed = {
			NOT = {
				has_dlc = "No Step Back"
			}
		}
		available = {
			has_war = yes
			has_country_flag = SOV_scorched_earth
			has_equipment = {
				support_equipment > 49
			}
			NOT = { has_country_flag = SOV_order_227_flag }
		}

		cost = 75
		fire_only_once = yes
		visible = {
			has_country_flag = SOV_scorched_earth
			NOT = { has_country_flag = SOV_order_227_flag }
			OR = {
				controls_state = 220
				controls_state = 222
				controls_state = 224
				controls_state = 243
				controls_state = 205
				controls_state = 242
				controls_state = 246
				controls_state = 219
			}
		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = support_equipment_1
				amount = -50
			}
			every_state = {
				limit = {
					OR = {
						state = 220
						state = 222
						state = 224
						state = 243
						state = 205
						state = 242
						state = 246
						state = 219
					}
					is_controlled_by = SOV
				}
				damage_building = {
						type = infrastructure
						damage = 3
					}
			}

		}

		ai_will_do = {
			factor = 1
		}
	}
}

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

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


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

SOV_soviet_civil_war_dec_cat = {

	SOV_the_head_of_the_nkvd_yezhov = {

		icon = GFX_decision_generic_political_discourse # TODO set right image

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}
		ai_will_do = {
			base = 500 # Always do if you can!
		}
		cost = 50

		days_remove = 90
		fire_only_once = yes

		visible = {
			has_completed_focus = SOV_the_plan_for_the_coup
			SOV_soviet_civil_war_not_started = yes
			has_idea = SOV_nikolay_yezhov
			SOV_nikolay_yezhov = {
				NOT = { has_character_flag = SOV_aligned_right_opposition_flag }
			}
		}
		cancel_if_not_visible = yes

		complete_effect = {
			random_list = {
				30 = { SOV_paranoia_very_low_increase_effect = yes }
				50 = { SOV_paranoia_low_increase_effect = yes }
				20 = { SOV_paranoia_medium_increase_effect = yes }
			}
		}
		remove_effect = {
			SOV_nikolay_yezhov = {
				set_character_flag = SOV_aligned_right_opposition_flag
			}
			custom_effect_tooltip = SOV_the_head_of_the_nkvd_yezhov_tt

		}
	}

	SOV_the_head_of_the_nkvd_yagoda = {

		icon = GFX_decision_generic_political_discourse

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}
		ai_will_do = {
			base = 500 # Always do if you can!
		}
		cost = 50
		fire_only_once = yes

		days_remove = 60

		visible = {
			has_completed_focus = SOV_the_plan_for_the_coup
			SOV_soviet_civil_war_not_started = yes
			has_idea = SOV_genrikh_yagoda
			SOV_genrikh_yagoda = {
				NOT = { has_character_flag = SOV_aligned_right_opposition_flag }
			}
		}
		cancel_if_not_visible = yes

		complete_effect = {
			random_list = {
				50 = { SOV_paranoia_very_low_increase_effect = yes }
				30 = { SOV_paranoia_low_increase_effect = yes }
				20 = { SOV_paranoia_medium_increase_effect = yes }
			}
		}
		remove_effect = {
			SOV_genrikh_yagoda = {
				set_character_flag = SOV_aligned_right_opposition_flag
			}
			custom_effect_tooltip = SOV_the_head_of_the_nkvd_yagoda_tt
		}
	}

	SOV_assassinate_stalin = {

		icon = GFX_decision_generic_political_discourse # TODO set right image

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}
		ai_will_do = {
			base = 200
			modifier = {
				factor = 0.01
				check_variable = { ROOT.SOV_paranoia > 69 } # Very careful
			}
			modifier = {
				factor = 0.75
				check_variable = { ROOT.SOV_paranoia > 49 } # Slightly careful
			}
			modifier = {
				factor = 2.5
				check_variable = { ROOT.SOV_paranoia < 20 } # totally safe!
			}
		}
		cost = 50

		days_remove = 14
		# fire_only_once = yes
		days_re_enable = 30

		visible = {
			OR = {
				AND = {
					has_idea = SOV_genrikh_yagoda
					SOV_genrikh_yagoda = { has_character_flag = SOV_aligned_right_opposition_flag }
				}
				AND = {
					has_idea = SOV_nikolay_yezhov
					SOV_nikolay_yezhov = { has_character_flag = SOV_aligned_right_opposition_flag }
				}
			}
			has_character = SOV_iosif_stalin
			SOV_soviet_civil_war_not_started = yes

		}
		cancel_if_not_visible = yes

		complete_effect = {
			#random_list = {
			#	50 = { SOV_paranoia_very_low_increase_effect = yes }
			#	30 = { SOV_paranoia_low_increase_effect = yes }
			#	20 = { SOV_paranoia_medium_increase_effect = yes }
			#}
		}
		remove_effect = {
			IF = {
				limit = {
					has_completed_focus = SOV_infiltrate_the_nkvd
				}
				custom_effect_tooltip = SOV_assassinate_stalin_good_tt
				custom_effect_tooltip = SOV_assassinate_stalin_outcome_tt
				hidden_effect = {
					random_list = {
						100 = {
							retire_character = SOV_iosif_stalin
							SOV_promote_to_country_leader_beriya = yes
							news_event = {
								id = NSB_soviet_communist_civil_war.009
							}
							subtract_from_variable = { SOV_paranoia_weekly_modifiers_amount = 2 } #Stalin will always have the Authority Undermined trait (+2 weekly Paranoia)
							SOV_paranoia_modifier_update_gui_tooltip = yes #Update Paranoia UI
						}
						0 = {
							SOV_paranoia_very_high_increase_effect = yes
							news_event = {
								id = NSB_soviet_communist_civil_war.008
							}
						}
					}
					# TODO Create events
				}
			}
			ELSE = {
				custom_effect_tooltip = SOV_assassinate_stalin_bad_tt
				custom_effect_tooltip = SOV_assassinate_stalin_outcome_tt
				hidden_effect = {
					random_list = {
						80 = {
							retire_character = SOV_iosif_stalin
							SOV_promote_to_country_leader_beriya = yes
							news_event = {
								id = NSB_soviet_communist_civil_war.009
							}
						}
						20 = {
							SOV_paranoia_very_high_increase_effect = yes
							news_event = {
								id = NSB_soviet_communist_civil_war.008
							}
						}
					}
				}
			}

		}
	}

	SOV_send_supporters_abroad = {

		icon = GFX_decision_generic_political_discourse

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}
		ai_will_do = {
			base = 250
		}
		cost = 25	#was 50, starved of pp at this point anyway...	-Fantom

		days_remove = 30

		visible = {
			has_completed_focus = SOV_committee_in_exile
			SOV_soviet_civil_war_not_started = yes
			any_character = {
				OR = {
					has_character_flag = SOV_aligned_left_opposition_flag
					has_trait = trait_SOV_trotskyist
				}
				NOT = { has_character_flag = SOV_exiled_flag }
				NOT = { has_character_flag = SOV_imprisoned_flag }
				NOT = { has_character_flag = SOV_character_purged_flag }
			}
		}

		complete_effect = {
			custom_effect_tooltip = SOV_send_supporters_abroad_exile_tt
			every_character = {
				limit = {
					OR = {
						has_character_flag = SOV_aligned_left_opposition_flag
						has_trait = trait_SOV_trotskyist
					}
					NOT = { has_character_flag = SOV_exiled_flag }
					NOT = { has_character_flag = SOV_imprisoned_flag }
					NOT = { has_character_flag = SOV_character_purged_flag }
				}
				set_character_flag = SOV_exiled_flag
			}
			custom_effect_tooltip = SOV_send_supporters_abroad_back_tt
		}
	}

	SOV_wreckers_sabotage_contruction = {

		icon = GFX_decision_generic_wreckers

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}
		ai_will_do = {
			base = 250
		}

		cost = 15
		fire_only_once = no
		days_re_enable = 60

		visible = {
			any_enemy_country = { has_idea = SOV_organized_wreckers_idea }
		}

		complete_effect = {
			SOS = {
				custom_effect_tooltip = SOV_wreckers_sabotage_contruction_tt

				hidden_effect = {
					every_controlled_state = {
						limit = {
							is_controlled_by = SOS
							industrial_complex > 2
						}
						damage_building = {
							type = industrial_complex
							damage = 2
						}
					}
				}
			}
		}
	}

	SOV_wreckers_sabotage_military_production = {

		icon = GFX_decision_generic_wreckers

		allowed = {
			original_tag = SOV
		}

		available = {

		}
		ai_will_do = {
			base = 250 # Do it if you have the PP
		}
		cost = 15
		fire_only_once = no
		days_re_enable = 60

		visible = {
			any_enemy_country = { has_idea = SOV_organized_wreckers_idea }
		}

		complete_effect = {
			SOS = {
				custom_effect_tooltip = SOV_wreckers_sabotage_military_production_tt
				hidden_effect = {
					every_controlled_state = {
						limit = {
							arms_factory  > 2
						}
						damage_building = {
							type = arms_factory
							damage = 2
						}
					}
				}
			}
		}
	}

	SOV_wreckers_sabotage_dockyards = {

		icon = GFX_decision_generic_wreckers

		allowed = {
			original_tag = SOV
		}

		available = {

		}
		ai_will_do = {
			base = 150 # only if we have nothing better to spend on
		}
		cost = 10
		fire_only_once = no
		days_re_enable = 60

		visible = {
			any_enemy_country = { has_idea = SOV_organized_wreckers_idea }
		}

		complete_effect = {
			SOS = {
				custom_effect_tooltip = SOV_wreckers_sabotage_dockyards_tt
				hidden_effect = {
					every_controlled_state = {
						limit = {
							dockyard  > 2
						}
						damage_building = {
							type = dockyard
							damage = 2
						}
					}
				}
			}
		}
	}


	SOV_wreckers_sabotage_railways = {

		icon = GFX_decision_generic_wreckers

		allowed = {
			original_tag = SOV
		}

		available = {

		}
		ai_will_do = {
			base = 250 # Do it if you have the PP
		}
		cost = 15
		fire_only_once = no
		days_re_enable = 60

		visible = {
			any_enemy_country = { has_idea = SOV_organized_wreckers_idea }
		}

		complete_effect = {
			SOS = {
				custom_effect_tooltip = SOV_wreckers_sabotage_railways_tt
				hidden_effect = {
					random_controlled_state = {
						damage_building = {
							type = rail_way
							damage = 1
						}
						set_state_flag = railway_damaged_flag
						#LOG = "Damage Railway 1 in [THIS.GetName]"
					}
					random_controlled_state = {
						limit = { NOT = { has_state_flag = railway_damaged_flag }}
						damage_building = {
							type = rail_way
							damage = 1
						}
						set_state_flag = railway_damaged_flag
						#LOG = "Damage Railway 2 in [THIS.GetName]"
					}
					random_controlled_state = {
						limit = { NOT = { has_state_flag = railway_damaged_flag }}
						damage_building = {
							type = rail_way
							damage = 1
						}
						set_state_flag = railway_damaged_flag
						#LOG = "Damage Railway 2 in [THIS.GetName]"
					}
					every_owned_state = {
						limit = { has_state_flag = railway_damaged_flag }
						clr_state_flag = railway_damaged_flag
					}
				}
			}
		}
	}

	SOV_secure_moscow_opposition = {

		icon = GFX_decision_revolt

		allowed = {
			original_tag = SOV
		}

		available = {
			NOT = { has_decision = SOV_secure_leningrad_opposition }
		}
		ai_will_do = {
			base = 10
			modifier = {
				add = 200
				check_variable = { ROOT.SOV_paranoia < 25 }
			}
		}
		cost = 25
		days_remove = 15
		fire_only_once = yes

		visible = {
			hidden_trigger = { has_completed_focus = SOV_align_the_zinovyevites }
			NOT = { has_global_flag = SOV_soviet_civil_war }
		}
		cancel_if_not_visible = yes

		complete_effect = {
			random_list = {
				20 = { SOV_paranoia_very_low_increase_effect = yes }
				60 = { SOV_paranoia_low_increase_effect = yes }
				20 = { SOV_paranoia_medium_increase_effect = yes }
			}
		}
		remove_effect = {
			custom_effect_tooltip = SOV_secure_moscow_opposition_tt
			219 = { set_state_flag = SOV_opposition_partisans_flag }
			SOV_opposition_support_high_increase_effect = yes
		}
	}

	SOV_secure_leningrad_opposition = {

		icon = GFX_decision_revolt

		allowed = {
			original_tag = SOV
		}

		available = {
			NOT = { has_decision = SOV_secure_moscow_opposition }
			195 = { SOV_is_unaligned_state = yes  }
		}
		ai_will_do = {
			base = 10
			modifier = {
				add = 200
				check_variable = { ROOT.SOV_paranoia < 25 }
			}
		}
		cost = 25
		days_remove = 15
		fire_only_once = yes

		highlight_states = {
			highlight_color_while_active = 1
		}

		visible = {
			hidden_trigger = { has_completed_focus = SOV_align_the_zinovyevites }

			NOT = { has_global_flag = SOV_soviet_civil_war }
		}
		cancel_if_not_visible = yes

		complete_effect = {
			random_list = {
				20 = { SOV_paranoia_very_low_increase_effect = yes }
				60 = { SOV_paranoia_low_increase_effect = yes }
				20 = { SOV_paranoia_medium_increase_effect = yes }
			}
		}
		remove_effect = {
			custom_effect_tooltip = SOV_secure_leningrad_opposition_tt
			195 = { set_state_flag = SOV_opposition_partisans_flag }
			SOV_opposition_support_high_increase_effect = yes
		}
	}

	SOV_army_framejob = {
		icon = generic_police_action
		available = {
			IF = {
				limit = { SOV_is_exiles = yes }
				any_army_leader = {
					NOT = { has_trait = trait_SOV_monarchist_sympathizer }
					NOT = { has_trait = trait_SOV_stalinist }
				}
			}
			IF = {
				limit = { SOV_is_left_opposition = yes }
				any_army_leader = {
					NOT = { has_trait = trait_SOV_trotskyist }
					NOT = { has_trait = trait_SOV_stalinist }
				}
			}
			IF = {
				limit = { SOV_is_right_opposition = yes }
				any_army_leader = {
					NOT = { has_trait = trait_SOV_bukharinist }
					NOT = { has_trait = trait_SOV_stalinist }
				}
			}
		}
		visible = {
			SOV_soviet_civil_war_not_started = yes
			hidden_trigger = {
				OR = {
					has_completed_focus = SOV_divert_attention_towards_military
					has_completed_focus = SOV_covert_operations
				}
			}
		}
		cost = SOV_army_framejob_decision_cost
		fire_only_once = no
		days_remove = 14
		days_re_enable = SOV_army_framejob_decision_re_enable_days
		ai_will_do = {
			base = 0
			modifier = { # Do if paranoia is above "totally safe level"
				add = 100
				check_variable = { ROOT.SOV_paranoia > 20 }
			}
			modifier = { # Prio if paranoia is at dangerous level
				add = 120
				check_variable = { ROOT.SOV_paranoia > 60 }
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
				check_variable = { ROOT.SOV_paranoia < 90 }
			}

		}
		complete_effect = {
		}
		remove_effect = {
			hidden_effect = {
				random_army_leader = {
					limit = {
						NOT = { has_character_flag = SOV_safe_from_purge_flag }
						NOT = { has_trait = trait_SOV_monarchist_sympathizer }
						NOT = { has_trait = trait_SOV_trotskyist }
						NOT = { has_trait = trait_SOV_bukharinist }
						NOT = { has_trait = trait_SOV_stalinist }
					}
					set_character_flag = SOV_potential_target_flag
					#log = "targeted leader = [THIS.GetName]"
				}

			}
			custom_effect_tooltip = SOV_army_framejob_tt
			SOV_regular_purge_general_accused_effect = yes
			custom_effect_tooltip = SOV_army_framejob_cd_tt
			add_to_variable = { SOV_army_framejob_decision_re_enable_days = 30 }
			add_to_variable = { SOV_army_framejob_decision_re_enable_days_display = 30 }
			add_to_variable = { SOV_army_framejob_decision_cost = 25 }
		}
	}
	SOV_navy_framejob = {
		icon = generic_police_action
		available = {
			IF = {
				limit = { SOV_is_exiles = yes }
				any_navy_leader = {
					NOT = { has_trait = trait_SOV_monarchist_sympathizer }
					NOT = { has_trait = trait_SOV_stalinist }
				}
			}
			IF = {
				limit = { SOV_is_left_opposition = yes }
				any_navy_leader = {
					NOT = { has_trait = trait_SOV_trotskyist }
					NOT = { has_trait = trait_SOV_stalinist }
				}
			}
			IF = {
				limit = { SOV_is_right_opposition = yes }
				any_navy_leader = {
					NOT = { has_trait = trait_SOV_bukharinist }
					NOT = { has_trait = trait_SOV_stalinist }
				}
			}
		}
		visible = {
			SOV_soviet_civil_war_not_started = yes
			hidden_trigger = {
				OR = {
					has_completed_focus = SOV_divert_attention_towards_military
					has_completed_focus = SOV_covert_operations
				}
			}
		}
		cost = SOV_navy_framejob_decision_cost
		fire_only_once = no
		days_remove = 14
		days_re_enable = SOV_navy_framejob_decision_re_enable_days
		ai_will_do = {
			base = 0
			modifier = { # Do if paranoia is above "totally safe level" but not as keen as for the army version
				add = 50
				check_variable = { ROOT.SOV_paranoia > 25 }
			}
			modifier = { # Prio if paranoia is at dangerous level
				add = 150
				check_variable = { ROOT.SOV_paranoia > 80 }
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
		}
		complete_effect = {
		}
		remove_effect = {
			hidden_effect = {
				random_navy_leader = {
					limit = {
						NOT = { has_character_flag = SOV_safe_from_purge_flag }
						NOT = { has_trait = trait_SOV_monarchist_sympathizer }
						NOT = { has_trait = trait_SOV_trotskyist }
						NOT = { has_trait = trait_SOV_bukharinist }
						NOT = { has_trait = trait_SOV_stalinist }
					}
					set_character_flag = SOV_potential_target_flag
					#log = "targeted leader = [THIS.GetName]"
				}
			}
			custom_effect_tooltip = SOV_navy_framejob_tt
			SOV_trigger_regular_purge_admiral_accused_effect = yes
			custom_effect_tooltip = SOV_navy_framejob_cd_tt
			add_to_variable = { SOV_navy_framejob_decision_re_enable_days = 30 }
			add_to_variable = { SOV_navy_framejob_decision_re_enable_days_display = 30 }
			add_to_variable = { SOV_navy_framejob_decision_cost = 25 }
		}
	}

	SOV_recruit_general_opposition = {

		icon = GFX_decision_generic_army_support

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}
		ai_will_do = {
			base = 150
			modifier = {
				factor = 0
				check_variable = { ROOT.SOV_paranoia > 70 } # Not worth the risk if Paranoia too high
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
		}
		cost = SOV_influence_general_decision_cost
		days_remove = 15
		days_re_enable = 30

		visible = {
			hidden_trigger = {
				OR = {
					has_completed_focus = SOV_military_support # Left Opp
					# has_completed_focus = SOV_embrace_the_black_hundreds # Exiles
				}
			}
			NOT = { has_global_flag = SOV_soviet_civil_war } # too late if the war has already started
		}
		cancel_if_not_visible = yes

		complete_effect = {
			random_list = {
				20 = { SOV_paranoia_very_low_increase_effect = yes }
				60 = { SOV_paranoia_low_increase_effect = yes }
				20 = { SOV_paranoia_medium_increase_effect = yes }
			}
		}
		remove_effect = {
			custom_effect_tooltip = SOV_recruit_general_opposition_tt
			custom_effect_tooltip = SOV_recruit_cd_tt
			hidden_effect = {
				IF = {
					limit = {
						SOV_is_left_opposition = yes
					}
					random_army_leader = {
						limit = {
							NOT = { has_trait = trait_SOV_stalinist }
							NOT = { has_trait = trait_SOV_bukharinist }
							NOT = { has_trait = trait_SOV_trotskyist }
							NOT = { has_trait = trait_SOV_monarchist_sympathizer }
						}
						add_unit_leader_trait = trait_SOV_trotskyist
						set_character_flag = SOV_aligned_left_opposition_flag
					}
				}
				ELSE_IF = {
					limit = {
						SOV_is_right_opposition = yes
					}
					random_army_leader = {
						limit = {
							NOT = { has_trait = trait_SOV_stalinist }
							NOT = { has_trait = trait_SOV_bukharinist }
							NOT = { has_trait = trait_SOV_trotskyist }
							NOT = { has_trait = trait_SOV_monarchist_sympathizer }
						}
						add_unit_leader_trait = trait_SOV_bukharinist
						set_character_flag = SOV_aligned_right_opposition_flag
					}
				}
				ELSE_IF = {
					limit = {
						SOV_is_exiles = yes
					}
					random_army_leader = {
						limit = {
							NOT = { has_trait = trait_SOV_stalinist }
							NOT = { has_trait = trait_SOV_bukharinist }
							NOT = { has_trait = trait_SOV_trotskyist }
							NOT = { has_trait = trait_SOV_monarchist_sympathizer }
						}
						add_unit_leader_trait = trait_SOV_monarchist_sympathizer
						set_character_flag = SOV_exiled_army_leader
					}
				}
				add_to_variable = { SOV_influence_general_decision_cost = 10 }
			}
		}
	}

	SOV_recruit_admiral_opposition = {

		icon = GFX_decision_generic_army_support

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}
		ai_will_do = {
			base = 50
			modifier = {
				factor = 1.5
				SOV_is_right_opposition = yes
			}
			modifier = {
				factor = 0
				check_variable = { ROOT.SOV_paranoia > 60 } # Not worth the risk if Paranoia too high
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
		}
		cost = SOV_influence_admiral_decision_cost
		days_re_enable = 30
		days_remove = 15

		visible = {
			hidden_trigger = {
				OR = {
					has_completed_focus = SOV_military_support # Left Opp
					# has_completed_focus = SOV_embrace_the_black_hundreds # Exiles
				}
			}
			NOT = { has_global_flag = SOV_soviet_civil_war }
		}
		cancel_if_not_visible = yes

		complete_effect = {
			random_list = {
				20 = { SOV_paranoia_very_low_increase_effect = yes }
				60 = { SOV_paranoia_low_increase_effect = yes }
				20 = { SOV_paranoia_medium_increase_effect = yes }
			}
		}
		remove_effect = {
			custom_effect_tooltip = SOV_recruit_admiral_opposition_tt
			custom_effect_tooltip = SOV_recruit_cd_tt
			hidden_effect = {
				IF = {
					limit = {
						SOV_is_left_opposition = yes
					}
					random_navy_leader = {
						limit = {
							NOT = { has_trait = trait_SOV_stalinist }
							NOT = { has_trait = trait_SOV_bukharinist }
							NOT = { has_trait = trait_SOV_trotskyist }
							NOT = { has_trait = trait_SOV_monarchist_sympathizer }
						}
						add_unit_leader_trait = trait_SOV_trotskyist
						set_character_flag = SOV_aligned_left_opposition_flag
					}
				}
				ELSE_IF = {
					limit = {
						SOV_is_right_opposition = yes
					}
					random_navy_leader = {
						limit = {
							NOT = { has_trait = trait_SOV_stalinist }
							NOT = { has_trait = trait_SOV_bukharinist }
							NOT = { has_trait = trait_SOV_trotskyist }
							NOT = { has_trait = trait_SOV_monarchist_sympathizer }
						}
						add_unit_leader_trait = trait_SOV_bukharinist
						set_character_flag = SOV_aligned_right_opposition_flag
					}
				}
				ELSE_IF = {
					limit = {
						SOV_is_exiles = yes
					}
					random_navy_leader = {
						limit = {
							NOT = { has_trait = trait_SOV_stalinist }
							NOT = { has_trait = trait_SOV_bukharinist }
							NOT = { has_trait = trait_SOV_trotskyist }
							NOT = { has_trait = trait_SOV_monarchist_sympathizer }
						}
						add_unit_leader_trait = trait_SOV_monarchist_sympathizer
						set_character_flag = SOV_exiled_army_leader
					}
				}
				add_to_variable = { SOV_influence_admiral_decision_cost = 10 }
			}
		}
	}

	SOV_expand_nkvd_opposition = {

		icon = GFX_decision_generic_police_action

		allowed = {
			original_tag = SOV
		}

		available = {
			always = yes
		}
		ai_will_do = {
			base = 100
			modifier = {
				factor = 1.75
				SOV_is_right_opposition = yes
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
		}
		visible = {
			hidden_trigger = {
				has_completed_focus = SOV_infiltrate_the_nkvd
			}
			NOT = { has_global_flag = SOV_soviet_civil_war }
		}
		cancel_if_not_visible = yes
		cost = 40
		days_remove = 60
		days_re_enable = 120

		complete_effect = {
			random_list = {
				20 = {  }
				60 = { SOV_paranoia_very_low_increase_effect = yes }
				20 = { SOV_paranoia_low_increase_effect = yes }
			}
		}
		remove_effect = {
			custom_effect_tooltip = SOV_expand_nkvd_opposition_tt
			custom_effect_tooltip = SOV_nkvd_cd_tt
			add_to_variable = { SOV.SOV_nkvd_divisions = 5 }
			hidden_effect = {
				random_owned_controlled_state = {
					create_unit = {
						division = "division_template = \"NKVD Pogranichnaya Diviziya\" start_experience_factor = 0.2 start_equipment_factor = 1.0" owner = ROOT count = 5
					}
				}
			}
	    }
	}


	SOV_influence_army_opposition = {

		icon = GFX_decision_generic_military

		allowed = {
			original_tag = SOV
		}

		available = {
			IF = {
				limit = { SOV_is_left_opposition = yes }
				custom_trigger_tooltip = {
					tooltip = SOV_influence_army_opposition_level_tt
					check_variable = { SOV.SOV_left_opposition_army_support < 0.70 }
				}
			}
			ELSE_IF = {
				limit = { SOV_is_right_opposition = yes }
				custom_trigger_tooltip = {
					tooltip = SOV_influence_army_opposition_level_tt
					check_variable = { SOV.SOV_right_opposition_army_support < 0.70 }
				}
			}
		}
		ai_will_do = {
			base = 200
			modifier = {
				factor = 0
				check_variable = { ROOT.SOV_paranoia > 60 } # Not worth the risk if Paranoia too high
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
		}
		visible = {
			hidden_trigger = {
				OR = {
					has_completed_focus = SOV_military_support
					# has_completed_focus = SOV_the_eyes_fear
				}


			}
			NOT = { has_global_flag = SOV_soviet_civil_war }
		}
		cancel_if_not_visible = yes
		cost = SOV_influence_army_decision_cost
		days_remove = 15
		days_re_enable = 60

		complete_effect = {
			random_list = {
				30 = { SOV_paranoia_low_increase_effect = yes }
				40 = { SOV_paranoia_medium_increase_effect = yes }
				30 = { SOV_paranoia_high_increase_effect = yes }
			}
		}
		remove_effect = {
			custom_effect_tooltip = SOV_influence_army_opposition_tt
			custom_effect_tooltip = SOV_influence_cd_tt
			IF = {
				limit = { SOV_is_left_opposition = yes }
				add_to_variable = { SOV.SOV_left_opposition_army_support = 0.1 }

			}
			ELSE_IF = {
				limit = { SOV_is_right_opposition = yes }
				add_to_variable = { SOV.SOV_right_opposition_army_support = 0.1 }
			}
			ELSE_IF = {
				limit = { SOV_is_exiles = yes }
				add_to_variable = { SOV.SOV_exiles_army_support = 0.1 }
			}
			SOV_get_centre_military_support = yes
			add_to_variable = { SOV_influence_army_decision_cost = 20 }
	    }
	}

	SOV_influence_navy_opposition = {

		icon = GFX_decision_generic_naval

		allowed = {
			original_tag = SOV
		}

		available = {
			IF = {
				limit = { SOV_is_left_opposition = yes }
				custom_trigger_tooltip = {
					tooltip = SOV_influence_navy_opposition_level_tt
					check_variable = { SOV.SOV_left_opposition_navy_support < 0.70 }
				}
			}
			ELSE_IF = {
				limit = { SOV_is_right_opposition = yes }
				custom_trigger_tooltip = {
					tooltip = SOV_influence_navy_opposition_level_tt
					check_variable = { SOV.SOV_right_opposition_navy_support < 0.70 }
				}
			}
		}
		ai_will_do = {
			base = 100
			modifier = {
				factor = 0
				check_variable = { ROOT.SOV_paranoia > 40 } # Not worth the risk if Paranoia too high
			}
			modifier = {
				factor = 1.5
				SOV_is_right_opposition = yes
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
		}
		visible = {
			hidden_trigger = { has_completed_focus = SOV_military_support }
			NOT = { has_global_flag = SOV_soviet_civil_war }
		}
		cancel_if_not_visible = yes
		cost = SOV_influence_navy_decision_cost
		days_remove = 15
		days_re_enable = 60

		complete_effect = {
			random_list = {
				20 = { SOV_paranoia_very_low_increase_effect = yes }
				60 = { SOV_paranoia_low_increase_effect = yes }
				20 = { SOV_paranoia_medium_increase_effect = yes }
			}
		}
		remove_effect = {
			custom_effect_tooltip = SOV_influence_navy_opposition_tt
			custom_effect_tooltip = SOV_influence_cd_tt
			IF = {
				limit = { SOV_is_left_opposition = yes }
				add_to_variable = { SOV_left_opposition_navy_support = 0.1 }
			}
			ELSE_IF = {
				limit = { SOV_is_right_opposition = yes }
				add_to_variable = { SOV_right_opposition_navy_support = 0.1 }
			}
			ELSE_IF = {
				limit = { SOV_is_exiles = yes }
				add_to_variable = { SOV_exiles_navy_support = 0.1 }
			}
			SOV_get_centre_military_support = yes
			add_to_variable = { SOV_influence_army_decision_cost = 20 }
		}
	}

	SOV_influence_airforce_opposition = {

		icon = GFX_decision_generic_air

		allowed = {
			original_tag = SOV
		}

		available = {
			IF = {
				limit = { SOV_is_left_opposition = yes }
				custom_trigger_tooltip = {
					tooltip = SOV_influence_air_opposition_level_tt
					check_variable = { SOV.SOV_left_opposition_air_support < 0.70 }
				}
			}
			ELSE_IF = {
				limit = { SOV_is_right_opposition = yes }
				custom_trigger_tooltip = {
					tooltip = SOV_influence_air_opposition_level_tt
					check_variable = { SOV.SOV_right_opposition_air_support < 0.70 }
				}
			}
		}
		ai_will_do = {
			base = 150
			modifier = {
				factor = 0
				check_variable = { ROOT.SOV_paranoia > 60 } # Not worth the risk if Paranoia too high
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
		}
		visible = {
			hidden_trigger = { has_completed_focus = SOV_military_support }
			NOT = { has_global_flag = SOV_soviet_civil_war }
		}
		cancel_if_not_visible = yes
		cost = SOV_influence_aiforce_decision_cost
		days_remove = 15
		days_re_enable = 60

		complete_effect = {
			random_list = {
				20 = { SOV_paranoia_very_low_increase_effect = yes }
				60 = { SOV_paranoia_low_increase_effect = yes }
				20 = { SOV_paranoia_medium_increase_effect = yes }
			}
		}
		remove_effect = {
			custom_effect_tooltip = SOV_influence_airforce_opposition_tt
			custom_effect_tooltip = SOV_influence_cd_tt
			IF = {
				limit = { SOV_is_left_opposition = yes }
				add_to_variable = { SOV_left_opposition_air_support = 0.1 }
			}
			ELSE_IF = {
				limit = { SOV_is_right_opposition = yes }
				add_to_variable = { SOV_right_opposition_air_support = 0.1 }
			}
			ELSE_IF = {
				limit = { SOV_is_exiles = yes }
				add_to_variable = { SOV_exiles_air_support = 0.1 }
			}
			SOV_get_centre_military_support = yes
			add_to_variable = { SOV_influence_aiforce_decision_cost = 20 }
		}
	}


	SOV_dismiss_the_counter_revolution = {

		icon = generic_speech

		available = {

		}
		ai_will_do = {
			base = 1
			modifier = {
				factor = 200
				check_variable = { ROOT.SOV_paranoia > 40 } # Do if Paranoia too high
			}
		}

		visible = {
			hidden_trigger = { has_completed_focus = SOV_embrace_the_black_hundreds }
			NOT = { has_global_flag = SOV_soviet_civil_war }
		}
		cancel_if_not_visible = yes

		cost = 75
		fire_only_once = no
		days_remove = 7
		days_re_enable = 60

		remove_effect = {

			random_list = {
				40 = {
					SOV_paranoia_low_decrease_effect = yes
				}
				50 = {
					SOV_paranoia_medium_decrease_effect = yes
				}
				10 = {
					SOV_paranoia_high_decrease_effect = yes
				}
			}
			set_country_flag = SOV_dismissed_the_counter_revolution_flag
			# SOV_increase_civil_war_timer_long = yes
		}
		complete_effect = {
			custom_effect_tooltip = SOV_dismiss_the_counter_revolution_tt
			custom_effect_tooltip = SOV_dismiss_cd_tt
			subtract_from_variable = { SOV_exiles_army_support = 0.01 }
			subtract_from_variable = { SOV_exiles_navy_support = 0.01 }
			subtract_from_variable = { SOV_exiles_air_support = 0.01 }
		}
	}

	# Offer Vladivostok to Japan
	SOV_concessions_japan_vladivostok_SCW = {

		icon = generic_political_discourse

		allowed = {
			original_tag = SOV
		}
		targets = { JAP }
		target_trigger = {
			FROM = {
				tag = JAP
			}
		}
		target_root_trigger = {
			OR = {
				SOV_is_right_opposition = yes
				SOV_is_exiles = yes
			}
		}
		available = {
			JAP = { exists = yes }
			408 = { 
				CONTROLLER = { 
					original_tag = SOV 
				}
				
			}
			custom_trigger_tooltip = {
				tooltip = SOV_not_has_conflict_with_japan
				NOT = { JAP = { has_decision = JAP_test_the_soviets } }
				NOT = { has_border_war_with = JAP }
				NOT = { has_war_with = JAP }
			}
		}
		ai_will_do = {
			base = 0
			modifier = {
				add = 50
				SOV_is_exiles = yes
			}
			modifier = {
				add = 50
				surrender_progress > 0
			}
			modifier = {
				add = 50
				date > 1938.1.1
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
		}
		cost = 25

		fire_only_once = yes # Either you make the offer or you don't

		visible = {
			hidden_trigger = {
				SOV_has_selected_hq = yes
				OR = {
					has_completed_focus = SOV_concessions_to_foreign_powers # Right Opposition
					AND = {
						SOV_is_exiles = yes
						has_completed_focus = SOV_unification_of_the_exiles
					}
				}
			}
			NOT = { has_global_flag = SOV_soviet_civil_war_over }
		}
		cancel_if_not_visible = yes

		complete_effect = {
			random_list = {
				20 = { SOV_paranoia_very_low_increase_effect = yes }
				60 = { SOV_paranoia_low_increase_effect = yes }
				20 = { SOV_paranoia_medium_increase_effect = yes }
			}
			JAP = {
				country_event = {
					id = NSB_soviet_civil_war_common.100
					hours = 1 # TODO THOMAS - set longer delay
				}
				custom_effect_tooltip = SOV_concessions_japan_vladivostok_SCW_accept
			}

		}
	}
	# Offer North Sakhalin to Japan
	SOV_concessions_japan_sakhalin_SCW = { #TODO_THOMAS

		icon = generic_political_discourse

		allowed = {
			original_tag = SOV
		}
		targets = { JAP }
		target_trigger = {
			FROM = {
				tag = JAP
			}
		}
		target_root_trigger = {
			OR = {
				SOV_is_right_opposition = yes
				SOV_is_exiles = yes
			}
		}

		available = {
			JAP = { exists = yes }
			655 = { CONTROLLER = { original_tag = SOV } }
			custom_trigger_tooltip = {
				tooltip = SOV_not_has_conflict_with_japan
				NOT = { JAP = { has_decision = JAP_test_the_soviets } }
				NOT = { has_border_war_with = JAP }
				NOT = { has_war_with = JAP }
			}

		}
		ai_will_do = {
			base = 100
			modifier = {
				add = 50
				SOV_is_exiles = yes
			}
			modifier = {
				add = 50
				surrender_progress > 0
			}
			modifier = {
				add = 50
				date > 1938.1.1
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
		}
		cost = 10

		fire_only_once = yes # Either you make the offer or you don't

		visible = {
			hidden_trigger = {
				SOV_has_selected_hq = yes
				OR = {
					has_completed_focus = SOV_concessions_to_foreign_powers # Right Opposition
					AND = {
						SOV_is_exiles = yes
						has_completed_focus = SOV_unification_of_the_exiles
					}
				}
			}
			NOT = { has_global_flag = SOV_soviet_civil_war_over }
		}
		cancel_if_not_visible = yes

		complete_effect = {
			random_list = {
				20 = { SOV_paranoia_very_low_increase_effect = yes }
				60 = { SOV_paranoia_low_increase_effect = yes }
				20 = { SOV_paranoia_medium_increase_effect = yes }
			}
			JAP = {
				country_event = {
					id = NSB_soviet_civil_war_common.103
					hours = 8
					random_hours = 12
				}
				custom_effect_tooltip = SOV_concessions_japan_sakhalin_SCW_accept
			}

		}
	}
	# Baku Oil fields in return for help with military buildup
	SOV_concessions_germany_baku_SCW = {

		icon = generic_political_discourse

		allowed = {
			original_tag = SOV
		}

		available = {
			GER = { exists = yes }
			229 = { CONTROLLER = { original_tag = SOV } }
		}
		ai_will_do = {
			base = 150
			modifier = {
				add = 50
				surrender_progress > 0
			}
			modifier = {
				add = 50
				date > 1938.1.1
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
		}
		targets = { GER }
		target_trigger = {
			FROM = {
				tag = GER
			}
		}
		target_root_trigger = {
			OR = {
				SOV_is_right_opposition = yes
				SOV_is_exiles = yes
			}
		}
		cost = 10

		fire_only_once = yes # Either you make the offer or you don't

		visible = {
			hidden_trigger = {
				OR = {
					has_completed_focus = SOV_concessions_to_foreign_powers
					AND = {
						has_completed_focus = SOV_unification_of_the_exiles
						SOV_has_selected_hq = yes
					}
				}

			}
			NOT = { has_global_flag = SOV_soviet_civil_war_over }
		}
		cancel_if_not_visible = yes

		complete_effect = {
			random_list = {
				60 = { SOV_paranoia_very_low_increase_effect = yes }
				30 = { SOV_paranoia_low_increase_effect = yes }
				10 = { SOV_paranoia_medium_increase_effect = yes }
			}
			GER = {
				country_event = {
					id = NSB_soviet_civil_war_common.106
					hours = 8
					random_hours = 12
				}
				custom_effect_tooltip = SOV_concessions_germany_baku_SCW_accept
			}

		}
	}

	# Ukraininan independence to Germany
	SOV_concessions_germany_ukraininan_oil_SCW = { #TODO_THOMAS

		icon = GFX_decision_revolt

		allowed = {
			original_tag = SOV
		}
		targets = { GER }
		target_trigger = {
			FROM = {
				tag = GER
			}
		}
		target_root_trigger = {
			SOV_is_right_opposition = yes
		}

		available = {
			GER = { exists = yes }
		}
		ai_will_do = {
			base = 0
			modifier = {
				add = 150 # More likely if not feeling secure
				check_variable = { SOV.SOV_right_opposition_army_support < 0.25}
				check_variable = { SOV.SOV_paranoia > 50 }
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}

		}
		cost = 15

		fire_only_once = yes # Either you make the offer or you don't

		visible = {
			hidden_trigger = { has_completed_focus = SOV_concessions_to_foreign_powers }
			NOT = { has_global_flag = SOV_soviet_civil_war_over }
		}
		cancel_if_not_visible = yes

		complete_effect = {
			GER = {
				country_event = {
					id = NSB_soviet_civil_war_common.110
					hours = 1 # TODO THOMAS - set longer delay
				}
				custom_effect_tooltip = SOV_concessions_germany_ukraininan_oil_SCW_accept
			}
			random_list = {
				20 = { SOV_paranoia_very_low_increase_effect = yes }
				60 = { SOV_paranoia_low_increase_effect = yes }
				20 = { SOV_paranoia_medium_increase_effect = yes }
			}
		}
	}

	# Belarus independence to UK
	SOV_concessions_uk_belarus_SCW = {

		icon = generic_political_discourse

		allowed = {
			original_tag = SOV
		}
		targets = { ENG }
		target_trigger = {
			FROM = {
				tag = ENG
			}
		}
		target_root_trigger = {
			SOV_is_right_opposition = yes
		}

		available = {
			ENG = { exists = yes }
			206 = { CONTROLLER = { original_tag = SOV } }

		}
		ai_will_do = {
			base = 0
			modifier = {
				add = 150 # More likely if not feeling secure
				check_variable = { SOV.SOV_right_opposition_army_support < 0.2}
				check_variable = { SOV.SOV_paranoia > 75 }
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}

		}
		cost = 15

		fire_only_once = yes # Either you make the offer or you don't

		visible = {
			hidden_trigger = { has_completed_focus = SOV_concessions_to_foreign_powers }
			NOT = { has_global_flag = SOV_soviet_civil_war_over }
		}
		cancel_if_not_visible = yes

		complete_effect = {
			random_list = {
				20 = { SOV_paranoia_very_low_increase_effect = yes }
				60 = { SOV_paranoia_low_increase_effect = yes }
				20 = { SOV_paranoia_medium_increase_effect = yes }
			}
			ENG = {
				country_event = {
					id = NSB_soviet_civil_war_common.115
					hours = 1 # TODO THOMAS - set longer delay
				}
				custom_effect_tooltip = SOV_concessions_uk_belarus_SCW_accept
			}

		}
	}

	# Behind enemy lines strikes
	SOV_sabotage_behind_enemy_lines_decision = {
		icon = generic_assassination
		state_target = yes
		target_root_trigger = {
			SOV_is_exiles = yes
			has_completed_focus = SOV_sabotage_behind_enemy_lines
		}

		target_trigger = {
			FROM = {
				is_core_of = SOV
			}
		}

		available = {
			ROOT = { NOT = { has_country_flag = sabotage_behind_enemy_lines_flag } }
		}
		ai_will_do = {
			base = 100 # This is generally a good thing to do
			modifier = {
				add = FROM.state_strategic_value # Prioritize important states
				always = yes
			}
			modifier = {
				factor = 2
				always = yes
			}
		}

		visible = {
			FROM = {
				OR = {
					is_controlled_by = SOS
					AND = {
						is_controlled_by = SOV
						NOT = { is_fully_controlled_by = SOV }
					}
				}
				is_owned_by = SOS
				NOT = { region = 133 } # Not around Moscov
				any_neighbor_state = { is_controlled_by = SOV }
			}
			has_global_flag = SOV_soviet_civil_war
		}

		on_map_mode = map_only
		fire_only_once = yes

		custom_cost_trigger = {
			command_power > 14
		}
		custom_cost_text = SOV_sabotage_behind_enemy_lines_cost
		days_remove = 14

		complete_effect = {
			hidden_effect = {
				add_command_power = -15
				set_country_flag = sabotage_behind_enemy_lines_flag
			}
		}
		remove_effect = {
			damage_units = {
				state = FROM
				limit = { tag = SOS }
				org_damage = 0.25
				str_damage = 0.05
				ratio = yes
				army = yes
				navy = yes
			}
			custom_effect_tooltip = SOV_sabotage_behind_enemy_lines_decision_tt
			clr_country_flag = sabotage_behind_enemy_lines_flag
		}

	}

	# Recruit cavalry - Manchuria
	SOV_recruit_manchurian_cavalry_exiles = {
		icon = generic_cavalry
		state_target = yes
		target_root_trigger = {
			SOV_is_exiles = yes
		}

		target_trigger = {
			FROM = {
				OR = {
					region = 155 # Manchuria
				}
			}
			has_completed_focus = SOV_approach_semyonov
		}
		available = {
			NOT = { has_country_flag = recruiting_cavalry_flag }
		}
		ai_will_do = {
			base = 200
			modifier = {
				factor = 0 # Not if it might start a premature war
				check_variable = { SOV.SOV_paranoia > 75 }
			}
		}

		visible = {
			OR = {
				FROM = { has_state_flag = SOV_exiles_state }
				FROM = { is_owned_by = MAN}
			}
			NOT = { has_global_flag = SOV_soviet_civil_war }
		}

		on_map_mode = map_only
		fire_only_once = yes

		custom_cost_trigger = {
			command_power > 9.9
		}
		custom_cost_text = SOV_recruit_cavalry_exiles_cost
		days_remove = 10

		complete_effect = {
			add_command_power = -10
			SOV_paranoia_very_low_increase_effect = yes
			set_country_flag = recruiting_cavalry_flag
		}
		remove_effect = {
			add_to_variable = { SOV_exiles_manchurian_cavalry = 1 }
			clr_country_flag = recruiting_cavalry_flag
		}
	}
	# Recruit cavalry - Siberia
	SOV_recruit_cavalry_exiles = {
		icon = generic_cavalry
		state_target = yes
		target_root_trigger = {
			SOV_is_exiles = yes
		}
		target_trigger = {
			FROM = {
				OR = {
					#region = 155 # Manchuria
					region = 151
					region = 149
					region = 152
				}
			}

		}
		available = {
			NOT = { has_country_flag = recruiting_cavalry_flag }
		}
		ai_will_do = {
			base = 200
			modifier = {
				factor = 0 # Not if it might start a premature war
				check_variable = { SOV.SOV_paranoia > 75 }
			}
		}

		visible = {
			OR = {
				FROM = { has_state_flag = SOV_exiles_state }
				FROM = { is_owned_by = MAN}
			}
			has_completed_focus = SOV_approach_semyonov
			NOT = { has_global_flag = SOV_soviet_civil_war }
		}
		on_map_mode = map_only
		fire_only_once = yes

		custom_cost_trigger = {
			command_power > 9.9
		}
		custom_cost_text = SOV_recruit_cavalry_exiles_cost
		days_remove = 15

		complete_effect = {
			add_command_power = -10
			SOV_paranoia_very_low_increase_effect = yes
			set_country_flag = recruiting_cavalry_flag
		}
		remove_effect = {
			FROM = { set_state_flag = SOV_exiles_cavalry_flag }
			clr_country_flag = recruiting_cavalry_flag
		}
	}

	##### Selecting start state
	# Archangelsk - Left / right
	SOV_plan_start_of_uprising_archangelsk = {
		icon = {
			key = SOV_place_hq
			trigger = {
				214  = { NOT = { has_state_flag = SOV_hq_state_selected } }
			}
		}
		icon = {
			key = SOV_place_hq_left_opposition
			trigger = {
				214 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_left_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_right_opposition
			trigger = {
				214 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_right_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_exiles
			trigger = {
				214 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_exiles = yes
			}
		}

		state_target = yes

		target_root_trigger = {
			OR = {
				SOV_is_left_opposition = yes
				SOV_is_right_opposition = yes
			}
		}

		targets = {
			state = 214 # Archangelsk
		}

		target_trigger = {
			FROM = { state = 214 }# Archangelsk
		}
		available = {
			NOT = { has_country_flag = SOV_align_state_in_process }
		}
		fire_only_once = yes

		visible = {
			SOV_display_civil_war_start_state = yes
			214 = { is_owned_by = ROOT }
		}

		cost = 15
		days_remove = 5

		on_map_mode = map_and_decisions_view

		complete_effect = {
			SOV_start_setting_up_hq_state = yes
		}
		remove_effect = {
			set_variable = {SOV_civil_war_start_state = FROM }
			SOV_set_civil_war_state = yes
			SOV_opposition_support_low_increase_effect = yes
			SOV_add_armed_forces_support_state = yes
		}
		ai_will_do = {
			base = 150

		}
	}
	# Odessa - only  available for LO
	SOV_plan_start_of_uprising_odessa = {
		state_target = yes
		target_root_trigger = {
			OR = {
				SOV_is_left_opposition = yes
				# SOV_is_right_opposition = yes
			}
		}

		targets = {
			state = 192 # Odessa
		}
		target_trigger = {
			FROM = { state = 192 }
		}
		icon = {
			key = SOV_place_hq
			trigger = {
				 NOT = { 192  = {has_state_flag = SOV_hq_state_selected } }
			}
		}
		icon = {
			key = SOV_place_hq_left_opposition
			trigger = {
				192 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_left_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_right_opposition
			trigger = {
				192 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_right_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_exiles
			trigger = {
				192 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_exiles = yes
			}
		}
		available = {
			NOT = { has_country_flag = SOV_align_state_in_process }
			NOT = { has_variable = SOV_civil_war_start_state }
		}
		fire_only_once = no # want it to stay on map so...

		visible = {
			SOV_display_civil_war_start_state = yes
			192 = { is_owned_by = ROOT }
		}

		cost = 30
		days_remove = 5

		on_map_mode = map_and_decisions_view

		complete_effect = {
			SOV_start_setting_up_hq_state = yes
		}
		remove_effect = {
			set_variable = {SOV_civil_war_start_state = FROM }
			SOV_set_civil_war_state = yes
			SOV_opposition_support_medium_increase_effect = yes
			SOV_add_armed_forces_support_state = yes
		}
		ai_will_do = {
			base = 250
		}
	}

	# Omsk - available for LO / RO
	SOV_plan_start_of_uprising_omsk = {
		state_target = yes
		target_root_trigger = {
			OR = {
				SOV_is_left_opposition = yes
				SOV_is_right_opposition = yes
			}
		}

		targets = {
			state = 571  # Omsk
		}
		target_trigger = {
			FROM = { state = 571 }
		}
		icon = {
			key = SOV_place_hq
			trigger = {
				571  = { NOT = { has_state_flag = SOV_hq_state_selected } }
			}
		}
		icon = {
			key = SOV_place_hq_left_opposition
			trigger = {
				571 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_left_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_right_opposition
			trigger = {
				571 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_right_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_exiles
			trigger = {
				571 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_exiles = yes
			}
		}
		available = {
			NOT = { has_country_flag = SOV_align_state_in_process }
			NOT = { has_variable = SOV_civil_war_start_state }
		}
		fire_only_once = no # want it to stay on map so...

		visible = {
			SOV_display_civil_war_start_state = yes
			571 = { is_owned_by = ROOT }
		}

		cost = 15
		days_remove = 5

		on_map_mode = map_and_decisions_view

		complete_effect = {
			SOV_start_setting_up_hq_state = yes
		}
		remove_effect = {
			set_variable = {SOV_civil_war_start_state = FROM }
			SOV_set_civil_war_state = yes
			SOV_opposition_support_low_increase_effect = yes
			SOV_add_armed_forces_support_state = yes
		}
		ai_will_do = {
			base = 110
		}
	}

	# Tashkent - available for LO / RO
	SOV_plan_start_of_uprising_tashkent = {
		state_target = yes
		target_root_trigger = {
			OR = {
				SOV_is_left_opposition = yes
				SOV_is_right_opposition = yes
			}
		}

		targets = {
			state = 405  # Tashkent
		}
		target_trigger = {
			FROM = { state = 405 }
		}
		icon = {
			key = SOV_place_hq
			trigger = {
				405  = { NOT = { has_state_flag = SOV_hq_state_selected } }
			}
		}
		icon = {
			key = SOV_place_hq_left_opposition
			trigger = {
				405 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_left_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_right_opposition
			trigger = {
				405 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_right_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_exiles
			trigger = {
				405 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_exiles = yes
			}
		}
		available = {
			NOT = { has_country_flag = SOV_align_state_in_process }
			NOT = { has_variable = SOV_civil_war_start_state }
		}
		fire_only_once = no # want it to stay on map so...

		visible = {
			SOV_display_civil_war_start_state = yes
			405 = { is_owned_by = ROOT }
		}

		cost = 15
		days_remove = 5

		on_map_mode = map_and_decisions_view

		complete_effect = {
			SOV_start_setting_up_hq_state = yes
		}
		remove_effect = {
			set_variable = {SOV_civil_war_start_state = FROM }
			SOV_set_civil_war_state = yes
			SOV_opposition_support_low_increase_effect = yes
			SOV_add_armed_forces_support_state = yes
		}
		ai_will_do = {
			base = 150
		}
	}

	# Ufa - available for LO / RO
	SOV_plan_start_of_uprising_ufa = {
		state_target = yes
		target_root_trigger = {
			OR = {
				SOV_is_left_opposition = yes
				SOV_is_right_opposition = yes
			}
		}

		targets = {
			state = 651  # Ufa
		}
		target_trigger = {
			FROM = { state = 651 }
		}
		icon = {
			key = SOV_place_hq
			trigger = {
				651  = { NOT = { has_state_flag = SOV_hq_state_selected } }
			}
		}
		icon = {
			key = SOV_place_hq_left_opposition
			trigger = {
				651 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_left_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_right_opposition
			trigger = {
				651 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_right_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_exiles
			trigger = {
				651 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_exiles = yes
			}
		}
		available = {
			NOT = { has_country_flag = SOV_align_state_in_process }
			NOT = { has_variable = SOV_civil_war_start_state }
		}
		fire_only_once = no # want it to stay on map so...

		visible = {
			SOV_display_civil_war_start_state = yes
			651 = { is_owned_by = ROOT }
		}

		cost = 10
		days_remove = 5

		on_map_mode = map_and_decisions_view

		complete_effect = {
			SOV_start_setting_up_hq_state = yes
		}
		remove_effect = {
			set_variable = {SOV_civil_war_start_state = FROM }
			SOV_set_civil_war_state = yes
			SOV_opposition_support_low_increase_effect = yes
			SOV_add_armed_forces_support_state = yes
		}
		ai_will_do = {
			base = 100
		}
	}

	# Chita - available for RO / Exiles
	SOV_plan_start_of_uprising_chita = {
		state_target = yes
		target_root_trigger = {
			OR = {
				SOV_is_exiles = yes
			}
		}

		targets = {
			state = 563  # Chita
		}
		target_trigger = {
			FROM = { state = 563  }
		}
		icon = {
			key = SOV_place_hq
			trigger = {
				563 = { NOT = { has_state_flag = SOV_hq_state_selected } }
			}
		}
		icon = {
			key = SOV_place_hq_left_opposition
			trigger = {
				563 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_left_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_right_opposition
			trigger = {
				563 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_right_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_exiles
			trigger = {
				563 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_exiles = yes
			}
		}
		available = {
			NOT = { has_country_flag = SOV_align_state_in_process }
			NOT = { has_variable = SOV_civil_war_start_state }
		}
		fire_only_once = no # want it to stay on map so...

		visible = {
			SOV_display_civil_war_start_state = yes
			563 = { is_owned_by = ROOT }
		}

		cost = 10
		days_remove = 5

		on_map_mode = map_and_decisions_view

		complete_effect = {
			SOV_start_setting_up_hq_state = yes
		}
		remove_effect = {
			SOV_set_civil_war_state = yes
			set_variable = { SOV_civil_war_start_state = FROM }
			SOV_opposition_support_low_increase_effect = yes
			SOV_add_armed_forces_support_state = yes
		}
		ai_will_do = {
			base = 125
		}
	}
	# Irkutsk - fallback for RO / Exiles
	SOV_plan_start_of_uprising_irkutsk = {
		name = SOV_plan_start_of_uprising_chita
		state_target = yes
		target_root_trigger = {
			OR = {
				SOV_is_exiles = yes
			}
		}

		targets = {
			state = 566  # Irkutsk
		}
		target_trigger = {
			FROM = { state = 566  }
		}
		icon = {
			key = SOV_place_hq
			trigger = {
				566 = { NOT = { has_state_flag = SOV_hq_state_selected } }
			}
		}
		icon = {
			key = SOV_place_hq_left_opposition
			trigger = {
				566 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_left_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_right_opposition
			trigger = {
				566 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_right_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_exiles
			trigger = {
				566 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_exiles = yes
			}
		}
		available = {
			NOT = { has_country_flag = SOV_align_state_in_process }
			NOT = { has_variable = SOV_civil_war_start_state }
		}
		fire_only_once = no # want it to stay on map so...

		visible = {
			SOV_display_civil_war_start_state = yes
			566 = { is_owned_by = ROOT }
		}

		cost = 10
		days_remove = 5

		on_map_mode = map_and_decisions_view

		complete_effect = {
			SOV_start_setting_up_hq_state = yes
		}
		remove_effect = {
			SOV_set_civil_war_state = yes
			set_variable = { SOV_civil_war_start_state = FROM }
			SOV_opposition_support_low_increase_effect = yes
			SOV_add_armed_forces_support_state = yes
		}
		ai_will_do = {
			base = 125
		}
	}
	# additional option - Vladivostok
	SOV_plan_start_of_uprising_vladivostok = {
		name = SOV_plan_start_of_uprising_chita
		state_target = yes
		target_root_trigger = {
			OR = {
				SOV_is_exiles = yes
			}
		}

		targets = {
			state = 408  # Vladivostok
		}
		target_trigger = {
			FROM = { state = 408  }
		}
		icon = {
			key = SOV_place_hq
			trigger = {
				408 = { NOT = { has_state_flag = SOV_hq_state_selected } }
			}
		}
		icon = {
			key = SOV_place_hq_left_opposition
			trigger = {
				408 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_left_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_right_opposition
			trigger = {
				408 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_right_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_exiles
			trigger = {
				408 = { has_state_flag = SOV_hq_state_selected }
				SOV_is_exiles = yes
			}
		}
		available = {
			NOT = { has_country_flag = SOV_align_state_in_process }
			NOT = { has_variable = SOV_civil_war_start_state }
		}
		fire_only_once = no # want it to stay on map so...

		visible = {
			SOV_display_civil_war_start_state = yes
			408 = { is_owned_by = ROOT }
		}

		cost = 10
		days_remove = 5

		on_map_mode = map_and_decisions_view

		complete_effect = {
			SOV_start_setting_up_hq_state = yes
		}
		remove_effect = {
			SOV_set_civil_war_state = yes
			set_variable = { SOV_civil_war_start_state = FROM }
			SOV_opposition_support_low_increase_effect = yes
			SOV_add_armed_forces_support_state = yes
		}
		
		ai_will_do = {
			base = 125
		}
	}


	##### SIBERIAN STATES
	SOV_align_states_siberia_csw = {
		name = SOV_planning_uprising_in_siberia
		state_target = yes
		ai_will_do = {
			base = 110
			modifier = {
				factor = 0
				check_variable = { SOV_paranoia > 65 } # let's be careful
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
			modifier = {
				factor = 2 # If totally safe
				check_variable = { SOV.SOV_paranoia < 35 }
			}
			modifier = {
				factor = 0.5 # only exiles will continue with Siberian states after a while
				AND = {
					OR = {
						SOV_is_left_opposition = yes
						SOV_is_right_opposition = yes
					}
					date > 1936.5.1
				}
			}
			modifier = {
				factor = 0 # only exiles will continue with Siberian states after a while
				AND = {
					OR = {
						SOV_is_left_opposition = yes
						SOV_is_right_opposition = yes
					}
					date > 1936.8.1
				}
			}
		}
		icon = {
			key = infiltrate_state
			trigger = {
				FROM = { SOV_is_unaligned_state = yes }
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_left_opposition_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_left }
					FROM = { has_state_flag = SOV_left_opposition_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_right_opposition_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_right }
					FROM = { has_state_flag = SOV_right_opposition_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_exiles_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_exiles }
					FROM = { has_state_flag = SOV_exiles_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_stalinist_state
			trigger = {
				FROM = { has_state_flag = SOV_stalinist_state }
			}
		}
		# These ones to ensure the HQ stays put even after decision to place has been removed
		icon = {
			key = SOV_place_hq_right_opposition
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_right_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_left_opposition
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_left_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_exiles
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_exiles = yes
			}
		}

		target_trigger = {
			FROM = {
				OR = {
					region = 147
					region = 263
					region = 151
					region = 261 
					region = 262 
					region = 149
					region = 256
					region = 257
					region = 258
					region = 259
					region = 260
				}
			}
		}

		available = {
			FROM = { SOV_is_unaligned_state = yes }
			NOT = { has_country_flag = SOV_align_state_in_process }
			IF = {
				limit = {
					SOV_is_exiles = yes
				}
				has_completed_focus = SOV_embrace_the_black_hundreds
			}
		}

		visible = {
			has_variable = SOV_civil_war_start_state
			NOT = { has_global_flag = SOV_soviet_civil_war }
			FROM = {
				SOV_is_display_state = yes
			}
		}
		on_map_mode = map_only
		cost = 5
		days_remove = 14
		complete_effect = {
			SOV_paranoia_very_low_increase_effect = yes
			IF = {
				limit = {
					NOT = { has_country_flag = SOV_siberia_states_unlocked }
				}
				set_country_flag = SOV_siberia_states_unlocked
			}
			SOV_start_infiltrating_state = yes
		}
		remove_effect = {
			SOV_set_civil_war_state = yes
			SOV_opposition_support_very_low_increase_effect = yes
			SOV_add_armed_forces_support_state = yes
		}
	}


	### The Far East
	SOV_align_states_far_east_csw = {
		name = SOV_planning_uprising_in_far_east
		state_target = yes
		ai_will_do = {
			base = 110
			modifier = {
				factor = 0
				check_variable = { SOV_paranoia > 65 } # let's be careful
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
			modifier = {
				factor = 2 # If totally safe
				check_variable = { SOV.SOV_paranoia < 35 }
			}
		}
		icon = {
			key = infiltrate_state
			trigger = {
				FROM = { SOV_is_unaligned_state = yes }
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_left_opposition_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_left }
					FROM = { has_state_flag = SOV_left_opposition_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_right_opposition_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_right }
					FROM = { has_state_flag = SOV_right_opposition_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_exiles_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_exiles }
					FROM = { has_state_flag = SOV_exiles_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_stalinist_state
			trigger = {
				FROM = { has_state_flag = SOV_stalinist_state }
			}
		}
		# These ones to ensure the HQ stays put even after decision to place has been removed
		icon = {
			key = SOV_place_hq_right_opposition
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_right_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_left_opposition
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_left_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_exiles
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_exiles = yes
			}
		}

		target_trigger = {
			FROM = {
				OR = {
					region = 148
					region = 255
				}
			}
		}

		available = {
			FROM = { SOV_is_unaligned_state = yes }
			NOT = { has_country_flag = SOV_align_state_in_process }
			IF = {
				limit = {
					SOV_is_exiles = yes
				}
				has_completed_focus = SOV_embrace_the_black_hundreds
			}
		}

		visible = {
			has_variable = SOV_civil_war_start_state
			NOT = { has_global_flag = SOV_soviet_civil_war }
			FROM = {
				SOV_is_display_state = yes
			}
		}
		on_map_mode = map_only
		cost = 15
		days_remove = 14
		complete_effect = {
			SOV_paranoia_low_increase_effect = yes
			IF = {
				limit = {
					NOT = { has_country_flag = SOV_far_east_states_unlocked }
				}
				set_country_flag = SOV_far_east_states_unlocked
			}
			SOV_start_infiltrating_state = yes
		}
		remove_effect = {
			SOV_set_civil_war_state = yes
			SOV_opposition_support_very_low_increase_effect = yes
			SOV_add_armed_forces_support_state = yes
		}
	}


	### The Northern States
	SOV_align_states_northern_csw = {
		name = SOV_planning_uprising_in_northern
		ai_will_do = {
			base = 110
			modifier = {
				add = -10
				SOV_is_exiles = yes # Prio clearing Siberia and Far East
			}
			modifier = {
				factor = 0
				check_variable = { SOV_paranoia > 65 } # let's be careful
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
			modifier = {
				factor = 2 # If totally safe
				check_variable = { SOV.SOV_paranoia < 35 }
			}
		}
		icon = {
			key = infiltrate_state
			trigger = {
				FROM = { SOV_is_unaligned_state = yes }
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_left_opposition_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_left }
					FROM = { has_state_flag = SOV_left_opposition_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_right_opposition_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_right }
					FROM = { has_state_flag = SOV_right_opposition_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_exiles_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_exiles }
					FROM = { has_state_flag = SOV_exiles_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_stalinist_state
			trigger = {
				FROM = { has_state_flag = SOV_stalinist_state }
			}
		}
		# These ones to ensure the HQ stays put even after decision to place has been removed
		icon = {
			key = SOV_place_hq_right_opposition
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_right_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_left_opposition
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_left_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_exiles
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_exiles = yes
			}
		}
		state_target = yes
		#  targets = { region = 136 }

		target_trigger = {
			FROM = {
				OR = {
					region = 12
					region = 150
					state = 215
					state = 216
				}
				is_owned_by = ROOT
				is_controlled_by = ROOT
			}
		}
		allowed = { original_tag = SOV }
		available = {
			FROM = { SOV_is_unaligned_state = yes }
			NOT = { has_country_flag = SOV_align_state_in_process }
		}

		visible = {
			has_variable = SOV_civil_war_start_state
			NOT = { has_global_flag = SOV_soviet_civil_war }
			FROM = {
				SOV_is_display_state = yes
			}
		}

		on_map_mode = map_only
		cost = 15
		days_remove = 14
		complete_effect = {
			SOV_paranoia_low_increase_effect = yes
			IF = {
				limit = {
					NOT = { has_country_flag = SOV_northern_states_unlocked }
				}
				set_country_flag = SOV_northern_states_unlocked
			}
			SOV_start_infiltrating_state = yes
		}
		remove_effect = {
			SOV_set_civil_war_state = yes
			SOV_opposition_support_low_increase_effect = yes
			SOV_add_armed_forces_support_state = yes
		}
	}

	##### The Ukraine
	SOV_align_states_ukraine_csw = {
		name = SOV_planning_uprising_in_ukraine
		ai_will_do = {
			base = 150
			modifier = {
				factor = 0
				check_variable = { SOV_paranoia > 55 } # let's be careful
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
			modifier = {
				factor = 2 # If totally safe
				check_variable = { SOV.SOV_paranoia < 35 }
			}
		}
		icon = {
			key = infiltrate_state
			trigger = {
				FROM = { SOV_is_unaligned_state = yes }
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_left_opposition_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_left }
					FROM = { has_state_flag = SOV_left_opposition_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_right_opposition_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_right }
					FROM = { has_state_flag = SOV_right_opposition_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_exiles_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_exiles }
					FROM = { has_state_flag = SOV_exiles_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_stalinist_state
			trigger = {
				FROM = { has_state_flag = SOV_stalinist_state }
			}
		}
		# These ones to ensure the HQ stays put even after decision to place has been removed
		icon = {
			key = SOV_place_hq_right_opposition
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_right_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_left_opposition
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_left_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_exiles
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_exiles = yes
			}
		}
		state_target = yes

		target_trigger = {
			FROM = {
				region = 130
				is_owned_by = ROOT
				is_controlled_by = ROOT
			}
		}

		available = {
			FROM = { SOV_is_unaligned_state = yes }
			NOT = { has_country_flag = SOV_align_state_in_process }
		}

		visible = {
			has_variable = SOV_civil_war_start_state
			NOT = { has_global_flag = SOV_soviet_civil_war }
			FROM = {
				SOV_is_display_state = yes
			}
		}

		on_map_mode = map_only
		cost = 25
		days_remove = 14
		complete_effect = {
			SOV_paranoia_low_increase_effect = yes
			IF = {
				limit = {
					NOT = { has_country_flag = SOV_ukrainian_states_unlocked }
				}
				set_country_flag = SOV_ukrainian_states_unlocked
			}
			SOV_start_infiltrating_state = yes

		}
		remove_effect = {
			SOV_set_civil_war_state = yes
			SOV_opposition_support_medium_increase_effect = yes
			SOV_add_armed_forces_support_state = yes
		}
	}

	#### Great Steppe
	SOV_align_states_steppe_csw = {
		name = SOV_align_states_steppe
		ai_will_do = {
			base = 150
			modifier = {
				add = -60 # prio clearing the East
				SOV_is_exiles = yes
			}
			modifier = {
				factor = 0
				check_variable = { SOV_paranoia > 55 } # let's be careful
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
			modifier = {
				factor = 2 # If totally safe
				check_variable = { SOV.SOV_paranoia < 35 }
			}
		}
		icon = {
			key = infiltrate_state
			trigger = {
				FROM = { SOV_is_unaligned_state = yes }
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_left_opposition_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_left }
					FROM = { has_state_flag = SOV_left_opposition_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_right_opposition_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_right }
					FROM = { has_state_flag = SOV_right_opposition_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_exiles_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_exiles }
					FROM = { has_state_flag = SOV_exiles_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_stalinist_state
			trigger = {
				FROM = { has_state_flag = SOV_stalinist_state }
			}
		}
		# These ones to ensure the HQ stays put even after decision to place has been removed
		icon = {
			key = SOV_place_hq_right_opposition
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_right_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_left_opposition
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_left_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_exiles
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_exiles = yes
			}
		}
		state_target = yes
		#  targets = { region = 136 }

		target_trigger = {
			FROM = {
				OR = {
					region = 136
					region = 267
					region = 268
					region = 269
					region = 270
				}
				is_owned_by = ROOT
				is_controlled_by = ROOT
			}
		}

		available = {
			FROM = { SOV_is_unaligned_state = yes }
			NOT = { has_country_flag = SOV_align_state_in_process }
		}

		visible = {
			has_variable = SOV_civil_war_start_state
			NOT = { has_global_flag = SOV_soviet_civil_war }
			FROM = {
				SOV_is_display_state = yes
			}
		}
		on_map_mode = map_only
		cost = 15
		days_remove = 14
		complete_effect = {
			SOV_paranoia_low_increase_effect = yes
			IF = {
				limit = {
					NOT = { has_country_flag = SOV_steppe_states_unlocked }
				}
				set_country_flag = SOV_steppe_states_unlocked
			}
			SOV_start_infiltrating_state = yes

		}
		remove_effect = {
			SOV_set_civil_war_state = yes
			SOV_opposition_support_medium_increase_effect = yes
			SOV_add_armed_forces_support_state = yes
		}
	}


	# The Urals and Trans Ural
	SOV_align_states_urals_csw = {
		name = SOV_planning_uprising_in_urals
		ai_will_do = {
			base = 120
			modifier = {
				factor = 0
				check_variable = { SOV_paranoia > 55 } # let's be careful
			}
			modifier = { # Save pp for NKVD Chief and Stalin Assassination
				factor = 0
				has_completed_focus = SOV_organize_uprisings_in_the_country
				NOT = { has_completed_focus = SOV_the_plan_for_the_coup }
			}
			modifier = {
				factor = 2 # If totally safe
				check_variable = { SOV.SOV_paranoia < 35 }
			}
		}
		icon = {
			key = infiltrate_state
			trigger = {
				FROM = { SOV_is_unaligned_state = yes }
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_left_opposition_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_left }
					FROM = { has_state_flag = SOV_left_opposition_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_right_opposition_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_right }
					FROM = { has_state_flag = SOV_right_opposition_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_exiles_state
			trigger = {
				OR = {
					FROM = { has_state_flag = SOV_is_aligning_exiles }
					FROM = { has_state_flag = SOV_exiles_state }
				}
				FROM = { NOT = { state = var:SOV.SOV_civil_war_start_state } }
			}
		}
		icon = {
			key = SOV_stalinist_state
			trigger = {
				FROM = { has_state_flag = SOV_stalinist_state }
			}
		}
		# These ones to ensure the HQ stays put even after decision to place has been removed
		icon = {
			key = SOV_place_hq_right_opposition
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_right_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_left_opposition
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_left_opposition = yes
			}
		}
		icon = {
			key = SOV_place_hq_exiles
			trigger = {
				FROM = { state = var:SOV.SOV_civil_war_start_state }
				SOV_is_exiles = yes
			}
		}
		state_target = yes
		#  targets = { region = 136 }

		target_trigger = {
			FROM = {
				OR = {
					region = 14
					region = 138
				}
				is_owned_by = ROOT
				is_controlled_by = ROOT
			}
		}
		allowed = { original_tag = SOV }
		available = {
			FROM = { SOV_is_unaligned_state = yes }
			NOT = { has_country_flag = SOV_align_state_in_process }
		}

		visible = {
			has_variable = SOV_civil_war_start_state
			NOT = { has_global_flag = SOV_soviet_civil_war }
			FROM = {
				SOV_is_display_state = yes
			}
		}
		on_map_mode = map_only
		cost = 15
		days_remove = 14
		complete_effect = {
			SOV_paranoia_low_increase_effect = yes
			IF = {
				limit = {
					NOT = { has_country_flag = SOV_urals_states_unlocked }
				}
				set_country_flag = SOV_urals_states_unlocked
			}
			SOV_start_infiltrating_state = yes
		}
		remove_effect = {
			SOV_set_civil_war_state = yes
			SOV_opposition_support_low_increase_effect = yes
			SOV_add_armed_forces_support_state = yes
		}
	}

	### Stalinist Counter Measures
	## Recruitment of Characters
	# Align a General or Field marshal
	SOV_align_general_stalin = {

		priority = 9

		icon = generic_military
		allowed = { tag = SOV }
		available = {
			var:SOV_selected_general_stalin = {
				OR = {
					has_trait = trait_SOV_bukharinist
					has_trait = trait_SOV_trotskyist
					has_trait = trait_SOV_monarchist_sympathizer
					custom_trigger_tooltip = {
						tooltip = SOV_character_purged_flag
						has_character_flag = SOV_character_purged_flag
					}
				}

			}

		}

		is_good = no

		days_mission_timeout = 30

		fire_only_once = no

		activation = {
			always = no # Only activated by triggers
		}

		visible = {
			hidden_trigger = {
				SOV_soviet_civil_war_not_started = yes

			}

		}
		cancel_if_not_visible = yes
		complete_effect = {
			hidden_effect = {
				clear_variable = SOV_selected_general_stalin
				SOV_launch_stalinist_counter_measure = yes
			}
		}

		timeout_effect = {
			custom_effect_tooltip = SOV_align_general_stalin_tt
			SOV_decrease_all_opposition_army = yes
			hidden_effect = {
				var:SOV_selected_general_stalin = {
					add_unit_leader_trait = trait_SOV_stalinist
				}
				clear_variable = SOV_selected_general_stalin
				SOV_launch_stalinist_counter_measure = yes # Prep for another run
			}
		}
	}
	# Align an Admiral
	SOV_align_admiral_stalin = {

		priority = 9

		icon = generic_military
		allowed = { tag = SOV }
		available = {
			var:SOV_selected_admiral_stalin = {
				OR = {
					has_trait = trait_SOV_bukharinist
					has_trait = trait_SOV_trotskyist
					has_trait = trait_SOV_monarchist_sympathizer
					custom_trigger_tooltip = {
						tooltip = SOV_character_purged_flag
						has_character_flag = SOV_character_purged_flag
					}
				}
			}
		}

		is_good = no

		days_mission_timeout = 30

		fire_only_once = no

		activation = {
			always = no # Only activated by triggers
		}

		visible = {
			hidden_trigger = {
				SOV_soviet_civil_war_not_started = yes
			}
		}
		cancel_if_not_visible = yes

		complete_effect = {
			hidden_effect = {
				clear_variable = SOV_selected_admiral_stalin
				SOV_launch_stalinist_counter_measure = yes
			}
		}

		timeout_effect = {
			custom_effect_tooltip = SOV_align_admiral_stalin_tt
			hidden_effect = {
				var:SOV_selected_admiral_stalin = {
					add_unit_leader_trait = trait_SOV_stalinist
				}
				clear_variable = SOV_selected_admiral_stalin
				SOV_launch_stalinist_counter_measure = yes # Prep for another run
			}
		}
	}

	## Stalin's crackdowns in unlocked Regions
	# Ukraine
	SOV_ukraine_crackdown_timer = {

		priority = 10

		icon = generic_ignite_civil_war
		allowed = { tag = SOV }
		available = {
			hidden_trigger = { always = no }
		}

		is_good = no

		days_mission_timeout = 45
		days_re_enable = 10

		fire_only_once = no

		activation = {
			has_country_flag = SOV_ukrainian_states_unlocked
			NOT = { has_global_flag = SOV_soviet_civil_war }
			NOT = { has_global_flag = SOV_soviet_civil_war_over } #Communist civil war has been completed
			NOT = { SOV_has_crackdown = yes } # Only one at a time
		}

		visible = {
			any_owned_state = {
				region = 130
				SOV_is_unaligned_state = yes
			}
		}
		cancel_if_not_visible = yes

		timeout_effect = {
			custom_effect_tooltip = SOV_ukraine_crackdown_timer_tt
			hidden_effect = {
				random_owned_state = {
					limit = {
						NOT = { has_state_flag = SOV_is_aligning_left }
						NOT = { has_state_flag = SOV_is_aligning_right }
						NOT = { has_state_flag = SOV_is_aligning_exiles	}
						SOV_is_unaligned_state = yes
						region = 130
					}
					set_state_flag = SOV_stalinist_state
				}
			}
			SOV_opposition_support_low_decrease_effect = yes
		}
	}
	# The Great Steppe Region
	SOV_steppe_crackdown_timer = {

		priority = 10

		icon = generic_ignite_civil_war
		allowed = { tag = SOV }
		available = {
			hidden_trigger = { always = no }
		}

		is_good = no

		days_mission_timeout = 45
		days_re_enable = 10

		fire_only_once = no

		activation = {
			has_country_flag = SOV_steppe_states_unlocked
			NOT = { has_global_flag = SOV_soviet_civil_war }
			NOT = { has_global_flag = SOV_soviet_civil_war_over } #Communist civil war has been completed
			NOT = { SOV_has_crackdown = yes } # Only one at a time
		}

		visible = {
			any_owned_state = {
				OR = {
					region = 136
					region = 267
					region = 268
					region = 269
					region = 270
				}
				SOV_is_unaligned_state = yes
			}
		}
		cancel_if_not_visible = yes

		timeout_effect = {
			custom_effect_tooltip = SOV_steppe_crackdown_timer_tt
			hidden_effect = {
				random_owned_state = {
					limit = {
						NOT = { has_state_flag = SOV_is_aligning_left }
						NOT = { has_state_flag = SOV_is_aligning_right }
						NOT = { has_state_flag = SOV_is_aligning_exiles	}
						SOV_is_unaligned_state = yes
						OR = {
							region = 136
							region = 267
							region = 268
							region = 269
							region = 270
						}
					}
					set_state_flag = SOV_stalinist_state
				}
			}
			SOV_opposition_support_low_decrease_effect = yes
		}
	}

	# The Northern Region
	SOV_northern_crackdown_timer = {

		priority = 10

		icon = generic_ignite_civil_war
		allowed = { tag = SOV }
		available = {
			hidden_trigger = { always = no }
		}

		is_good = no

		days_mission_timeout = 45
		days_re_enable = 10

		fire_only_once = no

		activation = {
			has_country_flag = SOV_northern_states_unlocked
			NOT = { has_global_flag = SOV_soviet_civil_war }
			NOT = { has_global_flag = SOV_soviet_civil_war_over } #Communist civil war has been completed
			NOT = { SOV_has_crackdown = yes } # Only one at a time
		}

		visible = {
			any_owned_state = {
				OR = {
					region = 12
					region = 150
					region = 264
					region = 265
					state = 215
					state = 216
				}
				SOV_is_unaligned_state = yes
			}
		}
		cancel_if_not_visible = yes

		timeout_effect = {
			custom_effect_tooltip = SOV_northern_crackdown_timer_tt
			hidden_effect = {
				random_owned_state = {
					limit = {
						NOT = { has_state_flag = SOV_is_aligning_left }
						NOT = { has_state_flag = SOV_is_aligning_right }
						NOT = { has_state_flag = SOV_is_aligning_exiles	}
						SOV_is_unaligned_state = yes
						OR = {
							region = 12
							region = 150
							region = 264
							region = 265
							state = 215
							state = 216
						}
					}
					set_state_flag = SOV_stalinist_state
				}
			}
			SOV_opposition_support_low_decrease_effect = yes
		}
	}

	# The Siberian Region
	SOV_siberian_crackdown_timer = {

		priority = 10

		icon = generic_ignite_civil_war
		allowed = { tag = SOV }
		available = {
			hidden_trigger = { always = no }
		}

		is_good = no

		days_mission_timeout = 45
		days_re_enable = 10

		fire_only_once = no

		activation = {
			has_country_flag = SOV_siberia_states_unlocked
			NOT = { has_global_flag = SOV_soviet_civil_war }
			NOT = { SOV_has_crackdown = yes } # Only one at a time
			NOT = { has_global_flag = SOV_soviet_civil_war_over } #Communist civil war has been completed
		}

		visible = {
			any_owned_state = {
				OR = {
					region = 147
					region = 263
					region = 151
					region = 261 
					region = 262 
					region = 149
					region = 256
					region = 257
					region = 258
					region = 259
					region = 260
				}
				NOT = { SOV_is_unaligned_state = yes  }
			}
		}
		cancel_if_not_visible = yes

		timeout_effect = {
			custom_effect_tooltip = SOV_siberian_crackdown_timer_tt
			hidden_effect = {
				random_owned_state = {
					limit = {
						SOV_is_unaligned_state = yes
						OR = {
							region = 147
							region = 263
							region = 151
							region = 261 
							region = 262 
							region = 149
							region = 256
							region = 257
							region = 258
							region = 259
							region = 260
						}
					}
					set_state_flag = SOV_stalinist_state
				}
			}
			SOV_opposition_support_low_decrease_effect = yes
		}

	}

	# The urals Region
	SOV_urals_crackdown_timer = {

		priority = 10

		icon = generic_ignite_civil_war
		allowed = { tag = SOV }
		available = {
			hidden_trigger = { always = no }
		}

		is_good = no

		days_mission_timeout = 45
		days_re_enable = 10

		fire_only_once = no

		activation = {
			has_country_flag = SOV_urals_states_unlocked
			NOT = { has_global_flag = SOV_soviet_civil_war }
			NOT = { SOV_has_crackdown = yes } # Only one at a time
			NOT = { has_global_flag = SOV_soviet_civil_war_over } #Communist civil war has been completed
		}

		visible = {
			any_owned_state = {
				OR = {
					region = 14
					region = 138
				}
				SOV_is_unaligned_state = yes
			}
		}
		cancel_if_not_visible = yes

		timeout_effect = {
			custom_effect_tooltip = SOV_urals_crackdown_timer_tt
			hidden_effect = {
				random_owned_state = {
					limit = {
						NOT = { has_state_flag = SOV_is_aligning_left }
						NOT = { has_state_flag = SOV_is_aligning_right }
						SOV_is_unaligned_state = yes
						OR = {
							region = 14
							region = 138
						}
					}
					set_state_flag = SOV_stalinist_state
				}
			}
			SOV_opposition_support_low_decrease_effect = yes
		}
	}

	## Doing Stalin's focuses
	# The Stalin Constitution
	SOV_the_stalin_constitution_mission = {

		priority = 11

		icon = SOV_the_stalin_constitution
		allowed = { tag = SOV }
		available = {
			hidden_trigger = { always = no }
		}

		is_good = no

		days_mission_timeout = 70
		fire_only_once = yes

		activation = {
			always = no #triggered by event
		}

		visible = {
			hidden_trigger = {
				SOV_soviet_civil_war_not_started = yes
			}
		}
		cancel_if_not_visible = yes

		timeout_effect = {

			add_political_power = -25
			SOV_opposition_support_low_decrease_effect = yes
			set_country_flag = SOV_the_stalin_constitution_completed_flag
			hidden_effect = {
				country_event = {
					id = NSB_soviet_civil_war_common.005
					hours = 1
					random_hours = 8
				}
			}
			custom_effect_tooltip = SOV_the_stalin_constitution_mission_tt
		}
	}
	SOV_the_zinovyevite_terrorist_center_mission = {
		priority = 11

		icon = SOV_the_zinovyevite_terrorist_center
		allowed = { tag = SOV }

		is_good = no

		days_mission_timeout = 70
		fire_only_once = yes
		available = {
			OR = {
				has_completed_focus = SOV_left_eliminate_right
				has_completed_focus = SOV_divert_attention_towards_military
				has_completed_focus = SOV_eliminate_the_left
			}
		}

		activation = {
			always = no #triggered by event
		}

		visible = {
			hidden_trigger = {
				SOV_soviet_civil_war_not_started = yes
			}
		}
		cancel_if_not_visible = yes
		complete_effect = {
			custom_effect_tooltip = SOV_the_zinovyevite_terrorist_center_mission_avoided_tt
			hidden_effect = {
				set_country_flag = SOV_the_zinovyevite_terrorist_center_completed_flag
				country_event = {
					id = NSB_soviet_civil_war_common.005
					days = 175
				}
			}
		}

		timeout_effect = {

			custom_effect_tooltip = SOV_the_zinovyevite_terrorist_center_mission_tt
			set_country_flag = { flag = SOV_paranoia_random_purge_cooldown_from_focus_flag days = 15 } #Used to prevent random purges from popping up while this is active
			set_country_flag = SOV_first_moscow_trial_flag #Used to unlock the next purge focus
			SOV_paranoia_high_increase_effect = yes

			#HISTORICAL
			#Zinovyev
			if = {
				limit = {
					has_character = SOV_grigory_zinovyev
					SOV_grigory_zinovyev = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_grigory_zinovyev = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}
			#Kamenev
			if = {
				limit = {
					has_character = SOV_lev_kamenev
					SOV_lev_kamenev = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_lev_kamenev = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}
			#Smirnov
			if = {
				limit = {
					has_character = SOV_ivan_smirnov
					SOV_ivan_smirnov = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_ivan_smirnov = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}

			#NOT-SO-HISTORICAL
			#Sokolnikov
			if = {
				limit = {
					has_character = SOV_grigory_sokolnikov
					SOV_grigory_sokolnikov = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_grigory_sokolnikov = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}
			#Shlyapnikov
			if = {
				limit = {
					has_character = SOV_aleksandr_shlyapnikov
					SOV_aleksandr_shlyapnikov = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_aleksandr_shlyapnikov = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}

			custom_effect_tooltip = SOV_will_trigger_a_great_purge_tt
			hidden_effect = {
				set_country_flag = SOV_purge_event_unavoidable_flag #No way to avoid this purge. This people are about to be purged and there's nothing you can do for them.
				SOV_trigger_great_purge_moscow_trial_effect = yes #FIRST MOSCOW TRIAL -> Zinovyev & friends
			}
			custom_effect_tooltip = SOV_trigger_first_moscow_trial_tt
			set_country_flag = SOV_the_zinovyevite_terrorist_center_completed_flag

			hidden_effect = {
				country_event = {
					id = NSB_soviet_civil_war_common.005
					days = 140
				}
			}
		}
	}

	# The Anti-Stalin Soviet Trotskyist Centre
	SOV_the_anti_soviet_trotskyist_center_mission = {

		priority = 11

		icon = SOV_the_anti_soviet_trotskyist_center
		allowed = { tag = SOV }
		available = {
			hidden_trigger = { always = no }
		}

		is_good = no

		days_mission_timeout = 35
		fire_only_once = yes

		activation = {
			always = no #triggered by event
		}

		visible = {
			hidden_trigger = {
				SOV_soviet_civil_war_not_started = yes
			}
		}
		cancel_if_not_visible = yes

		timeout_effect = {
			set_country_flag = { flag = SOV_paranoia_random_purge_cooldown_from_focus_flag days = 15 } #Used to prevent random purges from popping up while this is active
			set_country_flag = SOV_second_moscow_trial_flag #Used to unlock the next purge focus
			SOV_paranoia_high_increase_effect = yes
			#HISTORICAL
			#Radek
			if = {
				limit = {
					has_character = SOV_karl_radek
					SOV_karl_radek = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_karl_radek = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}
			#NOT-SO-HISTORICAL
			#Smilga
			if = {
				limit = {
					has_character = SOV_ivar_smilga
					SOV_ivar_smilga = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_ivar_smilga = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}
			#Preobrazhensky
			if = {
				limit = {
					has_character = SOV_yevgeny_preobrazhensky
					SOV_yevgeny_preobrazhensky = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_yevgeny_preobrazhensky = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}
			#Ryutin
			if = {
				limit = {
					has_character = SOV_martemyan_ryutin
					SOV_martemyan_ryutin = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_martemyan_ryutin = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}
			#Ustryalov
			if = {
				limit = {
					has_character = SOV_nikolay_ustryalov
					SOV_nikolay_ustryalov = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_nikolay_ustryalov = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}

			custom_effect_tooltip = SOV_will_trigger_a_great_purge_tt
			hidden_effect = {
				set_country_flag = SOV_purge_event_unavoidable_flag #No way to avoid this purge. This people are about to be purged and there's nothing you can do for them.
				SOV_trigger_great_purge_moscow_trial_effect = yes #SECOND MOSCOW TRIAL -> Left Opposition
			}
			custom_effect_tooltip = SOV_trigger_second_moscow_trial_tt
			set_country_flag = SOV_the_anti_soviet_trotskyist_center_completed_flag
			hidden_effect = {
				country_event = {
					id = NSB_soviet_civil_war_common.005
					days = 35
					random_hours = 12
				}
			}
		}
	}

	# The Workers Dictatorship
	SOV_the_workers_dictatorship_mission = {

		priority = 11

		icon = SOV_the_workers_dictatorship
		allowed = { tag = SOV }
		available = {
			hidden_trigger = { always = no }
		}

		is_good = no

		days_mission_timeout = 70
		fire_only_once = yes

		activation = {
			always = no #triggered by event
		}

		visible = {
			hidden_trigger = {
				SOV_soviet_civil_war_not_started = yes
			}
		}
		cancel_if_not_visible = yes

		timeout_effect = {

			add_political_power = -25
			SOV_opposition_support_low_decrease_effect = yes
			set_country_flag = SOV_the_workers_dictatorship_completed_flag
			hidden_effect = {
				country_event = {
					id = NSB_soviet_civil_war_common.005
					days = 70
				}
			}
			custom_effect_tooltip = SOV_the_workers_dictatorship_mission_tt
		}
	}

	# The Military Conspiracy
	SOV_the_military_conspiracy_mission = {

		priority = 11

		icon = SOV_the_military_conspiracy
		allowed = { tag = SOV }
		available = {
			hidden_trigger = { always = no }
		}

		is_good = no

		days_mission_timeout = 35
		fire_only_once = yes

		activation = {
			always = no #triggered by event
		}

		visible = {
			hidden_trigger = {
				SOV_soviet_civil_war_not_started = yes
			}
		}
		cancel_if_not_visible = yes

		timeout_effect = {

			SOV_decrease_all_opposition_army = yes
			set_country_flag = SOV_the_military_conspiracy_completed_flag
			set_country_flag = { flag = SOV_paranoia_random_purge_cooldown_from_focus_flag days = 15 } #Used to prevent random purges from popping up while this is active
			set_country_flag = SOV_trial_of_the_generals_flag #Used to unlock the next purge focus
			SOV_paranoia_high_increase_effect = yes

			#Historical
			if = {
				limit = {
					has_character = SOV_mikhail_tukhachevsky
					SOV_mikhail_tukhachevsky = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_mikhail_tukhachevsky = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}

			#Historical	- more comrades of Tukhachevsky getting purged...
			if = {
				limit = {
					has_character = SOV_august_kork
					SOV_august_kork = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_august_kork = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}

			#Historical	- more comrades of Tukhachevsky getting purged...
			if = {
				limit = {
					has_character = SOV_robert_eidemann
					SOV_robert_eidemann = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_robert_eidemann = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}

			#Historical	- more comrades of Tukhachevsky getting purged...
			if = {
				limit = {
					has_character = SOV_boris_feldman
					SOV_boris_feldman = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_boris_feldman = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}

			#Historical	- more comrades of Tukhachevsky getting purged...
			if = {
				limit = {
					has_character = SOV_iona_yakir
					SOV_iona_yakir = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_iona_yakir = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}
			#NOT-SO-HISTORICAL
			#Removed Yegorov, since he was purged in 1939 and was marked as "non-historical" - Fantom
			#Blyukher
			if = {
				limit = {
					has_character = SOV_vasily_blyukher
					SOV_vasily_blyukher = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_vasily_blyukher = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}
			#Primakov
			if = {
				limit = {
					has_character = SOV_vitaly_primakov
					SOV_vitaly_primakov = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_vitaly_primakov = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}

			custom_effect_tooltip = SOV_will_trigger_a_great_purge_tt
			hidden_effect = {
				set_country_flag = SOV_purge_event_unavoidable_flag #No way to avoid this purge. This people are about to be purged and there's nothing you can do for them.
				SOV_great_purge_army_trial_of_the_generals_effect = yes #TRIAL OF THE GENERALS -> Tukhachevsky
			}

			set_country_flag = SOV_stalinist_military_flag #New Generals have more chances of being Stalinists after this
			hidden_effect = {
				country_event = {
					id = NSB_soviet_civil_war_common.005
					days = 70
				}
			}
		}
	}

	# Socialism in one country
	SOV_socialism_in_one_country_mission = {

		priority = 11

		icon = SOV_socialism_in_one_country
		allowed = { tag = SOV }
		available = {
			hidden_trigger = { always = no }
		}

		is_good = no

		days_mission_timeout = 70
		fire_only_once = yes

		activation = {
			always = no #triggered by event
		}

		visible = {
			hidden_trigger = {
				SOV_soviet_civil_war_not_started = yes
			}
		}
		cancel_if_not_visible = yes

		timeout_effect = {
			add_political_power = -25
			SOV_opposition_support_low_decrease_effect = yes
			set_country_flag = SOV_socialism_in_one_country_completed_flag
			custom_effect_tooltip = SOV_socialism_in_one_country_mission_tt
			hidden_effect = {
				country_event = {
					id = NSB_soviet_civil_war_common.005
					days = 70
				}
			}
		}
	}

	# Secure the administration
	SOV_secure_the_administration_mission = {

		priority = 11

		icon = SOV_secure_the_administration
		allowed = { tag = SOV }
		available = {
			hidden_trigger = { always = no }
		}

		is_good = no

		days_mission_timeout = 70
		fire_only_once = yes

		activation = {
			always = no #triggered by event
		}

		visible = {
			hidden_trigger = {
				SOV_soviet_civil_war_not_started = yes
			}
		}
		cancel_if_not_visible = yes

		timeout_effect = {
			custom_effect_tooltip = "TODO: Lock still neutral Advisors. Prevent Bloodless Coup" # TODO_THOMAS FIX EFFECT
			add_political_power = -25
			SOV_opposition_support_low_decrease_effect = yes
			set_country_flag = SOV_secure_the_administration_completed_flag
			custom_effect_tooltip = SOV_secure_the_administration_mission_tt
			hidden_effect = {
				country_event = {
					id = NSB_soviet_civil_war_common.005
					days = 140
				}
			}
		}
	}

	# The Third Moscow trial
	SOV_the_bloc_of_rights_and_trotskyites_mission = {

		priority = 11

		icon = SOV_the_bloc_of_rights_and_trotskyites
		allowed = { tag = SOV }
		available = {
			hidden_trigger = { always = no }
		}

		is_good = no

		days_mission_timeout = 70
		fire_only_once = yes

		activation = {
			always = no #triggered by event
		}

		visible = {
			hidden_trigger = {
				SOV_soviet_civil_war_not_started = yes
			}
		}
		cancel_if_not_visible = yes

		timeout_effect = {
			set_country_flag = SOV_the_bloc_of_rights_and_trotskyites_completed_flag
			set_country_flag = { flag = SOV_paranoia_random_purge_cooldown_from_focus_flag days = 15 } #Used to prevent random purges from popping up while this is active
			set_country_flag = SOV_third_moscow_trial_flag #Used to unlock the next purge focus
			#HISTORICAL
			#Bukharin
			if = {
				limit = {
					has_character = SOV_nikolay_bukharin
					SOV_nikolay_bukharin = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_nikolay_bukharin = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}
			#Rykov
			if = {
				limit = {
					has_character = SOV_aleksey_rykov
					SOV_aleksey_rykov = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_aleksey_rykov = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}
			#NOT-SO-HISTORICAL
			#Tomsky
			if = {
				limit = {
					has_character = SOV_mikhail_tomsky
					SOV_mikhail_tomsky = {
						SOV_character_can_be_purged = yes
					}
				}
				SOV_mikhail_tomsky = {
					set_character_flag = SOV_targeted_for_purge_flag
				}
			}
			else = {
				SOV_add_random_character_to_purge_targets_effect = yes
			}
			#Litvinov was not purged, so nothing for him to do there either... - Fantom

			custom_effect_tooltip = SOV_will_trigger_a_great_purge_tt
			hidden_effect = {
				set_country_flag = SOV_purge_event_unavoidable_flag #No way to avoid this purge. This people are about to be purged and there's nothing you can do for them.
				SOV_trigger_great_purge_moscow_trial_effect = yes #THIRD MOSCOW TRIAL -> Right Opposition
			}
			custom_effect_tooltip = SOV_trigger_third_moscow_trial_tt
			hidden_effect = {
				country_event = {
					id = NSB_soviet_civil_war_common.005
					days = 520
				}
			}
		}
	}

	# Behead the snake
	SOV_behead_the_snake_mission = {

		priority = 11

		icon = SOV_behead_the_snake
		allowed = { tag = SOV }
		available = {
			hidden_trigger = { always = no }
		}

		is_good = no

		days_mission_timeout = 70
		fire_only_once = yes

		activation = {
			always = no #triggered by event
		}

		visible = {
			hidden_trigger = {
				SOV_soviet_civil_war_not_started = yes
			}
		}
		cancel_if_not_visible = yes

		timeout_effect = {
			custom_effect_tooltip = "TODO: Trigger Trotsky event" # TODO_THOMAS FIX EFFECT
			SOV_opposition_support_low_decrease_effect = yes
			set_country_flag = SOV_behead_the_snake_completed_flag
		}
	}

}


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


SOV_permanent_revolution_dec_cat = {
	SOV_organize_fifth_columnists_in_enemy_neighbor = { #Initially for Enemy European Neighbors -> Then other continents
		priority = 10

		icon = GFX_decision_generic_nationalism

		ai_will_do = {
			base = 0.7
		}

		target_trigger = {
			FROM = {
				exists = yes
				has_war_with = ROOT
				NOT = { original_tag = SOV }
				any_controlled_state = {
					is_in_home_area = yes
					any_neighbor_state = {
						is_controlled_by = ROOT
					}
				}
			}
			SOV_target_capital_is_on_unlocked_continent_fifth_columnists = yes
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			FROM = {
				has_civil_war = no
				any_controlled_state = {
					is_in_home_area = yes
					is_capital = no
				}
			}
			has_equipment = {
			    infantry_equipment > 19999
			}
		}

		visible = {

			FROM = {
				exists = yes
				NOT = { has_government = communism }
			}
		}

		cost = 150

		fire_only_once = yes

		days_remove = SOV_permanent_revolution_uprising_days

		complete_effect = {
			add_equipment_to_stockpile = {
			    type = infantry_equipment
			    amount = -20000
			}
			hidden_effect = {
				FROM = {
					set_country_flag = SOV_permanent_revolution_ignite_uprising_timer_flag
					activate_mission = SOV_ignite_uprising_timer_mission
				}
			}
		}

		remove_effect = {
			SOV_permanent_revolution_spawn_fifth_columnists_effect = yes
		}
	}

	SOV_ignite_revolutionary_uprisings = {
		priority = 5

		icon = generic_political_rally

		target_trigger = {
			FROM = {
				exists = yes
				NOT = { is_in_faction_with = ROOT }
				NOT = { tag = ROOT }
				NOT = { original_tag = SOV }
				has_capitulated = no
				NOT = { has_government = communism }
			}
		}

		ai_will_do = {
			base = 0
			modifier = {
				add = 1
				FROM = {
					communism > 0.4
				}
			}
		}

		allowed = {
			original_tag = SOV
		}

		available = {
			NOT = { has_war_with = FROM }
			FROM = {
				NOT = { has_government = communism }
			}
			FROM = {
				communism > 0.1
			}
		}

		visible = {
			SOV_target_capital_is_on_unlocked_continent_uprisings = yes
			country_exists = FROM
			NOT = { has_war_with = FROM }
			FROM = {
				NOT = { is_in_faction_with = ROOT }
				has_capitulated = no
				NOT = { has_government = communism }
				any_controlled_state = {
					is_in_home_area = yes
					any_neighbor_state = {
						is_controlled_by = ROOT
					}
				}
			}
		}

		cost = 50

		fire_only_once = yes

		days_remove = 120

		complete_effect = {
			FROM = {
				if = { #If country has banned communism, then add the weakened version of the NS
					limit = {
						has_country_flag = banned_communism_flag
					}
					add_timed_idea = {
						idea = SOV_trotskyist_revolutionary_agitation_weakened
						days = 120
					}
				}
				else = {
					add_timed_idea = {
						idea = SOV_trotskyist_revolutionary_agitation
						days = 120
					}
				}
				country_event = { id = NSB_soviet_permanent_revolution.1 hours = 2 }
			}
			hidden_effect = {
				FROM = {
					add_ai_strategy = {
						type = prepare_for_war
						id = ROOT
						value = 100
					}
				}
			}
		}

		remove_effect = {
			create_wargoal = {
				type = topple_government
				target = FROM
				expire = 90
			}
		}
	}

	SOV_ignite_uprising_timer_mission = {

		icon = generic_ignite_civil_war

		available = {
			hidden_trigger = { always = no }
		}

		days_mission_timeout = SOV.SOV_permanent_revolution_uprising_days

		fire_only_once = yes

		activation = {
			always = no
		}

		visible = {
			has_country_flag = SOV_permanent_revolution_ignite_uprising_timer_flag
		}

		cancel_if_not_visible = no

		is_good = yes

		timeout_effect = {
			clr_country_flag = SOV_permanent_revolution_ignite_uprising_timer_flag
			custom_effect_tooltip = SOV_ignite_uprising_timer_mission_tt
		}
	}
}



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


operations = {

	SOV_seize_manchuria = {

		icon = generic_operation

		allowed = {
			original_tag = SOV
		}

		available = {
			JAP = { has_completed_focus = JAP_pre_emptive_coup }
			MAN = { is_puppet = no }
			NOT = {
				has_war_with = MAN
			}
		}

		cost = 25
		fire_only_once = yes
		visible = {
			JAP = { has_completed_focus = JAP_strengthen_civilian_government }
			MAN = { exists = yes }
			NOT = {
				has_decision = SOV_counter_attack_through_manchuria
			}
		}

		complete_effect = {
			create_wargoal = {
				target = MAN
				type = annex_everything
			}
		}

		ai_will_do = {
			factor = 1
			modifier = {
				MAN = {
					is_ai = no
				}
				factor = 0 #we're mean but not that mean
			}
			modifier = {
				threat < 0.25
				factor = 0
			}
		}
	}

	SOV_counter_attack_through_manchuria = { # anti exploit decision if Japan attacks you

		icon = generic_operation

		allowed = {
			original_tag = SOV
		}

		available = {
			JAP = { has_war_with = SOV }
			MAN = { 
				is_puppet_of = JAP 
			}
			NOT = {
				has_war_with = MAN
			}
		}

		cost = 25
		fire_only_once = yes
		visible = {
			is_ai = yes	#a player can just declare war, since its a puppet of someone youre at war with
			MAN = {
				exists = yes 
				is_puppet_of = JAP 
			}			
			JAP = { has_war_with = SOV }
			controls_state = 657
			controls_state = 561
		}

		complete_effect = {
			create_wargoal = {
				target = MAN
				type = annex_everything
			}
		}

		ai_will_do = {
			factor = 0
			modifier = {
				MAN = {
					is_ai = no
				}
				factor = 0 #we're mean but not that mean
			}
			modifier = {
				SOV = {
					divisions_in_border_state = { # it should work, please confirm it works.
    					size > 5
    					state = 657
    					border_state = 714
					}
				}
				add = 20
			}
		}
	}
}

political_actions = {

	SOV_return_manchuria = {

		allowed = {
			original_tag = SOV
		}

		available = {
			OR = {
				AND = {
					owns_state = 610
					owns_state = 716
					owns_state = 328
					owns_state = 715
					owns_state = 714
					owns_state = 717
					owns_state = 761
					owns_state = 941
					owns_state = 942
					owns_state = 943
					owns_state = 944
					owns_state = 945
					owns_state = 946
					owns_state = 947
				}
				AND = {
					MAN = { 
						is_subject_of = SOV
						owns_state = 610
						owns_state = 716
						owns_state = 328
						owns_state = 715
						owns_state = 714
						owns_state = 717
						owns_state = 761
						owns_state = 941
						owns_state = 942
						owns_state = 943
						owns_state = 944
						owns_state = 945
						owns_state = 946
						owns_state = 947
					}
				}
			}
		}
		cost = 0
		fire_only_once = yes
		visible = {
			JAP = { has_completed_focus = JAP_strengthen_civilian_government }
			PRC = { exists = yes }
		}

		complete_effect = {
			if = {	#Mengjiang
				limit = {
					owns_state = 611
					owns_state = 612
				}
				PRC = {				
					transfer_state = 611
					transfer_state = 612
				}
			}
			PRC = { 
				transfer_state = 609
				transfer_state = 610
				transfer_state = 716
				transfer_state = 715
				transfer_state = 328
				transfer_state = 717
				transfer_state = 714
				transfer_state = 761
				transfer_state = 941
				transfer_state = 942
				transfer_state = 943
				transfer_state = 944
				transfer_state = 945
				transfer_state = 946
				transfer_state = 947
				country_event = { id = wtt_japan.125 }
			}		
		}

		ai_will_do = {
			factor = 1
		}
	}
}

political_actions = {

	demand_tribute_from_new_communist_china = {

		allowed = {
			tag = SOV
		}

		icon = generic_political_actions

		ai_will_do = {
			base = 0
			modifier = {
				add = 150
					#Has somewhat won against CHI and JAP
				count_triggers = {
					amount = 10
					595 = { is_controlled_by = FROM }
					596 = { is_controlled_by = FROM }
					597 = { is_controlled_by = FROM }
					598 = { is_controlled_by = FROM }
					600 = { is_controlled_by = FROM }
					601 = { is_controlled_by = FROM }
					602 = { is_controlled_by = FROM }
					603 = { is_controlled_by = FROM }
					605 = { is_controlled_by = FROM }
					606 = { is_controlled_by = FROM }
					607 = { is_controlled_by = FROM }
					608 = { is_controlled_by = FROM }
					613 = { is_controlled_by = FROM }
					614 = { is_controlled_by = FROM }
					620 = { is_controlled_by = FROM }
				}
			}

		}

		cost = 10

		visible = {
			has_government = communism
			FROM = {
				has_country_flag = WTT_support_from_soviet
				NOT = { has_war_with = ROOT }
				NOT = { is_subject_of = ROOT }
				NOT = {	has_idea = PRC_soviet_tribute_6 }
			}
		}

		targets = { CHI PRC GXC YUN SHX XSM SIK }
		targets_dynamic = yes

		target_trigger = {
			FROM = {
				tag = event_target:WTT_communist_china
				has_country_flag = WTT_support_from_soviet
			}
		}

		fire_only_once = no

		days_re_enable = 180

		complete_effect = {
			FROM = {
				country_event = { id = wtt_warlord_vs_prc.21 }
				custom_effect_tooltip = if_they_accept
				effect_tooltip = {
					PRC_soviet_tribute_level_up = yes
				}
			}
		}
	}

	demand_full_integration = {

		icon = generic_civil_support

		allowed = {
			tag = SOV
		}

		available = {
			FROM = { has_soviet_tribute = yes }
		}

		cost = WTT_communist_china_integration_cost?300

		visible = {
			has_government = communism
			FROM = { has_country_flag = WTT_support_from_soviet }
		}

		targets = { CHI PRC GXC YUN SHX XSM SIK }
		targets_dynamic = yes

		target_trigger = {
			FROM = { has_country_flag = WTT_support_from_soviet }
		}

		ai_will_do = {
			base = 0
			modifier = {
				add = 100
				#Has won against CHI and JAP
				595 = { is_controlled_by = FROM }
				596 = { is_controlled_by = FROM }
				597 = { is_controlled_by = FROM }
				598 = { is_controlled_by = FROM }
				600 = { is_controlled_by = FROM }
				601 = { is_controlled_by = FROM }
				602 = { is_controlled_by = FROM }
				603 = { is_controlled_by = FROM }
				605 = { is_controlled_by = FROM }
				606 = { is_controlled_by = FROM }
				607 = { is_controlled_by = FROM }
				608 = { is_controlled_by = FROM }
				613 = { is_controlled_by = FROM }
				614 = { is_controlled_by = FROM }
				620 = { is_controlled_by = FROM }
			}
			modifier = {
				add = 50
				FROM = {
					check_variable = { WTT_communist_china_integration_cost < 200 }
				}
			}
			modifier = {
				add = 50
				FROM = {
					check_variable = { WTT_communist_china_integration_cost < 150 }
				}
			}
			modifier = {
				add = 50
				FROM = {
					check_variable = { WTT_communist_china_integration_cost < 100 }
				}
			}
		}

		fire_only_once = yes

		complete_effect = {
			FROM = { country_event = { id = wtt_warlord_vs_prc.31 } }
		}
	}

	#SOVIET MISSION TO OCCUPY TURKEY
	SOV_set_up_puppet_state_in_turkey = {

		icon = generic_civil_support

		allowed = {
			has_dlc = "Battle for the Bosporus"
			tag = SOV
		}

		available = {
			NOT = { army_manpower_in_state = { state = 354 amount < 9600 } }
			NOT = { army_manpower_in_state = { state = 353 amount < 9600 } }
			NOT = { army_manpower_in_state = { state = 352 amount < 9600 } }
			NOT = { army_manpower_in_state = { state = 349 amount < 9600 } }
			NOT = { army_manpower_in_state = { state = 350 amount < 9600 } }
			NOT = { army_manpower_in_state = { state = 355 amount < 9600 } }
			NOT = { army_manpower_in_state = { state = 800 amount < 9600 } }
			NOT = { army_manpower_in_state = { state = 344 amount < 28800 } }
			NOT = { army_manpower_in_state = { state = 348 amount < 48000 } }
			NOT = { army_manpower_in_state = { state = 356 amount < 9600 } }
			NOT = { army_manpower_in_state = { state = 346 amount < 9600 } }
			NOT = { army_manpower_in_state = { state = 345 amount < 28800 } }
			NOT = { army_manpower_in_state = { state = 343 amount < 48000 } }
			NOT = { army_manpower_in_state = { state = 347 amount < 48000 } }
			NOT = { army_manpower_in_state = { state = 339 amount < 48000 } }
			NOT = { army_manpower_in_state = { state = 342 amount < 48000 } }
			NOT = { army_manpower_in_state = { state = 343 amount < 48000 } }
			NOT = { army_manpower_in_state = { state = 49 amount < 124000 } }
		}

		target_trigger = {
			FROM = {
				original_tag = TUR
			}
		}

		cost = 50

		fire_only_once = yes

		days_remove = 90

		visible = {
			has_government = communism
			has_global_flag = GRE_turkey_surrenders
			FROM = {
				NOT = {
					is_subject_of = SOV
					is_subject_of = GRE
				}
			}
		}

		cancel_if_not_visible = yes

		remove_effect = {
		}

		complete_effect = {
			TUR = {
				country_event = { id = bftb_greece.34 }
			}
			hidden_effect = {
				clr_global_flag = GRE_turkey_surrenders
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

}




SOV_panslavic_nationalism = {

	SOV_integrate_czechoslovakia = {
		icon = generic_form_nation

		available = {
			has_full_control_of_state = 9
			has_full_control_of_state = 69
			has_full_control_of_state = 1078
			has_full_control_of_state = 70
			has_full_control_of_state = 71
			has_full_control_of_state = 72
			has_full_control_of_state = 73
			has_full_control_of_state = 996
			has_full_control_of_state = 74
			has_full_control_of_state = 75
			has_full_control_of_state = 664
		}

		visible = {
			has_completed_focus = SOV_panslavic_nationalism
			NOT = {
				has_country_flag = SOV_integrated_czechoslovakia_flag
			}
		}

		cost = 150
		fire_only_once = yes
		days_remove = 90
		ai_will_do = {
			factor = 1
		}

		remove_effect = {
			add_state_core = 9
			add_state_core = 69
			add_state_core = 1078
			add_state_core = 70
			add_state_core = 71
			add_state_core = 72
			add_state_core = 73
			add_state_core = 996
			add_state_core = 74
			add_state_core = 75
			add_state_core = 664
			set_country_flag = SOV_integrated_czechoslovakia_flag
		}

		complete_effect = {

		}
	}

	SOV_integrate_bulgaria = {
		icon = generic_form_nation

		available = {
			has_full_control_of_state = 48
			has_full_control_of_state = 211
			has_full_control_of_state = 212
			has_full_control_of_state = 801
		}

		visible = {
			has_completed_focus = SOV_panslavic_nationalism
			NOT = {
				has_country_flag = SOV_integrated_bulgaria_flag
			}
		}

		cost = 75
		fire_only_once = yes
		days_remove = 90
		ai_will_do = {
			factor = 1
		}

		remove_effect = {
			add_state_core = 48
			add_state_core = 211
			add_state_core = 212
			add_state_core = 801
			set_country_flag = SOV_integrated_bulgaria_flag
		}

		complete_effect = {

		}
	}

	SOV_integrate_poland = {
		icon = generic_form_nation

		available = {
			has_full_control_of_state = 97
			has_full_control_of_state = 85
			has_full_control_of_state = 762
			has_full_control_of_state = 90
			has_full_control_of_state = 88
			has_full_control_of_state = 92
			has_full_control_of_state = 91
			has_full_control_of_state = 95
			has_full_control_of_state = 94
			has_full_control_of_state = 86
			has_full_control_of_state = 98
			has_full_control_of_state = 89
			has_full_control_of_state = 10
			has_full_control_of_state = 96
			has_full_control_of_state = 784
			has_full_control_of_state = 93
			has_full_control_of_state = 87
			#r56 - seems bugged in vanilla, missing Gdynia making Danzig city unconnected
			has_full_control_of_state = 807
			has_full_control_of_state = 934
			has_full_control_of_state = 935
			has_full_control_of_state = 936
		}

		visible = {
			has_completed_focus = SOV_panslavic_nationalism
			NOT = {
				has_country_flag = SOV_integrated_poland_flag
			}			
		}

		cost = 150
		fire_only_once = yes
		days_remove = 90
		ai_will_do = {
			factor = 1
		}

		remove_effect = {
			add_state_core = 97
			add_state_core = 85
			add_state_core = 762
			add_state_core = 90
			add_state_core = 88
			add_state_core = 92
			add_state_core = 91
			add_state_core = 95
			add_state_core = 94
			add_state_core = 86
			add_state_core = 98
			add_state_core = 89
			add_state_core = 10
			add_state_core = 96
			add_state_core = 784
			add_state_core = 93
			add_state_core = 87
			#r56
			add_state_core = 807
			add_state_core = 934
			add_state_core = 935
			add_state_core = 936
			set_country_flag = SOV_integrated_poland_flag
		}

		complete_effect = {

		}
	}

	SOV_integrate_yugoslavia = {
		icon = generic_form_nation

		available = {
			has_full_control_of_state = 104
			has_full_control_of_state = 109
			has_full_control_of_state = 103
			has_full_control_of_state = 804
			has_full_control_of_state = 802
			has_full_control_of_state = 106
			has_full_control_of_state = 105
			has_full_control_of_state = 108
			has_full_control_of_state = 107
			has_full_control_of_state = 102
			has_full_control_of_state = 803
			has_full_control_of_state = 45
			has_full_control_of_state = 764
			#r56
			has_full_control_of_state = 853 #Ljubljana
			has_full_control_of_state = 952 #Syrmia
			has_full_control_of_state = 953 #Mitrovica
			has_full_control_of_state = 950 #Debar
			has_full_control_of_state = 956 #Prekmurje
			has_full_control_of_state = 958 #Kvarner
			has_full_control_of_state = 959 #Slavonia
			has_full_control_of_state = 961 #Banja Luka
			has_full_control_of_state = 962 #Posavina
			has_full_control_of_state = 963 #West Sandzak
		}

		visible = {
			has_completed_focus = SOV_panslavic_nationalism
			NOT = {
				has_country_flag = SOV_integrated_yugoslavia_flag
			}
		}

		cost = 100
		fire_only_once = yes
		days_remove = 90
		ai_will_do = {
			factor = 1
		}

		remove_effect = {
			add_state_core = 104
			add_state_core = 109
			add_state_core = 103
			add_state_core = 804
			add_state_core = 802
			add_state_core = 106
			add_state_core = 105
			add_state_core = 108
			add_state_core = 107
			add_state_core = 102
			add_state_core = 803
			add_state_core = 45
			add_state_core = 764
			#r56
			add_state_core = 853 #Ljubljana
			add_state_core = 952 #Syrmia
			add_state_core = 953 #Mitrovica
			add_state_core = 950 #Debar
			add_state_core = 956 #Prekmurje
			add_state_core = 958 #Kvarner
			add_state_core = 959 #Slavonia
			add_state_core = 961 #Banja Luka
			add_state_core = 962 #Posavina
			add_state_core = 963 #West Sandzak
			set_country_flag = SOV_integrated_yugoslavia_flag
		}

		complete_effect = {

		}
	}

	SOV_declare_the_pan_slavic_union = {
		icon = generic_form_nation

		available = {
			has_country_flag = SOV_integrated_czechoslovakia_flag
			has_country_flag = SOV_integrated_bulgaria_flag
			has_country_flag = SOV_integrated_poland_flag
			has_country_flag = SOV_integrated_yugoslavia_flag
			has_full_control_of_state = 9
			has_full_control_of_state = 69
			has_full_control_of_state = 1078
			has_full_control_of_state = 70
			has_full_control_of_state = 71
			has_full_control_of_state = 72
			has_full_control_of_state = 73
			has_full_control_of_state = 996
			has_full_control_of_state = 74
			has_full_control_of_state = 75
			has_full_control_of_state = 664
			has_full_control_of_state = 48
			has_full_control_of_state = 211
			has_full_control_of_state = 212
			has_full_control_of_state = 801
			has_full_control_of_state = 97
			has_full_control_of_state = 85
			has_full_control_of_state = 762
			has_full_control_of_state = 90
			has_full_control_of_state = 88
			has_full_control_of_state = 92
			has_full_control_of_state = 91
			has_full_control_of_state = 95
			has_full_control_of_state = 94
			has_full_control_of_state = 86
			has_full_control_of_state = 98
			has_full_control_of_state = 89
			has_full_control_of_state = 10
			has_full_control_of_state = 96
			has_full_control_of_state = 784
			has_full_control_of_state = 93
			has_full_control_of_state = 87
			has_full_control_of_state = 104
			has_full_control_of_state = 109
			has_full_control_of_state = 103
			has_full_control_of_state = 804
			has_full_control_of_state = 802
			has_full_control_of_state = 106
			has_full_control_of_state = 105
			has_full_control_of_state = 108
			has_full_control_of_state = 107
			has_full_control_of_state = 102
			has_full_control_of_state = 803
			has_full_control_of_state = 45
			has_full_control_of_state = 764
		}

		visible = {
			has_completed_focus = SOV_panslavic_nationalism
		}

		cost = 25
		fire_only_once = yes
		ai_will_do = {
			factor = 1
		}

		complete_effect = {
			set_cosmetic_tag = SOV_PANSLAVIC
			news_event = { id = nsb_news.405 hours = 12 }
		}
	}
}

# American/British arms purchase

SOV_weapons_purchases_category = {
	SOV_order_weapons_in_USA = {
		icon = generic_prepare_civil_war
		available = {
			num_of_available_civilian_factories > 2
		}
		visible = {
			has_defensive_war = yes
			any_other_country = {
				is_major = yes
				has_war_with = ROOT
			}
			USA_can_sell_weapons_trigger = yes
		}
		days_remove = 60
		days_re_enable = 180
		cost = 25
		ai_will_do = {
			factor = 10
			modifier = {
				has_equipment = {
					infantry_equipment < 1
				}
				factor = 50
			}
			modifier = {
				has_manpower < 10000
				factor = 0 #need to up conscription laws
			}
		}
		modifier = {
			civilian_factory_use = 2
		}
		complete_effect = {
			USA = {
				add_offsite_building = { type = industrial_complex level = 2 }
			}
		}
		remove_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				producer = USA
				amount = 5000
			}
			USA = {
				add_offsite_building = { type = industrial_complex level = -2 }
			}
		}
	}
	SOV_order_support_equipment_in_USA = {
		icon = generic_prepare_civil_war
		available = {
			num_of_available_civilian_factories > 2
		}
		visible = {
			has_defensive_war = yes
			any_other_country = {
				is_major = yes
				has_war_with = ROOT
			}
			USA_can_sell_weapons_trigger = yes
		}
		days_remove = 60
		days_re_enable = 180
		cost = 25
		ai_will_do = {
			factor = 5
			modifier = {
				has_equipment = {
					support_equipment < 1
				}
				factor = 50
			}
			modifier = {
				has_manpower < 10000
				factor = 0 #need to up conscription laws
			}
		}
		modifier = {
			civilian_factory_use = 2
		}
		complete_effect = {
			USA = {
				add_offsite_building = { type = industrial_complex level = 2 }
			}
		}
		remove_effect = {
			add_equipment_to_stockpile = {
				type = support_equipment
				producer = USA
				amount = 150
			}
			USA = {
				add_offsite_building = { type = industrial_complex level = -2 }
			}
		}
	}
	SOV_order_artillery_in_USA = {
		icon = ger_military_buildup
		available = {
			num_of_available_civilian_factories > 2
		}
		visible = {
			has_defensive_war = yes
			any_other_country = {
				is_major = yes
				has_war_with = ROOT
			}
			USA_can_sell_weapons_trigger = yes
		}
		days_remove = 60
		days_re_enable = 180
		cost = 25
		ai_will_do = {
			factor = 5
			modifier = {
				has_equipment = {
					artillery_equipment < 1
				}
				factor = 50
			}
			modifier = {
				has_manpower < 10000
				factor = 0 #need to up conscription laws
			}
		}
		modifier = {
			civilian_factory_use = 2
		}
		complete_effect = {
			USA = {
				add_offsite_building = { type = industrial_complex level = 2 }
			}
		}
		remove_effect = {
			add_equipment_to_stockpile = {
				type = artillery_equipment
				producer = USA
				amount = 250
			}
			USA = {
				add_offsite_building = { type = industrial_complex level = -2 }
			}
		}
	}
	SOV_order_tanks_in_USA = {
		icon = generic_tank
		available = {
			num_of_available_civilian_factories > 5
		}
		visible = {
			has_defensive_war = yes
			any_other_country = {
				is_major = yes
				has_war_with = ROOT
			}
			USA_can_sell_weapons_trigger = yes
		}
		days_remove = 60
		days_re_enable = 180
		cost = 50
		ai_will_do = {
			factor = 1
			modifier = {
				has_equipment = {
					light_tank_chassis < 10
				}
				factor = 5
			}
			modifier = {
				has_manpower < 10000
				factor = 0 #need to up conscription laws
			}
		}
		modifier = {
			civilian_factory_use = 5
		}
		complete_effect = {
			USA = {
				add_offsite_building = { type = industrial_complex level = 5 }
			}
		}
		remove_effect = {
			if = {
				limit = {
					USA = { 
						OR = {
							has_tech = basic_light_tank 
							has_tech = basic_light_tank_chassis
						}
						NOT = { 
							has_tech = basic_medium_tank 
							has_tech = improved_medium_tank #needed because basic can be bypassed
							has_tech = basic_medium_tank_chassis
							has_tech = improved_medium_tank_chassis
						}
					}
				}
				add_equipment_to_stockpile = {
					type = light_tank_chassis
					producer = USA
					amount = 100
				}
			}
			else_if = {
				limit = {
					USA = {
						OR = {
							has_tech = basic_medium_tank
							has_tech = improved_medium_tank #needed because basic can be bypassed
							has_tech = basic_medium_tank_chassis
							has_tech = improved_medium_tank_chassis
						}
					}
				}
				add_equipment_to_stockpile = {
					type = medium_tank_chassis
					producer = USA
					amount = 100
				}
			}
			USA = {
				add_offsite_building = { type = industrial_complex level = -5 }
			}
		}
	}
	SOV_order_fighters_in_ENG = {
		icon = generic_air
		available = {
			num_of_available_civilian_factories > 5
		}
		visible = {
			has_defensive_war = yes
			any_other_country = {
				is_major = yes
				has_war_with = ROOT
			}
			has_country_flag = SOV_arms_purchases_permitted
			ENG_can_sell_weapons_trigger = yes
		}
		days_remove = 60
		days_re_enable = 180
		cost = 50
		ai_will_do = {
			factor = 1
			modifier = {
				has_equipment = {
					small_plane_airframe < 1
				}
				factor = 5
			}
			modifier = {
				has_manpower < 10000
				factor = 0 #need to up conscription laws
			}
		}
		modifier = {
			civilian_factory_use = 5
		}
		complete_effect = {
			ENG = {
				add_offsite_building = { type = industrial_complex level = 5 }
			}
		}
		remove_effect = {
			add_equipment_to_stockpile = {
				type = small_plane_airframe
				producer = ENG
				amount = 100
			}
			ENG = {
				add_offsite_building = { type = industrial_complex level = -5 }
			}
		}
	}
	SOV_order_bombers_in_ENG = {
		icon = generic_air
		available = {
			num_of_available_civilian_factories > 5
		}
		visible = {
			has_defensive_war = yes
			any_other_country = {
				is_major = yes
				has_war_with = ROOT
			}
			has_country_flag = SOV_arms_purchases_permitted
			ENG_can_sell_weapons_trigger = yes
		}
		days_remove = 60
		days_re_enable = 180
		cost = 50
		ai_will_do = {
			factor = 1
			modifier = {
				has_equipment = {
					tac_bomber_equipment < 1
				}
				factor = 5
			}
			modifier = {
				has_manpower < 10000
				factor = 0 #need to up conscription laws
			}
		}
		modifier = {
			civilian_factory_use = 5
		}
		complete_effect = {
			ENG = {
				add_offsite_building = { type = industrial_complex level = 5 }
			}
		}
		remove_effect = {
			add_equipment_to_stockpile = {
				type = medium_plane_airframe
				producer = ENG
				amount = 50
			}
			ENG = {
				add_offsite_building = { type = industrial_complex level = -5 }
			}
		}
	}
}
