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

diplomacy_lifestyle_progress_pulse = { # Fires 4 times per year
	trigger = {
		OR = {
			is_ai = no
			is_adult = yes
			has_lifestyle = diplomacy_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
			has_character_flag = had_recent_lifestyle_ongoing_event_diplomacy
			# Must not currently be in a diplomacy event chain.
			has_character_flag = is_in_diplomacy_foreign_special_event
			has_character_flag = is_in_diplomacy_family_special_event
			has_character_flag = is_in_diplomacy_majesty_special_event
		}
	}

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

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

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

		80 = diplomacy_lifestyle_common_events
		15 = diplomacy_lifestyle_uncommon_events
		 5 = diplomacy_lifestyle_rare_events		
	}
}

# Characters get a Common event roughly once every 24 months (2 years). Most lifestyle events should be Common events.
diplomacy_lifestyle_common_events = {
	random_events = {
		# Generic Events:
		100 = diplomacy_generic.0012 #Master suppression techniques

	 	# Foreign Affairs Events
		100 = diplomacy_foreign.1074 # Religious Refugees
	 	100 = diplomacy_foreign.3001 # Pen Pals
	 	100 = diplomacy_foreign.1100 # Meeting of neighboring heirs
	 	100 = diplomacy_foreign.1150 # Rulers tidying borders
	 	100 = diplomacy_foreign.1200 # Finding Diplomacy Friend

		# Family Events
		100 = diplomacy_family.0007 # Recruit votes for your heir of choice
		50 = diplomacy_family.0008  # Heir has disagreeable traits, coaching
		100 = diplomacy_family.2100 # Family fight
		100 = diplomacy_family.2200 # Picking Best Friend from list
		100 = diplomacy_family.2250 # Jealous relative reacting to lover's spouse
		100 = diplomacy_family.2300 # Problematic Dynasty Member

		# Majesty Events
		100 = diplomacy_majesty.0004 # Power of Words - Compliment someone to improve relations with them.
		100 = diplomacy_majesty.0016 # Kindred Spirits - Notice a potential friend; how do you react?
		100 = diplomacy_majesty.1020 # Loyal Subjects - Figure out how to inspirte loyalty in your vassals.
		100 = diplomacy_majesty.4030 # A Battle of Ideas - Develop tactics for use in conversations.
		100 = diplomacy_majesty.4070 # Lure of Language	- Learn a foreign language prevalent in your realm
		100 = diplomacy_majesty.4090 # Trappings of Royalty - How shall you dress your royal personage?
		50 = diplomacy_majesty_special.1010 # A Tedious Disagreement
	}
}

# Characters get an Uncommon event roughly once every 120 months (10 years). Longer event chains and lucrative opporunities should be Uncommon events.
diplomacy_lifestyle_uncommon_events = {
	random_events = {
		100 = diplomacy_foreign_special.1017 # Court visit
	}
	fallback = diplomacy_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.
diplomacy_lifestyle_rare_events = {
	random_events = {
		100 = diplomacy_family_special.2200 #Heir-vassal personality conflict
		50 = lifestyle_nicknames.0003 #Stewardship nickname for when the character is arrogant
		50 = lifestyle_nicknames.0004 #Stewardship nickname when the character is humble
	}
	fallback = diplomacy_lifestyle_uncommon_events
}

# Special event pool for unavailable characters (imprisoned, commanding an army, infirm, etc.)
diplomacy_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

 		50 = diplomacy_majesty.4030 # A Battle of Ideas - Develop tactics for use in conversations.
 		50 = 0 # Above event only has a 50% chance of firing during war.
	}
}


###########################################
# Custom actions for special event chains #
###########################################

diplomacy_foreign_special_1010_court_visit_events = {
	events = {
		diplomacy_foreign_special.1030 #Event for success (they had a good time - might give additional bonuses)
		diplomacy_foreign_special.1031 #Event for failure (they go home because unhappy)
		
	}
	random_events = {
		100 = diplomacy_foreign_special.1022 #Hunt or luncheon
		100 = diplomacy_foreign_special.1021 #Dance or church
		100 = diplomacy_foreign_special.1020 #Private dinner with relative/spouse/consort
		100 = diplomacy_foreign_special.1028 #Compliment
	}
}

diplomacy_foreign_special_1010_court_visit_interesting_relation_spy_outcome_events = {
	events = {
		diplomacy_foreign_special.1023 #Nothing special happened
		diplomacy_foreign_special.1024 #They seem friendly
		diplomacy_foreign_special.1025 #They seem to be plotting
		diplomacy_foreign_special.1026 #They seem about to sleep together
	}
}



###################################
# Commission Epic Event Selection
###################################
commission_epic_ongoing = {
	random_events = {
		100 = commission_epic.1001 # A Question of Time
		100 = commission_epic.1002 # Rich Source Material
		100 = commission_epic.1003 # Writer's Retreat
		100 = commission_epic.1004 # Expert Illuminator
		100 = commission_epic.1005 # The Song of Our People
		80 = commission_epic.1006 # Friends From Legends (Become friends with a Vassal)
		50 = commission_epic.1007 # Epic Emnity (Become rivals with a Vassal)
		100 = commission_epic.2001 # Precedence (Steward)
		100 = commission_epic.2002 # Pride of the Family (Spymaster)
		100 = commission_epic.2003 # Eternal Obligations (Court Chaplain, Theocratic)
		100 = commission_epic.2004 # Inspiration Strikes (Marshal)
		100 = commission_epic.2005 # Honesty and Perception (Chancellor)
		100 = commission_epic.2006 # Bound in Faith (Court Chaplain, Lay Clergy)
	}
}