﻿#Effects used in Stress events

#####################################################################
# EFFECT LIST
#####################################################################
#
# By Sean Hughes:
#  stress_threshold_event_aftereffects - Runs all post-event cleanup and pre-event setup to ensure the stress system keeps working without any breaks.
#  remove_stress_threshold_option_flags_effect – Cleans up all flags which may have been applied to a character for the purpose of calculating which event options get offered to the player.
#  contrite_get_secret_scopes_effect – Setup for 'contrite_get_secret_scopes_effect', should be run in immediate.
#  contrite_reveal_secrets_effect – Reduces stress, but exposes one or more of your secrets.
#  rakish_brothel_night_effect – Reduces stress, but has a high chance to contract STDs.
#  reclusive_get_relationships_effect – setup for 'reclusive_damage_relationship_effect', should be run in the immediate.
#  reclusive_damage_relationships_effect – Reduces stress, but damages a positive relationship you have with someone.
#  inappetetic_advance_starvation_effect – Reduces stress, but applies a skill and health penalty.
#  stress_replace_personality_trait_with_opposite_effect – Takes a personality trait, will add the trait and find an appropraite trait to remove to make space for it.
#  stress_prison_remove_ordered_personality_trait_effect – Part of the above. Removes a personaliy trait based on an ordered list designed to be used in prison.
#  stress_unimprisoned_remove_ordered_personality_trait_effect — Part of the above. Removes a personaliy trait based on an ordered list designed to be used outside of prison.
#  stress_save_deceased_character_for_mental_break — Saves a character as a variable for a mental break event to reference them later. Does not actually trigger a mental break.  


# Must be run at the end of 'immediate' in EVERY stress threshold event, to ensure all tasks the system expects to execute are done properly.
stress_threshold_event_post_immediate = {

	# Record the character's current stress level (must be done in the immediate so that if a character's stress level changes before 'after' executes we still apply the correct cooldowns).
	if = {
		limit = {
			stress_level >= 3
		}
		add_character_flag = apply_stress_threshold_cooldown_level_3
	}
	else_if = {
		limit = {
			stress_level >= 2
		}
		add_character_flag = apply_stress_threshold_cooldown_level_2
	}
	else_if = {
		limit = {
			stress_level >= 1
		}
		add_character_flag = apply_stress_threshold_cooldown_level_1
	}
}

# Must be run in the 'after' EVERY stress threshold event, to ensure all tasks the system expect to execute are done properly.
stress_threshold_event_aftereffects = {
	if = {
		limit = {
			is_alive = yes
		}
		
		# Clean up all event option flags.
		remove_stress_threshold_option_flags_effect = yes

		# Based on the character's recorded stress level, apply the appropraite cooldown flag for the cooldown duration - 1 days.
		if = {
			limit = {
				has_character_flag = apply_stress_threshold_cooldown_level_3
			}
			add_character_flag = {
				flag = stress_threshold_event_3_cooldown
				days = stress_threshold_cooldown_duration # 1 day less than 5 years (8 with Perk)
			}
		}
		else_if = {
			limit = {
				has_character_flag = apply_stress_threshold_cooldown_level_2
			}
			add_character_flag = {
				flag = stress_threshold_event_2_cooldown
				days = stress_threshold_cooldown_duration # 1 day less than 5 years (8 with Perk)
			}
		}
		else = {
			add_character_flag = {
				flag = stress_threshold_event_1_cooldown
				days = stress_threshold_cooldown_duration # 1 day less than 5 years (8 with Perk)
			}
		}
		
		# Remove the character's recorded stress level flags.
		remove_character_flag = apply_stress_threshold_cooldown_level_3
		remove_character_flag = apply_stress_threshold_cooldown_level_2
		remove_character_flag = apply_stress_threshold_cooldown_level_1

		# Schedule a new stress event to occur after the cooldown duration has elapsed.
		trigger_event = {
			id = stress_threshold.0005
			days = stress_threshold_second_check_timing # 5 year maximum between events (8 with Perk)
		}

		# Warn the player that they will receive another event if they are still Stressed.
		custom_tooltip = stress_threshold_cooldown_message	
	}
}

