﻿namespace = study_confucian_classics_outcome

######################
# Success Outcomes
######################

# Miniscule merit
study_confucian_classics_outcome.1 = {
	hidden = yes

	immediate = {
		send_interface_toast = {
			type = study_scheme_good_message
			title = study_confucian_classics_outcome_merit
			change_merit = miniscule_merit_gain
			left_icon = root
		}
	}
}

# Small stress
study_confucian_classics_outcome.2 = {
	hidden = yes

	immediate = {
		send_interface_toast = {
			type = study_scheme_bad_message
			title = study_confucian_classics_outcome_stress
			add_stress = miniscule_stress_impact_gain
			scope:scheme = {
				add_scheme_modifier = {
					type = tgp_persistent_studies_modifier
					years = 2
				}
			}
			left_icon = root
		}
	}
}

# Minor Confucian Education XP
study_confucian_classics_outcome.3 = {
	hidden = yes
	
	trigger = {
		has_trait = confucian_education
		has_trait_xp = {
			trait = confucian_education
			value < 100
		}
	}

	immediate = {
		send_interface_toast = {
			type = study_scheme_good_message
			title = study_confucian_classics_outcome_merit
			add_trait_xp = {
				trait = confucian_education
				value = { 1 3 }
			}
			left_icon = root
		}
	}
}

# Minor Poet XP
study_confucian_classics_outcome.4 = {
	hidden = yes
	
	trigger = {
		has_trait = lifestyle_poet
		has_trait_xp = {
			trait = lifestyle_poet
			value < 100
		}
	}

	immediate = {
		send_interface_toast = {
			type = study_scheme_good_message
			title = study_confucian_classics_outcome_poetry
			add_trait_xp = {
				trait = lifestyle_poet
				value = { 1 3 }
			}
			left_icon = root
		}
	}
}

