###########################################
#                                         #
# Conclave Favor and Mercenary Events	  #
# Written by Emil Tisander				  #
#										  #
# ID ZE.23000-ZE.25999     	              #
#                                         #
###########################################

###########################################
#                                         #
# Favor Events							  #
# by Alexander Oltner                     #
# ID ZE.22300-ZE.22800              	  #
#                                         #
###########################################

namespace = ZE

# Councillor is Overburdened with Work
character_event = {
	id = ZE.23000
	picture = GFX_evt_noble_in_castle
	desc = EVTDESC_ZE_23000

	min_age = 16
	capable_only = yes
	prisoner = no
	
	is_triggered_only = yes
	
	trigger = {
		has_dlc = "Zeus"
		is_voter = yes
		NOT = { is_inaccessible_trigger = yes }
		liege = {
			any_vassal = {
				NOR = {
					character = ROOT
					holds_favor_on = ROOT
					trait = incapable
					is_inaccessible_trigger = yes
					is_rival = ROOT
				}
				is_voter = yes
				prisoner = no
			}
		}
	}

	immediate = {
		liege = {
			random_vassal = {
				limit = {
					NOR = {
						character = ROOT
						holds_favor_on = ROOT
						trait = incapable
						is_inaccessible_trigger = yes
						is_rival = ROOT
					}
					is_voter = yes
					prisoner = no
				}
				save_event_target_as = target_help_councillor
			}
		}
	}

	option = { # Accept Help
		name = EVTOPTA_ZE_23000
		ai_chance = {
			factor = 50
			
			modifier = {
				factor = 1.5
				trait = humble
			}
		}
		reverse_add_favor = event_target:target_help_councillor
		opinion = {
			who = event_target:target_help_councillor
			modifier = opinion_very_grateful
			years = 3
		}
		event_target:target_help_councillor = {
			hidden_tooltip = {
				character_event = { id = ZE.23001 days = 5 }
			}
		}
	}

	option = { # Refuse Help
		name = EVTOPTB_ZE_23000
		ai_chance = {
			factor = 50
			
			modifier = {
				factor = 1.5
				trait = proud
			}
		}
		if = {
			limit = {
				trait = stressed
				trait = depressed
			}
			prestige = -100
		}
		if = {
			limit = {
				trait = stressed
				NOT = { trait = depressed }
			}
			random = {
				chance = 50
				add_trait = depressed
				hidden_tooltip = {
					character_event = { id = 38288 } # Notify Depressed
				}
			}
			prestige = -20
		}
		if = {
			limit = {
				NOT = { trait = stressed }
			}
			if = {
				limit = {
					NOR = {
						trait = stressed
						trait = depressed
					}
				}
				random = {
					chance = 75
					add_trait = stressed
					hidden_tooltip = {
						character_event = {
							id = 38282 #Notify Stressed
						}
					}
				}
			}
			prestige = -20
		}
		reverse_opinion = {
			who = event_target:target_help_councillor
			modifier = insulted
			years = 3
		}
		event_target:target_help_councillor = {
			hidden_tooltip = {
				character_event = { id = ZE.23002 days = 5 }
			}
		}
	}
}

# Help Accepted
character_event = {
	id = ZE.23001
	picture = GFX_evt_noble_in_castle
	desc = EVTDESC_ZE_23001

	is_triggered_only = yes

	option = {
		name = EVTOPTA_ZE_23001
		tooltip = {
			add_favor = FROM
			reverse_opinion = {
				who = FROM
				modifier = opinion_very_grateful
				years = 3
			}
		}
		prestige = 20
	}
}

# Help Refused
character_event = {
	id = ZE.23002
	picture = GFX_evt_noble_in_castle
	desc = EVTDESC_ZE_23002

	is_triggered_only = yes

	option = {
		name = EVTOPTA_ZE_23002
		tooltip = {
			opinion = {
				who = FROM
				modifier = insulted
				years = 3
			}
		}
	}
}

# Troublesome Peasants
long_character_event = {
	id = ZE.23005
	picture = GFX_evt_noble_haughty_talking_to_peasants
	desc = EVTDESC_ZE_23005

	min_age = 16
	capable_only = yes
	prisoner = no
	has_dlc = "Zeus"
	war = no
	
	is_triggered_only = yes
	
	trigger = {
		NOR = {
			trait = grey_eminence
			trait = gregarious
			trait = wounded
			can_be_maimed_trigger = yes
			government = nomadic_government
		}
		any_vassal = {
			NOR = {
				character = ROOT
				holds_favor_on = ROOT
				trait = incapable
				is_inaccessible_trigger = yes
				is_rival = ROOT
			}
			is_adult = yes
			is_voter = no
			prisoner = no
		}
	}

	immediate = {
		random_vassal = {
			limit = {
				NOR = {
					character = ROOT
					holds_favor_on = ROOT
					trait = incapable
					is_inaccessible_trigger = yes
					is_rival = ROOT
				}
				is_adult = yes
				is_voter = no
				prisoner = no
			}
			save_event_target_as = helping_vassal
		}
	}

	option = { # Run for Nearby Vassal
		name = EVTOPTA_ZE_23005
		custom_tooltip = { text = EVTOPTA_ZE_23005_custom_tooltip_a }
		hidden_tooltip = {
			event_target:helping_vassal = {
				character_event = { id = ZE.23006 days = 5 }
			}
		}
	}

	option = { # Make a run for it
		name = EVTOPTB_ZE_23005
		random_list = {
			50 = {
				add_trait = wounded
				hidden_tooltip = {
					character_event = { id = 38280 } # Notify Wounded
				}
			}
			10 = {
				add_maimed_trait_effect = yes
			}
			40 = {
				custom_tooltip = { text = EVTOPTA_ZE_23005_custom_tooltip_b }
			}
		}
	}
}

