﻿namespace = bp1_yearly

# bp1_yearly.1000 - Claudia Baldassi - A New Hobby
# bp1_yearly.1010 - Claudia Baldassi - Holy Mediation
# bp1_yearly.1020-1 - Claudia Baldassi - A Friend till the End
# bp1_yearly.1030-1 - Claudia Baldassi - Till the Bitter End
# bp1_yearly.1040 - Claudia Baldassi - Something in Common
# bp1_yearly.1050 - Claudia Baldassi - Annoying Company

# Best friend introduces you to a new hobby (could be anything, from stitching to becoming a cannibal)

bp1_yearly.1000 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.1000.t
	desc = {
		desc = bp1_yearly.1000.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:friend = {
						OR = {
							has_trait = cannibal
							any_secret = { secret_type = secret_cannibal }
						}
					}
					NOR = {
						has_trait = cannibal
						any_secret = { secret_type = secret_cannibal }
					}
				}
				desc = bp1_yearly.1000.desc_cannibal
			}
			triggered_desc = {
				trigger = {
					scope:friend = {
						OR = {
							has_trait = deviant
							any_secret = { secret_type = secret_deviant }
						}
					}
					NOR = {
						has_trait = deviant
						any_secret = { secret_type = secret_deviant }
					}
				}
				desc = bp1_yearly.1000.desc_deviant
			}
			triggered_desc = {
				trigger = {
					scope:friend = {
						OR = {
							has_trait = witch
							any_secret = { secret_type = secret_witch }
						}
					}
					NOR = {
						has_trait = witch
						any_secret = { secret_type = secret_witch }
					}
				}
				desc = bp1_yearly.1000.desc_witch
			}
			triggered_desc = {
				trigger = {
					scope:friend = {
						has_trait = hashishiyah
					}
					NOT = {
						has_trait = hashishiyah
					}
				}
				desc = bp1_yearly.1000.desc_hashish
			}
			triggered_desc = {
				trigger = {
					scope:friend = {
						has_trait = drunkard
					}
					NOT = {
						has_trait = drunkard
					}
				}
				desc = bp1_yearly.1000.desc_drunkard
			}
			triggered_desc = {
				trigger = {
					scope:friend = {
						has_trait = lifestyle_reveler
					}
					NOT = {
						has_trait = lifestyle_reveler
					}
				}
				desc = bp1_yearly.1000.desc_reveler
			}
			triggered_desc = {
				trigger = {
					scope:friend = {
						has_trait = lifestyle_hunter
					}
					NOT = {
						has_trait = lifestyle_hunter
					}
				}
				desc = bp1_yearly.1000.desc_hunter
			}
			triggered_desc = {
				trigger = {
					scope:friend = {
						has_trait = confider
					}
					NOT = {
						has_trait = confider
					}
				}
				desc = bp1_yearly.1000.desc_confider
			}
			triggered_desc = {
				trigger = {
					scope:friend = {
						has_trait = athletic
					}
					NOT = {
						has_trait = athletic
					}
				}
				desc = bp1_yearly.1000.desc_athletic
			}
			random_valid = {
				desc = bp1_yearly.1000.desc_fallback_1
				desc = bp1_yearly.1000.desc_fallback_2
				desc = bp1_yearly.1000.desc_fallback_3
			}
		}
	}
	theme = friendly
	override_background = { reference = corridor_day }
	left_portrait = {
		character = root
		animation = personality_content
	}
	right_portrait = {
		character = scope:friend
		animation = happiness
	}
	cooldown = { years = 10 }

	trigger = {
		has_dlc_feature = friends_and_foes
		any_relation = {
			type = best_friend
			is_available_ai_adult = yes
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 1
			any_relation = {
				type = best_friend
				OR = {
					has_trait = cannibal
					any_secret = { secret_type = secret_cannibal }
				}
			}
			NOR = {
				has_trait = cannibal
				any_secret = { secret_type = secret_cannibal }
			}
		}
		modifier = {
			add = 1
			any_relation = {
				type = best_friend
				OR = {
					has_trait = deviant
					any_secret = { secret_type = secret_deviant }
				}
			}
			NOR = {
				has_trait = deviant
				any_secret = { secret_type = secret_deviant }
			}
		}
		modifier = {
			add = 1
			any_relation = {
				type = best_friend
				OR = {
					has_trait = witch
					any_secret = { secret_type = secret_witch }
				}
			}
			NOR = {
				has_trait = witch
				any_secret = { secret_type = secret_witch }
			}
		}
		modifier = {
			add = 1
			any_relation = {
				type = best_friend
				has_trait = hashishiyah
			}
			NOT = {
				has_trait = hashishiyah
			}
		}
		modifier = {
			add = 1
			any_relation = {
				type = best_friend
				has_trait = drunkard
			}
			NOT = {
				has_trait = drunkard
			}
		}
		modifier = {
			add = 1
			any_relation = {
				type = best_friend
				has_trait = lifestyle_reveler
			}
			NOT = {
				has_trait = lifestyle_reveler
			}
		}
		modifier = {
			add = 1
			any_relation = {
				type = best_friend
				has_trait = lifestyle_hunter
			}
			NOT = {
				has_trait = lifestyle_hunter
			}
		}
		modifier = {
			add = 1
			any_relation = {
				type = best_friend
				has_trait = confider
			}
			NOT = {
				has_trait = confider
			}
		}
		modifier = {
			add = 1
			any_relation = {
				type = best_friend
				has_trait = athletic
			}
			NOT = {
				has_trait = athletic
			}
		}
	}

	immediate = {
		random_relation = {
			type = best_friend
			limit = { is_available_ai_adult = yes }
			save_scope_as = friend
		}
		if = {
			limit = {
				scope:friend = {
					any_secret = {
						secret_type = secret_cannibal
						NOT = { is_known_by = root }
					}
				}
			}
			scope:friend = {
				random_secret = {
					limit = {
						secret_type = secret_cannibal
						NOT = { is_known_by = root }
					}
					reveal_to = root
				}
			}
		}
		else_if = {
			limit = {
				scope:friend = {
					any_secret = {
						secret_type = secret_deviant
						NOT = { is_known_by = root }
					}
				}
			}
			scope:friend = {
				random_secret = {
					limit = {
						secret_type = secret_deviant
						NOT = { is_known_by = root }
					}
					reveal_to = root
				}
			}
		}
		else_if = {
			limit = {
				scope:friend = {
					any_secret = {
						secret_type = secret_witch
						NOT = { is_known_by = root }
					}
				}
			}
			scope:friend = {
				random_secret = {
					limit = {
						secret_type = secret_witch
						NOT = { is_known_by = root }
					}
					reveal_to = root
				}
			}
		}
	}

	#Option A-1: special for lust
	option = {
		name = bp1_yearly.1000.a1
		trigger = {
			scope:friend = {
				OR = {
					has_trait = cannibal
					any_secret = { secret_type = secret_cannibal }
				}
			}
			NOR = {
				has_trait = cannibal
				any_secret = { secret_type = secret_cannibal }
			}
			OR = {
				has_trait = lustful
				has_trait = rakish
				has_trait = deviant
			}
		}
		if = {
			limit = {
				scope:friend = {
					is_attracted_to_gender_of = root
					can_set_relation_potential_lover_trigger = { CHARACTER = root }
					OR = {
						has_trait = lustful
						has_trait = rakish
						has_trait = deviant
					}
				}
			}
			set_relation_potential_lover = scope:friend
			scope:friend = {
				add_opinion = {
					target = root
					modifier = flirty_opinion
				}
			}
		}
		else_if = {
			limit = {
				scope:friend = {
					can_set_relation_lover_trigger = { CHARACTER = root }
				}
			}
			set_relation_lover = { reason = lover_carnal_passion target = scope:friend }
			scope:friend = {
				add_opinion = {
					target = root
					modifier = flirty_opinion
				}
			}
		}
		else = {
			scope:friend = {
				add_opinion = {
					target = root
					modifier = awkward_opinion
					opinion = -20
				}
			}
		}
		ai_chance = {
			base = 250
			modifier = {
				NOT = { is_attracted_to_gender_of = scope:friend }
				add = -200
			}
		}
	}

	#Option A: yes
	option = {
		name = bp1_yearly.1000.a
		scope:friend = {
			add_opinion = {
				target = root
				modifier = friendliness_opinion
				opinion = 50
			}
		}
		if = {
			limit = {
				scope:friend = {
					OR = {
						has_trait = cannibal
						any_secret = { secret_type = secret_cannibal }
					}
				}
				NOR = {
					has_trait = cannibal
					any_secret = { secret_type = secret_cannibal }
				}
			}
			give_cannibal_secret_or_trait_effect = yes
			random = {
				chance = 25
				custom_tooltip = bp1_yearly.1000.a.tt
				send_interface_toast = {
					type = event_toast_effect_good
					title = bp1_yearly.1000.a.tt.2
					left_icon = root
					right_icon = scope:friend
					add_intrigue_skill = 1
				}
			}
			stress_impact = {
				compassionate = major_stress_impact_gain
			}
		}
		else_if = {
			limit = {
				scope:friend = {
					OR = {
						has_trait = deviant
						any_secret = { secret_type = secret_deviant }
					}
				}
			}
			give_deviant_secret_or_trait_effect = yes
			random = {
				chance = 25
				custom_tooltip = bp1_yearly.1000.a.tt
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = bp1_yearly.1000.a.tt.2
					left_icon = root
					right_icon = scope:friend
					add_intrigue_skill = 1
				}
			}
			stress_impact = {
				chaste = major_stress_impact_gain
				celibate = massive_stress_impact_gain
			}
		}
		else_if = {
			limit = {
				scope:friend = {
					OR = {
						has_trait = witch
						any_secret = { secret_type = secret_witch }
					}
				}
			}
			give_witch_secret_or_trait_effect = yes
			random = {
				chance = 25
				custom_tooltip = bp1_yearly.1000.a.tt
				send_interface_toast = {
					type = event_toast_effect_good
					title = bp1_yearly.1000.a.tt.2
					left_icon = root
					right_icon = scope:friend
					add_learning_skill = 1
				}
			}
			if = {
				limit = {
					faith = { trait_is_sin = witch }
				}
				stress_impact = {
					zealous = major_stress_impact_gain
				}
			}
		}
		else_if = {
			limit = {
				scope:friend = {
					has_trait = hashishiyah
				}
				NOT = { has_trait = hashishiyah }
			}
			random = {
				chance = 50
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = bp1_yearly.1000.a.tt.3
					left_icon = root
					right_icon = scope:friend
					add_trait = hashishiyah
				}
			}
			stress_impact = {
				temperate = major_stress_impact_gain
			}
		}
		else_if = {
			limit = {
				scope:friend = {
					has_trait = drunkard
				}
				NOT = { has_trait = drunkard }
			}
			random = {
				chance = 50
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = bp1_yearly.1000.a.tt.3
					left_icon = root
					right_icon = scope:friend
					add_trait = drunkard
				}
			}
			stress_impact = {
				temperate = major_stress_impact_gain
			}
		}
		else_if = {
			limit = {
				scope:friend = {
					has_trait = lifestyle_reveler
				}
				NOT = { has_trait = lifestyle_reveler }
			}
			random = {
				chance = 33
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = bp1_yearly.1000.a.tt.3
					left_icon = root
					right_icon = scope:friend
					add_trait = lifestyle_reveler
				}
			}
			random = {
				chance = 25
				custom_tooltip = bp1_yearly.1000.a.tt
				send_interface_toast = {
					type = event_toast_effect_good
					title = bp1_yearly.1000.a.tt.2
					left_icon = root
					right_icon = scope:friend
					add_diplomacy_skill = 1
				}
			}
			stress_impact = {
				temperate = medium_stress_impact_gain
				shy = major_stress_impact_gain
			}
		}
		else_if = {
			limit = {
				scope:friend = {
					has_trait = lifestyle_hunter
				}
				NOT = { has_trait = lifestyle_hunter }
			}
			random = {
				chance = 33
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = bp1_yearly.1000.a.tt.3
					left_icon = root
					right_icon = scope:friend
					add_trait = lifestyle_hunter
				}
			}
			random = {
				chance = 25
				custom_tooltip = bp1_yearly.1000.a.tt
				send_interface_toast = {
					type = event_toast_effect_good
					title = bp1_yearly.1000.a.tt.2
					left_icon = root
					right_icon = scope:friend
					add_prowess_skill = 1
				}
			}
			stress_impact = {
				compassionate = medium_stress_impact_gain
			}
		}
		else_if = {
			limit = {
				scope:friend = {
					has_trait = confider
				}
				NOT = { has_trait = confider }
			}
			random = {
				chance = 20
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = bp1_yearly.1000.a.tt.3
					left_icon = root
					right_icon = scope:friend
					add_trait = confider
				}
			}
			random = {
				chance = 25
				custom_tooltip = bp1_yearly.1000.a.tt
				send_interface_toast = {
					type = event_toast_effect_good
					title = bp1_yearly.1000.a.tt.2
					left_icon = root
					right_icon = scope:friend
					add_diplomacy_skill = 1
				}
			}
			stress_impact = {
				base = major_stress_impact_loss
				shy = medium_stress_impact_gain
			}
		}
		else_if = {
			limit = {
				scope:friend = {
					has_trait = athletic
				}
				NOT = { has_trait = athletic }
			}
			random = {
				chance = 15
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = bp1_yearly.1000.a.tt.3
					left_icon = root
					right_icon = scope:friend
					add_trait = athletic
				}
			}
			random = {
				chance = 25
				custom_tooltip = bp1_yearly.1000.a.tt
				send_interface_toast = {
					type = event_toast_effect_good
					title = bp1_yearly.1000.a.tt.2
					left_icon = root
					right_icon = scope:friend
					add_prowess_skill = 1
				}
			}
			stress_impact = {
				lazy = major_stress_impact_gain
			}
		}
		else = {
			add_character_modifier = {
				modifier = bp1_1000_time_with_bf_modifier
				years = 10
			}
		}
		stress_impact = {
			shy = minor_stress_impact_gain
			lazy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = shy
				add = -25
			}
			modifier = {
				has_trait = lazy
				add = -50
			}
			modifier = {
				scope:friend = {
					OR = {
						has_trait = cannibal
						any_secret = { secret_type = secret_cannibal }
					}
				}
				add = -50
			}
			modifier = {
				scope:friend = {
					OR = {
						has_trait = deviant
						any_secret = { secret_type = secret_deviant }
					}
				}
				add = -50
			}
			modifier = {
				scope:friend = {
					OR = {
						has_trait = witch
						any_secret = { secret_type = secret_witch }
					}
				}
				add = -25
			}
			modifier = {
				scope:friend = { has_trait = drunkard }
				add = -25
			}
			modifier = {
				scope:friend = { has_trait = hashishiyah }
				add = -25
			}
		}
	}

	#Option B: no
	option = {
		name = bp1_yearly.1000.b
		custom_tooltip = bp1_yearly.1000.b.tt
		scope:friend = {
			add_opinion = {
				target = root
				modifier = neglected_opinion
				opinion = -35
			}
		}
		add_character_modifier = {
			modifier = bp1_1000_focus_on_work_modifier
			years = 10
		}
		stress_impact = {
			gregarious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = gregarious
				add = -50
			}
		}
	}

	#Option C: dishonor on you!
	option = {
		name = bp1_yearly.1000.c
		scope:friend = {
			add_opinion = {
				target = root
				modifier = hurt_opinion
				opinion = -50
			}
		}
		if = {
			limit = {
				has_relation_best_friend = scope:friend
			}
			remove_relation_best_friend = scope:friend
		}
		else = {
			remove_relation_friend = scope:friend
		}
		if = {
			limit = {
				scope:friend = {
					any_secret = {
						secret_type = secret_cannibal
					}
				}
			}
			scope:friend = {
				random_secret = {
					limit = {
						secret_type = secret_cannibal
					}
					expose_secret = root
				}
			}
		}
		else_if = {
			limit = {
				scope:friend = {
					any_secret = {
						secret_type = secret_deviant
					}
				}
			}
			scope:friend = {
				random_secret = {
					limit = {
						secret_type = secret_deviant
					}
					expose_secret = root
				}
			}
		}
		else_if = {
			limit = {
				scope:friend = {
					any_secret = {
						secret_type = secret_witch
					}
				}
			}
			scope:friend = {
				random_secret = {
					limit = {
						secret_type = secret_witch
					}
					expose_secret = root
				}
			}
		}
		add_character_modifier = {
			modifier = bp1_1000_focus_on_work_modifier
			years = 10
		}
		ai_chance = {
			base = 50
		}
	}
}

