﻿############################
# Republican Yearly Events #
############################

namespace = yearly_republic

#########################################
# Patrician family and relations events #
#########################################
# Bjorn Sundstrom (2026) #

# Come to Bed						yearly_republic.1001	
# Thorny Marriage					yearly_republic.1002	
# Back Alley Honor					yearly_republic.1003	
# Back Alley Honor: Return Letter	yearly_republic.1004	
# Veto of the Masses				yearly_republic.1005	
# Detente:Letter					yearly_republic.1006
# Detente							yearly_republic.1007
# Wolves in Merchant's clothing		yearly_republic.1008
# Salon of Secrets					yearly_republic.1009
# Patricians in the Rafters 		yearly_republic.1010
# Summoned to Council				yearly_republic.1011
# The Doge's Procession				yearly_republic.1012
# Marriage to the sea				yearly_republic.1013
# Aligning the Faction				yearly_republic.1014
# Gold for Votes					yearly_republic.1015
# Beating the Vote Out of Them		yearly_republic.1016
# Philosopher-Kings					yearly_republic.1017

###################################################################################

###############
# COME TO BED #
###############

yearly_republic.1001 = {

	type = character_event
	title = yearly_republic.1001.t
	desc = yearly_republic.1001.desc

	theme = family
	override_background = study
	
	widgets = {
		widget = { gui = event_window_widget_vfx_background_flickering_candlelight_dark container = foreground_shader_vfx_container }
		widget = { gui = event_window_widget_vfx_left_character_flickering_candlelight container = foreground_shader_vfx_container }
		widget = { gui = event_window_widget_vfx_right_character_flickering_candlelight_dark container = foreground_shader_vfx_container }
	}

	left_portrait = {
		character = root
		animation = writing
		camera = camera_event_horse_right_facing_left_close
	}

	right_portrait = {
		character = root.primary_spouse
		animation = beg
		camera = camera_event_right_away_3_4
	}

	cooldown = { years = 10 }

	trigger = {
		government_has_flag = government_is_republic
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
		}
		exists = primary_spouse
		NOT = {
			has_trait = celibate
		}
	}

	immediate = {	
		if = {
			limit = {
				any_scheme = {
					scheme_owner = root
				}
			}
			random_scheme = {
				limit = { scheme_owner = root }
				save_scope_as = scheme
			}
		}
		root.primary_spouse = {
			save_scope_as = spouse_target
		}
	}

	## "Better get us more candles, my love"
	option = {
		name = yearly_republic.1001.a

		trigger = {
			NOT = {
				house = { 
					has_house_aspiration_parameter = republic_no_ambition 
				}
			}
		}

		progress_towards_lover_effect = {
			CHARACTER = root.primary_spouse
			REASON = lovers_marriage_shared_labor
			OPINION = default_lover_opinion
		}

		if = {
			limit = {
				house = { has_house_aspiration_parameter = republic_commerce }
			}
			add_gold = minor_gold_value
		}
		else_if = {
			limit = {
				house = { has_house_aspiration_parameter = republic_aggrandizement }
			}
			add_prestige = medium_prestige_gain
		}
		else_if = {
			limit = {
				house = { has_house_aspiration_parameter = republic_communal }
			}
			custom_tooltip = {
				text = yearly_republic.1001.communal
				every_vassal = {
					add_opinion = {
						modifier = house_ambition_communal
						opinion = 10
						target = root
					}
				}
			}
		}
		else_if = {
			limit = {
				house = { has_house_aspiration_parameter = republic_signorial }
			}
			dynasty = { add_dynasty_prestige = minor_dynasty_prestige_gain }
		}
		else_if = {
			limit = {
				house = { has_house_aspiration_parameter = republic_agitation }
			}
			if = {
				limit = {
					any_scheme = {
						scheme_owner = root
					}
				}
				scope:scheme = {
					add_scheme_progress = {
						value = scheme_progress_gain
						multiply = 5
					}
				}
			}
		}
		
		stress_and_fulfillment_impact = {
			# Gain
			paranoid = medium_stress_impact_gain
			# Loss
			trusting = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}
	## "I'm too behind on my duties. Leave me be" 
	option = {
		name = yearly_republic.1001.b

		if = {
			limit = {
				any_scheme = {
					scheme_owner = root
				}
			}
			scope:scheme = {
				add_scheme_progress = {
					value = scheme_progress_gain
					multiply = 5
				}
			}
		}
		else = {
			add_stewardship_lifestyle_xp = medium_lifestyle_experience
		}

		reverse_add_opinion = {
			modifier = rebuffed_opinion
			opinion = -15
			target = root.primary_spouse
		}

		stress_and_fulfillment_impact = {
			# Gain
			compassionate = medium_stress_impact_gain
			humble = minor_stress_impact_gain
			# Loss
			callous = medium_stress_impact_loss
			shy = minor_stress_impact_loss
			impatient = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = humble
				}
			}
		}
	}
	## "Go to bed - I'll be there soon, honey"
	option = {
		name = yearly_republic.1001.c
		
		progress_towards_lover_effect = {
			CHARACTER = root.primary_spouse
			REASON = lovers_marriage_shared_labor
			OPINION = default_lover_opinion
		}

		had_sex_with_effect = {
			CHARACTER = root.primary_spouse
			PREGNANCY_CHANCE = pregnancy_chance
		}
		
		stress_and_fulfillment_impact = {
			# Gain
			diligent = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
			# Loss
			fickle = minor_stress_impact_loss
			content = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = diligent
					has_trait = ambitious
				}
			}
			modifier = {
				add = 50
				has_trait = lustful
			}
		}
	}
}

###################
# THORNY MARRIAGE #
###################

yearly_republic.1002 = {

	type = character_event
	title = yearly_republic.1002.t
	desc = yearly_republic.1002.desc

	theme = family

	left_portrait = {
		character = root
		animation = anger
	}

	right_portrait = {
		character = root.primary_spouse
		animation = writing
	}

	cooldown = { years = 10 }

	trigger = {
		government_has_flag = government_is_republic
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
		}
		exists = primary_spouse
		primary_spouse.house ?= {
			this != root.house
			house_head = {
				government_has_flag = government_is_republic
			}
		}
		primary_spouse = {
			opinion = {
				target = root
				value <= -20
			}
		}
	}

	immediate = {	
		root.primary_spouse = {
			save_scope_as = spouse_target
		}
		root.primary_spouse.house = {
			save_scope_as = spouse_house
			house_head = {
				save_scope_as = spouse_house_leader
			}
		}
		hidden_effect = {
			house = {
				change_house_relation_effect = {
					HOUSE = scope:spouse_target.house
					VALUE = house_relation_damage_medium_value
					REASON = thorny
					CHAR = root
					TARGET_CHAR = scope:spouse_house_leader
					TITLE = scope:dummy_gender
				}
			}
		}
	}

	#	"I will buy the gratitude of [spouse_target.GetFirstNameNoTooltip] and [spouse_target.GetHerHis] house."
	option = {
		name = yearly_republic.1002.a

		trigger = {
			short_term_gold >= medium_gold_value
		}

		show_as_unavailable = { always = yes }	
		remove_short_term_gold = medium_gold_value
		
		house = {
			change_house_relation_effect = {
				HOUSE = scope:spouse_target.house
				VALUE = house_relation_improve_medium_value
				REASON = bribery_good
				CHAR = root
				TARGET_CHAR = scope:spouse_house_leader
				TITLE = scope:dummy_gender
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			greedy = medium_stress_impact_gain
			# Loss
			cynical = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				has_trait = greedy
				factor = 0
			}
			modifier = {
				short_term_treasury_or_gold <= massive_gold_value
				factor = 0
			}
		}
	}

	#	"I will forge [spouse_target.GetHerHis] letters to sing my praises."
	option = {
		name = yearly_republic.1002.b

		duel = {
			skill = intrigue
			target = scope:spouse_target
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1002.tt.falsifying_success.desc
				send_interface_toast = {
					title = yearly_republic.1002.falsifying_success.toast
					type = event_toast_effect_good
					left_icon = root
					right_icon = scope:spouse_target
					house = {
						change_house_relation_effect = {
							HOUSE = scope:spouse_target.house
							VALUE = house_relation_improve_medium_value
							REASON = falsify_good
							CHAR = root
							TARGET_CHAR = scope:spouse_house_leader
							TITLE = scope:dummy_gender
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1002.tt.falsifying_failure.desc
				send_interface_toast = {
					title = yearly_republic.1002.falsifying_failure.toast
					type = event_toast_effect_bad
					left_icon = root
					right_icon = scope:spouse_target
					house = {
						change_house_relation_effect = {
							HOUSE = scope:spouse_target.house
							VALUE = house_relation_damage_medium_value
							REASON = falsify_bad
							CHAR = root
							TARGET_CHAR = scope:spouse_house_leader
							TITLE = scope:dummy_gender
						}
					}
				}
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			honest = medium_stress_impact_gain
			humble = minor_stress_impact_gain
			# Loss
			impatient = minor_stress_impact_loss
			deceitful = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				intrigue <= good_skill_level
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = honest
					has_trait = humble
				}
			}
		}
	}

	#	"I swear to [ROOT.Char.GetFaith.random_GoodGodNames] to better myself in your eyes."
	option = {
		name = yearly_republic.1002.c

		duel = {
			skills = { prowess diplomacy stewardship learning }
			value = high_skill_rating
			55 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1002.tt.impress_spouse_success.desc
				send_interface_toast = {
					title = yearly_republic.1002.impress_spouse_success.toast
					type = event_toast_effect_good
					left_icon = root
					right_icon = scope:spouse_target
					
					progress_towards_lover_effect = {
						CHARACTER = root.primary_spouse
						REASON = lovers_marriage_shared_labor
						OPINION = default_lover_opinion
					}

					house = {
						change_house_relation_effect = {
							HOUSE = scope:spouse_target.house
							VALUE = house_relation_improve_medium_value
							REASON = falsify_good
							CHAR = root
							TARGET_CHAR = scope:spouse_house_leader
							TITLE = scope:dummy_gender
						}
					}
				}
			}
			45 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1002.tt.impress_spouse_failure.desc
				send_interface_toast = {
					title = yearly_republic.1002.impress_spouse_failure.toast
					type = event_toast_effect_bad
					left_icon = root
					right_icon = scope:spouse_target
					house = {
						change_house_relation_effect = {
							HOUSE = scope:spouse_target.house
							VALUE = house_relation_damage_medium_value
							REASON = falsify_bad
							CHAR = root
							TARGET_CHAR = scope:spouse_house_leader
							TITLE = scope:dummy_gender
						}
					}
				}
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			content = minor_stress_impact_gain
			fickle = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
			# Loss
			diligent = medium_stress_impact_loss
			humble = minor_stress_impact_loss
			ambitious = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = content
					has_trait = fickle
					has_trait = arrogant
				}
			}
		}
	}

	# "They can think what they will."	
	option = {
		name = yearly_republic.1002.d

		stress_and_fulfillment_impact = {
			# Gain
			diligent = medium_stress_impact_gain
			humble = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
			# Loss
			content = minor_stress_impact_loss
			fickle = minor_stress_impact_loss
			arrogant = medium_stress_impact_loss
		}

		ai_chance = {
			base = 25
			modifier = {
				factor = 0
				OR = {
					has_trait = diligent
					has_trait = humble
					has_trait = ambitious
				}
			}
		}
	}
}

####################		
# BACK ALLEY HONOR #
####################

scripted_trigger gdp_potential_street_brawler_trigger = {
	is_male = yes
	is_married = no
	is_clergy = no
	age = { 16 $MAX_AGE$ }
	is_available_quick = {
		adult = yes
		imprisoned = no
		incapable = no
		in_army = no
	}
	top_liege = root.top_liege
}

scripted_trigger gdp_house_is_hostile_to_root_house_trigger = {
	house ?= {
		this != root.house
		any_house_relation = {
			any_relation_house = { this = root.house }
			OR = {
				has_house_relation_level = quarrel
				has_house_relation_level = rivalry
				has_house_relation_level = feud
			}
		}
	}
}

scripted_trigger gdp_has_personal_animosity_trigger = {
	has_relation_rival = $CHARACTER$
}

scripted_trigger gdp_can_supply_rival_house_brawler_trigger = {
	any_close_or_extended_family_member = {
		NOR = {
			is_close_or_extended_family_of = root
			house ?= root.house
		}
		gdp_potential_street_brawler_trigger = { MAX_AGE = 25 }
		house.house_head.top_liege ?= root.top_liege
		OR = {
			gdp_house_is_hostile_to_root_house_trigger = yes
			gdp_has_personal_animosity_trigger = { CHARACTER = $BRAWLER$ }
		}
	}
}

