﻿#Events between siblings

namespace = sibling

#0001-0999: Misc
#1001-1999: A friendly unlanded sibling
#2001-2999: A friendly landed sibling vassal
#3001-3999: An unfriendly unlanded sibling
#4001-4999: An unfriendly landed sibling vassal
#5001-5999: A friendly landed sibling in same realm or independent
#6001-6999: An unfriendly landed sibling in same realm or independent
#7001-7999: Sibling childhood events
#8000-8999: Unlanded Sibling trait events



#A Friendly unlanded sibling asks to be rewarded
#scripted_trigger sibling_0001_sibling_trigger = {
#	is_ruler = no
#	is_adult = yes
#	is_ai = yes
#	OR = {
#		root = { is_ai = yes }
#		reverse_opinion = {
#			target = root
#			value > 60
#		}
#		AND = {
#			has_variable = helped_landed_sibling
#			var:helped_landed_sibling >= 1
#		}
#	}
#}
#
#sibling.0001 = {
#	type = character_event
#	title = sibling.0001.t
#	desc = sibling.0001.desc
#	theme = family
#	left_portrait = {
#		character = root
#		animation = war_over_tie
#	}
#	right_portrait = {
#		character = scope:sibling
#		animation = admiration
#	}
#	override_background = { reference = throne_room }
#
#	trigger = {
#		NOT = { has_character_flag = had_sibling_request_event }
#		is_ai = no
#		any_sibling = {
#			sibling_0001_sibling_trigger = yes
#		}
#	}
#
#	weight_multiplier = {
#		base = 0.5
#		modifier = {
#			add = 1
#			any_sibling = {
#				sibling_0001_sibling_trigger = yes
#				var:helped_landed_sibling >= 2
#			}
#		}
#	}
#
#	immediate = {
#		random_sibling = {
#			limit = {
#				sibling_0001_sibling_trigger = yes
#			}
#			save_scope_as = sibling
#		}
#		add_character_flag = {
#			flag = had_sibling_request_event
#			years = 20
#		}
#	}
#
#	option = { #Promise some land!
#		name = sibling.0001.a
#		trigger = {
#			is_landed = yes
#			NOT = { has_variable = sibling_waiting_for_land }
#		}
#		custom_tooltip = sibling_promised_land_tt
#		set_variable = {
#			name = sibling_waiting_for_land
#			value = scope:sibling
#			years = 4
#		}
#		trigger_event = {
#			id = sibling.0002
#			years = 2
#		}
#	}
#
#	option = { #Promise anything they ask for
#		trigger = {
#			scope:sibling = {
#				can_add_hook = {
#					type = favor_hook
#					target = root
#				}
#			}
#		}
#		name = sibling.0001.b
#		scope:sibling = {
#			add_hook = {
#				type = favor_hook
#				target = root
#			}
#		}
#	}
#
#	option = {
#		name = sibling.0001.e
#		scope:sibling = {
#			add_opinion = {
#				target = root
#				modifier = sibling_let_me_down_opinion
#				years = 15
#			}
#		}
#	}
#
#	after = {
#		hidden_effect = {
#			scope:sibling = {
#				remove_variable = helped_landed_sibling
#			}
#		}
#	}
#}



