########################################
# Flavor Events for Aragon
#
# written by Sara Wendel-rtqvist
########################################

namespace = flavor_ara
normal_or_historical_nations = yes

# Consulate of the Sea
country_event = {
	id = flavor_ara.1
	title = "flavor_ara.EVTNAME1"
	desc = "flavor_ara.EVTDESC1"
	picture = COURT_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		OR = {
			AND = {
				NOT = { has_dlc = "Golden Century" }
				tag = ARA
				NOT = { is_year = 1500 }
				NOT = {
					has_country_modifier = ara_consulate_sea
				}
			}
			has_country_flag = ara_consulate_flag
		}
	}
	
	mean_time_to_happen = {
		months = 200
	}
	
	option = {
		name = "flavor_ara.EVTOPTA1"
		if = {
			limit = { has_dlc = "Domination" }
			add_government_reform = consulate_of_the_sea
		}
		else = {
			add_country_modifier = {
				name = ara_consulate_sea
				duration = 18250
			}
		}
	}
}

# Book of the Consulate of the Sea
country_event = {
	id = flavor_ara.2
	title = "flavor_ara.EVTNAME2"
	desc = "flavor_ara.EVTDESC2"
	picture = ECONOMY_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		tag = ARA
		has_country_modifier = ara_consulate_sea
		NOT = { has_country_modifier = ara_book_consulate_sea }
	}
	
	mean_time_to_happen = {
		months = 200
	}
	
	option = {
		name = "flavor_ara.EVTOPTA2"
		add_years_of_income = -0.5
		if = {
			limit = {
				NOT = { has_completed_all_reforms_trigger = yes }
			}
			add_reform_progress_small_effect = yes
		}
		remove_country_modifier = ara_consulate_sea
		add_country_modifier = {
			name = ara_book_consulate_sea
			duration = -1
		}
	}
	option = {
		name = "flavor_ara.EVTOPTB2"
		add_prestige = -1
	}
}

# Antonio Beccadelli (poet)
country_event = {
	id = flavor_ara.3
	title = "flavor_ara.EVTNAME3"
	desc = "flavor_ara.EVTDESC3"
	picture = ADVISOR_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		tag = ARA
		NOT = { is_year = 1471 }
		OR = {
			dip = 3
			adm = 3
		}
	}
	
	mean_time_to_happen = {
		months = 200
	}
	
	option = {
		name = "flavor_ara.EVTOPTA3"
		add_adm_power = 10
		add_prestige = 10
		define_advisor = {
			type = artist
			name = "Antonio Beccadelli"
			culture = sicilian
			skill = 2
			discount = yes
		}
		add_innovativeness_small_effect = yes
	}
}

# Iovianus Pontanus
country_event = {
	id = flavor_ara.4
	title = "flavor_ara.EVTNAME4"
	desc = "flavor_ara.EVTDESC4"
	picture = ECONOMY_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		tag = ARA
		NOT = { is_year = 1503 }
		OR = {
			dip = 3
			adm = 3
		}
	}
	
	mean_time_to_happen = {
		months = 200
	}
	
	option = {
		name = "flavor_ara.EVTOPTA4"
		add_prestige = 10
		add_innovativeness_small_effect = yes
	}
	option = {
		name = "flavor_ara.EVTOPTB4"
		add_stability_or_adm_power = yes
		add_innovativeness_small_effect = yes
	}
}

# Monastery of Santa Mara de Sigena
country_event = {
	id = flavor_ara.5
	title = "flavor_ara.EVTNAME5"
	desc = "flavor_ara.EVTDESC5"
	picture = ST_PETERS_CHURCH_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		tag = ARA
		NOT = { is_year = 1520 }
		NOT = { has_country_modifier = ara_monastery_maria }
		religion = catholic
	}
	
	mean_time_to_happen = {
		months = 200
	}
	
	option = {
		name = "flavor_ara.EVTOPTA5"
		add_years_of_income = -0.5
		add_country_modifier = { 
			name = ara_monastery_maria 
			duration = 18250
		}
	}
	option = {
		name = "flavor_ara.EVTOPTB5"
		add_years_of_income = -0.5
		add_country_modifier = { 
			name = ara_monastery_painter
			duration = 18250
		}
	}
	option = {
		name = "flavor_ara.EVTOPTC5"
		add_prestige = -1
	}
}