# A friend offers to mediate between yourself and your HoF who has excommunicated you

bp1_yearly.1010 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.1010.t
	desc = bp1_yearly.1010.desc
	theme = friendly
	override_background = { reference = alley_day }
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:friend
		animation = personality_honorable
	}
	lower_right_portrait = scope:pope
	cooldown = { years = 10 }

	trigger = {
		has_dlc_feature = friends_and_foes
		has_trait = excommunicated
		exists = faith.religious_head
		faith.religious_head = {
			NOT = {
				this = root
			}
		}
		any_relation = {
			type = friend
			is_available_ai_adult = yes
			faith = root.faith
			NOR = {
				has_trait = excommunicated
				has_trait = cynical
				this = root.faith.religious_head
			}
		}
	}

	immediate = {
		random_relation = {
			type = friend
			limit = {
				is_available_ai_adult = yes
				faith = root.faith
				NOR = {
					has_trait = excommunicated
					has_trait = cynical
					this = root.faith.religious_head
				}
			}
			save_scope_as = friend
		}
		faith.religious_head = {
			save_scope_as = pope
		}
	}

	#Option A: thanks
	option = {
		name = bp1_yearly.1010.a
		remove_short_term_gold = medium_gold_value
		scope:friend = {
			add_opinion = {
				target = root
				modifier = trust_opinion
				opinion = 20
			}
			duel = {
				skill = diplomacy
				target = scope:pope
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = 2.5
					}
					opinion_modifier = {
						who = scope:pope
						opinion_target = scope:friend
						multiplier = 0.25
						step = 5
					}
					desc = bp1_yearly.1010.a.success
					root = {
						send_interface_toast = {
							type = event_toast_effect_good
							title = bp1_yearly.1010.a.success.tt
							left_icon = root
							right_icon = scope:pope
							remove_trait = excommunicated
							if = {
								limit = {
									is_ai = yes
								}
								add_opinion = {
									target = scope:friend
									modifier = grateful_opinion
									opinion = 30
								}
							}
							reverse_add_opinion = {
								target = scope:pope
								modifier = pleased_opinion
								opinion = 20
							}
							stress_impact = {
								zealous = massive_stress_impact_loss
							}
						}
					}
				}
				40 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -2.5
					}
					opinion_modifier = {
						who = scope:pope
						opinion_target = scope:friend
						multiplier = -0.25
						step = 5
					}
					desc = bp1_yearly.1010.a.failure
					root = {
						send_interface_toast = {
							type = event_toast_effect_bad
							title = bp1_yearly.1010.a.failure.tt
							left_icon = root
							right_icon = scope:pope
							if = {
								limit = {
									is_ai = yes
								}
								add_opinion = {
									target = scope:friend
									modifier = grateful_opinion
									opinion = 5
								}
							}
							stress_impact = {
								zealous = medium_stress_impact_gain
							}
						}
					}
				}
				10 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -2.5
					}
					opinion_modifier = {
						who = scope:pope
						opinion_target = scope:friend
						multiplier = -0.25
						step = 5
					}
					desc = bp1_yearly.1010.a.horrible_failure
					root = {
						send_interface_toast = {
							type = event_toast_effect_bad
							title = bp1_yearly.1010.a.horrible_failure.tt
							left_icon = root
							right_icon = scope:pope
							add_piety = medium_piety_loss
							reverse_add_opinion = {
								target = scope:pope
								modifier = insult_opinion
								opinion = -30
							}
							scope:pope = {
								reverse_add_opinion = {
									target = scope:friend
									modifier = insult_opinion
									opinion = -30
								}
							}
							stress_impact = {
								zealous = massive_stress_impact_gain
							}
						}
					}
				}
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
			}
		}
	}

	#Option B: no thanks
	option = {
		name = bp1_yearly.1010.b
		scope:friend = {
			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -10
			}
		}

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

# A friend visits you on your dying bed

bp1_yearly.1020 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.1020.t
	desc = {
		desc = bp1_yearly.1020.desc_intro
		desc = bp1_yearly.1020.desc
	}
	theme = death
	override_background  = { reference = bedchamber }
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		character = scope:friend
		animation = worry
	}
	cooldown = { years = 10 }

	trigger = {
		has_dlc_feature = friends_and_foes
		OR = {
			any_relation = {
				type = best_friend
				is_available_healthy_ai_adult = yes
			}
			any_relation = {
				type = friend
				is_available_healthy_ai_adult = yes
			}
		}
		OR = {
			health <= death_chance_dying_health
			has_trait = incapable
			has_trait = infirm
		}
	}

	immediate = {
		if = {
			limit = {
				any_relation = {
					type = best_friend
					is_available_healthy_ai_adult = yes
				}
			}
			random_relation = {
				type = best_friend
				limit = { is_available_healthy_ai_adult = yes }
				save_scope_as = friend
			}
		}
		else_if = {
			limit = {
				any_relation = {
					type = friend
					is_available_healthy_ai_adult = yes
				}
			}
			random_relation = {
				type = friend
				limit = { is_available_healthy_ai_adult = yes }
				save_scope_as = friend
			}
		}
		if = {
			limit = {
				NOT = { has_character_flag = use_sickness_clothes }
			}
			add_character_flag = use_sickness_clothes
		}
	}

	#Option A: stay
	option = {
		name = bp1_yearly.1020.a
		add_character_modifier = {
			modifier = bp1_1020_friend_with_modifier
			years = 2
		}
		reverse_add_opinion = {
			target = scope:friend
			modifier = pleased_opinion
			opinion = 10
		}
		stress_impact = {
			gregarious = minor_stress_impact_loss
			shy = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = gregarious
				add = 25
			}
			modifier = {
				has_trait = shy
				add = -25
			}
			modifier = {
				has_trait = arrogant
				add = -50
			}
		}
	}

	#Option B: go
	option = {
		name = bp1_yearly.1020.b
		reverse_add_opinion = {
			target = scope:friend
			modifier = disappointed_opinion
			opinion = -5
		}
		stress_impact = {
			humble = medium_stress_impact_gain
			gregarious = major_stress_impact_gain
			shy = medium_stress_impact_loss
			arrogant = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = humble
				add = -50
			}
			modifier = {
				has_trait = gregarious
				add = -75
			}
			modifier = {
				has_trait = shy
				add = 25
			}
			modifier = {
				has_trait = arrogant
				add = 25
			}
		}
	}
	after = {
		if = {
			limit = {
				has_character_flag = use_sickness_clothes
			}
			remove_character_flag = use_sickness_clothes
		}
	}
}

