SOV_SYR = {
	sov_intervene_SYR = {
		allowed = { tag = SOV }

		available = {
			or = {
				SYR = { has_volunteers_amount_from = { tag = SOV count > 0 } }
				FSA = { has_volunteers_amount_from = { tag = SOV count > 0 } }
				NUS = { has_volunteers_amount_from = { tag = SOV count > 0 } }
				ISI = { has_volunteers_amount_from = { tag = SOV count > 0 } }
			}

		}


		activation = {
			SYR = {
				or = {
					has_war_with = ISI
					has_war_with = FSA
					has_war_with = NUS
					has_war_with = ROJ
				}
			}
		}


		Is_good = yes

		selectable_mission = yes
		days_mission_timeout = 60
		days_remove = 5


		fire_only_once = yes


		timeout_effect = {

		}


		complete_effect = {
			add_political_power = 25
		}

		ai_will_do = {
			factor = 1
		}
	}
}

SOV_HOR = {
	sov_intervene_HOR = {
		allowed = { tag = SOV }

		available = {
			or = {
				GNA = { has_volunteers_amount_from = { tag = SOV count > 0 } }
				HOR = { has_volunteers_amount_from = { tag = SOV count > 0 } }
				TUA = { has_volunteers_amount_from = { tag = SOV count > 0 } }

			}

		}


		activation = {
			HOR = {
				or = {
					has_war_with = GNA
					has_war_with = TUA
				}
			}
		}


		Is_good = yes

		selectable_mission = yes
		days_mission_timeout = 60
		days_remove = 5


		fire_only_once = yes


		timeout_effect = {
		}


		complete_effect = {
			add_political_power = 25
		}

		ai_will_do = {
			factor = 1
		}
	}
}
SOV_CHE = {
	sov_CHE = {
		allowed = { tag = SOV }

		available = {
			tag = SOV
			CHE = {
				NOT = {
					controls_state = 672
				}
			}
		}

		activation = {
		}


		Is_good = yes


		fire_only_once = yes


		timeout_effect = {
		}

		cost = 50
		complete_effect = {
			country_event = russia.1
		}

		ai_will_do = {
			factor = 1
		}
	}
}
SOV_Propaganda = {
	SOV_Propaganda_1 = {
		allowed = { tag = SOV }
		icon = GFX_decision_ntv
		available = {
			tag = SOV
			communism < 0.6
			NOT = {
				has_country_flag = propaganda_1
			}
		}

		activation = {
		}


		Is_good = yes


		fire_only_once = yes


		timeout_effect = {
		}

		cost = 25
		complete_effect = {
			set_country_flag = propaganda_1
			add_popularity = {
				ideology = communism
				popularity = 0.05
			}
			add_stability = -0.03
			add_war_support = -0.03
		}

		ai_will_do = {
			factor = 1
		}
	}
	SOV_Propaganda_2 = {
		allowed = { tag = SOV }
		icon = GFX_decision_ntv
		available = {
			tag = SOV
			communism < 0.65
			has_country_flag = propaganda_1
			NOT = {
				has_country_flag = propaganda_2
			}
		}

		activation = {
		}


		Is_good = yes


		fire_only_once = yes


		timeout_effect = {
		}

		cost = 30
		complete_effect = {
			set_country_flag = propaganda_2
			add_popularity = {
				ideology = communism
				popularity = 0.07
			}
			add_stability = -0.03
			add_war_support = -0.03
		}

		ai_will_do = {
			factor = 1
		}
	}
	SOV_Propaganda_3 = {
		allowed = { tag = SOV }
		icon = GFX_decision_ntv
		available = {
			tag = SOV
			communism < 0.75
			has_country_flag = propaganda_2
			NOT = {
				has_country_flag = propaganda_3
			}
		}

		activation = {
		}


		Is_good = yes


		fire_only_once = yes


		timeout_effect = {
		}

		cost = 50
		complete_effect = {
			set_country_flag = propaganda_3
			add_popularity = {
				ideology = communism
				popularity = 0.1
			}
			add_stability = -0.05
			add_war_support = -0.05
		}

		ai_will_do = {
			factor = 1
		}
	}
}
SOV_crush_da_opositon = {
	SOV_tv_1 = {
		allowed = { tag = SOV }
		available = {
			tag = SOV
			NOT = {
				has_country_flag = tv_1
			}
		}

		activation = {
		}


		Is_good = yes


		fire_only_once = yes


		timeout_effect = {
		}

		cost = 100
		complete_effect = {
			set_country_flag = tv_1
			add_popularity = {
				ideology = communism
				popularity = 0.05
			}
		}

		ai_will_do = {
			factor = 1
		}
	}
	SOV_tv_2 = {
		allowed = { tag = SOV }
		available = {
			has_country_flag = tv_1
			tag = SOV
			NOT = {
				has_country_flag = tv_2
			}
		}

		activation = {
		}


		Is_good = yes


		fire_only_once = yes


		timeout_effect = {
		}

		cost = 125
		complete_effect = {
			set_country_flag = tv_2
			add_popularity = {
				ideology = communism
				popularity = 0.1
			}
		}

		ai_will_do = {
			factor = 1
		}
	}
	SOV_tv_3 = {
		allowed = { tag = SOV }
		available = {
			has_country_flag = tv_2
			tag = SOV
			NOT = {
				has_country_flag = tv_3
			}
		}

		activation = {
		}

		Is_good = yes

		fire_only_once = yes

		timeout_effect = {
		}

		cost = 150
		complete_effect = {
			set_country_flag = tv_3
			add_popularity = {
				ideology = communism
				popularity = 0.15
			}
		}

		ai_will_do = {
			factor = 1
		}
	}
}

