########################################
# Events for Hungary
#
# written by Johan Andersson & Henrik Lohmander
########################################

namespace = flavor_hun
normal_or_historical_nations = yes

# Diet of 1445
country_event = {
	id = flavor_hun.1
	title = flavor_hun.1.t
	desc = flavor_hun.1.d
	picture = DEBATE_REPUBLICAN_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		has_regency = yes
		has_consort_regency = no
		is_lesser_in_union = no
		has_leader = "00000000000"
		is_year = 1445
		NOT = { is_year = 1470 }
		has_government_attribute = heir
	}

	mean_time_to_happen = {
		months = 6
	}

	option = {
		ai_chance = { factor = 50 }
		trigger = {
			HAB = { has_heir = "00000000000000" }
		}
		name = flavor_hun.1.a
		define_ruler = {
			name = "00000"
			dynasty = "00000"
			DIP = 5
			ADM = 4
			MIL = 5
			age = 39
			attach_leader = "00000000000"
		}
		if = {
			limit = {
				has_states_general_mechanic = yes
			}
			change_statists_vs_orangists = 1
		}
		if = {
			limit = {
				has_dlc = "Rights of Man"
			}
			hidden_effect = { add_ruler_personality_ancestor = { key = bold_fighter } }
		}
		define_heir = {
			name = "00000000000000"
			dynasty = "0000000000"
			culture = austrian
			adm = 3
			dip = 3
			mil = 2
			block_disinherit = yes
			birth_date = 1440.2.22
		}
		custom_tooltip = hun_ladislaus_postumus_warning_tooltip
		hidden_effect = { set_country_flag = hun_ladislaus_postumus_heir }
		every_country = {
			limit = {
				NOT = { tag = ROOT }
				dynasty = "0000000000"
			}
			add_opinion = {
				who = root
				modifier = hun_habsburgs_spurned
			}
		}
		add_estate_loyalty = {
			estate = estate_nobles
			loyalty = 10
		}
	}
	option = {
		name = flavor_hun.1.b
		trigger = {
			HAB = { has_heir = "00000000000000" }
		}
		ai_chance = { factor = 50 }
		add_stability_or_adm_power = yes
		define_heir = {
			name = "00000000000000"
			dynasty = "0000000000"
			culture = austrian
			adm = 3
			dip = 3
			mil = 2
			birth_date = 1440.2.22
		}
		hidden_effect = {
			define_ruler = {
				ADM = 0
				DIP = 0
				MIL = 0
				regency = yes
			}
		}
		custom_tooltip = hun_ladislaus_postumus_warning_tooltip
		hidden_effect = { set_country_flag = hun_ladislaus_postumus_heir }
		add_estate_loyalty = {
			estate = estate_nobles
			loyalty = -15
		}

	}
	option = {
		ai_chance = { factor = 1 }
		trigger = {
			HAB = { NOT = { has_heir = "00000000000000" } }
		}
		name = flavor_hun.1.c
		define_ruler = {
			name = "00000"
			dynasty = "00000"
			DIP = 5
			ADM = 4
			MIL = 5
			age = 39
			attach_leader = "00000000000"
		}
		define_heir = {
			name = "0000000"
			culture = hungarian
			dynasty = "00000"
			adm = 4
			dip = 5
			mil = 6
			claim = 50
			birth_date = 1443.2.23
		}
		hidden_effect = {
			set_country_flag = hun_matyas_already_existed
		}
		if = {
			limit = {
				has_states_general_mechanic = yes
			}
			change_statists_vs_orangists = 1
		}
		if = {
			limit = {
				has_dlc = "Rights of Man"
			}
			hidden_effect = { add_ruler_personality_ancestor = { key = bold_fighter } }
		}
		add_estate_loyalty = {
			estate = estate_nobles
			loyalty = 10
		}
	}
}

# Mattias Corvinus or a Habsburg king
country_event = {
	id = flavor_hun.2
	title = flavor_hun.2.t
	desc = flavor_hun.2.d
	picture = ELECTION_REPUBLICAN_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1450
		NOT = { is_year = 1457 }
		OR = {
			heir_age = 15
			has_heir = no
		}
		if = {
			limit = {
				has_heir = no
			}
			NOT = { has_country_flag = hun_matyas_already_existed }
		}
		has_regency = no
		is_subject = no
		HAB = {
			is_subject = no
			government = monarchy
			has_regency = no
		}
		has_government_attribute = heir
		NOT = { has_country_flag = hun_has_had_matthias_corvinus_event }
	}

	mean_time_to_happen = {
		months = 1
	}

	immediate = {
		hidden_effect = {
			set_country_flag = hun_has_had_matthias_corvinus_event #for missions
		}
	}

	option = {
		ai_chance = { factor = 75 }
		trigger = {
			OR = {
				has_heir = no
				has_heir = "00000000000000"
			}
		}
		name = flavor_hun.2.a
		remove_historical_friend = HAB
		HAB = { remove_historical_friend = HUN }
		hidden_effect = { clr_country_flag = hun_ladislaus_postumus_heir }
		define_heir = {
			name = "0000000"
			culture = hungarian
			dynasty = "00000"
			adm = 4
			dip = 5
			mil = 6
			claim = 50
			birth_date = 1443.2.23
		}
		if = {
			limit = {
				has_dlc = "Rights of Man"
			}
			hidden_effect = { add_heir_personality_ancestor = { key = just } }
		}
		set_country_flag = hun_keep_ladislaus_alive
		define_ruler = {
			regency = yes
			ADM = 2
			DIP = 2
			MIL = 2
		}
		HAB = {
			tooltip = {
				add_casus_belli = {
					target = HUN
					type = cb_restore_personal_union
					months = 60
				}
			}
			hidden_effect = {
				country_event = { id = flavor_hun.10 days = 1 }
			}
		}
	}
	option = {
		name = flavor_hun.2.b
		ai_chance = { factor = 25 }
		add_stability_or_adm_power = yes
		HUN = {
			if = {
				limit = { senior_union_with = CRO }
				inherit = CRO
			}
		}
		HAB = {
			create_union = HUN
			hidden_effect = {
				country_event = { id = flavor_hun.3 days = 1 }
			}
		}
	}
	option = {
		name = flavor_hun.2.c
		trigger = {
			has_heir = yes
			NOT = { has_heir = "00000000000000" }
			NOT = { dynasty = HAB }
		}
		ai_chance = {
			factor = 25
			modifier = {
				factor = 10
				heir_adm = 5
				heir_mil = 5
				heir_dip = 5
			}
		}
		remove_historical_friend = HAB
		HAB = { remove_historical_friend = HUN }
		kill_ruler = yes
		HAB = {
			tooltip = {
				add_casus_belli = {
					target = HUN
					type = cb_restore_personal_union
					months = 60
				}
			}
			hidden_effect = {
				country_event = { id = flavor_hun.10 days = 1 }
			}
		}
	}
}

# Ladislaus Postumus dies of Leukemia (copy of flavor_hun.2 with adaptations)
country_event = {
	id = flavor_hun.201
	title = flavor_hun.201.name
	desc = {
		trigger = {
			has_ruler = "Ladislaus Postumus I"
			has_heir = no
		}
		desc = flavor_hun.201.d.king_no_heir
	}
	desc = {
		trigger = {
			has_ruler = "Ladislaus Postumus I"
			has_heir = yes
		}
		desc = flavor_hun.201.d.king
	}
	desc = {
		trigger = {
			has_heir = "00000000000000"
		}
		desc = flavor_hun.201.d.heir
	}
	picture = DEATH_OF_HEIR_eventPicture

	mean_time_to_happen = {
		years = 20 #so it should happen about 1/3 of games
	}

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1450
		NOT = { is_year = 1457 }
		OR = {
			has_heir = "00000000000000"
			has_ruler = "Ladislaus Postumus I"
		}
		HAB = {
			OR = {
				has_heir = "00000000000000"
				has_ruler = "00000000000000"
			}
		}
		NOT = { has_country_flag = hun_has_had_matthias_corvinus_event }
		is_subject = no
	}

	immediate = {
		set_country_flag = hun_has_had_matthias_corvinus_event
	}

	option = { #Heir dies, get Matyas
		name = flavor_hun.201.a
		ai_chance = { factor = 1 }
		trigger = {
			has_heir = "00000000000000"
		}
		remove_historical_friend = HAB
		HAB = { remove_historical_friend = HUN }
		kill_heir = { allow_new_heir = no }
		define_heir = {
			name = "0000000"
			culture = hungarian
			dynasty = "00000"
			adm = 4
			dip = 5
			mil = 6
			claim = 50
			birth_date = 1443.2.23
		}
		if = {
			limit = {
				has_dlc = "Rights of Man"
			}
			hidden_effect = { add_heir_personality_ancestor = { key = just } }
		}
		HAB = {
			tooltip = {
				add_casus_belli = {
					target = HUN
					type = cb_restore_personal_union
					months = 60
				}
			}
			hidden_effect = {
				country_event = { id = flavor_hun.10 days = 1 }
			}
		}
	}
	option = { #Ruler dies, keep his heir
		name = flavor_hun.201.b
		ai_chance = { factor = 1 }
		trigger = {
			has_ruler = "Ladislaus Postumus I"
			has_heir = yes
		}
		kill_ruler = yes
	}
	option = { #Ruler dies with no heir, take a union
		name = flavor_hun.201.c
		ai_chance = { factor = 1 }
		trigger = {
			has_ruler = "Ladislaus Postumus I"
			has_heir = no
		}
		add_stability_or_adm_power = yes
		kill_ruler = yes
		HUN = {
			if = {
				limit = { senior_union_with = CRO }
				inherit = CRO
			}
		}
		HAB = {
			create_union = HUN
			hidden_effect = {
				country_event = { id = flavor_hun.3 days = 1 }
			}
		}
	}
	option = { #Ruler dies with no heir, take Matyas
		name = flavor_hun.201.d
		ai_chance = { factor = 3 }
		trigger = {
			has_ruler = "Ladislaus Postumus I"
			has_heir = no
		}
		remove_historical_friend = HAB
		HAB = { remove_historical_friend = HUN }
		define_heir = {
			name = "0000000"
			culture = hungarian
			dynasty = "00000"
			adm = 4
			dip = 5
			mil = 6
			claim = 50
			birth_date = 1443.2.23
		}
		if = {
			limit = {
				has_dlc = "Rights of Man"
			}
			hidden_effect = { add_heir_personality_ancestor = { key = just } }
		}
		kill_ruler = yes
		HAB = {
			tooltip = {
				add_casus_belli = {
					target = HUN
					type = cb_restore_personal_union
					months = 60
				}
			}
			hidden_effect = {
				country_event = { id = flavor_hun.10 days = 1 }
			}
		}
	}
}