# You visit a friend on their dying bed

bp1_yearly.1021 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.1020.t
	desc = {
		desc = bp1_yearly.1021.desc
		triggered_desc = {
			trigger = {
				exists = scope:bestie
			}
			desc = bp1_yearly.1021.desc_bestie
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = 1021_token
				}
				desc = bp1_yearly.1021.desc_token
			}
			triggered_desc = {
				trigger = {
					has_character_flag = 1021_secret
				}
				desc = bp1_yearly.1021.desc_secret
			}
			triggered_desc = {
				trigger = {
					has_character_flag = 1021_misery
				}
				desc = bp1_yearly.1021.desc_misery
			}
		}
		triggered_desc = {
			trigger = {
				exists = scope:bestie
			}
			desc = bp1_yearly.1021.desc_end
		}
	}
	theme = death
	override_background  = { reference = bedchamber }
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = {
		character = scope:friend
		animation = sick
	}
	cooldown = { years = 10 }

	trigger = {
		has_dlc_feature = friends_and_foes
		any_relation = {
			type = friend
			is_ai = yes
			OR = {
				health <= death_chance_dying_health
				has_trait = incapable
				has_trait = infirm
			}
		}
		is_available_healthy_adult = yes
	}

	immediate = {
		if = {
			limit = {
				any_relation = {
					type = best_friend
					is_ai = yes
					OR = {
						health <= death_chance_dying_health
						has_trait = incapable
						has_trait = infirm
					}
				}
			}
			random_relation = {
				type = best_friend
				limit = {
					is_ai = yes
					OR = {
						health <= death_chance_dying_health
						has_trait = incapable
						has_trait = infirm
					}
				}
				save_scope_as = friend
				save_scope_as = bestie
			}
		}
		else_if = {
			limit = {
				any_relation = {
					type = friend
						is_ai = yes
						OR = {
						health <= death_chance_dying_health
						has_trait = incapable
						has_trait = infirm
					}
				}
			}
			random_relation = {
				type = friend
				limit = {
					is_ai = yes
					OR = {
						health <= death_chance_dying_health
						has_trait = incapable
						has_trait = infirm
					}
				}
				save_scope_as = friend
			}
		}
		scope:friend = {
			if = {
				limit = {
					NOT = { has_character_flag = use_sickness_clothes }
				}
				add_character_flag = use_sickness_clothes
			}
		}
		if = {
			limit = {
				exists = scope:bestie
			}
			random_list = {
				33 = {
					add_character_flag = 1021_token
					modifier = {
						scope:bestie = {
							has_trait = generous
						}
						add = 20
					}
					modifier = {
						scope:bestie = {
							has_trait = profligate
						}
						add = 30
					}
					modifier = {
						scope:bestie = {
							has_trait = greedy
						}
						factor = 0.5
					}
				}
				45 = {
					trigger = {
						scope:bestie = {
							any_secret = {
								NOT = { is_known_by = root }
							}
						}
					}
					add_character_flag = 1021_secret
					modifier = {
						scope:bestie = {
							has_trait = deceitful
						}
						add = 15
					}
					modifier = {
						scope:bestie = {
							has_trait = honest
						}
						factor = 2
					}
				}
				33 = {
					add_character_flag = 1021_misery
					modifier = {
						scope:bestie = {
							OR = {
								has_trait = depressed_1
								has_trait = depressed_genetic
							}
						}
						factor = 2
					}
					modifier = {
						scope:bestie = {
							OR = {
								has_trait = weak
								has_trait = physique_bad_1
								has_trait = physique_bad_2
								has_trait = physique_bad_3
							}
						}
						add = 25
					}
					modifier = {
						scope:bestie = {
							has_trait = wheezing
						}
						add = 15
					}
				}
			}
		}
		if = {
			limit = {
				has_character_flag = 1021_token
			}
			generate_trinket_effect = {
				TRINKET_RECEIVER = root
				TRINKET_GIVER = scope:bestie
				GRAB_ALL_TRINKETS = no
				HISTORY_TYPE = given
			}
			scope:new_trinket = {
				set_artifact_description = 1021_trinket_desc
			}
		}
		else_if = {
			limit = {
				has_character_flag = 1021_secret
			}
			scope:bestie = {
				random_secret = {
					limit = {
						NOT = { is_known_by = root }
					}
					reveal_to = root
					save_scope_as = secret
				}
			}
		}
	}

	#Option A: stay
	option = {
		name = bp1_yearly.1021.a
		scope:friend = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 15
			}
		}
		add_piety = medium_piety_gain
		if = {
			limit = {
				exists = scope:new_trinket
			}
			show_as_tooltip = {
				scope:new_trinket = { set_owner = root }
			}
		}
		else_if = {
			limit = {
				exists = scope:secret
			}
			show_as_tooltip = {
				scope:secret = { reveal_to = root }
			}
		}
		stress_impact = {
			shy = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
			disloyal = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = compassionate
				add = 50
			}
			modifier = {
				has_trait = callous
				add = -25
			}
			modifier = {
				has_trait = arrogant
				add = -25
			}
			modifier = {
				has_trait = disloyal
				add = -50
			}
			modifier = {
				has_trait = loyal
				add = 50
			}
		}
	}

	#Option B: leave
	option = {
		name = bp1_yearly.1021.b
		scope:friend = {
			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -5
			}
		}
		if = {
			limit = {
				exists = scope:new_trinket
			}
			show_as_tooltip = {
				scope:new_trinket = { set_owner = root }
			}
		}
		else_if = {
			limit = {
				exists = scope:secret
			}
			show_as_tooltip = {
				scope:secret = { reveal_to = root }
			}
		}
		stress_impact = {
			compassionate = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = compassionate
				add = -50
			}
			modifier = {
				has_trait = callous
				add = 25
			}
			modifier = {
				has_trait = arrogant
				add = 25
			}
			modifier = {
				has_trait = loyal
				add = -75
			}
		}
	}

	#Option C: rip
	option = {
		name = bp1_yearly.1021.c
		trigger = {
			has_character_flag = 1021_misery
		}
		scope:bestie = {
			death = {
				death_reason = death_euthanasia
				killer = root
			}
		}
		add_secret = {
			type = secret_murder
			target = scope:bestie
		}
		create_character_memory = {
			type = helped_friend_to_die
			participants = {
				dying_friend = scope:bestie
			}
		}
		stress_impact = {
			compassionate = medium_stress_impact_loss
			loyal = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = compassionate
				add = 50
			}
			modifier = {
				has_trait = loyal
				add = 50
			}
		}
	}

	after = {
		scope:friend ?= {
			if = {
				limit = {
					is_alive = yes
					has_character_flag = use_sickness_clothes
				}
				remove_character_flag = use_sickness_clothes
			}
		}
		if = {
			limit = {
				has_character_flag = 1021_token
			}
			remove_character_flag = 1021_token
		}
		else_if = {
			limit = {
				has_character_flag = 1021_secret
			}
			remove_character_flag = 1021_secret
		}
		else_if = {
			limit = {
				has_character_flag = 1021_misery
			}
			remove_character_flag = 1021_misery
		}
	}
}


# A rival visits you on your dying bed

scripted_trigger bp1_1030_valid_rival_trigger = {
	is_available_healthy_ai_adult = yes
	OR = {
		is_close_family_of = root
		is_councillor_of = root
		is_courtier_of = root
		AND = {
			highest_held_title_tier >= tier_county
			OR = {
				is_vassal_of = root
				target_is_vassal_or_below = root
			}
		}
		AND = {
			has_any_court_position = yes
			court_owner = root
		}
	}
}