# Sindicat Remena
country_event = {
	id = flavor_ara.6
	title = "flavor_ara.EVTNAME6"
	desc = "flavor_ara.EVTDESC6"
	picture = ELECTION_REPUBLICAN_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		tag = ARA
		catalonia_area = {
			type = all 
			country_or_non_sovereign_subject_holds = ROOT 
		}
	}
	
	mean_time_to_happen = {
		months = 60
	}
	
	immediate = {
		hidden_effect = {
			set_country_flag = ara_remensa_flag
			random_owned_province = {
				limit = {
					is_core = ROOT
					culture = catalan
				}
				set_province_flag = ara_sindicat_remensa_flag
			}
			random_owned_province = {
				limit = {
					is_core = ROOT
					culture = catalan
					NOT = {  has_province_flag = ara_sindicat_remensa_flag }
				}
				set_province_flag = ara_sindicat_remensa_flag
			}
			random_owned_province = {
				limit = {
					is_core = ROOT
					culture = catalan
					NOT = { has_province_flag = ara_sindicat_remensa_flag }
				}
				set_province_flag = ara_sindicat_remensa_flag
			}
		}
	}
	
	option = {
		name = "flavor_ara.EVTOPTA6"
		trigger = {
			if = { 
				limit = { has_dlc = "Domination" }
				has_estate = estate_burghers
			}
		}
		add_country_modifier = {
			name = "decentralization_modifier"
			duration = 3650
		}
		if = {
			limit = { has_dlc = "Domination" }
			set_country_flag = remensa_privilege_flag
			set_estate_privilege = estate_burghers_sindicat_remensa_privilege
		}
		else = {
			every_owned_province = {
				limit = {
					has_province_flag = ara_sindicat_remensa_flag
				}
				add_province_modifier = { 
					name = ara_sindicat_remensa 
					duration = -1
				}
			}
			hidden_effect = {
				every_owned_province = {
					limit = {
						has_province_flag = ara_sindicat_remensa_flag
					}
					clr_province_flag = ara_sindicat_remensa_flag
				}
			}
		}
		ai_chance = {
			factor = 45
		}
	}
	option = {
		name = "flavor_ara.EVTOPTB6"
		every_owned_province = {
			limit = {
				has_province_flag = ara_sindicat_remensa_flag
			}
			clr_province_flag = ara_sindicat_remensa_flag
			spawn_rebels = {
				type = anti_tax_rebels
				size = 2
			}
			add_local_autonomy = -25
		}
		ai_chance = {
			factor = 45
		}
	}
	
	option = {
		name = "flavor_ara.EVTOPTC6"
		
		if = { 
			limit = { 
				stability = 0 
			}
			add_stability = -3 
		}
		else = { 
			add_adm_power = -50 
			add_dip_power = -50
			add_mil_power = -50
		}
		every_owned_province = {
			limit = {
				has_province_flag = ara_sindicat_remensa_flag
			}
			clr_province_flag = ara_sindicat_remensa_flag
			spawn_rebels = {
				type = noble_rebels
				size = 3
			}
		}
		define_ruler = {
			name = "ric" 
			DIP = 6
			ADM = 5
			MIL = 4
			age = 28
			
		}
		if = {
			limit = { has_dlc = "Rights of Man" }
			add_ruler_personality = careful_personality
			add_ruler_personality = peasant_revolt_leader_personality
		}
		custom_tooltip = ara_become_p_republic_tt
		add_stability_or_adm_power = yes 
		hidden_effect = {
			change_government = republic 
			add_government_reform = peasants_republic
			hidden_effect = { add_republican_tradition = 100 }
		}
		ai_chance = {
			factor = 10
		}
	}
}



########################################
# Additions by Michael Kundak Cowall
########################################