# Union with Hungary
country_event = {
	id = flavor_hun.3
	title = flavor_hun.3.t
	desc = flavor_hun.3.d
	picture = DIPLOMACY_eventPicture

	fire_only_once = yes
	is_triggered_only = yes

	option = {
		name = flavor_hun.3.a
		add_legitimacy = 5
		add_prestige = 5
	}
}

# The magyar Throne
country_event = {
	id = flavor_hun.10
	title = flavor_hun.10.t
	desc = flavor_hun.10.d
	picture = DIPLOMACY_eventPicture

	is_triggered_only = yes

	option = {
		name = flavor_hun.10.a
		if = { #Only add if we haven't got one already.
			limit = {
				has_casus_belli = {
					type = cb_restore_personal_union
					target = HUN
				}
			}
			tooltip = {
				add_casus_belli = {
					target = HUN
					type = cb_restore_personal_union
					months = 120
				}
			}
		}
		else = {
			add_casus_belli = {
				target = HUN
				type = cb_restore_personal_union
				months = 120
			}
		}
	}
}

# Administrative and Social Reforms of Mathias Corvinus
country_event = {
	id = flavor_hun.4
	title = flavor_hun.4.t
	desc = flavor_hun.4.d
	picture = REFORM_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1466
		NOT = { is_year = 1470 }
		has_regency = no
		dynasty = "00000"
	}

	mean_time_to_happen = {
		months = 18
	}

	option = {
		ai_chance = { factor = 50 }
		name = flavor_hun.4.a
		if = {
			limit = {
				NOT = { has_completed_all_reforms_trigger = yes }
			}
			add_reform_progress_small_effect = yes
		}
		add_adm_power = 100
		random_owned_province = {
			add_base_tax = 1
			add_base_production = 1
		}
	}
	option = {
		ai_chance = { factor = 50 }
		name = flavor_hun.4.b
		if = {
			limit = {
				NOT = { has_completed_all_reforms_trigger = yes }
			}
			add_reform_progress_small_effect = yes
		}
		add_dip_power = 100
		random_owned_province = {
			add_base_manpower = 1
			add_base_production = 1
		}
	}
}

# Academia Istropolitana
country_event = {
	id = flavor_hun.5
	title = flavor_hun.5.t
	desc = flavor_hun.5.d
	picture = UNIVERSITY_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1465
		has_regency = no
		owns = 1772 #Pressburg
		dynasty = "00000"
		religion = catholic
	}

	mean_time_to_happen = {
		months = 12
	}

	option = {
		name = flavor_hun.5.a
		add_prestige = 10
		if = {
			limit = {
				NOT = { has_completed_all_reforms_trigger = yes }
			}
			add_reform_progress_small_effect = yes
		}
		add_papal_influence = 10
		1772 = {
			add_base_production = 1
		}
	}
}

# Printing Press in Buda
country_event = {
	id = flavor_hun.6
	title = flavor_hun.6.t
	desc = flavor_hun.6.d
	picture = INVENTION_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1473
		NOT = { is_year = 1500 }
	}

	mean_time_to_happen = {
		months = 12
	}

	option = {
		name = flavor_hun.6.a
		add_adm_power = 50
	}
}

# Decline of Royal Power
country_event = {
	id = flavor_hun.7
	title = flavor_hun.7.t
	desc = flavor_hun.7.d
	picture = COURT_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1490
		NOT = { is_year = 1530 }
		is_neighbor_of = TUR
		has_regency = no
		NOT = { ADM = 5 }
	}

	mean_time_to_happen = {
		months = 12
	}

	option = {
		name = flavor_hun.7.a
		add_ruler_modifier = {
			name = hun_power_to_magnates
		}
		add_estate_loyalty = {
			estate = estate_nobles
			loyalty = 15
		}
	}
	option = {
		name = flavor_hun.7.b
		add_stability = -3
		random_owned_province = {
			noble_rebels = 2
		}
		add_estate_loyalty = {
			estate = estate_nobles
			loyalty = -25
		}

	}
}

# Elizabeth Bathory
country_event = {
	id = flavor_hun.8
	title = flavor_hun.8.t
	desc = flavor_hun.8.d
	picture = ANGRY_MOB_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1614
		NOT = { is_year = 1620 }
		government = monarchy
	}

	mean_time_to_happen = {
		months = 12
	}

	option = {
		name = flavor_hun.8.a
		if = {
			limit = { is_lesser_in_union = yes }
			add_prestige = -10
		}
		if = {
			limit = { is_lesser_in_union = no }
			add_legitimacy = -10
		}
	}
	option = {
		name = flavor_hun.8.b
		add_stability = -1
	}
}

#Advance of the Turks.
country_event = {
	id = flavor_hun.9
	title = flavor_hun.9.t
	desc = flavor_hun.9.d
	picture = BATTLE_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		truce_with = TUR
		exists = HAB
		HAB = {
			is_emperor = yes
		}
		TUR = {
			any_owned_province = {
				OR = {
					area = alfold_area
					area = transdanubia_area
				}
				previous_owner = HUN
			}
		}
		NOT = { is_year = 1650 }
	}

	mean_time_to_happen = {
		months = 12
	}

	option = {
		name = flavor_hun.9.a
		every_owned_province = {
			limit = {
				NOT = { is_core = TRA }
				OR = {
					area = transylvania_area
					area = southern_transylvania_area
					area = alfold_area #Additional just to be sure:
					area = wallachia_area
					area = moldavia_area
					area = bulgaria_area
					area = red_ruthenia_area
					region = ruthenia_region
					region = crimea_region
				}
			}
			add_core = TRA
		}
		every_owned_province = {
			limit = {
				NOT = { is_core = TRA }
			}
			add_permanent_claim = HAB
		}
	}

}

#magyar Peasant Revolt
#György Dózsa
country_event = {
	id = flavor_hun.11
	title = flavor_hun.11.t
	desc = flavor_hun.11.d
	picture = BATTLE_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		NOT = { stability = 3 }
		has_ruler_modifier = hun_power_to_magnates
	}

	mean_time_to_happen = {
		months = 60
	}

	immediate = {
		hidden_effect = {
			random_owned_province = {
				limit = {
					is_capital = no
					culture = hungarian
				}
				set_province_flag = hun_peasant_revolt
				random_neighbor_province = {
					limit = {
						is_capital = no
					}
					set_province_flag = hun_peasant_revolt2
				}
				random_neighbor_province = {
					limit = {
						is_capital = no
						not = { has_province_flag = hun_peasant_revolt }
					}
					set_province_flag = hun_peasant_revolt2
				}
			}
		}
	}

	option = {
		name = flavor_hun.11.a #Ok.
		random_owned_province = {
			limit = { has_province_flag = hun_peasant_revolt }
			spawn_rebels = {
				type = anti_tax_rebels
				size = 2
				leader = "Gyrgy Dzsa"
			}
			clr_province_flag = hun_peasant_revolt
		}
		every_owned_province = {
			limit = { has_province_flag = hun_peasant_revolt2 }
			spawn_rebels = {
				type = anti_tax_rebels
				size = 1
			}
			clr_province_flag = hun_peasant_revolt2
		}
	}
}

#Tamás Bakócz
country_event = {
	id = flavor_hun.12
	title = flavor_hun.12.t
	desc = flavor_hun.12.d
	picture = ADVISOR_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1490
		NOT = { is_year = 1520 }
	}

	mean_time_to_happen = {
		months = 90
	}

	option = {
		name = flavor_hun.12.a
		add_adm_power = 100
		if = {
			limit = {
				NOT = { has_completed_all_reforms_trigger = yes }
			}
			add_reform_progress_small_effect = yes
		}
		add_prestige = 5
		define_advisor = {
			type = statesman
			name = "Tams Bakcz"
			culture = hungarian
			discount = yes
			skill = 2
		}
		if = {
			limit = {
				exists = HAB
			}
			HAB = {
				add_opinion = {
					who = HUN
					modifier = hun_bakocz_foreign_policy
				}
			}
			hidden_effect = {
				add_opinion = {
					who = HAB
					modifier = hun_bakocz_foreign_policy
				}
			}
		}

	}
}