bp1_yearly.1030 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.1030.t
	desc = {
		desc = bp1_yearly.1020.desc_intro
		desc = bp1_yearly.1030.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:nemesis
				}
				desc = bp1_yearly.1030.desc_nemesis
			}
			desc = bp1_yearly.1030.desc_rival
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:guard
				}
				desc = bp1_yearly.1030.desc_nemesis_guard
			}
			desc = bp1_yearly.1030.desc_nemesis_no_guard
		}
	}
	theme = death
	override_background  = { reference = bedchamber }
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		character = scope:rival
		animation = schadenfreude
	}
	lower_left_portrait = scope:guard
	cooldown = { years = 10 }

	trigger = {
		has_dlc_feature = friends_and_foes
		any_relation = {
			type = rival
			bp1_1030_valid_rival_trigger = yes
		}
		OR = {
			health <= death_chance_dying_health
			has_trait = incapable
			has_trait = infirm
		}
	}

	immediate = {
		if = {
			limit = {
				any_relation = {
					type = nemesis
					bp1_1030_valid_rival_trigger = yes
				}
			}
			random_relation = {
				type = nemesis
				limit = { bp1_1030_valid_rival_trigger = yes }
				save_scope_as = nemesis
				save_scope_as = rival
			}
		}
		else_if = {
			limit = {
				any_relation = {
					type = rival
					bp1_1030_valid_rival_trigger = yes
				}
			}
			random_relation = {
				type = rival
				limit = { bp1_1030_valid_rival_trigger = yes }
				save_scope_as = rival
			}
		}
		if = {
			limit = {
				exists = scope:nemesis
				employs_court_position = bodyguard_court_position
				any_court_position_holder = {
					type = bodyguard_court_position
					NOR = {
						this = scope:rival
						has_relation_rival = root
					}
					is_available_healthy_ai_adult = yes
				}
			}
			random_court_position_holder = {
				type = bodyguard_court_position
				limit = {
					NOR = {
						this = scope:rival
						has_relation_rival = root
					}
					is_available_healthy_ai_adult = yes
				}
				save_scope_as = guard
			}
		}
		else_if = {
			limit = {
				exists = scope:nemesis
				employs_court_position = akolouthos_court_position
				any_court_position_holder = {
					type = akolouthos_court_position
					NOR = {
						this = scope:rival
						has_relation_rival = root
					}
					is_available_healthy_ai_adult = yes
				}
			}
			random_court_position_holder = {
				type = akolouthos_court_position
				limit = {
					NOR = {
						this = scope:rival
						has_relation_rival = root
					}
					is_available_healthy_ai_adult = yes
				}
				save_scope_as = guard
			}
		}
		if = {
			limit = {
				NOT = { has_character_flag = use_sickness_clothes }
			}
			add_character_flag = use_sickness_clothes
		}
	}

	#Option A: forgive and forget
	option = {
		name = bp1_yearly.1030.a
		trigger = {
			NOT = { has_relation_nemesis = scope:rival }
		}
		remove_relation_rival = scope:rival
		create_character_memory = {
			type = let_go_of_rivalry
			participants = { rival = scope:rival }
		}
		add_prestige = minor_prestige_gain
		stress_impact = {
			stubborn = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
			vengeful = major_stress_impact_gain
			callous = major_stress_impact_gain
			forgiving = medium_stress_impact_loss
			compassionate = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = -1
			}
		}
	}

	#Option B: NOT
	option = {
		name = bp1_yearly.1030.b
		trigger = {
			NOT = { has_relation_nemesis = scope:rival }
		}
		add_prestige = minor_prestige_gain
		stress_impact = {
			fickle = minor_stress_impact_gain
			humble = medium_stress_impact_gain
			forgiving = major_stress_impact_gain
			compassionate = major_stress_impact_gain
			vengeful = medium_stress_impact_loss
			callous = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
			}
		}
	}

	#Option C: nemesis special
	option = {
		name = bp1_yearly.1030.c
		trigger = {
			exists = scope:nemesis
		}
		add_internal_flag = dangerous
		if = {
			limit = {
				exists = scope:guard
			}
			scope:guard = {
				duel = {
					skill = prowess
					target = scope:nemesis
					30 = {
						desc = bp1_yearly.1030.c_saved_guard
						compare_modifier = {
							value = scope:duel_value
							multiplier = 5
						}
						root = {
							send_interface_toast = {
								type = event_toast_effect_neutral
								title = bp1_yearly.1030.c_saved_guard.tt
								hidden_effect = {
									add_opinion = {
										target = scope:nemesis
										modifier = attempted_murder_opinion
									}
									scope:guard = { increase_wounds_no_death_effect = { REASON = fight } }
								}
								create_character_memory = {
									type = nemesis_killed
									participants = {
										dead_relation = scope:nemesis
										killer = scope:guard
									}
								}
								create_character_memory = {
									type = failed_assassination_by
									participants = {
										killer = scope:nemesis
									}
								}
								scope:nemesis = {
									death = {
										death_reason = death_while_assassinating
										killer = scope:guard
									}
								}
							}
						}
					}
					30 = {
						desc = bp1_yearly.1030.c_barely_saved_guard
						compare_modifier = {
							value = scope:duel_value
							multiplier = 2
						}
						root = {
							send_interface_toast = {
								type = event_toast_effect_neutral
								title = bp1_yearly.1030.c_barely_saved_guard.tt
								increase_wounds_no_death_effect = { REASON = fight }
								create_character_memory = {
									type = failed_assassination_by
									participants = {
										killer = scope:nemesis
									}
								}
								scope:nemesis = { increase_wounds_no_death_effect = { REASON = fight } }
								scope:guard = { increase_wounds_no_death_effect = { REASON = fight } }
								if = {
									limit = {
										is_ai = yes
									}
									add_opinion = {
										target = scope:nemesis
										modifier = attempted_murder_opinion
									}
								}
							}
						}
					}
					30 = {
						desc = bp1_yearly.1030.c_killed_guard
						compare_modifier = {
							value = scope:duel_value
							multiplier = -2
						}
						root = {
							send_interface_toast = {
								type = event_toast_effect_neutral
								title = bp1_yearly.1030.c_killed_guard.tt
								increase_wounds_no_death_effect = { REASON = fight }
								create_character_memory = {
									type = failed_assassination_by
									participants = {
										killer = scope:nemesis
									}
								}
								scope:nemesis = { increase_wounds_no_death_effect = { REASON = fight } }
								scope:guard = {
									death = {
										death_reason = death_murder_known
										killer = scope:nemesis
									}
								}
								if = {
									limit = {
										is_ai = yes
									}
									add_opinion = {
										target = scope:nemesis
										modifier = attempted_murder_opinion
									}
								}
							}
						}
					}
					10 = {
						desc = bp1_yearly.1030.c_killed_all
						compare_modifier = {
							value = scope:duel_value
							multiplier = -5
						}
						hidden_effect = {
							scope:nemesis = {
								add_secret = {
									type = secret_murder
									target = root
								}
								add_secret = {
									type = secret_murder
									target = scope:guard
								}
								create_character_memory = {
									type = nemesis_killed_by_me
									participants = { dead_relation = root }
								}
							}
						}
						root = {
							death = {
								death_reason = death_murder
								killer = scope:nemesis
							}
						}
						scope:guard = {
							death = {
								death_reason = death_murder
								killer = scope:nemesis
							}
						}
					}
				}
			}
		}
		else = {
			duel = {
				skill = prowess
				target = scope:nemesis
				10 = {
					desc = bp1_yearly.1030.c_saved
					compare_modifier = {
						value = scope:duel_value
						multiplier = 5
					}
					send_interface_toast = {
						type = event_toast_effect_good
						title = bp1_yearly.1030.c_saved.tt
						increase_wounds_no_death_effect = { REASON = fight }
						scope:nemesis = { increase_wounds_no_death_effect = { REASON = fight } }
						create_character_memory = {
							type = failed_assassination_by
							participants = {
								killer = scope:nemesis
							}
						}
						if = {
							limit = {
								is_ai = yes
							}
							add_opinion = {
								target = scope:nemesis
								modifier = attempted_murder_opinion
							}
						}
					}
				}
				90 = {
					desc = bp1_yearly.1030.c_killed
					compare_modifier = {
						value = scope:duel_value
						multiplier = -5
					}
					hidden_effect = {
						scope:nemesis = {
							add_secret = {
								type = secret_murder
								target = root
							}
							create_character_memory = {
								type = nemesis_killed_by_me
								participants = { dead_relation = root }
							}
						}
					}
					death = {
						death_reason = death_murder
						killer = scope:nemesis
					}
				}
			}
		}
		ai_chance = {
			base = 100
		}
	}

	after = {
		if = {
			limit = {
				has_character_flag = use_sickness_clothes
			}
			remove_character_flag = use_sickness_clothes
		}
	}
}

# You visit a rival on their dying bed

bp1_yearly.1031 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.1030.t
	desc = {
		desc = bp1_yearly.1031.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:nemesis
				}
				desc = bp1_yearly.1031.desc_nemesis
			}
			desc = bp1_yearly.1031.desc_rival
		}
		triggered_desc = {
			trigger = {
				exists = scope:guard
			}
			desc = bp1_yearly.1031.desc_guard
		}
	}
	theme = death
	override_background  = { reference = bedchamber }
	left_portrait = {
		character = root
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:rival
		animation = sick
	}
	cooldown = { years = 10 }

	trigger = {
		has_dlc_feature = friends_and_foes
		any_relation = {
			type = rival
			OR = {
				health <= death_chance_dying_health
				has_trait = incapable
				has_trait = infirm
			}
		}
		is_available_healthy_adult = yes
	}

	immediate = {
		if = {
			limit = {
				any_relation = {
					type = nemesis
					OR = {
						health <= death_chance_dying_health
						has_trait = incapable
						has_trait = infirm
					}
				}
			}
			random_relation = {
				type = nemesis
				limit = {
					OR = {
						health <= death_chance_dying_health
						has_trait = incapable
						has_trait = infirm
					}
				}
				save_scope_as = rival
				save_scope_as = nemesis
			}
		}
		else_if = {
			limit = {
				any_relation = {
					type = rival
					OR = {
						health <= death_chance_dying_health
						has_trait = incapable
						has_trait = infirm
					}
				}
			}
			random_relation = {
				type = rival
				limit = {
					OR = {
						health <= death_chance_dying_health
						has_trait = incapable
						has_trait = infirm
					}
				}
				save_scope_as = rival
			}
		}
		if = {
			limit = {
				exists = scope:nemesis
				scope:nemesis = {
					employs_court_position = bodyguard_court_position
					any_court_position_holder = {
						type = bodyguard_court_position
						NOR = {
							this = root
							has_relation_rival = scope:nemesis
						}
						is_available_healthy_ai_adult = yes
					}
				}
			}
			scope:nemesis = {
				random_court_position_holder = {
					type = bodyguard_court_position
					limit = {
						NOR = {
							this = root
							has_relation_rival = scope:nemesis
						}
						is_available_healthy_ai_adult = yes
					}
					save_scope_as = guard
				}
			}
		}
		else_if = {
			limit = {
				exists = scope:nemesis
				scope:nemesis = {
					employs_court_position = akolouthos_court_position
					any_court_position_holder = {
						type = akolouthos_court_position
						NOR = {
							this = root
							has_relation_rival = scope:nemesis
						}
						is_available_healthy_ai_adult = yes
					}
				}
			}
			scope:nemesis = {
				random_court_position_holder = {
					type = akolouthos_court_position
					limit = {
						NOR = {
							this = root
							has_relation_rival = scope:nemesis
						}
						is_available_healthy_ai_adult = yes
					}
					save_scope_as = guard
				}
			}
		}
		if = {
			limit = {
				scope:rival = { NOT = { has_character_flag = use_sickness_clothes } }
			}
			scope:rival = { add_character_flag = use_sickness_clothes }
		}
	}

	#Option A: forget and forgive
	option = {
		name = bp1_yearly.1031.a
		remove_relation_rival = scope:rival
		create_character_memory = {
			type = let_go_of_rivalry
			participants = { rival = scope:rival }
		}
		stress_impact = {
			stubborn = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
			vengeful = major_stress_impact_gain
			callous = major_stress_impact_gain
			forgiving = medium_stress_impact_loss
			compassionate = medium_stress_impact_loss
		}
		add_prestige = minor_prestige_gain
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = -1
			}
		}

	}

	#Option B: NOT
	option = {
		name = bp1_yearly.1031.b
		stress_impact = {
			fickle = minor_stress_impact_gain
			humble = medium_stress_impact_gain
			forgiving = major_stress_impact_gain
			compassionate = major_stress_impact_gain
			vengeful = medium_stress_impact_loss
			callous = medium_stress_impact_loss
		}
		add_prestige = minor_prestige_gain
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
			}
		}
	}

	#Option C: special for nemesis
	option = {
		name = bp1_yearly.1031.c
		trigger = {
			exists = scope:nemesis
		}
		add_internal_flag = dangerous
		if = {
			limit = {
				exists = scope:guard
			}
			custom_tooltip = bp1_yearly.1031.c.tt
			duel = {
				skill = prowess
				target = scope:guard
				20 = {
					desc = bp1_yearly.1031.c_killed_all
					compare_modifier = {
						value = scope:duel_value
						multiplier = 5
					}
					send_interface_toast = {
						type = event_toast_effect_good
						title = bp1_yearly.1031.c_killed_all.tt
						add_secret = {
							type = secret_murder
							target = scope:nemesis
						}
						add_secret = {
							type = secret_murder
							target = scope:guard
						}
						create_character_memory = {
							type = nemesis_killed_by_me
							participants = { dead_relation = scope:nemesis }
						}
						stress_impact = {
							vengeful = medium_stress_impact_loss
							callous = medium_stress_impact_loss
							arrogant = minor_stress_impact_loss
							ambitious = minor_stress_impact_loss
						}
					}
					scope:nemesis = {
						death = {
							death_reason = death_murder
							killer = root
						}
					}
					scope:guard = {
						death = {
							death_reason = death_murder
							killer = root
						}
					}
				}
				20 = {
					desc = bp1_yearly.1031.c_killed_guard
					compare_modifier = {
						value = scope:duel_value
						multiplier = 2
					}
					root = {
						send_interface_toast = {
							type = event_toast_effect_bad
							title = bp1_yearly.1031.c_failed.tt
							increase_wounds_no_death_effect = { REASON = fight }
							create_character_memory = {
								type = failed_assassination
								participants = { kill_target = scope:nemesis }
							}
							reverse_add_opinion = {
								target = scope:nemesis
								modifier = attempted_murder_opinion
							}
							scope:nemesis = { increase_wounds_no_death_effect = { REASON = fight } }
							scope:guard = {
								death = {
									death_reason = death_murder_known
									killer = root
								}
							}
						}
					}
				}
				30 = {
					desc = bp1_yearly.1031.c_barely_saved_guard
					compare_modifier = {
						value = scope:duel_value
						multiplier = -2
					}
					send_interface_toast = {
						type = event_toast_effect_bad
						title = bp1_yearly.1031.c_failed.tt
						increase_wounds_no_death_effect = { REASON = fight }
						create_character_memory = {
							type = failed_assassination
							participants = { kill_target = scope:nemesis }
						}
						reverse_add_opinion = {
							target = scope:nemesis
							modifier = attempted_murder_opinion
						}
						scope:nemesis = { increase_wounds_no_death_effect = { REASON = fight } }
						scope:guard = { increase_wounds_no_death_effect = { REASON = fight } }
					}
				}
				30 = {
					desc = bp1_yearly.1031.c_saved_guard
					compare_modifier = {
						value = scope:duel_value
						multiplier = -5
					}
					scope:guard = { increase_wounds_no_death_effect = { REASON = fight } }
					reverse_add_opinion = {
						target = scope:nemesis
						modifier = attempted_murder_opinion
					}
					scope:nemesis = {
						create_character_memory = {
							type = nemesis_killed
							participants = {
								dead_relation = root
								killer = scope:guard
							}
						}
					}
					death = {
						death_reason = death_while_assassinating
						killer = scope:guard
					}
				}
			}
		}
		else = {
			duel = {
				skill = prowess
				target = scope:nemesis
				90 = {
					desc = bp1_yearly.1031.c_killed
					compare_modifier = {
						value = scope:duel_value
						multiplier = 5
					}
					send_interface_toast = {
						type = event_toast_effect_good
						title = bp1_yearly.1031.c_killed_all.tt
						add_secret = {
							type = secret_murder
							target = scope:nemesis
						}
						create_character_memory = {
							type = nemesis_killed_by_me
							participants = { dead_relation = scope:nemesis }
						}
						scope:nemesis = {
							death = {
								death_reason = death_murder
								killer = root
							}
						}
						stress_impact = {
							vengeful = medium_stress_impact_loss
							callous = medium_stress_impact_loss
							arrogant = minor_stress_impact_loss
							ambitious = minor_stress_impact_loss
						}
					}
				}
				10 = {
					desc = bp1_yearly.1031.c_saved
					compare_modifier = {
						value = scope:duel_value
						multiplier = -5
					}
					send_interface_toast = {
						type = event_toast_effect_bad
						title = bp1_yearly.1031.c_failed.tt
						increase_wounds_no_death_effect = { REASON = fight }
						scope:nemesis = { increase_wounds_no_death_effect = { REASON = fight } }
						create_character_memory = {
							type = failed_assassination
							participants = { kill_target = scope:nemesis }
						}
						reverse_add_opinion = {
							target = scope:nemesis
							modifier = attempted_murder_opinion
						}
					}
				}
			}
		}
	}

	after = {
		scope:rival = {
			if = {
				limit = {
					is_alive = yes
					has_character_flag = use_sickness_clothes
				}
				remove_character_flag = use_sickness_clothes
			}
		}
	}
}

