namespace = mpo_events_tova

mpo_events_tova.0001 = { #Child expects gift after long journey
	type = character_event
	title = mpo_events_tova.0001.t
	desc = mpo_events_tova.0001.desc

	theme = nomads
	override_background = {
		trigger = {
			is_landed = yes
		}
		reference = corridor_day
	}
	override_background = {
		trigger = {
			is_landed = no
		}
		reference = bp1_bonfire
	}

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				root = {
					OR = {
						has_trait = cynical
						has_trait = callous
					}
				}
			}
			animation = personality_cynical
		}
		animation = shame
	}

	right_portrait = {
		character = scope:demanding_relation
		animation = admiration
	}

	trigger = {
		has_mpo_dlc_trigger = yes
		government_has_flag = government_is_nomadic
		is_available = yes
	}

	option = { #Increase Wanderer Lifestyle Experience by telling the child of your travels.
		name = mpo_events_tova.0001.a

        duel = {
            skill = learning
            target = scope:demanding_relation
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -49
                }
                min = 5
                desc = mpo_events_tova.0001.a.tt.success
                add_wanderer_lifestyle_xp = medium_lifestyle_experience
                send_interface_toast = {
                    title = mpo_events_tova.0001.a.tt.success
                    left_icon = root
                    right_icon = scope:demanding_relation
 					reverse_add_opinion = {
						target = scope:demanding_relation
 						modifier = pleased_opinion
 						opinion = 25
 					}
                }
            }
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -49
                }
                min = 5
                desc = mpo_events_tova.0001.a.tt.failure
                send_interface_toast = {
                    title = mpo_events_tova.0001.a.tt.failure
                    left_icon = scope:demanding_relation
                    reverse_add_opinion = {
                        target = scope:demanding_relation
                        modifier = insult_opinion 
                        opinion = -25
                    }
                }
            }
        }

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

	option = { #Purchase child a gift.
		name = mpo_events_tova.0001.b

 		hidden_effect = {
 			create_artifact = {
			name = gifted_toy_name
			description = gifted_toy_desc
			modifier = artifact_learning_1_modifier
			type = miscellaneous
			visuals = pocket_toy
			save_scope_as = wanderer_toy
			}
 		}

		remove_short_term_gold = tiny_gold_value
		reverse_add_opinion = {
			target = scope:demanding_relation
 			modifier = pleased_opinion
 			opinion = 15
 		}

	    send_interface_toast = {
			title = mpo_events_tova.0001.b.equipped_tt
		    left_icon = scope:demanding_relation
		    right_icon = scope:wanderer_toy
		    scope:wanderer_toy = {
		    	set_variable = {
					name = suppress_artifact_notifications
					value = yes
					days = 1
				}
		        set_owner = {
		        	target = scope:demanding_relation
					history = {
						location = root.capital_province
						actor = root
						recipient = scope:demanding_relation
						type = given
					}
				}
			}
		}

 		stress_impact = {
 			greedy = minor_stress_impact_gain
 		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -1
			}
            modifier = {
                gold <= medium_gold_value
                factor = 0
            }
		}
	}

	option = { #Gift false relic.
		name = mpo_events_tova.0001.c

        duel = {
            skill = intrigue
            target = scope:demanding_relation
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -49
                }
                min = 5
                desc = mpo_events_tova.0001.c.tt.success
                send_interface_toast = {
                    title = mpo_events_tova.0001.c.tt.success
                    left_icon = scope:demanding_relation
 					reverse_add_opinion = {
						target = scope:demanding_relation
 						modifier = pleased_opinion
 						opinion = 25
 					}
 					scope:demanding_relation = {
 						if = {
 							limit = {
 								OR = {
									has_trait =	trusting
									has_trait = compassionate
									has_trait = honest
 									number_of_personality_traits < childhood_personality_trait_gain_limit
 								}
 							}
 							add_diplomacy_skill = 1
 							add_intrigue_skill = -1
 						}
 						else = {
							random_list = {
								3 = {
									add_trait = trusting
								}
								3 = {
									add_trait = compassionate
								}
								3 = {
									add_trait = honest
								}
							}
 						}
 					}
                }
            }
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -49
                }
                min = 5
                desc = mpo_events_tova.0001.c.tt.failure
                send_interface_toast = {
                    title = mpo_events_tova.0001.c.tt.failure
                    left_icon = scope:demanding_relation
                    reverse_add_opinion = {
                        target = scope:demanding_relation
                        modifier = insult_opinion 
                        opinion = -25
                    }
 					scope:demanding_relation = {
 						if = {
 							limit = {
 								OR = {
									has_trait =	paranoid
									has_trait = shy
									has_trait = craven
 									number_of_personality_traits < childhood_personality_trait_gain_limit
 								}
 							}
 							add_diplomacy_skill = -1
 							add_intrigue_skill = 1
 						}
 						else = {
							random_list = {
								3 = {
									add_trait = paranoid
								}
								3 = {
									add_trait = shy
								}
								3 = {
									add_trait = craven
								}
							}
 						}
 					}
                }
            }
        }
		stress_impact = {
			base = minor_stress_impact_gain
			just = minor_stress_impact_gain
			honest = minor_stress_impact_gain
			craven = minor_stress_impact_loss
			callous = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -1
			}
		}
	}
}