yearly_republic.1003 = {

	type = character_event
	title = yearly_republic.1003.t
	desc = yearly_republic.1003.desc

	theme = family
	override_background = gdp_western_merchant_domicile

	left_portrait = {
		character = scope:spouse_target
		animation = anger
		camera = camera_event_center_coronation_kneeling
	}

	right_portrait = {
		character = scope:rook_01
		animation = severelywounded

	}

	lower_center_portrait = {
		character = scope:rook_02
		animation = aggressive_axe
		camera = camera_shoulders
	}

	cooldown = { years = 10 }

	trigger = {
		government_has_flag = government_is_republic
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
		}
		is_ai = no
		exists = primary_spouse
		any_close_or_extended_family_member = {
			gdp_potential_street_brawler_trigger = { MAX_AGE = 27 }
			save_temporary_scope_as = potential_rook_01
		}
		top_liege = {
			OR = {
				gdp_can_supply_rival_house_brawler_trigger = { BRAWLER = scope:potential_rook_01 }
				any_vassal = {
					gdp_can_supply_rival_house_brawler_trigger = { BRAWLER = scope:potential_rook_01 }
				}
			}
		}
	}

	immediate = {	
		primary_spouse = {
			save_scope_as = spouse_target
		}
		#1# Let's get ourselves a suitable young ruffian from our family:
		random_close_or_extended_family_member = {
			limit = {
				is_child_of = root
				gdp_potential_street_brawler_trigger = { MAX_AGE = 27 }
			}
			alternative_limit = {
				gdp_potential_street_brawler_trigger = { MAX_AGE = 27 }
			}
			save_scope_as = rook_01
		}
		#2# And a ruffian from another family
		top_liege = {
			if = {
				limit = { gdp_can_supply_rival_house_brawler_trigger = { BRAWLER = scope:rook_01 } }
				add_to_temporary_list = rook_02_source_list
			}
			every_vassal = {
				limit = { gdp_can_supply_rival_house_brawler_trigger = { BRAWLER = scope:rook_01 } }
				add_to_temporary_list = rook_02_source_list
			}
		}
		random_in_list = {
			list = rook_02_source_list
			random_close_or_extended_family_member = {
				limit = {
					NOR = {
						is_close_or_extended_family_of = root
						house ?= root.house
					}
					gdp_potential_street_brawler_trigger = { MAX_AGE = 25 }
					house.house_head.top_liege ?= root.top_liege
					gdp_has_personal_animosity_trigger = { CHARACTER = scope:rook_01 }
				}
				alternative_limit = {
					NOR = {
						is_close_or_extended_family_of = root
						house ?= root.house
					}
					gdp_potential_street_brawler_trigger = { MAX_AGE = 25 }
					house.house_head.top_liege ?= root.top_liege
					gdp_house_is_hostile_to_root_house_trigger = yes
				}
				save_scope_as = rook_02
			}
		}
		scope:rook_02.house.house_head = {
			save_scope_as = other_house_character_01
		}
		scope:rook_01 = {
			increase_wounds_no_death_effect = { REASON = fight }	
		}
		scope:rook_02 = {
			increase_wounds_no_death_effect = { REASON = fight }	
		}
		hidden_effect = {
			house = {
				change_house_relation_effect = {
					HOUSE = scope:rook_02.house
					VALUE = house_relation_damage_minor_value
					REASON = street_combat
					CHAR = root
					TARGET_CHAR = scope:other_house_character_01
					TITLE = scope:dummy_gender
				}
			}
		}
	}
	
	#	"Ah, the follies of youth"
	option = {
		name = yearly_republic.1003.a
		
		stress_and_fulfillment_impact = {
			# Gain
			content = minor_stress_impact_gain
			lazy = minor_stress_impact_gain 
			# Loss
			wrathful = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
			cynical = minor_stress_impact_loss
		}

		ai_chance = {
			base = 25
			modifier = {
				factor = 100
				OR = {
					has_trait = lazy
					has_trait = content
					has_trait = temperate
				}
			}
		}
	}
	
	#	"Clearly [rook_02.GetNameNoTooltip] was at fault. We demand reparations!"
	option = {
		name = yearly_republic.1003.b

		custom_tooltip = demand_reparation_for_fight_desc

		house = {
			change_house_relation_effect = {
				HOUSE = scope:rook_02.house
				VALUE = house_relation_damage_medium_value
				REASON = street_combat
				CHAR = root
				TARGET_CHAR = scope:other_house_character_01
				TITLE = scope:dummy_gender
			}
		}

		add_prestige = minor_prestige_gain
		
		trigger_event = {
			id = yearly_republic.1004
			days= 3
		}

		stress_and_fulfillment_impact = {
			# Gain
			craven = minor_stress_impact_gain
			content = minor_stress_impact_gain
			generous = minor_stress_impact_gain
			# Loss
			vengeful = minor_stress_impact_loss
			greedy = minor_stress_impact_loss
			arrogant = minor_stress_impact_loss
		}
		ai_chance = {
			base = 75
			modifier = {
				factor = 0
				OR = {
					has_trait = craven
					has_trait = humble
				}
			}
			modifier = {
				add = 50
				has_trait = greedy
			}
			modifier = {
				add = 100
				has_trait = vengeful
			}
		}
	}
	
	#	"We shall send a gift to [rook_02.GetDynastyHouseName] to smooth the waters"
	option = {
		name = yearly_republic.1003.c

		custom_tooltip = pay_reparation_for_fight_desc

		pay_short_term_gold = {
			target = scope:other_house_character_01
			gold = minor_gold_value
		}

		house = {
			change_house_relation_effect = {
				HOUSE = scope:rook_02.house
				VALUE = house_relation_improve_medium_value
				REASON = street_combat
				CHAR = root
				TARGET_CHAR = scope:other_house_character_01
				TITLE = scope:dummy_gender
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			fickle = minor_stress_impact_gain
			content = minor_stress_impact_gain
			lustful = minor_stress_impact_gain
			# Loss
			diligent = minor_stress_impact_loss
			ambitious = minor_stress_impact_loss
			wrathful = minor_stress_impact_loss
			vengeful = minor_stress_impact_loss
			
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 100
				OR = {
					has_trait = compassionate
					has_trait = forgiving
					has_trait = craven
				}
			}
			modifier = {
				add = 0
				OR = {
					has_trait = wrathful
					has_trait = vengeful
				}
			}
		}

	}
}

###################################
# BACK ALLEY HONOR: RETURN LETTER #
###################################

scripted_trigger ai_accept_demand_or_not_trigger = {
	OR = {
		scope:other_house_character_01 = {
			has_dread_level_towards = {
				target = root
				level >= 2
		 	}
		}
		holder.house.house_power_score > scope:other_house_character_01.house.house_power_score
	}
}

yearly_republic.1004 = {
	
	type = letter_event
	opening = yearly_republic.1004.t
	sender = scope:other_house_character_01
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						ai_accept_demand_or_not_trigger = yes
						scope:other_house_character_01 = {
							NOR = {
								has_trait = vengeful
								has_trait = wrathful
							}
							OR = {
								has_trait = gregarious
								has_trait = trusting
								has_trait = compassionate
							}
						}
					}
				}
				desc = yearly_republic.1004.b.desc 
			}
			desc = yearly_republic.1004.a.desc 
		}
	}

	trigger = {
		government_has_flag = government_is_republic
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
		}
	}

	immediate = {	

	}

	#	"They will regret this show of disrespect!"
	option = {
		name = yearly_republic.1004.a

		trigger = {
			NOT = {
				ai_accept_demand_or_not_trigger = yes
			}
		}

		progress_towards_rival_effect = {
			REASON = rival_unjust_demands
			CHARACTER = scope:other_house_character_01
			OPINION = -20
		}

		house = {
			change_house_relation_effect = {
				HOUSE = scope:rook_02.house
				VALUE = house_relation_damage_medium_value
				REASON = street_combat
				CHAR = root
				TARGET_CHAR = scope:other_house_character_01
				TITLE = scope:dummy_gender
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			craven = medium_stress_impact_gain
			# Loss
			wrathful = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = craven
					has_trait = humble
				}
			}
		}
	}

	#	"Fine, we will get our restitution in due time."
	option = {
		name = yearly_republic.1004.b

		trigger = {
			NOT = {	
				ai_accept_demand_or_not_trigger = yes
			}
		}

		house = {
			change_house_relation_effect = {
				HOUSE = scope:rook_02.house
				VALUE = house_relation_damage_minor_value
				REASON = street_combat
				CHAR = root
				TARGET_CHAR = scope:other_house_character_01
				TITLE = scope:dummy_gender
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			impatient = medium_stress_impact_gain
			# Loss
			patient = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = wrathful
					has_trait = vengeful
				}
			}
		}
	}

	#	"We accept our due."
	option = {
		name = yearly_republic.1004.c

		trigger = {
			ai_accept_demand_or_not_trigger = yes
		}

		scope:other_house_character_01 = {
			pay_short_term_gold = {
				target = root
				gold = medium_gold_value
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			# Loss
			greedy = medium_stress_impact_loss
			arrogant = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				add = 50
				OR = {
					has_trait = greedy
					has_trait = arrogant
				}
			}
		}
	}

	#	"Let this be the end of discord between us."	
	option = {
		name = yearly_republic.1004.d

		trigger = {	
			ai_accept_demand_or_not_trigger = yes
		}

		house = {
			change_house_relation_effect = {
				HOUSE = scope:other_house_character_01.house
				VALUE = house_relation_improve_major_value
				REASON = street_combat
				CHAR = root
				TARGET_CHAR = scope:other_house_character_01
				TITLE = scope:dummy_gender
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			callous = medium_stress_impact_gain
			vengeful = minor_stress_impact_gain
			# Loss
			compassionate = medium_stress_impact_loss
			humble = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				add = 50
				OR = {
					has_trait = gregarious
					has_trait = humble
				}
			}
		}
	}
}

######################
# VETO OF THE MASSES #
######################

yearly_republic.1005 = {

	type = character_event
	title = yearly_republic.1005.t
	desc = yearly_republic.1005.desc
	override_background = gdp_western_merchant_domicile
	theme = republic

	left_portrait = {
		character = root
		animation = thinking
		camera = camera_body
	}

	right_portrait = {
		character = scope:house_member_01
		animation = aggressive_unarmed
		camera = camera_body
	}

	cooldown = { years = 10 }

	trigger = {
		government_has_flag = government_is_republic
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
		}
		top_liege = {
			any_vassal = {
				house ?= {
					this != root.house
					any_house_relation = {
						any_relation_house = {
							this = root.house
						}
						OR = {
							has_house_relation_level = quarrel
							has_house_relation_level = rivalry
							has_house_relation_level = feud
						}
					}
				}
			}
		}
		any_close_or_extended_family_member = {
			is_available_quick = {
				adult = yes
				imprisoned = no
				incapable = no
				in_army = no
			}
			top_liege = root.top_liege
		}	
	}
	
	immediate = {	
		top_liege = {
			capital_county = {
				save_scope_as = capital_01
			}
			random_vassal = {
				limit = {
					house ?= {
						this != root.house
						any_house_relation = {
							any_relation_house = {
								this = root.house
							}
							OR = {
								has_house_relation_level = quarrel
								has_house_relation_level = rivalry
								has_house_relation_level = feud
							}
						}
					}
				}
				save_scope_as = other_house_character_01
			}
		}
		random_close_or_extended_family_member = {
			limit = {
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
				top_liege = root.top_liege
			}
			save_scope_as = house_member_01
		}
	}

	#	"No, [ROOT.Char.Custom2('RelationToMeShort', house_member_01)]. It's time to sit down with [other_house_character_01.GetDynastyHouseName]."
	option = {
		name = yearly_republic.1005.a

		custom_tooltip = offer_a_sitdown_desc

		add_piety = minor_piety_gain
		
		trigger_event = {
					id = yearly_republic.1006
					days= 7
				}

		stress_and_fulfillment_impact = {
			# Gain
			paranoid = medium_stress_impact_gain
			# Loss
			trusting = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = paranoid
			}
		}
	}

	#	"My oratory skills will put the blame on house [other_house_character_01.GetDynastyHouseName]."
	option = {
		name = yearly_republic.1005.b

		duel = {
			skills = { diplomacy intrigue }
			value = high_skill_rating
			55 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1005.tt.oratory_blame.desc
				send_interface_toast = {
					title = yearly_republic.1005.tt.oratory_blame.toast
					type = event_toast_effect_good
					left_icon = root
					right_icon = scope:other_house_character_01
					dynasty = { add_dynasty_prestige = minor_dynasty_prestige_gain }
					
				}
			}
			45 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1005.tt.oratory_blame_failure.desc
				send_interface_toast = {
					title = yearly_republic.1005.tt.oratory_blame_failure.toast
					type = event_toast_effect_bad
					left_icon = root
					right_icon = scope:other_house_character_01
					add_prestige = minor_prestige_loss
				}
			}
		}

		house = {
			change_house_relation_effect = {
				HOUSE = scope:other_house_character_01.house
				VALUE = house_relation_damage_minor_value
				REASON = house_blamed
				CHAR = root
				TARGET_CHAR = scope:other_house_character_01
				TITLE = scope:dummy_gender
			}
		}
		
		stress_and_fulfillment_impact = {
			# Gain
			compassionate = medium_stress_impact_gain
			humble = minor_stress_impact_gain
			# Loss
			callous = medium_stress_impact_loss
			shy = minor_stress_impact_loss
			impatient = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = humble
				}
			}
		}
	}

	#	"Guards! Drive these rabble from my door."	
	option = {
		name = yearly_republic.1005.c

		add_dread = minor_dread_gain

		stress_and_fulfillment_impact = {
			# Gain
			compassionate = medium_stress_impact_gain
			forgiving = minor_stress_impact_gain
			# Loss
			fickle = minor_stress_impact_loss
			wrathful = medium_stress_impact_loss
			sadistic = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = forgiving
				}
			}
			modifier = {
				add = 50
				OR = {
					has_trait = wrathful
					has_trait = sadistic
				}
			}
		}
	}
}

##################
# DETENTE:Letter #
##################		

yearly_republic.1006 = {

	type = letter_event
	opening = yearly_republic.1006.t
	sender = scope:other_house_character_01
	desc = {
			first_valid = {
				triggered_desc = {
					trigger = {
						OR = {
							ai_accept_demand_or_not_trigger = yes
							scope:other_house_character_01 = {
								NOT = {
									has_trait = vengeful
									has_trait = wrathful
								}
								OR = {
									has_trait = gregarious
									has_trait = trusting
									has_trait = compassionate
								}
							}
						}
					}
					desc = yearly_republic.1006.a.desc 
				}
				desc = yearly_republic.1006.b.desc 
			}
		}

	trigger = {
		government_has_flag = government_is_republic
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
		}
	}

	immediate = {	

	}

	#	"Excellent!"
	option = {
		name = yearly_republic.1006.a
		
		trigger = {
			OR = {
				ai_accept_demand_or_not_trigger = yes
				scope:other_house_character_01 = {
					NOT = {
						has_trait = vengeful
						has_trait = wrathful
					}
					OR = {
						has_trait = gregarious
						has_trait = trusting
						has_trait = compassionate
					}
				}
			}
		}

		trigger_event = {
			id = yearly_republic.1007
			days= 3
		}

		stress_and_fulfillment_impact = {
			# Gain
			# Loss
		}

		ai_chance = {
			base = 100
		}
	}

	#	"Damnation!"
	option = {
		name = yearly_republic.1006.b
		
		trigger = {
			NOR = {
				ai_accept_demand_or_not_trigger = yes
				scope:other_house_character_01 = {
					NOT = {
						has_trait = vengeful
						has_trait = wrathful
					}
					OR = {
						has_trait = gregarious
						has_trait = trusting
						has_trait = compassionate
					}
				}
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			# Loss	
		}

		ai_chance = {
			base = 100
		}
	}
}

###########
# DETENTE # 
###########

