﻿namespace = bp2_adult_education

# A clerical guest speaker holds a seminar
bp2_adult_education.9000 = {
	type = activity_event
	content_source = dlc_009
	title = bp2_adult_education.9000.t
	desc = bp2_adult_education.9000.desc
	theme = university

	left_portrait = {
		character = root
		animation = thinking
	}
	center_portrait = {
		character = scope:guest_speaker
		animation = wedding_priest
		camera = camera_event_right
	}
	right_portrait = {
		character = scope:teacher
		animation = happy_teacher
		outfit_tags = { spectacles_outfit }
	}

	trigger = {
		NOT = { 
			scope:activity = {
				has_variable = has_had_event_9000
			}
		}
		scope:activity = {
			any_attending_character = {
				is_physically_able_ai_adult = yes
				OR = {
					has_character_flag = teacher_1
					has_character_flag = teacher_2
				}
			}
		}
	}

	immediate = {
		scope:activity = {
			set_variable = has_had_event_9000
			activity_location = { save_scope_as = location }
			random_attending_character = {
				limit = {
					is_physically_able_ai_adult = yes
					OR = {
						has_character_flag = teacher_1
						has_character_flag = teacher_2
					}
				}
				save_scope_as = teacher
			}
		}
		if = {
			limit = {
				scope:activity.activity_location.barony.lessee ?= {
					is_physically_able_ai_adult = yes
				}
			}
			scope:activity.activity_location.barony.lessee ?= {
				save_scope_as = guest_speaker
			}
		}
		else_if = {
			limit = {
				scope:activity.activity_location.county ?= {
					any_in_de_jure_hierarchy = {
						tier = tier_barony
						lessee ?= {
							is_physically_able_ai_adult = yes
						}
					}
				}
			}
			scope:activity.activity_location.county ?= {
				random_in_de_jure_hierarchy = {
					limit = {
						tier = tier_barony
						lessee ?= {
							is_physically_able_ai_adult = yes
						}
					}
					lessee = {
						save_scope_as = guest_speaker
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:activity.activity_location.county ?= {
					any_in_de_jure_hierarchy = {
						tier = tier_barony
						holder ?= {
							is_physically_able_ai_adult = yes
							highest_held_title_tier = tier_barony
							capital_province = { has_holding_type = church_holding }
						}
					}
				}
			}
			scope:activity.activity_location.county ?= {
				random_in_de_jure_hierarchy = {
					limit = {
						tier = tier_barony
						holder ?= {
							is_physically_able_ai_adult = yes
							highest_held_title_tier = tier_barony
							capital_province = { has_holding_type = church_holding }
						}
					}
					holder = {
						save_scope_as = guest_speaker
					}
				}
			}
		}
		else_if = {
			limit = {
				any_pool_character = {
					province = scope:activity.activity_location
					is_physically_able_ai_adult = yes
					trigger_if = {
						limit = {
							faith = { has_doctrine = doctrine_clerical_gender_male_only }
						}
						is_male = yes
					}
					trigger_if = {
						limit = {
							faith = { has_doctrine = doctrine_clerical_gender_female_only }
						}
						is_female = yes
					}
					OR = {
						is_clergy = yes
						has_education_learning_trigger = yes
					}
				}
			}
			random_pool_character = {
				province = scope:activity.activity_location
				limit = {
					is_physically_able_ai_adult = yes
					trigger_if = {
						limit = {
							faith = { has_doctrine = doctrine_clerical_gender_male_only }
						}
						is_male = yes
					}
					trigger_if = {
						limit = {
							faith = { has_doctrine = doctrine_clerical_gender_female_only }
						}
						is_female = yes
					}
					OR = {
						is_clergy = yes
						has_education_learning_trigger = yes
					}
				}
				save_scope_as = guest_speaker
			}
		}
		else = {
			create_character = {
				template = scholar_character
				culture = scope:activity.activity_location.county.culture
				faith = scope:activity.activity_location.county.faith
				location = scope:activity.activity_location
				gender_female_chance = activity_location_faith_dominant_gender_female_chance
				save_scope_as = guest_speaker
			}
		}
		scope:guest_speaker = { assign_quirk_effect = yes }
	}

	# Challenge their beliefs
	option = {
		name = bp2_adult_education.9000.a
		trigger = {
			has_activity_intent = study_hard_intent
		}
		duel = {
			skills = { learning diplomacy }
			value = {
				add = scope:guest_speaker.learning
				add = scope:guest_speaker.diplomacy
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = bp2_adult_education.9000.a.success
				send_interface_toast = {
					title = bp2_adult_education.9000.a.success
					left_icon = root
					right_icon = scope:guest_speaker
					scope:activity = {
						add_activity_log_entry = {
							key = defeated_guest_speaker_log
							score = 25
							tags = { activity positive }
							character = root
							target = scope:guest_speaker
			
							#Effect
							custom_tooltip = adult_education_tt_positive_massive
							scope:activity = { activity_special_type_progression_massive = yes }
							scope:guest_speaker = {
								random = {
									chance = 1
									death = {
										killer = root
										death_reason = death_literalist_debate
									}
								}
							}
							scope:teacher = {
								add_opinion = {
									target = root
									modifier = impressed_opinion
									opinion = 30
								}
							}
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = bp2_adult_education.9000.a.failure
				send_interface_toast = {
					title = bp2_adult_education.9000.a.failure
					left_icon = root
					right_icon = scope:guest_speaker
					scope:activity = {
						add_activity_log_entry = {
							key = defeated_by_guest_speaker_log
							score = 25
							tags = { activity negative }
							character = root
							target = scope:guest_speaker
			
							#Effect
							root = {
								add_prestige = major_prestige_loss
							}
							scope:teacher = {
								add_opinion = {
									target = root
									modifier = disappointed_opinion
									opinion = -20
								}
							}
							scope:guest_speaker = {
								add_opinion = {
									target = root
									modifier = fp2_questioned_my_faith_opinion
									opinion = -20
								}
							}
						}
					}
				}
			}
		}
		stress_impact = {
			humble = medium_stress_impact_gain
			shy = minor_stress_impact_gain
			content = minor_stress_impact_gain
			zealous = major_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = humble
					has_trait = shy
					has_trait = content
				}
			}
		}
	}

	# Furiously scribble notes 
	option = {
		name = bp2_adult_education.9000.b
		custom_tooltip = adult_education_tt_positive_medium
		trigger = {
			has_activity_intent = study_hard_intent
		}
		scope:activity = { activity_special_type_progression_medium = yes }
		scope:teacher = {
			add_opinion = {
				target = root
				modifier = impressed_opinion
				opinion = 10
			}
		}
		stress_impact = {
			base = major_stress_impact_gain
			lazy = massive_stress_impact_gain
			zealous = massive_stress_impact_gain
			arrogant = medium_stress_impact_gain
			diligent = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = lazy
					has_trait = zealous
					has_trait = arrogant
				}
			}
		}
	}

	# Mess with them by mentioning EvilGod
	option = {
		name = bp2_adult_education.9000.c
		trigger = {
			has_activity_intent = university_revelry_intent
		}
		custom_tooltip = adult_education_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		add_prestige = medium_prestige_value
		add_piety = minor_piety_loss
		scope:teacher = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -20
			}
		}
		scope:guest_speaker = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -20
			}
		}
		stress_impact = {
			humble = massive_stress_impact_gain
			compassionate = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
			arrogant = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = humble
					has_trait = compassionate
					has_trait = forgiving
				}
			}
		}
	}

	# Go and drink instead
	option = {
		name = bp2_adult_education.9000.d
		trigger = {
			has_activity_intent = university_revelry_intent
		}
		bp2_goliards_potential_shenanigans_effect = { TITLE_VALUE = bp2_adult_education.1020.c.tt }
		random = {
			chance = 50
			send_interface_toast = {
				title = you_learn_something
				left_icon = root
				custom_tooltip = adult_education_tt_positive_medium
				scope:activity = { activity_special_type_progression_medium = yes }
			}
		}
		scope:teacher = {
			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -20
			}
		}
		stress_impact = {
			temperate = massive_stress_impact_gain
			diligent = medium_stress_impact_gain
			humble = medium_stress_impact_gain
			gluttonous = medium_stress_impact_loss
			drunkard = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = temperate
					has_trait = diligent
					has_trait = humble
				}
			}
		}
	}

	# Interesting
	option = {
		name = bp2_adult_education.9000.e
		random = {
			chance = 25
			send_interface_toast = {
				title = you_learn_something
				left_icon = root
				custom_tooltip = adult_education_tt_positive_tiny
				scope:activity = { activity_special_type_progression_tiny = yes }
			}
		}
		stress_impact = {
			diligent = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = diligent
			}
		}
	}
}

