namespace = mpo_events_anna
##################################################
# Anna's Events for MPO

#Train Them Young - teach a child how to ride a horse
mpo_events_anna.0001 = {
	type = character_event
	title = mpo_events_anna.0001.t
	desc = mpo_events_anna.0001.desc
	theme = nomads
	left_portrait = {
		character = scope:pushy_adult
		animation = standing_horse
		camera = camera_event_standing_with_horse_left
	}
	right_portrait = {
		character = scope:child
		animation = clutching_ball
	}
	cooldown = { years = 20 }

	trigger = {
		has_mpo_dlc_trigger = yes
		is_adult = yes
		location = { geographical_region = world_steppe }
		government_has_flag = government_is_nomadic
		any_child = {
			is_available_child = yes
			location = root.location
			age >= 5
		}
		any_courtier = {
			is_available_healthy_ai_adult = yes
		}
	}

	immediate = {
		random_child = {
			limit = {
				is_available_child = yes
				location = root.location
				age >= 5
			}
			save_scope_as = child
		}

		random_courtier = {
			limit = {
				is_available_healthy_ai_adult = yes
			}
			save_scope_as = pushy_adult
		}
	}

	#Put the child on the horse
	option = { 
		name = mpo_events_anna.0001.a
		flavor = mpo_events_anna.0001.a.tt
		random_list = {
			70 = {
				desc = mpo_events_anna.0001.a.toast.good
				send_interface_toast = {
					type = event_toast_effect_good
					title = mpo_events_anna.0001.a.toast.good
					left_icon = scope:child
					right_icon = root
					scope:child = { add_learning_lifestyle_xp = medium_lifestyle_experience }   
				}
			}
			20 = {
				desc = mpo_events_anna.0001.a.toast.neutral
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = mpo_events_anna.0001.a.toast.neutral
					left_icon = scope:child
					right_icon = root
					scope:child = { add_stress = miniscule_stress_gain }
				}	
			}
			10 = {
				desc = mpo_events_anna.0001.a.toast.bad
				send_interface_toast = {
					type = event_toast_effect_bad
					title = mpo_events_anna.0001.a.toast.bad
					left_icon = scope:child
					right_icon = root
					scope:child = { increase_wounds_effect = { REASON = fall }
					}
				}
			}
		}

		reverse_add_opinion = {
			target = scope:pushy_adult
			modifier = respect_opinion
			opinion = 10
		}

		stress_impact = {
			craven = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
			brave = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
				ai_boldness = 1
			}
		}
	}

	#Ride together with the child on the horse
	option = { 
		name = mpo_events_anna.0001.b

		reverse_add_opinion = {
			target = scope:child
			modifier = kindness_opinion
			opinion = 20
		}

		add_prestige = minor_prestige_loss

		stress_impact = {
			callous = minor_stress_impact_gain
			compassionate = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
				ai_rationality = 1
			}
		}
	}

	#Refuse their request
	option = {
		name = mpo_events_anna.0001.c

		reverse_add_opinion = {
			target = scope:pushy_adult
			modifier = disrespect_opinion
			opinion = -10
		}

		stress_impact = {
			craven = minor_stress_impact_loss
			paranoid = minor_stress_impact_loss
			brave = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -1
				ai_boldness = -1
			}
		}
	}
}

#Stories from the Past - choose a story to be told
mpo_events_anna.0005 = {
	type = character_event
	title = mpo_events_anna.0005.t
	desc = mpo_events_anna.0005.desc
	theme = nomads
	left_portrait = {
		character = root
		animation = ecstasy
	}
	right_portrait = {
		character = scope:storyteller
		animation = storyteller
	}
	override_background = mpo_campfire_steppe

	cooldown = { years = 20 }
	
	trigger = {
		has_mpo_dlc_trigger = yes
		is_available_child = yes
		age >= 5
		location = { geographical_region = world_steppe }
		government_has_flag = government_is_nomadic
		any_courtier = {
			is_available_healthy_ai_adult = yes
		}
	}

	immediate = {
		random_courtier = {
			limit = {
				is_available_healthy_ai_adult = yes
			}
			save_scope_as = storyteller
		}
	}

	#Fantastical creatures
	option = { 
		name = mpo_events_anna.0005.a
		flavor = mpo_events_anna.0005.a.tt

		add_character_modifier = {
			modifier = mpo_storyteller_fantastical_creatures_modifier
			years = 5
		}

		stress_impact = {
			eccentric = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = -1
				ai_energy = 1
			}
		}
	}

	#Humorous tales
	option = {
		name = mpo_events_anna.0005.b
		flavor = mpo_events_anna.0005.b.tt

		add_character_modifier = {
			modifier = mpo_storyteller_humorous_tales_modifier
			years = 5
		}

		add_stress = minor_stress_loss

		stress_impact = {
			gregarious = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
				ai_sociability = 1
			}
		}
	}

	#Heroic triumphs
	option = {
		name = mpo_events_anna.0005.c
		flavor = mpo_events_anna.0005.c.tt

		add_character_modifier = {
			modifier = mpo_storyteller_heroic_triumphs_modifier
			years = 5
		}

		stress_impact = {
			wrathful = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
				ai_boldness = 1
			}
		}
	}
}

