﻿###########################
# turkey Events
###########################

add_namespace = generic

# President dies
country_event = {
	id = generic.1
	title = generic.1.t
	desc = { 
		text = generic.1.d_neutral_good
		trigger = {
			has_government = FROM
		}
	}
	desc = {
		text = generic.1.d_bad
		trigger = {
			NOT = { has_government = FROM }
		}
	}
	picture = GFX_report_event_generic_read_write

	is_triggered_only = yes

	option = {
		name = generic.1.a
		trigger = {
			has_government = FROM
		}		
	}
	option = {
		name = generic.1.b
		trigger = {
			NOT = { has_government = FROM }
		}		
	}
}

# Generic request to join major Alliance
country_event = {
	id = generic.2
	title = generic.2.t
	desc = { # FROM and ROOT are Democratic
		text = generic.2.d.a
		trigger = {
			AND = {
				FROM = {
					has_government = democratic
				}
				has_government = democratic
			}
		}
	}
	desc = { # FROM and ROOT are Fascist
		text = generic.2.d.b
		trigger = {
			AND = {
				FROM = {
					has_government = fascism
				}
				has_government = fascism
			}
		}
	}
	desc = { # FROM and ROOT are Communist
		text = generic.2.d.c
		trigger = {
			AND = {
				FROM = {
					has_government = communism
				}
				has_government = communism
			}
		}
	}
	desc = { # FROM and ROOT are different ideologies
		text = generic.2.d.e
		trigger = {
			NOT = {
				AND = {
					FROM = {
						has_government = democratic
					}
					has_government = democratic
				}
				AND = {
					FROM = {
						has_government = fascism
					}
					has_government = fascism
				}
				AND = {
					FROM = {
						has_government = communism
					}
					has_government = communism
				}
			}
		}
	}
	picture = GFX_report_event_generic_read_write

	immediate = {
		hidden_effect = {
			save_event_target_as = alliance_inviter
			FROM = {
				save_event_target_as = alliance_applicant
			}
		}
	}

	is_triggered_only = yes
	
	option = { #Agree / Both Democratic
		name = generic.2.a
		trigger = {
			AND = {
				FROM = {
					has_government = democratic
				}
				has_government = democratic
			}
		}
		ai_chance = {
			base = 100
		}
		add_to_faction = FROM
		FROM = { country_event = { id = generic.3 hours = 6 } }
		hidden_effect = {
			set_country_flag = alliance_inviter@ROOT
			FROM = { set_country_flag = alliance_applicant@ROOT }
			news_event = { id = news.289 hours = 12 }
		}
	}
	option = { #Agree / Both Fascist
		name = generic.2.b
		trigger = {
			AND = {
				FROM = {
					has_government = fascism
				}
				has_government = fascism
			}
		}
		ai_chance = {
			base = 100
		}
		add_to_faction = FROM
		FROM = { country_event = { id = generic.3 hours = 6 } }
		hidden_effect = {
			set_country_flag = alliance_inviter@ROOT
			FROM = { set_country_flag = alliance_applicant@ROOT }
			news_event = { id = news.289 hours = 12 }
		}
	}
	option = { #Agree / Both Communist
		name = generic.2.c
		trigger = {
			AND = {
				FROM = {
					has_government = communism
				}
				has_government = communism
			}
		}
		ai_chance = {
			base = 100
		}
		add_to_faction = FROM
		FROM = { country_event = { id = generic.3 hours = 6 } }
		hidden_effect = {
			set_country_flag = alliance_inviter@ROOT
			FROM = { set_country_flag = alliance_applicant@ROOT }
			news_event = { id = news.289 hours = 12 }
		}
	}
	option = { #Agree / Both different
		name = generic.2.e
		trigger = {
			NOT = {
				AND = {
					FROM = {
						has_government = democratic
					}
					has_government = democratic
				}
				AND = {
					FROM = {
						has_government = fascism
					}
					has_government = fascism
				}
				AND = {
					FROM = {
						has_government = communism
					}
					has_government = communism
				}
			}
		}
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0.5
				has_war = no
				FROM = {
					has_war = yes
				}
			}
			
			modifier = {
				factor = 0.5
				NOT = {
					has_government = neutrality
				}
			}
			
			modifier = {
				factor = 0.75
				FROM = {
					is_major = no
				}
			}
		}
		add_to_faction = FROM
		FROM = { country_event = { id = generic.3 hours = 6 } }
		hidden_effect = {
			set_country_flag = alliance_inviter@ROOT
			FROM = { set_country_flag = alliance_applicant@ROOT }
			news_event = { id = news.289 hours = 12 }
		}
		FROM = {
			add_ai_strategy = {
				type = alliance
				id = ROOT
				value = 200
			}
		}
	}
	
	option = { #Reject
		name = generic.2.f
		ai_chance = {
			factor = 50
			
			modifier = {
				factor = 0.5
				has_opinion = {
					target = FROM
					value > 65
				}
			}
			
			modifier = {
				factor = 0.5
				has_opinion = {
					target = FROM
					value > 35
				}
			}
			
			modifier = {
				factor = 0.5
				has_opinion = {
					target = FROM
					value > 5
				}
			}
			
			modifier = {
				factor = 2.0
				has_opinion = {
					target = FROM
					value < 35
				}
			}
			
			modifier = {
				factor = 2.0
				has_opinion = {
					target = FROM
					value < 65
				}
			}
			
			modifier = {
				factor = 0.1
				has_war = yes
				FROM = {
					has_war = no
				}
			}
			
			modifier = {
				factor = 0.1
				FROM = {
					is_major = yes
				}
			}
		}
		FROM = { 
			country_event = { id = generic.4 hours = 6 }
		}
	}
}