# Intro Event
study_confucian_classics_outcome.10 = {
	type = character_event
	window = big_event_window
	title = study_confucian_classics_outcome.10.t
	desc = study_confucian_classics_outcome.10.desc
	theme = education
	center_portrait = {
		character = root
		animation = holding_scrolls
		camera = camera_body_right
	}
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	trigger = {
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
	}

	option = {
		name = study_confucian_classics_outcome.10.a
		trigger = {
			is_landed = no
		}
		show_as_unavailable = { always = yes }
		add_character_modifier = {
			modifier = tgp_focused_studies_personal_modifier
			years = 5
		}
		scope:scheme = {
			add_scheme_modifier = {
				type = tgp_focused_studies_modifier
				years = 5
			}
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.10.b
		add_character_modifier = {
			modifier = tgp_dignified_studies_personal_modifier
			years = 5
		}
		scope:scheme = {
			add_scheme_modifier = {
				type = tgp_dignified_studies_modifier
				years = 5
			}
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.10.c
		custom_tooltip = no_change_study_tt
		ai_chance = {
			base = 100
		}
	}

	# for the tutorial, to wait for this event to be finished
	after = {
		add_character_flag = study_scheme_intensity_chosen
	}
}

# Gain an Exam Advantage
study_confucian_classics_outcome.100 = {
	type = character_event
	window = scheme_successful_event
	title = study_confucian_classics_outcome.100.t
	desc = study_confucian_classics_outcome.100.desc
	theme = education
	left_portrait = {
		character = root
		animation = page_flipping
		camera = camera_body_right
	}
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		NOT = { has_variable = has_exam_advantage }
		OR = {
			NOT = { has_character_flag = passed_provincial_exam }
			NOT = { has_character_flag = passed_metropolitan_exam }
			NOT = { has_character_flag = passed_palace_exam }
		}
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
	}

	option = {
		name = study_confucian_classics_outcome.100.a
		custom_tooltip = preparatory.imperial_examination.advantage.tt
		imperial_examination_adjust_advantage_variable_effect = yes
		stress_impact = {
			base = medium_stress_impact_gain
			diligent = medium_stress_impact_loss
			patient = medium_stress_impact_loss
			stubborn = minor_stress_impact_loss
			impatient = medium_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.100.b
		if = {
			limit = { has_trait = confucian_education }
			add_trait_xp = {
				trait = confucian_education
				value = { 1 3 }
			}
		}
		else = {
			random = {
				chance = root.learning
				add_trait = confucian_education
			}
		}
		stress_impact = {
			base = minor_stress_impact_gain
			diligent = minor_stress_impact_loss
			patient = minor_stress_impact_loss
			impatient = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.100.c
		
		stress_impact = {
			base = minor_stress_impact_loss
			lazy = medium_stress_impact_loss
			diligent = medium_stress_impact_gain
			stubborn = minor_stress_impact_gain
		}
		ai_chance = {
			base = 0
		}
	}
}

# Become a Poet
study_confucian_classics_outcome.200 = {
	type = character_event
	window = scheme_successful_event
	title = study_confucian_classics_outcome.200.t
	desc = study_confucian_classics_outcome.200.desc
	theme = education
	left_portrait = {
		character = root
		animation = chancellor
		camera = camera_body_right
	}
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		NOT = { has_trait = lifestyle_poet }
		top_liege = {
			any_vassal_or_below = {
				has_trait = lifestyle_poet
				is_physically_able_ai_adult = yes
			}
		}
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
		top_liege = {
			random_vassal_or_below = {
				limit = {
					has_trait = lifestyle_poet
					is_physically_able_ai_adult = yes
				}
				save_scope_as = poet
			}
		}
	}

	option = {
		name = study_confucian_classics_outcome.200.a
		
		add_trait = lifestyle_poet
		
		stress_impact = {
			base = medium_stress_impact_gain
			diligent = medium_stress_impact_loss
			patient = medium_stress_impact_loss
			stubborn = minor_stress_impact_loss
			impatient = medium_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.200.b
		
		duel = {
			skill = learning
			value = medium_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				add_trait = lifestyle_poet
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
			}
		}
		
		stress_impact = {
			impatient = minor_stress_impact_loss
			arrogant = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.200.c
		
		progress_towards_friend_effect = {
			REASON = friend_praised_privately
			CHARACTER = scope:poet
			OPINION = 30
		}
		
		stress_impact = {
			gregarious = minor_stress_impact_loss
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.200.d
		
		change_merit = miniscule_merit_gain
		
		stress_impact = {
			diligent = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}
}

# Become a Poet
study_confucian_classics_outcome.300 = {
	type = character_event
	window = scheme_successful_event
	title = study_confucian_classics_outcome.300.t
	desc = study_confucian_classics_outcome.300.desc
	theme = education
	override_background = { reference = garden }
	left_portrait = {
		character = root
		animation = writing
		camera = camera_event_center_away
	}
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		has_trait = lifestyle_poet
		exists = location.county
		has_trait_xp = {
			trait = lifestyle_poet
			value < 100
		}
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
		location.county.title_province = {
			save_scope_as = location_province
		}
	}

	option = {
		name = study_confucian_classics_outcome.300.a
		
		add_trait_xp = {
			trait = lifestyle_poet
			value = { 15 30 }
		}
		
		stress_impact = {
			base = minor_stress_impact_gain
			diligent = minor_stress_impact_loss
			patient = minor_stress_impact_loss
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.300.b
		
		add_trait_xp = {
			trait = lifestyle_poet
			value = { 5 10 }
		}
		
		stress_impact = {
			lazy = minor_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.300.c
		
		change_merit = miniscule_merit_gain
		
		stress_impact = {
			diligent = minor_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
		}
	}
}

# Gain Confucian Education
study_confucian_classics_outcome.110 = {
	type = character_event
	window = scheme_successful_event
	title = study_confucian_classics_outcome.110.t
	desc = study_confucian_classics_outcome.110.desc
	theme = education
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = reading
		camera = camera_body
	}
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		NOT = { has_trait = confucian_education }
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
		location.county.title_province = {
			save_scope_as = location_province
		}
	}

	option = {
		name = study_confucian_classics_outcome.110.a
		
		add_trait = confucian_education
		
		stress_impact = {
			base = minor_stress_impact_gain
			diligent = minor_stress_impact_loss
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.110.b
		
		duel = {
			skills = { learning stewardship diplomacy }
			value = medium_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				add_trait = confucian_education
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				change_merit = minor_merit_value
			}
		}
		
		stress_impact = {
			diligent = minor_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
		}
	}
}

# Gain Confucian Education XP
study_confucian_classics_outcome.120 = {
	type = character_event
	window = scheme_successful_event
	title = study_confucian_classics_outcome.120.t
	desc = study_confucian_classics_outcome.120.desc
	theme = education
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = reading
		camera = camera_body_left
	}
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		has_trait = confucian_education
		
		has_trait_xp = {
			trait = confucian_education
			value < 100
		}
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
		location.county.title_province = {
			save_scope_as = location_province
		}
	}

	option = {
		name = study_confucian_classics_outcome.120.a
		
		duel = {
			skills = { learning stewardship diplomacy }
			value = medium_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = confucian_xp_high_tt
					left_icon = root
					add_trait_xp = {
						trait = confucian_education
						value = { 7 10 }
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = confucian_xp_low_tt
					left_icon = root
					add_trait_xp = {
						trait = confucian_education
						value = { 1 3 }
					}
				}
			}
		}
		
		stress_impact = {
			base = medium_stress_impact_gain
			diligent = medium_stress_impact_loss
			impatient = medium_stress_impact_loss
			patient = medium_stress_impact_gain
			lazy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.120.b
		
		add_trait_xp = {
			trait = confucian_education
			value = { 4 6 }
		}
		
		stress_impact = {
			base = minor_stress_impact_gain
			diligent = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.120.c
		
		add_trait_xp = {
			trait = confucian_education
			value = { 1 3 }
		}
		
		stress_impact = {
			diligent = minor_stress_impact_gain
			patient = minor_stress_impact_loss
			impatient = miniscule_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
		}
	}
}

# Gain Learning Skill
study_confucian_classics_outcome.130 = {
	type = character_event
	window = scheme_successful_event
	title = study_confucian_classics_outcome.130.t
	desc = study_confucian_classics_outcome.130.desc
	theme = education
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = worry
		camera = camera_body_right
	}
	right_portrait = {
		character = scope:servant
		animation = serving_tray
		camera = camera_body_left_slight
	}
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		learning < 8
		any_courtier_or_guest = {
			learning >= 8
			is_physically_able_ai_adult = yes
			NOT = { has_relation_rival = root }
			has_trait_malicious_trigger = no
		}
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
		random_courtier_or_guest = {
			limit = {
				learning >= 8
				is_physically_able_ai_adult = yes
				NOT = { has_relation_rival = root }
				has_trait_malicious_trigger = no
			}
			save_scope_as = servant
		}
	}

	option = {
		name = study_confucian_classics_outcome.130.a
		
		add_learning_skill = 1
		
		reverse_add_opinion = {
			modifier = grateful_opinion
			target = scope:servant
			opinion = 20
		}
		
		stress_impact = {
			base = minor_stress_impact_gain
			diligent = minor_stress_impact_loss
			humble = minor_stress_impact_loss
			lazy = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.130.b
		
		progress_towards_friend_effect = {
			REASON = friend_helped_me
			CHARACTER = scope:servant
			OPINION = 30
		}
		
		stress_impact = {
			base = minor_stress_impact_loss
			diligent = medium_stress_impact_gain
			trusting = minor_stress_impact_gain
		}
		ai_chance = {
			base = 0
		}
	}
}

# Gain Diplomacy Skill
study_confucian_classics_outcome.140 = {
	type = character_event
	window = scheme_successful_event
	title = study_confucian_classics_outcome.140.t
	desc = study_confucian_classics_outcome.140.desc
	theme = education
	override_background = relaxing_room
	left_portrait = {
		character = root
		animation = pondering
		camera = camera_body_right
	}
	lower_left_portrait = scope:diplomatic_vassal
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		diplomacy < 8
		top_liege = {
			any_vassal_or_below = {
				diplomacy >= 8
				is_physically_able_ai_adult = yes
				NOT = { has_relation_rival = root }
				has_trait_malicious_trigger = no
			}
		}
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
		top_liege = {
			random_vassal_or_below = {
				limit = {
					diplomacy >= 8
					is_physically_able_ai_adult = yes
					NOT = { has_relation_rival = root }
					has_trait_malicious_trigger = no
				}
				weight = {
					base = 1
					modifier = {
						add = diplomacy
					}
					modifier = {
						add = 200
						diplomacy >= 20
					}
					modifier = {
						add = 50
						has_trait = diplomat
					}
				}
				save_scope_as = diplomatic_vassal
			}
		}
	}

	option = {
		name = study_confucian_classics_outcome.140.a
		
		add_diplomacy_skill = 1
		
		stress_impact = {
			base = minor_stress_impact_gain
			humble = minor_stress_impact_loss
			gregarious = minor_stress_impact_loss
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.140.b
		
		change_merit = minor_merit_value
		stress_impact = {
			gregarious = medium_stress_impact_gain
			trusting = minor_stress_impact_gain
		}
		ai_chance = {
			base = 0
		}
	}
}

# Gain Stewardship Skill
study_confucian_classics_outcome.150 = {
	type = character_event
	window = scheme_successful_event
	title = study_confucian_classics_outcome.150.t
	desc = study_confucian_classics_outcome.150.desc
	theme = education
	override_background = { reference = terrain } 
	left_portrait = {
		character = root
		animation = survey
		camera = camera_event_left_away_3_4_far
	}
	right_portrait = {
		character = scope:servant
		animation = happy_teacher
		camera = camera_event_left_away
	}
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		stewardship < 8
		exists = location.county
		any_courtier_or_guest = {
			stewardship >= 8
			is_physically_able_ai_adult = yes
			NOT = { has_relation_rival = root }
			has_trait_malicious_trigger = no
		}
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
		location.county.title_province = {
			save_scope_as = location_province
		}
		random_courtier_or_guest = {
			limit = {
				stewardship >= 8
				is_physically_able_ai_adult = yes
				NOT = { has_relation_rival = root }
				has_trait_malicious_trigger = no
			}
			weight = {
				base = 1
				modifier = {
					add = stewardship
				}
				modifier = {
					add = 200
					stewardship >= 16
				}
			}
			save_scope_as = servant
		}
	}

	option = {
		name = study_confucian_classics_outcome.150.a
		
		add_stewardship_skill = 1
		
		progress_towards_friend_effect = {
			REASON = friend_helped_me
			CHARACTER = scope:servant
			OPINION = 0
		}
		
		stress_impact = {
			base = minor_stress_impact_gain
			diligent = minor_stress_impact_loss
			arrogant = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.150.b
		
		stress_impact = {
			base = minor_stress_impact_loss
			diligent = minor_stress_impact_gain
		}
		ai_chance = {
			base = 0
		}
	}
}

# Gain Merit
study_confucian_classics_outcome.160 = {
	type = character_event
	window = scheme_successful_event
	title = study_confucian_classics_outcome.160.t
	desc = {
		desc = study_confucian_classics_outcome.160.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					any_relation = { 
						type = elder
						this = scope:higher_merit_vassal
					}
				}
				desc = study_confucian_classics_outcome.160.desc_own_elder
			}
			desc = {
				desc = study_confucian_classics_outcome.160.desc_other_elder
			}
		}
	}
	theme = education
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = happy_teacher
		camera = camera_body_right
	}
	lower_left_portrait = scope:higher_merit_vassal
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		OR = {
			any_relation = { 
				type = elder
			}
			top_liege = {
				any_vassal_or_below = {
					is_physically_able_ai_adult = yes
					merit_level > root.merit_level
					any_relation = { 
						type = disciple
						NOT = { this = root }
					}
				}
			}
		}
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
		if = {
			limit = {
				any_relation = { 
					type = elder
				}
			}
			random_relation = { 
				type = elder
				save_scope_as = higher_merit_vassal
			}
		}
		else = {
			top_liege = {
				random_vassal_or_below = {
					limit = {
						is_physically_able_ai_adult = yes
						merit_level > root.merit_level
						any_relation = { 
							type = disciple
							NOT = { this = root }
						}
					}
					save_scope_as = higher_merit_vassal
				}
			}
		}
	}

	option = {
		name = study_confucian_classics_outcome.160.a
		skill = diplomacy
		
		duel = {
			skill = diplomacy
			value = medium_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = merit_gain_high_tt
					left_icon = root
					custom_tooltip = because_of_your_diplomacy
					change_merit = {
						add = medium_merit_gain
						add = root.diplomacy
					}
					reverse_add_opinion = {
						modifier = impressed_opinion
						opinion = {
							add = 10
							add = root.diplomacy
						}
						target = scope:higher_merit_vassal
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = merit_gain_low_tt
					left_icon = root
					
					change_merit = miniscule_merit_gain
				}
			}
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.160.b
		skill = stewardship
		
		custom_tooltip = because_of_your_stewardship
		change_merit = {
			add = minor_merit_gain
			add = {
				add = root.stewardship
				multiply = 2
			}
		}
		add_prestige = {
			add = root.stewardship
			multiply = 3
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.160.c
		skill = learning
		
		custom_tooltip = because_of_your_learning
		change_merit = {
			add = minor_merit_gain
			add = {
				add = root.learning
				multiply = 2
			}
		}
		add_piety = {
			add = root.learning
			multiply = 3
		}
		
		ai_chance = {
			base = 100
		}
	}
}