# Party-peasants break into the university
bp2_adult_education.9100 = {
	type = activity_event
	content_source = dlc_009
	title = bp2_adult_education.9100.t
	desc = bp2_adult_education.9100.desc
	theme = university

	left_portrait = {
		character = root
		animation = shock
	}
	center_portrait = {
		character = scope:first_peasant
		animation = drink
	}
	right_portrait = {
		character = scope:second_peasant
		animation = wedding_drunk
	}

	trigger = {
		NOT = { 
			scope:activity = {
				has_variable = has_had_event_9100
			}
		}
		scope:activity = {
			any_attending_character = {
				is_physically_able_ai_adult = yes
				OR = {
					has_character_flag = teacher_1
					has_character_flag = teacher_2
				}
			}
		}
	}

	immediate = {
		hidden_effect = {
			scope:activity = {
				set_variable = has_had_event_9100
				activity_location = { save_scope_as = location }
				random_attending_character = {
					limit = {
						is_physically_able_ai_adult = yes
						OR = {
							has_character_flag = teacher_1
							has_character_flag = teacher_2
						}
					}
					save_scope_as = teacher
				}
			}
			if = {
				limit = {
					any_pool_character = {
						province = scope:activity.activity_location
						is_adult = yes
						is_available_allow_travelling = yes
						has_no_particular_noble_roots_trigger = yes
						NOT = { exists = current_travel_plan }
					}
				}
				random_pool_character = {
					province = scope:activity.activity_location
					limit = {
						is_adult = yes
						is_available_allow_travelling = yes
						has_no_particular_noble_roots_trigger = yes
						NOT = { exists = current_travel_plan }
					}
					save_scope_as = first_peasant
				}
			}
			else = {
				create_character = {
					template = peasant_character
					culture = scope:activity.activity_location.county.culture
					faith = scope:activity.activity_location.county.faith
					location = scope:activity.activity_location
					gender_female_chance = 50
					save_scope_as = first_peasant
					after_creation = {
						add_character_flag = created
					}
				}
			}
			if = {
				limit = {
					any_pool_character = {
						province = scope:activity.activity_location
						is_adult = yes
						is_available_allow_travelling = yes
						has_no_particular_noble_roots_trigger = yes
						NOT = { exists = current_travel_plan }
						this != scope:first_peasant
					}
				}
				random_pool_character = {
					province = scope:activity.activity_location
					limit = {
						is_adult = yes
						is_available_allow_travelling = yes
						has_no_particular_noble_roots_trigger = yes
						NOT = { exists = current_travel_plan }
						this != scope:first_peasant
					}
					save_scope_as = second_peasant
				}
			}
			else = {
				create_character = {
					template = peasant_character
					culture = scope:activity.activity_location.county.culture
					faith = scope:activity.activity_location.county.faith
					location = scope:activity.activity_location
					gender_female_chance = 50
					save_scope_as = second_peasant
					after_creation = {
						add_character_flag = created
					}
				}
			}
			scope:first_peasant = {
				if = {
					limit = {
						learning >= 5
					}
					add_learning_skill = -5
				}
				if = {
					limit = {
						learning >= 8
					}
					add_learning_skill = -8
				}
				if = {
					limit = {
						learning >= 12
					}
					add_learning_skill = -12
				}
			}
			scope:second_peasant = {
				if = {
					limit = {
						learning >= 5
					}
					add_learning_skill = -5
				}
				if = {
					limit = {
						learning >= 8
					}
					add_learning_skill = -8
				}
				if = {
					limit = {
						learning >= 12
					}
					add_learning_skill = -12
				}
			}
			scope:second_peasant = { force_character_skill_recalculation = yes }
			if = {
				limit = {
					is_ai = no
				}
				scope:first_peasant = { force_character_skill_recalculation = yes }
				scope:second_peasant = { force_character_skill_recalculation = yes }
			}
		}
	}

	# Pay for their education
	option = {
		name = bp2_adult_education.9100.read
		trigger = {
			has_activity_intent = study_hard_intent
		}
		
		remove_short_term_gold = medium_gold_value
		add_prestige = medium_prestige_loss
		
		custom_tooltip = adult_education_tt_positive_medium
		scope:activity = { activity_special_type_progression_medium = yes }
		
		scope:first_peasant = {
			add_learning_skill = 8
			add_character_flag = {
				flag = peasant_adult_edu
				years = 2
			}
			add_to_entourage_court_and_activity_effect = { 
				CHAR_TO_ADD = scope:first_peasant 
				NEW_COURT_OWNER = root 
			}
			add_opinion = {
				target = root
				modifier = changed_my_life_opinion
				opinion = 50
			}
		}
		scope:second_peasant = {
			add_learning_skill = 8
			add_character_flag = {
				flag = peasant_adult_edu
				years = 2
			}
			add_to_entourage_court_and_activity_effect = { 
				CHAR_TO_ADD = scope:second_peasant 
				NEW_COURT_OWNER = root 
			}
			add_opinion = {
				target = root
				modifier = changed_my_life_opinion
				opinion = 50
			}
		}
		
		stress_impact = {
			greedy = massive_stress_impact_gain
			arrogant = massive_stress_impact_gain
			sadistic = massive_stress_impact_gain
			callous = massive_stress_impact_gain
			compassionate = major_stress_impact_loss
			generous = major_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = arrogant
					has_trait = sadistic
					has_trait = callous
				}
			}
		}
	}
	
	# Hire them to carry your books
	option = {
		name = bp2_adult_education.9100.a
		trigger = {
			has_activity_intent = study_hard_intent
		}
		
		remove_short_term_gold = minor_gold_value
		custom_tooltip = adult_education_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		
		scope:first_peasant = {
			add_to_court_and_entourage_only_effect = yes
			add_opinion = {
				target = root
				modifier = thankful_opinion
				opinion = 10
			}
		}
		scope:second_peasant = {
			add_to_court_and_entourage_only_effect = yes
			add_opinion = {
				target = root
				modifier = thankful_opinion
				opinion = 10
			}
		}
		
		stress_impact = {
			paranoid = medium_stress_impact_gain
			ambitious = major_stress_impact_loss
			arrogant = major_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = paranoid
			}
		}
	}

	# Party!!
	option = {
		name = bp2_adult_education.9100.b
		trigger = {
			has_activity_intent = university_revelry_intent
		}
		bp2_goliards_potential_shenanigans_effect = { TITLE_VALUE = bp2_adult_education.1020.c.tt }
		random = {
			chance = 50
			send_interface_toast = {
				title = you_learn_something
				left_icon = root
				custom_tooltip = adult_education_tt_positive_medium
				scope:activity = { activity_special_type_progression_medium = yes }
			}
		}
		scope:first_peasant = {
			add_opinion = {
				target = root
				modifier = feast_life_of_the_party_opinion
				opinion = 30
			}
		}
		scope:second_peasant = {
			add_opinion = {
				target = root
				modifier = feast_life_of_the_party_opinion
				opinion = 30
			}
		}
		stress_impact = {
			temperate = massive_stress_impact_gain
			wrathful = medium_stress_impact_gain
			gregarious = medium_stress_impact_loss
			drunkard = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = temperate
					has_trait = wrathful
				}
			}
		}
	}

	# Whyyyyyy
	option = {
		name = bp2_adult_education.9100.c
		if = {
			limit = {
				is_ai = no
				exists = scope:activity.activity_location.county.holder
			}
			rightfully_imprison_character_less_verbose_effect = {
				TARGET = scope:first_peasant
				IMPRISONER = scope:activity.activity_location.county.holder
			}
			rightfully_imprison_character_less_verbose_effect = {
				TARGET = scope:second_peasant
				IMPRISONER = scope:activity.activity_location.county.holder
			}
		}
		random_list = {
			50 = {
				send_interface_toast = {
					title = you_learn_something
					left_icon = root
					custom_tooltip = adult_education_tt_positive_tiny
					scope:activity = { activity_special_type_progression_tiny = yes }
				}
			}
			50 = {
				send_interface_toast = {
					title = you_are_hampered
					left_icon = root
					custom_tooltip = adult_education_tt_negative
					scope:activity = { activity_special_type_progression_negative = yes }
				}
			}
		}
		ai_chance = {
			base = 100
		}
	}
	after = {
		scope:first_peasant = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:second_peasant = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Romantic tensions
bp2_adult_education.9200 = {
	type = activity_event
	content_source = dlc_009
	title = bp2_adult_education.9200.t
	desc = bp2_adult_education.9200.desc
	theme = university

	left_portrait = {
		character = root
		animation = stressed_teacher
	}
	right_portrait = {
		character = scope:student_flirt
		animation = flirtation
	}

	trigger = {
		NOT = { 
			scope:activity = {
				has_variable = has_had_event_9200
			}
		}
		might_cheat_on_every_partner_trigger = yes
		scope:activity = {
			any_attending_character = {
				is_physically_able_ai_adult = yes
				might_cheat_on_every_partner_trigger = yes
				is_attracted_to_gender_of = root
				root = { is_attracted_to_gender_of = prev }
				OR = {
					has_character_flag = student_1
					has_character_flag = student_2
				}
				NOR = {
					has_trait = chaste
					has_trait = celibate
				}
			}
		}
	}

	immediate = {
		hidden_effect = {
			scope:activity = {
				set_variable = has_had_event_9200
				activity_location = { save_scope_as = location }
				random_attending_character = {
					limit = {
						is_physically_able_ai_adult = yes
						might_cheat_on_every_partner_trigger = yes
						is_attracted_to_gender_of = root
						root = { is_attracted_to_gender_of = prev }
						OR = {
							has_character_flag = student_1
							has_character_flag = student_2
						}
						NOR = {
							has_trait = chaste
							has_trait = celibate
						}
					}
					save_scope_as = student_flirt
				}
			}
			set_random_informative_text_effect = yes
		}
	}

	# Focus on studies
	option = {
		name = bp2_adult_education.9200.a
		trigger = {
			has_activity_intent = study_hard_intent
		}
		
		custom_tooltip = adult_education_tt_positive_medium
		scope:activity = { activity_special_type_progression_medium = yes }
		
		scope:student_flirt = {
			add_opinion = {
				target = root
				modifier = rejected_opinion
				opinion = -20
			}
		}
		
		stress_impact = {
			celibate = massive_stress_impact_loss
			chaste = massive_stress_impact_loss
			lustful = massive_stress_impact_gain
			rakish = massive_stress_impact_gain
			base = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = lustful
					has_trait = rakish
				}
			}
		}
	}

	# Do it on the roof
	option = {
		name = bp2_adult_education.9200.b
		trigger = {
			has_activity_intent = university_revelry_intent
		}
		bp2_goliards_potential_shenanigans_effect = { TITLE_VALUE = bp2_adult_education.1020.c.tt }
		random = {
			chance = 50
			send_interface_toast = {
				title = you_learn_something
				left_icon = root
				custom_tooltip = adult_education_tt_positive_major
				scope:activity = { activity_special_type_progression_major = yes }
			}
		}
		had_sex_with_effect = {
			CHARACTER = scope:student_flirt
			PREGNANCY_CHANCE = pregnancy_chance
		}
		scope:student_flirt = {
			add_opinion = {
				target = root
				modifier = blew_off_some_steam_opinion
				opinion = 50
			}
		}
		stress_impact = {
			lustful = medium_stress_impact_loss
			rakish = medium_stress_impact_loss
			chaste = massive_stress_impact_gain
			celibate = massive_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = chaste
					has_trait = celibate
				}
			}
		}
	}

	# Smash
	option = {
		name = bp2_adult_education.9200.c
		
		custom_tooltip = adult_education_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		
		had_sex_with_effect = {
			CHARACTER = scope:student_flirt
			PREGNANCY_CHANCE = pregnancy_chance
		}
		
		scope:student_flirt = {
			add_opinion = {
				target = root
				modifier = blew_off_some_steam_opinion
				opinion = 20
			}
		}
		
		stress_impact = {
			lustful = medium_stress_impact_loss
			rakish = medium_stress_impact_loss
			chaste = massive_stress_impact_gain
			celibate = massive_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = chaste
					has_trait = celibate
				}
			}
		}
	}
	
	# Rest
	option = {
		name = bp2_adult_education.9200.d
		
		scope:student_flirt = {
			add_opinion = {
				target = root
				modifier = rejected_opinion
				opinion = -20
			}
		}
		
		stress_impact = {
			lustful = massive_stress_impact_gain
			rakish = massive_stress_impact_gain
			base = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = lustful
					has_trait = rakish
				}
			}
		}
	}
}