#Sibling was promised land, but didn't get any
#sibling.0002 = {
#	type = character_event
#	title = sibling.0001.t
#	desc = sibling.0002.desc
#	theme = family
#	left_portrait = {
#		character = root
#		animation = war_over_win
#	}
#	right_portrait = {
#		character = scope:sibling
#		animation = disapproval
#	}
#	override_background = { reference = throne_room }
#
#	trigger = {
#		exists = var:sibling_waiting_for_land
#		is_landed = yes
#		any_sibling = {
#			is_landed = no
#			this = root.var:sibling_waiting_for_land
#		}
#	}
#
#	on_trigger_fail = {
#		if = {
#			limit = {
#				exists = var:sibling_waiting_for_land
#				any_sibling = {
#					is_landed = yes
#					this = root.var:sibling_waiting_for_land
#					has_character_flag = got_title_from_sibling
#				}
#			}
#			trigger_event = sibling.0003
#		}
#	}
#
#	immediate = {
#		random_sibling = {
#			limit = {
#				this = root.var:sibling_waiting_for_land
#			}
#			save_scope_as = sibling
#		}
#		remove_variable = sibling_waiting_for_land
#	}
#
#	option = { #Give them some gold
#		name = sibling.0002.a
#		trigger = {
#			short_term_gold >= medium_gold_value
#		}
#		show_as_unavailable = {
#			short_term_gold < medium_gold_value
#		}
#		remove_short_term_gold = medium_gold_value
#		stress_impact = {
#			greedy = minor_stress_impact_gain
#		}
#	}
#
#	option = { #No!
#		name = sibling.0002.b
#		stress_impact = {
#			generous = minor_stress_impact_gain
#		}
#		scope:sibling = {
#			add_opinion = {
#				target = root
#				modifier = sibling_goes_back_on_promise_opinion
#			}
#		}
#	}
#}
#
#
##Sibling is very happy about receiving land as promised
#sibling.0003 = {
#	type = character_event
#	title = sibling.0001.t
#	desc = sibling.0003.desc
#	theme = family
#	left_portrait = {
#		character = root
#		animation = war_over_tie
#	}
#	right_portrait = {
#		character = scope:sibling
#		animation = happiness
#	}
#	override_background = { reference = throne_room }
#
#	trigger = {
#		exists = var:sibling_waiting_for_land
#		is_landed = yes
#		any_sibling = {
#			is_landed = yes
#			this = root.var:sibling_waiting_for_land
#			has_character_flag = got_title_from_sibling
#		}
#	}
#
#	immediate = {
#		random_sibling = {
#			limit = {
#				is_landed = yes
#				this = root.var:sibling_waiting_for_land
#				has_character_flag = got_title_from_sibling
#			}
#			save_scope_as = sibling
#			remove_character_flag = got_title_from_sibling
#		}
#		remove_variable = sibling_waiting_for_land
#	}
#
#	option = {
#		name = sibling.0003.a
#		add_gold = minor_gold_value
#		scope:sibling = {
#			add_opinion = {
#				target = root
#				modifier = received_land_from_sibling_opinion
#			}
#		}
#		progress_towards_friend_effect = {
#			CHARACTER = scope:sibling
#			OPINION = 0
#			REASON = friend_grateful_landed_sibling
#		}
#	}
#}



#A sibling causes trouble with a vassal
scripted_trigger sibling_0004_troublemaker_sibling_trigger = {
	is_ruler = no
	NOT = {
		has_opinion_modifier = {
			target = root
			modifier = told_off_by_sibling_opinion
		}
	}
	OR = {
		diplomacy <= decent_skill_rating
		has_trait = deceitful
		has_trait = arrogant
		has_trait = stubborn
	}
}

scripted_trigger sibling_0004_vassal_trigger = {
	number_of_opposing_personality_traits = {
		target = $SIBLING$
		value >= 1
	}
	NOR = {
		this = $SIBLING$
		has_relation_friend = $SIBLING$
		is_consort_of = $SIBLING$
		is_close_family_of = $SIBLING$
	}
}

sibling.0004 = {
	type = character_event
	title = sibling.0004.t
	desc = {
		desc = sibling.0004.opening
		first_valid = {
			desc = sibling.0004.fallback
		}
	}
	theme = family
	left_portrait = {
		character = scope:sibling
		animation = dismissal
	}
	right_portrait = {
		character = scope:vassal
		animation = disapproval
	}
	override_background = { reference = throne_room }

	trigger = {
		NOT = { has_character_flag = had_sibling_vassal_relation_event }
		any_sibling = {
			sibling_0004_troublemaker_sibling_trigger = yes
			save_temporary_scope_as = comparison_sibling
		}
		OR = {
			any_vassal = {
				sibling_0004_vassal_trigger = { SIBLING = scope:comparison_sibling }
			}
			trigger_if = {
				limit = { is_landed = no }
				any_courtier = {
					sibling_0004_vassal_trigger = { SIBLING = scope:comparison_sibling }
				}
			}
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_sibling_vassal_relation_event
			years = 5
		}
		random_sibling = {
			limit = {
				sibling_0004_troublemaker_sibling_trigger = yes
				save_temporary_scope_as = comparison_sibling
				root = {
					OR = {
						any_vassal = {
							sibling_0004_vassal_trigger = { SIBLING = scope:comparison_sibling }
							save_temporary_scope_as = vassal_temp
						}
						trigger_if = {
							limit = { is_landed = no }
							any_courtier = {
								sibling_0004_vassal_trigger = { SIBLING = scope:comparison_sibling }
								save_temporary_scope_as = vassal_temp
							}
						}
					}
				}
			}
			save_scope_as = sibling
			scope:vassal_temp = {
				save_scope_as = vassal
				set_variable = {
					name = hates_lieges_sibling
					value = scope:sibling
				}
			}
		}
	}

	option = { #Side with sibling
		name = sibling.0004.a
		scope:vassal = {
			add_opinion = {
				target = root
				modifier = has_annoying_sibling_opinion
			}
		}
		scope:sibling = {
			increase_sibling_causing_trouble_value_effect = yes
		}
	}

	option = { #Side with vassal
		name = sibling.0004.b
		add_prestige = medium_prestige_loss
		dynasty = {
			add_dynasty_prestige = minor_dynasty_prestige_loss
		}
		scope:sibling = {
			add_opinion = {
				target = root
				modifier = told_off_by_sibling_opinion
			}
			decrease_sibling_causing_trouble_value_effect = yes
		}
	}

	option = { #Chide them both
		name = sibling.0004.c
		add_prestige = minor_prestige_gain
		stress_impact = {
			base = medium_stress_gain
		}
	}
}