# Your Elder helps you gain a lot of Merit
study_confucian_classics_outcome.170 = {
	type = character_event
	window = scheme_successful_event
	title = study_confucian_classics_outcome.170.t
	desc = study_confucian_classics_outcome.170.desc
	theme = education
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = chancellor
		camera = camera_body_right
	}
	right_portrait = {
		character = scope:letterman
		animation = throne_room_messenger_3
		camera = camera_body_left
	}
	lower_left_portrait = scope:elder
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		any_relation = {
			type = elder
			is_physically_able_adult = yes
		}
		any_courtier_or_guest = {
			is_physically_able_ai_adult = yes
			NOT = {
				has_relation_rival = root
			}
		}
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
		random_relation = { 
			type = elder
			limit = {
				is_physically_able_adult = yes
			}
			save_scope_as = elder
		}
		random_courtier_or_guest = {
			limit = {
				is_physically_able_ai_adult = yes
				NOT = {
					has_relation_rival = root
				}
			}
			save_scope_as = letterman
		}
	}

	option = {
		name = study_confucian_classics_outcome.170.a
		
		scope:elder = {
			progress_towards_friend_effect = {
				REASON = friend_praised_privately
				CHARACTER = root
				OPINION = 0
			}
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = 25
			}
		}
		
		change_merit = {
			add = minor_merit_gain
			multiply = scope:elder.merit_level
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.170.b
		
		change_influence = medium_influence_loss
		scope:elder = {
			change_influence = medium_influence_gain
		}
		
		change_merit = {
			add = minor_merit_gain
			add = {
				add = scope:elder.influence_level
				multiply = 5
			}
			multiply = scope:elder.merit_level
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.170.c
		
		reverse_add_opinion = {
            target = scope:letterman
            modifier = happy_opinion
            opinion = 30
        }
		
		change_merit = {
			add = minor_merit_gain
			multiply = scope:elder.merit_level
		}
		
		stress_impact = {
			base = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100
		}
	}
}

