﻿#Events run from the bp1_yearly_pulse on_action
namespace = bp1_yearly

# List of events in this file:
#
# 0100		Shelter from the Storm
#

#####################################
# Shelter from the Storm			#
# by Jason Cantalini				#
# 0100								#
#####################################

scripted_trigger bp1_yearly_0100_host_trigger = {
	NOR = {
		this = root
		is_at_war_with = root
	}
	has_relation_rival = root
	is_adult = yes
	is_ai = yes
}

scripted_trigger bp1_yearly_0100_nomadic_trigger = {
	OR = {
		government_has_flag = government_is_tribal
		government_has_flag = government_is_landless_adventurer
	}
	culture = {
		OR = {
			has_cultural_tradition = tradition_horse_lords
			has_cultural_tradition = tradition_desert_nomads
			has_cultural_tradition = tradition_saharan_nomads
		}
	}	
}

scripted_trigger bp1_yearly_0100_befriend_trigger = {
	this != root
	is_available_ai_adult = yes
	NOT = { is_at_war_with = root }
	NOR = {
		has_relation_rival = root
		has_relation_nemesis = root
		has_relation_friend = root
		has_relation_best_friend = root
		trigger_if = {
			limit = { exists = scope:befriend }
			root = {
				opinion = {
	 				target = scope:befriend
	 				value < -25
	 			}
	 		}
 		}
	}
}

scripted_trigger bp1_yearly_0100_lover_trigger = {
	is_available_ai_adult = yes
	NOR = {
		this = root
		any_consort = {
			this = root
		}
		any_spouse = {
			this = root
		}
		has_relation_lover = root
		has_trait = chaste
	}
	save_temporary_scope_as = lover_target_check
	possible_mutual_interest_trigger = {
		CHARACTER_1 = scope:lover_target_check
		CHARACTER_2 = root
	}
	might_cheat_on_every_partner_trigger = yes
	opinion = {
		target = root
		value > -10
	}
	can_set_relation_lover_trigger = { CHARACTER = root }
}