#Check for province that could be interesting for a Monument Expedition.
scripted_trigger tova_events_2_province_requirements = {
	NOT = {
		culture = root.culture
	}
	has_special_building = yes
	NOR = {
		has_building_or_higher = generic_copper_mines_01
		has_building_or_higher = generic_silver_mines_01
		has_building_or_higher = generic_gold_mines_01
		has_building_with_flag = special_mine
	}
	"squared_distance(root.location)" <= squared_distance_monstrous
}

mpo_events_tova.0002 = { #Hear musician playing unrecognized song about distant home.
	type = character_event
	title = mpo_events_tova.0002.t
	desc = mpo_events_tova.0002.desc

	theme = nomads

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = happiness
	}

	right_portrait = {
		character = scope:musician
		animation = alto_flute_active
	}

	override_background = {
		trigger = {
			is_landed = yes
		}
		reference = corridor_day
	}

	override_background = {
		trigger = {
			is_landed = no
		}
		reference = bp1_bonfire
	}

	trigger = {
		has_mpo_dlc_trigger = yes
		government_has_flag = government_is_nomadic
		is_available = yes
		any_special_building_province = {
			tova_events_2_province_requirements = yes
		}
	}

	immediate = {
		random_special_building_province = {
			limit = {
				tova_events_2_province_requirements = yes
			}
			save_scope_as = journey_province
		}
		if = {
			limit = {
				any_pool_character = {
					province = scope:journey_province
					NOT = {
						culture = scope:journey_province.county.culture
					}
					is_available_ai_adult = yes
				}
			}
			random_pool_character = {
				province = scope:journey_province
				limit = {
					NOT = {
						culture = scope:journey_province.county.culture
					}
					is_available_ai_adult = yes
				}
				save_scope_as = musician
			}
		}
		else = {
			create_character = {
				template = poet_template
				location = root.location
				culture = scope:journey_province.county.culture
				save_scope_as = musician
			}
		}
	}

	option = {	#Talk to musician to discover POI and improve cultural acceptance.
		name = mpo_events_tova.0002.a
		custom_tooltip = mpo_events_tova.0002.a.tt

		add_to_variable_list = {
			name = extra_journey_target
			target = scope:journey_province
		}
		culture = {
			change_cultural_acceptance = {
				target = scope:journey_province.county.culture
				value = minor_cultural_acceptance_gain
				desc = cultural_acceptance_enjoyed_music
			}
		}
		stress_impact = {
			ambitious = minor_stress_impact_loss
			shy = medium_stress_impact_gain
			paranoid = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
			callous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_compassion = 1
			}
		}
	}

	option = { #Recruit musician over shared love of music.
		name = mpo_events_tova.0002.b
		flavor = mpo_events_tova.0002.b.flavor

        duel = {
            skill = learning
            target = scope:musician
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -49
                }
                min = 5
                desc = mpo_events_tova.0002.b.tt.success
                send_interface_toast = {
                    title = mpo_events_tova.0002.b.tt.success
                    left_icon = scope:musician
                    add_courtier = scope:musician
                }
            }
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -49
                }
                min = 5
                desc = mpo_events_tova.0002.b.tt.failure
                send_interface_toast = {
                    title = mpo_events_tova.0002.b.tt.failure
                    left_icon = scope:musician
                    add_prestige = minor_prestige_loss
                }
            }
        }
	}

	option = { #Rest and reduce stress.
		name = mpo_events_tova.0002.c
		
		if = {
			limit = {
				has_trait = impatient
			}
			add_stress = miniscule_stress_loss
		}
		else_if = {
			limit = {
				has_trait = lazy
			}
			add_stress = medium_stress_loss
		}
		else = {
			add_stress = minor_stress_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -1
				ai_greed = -1
			}
		}
	}
}

