﻿bp2_yearly.1035 = {
	type = character_event
	content_source = dlc_009
	title = bp2_yearly.1035.t
	desc = {
		desc = bp2_yearly.1035.desc
		first_valid = {
			triggered_desc = {
				trigger = { is_parent_of = scope:rock_child }
				desc = bp2_yearly.1035.desc_parent
			}
			desc = bp2_yearly.1035.desc_guardian
		}
	} 
	theme = family
	override_background = { reference = bp2_nursery }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_trait = callous }
			animation = personality_cynical
		}
		triggered_animation = {
			trigger = { has_trait = greedy }
			animation = personality_greedy
		}
		animation = personality_compassionate
	}
	right_portrait = {
		character = scope:rock_child
		animation = reading
	}
	artifact = {
		target = scope:gemstone_trinket
		position = lower_center_portrait
	}
	#Set up the cooldown
	cooldown = { years = 10 }
	trigger = {
		#DLC check
		has_bp2_dlc_trigger = yes
		#Standard checks
		is_available = yes
		is_adult = yes
		is_landed = yes
		OR = {
			any_child = { bp2_yearly_1035_is_rock_child = yes }
			any_relation = {
				type = ward
				bp2_yearly_1035_is_rock_child = yes
			}
			any_warden_hostage = {
				bp2_yearly_1035_is_rock_child = yes
			}
		}
	}
	weight_multiplier = {
		base = 1
		modifier = {
			OR = {
				any_child = { 
					bp2_yearly_1035_is_rock_child = yes
					has_focus = education_learning
				}
				any_relation = {
					type = ward
					bp2_yearly_1035_is_rock_child = yes
					has_focus = education_learning
				}
				any_warden_hostage = {
					bp2_yearly_1035_is_rock_child = yes
					has_focus = education_learning
				}
			}
			add = 1
		}
	}
	immediate = {
		play_music_cue = "mx_cue_low_key_positive"

		random_list = {
			33 = {
				trigger = { any_child = { bp2_yearly_1035_is_rock_child = yes } }
				random_child = {
					limit = { 
						bp2_yearly_1035_is_rock_child = yes
						has_focus = education_learning
						this = root.player_heir
					}
					alternative_limit = { 
						bp2_yearly_1035_is_rock_child = yes
						has_focus = education_learning
					}
					alternative_limit = { bp2_yearly_1035_is_rock_child = yes }
					save_scope_as = rock_child
				}
				modifier = {
					any_child = {
						bp2_yearly_1035_is_rock_child = yes
						this = root.player_heir
					}
					add = 50
				}
			}
			33 = {
				trigger = {
					any_relation = {
						type = ward
						bp2_yearly_1035_is_rock_child = yes
					}
				}
				random_relation = {
					type = ward
					limit = { 
						bp2_yearly_1035_is_rock_child = yes
						has_focus = education_learning
					}
					alternative_limit = { bp2_yearly_1035_is_rock_child = yes }
					save_scope_as = rock_child
				}
			}
			33 = {
				trigger = {
					any_warden_hostage = {
						bp2_yearly_1035_is_rock_child = yes
					}
				}
				random_warden_hostage = {
					#A child you care about
					limit = { 
						bp2_yearly_1035_is_rock_child = yes
						has_focus = education_learning
					}
					alternative_limit = { bp2_yearly_1035_is_rock_child = yes }
					save_scope_as = rock_child
				}
			}
		}

		root.location = { save_scope_as = trinket_location }
		#Create the gemstone
		hidden_effect = {
			scope:rock_child = {
				random_list = {
					50 = {
						create_artifact = {
							name = gemstone_trinket_rough
							description = gemstone_trinket_rough.desc
							type = miscellaneous
							visuals = gemstone_trinket_rough_visuals
							modifier = artifact_monthly_minor_prestige_1_modifier
							modifier = artifact_learning_1_modifier
							save_scope_as = gemstone_trinket
							wealth = 15
							quality = 15
							max_durability = 30
							generate_history = no
						}
					}
					50 = {
						create_artifact = {
							name = gemstone_trinket_modest
							description = gemstone_trinket_modest.desc
							type = miscellaneous
							visuals = gemstone_trinket_modest_visuals
							modifier = artifact_monthly_minor_prestige_2_modifier
							modifier = artifact_learning_1_modifier
							save_scope_as = gemstone_trinket
							wealth = 15
							quality = 15
							max_durability = 40
							generate_history = no
						}
					}
					50 = {
						create_artifact = {
							name = gemstone_trinket_brilliant
							description = gemstone_trinket_brilliant.desc
							type = miscellaneous
							visuals = gemstone_trinket_brilliant_visuals
							modifier = artifact_monthly_minor_prestige_3_modifier
							modifier = artifact_learning_2_modifier
							save_scope_as = gemstone_trinket
							wealth = 15
							quality = 15
							max_durability = 50
							generate_history = no
						}
					}
				}
				
			}
		}
		scope:rock_child = {
			set_variable = {
				name = had_bp2_yearly_1035_learning_event
				value = flag:yes
			}
		}
	}
	#Have a gem trinket
	option = {
		name = bp2_yearly.1035.a		
		flavor = bp2_yearly.1035.a.flavor
		scope:gemstone_trinket = { set_owner = root }
		ai_chance = {
			base = 100
		}
	}
	#Have some education
	option = {
		name = bp2_yearly.1035.b
		trigger = {
			scope:rock_child = { has_focus = education_learning }
		}
		#More points for a matching education
		if = {
			limit = { has_trait = education_learning }
			custom_tooltip = bp2_yearly.1035.b.tt_matching
			hidden_effect = {
				scope:rock_child = { 
					education_point_acquisition_additional_points_effect = { LEVEL = mid }
				}
			}
		}
		else = {
			custom_tooltip = bp2_yearly.1035.b.tt
			hidden_effect = {
				scope:rock_child = { 
					education_point_acquisition_additional_points_effect = { LEVEL = low }
				}
			}
		}
		reverse_add_opinion = {
			target = scope:rock_child
			modifier = teaching_moment_opinion
			opinion = 15
		}
		stress_impact = { greedy = minor_stress_impact_gain }
		ai_chance = {
			base = 100
			modifier = {
				has_trait = greedy
				factor = 0
			}
		}
	}
}