# Troublesome Peasants - Vassal sees Liege in Trouble
character_event = {
	id = ZE.23006
	picture = GFX_evt_hiding_from_pursuers
	desc = EVTDESC_ZE_23006

	is_triggered_only = yes

	option = { # Aid Liege
		name = EVTOPTA_ZE_23006
		ai_chance = {
			factor = 60
			
			modifier = {
				factor = 1.5
				trait = kind
			}
			modifier = {
				factor = 1.5
				trait = content
			}
			modifier = {
				factor = 1.5
				trait = just
			}
		}
		tooltip = {
			add_favor = FROM
			reverse_opinion = {
				who = FROM
				modifier = opinion_very_grateful
				years = 3
			}
		}
		FROM = { hidden_tooltip = { character_event = { id = ZE.23007 days = 5 } } }
	}

	option = { # Ignore Liege
		name = EVTOPTB_ZE_23006
		ai_chance = {
			factor = 40
			
			modifier = {
				factor = 1.2
				trait = cruel
			}
		}
		tooltip = {
			FROM = {
				opinion = {
					who = ROOT
					modifier = opinion_hate
					years = 3
				}
			}
			add_rival = FROM
		}
		FROM = { hidden_tooltip = { character_event = { id = ZE.23008 days = 5 } } }
	}
}

# Troublesome Peasants - Vassal helps Liege
character_event = {
	id = ZE.23007
	picture = GFX_evt_hiding_from_pursuers
	desc = EVTDESC_ZE_23007

	is_triggered_only = yes

	option = {
		name = EVTOPTA_ZE_23007
		reverse_add_favor = FROM
		opinion = {
			who = FROM
			modifier = opinion_very_grateful
			years = 3
		}
	}
}

# Troublesome Peasants - Vassal ignores Liege
character_event = {
	id = ZE.23008
	picture = GFX_evt_hiding_from_pursuers
	desc = EVTDESC_ZE_23008

	is_triggered_only = yes

	option = {
		name = EVTOPTA_ZE_23008
		opinion = {
			who = FROM
			modifier = opinion_hate
			years = 3
		}
		add_rival = FROM
		random_list = {
			70 = {
				custom_tooltip = { text = EVTOPTA_ZE_23005_custom_tooltip_b }
			}
			30 = {
				add_trait = wounded
				hidden_tooltip = {
					character_event = { id = 38280 } # Notify Wounded
				}	
			}
		}
	}
}

## Dynamic Mercenaries Events
# Troop Composition
character_event = {
	id = ZE.23100
	
	hide_window = yes

	is_triggered_only = yes
	
	immediate = {
		primary_title = {
			band_creator = {
				character_event = { id = ZE.23101 }
			}
		}
	}
}

character_event = {
	id = ZE.23101
	picture = GFX_evt_large_army
	desc = EVTDESC_ZE_23101

	is_triggered_only = yes

	option = {
		name = EVTOPTA_ZE_23101
		FROM = {
			primary_title = {
				change_mercenary_composition = {
					from = light_infantry
					change = 50
					type = heavy_infantry
				}
			}
		}
		wealth = -50
	}
	option = {
		name = EVTOPTB_ZE_23101
		FROM = {
			primary_title = {
				change_mercenary_composition = {
					from = light_infantry
					type = pikemen
					change = 50
				}
			}
		}
		wealth = -50
	}
	option = {
		name = EVTOPTC_ZE_23101
		FROM = {
			primary_title = {
				change_mercenary_composition = {
					from = light_cavalry
					type = knights
					change = 50
				}
			}
		}
		wealth = -50
	}
	option = {
		name = EVTOPTD_ZE_23101
	}
}

# Send Troops
character_event = {
	id = ZE.23105
	
	hide_window = yes

	is_triggered_only = yes
	
	immediate = {
		primary_title = {
			band_creator = {
				character_event = { id = ZE.23106 }
			}
		}
	}
}

character_event = {
	id = ZE.23106
	picture = GFX_evt_large_army
	desc = EVTDESC_ZE_23106

	is_triggered_only = yes

	option = {
		name = EVTOPTA_ZE_23106
		FROM = {
			primary_title = {
				change_mercenary_composition = {
					type = light_infantry
					change = 100
				}
			}
		}
		wealth = -50
	}
	option = {
		name = EVTOPTB_ZE_23106
		FROM = {
			primary_title = {
				change_mercenary_composition = {
					type = light_cavalry
					change = 100
				}
			}
		}
		wealth = -50
	}
	option = {
		name = EVTOPTD_ZE_23101
	}
}

# Band Leader Speaks Highly of Employer
character_event = {
	id = ZE.23150
	
	hide_window = yes

	is_triggered_only = yes
	
	trigger = {
		has_dlc = "Zeus"
		mercenary = yes
		primary_title = {
			has_title_flag = ze_dyn_merc
			NOR = {
				has_title_flag = not_hired
				has_title_flag = mercenary_unemployment
			}
			band_creator = {
				OR = {
					is_feudal = yes
					is_republic = yes
				}
				NOT = { is_rival = ROOT }
				is_adult = yes
				reverse_opinion = {
					who = ROOT
					value = 10
				}
			}
			capital_scope = {
				owner = {
					is_adult = yes
					ROOT = {
						primary_title = {
							band_creator = {
								NOR = { 
									character = PREVPREVPREV
									war_with = PREVPREVPREV
								}
							}
						}
					}
				}
			}
		}
	}
	
	immediate = {
		primary_title = {
			band_creator = {
				save_event_target_as = merc_band_employer
			}
			capital_scope = {
				owner = {
					character_event = { id = ZE.23152 }
				}
			}
		}
	}
}

# Host speak to Band Leader
character_event = {
	id = ZE.23152
	picture = GFX_evt_large_army
	desc = EVTDESC_ZE_23152

	is_triggered_only = yes
	
	trigger = {
		NOT = { is_rival = event_target:merc_band_employer }
	}
	
	option = { # Write to Employer
		name = EVTOPTA_ZE_23152
		FROM = {
			primary_title = {
				band_creator = {
					letter_event = { id = ZE.23154 days = 5 }
				}
			}
		}
	}
	option = { # Do nothing
		name = EVTOPTB_ZE_23152
	}
}

