# Iberia Events

namespace = FEE_Iberia_Events

# The Irmandiño Revolts
country_event = {
	id = FEE_Iberia_Events.1
	title = FEE_Iberia_Events.1.T
	desc = FEE_Iberia_Events.1.D
	picture = ANGRY_MOB_eventPicture

	fire_only_once = yes

	trigger = {
		capital_scope = {
			region = iberia_region
		}
		culture_group = iberian
		religion_group = christian
		is_year = 1444
		NOT = { is_year = 1500 }
		galicia_area = {
			type = all
			owned_by = ROOT
		}
		NOT = { tag = GAL }
	}

	mean_time_to_happen = {
		months = 60
	}

	option = {
		name = FEE_Iberia_Events.1.OPT1

		ai_chance = {
			factor = 33
		}

		fee_add_estate_church_loyalty_effect_big = yes
		fee_add_estate_nobles_loyalty_effect_big = yes
		add_stability = -1
		4555 = { #Pontevedra
			spawn_rebels = {
				type = leadered_peasant_rebels
				size = 3
			}
		}
		4554 = { #Lugo
			spawn_rebels = {
				type = leadered_peasant_rebels
				size = 3
			}
		}
		4558 = { #Orense
			spawn_rebels = {
				type = leadered_peasant_rebels
				size = 3
			}
		}
		206 = {
			add_or_upgrade_fort_building = yes
		}
		country_event = {
			id = FEE_Iberia_Events.2
		}
	}

	option = {
		name = FEE_Iberia_Events.1.OPT2

		ai_chance = {
			factor = 33
		}

		add_stability_or_adm_power = yes
		fee_reduce_estate_nobles_loyalty_effect_big = yes
		galicia_area = {
			add_local_autonomy = 15
		}
	}

	option = {
		name = FEE_Iberia_Events.1.OPT3

		ai_chance = {
			factor = 33
		}
		4558 = { #Orense
			spawn_rebels = {
				type = noble_rebels
				size = 3
			}
		}
		add_stability = -1
		if = {
			limit = {
				has_estate = estate_nobles
			}
			add_estate_loyalty = {
				estate = estate_nobles
				loyalty = -15
			}
			add_estate_influence_modifier = {
				estate = estate_nobles
				desc = iberia_irmandinos_nobles_curtail
				influence = -10
				duration = 3650
			}
		}
		add_country_modifier = {
			name = iberia_irmandinos_justified
			duration = 9125
		}
	}
}

#Pedro Madruga
country_event = {
	id = FEE_Iberia_Events.2
	title = FEE_Iberia_Events.2.T
	desc = FEE_Iberia_Events.2.D
	picture = ADVISOR_eventPicture

	is_triggered_only = yes

	option = {
		name = FEE_Iberia_Events.2.OPT1

		ai_chance = {
			factor = 33
		}

		define_advisor = {
			type = army_reformer
			name = "Pedro Madruga"
			skill = 2
			culture = galician
			religion = catholic
			cost_multiplier = 0.25
		}
	}

	option = {
		name = FEE_Iberia_Events.2.OPT2

		ai_chance = {
			factor = 33
		}

		define_general = {
			name = "Pedro Madruga"
			fire = 5
			shock = 4
			manuever = 6
			siege = 0
			trait = ruthless_personality
		}
	}

	option = {
		name = FEE_Iberia_Events.2.OPT3

		ai_chance = {
			factor = 33
		}

		define_admiral = {
			name = "Pedro Madruga"
			fire = 4
			shock = 3
			manuever = 4
			siege = 0
			trait = level_headed_personality
		}
	}
}

