###########################
# Soviet Events
###########################

add_namespace = soviet

# Border Skirmish with the Japanese
country_event = {
	id = soviet.1
	title = soviet.1.t
	desc = soviet.1.d
	picture = GFX_report_event_japanese_transport_soldiers
	
	is_triggered_only = yes
	
	option = { # Push back
		name = soviet.1.a
		ai_chance = { factor = 75 }
		add_political_power = -25
		hidden_effect = {
			random_list = {
				60 = {
					JAP = {
						country_event = { days = 1 id = japan.3 }
					}
				}
				40 = {
					JAP = {
						country_event = { days = 1 id = japan.4 }
					}
				}
			}
		}
		effect_tooltip = {
			random_list = {
				60 = {
					country_event = soviet.2
				}
				40 = {
					country_event = soviet.3
				}
			}
		}
	}
	option = { # Yield
		name = soviet.1.b
		ai_chance = { factor = 25 }
		JAP = {
			effect_tooltip = {
				add_stability = 0.05
			}
			country_event = { days = 1 id = japan.5 }
		}
	}
}

# Successful Raid
country_event = {
	id = soviet.2
	title = soviet.2.t
	desc = soviet.2.d
	picture = GFX_report_event_dead_soldiers
	
	is_triggered_only = yes
	
	option = {
		name = soviet.2.a
		if = {
			limit = {
				561 = { 
					is_owned_by = SOV 
					any_neighbor_state = { 
						OR = {
							is_owned_by = JAP							
							is_owned_by = MAN								
						}
					} 
				}
			}
			561 = { add_manpower = -30000 }
		}		
		if = {
			limit = { 
				NOT = { 
					561 = { 
						is_owned_by = SOV 
						any_neighbor_state = { 
							OR = {
								is_owned_by = JAP
								is_owned_by = MAN
							} 	
						}
					}
				}
			}
			random_owned_state = {
				limit = { 
					any_neighbor_state = { 
						OR = {
							is_owned_by = JAP
							is_owned_by = MAN
						}
					} 
				} 
				add_manpower = -30000
			}
		}

		army_experience = 10
	}
}

# Failed Raid
country_event = {
	id = soviet.3
	title = soviet.3.t
	desc = soviet.3.d
	picture = GFX_report_event_dead_soldiers
	
	is_triggered_only = yes
	
	option = {
		if = {
			limit = {
				561 = { 
					is_owned_by = SOV 
					any_neighbor_state = { 
						OR = {
							is_owned_by = JAP
							is_owned_by = MAN							
						} 
					} 
				}
			}
			561 = { add_manpower = -20000 }
		}		
		if = {
			limit = { 
				NOT = { 
					561 = { 
						is_owned_by = SOV 
						any_neighbor_state = { 
							OR = {
								is_owned_by = JAP
								is_owned_by = MAN
							}
						}
					}
				}
			}
			random_owned_state = {
				limit = { 
					any_neighbor_state = { 
						OR = {
							is_owned_by = JAP
							is_owned_by = MAN
						}
					} 
				}
				add_manpower = -20000
			}
		}

		add_political_power = -25
		army_experience = 5
		name = soviet.3.a
	}
}

# Romania surrenders Bessarabia
country_event = {
	id = soviet.4
	title = soviet.4.t
	desc = soviet.4.d
	picture = GFX_report_event_soviet_army_greeted
	
	is_triggered_only = yes
	
	option = {
		name = soviet.4.a

		set_variable = { SOV.former_controller_of_bessarabia = 78.controller }
		
		ROOT = { #Scoping for tooltip reasons
			if = {
				limit = { 
					78 = { is_owned_and_controlled_by = FROM }
					192 = { is_owned_and_controlled_by = UKR } 
					is_in_faction_with = UKR
				}
				UKR = { transfer_state = 78 }
			}
			if = { #NSB note: Now this will check for ownership and control so that in edge cases where there might be more than one controller, it won't break.
				limit = {
					78 = { is_owned_and_controlled_by = FROM }
				}
				transfer_state = 78
			}
			if = {
				limit = { 
					80 = { is_owned_and_controlled_by = FROM }
					192 = { is_owned_and_controlled_by = UKR } 
					is_in_faction_with = UKR
				}
				UKR = { transfer_state = 80 }
			}
			if = {
				limit = {
					80 = { is_owned_and_controlled_by = FROM }
				}
				transfer_state = 80
			}
			if = {
				limit = { 
					766 = { is_owned_and_controlled_by = FROM }
					192 = { is_owned_and_controlled_by = UKR } 
					is_in_faction_with = UKR
				}
				UKR = { transfer_state = 766 }
			}
			if = {
				limit = {
					766 = { is_owned_and_controlled_by = FROM }
				}
				transfer_state = 766
			}
		}
		hidden_effect = {
			SOV = {
				country_event = { days = 1 id = news.10 }
			}
			news_event = { id = news.199 }
		}
	}
}

# Romania refuses to surrender Bessarabia
country_event = {
	id = soviet.5
	title = soviet.5.t
	desc = soviet.5.d
	picture = GFX_report_event_stalin_02
	
	is_triggered_only = yes
	
	option = {
		name = soviet.5.a
		create_wargoal = {
			type = take_state
			target = FROM
			generator = { 78 }
		}
		hidden_effect = {
			SOV = {
				country_event = { days = 1 id = news.11 }
			}
		}
	}
}

# Estonia Surrenders
country_event = {
	id = soviet.6
	title = soviet.6.t
	desc = soviet.6.d
	picture = GFX_report_event_soviet_invasion_map
	
	is_triggered_only = yes
	
	option = {
		name = soviet.6.a
		if = {
			limit = {
				FROM = { has_country_flag = cave_to_enemy_pressure_flag }
			}
			puppet = FROM
		}
		else = {
			annex_country = { target = FROM }
		}
	}
}

# Estonia Refuses
country_event = {
	id = soviet.7
	title = soviet.7.t
	desc = soviet.7.d
	picture = GFX_report_event_generic_read_write
	
	is_triggered_only = yes
	
	option = {
		name = soviet.7.a
		create_wargoal = {
			type = annex_everything
			target = EST
		}		
	}
}

# Latvia Surrenders
country_event = {
	id = soviet.8
	title = soviet.8.t
	desc = soviet.8.d
	picture = GFX_report_event_soviet_tank_parade
	
	is_triggered_only = yes
	
	option = {
		name = soviet.8.a
		if = {
			limit = {
				FROM = { has_country_flag = cave_to_enemy_pressure_flag }
			}
			puppet = FROM
		}
		else = {
			annex_country = { target = FROM }
		}
	}
}

# Latvia Refuses
country_event = {
	id = soviet.9
	title = soviet.9.t
	desc = soviet.9.d
	picture = report_event_generic_sign_treaty2
	
	is_triggered_only = yes
	
	option = {
		name = soviet.9.a
		create_wargoal = {
			type = annex_everything
			target = LAT
		}		
	}
}

# Lithuania Surrenders
country_event = {
	id = soviet.10
	title = soviet.10.t
	desc = soviet.10.d
	picture = GFX_report_event_soviet_tank_parade
	
	is_triggered_only = yes
	
	option = {
		name = soviet.10.a
		if = {
			limit = {
				FROM = {
					has_country_flag = cave_to_enemy_pressure_flag
					NOT = {	#Appeased the wrong side
						has_completed_focus = LIT_appease_nazis
					}
				}
			}
			puppet = FROM
		}
		else = {
			annex_country = { target = FROM }
		}
	}
}

# Lithuania Refuses
country_event = {
	id = soviet.11
	title = soviet.11.t
	desc = soviet.11.d
	picture = report_event_generic_sign_treaty2
	
	is_triggered_only = yes
	
	option = {
		name = soviet.11.a
		create_wargoal = {
			type = annex_everything
			target = LIT
		}		
	}
}

# Finland Accepts Demands
country_event = {
	id = soviet.12
	title = soviet.12.t
	desc = soviet.12.d
	picture = GFX_report_event_soviet_finnish_pact
	
	is_triggered_only = yes
	
	option = {
		name = soviet.12.a
		SOV = { 
			transfer_state = 146
			custom_effect_tooltip = FIN_remove_soviet_claims_in_other_states_tt
		}
		hidden_effect = {
			FIN = {
				every_core_state = {
					limit = {
						is_owned_by = PREV
						is_claimed_by = ROOT
					}
					remove_claim_by = ROOT 
				} 
			}
			SOV = {
				country_event = { days = 1 id = news.13 }
			}
		}
	}
}