mpo_events_tova.0003 = { #Peasants mock ruler and face deadly consequences.
	type = character_event
	title = mpo_events_tova.0003.t
	desc = mpo_events_tova.0003.desc

	theme = migration

	override_background = { reference = ep2_hunt_foggy_forest }

	override_effect_2d = {
		reference = fog	
	}

	cooldown = { years = 20 }

	left_portrait = {
		character = scope:peasant_actor_eldest
		animation = prisonhouse
	}
	right_portrait = {
		character = scope:stray_executioner
		animation = menacing
	}
	lower_left_portrait = {
		character = scope:peasant_actor_middle
	}
	lower_right_portrait = {
		character = scope:peasant_actor_youngest
	}

	trigger = {
		has_mpo_dlc_trigger = yes
		government_has_flag = government_is_nomadic
		is_available_travelling_adult = yes
		is_landed = yes
		is_ai = no
		is_location_valid_for_travel_event_on_land = yes
		location = { 
			has_holding = yes
			terrain = forest
		}
		exists = location.county.holder
		location.county.holder = { is_ai = yes }
		NOR = {
			this = location.county.holder
			is_liege_or_above_of = location.county.holder
		}
	}

	immediate = {
		location = {
			save_scope_as = unruly_province
		}
		location.county.holder = {
			save_scope_as = unruly_province_owner
		}
		create_character = {
			template = new_warrior_character
			location = root.location
			culture = scope:unruly_province.culture
			faith = scope:unruly_province.faith
			gender = male
			save_scope_as = stray_executioner
		}
		create_character = {
			template = peasant_character
			location = root.location
			culture = scope:unruly_province.culture
			faith = scope:unruly_province.faith
			gender = female
			age = 57
			save_scope_as = actor_mother
		}
		hidden_effect = {
			scope:actor_mother ?= {
				silent_disappearance_effect = yes
			}
		}
		create_character = {
			template = peasant_character
			location = root.location
			culture = scope:unruly_province.culture
			faith = scope:unruly_province.faith
			gender = male
			age = 63
			save_scope_as = actor_father
		}
		hidden_effect = {
			scope:actor_father ?= {
				silent_disappearance_effect = yes
			}
		}
		create_character = {
			template = bp1_doppelganger_template
			location = root.location
			culture = scope:unruly_province.culture
			faith = scope:unruly_province.faith
			mother = scope:actor_mother
			father = scope:actor_father
			random_traits = yes
			gender = male
			age = 31
			save_scope_as = peasant_actor_eldest
		}
		hidden_effect = {
			scope:peasant_actor_eldest = {
				copy_inheritable_appearance_from = scope:unruly_province_owner
			}
		}
		create_character = {
			template = peasant_character
			location = root.location
			culture = scope:unruly_province.culture
			faith = scope:unruly_province.faith
			mother = scope:actor_mother
			father = scope:actor_father
			random_traits = yes
			gender = male
			age = 28
			save_scope_as = peasant_actor_middle
		}
		create_character = {
			template = peasant_character
			location = root.location
			culture = scope:unruly_province.culture
			faith = scope:unruly_province.faith
			mother = scope:actor_mother
			father = scope:actor_father
			random_traits = yes
			gender = male
			age = 27
			save_scope_as = peasant_actor_youngest
		}
	}

	option = { #Actually, the actors are mine and I want them back.
		name = mpo_events_tova.0003.a
		custom_tooltip = mpo_events_tova.0003.a.tt

        duel = {
            skill = intrigue
            target = scope:stray_executioner
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -49
                }
                min = 5
                desc = mpo_events_tova.0003.a.tt.success
                send_interface_toast = {
                    title = mpo_events_tova.0003.a.tt.success
                    add_courtier = scope:peasant_actor_eldest
                    add_courtier = scope:peasant_actor_middle
                    add_courtier = scope:peasant_actor_youngest
                    root = {
                    	add_character_modifier = {
                    		modifier = charlatan_inspiration
                    		years = 5
                    	}
                    }
 				}
            }
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -49
                }
                min = 5
                desc = mpo_events_tova.0003.a.tt.failure
                send_interface_toast = {
                    title = mpo_events_tova.0003.a.tt.failure
                    left_icon = scope:unruly_province_owner
                    reverse_add_opinion = {
                        target = scope:unruly_province_owner
                        modifier = insult_opinion 
                        opinion = -25
                    }
					scope:peasant_actor_eldest = {
						death = { 
							death_reason = death_execution 
							killer = scope:stray_executioner 
						}
					}
					scope:peasant_actor_middle = {
						death = { 
							death_reason = death_execution 
							killer = scope:stray_executioner 
						}
					}
					scope:peasant_actor_youngest = {
						death = { 
							death_reason = death_execution 
							killer = scope:stray_executioner 
						}
					}
                }
            }
        }
	}

	option = { #Convince the executioner to spare the prisoners' lives.
		name = mpo_events_tova.0003.b
		custom_tooltip = mpo_events_tova.0003.b.tt

        duel = {
            skill = diplomacy
            target = scope:stray_executioner
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -49
                }
                min = 5
                desc = mpo_events_tova.0003.b.tt.success
                send_interface_toast = {
                    title = mpo_events_tova.0003.b.tt.success
                    left_icon = scope:unruly_province_owner
                    add_prestige = medium_prestige_gain
                    add_piety = medium_piety_gain
                }
            }
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -49
                }
                min = 5
                desc = mpo_events_tova.0003.b.tt.failure
                send_interface_toast = {
                    title = mpo_events_tova.0003.b.tt.failure
                    left_icon = scope:unruly_province_owner
                    reverse_add_opinion = {
                        target = scope:unruly_province_owner
                        modifier = insult_opinion 
                        opinion = -25
                    }
					scope:peasant_actor_eldest = {
						death = { 
							death_reason = death_execution 
							killer = scope:stray_executioner 
						}
					}
					scope:peasant_actor_middle = {
						death = { 
							death_reason = death_execution 
							killer = scope:stray_executioner 
						}
					}
					scope:peasant_actor_youngest = {
						death = { 
							death_reason = death_execution 
							killer = scope:stray_executioner 
						}
					}
                }
            }
        }
	}

	option = { #I have places to be.
		name = mpo_events_tova.0003.c

		scope:peasant_actor_eldest = {
			death = { 
				death_reason = death_execution 
				killer = scope:stray_executioner 
			}
		}
		scope:peasant_actor_middle = {
			death = { 
				death_reason = death_execution 
				killer = scope:stray_executioner 
			}
		}
		scope:peasant_actor_youngest = {
			death = { 
				death_reason = death_execution 
				killer = scope:stray_executioner 
			}
		}

		current_travel_plan = {
			add_travel_plan_modifier = travel_speed_actor
		}
		
		if = {
			limit = {
				root.faith = {
					religion_tag = christianity_religion
				}
				has_trait = zealous
			}
			add_stress = medium_stress_loss
		}
		else_if = {
			limit = {
				NOT = {
					has_trait = sadistic
					has_trait = vengeful
					has_trait = compassionate
				}
			}
			add_stress = medium_stress_gain
		}
		else = {
			stress_impact = {
				sadistic = minor_stress_impact_loss
				vengeful = minor_stress_impact_loss
				compassionate = major_stress_impact_gain
			}
		}
	}
	after = {
		scope:stray_executioner = {
			silent_disappearance_effect = yes		
		}
	}
}