yearly_republic.1007 = {

	type = character_event
	title = yearly_republic.1007.t
	desc = yearly_republic.1007.desc
	window = big_event_window
	override_background = western_tavern

	theme = republic

	left_portrait = {
		character = root
		animation = debating
	}

	right_portrait = {
		character = scope:other_house_character_01
		animation = chaplain
	}

	cooldown = { years = 10 }

	trigger = {
		government_has_flag = government_is_republic
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
		}	
	}

	immediate = {	

	}

	#	"This feud is bad for business"
	option = {
		name = yearly_republic.1007.a

		duel = {
			skill = stewardship
			value = high_skill_rating
			55 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1007.tt.detente_business.desc
				send_interface_toast = {
					title = yearly_republic.1007.tt.detente_business.toast
					type = event_toast_effect_good
					left_icon = root
					right_icon = scope:other_house_character_01
					house ?= {
						set_house_relation = {
							target = scope:other_house_character_01.house
							level = neutral
							description = yearly_republic.1007.detente_business.change.desc
						}
					}

				}
			}
			45 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1007.tt.detente_business_failure.desc
				send_interface_toast = {
					title = yearly_republic.1007.tt.detente_business_failure.toast
					type = event_toast_effect_neutral
					right_icon = scope:other_house_character_01
					house = {
						change_house_relation_effect = {
							HOUSE = scope:other_house_character_01.house
							VALUE = house_relation_improve_medium_value
							REASON = business_argument
							CHAR = root
							TARGET_CHAR = scope:other_house_character_01
							TITLE = scope:dummy_gender
						}
					}
				}
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			vengeful = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
			# Loss
			greedy = minor_stress_impact_loss
			gregarious = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = vengeful
					has_trait = wrathful
					has_trait = stubborn
				}
			}
		}
	}
	
	#	"We should make peace, as Christians."
	option = {
		name = yearly_republic.1007.b

		trigger = {
			OR = { 
				piety_level >= medium_piety_level
				has_trait = zealous
			}
		}

		trait = zealous
		reason = piety_level
		add_piety = medium_piety_loss

		house ?= {
			set_house_relation = {
				target = scope:other_house_character_01.house
				level = neutral
				description = yearly_republic.1007.piety.change.desc
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			cynical = medium_stress_impact_gain
			wrathful = minor_stress_impact_gain
			# Loss
			zealous = medium_stress_impact_loss
			just = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = cynical
			}
			modifier = {
				add = 100
				has_trait = zealous
			}
			modifier = {
				factor = 0
				piety <= medium_piety_value
			}
		}
	}
	
	#	"Blood has been spilled, let blood tie us together"
	option = {
		name = yearly_republic.1007.c

		trigger = {
			custom_tooltip = {
				text = yearly_republic.1007.c.tt.suitable_pair
				house ?= {
					any_house_member = {
						is_adult = yes
						is_married = no
						is_betrothed = no
						can_marry_trigger = yes
						save_temporary_scope_as = temp_spouse_1
						scope:other_house_character_01.house ?= {
							any_house_member = {
								is_married = no
								is_betrothed = no
								can_marry_trigger = yes
								can_marry_character_trigger = { CHARACTER = scope:temp_spouse_1 }
							}
						}
					}
				}
			}
		}

		house = {
			random_house_member = {
				limit = {
					is_adult = yes
					is_married = no
					is_betrothed = no
					can_marry_trigger = yes
					save_temporary_scope_as = temp_spouse_1
					scope:other_house_character_01.house ?= {
						any_house_member = {
							is_married = no
							is_betrothed = no
							can_marry_trigger = yes
							can_marry_character_trigger = { CHARACTER = scope:temp_spouse_1 }
						}
					}
				}
				save_scope_as = spouse_1
			}
		}

		scope:other_house_character_01.house = {
			random_house_member = {
				limit = {
					is_adult = yes
					is_married = no
					is_betrothed = no
					can_marry_trigger = yes
					can_marry_character_trigger = { CHARACTER = scope:spouse_1 }
				}
				save_scope_as = spouse_2
			}
		}

		marry_on_realm_law = {
			SPOUSE_1 = scope:spouse_1
			SPOUSE_2 = scope:spouse_2
		}
		
		# 4) End the feud
		house ?= {
			set_house_relation = {
				target = scope:other_house_character_01.house
				level = neutral
				description = yearly_republic.1007.detente_marriage.change.desc 
			}
		}
		stress_and_fulfillment_impact = {
			# Gain
			vengeful = medium_stress_impact_gain
			# Loss
			gregarious = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = vengeful
			}
			modifier = {
				add = 50
				has_trait = gregarious
			}
		}
	}
	
	#	"Let's settle it with steel, here and now!"
	option = {
		name = yearly_republic.1007.d
		add_internal_flag = dangerous
		
		trigger = {
			NOT = { has_trait = craven }
		}
		
		add_intrigue_lifestyle_xp = medium_lifestyle_xp
		add_prestige = medium_prestige_loss
		
		duel = {
			skill = prowess 
			target = scope:other_house_character_01
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1007.duel_win.desc
				custom_tooltip = { 
					text = yearly_republic.1007.duel_win.custom
					random_list = {
						50 = {
							root = {
								send_interface_toast = {
									title = yearly_republic.1007.duel_win.toast
									type = event_toast_effect_good
									left_icon = root
									right_icon = scope:other_house_character_01
									scope:other_house_character_01 = {
										increase_wounds_no_death_effect = { REASON = fight }
									}
								}
							}
						}
						50 = {
							root = {
								send_interface_toast = {
									title = yearly_republic.1007.duel_win.toast
									type = event_toast_effect_good
									left_icon = root
									right_icon = scope:other_house_character_01

									scope:other_house_character_01 = {
										death = {
											death_reason = death_ambushed_during_detente
											killer = root
										}
										every_child = {
											limit = {
												is_male = yes
												is_adult = yes
											}
											set_relation_nemesis = root
										}
									}
								}
							}
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1007.duel_loss.desc
				scope:other_house_character_01 = { 
					custom_tooltip = { 
						text = yearly_republic.1007.duel_loss.custom
						random_list = {
							75 = {
								root = {
									send_interface_toast = {
										title = yearly_republic.1007.duel_loss.toast
										type = event_toast_effect_bad
										left_icon = root
										right_icon = scope:other_house_character_01
										root = {
											increase_wounds_no_death_effect = { REASON = fight }
										}
									}
								}
							}
							35 = {
								root = {
									send_interface_toast = {
										title = yearly_republic.1007.duel_loss.toast
										type = event_toast_effect_bad
										left_icon = root
										right_icon = scope:other_house_character_01
										root = {
											death = {
												death_reason = death_ambushed_during_detente
												killer = scope:other_house_character_01
											}
											every_child = {
												limit = {
													is_male = yes
													is_adult = yes
												}
												set_relation_nemesis = scope:other_house_character_01
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			honest = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
			just = medium_stress_impact_gain
			# Loss
			deceitful = major_stress_impact_loss
			vengeful = major_stress_impact_loss
			wrathful = major_stress_impact_loss
		}

		ai_chance = {
			base = 25
			modifier = {
				factor = 0
				OR = {
					has_trait = honest
					has_trait = forgiving
					has_trait = just
				}
			}
			modifier = {
				add = 75
				OR = {
					has_trait = wrathful
					has_trait = vengeful
					has_trait = brave
				}
			}
		}
	}
}

#################################
# Wolves in Merchant's clothing #
#################################

yearly_republic.1008 = {

	type = character_event
	title = yearly_republic.1008.t
	desc = yearly_republic.1008.desc

	theme = republic

	left_portrait = {
		character = root
		animation = chancellor
	}

	lower_center_portrait = {
		character = scope:bandit_01
	}
	
	lower_right_portrait = {
		character = scope:other_patrician_01
	}

	cooldown = { years = 10 }

	trigger = {
		government_has_flag = government_is_republic
		domicile ?= {
			domicile_location ?= {
				OR = {
					geographical_region = world_middle_east_jerusalem
					geographical_region = world_africa_north
					geographical_region = world_europe
				}
			}
		}
		is_ai = no
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
		}
		top_liege = {
			any_vassal = {
				this != root
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
				is_powerful_vassal = yes	
			}
		}
	}

	immediate = {
		top_liege = {
			random_vassal = {
				limit = {
					this != root
					is_available_quick = {
						adult = yes
						imprisoned = no
						incapable = no
						in_army = no
					}
					is_powerful_vassal = yes	
				}
				save_scope_as = other_patrician_01		
			}
		}
		create_character = {
			template = bandit_captain_character
			location = root.location
			save_scope_as = bandit_01
		}
		hidden_effect = {
			scope:bandit_01 = { add_short_term_gold = major_gold_value }
			scope:other_patrician_01 = { add_courtier = scope:bandit_01 }	
		}
		
	}

	# "Hire the captain to work for you, forthwith."
	option = {
		name = yearly_republic.1008.a
		add_courtier = scope:bandit_01
		scope:bandit_01 = {
			add_opinion = {
				modifier = grateful_opinion
				opinion = 30
				target = root
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			just = medium_stress_impact_gain
			# Loss
			greedy = minor_stress_impact_loss
			ambitious = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = just
			}
			modifier = {
				add = 50
				OR = {
					has_trait = greedy
					has_trait = ambitious
				}
			}
		}
	}

	# "Threaten the captain to share his loot."
	option = {
		name = yearly_republic.1008.b

		scope:bandit_01 = {
			add_opinion = {
				modifier = scared_opinion
				opinion = -20
				target = root
			}
			set_relation_grudge = {
				target = root
				reason = grudge_took_loot_desc
			}
			pay_short_term_gold = {
			target = root
			gold = major_gold_value
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			honest = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
			# Loss
			greedy = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = honest
					has_trait = compassionate
				}
			}
			modifier = {
				add = 50
				has_trait = greedy
			}
		}
	}

	# "Threaten [other_patrician_01.GetShortUINameNoTooltip] to gain a hook."
	option = {
		name = yearly_republic.1008.c

		add_dread = minor_dread_gain

		if = {
			limit = {
				can_add_hook = {
					target = scope:other_patrician_01
					type = threat_hook
				}
			}
			add_hook = {
				target = scope:other_patrician_01
				type = threat_hook
			}
		}

		scope:other_patrician_01 = {
			add_opinion = {
				modifier = scared_opinion
				opinion = -20
				target = root
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			honest = medium_stress_impact_gain
			# Loss
			deceitful = minor_stress_impact_loss
			ambitious = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = honest
			}
			modifier = {
				add = 50
				OR = {
					has_trait = deceitful
					has_trait = ambitious
				}
			}
		}
	}
}

#####################
# Salon of Secrets #
#####################

yearly_republic.1009 = {

	type = character_event
	title = yearly_republic.1009.t
	desc = yearly_republic.1009.desc
	override_background = ep3_byzantine_feast

	theme = republic

	left_portrait = {
		character = root
		animation = eavesdrop
	}

	right_portrait = {
		character = scope:relation_01
		animation = holding_tally_stick
	}

	lower_center_portrait = {
		character = scope:patrician_spouse_01
	}

	lower_right_portrait = {
		character = scope:patrician_husband_01
	}

	cooldown = { years = 10 }

	trigger = {
		government_has_flag = government_is_republic
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
		}
		is_independent_ruler = no
		top_liege = {
			any_vassal = {
				is_ai = yes
				this != root
				is_powerful_vassal = yes
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
				any_spouse = { 
					this != root
					is_ai = yes 
					has_trait = deceitful
					is_available_quick = {
						adult = yes
						imprisoned = no
						incapable = no
						in_army = no
					}
					save_temporary_scope_as = patrician_spouse_01_temp 
				}
				save_temporary_scope_as = patrician_husband_01_temp
			}
		}
		OR = {
			any_relation = {
				type = friend
				type = best_friend
				type = lover
				type = soulmate
				this != scope:patrician_spouse_01_temp
				this != scope:patrician_husband_01_temp
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
			}
			any_close_or_extended_family_member = {
				this != root
				this != scope:patrician_spouse_01_temp
				this != scope:patrician_husband_01_temp
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
			}
			any_spouse = {  
				this != scope:patrician_spouse_01_temp
				this != scope:patrician_husband_01_temp
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
			}
		}
	}

	immediate = {
		top_liege = {
			random_vassal = {
				limit = {
					is_ai = yes
					this != root
					is_available_quick = {
						adult = yes
						imprisoned = no
						incapable = no
						in_army = no
					}
					is_powerful_vassal = yes
					any_spouse = { 
						is_available_quick = {
							adult = yes
							imprisoned = no
							incapable = no
							in_army = no
						}
						this != root
						has_trait = deceitful
					}
				}
				save_scope_as = patrician_husband_01
				random_spouse = {
					limit = { 
						is_ai = yes
						is_available_quick = {
							adult = yes
							imprisoned = no
							incapable = no
							in_army = no
						}
						this != root
						has_trait = deceitful
					}
					save_scope_as = patrician_spouse_01
				}
			}
		}
		every_relation = {
			type = friend
			type = best_friend
			type = lover
			type = soulmate
			limit = { 
			is_available_quick = {
				adult = yes
				imprisoned = no
				incapable = no
				in_army = no
			}
			this != scope:patrician_spouse_01
			this != scope:patrician_husband_01
			}
			add_to_list = relation_candidates
		}
		every_close_or_extended_family_member = {
			limit = {
				this != root
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
				this != scope:patrician_spouse_01
				this != scope:patrician_husband_01
			}
			add_to_list = relation_candidates
		}
		every_spouse = {
			limit = { 
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
				this != scope:patrician_spouse_01
				this != scope:patrician_husband_01
			}
			add_to_list = relation_candidates
		}
		random_in_list = {
			list = relation_candidates
			weight = {
				base = 1
				modifier = {
					add = 30
					has_relation_soulmate = root
				}
				modifier = {
					add = 15
					OR = {
						has_relation_best_friend = root
						has_relation_friend = root
						has_relation_lover = root
						is_primary_heir_of = root
					}
				}
				modifier = {
					add = 5
					OR = {
						is_child_of = root
						is_grandchild_of = root
					}
				}
				modifier = {
					factor = 1.5
					opinion = {
						target = root
						value >= 50
					}
				}
				modifier = {
					factor = 0.5
					opinion = {
						target = root
						value < 0
					}
				}
			}
			save_scope_as = relation_01
		}
		hidden_effect = {
			scope:patrician_spouse_01 = {
				give_spy_secret_effect = { TARGET = root }
				random_secret = {
					type = secret_spy
					limit = {
						secret_target = root
					}
					save_scope_as = spouse_secret_01
					reveal_to_without_events_effect = {
						CHARACTER = root
					}
				}
			}
			scope:patrician_husband_01 = {
				give_spy_secret_effect = { TARGET = root }
				random_secret = {
					type = secret_spy
					limit = {
						secret_target = root
					}
					save_scope_as = husband_secret_01
					reveal_to_without_events_effect = {
						CHARACTER = root
					}
				}
			}
		}
		top_liege = {
			random_vassal = {
				limit = {
					is_powerful_vassal = yes
					any_secret = { NOT = { is_known_by = root } }
					NOR = {
						this = scope:relation_01
						this = root
						this = scope:patrician_husband_01
						this = scope:patrician_spouse_01
					}
				}
				alternative_limit = {
					has_any_secrets = yes
					NOR = {
						this = scope:relation_01
						this = root
						this = scope:patrician_husband_01
						this = scope:patrician_spouse_01
					}
				}
				save_scope_as = potential_secret_holder_01
				random_secret = {
					limit = {
						NOT = { is_known_by = root }
					}
					save_scope_as = potential_secret_01
				}
			}
		}
	}
	
	# "I must warn everyone of this wicked scheme!"
	option = {
		name = yearly_republic.1009.a
		
		scope:spouse_secret_01 = {
			expose_secret = root
		}
		scope:husband_secret_01 = {
			expose_secret = root
		}
		
		top_liege = {
			add_opinion = {
				modifier = spy_opinion
				target = scope:patrician_spouse_01
			}
			add_opinion = {
				modifier = spy_opinion
				target = scope:patrician_husband_01
			}
			every_vassal = {
				limit = {
					this != root
					this != scope:patrician_husband_01
					this != scope:patrician_spouse_01 
					government_has_flag = government_is_republic
					domicile ?= {
						is_domicile_type = merchant_company
					}
					any_held_title = { is_noble_family_title = yes }
				}
				custom = custom.every_other_patrician
				custom_tooltip = {
				text = yearly_republic.1009.a.tt
				add_opinion = {
					modifier = grateful_opinion
					opinion = 20
					target = root
				}
				add_opinion = {
					modifier = spy_opinion
					target = scope:patrician_spouse_01
				}
				add_opinion = {
					modifier = spy_opinion
					target = scope:patrician_husband_01
				}
				}
			}
		}
		
		stress_and_fulfillment_impact = {
			# Gain
			shy = minor_stress_impact_gain
			# Loss
			compassionate = minor_stress_impact_loss
			honest = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = shy
			}
			modifier = {
				add = 50
				OR = {
					has_trait = honest
					has_trait = compassionate
				}
			}
		}
	}
	
	# "What a great Idea! I should to that myself."
	option = {
		name = yearly_republic.1009.b
		trigger = {
			exists = scope:potential_secret_01
			short_term_gold >= medium_gold_value
		}
		show_as_unavailable = { always = yes }	
		
		remove_short_term_gold = medium_gold_value
		
		add_intrigue_lifestyle_xp = medium_lifestyle_xp
		
		flavor = yearly_republic.1009.flavor
			
		send_interface_toast = {
			title = yearly_republic.1009.b.secret_learned
			type = event_toast_effect_good
			left_icon = scope:potential_secret_holder_01
			right_icon = root
			scope:potential_secret_01 = {
				reveal_to = root
			}
		}	
		
		give_spy_secret_effect = { TARGET = scope:potential_secret_holder_01 }

		stress_and_fulfillment_impact = {
			# Gain
			honest = medium_stress_impact_gain
			just = medium_stress_impact_gain
			# Loss
			deceitful = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				short_term_gold < medium_gold_value
			}
			modifier = {
				factor = 0
				has_trait = honest
			}
			modifier = {
				add = 50
				OR = {
					has_trait = deceitful
					has_trait = ambitious
				}
			}
		}
	}
	
	# "Blackmail [patrician_spouse_01.GetShortUINameNoTooltip] to keep her secret."
	option = {
		name = yearly_republic.1009.c
		add_intrigue_lifestyle_xp = medium_lifestyle_xp
		
		duel = {
			skill = intrigue
			target = scope:patrician_spouse_01
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1009.c.success.desc
				send_interface_toast = {
					title = yearly_republic.1009.c.success.toast
					type = event_toast_effect_good
					left_icon = root
					right_icon = scope:patrician_husband_01
					add_hook = {
						type = strong_blackmail_hook
						target = scope:patrician_husband_01
						secret = scope:husband_secret_01 
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1009.c.failure.desc
				send_interface_toast = {
					title = yearly_republic.1009.c.failure.toast
					type = event_toast_effect_bad
					left_icon = root
					right_icon = scope:patrician_husband_01
					progress_towards_rival_effect = {
						REASON = rival_attempted_blackmail
						CHARACTER = scope:patrician_husband_01
						OPINION = -20
					} 
				}
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			honest = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			# Loss
			deceitful = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = honest
					has_trait = compassionate
				}
			}
			modifier = {
				add = 50
				OR = {
					has_trait = deceitful
					has_trait = ambitious
				}
			}
			modifier = {
				add = 50
				intrigue >= scope:patrician_spouse_01.intrigue
			}
		}
	}
}

#############################
# Patricians in the Rafters #
#############################

yearly_republic.1010 = {

	type = character_event
	title = yearly_republic.1010.t
	desc = yearly_republic.1010.desc

	theme = republic

	left_portrait = {
		character = root
		animation = contemplating
		camera = camera_activity_horse
	}

	right_portrait = {
		character = scope:relation_01
		animation = debating
		camera = camera_activity_horse
	}

	lower_center_portrait = {
		character = scope:ambassador_01
	}

	cooldown = { years = 10 }

	trigger = {
		NOT = { 
			root.house ?= {
				has_house_modifier = gdp_secret_information_house_modifier 
			}
		}
		government_has_flag = government_is_republic
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
		}
		any_independent_ruler = {			
			in_diplomatic_range = root
			NOR = { 
				this = root
				this = root.top_liege
			}
			primary_title = {
				is_mercenary_company = no
				is_holy_order = no
			}
		}
		top_liege = {
			this != root
			any_vassal = {
				this != root
				government_has_flag = government_is_republic
				NOT = { is_close_or_extended_family_of = root }
				is_powerful_vassal = yes
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
			}
		}
		OR = {
			any_relation = {
				type = friend
				type = best_friend
				type = lover
				type = soulmate
				this != root.top_liege
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
			}
			any_close_or_extended_family_member = {
				this != root
				this != root.top_liege
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
			}
			any_spouse = {
				this != root.top_liege
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
			}
		}
	}

	immediate = {
		top_liege = { save_scope_as = republic_ruler }

		every_relation = {
			type = friend
			type = best_friend
			type = lover
			type = soulmate
			limit = { 
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
				this != root.top_liege
				}
			add_to_list = relation_candidates
		}
		every_close_or_extended_family_member = {
			limit = {
				this != root
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
				this != root.top_liege
			}
			add_to_list = relation_candidates
		}
		every_spouse = {
			limit = { 
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
				this != root.top_liege
			}
			add_to_list = relation_candidates
		}
		random_in_list = {
			list = relation_candidates
			weight = {
				base = 1
				modifier = {
					add = 30
					has_relation_soulmate = root
				}
				modifier = {
					add = 15
					OR = {
						has_relation_best_friend = root
						has_relation_friend = root
						has_relation_lover = root
						is_primary_heir_of = root
					}
				}
				modifier = {
					add = 5
					OR = {
						is_child_of = root
						is_grandchild_of = root
					}
				}
				modifier = {
					factor = 1.5
					opinion = {
						target = root
						value >= 50
					}
				}
				modifier = {
					factor = 0.5
					opinion = {
						target = root
						value < 0
					}
				}
			}
			save_scope_as = relation_01
		}

		random_independent_ruler = {
			limit = {
				in_diplomatic_range = root
				NOR = { 
					this = root
					this = root.top_liege
				}
				primary_title = {
					is_mercenary_company = no
					is_holy_order = no
				}
			}
			primary_title = { save_scope_as = ambassador_mission_location_01 }
		}

		top_liege = {
			random_vassal = {
				limit = {
					this != root
					this != scope:relation_01
					government_has_flag = government_is_republic
					is_powerful_vassal = yes
					NOT = {  is_close_or_extended_family_of = root }
					is_available_quick = {
						adult = yes
						imprisoned = no
						incapable = no
						in_army = no
					}
				}
				save_scope_as = ambassador_01	
			}
		}
	}

	option = {
		name = yearly_republic.1010.a

		add_internal_flag = dangerous
		add_intrigue_lifestyle_xp = medium_lifestyle_xp

		duel = {
			skill = intrigue
			value = high_skill_rating
			25 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1010.a.success.desc
				send_interface_toast = {
					title = yearly_republic.1010.a.success.toast
					type = event_toast_effect_good
					left_icon = root
					right_icon = scope:ambassador_01
					house ?= {
						add_house_modifier = {
							modifier = gdp_secret_information_house_modifier
							years = 5 
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1010.a.mixed.desc
				send_interface_toast = {
					title = yearly_republic.1010.a.mixed.toast
					type = event_toast_effect_neutral
					left_icon = root
					custom_tooltip = {
						text = yearly_republic.1010.a.mixed.custom
						increase_wounds_no_death_effect = { REASON = fell_off_roof }
						scope:relation_01 = {
							increase_wounds_no_death_effect = { REASON = fell_off_roof }
						}
					}
				}
			}
			25 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1010.a.failure.desc
				send_interface_toast = {
					title = yearly_republic.1010.a.failure.toast
					type = event_toast_effect_bad
					left_icon = root
					custom_tooltip = {
						text = yearly_republic.1010.a.failure.custom
						top_liege = {
							add_opinion = {
								modifier = spy_opinion
								target = root
							}
							add_opinion = {
								modifier = spy_opinion
								target = scope:relation_01
							}
						}
					}
				}
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			honest = medium_stress_impact_gain
			just = medium_stress_impact_gain
			craven = minor_stress_impact_gain
			# Loss
			deceitful = medium_stress_impact_loss
			paranoid = medium_stress_impact_loss
			ambitious = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				intrigue < mediocre_skill_rating
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = honest
					has_trait = just
					has_trait = craven
				}
			}
			modifier = {
				add = 50
				OR = {
					has_trait = deceitful
					has_trait = paranoid
					has_trait = ambitious
				}
			}
		}
	}

	option = {
		name = yearly_republic.1010.b

		trigger = {
			short_term_gold >= scope:ambassador_01.medium_gold_value
		}

		show_as_unavailable = { always = yes }	

		random_list = {
			100 = {
				desc = yearly_republic.1010.b.accept
				modifier = {
					scope:ambassador_01 = { has_trait = greedy }
					add = 75
				}
				modifier = {
					scope:ambassador_01 = { has_trait = deceitful }
					add = 50
				}
				modifier = {
					scope:ambassador_01 = { has_trait = ambitious }
					add = 25
				}
				modifier = {
					scope:ambassador_01 = { has_trait = cynical }
					add = 25
				}
				modifier = {
					scope:ambassador_01 = { has_trait = arbitrary }
					add = 25
				}
				modifier = {
					scope:ambassador_01 = { has_trait = honest }
					factor = 0.25
				}
				modifier = {
					scope:ambassador_01 = { has_trait = just }
					factor = 0.35
				}
				modifier = {
					scope:ambassador_01 = { has_trait = generous }
					factor = 0.5
				}
				modifier = {
					scope:ambassador_01 = { has_trait = stubborn }
					factor = 0.5
				}
				modifier = {
					scope:ambassador_01 = { has_trait = zealous }
					factor = 0.75
				}
				send_interface_toast = {
					title = yearly_republic.1010.b.success.toast
					type = event_toast_effect_good
					left_icon = root
					pay_short_term_gold = {
						target = scope:ambassador_01
						gold = scope:ambassador_01.medium_gold_value
					}
					house ?= {
						add_house_modifier = {
							modifier = gdp_secret_information_house_modifier
							years = 5 
						}
					}
				}
			}
			100 = {
				desc = yearly_republic.1010.b.refuse
				modifier = {
					scope:ambassador_01 = { has_trait = honest }
					add = 75
				}
				modifier = {
					scope:ambassador_01 = { has_trait = just }
					add = 50
				}
				modifier = {
					scope:ambassador_01 = { has_trait = generous }
					add = 25
				}
				modifier = {
					scope:ambassador_01 = { has_trait = greedy }
					factor = 0.25
				}
				modifier = {
					scope:ambassador_01 = { has_trait = deceitful }
					factor = 0.5
				}
				
				send_interface_toast = {
					title = yearly_republic.1010.b.failure.toast
					type = event_toast_effect_bad
					left_icon = root
					scope:ambassador_01 = {
						add_opinion = {
							target = root
							modifier = insulted_opinion
							opinion = -20
						}
					}
				}
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			honest = medium_stress_impact_gain
			just = medium_stress_impact_gain
			# Loss
			deceitful = medium_stress_impact_loss
			ambitious = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				short_term_gold < major_gold_value
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = honest
					has_trait = just
					has_trait = generous
				}
			}
			modifier = {
				add = 50
				OR = {
					has_trait = greedy
					has_trait = deceitful
					has_trait = ambitious
				}
			}
		}
	}

	option = {
		name = yearly_republic.1010.c

		if = {
			limit = {
				NOT = { has_trait = patient }
			}
			random = {
				chance = 5
				add_trait = patient
			}
			
		}

		stress_and_fulfillment_impact = {
			# Gain
			paranoid = medium_stress_impact_gain
			# Loss
			patient = medium_stress_impact_loss
			trusting = medium_stress_impact_loss 
			lazy = medium_stress_impact_loss
			calm = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = paranoid
			}
		}
	}
}

########################
# Summoned to Council #
########################

yearly_republic.1011 = {

	type = character_event
	title = yearly_republic.1011.t
	desc = yearly_republic.1011.desc

	theme = republic
	override_background = bedchamber

	left_portrait = {
		character = root
		animation = boredom
		camera = camera_event_center_close_to_right
	}

	right_portrait = {
		trigger = { exists = scope:right_portrait }
		character = scope:right_portrait
		triggered_animation = {
			trigger = { exists = scope:sick_person_01 }
			animation = sick
			camera = camera_event_center_close_to_right
		}
		animation = personality_rational
		camera = camera_body_right
	}

	cooldown = { years = 10 }

	trigger = {
		top_liege != root
		government_has_flag = government_is_republic
		is_healthy = yes
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
			travel = no
		}
	}

	immediate = {
		random_courtier = {
			limit = {
				is_healthy = no
				is_close_family_of = root
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
					travel = no
				}
			}
			save_scope_as = sick_person_01
		}
		court_position:court_physician_court_position ?= {
			if = {
			limit = {
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
					travel = no
				}
			}
			save_scope_as = physician_01
			}
		}
		if = {
			limit = { exists = scope:sick_person_01 }
			scope:sick_person_01 = { save_scope_as = right_portrait }
		}
		else_if = {
			limit = { exists = scope:physician_01 }
			scope:physician_01 = { save_scope_as = right_portrait }
		}
	}

	option = {
		name = yearly_republic.1011.a
		reason = physician
		trigger = {
			court_position:court_physician_court_position ?= {
				is_available_ai_adult = yes
			}
			NOT = { exists = scope:sick_person_01 }
		}

		add_character_modifier = {
			modifier = gdp_dodging_council_modifier
			years = 5 	
		}

		add_intrigue_lifestyle_xp = minor_lifestyle_xp

		stress_and_fulfillment_impact = {
			# Gain
			diligent = minor_stress_impact_gain
			# Loss
			lazy = minor_stress_impact_loss
			shy = minor_stress_impact_loss
			deceitful = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = diligent
			}
			modifier = {
				add = 50
				OR = {
					has_trait = lazy
					has_trait = shy
					has_trait = deceitful
				}
			}
		}
	}

	option = {
		name = yearly_republic.1011.b

		trigger = {
			exists = scope:sick_person_01
		}

		add_character_modifier = {
			modifier = gdp_dodging_council_modifier
			years = 5 	
		}

		progress_towards_friend_effect = {
			REASON = friend_stayed_home_when_sick
			CHARACTER = scope:sick_person_01
			OPINION = 0
		}

		stress_and_fulfillment_impact = {
			# Gain
			diligent = minor_stress_impact_gain
			# Loss
			lazy = minor_stress_impact_loss
			shy = minor_stress_impact_loss
			compassionate = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = diligent
			}
			modifier = {
				add = 50
				OR = {
					has_trait = lazy
					has_trait = shy
					has_trait = compassionate
				}
			}
		}
	}

	option = {
		name = yearly_republic.1011.c

		duel = {
			skill = diplomacy
			value = low_skill_rating
			65 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1011.c.success.desc
				send_interface_toast = {
					title = yearly_republic.1011.c.success.toast
					type = event_toast_effect_good
					left_icon = root
					add_character_modifier = {
						modifier = gdp_exemption_from_council_modifier
						years = 5
					}
				}
			}
			35 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1011.c.failure.desc
				send_interface_toast = {
					title = yearly_republic.1011.c.failure.toast
					type = event_toast_effect_bad
					left_icon = root
					add_prestige = minor_prestige_loss
				}
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			shy = minor_stress_impact_gain
			craven = minor_stress_impact_gain
			# Loss
			ambitious = minor_stress_impact_loss
			greedy = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = shy
					has_trait = craven
				}
			}
			modifier = {
				add = 50
				OR = {
					has_trait = ambitious
					has_trait = greedy
				}
			}
		}
	}

	option = {
		name = yearly_republic.1011.d

		add_prestige = minor_prestige_gain

		stress_and_fulfillment_impact = {
			# Gain
			lazy = minor_stress_impact_gain
			arbitrary = minor_stress_impact_gain
			# Loss
			diligent = minor_stress_impact_loss
			humble = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = lazy
					has_trait = arbitrary
				}
			}
			modifier = {
				add = 50
				OR = {
					has_trait = diligent
					has_trait = humble
				}
			}
		}
	}
}