scripted_trigger sibling_0005_vassal_trigger = {
	NOR = {
		this = $SIBLING$
		has_relation_friend = $SIBLING$
		is_consort_of = $SIBLING$
		is_close_family_of = $SIBLING$
	}
}

#The realm gets fed up with Sibling
sibling.0005 = {
	type = character_event
	title = sibling.0005.t
	desc = sibling.0005.desc
	theme = family
	left_portrait = {
		character = scope:vassal
		animation = dismissal
	}
	right_portrait = {
		character = scope:sibling
		animation = disapproval
	}
	override_background = { reference = throne_room }

	trigger = {
		any_sibling = {
			OR = {
				liege ?= root
				employer ?= root
			}
			has_variable = sibling_causing_trouble
			var:sibling_causing_trouble > 1
			save_temporary_scope_as = sibling_temp
		}
		OR = {
			any_vassal = {
				count >= 3
				sibling_0005_vassal_trigger = { SIBLING = scope:sibling_temp }
			}
			trigger_if = {
				limit = { is_landed = no }
				any_courtier = {
					count >= 3
					sibling_0005_vassal_trigger = { SIBLING = scope:sibling_temp }
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 1
			any_sibling ={
				has_variable = sibling_causing_trouble
				var:sibling_causing_trouble > 2
			}
		}
	}

	immediate = {
		ordered_sibling = {
			limit = { has_variable = sibling_causing_trouble }
			order_by = var:sibling_causing_trouble
			save_scope_as = sibling
			save_scope_as = compare_character
			remove_variable = sibling_causing_trouble
		}
		random_vassal = {
			limit = {
				var:hates_lieges_sibling ?= scope:sibling
				sibling_0005_vassal_trigger = { SIBLING = scope:sibling }
			}
			alternative_limit = {
				has_a_personality_trait_opposite_to_compare_character_trigger = yes
				sibling_0005_vassal_trigger = { SIBLING = scope:sibling }
			}
			alternative_limit = {
				sibling_0005_vassal_trigger = { SIBLING = scope:sibling }
			}
			save_scope_as = vassal
		}
		#If root doesn't have any vassals, use a courtier or guest instead
		if = {
			limit = {
				NOT = { exists = scope:vassal }
			}
			random_courtier = {
				limit = {
					var:hates_lieges_sibling ?= scope:sibling
					sibling_0005_vassal_trigger = { SIBLING = scope:sibling }
				}
				alternative_limit = {
					has_a_personality_trait_opposite_to_compare_character_trigger = yes
					sibling_0005_vassal_trigger = { SIBLING = scope:sibling }
				}
				alternative_limit = {
					sibling_0005_vassal_trigger = { SIBLING = scope:sibling }
				}
				save_scope_as = vassal
			}
		}
	}

	option = { #Don't talk like that about my sibling!
		name = sibling.0005.a
		if = {
			limit = { is_landed = yes }
			every_vassal = {
				limit = {
					sibling_0005_vassal_trigger = { SIBLING = scope:sibling }
				}
				custom = custom.every_vassal
				add_opinion = {
					target = root
					modifier = refused_to_rein_in_sibling_opinion
				}
			}
		}
		else = {
			every_courtier = {
				limit = {
					sibling_0005_vassal_trigger = { SIBLING = scope:sibling }
				}
				custom = custom.every_follower
				add_opinion = {
					target = root
					modifier = refused_to_rein_in_sibling_opinion
				}
			}
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:sibling
			}
		}
	}

	option = { #Sigh, give it up, sibling.
		name = sibling.0005.b
		stress_impact = {
			base = major_stress_gain
		}
		scope:sibling = {
			add_opinion = {
				target = root
				modifier = sibling_reined_me_in_opinion
			}
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:sibling
				multiplier = -1
			}
		}
	}

	option = { #Enough is enough, throw them in the dungeon
		name = sibling.0005.c
		add_dread = medium_dread_gain
		add_tyranny = minor_tyranny_gain
		imprison_character_effect_ignore_reason = {
			TARGET = scope:sibling
			IMPRISONER = root
		}
		ai_chance = {
			base = 20
		}
	}
}