#The Catholics in Bohemia seek our aid
country_event = {
	id = flavor_hun.13
	title = flavor_hun.13.t
	desc = flavor_hun.13.d
	picture = BAD_WITH_MONARCH_eventPicture

	fire_only_once = yes

	is_triggered_only = yes

	option = {
		name = flavor_hun.13.a
		ai_chance = {
			factor = 90
			modifier = {
				factor = 0
				alliance_with = BOH
			}
			modifier = {
				factor = 0
				is_subject_of = BOH
			}
			modifier = {
				factor = 0
				overlord_of = BOH
			}
			modifier = {
				factor = 0.1
				is_at_war = yes
			}
		}
		add_opinion = {
			who = BOH
			modifier = hun_crowned_by_rebels
		}
		add_prestige = 10
		if = {
			limit = {
				265 = { #Moravia
					owned_by = BOH
				}
			}
			265 = { add_permanent_claim = HUN }
		}
		if = {
			limit = {
				4237 = { #Moravia
					owned_by = BOH
				}
			}
			4237 = { add_permanent_claim = HUN }
		}
		if = {
			limit = {
				silesia_area = {
					country_or_non_sovereign_subject_holds = BOH
				}
			}
			silesia_area = {
				limit = { country_or_non_sovereign_subject_holds = BOH }
				add_permanent_claim = HUN
			}
		}
		BOH = {
			265 = {
				spawn_rebels = {
					type = heretic_rebels
					size = 1
					friend = HUN
				}
			}
			2970 = {
				spawn_rebels = {
					type = heretic_rebels
					size = 1
					friend = HUN
				}
			}
			hidden_effect = {
				country_event = { id = flavor_hun.14 }
			}
		}
	}
	option = {
		name = flavor_hun.13.b
		ai_chance = {
			factor = 10
		}
		add_prestige = -10
		reverse_add_opinion = {
			who = BOH
			modifier = hun_refused_to_help_rebels
		}
		BOH = {
			add_prestige = 10
			265 = {
				spawn_rebels = {
					type = heretic_rebels
					size = 1
				}
			}
			2970 = {
				spawn_rebels = {
					type = heretic_rebels
					size = 1
				}
			}
		}
	}
}

#Crowning of X
country_event = {
	id = flavor_hun.14
	title = flavor_hun.14.t
	desc = flavor_hun.14.d
	picture = BAD_WITH_MONARCH_eventPicture

	fire_only_once = yes

	is_triggered_only = yes

	option = {
		name = flavor_hun.14.a
		add_opinion = {
			who = FROM
			modifier = hun_crowned_by_rebels
		}
		tooltip = {
			if = {
				limit = {
					265 = { #Moravia
						owned_by = BOH
					}
				}
				265 = { add_permanent_claim = HUN }
			}
			if = {
				limit = {
					4237 = { #Moravia
						owned_by = BOH
					}
				}
				4237 = { add_permanent_claim = HUN }
			}
			if = {
				limit = {
					silesia_area = {
						country_or_non_sovereign_subject_holds = BOH
					}
				}
				silesia_area = {
					limit = { country_or_non_sovereign_subject_holds = BOH }
					add_permanent_claim = HUN
				}
			}
		}
	}
}

#Banditry in Slovakia

country_event = {
	id = flavor_hun.15
	title = flavor_hun.15.t
	desc = flavor_hun.15.d
	picture = BAD_WITH_MONARCH_eventPicture


	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_at_war = no
		has_truce = no
		slovakia_area = {
			owned_by = ROOT
		}
	}

	mean_time_to_happen = {
		months = 39
	}

	immediate = {
		hidden_effect = {
			set_country_flag = hun_had_mercenaries_in_slovakia
		}
	}

	option = {
		name = flavor_hun.15.a #We must crush these bandits!
		slovakia_area = {
			limit = { owned_by = ROOT }
			add_province_modifier = {
				name = "hun_curtailing_banditry_in_upper_hungary"
				duration = 3650
			}
			add_devastation = 25
		}
		random_owned_province = {
			limit = {
				area = slovakia_area
				NOT = { fort_level = 1 }
			}
			spawn_rebels = {
				type = nationalist_rebels
				size = 2
				leader = "Jan Jiskra z Brandsa"
			}
		}
	}
	option = {
		name = flavor_hun.15.b #Leave it to the local lords to handle.
		slovakia_area = {
			limit = { owned_by = ROOT }
			add_province_modifier = {
				name = "hun_banditry_in_upper_hungary"
				duration = 3650
			}
			add_devastation = 50
		}
	}
}


#Black Army
country_event = {
	id = flavor_hun.16
	title = flavor_hun.16.t
	desc = flavor_hun.16.d
	picture = SIEGE_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		has_regency = no
		OR = {
			has_country_flag = hun_had_mercenaries_in_slovakia
			is_year = 1455
		}
		NOT = { is_year = 1470 }
	}

	mean_time_to_happen = {
		months = 45

		modifier = {
			factor = 0.5
			has_country_flag = hun_had_mercenaries_in_slovakia
		}
	}

	option = {
		name = flavor_hun.16.a
		add_years_of_income = -0.75
		add_country_modifier = {
			name = hun_black_army
			duration = -1
		}
		custom_tooltip = flavor_hun.16.a.tt
		if = {
			limit = {
				has_estate = estate_nobles
			}
			custom_tooltip = flavor_hun.16.a.cossacks.tt
		}
	}
	option = {
		name = flavor_hun.16.b
		add_mil_power = 50
		if = {
			limit = {
				has_estate = estate_nobles
			}
			add_estate_loyalty = {
				estate = estate_nobles
				loyalty = 15
			}
		}
	}
}

#Maintain the Black Army?
country_event = {
	id = flavor_hun.17
	title = flavor_hun.17.t
	desc = flavor_hun.17.d
	picture = BAD_WITH_MONARCH_eventPicture

	is_triggered_only = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		has_regency = no
		has_country_modifier = hun_black_army
		NOT = { has_reform = black_army_reform }
	}

	option = {
		name = flavor_hun.17.a
		remove_country_modifier = hun_black_army
		add_prestige = -10
		if = {
			limit = {
				has_estate = estate_nobles
			}
			custom_tooltip = abolishing_black_army_tooltip
			add_estate_loyalty = {
				estate = estate_nobles
				loyalty = 10
			}
			hidden_effect = {
				add_estate_influence_modifier = {
						estate = estate_nobles
						desc = EST_VAL_ABOLISHED_BLACK_ARMY
						influence = 5
						duration = 3650
				}
			}
		}
	}
	option = {
		name = flavor_hun.17.b
		add_prestige = 10
		if = {
			limit = {
				has_estate = estate_nobles
			}
			add_estate_loyalty = {
				estate = estate_nobles
				loyalty = -5
			}
		}
	}
}

#End of the Black Army
country_event = {
	id = flavor_hun.18
	title = flavor_hun.18.t
	desc = flavor_hun.18.d
	picture = MILITARY_CAMP_eventPicture

	fire_only_once = yes

	trigger = {
		current_age = age_of_reformation
		has_country_modifier = hun_black_army
		NOT = { has_reform = black_army_reform }
	}

	mean_time_to_happen = {
		months = 12
	}

	option = {
		name = flavor_hun.18.a
		remove_country_modifier = hun_black_army
		add_army_tradition = 20
		add_absolutism = 10
		add_mil_power = 75
		if = {
			limit = {
				has_estate = estate_nobles
			}
			custom_tooltip = end_of_black_army_tooltip
		}
	}
	option = { # new option, keep the black army
		name = flavor_hun.18.b
		trigger = {
			is_subject = no
			OR = {
				has_dlc = "Emperor"
				has_dlc = "Domination"
			}
		}
		set_country_flag = black_army_reform_flag
		add_government_reform = black_army_reform
		if = {
			limit = {
				has_estate = estate_nobles
			}
			add_estate_loyalty = {
				estate = estate_nobles
				loyalty = -15
			}
		}
	}
}

#Mutiny in the Black Army
country_event = {
	id = flavor_hun.19
	title = flavor_hun.19.t
	desc = flavor_hun.19.d
	picture = MILITARY_CAMP_eventPicture

	trigger = {
		has_country_modifier = hun_black_army
		OR = {
			NOT = { has_country_flag = had_black_army_mutiny }
			had_country_flag = { flag = had_black_army_mutiny days = 7300 }
		}
		is_at_war = yes
		num_of_cities = 5
		any_owned_province = {
			is_capital = no
			is_in_capital_area = yes
			NOT = { has_province_modifier = mercenary_concessions }
		}
		num_of_mercenaries = 1
		NOT = { has_reform = black_army_reform }
	}

	immediate = {
		hidden_effect = {
			set_country_flag = had_black_army_mutiny
			random_owned_province = {
				limit = {
					is_capital = no
					is_in_capital_area = yes
					NOT = { has_province_modifier = mercenary_concessions }
				}
				save_event_target_as = mercenary_mutiny_province
			}
			random_owned_province = {
				limit = {
					is_capital = no
					is_in_capital_area = yes
					development = 6
					NOT = { has_province_modifier = mercenary_concessions }
				}
				save_event_target_as = mercenary_mutiny_province
			}
			random_owned_province = {
				limit = {
					is_capital = no
					is_in_capital_area = yes
					development = 10
					NOT = { has_province_modifier = mercenary_concessions }
				}
				save_event_target_as = mercenary_mutiny_province
			}
		}
	}

	mean_time_to_happen = {
		months = 80
	}

	option = {
		name = flavor_hun.19.a
		event_target:mercenary_mutiny_province = {
			spawn_rebels = {
				type = noble_rebels
				size = 2
			}
			add_devastation = 35
		}
	}
	option = {
		name = flavor_hun.19.b
		event_target:mercenary_mutiny_province = {
			add_province_modifier = {
				name = "mercenary_concessions"
				duration = 7300
			}
		}
	}
}