# Finland Refuses Demands
country_event = {
	id = soviet.13
	title = soviet.13.t
	desc = soviet.13.d
	picture = GFX_report_event_soviet_tanks_snow
	
	is_triggered_only = yes
	
	option = {
		name = soviet.13.a
		create_wargoal = {
			type = take_state
			target = FIN
			generator = { 146 }
		}				
		hidden_effect = {
			SOV = {
				country_event = { days = 1 id = news.12 }
			}
		}
	}
}

# Tannu Tuva is asked to join the USSR
country_event = {
	id = soviet.14
	title = soviet.14.t
	desc = soviet.14.d
	picture = GFX_report_event_stalin_01
	
	is_triggered_only = yes
	
	option = { # Accept
		name = soviet.14.a
		ai_chance = { factor = 100 }
		SOV = {
			country_event = { id = soviet.16 }
		}
		custom_effect_tooltip = GAME_OVER_TT
	}
	option = { # Refuse
		name = soviet.14.b
		SOV = {
			country_event = { id = soviet.15 }
		}
	}
}

# Tannu Tuva declines the offer
country_event = {
	id = soviet.15
	title = soviet.15.t
	desc = soviet.15.d
	picture = GFX_report_event_stalin_02
	
	is_triggered_only = yes
	
	option = {
		name = soviet.15.a
	}
}

# Tannu Tuva accepts the offer
country_event = {
	id = soviet.16
	title = soviet.16.t
	desc = soviet.16.d
	picture = GFX_report_event_stalin_propaganda
	
	is_triggered_only = yes
	
	option = {
		name = soviet.16.a
		annex_country = { target = TAN }
		hidden_effect = {
			SOV = {
				country_event = { days = 1 id = news.14 }
			}
		}
	}
}

# Improving the Stalin Line
country_event = {
	id = soviet.17
	title = soviet.17.t
	desc = soviet.17.d
	picture = GFX_report_event_bunker_01
	
	is_triggered_only = yes
	
	option = {
		name = soviet.17.a

		209 = {
			add_building_construction = {
				type = bunker
				province = 11202
				level = 5
			}
			add_building_construction = {
				type = bunker
				province = 6324
				level = 5
			}
			add_building_construction = {
				type = bunker
				province = 11392
				level = 5
			}
		}
		210 = {
			add_building_construction = {
				type = bunker
				province = 6242
				level = 5
			}
		}
		207 = {
			add_building_construction = {
				type = bunker
				province = 6249
				level = 5
			}
			add_building_construction = {
				type = bunker
				province = 9241
				level = 5
			}
			add_building_construction = {
				type = bunker
				province = 3331
				level = 5
			}
		}
		206 = {
			add_building_construction = {
				type = bunker
				province = 9289
				level = 5
			}
		}
	}
}

# Xi'an Incident
country_event = {
	id = soviet.18
	title = soviet.18.t
	desc = soviet.18.d
	picture = GFX_report_event_china_politicians_captured
	
	trigger = {
		date > 1936.11.1
		tag = CHI
		has_opinion_modifier = hostile_status
		NOT = { has_dlc = "Waking the Tiger" }
	}

	fire_only_once = yes

	mean_time_to_happen = {
		days = 50
	}
	
	# Enter negotiations with Communist China
	option = {
		name = soviet.18.a
		PRC = { country_event = { id = soviet.19 days = 1 } }
	}

	# Refuse to negotiate
	option = {
		name = soviet.18.b
		#SOV = { country_event = { id = soviet.20 days = 1 } }
		ai_chance = { factor = 0 }
		set_global_flag = CHI_no_national_front_flag
		custom_effect_tooltip = CHI_no_united_front
	}
}

# Xi'an Incident - Communist China
country_event = {
	id = soviet.19
	title = soviet.19.t
	desc = soviet.19.d
	picture = GFX_report_event_japanese_chinese_surrender
	
	is_triggered_only = yes
	
	# Agree to a truce
	option = {
		name = soviet.19.a
		remove_opinion_modifier = { target = CHI modifier = hostile_status }
		CHI = {
			remove_opinion_modifier = { target = PRC modifier = hostile_status }
			country_event = { id = soviet.21 days = 1 }
		}
		hidden_effect = {
			605 = {
				if = {
					limit = { is_border_conflict = yes }
					set_border_war = no
				}
			}
			620 = {
				if = {
					limit = { is_border_conflict = yes }
					set_border_war = no
				}
			}
			607 = {
				if = {
					limit = { is_border_conflict = yes }
					set_border_war = no
				}
			}
			622 = {
				if = {
					limit = { is_border_conflict = yes }
					set_border_war = no
				}
			}
		}
		#SOV = { country_event = { id = soviet.21 days = 1 } }
	}

	# Refuse to negotiate
	option = {
		name = soviet.19.b
		SOV = { country_event = { id = soviet.22 days = 1 } }
		set_global_flag = CHI_no_national_front_flag
		ai_chance = { factor = 0 }
		custom_effect_tooltip = CHI_no_united_front
	}
}

# Xi'an Incident - Kuomintang Refuses
country_event = {
	id = soviet.20
	title = soviet.20.t
	desc = soviet.20.d
	picture = GFX_report_event_nationalist_china_machinegun_firing
	
	is_triggered_only = yes
	
	option = {
		name = soviet.20.a
	}
}

# Xi'an Incident - Truce
country_event = {
	id = soviet.21
	title = soviet.21.t
	desc = soviet.21.d
	picture = GFX_report_event_chinese_japanese_handshake
	
	is_triggered_only = yes
	
	option = {
		name = soviet.21.a
		effect_tooltip = {
			PRC = { remove_opinion_modifier = { target = CHI modifier = hostile_status } }
			CHI = { remove_opinion_modifier = { target = PRC modifier = hostile_status } }
		}
	}
}

# Xi'an Incident - Communists Refuse
country_event = {
	id = soviet.22
	title = soviet.22.t
	desc = soviet.22.d
	picture = GFX_report_event_chinese_officers
	
	is_triggered_only = yes
	
	option = {
		name = soviet.22.a
	}
}

# Soviet Union Cedes Land (Japan)
country_event = {
	id = soviet.23
	title = soviet.23.t
	desc = soviet.23.d
	picture = GFX_report_event_soviet_japanese_pact
	
	is_triggered_only = yes
	
	option = {
		name = soviet.23.a
		transfer_state = 655
	}
}

# Great Purge - Begins
country_event = {
	id = soviet.24
	title = soviet.24.t
	desc = soviet.24.d
	picture = GFX_report_event_soviet_purge_speech
	
	is_triggered_only = yes
	
	option = {
		name = soviet.24.a
	}
}

# Deleted stuff in NSB
# Great Purge - Trial of the Anti-Soviet Trotskyist Center
#country_event = {
#	id = soviet.25
#	title = soviet.25.t
#	desc = soviet.25.d
#	picture = GFX_report_event_soviet_purge_trial
#
#	fire_only_once = yes
#	
#	trigger = {
#		tag = SOV
#		NOT = { has_completed_focus = SOV_great_purge }
#		focus_progress = {
#			focus = SOV_great_purge
#			progress > 0.25
#		}
#	}
#
#	mean_time_to_happen = {
#		days = 1
#	}
#
#	option = {
#		ai_chance = {
#			factor = 30
#		}
#		name = soviet.25.a
#		custom_effect_tooltip = remove_political_advisor
#		show_ideas_tooltip = mikhail_kalinin
#		set_country_flag = purged_kalinin
#		hidden_effect = {
#			retire_character = SOV_mikhail_kalinin_old
#		}
#	}
#	option = {
#		ai_chance = {
#			factor = 30
#		}
#		name = soviet.25.b
#		custom_effect_tooltip = remove_political_advisor
#		show_ideas_tooltip = nikita_khrushchev
#		set_country_flag = purged_khrushchev
#		hidden_effect = {
#			retire_character = SOV_nikita_khrushchyov_old
#		}
#	}
#	option = {
#		ai_chance = {
#			factor = 30
#		}
#		name = soviet.25.c
#		add_political_power = -75
#		set_country_flag = purged_party_members
#	}
#	option = {
#		ai_chance = {
#			factor = 10
#			modifier = {
#				factor = 0
#				is_historical_focus_on = yes
#			}
#		}
#		name = soviet.25.e
#		set_country_flag = no_political_purge
#		custom_effect_tooltip = soviet.27_tt2
#	}
#}