#########################
# The Doge's Procession #
#########################

yearly_republic.1012 = {

	type = character_event
	title = yearly_republic.1012.t
	desc = yearly_republic.1012.desc
	window = big_event_window
	
	override_background = market
	theme = republic

	left_portrait = {
		trigger = {
			exists = scope:second_highest_patrician
		}
		character = scope:second_highest_patrician
		camera = camera_event_group_talking_left_left
		animation = frontend_center_idle
	}

	center_portrait = {
		trigger = {
			exists = scope:highest_patrician
		}
		character = scope:highest_patrician
		camera = camera_event_group_talking_left_left
		animation = chaplain
	}

	right_portrait = {
		character = root
		camera = camera_event_group_talking_left_left
		animation = acknowledging
	}

	trigger = {
		NOT = {	has_character_flag = doge_procession_flag }
		top_liege = { this = root }
		government_has_flag = government_is_republic
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
		}
		any_noble_family = {
			exists = holder.house
			holder != root
			holder.domicile ?= {
				is_domicile_type = merchant_company
			}
			holder = {
				government_has_flag = government_is_republic
			}
		}
	}

	immediate = {
		add_character_flag = doge_procession_flag
		save_scope_as = patrician_ambition_display_ruler
		ordered_noble_family = {
			limit = {
				holder != root
				exists = holder.house
				holder.domicile ?= {
					is_domicile_type = merchant_company
				}
				holder = {
					government_has_flag = government_is_republic
				}
			}
			order_by = {
				value = 0
				add = holder.house.house_power_score
			}
			position = 0
			holder = { save_scope_as = highest_patrician }
		}
		ordered_noble_family = {
			limit = {
				holder != root
				exists = holder.house
				holder.domicile ?= {
					is_domicile_type = merchant_company
				}
				holder = {
					government_has_flag = government_is_republic
				}
			}
			order_by = {
				value = 0
				add = holder.house.house_power_score
			}
			position = 1
			check_range_bounds = no
			holder = { save_scope_as = second_highest_patrician }
		}
		
	}

	option = {
		name = yearly_republic.1012.a
		add_piety = medium_piety_gain
		root.capital_county = {
			add_popular_opinion = 20
		}
			
		every_vassal = {
			limit = {
				government_has_flag = government_is_republic
				domicile ?= {
					is_domicile_type = merchant_company
				}
				house ?= {
					OR = {
						has_house_aspiration_parameter = republic_communal
						has_house_aspiration_parameter = republic_commerce
					}
				}
			}
			custom = custom.every_patrician_commerce_communal
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 20
			}
		}
		
		ai_chance = {
			base = 100
			modifier = {
				add = 50
				house ?= {
					OR = {
						has_house_aspiration_parameter = republic_communal
						has_house_aspiration_parameter = republic_commerce
					}
				}
			}
		}
	}

	option = {
		name = yearly_republic.1012.b
		add_prestige = medium_prestige_gain
		root.capital_county = {
			change_county_control = 15
		}
			
		every_noble_family = {
			limit = {
				holder != root
				holder.domicile ?= {
					is_domicile_type = merchant_company
				}
				holder = {
					government_has_flag = government_is_republic
				}
				holder.house ?= {
					OR = {
						has_house_aspiration_parameter = republic_aggrandizement
						has_house_aspiration_parameter = republic_signorial
					}
				}
			}
			custom = custom.every_patrician_aggrandizement_signorial
			holder = {
				add_opinion = {
					target = root
					modifier = respect_opinion
					opinion = 20
				}
			}
		}	
		
		ai_chance = {
			base = 100
			modifier = {
				add = 50
				house ?= {
					OR = {
						has_house_aspiration_parameter = republic_aggrandizement
						has_house_aspiration_parameter = republic_signorial
					}
				}
			}
		}
	}

	option = {
		name = yearly_republic.1012.c

		add_prestige = medium_prestige_gain
		dynasty ?= { add_dynasty_prestige = minor_dynasty_prestige_gain }
		capital_county = {
			change_county_control = 15
		}
		add_character_flag = {
			flag = GDP_despot_discount_flag
			years = 10
		}

		every_noble_family = {
			limit = {
				holder != root
				holder.domicile ?= {
					is_domicile_type = merchant_company
				}
				holder = {
					government_has_flag = government_is_republic
				}
				holder.house ?= {
					OR = {
						has_house_aspiration_parameter = republic_aggrandizement
						has_house_aspiration_parameter = republic_signorial
						has_house_aspiration_parameter = republic_communal
					}
				}
			}
			custom = custom.every_patrician_aggrandizement_signorial_communal
			holder = {
				add_opinion = {
					target = root
					modifier = disrespect_opinion
					opinion = -40
				}
			}
		}	
		
		custom_tooltip = yearly_republic.1012.c.tt

		stress_and_fulfillment_impact = {
			# Gain
			humble = major_stress_impact_gain
			# Loss
			arrogant = major_stress_impact_loss
			ambitious = major_stress_impact_loss
			
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = humble
			}
			modifier = {
				add = 50
				OR = {
					has_trait = arrogant
					has_trait = ambitious
				}
			}
		}
	}
}