# Generic accepted request to join major Alliance
country_event = {
	id = generic.3
	title = generic.3.t
	desc = generic.3.d

	picture = GFX_report_event_generic_sign_treaty2

	is_triggered_only = yes
	
	option = {
		name = generic.3.a
		trigger = {
			AND = {
				FROM = {
					has_government = democratic
				}
				has_government = democratic
			}
		}
	}
	option = {
		name = generic.3.b
		trigger = {
			AND = {
				FROM = {
					has_government = fascism
				}
				has_government = fascism
			}
		}


	}
	option = {
		name = generic.3.c
		trigger = {
			AND = {
				FROM = {
					has_government = communism
				}
				has_government = communism
			}
		}
	}
	option = {
		name = generic.3.e
		trigger = {
			NOT = {
				AND = {
					FROM = {
						has_government = democratic
					}
					has_government = democratic
				}
				AND = {
					FROM = {
						has_government = fascism
					}
					has_government = fascism
				}
				AND = {
					FROM = {
						has_government = communism
					}
					has_government = communism
				}
			}
		}
	}
}

# Generic rejected request to join major Alliance
country_event = {
	id = generic.4
	title = generic.4.t
	desc = generic.4.d
	
	picture = GFX_report_event_generic_read_write

	is_triggered_only = yes
	
	option = {
		name = generic.4.a
		trigger = {
			AND = {
				FROM = {
					has_government = democratic
				}
				has_government = democratic
			}
		}
	}
	option = {
		name = generic.4.b
		trigger = {
			AND = {
				FROM = {
					has_government = fascism
				}
				has_government = fascism
			}
		}
	}
	option = {
		name = generic.4.c
		trigger = {
			AND = {
				FROM = {
					has_government = communism
				}
				has_government = communism
			}
		}
	}
	option = {
		name = generic.4.e
		trigger = {
			NOT = {
				AND = {
					FROM = {
						has_government = democratic
					}
					has_government = democratic
				}
				AND = {
					FROM = {
						has_government = fascism
					}
					has_government = fascism
				}
				AND = {
					FROM = {
						has_government = communism
					}
					has_government = communism
				}
			}
		}
	}
}

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