# Great Purge - Secret Trial of the Generals
#country_event = {
#	id = soviet.26
#	title = soviet.26.t
#	desc = soviet.26.d
#	picture = GFX_report_event_soviet_purge_officers_01
#
#	fire_only_once = yes
#	
#	trigger = {
#		tag = SOV
#		NOT = { has_completed_focus = SOV_great_purge }
#		focus_progress = {
#			focus = SOV_great_purge
#			progress > 0.5
#		}
#	}
#
#	mean_time_to_happen = {
#		days = 1
#	}
#
#	option = {
#		ai_chance = {
#			factor = 20
#		}
#		name = soviet.26.a
#		set_country_flag = purge_1_group_a
#		custom_effect_tooltip = remove_theorist
#		show_ideas_tooltip = mikhail_tukhachevsky
#		custom_effect_tooltip = remove_chief_of_army
#		show_ideas_tooltip = SOV_aleksandr_yegorov
#		show_ideas_tooltip = SOV_vasily_blyukher
#		custom_effect_tooltip = remove_chief_of_navy
#		show_ideas_tooltip = pyotr_smirnov
#		show_ideas_tooltip = mikhail_frinovsky
#		remove_unit_leader = 401 #mikhail_tukhachevsky, field marshal
#		custom_effect_tooltip = soviet.27_tt
#		hidden_effect = {
#			remove_ideas = mikhail_tukhachevsky
#			remove_ideas = SOV_aleksandr_yegorov
#			remove_ideas = SOV_vasily_blyukher
#			remove_ideas = pyotr_smirnov
#			remove_ideas = mikhail_frinovsky
#		}
#	}
#	option = {
#		ai_chance = {
#			factor = 75
#		}
#		name = soviet.26.b
#		set_country_flag = purge_1_group_b
#		custom_effect_tooltip = remove_chief_of_army
#		show_ideas_tooltip = semyon_timoshenko
#		show_ideas_tooltip = kliment_voroshilov
#		custom_effect_tooltip = remove_chief_of_navy
#		show_ideas_tooltip = ivan_yumashev
#		custom_effect_tooltip = remove_military_high_command
#		show_ideas_tooltip = konstantin_rokossovsky
#		show_ideas_tooltip = vladimir_kasatonov
#		remove_unit_leader = 405 #kliment_voroshilov, field marshal
#		remove_unit_leader = 402 #konstantin_rokossovsky, general
#		remove_unit_leader = 404 #semyon_timoshenko, general
#		remove_unit_leader = 403 #vladimir_kasatonov, naval commander
#		custom_effect_tooltip = soviet.27_tt
#		hidden_effect = {
#			remove_ideas = semyon_timoshenko
#			remove_ideas = kliment_voroshilov
#			remove_ideas = ivan_yumashev
#			remove_ideas = konstantin_rokossovsky
#			remove_ideas = vladimir_kasatonov
#		}	
#	}
#	# REVISIT Balance, since the latter removes more unit leaders
#	option = {
#		ai_chance = {
#			factor = 5
#			modifier = {
#				factor = 0
#				is_historical_focus_on = yes
#			}
#		}
#		name = soviet.26.c
#		set_country_flag = purge_1_no_purge 
#		custom_effect_tooltip = soviet.27_tt2
#	}
#}

# Great Purge - Trial of the 21
#country_event = {
#	id = soviet.27
#	title = soviet.27.t
#	desc = soviet.27.d
#	picture = GFX_report_event_soviet_purge_officers_02
#
#	fire_only_once = yes
#	
#	trigger = {
#		tag = SOV
#		NOT = { has_completed_focus = SOV_great_purge }
#		focus_progress = {
#			focus = SOV_great_purge
#			progress > 0.75
#		}
#	}
#
#	mean_time_to_happen = {
#		days = 1
#	}
#
#	option = {
#		ai_chance = {
#			factor = 50
#		}
#		name = soviet.27.a
#		set_country_flag = purge_2_group_a
#		custom_effect_tooltip = remove_political_advisor
#		show_ideas_tooltip = SOV_nikolay_yezhov
#		custom_effect_tooltip = remove_chief_of_airforce
#		show_ideas_tooltip = yakov_smushkevich
#		show_ideas_tooltip = pavel_rychagov
#		show_ideas_tooltip = alexander_novikov
#		custom_effect_tooltip = remove_military_high_command
#		show_ideas_tooltip = gordey_levchenko
#		remove_unit_leader = 406 #gordey_levchenko, naval commander
#		custom_effect_tooltip = soviet.27_tt
#		hidden_effect = {
#			remove_ideas = SOV_nikolay_yezhov
#			remove_ideas = yakov_smushkevich
#			remove_ideas = pavel_rychagov
#			remove_ideas = alexander_novikov
#			remove_ideas = gordey_levchenko
#		}
#	}
#	option = {
#		ai_chance = {
#			factor = 45
#		}
#		name = soviet.27.b
#		set_country_flag = purge_2_group_b
#		custom_effect_tooltip = remove_chief_of_navy
#		show_ideas_tooltip = nikolay_kuznetsov
#		custom_effect_tooltip = remove_chief_of_airforce
#		show_ideas_tooltip = konstantin_vershinin
#		custom_effect_tooltip = remove_military_high_command
#		show_ideas_tooltip = sergei_khudyakov
#		show_ideas_tooltip = aleksandr_vasilevsky
#		remove_unit_leader = 407 #aleksandr_vasilevsky, general
#		custom_effect_tooltip = soviet.27_tt
#		hidden_effect = {
#			remove_ideas = nikolay_kuznetsov
#			remove_ideas = konstantin_vershinin
#			remove_ideas = sergei_khudyakov
#			remove_ideas = aleksandr_vasilevsky
#		}
#	}
#	option = {
#		ai_chance = {
#			factor = 5
#			modifier = {
#				factor = 0
#				is_historical_focus_on = yes
#			}
#		}
#		name = soviet.27.c
#		set_country_flag = purge_2_no_purge
#		custom_effect_tooltip = soviet.27_tt2
#	}
#}


# Trotsykist Coup
#country_event = { #---------------------------------> No longer happening (NSB)
#	id = soviet.28
#	title = soviet.28.t
#	desc = soviet.28.d
#	picture = GFX_report_event_soviet_purge_politicians
#
#	fire_only_once = yes
#	
#	trigger = {
#		has_country_flag = SOV_soviet.48_trotsky
#		tag = SOV
#		NOT = {
#			MEX = {
#				has_country_leader = { character = SOV_lev_trotsky ruling_only = yes }
#			}
#		}
#	}
#
#	mean_time_to_happen = {
#		days = 90
#		#modifier = {
#		#	factor = 1.25
#		#	OR = {
#		#		has_country_flag = purged_kalinin
#		#		has_country_flag = purged_khrushchev
#		#		has_country_flag = purged_party_members
#		#	}
#		#}	
#	}
#
#	option = {
#		name = soviet.28.a
#		set_country_flag = counter_purge
#		if = {
#			limit = { has_idea = trotskyite_plot_purged }
#			remove_ideas = trotskyite_plot_purged
#		}
#		if = {
#			limit = { has_idea = trotskyite_plot }
#			remove_ideas = trotskyite_plot
#		}
#		kill_country_leader = yes
#		add_country_leader_role = {
#			character = MEX_leon_trotsky
#			country_leader = {
#				expire = "1965.1.1"
#				ideology = leninism
#				traits = {
#					permanent_revolutionary
#				}
#			}
#			promote_leader = yes
#		}
#		remove_ideas = mikhail_kalinin
#		remove_ideas = ivan_konev
#		remove_unit_leader = 408
#		remove_ideas = pavel_zhigarev
#		remove_ideas = stepan_krasovsky
#		remove_ideas = arseniy_golovko
#		remove_unit_leader = 409
#		remove_ideas = georgy_zhukov
#		remove_unit_leader = 410
#		remove_ideas = sergey_gorshkov
#		remove_unit_leader = 411
#		remove_ideas = sergei_rudenko
#		remove_ideas = nikita_khrushchev
#		remove_ideas = konstantin_rodzaevsky
#		add_timed_idea = {
#			idea = officers_purged_7
#			days = 584
#		}
#		hidden_effect = {
#			country_event = { id = soviet.43 days = 146 }				
#		}
#		start_civil_war = {
#			ideology = neutrality
#			size = 0.18
#			keep_unit_leaders = { 401 402 407 410 406 405 403 407 404 }
#		}
#		hidden_effect = {
#			random_other_country = {
#				limit = {
#					original_tag = SOV
#					has_government = neutrality
#				}
#				kill_country_leader = yes
#				create_country_leader = {
#					name = "Ivan Konev"
#					desc = "POLITICS_IVAN_KONEV_DESC"
#					picture = "Portrait_Soviet_Ivan_Konev.dds"
#					expire = "1965.1.1"
#					ideology = oligarchism
#					traits = {
#					}
#				}
#			}
#			news_event = { hours = 6 id = news.221 }
#		}
#	}
#}