# You make a new friend at the bathhouse

bp1_yearly.1040 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.1040.t
	desc = {
		desc = bp1_yearly.1040.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:new_friend = { has_relation_friend = root }
					NOT = {
						any_relation = {
							type = best_friend
						}
					}
				}
				desc = bp1_yearly.1040.desc_best_friend
			}
			desc = bp1_yearly.1040.desc_friend
		}
	}
	theme = friendly
	override_background  = { reference = bath_house }
	override_effect_2d = {
		reference = smoke	
	}
	left_portrait = {
		character = root
		animation = toast
		triggered_outfit = {
			remove_default_outfit = no
			outfit_tags = { no_clothes }
		}
	}
	right_portrait = {
		character = scope:new_friend
		animation = happiness
		triggered_outfit = {
			remove_default_outfit = no
			outfit_tags = { no_clothes }
		}
	}
	cooldown = { years = 20 }

	trigger = {
		has_dlc_feature = friends_and_foes
		NOT = {
			government_has_flag = government_is_tribal
		}
		is_at_war = no
		any_courtier = {
			NOR = {
				has_relation_potential_friend = root
				has_relation_friend = root
				has_relation_potential_rival = root
				has_relation_rival = root
			}
			opinion = {
				target = root
				value > 70
			}
			is_available_healthy_ai_adult = yes
			save_temporary_scope_as = rival_check
		}
		is_available_healthy_adult = yes
		trigger_if = {
			limit = {
				OR = {
					has_realm_law = male_only_law
					has_realm_law = female_only_law
				}
			}
			sex_same_as = scope:rival_check
		}
		exists = root.capital_province
	}

	weight_multiplier = {
		base = 1
		modifier = {
			any_relation = {
				type = friend
				count >= 4
			}
			factor = 0.5
		}
		modifier = {
			any_relation = {
				type = friend
				count <= 1
			}
			factor = 2
		}
	}

	immediate = {
		if = {
			limit = {
				OR = {
					has_realm_law = male_only_law
					has_realm_law = female_only_law
				}
			}
			random_courtier = {
				limit = {
					NOR = {
						has_relation_potential_friend = root
						has_relation_friend = root
						has_relation_potential_rival = root
						has_relation_rival = root
					}
					opinion = {
						target = root
						value > 70
					}
					is_available_healthy_ai_adult = yes
					sex_same_as = root
				}
				save_scope_as = new_friend
			}
			
		}
		else = {
			random_courtier = {
				limit = {
					NOR = {
						has_relation_potential_friend = root
						has_relation_friend = root
						has_relation_potential_rival = root
						has_relation_rival = root
					}
					opinion = {
						target = root
						value > 70
					}
					is_available_healthy_ai_adult = yes
				}
				save_scope_as = new_friend
			}
		}
	}

	#Option A: make new friend
	option = {
		name = bp1_yearly.1040.a
		if = {
			limit = {
				NOT = { has_relation_friend = scope:new_friend }
			}
			set_relation_friend = { reason = friend_bathhouse_bonding target = scope:new_friend province = root.capital_province }
		}
		else = {
			set_relation_best_friend = { reason = best_friend_bathhouse_bonding copy_reason = friend target = scope:new_friend province = root.capital_province }
		}
		stress_impact = {
			shy = minor_stress_impact_gain
			disloyal = medium_stress_impact_gain
			paranoid = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = gregarious
				add = 75
			}
			modifier = {
				has_trait = paranoid
				add = -75
			}
			modifier = {
				has_trait = disloyal
				add = -50
			}
		}
	}

	#Option B: more than friends?
	option = {
		name = bp1_yearly.1040.b
		flavor = bp1_yearly.1040.b.tt
		trigger = {
			matching_gender_and_sexuality_trigger = {
				CHARACTER_1 = root
				CHARACTER_2 = scope:new_friend
			}
			can_start_scheme = {
				type = seduce
				target_character = scope:new_friend
			}

			trigger_if = {
				limit = {
					scope:new_friend = { is_close_family_of = root }
				}
				OR = {
					is_deviant_trigger = yes
					accepts_incest_with_each_other_trigger = {
						CHARACTER_1 = root
						CHARACTER_2 = scope:new_friend
					}
				}
			}
		}
		start_scheme = {
			type = seduce
			target_character = scope:new_friend
		}
		custom_tooltip = diplomacy_family.2250.b.tt
		hidden_effect = {
			random_scheme = {
				limit = {
					scheme_type = seduce
					scheme_target_character = scope:new_friend
				}
				add_scheme_modifier = {
					type = extra_success_chance_modifier
				}
			}
		}
		random_scheme = {
			limit = {
				scheme_type = seduce
				scheme_target_character = scope:new_friend
			}
			add_scheme_modifier = {
				type = extra_success_chance_modifier
			}
		}
		stress_impact = {
			shy = medium_stress_impact_gain
			chaste = major_stress_impact_gain
			paranoid = major_stress_impact_gain
			reclusive = massive_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = shy
				add = -25
			}
			modifier = {
				has_trait = chaste
				add = -50
			}
		}
	}

	#Option C: I don't like them *that* much
	option = {
		name = bp1_yearly.1040.c
		reverse_add_opinion = {
			target = scope:new_friend
			modifier = disappointed_opinion
			opinion = -30
		}
		stress_impact = {
			gregarious = major_stress_impact_gain
			trusting = major_stress_impact_gain
			compassionate = major_stress_impact_gain
			loyal = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = gregarious
				add = -75
			}
			modifier = {
				has_trait = trusting
				add = -75
			}
			modifier = {
				has_trait = compassionate
				add = -75
			}
			modifier = {
				has_trait = loyal
				add = -75
			}
			modifier = {
				has_trait = arrogant
				add = 50
			}
			modifier = {
				has_trait = shy
				add = 50
			}
			modifier = {
				has_trait = reclusive
				add = 50
			}
		}
	}
}

# You make a new rival at the public discussion

scripted_trigger vs_valid_debater = {
	OR = {
		AND = {
			root = {
				OR = {
					has_focus = diplomacy_foreign_affairs_focus
					has_focus = diplomacy_majesty_focus
					has_focus = diplomacy_family_focus
				}
			}
			diplomacy >= average_skill_rating
		}
		AND = {
			root = {
				OR = {
					has_focus = intrigue_skulduggery_focus
					has_focus = intrigue_temptation_focus
					has_focus = intrigue_intimidation_focus
				}
			}
			intrigue >= average_skill_rating
		}
		AND = {
			root = {
				OR = {
					has_focus = martial_strategy_focus
					has_focus = martial_authority_focus
					has_focus = martial_chivalry_focus
				}
			}
			martial >= average_skill_rating
		}
		AND = {
			root = {
				OR = {
					has_focus = stewardship_wealth_focus
					has_focus = stewardship_domain_focus
					has_focus = stewardship_duty_focus
				}
			}
			stewardship >= average_skill_rating
		}
		AND = {
			root = {
				OR = {
					has_focus = learning_medicine_focus
					has_focus = learning_scholarship_focus
					has_focus = learning_theology_focus
				}
			}
			learning >= average_skill_rating
		}
	}
}

# You make a new rival at a public discussion