# you are caught in a storm while travelling and only a rival can shelter you
bp1_yearly.0100 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.0100.t
	desc = {	
		desc = bp1_yearly.0100.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					bp1_yearly_0100_nomadic_trigger = yes
				}
				desc = bp1_yearly.0100.nomadic_traveller
			}
			desc = bp1_yearly.0100.sedentary_traveller
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:host = {	
						bp1_yearly_0100_nomadic_trigger = yes
					}
				}
				desc = bp1_yearly.0100.nomadic_host
			}
			triggered_desc = {
				trigger = {
					scope:host = {	
						bp1_yearly_0100_nomadic_trigger = no
					}
				}
				desc = bp1_yearly.0100.sedentary_host
			}
		}
		
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:lover

				}
				desc = bp1_yearly.0100.lover_welcome
			}
			triggered_desc = {
				trigger = {
					exists = scope:befriend

				}
				desc = bp1_yearly.0100.friend_welcome
			}
			desc = bp1_yearly.0100.close
		}
	}
	theme = travel_danger
	override_background = {
		reference = bp1_bonfire
 	}
	left_portrait = {
		character = root
		animation = stress
	}

	lower_right_portrait = scope:host
	
	lower_center_portrait = scope:lower_center_portrait_character

	cooldown = {
		years = 10
	}

	override_effect_2d = {
		reference = rain
	}
	
	trigger = {
		has_bp1_dlc_trigger = yes
		is_location_valid_for_travel_event_on_land = yes
		is_healthy = yes
		is_imprisoned = no
		is_adult = yes
		OR = {
			location = {
				OR = {
					province_owner ?= { bp1_yearly_0100_host_trigger = yes }
					county.holder ?= {
						OR = {
							bp1_yearly_0100_host_trigger = yes
							liege ?= { bp1_yearly_0100_host_trigger = yes }
						}
					}
				}
			}
			any_relation = {
				type = rival
				OR = {
					government_has_flag = government_is_landless_adventurer
					government_allows = administrative
				}
				capital_province ?= root.location
			}
		}
	}

	immediate = {
		save_scope_as = traveler
		# find a host
		location = {
			if = {
				limit = {
					province_owner ?= { bp1_yearly_0100_host_trigger = yes }
				}
				province_owner = { add_to_list = travel_rivals }
			}
			else_if = {
				limit = {
					county.holder = { bp1_yearly_0100_host_trigger = yes }
				}
				county.holder = { add_to_list = travel_rivals }
			}
			else = {
				county.holder.liege = { add_to_list = travel_rivals }
			}
		}
		every_relation = {
			type = rival
			limit = {
				OR = {
					government_has_flag = government_is_landless_adventurer
					government_allows = administrative
				}
				capital_province ?= root.location
			}
			add_to_list = travel_rivals
		}
		random_in_list = {
			list = travel_rivals
			save_scope_as = host
		}
		if = {
			limit = {
				any_memory = {
					has_memory_category = negative
					has_memory_participant = scope:host
				}
			}
			random_memory = {
				limit = {
					has_memory_category = negative
					has_memory_participant = scope:host
				}
				save_scope_as = rival_memory
			}
		}
		# find a secret for sneaky ROOTs to discover
		if = {
			limit = {
				OR = {
					has_focus = intrigue_skulduggery_focus
					has_focus = intrigue_intimidation_focus
					has_focus = stewardship_wealth_focus
				}
			}
			scope:host = {
				if = {
					limit = {
						any_secret = {
							NOT = { is_known_by = root }
						}
					}
					random_secret = {
						limit = { NOT = { is_known_by = root } }
						save_scope_as = secret_to_reveal
					}
				}
				else_if = {
					limit = {
						any_spouse = {
							this != root
							any_secret = {
								NOT = { is_known_by = root }
							}
						}
					}
					random_spouse = {
						limit = {
							this != root
							any_secret = {
								NOT = { is_known_by = root }
							}
						}
						random_secret = {
							limit = { NOT = { is_known_by = root } }
							save_scope_as = secret_to_reveal
						}
					}
				}
				else_if = {
					limit = {
						any_close_family_member = {
							this != root
							any_secret = { 
								NOT = { is_known_by = root }
							}
						}
					}
					random_close_family_member = {
						limit = {
							this != root
							any_secret = {
								NOT = { is_known_by = root }
							}
						}
						random_secret = {
							limit = { NOT = { is_known_by = root } }
							save_scope_as = secret_to_reveal
						}
					}
				}
				else_if = {
					limit = {
						any_consort = {
							this != root
							any_secret = { 
								NOT = { is_known_by = root }
							}
						}
					}
					random_consort = {
						limit = {
							this != root
							any_secret = {
								NOT = { is_known_by = root }
							}
						}
						random_secret = {
							limit = { NOT = { is_known_by = root } }
							save_scope_as = secret_to_reveal
						}
					}
				}
			}
		}
		# find a family member for friendly ROOTS to befriend
		else_if = {
			limit = {
				OR = {
					has_focus = diplomacy_family_focus
					has_focus = diplomacy_majesty_focus
					has_focus = diplomacy_foreign_affairs_focus
				}
			}
			scope:host = {
				every_spouse = {
					limit = { bp1_yearly_0100_befriend_trigger = yes }
					add_to_list = potential_friend
				}
				every_consort = {
					limit = { bp1_yearly_0100_befriend_trigger = yes }
					add_to_list = potential_friend
				}
				every_close_family_member = {
					limit = { bp1_yearly_0100_befriend_trigger = yes }
					add_to_list = potential_friend
				}
			}
			if = {
				limit = {
					scope:host = {
						OR = {
							any_spouse = {
								is_in_list = potential_friend
							}
							any_consort = {
								is_in_list = potential_friend
							}
							any_close_family_member = {
								is_in_list = potential_friend
							}
						}
					}
				}
				random_in_list = {
					list = potential_friend
					weight = {
						base = 5
						interesting_feast_participant_modifier = yes
						modifier = {
							opinion = {
	 							target = root
	 							value > 0
	 						}
							add = 20
	 					}
						modifier = {
							opinion = {
	 							target = root
	 							value > 50
	 						}
							add = 50
						}
						modifier = {
							is_landed = no
							add = 20
						}
					}
					save_scope_as = befriend
					save_scope_as = lower_center_portrait_character
				}
			}
		}

		# find a family member for ROOT to seduce
		else_if = {
			limit = {
				OR = {
					has_focus = intrigue_temptation_focus
					has_focus = martial_chivalry_focus
				}
			}
			scope:host = {
				every_spouse = {
					limit = { bp1_yearly_0100_lover_trigger = yes }
					add_to_list = potential_lover
				}
				every_consort = {
					limit = { bp1_yearly_0100_lover_trigger = yes }
					add_to_list = potential_lover
				}
				every_close_family_member = {
					limit = { bp1_yearly_0100_lover_trigger = yes }
					add_to_list = potential_lover
				}
			}
			if = {
				limit = {
					scope:host = {
						OR = {
							any_spouse = {
								is_in_list = potential_lover
							}
							any_consort = {
								is_in_list = potential_lover
							}
							any_close_family_member = {
								is_in_list = potential_lover
							}
						}
					}
				}
				random_in_list = {
					list = potential_lover
					weight = {
						base = 5
						modifier = {
							has_relation_potential_lover = root
							add = 50
						}
						modifier = {
							is_landed = no
							add = 20
						}
						modifier = {
							opinion = {
	 							target = scope:host
	 							value > 50
							}
							add = 20
						}
					}
					save_scope_as = lover
					save_scope_as = lower_center_portrait_character
				}
			}
		}
	}


	# You schmooze your way in
	option = {
		name = bp1_yearly.0100.a
		flavor = bp1_yearly.0100.a.tt
		send_interface_toast = {
			title = bp1_yearly.0100.a_title
			left_icon = scope:host
			custom_tooltip = bp1_yearly.0100.a.success_chance
			hidden_effect = {
				scope:host = {
					if = {
						limit = {
							any_scheme = {
								scheme_target_character = root
							}
						}
						every_scheme = {
							limit = {
								scheme_target_character = root
							}
							add_scheme_modifier = {
								type = extra_success_chance_modifier
							}
						}
					}
				}
			}
			add_prestige = miniscule_prestige_loss
		}
		hidden_effect = {
			trigger_event = {
				id = bp1_yearly.0102
				days = 5
			}
		}
		add_character_flag = {
			flag = flag_0102_uneventful_night
			days = 10
		}
		stress_impact = {
			vengeful = massive_stress_impact_gain
			paranoid = massive_stress_impact_gain
			stubborn = major_stress_impact_gain
			honest = medium_stress_impact_gain
			wrathful = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = -1
				ai_sociability = 0.5
				ai_honor = -0.25
				ai_compassion = 0.25
				ai_boldness = 0.25
				ai_rationality = 0.50
			}
			modifier = {
				has_trait = stubborn
				add = -100
			}
			modifier = {
				has_trait = paranoid
				add = -100
			}
			modifier = {
				has_trait = vengeful
				add = -100
			}
			modifier = {
				has_trait = honest
				add = -100
			}
			modifier = {
				has_trait = wrathful
				add = -75
			}
			modifier = {
				has_trait = arrogant
				add = -50
			}
		}
	}

	# You take the opportunity to snoop about secrets
	option = {
		name = bp1_yearly.0100.b
		flavor = bp1_yearly.0100.b.tt
		trigger = {
			OR = {
				has_focus = intrigue_skulduggery_focus
				has_focus = intrigue_intimidation_focus
				has_focus = stewardship_wealth_focus
			}
			exists = scope:secret_to_reveal
		}
		duel = {
			skill = intrigue
			target = scope:host
			40 = {
				compare_modifier = {
					value = scope:duel_value
					min = -39
					multiplier = 3
				}
				desc = bp1_yearly.0100.b.tt_success
				send_interface_toast = {
					title = bp1_yearly.0100.b.tt_success
					left_icon = scope:host
					custom_tooltip = bp1_yearly.0100.b.secrets
					hidden_effect = {
						scope:secret_to_reveal = {
							reveal_to = root
						}
					}
				}
				hidden_effect = {
					trigger_event = {
						id = bp1_yearly.0102
						days = 5
					}
				}
				add_character_flag = {
					flag = flag_0102_uneventful_night
					days = 10
				}
			}
			45 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3
					min = -44
				}
				desc = bp1_yearly.0100.b.tt_failure
				send_interface_toast = {
					title = bp1_yearly.0100.b.tt_failure
					left_icon = scope:host
				}
				hidden_effect = {
					trigger_event = {
						id = bp1_yearly.0102
						days = 5
					}
				}
				add_character_flag = {
					flag = flag_0102_uneventful_night
					days = 10
				}
			}
			15 = {
				desc = bp1_yearly.0100.b.tt_crit_failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3
					min = -15
				}
				if = {
					limit = {
						scope:host = {
							is_landed = yes
						}
					}
					rightfully_imprison_character_less_verbose_effect = { 
						TARGET = root 
						IMPRISONER = scope:host 
					}
				}
				else = {
					send_interface_toast = {
						title = bp1_yearly.0100.b.tt_crit_failure
						left_icon = scope:host
						add_prestige = minor_prestige_loss
						progress_towards_rival_effect = {
							REASON = rival_snooping_around_home
							CHARACTER = scope:host
							OPINION = default_rival_opinion
						}
						every_courtier = {
							custom = all_courtiers
							add_opinion = {
	 							target = root
								modifier = intrusive_liege_opinion
	 							opinion = -10
							}
						}
					}
					hidden_effect = {
						trigger_event = {
							id = bp1_yearly.0102
							days = 5
						}
					}
					add_character_flag = {
						flag = flag_0102_failed_snoop
						days = 10
					}
				}
			}
		}
		stress_impact = {
			eccentric = minor_stress_impact_loss
			honest = massive_stress_impact_gain
			forgiving = massive_stress_impact_gain
			shy = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
			content = minor_stress_impact_gain
		}
		ai_chance = {
			base = 30
			ai_value_modifier = {
				ai_honor = -0.75
				ai_compassion = -0.5
				ai_sociability = 0.5
				ai_rationality = -0.25
			}
			modifier = {
				has_trait = honest
				add = -100
			}
			modifier = {
				has_trait = forgiving
				add = -100
			}
			modifier = {
				has_trait = shy
				add = -50
			}
			modifier = {
				has_trait = vengeful
				add = 50
			}
			modifier = {
				intrigue > decent_skill_rating
				add = 50
			}
			modifier = {
				intrigue > high_skill_rating
				add = 150
			}
			modifier = {
				intrigue < mediocre_skill_rating
				add = -50
			}
			modifier = {
				intrigue < low_skill_rating
				add = -50
			}
			modifier = {
				scope:host = {
					intrigue > decent_skill_rating
				}
				add = -50
			}
			modifier = {
				scope:host = {
					intrigue < mediocre_skill_rating
				}
				add = 50
			}
			modifier = {
				scope:host = {
					intrigue < low_skill_rating
				}
				add = 100
			}
		}
	}

	# You can try to befriend whoever's there to welcome you
	option = {
		name = bp1_yearly.0100.c
		flavor = bp1_yearly.0100.c.tt
		trigger = {
			OR = {
				has_focus = diplomacy_majesty_focus
				has_focus = diplomacy_family_focus
				has_focus = diplomacy_foreign_affairs_focus
			}
			exists = scope:befriend
		}
		custom_tooltip = bp1_yearly.0100.a.success_chance
		hidden_effect = {
			scope:host = {
				if = {
					limit = {
						any_scheme = {
							scheme_target_character = root
						}
					}
					every_scheme = {
						limit = {
							scheme_target_character = root
						}
						add_scheme_modifier = {
							type = extra_success_chance_modifier
						}
					}
				}
			}
		}
		duel = {
			skill = diplomacy
			value = 10
			35 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3
					min = -34
				}
				modifier = {
    				scope:befriend = {
    					has_trait = forgiving
    				}
      				add = 15
				}
				modifier = {
    				scope:befriend = {
    					has_trait = compassionate
    				}
      				add = 10
				}
				modifier = {
    				scope:befriend = {
    					has_trait = gregarious
    				}
      				add = 10
				}
				modifier = {
    				scope:befriend = {	
    					has_trait = trusting
					}
      				add = 15
				}
				modifier = {
    				scope:befriend = {	
    					has_trait = gregarious
					}
      				add = 10
				}
				modifier = {
    				scope:befriend = {	
    					has_trait = vengeful
					}
      				add = -15
				}
				modifier = {
    				scope:befriend = {	
    					has_trait = paranoid
					}
      				add = -15
				}
				modifier = {
    				scope:befriend = {	
    					has_trait = shy
					}
      				add = -10
				}
				modifier = {
    				scope:befriend = {	
    					has_trait = sadistic
					}
      				add = -10
				}
				opinion_modifier = {
					who = scope:befriend
					opinion_target = root
					multiplier = 1
				}
				opinion_modifier = {
					who = scope:befriend
					opinion_target = scope:host
					multiplier = -1
				}
				desc = bp1_yearly.0100.c.tt_success
				send_interface_toast = {
					title = bp1_yearly.0100.c.tt_success
					left_icon = scope:befriend
					set_relation_friend = { reason = friend_charmed_during_visit target = scope:befriend involved_character = scope:host }
				}
				create_character_memory = {
					type = friend_despite_rivalry

					participants = {
						unlikely_friend = scope:befriend
						rival = scope:host
					}
				}
				add_character_flag = {
					flag = flag_0102_warm_welcome
					days = 10
				}
				hidden_effect = {
					scope:host = {
						add_opinion = {
 							target = scope:befriend
							modifier = angry_opinion
 							opinion = -40
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3
					min = -49
				}
				desc = bp1_yearly.0100.c.tt_failure
				send_interface_toast = {
					title = bp1_yearly.0100.c.tt_failure
					left_icon = scope:befriend
					scope:befriend = {
						add_opinion = {
 							target = root
							modifier = friendly_interaction
 							opinion = 10
						}
					}
				}
				add_character_flag = {
					flag = flag_0102_warm_welcome
					days = 10
				}
				hidden_effect = {
					scope:host = {
						add_opinion = {
 							target = scope:befriend
							modifier = angry_opinion
 							opinion = -20
						}
					}
				}
			}
			15 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3
					min = -14
				}
				desc = bp1_yearly.0100.c.tt_crit_failure
				send_interface_toast = {
					title = bp1_yearly.0100.c.tt_crit_failure
					left_icon = scope:befriend
					add_prestige = minor_prestige_loss
					set_relation_rival = {
						reason = rival_repelled_during_visit
						target = scope:befriend
					}
				}
				create_character_memory = {
					type = detestable_family

					participants = {
						new_rival = scope:befriend
						old_rival = scope:host
					}
				}
				add_character_flag = {
					flag = flag_0102_cold_welcome
					days = 10
				}
			}
		}
		hidden_effect = {
			trigger_event = {
				id = bp1_yearly.0102
				days = 5
			}
		}
		stress_impact = {
			paranoid = major_stress_impact_gain
			shy = major_stress_impact_gain
			vengeful = major_stress_impact_gain
			callous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 200
			ai_value_modifier = {
				ai_sociability = 1
				ai_compassion = 1
				ai_vengefulness = -0.75
			}
			modifier = {
				has_trait = vengeful
				add = -400
			}
			modifier = {
				has_trait = paranoid
				add = -400
			}
			modifier = {
				has_trait = shy
				add = -400
			}
			modifier = {
				has_trait = callous
				add = -200
			}
			modifier = {
				has_trait = gregarious
				add = 200
			}
			modifier = {
				diplomacy > decent_skill_rating
				add = 200
			}
			modifier = {
				diplomacy < low_skill_rating
				add = -200
			}
		}
	}

	# You can throw yourself into welcoming, naked arms
	option = {
		trigger = {
			OR = {
				has_focus = intrigue_temptation_focus
				has_focus = martial_chivalry_focus
			}
			exists = scope:lover
			might_cheat_on_every_partner_trigger = yes
		}
		name = bp1_yearly.0100.d
		flavor = bp1_yearly.0100.d.tt
		hidden_effect = {
			scope:host = {
				if = {
					limit = {
						any_secret = {
							NOT = { is_known_by = root }
						}
					}
					every_scheme = {
						limit = {
							scheme_target_character = root
						}
						add_scheme_modifier = {
							type = extra_success_chance_modifier
						}
					}
				}
			}
		}
		random_list = {
			75 = {
				show_chance = no
				desc = bp1_yearly.0100.d.tt.success
				custom_tooltip = bp1_yearly.0100.d.tt.sex
				hidden_effect = {
					trigger_event = {
						id = bp1_yearly.0101
						days = 1
					}
				}
				add_character_flag = {
					flag = flag_0102_erotic_welcome
					days = 10
				}
				hidden_effect = {
					scope:host = {
						add_opinion = {
 							target = scope:lover
							modifier = angry_opinion
 							opinion = -20
						}
					}
				}
			}
			25 = {
				show_chance = no
				desc = bp1_yearly.0100.d.tt_failure
				send_interface_toast = {
					title = bp1_yearly.0100.d.tt_failure
					left_icon = scope:lover
					custom_tooltip = bp1_yearly.0100.d.tt_no_sex
					if = {
						limit = {
							NOT = { has_relation_potential_lover = scope:lover }
						}
						hidden_effect = {
							set_relation_potential_lover = scope:lover
						}
					}
				}
				add_character_flag = {
					flag = flag_0102_uneventful_night
					days = 10
				}
			}
		}
		if = {
			limit = {
				faith = {
					NOR = {
						has_doctrine = tenet_carnal_exaltation
						has_doctrine = tenet_polyamory
						has_doctrine = doctrine_adultery_men_accepted
						has_doctrine = doctrine_adultery_women_accepted
					}
				}
			}
			stress_impact = {
				zealous = major_stress_impact_gain
			}
			if = {
				limit = {
					scope:lover = {
						is_married = yes
					}
				}
				stress_impact = {
					just = major_stress_impact_gain
				}
			}
		}
		hidden_effect = {
			trigger_event = {
				id = bp1_yearly.0102
				days = 5
			}
		}
		stress_impact = {
			chaste = massive_stress_impact_gain
			paranoid = major_stress_impact_gain
			shy = medium_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 500
			ai_value_modifier = {
				ai_sociability = -0.5
				ai_boldness = 0.5
			}
			modifier = {
				scope:lover = {
					is_married = yes
				}
				has_trait = just
				add = -500
			}
			modifier = {
				faith = {
					NOR = {
						has_doctrine = tenet_carnal_exaltation
						has_doctrine = tenet_polyamory
						has_doctrine = doctrine_adultery_men_accepted
						has_doctrine = doctrine_adultery_women_accepted
					}
				}
				has_trait = zealous
				add = -500
			}
			modifier = {
				has_trait = honest
				add = -100
			}
			modifier = {
				has_trait = chaste
				factor = -1000
			}
			modifier = {
				has_trait = paranoid
				add = -500
			}
			modifier = {
				has_trait = lustful
				add = 1000
			}
			modifier = {
				has_trait = shy
				add = -500
			}
			modifier = {
				NOT = { can_set_relation_lover_trigger = { CHARACTER = scope:lover } }
				add = -1000
			}
		}
	}


	# You will enjoy a relaxing night. By force!
	option = {
		trigger = {
			NOT = {
				root.liege = {
					this = scope:host
				}
			}
		}
		name = bp1_yearly.0100.e
		flavor = bp1_yearly.0100.e.tt
		add_internal_flag = dangerous
		progress_towards_rival_effect = {
			REASON = rival_breaks_into_home
			CHARACTER = scope:host
			OPINION = 0
		}
		scope:host = {
			add_opinion = {
				modifier = hate_opinion
				target = root
				opinion = -40
			}

		}
		if = {
			limit = {	
				scope:host = {
					OR = {
						is_vassal_of = root
						is_courtier_of = root
					}
				}
			}
			add_tyranny = minor_tyranny_gain
		}
		duel = {
			skill = martial
			value = 10
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3
					min = -49
				}
				modifier = {
					has_trait = aggressive_attacker
					add = 20
				}
				modifier = {
					has_trait = reckless
					add = 20
				}
				modifier = {
					has_trait = cautious_leader
					add = -20
				}
				desc = bp1_yearly.0100.e.tt_success
				send_interface_toast = {	
					title = bp1_yearly.0100.e.tt_success
					left_icon = scope:host
					scope:host = {
						pay_short_term_gold = {
							target = root
							gold = minor_gold_value
						}
					}
					add_martial_lifestyle_xp = medium_lifestyle_experience
					stress_impact = {
						vengeful = minor_stress_impact_loss
						paranoid = minor_stress_impact_loss
					}
				}
				add_character_flag = {
					flag = flag_0102_attack_success
					days = 10
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3
					min = -49
				}
				desc = bp1_yearly.0100.e.tt_failure
				custom_tooltip = bp1_yearly.0100.e.wounded_chance
				if = {
					limit = {
						can_contract_disease_trigger = { DISEASE = ill }
					}
					custom_tooltip = bp1_yearly.0100.f.sick
				}
				else = {
					custom_tooltip = bp1_yearly.0100.f.very_sick
				}
				hidden_effect = {
					duel = {
						skill = prowess
						value = 10
						50 = {
							compare_modifier = {
								value = scope:duel_value
								multiplier = 3
							}
							min = -49
							show_chance = no
						}
						50 = {
							compare_modifier = {
								value = scope:duel_value
								multiplier = -3
							}
							min = -49
							show_chance = no
							send_interface_toast = {	
								title = bp1_yearly.0100.e.tt_failure
								left_icon = scope:host
								increase_wounds_effect = { REASON = fight }
							}
						}
					}
				}
				hidden_effect = {
					random_list = {
						55 = {
							modifier = {
								health > fine_health
								factor = 1.5
							}
							modifier = {
								health > good_health
								factor = 1.5
							}
							desc = bp1_yearly.0100.f.tt_success
							send_interface_toast = {
								title = bp1_yearly.0100.f.tt_success
								left_icon = root
							}
						}
						45 = {
							modifier = {
								health < fine_health
								factor = 1.5
							}
							modifier = {
								health < poor_health
								factor = 1.5
							}
							desc = bp1_yearly.0100.f.tt_failure
							send_interface_toast = {
								title = bp1_yearly.0100.f.tt_failure
								left_icon = root
								if = {
									limit = {
										can_contract_disease_trigger = { DISEASE = ill }
									}
									contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = yes }
								}
								else = {
									contract_disease_effect = { DISEASE = pneumonic TREATMENT_EVENT = yes }
								}
							}	
						}
					}
				}
				add_prestige = medium_prestige_loss
				create_character_memory = {
					type = endured_storm
				}
				add_character_flag = {
					flag = flag_0102_attack_fail
					days = 10
				}
			}
		}
		if = {
			limit = {
				scope:host = {
					OR = {
						is_vassal_of = root
						is_courtier_of = root
					}
				}
			}
			stress_impact = {
				just = major_stress_impact_gain
			}
		}
		hidden_effect = {
			trigger_event = {
				id = bp1_yearly.0102
				days = 5
			}
		}
		stress_impact = {
			trusting = massive_stress_impact_gain
			craven = major_stress_impact_gain
			forgiving = major_stress_impact_gain
			compassionate = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 20
			ai_value_modifier = {
				ai_honor = -0.5
				ai_boldness = 0.75
				ai_sociability = -0.50
				ai_compassion = -0.5
			}
			modifier = {
				has_trait = craven
				add = -100
			}
			modifier = {
				has_trait = forgiving
				add = -100
			}
			modifier = {
				has_trait = trusting
				add = -100
			}
			modifier = {
				has_trait = vengeful
				add = 50
			}
			modifier = {
				add = 50
				martial > high_skill_rating
			}
			modifier = {
				add = -100
				martial < mediocre_skill_rating
			}
			modifier = {
				is_healthy = no
				add = -100
			}
			modifier = {
				scope:host = {
					OR = {
						is_vassal_of = root
						is_courtier_of = root
					}
				}
				has_trait = just
				add = -150
			}
		}
	}

	# You endure the storm the old-fashioned way
	option = {
		name = bp1_yearly.0100.f
		random_list = {
			50 = {
				modifier = {
					health > fine_health
					factor = 1.5
				}
				modifier = {
					health > good_health
					factor = 1.5
				}
				desc = bp1_yearly.0100.f.tt_success
				send_interface_toast = {
					title = bp1_yearly.0100.f.tt_success
					left_icon = root
				}
			}
			50 = {
				modifier = {
					health < fine_health
					factor = 1.5
				}
				modifier = {
					health < poor_health
					factor = 1.5
				}
				desc = bp1_yearly.0100.f.tt_failure
				send_interface_toast = {
					title = bp1_yearly.0100.f.tt_failure
					left_icon = root
					if = {
						limit = {
							can_contract_disease_trigger = { DISEASE = ill }
						}
						contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = yes }
					}
					else = {
						contract_disease_effect = { DISEASE = pneumonic TREATMENT_EVENT = yes }	
					}
				}	
			}	
		}
		add_prestige = minor_prestige_loss
		create_character_memory = {
			type = endured_storm
		}
		stress_impact = {
			trusting = major_stress_impact_gain
			forgiving = major_stress_impact_gain
			gregarious = major_stress_impact_gain
			compassionate = minor_stress_impact_gain
			deceitful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_sociability = -1
				ai_boldness = -1
			}
			modifier = {
				has_trait = trusting
				add = -100
			}
			modifier = {
				has_trait = arrogant
				add = -50
			}
			modifier = {
				has_trait = compassionate
				add = -50
			}
			modifier = {
				has_trait = deceitful
				add = -50
			}
			modifier = {
				has_trait = forgiving
				add = -50
			}
			modifier = {
				has_trait = gregarious
				add = -50
			}
			modifier = {
				has_trait = ill
				add = -100
			}
		}
	}
}