# Generic invitaton to join major Alliance
country_event = {
	id = generic.5
	title = generic.5.t
	desc = { # FROM and ROOT are Democratic
		text = generic.5.d.a
		trigger = {
			AND = {
				FROM = {
					has_government = democratic
				}
				has_government = democratic
			}
		}
	}
	desc = { # FROM and ROOT are Fascist
		text = generic.5.d.b
		trigger = {
			AND = {
				FROM = {
					has_government = fascism
				}
				has_government = fascism
			}
		}
	}
	desc = { # FROM and ROOT are Communist
		text = generic.5.d.c
		trigger = {
			AND = {
				FROM = {
					has_government = communism
				}
				has_government = communism
			}
		}
	}
	desc = { # FROM and ROOT are different ideologies
		text = generic.5.d.e
		trigger = {
			NOT = {
				AND = {
					FROM = {
						has_government = democratic
					}
					has_government = democratic
				}
				AND = {
					FROM = {
						has_government = fascism
					}
					has_government = fascism
				}
				AND = {
					FROM = {
						has_government = communism
					}
					has_government = communism
				}
			}
		}
	}
	picture = GFX_report_event_generic_read_write

	immediate = {
		hidden_effect = {
			save_event_target_as = alliance_applicant
			FROM = {
				save_event_target_as = alliance_inviter
			}
		}
	}

	is_triggered_only = yes
	
	option = { #Agree / Both Democratic
		name = generic.5.a
		trigger = {
			is_in_faction = no
			AND = {
				FROM = {
					has_government = democratic
				}
				has_government = democratic
			}
		}
		ai_chance = {
			base = 100
		}
		FROM = { 
			add_to_faction = ROOT
			country_event = { id = generic.6 hours = 6 } 
		}
		add_ai_strategy = {
			type = alliance
			id = FROM
			value = 200
		}
		hidden_effect = {
			set_country_flag = alliance_applicant@ROOT
			FROM = { set_country_flag = alliance_inviter@ROOT }
			news_event = { id = news.289 hours = 12 }			
		}
	}
	option = { #Agree / Both Fascist
		name = generic.5.b
		trigger = {
			is_in_faction = no
			AND = {
				FROM = {
					has_government = fascism
				}
				has_government = fascism
			}
		}
		ai_chance = {
			base = 100
		}
		FROM = { 
			add_to_faction = ROOT
			country_event = { id = generic.6 hours = 6 } 
		}
		add_ai_strategy = {
			type = alliance
			id = FROM
			value = 200
		}
		hidden_effect = {
			set_country_flag = alliance_applicant@ROOT
			FROM = { set_country_flag = alliance_inviter@ROOT }
			news_event = { id = news.289 hours = 12 }
		}
	}
	option = { #Agree / Both Communist
		name = generic.5.c
		trigger = {
			is_in_faction = no
			AND = {
				FROM = {
					has_government = communism
				}
				has_government = communism
			}
		}
		ai_chance = {
			base = 100
		}
		FROM = { 
			add_to_faction = ROOT
			country_event = { id = generic.6 hours = 6 }
		}
		add_ai_strategy = {
			type = alliance
			id = FROM
			value = 200
		}
		hidden_effect = {
			set_country_flag = alliance_applicant@ROOT
			FROM = { set_country_flag = alliance_inviter@ROOT }
			news_event = { id = news.289 hours = 12 }
		}
	}
	option = { #Agree / Both different
		name = generic.5.e
		trigger = {
			is_in_faction = no
			NOT = {
				AND = {
					FROM = {
						has_government = democratic
					}
					has_government = democratic
				}
				AND = {
					FROM = {
						has_government = fascism
					}
					has_government = fascism
				}
				AND = {
					FROM = {
						has_government = communism
					}
					has_government = communism
				}
			}
		}
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0.5
				has_war = no
				FROM = {
					has_war = yes
				}
			}
			
			modifier = {
				factor = 0.5
				NOT = {
					has_government = neutrality
				}
			}
			
			modifier = {
				factor = 0.75
				FROM = {
					is_major = no
				}
			}
		}
		FROM = { 
			add_to_faction = ROOT
			country_event = { id = generic.6 hours = 6 }
		}		
		add_ai_strategy = {
			type = alliance
			id = FROM
			value = 200
		}
		hidden_effect = {
			set_country_flag = alliance_applicant@ROOT
			FROM = { set_country_flag = alliance_inviter@ROOT }
			news_event = { id = news.289 hours = 12 }			
		}
	}
	
	option = { #Reject
		name = generic.2.f
		trigger = {
			is_in_faction = no
		}
		ai_chance = {
			factor = 50
			
			modifier = {
				factor = 0.5
				has_opinion = {
					target = FROM
					value > 65
				}
			}
			
			modifier = {
				factor = 0.5
				has_opinion = {
					target = FROM
					value > 35
				}
			}
			
			modifier = {
				factor = 0.5
				has_opinion = {
					target = FROM
					value > 5
				}
			}
			
			modifier = {
				factor = 2.0
				has_opinion = {
					target = FROM
					value < 35
				}
			}
			
			modifier = {
				factor = 2.0
				has_opinion = {
					target = FROM
					value < 65
				}
			}
			
			modifier = {
				factor = 0.1
				has_war = yes
				FROM = {
					has_war = no
				}
			}
			
			modifier = {
				factor = 0.1
				FROM = {
					is_major = yes
				}
			}
		}
		FROM = { 
			country_event = { id = generic.7 hours = 6 }
		}
	}

	option = { #Reject if in faction
		name = generic.2.g
		trigger = {
			is_in_faction = yes
		}
		FROM = { 
			country_event = { id = generic.7 hours = 6 }
		}
	}
}

