namespace = ep3_travel_events

##################################################
#	EP3 Travel Events
#	by Jason Cantalini
#
#	3000		Waters of the Jordan
#	3001 		The Cilician Gates
#	3002-3 		Where Armenians Govern
#	3010		Anatolian Silence

scripted_trigger ep3_travel_events_3000_enraptured_trigger = {
	#every kind of personality which wouldn't mind or self-delude about the river being a bit icky
	OR = {
		has_trait = zealous
		has_trait = stubborn
		has_trait = trusting
		has_trait = humble
		has_trait = peasant_leader
	}
}

# You enter a province which your faith is syncretic with
ep3_travel_events.3000 = { 
	type = character_event
	title = ep3_travel_events.3000.t
	desc = {
		desc = ep3_travel_events.3000.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					religion = religion:judaism_religion
				}
				desc = ep3_travel_events.3000.israel
			}
			triggered_desc = {
				trigger = {
					religion = religion:islam_religion
				}
				desc = ep3_travel_events.3000.muslim
			}
			triggered_desc = {
				trigger = {
					OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
					culture = { has_cultural_pillar = language_greek }
				}
				desc = ep3_travel_events.3000.greek_christian
			}
			triggered_desc = {
				trigger = {
					OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
				}
				desc = ep3_travel_events.3000.christian
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					ep3_travel_events_3000_enraptured_trigger = yes
				}
				desc = ep3_travel_events.3000.outro_rapture
			}
			desc = ep3_travel_events.3000.outro
		}
		
	}
	theme = travel
	override_background = {
		reference = wilderness_wetlands
	}
	left_portrait = {
		character = root 
	   	triggered_animation = {
			trigger = {
				ep3_travel_events_3000_enraptured_trigger = yes
			}
			animation = wedding_happy_cry
		}
		triggered_animation = {
			trigger = {
				ep3_travel_events_3000_enraptured_trigger = no
			}
			animation = disgust
		}
	   	triggered_outfit = {
			remove_default_outfit = no
			outfit_tags = { nightgown }
		}
	}
	cooldown = { years = 75 }
	trigger = {
		age >= 14
		is_available_travelling = yes
        is_playable_character = yes
		is_location_valid_for_travel_event_on_land = yes
		location = {
			OR = {
				barony = title:b_maab
				barony = title:b_jarash
				barony = title:b_irbid
				barony = title:b_zurra
				barony = title:b_baniyas
				barony = title:b_tiberias
				barony = title:b_nablus
			}
		}
		
		NOT = {
			has_trait = cynical
		}
		OR = {
			OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
			religion = religion:judaism_religion
			religion = religion:islam_religion
		}
	}
	immediate = {
		hidden_effect_new_object = {
			root = {
				save_scope_as = owner
				#Create fancy regalia
				set_artifact_rarity_masterwork = yes
				create_artifact = {	
					name = artifact_water_of_the_jordan
					description = placeholder # Will be updated in the post-creation effects
					creator = root
					visuals = flask
					type = miscellaneous
					modifier = artifact_monthly_piety_gain_per_legitimacy_level_mult_3_modifier
					modifier = artifact_legitimacy_gain_mult_3_modifier
					wealth = scope:wealth
					quality = scope:quality
					save_scope_as = newly_created_artifact_1
					history = {
						type = created_before_history
					}
				}
				scope:newly_created_artifact_1 = {
					set_artifact_description = artifact_water_of_the_jordan_desc
				}
			}
		}
	}
	# I'm here looking for holiness, cleanliness be damned! Taking some water with me
	option = {
		trigger = {
			OR = { 
				has_trait = zealous
				trigger_if = {
					limit = {
						involved_activity ?= {
							has_activity_type = activity_pilgrimage
						}
					}
					has_activity_intent = zealot_intent
				}
			}
		}
		name = {
			trigger = {
				OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
			}
			text = ep3_travel_events.3000.a_christian
		}
		name = {
			trigger = {
				religion = religion:judaism_religion
			}
			text = ep3_travel_events.3000.a_jewish
		}
		name = {
			trigger = {
				religion = religion:islam_religion
			}
			text = ep3_travel_events.3000.a_muslim
		}
		show_as_tooltip = {
			scope:newly_created_artifact_1 = {
				set_owner = {
					target = root
					history = { type = created_before_history }
				}
			}
		}
		add_character_modifier = {
			modifier = holy_water_mortal_stomach_modifier
			years = 5
		}
		
		stress_impact = {
			content = minor_stress_impact_gain
			zealous = miniscule_stress_impact_loss
			paranoid = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
				ai_energy = 1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = content
					has_trait = paranoid
				}
			}
		}
	}
	# A cleansing rite!
	option = {
		name = {
			trigger = {
				ep3_travel_events_3000_enraptured_trigger = yes
			}
			text = ep3_travel_events.3000.b_zealot
		}
		name = {
			trigger = {
				ep3_travel_events_3000_enraptured_trigger = no
			}
			text = ep3_travel_events.3000.b
		}
		flavor = ep3_travel_events.3000.b.flavor
		
		add_piety = medium_piety_gain
		add_stress = miniscule_stress_impact_loss
		add_character_modifier = {
			modifier = holy_water_mortal_stomach_modifier
			years = 5
		}		
		stress_impact = {
			honest = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
			craven = miniscule_stress_impact_gain
			arrogant = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = arrogant
					has_trait = honest
					has_trait = craven
					has_trait = paranoid
				}
			}
		}
	}
	# This doesn't taste good... I should take precautions
	option = {
		name = {
			trigger = {
				ep3_travel_events_3000_enraptured_trigger = yes
			}
			text = ep3_travel_events.3000.c_zealot
		}
		name = {
			trigger = {
				ep3_travel_events_3000_enraptured_trigger = no
			}
			text = ep3_travel_events.3000.c
		}
		flavor = ep3_travel_events.3000.c_flavor
		stress_impact = {
			zealous = medium_stress_impact_gain
			brave = miniscule_stress_impact_gain
			stubborn = minor_stress_impact_gain
			trusting = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = -1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = trusting
					has_trait = stubborn
					has_trait = brave
					has_trait = zealous
				}
			}
			modifier = {
				health <= poor_health
				add = 100
			}
			modifier = {
				health <= dying_health
				add = 100
			}
		}
	}
}