# A skilled sibling adds a diplomacy modifier
scripted_trigger sibling_events_friendly_adult_trigger = {
	OR = {
		liege ?= root
		employer ?= root
	}
	is_available_ai_adult = yes
	opinion = {
		target = root
		value > 30
	}
	NOT = {
		has_opinion_modifier = {
			target = root
			modifier = sibling_refused_help_opinion
		}
	}
}

scripted_trigger sibling_1001_helpful_sibling_trigger = {
	sibling_events_friendly_adult_trigger = yes
	diplomacy >= decent_skill_rating
}

sibling.1001 = {
	type = character_event
	title = sibling.1001.t
	desc = sibling.1001.desc
	theme = family
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:sibling
		animation = admiration
	}
	override_background = { reference = corridor_day }

	trigger = {
		NOT = { has_character_flag = had_sibling_help_event }
		NOT = { has_character_modifier = sibling_aids_in_diplomacy }
		is_playable_character = yes
		any_sibling = {
			sibling_1001_helpful_sibling_trigger = yes
		}
	}

	immediate = {
		random_sibling = {
			limit = {
				sibling_1001_helpful_sibling_trigger = yes
			}
			save_scope_as = sibling
		}
		add_character_flag = {
			flag = had_sibling_help_event
			years = 3
		}
	}

	option = { #Yes please
		name = sibling.1001.a
		add_character_modifier = {
			modifier = sibling_aids_in_diplomacy
			years = 5
		}
		add_opinion = {
			target = root
			modifier = sibling_aiding_diplomacy_opinion
		}
		scope:sibling = {
			increase_helped_landed_sibling_value_effect = yes
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #No
		name = sibling.1001.b
		stress_impact = {
			base = minor_stress_gain
		}
		scope:sibling = {
			add_opinion = {
				target = root
				modifier = sibling_refused_help_opinion
			}
		}
		ai_chance = {
			base = 10
		}
	}
}




# A skilled sibling adds a martial modifier
scripted_trigger sibling_1002_helpful_sibling_trigger = {
	sibling_events_friendly_adult_trigger = yes
	martial >= decent_skill_rating
}

sibling.1002 = {
	type = character_event
	title = sibling.1002.t
	desc = sibling.1002.desc
	theme = family
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:sibling
		animation = admiration
	}
	override_background = { reference = courtyard }

	trigger = {
		NOT = { has_character_flag = had_sibling_help_event }
		NOT = { has_character_modifier = sibling_aids_in_diplomacy }
		is_landed = yes
		any_sibling = {
			sibling_1002_helpful_sibling_trigger = yes
		}
	}

	immediate = {
		random_sibling = {
			limit = {
				sibling_1002_helpful_sibling_trigger = yes
			}
			save_scope_as = sibling
		}
		add_character_flag = {
			flag = had_sibling_help_event
			years = 3
		}
	}

	option = {
		name = sibling.1002.a
		add_character_modifier = {
			modifier = sibling_aids_in_martial
			years = 5
		}
		add_opinion = {
			target = root
			modifier = sibling_aiding_martial_opinion
		}
		scope:sibling = {
			increase_helped_landed_sibling_value_effect = yes
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = sibling.1002.b
		stress_impact = {
			base = minor_stress_gain
		}
		scope:sibling = {
			add_opinion = {
				target = root
				modifier = sibling_refused_help_opinion
			}
		}
		ai_chance = {
			base = 10
		}
	}
}



