#Navarran events

namespace = FEE_Navarra_Events

# The Wedding of Navarra
country_event = {
	id = FEE_Navarra_Events.1
	title = FEE_Navarra_Events.1.T
	desc = FEE_Navarra_Events.1.D
	picture = GOOD_WITH_MONARCH_eventPicture

	fire_only_once = yes

	trigger = {
		tag = NAV
		is_free_or_tributary_trigger = yes
		ARA = {
			is_free_or_tributary_trigger = yes
		}
		has_opinion = {
			who = ARA
			value = -10
		}
		OR = {
			AND = {
				is_female = yes
				ARA = {
					is_female = no
				}
			}
			AND = {
				OR = {
					has_female_heir = yes
					has_heir = no
				}
				ARA = {
					has_heir = yes
					has_female_heir = no
				}
			}
			AND = {
				is_female = yes
				ARA = {
					has_female_heir = no
					heir_age = 15
				}
			}
		}
		NOT = { is_year = 1510 }
	}

	mean_time_to_happen = {
		months = 90
	}

	option = {
		name = FEE_Navarra_Events.1.OPT1
		ai_chance = {
			factor = 90
		}

		ARA = {
			country_event = {
				id = FEE_Navarra_Events.2
			}
		}
	}

	option = {
		name = FEE_Navarra_Events.1.OPT2
		ai_chance = {
			factor = 10
		}

		add_legitimacy_equivalent = { amount = -5 republican_tradition = -3 }
		add_prestige_or_monarch_power = { amount = 5 }
	}
}

# Navarran wedding
country_event = {
	id = FEE_Navarra_Events.2
	title = FEE_Navarra_Events.2.T
	desc = FEE_Navarra_Events.2.D
	picture = GOOD_WITH_MONARCH_eventPicture

	is_triggered_only = yes

	option = {
		name = FEE_Navarra_Events.2.OPT1
		ai_chance = {
			factor = 100
			modifier = {
				factor = 0
				is_subject = yes
			}
		}

		if = {
			limit = {
				valid_for_personal_unions_trigger = yes
				NAV = { valid_for_personal_unions_trigger = yes }
			}
			create_union = NAV
		}
	}

	option = {
		name = FEE_Navarra_Events.2.OPT2
		ai_chance = {
			factor = 0
			modifier = {
				factor = 100
				is_subject = yes
			}
		}

		add_legitimacy_equivalent = { amount = -5 republican_tradition = -3 }
		FROM = {
			country_event = {
				id = FEE_Navarra_Events.3
			}
		}
	}
}

# Aragon rejects
country_event = {
	id = FEE_Navarra_Events.3
	title = FEE_Navarra_Events.3.T
	desc = FEE_Navarra_Events.3.D
	picture = COURT_eventPicture

	is_triggered_only = yes

	option = {
		name = FEE_Navarra_Events.3.OPT1

		add_opinion = {
			who = FROM
			modifier = fee_nav_rejected_marriage_offer
		}
	}
}

# Navarran Civil War Not Aragon
country_event = {
	id = FEE_Navarra_Events.4
	title = FEE_Navarra_Events.4.T
	desc = FEE_Navarra_Events.4.D
	picture = CIVIL_WAR_eventPicture

	fire_only_once = yes

	trigger = {
		tag = NAV
		is_lesser_in_union = yes
		NOT = { junior_union_with = ARA }
		NOT = { is_year = 1500 }
		NOT = { has_country_flag = fee_nav_navarran_civil_war }
	}

	mean_time_to_happen = {
		months = 48
		modifier = {
			factor = 0.5
			NOT = {
				legitimacy = 75
			}
		}
		modifier = {
			factor = 0.8
			NOT = {
				stability = 1
			}
		}
	}

	immediate = {
		hidden_effect = {
			set_country_flag = fee_nav_navarran_civil_war
		}
	}

	option = {
		name = FEE_Navarra_Events.4.OPT1

		random_owned_province = {
			spawn_rebels = {
				type = pretender_rebels
				size = 3
				leader = "Carlos de Trastamara"
			}
		}
		overlord = {
			country_event = {
				id = FEE_Navarra_Events.5
			}
		}
	}
}