# Employer receives letter
letter_event = {
	id = ZE.23154
	desc = EVTDESC_ZE_23154

	is_triggered_only = yes
	
	option = { # Accept the invitation
		name = EVTOPTA_ZE_23154
		FROM = {
			letter_event = { id = ZE.23155 days = 5 }
		}
	}
	option = { # Decline the invitation
		name = EVTOPTB_ZE_23154
		FROM = {
			letter_event = { id = ZE.23156 days = 5 }
		}
	}
}

# Host receives positive response
letter_event = {
	id = ZE.23155
	desc = EVTDESC_ZE_23155

	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_ZE_23155
		character_event = { id = ZE.23157 days = 5 }
	}
}

# Host receives	negative response
letter_event = {
	id = ZE.23156
	desc = EVTDESC_ZE_23156

	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_ZE_23156
	}
}

# Employer and Host attends feast
character_event = {
	id = ZE.23157
	picture = GFX_evt_feast
	desc = EVTDESC_ZE_23157

	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_ZE_23157
		add_friend = FROMFROM
		opinion = {
			modifier = in_non_aggression_pact
			years = 3
			who = FROMFROM
			origin_description = EVTTITLE_ZE_23157
		}
		FROMFROM = {
			opinion = {
				modifier = in_non_aggression_pact
				years = 3
				who = ROOT
				origin_description = EVTTITLE_ZE_23157
			}
		}
		hidden_tooltip = {
			FROMFROM = {
				character_event = { id = ZE.23158 days = 1 }
			}
		}
	}
}

# Employer returns home
character_event = {
	id = ZE.23158
	picture = GFX_evt_feast
	desc = EVTDESC_ZE_23158

	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_ZE_23158
		tooltip = {
			add_friend = FROM
			opinion = {
				modifier = in_non_aggression_pact
				years = 3
				who = FROM
				origin_description = EVTTITLE_ZE_23157
			}
			FROM = {
				opinion = {
					modifier = in_non_aggression_pact
					years = 3
					who = ROOT
					origin_description = EVTTITLE_ZE_23157
				}
			}
		}
	}
}

# Pardon a young noble to use as a future 'Yes Man'.
character_event = {
	id = ZE.22300
	desc = EVTDESC_ZE_22300
	picture = GFX_evt_judged_by_ruler
	
	min_age = 16
	capable_only = yes
	prisoner = no	
	war = no
	has_dlc = "Zeus"
	
	only_playable = yes

	is_triggered_only = yes
	
	trigger = {
		is_nomadic = no
		NOT = { is_inaccessible_trigger = yes }
	}
	
	# Pardon
	option = {
		name = EVTOPTA_ZE_22300
		
		ai_chance = {
			factor = 70
		}
		
		prestige = -50
		create_character = {
			random_traits = yes
			dynasty = RANDOM
			female = no
			age = 20
			religion = ROOT
			culture = ROOT
		}
		new_character = {
			reverse_add_favor = ROOT
		}
		custom_tooltip = { text = character_owe_favor }
	}
	
	# Condemn
	option = {
		name = EVTOPTB_ZE_22300
		
		ai_chance = {
			factor = 30
		}
		
		prestige = 50
		
	}
}

# Voter saves another voters face at a Council Meeting.
character_event = {
	id = ZE.22400
	desc = EVTDESC_ZE_22400
	picture = GFX_evt_council_quarrelling
	
	min_age = 16
	capable_only = yes
	prisoner = no
	
	only_playable = yes

	is_triggered_only = yes
	
	trigger = {
		has_dlc = "Zeus"
		
		is_voter = yes
		NOR = { 
			diplomacy = 10
			is_inaccessible_trigger = yes
		}
		
		liege = {
			any_realm_character = {
				same_liege = ROOT
				diplomacy = 10
				NOR = {
					character = ROOT
					owes_favor_to = ROOT
					trait = incapable
					is_inaccessible_trigger = yes
					is_rival = ROOT
				}
				is_voter = yes
				prisoner = no
			}
		}
	}
	
	immediate = {
		liege = {
			any_realm_character = {
				limit = {
					same_liege = ROOT
					diplomacy = 10
					NOR = {
						character = ROOT
						owes_favor_to = ROOT
						trait = incapable
						is_inaccessible_trigger = yes
						is_rival = ROOT
					}
					is_voter = yes
					prisoner = no
				}
				save_event_target_as = target_saved_voter
			}
		}
	}
	
	# Accept save of face
	option = {
		name = EVTOPTA_ZE_22400
		
		ai_chance = {
			factor = 70
			
			modifier = {
				factor = 0.5
				trait = proud
			}
		}
		
		prestige = 150
		event_target:target_saved_voter = {
			add_favor = ROOT
			character_event = {	id = ZE.22410 days = 1 }
		}
	}
	
	# Deny
	option = {
		name = EVTOPTB_ZE_22400
		
		ai_chance = {
			factor = 30
		}
		
		prestige = -150
		add_character_modifier = {
			modifier = publicly_humiliated
			months = 36
		}
		
		event_target:target_saved_voter = {
			opinion = {
				modifier = opinion_dislike
				who = ROOT
				years = 15
			}
			character_event = {	id = ZE.22420 days = 1 }
		}
		
	}
}

# Another voter was saved by you!
character_event = {
	id = ZE.22410
	desc = EVTDESC_ZE_22410
	picture = GFX_evt_council_agreement

	is_triggered_only = yes
	
	# Accept save of face
	option = {
		name = EVTOPTA_ZE_22410
		
		tooltip = {
			FROM = {
				prestige = 150
				add_favor = ROOT 
			}
		}	
	}
}

# You saved the face of another voter but they weren't grateful.
character_event = {
	id = ZE.22420
	desc = EVTDESC_ZE_22420
	picture = GFX_evt_leaving_table_angrily

	is_triggered_only = yes
	
	# Decline save of face
	option = {
		name = EVTOPTA_ZE_22420
		
		prestige = 50
		
		tooltip = {
			FROM = {
				prestige = -150
			}
		}		
	}
}