# Generic accepted invitation to join major Alliance
country_event = {
	id = generic.6
	title = generic.6.t
	desc = generic.6.d

	picture = GFX_report_event_generic_sign_treaty2

	is_triggered_only = yes
	
	option = {
		name = generic.3.a
		trigger = {
			AND = {
				FROM = {
					has_government = democratic
				}
				has_government = democratic
			}
		}
	}
	option = {
		name = generic.3.b
		trigger = {
			AND = {
				FROM = {
					has_government = fascism
				}
				has_government = fascism
			}
		}


	}
	option = {
		name = generic.3.c
		trigger = {
			AND = {
				FROM = {
					has_government = communism
				}
				has_government = communism
			}
		}
	}
	option = {
		name = generic.3.e
		trigger = {
			NOT = {
				AND = {
					FROM = {
						has_government = democratic
					}
					has_government = democratic
				}
				AND = {
					FROM = {
						has_government = fascism
					}
					has_government = fascism
				}
				AND = {
					FROM = {
						has_government = communism
					}
					has_government = communism
				}
			}
		}
	}
}

# Generic rejected invitation to join major Alliance
country_event = {
	id = generic.7
	title = generic.7.t
	desc = generic.7.d
	
	picture = GFX_report_event_generic_read_write

	is_triggered_only = yes
	
	option = {
		name = generic.7.a
		trigger = {
			AND = {
				FROM = {
					has_government = democratic
				}
				has_government = democratic
			}
		}
	}
	option = {
		name = generic.4.b
		trigger = {
			AND = {
				FROM = {
					has_government = fascism
				}
				has_government = fascism
			}
		}
	}
	option = {
		name = generic.4.c
		trigger = {
			AND = {
				FROM = {
					has_government = communism
				}
				has_government = communism
			}
		}
	}
	option = {
		name = generic.4.e
		trigger = {
			NOT = {
				AND = {
					FROM = {
						has_government = democratic
					}
					has_government = democratic
				}
				AND = {
					FROM = {
						has_government = fascism
					}
					has_government = fascism
				}
				AND = {
					FROM = {
						has_government = communism
					}
					has_government = communism
				}
			}
		}
	}

}

# Race for the Bomb success event
country_event = {
	id = generic.8
	title = generic.8.t
	desc = generic.8.d
	
	picture = GFX_report_event_physics_lab_01 #todo picture of Little Boy

	is_triggered_only = yes
	
	option = {
		name = generic.8.a
		clr_country_flag = racing_for_the_bomb
		remove_ideas = race_for_the_bomb
		add_war_support = 0.1
		every_other_country = {
			limit = {
				has_country_flag = racing_for_the_bomb
				NOT = { is_in_faction_with = ROOT }
			}
			country_event = { id = generic.9 }
		}
		every_other_country = {
			limit = {
				has_country_flag = racing_for_the_bomb
				is_in_faction_with = ROOT
			}
			country_event = { id = generic.10 }
		}
	}	
}

# Race for the Bomb failure event
country_event = {
	id = generic.9
	title = generic.9.t
	desc = generic.9.d
	
	picture = GFX_report_event_physics_lab_01

	is_triggered_only = yes
	
	option = {
		name = generic.9.a
		clr_country_flag = racing_for_the_bomb
		remove_ideas = race_for_the_bomb
		add_timed_idea = { idea = race_for_the_bomb_outclassed days = 360 }
		add_stability = -0.1
	}	
}

# Race for the Bomb faction member success event
country_event = {
	id = generic.10
	title = generic.10.t
	desc = generic.10.d
	
	picture = GFX_report_event_physics_lab_01

	is_triggered_only = yes
	
	option = {
		name = generic.10.a
		clr_country_flag = racing_for_the_bomb
		remove_ideas = race_for_the_bomb
		add_war_support = 0.05
	}	
}

# Ideology civil war won
country_event = {
	id = generic.11
	title = generic.11.t
	desc = generic.11.d
	
	picture = GFX_report_event_generic_ruins

	is_triggered_only = yes
	
	option = {
		name = generic.11.a
		clr_country_flag = ideology_civil_war
	}	
}