#Whistle Like an Arrow - being taught how to whistle as a child
mpo_events_anna.0010 = {
	type = character_event
	title = mpo_events_anna.0010.t
	desc = mpo_events_anna.0010.desc
	theme = nomads
	left_portrait = {
		character = root
		animation = shame
	}
	right_portrait = {
		character = scope:whistler
		animation = storyteller
	}

	cooldown = { years = 10 }

	trigger = {
		has_mpo_dlc_trigger = yes
		is_available_child = yes
		age >= 5
		location = { geographical_region = world_steppe }
		government_has_flag = government_is_nomadic
		OR = {
			any_relation = {
				type = guardian
				location = root.location
				is_available = yes
			}
			any_parent = {
				location = root.location
				is_available = yes
			}
		}
	}

	immediate = {
		if = {
			limit = {
				any_relation = {
					type = guardian
					location = root.location
					is_available = yes
				}
			}
			random_relation = {
				type = guardian
				limit = {
					location = root.location
					is_available = yes
				}
				save_scope_as = whistler
			}
		}
		else_if = {
			limit = {
				any_parent = {
					location = root.location
					is_available = yes
				}
			}
			random_parent = {
				limit = {
					location = root.location
					is_available = yes	
				}
				save_scope_as = whistler
			}
		}
	}

	option = { 
		name = mpo_events_anna.0010.a
		custom_tooltip = mpo_events_anna.0010.a.tt.learning
		duel = {
			skill = learning
			value = mediocre_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					#This takes the whistlers learning skill into account, using their skills to teach the child of how to whistle
					multiplier = { add = scope:whistler.learning multiply = 0.5 }
					min = -39
				}
				desc = mpo_events_anna.0010.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = mpo_events_anna.0010.a.tt.success
					left_icon = root
					right_icon = scope:whistler
					add_learning_lifestyle_xp = medium_lifestyle_experience
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = { add = scope:whistler.learning multiply = -0.5 }
					min = -39
				}
				desc = mpo_events_anna.0010.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = mpo_events_anna.0010.a.tt.failure
					left_icon = root
					right_icon = scope:whistler
					add_character_modifier = {
						modifier = mpo_whistling_is_difficult_modifier
						years = 5
					}
				}
			}
		}

		stress_impact = {
			pensive = minor_stress_impact_loss
			bossy = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_sociability = 1
			}
		}
	}
	
	option = {
		name = mpo_events_anna.0010.b

		add_prestige = miniscule_prestige_gain

		reverse_add_opinion = {
			target = scope:whistler
			modifier = disappointed_opinion
			opinion = -5
		}

		stress_impact = {
			bossy = minor_stress_impact_loss
			pensive = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -1
				ai_sociability = -1
			}
		}
	}
}