bp1_yearly.1050 = {
	type = character_event
	title = bp1_yearly.1050.t
	desc = {
		desc = bp1_yearly.1050.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_focus = diplomacy_foreign_affairs_focus
						has_focus = diplomacy_majesty_focus
						has_focus = diplomacy_family_focus
					}	 
				}
				desc = bp1_yearly.1050.diplo
			}
			triggered_desc = {
				trigger = {
					OR = {
						has_focus = martial_strategy_focus
						has_focus = martial_authority_focus
						has_focus = martial_chivalry_focus
					}
				}
				desc = bp1_yearly.1050.martial	 
			}
			triggered_desc = {
				trigger = {
					OR = {
						has_focus = intrigue_skulduggery_focus
						has_focus = intrigue_temptation_focus
						has_focus = intrigue_intimidation_focus
					}
				}
				desc = bp1_yearly.1050.intrigue	
			}
			triggered_desc = {
				trigger = {
					OR = {
						has_focus = stewardship_wealth_focus
						has_focus = stewardship_domain_focus
						has_focus = stewardship_duty_focus
					}
				}
				desc = bp1_yearly.1050.steward	 
			}
			triggered_desc = {
				trigger = {
					OR = {
						has_focus = learning_medicine_focus
						has_focus = learning_scholarship_focus
						has_focus = learning_theology_focus
					}
				}
				desc = bp1_yearly.1050.learning
			}
#should not trigger ever, but as a failsafe
			desc = bp1_yearly.1050.neutral
		}
		desc = bp1_yearly.1050.desc_end	
	}
	theme = unfriendly
#override_background  = { reference = relaxing_room } - check what background works
	left_portrait = {
		character = root
		animation = anger
	}
	right_portrait = {
		character = scope:new_rival
		animation = dismissal
	}
	cooldown = { years = 20 }

	trigger = {
		has_dlc_feature = friends_and_foes
		NOT = { government_has_flag = government_is_tribal }
		is_available_healthy_adult = yes
		is_at_war = no
		any_courtier = {
			NOT = {
				has_relation_rival = root
			}
			OR = {
				AND = {
					has_relation_potential_rival = root
					is_available_healthy_ai_adult = yes
				}
				AND = {
					NOR = {
						has_relation_potential_friend = root
						has_relation_friend = root
						has_relation_potential_rival = root
						has_relation_rival = root
					}
					opinion = {
						target = root
						value < -50
					}
				}
			}
			is_available_healthy_ai_adult = yes
			vs_valid_debater = yes
		}
		exists = root.capital_province
	}

	weight_multiplier = {
		base = 1
		modifier = {
			any_relation = {
				type = rival
				count >= 2
			}
			factor = 0.5
		}
		modifier = {
			any_relation = {
				type = rival
				count <= 1
			}
			factor = 2
		}
	}

	immediate = {
		random_courtier = {
			limit = {
				OR = {
					AND = {
						has_relation_potential_rival = root
						is_available_healthy_ai_adult = yes
					}
					AND = {
						NOR = {
							has_relation_potential_friend = root
							has_relation_friend = root
							has_relation_potential_rival = root
							has_relation_rival = root
						}
						opinion = {
							target = root
							value < -50
						}
					}
				}
				is_available_healthy_ai_adult = yes
				vs_valid_debater = yes
			}
			save_scope_as = new_rival
		}
	}

	#Option A: vent and make new rival
	option = {
		name = bp1_yearly.1050.a
		set_relation_rival = {
			target = scope:new_rival
			reason = rival_a_debate_result
		}
		stress_impact = {
			patient = minor_stress_impact_gain
			calm = minor_stress_impact_gain
			forgiving = major_stress_impact_gain
			wrathful = medium_stress_impact_loss
			impatient = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = patient
				add = -25
			}
			modifier = {
				has_trait = calm
				add = -25
			}
			modifier = {
				has_trait = forgiving
				add = -75
			}
		}
	}

	#Option B: seethe - non-diplo
	option = {
		trigger = {
			NOR = {
				has_focus = diplomacy_family_focus
				has_focus = diplomacy_foreign_affairs_focus
				has_focus = diplomacy_majesty_focus
			}
		}
		name = bp1_yearly.1050.b.ndip
		add_stress = medium_stress_impact_gain
		stress_impact = {
			vengeful = medium_stress_impact_gain
			wrathful = medium_stress_impact_gain
			impatient = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		scope:new_rival = {
			duel = {
				skill = diplomacy
				value = average_skill_rating
				10 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = 0.25
					}
					desc = bp1_yearly.b.success
					root = {
						send_interface_toast = {
							title = bp1_yearly.b.success
							add_prestige = medium_prestige_loss
						}
					}
				}
				10 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -0.25
						min = -9
					}
					desc = bp1_yearly.b.failure
					root = {
						send_interface_toast = {
							title = bp1_yearly.b.failure
							add_prestige = medium_prestige_gain
						}
					}
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = patient
				add = 25
			}
			modifier = {
				has_trait = calm
				add = 25
			}
			modifier = {
				has_trait = forgiving
				add = 75
			}
			modifier = {
				has_trait = compassionate
				add = 75
			}
			modifier = {
				has_trait = vengeful
				add = -75
			}
			modifier = {
				has_trait = arrogant
				add = -50
			}
			modifier = {
				has_trait = wrathful
				add = -50
			}
		}
	}
	
	#Option B: seethe - diplo
	option = {
		trigger = {
			OR = {
				has_focus = diplomacy_family_focus
				has_focus = diplomacy_foreign_affairs_focus
				has_focus = diplomacy_majesty_focus
			}
		}
		name = bp1_yearly.1050.b.dip
		add_stress = medium_stress_impact_gain
		stress_impact = {
			vengeful = medium_stress_impact_gain
			wrathful = medium_stress_impact_gain
			impatient = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		scope:new_rival = {
			duel = {
				skill = diplomacy
				value = average_skill_rating
				8 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = 0.25
					}
					desc = bp1_yearly.b.success
					root = {
						send_interface_toast = {
							title = bp1_yearly.b.success
							add_prestige = medium_prestige_loss
						}
					}
				}
				12 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -0.25
						min = -9
					}
					desc = bp1_yearly.b.failure
					root = {
						send_interface_toast = {
							title = bp1_yearly.b.failure
							add_prestige = medium_prestige_gain
						}
					}
				}
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = patient
				add = 25
			}
			modifier = {
				has_trait = calm
				add = 25
			}
			modifier = {
				has_trait = forgiving
				add = 75
			}
			modifier = {
				has_trait = compassionate
				add = 75
			}
			modifier = {
				has_trait = vengeful
				add = -75
			}
			modifier = {
				has_trait = arrogant
				add = -50
			}
			modifier = {
				has_trait = wrathful
				add = -50
			}
		}
	}

	#Option C: lash out
	option = {
		name = bp1_yearly.1050.c
		add_tyranny = minor_tyranny_gain
		add_dread = minor_dread_gain
		set_relation_rival = {
			target = scope:new_rival
			reason = rival_a_debate_throw
		}
		stress_impact = {
			patient = major_stress_impact_gain
			calm = major_stress_impact_gain
			forgiving = massive_stress_impact_gain
			wrathful = medium_stress_impact_loss
			impatient = medium_stress_impact_loss
			sadistic = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = patient
				add = -25
			}
			modifier = {
				has_trait = calm
				add = -25
			}
			modifier = {
				has_trait = forgiving
				add = -75
			}
			modifier = {
				has_trait = vengeful
				add = 75
			}
			modifier = {
				has_trait = arrogant
				add = 50
			}
			modifier = {
				has_trait = wrathful
				add = 50
			}
		}
	}
}

# React to a superstitious friend

bp1_yearly.1060 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.1060.t
	desc = bp1_yearly.1060.desc
	theme = faith
	override_background  = { reference = corridor_day }
	left_portrait = {
		character = root
		animation = dismissal
	}
	right_portrait = {
		character = scope:friend
		animation = paranoia
	}
	cooldown = { years = 10 }

	trigger = {
		has_dlc_feature = friends_and_foes
		NOT = {
			has_character_modifier = bp1_superstition_modifier
		}
		OR = {
			any_relation = {
				type = friend
				has_character_modifier = bp1_superstition_modifier
				is_available_ai_adult = yes
			}
			any_relation = {
				type = lover
				has_character_modifier = bp1_superstition_modifier
				is_available_ai_adult = yes
			}
			any_relation = {
				type = potential_friend
				has_character_modifier = bp1_superstition_modifier
				is_available_ai_adult = yes
			}
		}
	}

	immediate = {
		if = {
			limit = {
				any_relation = {
					type = friend
					has_character_modifier = bp1_superstition_modifier
					is_available_ai_adult = yes
				}
			}
			random_relation = {
				type = friend
				limit = {
					has_character_modifier = bp1_superstition_modifier
					is_available_ai_adult = yes
				}
				save_scope_as = friend
			}
		}
		else_if = {
			limit = {
				any_relation = {
					type = lover
					has_character_modifier = bp1_superstition_modifier
					is_available_ai_adult = yes
				}
			}
			random_relation = {
				type = lover
				limit = {
					has_character_modifier = bp1_superstition_modifier
					is_available_ai_adult = yes
				}
				save_scope_as = friend
			}
		}
		else = {
			random_relation = {
				type = potential_friend
				limit = {
					has_character_modifier = bp1_superstition_modifier
					is_available_ai_adult = yes
				}
				save_scope_as = friend
			}
		}
	}

	#Option A: what if it's all true?
	option = {
		name = bp1_yearly.1060.a
		add_character_modifier = bp1_superstition_modifier
		if = {
			limit = {
				scope:friend = {
					has_relation_potential_friend = root
				}
			}
			set_relation_friend = { reason = friend_superstitions target = scope:friend }
		}
		add_prestige = minor_prestige_loss
		reverse_add_opinion = {
			target = scope:friend
			modifier = respect_opinion
			opinion = 20
		}
		stress_impact = {
			cynical = major_stress_impact_gain
			arrogant = medium_stress_impact_gain
			diligent = medium_stress_impact_gain
			lazy = medium_stress_impact_gain
			stubborn = medium_stress_impact_gain
			impatient = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				has_trait = arbitrary
				add = 50
			}
			modifier = {
				has_trait = craven
				add = 50
			}
			modifier = {
				has_trait = trusting
				add = 50
			}
			modifier = {
				has_trait = fickle
				add = 25
			}
			modifier = {
				has_trait = paranoid
				add = 100
			}
			modifier = {
				has_trait = cynical
				add = -100
			}
			modifier = {
				has_trait = arrogant
				add = -50
			}
			modifier = {
				has_trait = stubborn
				add = -50
			}
		}
	}

	#Option B: let me help you out
	option = {
		name = bp1_yearly.1060.b
		trigger = {
			trigger_if = {
				limit = { is_ai = yes }
				ai_rationality > medium_positive_rationality
			}
		}
		duel = {
			skill = learning
			target = scope:friend
			30 = {
				desc = bp1_yearly.1060.b_persuaded
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = bp1_yearly.1060.b_persuaded.tt
					scope:friend = {
						remove_character_modifier = bp1_superstition_modifier
						add_opinion = {
							target = root
							modifier = impressed_opinion
							opinion = 30
						}
					}
					add_prestige = medium_prestige_gain
					if = {
						limit = {
							can_add_hook = {
								target = scope:friend
								type = favor_hook
							}
						}
						add_hook = {
							type = favor_hook
							target = scope:friend
						}
					}
				}
			}
			50 = {
				desc = bp1_yearly.1060.b_not_persuaded
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2
				}
				send_interface_toast = {
					type = event_toast_effect_bad
					title = bp1_yearly.1060.b_not_persuaded.tt
					scope:friend = {
						add_opinion = {
							target = root
							modifier = insult_opinion
							opinion = -15
						}
					}
				}
			}
			20 = {
				desc = bp1_yearly.1060.b_you_persuaded
				compare_modifier = {
					value = scope:duel_value
					multiplier = -4
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = bp1_yearly.1060.b_you_persuaded.tt
					add_character_modifier = bp1_superstition_modifier
					add_prestige = medium_prestige_loss
					scope:friend = {
						add_hook = {
							target = root
							type = favor_hook
						}
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 50
						}
					}
				}
			}
		}
		stress_impact = {
			diligent =medium_stress_impact_gain
			lazy =medium_stress_impact_gain
			impatient =medium_stress_impact_gain
			paranoid =medium_stress_impact_gain
			fickle = medium_stress_impact_gain
		}
		ai_chance = {
			base = 200
		}
	}

	#Option C: blasphemy!
	option = {
		name = bp1_yearly.1060.c
		trigger = {
			trigger_if = {
				limit = { is_ai = yes }
				ai_zeal > medium_positive_zeal
			}
		}
		if = {
			limit = {
				scope:friend = {
					has_relation_friend = root
				}
			}
			remove_relation_friend = scope:friend
		}
		else_if = {
			limit = {
				scope:friend = {
					has_relation_lover = root
				}
			}
			remove_relation_lover = scope:friend
		}
		else = {
			remove_relation_potential_friend = scope:friend
		}
		add_piety = major_piety_gain
		reverse_add_opinion = {
			target = scope:friend
			modifier = insult_opinion
			opinion = -40
		}
		stress_impact = {
			cynical = major_stress_impact_gain
			patient = medium_stress_impact_gain
			calm = minor_stress_impact_gain
		}
		ai_chance = {
			base = 200
		}
	}

	#Option D: foolishness
	option = {
		name = bp1_yearly.1060.d
		add_prestige = minor_prestige_gain
		reverse_add_opinion = {
			target = scope:friend
			modifier = disappointed_opinion
			opinion = -20
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = arbitrary
				add = -50
			}
			modifier = {
				has_trait = craven
				add = -50
			}
			modifier = {
				has_trait = trusting
				add = -25
			}
			modifier = {
				has_trait = fickle
				add = -25
			}
			modifier = {
				has_trait = paranoid
				add = -100
			}
			modifier = {
				has_trait = cynical
				add = 100
			}
			modifier = {
				has_trait = arrogant
				add =50
			}
			modifier = {
				has_trait = stubborn
				add = 50
			}
		}
	}
}