#Walls of Belgrade and the Ottoman Threat
country_event = {
	id = flavor_hun.20
	title = flavor_hun.20.t
	desc = flavor_hun.20.d
	picture = MILITARY_CAMP_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		owns = 4239
		is_year = 1450
		NOT = { is_year = 1500 }
		OR = { #Big threathening power in the south, probably Ottomans
			AND = {
				is_neighbor_of = TUR
				NOT = { num_of_cities = TUR }
			}
			any_rival_country = {
				exists = yes
				capital_scope = {
					OR = {
						region = balkan_region
						region = anatolia_region
					}
				}
			}
		}
	}

	immediate = {
		hidden_effect = { #Used in Loc
			if = {
				limit = {
					any_neighbor_country = {
						tag = TUR
						num_of_cities = ROOT
					}
				}
				TUR = { save_event_target_as = threat_to_hungary }
				else = {
					random_rival_country = {
						limit = {
							capital_scope = {
								OR = {
									region = balkan_region
									region = anatolia_region
								}
							}
						}
						save_event_target_as = threat_to_hungary
					}
				}
			}
			4239 = { save_event_target_as = belgrade_localized }
		}
	}

	mean_time_to_happen = {
		months = 150
		modifier = {
			factor = 0.75
			truce_with = TUR
		}
		modifier = {
			factor = 0.5
			war_with = TUR
		}
	}

	option = {
		name = flavor_hun.20.a
		add_years_of_income = -0.75
		add_country_modifier = {
			name = "hun_frontier_fortresses"
			duration = 10950
		}
	}
	option = {
		name = flavor_hun.20.b
		4239 = {
			add_province_modifier = {
				name = "hun_poorly_maintained_fortifications"
				duration = 5475
			}
		}
		if = {
			limit = {
				has_estate = estate_nobles
			}
			add_estate_loyalty = {
				estate = estate_nobles
				loyalty = 10
			}
		}
	}
}


#Fall of Serbia
country_event = {
	id = flavor_hun.21
	title = flavor_hun.21.t
	desc = flavor_hun.21.d
	picture = BORDER_TENSION_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		owns = 4239
		religion_group = christian
		NOT = { exists = SER }
		NOT = { alliance_with = TUR }
		4239 = {
			culture = serbian
			any_neighbor_province = { #Best not have this event triggering from conquering Serbia yourself...
				owned_by = TUR
				culture = serbian
			}
		}
	}

	immediate = {
		hidden_effect = {
			4239 = { save_event_target_as = belgrade_localized }
		}
	}

	mean_time_to_happen = {
		months = 48
	}

	option = {
		name = flavor_hun.21.a
		4239 = {
			add_devastation = 25 #Chaos
			add_base_manpower = 2
			add_base_tax = 1
			add_base_production = 1
			if = {
				limit = {
					NOT = { religion = orthodox }
				}
				change_religion = orthodox
			}
		}
	}
}

#Synod of Debrecen
country_event = {
	id = flavor_hun.22
	title = flavor_hun.22.t
	desc = flavor_hun.22.d
	picture = BORDER_TENSION_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			OR = {
				tag = HUN
				was_tag = HUN
			}
			tag = TRA
		}
		religion = catholic
		is_year = 1560
		NOT = { is_year = 1570 }
		is_religion_enabled = reformed
		owns = 1953
	}

	immediate = {
		hidden_effect = {
			if = {
				limit = {
					1953 = {
						religion = catholic
					}
				}
				1953 = {
					set_province_flag = synod_of_debrecen_flag_start
					save_event_target_as = debrecen_province
				}
				else = {
					random_owned_province = {
						limit = {
							NOT = { religion = reformed }
						}
						set_province_flag = synod_of_debrecen_flag_start
						save_event_target_as = debrecen_province
					}
				}
			}
			random_owned_province = {
				limit = {
					NOT = { has_province_flag = synod_of_debrecen_flag_start }
					NOT = { has_province_modifier = religious_zeal_at_conv }
					is_in_capital_area = yes
					NOT = { religion = reformed }
					any_neighbor_province = {
						OR = {
							religion = reformed
							has_province_flag = synod_of_debrecen_flag_start
						}
					}
				}
				set_province_flag = synod_of_debrecen_flag
			}
			random_owned_province = {
				limit = {
					NOT = { has_province_flag = synod_of_debrecen_flag_start }
					NOT = { has_province_flag = synod_of_debrecen_flag }
					NOT = { has_province_modifier = religious_zeal_at_conv }
					is_in_capital_area = yes
					NOT = { religion = reformed }
					any_neighbor_province = {
						OR = {
							religion = reformed
							has_province_flag = synod_of_debrecen_flag
							has_province_flag = synod_of_debrecen_flag_start
						}
					}
				}
				set_province_flag = synod_of_debrecen_flag
			}
			random_owned_province = {
				limit = {
					NOT = { has_province_flag = synod_of_debrecen_flag_start }
					NOT = { has_province_flag = synod_of_debrecen_flag }
					NOT = { has_province_modifier = religious_zeal_at_conv }
					is_in_capital_area = yes
					NOT = { religion = reformed }
					any_neighbor_province = {
						OR = {
							religion = reformed
							has_province_flag = synod_of_debrecen_flag
							has_province_flag = synod_of_debrecen_flag_start
						}
					}
				}
				set_province_flag = synod_of_debrecen_flag
			}
			random_province = {
				limit = {
					is_reformation_center = yes
					religion = reformed
				}
				save_event_target_as = reformed_origin #Used in localization
			}
		}
	}

	mean_time_to_happen = {
		months = 30
	}

	option = {
		name = flavor_hun.22.a
		random_owned_province = {
			limit = { has_province_flag = synod_of_debrecen_flag_start }
			spawn_rebels = {
				type = reformed_rebels
				size = 1
			}
			change_religion = reformed
			clr_province_flag = synod_of_debrecen_flag_start
		}
		every_owned_province = {
			limit = { has_province_flag = synod_of_debrecen_flag }
			change_religion = reformed
			clr_province_flag = synod_of_debrecen_flag
		}
		add_papal_influence = 10
		if = {
			limit = { exists = PAP }
			add_opinion = {
				who = PAP
				modifier = hun_invited_jesuits
			}
			PAP = {
				add_opinion = {
					who = ROOT
					modifier = hun_invited_jesuits
				}
			}
		}
		add_country_modifier = {
			name = hun_counter_reformation
			duration = 7300
		}
		if = {
			limit = {
				has_estate = estate_church
			}
			add_estate_loyalty = {
				estate = estate_church
				loyalty = 10
			}
		}
	}
	option = {
		name = flavor_hun.22.b
		every_owned_province = {
			limit = {
				OR = {
					has_province_flag = synod_of_debrecen_flag
					has_province_flag = synod_of_debrecen_flag_start
				}
			}
			change_religion = reformed
			add_permanent_province_modifier = {
				name = hun_reformed_colleges
				duration = 7300
			}
			clr_province_flag = synod_of_debrecen_flag
			clr_province_flag = synod_of_debrecen_flag_start
		}
		if = {
			limit = {
				has_estate = estate_church
			}
			add_estate_loyalty = {
				estate = estate_church
				loyalty = -10
			}
		}
	}
}

#Támas Nádasdy
country_event = {
	id = flavor_hun.23
	title = flavor_hun.23.t
	desc = flavor_hun.23.d
	picture = ADVISOR_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1530
		NOT = { is_year = 1555 }
	}


	mean_time_to_happen = {
		months = 75
	}

	option = {
		name = flavor_hun.23.a
		add_adm_power = 50
		define_advisor = {
			name = "Tams Ndasdy"
			culture = hungarian
			type = master_of_mint
			skill = 3
			discount = yes
		}
	}
	option = {
		name = flavor_hun.23.b
		add_dip_power = 50
		define_advisor = {
			name = "Tams Ndasdy"
			culture = hungarian
			type = diplomat
			skill = 3
			discount = yes
		}
	}
	option = {
		name = flavor_hun.23.c
		add_mil_power = 50
		define_advisor = {
			name = "Tams Ndasdy"
			type = fortification_expert
			culture = hungarian
			skill = 3
			discount = yes
		}
	}
}

#Voivodes of Transylvania Abolish their title
#Triggers after the advance of the Turks
country_event = {
	id = flavor_hun.24
	title = flavor_hun.24.t
	desc = flavor_hun.24.d
	picture = BAD_WITH_MONARCH_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		exists = HAB
		is_subject = no
		government = monarchy
		NOT = { exists = TRA }
		NOT = { num_of_cities = 25 }
		any_owned_province = {
			is_core = TRA
		}
		any_owned_province = {
			is_permanent_claim = HAB
		}
		TUR = {
			owns = 153 #Pest
			num_of_cities = HAB #Ottomans are bigger than Austria
		}
		HAB = {
			num_of_cities = HUN #Austria is bigger than Hungary
		}
		capital_scope = {
			OR = {
				area = transdanubia_area
				area = slovakia_area
				area = croatia_area
			}
			is_permanent_claim = HAB
		}
		calc_true_if = {
			all_owned_province = {
				is_core = TRA
			}
			amount = 6
		}
	}


	mean_time_to_happen = {
		months = 24
	}

	option = {
		name = flavor_hun.24.a
		ai_chance = { factor = 25 }
		set_global_flag = hungary_inherited
		change_tag = TRA
		on_change_tag_effect = yes
		define_ruler = {
			name = "00000"
			culture = hungarian
			dynasty = "00000"
			claim = 95
			change_adm = 4
			change_dip = 3
			change_mil = 2
			max_random_adm = 5
			max_random_dip = 4
			max_random_mil = 3
		}
		if = {
			limit = {
				has_states_general_mechanic = yes
			}
			change_statists_vs_orangists = 1
		}
		every_owned_province = {
			limit = {
				is_permanent_claim = HAB
			}
			cede_province = HAB
			hidden_effect = {
				add_core = HAB
				add_core = HUN
				set_province_flag = royal_hungary_flag
			}
		}
		HAB = {
			country_event = { id = flavor_hun.25 }
		}
		if = {
			limit = { has_custom_ideas = no }
			country_event = { id = ideagroups.1 } #Swap Ideas
		}
	}
	option = {
		name = flavor_hun.24.b
		ai_chance = { factor = 75 }
		release = TRA
	}
}