# France national focus -  requests to join commitern
country_event = {
	id = soviet.29
	title = soviet.29.t
	desc = soviet.29.d
	picture = GFX_report_event_stalin_01

	is_triggered_only = yes
		
	option = {
		name = soviet.29.a
		SOV = { add_to_faction = FRA }
		FRA = {
			add_ai_strategy = {
				type = alliance
				id = "SOV"
				value = 200
			}
		}
		hidden_effect = {
			news_event = { hours = 6 id = news.180 }
		}
	}
	option = {
		name = soviet.29.b
		ai_chance = { factor = 0 }
		FRA = {
			add_opinion_modifier = {
				target = SOV
				modifier = SOV_FRA_join_comintern_reject
			}
		}
	}
}

# comintern_influence removed due to war with common enemy
country_event = {
	id = soviet.100
	title = soviet.100.t
	desc = soviet.100.d
	picture = GFX_report_event_soviet_soldiers_tank
	
	trigger = {
		has_idea = comintern_influence
		has_war = yes
		SOV = { has_war = yes }
		NOT = { has_war_with = SOV }
		any_enemy_country = {
			has_war_with = SOV
		}
	}
	
	mean_time_to_happen = {
		days = 30
	}
	
	option = {
		name = soviet.100.a
		remove_ideas = comintern_influence
	}
}

# Demand Bessarabia
country_event = {
	id = soviet.30
	title = soviet.30.t
	desc = soviet.30.d
	picture = GFX_report_event_stalin_propaganda

	is_triggered_only = yes
	
	trigger = {
		tag = SOV
		FROM = { tag = ROM }
		NOT = { has_country_flag = bessarabia_demand }
		78 = {
			is_claimed_by = SOV
			is_owned_by = ROM
		}
	}
	
	immediate = { set_country_flag = bessarabia_demand } 
		
	option = {
		name = soviet.30.a
		ROM = { country_event = { days = 2 id = romania.1 } }
	}
	option = {
		name = soviet.30.b
		ai_chance = { factor = 0 }
		#
	}
}

# Demand Karjala - UNUSED
country_event = {
	id = soviet.31
	title = soviet.31.t
	desc = soviet.31.d
	picture = GFX_report_event_stalin_propaganda

	is_triggered_only = yes
	
	trigger = {
		tag = SOV
		FROM = { tag = FIN }
		NOT = { has_country_flag = karjala_demand }
		146 = {
			is_claimed_by = SOV
			is_owned_by = FIN
		}
	}
	
	immediate = { set_country_flag = karjala_demand } 
		
	option = {
		name = soviet.31.a
		FIN = { country_event = { days = 2 id = finland.1 } }
	}
	option = {
		name = soviet.31.b
		ai_chance = { factor = 0 }
		#
	}
}

# Oppress Estonia
country_event = {
	id = soviet.32
	title = soviet.32.t
	desc = soviet.32.d
	picture = GFX_report_event_soviet_in_riga

	is_triggered_only = yes
	
	trigger = {
		tag = SOV
		FROM = {
			tag = EST
			any_owned_state = { is_claimed_by = SOV }
		}
		NOT = { has_country_flag = estonia_demand }
	}
	
	immediate = { set_country_flag = estonia_demand } 
		
	option = {
		name = soviet.32.a
		EST = { country_event = { days = 2 id = baltic.1 } }
	}
	option = {
		name = soviet.32.b
		ai_chance = { factor = 0 }
		#
	}
}

# Oppress Latvia
country_event = {
	id = soviet.33
	title = soviet.33.t
	desc = soviet.33.d
	picture = GFX_report_event_soviet_in_riga

	is_triggered_only = yes
	
	trigger = {
		tag = SOV
		FROM = {
			tag = LAT
			any_owned_state = { is_claimed_by = SOV }
		}
		NOT = { has_country_flag = latvia_demand }
	}
	
	immediate = { set_country_flag = latvia_demand } 
		
	option = {
		name = soviet.33.a
		LAT = { country_event = { days = 2 id = baltic.2 } }
	}
	option = {
		name = soviet.33.b
		ai_chance = { factor = 0 }
		#
	}
}

# Oppress Lithuania 
country_event = {
	id = soviet.34
	title = soviet.34.t
	desc = soviet.34.d
	picture = GFX_report_event_soviet_in_riga

	is_triggered_only = yes
	
	trigger = {
		tag = SOV
		FROM = {
			tag = LIT
			any_owned_state = { is_claimed_by = SOV }
		}
		NOT = { has_country_flag = lithuania_demand }
	}
	
	immediate = { set_country_flag = lithuania_demand } 
		
	option = {
		name = soviet.34.a
		LIT = { country_event = { days = 2 id = baltic.3 } }
	}
	option = {
		name = soviet.34.b
		ai_chance = { factor = 0 }
		#
	}
}

# Communist government in FROM baltic country and they wish to be annexed
country_event = {
	id = soviet.35
	title = soviet.35.t
	desc = soviet.35.d
	picture = GFX_report_event_soviet_in_riga

	is_triggered_only = yes

	option = {
		name = soviet.35.a
		ai_chance = { factor = 100 }

		effect_tooltip = {
			if = {
				limit = { FROM = { tag = LIT } }
			 	SOV = {
			 		annex_country = {
					target = LIT
					transfer_troops = yes } 
					add_named_threat = { threat = 2 name = soviet.35_threat_LIT }
				}
			}
			if = {
				limit = { FROM = { tag = FIN } } 
			 	SOV = { 
			 		annex_country = {
					target = FIN
					transfer_troops = yes } 
					add_named_threat = { threat = 5 name = soviet.35_threat_FIN }
				}
			}
			if = {
				limit = { FROM = { tag = EST } } 
			 	SOV = { 
			 		annex_country = {
					target = EST
					transfer_troops = yes } 
					add_named_threat = { threat = 2 name = soviet.35_threat_EST }
				}
			}
			if = {
				limit = { FROM = { tag = LAT } } 
			 	SOV = {
			 		annex_country = {
					target = LAT
					transfer_troops = yes } 
					add_named_threat = { threat = 2 name = soviet.35_threat_LAT }
				}
			}
		} 

		hidden_effect = {

			 FROM = {
			 	country_event = { id = baltic.6 hours = 6}
			 }			
		}
	}
	option = {
		name = soviet.35.b
		ai_chance = { factor = 0 }
	}
}