# Enemy attempting to destroy Suez
country_event = {
	id = generic.12
	title = generic.12.t
	desc = generic.12.d
	
	picture = GFX_report_event_merchant_ship_01

	is_triggered_only = yes
	
	option = {
		name = generic.12.a
		custom_effect_tooltip = canals_tt
	}	
}

# Enemy attempting to destroy Panama
country_event = {
	id = generic.13
	title = generic.13.t
	desc = generic.13.d
	
	picture = GFX_report_event_merchant_ship_01

	is_triggered_only = yes
	
	option = {
		name = generic.12.a
		custom_effect_tooltip = canals_tt
	}	
}

# Object to Attaches
country_event = {
	id = generic.14
	title = generic.14.t
	desc = generic.14.d
	
	picture = GFX_report_event_generic_read_write

	is_triggered_only = yes
	
	# Agree - recall attache
	option = {
		name = generic.14.a
		ai_chance = {
			base = 80
			modifier = {
				factor = 1.5
				has_opinion = { target = FROM value > 50 }
			}
			modifier = {
				factor = 1.5
				has_opinion = { target = FROM value > 75 }
			}
		}
		random_other_country = {
			limit = {
				has_war_with = FROM
				has_attache_from = ROOT
			}
			ROOT = { recall_attache = PREV }
		}
		FROM = {
			country_event = { id = generic.15 days = 1 }
		}
		clr_country_flag = object_attache_going_on
	}	

	# Reject demands
	option = {
		name = generic.14.b
		ai_chance = {
			base = 20
			modifier = {
				factor = 2
				has_opinion = { target = FROM value < 0 }
			}
			modifier = {
				factor = 3
				has_opinion = { target = FROM value < -20 }
			}
			modifier = {
				factor = 3
				has_opinion = { target = FROM value < -50 }
			}
		}
		custom_effect_tooltip = attache_political_power_tt
		if = {
			limit = {
				NOT = { strength_ratio = { tag = FROM ratio < 3 } }
			}
			if = {
				limit = {
					has_opinion = { target = FROM value > -25 }
					NOT = { has_opinion = { target = FROM value > 0 } }
				}
				add_political_power = -5
			}
			if = {
				limit = {
					has_opinion = { target = FROM value > 0 }
					NOT = { has_opinion = { target = FROM value > 50 } }
	
				}
				add_political_power = -10
			}
			if = {
				limit = { has_opinion = { target = FROM value > 50 } }
				add_political_power = -15
			}
		}
		if = {
			limit = {
				strength_ratio = { tag = FROM ratio < 3 }
				NOT = { strength_ratio = { tag = FROM ratio < 2.5 } }
			}
			if = {
				limit = {
					has_opinion = { target = FROM value > -25 }
					NOT = { has_opinion = { target = FROM value > 0 } }
				}
				add_political_power = -10
			}
			if = {
				limit = {
					has_opinion = { target = FROM value > 0 }
					NOT = { has_opinion = { target = FROM value > 50 } }
	
				}
				add_political_power = -20
			}
			if = {
				limit = { has_opinion = { target = FROM value > 50 } }
				add_political_power = -30
			}
		}
		if = {
			limit = {
				strength_ratio = { tag = FROM ratio < 2.5 }
				NOT = { strength_ratio = { tag = FROM ratio < 2 } }
			}
			if = {
				limit = {
					has_opinion = { target = FROM value > -25 }
					NOT = { has_opinion = { target = FROM value > 0 } }
				}
				add_political_power = -15
			}
			if = {
				limit = {
					has_opinion = { target = FROM value > 0 }
					NOT = { has_opinion = { target = FROM value > 50 } }
	
				}
				add_political_power = -30
			}
			if = {
				limit = { has_opinion = { target = FROM value > 50 } }
				add_political_power = -45
			}
		}
		if = {
			limit = {
				strength_ratio = { tag = FROM ratio < 2 }
				NOT = { strength_ratio = { tag = FROM ratio < 1.5 } }
			}
			if = {
				limit = {
					has_opinion = { target = FROM value > -25 }
					NOT = { has_opinion = { target = FROM value > 0 } }
				}
				add_political_power = -20
			}
			if = {
				limit = {
					has_opinion = { target = FROM value > 0 }
					NOT = { has_opinion = { target = FROM value > 50 } }
	
				}
				add_political_power = -40
			}
			if = {
				limit = { has_opinion = { target = FROM value > 50 } }
				add_political_power = -60
			}
		}
		if = {
			limit = {
				strength_ratio = { tag = FROM ratio < 1.5 }
			}
			if = {
				limit = {
					has_opinion = { target = FROM value > -25 }
					NOT = { has_opinion = { target = FROM value > 0 } }
				}
				add_political_power = -25
			}
			if = {
				limit = {
					has_opinion = { target = FROM value > 0 }
					NOT = { has_opinion = { target = FROM value > 50 } }
	
				}
				add_political_power = -50
			}
			if = {
				limit = { has_opinion = { target = FROM value > 50 } }
				add_political_power = -75
			}
		}
		FROM = {
			add_opinion_modifier = { target = ROOT modifier = rejected_demands }
			country_event = { id = generic.16 days = 1 }
		}
		hidden_effect = {
			set_country_flag = { flag = rejected_withdrawing_attache value = 1 days = 90 }
			set_country_flag = { flag = rejected_withdrawing_attache@FROM value = 1 days = 365 }
			clr_country_flag = object_attache_going_on
		}
		if = {
			limit = {
				FROM = { has_government = fascism }
				NOT = { has_government = fascism }
				fascism > 0.1
				NOT = { fascism > 0.2 }
				strength_ratio = { tag = FROM ratio < 1.2 }
			}
			custom_effect_tooltip = attache_fascism_tt
			add_stability = -0.025
		}
		if = {
			limit = {
				FROM = { has_government = fascism }
				NOT = { has_government = fascism }
				fascism > 0.2
				NOT = { fascism > 0.3 }
				strength_ratio = { tag = FROM ratio < 1.2 }
			}
			custom_effect_tooltip = attache_fascism_tt
			add_stability = -0.05
		}
		if = {
			limit = {
				FROM = { has_government = fascism }
				NOT = { has_government = fascism }
				fascism > 0.3
				NOT = { fascism > 0.4 }
				strength_ratio = { tag = FROM ratio < 1.2 }
			}
			custom_effect_tooltip = attache_fascism_tt
			add_stability = -0.075
		}
		if = {
			limit = {
				FROM = { has_government = fascism }
				NOT = { has_government = fascism }
				fascism > 0.4
				strength_ratio = { tag = FROM ratio < 1.2 }
			}
			custom_effect_tooltip = attache_fascism_tt
			add_stability = -0.1
		}
		if = {
			limit = {
				FROM = { has_government = communism }
				communism > 0.1
				NOT = { communism > 0.2 }
				strength_ratio = { tag = FROM ratio < 1.2 }
			}
			custom_effect_tooltip = attache_communism_tt
			add_stability = -0.025
		}
		if = {
			limit = {
				FROM = { has_government = communism }
				NOT = { has_government = communism }
				communism > 0.2
				NOT = { communism > 0.3 }
				strength_ratio = { tag = FROM ratio < 1.2 }
			}
			custom_effect_tooltip = attache_communism_tt
			add_stability = -0.05
		}
		if = {
			limit = {
				FROM = { has_government = communism }
				NOT = { has_government = communism }
				communism > 0.3
				NOT = { communism > 0.4 }
				strength_ratio = { tag = FROM ratio < 1.2 }
			}
			custom_effect_tooltip = attache_communism_tt
			add_stability = -0.075
		}
		if = {
			limit = {
				FROM = { has_government = communism }
				NOT = { has_government = communism }
				communism > 0.4
				strength_ratio = { tag = FROM ratio < 1.2 }
			}
			custom_effect_tooltip = attache_communism_tt
			add_stability = -0.1
		}
		if = {
			limit = {
				FROM = { has_government = democratic }
				NOT = { has_government = democratic }
				democratic > 0.1
				NOT = { democratic > 0.2 }
				strength_ratio = { tag = FROM ratio < 1.2 }
			}
			custom_effect_tooltip = attache_democratic_tt
			add_stability = -0.025
		}
		if = {
			limit = {
				FROM = { has_government = democratic }
				NOT = { has_government = democratic }
				democratic > 0.2
				NOT = { democratic > 0.3 }
				strength_ratio = { tag = FROM ratio < 1.2 }
			}
			custom_effect_tooltip = attache_democratic_tt
			add_stability = -0.05
		}
		if = {
			limit = {
				FROM = { has_government = democratic }
				NOT = { has_government = democratic }
				democratic > 0.3
				NOT = { democratic > 0.4 }
				strength_ratio = { tag = FROM ratio < 1.2 }
			}
			custom_effect_tooltip = attache_democratic_tt
			add_stability = -0.075
		}
		if = {
			limit = {
				FROM = { has_government = democratic }
				NOT = { has_government = democratic }
				democratic > 0.4
				strength_ratio = { tag = FROM ratio < 1.2 }
			}
			custom_effect_tooltip = attache_democratic_tt
			add_stability = -0.1
		}
	}	
}