# Godly voter shows you how to be more pious.
character_event = {
	id = ZE.22500
	desc = EVTDESC_ZE_22500
	picture = GFX_evt_council_agreement
	
	min_age = 16
	capable_only = yes
	prisoner = no
	
	only_playable = yes

	is_triggered_only = yes
	
	trigger = {
		has_dlc = "Zeus"
		is_voter = yes
		NOR = { 
			piety = 200
			trait = zealous
			trait = humble
			trait = erudite
			trait = theologian
			trait = faqih
			trait = hafiz
			is_inaccessible_trigger = yes
		}
		
		liege = {
			any_realm_character = {
				same_liege = ROOT
				religion = ROOT
				OR = {
					AND = {
						is_theocracy = yes
						piety = 0
						NOR = {
							trait = bad_priest_muslim
							trait = bad_priest_christian
							trait = bad_priest_norse
							trait = bad_priest_tengri
							trait = bad_priest_zoroastrian
							trait = bad_priest_aztec
							trait = cynical
						}
					}
					AND = {
						piety = 200
						NOT = { trait = cynical }
						OR = {
							trait = zealous
							trait = humble
							trait = erudite
							trait = theologian
							trait = faqih
							trait = hafiz
						}
					}
				}
				NOR = {
					character = ROOT
					owes_favor_to = ROOT
					trait = incapable
					is_inaccessible_trigger = yes
					is_rival = ROOT
				}
				is_voter = yes
				prisoner = no
			}
		}
	}
	
	immediate = {
		liege = {
			any_realm_character = {
				limit = {
					same_liege = ROOT
					religion = ROOT
					OR = {
						AND = {
							is_theocracy = yes
							piety = 0
							NOR = {
								trait = bad_priest_muslim
								trait = bad_priest_christian
								trait = bad_priest_norse
								trait = bad_priest_tengri
								trait = bad_priest_zoroastrian
								trait = bad_priest_aztec
								trait = cynical
							}
						}
						AND = {
							piety = 200
							NOT = { trait = cynical }
							OR = {
								trait = zealous
								trait = humble
								trait = erudite
								trait = theologian
								trait = faqih
								trait = hafiz
							}
						}
					}
					NOR = {
						character = ROOT
						owes_favor_to = ROOT
						trait = incapable
						is_inaccessible_trigger = yes
						is_rival = ROOT
					}
					is_voter = yes
					prisoner = no
				}
				save_event_target_as = target_pious_voter
			}
		}
	}
	
	# Accept
	option = {
		name = EVTOPTA_ZE_22500
		
		ai_chance = {
			factor = 70
			
			modifier = {
				factor = 0.5
				trait = proud
			}
		}
		
		piety = 100
		add_character_modifier = {
			name = the_pious
			years = 3
		}
		event_target:target_pious_voter = {
			add_favor = ROOT
			character_event = {	id = ZE.22510 days = 1 }
		}
	}
	
	# Deny
	option = {
		name = EVTOPTB_ZE_22500
		
		ai_chance = {
			factor = 30
		}
		
		piety = -50
		
		event_target:target_pious_voter = {
			opinion = {
				modifier = opinion_dislike
				who = ROOT
				years = 15
			}
			character_event = {	id = ZE.22520 days = 1 }
		}
		
	}
}

# The voter accepts your help!
character_event = {
	id = ZE.22510
	desc = EVTDESC_ZE_22510
	picture = GFX_evt_council_agreement

	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_ZE_22510
		
		tooltip = {
			FROM = {
				piety = 100
				add_favor = ROOT 
			}
		}	
	}
}

# The voter denies your help.
character_event = {
	id = ZE.22520
	desc = EVTDESC_ZE_22520
	picture = GFX_evt_leaving_table_angrily

	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_ZE_22520
		
		piety = 50
		
		tooltip = {
			FROM = {
				piety = -50
			}
		}		
	}
}

# Ask foreign voter with the same job as you to help you get better at your job
# on_yearly_pulse
character_event = {
	id = ZE.22600
	desc = EVTDESC_ZE_22600
	picture = GFX_evt_council_quarrelling
	
	min_age = 16
	capable_only = yes
	prisoner = no
	war = no
	has_dlc = "Zeus"
	
	only_playable = yes

	is_triggered_only = yes
	
	trigger = {
		is_voter = yes
		liege = { war = no }
		NOR = { 
			is_inaccessible_trigger = yes
			trait = slothful
			has_character_flag = asked_for_job_advice
		}
		OR = {
			AND = {
				NOT = { diplomacy = 10 }
				has_job_title = job_chancellor
			}
			AND = {
				NOT = { stewardship = 10 }
				has_job_title = job_treasurer
			}
			AND = {
				NOT = { intrigue = 10 }
				has_job_title = job_spymaster
			}
			AND = {
				NOT = { learning = 10 }
				has_job_title = job_spiritual
			}
			AND = {
				NOT = { martial = 10 }
				has_job_title = job_marshal
			}
		}
		
		top_liege = {
			any_realm_province = {
				any_neighbor_province = {
					holder_scope = {
						top_liege = {
							any_courtier = {
								NOR = {
									holds_favor_on = ROOT
									trait = incapable
									is_inaccessible_trigger = yes
									is_rival = ROOT
									same_realm = ROOT
								}
								OR = {
									AND = {
										diplomacy = 10
										has_job_title = job_chancellor
										ROOT = { has_job_title = job_chancellor }
									}
									AND = {
										stewardship = 10
										has_job_title = job_treasurer
										ROOT = { has_job_title = job_treasurer }
									}
									AND = {
										intrigue = 10
										has_job_title = job_spymaster
										ROOT = { has_job_title = job_spymaster }
									}
									AND = {
										learning = 10
										has_job_title = job_spiritual
										ROOT = { has_job_title = job_spiritual }
									}
									AND = {
										martial = 10
										has_job_title = job_marshal
										ROOT = { has_job_title = job_marshal }
									}
								}
							}
						}
					}
				}
			}
		}
	}
	
	immediate = {
		top_liege = {
			any_realm_province = {
				any_neighbor_province = {
					holder_scope = {
						top_liege = {
							any_courtier = {
								limit = {
									NOR = {
										holds_favor_on = ROOT
										trait = incapable
										is_inaccessible_trigger = yes
										is_rival = ROOT
										same_realm = ROOT
									}
									OR = {
										AND = {
											diplomacy = 10
											has_job_title = job_chancellor
											ROOT = { has_job_title = job_chancellor }
										}
										AND = {
											stewardship = 10
											has_job_title = job_treasurer
											ROOT = { has_job_title = job_treasurer }
										}
										AND = {
											intrigue = 10
											has_job_title = job_spymaster
											ROOT = { has_job_title = job_spymaster }
										}
										AND = {
											learning = 10
											has_job_title = job_spiritual
											ROOT = { has_job_title = job_spiritual }
										}
										AND = {
											martial = 10
											has_job_title = job_marshal
											ROOT = { has_job_title = job_marshal }
										}
									}
								}
								save_event_target_as = target_foreign_voter
							}
						}
					}
				}
			}
		}
	}
	
	# I should approach the voter
	option = {
		name = EVTOPTA_ZE_22600
		
		ai_chance = {
			factor = 90
			
			modifier = {
				factor = 0.5
				trait = proud
			}
		}
		
		event_target:target_foreign_voter = {
			letter_event = { id = ZE.22610 }
		}
	}
	
	# Lets not
	option = {
		name = EVTOPTB_ZE_22600
		
		ai_chance = {
			factor = 10
		}
		
		prestige = -10
		
	}
}