#magyar Estates elect X to lead them
country_event = {
	id = flavor_hun.25
	title = flavor_hun.25.t
	desc = flavor_hun.25.d
	picture = BORDER_TENSION_eventPicture

	fire_only_once = yes

	is_triggered_only = yes

	option = {
		name = flavor_hun.25.a
		ai_chance = { factor = 100 }
		hidden_effect = {
			every_owned_province = {
				limit = {
					has_province_flag = royal_hungary_flag
				}
				clr_province_flag = royal_hungary_flag
				add_province_modifier = {
					name = "hab_royal_hungary"
					duration = 18250
				}
			}
		}
		custom_tooltip = flavor_hun.25.a.tt
		tooltip = {
			add_country_modifier = { #Consciously set to "wrong" scope to give prettier tooltip.
				name = "hab_royal_hungary"
				duration = 18250
			}
		}
	}
	option = {
		name = flavor_hun.25.b
		ai_chance = { factor = 0 }
		every_owned_province = {
			limit = {
				has_province_flag = royal_hungary_flag
			}
			clr_province_flag = royal_hungary_flag
		}
		release = HUN
		HAB = { create_union = HUN }
	}
}

#Statuta Valachorum
country_event = {
	id = flavor_hun.26
	title = flavor_hun.26.t
	desc = flavor_hun.26.d
	picture = BORDER_TENSION_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			AND = {
				OR = {
					tag = HUN
					was_tag = HUN
				}
				is_lesser_in_union = no
			}
			senior_union_with = HUN
		}
		exists = TUR
		is_neighbor_of = TUR
		NOT = { num_of_cities = TUR }
		NOT = { alliance_with = TUR }
		NOT = { is_subject_of = TUR }
		any_owned_province = {
			region = balkan_region
			any_neighbor_province = {
				owned_by = TUR
			}
		}
	}

	immediate = {
		hidden_effect = {
			random_owned_province = {
				limit = { region = balkan_region }
				set_province_flag = hun_military_frontier
				if = {
					limit = {
						OR = {
							religion = catholic
							religion_group = muslim
						}
					}
					random_list = {
							40 = { set_province_flag = will_be_orthodox_flag }
							10 = { set_province_flag = will_be_reformed_flag }
							10 = { set_province_flag = will_be_protestant_flag }
							40 = { }
					}
				}
			}
			random_owned_province = {
				limit = {
					region = balkan_region
					NOT = { has_province_flag = hun_military_frontier }
				}
				if = {
					limit = {
						OR = {
							religion = catholic
							religion_group = muslim
						}
					}
					random_list = {
							40 = { set_province_flag = will_be_orthodox_flag }
							15 = { set_province_flag = will_be_reformed_flag }
							15 = { set_province_flag = will_be_protestant_flag }
							30 = { }
					}
				}
				set_province_flag = hun_military_frontier
			}
			random_owned_province = {
				limit = {
					region = balkan_region
					NOT = { has_province_flag = hun_military_frontier }
				}
				if = {
					limit = {
						OR = {
							religion = catholic
							religion_group = muslim
						}
					}
					random_list = {
							40 = { set_province_flag = will_be_orthodox_flag }
							10 = { set_province_flag = will_be_reformed_flag }
							10 = { set_province_flag = will_be_protestant_flag }
							40 = { }
					}
				}
				set_province_flag = hun_military_frontier
			}
		}
	}

	mean_time_to_happen = {
		months = 120
	}

	option = {
		name = flavor_hun.26.a
		ai_chance = { factor = 75 }
		every_owned_province = {
			limit = {
				has_province_flag = hun_military_frontier
			}
			add_base_manpower = 2
			if = {
				limit = {
					has_province_flag = will_be_orthodox_flag
					NOT = { religion = orthodox }
				}
				clr_province_flag = will_be_orthodox_flag
				change_religion = orthodox
			}
			if = {
				limit = {
					has_province_flag = will_be_reformed_flag
					NOT = { religion = reformed }
				}
				clr_province_flag = will_be_reformed_flag
				if = {
					limit = { is_religion_enabled = reformed }
					change_religion = reformed
					else = {
						change_religion = orthodox
					}
				}
			}
			if = {
				limit = {
					has_province_flag = will_be_protestant_flag
					NOT = { religion = protestant }
				}
				clr_province_flag = will_be_protestant_flag
				if = {
					limit = { is_religion_enabled = protestant }
					change_religion = protestant
					else = {
						change_religion = orthodox
					}
				}
			}
			add_province_modifier = {
				name = hun_military_frontier_modifier
				duration = 10950
			}
			clr_province_flag = hun_military_frontier
		}
	}
	option = {
		name = flavor_hun.26.b
		ai_chance = { factor = 25 }
		every_owned_province = {
			limit = {
				has_province_flag = hun_military_frontier
			}
			add_devastation = 25
			add_province_modifier = {
				name = "hun_great_balkan_migration"
				duration = 10950
			}
			clr_province_flag = hun_military_frontier
			clr_province_flag = will_be_protestant_flag
			clr_province_flag = will_be_reformed_flag
			clr_province_flag = will_be_orthodox_flag
		}
	}
}

# Romanian Revolt
country_event = {
	id = flavor_hun.27
	title = flavor_hun.27.t
	desc = flavor_hun.27.d
	picture = ANGRY_MOB_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			OR = {
				tag = HUN
				was_tag = HUN
			}
			tag = TRA
		}
		NOT = { primary_culture = romanian }
		is_year = 1750
		any_owned_province = {
			culture = transylvanian
			is_capital = no
		}
	}

	mean_time_to_happen = {
		months = 210
	}

	option = {
		name = flavor_hun.27.a
		every_owned_province = {
			limit = {
				OR = {
					culture = romanian
					culture = transylvanian
				}
			}
			if = {
				limit = {
					NOT = { province_id = 158 }
					NOT = { province_id = 4128 }
				}
				change_culture = romanian
			}
			add_core = RMN
		}
		random_owned_province = {
			limit = {
				culture = romanian
			}
			spawn_rebels = {
				type = nationalist_rebels
				size = 2
				leader = "Horea"
			}
		}
	}
}


# Tamás Erdödy
country_event = {
	id = flavor_hun.28
	title = flavor_hun.28.t
	desc = flavor_hun.28.d
	picture = ADVISOR_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1583
		NOT = { is_year = 1610 }
		owns = 131
	}

	mean_time_to_happen = {
		months = 12
	}

	option = {
		name = flavor_hun.28.a
		define_advisor = {
			name = "Tams Erddy"
			culture = hungarian
			skill = 3
			discount = yes
			type = grand_captain
		}
	}

	option = {
		name = flavor_hun.28.b
		define_general = {
			name = "Tams Erddy"
			shock = 3
			fire = 3
			manuever = 2
			siege = 2
			trait = hardy_warrior_personality
		}
	}
}


# Matthias Dévay
country_event = {
	id = flavor_hun.29
	title = flavor_hun.29.t
	desc = flavor_hun.29.d
	picture = ADVISOR_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1530
		NOT = { is_year = 1540 }
		owns = 131
		is_religion_enabled = protestant
		any_owned_province = {
			religion = catholic
			culture = hungarian
		}
	}

	mean_time_to_happen = {
		months = 30
	}

	immediate = {
		hidden_effect = {
			random_owned_province = {
				limit = {
					religion = catholic
					culture = hungarian
				}
				set_province_flag = magyar_reform
			}
			random_owned_province = {
				limit = {
					religion = catholic
					OR = {
						culture = hungarian
						culture = slovak
					}
					NOT = { has_province_flag = magyar_reform }
				}
				set_province_flag = magyar_reform
			}
		}
	}

	#AI picks randomly here

	option = {
		name = flavor_hun.29.a
		define_advisor = {
			name = "Matthias Dvay"
			skill = 3
			discount = yes
			religion = protestant
			culture = hungarian
			type = inquisitor
		}
		every_owned_province = {
			limit = { has_province_flag = magyar_reform }
			change_religion = protestant
			clr_province_flag = magyar_reform
		}
	}

	option = {
		name = flavor_hun.29.b
		trigger = { religion = catholic }
		every_owned_province = {
			limit = { has_province_flag = magyar_reform }
			clr_province_flag = magyar_reform
		}
		define_advisor = {
			name = "Tams Szalahzy"
			culture = hungarian
			religion = catholic
			skill = 3
			discount = yes
			type = theologian
		}
	}
}

# Janus Pannonius
country_event = {
	id = flavor_hun.30
	title = flavor_hun.30.t
	desc = flavor_hun.30.d
	picture = ADVISOR_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_institution_enabled = renaissance
		is_year = 1450
		NOT = { is_year = 1470 }
	}

	mean_time_to_happen = {
		months = 60
	}


	option = {
		name = flavor_hun.30.a
		add_prestige = 25
		if = {
			limit = {
				capital_scope = {
					NOT = { renaissance = 50 }
				}
			}
			capital_scope = {
				add_institution_embracement = {
					which = renaissance
					value = 50
				}
			}
			else = {
				random_owned_province = {
					limit = { NOT = { renaissance = 50 } }
					add_institution_embracement = {
						which = renaissance
						value = 50
					}
				}
			}
		}
		define_advisor = {
			name = "Janus Pannonius"
			type = philosopher
			culture = croatian
			skill = 2
			discount = yes
		}
	}

}