# Notification event that TAG withdrew attache
country_event = {
	id = generic.15
	title = generic.15.t
	desc = generic.15.d
	
	picture = GFX_report_event_generic_read_write

	is_triggered_only = yes

	option = {
		name = excellent
	}	
}

# Notification event that TAG refused to withdraw attache
country_event = {
	id = generic.16
	title = generic.16.t
	desc = generic.16.d
	
	picture = GFX_report_event_generic_read_write

	is_triggered_only = yes

	option = {
		name = generic.16.a
		effect_tooltip = {
			add_opinion_modifier = { target = FROM modifier = rejected_demands }
		}
	}	
}

# Notification event that leader has gotten sick
unit_leader_event = {
	id = generic.17
	title = generic.17.t
	desc = generic.17.d
	
	picture = GFX_report_event_military_planning

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			FROM = {
				set_unit_leader_flag = {
					flag = recently_sick
					value = 1
					days = 180
				}
			}
		}
	}

	option = {
		name = unfortunate
		effect_tooltip = {
			FROM = {
				add_timed_unit_leader_trait = {
					trait = sick
					days = 30
				}
			}
		}
	}	
}

# Notification event that leader has been wounded
country_event = {
	id = generic.18
	title = generic.18.t
	desc = generic.18.d
	
	picture = GFX_report_event_military_planning

	is_triggered_only = yes

	option = {
		name = unfortunate
		effect_tooltip = {
			FROM = {
				add_timed_unit_leader_trait = {
					trait = wounded
					days = 90
				}
			}
		}
	}	
}