##################################### BORDER WAR SETUP #########################################
##################################### BORDER WAR SETUP #########################################
##################################### BORDER WAR SETUP #########################################
	
@border_incident_escalation_countdown = 30
@border_conflict_incident_forgotten_timer = 30
@border_conflict_escalate_to_war_countdown = 45
@border_conflict_time_until_cancelled = 360

	#Crimea#find loc TUR_afrin
	SOV_crimea = {
		icon = border_war		

		available = {
			669 = {
				is_owned_and_controlled_by = UKR
				any_neighbor_state = {
					is_fully_controlled_by = SOV
					set_temp_variable = { var:attacker_state_temp = id }
					has_ROOT_at_least_1_div_in_current_state_scope = yes
					hidden_trigger = { NOT = { has_state_flag = border_incident_active } }
				}
				NOT = { has_state_flag = border_incident_active }
			}
		}

		visible = {
			NOT = { has_war_with = UKR }
			UKR = {
			exists = yes 
			has_not_initiated_border_incident_with_ROOT = yes
			NOT = {
					is_subject_of = SOV
					is_in_faction_with = SOV
				}
			}
			
			669 = {
				is_owned_and_controlled_by = UKR
				OR = {
					AND = {
						TUR = { is_ai = yes }
						UKR = { is_ai = yes }
						OR = {
							is_core_of = SOV
							is_claimed_by = SOV
						}
						
						SOV = { has_opinion = { target = UKR value < 50 } }
						SOV = { is_major = no }
					}
					
					SOV = { is_ai = no }
				}
				
				any_neighbor_state = {
					is_fully_controlled_by = SOV
				}
			}
			
			NOT = {
				is_subject_of = UKR
			}

			OR = {
				NOT = { has_border_war_with = UKR }
				any_state = {
					is_owned_and_controlled_by = UKR
					hidden_trigger = { NOT = { has_state_flag = border_incident_active } }
					any_neighbor_state = {
						hidden_trigger = { NOT = { has_state_flag = border_incident_active } }
						is_fully_controlled_by = SOV
					}
				}
			}
		}

		highlight_states = {
			state = 669
		}

		ai_will_do = {
			base = 0.2
			modifier = {
				OR = {
					NOT = {
						UKR = {
							any_owned_state = {
								OR = {
									is_core_of = SOV
									is_claimed_by = SOV
								}
							}
						}
					}
					
					SOV = { has_government = democratic }
				}
				factor = 0
			}
			
			modifier = {
				UKR = {
					any_owned_state = {
						is_core_of = SOV
					}
				}
				
				factor = 0.5
			}
			
			modifier = {
				NOT = { SOV = { has_government = fascism } }
				
				factor = 0.1
			}
			
			modifier = {
				SOV = { strength_ratio = { tag = UKR ratio > 0.8 } }
				
				factor = 0
			}
		}

		cost = 100
		days_remove = 365 

		fire_only_once = yes

		days_remove = @border_incident_escalation_countdown
		days_re_enable = 180

		war_with_target_on_remove = yes

		complete_effect = {
			UKR = {
			add_opinion_modifier = {
				target = SOV 
				modifier = border_conflict_started 
			}
			country_event = { id = SOV_ob_warn.1 hours = 1 }
			activate_targeted_decision = { target = SOV decision = SOV_crimea_d }
			}
			custom_effect_tooltip = WTT_border_incident_delay_until_new_incident_180
			hidden_effect = {
			random_state = {
					limit = {
						is_fully_controlled_by = SOV
						hidden_trigger = { NOT = { has_state_flag = border_incident_active } }
						has_ROOT_at_least_1_div_in_current_state_scope = yes
						any_neighbor_state = {
							state = 669
						}
					}
					save_event_target_as = attacker_state
					set_variable = { FROM.attacker_state_vs_@ROOT = id }
					set_temp_variable = { attacker_state_temp = id }
					set_state_flag = border_incident_active
				}
			}
		}
		
		remove_effect = {
		hidden_effect = {
		var:FROM.attacker_state_vs_@ROOT = {
					save_event_target_as = attacker_state 
				}
			}
		random_state = {
					limit = {
						is_fully_controlled_by = SOV
						hidden_trigger = { NOT = { has_state_flag = border_incident_active } }
						has_ROOT_at_least_1_div_in_current_state_scope = yes
						any_neighbor_state = {
							state = 669
						}
					}
					set_temp_variable = { attacker_state_temp = id }
				}
			activate_targeted_decision = { target = UKR decision = SOV_crimea2 }
		}
	}

	#Mission for defender warning that a conflict with SOVkey is coming
	 SOV_crimea_d = {
		icon = border_war

		allowed = { always = no } #Activated from effect

		available = {
			hidden_trigger = { always = no }
		}

		highlight_states = {
			state = 669
		}

		war_with_target_on_timeout = yes
		ai_will_do = {
			base = 1
			modifier = {
			}
		}

		days_mission_timeout = @border_incident_escalation_countdown

		fire_only_once = yes

		is_good = no
		
		timeout_effect = {
			custom_effect_tooltip = escalation_possible_tooltip_for_defender
			custom_effect_tooltip = effects_if_border_conflict_is_lost
			effect_tooltip = {
				add_political_power = -100
				SOV = {
				transfer_state = 669
				}
			}
			hidden_effect = {
				remove_targeted_decision = { target = UKR decision = SOV_crimea_d }
				activate_targeted_decision = { target = UKR decision = SOV_crimea_d2 }
			}
		}
	}

	#Mission for defender warning Russia can escalate to war at any point is coming
	 SOV_crimea_d2 = {
	 icon = border_war

		allowed = { always = no } #Activated from effect

		available = {
			hidden_trigger = { always = no }
		}

		highlight_states = {
			state = 669
		}

		war_with_target_on_timeout = yes
		ai_will_do = {
			base = 0
			modifier = {
			}
		}

		days_mission_timeout = @border_conflict_incident_forgotten_timer

		fire_only_once = yes

		is_good = no

		timeout_effect = {
			custom_effect_tooltip = from_cannot_escalate
			custom_effect_tooltip = effects_if_border_conflict_is_lost
			SOV = {
				transfer_state = 669
			}
		}		
	}

	#Mission for attacker to escalate or incident is forgotten
	#Decision to escalate incident on border with SOVkey to border conflict
	 SOV_crimea2 = {
	 icon = border_war

		allowed = { always = no } #Activated from effect

		available = {
			var:FROM.attacker_state_vs_@ROOT = {
				is_fully_controlled_by = SOV
			}
			divisions_in_border_state = {
				state = var:FROM.attacker_state_vs_@ROOT
				border_state = 669
				size > 0
			}
		}

		highlight_states = {
			state = 669		
		}

		ai_will_do = {
			base = 200
			modifier = {
				
			}
		}
		
		cancel_trigger = {
			is_in_faction_with = UKR
		}

		selectable_mission = yes

		fire_only_once = yes #Reactivation handled in effect

		days_mission_timeout = @border_conflict_incident_forgotten_timer

		timeout_effect = {
			custom_effect_tooltip = WTT_border_incident_delay_until_new_incident_120
			hidden_effect = {
				UKR = { remove_targeted_decision = { target = SOV decision = SOV_crimea_d2 } }
			}
		}

		complete_effect = {
			start_border_war = {
				change_state_after_war = no
				attacker = {
					state = var:FROM.attacker_state_vs_@ROOT
					num_provinces = 4
					#on_win = wtt_border_conflict_won_attacker.1
					#on_lose = wtt_border_conflict_lost_attacker.1
					#on_cancel = wtt_border_conflict_canceled_attacker.1
				}
				
				defender = {
					state = 669
					num_provinces = 1
					#on_win = wtt_border_conflict_won_defender.1
					#on_lose = wtt_border_conflict_lost_defender.1
					#on_cancel = wtt_border_conflict_canceled_defender.1
				}
			}
			UKR = {
				#activate_targeted_decision = { target = SOV decision = WTT_border_conflict_escalate_conflict }
				#activate_targeted_decision = { target = SOV decision = WTT_border_conflict_time_until_cancelled }
			}
			#activate_targeted_decision = { target = SOV decision = WTT_border_conflict_escalate_conflict }
			#activate_targeted_decision = { target = SOV decision = WTT_border_conflict_time_until_cancelled }
		}
	}

##################################### ^  BORDER WAR SETUP ^ #########################################
##################################### ^  BORDER WAR SETUP ^ #########################################
##################################### ^  BORDER WAR SETUP ^ #########################################