# Manic student
bp2_adult_education.9300 = {
	type = activity_event
	content_source = dlc_009
	title = bp2_adult_education.9300.t
	desc = bp2_adult_education.9300.desc
	theme = university

	left_portrait = {
		character = root
		animation = stress
	}
	center_portrait = {
		character = scope:eccentric_student
		animation = manic
	}

	trigger = {
		NOT = { 
			scope:activity = {
				has_variable = has_had_event_9300
			}
		}
		might_cheat_on_every_partner_trigger = yes
		scope:activity = {
			any_attending_character = {
				is_physically_able_ai_adult = yes
				OR = {
					has_character_flag = student_1
					has_character_flag = student_2
				}
				NOR = {
					has_trait = stubborn
					has_trait = fickle
				}
			}
		}
	}

	immediate = {
		hidden_effect = {
			scope:activity = {
				set_variable = has_had_event_9300
				activity_location = { save_scope_as = location }
				random_attending_character = {
					limit = {
						is_physically_able_ai_adult = yes
						OR = {
							has_character_flag = student_1
							has_character_flag = student_2
						}
						NOR = {
							has_trait = stubborn
							has_trait = fickle
						}
					}
					save_scope_as = eccentric_student
					if = {
						limit = {
							NOT = {
								has_trait = eccentric
							}
						}
						add_trait = eccentric
					}
				}
			}
			set_random_informative_text_effect = yes
		}
	}

	# Eccentric
	option = {
		name = bp2_adult_education.9300.eccentric
		trigger = {
			has_trait = eccentric
		}
		trait = eccentric
		
		custom_tooltip = adult_education_tt_positive_massive
		scope:activity = { activity_special_type_progression_massive = yes }
		bp2_goliards_potential_shenanigans_effect = { TITLE_VALUE = bp2_adult_education.1020.c.tt }
		if = {
			limit = {
				can_set_relation_friend_trigger = { CHARACTER = scope:eccentric_student }
			}
			set_relation_friend = { reason = friend_goliardic_shenanigans target = scope:eccentric_student }
		}
		
		stress_impact = {
			eccentric = massive_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}

	# Focus on studies
	option = {
		name = bp2_adult_education.9300.a
		trigger = {
			has_activity_intent = study_hard_intent
		}
		
		custom_tooltip = adult_education_tt_positive_medium
		scope:activity = { activity_special_type_progression_medium = yes }
		
		scope:eccentric_student = {
			add_opinion = {
				target = root
				modifier = ignored_opinion
				opinion = -30
			}
			if = {
				limit = {
					can_set_relation_rival_trigger = { CHARACTER = root }
				}
				progress_towards_rival_effect = {
					REASON = rival_ignored_ideas
					CHARACTER = root
					OPINION = 0
				}
			}
		}
		
		stress_impact = {
			eccentric = massive_stress_impact_gain
			lazy = massive_stress_impact_gain
			compassionate = medium_stress_impact_gain
			callous = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = eccentric
					has_trait = lazy
					has_trait = compassionate
				}
			}
		}
	}

	# Listen to the insane ideas
	option = {
		name = bp2_adult_education.9300.b
		trigger = {
			has_activity_intent = university_revelry_intent
		}
		bp2_goliards_potential_shenanigans_effect = { TITLE_VALUE = bp2_adult_education.1020.c.tt }
		random = {
			chance = 25
			send_interface_toast = {
				title = you_learn_something
				left_icon = root
				custom_tooltip = adult_education_tt_positive_massive
				scope:activity = { activity_special_type_progression_massive = yes }
			}
		}
		if = {
			limit = {
				NOR = {
					has_trait = eccentric
					has_trait = fickle
					has_trait = stubborn
				}
			}
			random = {
				chance = 10
				add_trait = eccentric
			}
		}
		if = {
			limit = {
				can_set_relation_friend_trigger = { CHARACTER = scope:eccentric_student }
			}
			progress_towards_friend_effect = {
				REASON = friend_goliardic_shenanigans
				CHARACTER = scope:eccentric_student
				OPINION = 30
			}
		}
		stress_impact = {
			impatient = medium_stress_impact_gain
			wrathful = medium_stress_impact_gain
			gregarious = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = impatient
					has_trait = wrathful
				}
			}
		}
	}

	# Leave
	option = {
		name = bp2_adult_education.9300.c
		
		custom_tooltip = adult_education_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		
		scope:eccentric_student = {
			add_opinion = {
				target = root
				modifier = ignored_opinion
				opinion = -15
			}
		}
		
		stress_impact = {
			gregarious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = gregarious
			}
		}
	}
}