#The Autonomous Regions
country_event = {
	id = FEE_Iberia_Events.3
	title = FEE_Iberia_Events.3.T
	desc = FEE_Iberia_Events.3.D
	picture = ANGRY_MOB_eventPicture

	fire_only_once = yes

	trigger = {
		is_year = 1450
		NOT = { exists = CAT }
		NOT = { exists = GAL }
		NOT = { exists = NAV }
		galicia_area = {
			type = all
			country_or_non_sovereign_subject_holds = ROOT
			NOT = { owned_by = GAL }
		}
		catalonia_area = {
			type = all
			country_or_non_sovereign_subject_holds = ROOT
			NOT = { owned_by = CAT }
		}
		basque_country = {
			type = all
			country_or_non_sovereign_subject_holds = ROOT
			NOT = { owned_by = NAV }
		}
		capital_scope = {
			region = iberia_region
		}
		culture_group = iberian
		any_country = {
			OR = {
				capital_scope = {
					NOT = { region = iberia_region }
				}
				religion_group = christian
			}
		}
	}

	mean_time_to_happen = {
		months = 60
	}

	option = {
		name = FEE_Iberia_Events.3.OPT1

		ai_chance = {
			factor = 25
		}

		add_stability_or_adm_power = yes
		add_estate_nobles_loyalty_effect = yes
		add_country_modifier = {
			name = iberia_spanish_cortes
			duration = -1
		}
		custom_tooltip = FEE_IBERIA_AUTONOMOUS_REGION_AREA_TT
		tooltip = {
			add_permanent_province_modifier = {
				name = iberia_autonomous_regions
				duration = -1
			}
		}
		hidden_effect = {
			catalonia_area = {
				add_permanent_province_modifier = {
					name = iberia_autonomous_regions
					duration = -1
				}
			}
			galicia_area = {
				add_permanent_province_modifier = {
					name = iberia_autonomous_regions
					duration = -1
				}
			}
			basque_country = {
				add_permanent_province_modifier = {
					name = iberia_autonomous_regions
					duration = -1
				}
			}
		}
	}

	option = {
		name = FEE_Iberia_Events.3.OPT2

		ai_chance = {
			factor = 25
		}
		add_stability_or_adm_power = yes

		custom_tooltip = FEE_IBERIA_AUTONOMOUS_REGION_AREA_TT
		tooltip = {
			add_permanent_province_modifier = {
				name = iberia_restricted_autonomy
				duration = -1
			}
		}
		hidden_effect = {
			catalonia_area = {
				add_permanent_province_modifier = {
					name = iberia_restricted_autonomy
					duration = -1
				}
			}
			galicia_area = {
				add_permanent_province_modifier = {
					name = iberia_restricted_autonomy
					duration = -1
				}
			}
			basque_country = {
				add_permanent_province_modifier = {
					name = iberia_restricted_autonomy
					duration = -1
				}
			}
		}
	}

	option = {
		name = FEE_Iberia_Events.3.OPT3

		ai_chance = {
			factor = 25
		}
		add_years_of_income = 1.5
		add_stability_or_adm_power_per_stab = { amount = 2 }
		if = {
			limit = {
				has_estate = estate_nobles
			}
			add_estate_loyalty = {
				estate = estate_nobles
				loyalty = 20
			}
			add_estate_influence_modifier = {
				estate = estate_nobles
				desc = iberia_nobles_decision
				influence = 10
				duration = 3650
			}
		}
		if = {
			limit = {
				NOT = { exists = CAT }
			}
			release = CAT
			CAT = {
				change_government = monarchy
				add_government_reform = feudalism_reform
			}
			if = {
				limit = {
					valid_for_personal_unions_trigger = yes
					CAT = { valid_for_personal_unions_trigger = yes }
				}
				create_union = CAT
			}
		}
		if = {
			limit = {
				NOT = { exists = GAL }
			}
			release = GAL
			GAL = {
				change_government = monarchy
				add_government_reform = feudalism_reform
			}
			if = {
				limit = {
					valid_for_personal_unions_trigger = yes
					GAL = { valid_for_personal_unions_trigger = yes }
				}
				create_union = GAL
			}
		}
		if = {
			limit = {
				NOT = { exists = NAV }
			}
			release = NAV
			NAV = {
				change_government = monarchy
				add_government_reform = feudalism_reform
			}
			if = {
				limit = {
					valid_for_personal_unions_trigger = yes
					NAV = { valid_for_personal_unions_trigger = yes }
				}
				create_union = NAV
			}
		}
	}

	option = {
		name = FEE_Iberia_Events.3.OPT4

		ai_chance = {
			factor = 25
		}

		add_stability = -1
		add_years_of_income = 1.5
		add_country_modifier = {
			name = iberia_autonomy_curalied
			duration = -1
		}

		custom_tooltip = FEE_IBERIA_AUTONOMOUS_REGION_AREA_TT
		tooltip = {
			add_permanent_province_modifier = {
				name = iberia_abolished_local_privileges
				duration = -1
			}
		}
		hidden_effect = {
			catalonia_area = {
				add_permanent_province_modifier = {
					name = iberia_abolished_local_privileges
					duration = -1
				}
			}
			galicia_area = {
				add_permanent_province_modifier = {
					name = iberia_abolished_local_privileges
					duration = -1
				}
			}
			basque_country = {
				add_permanent_province_modifier = {
					name = iberia_abolished_local_privileges
					duration = -1
				}
			}
		}

		random_province = {
			custom_tooltip = FEE_IBERIA_AUTONOMOUS_REGION_AREA_REBELS_TT
			tooltip = {
				spawn_rebels = {
					size = 3
					type = particularist_rebels
				}
				spawn_rebels = {
					size = 2
					type = nationalist_rebels
				}
			}
		}
		hidden_effect = {
			random_province = {
				limit = {
					area = galicia_area
				}
				spawn_rebels = {
					size = 3
					type = particularist_rebels
				}
			}
			random_province = {
				limit = {
					area = galicia_area
				}
				spawn_rebels = {
					size = 2
					type = nationalist_rebels
				}
			}
			random_province = {
				limit = {
					area = catalonia_area
				}
				spawn_rebels = {
					size = 3
					type = particularist_rebels
				}
			}
			random_province = {
				limit = {
					area = catalonia_area
				}
				spawn_rebels = {
					size = 2
					type = nationalist_rebels
				}
			}
			random_province = {
				limit = {
					area = basque_country
				}
				spawn_rebels = {
					size = 3
					type = particularist_rebels
				}
			}
			random_province = {
				limit = {
					area = basque_country
				}
				spawn_rebels = {
					size = 2
					type = nationalist_rebels
				}
			}
		}
	}
}