# The Neapolitan Succession
country_event = {
	id = flavor_ara.7
	title = "flavor_ara.EVTNAME7"
	desc = "flavor_ara.EVTDESC7"
	picture = KING_SICK_IN_BED_eventPicture
	
	fire_only_once = yes
	
	major = yes
	
	trigger = {
		tag = ARA
		NOT = { has_ruler = "000000 V" }
		NOT = { has_country_flag = alfonso_died_yes_really }
		NAP = { junior_union_with = ARA }
		NOT = { is_year = 1500 }
	}
	
	mean_time_to_happen = {
		months = 2
	}
	
	immediate = {
		set_country_flag = alfonso_died_yes_really
	}
	
	option = {
		name = "flavor_ara.EVTOPTA7"
		ai_chance = {
			factor = 20
		}
		custom_tooltip = flavor_ara7_naples_goes_free
		hidden_effect = {
			NAP = {
				country_event = { id = flavor_ara.8 }
			}
		}
		set_ruler_flag = alfonsos_successor
	}
	
	option = {
		name = "flavor_ara.EVTOPTB7"
		ai_chance = {
			factor = 1
		}
		
		add_legitimacy = -25
		NAP = { add_liberty_desire = 50 }
	}
}

country_event = {
	id = flavor_ara.8
	title = "flavor_ara.EVTNAME8"
	desc = "flavor_ara.EVTDESC8"
	picture = COURT_eventPicture
	
	is_triggered_only = yes
	
	
	option = {
		name = "flavor_ara.EVTOPTA8"
		define_ruler = {
			name = "Ferrando I"
			dynasty = "00000000"
			dip = 4
			mil = 4
			adm = 2
			claim = 50
		}
		PAP = {
			country_event = { id = flavor_ara.9 days = 1 }
		}
		break_union = ARA
		hidden_effect = {
			if = { 
				limit = { 
					ARA = { has_heir = yes } 
				}
				NAP = { 
					remove_heir = { } 
				} 
			}
		}
	}
	
	option = {
		name = "flavor_ara.EVTOPTB8"
		define_ruler = {
			name = "Ferrando I"
			dynasty = "00000000"
			dip = 4
			mil = 4
			adm = 2
			claim = 50
		}
		break_union = ARA
		hidden_effect = {
			if = { 
				limit = { 
					ARA = { has_heir = yes } 
				}
				NAP = { 
					remove_heir = { } 
				} 
			}
		}
		add_legitimacy = -20
		add_treasury = -100
		PAP = {
			country_event = { id = flavor_ara.10 days = 1 }
		}
		set_country_flag = naples_submits_to_the_pope
	}
}


country_event = {
	id = flavor_ara.9
	title = "flavor_ara.EVTNAME9"
	desc = "flavor_ara.EVTDESC9"
	picture = DIPLOMACY_eventPicture
	
	is_triggered_only = yes
	
	option = {
		name = "flavor_ara.EVTOPTA9"
		trigger = {
			FRA = {
				NOT = { has_country_flag = claimed_naples }
			}
		}
		FRA = {
			country_event = { id = flavor_fra.3105 days = 7 }
		}
		NAP = {
			add_opinion = {
				who = PAP
				modifier = opinion_interfering_pope
			}
		}
	}
	
	option = {
		name = "flavor_ara.EVTOPTB9"
		trigger = {
			OR = {
				FRA = {
					has_country_flag = claimed_naples
				}
				ai = no
			}
		}
		add_casus_belli = {
			type = cb_vassalize_mission
			months = 600
			target = NAP
		}
		NAP = {
			add_opinion = {
				who = PAP
				modifier = opinion_interfering_pope
			}
		}
	}
	
	option = {
		name = "flavor_ara.EVTOPTC9"
		ai_chance = {
			factor = 0
		}
		add_prestige = -40
	}
}

country_event = {
	id = flavor_ara.10
	title = "flavor_ara.EVTNAME10"
	desc = "flavor_ara.EVTDESC10"
	picture = BAD_WITH_MONARCH_eventPicture
	
	is_triggered_only = yes
	
	option = {
		name = "flavor_ara.EVTOPTA10"
		add_treasury = 100
		add_opinion = {
			who = NAP
			modifier = opinion_NAP_paid_tribute
		}
	}
}

