namespace = ep2_accolade_events

############################
## Accolade Events
## 0200-999
## by Jason Cantalini
############################

# ep2_accolade_events.0100 - Hunter gives you and/or your heir the hunter trait
# ep2_accolade_events.0200 - Blademaster gives you and/or your heir the Blademaster trait
# ep2_accolade_events.0300 - Master of Revels gives you and/or your heir the Reveler trait

scripted_trigger ep2_accolade_events_0100_hunting_knight_trigger = {
	accolade ?= {
		is_accolade_active = yes
		has_accolade_parameter = acclaimed_knight_trains_hunting
	}
	is_healthy = yes
	is_imprisoned = no
	OR = {
		AND = {
			is_available = yes
			root = { is_available = yes }
		}
		AND = {
			is_available = yes
			root.primary_heir ?= { is_available = yes }
		}
		location = root.location
		root.primary_heir.location ?= location
	}
}

# Huntsmaster shares the Hunter trait with your line
ep2_accolade_events.0100 = {
	type = character_event
	title = ep2_accolade_events.0100.t
	desc = {
		desc = ep2_accolade_events.0100.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:new_hunter = {
						this = root
					}
					scope:new_hunter_2 = {
						this = root.primary_heir
					}
				}
				desc = ep2_accolade_events.0100.desc.both
			}
			triggered_desc = {
				trigger = {
					scope:new_hunter = {
						this = root.primary_heir
					}
				}
				desc = ep2_accolade_events.0100.desc.heir
			}
			triggered_desc = {
				trigger = {
					scope:new_hunter = {
						this = root
					}
				}
				desc = ep2_accolade_events.0100.desc.liege
			}
		}
	}
	theme = hunt_activity
	left_portrait = {
		character = scope:new_hunter
		animation = hunting_horn
	}
	right_portrait = {
		character = scope:huntsmaster
		animation = war_over_win
	}
	lower_right_portrait = {
		character = scope:new_hunter_2
	}

	trigger = {
		has_dlc_feature = accolades
		any_active_accolade = {
			accolade_parameter = acclaimed_knight_trains_hunting
		}
		OR = {
			NOT = {
				has_trait = lifestyle_hunter
			}
			AND = {
				primary_heir ?= {
					NOT = {
						has_trait = lifestyle_hunter
					}
				}
			}
		}
		any_knight = {
			ep2_accolade_events_0100_hunting_knight_trigger = yes
		}
		trigger_if = {
			limit = {
				NOT = {
					has_trait = lifestyle_hunter
				}
			}
			OR = {
				is_available = yes
				involved_activity ?= { has_activity_type = activity_hunt }
			}
			is_healthy = yes
			is_imprisoned = no
			age >= 13
		}
		trigger_else = {
			primary_heir ?= {
				NOT = {
					has_trait = lifestyle_hunter
				}
			}
			primary_heir = {
				OR = {
					is_available = yes
					involved_activity ?= { has_activity_type = activity_hunt }
				}
				is_healthy = yes
				is_ai = yes
				is_imprisoned = no
				age >= 13
				is_courtier_of = root
			}
		}
	}

	immediate = {
		random_knight = {
			limit = {
				ep2_accolade_events_0100_hunting_knight_trigger = yes
			}
			save_scope_as = huntsmaster
		}
		if = {
			limit = {
				NOT = {
					has_trait = lifestyle_hunter
				}
				OR = {
					is_available = yes
					involved_activity ?= { has_activity_type = activity_hunt }
				}
				is_healthy = yes
				is_imprisoned = no
				age >= 13
			}
			save_scope_as = new_hunter
		}
		else_if = {
			limit = {
				primary_heir ?= {
					NOT = {
						has_trait = lifestyle_hunter
					}
					OR = {
						is_available = yes
						involved_activity ?= { has_activity_type = activity_hunt }
					}
					is_healthy = yes
					is_ai = yes
					is_imprisoned = no
					age >= 13
				}
			}
			primary_heir = {
				save_scope_as = new_hunter
			}
		}
		if = {
			limit = {
				scope:new_hunter = {
					this = root
				}
				primary_heir ?= {
					NOT = {
						has_trait = lifestyle_hunter
					}
					OR = {
						is_available = yes
						involved_activity ?= { has_activity_type = activity_hunt }
					}
					is_healthy = yes
					is_ai = yes
					is_imprisoned = no
					age >= 13
					is_courtier_of = root
				}
			}
			primary_heir = {
				save_scope_as = new_hunter_2
			}
		}
	}

	option = {
		name = ep2_accolade_events.0100.a
		scope:new_hunter = {
			add_trait = lifestyle_hunter
		}
		if = {
			limit = {
				exists = scope:new_hunter_2
			}
			scope:new_hunter_2 = {
				add_trait = lifestyle_hunter
			}
		}
		if = {
			limit = {
				culture = {
					OR = {
						has_cultural_tradition = tradition_bush_hunting
						has_cultural_tradition = tradition_hunters
						has_cultural_tradition = tradition_sacred_hunts
					}
				}
			}
			stress_impact = {
				base = miniscule_stress_impact_loss
				brave = miniscule_stress_impact_loss
				diligent = miniscule_stress_impact_loss
				lifestyle_hunter = miniscule_stress_impact_loss
			}
		}
		else = {
			stress_impact = {
				lifestyle_hunter = miniscule_stress_impact_loss
			}
		}
		ai_chance = {
			base = 100
		}
	}
}