# Notification event that FROM has sent industrial support
country_event = {
	id = generic.19
	title = generic.19.t
	desc = generic.19.d
	
	picture = GFX_report_event_generic_factory

	is_triggered_only = yes

	option = {
		name = excellent
		effect_tooltip = {
			add_offsite_building = { type = arms_factory level = 2 }
		}
	}	
}

#Become a puppet
country_event = {
	id = generic.20
	title = generic.20.t
	desc = {
		text = generic.20.d_friends
		trigger = {
			has_opinion = {
				target = FROM
				value = 150
			}
		}
	}
	desc = {
		text = generic.20.d_enemies
		trigger = {
			NOT = { 
				has_opinion = {
					target = FROM
					value = 150
				}
			}
		}
	}
	picture = GFX_report_event_generic_read_write
	
	is_triggered_only = yes

	option = {
		name = generic.20.a
		trigger = {
			NOT = { 
				has_opinion = {
					target = FROM
					value = 150
				}
			}
		}
		ai_chance = {
			factor = 20
			modifier = {
				threat > 20
				factor = 2
			}
			modifier = {
				is_in_faction = no
				factor = 2
			}
			modifier = {
				is_in_faction_with = FROM
				factor = 2
			}
			modifier = {
				is_in_faction = yes
				NOT = { is_in_faction_with = FROM }
				factor = 0.5
			}
		}
		effect_tooltip = { 
			FROM = { puppet = ROOT }
			if = {
				limit = {
					FROM = { is_in_faction = yes }
				}
				random_country = {
					limit = { 
						is_in_faction_with = FROM 
						is_faction_leader = yes
					}
					add_to_faction = ROOT
				}
			}
		}
		hidden_effect = {
			FROM = { country_event = { id = generic.21 hours = 6 } }
		}
	}

	option = {
		name = generic.20.b
		trigger = {
			has_opinion = {
				target = FROM
				value = 150
			}
		}
		ai_chance = {
			factor = 25
			modifier = {
				threat > 20
				factor = 2
			}
			modifier = {
				is_in_faction = no
				factor = 2
			}
			modifier = {
				is_in_faction_with = FROM
				factor = 2
			}
			modifier = {
				is_in_faction = yes
				NOT = { is_in_faction_with = FROM }
				factor = 0.5
			}
		}
		effect_tooltip = { 
			FROM = { puppet = ROOT }
			if = {
				limit = {
					FROM = { is_in_faction = yes }
				}
				random_country = {
					limit = { 
						is_in_faction_with = FROM 
						is_faction_leader = yes
					}
					add_to_faction = ROOT
				}
			}
		}
		hidden_effect = {
			FROM = { country_event = { id = generic.21 hours = 6 } }
		}
	}

	option = {
		name = generic.20.c
		ai_chance = {
			factor = 30
			modifier = {
				is_in_faction = yes
				NOT = { is_in_faction_with = FROM }
				factor = 2
			}
			modifier = {
				threat < 20
				factor = 2
			}
		}
		effect_tooltip = { 
			FROM = { 
				create_wargoal = {
					type = puppet_wargoal_focus
					target = ROOT
				}
			}
		}
		hidden_effect = {
			FROM = { country_event = { id = generic.22 hours = 6 } }
		}
	}

}