# A voter from another realm asks you for help
letter_event = {
	id = ZE.22610
	desc = EVTDESC_ZE_22610

	is_triggered_only = yes
	
	# Agree
	option = {
		name = EVTOPTA_ZE_22610
		
		ai_chance = {
			factor = 50
			
			modifier = {
				factor = 2
				trait = charitable
			}
			
			modifier = {
				factor = 2
				trait = kind
			}
			
			modifier = {
				factor = 2
				opinion = { who = FROM value = 25 }
			}
		}
		
		FROM = {
			letter_event = { id = ZE.22620 days = 5 }
		}
	}
	
	# Deny
	option = {
		name = EVTOPTB_ZE_22610
		
		ai_chance = {
			factor = 50
			
			modifier = {
				factor = 3
				trait = paranoid
			}
			
			modifier = {
				factor = 0
				is_friend = FROM
			}
		}
		
		FROM = {
			letter_event = { id = ZE.22630 days = 5 }
		}
	}
}

# Help is accepted!
letter_event = {
	id = ZE.22620
	desc = EVTDESC_ZE_22620

	is_triggered_only = yes
	
	# Fantastic!
	option = {
		name = EVTOPTA_ZE_22620
		
		set_character_flag = asked_for_job_advice
		
		reverse_add_favor = FROM
		if = {
			limit = {
				NOT = { is_friend = FROM }
			}
			add_friend = FROM
		}
		
		if = {
			limit = {
				has_job_title = job_chancellor
			}
			change_diplomacy = 2
		}
		if = {
			limit = {
				has_job_title = job_treasurer
			}
			change_stewardship = 2
		}
		if = {
			limit = {
				has_job_title = job_spymaster
			}
			change_intrigue = 2
		}
		if = {
			limit = {
				has_job_title = job_spiritual
			}
			change_learning = 2
		}
		if = {
			limit = {
				has_job_title = job_marshal
			}
			change_martial = 2
		}
		
		FROM = {
			letter_event = { id = ZE.22640 }
		}
	}
}

# Help is denied!
letter_event = {
	id = ZE.22630
	desc = EVTDESC_ZE_22630

	is_triggered_only = yes
	
	# Disappointed!
	option = {
		name = EVTOPTA_ZE_22630
		
		ai_chance = {
			factor = 20
			
			modifier = {
				factor = 2
				trait = humble
			}
		}
		
		prestige = -50
		
		FROM = {
			letter_event = { id = ZE.22650 }
		}
	}
	
	# You dare to deny me help?
	option = {
		name = EVTOPTB_ZE_22630
		tooltip_info = wroth
		
		ai_chance = {
			factor = 60
		}
		
		trigger = {
			trait = wroth
		}
		
		prestige = -25
		add_rival = FROM
		
		FROM = {
			letter_event = { id = ZE.22660 }
		}
	}
	
	# Perhaps some money will help?
	option = {
		name = EVTOPTC_ZE_22630
		
		ai_chance = {
			factor = 20
			
			modifier = {
				factor = 2
				trait = ambitious
			}
			
			modifier = {
				factor = 2
				trait = stubborn
			}
		}
		
		trigger = {
			wealth = 100
		}
		
		wealth = -100
		
		FROM = {
			letter_event = { id = ZE.22670 days = 5 }
		}
	}
}

# Notified of gratitude & friendship
letter_event = {
	id = ZE.22640
	desc = EVTDESC_ZE_22640

	is_triggered_only = yes
	
	# Lovely!
	option = {
		name = EVTOPTA_ZE_22640
		
		tooltip = {
			add_favor = FROM
			add_friend = FROM
		}
		custom_tooltip = { text = stats_increased_tooltip }
	}
}

# Convey disappointment
letter_event = {
	id = ZE.22650
	desc = EVTDESC_ZE_22650

	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_ZE_22650
		
		tooltip = {
			FROM = { prestige = -25 }
		}
	}
}

# Convey rage!
letter_event = {
	id = ZE.22660
	desc = EVTDESC_ZE_22660

	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_ZE_22660
		
		tooltip = {
			FROM = { prestige = -25 }
			add_rival = FROM
		}
	}
}

# Bribery
letter_event = {
	id = ZE.22670
	desc = EVTDESC_ZE_22670

	is_triggered_only = yes
	
	# When you put it like that!
	option = {
		name = EVTOPTA_ZE_22670
		
		ai_chance = {
			factor = 70
			
			modifier = {
				factor = 5
				trait = greedy
			}
			
			modifier = {
				factor = 5
				NOT = { wealth = 100 }
			}
		}
		
		wealth = 100
		tooltip = { 
			FROM = { wealth = -100 }
			add_favor = FROM
		}
		custom_tooltip = { text = stats_increased_tooltip }
		
		FROM = {
			letter_event = { id = ZE.22680 }
		}
	}
	
	# Still no.
	option = {
		name = EVTOPTB_ZE_22670
		
		ai_chance = {
			factor = 30

			modifier = {
				factor = 2
				trait = stubborn
			}
		}
		
		FROM = {
			letter_event = { id = ZE.22690 }
		}
	}
}