scripted_trigger ep3_travel_events_3001_is_foe_trigger = {
	#every kind of personality which wouldn't mind or self-delude about the river being a bit icky
	 OR = {
		faith = {
			faith_hostility_level = {
				target = scope:lords_liege.faith
				value >= faith_hostile_level
			}
		}
		is_at_war_with = scope:lord_of_passes
		liege ?= {
			is_at_war_with = scope:lord_of_passes
		}
		top_liege ?= {
			is_at_war_with = scope:lord_of_passes
		}
		scope:lord_of_passes = {
			liege ?= {
				is_at_war_with = root
			}
		}
		scope:lord_of_passes = {
			top_liege ?= {
				is_at_war_with = root
			}
		}
	}
}

# You enter the Cilician Gates
ep3_travel_events.3001 = { 
	type = character_event
	title = ep3_travel_events.3001.t
	desc = {
		desc = ep3_travel_events.3001.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					culture = { has_cultural_pillar = language_greek }
					ep3_travel_events_3001_is_foe_trigger = no
				}
				desc = ep3_travel_events.3001.greek
			}
			triggered_desc = {
				trigger = {
					ep3_travel_events_3001_is_foe_trigger = no
				}
				desc = ep3_travel_events.3001.friend
			}
			triggered_desc = {
				trigger = {
					ep3_travel_events_3001_is_foe_trigger = yes
					knows_language = language_arabic
					religion = religion:islam_religion
				}
				desc = ep3_travel_events.3001.islamic_arabic
			}
			desc = ep3_travel_events.3001.foe
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					ep3_travel_events_3001_is_foe_trigger = no
				}
				desc = ep3_travel_events.3001.praise_outro
			}
			triggered_desc = {
				trigger = {
					ep3_travel_events_3001_is_foe_trigger = yes
				}
				desc = ep3_travel_events.3001.distrust_outro
			}
		}
	}
	theme = travel

	override_background = {
		reference = ep2_travel_settlement_mountains
	}
	left_portrait = {
		character = root 
	   	animation = jockey_walk
		camera = camera_event_horse_left
	}
	trigger = {
		age >= 12
		is_available_travelling = yes
        is_playable_character = yes
		is_location_valid_for_travel_event_on_land = yes
		location = {
			barony = title:b_tyana
			is_occupied = no
		}
		location.county.holder != root #If I own it then it does not make sense to visit it.
		NOT = { has_character_flag = had_ep3_travel_events.3001 }
	}
	immediate = {
		#Make sure the same person doesn't get this twice
		add_character_flag = had_ep3_travel_events.3001
		location = {
			save_scope_as = current_location
		}
		location.county.holder = {
			save_scope_as = lord_of_passes
		}
		if = {
			limit = {
				exists = scope:lord_of_passes.top_liege
			}
			scope:lord_of_passes.top_liege = {
				save_scope_as = lords_liege
			}
		}
		else = {
			scope:lord_of_passes = {
				save_scope_as = lords_liege
			}
		}
		show_as_tooltip = {
			add_martial_lifestyle_xp = travel_medium_xp
		}
	}
	# These are our defenders and I am proud
	option = {
		trigger = {
			ep3_travel_events_3001_is_foe_trigger = no
		}
		name = {
			trigger = {
				culture = { has_cultural_pillar = language_greek }
			}
			text = ep3_travel_events.3001.a_greek
		}
		name = {
			trigger = {
				NOT = { culture = { has_cultural_pillar = language_greek } }
			}
			text = ep3_travel_events.3001.a_non_greek
		}
		if = {
			limit = {
				faith = {
					faith_hostility_level = {
						target = scope:lord_of_passes.faith
						value < faith_hostile_level
					}
				}
				NOT = {
					is_at_war_with = scope:lord_of_passes
				}
				#Need to be in same realm
				OR = {
					liege ?= {
						OR = {
							AND = {
								exists = scope:lord_of_passes.liege
								this = scope:lord_of_passes.liege
							}
							this = scope:lord_of_passes
						}
					}
					scope:lord_of_passes = {
						is_vassal_of = root
					}
				}
				culture = { has_cultural_pillar = language_greek }
			}
			add_opinion = {
				target = scope:lord_of_passes
				opinion = 10
				modifier = impressed_opinion
			}
		}
		stress_impact = {
			trusting = minor_stress_impact_loss
			zealous = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}
	# These are our foes and it's ominous
	option = {
		trigger = {
			ep3_travel_events_3001_is_foe_trigger = yes
		}
		name = ep3_travel_events.3001.b
		add_character_modifier = {
			modifier = haunted_by_hostile_troops_modifier
			years = 1
		}
		
		stress_impact = {
			paranoid = miniscule_stress_impact_gain
			craven = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}
}

scripted_trigger ep3_travel_events_3002_byzantine_root_trigger = {
	culture = {
		has_cultural_pillar = heritage_byzantine
		OR = {
			any_parent_culture_or_above = { this = culture:greek }
			this = culture:greek
		}
	}
}

# You visit the capital of a ruler who belongs to a neighboring culture
ep3_travel_events.3002 = { 
	type = character_event
	title = ep3_travel_events.3002.t
	desc = {
		desc = ep3_travel_events.3002.intro
		#One desc for admin, one for non-admins
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:local_lord = {
						government_allows = administrative
					}
				}
				desc = ep3_travel_events.3002.admin
			}
			desc = ep3_travel_events.3002.non_admin
		}
		#Different descs for historic flavor
		first_valid = {
			#Armenian
			triggered_desc = {
				trigger = {
					ep3_travel_events_3002_byzantine_root_trigger = yes
					scope:local_lord.culture = {
						OR = {
							any_parent_culture_or_above = { this = culture:armenian }
							this = culture:armenian
						}
					}
				}
				desc = ep3_travel_events.3002.armenian
			}
			#Georgian
			triggered_desc = {
				trigger = {
					ep3_travel_events_3002_byzantine_root_trigger = yes
					scope:local_lord.culture = {
						OR = {
							any_parent_culture_or_above = { this = culture:georgian }
							this = culture:georgian
						}
					}
				}
				desc = ep3_travel_events.3002.georgian
			}
			#Bulgarian
			triggered_desc = {
				trigger = {
					ep3_travel_events_3002_byzantine_root_trigger = yes
					scope:local_lord.culture = {
						OR = {
							any_parent_culture_or_above = { this = culture:bulgarian }
							this = culture:bulgarian
						}
					}
				}
				desc = ep3_travel_events.3002.bulgarian
			}
			#Serbian
			triggered_desc = {
				trigger = {
					ep3_travel_events_3002_byzantine_root_trigger = yes
					scope:local_lord.culture = {
						OR = {
							any_parent_culture_or_above = { this = culture:serbian }
							this = culture:serbian
						}
					}
				}
				desc = ep3_travel_events.3002.serbian
			}
			#Latin
			triggered_desc = {
				trigger = {
					ep3_travel_events_3002_byzantine_root_trigger = yes
					scope:local_lord.culture = {
						has_cultural_pillar = heritage_latin
					}
				}
				desc = ep3_travel_events.3002.latin
			}
			#Vlach
			triggered_desc = {
				trigger = {
					ep3_travel_events_3002_byzantine_root_trigger = yes
					scope:local_lord.culture = {
						OR = {
							any_parent_culture_or_above = { this = culture:vlach }
							this = culture:vlach
						}
					}
				}
				desc = ep3_travel_events.3002.vlach
			}
			desc = ep3_travel_events.3002.generic
		}
	}
	theme = travel

	override_background = {
		reference = holy_site_generic
	}
	left_portrait = {
		character = root 
	   	animation = jockey_idle
	   	camera = camera_event_horse_left
	}
	lower_right_portrait = {
		character = scope:local_lord
	}
	trigger = {
		#check root is an eligible travelling person
		age >= 12
		is_available_travelling = yes
        is_playable_character = yes
		is_location_valid_for_travel_event_on_land = yes
		government_allows = administrative
		OR = {
			NOT = { exists = top_liege }
			top_liege.culture = {
				this = root.culture
			}
		}
		location.county.holder = {
			highest_held_title_tier >= tier_duchy
			culture = {
				this != root.culture
			}
			faith = {
				faith_hostility_level = {
					target = root.faith
					value <= faith_hostile_level
				}
			}
			#shouldn't loath root
			opinion = {
				target = root
				value >= -60
			}
			NOR = {
				#If I own it then it does not make sense to visit it.
				this = root
				AND = {
					exists = root.liege
					this = root.liege
				}
				AND = {
					exists = root.top_liege
					this = root.top_liege
				}
			}
			#check that this is actually a neighbour
			OR = {
				#neighbour
				any_neighboring_top_liege_realm_owner = {
					this = root
				}
				#same realm
				liege ?= root.liege
				liege ?= root.top_liege
				liege = root
				#within de jure empire
				OR = {
					AND = {
						exists = root.top_liege
						root.top_liege.primary_title = {
							any_de_jure_county = {
								this = root.location.county
							}
						}
					}
					root.primary_title = {
						any_de_jure_county = {
							this = root.location.county
						}
					}
				}
				#Also the special named cultures for Byzantines
				AND = {
					root = { ep3_travel_events_3002_byzantine_root_trigger = yes }
					culture = {
						OR = {
							has_cultural_pillar = heritage_latin
							any_parent_culture_or_above = { this = culture:armenian }
							this = culture:armenian
							any_parent_culture_or_above = { this = culture:georgian }
							this = culture:georgian
							any_parent_culture_or_above = { this = culture:serbian }
							this = culture:serbian
							any_parent_culture_or_above = { this = culture:vlach }
							this = culture:vlach
							any_parent_culture_or_above = { this = culture:bulgarian }
							this = culture:bulgarian
						}
					}
				}
			}
			#The cultures should sorta like each other (more than just sharing a religion)
			culture = {
				OR = {
					#exception for former romans
					has_cultural_pillar = heritage_latin
					cultural_acceptance = {
						target = ROOT.culture
						value >= 10
					}
				}
			}
			save_temporary_scope_as = location_holder
		}
		location.county = {
			this = scope:location_holder.capital_county
			culture = {
				this != root.culture
			}
		}
		location = {
			is_occupied = no
			OR = {
				is_county_capital = yes
				any_neighboring_province = {
					is_county_capital = yes
					county = root.location.county
					
				}
			}
		}
	}

	cooldown = { days = 30 }

	immediate = {
		location.county.holder = {
			save_scope_as = local_lord
		}
		location = {
			save_scope_as = current_location
		}
		scope:local_lord.capital_county = {
			save_scope_as = local_lord_capital
		}
	}
	# This is an opportunity to represent the majesty of the empire
	option = {
		name = {
			trigger = {
				ep3_travel_events_3002_byzantine_root_trigger = yes
			}
			text = ep3_travel_events.3002.a_byzantine
		}
		name = {
			trigger = {
				ep3_travel_events_3002_byzantine_root_trigger = no
			}
			text = ep3_travel_events.3002.a
		}
		flavor = ep3_travel_events.3002.a.flavor
			
		#I am an impressive imperial Greek!!!!!
		duel = {
			skill = diplomacy
			target = scope:local_lord
			50 = { #The local lord is in awe
				desc = ep3_travel_events.3002.a_success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				modifier = {
					OR = {
						AND = {
							highest_held_title_tier >= tier_empire
							scope:local_lord = { highest_held_title_tier < tier_empire }
						}
						AND = {
							highest_held_title_tier >= tier_kingdom
							scope:local_lord = { highest_held_title_tier < tier_kingdom }
						}
					}
					add = 25
				}
				modifier = {
					OR = {
						AND = {
							highest_held_title_tier >= tier_empire
							scope:local_lord = { highest_held_title_tier = tier_empire }
						}
						AND = {
							highest_held_title_tier >= tier_kingdom
							scope:local_lord = { highest_held_title_tier = tier_kingdom }
						}
					}
					add = 10
				}
				
				send_interface_toast = {
					title = ep3_travel_events.3002.a_success
					left_icon = root
					right_icon = scope:local_lord
					
					add_prestige = minor_prestige_gain
					if = {
						limit = {
							highest_held_title_tier >= tier_empire
							scope:local_lord = {
								NOR = {
									top_liege = root
									liege = root
								}
							}
						}
						custom_tooltip = impressive_visit_vassalization_acceptance_bonus
						scope:local_lord = {
							add_character_flag = cowed_increased_vassalization_acceptance
							trigger_event = {
								id = ep3_travel_events.3003
								years = 5
							}
						}
					}
					else_if = {
						#de jure integration bonus on vassal's land if in progress
						limit = {
							is_liege_or_above_of = scope:local_lord
							scope:local_lord_capital = {
								de_jure_drifting_towards = root.primary_title
							}
						}
						scope:local_lord_capital = {
							change_de_jure_drift_progress = {
								target = scope:councillor_liege.primary_title
								value = 10
							}
						}
					}
					else = {
						change_influence = minor_influence_gain
					}
				}
			}
			50 = { #The local lord is irked
				desc = ep3_travel_events.3002.a_failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				modifier = {
					prestige_level <= 1
					add = 10
				}
				send_interface_toast = {
					title = ep3_travel_events.3002.a_failure
					left_icon = root
					right_icon = scope:local_lord
					if = {
						limit = {
							scope:local_lord = {
								liege ?= root
							}
						}
						scope:local_lord = {
							add_opinion = {
								target = root
								modifier = angry_opinion
								opinion = -10
							}
						}
					}
					#The relationship is less useful, might as well toss more opinion
					else = {
						scope:local_lord = {
							add_opinion = {
								target = root
								modifier = angry_opinion
								opinion = -20
							}
						}
					}
					if = {
						limit = {
							this = root.culture.culture_head
						}
						culture = {
							change_cultural_acceptance = {
								target = scope:local_lord.culture
								value = minor_cultural_acceptance_loss
								desc = cultural_acceptance_loss_insulted_by_visiting_emperor
							}
						}
					}
				}
			}
		}
		stress_impact = {
			humble = minor_stress_impact_gain
			shy = miniscule_stress_impact_gain
			craven = miniscule_stress_impact_gain
			compassionate = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = humble
					has_trait = shy
					has_trait = craven
					has_trait = compassionate
				}
			}
			modifier = {
				add = -50
				diplomacy < decent_skill_rating
			}
			modifier = {
				add = -20
				prestige_level <= 1
			}
			modifier = {
				add = -20
				NOR = {
					AND = {
						highest_held_title_tier >= tier_empire
						scope:local_lord = { highest_held_title_tier < tier_empire }
					}
					AND = {
						highest_held_title_tier >= tier_kingdom
						scope:local_lord = { highest_held_title_tier < tier_kingdom }
					}
				}
			}
			ai_value_modifier = {
				ai_compassion = -1
				ai_boldness = 1
			}
		}
	}
	
	# I should visit their local places of worship
	option = {
		name = ep3_travel_events.3002.b
		flavor = ep3_travel_events.3002.b.flavor

		add_piety = minor_piety_gain
		if = {
			limit = {
				highest_held_title_tier >= tier_empire
				scope:local_lord_capital.faith = {
					this != root.faith
				}
				faith = {
					NOT = { has_doctrine = doctrine_pluralism_pluralistic }
				}
			}
			faith = {
				change_fervor = {
					value = -5
					desc = fervor_loss_emperor_pluralistic_act
				}
			}
		}
		stress_impact = {
			zealous = miniscule_stress_impact_loss
			cynical = miniscule_stress_impact_gain
			gregarious = minor_stress_impact_gain
			impatient = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = cynical
					has_trait = gregarious
					has_trait = impatient
				}
			}
			ai_value_modifier = {
				ai_energy = -1
				ai_zeal = 1
			}
		}
	}
	# I should pay tribute to our neighbours
	option = {
		name = {
			trigger = {
				scope:local_lord = {
					NOR = {
						liege ?= root.liege
						liege ?= root.top_liege
						liege = root
					}
				}
			}
			text = ep3_travel_events.3002.c_foreign
		}
		name = {
			trigger = {
				scope:local_lord = {
					is_liege_or_above_of = root
				}
			}
			text = ep3_travel_events.3002.c
		}
		if = {
			limit = {
				scope:local_lord = {
					liege ?= root
				}
			}
			scope:local_lord = {
				add_opinion = {
					target = root
					modifier = grateful_opinion
					opinion = 10
				}
			}
		}
		#The relationship is less useful, might as well toss more opinion
		else = {
			scope:local_lord = {
				add_opinion = {
					target = root
					modifier = friendliness_opinion
					opinion = 20
				}
			}
		}
		
		if = {
			limit = {
				this = root.culture.culture_head
			}
			root.culture = {
				change_cultural_acceptance = {
					target = scope:local_lord.culture
					value = minor_cultural_acceptance_gain
					desc = cultural_acceptance_gain_honored_by_visiting_emperor
				}
			}
		}
		
		stress_impact = {
			arrogant = minor_stress_impact_gain
			callous = miniscule_stress_impact_gain
			sadistic = miniscule_stress_impact_gain
			stubborn = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = arrogant
					has_trait = callous
					has_trait = sadistic
					has_trait = stubborn
				}
			}
			ai_value_modifier = {
				ai_energy = -1
				ai_zeal = 1
			}
		}
	}
}