#######################
# Marriage to the Sea #
#######################

yearly_republic.1013 = {

	type = character_event
	title = yearly_republic.1013.t
	desc = yearly_republic.1013.desc

	theme = republic
	override_background = fp1_ocean
	
	left_portrait = {
		character = root
		animation = acknowledging
		camera = camera_body_left
	}

	right_portrait = {
		character = scope:bishop_01
	}

	trigger = {
		NOT = {	has_character_flag = marriage_to_the_sea_doge_flag }
		top_liege = { this = root }
		government_has_flag = government_is_republic
		capital_county = title:c_venezia
		culture = { has_cultural_pillar = heritage_latin }
		OR = { religion = religion:catholic_religion religion = religion:protestant_religion religion = religion:eastern_orthodox_religion religion = religion:oriental_orthodox_religion }
		cp:councillor_court_chaplain ?= { is_available_ai_adult = yes }
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
			travel = no
		}

	}

	immediate = {
		add_character_flag = marriage_to_the_sea_doge_flag
		cp:councillor_court_chaplain ?= {
			save_scope_as = bishop_01
		}

		capital_county = {
			add_popular_opinion = 15
			change_county_control = minor_county_control_gain
		}
	}
	# "We rule the waves!"
	option = {
		name = yearly_republic.1013.a

		trigger = {
			NOT = { has_trait = cynical }
		}

		add_prestige = medium_prestige_gain
		dynasty ?= { add_dynasty_prestige = miniscule_dynasty_prestige_gain }
		add_stewardship_lifestyle_xp = medium_lifestyle_experience

		stress_and_fulfillment_impact = {
			# Gain
			humble = minor_stress_impact_gain
			shy = minor_stress_impact_gain
			# Loss
			arrogant = medium_stress_impact_loss
			gregarious = minor_stress_impact_loss
			zealous = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				add = 50
				OR = {
					has_trait = arrogant
					has_trait = gregarious
					has_trait = zealous
				}
			}
		}
	}
	# "A foolish and empty ritual."
	option = {
		name = yearly_republic.1013.b

		trigger = {
			has_trait = cynical
		}

		add_prestige = medium_prestige_gain
		dynasty ?= { add_dynasty_prestige = miniscule_dynasty_prestige_gain }
		add_intrigue_lifestyle_xp = medium_lifestyle_experience

		stress_and_fulfillment_impact = {
			# Gain
			gregarious = minor_stress_impact_gain
			# Loss
			cynical = medium_stress_impact_loss
			honest = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				add = 50
				has_trait = cynical
			}
		}
	}
	# "I am coming my love!"
	option = {
		name = yearly_republic.1013.c
		add_internal_flag = dangerous

		trigger = {
			OR = {
				has_trait = lunatic_1
			}
		}
		
		dynasty ?= { add_dynasty_prestige = major_dynasty_prestige_gain }

		death = {
			death_reason = death_drowned
		}

		# Lethal, so player-only. Options a and b are never zeroed, leaving the AI a weighted alternative
		ai_chance = {
			base = 0
		}
	}
	# "and to the sea I will remain true!"
	option = {
		name = yearly_republic.1013.d

		trigger = {
			has_trait = eccentric
		}

		add_character_modifier = {
			modifier = gdp_wedded_to_the_sea_modifier
		}

		set_nickname_effect = { NICKNAME = nick_amator_maris }

		stress_and_fulfillment_impact = {
			# Gain
			zealous = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			# Loss
			eccentric = medium_stress_impact_loss
		}

		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				OR = {
					has_trait = zealous
					has_trait = arrogant
				}
			}
			modifier = {
				add = 50
				has_trait = lunatic_1
			}
		}
	}
}

########################
# Aligning the Houses #
########################

# NEOW 2555: historical Guelph/Ghibelline faction recruitment is disabled.
#yearly_republic.1014 = {

#	type = character_event
#	title = yearly_republic.1014.t
#	desc = yearly_republic.1014.desc
#	override_background = bp1_relaxing_room_western

#	theme = republic
#	window = big_event_window
	
#	left_portrait = {
#		character = scope:faction_head_01
#		animation = admiration
#	}
#	center_portrait = {
#		character = root
#		animation = contemplating
#	}
#	right_portrait = {
#		character = scope:faction_head_02
#		animation = arguing
#	}

#	cooldown = { years = 10 }

#	trigger = {
#		is_ai = no
#		government_has_flag = government_is_republic
#		exists = house
#		house = { NOT = { has_default_house_aspiration = yes } }
#		trigger_if = {
#			limit = { gdp_is_assembly_head_trigger = yes }
#			any_vassal = {
#				count >= 2
#				gdp_shares_house_ambition_trigger = { CHARACTER = root }
#			}
#		}
#		trigger_else = {
#			liege ?= {
#				trigger_if = {
#					limit = { gdp_shares_house_ambition_trigger = { CHARACTER = root } }
#					any_vassal = {
#						count >= 1
#						gdp_shares_house_ambition_trigger = { CHARACTER = root }
#					}
#				}
#				trigger_else = {
#					any_vassal = {
#						count >= 2
#						gdp_shares_house_ambition_trigger = { CHARACTER = root }
#					}
#				}
#			}
#		}
#	}

#	immediate = {
#		if = {
#			limit = { gdp_is_assembly_head_trigger = yes }
#			save_scope_as = republic_ruler
#		}
#		else = {
#			liege ?= { save_scope_as = republic_ruler }
#		}

#		# Pool the head of the republic with the patrician families so they compete on house score together
#		scope:republic_ruler = {
#			if = {
#				limit = { gdp_shares_house_ambition_trigger = { CHARACTER = root } }
#				add_to_list = faction_candidates
#			}
#			every_vassal = {
#				limit = { gdp_shares_house_ambition_trigger = { CHARACTER = root } }
#				add_to_list = faction_candidates
#			}
#		}

#		# faction_candidates excludes root, so pool a second list for the options that act on the gathering as a whole
#		add_to_list = aligning_houses
#		every_in_list = {
#			list = faction_candidates
#			add_to_list = aligning_houses
#		}

#		ordered_in_list = {
#			list = faction_candidates
#			order_by = house.house_power_score
#			position = 0
#			save_scope_as = faction_head_01
#		}
#		ordered_in_list = {
#			list = faction_candidates
#			order_by = house.house_power_score
#			position = 1
#			save_scope_as = faction_head_02
#		}
#	}
#	# "We should all join the Guelphs."
#	option = {
#		name = yearly_republic.1014.a

#		trigger = {
#			is_guelph_trigger = yes
#			any_in_list = {
#				list = faction_candidates
#				is_guelph_trigger = no
#			}
#		}

