###########################
# Carpathian Events
###########################

add_namespace = carpathian

# New leader of government
country_event = {
	id = carpathian.1
	title = carpathian.1.t
	desc = carpathian.1.d
	picture = GFX_report_event_carpathian_delegation
	
	is_triggered_only = yes

	option = {
		name = carpathian.1.a #Brodiy
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0
				OR = {
					is_historical_focus_on = yes
					UKR = { has_country_flag = UKR_acceptance_of_voloshyn }
				}
				
			}
		}
		complete_national_focus = CUA_strengthen_autonomy
	}
	option = {
		name = carpathian.1.b #Voloshyn
		ai_chance = {
			factor = 70
			modifier = {
				factor = 0
				NOT = { country_exists = UKR }
			}
		}
		complete_national_focus = CUA_proukrainian_government
	}
	option = {
		name = carpathian.1.c #Fentsik
		ai_chance = {
			factor = 20
			modifier = {
				factor = 0
				OR = {
					NOT = {	country_exists = HUN }
					HUN = { is_puppet = yes }
					NOT = { is_neighbor_of = HUN }
				}
			}
			modifier = {
				factor = 0
				OR = {
					is_historical_focus_on = yes
					UKR = { has_country_flag = UKR_acceptance_of_voloshyn }
				}
			}
		}
		complete_national_focus = CUA_prohungarian_government
	}
}
# Request to Germany/Hungary for saving of autonomy
country_event = {
	id = carpathian.2
	title = carpathian.2.t
	desc = carpathian.2.d
	picture = GFX_report_event_carpathian_delegation
	
	is_triggered_only = yes

	option = {
		name = carpathian.2.a
		ai_chance = {
			factor = 90
			modifier = {
				factor = 0.2
				tag = HUN
			}
		}
		puppet = CUA
		CUA = { 
			set_politics = { ruling_party = neutrality elections_allowed = no } 
			country_event = carpathian.3
		}
	}
	option = {
		name = carpathian.2.b
		ai_chance = {
			factor = 10
		}
		CUA = { country_event = carpathian.4 }
	}
}
# Germany/Hungary accept carpathian autonomy - message for CUA
country_event = {
	id = carpathian.3
	title = carpathian.3.t
	desc = carpathian.3.d
	picture = GFX_report_event_usa_election_generic
	
	is_triggered_only = yes

	option = {
		name = carpathian.3.a
	}
}
# Germany/Hungary decline carpathian autonomy - choice for CUA
country_event = {
	id = carpathian.4
	title = carpathian.4.t
	desc = carpathian.4.d
	picture = GFX_report_event_usa_election_generic
	
	is_triggered_only = yes

	option = {
		name = carpathian.4.a # submission
		ai_chance = {
			factor = 100
		}
		if = {
			limit = {
				154 = { is_owned_by = HUN }
				HUN = {
					is_friend_or_potential_friend_of_GER = yes
				}
				GER = { NOT = { has_country_flag = GER_annex_all_CZE } }
			 } 
			HUN = { annex_country = { target = CUA } }
			else = {
				FROM = { annex_country = { target = CUA } }
			}
		}
	}
	option = {
		name = carpathian.4.b # resistance
		ai_chance = {
			factor = 0
		}
		effect_tooltip = {
			create_wargoal = {
				type = take_state_focus
				target = CUA
				generator = { 73 }
			}
		}
		FROM = { country_event = { id = carpathian.5 days = 1 } }
	}
}
# CUA resists occupation
country_event = {
	id = carpathian.5
	title = carpathian.5.t
	desc = carpathian.5.d
	picture = GFX_report_event_carpathian_soldiers
	
	is_triggered_only = yes

	option = {
		name = carpathian.5.a
		create_wargoal = {
			type = take_state_focus
			target = CUA
			generator = { 73 }
		}
	}
}
#Hungary/Ukraine ask Germany for protection under Carpathian Ukraine
country_event = {
	id = carpathian.6
	title = carpathian.6.t
	desc = carpathian.6.d
	picture = GFX_report_event_carphatian_ukraine

	is_triggered_only = yes

	option = {
		name = ukraine.92.a
		ai_chance = {
			factor = 100
		}
		add_political_power = -25
		GER = {
			country_event = { id = carpathian.7 hours = 6 }
		}
	}
	option = {
		name = ukraine.92.e #ignore
		ai_chance = {
			factor = 0
		}
	}
}
#Hungary/Ukraine ask Germany for protection under Carpathian Ukraine - choice for Germany
country_event = {
	id = carpathian.7
	title = carpathian.7.t
	desc = carpathian.7.d
	picture = GFX_report_event_carphatian_ukraine

	is_triggered_only = yes

	option = {
		name = carpathian.7.a
		ai_chance = {
			factor = 70
			modifier = {
				FROM = { tag = UKR }
				UKR = {
					OR = { 
						has_government = democratic 
						has_government = communism
					}
				}
				factor = 0.1
			}
			modifier = {
				FROM = { tag = UKR }
				UKR = { 
					OR = {
						is_neighbor_of = CUA
						AND = {
							oun_low_power_of_melnyk_trigger = yes
							is_in_faction_with = GER	
						}
					}
				}
				factor = 3
			}
		}
		FROM = {
			country_event = { id = carpathian.8 hours = 6 }
		}
	}
	option = {
		name = carpathian.7.b
		ai_chance = {
			factor = 30
		}
		CUA = { country_event = carpathian.4 }
		FROM = {
			country_event = carpathian.9
		}
	}
}
# Germany accept hungaryan protectorate for CUA
country_event = {
	id = carpathian.8
	title = carpathian.8.t
	desc = carpathian.8.d
	picture = GFX_report_event_usa_election_generic
	
	is_triggered_only = yes

	option = {
		name = carpathian.8.a
		puppet = CUA
		if = {
			limit = { tag = HUN }
			CUA = { set_politics = { ruling_party = fascism elections_allowed = no } }
		}
		if = {
			limit = { tag = UKR }
			CUA = { set_politics = { ruling_party = democratic elections_allowed = yes } }
		}
	}
}
# Germany decline hungaryan protectorate for CUA
country_event = {
	id = carpathian.9
	title = carpathian.9.t
	desc = carpathian.9.d
	picture = GFX_report_event_usa_election_generic
	
	is_triggered_only = yes

	option = {
		name = carpathian.9.a
	}
}
# Hungary accepts protectorate - message for CUA
country_event = {
	id = carpathian.10
	title = carpathian.10.t
	desc = carpathian.10.d
	picture = GFX_report_event_usa_election_generic
	
	is_triggered_only = yes

	option = {
		name = carpathian.10.a
	}
}
# CUA demand autonomy from CZE at war time
country_event = {
	id = carpathian.11
	title = carpathian.11.t
	desc = carpathian.11.d
	picture = GFX_report_event_carphatian_ukraine
	
	trigger = {
		tag = CZE
		has_war = yes
		NOT = { has_war_with = UKR } 
		has_civil_war = no
		73 = {
			is_owned_and_controlled_by = CZE
		}
	}

	mean_time_to_happen = { days = 7 }

	fire_only_once = yes

	#accept
	option = {
		name = carpathian.11.a
		ai_chance = {
			factor = 80
		}
		add_stability = 0.05
		release_puppet = CUA
		CUA = { 
			set_politics = { ruling_party = neutrality elections_allowed = no } 
			inherit_technology = CZE
			set_research_slots = 2
		}
	}

	#reject
	option = {
		name = carpathian.11.b
		ai_chance = {
			factor = 20
		}
		add_political_power = -100
	}
}
# Request for support to Ukraine from CUA 
country_event = {
	id = carpathian.12
	title = carpathian.12.t
	desc = carpathian.12.d
	picture = GFX_report_event_avgustyn_voloshyn
	
	is_triggered_only = yes

	option = {
		name = carpathian.12.a
		trigger = {
			has_country_flag = UKR_shukhevych_is_available
		}
		ai_chance = {
			factor = 100
			modifier = {
				factor = 0.5
				has_war = yes
			}
		}
		add_manpower = -5000
		UKR_roman_shukhevych = { set_nationality = CUA }
		set_country_flag = UKR_send_shukhevych_to_transcarpathia
		CUA = { 
			set_country_flag = UKR_shukhevych_is_available
			country_event = { id = carpathian.13 days = 1 } 
		}
	}
	option = {
		name = carpathian.12.b
		ai_chance = {
			factor = 50
		}
		add_manpower = -3000
		CUA = { country_event = { id = carpathian.14 days = 1 } }
	}
	option = {
		name = carpathian.12.c
		ai_chance = {
			factor = 0
		}
		add_political_power = -10
		CUA = { country_event = { id = carpathian.15 days = 1 } }
	}
}
# Full support for CUA
country_event = {
	id = carpathian.13
	title = carpathian.13.t
	desc = carpathian.13.d
	
	is_triggered_only = yes

	option = {
		name = carpathian.13.a
		add_manpower = 5000
		army_experience = 10
	}
}
# Big support for CUA
country_event = {
	id = carpathian.14
	title = carpathian.14.t
	desc = carpathian.14.d
	
	is_triggered_only = yes

	option = {
		name = carpathian.13.a
		add_manpower = 3000
	}
}
# Limited support for CUA
country_event = {
	id = carpathian.15
	title = carpathian.15.t
	desc = carpathian.15.d
	
	is_triggered_only = yes

	option = {
		name = carpathian.13.a
	}
}
# Coming ukrainian weapons for CUA
country_event = {
	id = carpathian.16
	title = carpathian.16.t
	desc = carpathian.16.d
	picture = GFX_report_event_china_ledo_road

	is_triggered_only = yes

	option = {
		name = carpathian.16.a
	}
}
# Protection of Ukraine for CUA
country_event = {
	id = carpathian.17
	title = carpathian.17.t
	desc = carpathian.17.d
	picture = GFX_report_event_avgustyn_voloshyn
	
	is_triggered_only = yes

	#accept
	option = {
		name = carpathian.17.a
		ai_chance = {
			factor = 60
			modifier = {
				OR = {
					is_neighbor_of = CUA
					any_other_country = {
						is_in_faction_with = UKR
						is_neighbor_of = CUA
					}
				}
				factor = 2
			}
		}
		if = {
			limit = { CUA = { is_puppet = yes } }
			CUA = {
				OVERLORD = {
					country_event = { id = carpathian.20 hours = 12 }
				}
			}
		}
		puppet = CUA
		CUA = { 
			set_politics = { ruling_party = democratic elections_allowed = yes } 
			country_event = carpathian.18
		}
	}

	#reject
	option = {
		name = carpathian.17.b
		ai_chance = {
			factor = 40
			modifier = {
				OR = {
					CUA = { is_ai = no }
					CUA = { is_puppet = no }
					any_other_country = {
						has_war_with = UKR
						has_war_with = CUA
					}
				}
				factor = 0
			}
			modifier = {
				CUA = { has_war = yes }
				factor = 2
			}
			modifier = {
				CUA = {
					is_puppet = yes
					OVERLORD = {
						is_major = yes
					}
				}
				factor = 2
			}
		}
		CUA = { country_event = carpathian.19 }
	}
}
# Ukraine/Hungary accept protection - message for CUA
country_event = {
	id = carpathian.18
	title = carpathian.18.t
	desc = carpathian.18.d
	
	is_triggered_only = yes

	option = {
		name = carpathian.18.a
	}
}
# Ukraine/Hungary reject protection - message for CUA
country_event = {
	id = carpathian.19
	title = carpathian.19.t
	desc = carpathian.19.d
	
	is_triggered_only = yes

	option = {
		name = carpathian.19.a
	}
}
# Protection of Ukraine/Hungary for CUA - choice for former overlord
country_event = {
	id = carpathian.20
	title = carpathian.20.t
	desc = carpathian.20.d
	picture = GFX_report_event_carphatian_ukraine

	trigger = { NOT = { has_war_with = FROM } }
	
	is_triggered_only = yes

	#go war!
	option = {
		name = carpathian.20.a
		ai_chance = {
			factor = 40
			modifier = {
				factor = 2
				NOT = { FROM = { tag = CUA } } #for coup of Shukhevych
				strength_ratio = {
					tag = FROM
					ratio > 1
				}
			}
		}
		declare_war_on = {
			target = CUA
			type = annex_everything
		}
		FROM = { country_event = carpathian.32 }
	}

	#give up
	option = {
		name = carpathian.20.b
		ai_chance = {
			factor = 60
			modifier = {
				FROM = { is_in_faction = yes }
				factor = 1.5
			}
			modifier = {
				FROM = { has_war = no }
				factor = 1.5
			}
		}
	}
}
# Protection of Hungary for CUA
country_event = {
	id = carpathian.21
	title = carpathian.21.t
	desc = carpathian.21.d
	picture = GFX_report_event_generic_sign_treaty2
	
	is_triggered_only = yes

	#accept
	option = {
		name = carpathian.17.a
		ai_chance = {
			factor = 60
		}
		if = {
			limit = { CUA = { is_puppet = yes } }
			CUA = {
				OVERLORD = {
					country_event = { id = carpathian.20 hours = 12 }
				}
			}
		}
		puppet = CUA
		CUA = { 
			set_politics = { ruling_party = fascism elections_allowed = no } 
			country_event = carpathian.18
		}
	}

	#reject
	option = {
		name = carpathian.17.b
		ai_chance = {
			factor = 40
			modifier = {
				OR = {
					CUA = { is_ai = no }
					CUA = { is_puppet = no }
					any_other_country = {
						has_war_with = HUN
						has_war_with = CUA
					}
				}
				factor = 0
			}
			modifier = {
				CUA = { has_war = yes }
				factor = 2
			}
			modifier = {
				CUA = {
					is_puppet = yes
					OVERLORD = {
						is_major = yes
					}
				}
				factor = 2
			}
		}
		CUA = { country_event = carpathian.19 }
	}
}
# Request for transfer Presov kraj from CUA
country_event = {
	id = carpathian.22
	title = carpathian.22.t
	desc = carpathian.22.d
	picture = GFX_report_event_generic_sign_treaty2
	
	is_triggered_only = yes

	#accept
	option = {
		name = carpathian.22.a
		ai_chance = {
			factor = 50
			modifier = {
				OR = {
					tag = HUN
					tag = GER
				}
				factor = 3
			}
			modifier = {
				tag = CZE
				has_war = yes
				factor = 1.5
			}
		}
		CUA = {
			country_event = carpathian.23
			effect_tooltip = {
				transfer_state = 1049
			}
		}
	}

	#reject
	option = {
		ai_chance = {
			factor = 50
			modifier = {
				tag = UKR
				factor = 0
			}
			modifier = {
				tag = CZE
				factor = 1.5
			}
		}
		name = carpathian.22.b
		CUA = { country_event = carpathian.24 }
	}
}
# Request for transfer Presov kraj - success - message for CUA
country_event = {
	id = carpathian.23
	title = carpathian.23.t
	desc = carpathian.23.d
	
	is_triggered_only = yes

	option = {
		name = carpathian.23.a
		transfer_state = 1049
	}
}
# Request for transfer Presov kraj - denial - message for CUA
country_event = {
	id = carpathian.24
	title = carpathian.24.t
	desc = carpathian.24.d
	
	is_triggered_only = yes

	option = {
		name = carpathian.24.a
	}
}
# Capture of czech arms for Carpathian Sich
country_event = {
	id = carpathian.25
	title = carpathian.25.t
	desc = carpathian.25.d
	picture = GFX_report_event_capture_of_czech_arms
	
	trigger = {
		tag = CUA
		is_puppet_of = CZE
		69 = { is_owned_and_controlled_by = GER }
		has_war = no
		has_completed_focus = CUA_mobilization_of_carpathian_sich
	}

	mean_time_to_happen = { days = 20 }

	fire_only_once = yes

	option = {
		name = carpathian.25.a
		add_equipment_to_stockpile = { type = infantry_equipment amount = 50 producer = CZE }
		add_equipment_to_stockpile = { type = support_equipment amount = 20 producer = CZE }
	}
}
# Request to OVERLORD for send fighters for carpathian airforces
country_event = {
	id = carpathian.26
	title = carpathian.26.t
	desc = carpathian.26.d
	picture = GFX_report_event_fighters
	
	is_triggered_only = yes

	option = {
		name = carpathian.26.a
		set_country_flag = CUA_create_airforce
		custom_effect_tooltip = UKR_additional_decisions
	}
}
# Request to OVERLORD for send fighters - equipment was delivered
country_event = {
	id = carpathian.27
	title = carpathian.27.t
	desc = carpathian.27.d
	picture = GFX_report_event_fighters
	
	is_triggered_only = yes

	option = {
		name = carpathian.27.a
		air_experience = 25
	}
}
# CUA demand autonomy from CZE after Munich - possibility of change tag for player
country_event = {
	id = carpathian.28
	title = carpathian.28.t
	desc = carpathian.28.d
	picture = GFX_report_event_carphatian_ukraine
	
	trigger = {
		is_ai = no
	}

	is_triggered_only = yes

	#stay as CZE
	option = {
		name = carpathian.28.a
	}

	#go to CUA
	option = {
		name = carpathian.28.b
		CUA = { change_tag_from = ROOT }
	}
}
# Protection of Ukraine for CUA - request to allied OVERLORD of CUA
country_event = {
	id = carpathian.29
	title = carpathian.29.t
	desc = carpathian.29.d
	picture = GFX_report_event_avgustyn_voloshyn
	
	is_triggered_only = yes

	#accept
	option = {
		name = carpathian.29.a
		ai_chance = {
			factor = 60
			modifier = {
				tag = CZE
				factor = 0.5
			}
		}
		CUA = { 
			country_event = carpathian.30
		}
		UKR = { 
			country_event = carpathian.30
		}
	}

	#reject
	option = {
		name = carpathian.29.b
		ai_chance = {
			factor = 40
		}
		CUA = { country_event = carpathian.31 }
	}
}
# OVERLORD accept protection of Ukraine - message for CUA and UKR
country_event = {
	id = carpathian.30
	title = carpathian.30.t
	desc = carpathian.30.d
	
	is_triggered_only = yes

	option = {
		name = carpathian.30.a
		if = {
			limit = { tag = UKR }
			puppet = CUA
			CUA = { 
				set_politics = { ruling_party = democratic elections_allowed = yes }
				add_popularity = {
					ideology = democratic
					popularity = 0.50
				}
			}
		}
	}
}
# OVERLORD reject protection of Ukraine - message for CUA
country_event = {
	id = carpathian.31
	title = carpathian.31.t
	desc = carpathian.31.d
	
	is_triggered_only = yes

	option = {
		name = carpathian.31.a
	}
}
# Former OVERLORD ready for war - message for UKR
country_event = {
	id = carpathian.32
	title = carpathian.32.t
	desc = carpathian.32.d
	
	is_triggered_only = yes

	option = {
		name = carpathian.32.a
	}
}