mpo_events_tova.0004 = { #Rank Disloyalty
	type = character_event
	title = mpo_events_tova.0004.t
	desc = mpo_events_tova.0004.desc

	theme = migration

	override_background = {
		reference = bp1_bonfire
	}
	cooldown = { years = 20 }

	left_portrait = {
		character = root
		animation = anger
	}

	right_portrait = {
		character = scope:maa_leader
		animation = drink
	}

	trigger = {
		has_mpo_dlc_trigger = yes
		government_has_flag = government_is_nomadic
		is_available_travelling_adult = yes
		is_landed = yes
		is_ai = no
		is_location_valid_for_travel_event_on_land = yes
		exists = location.county.holder
		location.county.holder = root
		location = {
			has_stationed_regiment = yes
		}
		location.county = {
			county_opinion <= -10
		}
	}

	immediate = {
		location = {
			save_scope_as = maa_province
		}
		create_character = {
			template = new_warrior_character
			location = root.location
			culture = root.culture
			faith = root.faith
			trait = drunkard
			gender = male
			save_scope_as = maa_leader
		}
	}

	option = { #Stricter rations will teach them dicipline.
		name = mpo_events_tova.0004.a
		flavor = mpo_events_tova.0004.a.flavor
		custom_tooltip = mpo_events_tova.0004.a.tt

		add_short_term_gold = medium_gold_value

		scope:maa_province = {
			add_province_modifier = {
				modifier = sold_provisions
				years = 5
			}
		}

		stress_impact = {
			greedy = medium_stress_impact_loss
		}

		hidden_effect = {
			random = {
				chance = 15
				trigger_event = {
					ID = mpo_events_tova.0006
					days = { 2 3 }
				}
			}		
		}
	}
	option = { #I will have the leader's head.
		name = mpo_events_tova.0004.b
		custom_tooltip = mpo_events_tova.0004.b.tt

		scope:maa_province = {
			add_province_modifier = {
				modifier = diminished_regiment
				years = 5
			}
		}
		add_character_modifier = {
			modifier = reluctant_recruits
			years = 5
		}

		if = {
			limit = {
				OR = {
					has_trait = sadistic
					has_trait = vengeful
					has_trait = wrathful
				}
			}
			add_stress = medium_stress_loss
		}
		else_if = {
			limit = {
				OR = {
					has_trait = forgiving
					has_trait = compassionate
					has_trait = calm
				}
			}
			add_stress = medium_stress_gain
		}
		else = {
			add_stress = minor_stress_gain
		}
	}
	option = { #I will pay for better provisions.
		name = mpo_events_tova.0004.c

		remove_treasury_or_gold = medium_treasury_or_gold_value

		add_character_modifier = {
			modifier = celebrated_leader
			years = 5
		}

		stress_impact = {
			greedy = medium_stress_impact_gain
			generous = medium_stress_impact_loss
		}
        ai_chance = {
            base = 1
            modifier = {
            	treasury_or_gold <= major_treasury_or_gold_value
                factor = 0
            }
        }
	}
	after = {
		scope:maa_leader = {
			silent_disappearance_effect = yes
		}
	}
}