#		duel = {
#			skill = diplomacy
#			value = high_skill_rating
#			50 = {
#				compare_modifier = {
#					value = scope:duel_value
#					multiplier = 3.5
#					min = -49
#				}
#				min = 5
#				desc = yearly_republic.1014.tt.align_guelphs_success.desc
#				custom_tooltip = {
#					text = yearly_republic.1014.a.tt
#					send_interface_toast = {
#						title = yearly_republic.1014.align_guelphs_success.toast
#						type = event_toast_effect_good
#						left_icon = root
#						every_in_list = {
#							list = faction_candidates
#							limit = {
#								exists = top_participant_group:guelph_ghibelline
#								is_guelph_trigger = no
#								NOT = { exists = var:gg_recently_recruited }
#							}
#							gg_change_side_to_guelph_effect = { REASON = flag:schemed }
#							# Grace period so they can't be flip-flopped incessantly
#							set_variable = {
#								name = gg_recently_recruited
#								years = 2
#							}
#						}
#					}
#				}
#			}
#			50 = {
#				compare_modifier = {
#					value = scope:duel_value
#					multiplier = -3.5
#					min = -49
#				}
#				min = 5
#				desc = yearly_republic.1014.tt.align_guelphs_failure.desc
#				send_interface_toast = {
#					title = yearly_republic.1014.align_guelphs_failure.toast
#					type = event_toast_effect_bad
#					left_icon = root
#					add_prestige = minor_prestige_loss
#				}
#			}
#		}

#		stress_and_fulfillment_impact = {
#			# Gain
#			shy = medium_stress_impact_gain
#			craven = minor_stress_impact_gain
#			content = minor_stress_impact_gain
#			# Loss
#			ambitious = medium_stress_impact_loss
#			gregarious = minor_stress_impact_loss
#			zealous = minor_stress_impact_loss
#		}

#		ai_chance = {
#			base = 100
#			modifier = {
#				factor = 0
#				OR = {
#					has_trait = shy
#					has_trait = craven
#					has_trait = content
#				}
#			}
#			modifier = {
#				add = 50
#				has_trait = ambitious
#			}
#			modifier = {
#				add = 25
#				diplomacy >= high_skill_rating
#			}
#		}
#	}
#	# "We should all join the Ghibellines."
#	option = {
#		name = yearly_republic.1014.b

#		trigger = {
#			is_ghibelline_trigger = yes
#			any_in_list = {
#				list = faction_candidates
#				is_ghibelline_trigger = no
#			}
#		}

#		duel = {
#			skill = diplomacy
#			value = high_skill_rating
#			50 = {
#				compare_modifier = {
#					value = scope:duel_value
#					multiplier = 3.5
#					min = -49
#				}
#				min = 5
#				desc = yearly_republic.1014.tt.align_ghibellines_success.desc
#				custom_tooltip = yearly_republic.1014.b.tt
#				send_interface_toast = {
#					title = yearly_republic.1014.align_ghibellines_success.toast
#					type = event_toast_effect_good
#					left_icon = root
#					every_in_list = {
#						list = faction_candidates
#						limit = {
#							exists = top_participant_group:guelph_ghibelline
#							is_ghibelline_trigger = no
#							NOT = { exists = var:gg_recently_recruited }
#						}
#						gg_change_side_to_ghibelline_effect = { REASON = flag:schemed }
#						# Grace period so they can't be flip-flopped incessantly
#						set_variable = {
#							name = gg_recently_recruited
#							years = 2
#						}
#					}
#				}
#			}
#			50 = {
#				compare_modifier = {
#					value = scope:duel_value
#					multiplier = -3.5
#					min = -49
#				}
#				min = 5
#				desc = yearly_republic.1014.tt.align_ghibellines_failure.desc
#				send_interface_toast = {
#					title = yearly_republic.1014.align_ghibellines_failure.toast
#					type = event_toast_effect_bad
#					left_icon = root
#					add_prestige = minor_prestige_loss
#				}
#			}
#		}

#		stress_and_fulfillment_impact = {
#			# Gain
#			shy = medium_stress_impact_gain
#			craven = minor_stress_impact_gain
#			content = minor_stress_impact_gain
#			# Loss
#			ambitious = medium_stress_impact_loss
#			gregarious = minor_stress_impact_loss
#			stubborn = minor_stress_impact_loss
#		}

#		ai_chance = {
#			base = 100
#			modifier = {
#				factor = 0
#				OR = {
#					has_trait = shy
#					has_trait = craven
#					has_trait = content
#				}
#			}
#			modifier = {
#				add = 50
#				has_trait = ambitious
#			}
#			modifier = {
#				add = 25
#				diplomacy >= high_skill_rating
#			}
#		}
#	}
#	# "Let's strengthen the bonds between our houses."
#	option = {
#		name = yearly_republic.1014.c

#		custom_tooltip = {
#			text = yearly_republic.1014.c.tt
#			every_in_list = {
#				list = aligning_houses
#				save_temporary_scope_as = aligning_house_head
#				every_in_list = {
#					list = aligning_houses
#					limit = {
#						this != scope:aligning_house_head
#						# Handle each pair once, from the side not yet paired off
#						NOT = { has_character_flag = aligning_houses_paired_flag }
#						house ?= { NOT = { scope:aligning_house_head.house ?= this } }
#					}
#					save_temporary_scope_as = aligning_other_house_head
#					scope:aligning_house_head.house ?= {
#						# impact_house_relation silently fails to create a relation between two small AI houses, so we set a new one ourselves
#						if = {
#							limit = { NOT = { has_house_relation_with = scope:aligning_other_house_head.house } }
#							set_house_relation = {
#								target = scope:aligning_other_house_head.house
#								level = cordial
#								description = house_relation_reason_houses_aligned_desc
#							}
#						}
#						else = {
#							change_house_relation_effect = {
#								HOUSE = scope:aligning_other_house_head.house
#								VALUE = house_relation_improve_medium_value
#								REASON = houses_aligned
#								CHAR = scope:aligning_house_head
#								TARGET_CHAR = scope:aligning_other_house_head
#								TITLE = scope:dummy_gender
#							}
#						}
#					}
#				}
#				add_character_flag = aligning_houses_paired_flag
#			}
#			every_in_list = {
#				list = aligning_houses
#				remove_character_flag = aligning_houses_paired_flag
#			}
#		}

#		stress_and_fulfillment_impact = {
#			# Gain
#			paranoid = medium_stress_impact_gain
#			callous = minor_stress_impact_gain
#			arrogant = minor_stress_impact_gain
#			# Loss
#			gregarious = medium_stress_impact_loss
#			trusting = minor_stress_impact_loss
#			compassionate = minor_stress_impact_loss
#		}

#		ai_chance = {
#			base = 100
#			modifier = {
#				factor = 0
#				OR = {
#					has_trait = paranoid
#					has_trait = callous
#					has_trait = arrogant
#				}
#			}
#			modifier = {
#				add = 50
#				has_trait = gregarious
#			}
#			modifier = {
#				add = 25
#				has_trait = trusting
#			}
#		}
#	}
#	# "All rivalries among us has to end."
#	option = {
#		name = yearly_republic.1014.d

#		trigger = {
#			any_in_list = {
#				list = aligning_houses
#				OR = {
#					any_relation = {
#						type = rival
#						is_in_list = aligning_houses
#					}
#					any_relation = {
#						type = nemesis
#						is_in_list = aligning_houses
#					}
#				}
#			}
#		}

#		custom_tooltip = {
#			text = yearly_republic.1014.d.tt
#			send_interface_toast = {
#				title = yearly_republic.1014.d.toast
#				type = event_toast_effect_good
#				left_icon = root
#				every_in_list = {
#					list = aligning_houses
#					save_temporary_scope_as = feuding_house_head
#					every_in_list = {
#						list = aligning_houses
#						limit = { this != scope:feuding_house_head }
#						# Nemesis aliases as rival, so it has to be caught first
#						if = {
#							limit = { has_relation_nemesis = scope:feuding_house_head }
#							remove_relation_nemesis = scope:feuding_house_head
#						}
#						else_if = {
#							limit = { has_relation_rival = scope:feuding_house_head }
#							remove_relation_rival = scope:feuding_house_head
#						}
#					}
#				}
#			}
#		}

#		stress_and_fulfillment_impact = {
#			# Gain
#			vengeful = medium_stress_impact_gain
#			wrathful = minor_stress_impact_gain
#			stubborn = minor_stress_impact_gain
#			# Loss
#			forgiving = medium_stress_impact_loss
#			compassionate = minor_stress_impact_loss
#			calm = minor_stress_impact_loss
#		}

#		ai_chance = {
#			base = 100
#			modifier = {
#				factor = 0
#				OR = {
#					has_trait = vengeful
#					has_trait = wrathful
#					has_trait = stubborn
#				}
#			}
#			modifier = {
#				add = 50
#				has_trait = forgiving
#			}
#			modifier = {
#				add = 25
#				has_trait = compassionate
#			}
#		}
#	}
#	# "We should align our business interests."
#	option = {
#		name = yearly_republic.1014.e

#		trigger = {
#			NOT = { 
#				house ?= { 
#					has_house_modifier = gdp_ambitions_aligned_house_modifier
#				}
#			}
#		}
#		custom_tooltip = {
#			text = yearly_republic.1014.e.tt
#			send_interface_toast = {
#				title = yearly_republic.1014.e.toast
#				type = event_toast_effect_good
#				left_icon = root
#				every_in_list = {
#					list = aligning_houses
#					# Several attendees can share a house, so let the first of them claim the modifier for it
#					limit = {
#						house ?= {
#							NOT = { has_house_modifier = gdp_ambitions_aligned_house_modifier }
#						}
#					}
#					this.house ?= {
#						add_house_modifier = {
#							modifier = gdp_ambitions_aligned_house_modifier
#							years = 2
#						}
#					}
#				}
#			}
#		}

#		stress_and_fulfillment_impact = {
#			# Gain
#			content = minor_stress_impact_gain
#			lazy = minor_stress_impact_gain
#			generous = minor_stress_impact_gain
#			# Loss
#			greedy = medium_stress_impact_loss
#			diligent = minor_stress_impact_loss
#			ambitious = minor_stress_impact_loss
#		}

#		ai_chance = {
#			base = 100
#			modifier = {
#				factor = 0
#				OR = {
#					has_trait = content
#					has_trait = lazy
#					has_trait = generous
#				}
#			}
#			modifier = {
#				add = 50
#				has_trait = greedy
#			}
#			modifier = {
#				add = 25
#				has_trait = diligent
#			}
#		}
#	}
#}

##################
# Gold for Votes #
##################

yearly_republic.1015 = {

	type = character_event
	title = yearly_republic.1015.t
	desc = yearly_republic.1015.desc

	theme = republic

	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:patrician
		animation = debating
	}

	cooldown = { years = 3 }

	trigger = {
		is_ai = no
		government_has_flag = government_is_republic
		gdp_is_assembly_head_trigger = yes
		# A pledge for the next vote only makes sense while none is under way
		ongoing_voting_session = no
		any_vassal = {
			gdp_can_pledge_assembly_vote_trigger = yes
		}
	}

	immediate = {
		random_vassal = {
			limit = {
				gdp_can_pledge_assembly_vote_trigger = yes
			}
			weight = {
				base = 1
				modifier = {
					add = 3
					has_trait = greedy
				}
				modifier = {
					add = 2
					is_major_assembly_member = yes
				}
				modifier = {
					factor = 0.5
					opinion = {
						target = root
						value < 0
					}
				}
			}
			save_scope_as = patrician
		}
	}

	# "Name your price."
	option = {
		name = yearly_republic.1015.a

		trigger = {
			short_term_gold >= scope:patrician.major_gold_value
		}

		pay_short_term_gold = {
			target = scope:patrician
			gold = scope:patrician.major_gold_value
		}

		gdp_pledge_assembly_vote_effect = {
			PLEDGER = scope:patrician
		}

		stress_and_fulfillment_impact = {
			# Gain
			greedy = medium_stress_impact_gain
			just = minor_stress_impact_gain
			# Loss
			ambitious = minor_stress_impact_loss
			gregarious = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = just
				}
			}
		}
	}

	# "My proposals will stand on their own merits."
	option = {
		name = yearly_republic.1015.c

		stress_and_fulfillment_impact = {
			# Gain
			ambitious = minor_stress_impact_gain
			# Loss
			just = medium_stress_impact_loss
			content = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = ambitious
				}
			}
		}
	}
}

################################
# Beating the Vote Out of Them #
################################

scripted_effect vote_intimidation_response_effect = {
	if = {
		limit = {
			has_trait = vengeful
		}
		set_relation_rival = { reason = rival_intimidation target = root }
	}
	else_if = {
		limit = {
			has_trait = brave
		}
		progress_towards_rival_effect = {
			REASON = rival_intimidation
			CHARACTER = root
			OPINION = -15
		}
	}
	else_if = {
		limit = {
			has_trait = craven
		}
		add_opinion = {
			modifier = threatened_opinion
			target = root
			opinion = -5
		}
	}
	else = {
		add_opinion = {
			modifier = threatened_opinion
			target = root
			opinion = -10
		}	
	}
}

