
add_namespace = russia2_baltic

# Check if File is Loaded
country_event = {
	id = russia2_baltic.2092066524

	hidden = yes

	is_triggered_only = yes

	immediate = {
		set_global_flag = russia_reworked_events_loaded_baltics
	}
}

# Soviet Ultimatum (Estonia)
country_event = {
	id = russia2_baltic.1
	title = russia2_baltic.1.t
	desc = russia2_baltic.1.d
	picture = GFX_report_event_soviet_soldiers
	
	is_triggered_only = yes
	
	option = { # Accept demands
		name = russia2_baltic.1.a
		ai_chance = {
			base = 10
			modifier = { # Don't accept if in a faction that can protect them
				factor = 0
				OR = {
					any_other_country = {
						is_major = yes
						OR = {
							is_in_faction_with = EST
							has_guaranteed = EST
						}
					}
					has_idea = anti_soviet_pact
					SOV = { surrender_progress > 0.5 }
				}
			}
		}
		SOV = {
			country_event = { days = 5 id = russia2_russia.6 }
		}
		if = {
			limit = {
				NOT = {
					tag = EST
				}
 			}
			custom_effect_tooltip = SOV_estonia_is_puppet_tt
		}
		else = {
			custom_effect_tooltip = SOV_game_totally_over_TT
		}
	}
	option = { # Refuse
		name = russia2_baltic.1.b
		ai_chance = {
			base = 0
			modifier = {
				add = 1
				OR = {
					is_historical_focus_on = no
					any_other_country = {
						is_major = yes
						is_in_faction_with = EST
					}
				}
			}
			modifier = {
				add = 5
				any_other_country = {
					is_major = yes
					has_guaranteed = EST
				}
			}
		}

		SOV = {
			country_event = { days = 5 id = russia2_russia.7 }
			effect_tooltip = {
				create_wargoal = {
					type = annex_everything
					target = EST
				}	
			}
		}
		if = {
			limit = {
				NOT = {
					tag = EST
				}
 			}
			custom_effect_tooltip = SOV_estonia_is_puppet_tt
		}
	}
}

# Soviet Ultimatum (Latvia)
country_event = {
	id = russia2_baltic.2
	title = russia2_baltic.1.t
	desc = russia2_baltic.1.d
	picture = GFX_report_event_soviet_soldiers
	
	is_triggered_only = yes
	
	option = { # Accept demands
		name = russia2_baltic.1.a
		ai_chance = {
			base = 10
			modifier = { # Don't accept if in a faction that can protect them
				factor = 0
				OR = {
					any_other_country = {
						is_major = yes
						OR = {
							is_in_faction_with = LAT
							has_guaranteed = LAT
						}
					}
					has_idea = anti_soviet_pact
					SOV = { surrender_progress > 0.5 }
				}
			}
		}
		SOV = {
			country_event = { days = 5 id = russia2_russia.8 }
		}
		if = {
			limit = {
				NOT = {
					tag = LAT
				}
 			}
			custom_effect_tooltip = SOV_latvia_is_puppet_tt
		}
		else = {
			custom_effect_tooltip = SOV_game_totally_over_TT
		}
	}
	option = { # Refuse
		name = russia2_baltic.1.b
		ai_chance = {
			base = 0
			modifier = {
				add = 1
				OR = {
					is_historical_focus_on = no
					any_other_country = {
						is_major = yes
						is_in_faction_with = LAT
					}
				}
			}
			modifier = {
				add = 5
				any_other_country = {
					is_major = yes
					has_guaranteed = LAT
				}
			}
		}
		SOV = {
			country_event = { days = 5 id = russia2_russia.9 }
			effect_tooltip = {
				create_wargoal = {
					type = annex_everything
					target = LAT
				}
			}
		}
		if = {
			limit = {
				NOT = {
					tag = LAT
				}
 			}
			custom_effect_tooltip = SOV_latvia_is_puppet_tt
		}
	}
}

# Soviet Ultimatum (Lithuania)
country_event = {
	id = russia2_baltic.3
	title = russia2_baltic.1.t
	desc = russia2_baltic.1.d
	picture = GFX_report_event_soviet_soldiers
	
	is_triggered_only = yes
	
	option = { # Accept demands
		name = russia2_baltic.1.a
		ai_chance = {
			base = 10
			modifier = { # Don't accept if in a faction that can protect them
				factor = 0
				OR = {
					any_other_country = {
						is_major = yes
						OR = {
							is_in_faction_with = LIT
							has_guaranteed = LIT
						}
					}
					has_idea = anti_soviet_pact
					SOV = { surrender_progress > 0.5 }
				}
			}
		}
		SOV = {
			country_event = { days = 5 id = russia2_russia.10 }	
		}
		if = {
			limit = {
				NOT = {
					tag = LIT
				}
 			}
			custom_effect_tooltip = SOV_lithuania_is_puppet_tt
		}
		else = {
			custom_effect_tooltip = SOV_game_totally_over_TT
		}
	}
	option = { # Refuse
		name = russia2_baltic.1.b
		ai_chance = {
			base = 0
			modifier = {
				add = 1
				OR = {
					is_historical_focus_on = no
					any_other_country = {
						is_major = yes
						is_in_faction_with = LIT
					}
				}
			}
			modifier = {
				add = 5
				any_other_country = {
					is_major = yes
					has_guaranteed = LIT
				}
			}
		}
		SOV = {
			country_event = { days = 5 id = russia2_russia.11 }
			effect_tooltip = {
				create_wargoal = {
				type = annex_everything
				target = LIT
				}		
			}
		}
		if = {
			limit = {
				NOT = {
					tag = LIT
				}
 			}
			custom_effect_tooltip = SOV_lithuania_is_puppet_tt
		}
	}
}

# Country becomes Communist. Gets event to become part of the Soviet Union
country_event = {
	id = russia2_baltic.5
	title = russia2_baltic.5.t
	desc = russia2_baltic.5.d
	picture = GFX_report_event_worker_protests

	trigger = {
		SOV = { has_government = communism }
		NOT = { has_country_flag = russia2_baltic.5_fired }
		NOT = { is_subject_of = SOV }
		OR = {
			tag = LIT
			tag = EST
			tag = LAT
		} 
		has_government = communism
	}

	immediate = {
		FROM = { set_country_flag = russia2_baltic.5_fired }
		save_event_target_as = baltic_annexation
	}
	
	option = { # Annexed by SOV
		name = russia2_baltic.5.a
		ai_chance = {
			base = 75
			modifier =  {
				factor = 2
				OR = {
					tag = LIT
					tag = EST
					tag = FIN
				}
			}
			modifier = {
				factor = 0.5
				is_subject = yes
			}
		}
		SOV = { country_event = { id = russia2_russia.4 days = 1 } }
	}
	option = { # Become Puppet state
		name = russia2_baltic.5.b
		ai_chance = { 
			base = 25
			modifier = {
				factor = 2
				tag = FIN
			}
		}
		SOV = { country_event = { id = russia2_russia.5 days = 1 } }
	}
	option = { # Stay as own communist state
		name = russia2_baltic.5.c
		trigger = {
			is_subject = no
		}
		ai_chance = { base = 5 }
	}

	mean_time_to_happen = {
		days = 2
	}
}

# Hidden event to be annexed. Needed because of problem with FROM and events in annexed countries (JH)
country_event = {
	id = russia2_baltic.6

	hidden = yes
	
	is_triggered_only = yes

	immediate = {
		news_event = { id = news.71 hours = 1 }
	}
}