#Became puppet
country_event = {
	id = generic.21
	title = generic.21.t
	desc = generic.21.d
	picture = GFX_report_event_generic_read_write
	
	is_triggered_only = yes

	option = {
		name = generic.21.a
		ai_chance = {
			factor = 1
		}
		ROOT = { puppet = FROM }
		if = {
			limit = {
				ROOT = { is_in_faction = yes }
			}
			random_country = {
				limit = { 
					is_in_faction_with = ROOT 
					is_faction_leader = yes
				}
				add_to_faction = FROM
			}
		}
	}

}

#Denied puppet
country_event = {
	id = generic.22
	title = generic.22.t
	desc = generic.22.d
	picture = GFX_report_event_generic_read_write
	
	is_triggered_only = yes

	option = {
		name = generic.22.a
		ai_chance = {
			factor = 1
		}
		ROOT = { 
			create_wargoal = {
				type = puppet_wargoal_focus
				target = FROM
			}
		}
	}

}

# generic event for demanding territory
country_event = {
	id = generic.23
	title = generic.23.t
	desc = generic.23.d
	
	picture = GFX_report_event_czech_soldiers_01

	is_triggered_only = yes

	option = {
		name = generic.23.a
		ai_chance = {
			factor = 90
			modifier = { # If they stand a chance they will fight
				factor = 0
				strength_ratio = {
					tag = FROM
					ratio > 0.75
				}
				NOT = {
					any_neighbor_country = {
						NOT = { tag = FROM }
						is_in_faction_with = FROM
					}
				}
			}
			modifier = {
				factor = 0 #if you lead a faction, fight
				is_faction_leader = yes
			}
			modifier = {
				factor = 0.5 #if you are in a faction, maybe fight
				is_faction_leader = no
				is_in_faction = yes
			}
			modifier = { # Increase it again if other bordering nations are in the enemy faction
				any_neighbor_country = {
					NOT = { tag = FROM }
					is_in_faction_with = FROM
				}
				factor = 2.0
			}
		}
		effect_tooltip = {
			FROM = { transfer_state = event_target:demanded_prov_target }
			if = {
				limit = {
					event_target:demanded_prov_target = { has_state_flag = give_core_to_state_flag }
				}
			event_target:demanded_prov_target = { add_core_of = FROM }
			}
		}
		hidden_effect = {
			FROM = { country_event = generic.24 }
		}
	}

	option = {
		name = generic.23.b
		ai_chance = { 
			factor = 10 
			modifier = {
				factor = 0.5
				strength_ratio = {
					tag = FROM
					ratio < 0.5
				}
			}
		}
		custom_effect_tooltip = maybe_war_tt
		hidden_effect = {
			FROM = { country_event = generic.25 }
		}
	}
}

# accepted demands
country_event = {
	id = generic.24
	title = generic.24.t
	desc = generic.24.d
	
	picture = GFX_report_event_czech_soldiers_01

	is_triggered_only = yes

	option = {
		name = excellent
		THIS = { transfer_state = event_target:demanded_prov_target }
		if = {
			limit = {
				event_target:demanded_prov_target = { has_state_flag = give_core_to_state_flag }
			}
			event_target:demanded_prov_target = { 
				add_core_of = THIS
				clr_state_flag = give_core_to_state_flag
			}
		}
		hidden_effect = { clear_global_event_target = demanded_prov_target }
	}
}

# accepted demands
country_event = {
	id = generic.25
	title = generic.25.t
	desc = generic.25.d
	
	picture = GFX_report_event_czech_soldiers_01

	is_triggered_only = yes

	option = {
		name = generic.25.a
		ai_chance = {
			factor = 90
		}
		create_wargoal = {
			type = annex_everything 
			target = FROM
		}
		hidden_effect = { clear_global_event_target = demanded_prov_target }
	}
}
