﻿#Events fired by the Lover relation

namespace = lover

# Oops, your actions had consequences! (Pilgrimage Brothel follow-up)
# by Bianca Savazzi
lover.8102 = {
	type = character_event
	id_override_priority = 100
	theme = lover_relation
	title = lover.8102.t
	desc = { 
		desc = lover.8102.desc
		random_valid = {
			desc = lover.8102.desc.puppy_love
			triggered_desc = {
				trigger = {
					scope:brothel_worker = { is_male = yes }
					is_female = yes
				}
				desc = lover.8102.desc.you_pregnant
			}
			triggered_desc = {
				trigger = {
					scope:brothel_worker = { is_female = yes }
					is_male = yes
				}
				desc = lover.8102.desc.they_pregnant
			}
		}
		desc = lover.8102.desc.ending	
	}
	cooldown = { years = 20 }

	left_portrait = {
		character = scope:brothel_worker
		animation = worry
	}

	trigger = {
		fertility > 0
		scope:brothel_worker.fertility > 0
		# Can clash with the peasant affair story
		NOT = {
			any_owned_story = {
				type = story_peasant_affair
			}
		}
	}

	immediate = {
		remove_character_flag = brothel_worker_returns
		move_pool_lover_to_root_location = { TARGET = scope:brothel_worker }
		if = {
			limit = {
				is_male = yes
				scope:brothel_worker = {
					is_female = yes
					is_pregnant = no
				}
			}
			scope:brothel_worker = {
				random_list = {
					#Actually pregnant
					50 = {
						modifier = {
							add = 25
							fertility >= high_fertility
						}
						scope:brothel_worker = {
							make_pregnant = {
								father = root
							}
							# added to make sure the pregnancy can actually take effect, if it occurs
							event_pregnancy_effect = yes
						}
					}
					#Not pregnant
					50 = {
						modifier = {
							add = 25
							fertility <= low_fertility
						}
						#nothing
					}	
				}
			}
		}
		if = {
			limit = {
				is_female = yes
				is_pregnant = no
				scope:brothel_worker = {
					is_male = yes
				}
			}
			random_list = {
				#Actually pregnant
				50 = {
					modifier = {
						add = 25
						fertility >= high_fertility
					}
					make_pregnant = {
						father = scope:brothel_worker 
					}
					# added to make sure the pregnancy can actually take effect, if it occurs
					event_pregnancy_effect = yes
				}
				#Not pregnant
				50 = {
					modifier = {
						add = 25
						fertility <= low_fertility
					}
					#nothing	
				}	
			}
		}	
	}

	#Option A: Take full responsibility
	option = {
		name = lover.8102.a
		hidden_effect = {
			set_relation_lover = { reason = lover_pilgrimage_brothel target = scope:brothel_worker province = scope:brothel_location }
		}
		expose_lover_secret_or_run_consequence_effect = {
			TARGET = scope:brothel_worker
			EXPOSER = root
		}
		if = {
			limit = {
				OR = {
					exists = current_travel_plan
					exists = involved_activity
				}
			}
			add_to_entourage_court_and_activity_effect = { 
				CHAR_TO_ADD = scope:brothel_worker 
				NEW_COURT_OWNER = root 
			}
		}
		else = {
			add_courtier = scope:brothel_worker
		}
		stress_and_fulfillment_impact = {
			eccentric = minor_stress_impact_loss
			deceitful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_compassion = 2
				ai_honor = 0.5
				ai_greed = -2
				ai_rationality = -0.5
			}
		}
	}

	#Option B: Silence them
	option = {
		name = lover.8102.b


		unknown_murder_effect = { VICTIM = scope:brothel_worker MURDERER = root REASON = death_murder }
		stress_and_fulfillment_impact = {
			generous = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_compassion = -2
				ai_vengefulness = 2
			}
		}
	}

	#Option C: Threaten
	option = {
		name = lover.8102.c
		
		duel = {
			skill = intrigue
			target = scope:brothel_worker
			desc = outcome_in_a_few_days

			60 = {
				desc = lover.8102.c.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				send_interface_toast = {
					title = lover.8102.c.success
					left_icon = scope:brothel_worker
					add_dread = miniscule_dread_gain
				}
			}
			40 = {
				desc = lover.8102.c.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2
				}
				send_interface_toast = {
					title = lover.8102.c.failure
					left_icon = scope:brothel_worker
					remove_short_term_gold = minor_gold_value
				}
			}
			10 = {
				desc = lover.8102.c.crit_failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2
				}
				send_interface_toast = {
					title = lover.8102.c.crit_failure
					left_icon = scope:brothel_worker
					expose_lover_secret_or_run_consequence_effect = {
						TARGET = scope:brothel_worker
						EXPOSER = root
					}
				}
			}
		}
		stress_and_fulfillment_impact = {
			compassionate = minor_stress_impact_gain
			generous = minor_stress_impact_gain
			just = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_compassion = -0.5
				ai_honor = -0.5
				ai_vengefulness = 1
			}
		}
	}

	#Option D: Come with me but keep it a secret
	option = {
		name = lover.8102.d
		hidden_effect = {
			set_relation_lover = { reason = lover_pilgrimage_brothel target = scope:brothel_worker province = scope:brothel_location }
		}
		if = {
			limit = {
				OR = {
					exists = current_travel_plan
					exists = involved_activity
				}
			}
			add_to_entourage_court_and_activity_effect = { 
				CHAR_TO_ADD = scope:brothel_worker 
				NEW_COURT_OWNER = root 
			}
		}
		else = {
			add_courtier = scope:brothel_worker
		}
		stress_and_fulfillment_impact = {
			paranoid = medium_stress_impact_gain
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_honor = -0.5
				ai_rationality = 0.5
			}
		}
	}
}