mpo_events_tova.0005 = { #Happy Soldiers
	title = mpo_events_tova.0005.t
	desc = mpo_events_tova.0005.desc
	type = character_event

	theme = migration

	override_background = { reference = bp1_bonfire }
	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = happiness
	}

	right_portrait = {
		character = scope:maa_happy_leader
		animation = drink
	}

	trigger = {
		has_mpo_dlc_trigger = yes
		government_has_flag = government_is_nomadic
		is_available_travelling_adult = yes
		is_landed = yes
		is_ai = no
		is_location_valid_for_travel_event_on_land = yes
		days_of_continuous_peace = 365
		exists = location.county.holder
		location.county.holder = root
		location = {
			has_stationed_regiment = yes
		}
		location.county = {
			county_opinion >= 10
		}
	}

	immediate = {
		location = {
			save_scope_as = maa_happy_province
		}
		create_character = {
			template = new_warrior_character
			location = root.location
			culture = root.culture
			faith = root.faith
			gender = male
			save_scope_as = maa_happy_leader
		}
	}

	option = { #Whip the lazy bums into shape
		name = mpo_events_tova.0005.a

		scope:maa_happy_province = {
			add_province_modifier = {
				modifier = whipped_soldiers
				years = 5
			}
		}

		stress_impact = {
			patient = medium_stress_impact_gain
			calm = medium_stress_impact_gain
		}
	}

	option = { #Dicipline them for not being vigilant.
		name = mpo_events_tova.0005.b

		add_character_modifier = {
			modifier = alert_soldiers
			years = 5
		}
		stress_impact = {
			patient = medium_stress_impact_gain
			calm = medium_stress_impact_gain
		}
	}

	option = { #Take their happiness and kind words to heart.
		name = mpo_events_tova.0005.c

		stress_impact = {
			base = major_stress_loss
			paranoid = minor_stress_impact_gain
		}
	}
}

mpo_events_tova.0006 = { #Just Desserts
	opening = mpo_events_tova.0006.t
	desc = mpo_events_tova.0006.desc
	type = letter_event

	sender = scope:sender

	immediate = {
		if = {
			limit = {
				exists = cp:councillor_steward
			}
			cp:councillor_steward = {
				save_scope_as = sender
			}
		}
		else_if = {
			limit = {
				exists = cp:councillor_marshal
			}
			cp:councillor_marshal = {
				save_scope_as = sender
			}
		}
		else_if = {
			limit = {
				exists = cp:councillor_chancellor
			}
			cp:councillor_chancellor = {
				save_scope_as = sender
			}
		}
	}

	trigger = {
		OR = {
			exists = cp:councillor_steward
			exists = cp:councillor_marshal
			exists = cp:councillor_chancellor
		}
	}

	option = { #Hunger makes men desperate, it seems.
		name = mpo_events_tova.0006.a

		scope:maa_province.county = {
			change_development_level = -2
		}
	}
}