#A Morsel of Meat - choose the fate of a fawn stuck in a trap
mpo_events_anna.0015 = {
	type = character_event
	title = mpo_events_anna.0015.t
	desc = mpo_events_anna.0015.desc
	theme = travel
	left_portrait = {
		character = root
		animation = personality_dishonorable
	}
	right_portrait = {
		character = scope:sceptic
		animation = personality_cynical
	}

	cooldown = { years = 10 }

	trigger = {
		has_mpo_dlc_trigger = yes
		is_adult = yes
		location = { geographical_region = world_steppe }
		government_has_flag = government_is_landless_adventurer
		NOT = {
			culture = { has_cultural_tradition = tradition_vegetarianism }
		}
		is_available_travelling = yes
		domicile = {
			provisions <= medium_provisions_value
		}
		current_travel_plan = {
			any_entourage_character = {
				is_available_allow_travelling = yes
			}
		}
	}

	immediate = {
		current_travel_plan = {
			random_entourage_character = {
				limit = {
					is_available_allow_travelling = yes
				}
				save_scope_as = sceptic
			}
		}
	}

	#Steal the prey, kill it for provisions
	option = { 
		name = mpo_events_anna.0015.a

		domicile = {
			change_provisions = minor_provisions_gain
		}

		add_prestige = minor_prestige_loss

		stress_impact = {
			humble = minor_stress_impact_gain
			arrogant = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -1
				ai_greed = 1
			}
		}
	}

	#Convince the entourage that it is your trap you laid out
	option = {
		name = mpo_events_anna.0015.b

		duel = {
			skill = intrigue
			value = high_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				domicile = {
					change_provisions = minor_provisions_gain
				}
				add_character_modifier = {
					modifier = mpo_sufficient_liar_modifier
					years = 5
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				add_prestige = minor_prestige_loss
				add_stress = medium_stress_gain
			}
		}

		stress_impact = {
			honest = minor_stress_impact_gain
			deceitful = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -1
				ai_greed = 1
				ai_boldness = 1
			}
		}
	}

	#Release the animal
	option = {
		name = mpo_events_anna.0015.c

		add_character_modifier = {
			modifier = mpo_trapped_fawn_modifier
			years = 5
		}

		add_prestige = miniscule_prestige_loss

		stress_impact = {
			callous = minor_stress_impact_gain
			compassionate = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
				ai_rationality = 1
			}
		}
	}

	#It isn't your trap, leave it be
	option = {
		name = mpo_events_anna.0015.d

		add_prestige = miniscule_prestige_gain

		stress_impact = {
			arbitrary = minor_stress_impact_gain
			just = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
				ai_rationality = 1
			}
		}
	}
}