# Clears all 'stress_threshold_option_xxx' flags from a character so that they will get the correct options offered to them the next time they get a stress threshold event.
remove_stress_threshold_option_flags_effect = {
	remove_character_flag = stress_threshold_option_drunkard
	remove_character_flag = stress_threshold_option_hashishiyah
	remove_character_flag = stress_threshold_option_rakish
	remove_character_flag = stress_threshold_option_reclusive
	remove_character_flag = stress_threshold_option_irritable
	remove_character_flag = stress_threshold_option_flagellant
	remove_character_flag = stress_threshold_option_profligate
	remove_character_flag = stress_threshold_option_improvident
	remove_character_flag = stress_threshold_option_contrite
	remove_character_flag = stress_threshold_option_comfort_eater
	remove_character_flag = stress_threshold_option_inappetetic
	remove_character_flag = stress_threshold_option_journaller
	remove_character_flag = stress_threshold_option_confider
	remove_character_flag = stress_threshold_option_athletic
	remove_character_flag = stress_threshold_option_conversion
	remove_character_flag = stress_threshold_option_depression
	remove_character_flag = stress_threshold_option_burdened
}

# Setup for 'contrite_reveal_secrets_effect'. Checks what secrets we have and save their scopes so the option tooltip is consistent and correct.
# While preferable to have some, it is okay if we don't have any, as we have a fallback in the option itself.
contrite_get_secret_scopes_effect = {

	random_secret = {
		limit = {
			is_criminal_for = root
			can_be_exposed_by = root
		}
		save_scope_as = confessed_secret # The first secret must be criminal.
	}
	if = {
		limit = {
			exists = scope:confessed_secret
			any_secret = {
				this != scope:confessed_secret
				can_be_exposed_by = root
			}
		}
		random_secret = {
			limit = {
				this != scope:confessed_secret
				can_be_exposed_by = root
			}
			save_scope_as = second_confessed_secret # The second secret can be anything as long as it is different from the first.
		}
	}
}

# Requires 'contrite_get_secret_scopes_effect' to be run first. Reveals one or more secrets you know or, if you have none, applies a general opinion modifier to you and reduces stress.
contrite_reveal_secrets_effect = {
	# The more secrets you have to confess, the more stress reduction you get!
	if = {
		limit = {
			exists = scope:confessed_secret
			scope:confessed_secret = { can_be_exposed_by = root }
		}
		scope:confessed_secret = {
			expose_secret = root
		}
		if = {
			limit = {
				exists = scope:second_confessed_secret
				scope:second_confessed_secret = { can_be_exposed_by = root }
			}
			scope:second_confessed_secret = {
				expose_secret = root
			}
			add_stress = massive_stress_impact_loss # Revealing both a Criminal secret and a 2nd secret gives us a lot of Stress Reduction.
		}
		else = {
			add_stress = major_stress_impact_loss # Revealing only a Criminal secret still gives us a lot of Stress Reduction.
		}
	}
	else_if = {
		limit = {
			exists = scope:second_confessed_secret
			scope:second_confessed_secret = { can_be_exposed_by = root }
		}
		scope:second_confessed_secret = {
			expose_secret = root
		}
		add_stress = medium_stress_impact_loss # Revealing only a non-Criminal secret gives us less Stress Reduction.
	}
	# If you have no secrets, you reveal a 'minor secret' about yourself (not something which is a real Secret, but something still disturbing enough to make people uncomfortable).
	else = {
		add_character_modifier = {
			modifier = stress_disturbing_confession
			years = 3
		}
		add_stress = medium_stress_impact_loss
	}	
}