mpo_events_tova.0025 = { # You are invited to a knucklebone shooting game
	type = character_event
	title = mpo_events_tova.0025.t
	desc = mpo_events_tova.0025.desc

	theme = nomads

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = interested
	}
	
	right_portrait = {
		character = scope:challenger_anda
		animation = hero_flex
	}

	trigger = {
		has_mpo_dlc_trigger = yes
		government_has_flag = government_is_nomadic
		culture = {
			OR = {
				has_cultural_pillar = heritage_mongolic
				has_cultural_pillar = heritage_turkic
			}
		}
		is_available_adult = yes
		any_courtier = {
			has_relation_blood_brother = root
			is_available_ai_adult = yes
		}
	}
	
	immediate = {
		random_courtier = {
			limit = {
				has_relation_blood_brother = root
				is_available_ai_adult = yes
			}
			save_scope_as = challenger_anda
		}
	}

	option = { # I will outsmart them all!
		name = mpo_events_tova.0025.a
        duel = {
            skill = intrigue
            target = scope:challenger_anda
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -49
                }
                min = 5
                desc = mpo_events_tova.0025.a.tt.success
                send_interface_toast = {
                    title = mpo_events_tova.0025.a.tt.success
                    left_icon = root
                    right_icon = scope:challenger_anda
 					reverse_add_opinion = {
						target = scope:challenger_anda
 						modifier = impressed_opinion
 						opinion = 25
 					}
 					add_character_modifier = {
 						modifier = mpo_sharp_wits_modifier
 						years = 10
 					}
 					stress_impact = {
 						deceitful = minor_stress_loss
 					}
                }
            }
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -49
                }
                min = 5
                desc = mpo_events_tova.0025.a.tt.failure
                send_interface_toast = {
                    title = mpo_events_tova.0025.a.tt.failure
                    left_icon = root
                    reverse_add_opinion = {
                        target = scope:challenger_anda
                        modifier = disappointed_opinion
                        opinion = -25
                    }
                    add_prestige = minor_prestige_loss
        			stress_impact = {
        				just = minor_stress_gain
        				honest = minor_stress_gain
        			}
                }
            }
        }
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -2
				ai_compassion = -1
				ai_rationality = -1
				ai_boldness = -1				
			}
		}
	}

	option = { # I will crush my opponents' tokens!
		name = mpo_events_tova.0025.b
        duel = {
            skill = prowess
            target = scope:challenger_anda
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -49
                }
                min = 5
                desc = mpo_events_tova.0025.b.tt.success
                send_interface_toast = {
                    title = mpo_events_tova.0025.b.tt.success
                    left_icon = root
                    right_icon = scope:challenger_anda
 					reverse_add_opinion = {
						target = scope:challenger_anda
 						modifier = impressed_opinion
 						opinion = 25
 					}
 					add_character_modifier = {
 						modifier = mpo_thunder_knuckles_modifier
 						years = 10
 					}
        			stress_impact = {
        				ambitious = medium_stress_impact_loss
        				
        			}
                }
            }
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -49
                }
                min = 5
                desc = mpo_events_tova.0025.b.tt.failure
                send_interface_toast = {
                    title = mpo_events_tova.0025.b.tt.failure
                    left_icon = scope:challenger_anda
                    reverse_add_opinion = {
                        target = scope:challenger_anda
                        modifier = disappointed_opinion
                        opinion = -25
                    }
                    add_prestige = minor_prestige_loss
        			stress_impact = {
        				brave = minor_stress_impact_gain
        				ambitious = minor_stress_impact_gain
        			}
                }
            }
        }
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 1
				ai_sociability = 0.5
			}
			modifier = {
				OR = {
					has_trait = lazy
					has_trait = craven
				}
				factor = 0
			}
		}		
	}

	option = { # Nah
		name = mpo_events_tova.0025.c
		ai_chance = {
			base = 100
			modifier = {
				has_trait = lazy
				factor = 20
			}
		}
	}
}

mpo_events_tova.0030 = { # No astrologer? Someone comes to you with a vision
	type = character_event
	title = mpo_events_tova.0030.t
	desc = {
		desc = mpo_events_tova.0030.desc
		random_valid = {
			desc = mpo_events_tova.0030.desc_red
			desc = mpo_events_tova.0030.desc_white
			desc = mpo_events_tova.0030.desc_green
		}
		desc = mpo_events_tova.0030.desc_outro
	}

	theme = nomads
	override_background = { reference = mpo_steppe_evening }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = interested
	}
	
	right_portrait = {
		character = scope:visionary
		animation = personality_zealous
	}

	trigger = {
		has_mpo_dlc_trigger = yes
		government_has_flag = government_is_nomadic
		is_available_adult = yes
		NOT = {
			employs_court_position = court_astrologer_court_position
		}
		any_courtier_or_guest = {
			is_available_ai_adult = yes
			is_close_family_or_spouse_of_root_trigger = no
			can_be_employed_as = court_astrologer_court_position
		}

	}
	
	immediate = {
		ordered_courtier = {
			limit = {
				is_available_ai_adult = yes
				is_close_family_or_spouse_of_root_trigger = no
				can_be_employed_as = court_astrologer_court_position
			}
			order_by = {
				value = learning
				if = {
					limit = { has_trait = lifestyle_mystic }
					add = 2
				}
			}
			if = {
				limit = {
					NOT = { has_trait = lifestyle_mystic }
				}
				add_trait = lifestyle_mystic
			}
			else = {
				add_learning_skill = 2
			}
			save_scope_as = visionary
		}
	}

	option = { # You are truly blessed with special talents!
		name = mpo_events_tova.0030.a
		add_hook = {
			target = scope:visionary
			type = obligation_hook
		}
		custom_tooltip = obligation_hook_tt
		court_position_grant_effect = {
			EMPLOYER = root
			POS = court_astrologer
			CANDIDATE = scope:visionary
		}
 		reverse_add_opinion = {
			target = scope:visionary
 			modifier = grateful_opinion
 			opinion = 30
 		}		

		stress_impact = {
			zealous = minor_stress_impact_loss
			cynical = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
				ai_zeal = 1
			}
			modifier = {
				factor = 0
				has_trait = cynical
			}
		}
	}

	option = { # The heavens must favor me and my deeds
		name = mpo_events_tova.0030.b
		if = {
			limit = {
				has_focus_martial = yes
			}
			add_character_modifier = {
				modifier = mpo_heavens_favor_martial_modifier
				years = 10
			}
		}
		else_if = {
			limit = {
				has_focus_intrigue = yes
			}
			add_character_modifier = {
				modifier = mpo_heavens_favor_modifier
				years = 10
			}
		}
		else_if = {
			limit = {
				has_focus_diplomacy = yes
			}
			add_character_modifier = {
				modifier = mpo_heavens_favor_diplo_modifier
				years = 10
			}
		}
		else = {
			add_legitimacy = medium_legitimacy_gain
		}

		stress_impact = {
			zealous = minor_stress_impact_loss
			cynical = medium_stress_impact_gain
		}

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

	option = { # What a story!
		name = mpo_events_tova.0030.c
		stress_impact = {
			base = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -1
			}
		}
	}
}