# ROOT's needy charm successfully seduces their rival's family member
bp1_yearly.0101 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.0101.t
	desc = {
		desc = bp1_yearly.0101.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:lover = {
						OR = {
							culture = { has_cultural_pillar = martial_custom_male_only }
							culture = { has_cultural_pillar = martial_custom_equal }
						}
						is_female = yes
					}
				}
				desc = bp1_yearly.0101.gentle_flirt
			}
			triggered_desc = {
				trigger = {
					scope:lover = {
						culture = { has_cultural_pillar = martial_custom_female_only }
						is_female = no
					}
				}
				desc = bp1_yearly.0101.gentle_flirt
			}
			triggered_desc = {
				trigger = {
					scope:lover = {
						OR = {
							culture = { has_cultural_pillar = martial_custom_male_only }
							culture = { has_cultural_pillar = martial_custom_equal }
						}
						is_female = no
					}
				}
				desc = bp1_yearly.0101.protective_flirt
			}
			desc = bp1_yearly.0101.protective_flirt
		}
		desc = bp1_yearly.0101.finish
	}
	theme = seduction

	override_background = {
		reference = corridor_night
 	}

	left_portrait = {
		character = root
		animation = reception_groom_left
	}
	right_portrait = {
		character = scope:lover
		animation = scheme
		camera = camera_event_very_right
	}

	immediate = {
		scope:lover = {
			add_character_flag = is_naked
		}
	}

	option = {
		name = bp1_yearly.0101.a
		show_as_tooltip = {
			had_sex_with_effect = {
				CHARACTER = scope:lover
				PREGNANCY_CHANCE = seduce_pregnancy_chance
			}
		}
		set_relation_lover = { reason = lover_storm target = scope:lover involved_character = scope:host }
		scope:lover = {
			#Sodomy
			give_homosexual_secret_or_nothing_with_target_effect = { CHARACTER = root }

			#Incest
			give_incest_secret_or_nothing_with_target_effect = { CHARACTER = root } 
				
			#Adultery/fornication isn't a secret, but is applied as traits when the secrets are revealed
		}
		#Sodomy
		give_homosexual_secret_or_nothing_with_target_effect = { CHARACTER = scope:lover }

		#Incest
		give_incest_secret_or_nothing_with_target_effect = { CHARACTER = scope:lover } 
		
		create_character_memory = {
			type = storm_seduction
			participants = {
				storm_lover = scope:lover
			}
		}
		if = {
			limit = { #Extra stress for zealous
				faith = { save_temporary_scope_as = my_faith }
				OR = {
					relation_with_character_is_incestuous_in_my_faith_trigger = { CHARACTER = scope:lover }
					relation_with_character_is_sodomy_trigger = { CHARACTER = scope:lover }
					OR = {				
						trait_is_shunned_in_faith_trigger = { TRAIT = adulterer FAITH = scope:my_faith GENDER_CHARACTER = root } #Fornicator is handled by same rules
						trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = scope:my_faith GENDER_CHARACTER = root } #Fornicator is handled by same rules
					}
				}
			}
			stress_impact = {
				chaste = medium_stress_impact_gain
				zealous = medium_stress_impact_gain
			}
		}
		else = { #Regular stress
			stress_impact = {
				chaste = medium_stress_impact_gain
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.50
				ai_vengefulness = -0.50
				ai_sociability = 0.25
			}
		}
	}
	option = {
		name = bp1_yearly.0101.b
		show_as_tooltip = {
			had_sex_with_effect = {
				CHARACTER = scope:lover
				PREGNANCY_CHANCE = seduce_pregnancy_chance
			}
		}
		scope:lover = {
			#Sodomy
			give_homosexual_secret_or_nothing_with_target_effect = { CHARACTER = root }

			#Incest
			give_incest_secret_or_nothing_with_target_effect = { CHARACTER = root } 
				
			#Adultery/fornication isn't a secret, but is applied as traits when the secrets are revealed
		}
		#Sodomy
		give_homosexual_secret_or_nothing_with_target_effect = { CHARACTER = scope:lover }

		#Incest
		give_incest_secret_or_nothing_with_target_effect = { CHARACTER = scope:lover } 
		if = {
			limit = { #Extra stress for zealous
				faith = { save_temporary_scope_as = my_faith }
				OR = {
					relation_with_character_is_incestuous_in_my_faith_trigger = { CHARACTER = scope:lover }
					relation_with_character_is_sodomy_trigger = { CHARACTER = scope:lover }
					OR = {				
						trait_is_shunned_in_faith_trigger = { TRAIT = adulterer FAITH = scope:my_faith GENDER_CHARACTER = root } #Fornicator is handled by same rules
						trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = scope:my_faith GENDER_CHARACTER = root } #Fornicator is handled by same rules
					}
				}
			}
			stress_impact = {
				chaste = medium_stress_impact_gain
				compassionate = minor_stress_impact_gain
				zealous = medium_stress_impact_gain
			}
		}
		else = { #Regular stress
			stress_impact = {
				chaste = medium_stress_impact_gain
				compassionate = medium_stress_impact_gain
				forgiving = minor_stress_impact_gain
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_honor = 0.25
				ai_compassion = -0.75
				ai_energy = 0.25
				ai_rationality = 0.25
			}
			modifier = {
				has_trait = compassionate
				add = -50
			}
			modifier = {
				has_trait = forgiving
				add = -75
			}
		}
	}
	after = {
		scope:lover = {
			remove_character_flag = is_naked
		}
	}
}