# Communist government in FROM baltic country and they wish to be part puppet
country_event = {
	id = soviet.36
	title = soviet.36.t
	desc = soviet.36.d
	picture = GFX_report_event_soviet_in_riga

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			FROM = {
				save_event_target_as = baltic
			}
		}
	}

	option = {
		name = soviet.36.a
		if = {
			limit = {
				FROM = { is_puppet = no }
			}
			SOV = { puppet = FROM }
		}
		ai_chance = { factor = 100 }
			if = {
				limit = { FROM = { tag = LIT } }
				add_named_threat = { threat = 1 name = soviet.36_threat_LIT }
			}	
			if = {
				limit = { FROM = { tag = FIN } }
				add_named_threat = { threat = 2 name = soviet.36_threat_FIN }
			}			
			if = {
				limit = { FROM = { tag = EST } }
				add_named_threat = { threat = 1 name = soviet.36_threat_EST }
			}			
			if = {
				limit = { FROM = { tag = LAT } }
				add_named_threat = { threat = 1 name = soviet.36_threat_LAT }
			}		

		#trigger news event
		hidden_effect = {
			news_event =  { id = news.70 days = 1}
		}		
	}
	option = {
		name = soviet.36.b
		ai_chance = { factor = 0 }
	}
}

## Purge - Fighting defensive war against major
#country_event = { #------------------------------------> No longer happening (NSB)
#	id = soviet.46
#	title = soviet.46.t
#	desc = soviet.46.d
#	picture = GFX_report_event_soldiers_marching
#
#	is_triggered_only = yes
#
#	trigger = {
#
#	}
#
#	immediate = {
#		hidden_effect = {
#			if = {
#				limit = {
#					OR = {
#						has_idea = officers_purged
#						has_idea = officers_purged_2
#					}
#				}
#				add_ideas = SOV_great_patriotic_war
#			}
#			if = {
#				limit = {
#					OR = {
#						has_idea = officers_purged_3	
#						has_idea = officers_purged_4	
#					}
#				}
#				add_ideas = SOV_great_patriotic_war_2
#			}
#			if = {
#				limit = {
#					OR = {
#						has_idea = officers_purged_5	
#						has_idea = officers_purged_6	
#					}
#				}
#				add_ideas = SOV_great_patriotic_war_3
#			}
#			if = {
#				limit = {
#					OR = {
#						has_idea = officers_purged_7	
#						has_idea = officers_purged_8	
#					}
#				}
#				add_ideas = SOV_great_patriotic_war_4
#			}
#			if = {
#				limit = {
#					OR = {
#						has_idea = officers_purged_9	
#						has_idea = officers_purged_10	
#					}
#				}
#				add_ideas = SOV_great_patriotic_war_5
#			}
#		}
#	}
#
#	option = {
#		name = soviet.46.a
#		custom_effect_tooltip = soviet.46.a_tt
#	}
#}


################################
### OLD PURGE-RELATED EVENTS ###
################################

## Purge - New officers less dumb. Regaining org
#country_event = {
#	id = soviet.37
#	title = soviet.37.t
#	desc = soviet.37.d
#	picture = GFX_report_event_soldiers_marching
#
#	is_triggered_only = yes
#
#	trigger = {	has_idea = officers_purged }
#
#	immediate = {
#		hidden_effect = {
#			remove_ideas = officers_purged
#			add_timed_idea = {
#				idea = officers_purged_2
#				days = 1314
#			}
#			country_event = { id = soviet.38 days = 146 }
#		}
#	}
#	option = {
#		name = soviet.37.a
#		custom_effect_tooltip = soviet.37.a_tt
#	}
#}
## Purge - New officers less dumb. Regaining org
#country_event = {
#	id = soviet.38
#	title = soviet.37.t
#	desc = soviet.37.d
#	picture = GFX_report_event_soldiers_marching
#
#	is_triggered_only = yes
#
#	trigger = {	has_idea = officers_purged_2 }
#
#	immediate = {
#		hidden_effect = {
#			remove_ideas = officers_purged_2
#			add_timed_idea = {
#				idea = officers_purged_3
#				days = 1168
#			}
#			if = {
#				limit = { has_idea = SOV_great_patriotic_war }
#				remove_ideas = SOV_great_patriotic_war
#				add_ideas = SOV_great_patriotic_war_2
#			}
#			country_event = { id = soviet.39 days = 146 }
#		}
#	}
#	option = {
#		name = soviet.37.a
#		custom_effect_tooltip = soviet.37.a_tt
#	}
#}
## Purge - New officers less dumb. Regaining org
#country_event = {
#	id = soviet.39
#	title = soviet.37.t
#	desc = soviet.37.d
#	picture = GFX_report_event_soldiers_marching
#
#	is_triggered_only = yes
#
#	trigger = {	has_idea = officers_purged_3 }
#
#	immediate = {
#		hidden_effect = {
#			remove_ideas = officers_purged_3
#			add_timed_idea = {
#				idea = officers_purged_4
#				days = 1022
#			}
#			country_event = { id = soviet.40 days = 146 }
#		}
#	}
#	option = {
#		name = soviet.37.a
#		custom_effect_tooltip = soviet.37.a_tt
#	}
#}
## Purge - New officers less dumb. Regaining org
#country_event = {
#	id = soviet.40
#	title = soviet.37.t
#	desc = soviet.37.d
#	picture = GFX_report_event_soldiers_marching
#
#	is_triggered_only = yes
#
#	trigger = {	has_idea = officers_purged_4 }
#
#	immediate = {
#		hidden_effect = {
#			remove_ideas = officers_purged_4
#			add_timed_idea = {
#				idea = officers_purged_5
#				days = 876
#			}
#			if = {
#				limit = { has_idea = SOV_great_patriotic_war_2 }
#				remove_ideas = SOV_great_patriotic_war_2
#				add_ideas = SOV_great_patriotic_war_3
#			}			
#			country_event = { id = soviet.41 days = 146 }
#		}
#	}
#	option = {
#		name = soviet.37.a
#		custom_effect_tooltip = soviet.37.a_tt
#	}
#}
## Purge - New officers less dumb. Regaining org
#country_event = {
#	id = soviet.41
#	title = soviet.37.t
#	desc = soviet.37.d
#	picture = GFX_report_event_soldiers_marching
#
#	is_triggered_only = yes
#
#	trigger = {	has_idea = officers_purged_5 }
#
#	immediate = {
#	hidden_effect = {
#			remove_ideas = officers_purged_5
#			add_timed_idea = {
#				idea = officers_purged_6
#				days = 730
#			}		
#			country_event = { id = soviet.42 days = 146 }
#		}
#	}
#	option = {
#		name = soviet.37.a
#		custom_effect_tooltip = soviet.37.a_tt
#	}
#}
## Purge - New officers less dumb. Regaining org
#country_event = {
#	id = soviet.42
#	title = soviet.37.t
#	desc = soviet.37.d
#	picture = GFX_report_event_soldiers_marching
#
#	is_triggered_only = yes
#
#	trigger = {	has_idea = officers_purged_6 }
#
#	immediate = {
#		hidden_effect = {
#			remove_ideas = officers_purged_6
#			add_timed_idea = {
#				idea = officers_purged_7
#				days = 584
#			}
#			if = {
#				limit = { has_idea = SOV_great_patriotic_war_3 }
#				remove_ideas = SOV_great_patriotic_war_3
#				add_ideas = SOV_great_patriotic_war_4
#			}			
#			country_event = { id = soviet.43 days = 146 }
#		}
#	}
#	option = {
#		name = soviet.37.a
#		custom_effect_tooltip = soviet.37.a_tt
#	}
#}
## Purge - New officers less dumb. Regaining org
#country_event = {
#	id = soviet.43
#	title = soviet.37.t
#	desc = soviet.37.d
#	picture = GFX_report_event_soldiers_marching
#
#	is_triggered_only = yes
#
#	trigger = {	has_idea = officers_purged_7 }
#
#	immediate = {
#		hidden_effect = {
#			remove_ideas = officers_purged_7
#			add_timed_idea = {
#				idea = officers_purged_8
#				days = 438
#			}
#			country_event = { id = soviet.44 days = 146 }
#		}
#	}
#	option = {
#		name = soviet.37.a
#		custom_effect_tooltip = soviet.37.a_tt
#	}
#}
## Purge - New officers less dumb. Regaining org
#country_event = {
#	id = soviet.44
#	title = soviet.37.t
#	desc = soviet.37.d
#	picture = GFX_report_event_soldiers_marching
#
#	is_triggered_only = yes
#
#	trigger = {	has_idea = officers_purged_8 }
#
#	immediate = {
#		hidden_effect = {
#			remove_ideas = officers_purged_8
#			add_timed_idea = {
#				idea = officers_purged_9
#				days = 292
#			}
#			if = {
#				limit = { has_idea = SOV_great_patriotic_war_4 }
#				remove_ideas = SOV_great_patriotic_war_4
#				add_ideas = SOV_great_patriotic_war_5
#			}					
#			country_event = { id = soviet.45 days = 146 }
#		}
#	}
#	option = {
#		name = soviet.37.a
#		custom_effect_tooltip = soviet.37.a_tt
#	}
#}
## Purge - New officers less dumb. Regaining org
#country_event = {
#	id = soviet.45
#	title = soviet.37.t
#	desc = soviet.37.d
#	picture = GFX_report_event_soldiers_marching
#
#	is_triggered_only = yes
#
#	trigger = {	has_idea = officers_purged_9 }
#
#	immediate = {
#		hidden_effect = {
#			remove_ideas = officers_purged_9
#			add_timed_idea = {
#				idea = officers_purged_10
#				days = 146
#			}
#		}
#		country_event = { id = soviet.47 days = 146 }
#	}
#	option = {
#		name = soviet.37.a
#		custom_effect_tooltip = soviet.37.a_tt
#	}
#}

