﻿######################################
# Standard actions for random events #
######################################

intrigue_lifestyle_progress_pulse = { # Fires 4 times per year
	trigger = {
		OR = {
			is_ai = no
			is_adult = yes
			has_lifestyle = intrigue_lifestyle
		}
		is_landed = yes # Lifestyle events inherently assume you have one. Non-landed rulers shouldn't get lifestyle events, even if they still have a lifestyle.
		exists = capital_province # Because in rare situations landed AI rulers can end up without a capital.
		trigger_if = {
			limit = {
				is_ai = no
			}
			has_had_focus_for_days > 30
		}
		NOR = {
			has_character_flag = had_recent_lifestyle_ongoing_event
			# Must not currently be in a intrigue event chain.
			has_character_flag = is_in_intrigue_special_event
		}
	}

	first_valid_on_action = {
		intrigue_lifestyle_ongoing_events # General event pool
		intrigue_lifestyle_unavailable_events # Special event pool for unavailable characters (imprisoned, commanding an army, infirm, etc.)
	}
}

#Ongoing events and story cycles
intrigue_lifestyle_ongoing_events = {
	trigger = {
		is_available = yes
	}

	random_on_action = {
		chance_to_happen = 10 # Roughly one event every 18 months

		80 = intrigue_lifestyle_common_events
		15 = intrigue_lifestyle_uncommon_events
		5 = intrigue_lifestyle_rare_events		
	}
}

# Characters get a Common event roughly once every 24 months (2 years). Most lifestyle events should be Common events.
intrigue_lifestyle_common_events = {
	random_events = {
		# Skulduggery
		100 = intrigue_scheming.1001 #Act without your council for the sake of a county
		100 = intrigue_scheming.1011 #Invent code
		100 = intrigue_scheming.1201 #Hired spies report your castle's weaknesses
		100 = intrigue_scheming.1401 #Meet a merchant from a far away land
		100 = intrigue_scheming.2001 #Gain intrigue mentor
		100 = intrigue_scheming.2101 #Sneaky person seeks you out (might be an agent)
		100 = intrigue_scheming.3001 #Convert a Hook on a Courtier into a Hook on their Court Owner
		100 = intrigue_scheming.3041 #Convert a Hook on ruler's vassal into a Hook on the ruler
		100 = intrigue_scheming.3061 #An opportunity to turn an enemy's Heir into a Bastard
		200 = intrigue_scheming.4021 #Interrogate a prisoner to learn what secrets they know.
		100 = intrigue_scheming.4040 #Make your courtiers hate each other so they scheme and plot against someone else.
		100 = intrigue_scheming.1601 #Turn a Secret into a Hook, or otherwise
		100 = intrigue_scheming.4050 #Sell a major secret you know about somebody to the close family of the owner and/or target.

		# Intimidation
		100 = intrigue_dread.1801 #Poison tasting
		100 = intrigue_dread.1901 #Mess with a courtier you don't like

		# Temptation
		200 = intrigue_temptation.2201 #Gain secrets from a lover in another court.
		100 = intrigue_temptation.3000 #A visiting guest would like a tumble before leaving
		100 = intrigue_temptation.3100 #A courtier propositions you via a lewd image.
		100 = intrigue_temptation.3110 #While drinking with a courtier, you lead them towards deviancy.
		100 = intrigue_temptation.3120 #You enjoy a dinner with one of your guests, and try to tempt them into staying.
		100 = intrigue_temptation.3010 #Wingman/woman
		100 = intrigue_temptation.3020 #Medieval tinder
		100 = intrigue_temptation.3130 #Cuckolding a potential rival.
		100 = intrigue_temptation.3140 #Flirt openly with people at court.
		100 = intrigue_temptation.3150 #Caught chatting up a courtier.
		100 = intrigue_temptation.3160 #Sleep with someone who dislikes you for fun or profit.
	}
}

# Characters get an Uncommon event roughly once every 120 months (10 years). Longer event chains and lucrative opporunities should be Uncommon events.
intrigue_lifestyle_uncommon_events = {
	random_events = {
		100 = intrigue_scheming_special.1001 #Convince Courtier to Share Spy-Secrets
		100 = intrigue_scheming_special.1301 #Root out secrets at your court
		100 = intrigue_dread_special.1301 #Root out secrets at your court
		100 = intrigue_temptation_special.1000 #Matchmaking
		100 = intrigue_dread.4100 # Bothersome petitioners
	}
	fallback = intrigue_lifestyle_common_events
}

# Characters get a Rare event roughly once every 360 months (30 years). Character-defining events and easter egg events should be Rare events.
intrigue_lifestyle_rare_events = {
	random_events = {
		100 = intrigue_dread.1501 #Cannibal cook
		100 = intrigue_dread.4001 #Torture & brainwash one of your prisoners to make them into a mind-slave.
		100 = intrigue_dread_special.1101 #Join a touring theater
		50 = lifestyle_nicknames.0007 # Intrigue nickname for someone who's arrogant
		50 = lifestyle_nicknames.0008 # Intrigue nickname when the character is humble
	}
	fallback = intrigue_lifestyle_uncommon_events
}

# Special event pool for unavailable characters (imprisoned, commanding an army, infirm, etc.)
intrigue_lifestyle_unavailable_events = {
	trigger = {
		is_available = no
	}

	random_events = {
 		# WARNING: All events in this pool *MUST* have custom is_available triggers defined.
 		# Otherwise we can wind up with weird things like imprisoned characters having a strategy discussion with their army commanders out on the campaign trail.
 		chance_to_happen = 10
	}
}