# A skilled sibling adds a intrigue modifier
scripted_trigger sibling_1003_helpful_sibling_trigger = {
	sibling_events_friendly_adult_trigger = yes
	intrigue >= decent_skill_rating
}

sibling.1003 = {
	type = character_event
	title = sibling.1003.t
	desc = sibling.1003.desc
	theme = family
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:sibling
		animation = scheme
	}
	override_background = { reference = relaxing_room }

	trigger = {
		NOT = { has_character_flag = had_sibling_help_event }
		is_landed = yes
		any_sibling = {
			sibling_1003_helpful_sibling_trigger = yes
		}
	}

	immediate = {
		random_sibling = {
			limit = {
				sibling_1003_helpful_sibling_trigger = yes
			}
			save_scope_as = sibling
		}
		add_character_flag = {
			flag = had_sibling_help_event
			years = 3
		}
	}

	option = {
		name = sibling.1003.a
		add_character_modifier = {
			modifier = sibling_aids_in_intrigue
			years = 5
		}
		add_opinion = {
			target = root
			modifier = sibling_aiding_intrigue_opinion
		}
		scope:sibling = {
			increase_helped_landed_sibling_value_effect = yes
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = sibling.1003.b
		stress_impact = {
			base = minor_stress_gain
		}
		scope:sibling = {
			add_opinion = {
				target = root
				modifier = sibling_refused_help_opinion
			}
		}
		ai_chance = {
			base = 10
		}
	}
}




# A skilled sibling adds a stewardship modifier
scripted_trigger sibling_1004_helpful_sibling_trigger = {
	sibling_events_friendly_adult_trigger = yes
	stewardship >= decent_skill_rating
}

sibling.1004 = {
	type = character_event
	title = sibling.1004.t
	desc = sibling.1004.desc
	theme = family
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:sibling
		animation = page_flipping
	}
	override_background = { reference = study }

	trigger = {
		NOT = { has_character_flag = had_sibling_help_event }
		any_sibling = {
			sibling_1004_helpful_sibling_trigger = yes
		}
	}

	immediate = {
		random_sibling = {
			limit = {
				sibling_1004_helpful_sibling_trigger = yes
			}
			save_scope_as = sibling
		}
		add_character_flag = {
			flag = had_sibling_help_event
			years = 3
		}
	}

	option = {
		name = sibling.1004.a
		add_character_modifier = {
			modifier = sibling_aids_in_stewardship
			years = 5
		}
		add_opinion = {
			target = root
			modifier = sibling_aiding_stewardship_opinion
		}
		scope:sibling = {
			increase_helped_landed_sibling_value_effect = yes
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = sibling.1004.b
		stress_impact = {
			base = minor_stress_gain
		}
		scope:sibling = {
			add_opinion = {
				target = root
				modifier = sibling_refused_help_opinion
			}
		}
		ai_chance = {
			base = 10
		}
	}
}



# A skilled sibling adds a learning modifier
scripted_trigger sibling_1005_helpful_sibling_trigger = {
	sibling_events_friendly_adult_trigger = yes
	learning >= decent_skill_rating
	faith = root.faith
}

sibling.1005 = {
	type = character_event
	title = sibling.1005.t
	desc = sibling.1005.desc
	theme = family
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:sibling
		animation = personality_zealous
	}
	override_background = { reference = study }

	trigger = {
		NOT = { has_character_flag = had_sibling_help_event }
		any_sibling = {
			sibling_1005_helpful_sibling_trigger = yes
		}
	}

	immediate = {
		random_sibling = {
			limit = {
				sibling_1005_helpful_sibling_trigger = yes
			}
			save_scope_as = sibling
		}
		add_character_flag = {
			flag = had_sibling_help_event
			years = 3
		}
	}

	option = {
		name = sibling.1005.a
		add_character_modifier = {
			modifier = sibling_aids_in_learning
			years = 5
		}
		add_opinion = {
			target = root
			modifier = sibling_aiding_learning_opinion
		}
		scope:sibling = {
			increase_helped_landed_sibling_value_effect = yes
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = sibling.1005.b
		stress_impact = {
			base = minor_stress_loss
		}
		scope:sibling = {
			add_opinion = {
				target = root
				modifier = sibling_refused_help_opinion
			}
		}
		ai_chance = {
			base = 10
		}
	}
}