#Fate of the Fueros
country_event = {
	id = FEE_Iberia_Events.4
	title = FEE_Iberia_Events.4.T
	desc = FEE_Iberia_Events.4.D
	picture = CONQUEST_eventPicture

	fire_only_once = yes

	trigger = {
		NOT = { tag = NAV }
		NOT = { exists = NAV }
		culture_group = iberian
		capital_scope = {
			region = iberia_region
		}
		basque_country = {
			type = all
			is_core = ROOT
			owned_by = ROOT
		}
		religion_group = christian
	}

	mean_time_to_happen = {
		months = 60
	}

	option = {
		name = FEE_Iberia_Events.4.OPT1

		ai_chance = {
			factor = 50
		}

		add_stability_or_adm_power = yes
		basque_country = {
			add_permanent_province_modifier = {
				name = iberia_fueros_enforced
				duration = -1
			}
		}
		add_yearly_manpower = 0.25
	}
	option = {
		name = FEE_Iberia_Events.4.OPT2

		ai_chance = {
			factor = 50
		}

		add_stability = -1
		basque_country = {
			add_permanent_province_modifier = {
				name = iberia_fueros_ignored
				duration = -1
			}
		}
		add_years_of_income = 0.50
		add_country_modifier = {
			name = iberia_centralised_rule
			duration = -1
		}
	}
}

#The Institutions of Catalonia
country_event = {
	id = FEE_Iberia_Events.5
	title = FEE_Iberia_Events.5.T
	desc = FEE_Iberia_Events.5.D
	picture = LIBERUM_VETO_eventPicture

	fire_only_once = yes

	trigger = {
		culture_group = iberian
		NOT = { tag = ARA }
		NOT = { tag = CAT }
		catalonia_area = {
			type = all
			is_core = ROOT
			owned_by = ROOT
		}
		religion_group = christian
	}

	mean_time_to_happen = {
		months = 120
	}

	option = {
		name = FEE_Iberia_Events.5.OPT1

		ai_chance = {
			factor = 25
		}

		add_stability_or_adm_power = yes
		catalonia_area = {
			add_permanent_province_modifier = {
				name = iberia_institutions_respected
				duration = -1
			}
		}
		fee_add_estate_church_loyalty_effect_big = yes
		fee_add_estate_nobles_loyalty_effect_big = yes
	}
	option = {
		name = FEE_Iberia_Events.5.OPT2

		ai_chance = {
			factor = 25
		}

		catalonia_area = {
			add_permanent_province_modifier = {
				name = iberia_institutions_modified
				duration = -1
			}
		}
	}
	option = {
		name = FEE_Iberia_Events.5.OPT3

		ai_chance = {
			factor = 25
		}

		add_stability = -1
		catalonia_area = {
			add_permanent_province_modifier = {
				name = iberia_institutions_abolished
				duration = -1
			}
		}
		if = {
			limit = {
				has_estate = estate_nobles
			}
			add_estate_loyalty = {
				estate = estate_nobles
				loyalty = -15
			}
			add_estate_influence_modifier = {
				estate = estate_nobles
				desc = iberia_catalonia_influence
				influence = -10
				duration = 3650
			}
		}
		if = {
			limit = {
				has_estate = estate_burghers
			}
			add_estate_loyalty = {
				estate = estate_burghers
				loyalty = -10
			}
			add_estate_influence_modifier = {
				estate = estate_burghers
				desc = iberia_catalonia_influence
				influence = -10
				duration = 3650
			}
		}
	}
}