# Applies the effects of a one-night debauchery spree in a brothel.
# (Does not use "had_sex_with_unknown_effect" since we want a higher risk of STDs)
rakish_brothel_night_effect = {
	# Warn the character about possible negative consequences.
	custom_tooltip = stress_threshold.1011.rakish.tt

	# Negative consequences of the night.
	random_list = {
		50 = {
			trigger = {
				is_attracted_to_men = yes
			}
			set_variable = {
				name = had_recent_sex
				value = flag:male
			}
			give_homosexual_secret_or_nothing_with_target_effect = { CHARACTER = dummy_male }
		}
		50 = {
			trigger = {
				is_attracted_to_women = yes
			}
			set_variable = {
				name = had_recent_sex
				value = flag:female
			}
		}
	}
	hidden_effect = {
		#Adultery suspicion
		random = {
			chance = 5
			random_spouse = {
				limit = { is_ai = no }
				alternative_limit = { always = yes }
				trigger_event = adultery.0001
			}
		}

		# Possible STD transmission
		random_list = {
			75 = {
				#Nothing
			}
			20 = {
				contract_disease_notify_effect = { DISEASE = lovers_pox }
			}
			5 = {
				contract_disease_notify_effect = { DISEASE = great_pox }
			}
		}

		#Possibility to start peasant story cycle
		random = {
			chance = 5
			if = {
				limit = {
					NOT = { has_character_flag = had_story_cycle_peasant_affair }
					is_ruler = yes
					is_ai = no
				}
				create_character = {
					location = root.capital_province
					template = beautiful_peasant_character
					gender_female_chance = root_attraction_based_female_chance
					faith = root.faith
					culture = root.culture
					save_scope_as = beautiful_peasant
				}
				scope:beautiful_peasant = {
					set_sexuality = bisexual
				}
				if = {
					limit = {
						is_male = yes
						exists = scope:beautiful_peasant
						scope:beautiful_peasant = {
							is_female = yes
							age < define:NChildbirth|MAX_FEMALE_REPRODUCTION_AGE
						}
					}
					random = {
						chance = pregnancy_chance
						scope:beautiful_peasant = {
							add_character_flag = {
								flag = peasant_is_pregnant
								days = 560
							}
						}
					}
				}
				set_variable = {
					name = story_peasant_affair_target
					value = scope:beautiful_peasant
				}
				set_variable = { #To save how you met
					name = rakish_night
					value = 0
				}
				create_story = story_peasant_affair
			}
		}
	}

	add_stress = major_stress_impact_loss
}


# Check what relationships we have and save their scopes for 'reclusive_damage_relationships_effect' so that the option tooltip is consistent and correct.
# While preferable to have some, it is okay if we don't have any, as we have a fallback in the option itself.
reclusive_get_relationships_effect = {
	if = {
		limit = {
			any_relation = { type = friend }
		}
		random_relation = {
			type = friend
			save_scope_as = lost_friend
		}
	}
	else_if = {
		limit = {
			any_relation = { type = lover }
		}
		random_relation = {
			type = lover
			save_scope_as = lost_lover
		}
	}
	else_if = {
		limit = {
			any_spouse = {
				exists = this
			}
		}
		random_spouse = {
			save_scope_as = neglected_spouse
		}
	}
}

# Requires 'reclusive_get_relationships_effect' to be run first (preferably in the immediate). Hurts the opinion of someone important to us and relieves stress.
reclusive_damage_relationships_effect = {
	if = {
		limit = {
			exists = scope:lost_friend
			scope:lost_friend = { is_alive = yes }
			has_relation_friend = scope:lost_friend
		}
		remove_relation_friend = scope:lost_friend
		add_stress = medium_stress_impact_loss
	}
	else_if = {
		limit = {
			exists = scope:lost_lover
			scope:lost_lover = { is_alive = yes }
			has_relation_lover = scope:lost_lover
		}
		remove_relation_lover = scope:lost_lover
		add_stress = medium_stress_impact_loss
	}
	else_if = {
		limit = {
			exists = scope:neglected_spouse
			scope:neglected_spouse = { is_alive = yes }
			any_consort = { this = scope:neglected_spouse }
		}
		scope:neglected_spouse = {
			add_opinion = {
				modifier = neglected_opinion
				target = root
				opinion = -25
			}
		}
		add_stress = medium_stress_impact_loss
	}
	else = {
		add_stress = minor_stress_impact_loss
	}
}