# Make someone superstitious, to kick it off

bp1_yearly.1061 = {
	type = character_event
	content_source = dlc_006
	hidden = yes

	trigger = {
		NOR = {
			has_character_modifier = bp1_superstition_modifier
			has_trait = cynical
			ai_rationality > medium_positive_rationality
		}
		is_ai = yes
		is_adult = yes
	}

	weight_multiplier = {
		base = 0.5
		modifier = {
			ai_rationality < medium_negative_rationality
			add = 4
		}
		modifier = {
			ai_rationality < low_negative_rationality
			add = 2
		}
		modifier = {
			ai_rationality < low_positive_rationality
			add = 1
		}
	}

	immediate = {
		add_character_modifier = bp1_superstition_modifier
	}
}

# Rival is superstitious - take advantage?

bp1_yearly.1070 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.1070.t
	desc = bp1_yearly.1070.desc
	theme = unfriendly
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = schadenfreude
	}
	lower_right_portrait = scope:rival

	cooldown = { years = 5 }

	trigger = {
		has_dlc_feature = friends_and_foes
		any_relation = {
			type = rival
			has_character_modifier = bp1_superstition_modifier
			is_available_ai_adult = yes
		}
		OR = {
			intrigue >= 12
			has_lifestyle = intrigue_lifestyle
		}
		NOT = { has_character_modifier = bp1_superstition_modifier }
	}

	weight_multiplier = {
		base = 1
		modifier = {
			any_relation = {
				type = nemesis
				has_character_modifier = bp1_superstition_modifier
				is_available_ai_adult = yes
			}
			add = 2
		}
	}

	immediate = {
		if = {
			limit = {
				any_relation = {
					type = nemesis
					has_character_modifier = bp1_superstition_modifier
					is_available_ai_adult = yes
				}
			}
			random_relation = {
				type = nemesis
				limit = {
					has_character_modifier = bp1_superstition_modifier
					is_available_ai_adult = yes
				}
				save_scope_as = rival
			}
		}
		else = {
			random_relation = {
				type = rival
				limit = {
					has_character_modifier = bp1_superstition_modifier
					is_available_ai_adult = yes
				}
				save_scope_as = rival
			}
		}
	}

	#Option A: start a scheme
	option = {
		name = bp1_yearly.1070.a
		trigger = {
			NOT = {
				any_scheme = {
					hostile_scheme_trigger = yes
					scheme_target_character = scope:rival
				}
			}
			can_start_hostile_scheme_against_trigger = { TARGET = scope:rival }
		}
		add_intrigue_lifestyle_xp = medium_lifestyle_xp
		start_scheme = {
			type = murder
			target_character = scope:rival
		}
		custom_tooltip = bp1_yearly.1070.a.tt
		random_scheme = {
			limit = {
				scheme_type = murder
				scheme_target_character = scope:rival
			}
			add_scheme_modifier = {
				type = extra_success_chance_modifier
			}
		}
		stress_impact = {
			compassionate = major_stress_impact_gain
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = compassionate
				add = -75
			}
			modifier = {
				has_trait = just
				add = -25
			}
		}
	}

	#Option B: you already have a hostile scheme - take advantage
	option = {
		name = bp1_yearly.1070.a
		trigger = {
			any_scheme = {
				hostile_scheme_trigger = yes
				scheme_target_character = scope:rival
			}
		}
		add_intrigue_lifestyle_xp = medium_lifestyle_xp
		custom_tooltip = bp1_yearly.1070.a.tt
		random_scheme = {
			limit = {
				hostile_scheme_trigger = yes
				scheme_target_character = scope:rival
			}
			add_scheme_modifier = {
				type = extra_success_chance_modifier
			}
		}
		stress_impact = {
			compassionate = major_stress_impact_gain
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = compassionate
				add = -75
			}
			modifier = {
				has_trait = just
				add = -25
			}
		}
	}

	#Option C: just annoy them
	option = {
		name = bp1_yearly.1070.c
		add_intrigue_lifestyle_xp = medium_lifestyle_xp
		scope:rival = {
			add_character_modifier = {
				modifier = bp1_1070_unlucky_charm_modifier
				years = 10
			}
		}
		reverse_add_opinion = {
			target = scope:rival
			modifier = annoyed_opinion
			opinion = -40
		}
		stress_impact = {
			just = minor_stress_impact_gain
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = just
				add = -25
			}
			modifier = {
				has_trait = shy
				add = -25
			}
		}
	}

	#Option D: not stooping so low
	option = {
		name = bp1_yearly.1070.d
		add_prestige = minor_prestige_gain
		stress_impact = {
			vengeful = major_stress_impact_gain
			deceitful = major_stress_impact_gain
			callous = major_stress_impact_gain
			sadistic = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}
}

# Married off relative writes home to complain

scripted_trigger bp1_bad_stress_coping_trait_trigger = {
	OR = {
		has_trait = drunkard
		has_trait = hashishiyah
		has_trait = rakish
		has_trait = reclusive
		has_trait = irritable
		has_trait = profligate
	}
}

scripted_trigger bp1_1080_valid_relative_trigger = {
	is_available_ai_adult = yes
	is_married = yes
	is_landed = no
	NOT = { is_courtier_of = root }
	primary_spouse = {
		is_landed = yes
	}
	opinion = {
		target = primary_spouse
		value < 0
	}
	OR = {
		opinion = {
			target = primary_spouse
			value < -60
		}
		primary_spouse = {
			is_ai = yes
			OR = {
				bp1_bad_stress_coping_trait_trigger = yes
				has_trait = adulterer
				has_trait = torturer
				has_trait = sadistic
				has_trait = deviant
				dread >= high_dread
			}
		}
	}
}