#The Catalonian Revolts
country_event = {
	id = FEE_Iberia_Events.6
	title = FEE_Iberia_Events.6.T
	desc = FEE_Iberia_Events.6.D
	picture = REVOLUTION_eventPicture

	major = yes
	major_trigger = {
		capital_scope = {
			continent = europe
		}
	}
	fire_only_once = yes

	trigger = {
		NOT = {
			OR = {
				AND = {
					tag = ARA
					was_tag = ARA
				}
				AND = {
					tag = CAT
					was_tag = CAT
				}
			}
		}
		any_owned_province = {
			area = catalonia_area
		}
		current_age = age_of_absolutism
		catalonia_area = {
			NOT = { has_province_modifier = iberia_institutions_respected }
		}
		NOT = { has_country_modifier = iberia_spanish_cortes }
	}

	mean_time_to_happen = {
		months = 500
		modifier = {
			factor = 0.5
			absolutism = 10
		}
		modifier = {
			factor = 0.5
			absolutism = 50
		}
		modifier = {
			factor = 0.5
			war_exhaustion = 5
		}
	}

	option = {
		name = FEE_Iberia_Events.6.OPT1

		ai_chance = {
			factor = 25
		}

		add_absolutism = -20
		add_prestige = -10
		catalonia_area = {
			add_permanent_province_modifier = {
				name = iberia_catalonian_constitution
				duration = -1
			}
			if = {
				limit = {
					has_province_modifier = iberia_institutions_modified
				}
				remove_province_modifier = iberia_institutions_modified
			}
			else_if = {
				limit = {
					has_province_modifier = iberia_institutions_abolished
				}
				remove_province_modifier = iberia_institutions_modified
			}
		}
		add_country_modifier = {
			name = iberia_constitution_concessions
			duration = -1
		}
	}
	option = {
		name = FEE_Iberia_Events.6.OPT2

		ai_chance = {
			factor = 25
		}

		hidden_effect = {
			every_owned_province = {
				limit = {
					area = catalonia_area
				}
				discover_country = CAT
				add_core = CAT
			}
		}
		release = CAT
		CAT = {
			change_government = republic
			add_country_modifier = {
				name = iberia_segadores
				duration = 9125
			}
			declare_war_with_cb = {
				who = ROOT
				casus_belli = cb_independence_war
			}
			custom_tooltip = CAT_SPAWN_ARMIES
			hidden_effect = {
				every_owned_province = {
					limit = {
						culture = catalan
					}
					add_claim = CAT
				}
				if = {
					limit = {
						capital_scope = {
							NOT = { has_port = yes }
						}
					}
					random_owned_province = {
						limit = { has_port = yes }
						galley = CAT
						galley = CAT
						galley = CAT
						galley = CAT
						galley = CAT
						galley = CAT
						galley = CAT
						galley = CAT
						galley = CAT
						galley = CAT
					}
				}
				else = {
					capital_scope = {
						galley = CAT
						galley = CAT
						galley = CAT
						galley = CAT
						galley = CAT
						galley = CAT
						galley = CAT
						galley = CAT
						galley = CAT
						galley = CAT
					}
				}
				capital_scope = {
					artillery = CAT
					artillery = CAT
					artillery = CAT
					artillery = CAT
					artillery = CAT
					artillery = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
					infantry = CAT
				}
			}
		}
		hidden_effect = {
			every_enemy_country = {
				country_event = {
					id = FEE_Iberia_Events.7
					days = 1
				}
			}
		}
		add_absolutism = 20
		add_stability_or_adm_power = yes
	}
}

#Catalonia calls for help
country_event = {
	id = FEE_Iberia_Events.7
	title = FEE_Iberia_Events.7.T
	desc = FEE_Iberia_Events.7.D
	picture = DIPLOMACY_eventPicture

	is_triggered_only = yes

	option = {
		name = FEE_Iberia_Events.7.OPT1

		ai_chance = {
			factor = 50
		}

		create_alliance = CAT
		set_ai_attitude = {
			attitude = attitude_friendly
			who = CAT
		}
		add_opinion = {
			who = CAT
			modifier = supported_independence
		}
		reverse_add_opinion = {
			who = CAT
			modifier = supported_independence
		}
	}
	option = {
		name = FEE_Iberia_Events.7.OPT2

		ai_chance = {
			factor = 50
		}

		add_prestige = -10
	}
}

#The Great Earthquake of 1755
country_event = {
	id = FEE_Iberia_Events.8
	title = FEE_Iberia_Events.8.T
	desc = FEE_Iberia_Events.8.D
	picture = COUNTRY_COLLAPSE_eventPicture

	fire_only_once = yes

	mean_time_to_happen = {
		months = 60
	}

	trigger = {
		is_year = 1755
		NOT = { is_year = 1760 }
		owns = 227
	}

	option = {
		name = FEE_Iberia_Events.8.OPT1

		ai_chance = {
			factor = 33
		}

		add_stability = -1
		227 = {
			add_base_tax = -2
			add_base_production = -2
			add_base_manpower = -2
			add_devastation = 100
		}
	}

	option = {
		name = FEE_Iberia_Events.8.OPT2

		ai_chance = {
			factor = 33
		}

		add_stability_or_adm_power = yes
		add_years_of_income = -2
		add_dip_power = -75

		add_ruler_modifier = {
			name = iberia_ministerial_power
			duration = -1
		}

		227 = {
			add_base_manpower = -3
			add_devastation = 60
		}
	}

	option = {
		name = FEE_Iberia_Events.8.OPT3

		ai_chance = {
			factor = 33
		}

		add_war_exhaustion = 4
		add_mil_power = -125

		add_country_modifier = {
			name = iberia_order_restored
			duration = 3650
		}
		if = {
			limit = {
				has_estate = estate_nobles
			}
			add_estate_loyalty_modifier = {
				estate = estate_nobles
				desc = iberia_order_restored
				loyalty = 5
				duration = 3650
			}
		}

		227 = {
			add_base_tax = -1
			add_base_production = -1
			add_base_manpower = -1
			add_devastation = 75
			add_permanent_province_modifier = {
				name = iberia_oppressive_government
				duration = 3650
			}
		}
	}

	after = {
		hidden_effect = {
			country_event = {
				id = FEE_Iberia_Events.9
				days = 60
				random = 15
			}
		}
	}
}