## Purge - Special event to remove patriotic war if it has been added
#country_event = {
#	id = soviet.47
#
#	hidden = yes
#
#	is_triggered_only = yes
#
#	immediate = {
#		if = {
#			limit = { has_idea = SOV_great_patriotic_war_5 }
#			remove_ideas = SOV_great_patriotic_war_5
#		}	
#	}
#}

##No purges completed - decide what to do
#country_event = {
#	id = soviet.48
#	title = soviet.48.t
#	desc = soviet.48.d
#	picture = GFX_report_event_soviet_purge_politicians
#
#	trigger = {
#		has_government = communism
#		tag = SOV
#		has_global_flag = SOV_fourth_international_fired
#		NOT = { has_completed_focus = SOV_great_purge }
#	}
#
#	mean_time_to_happen = {
#		days = 90
#	}
#
#	fire_only_once = yes
#
#	#Don't invite trotsky
#	option = {
#		name = soviet.48.a
#		custom_effect_tooltip = soviet.48.a_tt
#		set_country_flag = SOV_soviet.48_notrotsky
#	}
#
#	#Invite back Trotsky
#	option = {
#		name = soviet.48.b
#		custom_effect_tooltip = soviet.48.b_tt
#		set_country_flag = SOV_soviet.48_trotsky
#	}
#
#}
#
##No purges massive civil war
#country_event = {
#	id = soviet.49
#	title = soviet.49.t
#	desc = soviet.49.d
#	picture = GFX_report_event_soviet_tanks
#
#	trigger = {
#		tag = SOV
#		has_country_flag = SOV_soviet.48_notrotsky
#	}
#	
#	fire_only_once = yes
#
#	mean_time_to_happen = { days = 10 }
#
#	option = {
#		name = soviet.49.a
#		start_civil_war = {
#			ideology = neutrality
#			size = 0.5
#			keep_unit_leaders = { 401 402 407 410 406 405 403 407 408 410 411 404 }
#		}
#		hidden_effect = {
#			remove_unit_leader = 412 #Remove Andrey Vlasov
#			random_other_country = {
#				limit = {
#					original_tag = SOV
#					has_government = neutrality
#				}
#				kill_country_leader = yes
#				create_country_leader = {
#					name = "Andrey Vlasov"
#					desc = "POLITICS_ANDREY_VLASOV_DESC"
#					picture = "Portrait_Soviet_Andrey_Vlasov.dds"
#					expire = "1965.1.1"
#					ideology = moderatism
#					traits = {
#					}
#				}
#			}
#			news_event = { hours = 3 id = news.220 }
#		}
#	}
#}

##1/4 purges
#country_event = {
#	id = soviet.50
#	title = soviet.50.t
#	desc = soviet.50.d
#	picture = GFX_report_event_soviet_purge_officers_02
#
#	fire_only_once = yes
#
#	trigger = {
#		tag = SOV
#		has_country_flag = SOV_purged_1
#	}
#
#	mean_time_to_happen = { days = 90 }
#
#	option = {
#		name = soviet.50.a
#		remove_unit_leader = 412 #Remove Andrey Vlasov
#		start_civil_war = {
#			ideology = neutrality
#			size = 0.3
#			keep_unit_leaders = { 401 402 407 410 406 405 403 407 408 410 411 404 }
#		}
#		hidden_effect = {
#			random_other_country = {
#				limit = {
#					original_tag = SOV
#					has_government = neutrality
#				}
#				kill_country_leader = yes
#				create_country_leader = {
#					name = "Andrey Vlasov"
#					desc = "POLITICS_ANDREY_VLASOV_DESC"
#					picture = "Portrait_Soviet_Andrey_Vlasov.dds"
#					expire = "1965.1.1"
#					ideology = moderatism
#					traits = {
#					}
#				}
#			}
#			news_event = { hours = 3 id = news.220 }
#		}
#	}
#}
#
##2/4 purges
#country_event = {
#	id = soviet.51
#	title = soviet.51.t
#	desc = soviet.51.d
#	picture = GFX_report_event_soviet_purge_officers_02
#
#	fire_only_once = yes
#	
#	trigger = {
#		tag = SOV
#		has_country_flag = SOV_purged_2
#	}
#
#	mean_time_to_happen = { days = 90 }
#
#	option = {
#		name = soviet.51.a
#		remove_unit_leader = 412 #Remove Andrey Vlasov
#		start_civil_war = {
#			ideology = neutrality
#			size = 0.25
#			keep_unit_leaders = { 401 402 407 410 406 405 403 407 408 410 411 404 }
#		}
#		hidden_effect = {
#			random_other_country = {
#				limit = {
#					original_tag = SOV
#					has_government = neutrality
#				}
#				kill_country_leader = yes
#				create_country_leader = {
#					name = "Andrey Vlasov"
#					desc = "POLITICS_ANDREY_VLASOV_DESC"
#					picture = "Portrait_Soviet_Andrey_Vlasov.dds"
#					expire = "1965.1.1"
#					ideology = moderatism
#					traits = {
#					}
#				}
#			}
#			news_event = { hours = 3 id = news.220 }
#		}
#	}
#}
#
##3/4 purges
#country_event = {
#	id = soviet.52
#	title = soviet.52.t
#	desc = soviet.52.d
#	picture = GFX_report_event_stalin_propaganda
#
#	fire_only_once = yes
#
#	trigger = {
#		tag = SOV
#		has_country_flag = SOV_purged_3
#	}
#
#	mean_time_to_happen = { days = 90 }
#
#	option = {
#		name = soviet.52.a
#		remove_unit_leader = 412 #Remove Andrey Vlasov
#		start_civil_war = {
#			ideology = neutrality
#			size = 0.2
#			keep_unit_leaders = { 401 402 407 410 406 405 403 407 408 410 411 404 }
#		}
#		hidden_effect = {
#			random_other_country = {
#				limit = {
#					original_tag = SOV
#					has_government = neutrality
#				}
#				kill_country_leader = yes
#				create_country_leader = {
#					name = "Andrey Vlasov"
#					desc = "POLITICS_ANDREY_VLASOV_DESC"
#					picture = "Portrait_Soviet_Andrey_Vlasov.dds"
#					expire = "1965.1.1"
#					ideology = moderatism
#					traits = {
#					}
#				}
#			}
#			news_event = { hours = 3 id = news.220 }
#		}
#	}
#
#}
#
##4/4 purges
#country_event = {
#	id = soviet.53
#	title = soviet.53.t
#	desc = soviet.53.d
#	picture = GFX_report_event_stalin_01
#
#	fire_only_once = yes
#
#	trigger = {
#		tag = SOV
#		has_country_flag = SOV_purged_4
#	}
#
#	mean_time_to_happen = { days = 2 }
#
#	option = {
#		name = soviet.53.a
#		remove_ideas = trotskyite_plot_purged
#	}
#
#}