bp1_yearly.1080 = {
	type = letter_event
	opening = bp1_yearly.1080.opening
	desc = {
		desc = bp1_yearly.1080.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:spouse = {
						OR = {
							has_trait = drunkard
							has_trait = hashishiyah
						}
					}
				}
				desc = bp1_yearly.1080.intoxicated
			}
			triggered_desc = {
				trigger = {
					scope:spouse = {
						OR = {
							has_trait = rakish
							has_trait = adulterer
							has_trait = deviant
						}
					}
				}
				desc = bp1_yearly.1080.sexuality
			}
			triggered_desc = {
				trigger = {
					scope:spouse = {
						OR = {
							has_trait = irritable
							has_trait = torturer
							has_trait = sadistic
							dread >= high_dread
						}
					}
				}
				desc = bp1_yearly.1080.violence
			}
			triggered_desc = {
				trigger = {
					scope:spouse = {
						has_trait = reclusive
					}
				}
				desc = bp1_yearly.1080.reclusive
			}
			triggered_desc = {
				trigger = {
					scope:spouse = {
						OR = {
							has_trait = profligate
							has_trait = improvident
						}
					}
				}
				desc = bp1_yearly.1080.profligate
			}
			desc = bp1_yearly.1080.fallback
		}
		desc = bp1_yearly.1080.ending
	}
	sender = scope:relative

	cooldown = { years = 10 }

	trigger = {
		has_dlc_feature = friends_and_foes
		any_close_family_member = {
			bp1_1080_valid_relative_trigger = yes
		}
	}

	immediate = {
		random_close_family_member = {
			limit = {
				bp1_1080_valid_relative_trigger = yes
			}
			save_scope_as = relative
		}
		scope:relative.primary_spouse = {
			save_scope_as = spouse
		}
	}

	#Option A: outrageous!
	option = {
		name = bp1_yearly.1080.a
		if = {
			limit = {
				can_set_relation_rival_trigger = { CHARACTER = scope:spouse }
			}
			set_relation_rival = {
				target = scope:spouse
				reason = rival_mean_to_spouse
				involved_character = scope:relative
			}
		}
		#try to make your relative escape
		duel = {
			skill = intrigue
			target = scope:spouse
			50 = {
				desc = bp1_yearly.1080.a.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				show_as_tooltip = {
					scope:spouse = {
						remove_courtier_or_guest = {
							character = scope:relative
							new_location = root.capital_province
						}
					}
					reverse_add_opinion = {
						target = scope:relative
						modifier = grateful_opinion
						opinion = 40
					}
					if = {
						limit = {
							can_add_hook = {
								target = scope:relative
								type = favor_hook
							}
						}
						add_hook = {
							target = scope:relative
							type = favor_hook
						}
					}
					if = {
						limit = {
							can_set_relation_friend_trigger = { CHARACTER = scope:relative }
						}
						set_relation_friend = { reason = friend_brought_back_home target = scope:relative involved_character = scope:spouse }
					}
				}
				trigger_event = {
					id = bp1_yearly.1081
					days = 3
				}
			}
			50 = {
				desc = bp1_yearly.1080.a.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				send_interface_toast = {
					type = event_toast_effect_bad
					title = bp1_yearly.1080.a.failure.tt
					reverse_add_opinion = {
						target = scope:relative
						modifier = grateful_opinion
						opinion = 10
					}
					scope:relative = { add_character_flag = bp1_could_not_escape_flag }	#for a follow-up event
					stress_impact = {
						base = medium_stress_impact_gain
					}
				}
			}
		}
		reverse_add_opinion = {
			target = scope:spouse
			modifier = insult_opinion
			opinion = -40
		}
		stress_impact = {
			honest = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
			}
			modifier = {
				has_trait = deceitful
				add = 50
			}
			modifier = {
				has_trait = loyal
				add = 50
			}
		}
	}

	#Option D: UNFORGIVABLE!
	option = {
		name = bp1_yearly.1080.d
		trigger = {
			is_allied_to = scope:spouse
		}
		break_alliance = scope:spouse
		if = {
			limit = {
				NOT = {
					any_relation = {
						type = nemesis
					}
				}
				can_set_relation_nemesis_trigger = { CHARACTER = scope:spouse }
			}
			set_relation_nemesis = {
				target = scope:spouse
				involved_character = scope:relative
				copy_reason = rival
				reason = nemesis_mean_to_spouse
			}
		}
		else_if = {
			limit = {
				can_set_relation_rival_trigger = { CHARACTER = scope:spouse }
			}
			set_relation_rival = {
				target = scope:spouse
				reason = rival_mean_to_spouse
				involved_character = scope:relative
			}
		}
		dynasty = {
			add_dynasty_prestige = medium_dynasty_prestige_gain
		}
		#demand the fiend release your relative
		duel = {
			skill = diplomacy
			target = scope:spouse
			50 = {
				desc = bp1_yearly.1080.d.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				show_as_tooltip = {
					scope:spouse = {
						remove_courtier_or_guest = {
							character = scope:relative
							new_location = root.capital_province
						}
					}
					reverse_add_opinion = {
						target = scope:relative
						modifier = grateful_opinion
						opinion = 50
					}
					if = {
						limit = {
							can_add_hook = {
								target = scope:relative
								type = favor_hook
							}
						}
						add_hook = {
							target = scope:relative
							type = favor_hook
						}
					}
					if = {
						limit = {
							can_set_relation_friend_trigger = { CHARACTER = scope:relative }
						}
						set_relation_friend = { reason = friend_brought_back_home target = scope:relative involved_character = scope:spouse }
					}
				}
				trigger_event = {
					id = bp1_yearly.1081
					days = 3
				}
			}
			50 = {
				desc = bp1_yearly.1080.d.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				send_interface_toast = {
					type = event_toast_effect_bad
					title = bp1_yearly.1080.d.failure.tt
					reverse_add_opinion = {
						target = scope:relative
						modifier = grateful_opinion
						opinion = 10
					}
					scope:relative = { add_character_flag = bp1_could_not_escape_flag }	#for a follow-up event
					stress_impact = {
						base = medium_stress_impact_gain
					}
				}
			}
		}
		reverse_add_opinion = {
			target = scope:spouse
			modifier = insult_opinion
			opinion = -50
		}
		stress_impact = {
			deceitful = medium_stress_impact_gain
			calm = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
			}
			modifier = {
				has_trait = deceitful
				add = -50
			}
		}
	}

	#Option B: not compromising alliance over this
	option = {
		name = bp1_yearly.1080.b
		trigger = {
			is_allied_to = scope:spouse
		}
		reverse_add_opinion = {
			target = scope:relative
			modifier = hurt_opinion
			opinion = -80
		}
		reverse_add_opinion = {
			target = scope:spouse
			modifier = pleased_opinion
			opinion = 15
		}
		stress_impact = {
			compassionate = major_stress_impact_gain
			family_first = major_stress_impact_gain
			wrathful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = -0.5
				ai_honor = 0.5
			}
		}
	}

	#Option C: please be strong
	option = {
		name = bp1_yearly.1080.c
		reverse_add_opinion = {
			target = scope:relative
			modifier = disappointed_opinion
			opinion = -40
		}
		stress_impact = {
			compassionate = massive_stress_impact_gain
			family_first = massive_stress_impact_gain
			wrathful = medium_stress_impact_gain
			impatient = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = compassionate
				add = -100
			}
			modifier = {
				has_trait = family_first
				add = -100
			}
			modifier = {
				has_trait = loyal
				add = -50
			}
			modifier = {
				has_trait = wrathful
				add = -25
			}
			modifier = {
				has_trait = impatient
				add = -25
			}
		}
	}
}

bp1_yearly.1081 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.1081.t
	desc = bp1_yearly.1081.desc
	theme = family
	override_background = { reference = relaxing_room }
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:relative
		animation = ecstasy
	}

	trigger = {
		has_dlc_feature = friends_and_foes
		exists = scope:relative
		scope:relative = {
			is_alive = yes
		}
		exists = scope:spouse
		scope:spouse = {
			is_alive = yes
		}
	}

	immediate = {
		reverse_add_opinion = {
			target = scope:relative
			modifier = grateful_opinion
			opinion = 50
		}
		if = {
			limit = {
				can_add_hook = {
					target = scope:relative
					type = favor_hook
				}
			}
			add_hook = {
				target = scope:relative
				type = favor_hook
			}
		}
		if = {
			limit = {
				can_set_relation_friend_trigger = { CHARACTER = scope:relative }
			}
			set_relation_friend = { reason = friend_brought_back_home target = scope:relative involved_character = scope:spouse }
		}
		stress_impact = {
			base = medium_stress_impact_loss
			compassionate = major_stress_impact_loss
			family_first = major_stress_impact_loss
			loyal = medium_stress_impact_loss
		}
		scope:relative = {
			create_character_memory = {
				type = freed_from_bad_marriage
				participants = {
					savior = root
					spouse = scope:spouse
				}
			}
		}
		create_character_memory = {
			type = freed_relative_from_bad_marriage
			participants = {
				relative = scope:relative
				spouse = scope:spouse
			}
		}
	}

	#Option A: get relative divorced
	option = {
		name = bp1_yearly.1081.a
		trigger = {
			NOR = {
				scope:relative.faith = {
					has_doctrine = doctrine_divorce_disallowed
				}
				scope:spouse.faith = {
					has_doctrine = doctrine_divorce_disallowed
				}
			}
		}
		scope:relative = {
			divorce = scope:spouse
		}
		if = {
			limit = {
				faith = {
					this = scope:relative.faith
					has_doctrine = doctrine_divorce_approval
				}
			}
			add_piety = major_piety_loss
		}
		else_if = {
			limit = {
				scope:relative.faith = {
					has_doctrine = doctrine_divorce_approval
				}
			}
			remove_short_term_gold = medium_gold_value
		}
		reverse_add_opinion = {
			target = scope:relative
			modifier = relieved_opinion
			opinion = 30
		}
		ai_chance = {
			base = 100
			modifier = {
				short_term_gold < medium_gold_value
				add = -100
			}
			modifier = {
				piety < major_piety_value
				add = -100
			}
		}
	}

	#Option C: get spouse killed
	option = {
		name = bp1_yearly.1081.c
		trigger = {
			can_start_scheme = {
				type = murder
				target_character = scope:spouse
			}
		}
		start_scheme = {
			type = murder
			target_character = scope:spouse
		}
		if = {
			limit = {
				any_scheme = {
					scheme_type = murder
					scheme_target_character = scope:spouse
					scheme_owner = root
				}
			}
			random_scheme = {
				limit = {
					scheme_type = murder
					scheme_target_character = scope:spouse
					scheme_owner = root
				}
				save_scope_as = 1081_scheme
				try_to_force_assign_character_to_random_agent_slot_effect = {
					SCHEME = scope:1081_scheme
					CHAR = scope:relative
					YEARS = 20
				}
			}
		}
		reverse_add_opinion = {
			target = scope:relative
			modifier = relieved_opinion
			opinion = 20
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
			}
		}
	}

	#Option B: tell me all about your woes
	option = {
		name = bp1_yearly.1081.b
		reverse_add_opinion = {
			target = scope:relative
			modifier = relieved_opinion
			opinion = 10
		}
		if = {
			limit = {
				scope:spouse = {
					any_secret = {
						is_known_by = scope:relative
						NOT = { is_known_by = root }
					}
				}
			}
			scope:spouse = {
				random_secret = {
					limit = {
						is_known_by = scope:relative
						NOT = { is_known_by = root }
					}
					reveal_to = root
				}
			}
		}
		ai_chance = {
			base = 75
			ai_value_modifier = {
				ai_energy = -1
			}
		}
	}

	after = {
		if = {
			limit = { scope:spouse = { is_landed = yes } }
			scope:spouse = {
				remove_courtier_or_guest = {
					character = scope:relative
					new_location = root.capital_province
				}
			}
			add_courtier = scope:relative
		}
		else_if = {
			limit = { exists = scope:spouse.court_owner }
			scope:spouse.court_owner = {
				remove_courtier_or_guest = {
					character = scope:relative
					new_location = root.capital_province
				}
			}
			add_courtier = scope:relative
		}
		else = { # In case they are wandering in the wild
			add_courtier = scope:relative
		}
	}
}

# Relative you couldn't save digs up some dirt on their spouse

bp1_yearly.1082 = {
	type = letter_event
	opening = bp1_yearly.1080.opening
	desc = bp1_yearly.1082.desc
	sender = scope:relative

	cooldown = { years = 10 }

	trigger = {
		has_dlc_feature = friends_and_foes
		any_close_family_member = {
			has_character_flag = bp1_could_not_escape_flag
			is_married = yes
			save_temporary_scope_as = temp_relative
		}
		scope:temp_relative.primary_spouse = {
			any_secret = {
				is_known_by = scope:temp_relative
				NOT = { is_known_by = root }
			}
		}
	}

	immediate = {
		random_close_family_member = {
			limit = {
				has_character_flag = bp1_could_not_escape_flag
				is_married = yes
				save_temporary_scope_as = temp_rel
				primary_spouse = {
					any_secret = {
						is_known_by = scope:temp_rel
						NOT = { is_known_by = root }
					}
				}
			}
			save_scope_as = relative
		}
		scope:relative.primary_spouse = {
			save_scope_as = spouse
		}
		scope:spouse = {
			random_secret = {
				limit = {
					is_known_by = scope:relative
					NOT = { is_known_by = root }
				}
				save_scope_as = secret
			}
		}
	}

	option = {
		name = bp1_yearly.1082.a
		scope:secret = {
			reveal_to = root
		}
		stress_impact = {
			deceitful = minor_stress_impact_loss
			loyal = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}
}