# Notification to Overlord
country_event = {
	id = FEE_Navarra_Events.5
	title = FEE_Navarra_Events.5.T
	desc = FEE_Navarra_Events.5.D
	picture = BATTLE_eventPicture

	is_triggered_only = yes

	option = {
		name = FEE_Navarra_Events.5.OPT1

		add_prestige = -5
	}
}

# Navarran Civil War with Aragon
country_event = {
	id = FEE_Navarra_Events.6
	title = FEE_Navarra_Events.6.T
	desc = FEE_Navarra_Events.6.D
	picture = CIVIL_WAR_eventPicture

	fire_only_once = yes

	trigger = {
		tag = NAV
		junior_union_with = ARA
		ARA = {
			has_regency = no
		}
		NOT = { is_year = 1500 }
		NOT = { has_country_flag = fee_nav_navarran_civil_war }
	}

	mean_time_to_happen = {
		months = 60
		modifier = {
			factor = 0.5
			NOT = {
				legitimacy = 75
			}
		}
		modifier = {
			factor = 0.8
			NOT = {
				stability = 1
			}
		}
	}

	immediate = {
		hidden_effect = {
			set_country_flag = fee_nav_navarran_civil_war
		}
	}

	option = {
		name = FEE_Navarra_Events.6.OPT1

		ARA = {
			country_event = {
				id = FEE_Navarra_Events.7
			}
		}
	}
}

# Aragon Reacts
country_event = {
	id = FEE_Navarra_Events.7
	title = FEE_Navarra_Events.7.T
	desc = FEE_Navarra_Events.7.D
	picture = LIBERUM_VETO_eventPicture

	is_triggered_only = yes

	option = {
		name = FEE_Navarra_Events.7.OPT1
		ai_chance = {
			factor = 85
		}
		NAV = {
			random_owned_province = {
				spawn_rebels = {
					type = pretender_rebels
					size = 3
					leader = "Carlos de Trastamara"
				}
			}
		}
	}

	option = {
		name = FEE_Navarra_Events.7.OPT2
		trigger = {
			has_heir = yes
		}
		ai_chance = {
			factor = 15
		}

		kill_ruler = yes
		if = {
			limit = {
				OR = {
					NAV = {
						NOT = {
							has_opinion = {
								who = ARA
								value = 1
							}
						}
					}
					NOT = {
						prestige = 1
					}
				}
				valid_for_personal_unions_trigger = yes
				NAV = { valid_for_personal_unions_trigger = yes }
			}
			create_union = NAV
		}
		NAV = {
			country_event = { id = FEE_Navarra_Events.8 days = 3 }
		}
	}

	option = {
		name = FEE_Navarra_Events.7.OPT3

		break_union = NAV
		NAV = {
			define_ruler = {
				name = "Carlos"
				dynasty = "de Trastamara"
				ADM = 3
				DIP = 4
				MIL = 5
				age = 16
			}
			country_event = { id = FEE_Navarra_Events.9 }
		}
	}
}

#The King of Aragon Abdicates!
country_event = {
	id = FEE_Navarra_Events.8
	title = FEE_Navarra_Events.8.T
	desc = FEE_Navarra_Events.8.D
	picture = COURT_eventPicture

	is_triggered_only = yes

	option = {
		name = FEE_Navarra_Events.8.OPT1

		add_legitimacy_equivalent = { amount = -15 republican_tradition = -8 }
	}
}

#Navarra passes to Carlos
country_event = {
	id = FEE_Navarra_Events.9
	title = FEE_Navarra_Events.9.T
	desc = FEE_Navarra_Events.9.D
	picture = DIPLOMACY_eventPicture

	is_triggered_only = yes

	option = {
		name = FEE_Navarra_Events.9.OPT1

		add_legitimacy_equivalent = { amount = 5 republican_tradition = 3 }
		add_adm_power = 10
		add_dip_power = 10
		add_mil_power = 10
	}
}