# City leagues of Upper Hungary
country_event = {
	id = flavor_hun.31
	title = flavor_hun.31.t
	desc = flavor_hun.31.d
	picture = CITY_VIEW_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1580
		NOT = { is_year = 1640 }
		owns = 154
		owns = 1318
	}

	mean_time_to_happen = {
		months = 180
	}


	option = {
		name = flavor_hun.31.a
		every_owned_province = {
			limit = {
				area = slovakia_area
				OR = {
					trade_goods = gold
					trade_goods = iron
					trade_goods = copper
				}
			}
			add_province_modifier = {
				name = "hun_city_league_obligation"
				duration = 18250
			}
		}
	}
	option = {
		name = flavor_hun.31.b
		every_owned_province = {
			limit = {
				area = slovakia_area
				OR = {
					trade_goods = gold
					trade_goods = iron
					trade_goods = copper
				}
			}
			add_province_modifier = {
				name = "hun_city_leagues_protected"
				duration = 18250
			}
		}
	}
}

#Slovak National Awakening
country_event = {
	id = flavor_hun.32
	title = flavor_hun.32.t
	desc = flavor_hun.32.d
	picture = WESTERNISATION_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		NOT = { exists = SLO }
		is_year = 1750
		slovakia_area = {
			owned_by = ROOT
		}
	}

	mean_time_to_happen = {
		months = 210
	}


	option = {
		name = flavor_hun.32.a
		slovakia_area = {
			limit = {
				owned_by = ROOT
			}
			if = {
				limit = {
					NOT = { is_core = SLO }
				}
				add_core = SLO
			}
			if = {
				limit = { has_updated_culture = { culture = slavic } }
				if = {
					limit = {
						NOT = { culture = slovak_new }
					}
					change_culture = slovak_new
				}
			}
			else = {
				if = {
					limit = {
						NOT = { culture = slovak }
					}
					change_culture = slovak
				}
			}
			add_local_autonomy = 40
			add_province_modifier = {
				name = "slovak_autonomy"
				duration = 9125
			}
		}
	}
	option = {
		name = flavor_hun.32.b
		slovakia_area = {
			limit = {
				owned_by = ROOT
			}
			if = {
				limit = {
					NOT = { is_core = SLO }
				}
				add_core = SLO
			}
			if = {
				limit = { has_updated_culture = { culture = slavic } }
				if = {
					limit = {
						NOT = { culture = slovak_new }
					}
					change_culture = slovak_new
				}
			}
			else = {
				if = {
					limit = {
						NOT = { culture = slovak }
					}
					change_culture = slovak
				}
			}
			add_province_modifier = {
				name = "slovak_national_awakening"
				duration = 9125
			}
		}
	}
}

#Kurucs and Hajduks
country_event = {
	id = flavor_hun.33
	title = flavor_hun.33.t
	desc = flavor_hun.33.d
	picture = BORDER_TENSION_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1600
		NOT = { is_year = 1700 }
		any_owned_province = {
			devastation = 25
		}
	}

	mean_time_to_happen = {
		months = 300
	}


	option = {
		name = flavor_hun.33.a
		add_prestige = -5
		random_owned_area = {
			limit = {
				has_owner_culture = yes
				is_state = yes
				is_capital = no
			}
			add_devastation = 50
		}
		add_country_modifier = {
			name = "hun_kurucs"
			duration = 9125
		}
	}
	option = {
		name = flavor_hun.33.b
		add_adm_power = 50
		random_owned_area = {
			limit = {
				devastation = 25
			}
			add_devastation = -25
		}
	}
}


#Francis (II) Rákóczi
#Event for independent Hungary
country_event = {
	id = flavor_hun.34
	title = flavor_hun.34.t
	desc = flavor_hun.34.d
	picture = ELECTION_REPUBLICAN_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_subject = no
		has_regency = yes
		government = monarchy
		is_year = 1694
		NOT = { is_year = 1730 }
	}

	mean_time_to_happen = {
		months = 54 #Lower due to triggers being somewhat rare
	}


	option = {
		name = flavor_hun.34.a
		ai_chance = {
			factor = 95
		}
		define_ruler = {
			name = "00000"
			dynasty = "000000"
			culture = hungarian
			adm = 4
			dip = 5
			mil = 4
		}
		if = {
			limit = {
				has_states_general_mechanic = yes
			}
			change_statists_vs_orangists = 1
		}
	}
	option = {
		name = flavor_hun.34.b
		ai_chance = {
			factor = 5
		}
		add_stability_or_adm_power = yes
		random_owned_province = {
			limit = { is_in_capital_area = yes }
			spawn_rebels = {
				type = pretender_rebels
				size = 2
				culture = hungarian
				leader = "Ferenc"
				leader_dynasty = "Rkczy"
			}
		}
	}
}

#Francis (II) Rákóczi
#Event for subjected Hungary
country_event = {
	id = flavor_hun.35
	title = flavor_hun.35.t
	desc = flavor_hun.35.d
	picture = ELECTION_REPUBLICAN_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_subject_other_than_tributary_trigger = yes
		government = monarchy
		is_year = 1694
		NOT = { is_year = 1730 }
	}

	mean_time_to_happen = {
		months = 108
	}

	option = {
		name = flavor_hun.35.a
		ai_chance = {
			factor = 0
		}
		overlord = {
			country_event = { id = flavor_hun.36 }
			tooltip = {
				ROOT = {
					declare_war_with_cb = {
						who = PREV
						casus_belli = cb_independence_war
					}
					define_ruler = {
						name = "00000"
						dynasty = "000000"
						culture = hungarian
						adm = 4
						dip = 5
						mil = 4
					}
				}
			}
		}
		if = {
			limit = {
				has_states_general_mechanic = yes
			}
			change_statists_vs_orangists = 1
		}
	}
	option = {
		name = flavor_hun.35.b
		ai_chance = {
			factor = 100
		}
		random_owned_province = {
			limit = { is_in_capital_area = yes }
			spawn_rebels = {
				type = pretender_rebels
				culture = hungarian
				size = 3
				leader = "Ferenc"
				leader_dynasty = "Rkczy"
			}
		}
	}
}

#Francis (II) Rákóczi
#Event for subjected Hungary
country_event = {
	id = flavor_hun.36
	title = flavor_hun.36.t
	desc = flavor_hun.36.d
	picture = ELECTION_REPUBLICAN_eventPicture

	is_triggered_only = yes

	option = {
		name = flavor_hun.36.a
		HUN = {
			declare_war_with_cb = {
				who = ROOT
				casus_belli = cb_independence_war
			}
			hidden_effect = {
				define_ruler = {
					name = "00000"
					dynasty = "000000"
					culture = hungarian
					adm = 4
					dip = 5
					mil = 4
				}
			}
		}
	}
}


#Francis (II) Rákóczi
#Event for subjected Hungary
country_event = {
	id = flavor_hun.37
	title = flavor_hun.36.t
	desc = flavor_hun.36.d
	picture = ELECTION_REPUBLICAN_eventPicture

	fire_only_once = yes

	trigger = {
		tag = HAB
		NOT = { exists = HUN }
		any_owned_province = {
			culture = hungarian
		}
		is_year = 1694
		NOT = { is_year = 1730 }
	}

	mean_time_to_happen = {
		months = 108
	}

	immediate = {
		hidden_effect = {
			random_owned_province = {
				limit = {
					culture = hungarian
				}
				save_event_target_as = rakoczy_spawn_province
			}
			random_owned_province = {
				limit = {
					culture = hungarian
					OR = {
						area = alfold_area
						area = transdanubia_area
					}
				}
				save_event_target_as = rakoczy_spawn_province
			}
			random_owned_province = {
				limit = {
					culture = hungarian
					province_id = 153
				}
				save_event_target_as = rakoczy_spawn_province
			}
		}
	}

	option = {
		name = flavor_hun.36.a
		event_target:rakoczy_spawn_province = {
			if = {
				limit = { NOT = { is_core = HUN } }
				add_core = HUN
			}
			spawn_rebels = {
				type = nationalist_rebels
				size = 3
				leader = "Ferenc II Rkczi"
			}
		}
	}
}


########################################
# More Events for Hungary
#
# written by Pierre du Plessis
########################################

namespace = new_flavour_hun

#Ask the Emperor to become part of the Empire?
country_event = {
	id = new_flavour_hun.1
	title = new_flavour_hun.1.name
	desc = new_flavour_hun.1.desc
	picture = HRE_eventPicture

	immediate = {
		hidden_effect = {
			save_event_target_as = Hungary
		}
	}

	is_triggered_only = yes

	option = { #Go for it
		name = new_flavour_hun.1.A
		set_country_flag = hungary_flag_incident
		set_imperial_incident = incident_hungary_mission
		ai_chance = {
			factor = 100
			modifier = {
				factor = 0
				OR = {
					NOT = { prestige = 0 }
					emperor = {
						NOT = { tag = HAB }
					}
				}
				emperor = {
					OR = {
						ai_attitude = {
							who = root
							attitude = attitude_threatened
						}
						ai_attitude = {
							who = root
							attitude = attitude_hostile
						}
						ai_attitude = {
							who = root
							attitude = attitude_outraged
						}
					}
				}
			}
		}
	}
	option = { #Nah
		name = new_flavour_hun.1.B

		add_prestige = 15

		ai_chance = {
			factor = 1
		}
	}
}