country_event = {
	id = flavor_ara.11
	title = "flavor_ara.EVTNAME11"
	desc = "flavor_ara.EVTDESC11"
	picture = BAD_WITH_MONARCH_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		NAP = {
			exists = yes
			is_subject = no
		}
		NOT = {
			has_casus_belli = {
				type = cb_restore_personal_union
				target = NAP
			}
		}
		OR = {
			AND = {
				tag = ARA
				government = monarchy
				has_country_flag = alfonso_died_yes_really
				NOT = { has_ruler_flag = alfonsos_successor }
				is_subject = no
			}
			AND = {
				NOT = { exists = ARA }
				tag = SPA
				government = monarchy
				is_subject = no
			}
		}
	}
	
	mean_time_to_happen = {
		months = 6
	}
	
	option = {
		name = "flavor_ara.EVTOPTA11"
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				alliance_with = NAP
			}
		}
		add_casus_belli = {
			type = cb_restore_personal_union
			months = 600
			target = NAP
		}
		NAP = {
			add_opinion = {
				who = ROOT
				modifier = fra_claimed_naples
			}
		}
	}
	option = {
		name = "flavor_ara.EVTOPTB11"
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0
				NOT = { alliance_with = NAP }
			}
		}
		NAP = {
			add_opinion = {
				who = ROOT
				modifier = fra_did_not_claim_naples
			}
		}
	}
}

#1.35 Content by Big Boss#

country_event = {
	id = flavor_ara.12
	title = flavor_ara.12.t 
	desc = flavor_ara.12.d 
	picture = SONS_OF_ARAGON_eventPicture
	fire_only_once = yes
	trigger = {
		tag = ARA 
		NOT = { is_year = 1452 }
	}
	
	mean_time_to_happen = { months = 2 } 
	major = yes 
	major_trigger = {
		OR = { 
			tag = CAS 
			is_rival = CAS 
			is_enemy = CAS 
			capital_scope = {
				region = iberia_region 
			}
		}
	}
	
	option = { 
		name = flavor_ara.12.a 
		
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0.5
				has_opinion = {
					who = CAS 
					value = 0
				}
			}
		}
		custom_tooltip = ara_claims_in_castile_tt
		hidden_effect = {
			CAS = { 
				every_owned_province = {
					limit = { is_core = CAS  owned_by = CAS } 
					add_permanent_claim = ROOT 
				}
			}
		}
	}
	
	option = {
		name = flavor_ara.12.b 
		
		ai_chance = {
			factor = 1
			modifier = {
				factor = 0.5
				NOT = {
					has_opinion = {
						who = CAS 
						value = 0
					}
				}
			}
		}
		CAS = {
			add_opinion = {
				who = ROOT 
				modifier = successful_diplomacy
			}
		}
		add_opinion = {
			who = CAS 
			modifier = successful_diplomacy
		}
		if = { 
			limit = { 
				OR = { 
					is_rival = CAS 
					is_enemy = CAS 
					CAS = {
						OR = { 
							is_rival = ROOT 
							is_enemy = ROOT 
						}
					}
				}
			}
			remove_rival = CAS 
			CAS = { 
				remove_rival = ROOT 
				add_stability_or_adm_power = yes 
			} 
			add_trust = { 
				who = CAS 
				value = 10 
				mutual = yes 
			}
		}
	}
}	

country_event = { #Commercial Expansion in Alexandria
	id = flavor_ara.13 
	title = flavor_ara.13.t 
	desc = flavor_ara.13.d 
	picture = TRADEGOODS_eventPicture
	fire_only_once = yes 
	
	trigger = {
		OR = { 
			tag = ARA 
			was_tag = ARA 
		}
		OR = { 
			mission_completed = gc_ara_alexandria2
			mission_completed = gc_ara_alexandria
			bahari_area = { 
				type = all 
				country_or_non_sovereign_subject_holds = ROOT 
			}
			delta_area = { 
				type = all 
				country_or_non_sovereign_subject_holds = ROOT 
			}
		}
	}
	
	mean_time_to_happen = { months = 120 } 
	
	option = {
		name = flavor_ara.13.a 
		
		bahari_area = { 
			add_province_modifier = {
				name = ara_nile_production_monopoly_modifier
				duration = 9125 
			}
		}
		delta_area = {
			add_province_modifier = {
				name = ara_nile_production_monopoly_modifier
				duration = 9125 
			}
		}
	}
}
	