bp1_yearly.0102 = {
	type = letter_event
	content_source = dlc_006
	opening = bp1_yearly.0102.opening
	desc = {
		desc = bp1_yearly.0102.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:host = {
						OR = {
							is_vassal_of = root
							is_courtier_of = root
						}
					}
				}
				desc = bp1_yearly.0102.desc_weak
			}
			desc = bp1_yearly.0102.desc_powerful
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = flag_0102_uneventful_night
				}
				desc = bp1_yearly.0102.uneventful_night
			}
			triggered_desc = {
				trigger = {
					has_character_flag = flag_0102_failed_snoop
				}
				desc = bp1_yearly.0102.failed_snoop
			}
			triggered_desc = {
				trigger = {
					has_character_flag = flag_0102_warm_welcome
				}
				desc = bp1_yearly.0102.warm_welcome
			}
			triggered_desc = {
				trigger = {
					has_character_flag = flag_0102_cold_welcome
				}
				desc = bp1_yearly.0102.cold_welcome
			}
			triggered_desc = {
				trigger = {
					has_character_flag = flag_0102_erotic_welcome
				}
				desc = bp1_yearly.0102.erotic_welcome
			}
			triggered_desc = {
				trigger = {
					has_character_flag = flag_0102_attack_success
				}
				desc = bp1_yearly.0102.attack_success
			}
			desc = bp1_yearly.0102.attack_fail
		}
		desc = bp1_yearly.0102.close
	}
	sender = scope:host

	immediate = {

	}

	option = {
		trigger = {
			NOT = { has_character_flag = flag_0102_attack_fail }
		}
		name = bp1_yearly.0102.a
		scope:host = {
			add_opinion = { 
				target = root
				modifier = hate_opinion
				opinion = -15
			}
		}
		ai_chance = {
			base = 100
		}
	}
	option = {
		trigger = {
			has_character_flag = flag_0102_attack_fail
		}
		name = bp1_yearly.0102.b
		scope:host = {
			add_opinion = { 
				target = root
				modifier = hate_opinion
				opinion = -15
			}
		}
		ai_chance = {
			base = 100
		}
	}
}