yearly_republic.1016 = {

	type = character_event
	title = yearly_republic.1016.t
	desc = yearly_republic.1016.desc

	theme = republic
	override_background = alley_day

	left_portrait = {
		character = root
		animation = anger
	}
	lower_center_portrait = { 
		character = scope:house_member
		animation = fear
	}
	lower_right_portrait = { 
		character = scope:house_client
		animation = fear
	}
	right_portrait = { 
		character = scope:patrician
		animation = fear
	}

	cooldown = { years = 3 }

	trigger = {
		is_ai = no
		government_has_flag = government_is_republic
		gdp_is_assembly_head_trigger = yes
		# A pledge for the next vote only makes sense while none is under way
		ongoing_voting_session = no
		top_liege = {
			any_vassal = {
				gdp_can_pledge_assembly_vote_trigger = yes
				any_courtier = {
					this != root
					is_available_quick = {
						activity = no
						adult = yes
						ai = yes
					}
					save_temporary_scope_as = first_associate
				}
				any_close_or_extended_family_member = {
					this != root
					this != scope:first_associate
					NOR = {
							has_trait = reclusive
							has_trait = irritable
							has_trait = lunatic
					}
					is_available_quick = {
						activity = no
						adult = yes
						ai = yes
					}
				}
			}
		}
	}

	immediate = {
		random_vassal = {
			limit = {
				gdp_can_pledge_assembly_vote_trigger = yes
				any_courtier = {
					this != root
					is_available_quick = {
						activity = no
						adult = yes
						ai = yes
					}
					save_temporary_scope_as = first_associate
				}
				any_close_or_extended_family_member = {
					this != root
					this != scope:first_associate
					NOR = {
							has_trait = reclusive
							has_trait = irritable
							has_trait = lunatic
					}
					is_available_quick = {
						activity = no
						adult = yes
						ai = yes
					}
				}
			}
			weight = {
				base = 1
				modifier = {
					add = 3
					has_trait = craven
				}
				modifier = {
					add = -10
					has_trait = brave
				}
				modifier = {
					add = 2
					is_major_assembly_member = yes
				}
				modifier = {
					factor = 0.5
					opinion = {
						target = root
						value < 0
					}
				}
			}
			save_scope_as = patrician
			random_courtier = {
				limit = {
					this != root
					is_available_quick = {
						activity = no
						adult = yes
						ai = yes
					}
				}
				save_scope_as = house_client
			}
			random_close_or_extended_family_member = {
				limit = {
					this != scope:patrician
					this != root
					this != scope:house_client
					NOR = {
						has_trait = reclusive
						has_trait = irritable
						has_trait = lunatic
					}
					is_available_quick = {
						activity = no
						adult = yes
						ai = yes
					}
				}
				save_scope_as = house_member
			}
		}
	}

	## "Sabotage [target.GetHerHis] business interests."
	option = { 
		name = yearly_republic.1016.a
		scope:patrician = {
			add_character_modifier = {
				modifier = gdp_business_sabotage_modifier
				years = 5 	
			}
		}

		progress_towards_rival_effect = {
			REASON = rival_sabotaged_business_interests
			CHARACTER = scope:patrician
			OPINION = -20
		}

		send_interface_toast = {
			title = yearly_republic.1016.pledge.toast
			type = event_toast_effect_good
			left_icon = root
			right_icon = scope:patrician
			gdp_pledge_assembly_vote_effect = {
				PLEDGER = scope:patrician
			}
		}

		stress_and_fulfillment_impact = {
			# Stress Gain #
			compassionate = miniscule_stress_impact_gain
			just = miniscule_stress_impact_gain
			craven = miniscule_stress_impact_gain
			calm = miniscule_stress_impact_gain
			
			# Stress Loss #
			callous = miniscule_stress_impact_loss
			impatient = miniscule_stress_impact_loss
			wrathful = miniscule_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = just
					has_trait = craven
					has_trait = calm
				}
			}
		}
	}
	## "Have thugs ambush and beat [target.GetHerHis] courtiers."
	option = { 
		name = yearly_republic.1016.b
		trigger = {
			NOR = { 
				has_trait = sadistic
				has_trait = wrathful
			} 
		}
		add_dread = minor_dread_gain

		send_interface_toast = {
			title = yearly_republic.1016.pledge.toast
			type = event_toast_effect_good
			left_icon = root
			right_icon = scope:patrician
			gdp_pledge_assembly_vote_effect = {
				PLEDGER = scope:patrician
			}
		}

		scope:house_client = {
			increase_wounds_no_death_effect = { REASON = beaten }
		}
		scope:patrician = {
			vote_intimidation_response_effect = yes
		}
		add_piety = minor_piety_loss
		
		stress_and_fulfillment_impact = {
			# Stress Gain #
			just = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
			craven = miniscule_stress_impact_gain
			calm = minor_stress_impact_gain
			
			# Stress Loss #
			callous = miniscule_stress_impact_loss
			impatient = miniscule_stress_impact_loss
			wrathful = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = just
					has_trait = craven
					has_trait = calm
				}
			}
		}
	}
	## "Set fire to [target.GetHerHis] home."
	option = { 
		name = yearly_republic.1016.c
		trigger = {
			has_trait = wrathful
			NOT = {
				has_trait = sadistic
			}
		}
		scope:patrician = {
			add_character_modifier = {
				modifier = gdp_arson_modifier
				years = 5 	
			}

			vote_intimidation_response_effect = yes
		}
		add_dread = medium_dread_gain

		add_piety = medium_piety_loss
		random = {
			chance = 25
			scope:house_member = {
				increase_wounds_no_death_effect = { REASON = wounded }
			}
		}

		send_interface_toast = {
			title = yearly_republic.1016.pledge.toast
			type = event_toast_effect_good
			left_icon = root
			right_icon = scope:patrician
			gdp_pledge_assembly_vote_effect = {
				PLEDGER = scope:patrician
			}
		}

		stress_and_fulfillment_impact = {
			# Stress Gain #
			just = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
			craven = miniscule_stress_impact_gain
			calm = minor_stress_impact_gain
			
			# Stress Loss #
			callous = minor_stress_impact_loss
			wrathful = minor_stress_impact_loss
			impatient = miniscule_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = just
					has_trait = craven
					has_trait = calm
				}
			}
		}
	}
	## "I will teach him TERROR!"
	option = { 
		name = yearly_republic.1016.d
		trigger = { 
			has_trait = sadistic
		}
		add_dread = major_dread_gain
		add_piety = major_piety_loss
		scope:patrician = {
			vote_intimidation_response_effect = yes
		}

		send_interface_toast = {
			title = yearly_republic.1016.pledge.toast
			type = event_toast_effect_good
			left_icon = root
			right_icon = scope:patrician
			gdp_pledge_assembly_vote_effect = {
				PLEDGER = scope:patrician
			}
		}
		custom_tooltip = {
			text = yearly_republic.1016.d.tt
			scope:house_member = {
				increase_wounds_no_death_effect = { REASON = wounded }
				if = {
					limit = {
						is_male = yes
					}
					random_list = { 
						1 = { add_trait = eunuch_1 }
						1 = { add_trait = blind }
						1 = { add_trait = disfigured }
					}
				}
				else = {
					random_list = { 
						1 = { add_trait = blind }
						1 = { add_trait = disfigured }
					}
				}
			}
		}
		
		stress_and_fulfillment_impact = {
			# Stress Gain #
			just = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			craven = miniscule_stress_impact_gain
			calm = minor_stress_impact_gain

			# Stress Loss #
			callous = medium_stress_impact_loss
			wrathful = medium_stress_impact_loss
			impatient = miniscule_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = just
					has_trait = craven
					has_trait = calm
				}
			}
		}
	}
	## "I will be patient a while longer."
	option = { 
		name = yearly_republic.1016.e
		stress_and_fulfillment_impact = {
			# Stress Gain
			wrathful = miniscule_stress_impact_gain
			impatient = medium_stress_impact_gain
			
			# Stress Loss 
			compassionate = miniscule_stress_impact_loss 
			calm = medium_stress_impact_loss
			stubborn = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = wrathful
					has_trait = impatient
				}
			}
		}
	}
}

#####################
# Philosopher-Kings #
#####################

#TODO_GDP_BS TIT-68244 Change order of the left_portrait so arm don't go behind the center_portrait.

yearly_republic.1017 = {

	type = character_event
	title = yearly_republic.1017.t
	desc = yearly_republic.1017.desc
	window = big_event_window
	override_background = activity_feast

	theme = republic

	left_portrait = {
		character = scope:debater_01
		animation = stunned
		camera = camera_body_right
	}
	center_portrait = {
		character = scope:debater_02
		animation = drink
		camera = camera_event_center_pointing_left
	}
	right_portrait = {
		character = scope:debater_03
		animation = admiration
		camera = camera_body_left_gg
	}
	lower_center_portrait = {
		character = root
	}

	cooldown = { years = 10 }

	trigger = {
		is_ai = no
		government_has_flag = government_is_republic
		gdp_is_assembly_head_trigger = yes
		# A pledge for the next vote only makes sense while none is under way
		ongoing_voting_session = no
		any_vassal = {
			count >= 3
			gdp_can_pledge_assembly_vote_trigger = yes
		}
	}

	immediate = {
		random_vassal = {
			limit = {
				gdp_can_pledge_assembly_vote_trigger = yes
			}
			weight = {
				base = 1
				modifier = {
					add = 10
					has_trait = shrewd
				}
				modifier = {
					add = 5
					has_trait = lifestyle_poet
				}
				modifier = {
					add = 5
					has_trait = lifestyle_mystic
				}
				modifier = {
					add = 5
					has_trait = administrator
				}
				modifier = {
					add = 10
					has_trait = lifestyle_scholar
				}
				modifier = {
					add = 2
					is_major_assembly_member = yes
				}
				modifier = {
					add = 10
					has_trait_rank = {
						trait = education_learning
						rank >= 2
					}
				}
				modifier = {
					factor = 0.5
					opinion = {
						target = root
						value < 0
					}
				}
			}
			save_scope_as = debater_01
		}
		random_vassal = {
			limit = {
				gdp_can_pledge_assembly_vote_trigger = yes
				this != scope:debater_01
			}
			weight = {
				base = 1
				modifier = {
					add = 10
					has_trait = shrewd
				}
				modifier = {
					add = 5
					has_trait = lifestyle_poet
				}
				modifier = {
					add = 5
					has_trait = lifestyle_mystic
				}
				modifier = {
					add = 5
					has_trait = administrator
				}
				modifier = {
					add = 10
					has_trait = lifestyle_scholar
				}
				modifier = {
					add = 2
					is_major_assembly_member = yes
				}
				modifier = {
					add = 10
					has_trait_rank = {
						trait = education_learning
						rank >= 2
					}
				}
				modifier = {
					factor = 0.5
					opinion = {
						target = root
						value < 0
					}
				}
			}
			save_scope_as = debater_02
		}
		random_vassal = {
			limit = {
				gdp_can_pledge_assembly_vote_trigger = yes
				this != scope:debater_01
				this != scope:debater_02
			}
			weight = {
				base = 1
				modifier = {
					add = 10
					has_trait = shrewd
				}
				modifier = {
					add = 5
					has_trait = lifestyle_poet
				}
				modifier = {
					add = 5
					has_trait = lifestyle_mystic
				}
				modifier = {
					add = 5
					has_trait = administrator
				}
				modifier = {
					add = 10
					has_trait = lifestyle_scholar
				}
				modifier = {
					add = 2
					is_major_assembly_member = yes
				}
				modifier = {
					add = 10
					has_trait_rank = {
						trait = education_learning
						rank >= 2
					}
				}
				modifier = {
					factor = 0.5
					opinion = {
						target = root
						value < 0
					}
				}
			}
			save_scope_as = debater_03
		}
		# The sharpest of the three sets the bar for each kind of argument
		ordered_vassal = {
			limit = {
				OR = {
					this = scope:debater_01
					this = scope:debater_02
					this = scope:debater_03
				}
			}
			order_by = diplomacy
			save_scope_as = debater_orator
		}
		ordered_vassal = {
			limit = {
				OR = {
					this = scope:debater_01
					this = scope:debater_02
					this = scope:debater_03
				}
			}
			order_by = learning
			save_scope_as = debater_scholar
		}
	}

	## "Brilliant Oratory will convince them."
	option = {
		name = yearly_republic.1017.a

		duel = {
			skill = diplomacy
			target = scope:debater_orator
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1017.a.success.desc
				send_interface_toast = {
					title = yearly_republic.1017.a.success.toast
					type = event_toast_effect_good
					left_icon = root
					right_icon = scope:debater_orator
					gdp_pledge_assembly_vote_effect = {
						PLEDGER = scope:debater_01
					}
					gdp_pledge_assembly_vote_effect = {
						PLEDGER = scope:debater_02
					}
					gdp_pledge_assembly_vote_effect = {
						PLEDGER = scope:debater_03
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1017.a.failure.desc
				send_interface_toast = {
					title = yearly_republic.1017.a.failure.toast
					type = event_toast_effect_bad
					left_icon = root
					right_icon = scope:debater_orator
					add_prestige = minor_prestige_loss
				}
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			shy = minor_stress_impact_gain
			# Loss
			gregarious = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = shy
			}
		}
	}

	## "The soundness of my reasoning will dazzle them."
	option = {
		name = yearly_republic.1017.b

		duel = {
			skill = learning
			target = scope:debater_scholar
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1017.b.success.desc
				send_interface_toast = {
					title = yearly_republic.1017.b.success.toast
					type = event_toast_effect_good
					left_icon = root
					right_icon = scope:debater_scholar
					gdp_pledge_assembly_vote_effect = {
						PLEDGER = scope:debater_01
					}
					gdp_pledge_assembly_vote_effect = {
						PLEDGER = scope:debater_02
					}
					gdp_pledge_assembly_vote_effect = {
						PLEDGER = scope:debater_03
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = yearly_republic.1017.b.failure.desc
				send_interface_toast = {
					title = yearly_republic.1017.b.failure.toast
					type = event_toast_effect_bad
					left_icon = root
					right_icon = scope:debater_scholar
					add_prestige = minor_prestige_loss
				}
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			humble = minor_stress_impact_gain
			# Loss
			arrogant = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = humble
			}
		}
	}

	## "Maybe its better to listen and learn."
	option = {
		name = yearly_republic.1017.c

		send_interface_toast = {
			title = yearly_republic.1017.c.toast
			type = event_toast_effect_good
			left_icon = root
			right_icon = scope:debater_scholar
			add_learning_lifestyle_xp = medium_lifestyle_xp
		}

		custom_tooltip = yearly_republic.1017.c.tt
		hidden_effect = {
			random = {
				chance = 15
				random_list = {
					25 = {
						send_interface_toast = {
							title = yearly_republic.1017.c.insight.toast
							type = event_toast_effect_good
							left_icon = root
							add_learning_skill = 1
						}
					}
					25 = {
						trigger = {
							NOT = { has_trait = lifestyle_mystic }
						}
						send_interface_toast = {
							title = yearly_republic.1017.c.insight.toast
							type = event_toast_effect_good
							left_icon = root
							add_trait = lifestyle_mystic
						}
					}
					25 = {
						trigger = {
							NOT = { has_trait = lifestyle_poet }
						}
						send_interface_toast = {
							title = yearly_republic.1017.c.insight.toast
							type = event_toast_effect_good
							left_icon = root
							add_trait = lifestyle_poet
						}
					}
					25 = {
						trigger = {
							NOR = {
								has_trait = shrewd
								has_trait = dull
							}
						}
						send_interface_toast = {
							title = yearly_republic.1017.c.insight.toast
							type = event_toast_effect_good
							left_icon = root
							add_trait = shrewd
						}
					}
				}
			}
		}

		stress_and_fulfillment_impact = {
			# Gain
			arrogant = minor_stress_impact_gain
			# Loss
			humble = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = arrogant
			}
		}
	}
}

############################
# Friend Comes Bearing Gifts#
############################
## Player get an domicile artifact from a friendly merchant/patrician/adventurer.

yearly_republic.1018 = {
	
	type = character_event
	title = yearly_republic.1018.t
	desc = yearly_republic.1018.desc
	override_background = bp2_courtyard

	theme = republic

	left_portrait = {
		character = root
		animation = happiness
		camera = camera_event_crowd
	}
	right_portrait = {
		character = scope:benefactor_01
		animation = admiration
		camera = camera_event_far_right_very_right
	}
	artifact = {
		target = scope:new_curio
		position = lower_center_portrait
	}
	cooldown = { years = 10 }

	trigger = {
		government_has_flag = government_is_republic
		exists = house
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
		}
		any_relation = {
			type = friend
			type = soulmate
			type = lover
			NOR = {
				is_spouse_of = root
				is_close_family_of = root
			}
			is_available_quick = {
				adult = yes
				imprisoned = no
				incapable = no
				in_army = no
			}
		}
	}

	immediate = {
		every_relation = {
			type = friend
			type = soulmate
			type = lover
			limit = {
				NOR = {
					is_spouse_of = root
					is_close_family_of = root
				}
				is_available_quick = {
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
			}
			add_to_list = potential_benefactor_list
		}
		random_in_list = {
			list = potential_benefactor_list
			weight = {
				base = 1
				modifier = {
					factor = 50
					OR = {
						government_has_flag = government_is_merchant
						is_landless_adventurer = yes
					}
				}
				# Prefer best friends next
				modifier = {
					factor = 10
					has_relation_best_friend = root
				}
			}
			save_scope_as = benefactor_01
		}
		hidden_effect = {
			random_dummy_gender_effect = yes
			house = {
				switch = {
					trigger = has_house_aspiration_parameter
					republic_commerce = {
						scope:benefactor_01 = {
							random_gift_artifact_commerce_effect = {
								OWNER = scope:benefactor_01
								CREATOR = scope:dummy_gender
								SUBJECT = flag:stewardship
								TOPIC = flag:no
							}
						}
						scope:new_trinket ?= { save_scope_as = new_curio }
						scope:newly_created_artifact ?= { save_scope_as = new_curio }
					}
					republic_aggrandizement = {
						scope:benefactor_01 = {
							random_gift_artifact_aggrandizement_effect = {
								OWNER = scope:benefactor_01
								CREATOR = scope:dummy_gender
							}
						}
						scope:new_trinket ?= { save_scope_as = new_curio }
						scope:newly_created_artifact ?= { save_scope_as = new_curio }
					}
					republic_communal = {
						scope:benefactor_01 = {
							random_gift_artifact_communal_effect = {
								OWNER = scope:benefactor_01
								CREATOR = scope:dummy_gender
								SUBJECT = flag:stewardship
								TOPIC = flag:no
							}
						}
						scope:new_trinket ?= { save_scope_as = new_curio }
						scope:newly_created_artifact ?= { save_scope_as = new_curio }
					}
					republic_signorial = {
						scope:benefactor_01 = {
							random_gift_artifact_signorial_effect = {
								OWNER = scope:benefactor_01
								CREATOR = scope:dummy_gender
							}
						}
						scope:new_trinket ?= { save_scope_as = new_curio }
						scope:newly_created_artifact ?= { save_scope_as = new_curio }
					}
					republic_agitation = {
						scope:benefactor_01 = {
							random_gift_artifact_agitation_effect = {
								OWNER = scope:benefactor_01
								CREATOR = scope:dummy_gender
							}
						}
						scope:new_trinket ?= { save_scope_as = new_curio }
						scope:newly_created_artifact ?= { save_scope_as = new_curio }
					}
					fallback = {
						scope:benefactor_01 = {
							create_curio_artifact_effect = {
								OWNER = scope:benefactor_01
								CREATOR = scope:dummy_gender
							}
						}
						scope:new_trinket ?= { save_scope_as = new_curio }
						scope:newly_created_artifact ?= { save_scope_as = new_curio }
						scope:new_curio ?= {
							add_artifact_modifier = artifact_diplomacy_1_modifier
						}
					}
				}
			}
		}
	}

	#	""Thank you, my friend!""
	option = {
		name = yearly_republic.1018.a

		scope:new_curio = {
			set_owner = {
				target = root
				history = {
					type = given
					actor = scope:benefactor_01
					recipient = root
					location = root.location     # optional
				}
			}
		}

		stress_and_fulfillment_impact = {
			# Loss
			base = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				add = 50
				OR = {
					has_trait = gregarious
					has_trait = humble
				}
			}
		}
	}
	#	"Perhaps this could fetch a good price?"
	option = {
		name = yearly_republic.1018.b
		# Sale price scales with the curio's quality (falling back to wealth, then rarity)
		add_gold = {
			value = 0
			if = {
				limit = { exists = scope:new_curio.var:quality }
				add = scope:new_curio.var:quality
			}
			else_if = {
				limit = { exists = scope:new_curio.var:wealth }
				add = scope:new_curio.var:wealth
			}
			else_if = {
				limit = { scope:new_curio = { rarity = illustrious } }
				add = 80
			}
			else_if = {
				limit = { scope:new_curio = { rarity = famed } }
				add = 50
			}
			else_if = {
				limit = { scope:new_curio = { rarity = masterwork } }
				add = 30
			}
			else = {
				add = 15
			}
			multiply = 2
			min = 20
			max = 150
			# Round to the nearest 5 to match gold formatting conventions
			divide = 5
			ceiling = yes
			multiply = 5
		}
		custom_tooltip = yearly_republic.1018_domicile_curio_sold_tt
		hidden_effect = {
			scope:new_curio = {
				set_owner = {
					target = root
					history = {
						type = given
						actor = scope:benefactor_01
						recipient = root
						location = root.location     # optional
					}
				}
			}
		}
		
		add_character_flag = yearly_republic_1018_selling_artifact
		
		stress_and_fulfillment_impact = {
			# Loss
			greedy = medium_stress_impact_loss
			paranoid = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				add = 50
				OR = {
					has_trait = greedy
					has_trait = paranoid
				}
			}
		}
	}
	after = {
		if = {
			limit = {
				has_character_flag = yearly_republic_1018_selling_artifact
			}
			destroy_owned_artifact = scope:new_curio
			remove_character_flag = yearly_republic_1018_selling_artifact
		}
	}
}