#follow up event that removes vassalization acceptance effect from the local lord
ep3_travel_events.3003 = {
	hidden = yes
	trigger = {
		is_alive = yes
	}
	immediate = {
		remove_character_flag = cowed_increased_vassalization_acceptance
	}
}

scripted_trigger ep3_travel_events_3010_anatolian_native_trigger = {
	OR = {
		has_cultural_pillar = heritage_byzantine
		AND = {
			has_cultural_pillar = heritage_caucasian
			any_parent_culture_or_above = { this = culture:armenian }
			this = culture:armenian
		}
	}
	OR = {
		any_parent_culture_or_above = { this = culture:greek }
		this = culture:greek
		any_parent_culture_or_above = { this = culture:armenian }
		this = culture:armenian
	}
}


#you arrive in a low control anatolian province and the locals hide, mistaking you for tax-collectors/raiders
ep3_travel_events.3010 = { 
	type = character_event
	title = ep3_travel_events.3010.t
	desc = {
		desc = ep3_travel_events.3010
		#Alternate loc if you're in the fairy tower county
		first_valid = {
			triggered_desc = {
				trigger = {
					location = {
						barony = title:b_kaisereia
					}
				}
				desc = ep3_travel_events.3010.fairy_towers
			}
			desc = ep3_travel_events.3010.normal_holes
		}
		#Alternate desc for fellow Greeks/Armenians
		first_valid = {
			triggered_desc = {
				trigger = {
					culture = { ep3_travel_events_3010_anatolian_native_trigger = yes }
				}
				desc = ep3_travel_events.3010.native_knowledge
			}
			desc = ep3_travel_events.3010.foreigners
		}
	}
	theme = travel

	override_background = {
		reference = terrain_travel
	}
	left_portrait = {
		character = root 
	   	animation = eyeroll
	}
	right_portrait = {
		character = scope:hornblower
	   	animation = hunting_horn
	}
	trigger = {
		#check root is an eligible travelling person
		age >= 6
		is_available_travelling = yes
        is_playable_character = yes
		is_location_valid_for_travel_event_on_land = yes
		location = {
			county = {
				#check local people are greeks, armenians or products thereof
				culture = {
					ep3_travel_events_3010_anatolian_native_trigger = yes
				}
				county_control <= 90
				duchy = {
					OR = {
						this = title:d_anatolia
						this = title:d_cappadocia
						this = title:d_charsianon
						this = title:d_sebasteia
						this = title:d_mesopotamia
						this = title:d_diyarbakr
						this = title:d_vaspurakan
						this = title:d_cilicia
						this = title:d_cibyrrhaeot
						this = title:d_edessa
					}
				}
				holder = {
					is_ai = yes
				}
			}
		}
	}

	cooldown = { days = 60 }

	immediate = {
		location.county.holder = {
			save_scope_as = local_lord
		}
		location = {
			save_scope_as = current_location
		}
		if = {
			limit = {
				current_travel_plan ?= {
					any_entourage_character = {
						age >= 10
					}
				}
			}
			current_travel_plan ?= {
				random_entourage_character = {
					limit = {
						age >= 10
					}
					save_scope_as = hornblower
				}
			}
		}
		create_character = {
 			template = anatolian_guide_character
 			location = root.location
 			culture = root.location.county.culture
 			faith = root.location.county.faith
 			dynasty = none
 			save_scope_as = anatolian_guide
 		}
	}
	#Well... let's see what's left for the taking these empty houses
	option = {
		name = ep3_travel_events.3010.a
		flavor = ep3_travel_events.3010.a.flavor
		
		random_list = {
			10 = {
				send_interface_toast = {
					title = ep3_travel_events.3010.a_success
					left_icon = root
					add_gold = minor_gold_value	
				}
			}
			10 = {
				send_interface_toast = {
					title = ep3_travel_events.3010.a_failure
					left_icon = root
				}
			}
		}
		location.county = {
			change_development_progress = minimal_development_progress_loss
			change_county_control = miniscule_county_control_loss
		}
		stress_impact = {
			honest = minor_stress_impact_gain
			just = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 25
			modifier = {
				factor = 0
				OR = {
					has_trait = honest
					has_trait = just
					has_trait = compassionate
					has_trait = generous
				}
			}
			ai_value_modifier = {
				ai_compassion = -1
				ai_greed = 1
				ai_honor = -1
			}
		}
	}
	#Convince them to come out and get a local guide
	option = {
		name = ep3_travel_events.3010.b
		flavor = ep3_travel_events.3010.b.flavor

			
		duel = {
			skill = diplomacy
			value = decent_skill_rating
			60 = { #The locals come out
				desc = ep3_travel_events.3010.b_success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				modifier = {
					location.county.holder = {
						OR = {
							this = root
							any_liege_or_above = {
								this = root
							}
						}
					}
					add = 25
				}
				
				send_interface_toast = {
					title = ep3_travel_events.3010.b_success
					left_icon = root
					
					add_diplomacy_lifestyle_xp = miniscule_lifestyle_xp
					current_travel_plan = {
						add_companion = scope:anatolian_guide
					}
					add_character_modifier = {
						modifier = ep3_guide_from_the_borderlands_modifier
						years = 1
					}
					if = {
						limit = {
							NOT = { scope:anatolian_guide = { is_courtier_of = root } }
						}
						add_courtier = scope:anatolian_guide		
					}
				}
			}
			40 = { #The locals ignore you
				desc = ep3_travel_events.3010.b_failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = ep3_travel_events.3010.b_failure
					left_icon = root
					add_stress = miniscule_stress_impact_gain
				}
			}
		}
		stress_impact = {
			shy = medium_stress_impact_gain
			arrogant = minor_stress_impact_gain
			content = miniscule_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -50
				diplomacy < decent_skill_rating
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = shy
					has_trait = arrogant
					has_trait = content
				}
			}
			ai_value_modifier = {
				ai_sociability = 1
			}
		}
	}
	#Let's just appreciate the quiet, no commoners bustling around (and beauty of the fairy towers)
	option = {
		name = {
			trigger = {
				location = {
					barony = title:b_kaisereia
				}
			}
			text = ep3_travel_events.3010.c_fairy_towers
		}
		name = {
			trigger = {
				NOT = {
					location = {
						barony = title:b_kaisereia
					}
				}
			}
			text = ep3_travel_events.3010.c
		}
		flavor = ep3_travel_events.3010.c.flavor
		
		if = {
			limit = {
				location = {
					barony = title:b_kaisereia
				}
			}
			stress_impact = {
				base = minor_stress_impact_loss
				impatient = minor_stress_impact_gain
				stubborn = miniscule_stress_impact_gain
				vengeful = miniscule_stress_impact_gain
				wrathful = minor_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				base = miniscule_stress_impact_loss
				impatient = minor_stress_impact_gain
				stubborn = miniscule_stress_impact_gain
				vengeful = miniscule_stress_impact_gain
				wrathful = minor_stress_impact_gain
			}
		}
		
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = impatient
					has_trait = stubborn
					has_trait = wrathful
					has_trait = vengeful
				}
			}
			ai_value_modifier = {
				ai_vengefulness = -1
				ai_energy = -1
			}
		}
	}
	after = {
		if = {
			limit = {
				is_ai = yes
			}
			scope:anatolian_guide = { silent_disappearance_effect = yes }
		}
	}
}