# Bribery is accepted!
letter_event = {
	id = ZE.22680
	desc = EVTDESC_ZE_22680

	is_triggered_only = yes
	
	# Fantastic!
	option = {
		name = EVTOPTA_ZE_22680
		
		set_character_flag = asked_for_job_advice
		
		reverse_add_favor = FROM
		
		if = {
			limit = {
				has_job_title = job_chancellor
			}
			change_diplomacy = 2
		}
		if = {
			limit = {
				has_job_title = job_treasurer
			}
			change_stewardship = 2
		}
		if = {
			limit = {
				has_job_title = job_spymaster
			}
			change_intrigue = 2
		}
		if = {
			limit = {
				has_job_title = job_spiritual
			}
			change_learning = 2
		}
		if = {
			limit = {
				has_job_title = job_marshal
			}
			change_martial = 2
		}
	}
}

# Bribery is denied!
letter_event = {
	id = ZE.22690
	desc = EVTDESC_ZE_22690

	is_triggered_only = yes
	
	# Disappointed!
	option = {
		name = EVTOPTA_ZE_22690
		
		wealth = 100
		prestige = -50
	}
}

# Give land to an unlanded friend for a favor
character_event = {
	id = ZE.22700
	
	hide_window = yes
	
	min_age = 16
	capable_only = yes
	prisoner = no
	war = no
	has_dlc = "Zeus"
	
	only_playable = yes

	is_triggered_only = yes
	
	trigger = {
		is_nomadic = no
		NOT = { is_inaccessible_trigger = yes }
		higher_tier_than = COUNT
		
		any_demesne_title = {
			tier = COUNT 
			can_be_given_away = yes 
			is_feudal = yes
			NOT = {
				location = {
					is_capital = yes
				}						
			}
		}
		
		any_friend = {
			NOR = {
				owes_favor_to = ROOT
				can_inherit_trigger = yes
				is_inaccessible_trigger = yes
				trait = celibate
				is_ascetic_trigger = yes
				trait = incapable
				any_heir_title = {
					always = yes
				}
				liege = { character = ROOT }
				is_close_relative = ROOT
			}
			OR = {
				is_female = no
				ROOT = {
					OR = {
						is_feminist_trigger = yes
						primary_title = {
							OR = {
								has_law = true_cognatic_succession
								has_law = enatic_succession
								has_law = enatic_cognatic_succession
							}
						}
					}
				}
			}
			prisoner = no
			is_ruler = no
			is_adult = yes
		}
	}
	
	immediate = {
		any_friend = {
			limit = {
				NOR = {
					owes_favor_to = ROOT
					can_inherit_trigger = yes
					is_inaccessible_trigger = yes
					trait = celibate
					is_ascetic_trigger = yes
					trait = incapable
					any_heir_title = {
						always = yes
					}
					liege = { character = ROOT }
					is_close_relative = ROOT
				}
				OR = {
					is_female = no
					ROOT = {
						OR = {
							is_feminist_trigger = yes							
							has_game_rule = {
								name = gender
								value = all
							}
							has_game_rule = {
								name = gender
								value = plus
							}
							primary_title = {
								OR = {
									has_law = female_council_law_4
									has_law = true_cognatic_succession
									has_law = enatic_succession
									has_law = enatic_cognatic_succession
								}
							}
						}
					}
				}
				prisoner = no
				is_ruler = no
				is_adult = yes
			}
			save_event_target_as = target_unlanded_friend
		}
		random_demesne_title = {
			limit = {
				tier = COUNT 
				can_be_given_away = yes 
				is_feudal = yes
				NOT = {
					location = {
						is_capital = yes
					}						
				}
			}
			save_event_target_as = target_friend_land
		}
		event_target:target_unlanded_friend = { character_event = { id = ZE.22701 } }
	}
}

character_event = {
	id = ZE.22701
	
	hide_window = yes

	is_triggered_only = yes
	
	immediate = {
		FROM = { character_event = { id = ZE.22702 } }
	}
}

character_event = {
	id = ZE.22702
	desc = EVTDESC_ZE_22702
	picture = GFX_evt_council_agreement

	is_triggered_only = yes
	
	# Give friend land
	option = {
		name = EVTOPTA_ZE_22702
		
		ai_chance = {
			factor = 50
			
			modifier = {
				factor = 0.5
				trait = greedy
			}
			
			modifier = {
				factor = 0.5
				trait = paranoid
			}
			
			modifier = {
				factor = 2
				trait = charitable
			}
			
			modifier = {
				factor = 2
				trait = kind
			}
		}
		
		event_target:target_unlanded_friend = {
			opinion = {
				modifier = opinion_loyal_servant
				who = ROOT
				months = 1200
			}
			reverse_add_favor = ROOT
			hidden_tooltip = {
				if = {
					limit = {
						religion_group = muslim
					}
					set_government_type = muslim_government
				}
				else_if = {
					limit = {
						culture_group = tibetan_group
						OR = {
							religion = bon
							religion = buddhist
						}
					}
					set_government_type = theocratic_feudal_government
				}
				else = {
					set_government_type = feudal_government
				}
			}
			grant_title = event_target:target_friend_land
		}
		custom_tooltip = {
			text = indebted_to_family_tooltip
			hidden_tooltip = {
				any_dynasty_member = {
					event_target:target_unlanded_friend = {
						opinion = {
							who = PREV
							modifier = opinion_loyal_servant
							months = 1200
						}
					}
				}
			}
		}
		if = {
			limit = {
				NOT = {
					trait = charitable
				}
			}
			add_trait = charitable
		}
	}
	
	# Deny friend land
	option = {
		name = EVTOPTB_ZE_22702
		
		ai_chance = {
			factor = 50
		}
		
	}
}