# Adds increasingly severe starvation penalties to a character.
inappetetic_advance_starvation_effect = {
	if = {
		limit = {
			has_character_modifier = stress_inappetetic_hunger_3
		}
		death = { death_reason = death_malnourishment }
	}
	else_if = {
		limit = {
			has_character_modifier = stress_inappetetic_hunger_2
		}
		remove_character_modifier = stress_inappetetic_hunger_2
		add_character_modifier = {
			modifier = stress_inappetetic_hunger_3
			years = 3
		}
	}
	else_if = {
		limit = {
			has_character_modifier = stress_inappetetic_hunger_1
		}
		remove_character_modifier = stress_inappetetic_hunger_1
		add_character_modifier = {
			modifier = stress_inappetetic_hunger_2
			years = 3
		}
	}
	else = {
		add_character_modifier = {
			modifier = stress_inappetetic_hunger_1
			years = 3
		}
	}
}

stress_get_victim_in_court_effect = {
	if = {
		limit = {		
			any_courtier = {
				exists = this
				is_imprisoned = no
			}
		}
		random_courtier = {
			limit = {
				is_imprisoned = no
				exists = root.player_heir
				this = root.player_heir
			}
			alternative_limit = {
				is_imprisoned = no
				is_child_of = root
			}
			alternative_limit = {
				is_imprisoned = no
				is_spouse_of = root
			}
			alternative_limit = {
				is_imprisoned = no
			}

			save_scope_as = victim
		}
	}
}

# Removes an existing personality trait and replace it with a 'negative' personality trait (though could conceivably be used with any personality trait).
# Designed for use in prison or high-stress situations.
stress_replace_personality_trait_with_opposite_effect = {
	if = {
		limit = {
			flag:$TRAIT$ = flag:lustful
			has_trait = chaste
		}
		remove_trait = chaste
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:chaste
			has_trait = lustful
		}
		remove_trait = lustful
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:gluttonous
			has_trait = temperate
		}
		remove_trait = temperate
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:temperate
			has_trait = gluttonous
		}
		remove_trait = gluttonous
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:greedy
			has_trait = generous
		}
		remove_trait = generous
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:generous
			has_trait = greedy
		}
		remove_trait = greedy
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:lazy
			has_trait = diligent
		}
		remove_trait = diligent
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:diligent
			has_trait = lazy
		}
		remove_trait = lazy
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:wrathful
			has_trait = calm
		}
		remove_trait = calm
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:calm
			has_trait = wrathful
		}
		remove_trait = wrathful
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:patient
			has_trait = impatient
		}
		remove_trait = impatient
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:impatient
			has_trait = patient
		}
		remove_trait = patient
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:arrogant
			has_trait = humble
		}
		remove_trait = humble
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:humble
			has_trait = arrogant
		}
		remove_trait = arrogant
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:deceitful
			has_trait = honest
		}
		remove_trait = honest
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:honest
			has_trait = deceitful
		}
		remove_trait = deceitful
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:craven
			has_trait = brave
		}
		remove_trait = brave
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:brave
			has_trait = craven
		}
		remove_trait = craven
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:shy
			has_trait = gregarious
		}
		remove_trait = gregarious
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:gregarious
			has_trait = shy
		}
		remove_trait = shy
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:ambitious
			has_trait = content
		}
		remove_trait = content
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:content
			has_trait = ambitious
		}
		remove_trait = ambitious
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:arbitrary
			has_trait = just
		}
		remove_trait = just
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:just
			has_trait = arbitrary
		}
		remove_trait = arbitrary
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:cynical
			has_trait = zealous
		}
		remove_trait = zealous
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:zealous
			has_trait = cynical
		}
		remove_trait = cynical
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:paranoid
			has_trait = trusting
		}
		remove_trait = trusting
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:trusting
			has_trait = paranoid
		}
		remove_trait = paranoid
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:compassionate
			OR = {
				has_trait = callous
				has_trait = sadistic
			}	
		}
		remove_trait = callous
		remove_trait = sadistic
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:callous
			has_trait = compassionate
		}
		remove_trait = compassionate
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:sadistic
			has_trait = compassionate
		}
		remove_trait = compassionate
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:stubborn
			has_trait = fickle
		}
		remove_trait = fickle
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:fickle
			has_trait = stubborn
		}
		remove_trait = stubborn
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:vengeful
			has_trait = forgiving
		}
		remove_trait = forgiving
	}
	else_if = {
		limit = {
			flag:$TRAIT$ = flag:forgiving
			has_trait = vengeful
		}
		remove_trait = vengeful
	}
	else = {
		if = {
			limit = {
				is_imprisoned = yes
			}
			stress_prison_remove_ordered_personality_trait_effect = yes
		}
		else = {
			stress_unimprisoned_remove_ordered_personality_trait_effect = yes
		}
	}
	add_trait_force_tooltip = $TRAIT$
}