#Hungary Joins the Empire? - Incident
country_event = {
	id = new_flavour_hun.201
	title = new_flavour_hun.2.name
	desc = new_flavour_hun.2.desc
	picture = HRE_eventPicture

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			random_country = {
				limit = {
					has_country_flag = hungary_flag_incident
				}
				save_event_target_as = hungary_country
			}
		}
	}

	option = { #Sure
		name = new_flavour_hun.2.A

		BOH = {
			elector = no
		}
		event_target:hungary_country = {
			set_in_empire = yes
			elector = yes
		}
		event_target:hungary_country = {
			country_event = { id = flavor_hun.52 }
		}
		event_target:hungary_country = {
			add_opinion = {
				who = root
				modifier = opinion_hun_let_into_empire
			}
		}
		BOH = {
			add_opinion = {
				who = root
				modifier = opinion_bav_repealed_electorate
			}
		}

		ai_chance = {
			factor = 1
			modifier = {
				factor = 2
				OR = {
					ai_attitude = {
						who = event_target:hungary_country
						attitude = attitude_allied
					}
					ai_attitude = {
						who = event_target:hungary_country
						attitude = attitude_friendly
					}
				}
			}
			modifier = {
				factor = 1.5
				has_opinion = {
					who = event_target:hungary_country
					value = 50
				}
			}
			modifier = {
				factor = 1.5
				has_opinion = {
					who = event_target:hungary_country
					value = 100
				}
			}
			modifier = {
				factor = 0.5
				NOT = {
					has_opinion = {
						who = event_target:hungary_country
						value = -15
					}
				}
			}
			modifier = {
				factor = 0
				OR = {
					ai_attitude = {
						who = event_target:hungary_country
						attitude = attitude_threatened
					}
					ai_attitude = {
						who = event_target:hungary_country
						attitude = attitude_hostile
					}
					ai_attitude = {
						who = event_target:hungary_country
						attitude = attitude_outraged
					}
					NOT = {
						has_opinion = {
							who = event_target:hungary_country
							value = -100
						}
					}
				}
			}
		}
	}
	option = { #No way in h...
		name = new_flavour_hun.2.B

		event_target:hungary_country = {
			add_opinion = {
				who = root
				modifier = opinion_hun_didnt_let_into_empire
			}
		}
		event_target:hungary_country = {
			country_event = { id = flavor_hun.54 }
		}
		if = {
			limit = {
				tag = HAB
			}
			austria_proper_area = {
				limit = {
					NOT = { is_claim = event_target:hungary_country }
					NOT = { is_core = event_target:hungary_country }
				}
				add_claim = event_target:hungary_country
			}
			inner_austria_area = {
				limit = {
					NOT = { is_claim = event_target:hungary_country }
					NOT = { is_core = event_target:hungary_country }
				}
				add_claim = event_target:hungary_country
			}
			carinthia_area = {
				limit = {
					NOT = { is_claim = event_target:hungary_country }
					NOT = { is_core = event_target:hungary_country }
				}
				add_claim = event_target:hungary_country
			}
		}

		ai_chance = {
			factor = 1
			modifier = {
				factor = 0.5
				OR = {
					ai_attitude = {
						who = event_target:hungary_country
						attitude = attitude_allied
					}
					ai_attitude = {
						who = event_target:hungary_country
						attitude = attitude_friendly
					}
				}
			}
		}
	}
}


#The Greeks in Constantinople (used by Austria too)
country_event = {
	id = new_flavour_hun.3
	title = new_flavour_hun.3.name
	desc = new_flavour_hun.3.desc
	picture = CITY_VIEW_eventPicture

	is_triggered_only = yes

	option = { #Bring back the Greeks
		name = new_flavour_hun.3.A

		151 = {
			change_culture = greek
			change_religion = orthodox
		}

		ai_chance = {
			factor = 1
		}
	}
	option = { #Leave it as is
		name = new_flavour_hun.3.B

		151 = {
			add_nationalism = -5
		}

		ai_chance = {
			factor = 0
		}
	}
}

########################################
# New Hungarian flavor events for 1.37
#
# written by Parmelion
########################################

#Addressing the Ethnic Situation
country_event = {
	id = flavor_hun.38
	title = flavor_hun.38.t
	desc = flavor_hun.38.d
	picture = REFORM_eventPicture

	is_triggered_only = yes

	option = { #Promote the Hungarian culture
		name = flavor_hun.38.a
		add_country_modifier = {
			name = "hun_promote_hungarian_culture"
			duration = -1
		}
	}
	option = { #Guarantee the minority rights
		name = flavor_hun.38.b
		add_country_modifier = {
			name = "hun_guarantee_minority_rights"
			duration = -1
		}
	}
}

#Balazs Magyar
country_event = {
	id = flavor_hun.39
	title = flavor_hun.39.t
	desc = flavor_hun.39.d
	picture = BATTLE_eventPicture

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_subject = no
		is_year = 1470
		OR = {
			has_country_modifier = hun_black_army
			has_reform = black_army_reform
		}
	}
	
	fire_only_once = yes
	
	mean_time_to_happen = {
		months = 120
	}

	option = {
		name = flavor_hun.39.a
		ai_chance = { factor = 10 }
		define_advisor = {
			name = "Balzs Magyar"
			culture = hungarian
			type = commandant
			skill = 3
			discount = yes
		}
	}
	
	option = {
		name = flavor_hun.39.b
		ai_chance = { factor = 80 }
		define_general = {
			shock = 4
			fire = 4
			manuever = 4
			siege = 2
			name = "Balzs Magyar"
		}
	}
	
	option = {
		name = flavor_hun.39.c
		ai_chance = { factor = 10 }
		add_mil_power = 50
	}
}

#Gubec's Peasant Uprising
country_event = {
    id = flavor_hun.40
	title = flavor_hun.40.t
	desc = flavor_hun.40.d
	picture = ANGRY_MOB_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1573
		croatia_area = {
			type = all
			owned_by = ROOT
		}
	}
	
	mean_time_to_happen = {
	    months = 3
	}
	
	option = {
	    name = flavor_hun.40.a
		ai_chance = { factor = 20 }
		add_years_of_income = -0.3
		croatia_area = {
			limit = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			add_province_modifier = {
				name = "hun_peasants_compensated"
				duration = 3650
			}
		}
		slavonia_area = {
			limit = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			add_province_modifier = {
				name = "hun_peasants_compensated"
				duration = 3650
			}
		}
		if = {
			limit = {
				has_estate = estate_nobles
			}
			add_estate_loyalty = {
				estate = estate_nobles
				loyalty = -20
			}
		}
	}
	
	option = {
		ai_chance = { factor = 80 }
	    name = flavor_hun.40.b
		if = {
			limit = {
				has_estate = estate_nobles
			}
			add_estate_loyalty = {
				estate = estate_nobles
				loyalty = 10
			}
		}
		random_owned_province = {
			limit = {
				culture = croatian
			}
			spawn_rebels = {
				type = anti_tax_rebels
				size = 3
				leader = "Matija Gubec"
			}
		}
		random_owned_province = {
			limit = {
				culture = croatian
			}
			spawn_rebels = {
				type = anti_tax_rebels
				size = 2
			}
		}
	}
}

#Ascendant Hungary
country_event = {
    id = flavor_hun.41
	title = flavor_hun.41.t
	desc = flavor_hun.41.d
	picture = HRE_eventPicture
	
	is_triggered_only = yes
	
	option = {
	    name = flavor_hun.41.a
		ai_chance = { factor = 90 }
		add_dip_power = 200
		add_country_modifier = {
			name = hun_imperial_crown_bid
			duration = 7300
		}
	}
	
	option = {
		ai_chance = { factor = 10 }
	    name = flavor_hun.41.b
		custom_tooltip = hun_elector_cb_tt
		hidden_effect = {
			every_elector = {
				reverse_add_casus_belli = {
					target = ROOT
					type = cb_vassalize_mission
					months = 300
				}
			}
			emperor = {
				reverse_add_casus_belli = {
					target = ROOT
					type = cb_vassalize_mission
					months = 300
				}
			}
		}
	}
}

# Adam František Kollár
country_event = {
	id = flavor_hun.42
	title = flavor_hun.42.t
	desc = flavor_hun.42.d
	picture = ADVISOR_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		exists = HAB
		HAB = {
			is_emperor = yes
		}
		is_year = 1760
		NOT = { is_year = 1783 }
		slovakia_area = {
			owned_by = ROOT
		}
	}
	
	mean_time_to_happen = {
		months = 12
	}
	
    option = {
	    name = flavor_hun.42.a
		ai_chance = { factor = 90 }
			define_advisor = {
			type = statesman
			name = "Adam Frantisek Kollr"
			culture = slovak
			discount = yes
			skill = 3
		}
	}
	
	option = {
		ai_chance = { factor = 10 }
	    name = flavor_hun.42.b
		add_dip_power = 50
	}
}


# Pal Kinizsi
country_event = {
	id = flavor_hun.43
	title = flavor_hun.43.t
	desc =  flavor_hun.43.d
	picture = LAND_MILITARY_eventPicture
	
	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1490
		NOT = { is_year = 1494 }
		OR = {
			has_country_modifier = hun_black_army
			has_reform = black_army_reform
		}
	}

	fire_only_once = yes
	
	mean_time_to_happen = {
		months = 12
	}

	option = {
		name = flavor_hun.43.a
		add_army_tradition_or_mil_power = { amount = 15 }
	}
	
	option = {
		name = flavor_hun.43.b
		define_advisor = {
			name = "Pl Kinizsi"
			culture = hungarian
			type = army_reformer
			skill = 3
			discount = yes
		}
	}
	
	option = {
		name = flavor_hun.43.c
		add_mil_power = 50
	}
}

#Beatrice of Aragon
country_event = {
	id = flavor_hun.44
	title = flavor_hun.44.t
	desc =  flavor_hun.44.d
	picture = wihgfx_FEMALE_SCHOLAR_eventPicture
	
	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
	    dynasty = "00000"
		is_year = 1480
		NOT = { is_year = 1508 }
	}
	
	fire_only_once = yes
	
	mean_time_to_happen = {
		months = 150
	}
	
    option = {
	    name = flavor_hun.44.a
		ai_chance = { factor = 90 }
		add_ruler_modifier = {
			name = "hun_beatrice_aragon"
			duration = 7300
		}
	}
	
	option = {
		ai_chance = { factor = 10 }
	    name = flavor_hun.44.b
		add_dip_power = 50
	}
}