# Offer to teach liege's commanders tactics
character_event = {
	id = ZE.22800
	desc = EVTDESC_ZE_22800
	picture = GFX_evt_war_planning
	
	min_age = 16
	capable_only = yes
	prisoner = no
	war = no
	has_dlc = "Zeus"
	
	only_playable = yes

	is_triggered_only = yes
	
	trigger = {
		martial = 12
		independent = no
		NOR = {
			is_inaccessible_trigger = yes
			trait = slothful
			trait = shy
			liege = { is_rival = ROOT }
			holds_favor_on = LIEGE
		}
		OR = { 
			trait = light_foot_leader
			trait = heavy_infantry_leader 
			trait = cavalry_leader
			trait = inspiring_leader
			trait = trickster
			trait = organizer
			trait = defensive_leader
			trait = experimenter
			trait = flanker
			trait = aggressive_leader
			trait = siege_leader
			trait = flat_terrain_leader
			trait = rough_terrain_leader
			trait = mountain_terrain_leader
			trait = desert_terrain_leader
			trait = unyielding_leader
			trait = narrow_flank_leader
			trait = war_elephant_leader
			trait = jungle_terrain_leader
			trait = winter_soldier
		}
		
		liege = {
			prisoner = no
			NOR = {
				trait = incapable
				is_inaccessible_trigger = yes
			}
			any_realm_character = {
				count = 3
				can_have_more_leadership_traits = yes
				martial = 6
				same_liege = ROOT
				has_minor_title = title_commander
				ai = yes
				NOR = {
					trait = light_foot_leader
					trait = heavy_infantry_leader 
					trait = cavalry_leader
					trait = inspiring_leader
					trait = trickster
					trait = organizer
					trait = defensive_leader
					trait = experimenter
					trait = flanker
					trait = aggressive_leader
					trait = siege_leader
					trait = flat_terrain_leader
					trait = rough_terrain_leader
					trait = mountain_terrain_leader
					trait = desert_terrain_leader
					trait = unyielding_leader
					trait = narrow_flank_leader
					trait = war_elephant_leader
					trait = jungle_terrain_leader
					trait = winter_soldier
				}
			}
		}
	}
	
	immediate = {
		liege = {
			save_event_target_as = letter_event_portrait
		}
		liege = {
			any_realm_character = {
				limit = {
					martial = 6
					same_liege = ROOT
					has_minor_title = title_commander
					ai = yes
					can_have_more_leadership_traits = yes
					NOR = {
						character = event_target:commander_two
						character = event_target:commander_three
						trait = light_foot_leader
						trait = heavy_infantry_leader 
						trait = cavalry_leader
						trait = inspiring_leader
						trait = trickster
						trait = organizer
						trait = defensive_leader
						trait = experimenter
						trait = flanker
						trait = aggressive_leader
						trait = siege_leader
						trait = flat_terrain_leader
						trait = rough_terrain_leader
						trait = mountain_terrain_leader
						trait = desert_terrain_leader
						trait = unyielding_leader
						trait = narrow_flank_leader
						trait = war_elephant_leader
						trait = jungle_terrain_leader
						trait = winter_soldier
					}
				}
				save_event_target_as = commander_one
			}
			any_realm_character = {
				limit = {
					martial = 6
					same_liege = ROOT
					has_minor_title = title_commander
					ai = yes
					can_have_more_leadership_traits = yes
					NOR = {
						character = event_target:commander_one
						character = event_target:commander_three
						trait = light_foot_leader
						trait = heavy_infantry_leader 
						trait = cavalry_leader
						trait = inspiring_leader
						trait = trickster
						trait = organizer
						trait = defensive_leader
						trait = experimenter
						trait = flanker
						trait = aggressive_leader
						trait = siege_leader
						trait = flat_terrain_leader
						trait = rough_terrain_leader
						trait = mountain_terrain_leader
						trait = desert_terrain_leader
						trait = unyielding_leader
						trait = narrow_flank_leader
						trait = war_elephant_leader
						trait = jungle_terrain_leader
						trait = winter_soldier
					}
				}
				save_event_target_as = commander_two
			}
			any_realm_character = {
				limit = {
					martial = 6
					same_liege = ROOT
					has_minor_title = title_commander
					ai = yes
					can_have_more_leadership_traits = yes
					NOR = {
						character = event_target:commander_two
						character = event_target:commander_one
						trait = light_foot_leader
						trait = heavy_infantry_leader 
						trait = cavalry_leader
						trait = inspiring_leader
						trait = trickster
						trait = organizer
						trait = defensive_leader
						trait = experimenter
						trait = flanker
						trait = aggressive_leader
						trait = siege_leader
						trait = flat_terrain_leader
						trait = rough_terrain_leader
						trait = mountain_terrain_leader
						trait = desert_terrain_leader
						trait = unyielding_leader
						trait = narrow_flank_leader
						trait = war_elephant_leader
						trait = jungle_terrain_leader
						trait = winter_soldier
					}
				}
				save_event_target_as = commander_three
			}
		}
	}
	
	# Offer to train
	option = {
		name = EVTOPTA_ZE_22800
		
		ai_chance = {
			factor = 90
		}
		
		liege = {
			letter_event = { id = ZE.22801 }
		}
	}
	
	# Rather not bother with it
	option = {
		name = EVTOPTB_ZE_22800
		
		ai_chance = {
			factor = 10
		}
	}
}