# Removes one personality trait from a character, ordered based on what makes more sense for a character to lose while in prison.
stress_prison_remove_ordered_personality_trait_effect = {
	if = {
		limit = { has_trait = forgiving }
		remove_trait = forgiving
	}
	else_if = {
		limit = { has_trait = trusting }
		remove_trait = trusting
	}
	else_if = {
		limit = { has_trait = lustful }
		remove_trait = lustful
	}
	else_if = {
		limit = { has_trait = arrogant }
		remove_trait = arrogant
	}
	else_if = {
		limit = { has_trait = gregarious }
		remove_trait = gregarious
	}
	else_if = {
		limit = { has_trait = ambitious }
		remove_trait = ambitious
	}
	else_if = {
		limit = { has_trait = impatient }
		remove_trait = impatient
	}
	else_if = {
		limit = { has_trait = diligent }
		remove_trait = diligent
	}
	else_if = {
		limit = { has_trait = temperate }
		remove_trait = temperate
	}
	else_if = {
		limit = { has_trait = generous }
		remove_trait = generous
	}
	else_if = {
		limit = { has_trait = compassionate }
		remove_trait = compassionate
	}
	else_if = {
		limit = { has_trait = zealous }
		remove_trait = zealous
	}
	else_if = {
		limit = { has_trait = brave }
		remove_trait = brave
	}
	else_if = {
		limit = { has_trait = calm }
		remove_trait = calm
	}
	else_if = {
		limit = { has_trait = just }
		remove_trait = just
	}
	else_if = {
		limit = { has_trait = fickle }
		remove_trait = fickle
	}
	else_if = {
		limit = { has_trait = stubborn }
		remove_trait = stubborn
	}
	else_if = {
		limit = { has_trait = content }
		remove_trait = content
	}
	else_if = {
		limit = { has_trait = honest }
		remove_trait = honest
	}
	else_if = {
		limit = { has_trait = gluttonous }
		remove_trait = gluttonous
	}
	else_if = {
		limit = { has_trait = chaste }
		remove_trait = chaste
	}
	else_if = {
		limit = { has_trait = greedy }
		remove_trait = greedy
	}
	else_if = {
		limit = { has_trait = deceitful }
		remove_trait = deceitful
	}
	else_if = {
		limit = { has_trait = cynical }
		remove_trait = cynical
	}
	else_if = {
		limit = { has_trait = shy }
		remove_trait = shy
	}
	else_if = {
		limit = { has_trait = lazy }
		remove_trait = lazy
	}
	else_if = {
		limit = { has_trait = patient }
		remove_trait = patient
	}
	else_if = {
		limit = { has_trait = arbitrary }
		remove_trait = arbitrary
	}
	else_if = {
		limit = { has_trait = humble }
		remove_trait = humble
	}
	else_if = {
		limit = { has_trait = wrathful }
		remove_trait = wrathful
	}
	else_if = {
		limit = { has_trait = sadistic }
		remove_trait = sadistic
	}
	else_if = {
		limit = { has_trait = callous }
		remove_trait = callous
	}
	else_if = {
		limit = { has_trait = vengeful }
		remove_trait = vengeful
	}
	else_if = {
		limit = { has_trait = paranoid }
		remove_trait = paranoid
	}
	else_if = {
		limit = { has_trait = craven }
		remove_trait = craven
	}
}

