﻿namespace = jdb_take_a_bath_events

scripted_effect jdb_take_a_bath_events_generic_effect = {
	add_character_modifier = {
		modifier = jdb_take_a_bath_smells_like_lavender_modifier
		months = 3
	}

	if = {
		limit = {
			has_character_modifier = stress_smelling_of_sweat
		}
		remove_character_modifier = stress_smelling_of_sweat
	}

	if = {
		limit = {
			has_character_modifier = drenched_in_excrement_roco_modifier
		}
		remove_character_modifier = drenched_in_excrement_roco_modifier
	}

	add_stress = medium_stress_loss
}

jdb_take_a_bath_events.0001 = {
	type = character_event
	title = jdb_take_a_bath_events.0001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { is_in_army = yes }
				desc = jdb_take_a_bath_events.0001.in_army_desc
			}
			desc = jdb_take_a_bath_events.0001.desc
		}
	}
	theme = mental_break

	override_background = {
		trigger = {
			OR = {
				location = { is_sea_province = yes }
				location = { terrain = coastal_sea }
			}
		}
		reference = ocean
	}
	override_background = {
		trigger = { is_in_army = yes }
		reference = army_camp
	}
	override_background = {
		trigger = {
			is_travelling = yes
			location = {
				has_holding = no
			}
		}
		reference = terrain
	}
	override_background  = { reference = bath_house }

	left_portrait = {
		trigger = { is_in_army = yes }
		character = root
		animation = personality_bold

		triggered_outfit = {
			outfit_tags = { no_clothes }
		}
	}

	right_portrait = {
		trigger = { is_in_army = no }
		character = root
		animation = personality_honorable

		triggered_outfit = {
			outfit_tags = { no_clothes }
		}
	}

	trigger = {
		is_physically_able = yes
	}

	immediate = {
		jdb_take_a_bath_events_generic_effect = yes
	}

	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { is_in_army = yes  }
						desc = jdb_take_a_bath_events.0001.in_army.a
					}
					desc = jdb_take_a_bath_events.0001.a
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
}

jdb_take_a_bath_events.0002 = {
	type = character_event
	title = jdb_take_a_bath_events.0002.t
	desc = jdb_take_a_bath_events.0002.desc
	theme = mental_break

	override_background = {
		trigger = {
			location = { is_sea_province = yes }
		}
		reference = ocean
	}
	override_background = {
		trigger = { is_in_army = yes }
		reference = army_camp
	}
	override_background = {
		trigger = {
			is_travelling = yes
			location = {
				has_holding = no
			}
		}
		reference = terrain
	}
	override_background  = { reference = bath_house }

	left_portrait = {
		character = scope:random_person
		animation = personality_bold

		triggered_outfit = {
			outfit_tags = { no_clothes }
		}
	}

	right_portrait = {
		character = root
		animation = personality_rational

		triggered_outfit = {
			outfit_tags = { no_clothes }
		}
	}

	trigger = {
		is_adult = yes
		is_physically_able = yes
		any_courtier_or_guest = {
			is_physically_able_ai_adult = yes
			location = root.location
		}
	}

	immediate = {
		jdb_take_a_bath_events_generic_effect = yes

		random_courtier_or_guest = {
			limit = {
				is_physically_able_ai_adult = yes
				location = root.location
			}
			save_scope_as = random_person
		}
	}

	option = { # share your soap
		name = jdb_take_a_bath_events.0002.a
		custom_tooltip = jdb_take_a_bath_events.0002.a.tt

		remove_short_term_gold = 5

		custom_tooltip = {
			text = jdb_take_a_bath_events.0002.shared_scents_to_someone_effect.tt
			scope:random_person = {
				jdb_take_a_bath_events_generic_effect = yes
			}
		}

		scope:random_person = {
			progress_towards_friend_effect = {
				CHARACTER = root
				REASON = friend_gift
				OPINION = 10
			}
		}
		
		stress_impact = {
			gregarious = miniscule_stress_impact_loss
			generous = miniscule_stress_impact_loss
			shy = miniscule_stress_impact_gain
			greedy = miniscule_stress_impact_gain
		}

		ai_chance = {
			base = 50
		}
	}

	option = { # scrub my back
		name = jdb_take_a_bath_events.0002.b
		custom_tooltip = jdb_take_a_bath_events.0002.b.tt

		add_stress = medium_stress_loss

		hidden_effect = {
			random_list = {
				20 = {
					modifier = {
						add = 30
						scope:random_person = {
							has_relation_friend = root
						}
					}
					modifier = {
						add = 40
						scope:random_person = {
							has_relation_best_friend = root
						}
					}
					modifier = {
						add = 40
						scope:random_person = {
							OR = {
								has_relation_lover = root
								has_relation_soulmate = root
							}
						}
					}
					modifier = {
						add = 80
						scope:random_person = {
							OR = {
								has_trait = lustful
								has_trait = rakish
								has_trait = deviant
								any_secret = {
									secret_type = secret_deviant
								}
							}
							is_attracted_to_gender_of = root
						}
					}
					modifier = {
						add = attraction
						scope:random_person = {
							is_attracted_to_gender_of = root
						}
					}
					send_interface_toast = {
						title = jdb_take_a_bath_events.0002.scrub_back_liked_it_toaster
						left_icon = scope:random_person

						scope:random_person = {
							add_stress = -20
						}
					}
				}
				50 = {
					modifier = {
						add = 100
						scope:random_person = {
							OR = {
								has_relation_rival = root
								has_relation_nemesis = root
							}		
						}
					}	
					modifier = {
						add = 40
						scope:random_person = {
							OR = {
								has_trait = arrogant
								has_trait = callous
								has_trait = stubborn
								has_trait = paranoid
							}
						}
					}
					send_interface_toast = {
						title = jdb_take_a_bath_events.0002.scrub_back_got_stressed_toaster
						left_icon = scope:random_person

						scope:random_person = {
							add_opinion = {
								modifier = annoyed_opinion
								target = root
								opinion = -20
							}
						}
						scope:random_person = {
							add_stress = 20
						}
					}
				}
			}
		}

		stress_impact = {
			arrogant = miniscule_stress_impact_loss
			compassionate = miniscule_stress_impact_gain
			shy = miniscule_stress_impact_gain
		}

		ai_chance = {
			base = 50
		}
	}

	option = { # nod
		name = jdb_take_a_bath_events.0002.c

		stress_impact = {
			gregarious = miniscule_stress_impact_gain
			shy = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 50
		}
	}
}