# Liege receives offer
letter_event = {
	id = ZE.22801
	desc = EVTDESC_ZE_22801
	
	min_age = 16
	capable_only = yes
	prisoner = no
	
	only_playable = yes

	is_triggered_only = yes
	
	# Accept offer
	option = {
		name = EVTOPTA_ZE_22801
		
		ai_chance = {
			factor = 90
			
			modifier = {
				factor = 0.5
				trait = paranoid
			}
			modifier = {
				factor = 0.5
				trait = proud
			}
		}
		
		hidden_tooltip = {
			FROM = {
				letter_event = { id = ZE.22802 days = 7 }
			}
		}
		tooltip = {
			FROM = {
				add_favor = ROOT 
			}
		}
		
		if = {
			limit = {
				FROM = {
					trait = siege_leader  
				}
			}
			event_target:commander_one = { 
				add_trait = siege_leader 
			}
			event_target:commander_two = { 
				add_trait = siege_leader 
			}
			event_target:commander_three = { 
				add_trait = siege_leader 
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = flat_terrain_leader   
				}
			}
			event_target:commander_one = { 
				add_trait = flat_terrain_leader  
			}
			event_target:commander_two = { 
				add_trait = flat_terrain_leader  
			}
			event_target:commander_three = { 
				add_trait = flat_terrain_leader  
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = rough_terrain_leader   
				}
			}
			event_target:commander_one = { 
				add_trait = rough_terrain_leader  
			}
			event_target:commander_two = { 
				add_trait = rough_terrain_leader  
			}
			event_target:commander_three = { 
				add_trait = rough_terrain_leader  
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = mountain_terrain_leader   
				}
			}
			event_target:commander_one = { 
				add_trait = mountain_terrain_leader  
			}
			event_target:commander_two = { 
				add_trait = mountain_terrain_leader  
			}
			event_target:commander_three = { 
				add_trait = mountain_terrain_leader  
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = desert_terrain_leader   
				}
			}
			event_target:commander_one = { 
				add_trait = desert_terrain_leader  
			}
			event_target:commander_two = { 
				add_trait = desert_terrain_leader  
			}
			event_target:commander_three = { 
				add_trait = desert_terrain_leader  
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = jungle_terrain_leader   
				}
			}
			event_target:commander_one = { 
				add_trait = jungle_terrain_leader  
			}
			event_target:commander_two = { 
				add_trait = jungle_terrain_leader  
			}
			event_target:commander_three = { 
				add_trait = jungle_terrain_leader  
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = winter_soldier   
				}
			}
			event_target:commander_one = { 
				add_trait = winter_soldier  
			}
			event_target:commander_two = { 
				add_trait = winter_soldier  
			}
			event_target:commander_three = { 
				add_trait = winter_soldier  
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = organizer  
				}
			}
			event_target:commander_one = { 
				add_trait = organizer 
			}
			event_target:commander_two = { 
				add_trait = organizer 
			}
			event_target:commander_three = { 
				add_trait = organizer 
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = light_foot_leader   
				}
			}
			event_target:commander_one = { 
				add_trait = light_foot_leader  
			}
			event_target:commander_two = { 
				add_trait = light_foot_leader  
			}
			event_target:commander_three = { 
				add_trait = light_foot_leader  
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = heavy_infantry_leader   
				}
			}
			event_target:commander_one = { 
				add_trait = heavy_infantry_leader  
			}
			event_target:commander_two = { 
				add_trait = heavy_infantry_leader  
			}
			event_target:commander_three = { 
				add_trait = heavy_infantry_leader  
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = cavalry_leader   
				}
			}
			event_target:commander_one = { 
				add_trait = cavalry_leader  
			}
			event_target:commander_two = { 
				add_trait = cavalry_leader  
			}
			event_target:commander_three = { 
				add_trait = cavalry_leader  
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = inspiring_leader   
				}
			}
			event_target:commander_one = { 
				add_trait = inspiring_leader  
			}
			event_target:commander_two = { 
				add_trait = inspiring_leader  
			}
			event_target:commander_three = { 
				add_trait = inspiring_leader  
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = defensive_leader   
				}
			}
			event_target:commander_one = { 
				add_trait = defensive_leader  
			}
			event_target:commander_two = { 
				add_trait = defensive_leader  
			}
			event_target:commander_three = { 
				add_trait = defensive_leader  
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = experimenter  
				}
			}
			event_target:commander_one = { 
				add_trait = experimenter 
			}
			event_target:commander_two = { 
				add_trait = experimenter 
			}
			event_target:commander_three = { 
				add_trait = experimenter 
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = flanker  
				}
			}
			event_target:commander_one = { 
				add_trait = flanker 
			}
			event_target:commander_two = { 
				add_trait = flanker 
			}
			event_target:commander_three = { 
				add_trait = flanker 
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = aggressive_leader   
				}
			}
			event_target:commander_one = { 
				add_trait = aggressive_leader  
			}
			event_target:commander_two = { 
				add_trait = aggressive_leader  
			}
			event_target:commander_three = { 
				add_trait = aggressive_leader  
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = unyielding_leader   
				}
			}
			event_target:commander_one = { 
				add_trait = unyielding_leader  
			}
			event_target:commander_two = { 
				add_trait = unyielding_leader  
			}
			event_target:commander_three = { 
				add_trait = unyielding_leader  
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = narrow_flank_leader   
				}
			}
			event_target:commander_one = { 
				add_trait = narrow_flank_leader  
			}
			event_target:commander_two = { 
				add_trait = narrow_flank_leader  
			}
			event_target:commander_three = { 
				add_trait = narrow_flank_leader  
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = trickster  
				}
			}
			event_target:commander_one = { 
				add_trait = trickster 
			}
			event_target:commander_two = { 
				add_trait = trickster 
			}
			event_target:commander_three = { 
				add_trait = trickster 
			}
			break = yes
		}
		if = {
			limit = {
				FROM = {
					trait = war_elephant_leader   
				}
			}
			event_target:commander_one = { 
				add_trait = war_elephant_leader  
			}
			event_target:commander_two = { 
				add_trait = war_elephant_leader  
			}
			event_target:commander_three = { 
				add_trait = war_elephant_leader  
			}
			break = yes
		}
	}
	
	# An insult!
	option = {
		name = EVTOPTB_ZE_22801
		
		ai_chance = {
			factor = 10
		}
		
		opinion = {
			modifier = insulted
			who = FROM
			years = 5
		}
		
		FROM = {
			letter_event = { id = ZE.22803 days = 7 }
		}
		
	}
}

# Liege accepted!
letter_event = {
	id = ZE.22802
	desc =  EVTDESC_ZE_22802

	is_triggered_only = yes
	
	immediate = {
		ROOT = {
			add_favor = FROM 
		}
	}
	
	option = {
		name = EVTOPTA_ZE_22802
		tooltip = {
			ROOT = {
				add_favor = FROM 
			}
		}
	}
}

# Liege denied
letter_event = {
	id = ZE.22803
	desc =  EVTDESC_ZE_22803

	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_ZE_22803
		
		tooltip = {
			FROM = {
				opinion = {
					modifier = insulted
					who = FROM
					years = 5
				}
			}
		}
	}
}