#Race Against Time - encounter a wounded messenger
mpo_events_anna.0020 = {
	type = character_event
	title = mpo_events_anna.0020.t
	desc = mpo_events_anna.0020.desc
	theme = travel
	left_portrait = {
		character = root
		animation = disbelief
	}
	right_portrait = {
		character = scope:messenger
		animation = loss_1
	}

	cooldown = { years = 20 }
	
	trigger = {
		has_mpo_dlc_trigger = yes
		is_adult = yes
		location = { geographical_region = world_steppe }
		government_has_flag = government_is_nomadic
		is_independent_ruler = no
		is_available_travelling = yes
	}

	immediate = {
		create_character = {
			template = wounded_messenger_character_template
			location = root.location
			culture = this.culture
			faith = this.faith
			save_scope_as = messenger

			after_creation = {
				scope:messenger = {
					increase_wounds_effect = { REASON = battle }
				}
			}
		}

		#This is to make sure that the Trait Wounded is being cured by the root (player) in option A
		save_scope_as = physician
	}

	#Treat the messengers wounds
	option = { 
		name = mpo_events_anna.0020.a

		current_travel_plan = {
			delay_travel_plan = { days = 14 }
		}

		custom_tooltip = mpo_events_anna.0020.war_impact.tt

		hidden_effect = {
			liege = {
				add_character_modifier = {
					modifier = mpo_messenger_negative_liege_modifier
					years = 10
				}
			}
		}

		duel = {
			skill = learning
			value = high_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				modifier = {
					current_travel_plan = {
						any_entourage_character = {
							has_court_position = court_physician_court_position
						}
					}
					add = 10
				}
				modifier = {
					root = {
						has_trait = lifestyle_herbalist
					}
					add = 10
				}

				send_interface_toast = {
					type = event_toast_effect_good
					title = mpo_events_anna.0020.a.toast.good
					left_icon = scope:messenger
					right_icon = root
					scope:messenger = {
						wound_treatment_results_effect = { TREATMENT = safe OUTCOME = success }
					}
					current_travel_plan = { add_companion = scope:messenger }

					reverse_add_opinion = {
						modifier = grateful_opinion
						target = scope:messenger
						opinion = 10
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					type = event_toast_effect_bad
					title = mpo_events_anna.0020.a.toast.bad
					left_icon = scope:messenger
					right_icon = root
				}
				scope:messenger = {
					death = {
						death_reason = death_wounds
					}
				}
			}
		}

		stress_impact = {
			cynical = minor_stress_impact_gain
			compassionate = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
			}
		}
	}

	#Deliver the message
	option = {
		name = mpo_events_anna.0020.b

		current_travel_plan = {
			delay_travel_plan = { days = 21 }
		}

		scope:messenger = {
			death = {
				death_reason = death_wounds
			}
		}

		custom_tooltip = mpo_events_anna.0020.war_impact.tt

		duel = {
			skill = prowess
			value = high_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				modifier = {
					any_owned_story = {
						story_type = story_cycle_martial_lifestyle_warhorse
					}
					add = 10
				}

				send_interface_toast = {
					type = event_toast_effect_good
					title = mpo_events_anna.0020.b.toast.good
					left_icon = root

					add_hook = {
						target = liege
						type = favor_hook
					}
				}

				hidden_effect = {
					liege = {
						add_character_modifier = {
							modifier = mpo_messenger_positive_liege_modifier
							years = 10
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				send_interface_toast = {
					type = event_toast_effect_bad
					title = mpo_events_anna.0020.b.toast.bad
					left_icon = root
					hidden_effect = {
						liege = {
							add_character_modifier = {
								modifier = mpo_messenger_negative_liege_modifier
								years = 10
							}
						}
					}
				}
			}
		}

		stress_impact = {
			brave = minor_stress_impact_loss
			diligent = minor_stress_impact_loss
			craven = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 1
			}
		}
	}

	#How can they be trusted?
	option = {
		name = mpo_events_anna.0020.c
		
		flavor = mpo_events_anna.0020.c_flavor

		hidden_effect = {
			liege = {
				add_character_modifier = {
					modifier = mpo_messenger_negative_liege_modifier
					years = 10
				}
			}
		}

		add_gold = { 5 15 }

		scope:messenger = {
			death = {
				death_reason = death_wounds
			}
		}

		custom_tooltip = mpo_events_anna.0020.war_impact.tt

		current_travel_plan = {
			every_entourage_character = {
				limit = {
					has_trait = trusting
				}
				add_opinion = {
					modifier = cruelty_opinion
					target = root
					opinion = -10
				}
			}
		}

		stress_impact = {
			trusting = minor_stress_impact_gain
			paranoid = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}
}

#Familiar Tunes - encounter with a performer
mpo_events_anna.0025 = {
	type = character_event
	title = mpo_events_anna.0025.t
	desc = mpo_events_anna.0025.desc
	theme = travel
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:throat_singer
		animation = lute_active
	}

	cooldown = { years = 10 }
	
	trigger = {
		has_mpo_dlc_trigger = yes
		is_adult = yes
		location = { geographical_region = world_steppe }
		government_has_flag = government_is_nomadic
		is_available_travelling = yes
	}

	immediate = {
		create_character = {
			template = throat_singer_character_template
			location = root.location
			culture = this.culture
			faith = this.faith
			save_scope_as = throat_singer
		}
	}

	option = { 
		name = mpo_events_anna.0025.a

		duel = {
			skill = learning
			value = low_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = mpo_events_anna.0025.a.toast.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = mpo_events_anna.0025.a.toast.success
					left_icon = root
					right_icon = scope:throat_singer
					add_character_modifier = {
						modifier = mpo_inspiring_tunes_modifier
						years = 5
					}
					add_learning_lifestyle_xp = medium_lifestyle_experience
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = mpo_events_anna.0025.a.toast.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = mpo_events_anna.0025.a.toast.failure
					left_icon = root
					right_icon = scope:throat_singer
					add_prestige = miniscule_prestige_loss
				}
			}
		}

		stress_impact = {
			calm = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = -1
				ai_energy = 1
				ai_sociability = 1
			}
		}
	}

	option = {
		name = mpo_events_anna.0025.b

		add_stress = medium_stress_loss

		stress_impact = {
			calm = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
				ai_energy = 1
				ai_sociability = 1
			}
		}
	}
	after = {
		scope:throat_singer = {
			silent_disappearance_ai_effect = yes
		}
	}
}