#Foundations of Seismology
country_event = {
	id = FEE_Iberia_Events.9
	title = FEE_Iberia_Events.9.T
	desc = FEE_Iberia_Events.9.D
	picture = ENLIGHTENMENT_eventPicture

	is_triggered_only = yes

	option = {
		name = FEE_Iberia_Events.9.OPT1

		ai_chance = {
			factor = 100
		}

		if = {
			limit = {
				has_dlc = "Rule Britannia"
			}
			change_innovativeness = 3
			add_country_modifier = {
				name = iberia_seismological_studies_innovativeness
				duration = 9125
			}
		}
		else = {
			add_country_modifier = {
				name = iberia_seismological_studies_no_innovativeness
				duration = 9125
			}
		}

		define_advisor = {
			type = natural_scientist
			skill = 2
			cost_multiplier = 0.50
		}
	}
}

#Foundations of Seismology
country_event = {
	id = FEE_Iberia_Events.10
	title = FEE_Iberia_Events.10.T
	desc = FEE_Iberia_Events.10.D
	picture = ENLIGHTENMENT_eventPicture

	trigger = {
		culture_group = iberian
		owns = 217
		owns = 219
		NOT = { tag = POR }
		religion = catholic
		current_age = age_of_discovery
	}

	fire_only_once = yes

	mean_time_to_happen = {
		months = 300
	}

	option = {
		name = FEE_Iberia_Events.10.OPT1

		ai_chance = {
			factor = 33
			modifier = {
				factor = 100
				ai = yes
			}
		}
		add_reform_desire = -0.02
		define_advisor = {
			type = theologian
			name = "Jimenez de Cisneros"
			skill = 3
			culture = castillian
			religion = catholic
			cost_multiplier = 0.5
		}
		country_event = {
			id = FEE_Iberia_Events.11
		}
		add_corruption = -2
		add_country_modifier = {
			name = iberia_lay_piety
			duration = -1
		}
		reduce_estate_church_loyalty_effect = yes
	}

	option = {
		name = FEE_Iberia_Events.10.OPT2

		ai_chance = {
			factor = 33
		}
		add_reform_desire = -0.01
		add_stability_or_adm_power = yes
		add_corruption = -1
		add_estate_church_loyalty_effect = yes
	}

	option = {
		name = FEE_Iberia_Events.10.OPT3

		ai_chance = {
			factor = 33
		}
		add_reform_desire = 0.02
		add_stability_or_adm_power = yes
		add_corruption = 1
		add_country_modifier = {
			name = iberia_reforms_rejected
			duration = -1
		}
	}
}

# University of Alcala
country_event = {
	id = FEE_Iberia_Events.11
	title = FEE_Iberia_Events.11.T
	desc = FEE_Iberia_Events.11.D
	picture = ENLIGHTENMENT_eventPicture

	is_triggered_only = yes

	option = {
		name = FEE_Iberia_Events.11.OPT1

		ai_chance = {
			factor = 50
		}
		add_years_of_income = -0.5
		add_innovativeness_or_monarch_power = {
			amount = 3
			adm = 30
			dip = 30
			mil = 30
		}
		add_country_modifier = {
			name = iberia_school_alcala
			duration = -1
		}
		217 = {
			owner = {
				if = {
					limit = {
						religion = catholic
					}
					add_country_modifier = {
						name = iberia_university_alcala
						duration = -1
					}
				}
			}
		}
		if = {
			limit = {
				has_estate = estate_church
			}
			add_estate_loyalty = {
				estate = estate_church
				loyalty = 10
			}
			add_estate_influence_modifier = {
				estate = estate_church
				desc = iberia_university_alcala_accepted
				influence = 10
				duration = 5475
			}
		}
	}

	option = {
		name = FEE_Iberia_Events.11.OPT2

		ai_chance = {
			factor = 50
		}
		add_years_of_income = 0.5
		add_prestige = -15
		if = {
			limit = {
				has_estate = estate_church
			}
			add_estate_loyalty = {
				estate = estate_church
				loyalty = -10
			}
			add_estate_influence_modifier = {
				estate = estate_church
				desc = iberia_university_alcala_refused
				influence = -10
				duration = 5475
			}
		}
	}
}