##New Leadership in Russia
#country_event = { #-------------------> No longer used
#	id = soviet.54
#	title = soviet.54.t
#	desc = {
#		text = soviet.54.d_nopurge
#		trigger = {
#			NOT = {
#				has_completed_focus = SOV_the_anti_soviet_trotskyist_center
#			}
#		}
#	}
#	desc = {
#		text = soviet.54.d_purge
#		trigger = {
#			has_completed_focus = SOV_the_anti_soviet_trotskyist_center
#		}
#	}
#	picture = GFX_report_event_soviet_purge_speech
#
#	fire_only_once = yes
#
#	trigger = {
#		tag = SOV
#		NOT = {
#			has_government = communism
#		}
#		NOT = { SOV_is_exiles = yes } # No need to fire event if following the exiles focus branch
#		has_civil_war = no
#	}
#
#	mean_time_to_happen = {
#		days = 1
#	}
#
#	option = {
#		name = soviet.54.a
#		if = {
#			limit = {
#				has_idea = trotskyite_plot
#			}
#			remove_ideas = trotskyite_plot
#		}
#		if = {
#			limit = {
#				has_idea = trotskyite_plot_purged
#			}
#			remove_ideas = trotskyite_plot_purged
#		}
#		remove_ideas = home_of_revolution
#	}
#}