# The local ruler pays a visit
bp2_adult_education.9400 = {
	type = activity_event
	content_source = dlc_009
	title = bp2_adult_education.9400.t
	desc = bp2_adult_education.9400.desc
	theme = university

	left_portrait = {
		character = root
		animation = admiration
	}
	center_portrait = {
		character = scope:local_ruler
		animation = thinking
		camera = camera_event_right
	}
	right_portrait = {
		character = scope:teacher
		animation = happy_teacher
		outfit_tags = { spectacles_outfit }
	}

	trigger = {
		NOT = { 
			scope:activity = {
				has_variable = has_had_event_9400
			}
		}
		scope:activity = {
			activity_location.county.holder ?= {
				is_available_adult = yes
				this != root
			}
			any_attending_character = {
				is_physically_able_ai_adult = yes
				OR = {
					has_character_flag = teacher_1
					has_character_flag = teacher_2
				}
			}
		}
	}

	immediate = {
		save_scope_as = root_scope
		scope:activity = {
			set_variable = has_had_event_9400
			activity_location = { save_scope_as = location }
			activity_location.county.holder = {
				save_scope_as = local_ruler
			}
			random_attending_character = {
				limit = {
					is_physically_able_ai_adult = yes
					OR = {
						has_character_flag = teacher_1
						has_character_flag = teacher_2
					}
				}
				save_scope_as = teacher
			}
		}
		scope:local_ruler = { assign_quirk_effect = yes }
	}

	# Friend/lover
	option = {
		name = bp2_adult_education.9400.friend
		trigger = {
			OR = {
				has_relation_friend = scope:local_ruler
				has_relation_lover = scope:local_ruler
			}
			NOT = { has_relation_rival = scope:local_ruler }
		}
		flavor = available_friend_lover
		custom_tooltip = adult_education_tt_positive_major
		scope:activity = { activity_special_type_progression_major = yes }
		stress_impact = {
			humble = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = humble
			}
		}
	}

	# Liege
	option = {
		name = bp2_adult_education.9400.liege
		trigger = {
			scope:local_ruler = {
				is_vassal_or_below_of = root
			}
		}
		flavor = available_liege
		add_tyranny = 20
		custom_tooltip = adult_education_tt_positive_major
		scope:activity = { activity_special_type_progression_major = yes }
		stress_impact = {
			just = massive_stress_impact_gain
			forgiving = medium_stress_impact_gain
			patient = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = just
					has_trait = forgiving
					has_trait = patient
				}
			}
		}
	}

	# Higher Tier
	option = {
		name = bp2_adult_education.9400.tier
		trigger = {
			exists = root.primary_title.tier
			scope:local_ruler.primary_title.tier < root.primary_title.tier
			is_landless_adventurer = no
		}
		flavor = available_higher_tier

		custom_tooltip = adult_education_tt_positive_medium
		scope:activity = { activity_special_type_progression_medium = yes }
		
		scope:local_ruler = {
			send_interface_toast = {
				title = bp2_adult_education.9400.tier.toast
				left_icon = scope:root_scope
				root = {
					add_prestige = medium_prestige_loss
				}
				add_prestige = medium_prestige_value
			}
		}
		
		stress_impact = {
			arrogant = massive_stress_impact_gain
			ambitious = medium_stress_impact_gain
			callous = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
			arbitrary = medium_stress_impact_gain
			stubborn = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = arrogant
					has_trait = ambitious
					has_trait = callous
					has_trait = sadistic
					has_trait = arbitrary
				}
			}
		}
	}

	# Donate lots of gold for privileges
	option = {
		name = bp2_adult_education.9400.gold_lots
		trigger = {
			has_activity_intent = study_hard_intent
			gold >= medium_gold_value
		}
		
		custom_tooltip = adult_education_tt_positive_major
		scope:activity = { activity_special_type_progression_major = yes }
		
		scope:local_ruler = {
			send_interface_toast = {
				title = bp2_adult_education.9400.gold_lots.toast
				left_icon = scope:root_scope
				root = {
					pay_short_term_gold = {
						target = scope:local_ruler
						gold = medium_gold_value
					}
					if = {
						limit = {
							has_government = landless_adventurer_government
						}
						add_contact = scope:local_ruler
					}
				}
			}
		}
		
		scope:teacher = {
			add_opinion = {
				target = root
				modifier = impressed_opinion
				opinion = 40
			}
		}
		
		scope:local_ruler = {
			add_opinion = {
				target = root
				modifier = impressed_opinion
				opinion = 20
			}
		}
		
		stress_impact = {
			greedy = massive_stress_impact_gain
			humble = medium_stress_impact_gain
			content = medium_stress_impact_gain
			generous = massive_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = humble
					has_trait = content
				}
			}
		}
	}

	# Go and drink instead
	option = {
		name = bp2_adult_education.9400.drink
		trigger = {
			has_activity_intent = university_revelry_intent
		}
		bp2_goliards_potential_shenanigans_effect = { TITLE_VALUE = bp2_adult_education.1020.c.tt }
		random = {
			chance = 50
			send_interface_toast = {
				title = you_learn_something
				left_icon = root
				custom_tooltip = adult_education_tt_positive_tiny
				scope:activity = { activity_special_type_progression_tiny = yes }
				if = {
					limit = {
						has_government = landless_adventurer_government
					}
					add_contact = scope:local_ruler
				}
			}
		}
		scope:teacher = {
			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -20
			}
		}
		scope:local_ruler = {
			add_opinion = {
				target = root
				modifier = insulted_opinion
				opinion = -20
			}
		}
		stress_impact = {
			generous = medium_stress_impact_gain
			just = medium_stress_impact_gain
			base = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = generous
					has_trait = just
				}
			}
		}
	}

	# Donate some gold for privileges
	option = {
		name = bp2_adult_education.9400.gold
		
		trigger = {
			gold >= minor_gold_value
		}
		
		custom_tooltip = adult_education_tt_positive_medium
		scope:activity = { activity_special_type_progression_medium = yes }
		
		scope:local_ruler = {
			send_interface_toast = {
				title = bp2_adult_education.9400.gold.toast
				left_icon = scope:root_scope
				root = {
					pay_short_term_gold = {
						target = scope:local_ruler
						gold = minor_gold_value
					}
					if = {
						limit = {
							has_government = landless_adventurer_government
						}
						add_contact = scope:local_ruler
					}
				}
			}
		}
		
		scope:teacher = {
			add_opinion = {
				target = root
				modifier = impressed_opinion
				opinion = 20
			}
		}
		
		scope:local_ruler = {
			add_opinion = {
				target = root
				modifier = impressed_opinion
				opinion = 10
			}
		}
		stress_impact = {
			greedy = massive_stress_impact_gain
			generous = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = greedy
			}
		}
	}

	# Do nothing
	option = {
		name = bp2_adult_education.9400.nothing
		
		scope:local_ruler = {
			add_opinion = {
				target = root
				modifier = compliment_opinion
				opinion = 5
			}
		}
		stress_impact = {
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = generous
			}
		}
	}
}