#A sibling causes stress and worry
scripted_trigger sibling_2001_cause_of_worry_trigger = {
	OR = {
		liege ?= root
		employer ?= root
	}
	is_available_ai_adult = yes
	OR = {
		AND = {
			has_variable = sibling_causing_trouble
			var:sibling_causing_trouble > 0
		}
		reverse_opinion = {
			target = root
			value < 0
		}
	}
}
sibling.2001 = {
	type = character_event
	title = sibling.2001.t
	desc = {
		desc = sibling.2001.opening
		random_valid = {
			desc = sibling.2001.fallback
		}
	}	
	theme = family
	left_portrait = {
		character = root
		animation = stress
	}
	right_portrait = {
		character = scope:sibling
		animation = war_over_win
	}
	override_background = { reference = throne_room }

	trigger = {
		NOT = { has_character_flag = had_sibling_stress_event }
		any_sibling = {
			sibling_2001_cause_of_worry_trigger = yes
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_sibling_stress_event
			years = 5
		}
		random_sibling = {
			limit = {
				sibling_2001_cause_of_worry_trigger = yes
			}
			weight = {
				base = 1
				modifier = {
					add = 5
					root = { has_relation_oaf = prev }
				}
			}
			save_scope_as = sibling
		}
	}

	option = {
		name = sibling.2001.a
		stress_impact = {
			base = medium_stress_gain
		}
		scope:sibling = {
			increase_sibling_causing_trouble_value_effect = yes
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = sibling.2001.b
		scope:sibling = {
			add_opinion = {
				target = root
				modifier = told_off_by_stressed_sibling_opinion
			}
			decrease_sibling_causing_trouble_value_effect = yes
		}
		ai_chance = {
			base = 100
			compare_modifier = {
				value = stress_level
				multiplier = 100
			}
		}
	}
}




#######
# Unlanded Sibling Trait events
#######
scripted_trigger sibling_8001_greedy_sibling_trigger = {
	OR = {
		liege ?= root
		employer ?= root
	}
	is_available_ai_adult = yes
	has_trait = greedy
}

#A Greedy Sibling causes trouble
sibling.8001 = {
	type = character_event
	title = sibling.8001.t
	desc = sibling.8001.desc
	theme = family
	left_portrait = {
		character = root
		animation = disapproval
	}
	right_portrait = {
		character = scope:sibling
		animation = steward
	}
	override_background = { reference = study }

	trigger = {
		NOT = { has_character_flag = had_sibling_trait_event }
		any_sibling = {
			sibling_8001_greedy_sibling_trigger = yes
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_sibling_trait_event
			years = 3
		}
		random_sibling = {
			limit = {
				sibling_8001_greedy_sibling_trigger = yes
			}
			save_scope_as = sibling
		}
		pay_short_term_gold = {
			target = scope:sibling
			gold = minor_gold_value
		}
		add_opinion = {
			target = scope:sibling
			modifier = sibling_behaved_badly_opinion
		}
	}

	option = {
		name = sibling.8001.a
		scope:sibling = { increase_sibling_causing_trouble_value_effect = yes }
	}
}



#A Generous Sibling interacts with local peasants
scripted_trigger sibling_8002_generous_sibling_trigger = {
	liege = root
	is_available_ai_adult = yes
	has_trait = generous
}

sibling.8002 = {
	type = character_event
	title = sibling.8002.t
	desc = sibling.8002.desc
	theme = family
	left_portrait = {
		character = root
		animation = war_over_win
	}
	right_portrait = {
		character = scope:sibling
		animation = admiration
	}
	override_background = { reference = corridor_day }

	trigger = {
		NOT = { has_character_flag = had_sibling_trait_event }
		any_sibling = {
			sibling_8002_generous_sibling_trigger = yes
		}
		gold >= minor_gold_value_check
	}

	immediate = {
		add_character_flag = {
			flag = had_sibling_trait_event
			years = 3
		}
		random_sibling = {
			limit = {
				sibling_8002_generous_sibling_trigger = yes
			}
			save_scope_as = sibling
		}
		if = {
			limit = { is_landed = yes }
			random_realm_province = { save_scope_as = province }
		}
		else = {
			domicile.domicile_location = { save_scope_as = province }
		}
		remove_short_term_gold = minor_gold_value
	}

	option = {
		name = sibling.8002.a
		trigger = {
			NOT = {
				has_trait = arrogant
			}
			NOT = {
				has_trait = greedy
			}
		}
		stress_impact = {
			callous = minor_stress_impact_gain
		}
		every_held_title = {
			title_tier = county
			add_county_modifier = {
				modifier = popular_sibling_modifier
				years = 5
			}
		}
		hidden_effect = {
			add_opinion = {
				target = scope:sibling
				modifier = sibling_helped_me_with_peasants_opinion
			}
		}
		scope:sibling = {
			increase_helped_landed_sibling_value_effect = yes
		}
	}

	option = {
		name = sibling.8002.b
		stress_impact = {
			generous = minor_stress_impact_gain
		}
		scope:sibling = {
			add_opinion = {
				target = root
				modifier = sibling_dislikes_charity_opinion
			}
			increase_sibling_causing_trouble_value_effect = yes
		}
	}
}



#A Lustful Sibling tries something with a servant
scripted_trigger sibling_8003_lustful_sibling_trigger = {
	liege = root
	is_available_ai_adult = yes
	has_trait = lustful
	is_male = yes
}

sibling.8003 = {
	type = character_event
	title = sibling.8003.t
	desc = sibling.8003.desc
	theme = family
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = {
		character = scope:sibling
		animation = flirtation
	}
	override_background = { reference = corridor_day }

	trigger = {
		NOT = { has_character_flag = had_sibling_trait_event }
		any_sibling = {
			sibling_8003_lustful_sibling_trigger = yes
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_sibling_trait_event
			years = 3
		}
		random_sibling = {
			limit = {
				sibling_8003_lustful_sibling_trigger = yes
			}
			save_scope_as = sibling
		}
		scope:sibling = {
			pick_servant_romance_target_effect = yes			   
			increase_sibling_causing_trouble_value_effect = yes
		}
	}

	option = { #Let them do what they want
		name = sibling.8003.a
		custom_tooltip = risk_of_sibling_producing_bastard_tt
		hidden_effect = {
			hidden_effect = {
				if = { #Had sex with a man
					limit = {
						scope:sibling = {
							OR = {
								var:servant_romance_target = flag:stable_boy
								var:servant_romance_target = flag:page
							}
						}
					}
					had_sex_with_unknown_effect = {
						GENDER = male
					}
				}
				else_if = { #Had sex with a woman
					limit = {
						scope:sibling = {
							OR = {
								var:servant_romance_target = flag:scullery_maid
								var:servant_romance_target = flag:launderer
							}
						}
					}
					had_sex_with_unknown_effect = {
						GENDER = female
					}
				}
				else = { #Had sex with whatever gender you're attracted to
					random_list = {
						50 = {
							trigger = {
								is_attracted_to_men = yes
							}
							had_sex_with_unknown_effect = {
								GENDER = male
							}
						}
						50 = {
							trigger = {
								is_attracted_to_women = yes
							}
							had_sex_with_unknown_effect = {
								GENDER = female
							}
						}
					}
				}
			}
		}
	}

	option = { #Forbid the relationship
		name = sibling.8003.b
		stress_impact = {
			base = minor_stress_gain
		}
		scope:sibling = {
			add_opinion = {
				target = root
				modifier = sibling_wants_me_to_change_opinion
			}
		}
	}
}


#Arrogant sibling upsets peasants
scripted_trigger sibling_8004_arrogant_sibling_trigger = {
	is_available_ai_adult = yes
	has_trait = arrogant
}

scripted_trigger sibling_8004_target_county_trigger = {
	tier = tier_county
	NOR = {
		has_county_modifier = hated_sibling_county_modifier
		has_county_modifier = popular_sibling_modifier
	}
}

sibling.8004 = {
	type = character_event
	title = sibling.8004.t
	desc = sibling.8004.desc
	theme = family
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = {
		character = scope:sibling
		animation = flirtation
	}
	override_background = { reference = corridor_day }

	trigger = {
		is_landed = yes
		NOT = { has_character_flag = had_sibling_trait_event }
		any_sibling = {
			sibling_8004_arrogant_sibling_trigger = yes
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_sibling_trait_event
			years = 3
		}
		random_sibling = {
			limit = {
				sibling_8004_arrogant_sibling_trigger = yes
			}
			save_scope_as = sibling
		}
		random_held_title = {
			limit = {
				sibling_8004_target_county_trigger = yes
			}
			save_scope_as = province
		}
		hidden_effect = {
			add_opinion = {
				target = scope:sibling
				modifier = sibling_behaved_badly_opinion
			}
		}
	}

	option = {
		name = sibling.8004.a
		scope:province = {
			add_county_modifier = {
				modifier = hated_sibling_county_modifier
				years = 5
			}
		}
		scope:sibling = {
			increase_sibling_causing_trouble_value_effect = yes
		}
	}
}



#Impatient sibling
scripted_trigger sibling_8005_impatient_sibling_trigger = {
	OR = {
		liege ?= root
		employer ?= root
	}
	is_available_ai_adult = yes
	has_trait = impatient 
}

scripted_trigger sibling_8005_vassal_trigger = {
	NOT = { is_close_family_of = root }
}

sibling.8005 = {
	type = character_event
	title = sibling.8005.t
	desc = sibling.8005.desc
	theme = family
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = {
		character = scope:vassal
		animation = disapproval
	}
	lower_center_portrait = scope:sibling
	override_background = { reference = courtyard }

	trigger = {
		NOT = { has_character_flag = had_sibling_trait_event }
		is_landed = yes
		any_sibling = {
			sibling_8005_impatient_sibling_trigger = yes
		}
		any_vassal = {
			sibling_8005_vassal_trigger = yes
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_sibling_trait_event
			years = 3
		}
		random_sibling = {
			limit = { sibling_8005_impatient_sibling_trigger = yes }
			save_scope_as = sibling
		}
		random_vassal = {
			limit = { sibling_8005_vassal_trigger = yes }
			save_scope_as = vassal
		}
		hidden_effect = {
			add_opinion = {
				target = scope:sibling
				modifier = sibling_behaved_badly_opinion
			}
		}
		scope:sibling = {
			increase_sibling_causing_trouble_value_effect = yes
		}
	}

	option = {
		name = sibling.8005.a
		pay_short_term_gold = {
			target = scope:vassal
			gold = minor_gold_value
		}
		add_prestige = minor_prestige_loss
	}

	option = {
		name = sibling.8005.b
		stress_impact = {
			base = minor_stress_gain
		}
		add_prestige = medium_prestige_loss
	}
}



# Just Sibling improves reputation
scripted_trigger sibling_8006_just_sibling_trigger = {
	is_available_ai_adult = yes
	has_trait = just
}

scripted_trigger sibling_8006_vassal_trigger = {
	NOR = {
		has_relation_rival = scope:sibling
		has_relation_potential_rival = scope:sibling
	}
}

sibling.8006 = {
	type = character_event
	title = sibling.8006.t
	desc = sibling.8006.desc
	theme = family
	left_portrait = {
		character = scope:vassal
		animation = happiness
	}
	right_portrait = {
		character = scope:sibling
		animation = war_over_tie
	}
	override_background = { reference = throne_room }

	trigger = {
		NOT = { has_character_flag = had_sibling_trait_event }
		is_landed = yes
		any_sibling = {
			sibling_8006_just_sibling_trigger = yes
			save_temporary_scope_as = sibling
		}
		any_vassal = {
			sibling_8006_vassal_trigger = yes
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_sibling_trait_event
			years = 3
		}
		random_sibling = {
			limit = {
				sibling_8006_just_sibling_trigger = yes
			}
			save_scope_as = sibling
		}
		random_vassal = {
			limit = {
				sibling_8006_vassal_trigger = yes
			}
			save_scope_as = vassal
		}
		scope:sibling = {
			increase_helped_landed_sibling_value_effect = yes
		}
	}

	option = { # Accept praise
		name = sibling.8006.a
		scope:vassal = {
			add_opinion = {
				modifier = sibling_delivered_just_judgement_opinion
				target = root
			}
			add_opinion = {
				modifier = delivered_just_judgement_opinion
				target = scope:sibling
			}
		}
	}

	option = { # They are simply helping me with MY job
		name = sibling.8006.b
		stress_impact = {
			base = minor_stress_loss
		}
	}
}