# Lose Burdened
study_confucian_classics_outcome.180 = {
	type = character_event
	window = scheme_successful_event
	title = study_confucian_classics_outcome.180.t
	desc = study_confucian_classics_outcome.180.desc
	theme = education
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = happy_teacher
		camera = camera_body_right
	}
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		has_trait = burdened
	}

	immediate = {
	}

	option = {
		name = study_confucian_classics_outcome.180.a
		
		add_stress = minor_stress_impact_loss
		
		remove_trait = burdened
		
		ai_chance = {
			base = 100
		}
	}
}

# Trade Influence for benefits
study_confucian_classics_outcome.190 = {
	type = character_event
	window = scheme_successful_event
	title = study_confucian_classics_outcome.190.t
	desc = study_confucian_classics_outcome.190.desc
	theme = education
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = pondering
		camera = camera_body_right
	}
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		influence >= medium_influence_value
	}

	immediate = {
	}

	option = {
		name = study_confucian_classics_outcome.190.a
		
		change_influence = medium_influence_loss
		change_merit = medium_merit_gain
		add_character_modifier = {
			modifier = tgp_known_by_magistrates_modifier
			years = 5
		}
		
		stress_impact = {
			honest = minor_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.190.b
		trigger = {
			has_trait = confucian_education
			has_trait_xp = {
				trait = confucian_education
				value < 100
			}
		}
		change_influence = medium_influence_loss
		add_trait_xp = {
			trait = confucian_education
			value = { 4 6 }
		}
		add_character_modifier = {
			modifier = tgp_assisted_by_scholars_modifier
			years = 5
		}
		
		stress_impact = {
			honest = minor_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.190.c
		trigger = {
			has_trait = lifestyle_poet
			has_trait_xp = {
				trait = lifestyle_poet
				value < 100
			}
		}
		change_influence = medium_influence_loss
		add_trait_xp = {
			trait = lifestyle_poet
			value = { 5 10 }
		}
		add_character_modifier = {
			modifier = tgp_known_by_poets_modifier
			years = 5
		}
		
		stress_impact = {
			honest = minor_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.190.d
		
		change_merit = minor_merit_gain
		
		ai_chance = {
			base = 100
		}
	}
}

#################################
# Failure Outcomes
#################################

# Parent scolds you
study_confucian_classics_outcome.1000 = {
	type = character_event
	window = scheme_failed_event
	title = study_confucian_classics_outcome.1000.t
	desc = study_confucian_classics_outcome.1000.desc
	theme = education
	center_portrait = {
		character = root
		animation = shame
		camera = camera_body_left
	}
	right_portrait = {
		character = scope:parent
		animation = rage
		camera = camera_body_left
	}
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		OR = {
			father ?= {
				is_physically_able_ai_adult = yes
				location = root.location
				has_trait_benevolent_trigger = no
				NOT = {
					has_relation_friend = root
				}
			}
			mother ?= {
				is_physically_able_ai_adult = yes
				location = root.location
				has_trait_benevolent_trigger = no
				NOT = {
					has_relation_friend = root
				}
			}
		}
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
		random_list = {
			10 = {
				trigger = {
					father ?= {
						is_physically_able_ai_adult = yes
						location = root.location
						has_trait_benevolent_trigger = no
						NOT = {
							has_relation_friend = root
						}
					}
				}
				father = { save_scope_as = parent }
			}
			10 = {
				trigger = {
					mother ?= {
						is_physically_able_ai_adult = yes
						location = root.location
						has_trait_benevolent_trigger = no
						NOT = {
							has_relation_friend = root
						}
					}
				}
				mother = { save_scope_as = parent }
			}
		}
	}

	option = {
		name = study_confucian_classics_outcome.1000.a
		add_character_modifier = {
			modifier = tgp_study_harder_modifier
			years = 3
		}
		reverse_add_opinion = {
			target = scope:parent
			modifier = satisfied_opinion
			opinion = 30
		}
		stress_impact = {
			base = medium_stress_impact_gain
			lazy = medium_stress_impact_gain
			stubborn = medium_stress_impact_loss
			diligent = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.1000.b
		trigger = {
			has_trait = burdened
		}
		trait = burdened
		reverse_add_opinion = {
			target = scope:parent
			modifier = dishonor_opinion
			opinion = -200
		}
		add_character_modifier = tgp_gave_up_modifier
		custom_tooltip = never_study_again_tt
		scope:scheme = {
			end_scheme = yes
		}
		stress_impact = {
			burdened = -500
		}
		ai_chance = {
			base = 0
		}
	}

	option = {
		name = study_confucian_classics_outcome.1000.c
		reverse_add_opinion = {
			target = scope:parent
			modifier = disappointed_opinion
			opinion = -50
		}
		stress_impact = {
			base = miniscule_stress_impact_gain
			lazy = medium_stress_impact_loss
			diligent = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
		}
		ai_chance = {
			base = 0
		}
	}
}

# Elder sends helpful text
study_confucian_classics_outcome.1010 = {
	type = character_event
	window = scheme_failed_event
	title = study_confucian_classics_outcome.1010.t
	desc = study_confucian_classics_outcome.1010.desc
	theme = education
	override_background = garden
	left_portrait = {
		character = root
		animation = chancellor
		camera = camera_event_scheme_center
	}
	lower_left_portrait = scope:elder
	artifact = {
	    target = scope:newly_created_artifact
	    position = lower_center_portrait
	}
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		any_relation = {
			type = elder
			is_physically_able_adult = yes
			save_temporary_scope_as = elder_scope
		}
		NOT = {
			any_character_artifact = {
				has_variable = elder_musings_scroll
				creator = scope:elder_scope
			}
		}
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
		random_relation = { 
			type = elder
			limit = {
				is_physically_able_adult = yes
			}
			save_scope_as = elder
			hidden_effect_new_object = {
				get_artifact_quality_effect = yes
				get_artifact_wealth_effect = yes

				create_artifact = {
					name = artifact_elder_text_name
					creator = scope:elder
					description = artifact_elder_text_description
					visuals = scroll
					type = miscellaneous
					modifier = artifact_study_confucian_classics_scheme_phase_duration_add_1_modifier
					save_scope_as = newly_created_artifact
					wealth = scope:wealth
					quality = scope:quality
				}

				scope:newly_created_artifact = {
					add_scaled_artifact_modifier_merit_gain_effect = yes
					add_scaled_artifact_modifier_study_confucian_classics_scheme_phase_duration_add_effect = yes
					set_variable = {
						name = elder_musings_scroll
						value = yes
					}
				}
			}
		}
	}

	option = {
		name = study_confucian_classics_outcome.1010.a
		
		scope:scheme = {
			add_scheme_modifier = {
				type = tgp_motivated_elder_study_modifier
				years = 3
			}
		}
		
		scope:newly_created_artifact = {
			set_owner = { target = root }
		}
		
		stress_impact = {
			base = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
			diligent = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.1010.b
		
		scope:newly_created_artifact = {
			set_owner = { target = root }
		}
		
		ai_chance = {
			base = 100
		}
	}
}

# Double-down on studying?
study_confucian_classics_outcome.1020 = {
	type = character_event
	window = scheme_failed_event
	title = study_confucian_classics_outcome.1020.t
	desc = study_confucian_classics_outcome.1020.desc
	theme = education
	override_background = study
	left_portrait = {
		character = root
		animation = stress
		camera = camera_body
	}
	lower_left_portrait = scope:elder
	artifact = {
	    target = scope:newly_created_artifact
	    position = lower_center_portrait
	}
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
	}

	option = {
		name = study_confucian_classics_outcome.1020.a
		
		scope:scheme = {
			add_scheme_modifier = {
				type = tgp_double_down_on_studies_modifier
				years = 3
			}
		}
		
		stress_impact = {
			base = medium_stress_impact_gain
			lazy = minor_stress_impact_gain
			diligent = minor_stress_impact_loss
			stubborn = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.1020.b
		trigger = {
			drinks_alcohol_trigger = yes
		}
		
		random = {
			chance = 2
			add_trait = drunkard
		}
		
		stress_impact = {
			base = miniscule_stress_impact_gain
			diligent = miniscule_stress_impact_gain
		}
		
		scope:scheme = {
			add_scheme_modifier = {
				type = tgp_double_down_on_studies_modifier
				years = 3
			}
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.1020.c
		
		stress_impact = {
			base = miniscule_stress_impact_gain
			diligent = miniscule_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
		}
	}
}

# Pray for divine help
study_confucian_classics_outcome.1030 = {
	type = character_event
	window = scheme_failed_event
	title = study_confucian_classics_outcome.1030.t
	desc = study_confucian_classics_outcome.1030.desc
	theme = education
	override_background = temple
	left_portrait = {
		character = root
		animation = prayer
		camera = camera_event_center_pointing_right
	}
	right_portrait = {
		character = scope:priest
		animation = wedding_priest
		camera = camera_event_center_pointing_forward_fov35
	}
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		cp:councillor_court_chaplain ?= {
			is_physically_able_ai_adult = yes
			location = root.location
			NOT = {
				has_relation_rival = root
			}
		}
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
		cp:councillor_court_chaplain = {
			save_scope_as = priest
		}
	}

	option = {
		name = study_confucian_classics_outcome.1030.a
		
		reverse_add_opinion = {
			modifier = pious_opinion
			target = scope:priest
			opinion = 30
		}
		
		pay_short_term_gold = {
			target = scope:priest
			gold = tiny_gold_value
		}
		
		scope:scheme = {
			add_scheme_modifier = {
				type = tgp_divine_favor_modifier
				years = 3
			}
		}
		
		stress_impact = {
			greedy = medium_stress_impact_gain
			cynical = minor_stress_impact_gain
			zealous = medium_stress_impact_loss
			humble = medium_stress_impact_loss
		}
		
		ai_chance = {
			base = 0
		}
	}

	option = {
		name = study_confucian_classics_outcome.1030.b
		
		reverse_add_opinion = {
			modifier = grateful_opinion
			target = scope:priest
			opinion = 30
		}
		
		scope:scheme = {
			add_scheme_modifier = {
				type = tgp_divine_favor_modifier
				years = 3
			}
		}
		
		stress_impact = {
			base = minor_stress_impact_gain
			lazy = miniscule_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.1030.c
		
		add_piety = miniscule_piety_gain
		
		stress_impact = {
			cynical = miniscule_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
		}
	}
}

# Partner helps you prepare
study_confucian_classics_outcome.1040 = {
	type = character_event
	window = scheme_failed_event
	title = study_confucian_classics_outcome.1040.t
	desc = study_confucian_classics_outcome.1040.desc
	theme = education
	override_background = study
	left_portrait = {
		character = root
		animation = sadness
		camera = camera_body_left_slight
	}
	right_portrait = {
		character = scope:partner
		animation = serving_tray
		camera = camera_body_left_slight
	}
	
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	
	cooldown = { years = 5 }
	
	trigger = {
		OR = {
			any_consort = {
				location = root.location
				is_physically_able_ai_adult = yes
				NOT = {
					has_relation_rival = root
				}
				is_attracted_to_gender_of = root
				root = { is_attracted_to_gender_of = prev }
				opinion = {
					target = root
					value >= 0
				}
			}
			any_relation = {
				type = lover
				location = root.location
				is_physically_able_ai_adult = yes
				NOT = {
					has_relation_rival = root
				}
			}
		}
	}

	immediate = {
		scope:owner = {
			save_scope_as = owner
		}
		if = {
			limit = {
				any_relation = {
					type = lover
					location = root.location
					is_physically_able_ai_adult = yes
					NOT = {
						has_relation_rival = root
					}
				}
			}
			random_relation = {
				type = lover
				limit = {
					location = root.location
					is_physically_able_ai_adult = yes
					NOT = {
						has_relation_rival = root
					}
				}
				save_scope_as = partner
			}
		}
		else = {
			random_consort = {
				limit = {
					location = root.location
					is_physically_able_ai_adult = yes
					NOT = {
						has_relation_rival = root
					}
					is_attracted_to_gender_of = root
					root = { is_attracted_to_gender_of = prev }
					opinion = {
						target = root
						value >= 0
					}
				}
				save_scope_as = partner
			}
		}
	}

	option = {
		name = study_confucian_classics_outcome.1040.a
		
		scope:scheme = {
			add_scheme_modifier = {
				type = tgp_servile_partner_modifier
				years = 3
			}
		}
		
		stress_impact = {
			base = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
			sadistic = medium_stress_impact_loss
			callous = medium_stress_impact_loss
		}
		
		ai_chance = {
			base = 0
		}
	}

	option = {
		name = study_confucian_classics_outcome.1040.b
		
		scope:scheme = {
			add_scheme_modifier = {
				type = tgp_assistant_partner_modifier
				years = 3
			}
		}
		if = {
			limit = {
				 can_set_relation_lover_trigger = { CHARACTER = scope:partner }
			}
			scope:partner = {
				progress_towards_lover_effect = {
					REASON = lover_helped_study
					CHARACTER = root
					OPINION = 0
				}
			}
		}
		reverse_add_opinion = {
			modifier = love_opinion
			target = scope:partner
			opinion = 30
		}
		
		stress_impact = {
			base = minor_stress_impact_gain
			lazy = miniscule_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = study_confucian_classics_outcome.1040.c
		
		if = {
			limit = {
				 can_set_relation_lover_trigger = { CHARACTER = scope:partner }
			}
			scope:partner = {
				progress_towards_lover_effect = {
					REASON = lover_helped_study
					CHARACTER = root
					OPINION = 0
				}
			}
		}
		reverse_add_opinion = {
			modifier = love_opinion
			target = scope:partner
			opinion = 30
		}
		
		stress_impact = {
			base = miniscule_stress_impact_loss
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
		}
	}
}