# Removes one personality trait from a character, ordered based on what makes more sense for a character to lose while not in prison.
stress_unimprisoned_remove_ordered_personality_trait_effect = {
	if = {
		limit = { has_trait = ambitious }
		remove_trait = ambitious
	}
	else_if = {
		limit = { has_trait = just }
		remove_trait = just
	}
	else_if = {
		limit = { has_trait = brave }
		remove_trait = brave
	}
	else_if = {
		limit = { has_trait = diligent }
		remove_trait = diligent
	}
	else_if = {
		limit = { has_trait = gregarious }
		remove_trait = gregarious
	}
	else_if = {
		limit = { has_trait = zealous }
		remove_trait = zealous
	}
	else_if = {
		limit = { has_trait = calm }
		remove_trait = calm
	}
	else_if = {
		limit = { has_trait = temperate }
		remove_trait = temperate
	}
	else_if = {
		limit = { has_trait = generous }
		remove_trait = generous
	}
	else_if = {
		limit = { has_trait = compassionate }
		remove_trait = compassionate
	}
	else_if = {
		limit = { has_trait = forgiving }
		remove_trait = forgiving
	}
	else_if = {
		limit = { has_trait = honest }
		remove_trait = honest
	}
	else_if = {
		limit = { has_trait = content }
		remove_trait = content
	}
	else_if = {
		limit = { has_trait = patient }
		remove_trait = patient
	}
	else_if = {
		limit = { has_trait = trusting }
		remove_trait = trusting
	}
	else_if = {
		limit = { has_trait = arrogant }
		remove_trait = arrogant
	}
	else_if = {
		limit = { has_trait = impatient }
		remove_trait = impatient
	}
	else_if = {
		limit = { has_trait = stubborn }
		remove_trait = stubborn
	}
	else_if = {
		limit = { has_trait = fickle }
		remove_trait = fickle
	}
	else_if = {
		limit = { has_trait = lustful }
		remove_trait = lustful
	}
	else_if = {
		limit = { has_trait = gluttonous }
		remove_trait = gluttonous
	}
	else_if = {
		limit = { has_trait = greedy }
		remove_trait = greedy
	}
	else_if = {
		limit = { has_trait = chaste }
		remove_trait = chaste
	}
	else_if = {
		limit = { has_trait = shy }
		remove_trait = shy
	}
	else_if = {
		limit = { has_trait = deceitful }
		remove_trait = deceitful
	}
	else_if = {
		limit = { has_trait = cynical }
		remove_trait = cynical
	}
	else_if = {
		limit = { has_trait = lazy }
		remove_trait = lazy
	}
	else_if = {
		limit = { has_trait = humble }
		remove_trait = humble
	}
	else_if = {
		limit = { has_trait = wrathful }
		remove_trait = wrathful
	}
	else_if = {
		limit = { has_trait = callous }
		remove_trait = callous
	}
	else_if = {
		limit = { has_trait = vengeful }
		remove_trait = vengeful
	}
	else_if = {
		limit = { has_trait = sadistic }
		remove_trait = sadistic
	}
	else_if = {
		limit = { has_trait = arbitrary }
		remove_trait = arbitrary
	}
	else_if = {
		limit = { has_trait = paranoid }
		remove_trait = paranoid
	}
	else_if = {
		limit = { has_trait = craven }
		remove_trait = craven
	}
}

stress_save_deceased_character_for_mental_break = {
	if = {
		limit = {
			always = no
		}
	}
	else = {
		set_variable = {
			name = mental_break_deceased_character
			value = $TARGET$
			days = 14
		}
		set_variable = {
			name = mental_break_deceased_character_relation
			value = flag:$FLAG$
			days = 14
		}
	}
}