######################
# An Eye for Details #
######################
## Player get some trade expertise by discussions with a friend - more if the friend is a merchant.

scripted_effect set_trade_category_for_experience_effect_01 = {
	random_trade_good_category = {
		limit = { 
			has_trade_good_category_xp_track = yes
		}
		save_scope_as = $CATEGORY_SCOPE$
	}
}

scripted_effect set_trade_category_for_experience_effect_02 = {
	random_trade_good_category = {
		limit = { 
			has_trade_good_category_xp_track = yes
			this != scope:experience_trade_category_01
		}
		save_scope_as = $CATEGORY_SCOPE$
	}
}

scripted_effect give_trade_category_experience_effect = {
	add_trade_good_category_xp = {
		target = $CATEGORY$
		value = $VALUE$
	}
}

yearly_republic.1019 = {
	type = character_event
	title = yearly_republic.1019.t
	desc = yearly_republic.1019.desc
	override_background = gdp_artisan_street

	theme = republic

	left_portrait = {
		character = root
		animation = thinking
		camera = camera_body
	}
	right_portrait = {
		character = scope:benefactor_01
		animation = debating
		camera = camera_body
	}
	cooldown = { years = 10 }


	trigger = {
		government_has_flag = government_is_republic
		is_travelling = no
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
		}
		any_relation = {
			type = friend
			type = soulmate
			type = lover
			NOR = {
				is_spouse_of = root
				is_close_family_of = root
			}
			is_travelling = no
			is_available_quick = {
				adult = yes
				travel = no
				imprisoned = no
				incapable = no
				in_army = no
			}
		}
	}

	immediate = {
		location = { save_scope_as = event_location_01 }
		random_barony = {
			limit = {
				exists = holder
				holder = { in_diplomatic_range = root }
			}
			save_scope_as = target_city
		}
		every_relation = {
			type = friend
			type = soulmate
			type = lover
			limit = {
				NOR = {
					is_spouse_of = root
					is_close_family_of = root
				}
				is_available_quick = {
					travel = no
					adult = yes
					imprisoned = no
					incapable = no
					in_army = no
				}
			}
			add_to_list = potential_benefactor_list
		}
		random_in_list = {
			list = potential_benefactor_list
			weight = {
				base = 1
				modifier = {
					factor = 50
					OR = {
						government_has_flag = government_is_merchant
					}
				}
				modifier = {
					factor = 25
					OR = {
						is_landless_adventurer = yes
					}
				}
				# Prefer best friends next
				modifier = {
					factor = 10
					has_relation_best_friend = root
				}
			}
			save_scope_as = benefactor_01
		}
		set_trade_category_for_experience_effect_01 = {
			CATEGORY_SCOPE = experience_trade_category_01
		}
		set_trade_category_for_experience_effect_02 = {
			CATEGORY_SCOPE = experience_trade_category_02
		}
	}

	#	 ""Did you learn about [experience_trade_category_01.GetNameNoTooltip] during your travels?""
	option = {
		name = yearly_republic.1019.a
		
		every_held_title = {
			limit = {
				is_noble_family_title = yes
			}
			if = {
				limit = {
					scope:benefactor_01 = {
						government_has_flag = government_is_merchant
					}
				}
				give_trade_category_experience_effect = {
					CATEGORY = scope:experience_trade_category_01
					VALUE = trade_expertise_xp_major_value
				}
			}
			else = {
				give_trade_category_experience_effect = {
					CATEGORY = scope:experience_trade_category_01
					VALUE = trade_expertise_xp_medium_value
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 100
				any_held_title = {
					is_noble_family_title = yes
					save_temporary_scope_as = held_title_01
					trade_good_category_level = {
						target = scope:experience_trade_category_01
						value >= 5
					}
					NOT = {
						any_trade_good_category = {
							this != scope:experience_trade_category_01
							save_temporary_scope_as = rival_category
							"scope:held_title_01.trade_good_category_level(scope:rival_category)" > "scope:held_title_01.trade_good_category_level(scope:experience_trade_category_01)"
						}
					}
				}
			}
		}
	}

	#	""Let's discuss the [experience_trade_category_02.GetNameNoTooltip] business at the market.""
	option = {
		name = yearly_republic.1019.b
		every_held_title = {
			limit = {
				is_noble_family_title = yes
			}
			if = {
				limit = {
					scope:benefactor_01 = {
						government_has_flag = government_is_merchant
					}
				}
				give_trade_category_experience_effect = {
					CATEGORY = scope:experience_trade_category_02
					VALUE = trade_expertise_xp_major_value
				}
			}
			else = {
				give_trade_category_experience_effect = {
					CATEGORY = scope:experience_trade_category_02
					VALUE = trade_expertise_xp_medium_value
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 100
				any_held_title = {
					is_noble_family_title = yes
					save_temporary_scope_as = held_title_01
					trade_good_category_level = {
						target = scope:experience_trade_category_02
						value >= 5
					}
					NOT = {
						any_trade_good_category = {
							this != scope:experience_trade_category_02
							save_temporary_scope_as = rival_category
							"scope:held_title_01.trade_good_category_level(scope:rival_category)" > "scope:held_title_01.trade_good_category_level(scope:experience_trade_category_02)"
						}
					}
				}
			}
		}
	}

	#	"I should make observation a daily habit."
	option = {
		name = yearly_republic.1019.c
		add_character_modifier = {
			modifier = gdp_learning_from_the_masses
			years = 10
		}

		ai_chance = {
			base = 100
		}
	}
}

######################
# The Bathhouse Deal #
######################
## Player get to choose between getting some competitive benefit or higher trade range modifier by cooperating with a friendly house.

yearly_republic.1020 = {
	
	type = character_event
	title = yearly_republic.1020.t
	desc = yearly_republic.1020.desc
	override_background = bath_house
	widget = { gui = event_window_widget_vfx_fog container = foreground_shader_vfx_container }

	theme = republic

	left_portrait = {
		character = root
		animation = drink_goblet
	}
	right_portrait = {
		character = scope:house_benefactor_01
		animation = chaplain
	}
	cooldown = { years = 10 }

	trigger = {
		government_has_flag = government_is_republic
		is_travelling = no
		is_available_quick = {
			adult = yes
			imprisoned = no
			incapable = no
			in_army = no
		}
		house = {
			any_house_relation = {
				OR = {
					has_house_relation_level = cordial
					has_house_relation_level = friendly
					has_house_relation_level = amity
				}
				any_relation_house = {
					NOT = { this = root.house }				
				}
			}
		}
	}

	immediate = {
		house = {
			random_house_relation = {
				limit = {
					OR = {
						has_house_relation_level = cordial
						has_house_relation_level = friendly
						has_house_relation_level = amity
					}
					any_relation_house = {
						NOT = { this = root.house }
						house_head = {
							is_available_quick = {
								adult = yes
								imprisoned = no
								incapable = no
								in_army = no
							}
						}
					}
				}
				random_relation_house = {
						limit = {
						NOT = { this = root.house }
						house_head = {
							is_travelling = no
							is_available_quick = {
								adult = yes
								imprisoned = no
								incapable = no
								in_army = no
							}
						}
					}
					house_head = { save_scope_as = house_benefactor_01 }
				}
			}
		}
		add_character_flag = is_naked
		scope:house_benefactor_01 = { add_character_flag = is_naked }
	}

	#	""We should share agents and contacts abroad, widening our reach.""
	option = {
		name = yearly_republic.1020.a

		house ?= {
			add_house_modifier = {
				modifier = gdp_cooperation_correspondenti_house_modifier
				years = 20 
			}
			change_house_relation_effect = {
				HOUSE = scope:house_benefactor_01.house
				VALUE = house_relation_improve_medium_value
				REASON = cooperation
				CHAR = root
				TARGET_CHAR = scope:house_benefactor_01
				TITLE = scope:dummy_gender
			}
		}
		hidden_effect = {
			scope:house_benefactor_01 = {
				house ?= {
					add_house_modifier = {
						modifier = gdp_cooperation_correspondenti_house_modifier
						years = 20 
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}

	#	""Let's share our expertise and grow stronger together.""
	option = {
		name = yearly_republic.1020.b

		house ?= {
			add_house_modifier = {
				modifier = gdp_cooperation_compagnia_house_modifier
				years = 20 
			}
			change_house_relation_effect = {
				HOUSE = scope:house_benefactor_01.house
				VALUE = house_relation_improve_medium_value
				REASON = cooperation
				CHAR = root
				TARGET_CHAR = scope:house_benefactor_01
				TITLE = scope:dummy_gender
			}
		}
		hidden_effect = {
			scope:house_benefactor_01 = {
				house ?= {
					add_house_modifier = {
						modifier = gdp_cooperation_compagnia_house_modifier
						years = 20 
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	after = {
		remove_character_flag = is_naked
		scope:house_benefactor_01 = { remove_character_flag = is_naked }
	}
}