# Poland conquered... honor MR Pact?
country_event = {
	id = soviet.60
	title = soviet.60.t
	desc = soviet.60.d
	picture = GFX_report_event_soviet_tanks
	
	fire_only_once = yes

	trigger = {
		tag = SOV
		has_global_flag = sov_yes_pact
		GER = {
			exists = yes
			is_subject = no
		}
		NOT =  { has_war_with = GER }
		NOT = { has_global_flag = germany_lost_the_war }
		OR = {
			OR = {
				owns_state = 88 #KRAKOW
				owns_state = 92 #LUBLIN
				owns_state = 90 #KIELCE
				owns_state = 86 #POZNAN
				owns_state = 87 #LODZ
				owns_state = 85 #DANZIG
				owns_state = 98 #PLOCK
				owns_state = 10 #WARSAW
				owns_state = 762 #KATOWICE
				owns_state = 807 #GDYNIA
			}
			AND = {
				POL = { has_capitulated = yes }
				OR = {
					controls_state = 88 #KRAKOW
					controls_state = 92 #LUBLIN
					controls_state = 90 #KIELCE
					controls_state = 86 #POZNAN
					controls_state = 87 #LODZ
					controls_state = 85 #DANZIG
					controls_state = 98 #PLOCK
					controls_state = 10 #WARSAW
					controls_state = 762 #KATOWICE
					controls_state = 807 #GDYNIA
				}
			}
			OR = {
				any_other_country = {
					is_in_faction_with = SOV
					SOV = {
						is_faction_leader = yes
					}
					OR = {
						owns_state = 88 #KRAKOW
						owns_state = 92 #LUBLIN
						owns_state = 90 #KIELCE
						owns_state = 86 #POZNAN
						owns_state = 87 #LODZ
						owns_state = 85 #DANZIG
						owns_state = 98 #PLOCK
						owns_state = 10 #WARSAW
						owns_state = 762 #KATOWICE
						owns_state = 807 #GDYNIA
						AND = {
							POL = { has_capitulated = yes }
							OR = {
								controls_state = 88 #KRAKOW
								controls_state = 92 #LUBLIN
								controls_state = 90 #KIELCE
								controls_state = 86 #POZNAN
								controls_state = 87 #LODZ
								controls_state = 85 #DANZIG
								controls_state = 98 #PLOCK
								controls_state = 10 #WARSAW
								controls_state = 762 #KATOWICE
								controls_state = 807 #GDYNIA
							}
						}		
					}
				}
			}
		}
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		ai_chance = {
			base = 1
			modifier = {
				factor = 0
				AND = {
					POL = {
						is_ai = no
						has_civil_war = no
					}
					is_in_faction_with = POL
				}
			}
		}
		name = soviet.60.a
		#KRAKOW
		if = {
			limit = {
				88 = {
					OR = {
						is_controlled_by = SOV
						any_other_country = {
							controls_state = 88
							is_in_faction_with = SOV
							SOV = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { transfer_state = 88 }
		}
		#LUBLIN
		if = {
			limit = {
				92 = {
					OR = {
						is_controlled_by = SOV
						any_other_country = {
							controls_state = 92
							is_in_faction_with = SOV
							SOV = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { transfer_state = 92 }
		}
		#KIELCE
		if = {
			limit = {
				90 = {
					OR = {
						is_controlled_by = SOV
						any_other_country = {
							controls_state = 90
							is_in_faction_with = SOV
							SOV = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { transfer_state = 90 }
		}
		#POZNAN
		if = {
			limit = {
				86 = {
					OR = {
						is_controlled_by = SOV
						any_other_country = {
							controls_state = 86
							is_in_faction_with = SOV
							SOV = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = {
				transfer_state = 86
				add_state_core = 86
			}
		}
		#LODZ
		if = {
			limit = {
				87 = {
					OR = {
						is_controlled_by = SOV
						any_other_country = {
							controls_state = 87
							is_in_faction_with = SOV
							SOV = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { transfer_state = 87 }
		}
		#DANZIG
		if = {
			limit = {
				85 = {
					OR = {
						is_controlled_by = SOV
						any_other_country = {
							controls_state = 85
							is_in_faction_with = SOV
							SOV = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = {
				transfer_state = 85
				add_state_core = 85
			}
		}
		#PLOCK
		if = {
			limit = {
				98 = {
					OR = {
						is_controlled_by = SOV
						any_other_country = {
							controls_state = 98
							is_in_faction_with = SOV
							SOV = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { transfer_state = 98 }
		}
		#WARSAW
		if = {
			limit = {
				10 = {
					OR = {
						is_controlled_by = SOV
						any_other_country = {
							controls_state = 10
							is_in_faction_with = SOV
							SOV = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { transfer_state = 10 }
		}
		#KATOWICE
		if = {
			limit = {
				762 = {
					OR = {
						is_controlled_by = SOV
						any_other_country = {
							controls_state = 762
							is_in_faction_with = SOV
							SOV = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = {
				transfer_state = 762
				add_state_core = 762
			}
		}
		#GDYNIA
		if = {
			limit = {
				807 = {
					OR = {
						is_controlled_by = SOV
						any_other_country = {
							controls_state = 807
							is_in_faction_with = SOV
							SOV = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { transfer_state = 807 }
		}
		#MEMEL
		if = {
			limit = {
				188 = {
					OR = {
						is_controlled_by = SOV
						any_other_country = {
							controls_state = 188
							is_in_faction_with = SOV
							SOV = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { transfer_state = 188 }
		}
		#WESTERN SLOVAKIA
		if = {
			limit = {
				70 = {
					OR = {
						is_controlled_by = SOV
						any_other_country = {
							controls_state = 70
							is_in_faction_with = SOV
							SOV = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { transfer_state = 70 }
		}
		#EASTERN SLOVAKIA
		if = {
			limit = {
				71 = {
					OR = {
						is_controlled_by = SOV
						any_other_country = {
							controls_state = 71
							is_in_faction_with = SOV
							SOV = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { transfer_state = 71 }
		}
		#SOUTHERN SLOVAKIA
		if = {
			limit = {
				664 = {
					OR = {
						is_controlled_by = SOV
						any_other_country = {
							controls_state = 664
							is_in_faction_with = SOV
							SOV = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { transfer_state = 664 }
		}
		#ZAOLZIE
		if = {
			limit = {
				72 = {
					OR = {
						is_controlled_by = SOV
						any_other_country = {
							controls_state = 72
							is_in_faction_with = SOV
							SOV = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { transfer_state = 72 }
		}

		GER = { country_event = soviet.61 }
	}
	option = {
		name = soviet.60.b
		ai_chance = {
			base = 1
			modifier = {
				add = -1
				is_historical_focus_on = yes
				NOT = {
					AND = {
						POL = {
							is_ai = no
							has_civil_war = no
						}
						is_in_faction_with = POL
					}
				}
			}
		}
		GER = { country_event = soviet.62 }
		clr_global_flag = sov_yes_pact
		diplomatic_relation = {
			country = GER
			relation = non_aggression_pact
			active = no
		}
		GER = {
			add_state_claim = 88
			add_state_claim = 92
			add_state_claim = 90
			add_state_claim = 86
			add_state_claim = 87
			add_state_claim = 85
			add_state_claim = 98
			add_state_claim = 10
			add_state_claim = 762
			add_state_claim = 807
			effect_tooltip = {
				create_wargoal = {
					type = annex_everything
					target = SOV
				}
			}
		}
	}
}

# Soviet honors MR Pact (Germany)
country_event = {
	id = soviet.61
	title = soviet.61.t
	desc = soviet.61.d
	picture = GFX_report_event_soviet_german_soldier_handshake

	is_triggered_only = yes
	
	option = {
		name = germany.12.a
		if = {
			limit = {
				GER = {
					controls_state = 85
					controls_state = 86
					controls_state = 87
				}
			}
			hidden_effect = {
				news_event = { hours = 6 id = news.287 }
			}
		}
	}
}

# Soviet betrays MR Pact (Germany)
country_event = {
	id = soviet.62
	title = soviet.62.t
	desc = soviet.62.d
	picture = GFX_report_event_soviet_tanks

	is_triggered_only = yes
	
	option = {
		name = soviet.62.a
		create_wargoal = {
			type = annex_everything
			target = SOV
		}
	}
}

# SOV becomes just Russia
country_event = {
	id = soviet.63
	
	trigger = {
		tag = SOV
		country_exists = UKR
		country_exists = BLR
		country_exists = GEO
		country_exists = AZR
		country_exists = ARM
		country_exists = UZB
		country_exists = TAJ
		country_exists = KYR
		country_exists = TMS
		country_exists = KAZ
		NOT = { has_global_flag = SOV_became_russia }
	}

	mean_time_to_happen = { days = 2 }

	hidden = yes

	immediate = {
		set_cosmetic_tag = SOV_russia
		set_global_flag = SOV_became_russia
	}
}

# SOV becomes SOV again
country_event = {
	id = soviet.64
	
	trigger = {
		tag = SOV
		NOT = { country_exists = UKR }
		NOT = { country_exists = BLR }
		NOT = { country_exists = GEO }
		NOT = { country_exists = AZR }
		NOT = { country_exists = ARM }
		NOT = { country_exists = UZB }
		NOT = { country_exists = TAJ }
		NOT = { country_exists = KYR }
		NOT = { country_exists = TMS }
		NOT = { country_exists = KAZ }
		NOT = {
			any_state = {
				is_core_of = SOV
				NOT = { state = 329 }
				NOT = { is_owned_by = SOV }
			}
		}
		has_global_flag = SOV_became_russia
	}

	mean_time_to_happen = { days = 2 }

	hidden = yes

	immediate = {
		drop_cosmetic_tag = yes
		clr_global_flag = SOV_became_russia
	}
}
#hidden event to play historic speech
country_event = {
	id = soviet.999
	hidden = yes
	mean_time_to_happen = { days = 2 }
	fire_only_once = yes
	trigger = {
		tag = SOV
		has_war_with = GER
		surrender_progress < 0.5 #let's not tempt fate, it's counter-revolutionary
		has_government = communism
		NOT = {
			has_global_flag = barbarossa_counter
		}
	}
	immediate = {
		play_no_invincible_armies_effect = yes
	}
	option = {}
}

# Polish event for Soviets demanding alignment after Yalta
country_event = {
	id = soviet.70
	title = soviet.70.t
	desc = soviet.70.desc
	picture = GFX_report_event_soviet_tanks

	trigger = {
		tag = POL
		is_subject = no
		NOT = { has_government = communism }
		has_global_flag = yalta_agreed_flag
		SOV = {
			exists = yes
			is_subject = no
		}
		OR = {
			NOT = { GER = { has_government = fascism } }
			GER = { exists = no }
		}
	}
	fire_only_once = yes
	
	option = {
		name = soviet.70.a
		ai_chance = {
			base = 7
		}

		add_timed_idea = {
			idea = communist_influence
			days = 730
		}	

		SOV = {
			country_event = {
				id = soviet.71
				days = 1
			}
		}

	}
	option = {
		name = soviet.70.b
		ai_chance = {
			base = 3
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
		}

		SOV = {
			country_event = {
				id = soviet.72
				days = 1
			}
		}
		effect_tooltip = {
			SOV = {
				create_wargoal = {
					type = puppet_wargoal_focus
					target = ROOT
				}
			}
		}

	}
}

# Soviet event for Poland joining sphere after Yalta 
country_event = {
	id = soviet.71
	title = soviet.71.t
	desc = soviet.71.desc
	picture = GFX_report_event_soviet_tanks

	is_triggered_only = yes
	fire_only_once = yes
	
	option = {
		name = soviet.71.a
		effect_tooltip = {
			FROM = {
				add_timed_idea = {
					idea = communist_influence
					days = 730
				}	
			}
		}
	}
}

# Soviet event for Poland refusing to join sphere after Yalta 
country_event = {
	id = soviet.72
	title = soviet.72.t
	desc = soviet.72.desc
	picture = GFX_report_event_soviet_tanks

	is_triggered_only = yes
	fire_only_once = yes
	
	option = {
		name = soviet.72.a
		ai_chance = {
			base = 5
			modifier = {
				factor = 0
				POL = {
					is_in_faction_with = USA
				}
			}
		}

		create_wargoal = {
			type = puppet_wargoal_focus
			target = FROM
		}

	}
	option = {
		name = soviet.72.b
		ai_chance = {
			base = 5
		}

		FROM = {
			country_event = {
				id = soviet.73
				days = 7
			}
		}

	}
}

country_event = {
	id = soviet.73
	title = soviet.73.t
	desc = soviet.73.desc
	picture = GFX_report_event_soviet_tanks

	is_triggered_only = yes
	fire_only_once = yes
	
	option = {
		name = soviet.73.a

		add_political_power = 50

	}
}


# Polish event for Returning occupied territory
country_event = {
	id = soviet.74
	title = soviet.74.t
	desc = soviet.74.d
	picture = GFX_report_event_SOV_demands
	is_triggered_only = yes 

	trigger = {
		
	}
	#fire_only_once = yes
	
	option = {
		name = soviet.74.a
		ai_chance = {
			base = 1
		}
		POL = {
			add_autonomy_score = { 
				value = -250 
				localization = POL_accepted_states
			}
			add_popularity = {
				ideology = FROM
				popularity = 0.05
			}
		}
		FROM = {
			every_owned_state = {
				limit = {
					is_core_of = POL 
					OR = {
						# Białystok
						state = 97 
						# Uncontested Polish Cores
						NOT = {
							any_country_with_core = {
								NOT = { tag = POL }
							}
						}
					}
					
				}
				transfer_state_to = POL
			}
		}
		FROM = {
			country_event = {
				id = soviet.75
				hours = 2 
				random_hours = 6 
			}
		}
	}
	option = {
		name = soviet.74.b
		ai_chance = {
			base = 0
		}
		POL = {
			add_autonomy_score = { 
				value = 250 
				localization = POL_refused_states
			}
		}
		FROM = {
			every_owned_state = {
				limit = {
					is_core_of = POL 
					OR = {
						# Białystok
						state = 97 
						# Uncontested Polish Cores
						NOT = {
							any_country_with_core = {
								NOT = { tag = POL }
							}
						}
					}
					
				}
				remove_core_of = POL  
				add_core_of = SOV
				add_claim_by = POL 
			}
		}
		FROM = {
			country_event = {
				id = soviet.76
				hours = 2 
				random_hours = 6 
			}
		}
	}
}

# Poland Accepted
country_event = {
	id = soviet.75
	title = soviet.75.t
	desc = soviet.75.d
	picture = GFX_report_event_SOV_demands
	is_triggered_only = yes 
	option = {
		name = soviet.75.a
		ai_chance = {
			base = 1
		}
		add_stability = 0.05
	}
}

# Poland refused
country_event = {
	id = soviet.76
	title = soviet.76.t
	desc = soviet.76.d
	picture = GFX_report_event_SOV_demands
	is_triggered_only = yes 
	option = {
		name = soviet.76.a
		ai_chance = {
			base = 1
		}
	}
}