#Tripartitum 
country_event = { 
    id = flavor_hun.45
	title = flavor_hun.45.t
	desc = flavor_hun.45.d
	picture = BIG_BOOK_eventPicture 
	
	trigger = {
		OR = {
			OR = {
				tag = HUN
				was_tag = HUN
			}
			tag = TRA
		}
		is_year = 1514
	}
	
	fire_only_once = yes 
	
	mean_time_to_happen = {
	    months = 6
	}
	
	option = { 
	    name = flavor_hun.45.a
		ai_chance = { factor = 100 }
		add_country_modifier = {
			name = "hun_tripartitum"
			duration = -1
		}
	}
	
	option = {
		name = flavor_hun.45.b	
		ai_chance = { factor = 0 }
		add_stability_or_adm_power = yes
	}
}

# Saxons convert to Protestantism	
country_event = {
    id = flavor_hun.46
	title = flavor_hun.46.t
	desc = flavor_hun.46.d
	picture = {	
		trigger = {
			has_dlc = "Common Sense"
		}
		picture = PROTESTANT_RELIGIOUS_TENSIONS_eventPicture
	}
	picture = {	
		trigger = {
			NOT = { has_dlc = "Common Sense" }
		}
		picture = PRAYING_eventPicture
	}
	
	fire_only_once = yes
	
	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		is_year = 1533
		NOT = { is_year = 1549 }
		religion = catholic
		is_religion_enabled = protestant
		owns = 4128
		owns = 4127
	}
	
	mean_time_to_happen = {
		months = 48
	}
	
	option = {
	    name = flavor_hun.46.a
		4128 = {
		    change_religion = protestant 
		}
		4128 = {
			add_province_modifier = {
				name = hun_religious_tolerance
				duration = 3650
			}
		}
		4127 = {
		    change_religion = protestant 
		}
		4127 = {
			add_province_modifier = {
				name = hun_religious_tolerance
				duration = 3650
			}
		}
	}
	
	option = {
	    name = flavor_hun.46.b
		4128 = {
		    change_religion = protestant 
		}
		4128 = {
			add_unrest = 5
		}
		4128 = {
			add_province_modifier = {
				name = hun_convert_the_saxons
				duration = 3650
			}
		}
		4127 = {
		    change_religion = protestant 
		}
		4127 = {
			add_unrest = 5
		}
		4127 = {
			add_province_modifier = {
				name = hun_convert_the_saxons
				duration = 3650
			}
		}
	}
}

#Bibliotheca Corviniana
country_event = { 
    id = flavor_hun.47
	title = flavor_hun.47.t
	desc = flavor_hun.47.d
	picture = BIG_BOOK_eventPicture 

	is_triggered_only = yes
	
	option = { 
	    name = flavor_hun.47.a
		goto = 153
		add_country_modifier = {
			name = hun_corviana_library
			duration = 7300
		}
		153 = {
			if = {
				limit = {
					has_dlc = "Leviathan"
					has_great_project = {
						type = buda_castle
						tier = 0
					}
				}
				set_great_project_tier_1 = {
					type = buda_castle
				}
			}
			else = {
				add_base_tax = 3
			}
		}
	}
}

#Capital in Danger
country_event = {
    id = flavor_hun.48
	title = flavor_hun.48.t
	desc = flavor_hun.48.d 
	picture = CITY_VIEW_eventPicture
	
	fire_only_once = yes 
	
	trigger = {
		OR = {
			tag = HUN
			was_tag = HUN
		}
		owns = 153
		153 = {
			is_capital_of = ROOT
		}
		153 = {
			any_neighbor_province = {
				owned_by = TUR
			}
		}
		owns_core_province = 1772
	}

	mean_time_to_happen = {
		months = 4
	}
	
	option = {
	    name = flavor_hun.48.a
		ai_chance = { factor = 25 }
		goto = 153
		153 = {
		    add_permanent_province_modifier = {
				name = hun_buda_fortified
				duration = 14600
			}
			add_base_manpower = 3
	    }
	}

	option = {
		ai_chance = { factor = 75 }
	    name = flavor_hun.48.b
		goto = 1772
		1772 = {
			move_capital_effect = yes
		}
		1772 = {
			add_base_tax = 2
			add_base_production = 2
	    }
	}
}

#Juraj Jánošík
country_event = {
    id = flavor_hun.49
	title = flavor_hun.49.t
	desc = flavor_hun.49.d 
	picture = JURAJ_JANOSIK_eventPicture #to be replaced
	
	goto = 4236
	
	fire_only_once = yes 
	
	trigger = {
		is_year = 1710
		OR = {
			tag = HUN
			was_tag = HUN
		}
		slovakia_area = {
			owned_by = ROOT
		}
		4236 = {
			culture = slovak
		}
	}

	mean_time_to_happen = {
		months = 24
	}
	
	option = {
	    name = flavor_hun.49.a
		ai_chance = { factor = 100 }
		custom_tooltip = hun_janosik_raid
		hidden_effect = {
			4236 = {
				remove_loot = {
					who = REB
					amount = 100
				}
			}
		}
		4236 = {
			add_base_production = -1
		}
		custom_tooltip = hun_empty
		add_years_of_income = -0.5
		set_country_flag = hun_hunt_of_janosik
		custom_tooltip = hun_janosik_group_tt
	}

	option = {
		ai_chance = { factor = 75 }
	    name = flavor_hun.49.b
		custom_tooltip = hun_janosik_raid
		hidden_effect = {
			4236 = {
				remove_loot = {
					who = REB
					amount = 100
				}
			}
		}
		4236 = {
			add_base_production = -1
		}
		custom_tooltip = hun_empty
		set_country_flag = hun_janosik_ignored
		add_stability = -1
		add_estate_loyalty = {
			estate = estate_nobles
			loyalty = -20
		}
		add_estate_loyalty = {
			estate = estate_burghers
			loyalty = -20
		}
	}
}

#Jánošík Strikes Again
country_event = {
    id = flavor_hun.50
	title = flavor_hun.50.t
	desc = flavor_hun.50.d 
	picture = JURAJ_JANOSIK_eventPicture #to be replaced
	
	goto = 154
	
	fire_only_once = yes 
	
	trigger = {
		has_country_flag = hun_janosik_ignored
		OR = {
			tag = HUN
			was_tag = HUN
		}
		154 = {
			owned_by = ROOT
		}
	}

	mean_time_to_happen = {
		months = 50
	}
	
	option = {
	    name = flavor_hun.50.a
		ai_chance = { factor = 100 }
		add_estate_loyalty = {
			estate = estate_nobles
			loyalty = -20
		}
		add_estate_loyalty = {
			estate = estate_burghers
			loyalty = -20
		}
		custom_tooltip = hun_janosik_raid_nitra
		hidden_effect = {
			154 = {
				remove_loot = {
					who = REB
					amount = 100
				}
			}
		}
		154 = {
			add_base_production = -2
		}
		custom_tooltip = hun_empty
		add_years_of_income = -0.5
		set_country_flag = hun_hunt_of_janosik
		custom_tooltip = hun_janosik_group_tt
	}
}

#The End of Jnok
country_event = {
    id = flavor_hun.51
	title = flavor_hun.51.t
	desc = flavor_hun.51.d 
	picture = JURAJ_JANOSIK_eventPicture #to be replaced
	
	fire_only_once = yes 
	
	trigger = {
		has_country_flag = hun_hunt_of_janosik
		OR = {
			tag = HUN
			was_tag = HUN
		}
	}

	mean_time_to_happen = {
		months = 80
	}
	
	option = {
	    name = flavor_hun.51.a
		ai_chance = { factor = 100 }
		add_estate_loyalty = {
			estate = estate_nobles
			loyalty = 20
		}
		add_estate_loyalty = {
			estate = estate_burghers
			loyalty = 20
		}
		slovakia_area = {
			add_province_modifier = {
				name = "hun_end_of_banditry"
				duration = 7300
			}
		}
	}
}

country_event = {
	id = flavor_hun.52
	title = flavor_hun.52.t
	desc = flavor_hun.52.d
	picture = HRE_eventPicture

	is_triggered_only = yes

	option = {
		name = flavor_hun.52.a
	}
}

#New Trade Goods in Pest
country_event = {
	id = flavor_hun.53
	title = flavor_hun.53.t
	desc = flavor_hun.53.d
	picture = CITY_VIEW_eventPicture
	
	is_triggered_only = yes
	
	option = {
		name = "flavor_hun.53.a"
		153 = {
			change_trade_goods = cloth
		}
		153 = {
			add_base_production = 1
		}
		ai_chance = {
			factor = 20
		}
	}
	
	option = {
		name = "flavor_hun.53.b"
		153 = {
			change_trade_goods = copper
		}
		153 = {
			add_base_production = 1
		}
		ai_chance = {
			factor = 20
		}
	}
	
	option = {
		name = "flavor_hun.53.c"
		153 = {
			change_trade_goods = iron
		}
		153 = {
			add_base_production = 1
		}
		ai_chance = {
			factor = 20
		}
	}
	
	option = {
		name = "flavor_hun.53.de"
		153 = {
			change_trade_goods = glass
		}
		153 = {
			add_base_production = 1
		}
		ai_chance = {
			factor = 20
		}
	}
	
	option = {
		name = "flavor_hun.53.e"
		153 = {
			add_base_production = 3
		}
	}	
}

#Hungary Joins the Empire - Negative Response
country_event = {
	id = flavor_hun.54
	title = flavor_hun.54.t
	desc = flavor_hun.54.d
	picture = HRE_eventPicture

	is_triggered_only = yes

	option = {
		name = flavor_hun.54.a
	}
}