#St. Francis of Xavier
country_event = {
	id = FEE_Navarra_Events.10
	title = FEE_Navarra_Events.10.T
	desc = FEE_Navarra_Events.10.D
	picture = RELIGIOUS_CONVERSION_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = NAV
			AND = {
				NOT = { exists = NAV }
				tag = SPA
			}
		}
		is_year = 1500
		NOT = { is_year = 1551 }
		OR = {
			religion = catholic
			religion = protestant
			religion = reformed
		}
	}

	mean_time_to_happen = {
		months = 360
		modifier = {
			factor = 0.9
			has_idea_group = religious_ideas
		}
	}

	option = { #He should serve as a minister
		name = FEE_Navarra_Events.10.OPT1
		ai_chance = {
			factor = 15
		}

		define_advisor = {
			type = inquisitor
			name = "Francis of Xavier"
			skill = 2
			discount = yes
		}
	}

	option = { #God leads his path
		name = FEE_Navarra_Events.10.OPT2
		ai_chance = {
			factor = 85
		}

		add_dip_power = 150
		hidden_effect = {
			random_province = {
				limit = {
					is_capital = no
					OR = {
						region = japan_region
						region = indonesia_region
						region = deccan_region
					}
				}
				province_event = { id = FEE_Navarra_Events.12 days = 365 }
			}
			random_province = {
				limit = {
					is_capital = no
					OR = {
						region = japan_region
						region = indonesia_region
						region = deccan_region
					}
				}
				province_event = { id = FEE_Navarra_Events.12 days = 365 random = 90}
			}
		}
		custom_tooltip = fee_nav_francis_xavier_conversion
	}
}

#Ciudadela de Pamplona
country_event = {
	id = FEE_Navarra_Events.11
	title = FEE_Navarra_Events.11.T
	desc = FEE_Navarra_Events.11.D
	picture = FORT_eventPicture

	fire_only_once = yes

	trigger = {
		OR = {
			tag = NAV
			AND = {
				tag = SPA
				NOT = { exists = NAV }
			}
			AND = {
				tag = ARA
				NOT = { exists = NAV }
			}
		}
		owns = 210
		is_year = 1570
		NOT = { is_year = 1630 }
		exists = FRA
		NOT = { alliance_with = FRA }
		NOT = {
			has_opinion = {
				who = FRA
				value = 50
			}
		}
	}

	mean_time_to_happen = {
		months = 420
		modifier = {
			factor = 0.7
			truce_with = FRA
		}
		modifier = {
			factor = 0.8
			is_rival = FRA
		}
		modifier = {
			factor = 0.8
			FRA = {
				is_rival = ROOT
			}
		}
	}

	option = { #Build a great fort!
		name = FEE_Navarra_Events.11.OPT1
		ai_chance = {
			factor = 90
			modifier = {
				factor = 0
				num_of_loans = 5
			}
		}

		add_years_of_income = -0.25
		210 = {
			add_province_modifier = {
				name = fee_nav_ciudadela_pamplona
				duration = -1
			}
		}
		if = {
			limit = {
				NOT = {
					210 = {
						fort_level = 2
					}
				}
			}
			210 = {
				add_or_upgrade_fort_building = yes
			}
		}
	}

	option = { #Let's develop a different strategy
		name = FEE_Navarra_Events.11.OPT2
		ai_chance = {
			factor = 10
			modifier = {
				factor = 100
				num_of_loans = 5
			}
		}

		add_mil_power = 20
	}
}

#Converted by Francis Xavier
province_event = {
	id = FEE_Navarra_Events.12
	title = FEE_Navarra_Events.12.T
	desc = FEE_Navarra_Events.12.D
	picture = RELIGIOUS_CONVERSION_eventPicture

	is_triggered_only = yes

	option = {
		name = FEE_Navarra_Events.12.OPT1

		change_religion = FROM
	}
}