# On the Donation of Constantine
country_event = {
	id = FEE_Iberia_Events.12
	title = FEE_Iberia_Events.12.T
	desc = FEE_Iberia_Events.12.D
	picture = CHURCH_ESTATE_1_eventPicture

	trigger = {
		tag = ARA
		current_age = age_of_discovery
		religion = catholic
		is_subject = no
		num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
			value = 3
			region = italy_region
		}
	}

	fire_only_once = yes
	major = yes

	mean_time_to_happen = {
		months = 24
	}

	option = {
		name = FEE_Iberia_Events.12.OPT1

		ai_chance = {
			factor = 33
		}
		add_prestige_or_monarch_power = { amount = 15 }
		add_reform_desire = 0.05
		PAP = {
			add_opinion = {
				who = ROOT
				modifier = iberia_papal_fraud_uncovered_opinion
			}
		}
		add_opinion = {
			who = PAP
			modifier = iberia_papal_fraud_uncovered_opinion
		}
		emperor = {
			add_opinion = {
				who = ROOT
				modifier = iberia_papal_fraud_uncovered_opinion
			}
		}
		add_opinion = {
			who = emperor
			modifier = iberia_papal_fraud_uncovered_opinion
		}
		custom_tooltip = FEE_Iberia_Events.12.tt
		hidden_effect = {
			every_country = {
				limit = {
					religion = catholic
					NOT = { tag = ROOT }
				}
				add_opinion = {
					who = PAP
					modifier = iberia_papal_fraud_uncovered_opinion
				}
				reverse_add_opinion = {
					who = PAP
					modifier = iberia_papal_fraud_uncovered_opinion
				}
			}
		}
		define_advisor = {
			type = philosopher
			name = "Lorenzo Valla"
			skill = 2
			culture = umbrian
			religion = catholic
			cost_multiplier = 0.5
		}
		add_country_modifier = {
			name = iberia_papal_fraud_uncovered
			duration = 9125
		}
	}

	option = {
		name = FEE_Iberia_Events.12.OPT2

		ai_chance = {
			factor = 33
		}

		add_reform_desire = 0.03
		add_stability_or_adm_power = yes
		define_advisor = {
			type = philosopher
			name = "Lorenzo Valla"
			skill = 2
			culture = umbrian
			religion = catholic
			cost_multiplier = 0.5
		}
		add_country_modifier = {
			name = iberia_reconcilation_pope
			duration = 9125
		}
	}

	option = {
		name = FEE_Iberia_Events.12.OPT3
		custom_tooltip = FEE_Iberia_Events.12.OPT3.tt
		ai_chance = {
			factor = 33
		}

		add_reform_desire = -0.01
		add_stability = -1
		add_country_modifier = {
			name = iberia_submission_pope
			duration = 9125
		}
	}
}

# Juan de Avila
country_event = {
	id = FEE_Iberia_Events.13
	title = FEE_Iberia_Events.13.T
	desc = FEE_Iberia_Events.13.D
	picture = ENLIGHTENMENT_eventPicture

	trigger = {
		culture_group = iberian
		religion = catholic
		lower_andalucia_area = {
			type = all
			owned_by = ROOT
		}
		upper_andalucia_area = {
			type = all
			owned_by = ROOT
		}
		owns = 223
	}

	fire_only_once = yes

	mean_time_to_happen = {
		months = 500
	}

	option = {
		name = FEE_Iberia_Events.13.OPT1

		ai_chance = {
			factor = 33
		}

		define_advisor = {
			type = theologian
			name = "Juan de Avila"
			skill = 3
			culture = andalucian
			religion = catholic
			cost_multiplier = 0.25
		}
		add_reform_desire = -0.01
		add_country_modifier = {
			name = iberia_recogimiento
			duration = -1
		}
		if = {
			limit = {
				has_estate = estate_church
			}
			add_estate_loyalty = {
				estate = estate_church
				loyalty = -10
			}
			add_estate_influence_modifier = {
				estate = estate_church
				desc = iberia_juan_de_avila_welcomed
				influence = -10
				duration = 5475
			}
		}
		if = {
			limit = {
				has_estate = estate_nobles
			}
			add_estate_loyalty = {
				estate = estate_nobles
				loyalty = -10
			}
			add_estate_influence_modifier = {
				estate = estate_nobles
				desc = iberia_juan_de_avila_welcomed
				influence = -10
				duration = 5475
			}
		}
		custom_tooltip = FEE_IBERIA_JUAN_AVILA_TT
		tooltip = {
			random_owned_province = {
				limit = { culture = andalucian }
				add_permanent_province_modifier = {
					name = iberia_juan_avila
					duration = 7300
				}
			}
		}
		hidden_effect = {
			every_owned_province = {
				limit = { culture = andalucian }
				add_permanent_province_modifier = {
					name = iberia_juan_avila
					duration = 7300
				}
			}
		}
	}

	option = {
		name = FEE_Iberia_Events.13.OPT2

		ai_chance = {
			factor = 33
		}

		add_stability_or_adm_power = yes
		add_country_modifier = {
			name = iberia_recogimiento
			duration = -1
		}
		if = {
			limit = {
				has_estate = estate_church
			}
			add_estate_loyalty = {
				estate = estate_church
				loyalty = -10
			}
			add_estate_influence_modifier = {
				estate = estate_church
				desc = iberia_juan_de_avila_freed
				influence = -10
				duration = 5475
			}
		}
		if = {
			limit = {
				has_estate = estate_nobles
			}
			add_estate_loyalty = {
				estate = estate_nobles
				loyalty = -10
			}
			add_estate_influence_modifier = {
				estate = estate_nobles
				desc = iberia_juan_de_avila_freed
				influence = -10
				duration = 5475
			}
		}
	}

	option = {
		name = FEE_Iberia_Events.13.OPT3

		ai_chance = {
			factor = 33
		}

		add_reform_desire = 0.01
		add_country_modifier = {
			name = iberia_recogimiento
			duration = -1
		}
		add_estate_church_loyalty_effect = yes
		add_estate_nobles_loyalty_effect = yes
		every_owned_province = {
			limit = {
				culture = andalucian
			}
			add_permanent_province_modifier = {
				name = iberia_suppressed_reform
				duration = 7300
			}
		}
	}
}