scripted_trigger ep2_accolade_events_0200_blademaster_knight_trigger = {
	accolade ?= {
		is_accolade_active = yes
		has_accolade_parameter = acclaimed_knight_trains_swordfighting
	}
	is_healthy = yes
	is_imprisoned = no
	OR = {
		AND = {
			is_available = yes
			root = { is_available = yes }
		}
		AND = {
			is_available = yes
			root.primary_heir = { is_available = yes }
		}
		location = root.location
		location = root.primary_heir.location
	}
}

# Blademaster shares the Blademaster trait with your line
ep2_accolade_events.0200 = {
	type = character_event
	title = ep2_accolade_events.0200.t
	desc = {
		desc = ep2_accolade_events.0200.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:new_blademaster = {
						this = root
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
					exists = scope:new_blademaster_2
					scope:new_blademaster_2 = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
				}
				desc = ep2_accolade_events.0200.desc.both_not_martial
			}
			triggered_desc = {
				trigger = {
					scope:new_blademaster = {
						this = root
					}
					exists = scope:new_blademaster_2
					scope:new_blademaster_2 = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
				}
				desc = ep2_accolade_events.0200.desc.heir_not_martial
			}
			triggered_desc = {
				trigger = {
					scope:new_blademaster = {
						this = root
					}
					exists = scope:new_blademaster_2
					scope:new_blademaster_2 = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
				}
				desc = ep2_accolade_events.0200.desc.heir_not_martial
			}
			triggered_desc = {
				trigger = {
					scope:new_blademaster = {
						this = root
					}
					exists = scope:new_blademaster_2
				}
				desc = ep2_accolade_events.0200.desc.both
			}
			triggered_desc = {
				trigger = {
					scope:new_blademaster = {
						this = root.primary_heir
					}
				}
				desc = ep2_accolade_events.0200.desc.heir
			}
			triggered_desc = {
				trigger = {
					scope:new_blademaster = {
						this = root
					}
				}
				desc = ep2_accolade_events.0200.desc.liege
			}
		}
	}
	theme = martial
	override_background = {
		reference = courtyard
	}
	left_portrait = {
		trigger = {
			exists = scope:new_blademaster
		}
		character = scope:new_blademaster
		animation = marshal
	}
	right_portrait = {
		character = scope:acclaimed_blademaster
		animation = throne_room_one_handed_passive_1
	}
	lower_right_portrait = {
		character = scope:new_blademaster_2
	}

	trigger = {
		has_dlc_feature = accolades
		any_active_accolade = {
			accolade_parameter = acclaimed_knight_trains_swordfighting
		}
		OR = {
			NOT = {
				has_trait = lifestyle_blademaster
			}
			AND = {
				primary_heir ?= {
					NOT = {
						has_trait = lifestyle_blademaster
					}
				}
			}
		}
		any_knight = {
			ep2_accolade_events_0200_blademaster_knight_trigger = yes
		}
		trigger_if = {
			limit = {
				NOT = {
					has_trait = lifestyle_blademaster
				}
			}
			OR = {
				is_available = yes
				involved_activity ?= { has_activity_type = activity_tournament }
			}
			is_healthy = yes
			is_imprisoned = no
			age >= 13
			NOT = { has_character_flag = denied_blademaster_training }
		}
		trigger_else = {
			primary_heir ?= {
				NOT = {
					has_trait = lifestyle_blademaster
				}
			}
			OR = {
				primary_heir = {
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				}
				primary_heir = {
					NOT = {
						can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
					}
					NOR = {
						has_trait = craven
						has_trait = lazy
						has_trait = content
					}
				}
			}
			primary_heir = {
				OR = {
					is_available = yes
					involved_activity ?= { has_activity_type = activity_tournament }
				}
				is_healthy = yes
				is_ai = yes
				is_imprisoned = no
				age >= 13
				is_courtier_of = root
				NOT = { has_character_flag = denied_blademaster_training }
			}
		}
	}

	immediate = {
		#save trainer knight
		random_knight = {
			limit = {
				ep2_accolade_events_0200_blademaster_knight_trigger = yes
			}
			save_scope_as = acclaimed_blademaster
		}
		#save non-blademaster liege
		if = {
			limit = {
				NOT = {
					has_trait = lifestyle_blademaster
				}
				OR = {
					is_available = yes
					involved_activity ?= { has_activity_type = activity_tournament }
				}
				is_healthy = yes
				is_imprisoned = no
				age >= 13
				NOT = { has_character_flag = denied_blademaster_training }
			}
			save_scope_as = new_blademaster
		}
		#save non-blademaster heir
		else = {
			primary_heir = {
				save_scope_as = new_blademaster
			}
		}
		#save non-blademaster heir, if liege exists
		if = {
			limit = {
				scope:new_blademaster = {
					this = root
				}
				primary_heir ?= {
					NOT = {
						has_trait = lifestyle_blademaster
					}
					OR = {
						is_available = yes
						involved_activity ?= { has_activity_type = activity_hunt }
					}
					is_healthy = yes
					is_ai = yes
					is_imprisoned = no
					age >= 13
					is_courtier_of = root
					NOT = { has_character_flag = denied_blademaster_training }
				}
			}
			primary_heir = {
				save_scope_as = new_blademaster_2
			}
		}
		scope:new_blademaster = {
			add_character_flag = wear_armor
		}
		scope:acclaimed_blademaster = {
			add_character_flag = wear_armor
		}
		scope:new_blademaster_2 ?= {
			add_character_flag = wear_armor
		}
	}

	# we're going to be blademasters
	option = {
		name = ep2_accolade_events.0200.a
		scope:new_blademaster = {
			add_trait = lifestyle_blademaster
		}
		if = {
			limit = {
				exists = scope:new_blademaster_2
			}
			scope:new_blademaster_2 = {
				add_trait = lifestyle_blademaster
			}
		}
		if = {
			limit = {
				OR = {
					scope:new_blademaster = {
					NOT = {
						can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
					}
				}
					scope:new_blademaster_2 ?= {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
				}
			}
			add_piety = medium_piety_loss
			add_character_modifier = {
				modifier = defied_martial_custom_modifier
				years = 20
			}
		}
		if = {
			limit = {
				OR = {
					scope:new_blademaster = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
						this = root.primary_heir
					}
					scope:new_blademaster_2 ?= {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
						this = root.primary_heir
					}
				}
			}
			reverse_add_opinion = {
				modifier = grateful_opinion
				target = primary_heir
				opinion = 30
			}
		}
		if = {
			limit = {
				culture = {
					OR = {
						has_cultural_tradition = tradition_druzhina
						has_cultural_tradition = tradition_futuwaa
						has_cultural_tradition = tradition_khadga_puja
						has_cultural_tradition = tradition_talent_acquisition
						has_cultural_tradition = tradition_swords_for_hire
						has_cultural_tradition = tradition_warriors_by_merit
						has_cultural_tradition = tradition_only_the_strong
						has_cultural_tradition = tradition_martial_admiration
						has_cultural_tradition = tradition_fp1_trials_by_combat
						has_cultural_tradition = tradition_chanson_de_geste
					}
				}
			}
			stress_impact = {
				base = miniscule_stress_impact_loss
				sadistic = miniscule_stress_impact_loss
				brave = miniscule_stress_impact_loss
				ambitious = miniscule_stress_impact_loss
				wrathful = miniscule_stress_impact_loss
				lifestyle_blademaster = miniscule_stress_impact_loss
			}
		}
		else_if = {
			limit = {
				OR = {
					scope:new_blademaster = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
					scope:new_blademaster_2 ?= {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
				}
			}
			stress_impact = {
				craven = major_stress_impact_gain
				lazy = major_stress_impact_gain
				content = major_stress_impact_gain
				zealous = minor_stress_impact_gain
				humble = minor_stress_impact_gain
				just = minor_stress_impact_gain
				lifestyle_blademaster = miniscule_stress_impact_loss
			}
		}
		else_if = {
			limit = {
				OR = {
					scope:new_blademaster = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
					scope:new_blademaster_2 ?= {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
				}
				culture = {
					OR = {
						has_cultural_tradition = tradition_druzhina
						has_cultural_tradition = tradition_futuwaa
						has_cultural_tradition = tradition_khadga_puja
						has_cultural_tradition = tradition_talent_acquisition
						has_cultural_tradition = tradition_swords_for_hire
						has_cultural_tradition = tradition_warriors_by_merit
						has_cultural_tradition = tradition_only_the_strong
						has_cultural_tradition = tradition_martial_admiration
						has_cultural_tradition = tradition_fp1_trials_by_combat
						has_cultural_tradition = tradition_chanson_de_geste
					}
				}
			}
			stress_impact = {
				base = miniscule_stress_impact_loss
				sadistic = miniscule_stress_impact_loss
				brave = miniscule_stress_impact_loss
				ambitious = miniscule_stress_impact_loss
				wrathful = miniscule_stress_impact_loss
				craven = major_stress_impact_gain
				lazy = major_stress_impact_gain
				content = major_stress_impact_gain
				zealous = minor_stress_impact_gain
				humble = minor_stress_impact_gain
				just = minor_stress_impact_gain
				lifestyle_blademaster = miniscule_stress_impact_loss
			}
		}
		else = {
			stress_impact = {
				lifestyle_blademaster = miniscule_stress_impact_loss
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				add = -75
				OR = {
					scope:new_blademaster = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
					scope:new_blademaster_2 ?= {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
				}
				OR = {
					has_trait = zealous
					has_trait = humble
					has_trait = just
				}
			}
			modifier = {
				add = 100
				OR = {
					scope:new_blademaster = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
					scope:new_blademaster_2 ?= {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
				}
				OR = {
					has_trait = brave
					has_trait = ambitious
					has_trait = arrogant
					has_trait = arbitrary
					has_trait = cynical
				}
			}
			modifier = {
				factor = 0
				OR = {
					scope:new_blademaster = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
					scope:new_blademaster_2 ?= {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
				}
				OR = {
					has_trait = craven
					has_trait = lazy
					has_trait = content
				}
			}
		}
	}

	# better not defy gender norms
	option = {
		trigger = {
			OR = {
				scope:new_blademaster = {
					NOT = {
						can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
					}
				}
				scope:new_blademaster_2 ?= {
					NOT = {
						can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
					}
				}
			}
		}
		name = ep2_accolade_events.0200.b
		flavor = ep2_accolade_events.0200.b.tt
		if = {
			limit = {
				scope:new_blademaster = {
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				}
			}
			scope:new_blademaster = {
				add_trait = lifestyle_blademaster
			}
		}
		else = {
			scope:new_blademaster = {
				add_character_flag = denied_blademaster_training
			}
		}
		if = {
			limit = {
				exists = scope:new_blademaster_2
				scope:new_blademaster_2 = {
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				}
			}
			scope:new_blademaster_2 = {
				add_trait = lifestyle_blademaster
			}
		}
		else = {
			scope:new_blademaster_2 ?= {
				add_character_flag = denied_blademaster_training
			}
		}
		if = {
			limit = {
				OR = {
					scope:new_blademaster = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
						this = root.primary_heir
					}
					scope:new_blademaster_2 ?= {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
						this = root.primary_heir
					}
				}
			}
			reverse_add_opinion = {
				modifier = angry_opinion
				target = primary_heir
				opinion = -30
			}
		}
		if = {
			limit = {
				OR = {
					scope:new_blademaster = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
						this != root.primary_heir
					}
					scope:new_blademaster_2 ?= {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
						this != root.primary_heir
					}
				}
			}
			stress_impact = {
				arrogant = medium_stress_impact_gain
				ambitious = medium_stress_impact_gain
				brave = medium_stress_impact_gain
				cynical = medium_stress_impact_gain
				arbitrary = medium_stress_impact_gain
			}
		}
		else_if = {
			limit = {
				OR = {
					scope:new_blademaster = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
						this = root.primary_heir
					}
					scope:new_blademaster_2 ?= {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
						this = root.primary_heir
					}
				}
			}
			stress_impact = {
				compassionate = major_stress_impact_gain
				arrogant = medium_stress_impact_gain
				ambitious = medium_stress_impact_gain
				brave = medium_stress_impact_gain
				cynical = medium_stress_impact_gain
				arbitrary = medium_stress_impact_gain
			}
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 100
				OR = {
					scope:new_blademaster = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
					scope:new_blademaster_2 ?= {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
				}
			}
			modifier = {
				add = -75
				OR = {
					scope:new_blademaster = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
					scope:new_blademaster_2 ?= {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
				}
				OR = {
					has_trait = arrogant
					has_trait = ambitious
					has_trait = brave
					has_trait = cynical
					has_trait = arbitrary
				}
			}
			modifier = {
				add = 100
				OR = {
					scope:new_blademaster = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
					scope:new_blademaster_2 ?= {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
					}
				}
				OR = {
					has_trait = humble
					has_trait = content
					has_trait = craven
					has_trait = zealous
					has_trait = just
					has_trait = lazy
				}
			}
			modifier = {
				factor = 0
				OR = {
					scope:new_blademaster = {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
						this = root.primary_heir
					}
					scope:new_blademaster_2 ?= {
						NOT = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
						}
						this = root.primary_heir
					}
				}
				has_trait = compassionate
			}
		}
	}
	after = {
		scope:acclaimed_blademaster = {
			remove_character_flag = wear_armor
		}
		scope:new_blademaster = {
			remove_character_flag = wear_armor
		}
	}
}

scripted_trigger ep2_accolade_events_0300_reveler_knight_trigger = {
	accolade ?= {
		is_accolade_active = yes
		has_accolade_parameter = acclaimed_knight_trains_reveling
	}
	is_healthy = yes
	is_imprisoned = no
	OR = {
		AND = {
			is_available = yes
			root = { is_available = yes }
		}
		AND = {
			is_available = yes
			root.primary_heir = { is_available = yes }
		}
		location = root.location
		location = root.primary_heir.location
	}
}

# master_of_revels shares the reveler trait with your line
ep2_accolade_events.0300 = {
	type = character_event
	title = ep2_accolade_events.0300.t
	desc = {
		desc = ep2_accolade_events.0300.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:new_reveler = {
						this = root
					}
					scope:new_reveler_2 = {
						this = root.primary_heir
					}
				}
				desc = ep2_accolade_events.0300.desc.both
			}
			triggered_desc = {
				trigger = {
					scope:new_reveler = {
						this = root.primary_heir
					}
				}
				desc = ep2_accolade_events.0300.desc.heir
			}
			triggered_desc = {
				trigger = {
					scope:new_reveler = {
						this = root
					}
				}
				desc = ep2_accolade_events.0300.desc.liege
			}
		}
	}
	theme = feast_activity
	left_portrait = {
		character = scope:new_reveler
		animation = laugh
	}
	right_portrait = {
		character = scope:master_of_revels
		animation = toast_goblet
	}
	lower_right_portrait = {
		character = scope:new_reveler_2
	}

	trigger = {
		has_dlc_feature = accolades
		any_active_accolade = {
			accolade_parameter = acclaimed_knight_trains_reveling
		}
		OR = {
			NOR = {
				has_trait = lifestyle_reveler
				has_trait = temperate
				has_trait = shy
			}
			AND = {
				primary_heir ?= {
					NOR = {
						has_trait = lifestyle_reveler
						has_trait = temperate
						has_trait = shy
					}
				}
			}
		}
		any_knight = {
			ep2_accolade_events_0300_reveler_knight_trigger = yes
		}
		trigger_if = {
			limit = {
				NOT = {
					has_trait = lifestyle_reveler
				}
			}
			OR = {
				is_available = yes
				involved_activity ?= { has_activity_type = activity_feast }
				involved_activity ?= { has_activity_type = activity_wedding }
			}
			is_healthy = yes
			is_imprisoned = no
			age >= 13
		}
		trigger_else = {
			primary_heir ?= {
				NOT = {
					has_trait = lifestyle_reveler
				}
			}
			primary_heir = {
				OR = {
					is_available = yes
					involved_activity ?= { has_activity_type = activity_feast }
					involved_activity ?= { has_activity_type = activity_wedding }
				}
				is_healthy = yes
				is_ai = yes
				is_imprisoned = no
				age >= 13
				is_courtier_of = root
			}
		}
	}

	immediate = {
		random_knight = {
			limit = {
				ep2_accolade_events_0300_reveler_knight_trigger = yes
			}
			save_scope_as = master_of_revels
		}
		if = {
			limit = {
				NOR = {
					has_trait = lifestyle_reveler
					has_trait = temperate
					has_trait = shy
				}
				OR = {
					is_available = yes
					involved_activity ?= { has_activity_type = activity_feast }
					involved_activity ?= { has_activity_type = activity_wedding }
				}
				is_healthy = yes
				is_imprisoned = no
				age >= 13
			}
			save_scope_as = new_reveler
		}
		else_if = {
			limit = {
				primary_heir ?= {
					NOR = {
						has_trait = lifestyle_reveler
						has_trait = temperate
						has_trait = shy
					}
					OR = {
						is_available = yes
						involved_activity ?= { has_activity_type = activity_feast }
						involved_activity ?= { has_activity_type = activity_wedding }
					}
					is_healthy = yes
					is_ai = yes
					is_imprisoned = no
					age >= 13
					is_courtier_of = root
				}
			}
			primary_heir = {
				save_scope_as = new_reveler
			}
		}
		if = {
			limit = {
				scope:new_reveler ?= {
					this = root
				}
				primary_heir ?= {
					NOT = {
						has_trait = lifestyle_reveler
						has_trait = temperate
						has_trait = shy
					}
					OR = {
						is_available = yes
						involved_activity ?= { has_activity_type = activity_feast }
						involved_activity ?= { has_activity_type = activity_wedding }
					}
					is_healthy = yes
					is_ai = yes
					is_imprisoned = no
					age >= 13
					is_courtier_of = root
				}
			}
			primary_heir = {
				save_scope_as = new_reveler_2
			}
		}
	}

	option = {
		name = ep2_accolade_events.0300.a
		scope:new_reveler ?= {
			add_trait = lifestyle_reveler
		}
		if = {
			limit = {
				exists = scope:new_reveler_2
			}
			scope:new_reveler_2 = {
				add_trait = lifestyle_reveler
			}
		}
		if = {
			limit = {
				culture = {
					OR = {
						has_cultural_tradition = tradition_festivities
						has_cultural_tradition = tradition_esteemed_hospitality
					}
				}
				faith = {
					OR = {
						has_doctrine = tenet_ritual_celebrations
						has_doctrine = tenet_hedonistic
					}
				}
			}
			stress_impact = {
				base = miniscule_stress_impact_loss
				gregarious = miniscule_stress_impact_loss
				gluttonous = miniscule_stress_impact_loss
				drunkard = miniscule_stress_impact_loss
				profligate = miniscule_stress_impact_loss
				comfort_eater = miniscule_stress_impact_loss
				lustful = miniscule_stress_impact_loss
				lifestyle_reveler = miniscule_stress_impact_loss
			}
		}
		else = {
			stress_impact = {
				lifestyle_reveler = miniscule_stress_impact_loss
			}
		}
		ai_chance = {
			base = 100
		}
	}
}