mpo_events_tova.0035 = { # Anda comes to you with marital concerns
	type = character_event
	title = mpo_events_tova.0035.t
	desc = mpo_events_tova.0035.desc

	theme = nomads
	override_background = { reference = mpo_tent_interior_mongol }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = shock
	}
	
	right_portrait = {
		character = scope:distressed_anda
		animation = worry
	}

	lower_right_portrait = {
		character = scope:pregnant_woman
	}

	trigger = {
		has_mpo_dlc_trigger = yes
		government_has_flag = government_is_nomadic
		is_available_adult = yes
		any_courtier = {
			has_relation_blood_brother = root
			is_available_ai_adult = yes
			is_close_family_or_spouse_of_root_trigger = no
			is_married = yes
			is_male = yes
			is_attracted_to_women = yes
			primary_spouse = {
				can_have_children = yes
				is_available_ai = yes
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 3
			any_courtier = {
				has_relation_blood_brother = root
				is_available_ai_adult = yes
				is_close_family_or_spouse_of_root_trigger = no
				is_married = yes
				is_male = yes
				is_attracted_to_women = yes
				primary_spouse = {
					is_pregnant = yes
				}
			}			
		}
		modifier = {
			add = -0.5
			any_courtier = {
				has_relation_blood_brother = root
				is_available_ai_adult = yes
				is_close_family_or_spouse_of_root_trigger = no
				is_married = yes
				is_male = yes
				is_attracted_to_women = yes
				primary_spouse = {
					is_pregnant = no
				}
			}
		}
	}
	
	immediate = {
		random_courtier = {
			limit = {
				has_relation_blood_brother = root
				is_available_ai_adult = yes
				is_close_family_or_spouse_of_root_trigger = no
				is_married = yes
				is_male = yes
				is_attracted_to_women = yes
				primary_spouse = {
					can_have_children = yes
					is_available_ai = yes
				}
			}
			save_scope_as = distressed_anda
		}
		scope:distressed_anda = {
			primary_spouse = {
				save_scope_as = pregnant_woman
			}
		}
		hidden_effect = {
			scope:pregnant_woman = {
				if = {
					limit = {
						NOT = {
							has_trait = pregnant
						}
					}
					make_pregnant = { father = scope:distressed_anda }
				}
			}
		}
	}

	option = { # Rejoice! The heavens sent you a child.
		name = mpo_events_tova.0035.a
		custom_tooltip = mpo_events_tova.0035.a.tt
		add_piety = medium_piety_gain
 		reverse_add_opinion = {
			target = scope:pregnant_woman
 			modifier = grateful_opinion
 			opinion = 30
 		}
 		hidden_effect = {
	 		random = {
	 			chance = 33
	  			scope:pregnant_woman = {
	 				add_character_flag = blessed_baby
	 			}
	 		}
 		}
 		stress_impact = {
 			cynical = medium_stress_impact_gain
 		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = cynical
				factor = 0
			}
			ai_value_modifier = {
				ai_zeal = 1
			}
		}
	}

	option = { # Blatant lies!
		name = mpo_events_tova.0035.b
		scope:distressed_anda = {
			divorce_effect = {
				DIVORCER = scope:distressed_anda
				DIVORCEE = scope:pregnant_woman
			}
			random = {
				chance = 33
				if = {
					limit = {
						NOT = {
							has_trait = shrewd
						}
					}
					add_trait = shrewd
				}
				else = { add_intrigue_skill = 2 }
			}
		}
 		reverse_add_opinion = {
			target = scope:distressed_anda
 			modifier = grateful_opinion
 			opinion = 30
 		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -1
			}
			modifier = {
				has_trait = compassionate
				factor = 0
			}
		}
	}

	option = { # That is the funniest thing I ever heard!
		name = mpo_events_tova.0035.c
		stress_impact = {
			base = medium_stress_impact_loss
			compassionate = medium_stress_impact_gain
			trusting = medium_stress_impact_gain
		}
 		reverse_add_opinion = {
			target = scope:distressed_anda
 			modifier = insulted_opinion
 			opinion = -30
 		}

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

mpo_events_tova.0045 = { # Anda comes bearing gifts
	type = character_event
	title = mpo_events_tova.0045.t
	desc = {
		desc = mpo_events_tova.0045.desc
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:knucklebone_gift }
				desc = mpo_events_tova.0045.desc_knucklebone
			}
			triggered_desc = {
				trigger = { exists = scope:herd_gift }
				desc = mpo_events_tova.0045.desc_herd
			}
			desc = mpo_events_tova.0045.desc_axe
		}
	}

	theme = nomads
	override_background = { reference = mpo_campfire_steppe }

	cooldown = { years = 10 }

	left_portrait = {
		character = root
		animation = happiness
	}
	
	right_portrait = {
		character = scope:generous_anda
		triggered_animation = {
			trigger = {
				exists = scope:knucklebone_gift
			}
			animation = steward
		}
		triggered_animation = {
			trigger = {
				exists = scope:herd_gift
			}
			animation = admiration
		}
		animation = marshal_axe
	}

	trigger = {
		has_mpo_dlc_trigger = yes
		government_has_flag = government_is_nomadic
		culture = {
			OR = {
				has_cultural_pillar = heritage_mongolic
				has_cultural_pillar = heritage_turkic
			}
		}
		is_available_adult = yes
		any_courtier = {
			has_relation_blood_brother = root
			is_available_ai_adult = yes
			is_close_family_or_spouse_of_root_trigger = no
		}
		NOT = {
			AND = {
				has_character_flag = knucklebone_gift
				has_character_flag = herd_gift
				has_character_flag = axe_gift
			}
		}
	}
	
	immediate = {
		random_courtier = {
			limit = {
				has_relation_blood_brother = root
				is_available_ai_adult = yes
				is_close_family_or_spouse_of_root_trigger = no
			}
			save_scope_as = generous_anda
		}
		random_list = {
			3 = {
				trigger = {
					NOT = {
						has_character_flag = knucklebone_gift
					}
				}
 				hidden_effect = {
 					create_artifact = {
					name = gifted_bone_name
					description = gifted_bone_desc
					modifier = artifact_monthly_prestige_3_modifier
					type = miscellaneous
					visuals = pocket_pouch
					save_scope_as = gift
					}
 				}
				add_character_flag = knucklebone_gift
				save_scope_as = knucklebone_gift
			}
			3 = {
				trigger = {
					NOT = {
						has_character_flag = herd_gift
						domicile = {
							herd >= major_herd_value
						}
					}
				}
				add_character_flag = herd_gift
				save_scope_as = herd_gift
			}
			3 = {
				trigger = {
					NOT = {
						has_character_flag = axe_gift
					}
				}
 				hidden_effect = {
 					create_artifact = {
					name = gifted_axe_name
					description = gifted_axe_desc
					modifier = artifact_prowess_3_modifier
					type = axe
					visuals = axe
					save_scope_as = gift
					}
 				}
				add_character_flag = axe_gift
			}
		}
	}

	option = { # I will treasure this gift.
		name = mpo_events_tova.0045.a
		if = {
			limit = {
				exists = scope:gift
			}
	    	send_interface_toast = {
				title = mpo_events_tova.0045.a.equipped_tt
			    left_icon = root
			    right_icon = scope:gift
			    scope:gift = {
			    	set_variable = {
						name = suppress_artifact_notifications
						value = yes
						days = 1
					}
			        set_owner = {
			        	target = root
						history = {
							location = root.capital_province
							actor = scope:generous_anda
							recipient = root
							type = given
						}
					}
				}
			}
		}
		else = {
            domicile ?= { change_herd = medium_herd_gain }
		}

		stress_impact = {
			greedy = medium_stress_loss
		}

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

	option = { # Your friendship is the only gift I need.
		name = mpo_events_tova.0045.b
		if = {
			limit = {
				exists = scope:gift
			}
	    	send_interface_toast = {
				title = mpo_events_tova.0045.a.equipped_tt
			    left_icon = scope:generous_anda
			    right_icon = scope:gift
			    scope:gift = {
			    	set_variable = {
						name = suppress_artifact_notifications
						value = yes
						days = 1
					}
			        set_owner = {
			        	target = scope:generous_anda
						history = {
							location = root.capital_province
							actor = scope:generous_anda
							recipient = scope:generous_anda
							type = given
						}
					}
				}
			}
		}
 		reverse_add_opinion = {
			target = scope:generous_anda
 			modifier = grateful_opinion
 			opinion = 30
 		}

		stress_impact = {
			base = medium_stress_impact_loss
			greedy = major_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -1
				ai_sociability = 0.5
			}
		}
	}
}