# Reforming the Benedictine Order
country_event = {
	id = FEE_Iberia_Events.14
	title = FEE_Iberia_Events.14.T
	desc = FEE_Iberia_Events.14.D
	picture = ENLIGHTENMENT_eventPicture

	trigger = {
		culture_group = iberian
		religion = catholic
		has_dlc = "Golden Century"
		current_age = age_of_reformation
		owns = 215
	}

	fire_only_once = yes

	mean_time_to_happen = {
		months = 240
	}

	option = {
		name = FEE_Iberia_Events.14.OPT1

		ai_chance = {
			factor = 50
		}
		add_stability_or_adm_power = yes
		add_years_of_income = -0.5
		add_country_modifier = {
			name = iberia_benedictine_reforms
			duration = -1
		}
	}

	option = {
		name = FEE_Iberia_Events.14.OPT2

		ai_chance = {
			factor = 50
		}
		add_prestige = -10
	}
}

# Reform among the Franciscans
country_event = {
	id = FEE_Iberia_Events.15
	title = FEE_Iberia_Events.15.T
	desc = FEE_Iberia_Events.15.D
	picture = ENLIGHTENMENT_eventPicture

	trigger = {
		culture_group = iberian
		religion = catholic
		has_dlc = "Golden Century"
		current_age = age_of_reformation
	}

	fire_only_once = yes

	mean_time_to_happen = {
		months = 240
	}

	option = {
		name = FEE_Iberia_Events.15.OPT1

		ai_chance = {
			factor = 33
		}
		add_stability = -1
		add_country_modifier = {
			name = iberia_strict_franciscans
			duration = -1
		}
	}

	option = {
		name = FEE_Iberia_Events.15.OPT2

		ai_chance = {
			factor = 33
		}
		add_stability_or_adm_power = yes
		add_country_modifier = {
			name = iberia_gradual_franciscans_reform
			duration = -1
		}
	}

	option = {
		name = FEE_Iberia_Events.15.OPT3

		ai_chance = {
			factor = 33
		}
		add_stability = -1
		add_country_modifier = {
			name = iberia_orthodoxy_enforced
			duration = 18250
		}
		random_owned_province = {
			limit = {
				area = upper_andalucia_area
			}
			spawn_rebels = {
				size = 2
				type = catholic_rebels
			}
		}
	}
}

# The Jesuits and the Ministry of Teaching
country_event = {
	id = FEE_Iberia_Events.16
	title = FEE_Iberia_Events.16.T
	desc = FEE_Iberia_Events.16.D
	picture = ENLIGHTENMENT_eventPicture

	trigger = {
		tag = SPA
		current_age = age_of_reformation
		religion = catholic
		has_country_modifier = counter_reformation
		has_country_modifier = the_societas_jesu
		is_year = 1566
	}

	fire_only_once = yes

	mean_time_to_happen = {
		months = 100
	}

	option = {
		name = FEE_Iberia_Events.16.OPT1

		ai_chance = {
			factor = 50
		}
		add_years_of_income = -0.25
		change_religious_influence_equivalent_fee = { add = 10 }
		add_country_modifier = {
			name = iberia_jesuit_education
			duration = -1
		}
	}

	option = {
		name = FEE_Iberia_Events.16.OPT2

		ai_chance = {
			factor = 50
		}
		add_prestige_or_monarch_power = { amount = 25 }
	}
}

# Luis de Molina
country_event = {
	id = FEE_Iberia_Events.17
	title = FEE_Iberia_Events.17.T
	desc = FEE_Iberia_Events.17.D
	picture = ENLIGHTENMENT_eventPicture

	trigger = {
		culture_group = iberian
		religion = catholic
		current_age = age_of_reformation
		is_religion_enabled = reformed
		is_religion_enabled = protestant
	}

	fire_only_once = yes

	mean_time_to_happen = {
		months = 100
	}

	option = {
		name = FEE_Iberia_Events.17.OPT1

		ai_chance = {
			factor = 33
		}
		define_advisor = {
			type = theologian
			name = "Luis de Molina"
			skill = 3
			culture = portugese
			religion = catholic
			cost_multiplier = 0.5
		}
		add_country_modifier = {
			name = iberia_molinism
			duration = -1
		}
	}

	option = {
		name = FEE_Iberia_Events.17.OPT2

		ai_chance = {
			factor = 33
		}
		change_religious_influence_equivalent_fee = { add = 10 }
		add_prestige_or_monarch_power = { amount = 15 }
	}

	option = {
		name = FEE_Iberia_Events.17.OPT3

		ai_chance = {
			factor = 33
		}
		add_stability_or_adm_power = yes
	}
}

# Jesuit Plot Uncovered
country_event = {
	id = FEE_Iberia_Events.18
	title = FEE_Iberia_Events.18.T
	desc = FEE_Iberia_Events.18.D
	picture = ENLIGHTENMENT_eventPicture

	trigger = {
		has_country_modifier = iberia_jesuit_education
	}

	fire_only_once = yes

	mean_time_to_happen = {
		months = 500
	}

	option = {
		name = FEE_Iberia_Events.18.OPT1

		ai_chance = {
			factor = 50
		}
		add_stability = -1
		add_legitimacy_equivalent = { amount = -20 republican_tradition = -10 }
	}

	option = {
		name = FEE_Iberia_Events.18.OPT2

		ai_chance = {
			factor = 50
		}
		add_stability_or_adm_power = yes
		add_prestige_or_monarch_power = { amount = 25 }
		add_years_of_income = 1
		remove_country_modifier = iberia_jesuit_education
		random_owned_province = {
			spawn_rebels = {
				size = 1
				type = catholic_rebels
			}
		}
		random_owned_province = {
			spawn_rebels = {
				size = 1
				type = catholic_rebels
			}
		}
		random_owned_province = {
			spawn_rebels = {
				size = 1
				type = catholic_rebels
			}
		}
	}
}

# The Poor Laws
country_event = {
	id = FEE_Iberia_Events.19
	title = FEE_Iberia_Events.19.T
	desc = FEE_Iberia_Events.19.D
	picture = ENLIGHTENMENT_eventPicture

	trigger = {
		culture_group = iberian
		is_year = 1550
		is_religion_enabled = reformed
		is_religion_enabled = protestant
		religion = catholic
	}

	fire_only_once = yes

	mean_time_to_happen = {
		months = 300
	}

	option = {
		name = FEE_Iberia_Events.19.OPT1

		ai_chance = {
			factor = 33
		}
		add_adm_power = -100
		add_country_modifier = {
			name = iberia_poor_laws
			duration = -1
		}
	}

	option = {
		name = FEE_Iberia_Events.19.OPT2

		ai_chance = {
			factor = 33
		}
		add_stability_or_adm_power = yes
		add_country_modifier = {
			name = iberia_traditional_charity
			duration = -1
		}
		if = {
			limit = {
				has_estate = estate_church
			}
			add_estate_loyalty = {
				estate = estate_church
				loyalty = 10
			}
			add_estate_influence_modifier = {
				estate = estate_church
				desc = iberia_traditional_charity_estate
				influence = 15
				duration = 5475
			}
		}
	}

	option = {
		name = FEE_Iberia_Events.19.OPT2

		ai_chance = {
			factor = 33
		}
		add_stability_or_adm_power = yes
		add_country_modifier = {
			name = iberia_poor_laws_church_support
			duration = -1
		}
		add_estate_church_loyalty_effect = yes
	}
}

# Pedro Alvarez de Toledo
country_event = {
	id = FEE_Iberia_Events.20
	title = FEE_Iberia_Events.20.T
	desc = FEE_Iberia_Events.20.D
	picture = ADVISOR_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = CAS
			tag = ARA
			tag = SPA
		}
		owns_core_province = 121
		is_year = 1520
		NOT = { is_year = 1560 }
	}

	mean_time_to_happen = {
		months = 360
	}

	# His work in naples makes the crown proud.
	option = {
		name = FEE_Iberia_Events.20.OPT1

		121 = {
			add_base_tax = 1
			add_base_production = 1
		}
	}

	# His talent should be used in other parts of our country.
	option = {
		name = FEE_Iberia_Events.20.OPT2

		add_adm_power = 50
		add_dip_power = 25
	}
}