﻿dynasty_blessing = {
	icon = public
	
	is_valid = {
		is_current_phase_active = yes
		exists = scope:host.dynasty
		trigger_if = {
			limit = {
				scope:activity = { has_activity_type = activity_wedding }
			}
			any_attending_character = {
				NOR = {
					this = scope:host
					this = scope:activity.special_guest:spouse_1
					this = scope:activity.special_guest:spouse_2
				}
				is_physically_able_ai_adult = yes
				location = scope:province
				dynasty ?= { dynasty_prestige_level > scope:host.dynasty.dynasty_prestige_level }
			}
		}
		trigger_if = {
			limit = {
				scope:activity = { has_activity_type = activity_coronation }
			}
			any_attending_character = {
				NOR = {
					this = scope:host
				}
				is_physically_able_ai_adult = yes
				location = scope:province
				dynasty ?= { dynasty_prestige_level > scope:host.dynasty.dynasty_prestige_level }
			}
		}
	}

	weight = {
		value = 1
		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_wedding
					has_activity_option = {
						category = wedding_option_decoration
						option = wedding_decoration_good
					}
				}
			}
			add = 0.5
		}

		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_coronation
					has_activity_option = {
						category = ceremony_size
						option = coronation_large_ceremony
					}
				}
			}
			add = 0.5
		}
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		
		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_wedding
				}
			}
			random_attending_character = {
				limit = {
					NOR = {
						this = scope:host
						this = scope:activity.special_guest:spouse_1
						this = scope:activity.special_guest:spouse_2
					}
					is_physically_able_ai_adult = yes
					location = scope:province
					dynasty ?= { dynasty_prestige_level > scope:host.dynasty.dynasty_prestige_level }
				}
				save_scope_as = first
			}		
		}

		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_coronation
				}
			}
			random_attending_character = {
				limit = {
					NOR = {
						this = scope:host
					}
					is_physically_able_ai_adult = yes
					location = scope:province
					dynasty ?= { dynasty_prestige_level > scope:host.dynasty.dynasty_prestige_level }
				}
				save_scope_as = first
			}		
		}

		add_activity_log_entry = {
			key = dynasty_blessing
			tags = { pulse_action }
			character = scope:first
			
			scope:host.dynasty = {
				add_dynasty_prestige = medium_dynasty_prestige_gain
			}
			scope:first = {
				add_opinion = {
					modifier = impressed_opinion
					target = scope:host
					opinion = 10
				}
			}
		}
	}
}

cultural_acceptance = {
	icon = stewardship
	
	is_valid = {
		is_current_phase_active = yes
		exists = scope:activity.special_guest:spouse_1.culture
		exists = scope:activity.special_guest:spouse_2.culture
		scope:activity.special_guest:spouse_1.culture != scope:activity.special_guest:spouse_2.culture
		trigger_if = {
			limit = {
				scope:activity = { has_activity_type = activity_wedding }
			}
			NOT = { scope:activity.special_guest:spouse_1.culture = scope:activity.special_guest:spouse_2.culture }
		}
		trigger_if = {
			limit = {
				scope:activity = { has_activity_type = activity_coronation }
			}
			scope:activity.var:officiator ?= { is_alive = yes }
			NOT = { scope:host.culture = scope:activity.var:officiator.culture }
		}
	}

	weight = {
		value = 1
	}

	effect = {
		if = {
			limit = {
				scope:activity = { has_activity_type = activity_wedding }
			}
			scope:activity.special_guest:spouse_1 = { save_scope_as = first }
			scope:activity.special_guest:spouse_2 = { save_scope_as = second }
		}

		if = {
			limit = {
				scope:activity = { 
					has_activity_type = activity_coronation 
					has_variable = officiator
				}
			}
			scope:host = { save_scope_as = first }
			scope:activity.var:officiator = { save_scope_as = second }
		}

		add_activity_log_entry = {
			key = cultural_acceptance
			tags = { pulse_action }
			character = scope:first
			target = scope:second
			
			scope:first.culture = {
				change_cultural_acceptance = {
					target = scope:second.culture
					value = miniscule_positive_culture_acceptance
					desc = cultural_acceptance_gain_hold_court_event_outcome
				}
			}
			scope:second.culture = {
				change_cultural_acceptance = {
					target = scope:first.culture
					value = miniscule_positive_culture_acceptance
					desc = cultural_acceptance_gain_hold_court_event_outcome
				}
			}
		}
	}
}

marriage_reflection = {
	icon = wedding
	
	is_valid = {
		is_current_phase_active = yes
		any_attending_character = {
			is_physically_able_ai_adult = yes
			location = scope:province
			any_memory = {
				has_memory_category = marriage
			}
		}
	}

	weight = {
		value = 1
		if = {
			limit = {
				any_attending_character = {
					is_physically_able_ai_adult = yes
					location = scope:province
					any_memory = {
						has_memory_category = marriage
					}
					this = scope:host
				}
			}
			add = 1
		}
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		
		random_attending_character = {
			limit = {
				this = scope:host
				is_physically_able_ai_adult = yes
				location = scope:province
				any_memory = {
					has_memory_category = marriage
				}
			}
			alternative_limit = {
				is_physically_able_ai_adult = yes
				location = scope:province
				any_memory = {
					has_memory_category = marriage
				}
			}
			save_scope_as = first
		}

		add_activity_log_entry = {
			key = marriage_reflection
			tags = { pulse_action }
			character = scope:first
			
			scope:first = {
				stress_impact = {
					base = minor_stress_impact_loss
				}
			}
		}
	}
}

royal_gift = {
	icon = wedding
	
	is_valid = {
		trigger_if = {
			limit = {
				scope:activity = { has_activity_type = activity_wedding }
			}
			is_current_phase_active = yes
			any_attending_character = {
				NOR = {
					this = scope:host
					this = scope:activity.special_guest:spouse_1
					this = scope:activity.special_guest:spouse_2
				}
				is_physically_able_ai_adult = yes
				location = scope:province
				highest_held_title_tier >= tier_kingdom
				gold > minor_gold_value
			}
		}
		trigger_if = {
			limit = {
				scope:activity = { has_activity_type = activity_coronation }
			}
			is_current_phase_active = yes
			any_attending_character = {
				NOT = {
					this = scope:host
				}
				is_physically_able_ai_adult = yes
				location = scope:province
				highest_held_title_tier >= tier_kingdom
				gold > minor_gold_value
			}
		}
	}

	weight = {
		value = 1
		if = {
			limit = {
				scope:activity = { has_activity_type = activity_wedding }
				any_attending_character = {
					NOR = {
						this = scope:host
						this = scope:activity.special_guest:spouse_1
						this = scope:activity.special_guest:spouse_2
					}
					is_physically_able_ai_adult = yes
					location = scope:province
					highest_held_title_tier = tier_empire
					gold > minor_gold_value
				}
			}
			add = 0.5
		}
		if = {
			limit = {
				scope:activity = { has_activity_type = activity_coronation }
				any_attending_character = {
					NOR = {
						this = scope:host
						scope:activity.var:officiator ?= this
					}
					is_physically_able_ai_adult = yes
					location = scope:province
					highest_held_title_tier = tier_empire
					gold > minor_gold_value
				}
			}
			add = 0.5
		}
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		
		random_attending_character = {
			limit = {
				NOR = {
					this = scope:host
					scope:activity.special_guest:spouse_1 ?= this
					scope:activity.special_guest:spouse_2 ?= this
				}
				is_physically_able_ai_adult = yes
				location = scope:province
				highest_held_title_tier = tier_empire
				gold > minor_gold_value
			}
			alternative_limit = {
				NOR = {
					this = scope:host
					scope:activity.special_guest:spouse_1 ?= this
					scope:activity.special_guest:spouse_2 ?= this
				}
				is_physically_able_ai_adult = yes
				location = scope:province
				highest_held_title_tier >= tier_kingdom
				gold > minor_gold_value
			}
			save_scope_as = first
		}
		random_list = {
			30 = {
				modifier = {
					scope:host = { is_ai = no }
					add = 70
				}
				scope:host = { save_scope_as = second }
			}
			30 = {
				trigger = {
					scope:activity = { has_activity_type = activity_wedding }
				}
				modifier = {
					scope:activity.special_guest:spouse_1 = { is_ai = no }
					add = 70
				}
				scope:activity.special_guest:spouse_1 = { save_scope_as = second }
			}
			30 = {
				trigger = {
					scope:activity = { has_activity_type = activity_wedding }
				}
				modifier = {
					scope:activity.special_guest:spouse_2 = { is_ai = no }
					add = 70
				}
				scope:activity.special_guest:spouse_2 = { save_scope_as = second }
			}
		}


		add_activity_log_entry = {
			key = royal_gift
			tags = { pulse_action }
			character = scope:first
			target = scope:second
			
			scope:first = {
				pay_short_term_gold = {
					target = scope:second
					gold = minor_gold_value
				}
			}
		}
	}
}

gossip_with_guests = {
	icon = intrigue
	
	is_valid = {
		is_current_phase_active = yes
		trigger_if = {
			limit = {
				scope:activity = { has_activity_type = activity_wedding }
			}
			has_current_phase = wedding_phase_banquet
		}
		trigger_if = {
			limit = {
				scope:activity = { has_activity_type = activity_coronation }
			}
			has_current_phase = coronation_phase_feast
		}
		any_attending_character = {
			is_physically_able_adult = yes
			OR = {
				is_ai = no
				this = scope:host
			}
			location = scope:province
			has_lifestyle = intrigue_lifestyle
		}
	}

	weight = {
		value = 1
		if = {
			limit = {
				any_attending_character = {
					is_physically_able_adult = yes
					OR = {
						is_ai = no
						this = scope:host
					}
					location = scope:province
					has_lifestyle = intrigue_lifestyle
					OR = {
						this = scope:host
						this = scope:activity.special_guest:spouse_1
						this = scope:activity.special_guest:spouse_2
					}
				}
			}
			add = 1
		}
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		
		random_attending_character = {
			limit = {
				is_physically_able_adult = yes
				OR = {
					is_ai = no
					this = scope:host
				}
				location = scope:province
				has_lifestyle = intrigue_lifestyle
				OR = {
					this = scope:host
					this = scope:activity.special_guest:spouse_1
					this = scope:activity.special_guest:spouse_2
				}			
			}
			alternative_limit = {
				is_physically_able_adult = yes
				OR = {
					is_ai = no
					this = scope:host
				}
				location = scope:province
				has_lifestyle = intrigue_lifestyle
			}
			save_scope_as = first
		}

		add_activity_log_entry = {
			key = gossip_with_guests
			tags = { pulse_action }
			character = scope:first
			
			scope:first = {
				add_intrigue_lifestyle_xp = miniscule_lifestyle_xp
			}
		}
	}
}

contact_network = {
	icon = courtly
	
	is_valid = {
		is_current_phase_active = yes
		any_attending_character = {
			is_physically_able_adult = yes
			OR = {
				is_ai = no
				this = scope:host
			}
			location = scope:province
			has_lifestyle = diplomacy_lifestyle
		}
	}

	weight = {
		value = 1
		if = {
			limit = {
				any_attending_character = {
					is_physically_able_adult = yes
					OR = {
						is_ai = no
						this = scope:host
					}
					location = scope:province
					has_lifestyle = diplomacy_lifestyle
					trigger_if = {
						limit = {
							scope:activity = { has_activity_type = activity_wedding }
						}
						OR = {
							this = scope:host	
							this = scope:activity.special_guest:spouse_1
							this = scope:activity.special_guest:spouse_2
						}
					}
					trigger_if = {
						limit = {
							scope:activity = { has_activity_type = activity_coronation }
						}
						OR = {
							this = scope:host	
							scope:activity.var:officiator ?= this
							is_in_guest_subset = { name = supporter }
							is_in_guest_subset = { name = detractor }
						}
					}
				}
			}
			add = 1
		}
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		
		random_attending_character = {
			limit = {
				is_physically_able_adult = yes
				OR = {
					is_ai = no
					this = scope:host
				}
				location = scope:province
				has_lifestyle = diplomacy_lifestyle
				trigger_if = {
					limit = {
						scope:activity = { has_activity_type = activity_wedding }
					}
					OR = {
						this = scope:host	
						this = scope:activity.special_guest:spouse_1
						this = scope:activity.special_guest:spouse_2
					}
				}
				trigger_if = {
					limit = {
						scope:activity = { has_activity_type = activity_coronation }
					}
					OR = {
						this = scope:host	
						scope:activity.var:officiator ?= this
						is_in_guest_subset = { name = supporter }
						is_in_guest_subset = { name = detractor }
					}
				}			
			}
			alternative_limit = {
				is_physically_able_adult = yes
				OR = {
					is_ai = no
					this = scope:host
				}
				location = scope:province
				has_lifestyle = diplomacy_lifestyle
			}
			save_scope_as = first
		}

		add_activity_log_entry = {
			key = contact_network
			tags = { pulse_action }
			character = scope:first
			
			scope:first = {
				add_diplomacy_lifestyle_xp = miniscule_lifestyle_xp
			}
		}
	}
}

wedding_gift = {
	icon = wedding
	
	is_valid = {
		is_current_phase_active = yes
		any_attending_character = {
			NOR = {
				this = scope:host
				this = scope:activity.special_guest:spouse_1
				this = scope:activity.special_guest:spouse_2
			}
			is_physically_able_ai_adult = yes
			location = scope:province
			has_any_unequipped_artifact = yes
			OR = {
				opinion = {
					target = scope:activity.special_guest:spouse_1
					value >= 20
				}
				opinion = {
					target = scope:activity.special_guest:spouse_2
					value >= 20
				}
			}
		}
	}

	weight = {
		value = 1
		if = {
			limit = {
				OR = {
					scope:activity.special_guest:spouse_1 = { is_ai = no }
					scope:activity.special_guest:spouse_2 = { is_ai = no }
				}
			}
			add = 0.5
		}
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		
		random_attending_character = {
			limit = {
				NOR = {
					this = scope:host
					this = scope:activity.special_guest:spouse_1
					this = scope:activity.special_guest:spouse_2
				}
				is_physically_able_ai_adult = yes
				location = scope:province
				any_character_artifact = {
					OR = { #Unop: Fix using scope:second that does not exists yet, try check it can be gifted to either spouse
						artifact_can_be_gift_to_trigger = { RECIPIENT = scope:activity.special_guest:spouse_1 }
						artifact_can_be_gift_to_trigger = { RECIPIENT = scope:activity.special_guest:spouse_2 }
					}
					is_equipped = no
				}
				OR = {
					opinion = {
						target = scope:activity.special_guest:spouse_1
						value >= 20
					}
					opinion = {
						target = scope:activity.special_guest:spouse_2
						value >= 20
					}
				}
			}
			save_scope_as = first
		}
		if = {
			limit = {
				scope:first = {
					opinion = {
						target = scope:activity.special_guest:spouse_1
						value >= 20
					}
				}
			}
			scope:activity.special_guest:spouse_1 = { save_scope_as = second }
		}
		else = {
			scope:activity.special_guest:spouse_2 = { save_scope_as = second }
		}

		add_activity_log_entry = {
			key = wedding_gift
			tags = { pulse_action }
			character = scope:first
			target = scope:second
			
			scope:first = {
				random_character_artifact = {
					limit = {
						artifact_can_be_gift_to_trigger = { RECIPIENT = scope:second }
						is_equipped = no
					}
					set_owner = scope:second
					add_artifact_history = {
						type = given
						actor = scope:first
						recipient = scope:second
					}
					save_scope_as = target
				}	
			}
			hidden_effect = {
				scope:second = {
					if = {
						limit = {
							is_ruler = no
							trigger_if = {
								limit = {
									scope:target = {
										artifact_slot_type = primary_armament
									}
								}
								OR = {
									NOT = {
										any_equipped_character_artifact = {
											artifact_slot_type = primary_armament
										}
									}
									AND = {
										scope:target = {
											rarity = illustrious
										}
										any_equipped_character_artifact = {
											artifact_slot_type = primary_armament
											NOT = {
												rarity = illustrious
											}
										}
									}
									AND = {
										scope:target = {
											rarity = famed
										}
										any_equipped_character_artifact = {
											artifact_slot_type = primary_armament
											NOR = {
												rarity = illustrious
												rarity = famed
											}
										}
									}
									AND = {
										scope:target = {
											rarity = masterwork
										}
										any_equipped_character_artifact = {
											artifact_slot_type = primary_armament
											NOR = {
												rarity = illustrious
												rarity = famed
												rarity = masterwork
											}
										}
									}
									AND = {
										scope:target = {
											rarity = common
										}
										any_equipped_character_artifact = {
											artifact_slot_type = primary_armament
											NOR = {
												rarity = illustrious
												rarity = famed
												rarity = masterwork
												rarity = common
											}
										}
									}
								}
							}
							trigger_if = {
								limit = {
									scope:target = {
										artifact_slot_type = armor
									}
								}
								OR = {
									NOT = {
										any_equipped_character_artifact = {
											artifact_slot_type = armor
										}
									}
									AND = {
										scope:target = {
											rarity = illustrious
										}
										any_equipped_character_artifact = {
											artifact_slot_type = armor
											NOT = {
												rarity = illustrious
											}
										}
									}
									AND = {
										scope:target = {
											rarity = famed
										}
										any_equipped_character_artifact = {
											artifact_slot_type = armor
											NOR = {
												rarity = illustrious
												rarity = famed
											}
										}
									}
									AND = {
										scope:target = {
											rarity = masterwork
										}
										any_equipped_character_artifact = {
											artifact_slot_type = armor
											NOR = {
												rarity = illustrious
												rarity = famed
												rarity = masterwork
											}
										}
									}
									AND = {
										scope:target = {
											rarity = common
										}
										any_equipped_character_artifact = {
											artifact_slot_type = armor
											NOR = {
												rarity = illustrious
												rarity = famed
												rarity = masterwork
												rarity = common
											}
										}
									}
								}
							}
							trigger_if = {
								limit = {
									scope:target = {
										artifact_slot_type = regalia
									}
								}
								OR = {
									NOT = {
										any_equipped_character_artifact = {
											artifact_slot_type = regalia
										}
									}
									AND = {
										scope:target = {
											rarity = illustrious
										}
										any_equipped_character_artifact = {
											artifact_slot_type = regalia
											NOT = {
												rarity = illustrious
											}
										}
									}
									AND = {
										scope:target = {
											rarity = famed
										}
										any_equipped_character_artifact = {
											artifact_slot_type = regalia
											NOR = {
												rarity = illustrious
												rarity = famed
											}
										}
									}
									AND = {
										scope:target = {
											rarity = masterwork
										}
										any_equipped_character_artifact = {
											artifact_slot_type = regalia
											NOR = {
												rarity = illustrious
												rarity = famed
												rarity = masterwork
											}
										}
									}
									AND = {
										scope:target = {
											rarity = common
										}
										any_equipped_character_artifact = {
											artifact_slot_type = regalia
											NOR = {
												rarity = illustrious
												rarity = famed
												rarity = masterwork
												rarity = common
											}
										}
									}
								}
							}
							trigger_if = {
								limit = {
									scope:target = {
										artifact_slot_type = helmet
									}
								}
								OR = {
									NOT = {
										any_equipped_character_artifact = {
											artifact_slot_type = helmet
										}
									}
									AND = {
										scope:target = {
											rarity = illustrious
										}
										any_equipped_character_artifact = {
											artifact_slot_type = helmet
											NOT = {
												rarity = illustrious
											}
										}
									}
									AND = {
										scope:target = {
											rarity = famed
										}
										any_equipped_character_artifact = {
											artifact_slot_type = helmet
											NOR = {
												rarity = illustrious
												rarity = famed
											}
										}
									}
									AND = {
										scope:target = {
											rarity = masterwork
										}
										any_equipped_character_artifact = {
											artifact_slot_type = helmet
											NOR = {
												rarity = illustrious
												rarity = famed
												rarity = masterwork
											}
										}
									}
									AND = {
										scope:target = {
											rarity = common
										}
										any_equipped_character_artifact = {
											artifact_slot_type = helmet
											NOR = {
												rarity = illustrious
												rarity = famed
												rarity = masterwork
												rarity = common
											}
										}
									}
								}
							}
						}
						scope:target = {
							equip_artifact_to_owner_replace = yes
						}
					}
				}
			}
		}
	}
}

bonding_spouse_family = {
	icon = wedding
	
	is_valid = {
		is_current_phase_active = yes
		any_attending_character = {
			NOR = {
				this = scope:activity.special_guest:spouse_1
				this = scope:activity.special_guest:spouse_2
			}
			is_physically_able_ai_adult = yes
			location = scope:province
			OR = {
				is_close_family_of = scope:activity.special_guest:spouse_1
				is_close_family_of = scope:activity.special_guest:spouse_2
			}
			trigger_if = {
				limit = {
					is_close_family_of = scope:activity.special_guest:spouse_1
				}
				can_set_relation_friend_trigger = { CHARACTER = scope:activity.special_guest:spouse_2 }
			}
			trigger_else = {
				can_set_relation_friend_trigger = { CHARACTER = scope:activity.special_guest:spouse_1 }
			}
		}
	}

	weight = {
		value = 1
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		
		random_attending_character = {
			limit = {
				NOR = {
					this = scope:activity.special_guest:spouse_1
					this = scope:activity.special_guest:spouse_2
				}
				is_physically_able_ai_adult = yes
				location = scope:province
				OR = {
					is_close_family_of = scope:activity.special_guest:spouse_1
					is_close_family_of = scope:activity.special_guest:spouse_2
				}
				trigger_if = {
					limit = {
						is_close_family_of = scope:activity.special_guest:spouse_1
					}
					can_set_relation_friend_trigger = { CHARACTER = scope:activity.special_guest:spouse_2 }
				}
				trigger_else = {
					can_set_relation_friend_trigger = { CHARACTER = scope:activity.special_guest:spouse_1 }
				}
			}
			save_scope_as = first
		}
		if = {
			limit = {
				scope:first = { is_close_family_of = scope:activity.special_guest:spouse_1 }
			}
			scope:activity.special_guest:spouse_2 = { save_scope_as = second }
		}
		else = {
			scope:activity.special_guest:spouse_1 = { save_scope_as = second }
		}

		add_activity_log_entry = {
			key = bonding_spouse_family
			tags = { pulse_action }
			character = scope:first
			target = scope:second
			
			scope:first = {
				progress_towards_friend_effect = {
					REASON = friend_wedding_relation_bond
					CHARACTER = scope:second
					OPINION = default_friend_opinion
				}
			}
		}
	}
}

received_flowers = {
	icon = wedding
	
	is_valid = {
		is_current_phase_active = yes
		any_attending_character = {
			NOR = {
				this = scope:activity.special_guest:spouse_1
				this = scope:activity.special_guest:spouse_2
			}
			is_physically_able_ai_adult = yes
			location = scope:province
		}
	}

	weight = {
		value = 1
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		random_list = {
			50 = {
				scope:activity.special_guest:spouse_1 = { save_scope_as = first }
			}
			50 = {
				scope:activity.special_guest:spouse_2 = { save_scope_as = first }
			}
		}
		
		random_attending_character = {
			limit = {
				NOR = {
					this = scope:activity.special_guest:spouse_1
					this = scope:activity.special_guest:spouse_2
				}
				is_physically_able_ai_adult = yes
				location = scope:province
			}
			save_scope_as = second
		}

		add_activity_log_entry = {
			key = received_flowers
			tags = { pulse_action }
			character = scope:first
			target = scope:second
			
			scope:first = {
				add_prestige = minor_prestige_gain
			}
		}
	}
}

admired_venue = {
	icon = wedding
	
	is_valid = {
		is_current_phase_active = yes
		trigger_if = {
			limit = {
				scope:activity = { has_activity_type = activity_wedding }
			}
			any_attending_character = {
				NOR = {
					is_physically_able_ai_adult = yes
					this = scope:host
					this = scope:activity.special_guest:spouse_1
					this = scope:activity.special_guest:spouse_2
				}
				location = scope:province
				has_activity_intent = reduce_stress_intent
			}
		}

		trigger_if = {
			limit = {
				scope:activity = { has_activity_type = activity_coronation }
			}
			any_attending_character = {
				NOR = {
					is_physically_able_ai_adult = yes
					this = scope:host
					scope:activity.var:officiator ?= this
				}
				location = scope:province
				has_activity_intent = coronation_bear_witness
			}
		}
	}

	weight = {
		value = 1
		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_wedding
					has_activity_option = {
						category = wedding_option_decoration
						option = wedding_decoration_good
					}
				}
			}
			add = 1
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_wedding
					has_activity_option = {
						category = wedding_option_decoration
						option = wedding_decoration_normal
					}
				}
			}
			add = 0.5
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_coronation
					has_activity_option = {
						category = ceremony_size
						option = coronation_large_ceremony
					}
				}
			}
			add = 1
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_coronation
					has_activity_option = {
						category = ceremony_size
						option = coronation_medium_ceremony
					}
				}
			}
			add = 0.5
		}
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		
		random_attending_character = {
			limit = {
				trigger_if = {
					limit = {
						scope:activity = { has_activity_type = activity_wedding }
					}
					NOR = {
						this = scope:host
						this = scope:activity.special_guest:spouse_1
						this = scope:activity.special_guest:spouse_2
					}
					has_activity_intent = reduce_stress_intent
				}

				trigger_if = {
					limit = {
						scope:activity = { has_activity_type = activity_coronation }
					}
					NOR = {
						this = scope:host
						scope:activity.var:officiator ?= this
					}
					has_activity_intent = coronation_bear_witness
				}
				
				is_physically_able_ai_adult = yes
				location = scope:province
			}
			save_scope_as = first
		}

		add_activity_log_entry = {
			key = admired_venue
			tags = { pulse_action }
			character = scope:first
			
			scope:first = {
				stress_impact = {
					base = minor_stress_impact_loss
				}
			}
		}
	}
}

knight_praised = {
	icon = martial
	
	is_valid = {
		is_current_phase_active = yes
		any_attending_character = {
			is_physically_able_ai_adult = yes
			location = scope:province
			is_acclaimed = yes
			liege ?= {
				OR = {
					is_ai = no
					this = scope:host
				}
			}
		}
	}

	weight = {
		value = 1
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		
		random_attending_character = {
			limit = {
				is_physically_able_ai_adult = yes
				location = scope:province
				is_acclaimed = yes
				liege ?= {
					OR = {
						is_ai = no
						this = scope:host
					}
				}
			}
			save_scope_as = first
			set_variable = {
				name = court_6040_best_looking_var
				days = 2
			}
		}

		add_activity_log_entry = {
			key = knight_praised
			tags = { pulse_action }
			character = scope:first
			
			scope:first.accolade = {
				add_glory = minor_glory_gain
			}
		}
	}
}

mischievous_joke = {
	icon = public
	
	is_valid = {
		is_current_phase_active = yes
		any_attending_character = {
			has_activity_intent = banquet_mischief_intent
			is_physically_able_ai_adult = yes
			location = scope:province
		}
	}

	weight = {
		value = 1
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		
		random_attending_character = {
			limit = {
				has_activity_intent = banquet_mischief_intent
				is_physically_able_ai_adult = yes
				location = scope:province
			}
			save_scope_as = first
		}

		add_activity_log_entry = {
			key = mischievous_joke
			tags = { pulse_action }
			character = scope:first
			
			scope:first = {
				stress_impact = {
					base = minor_stress_impact_loss
				}
			}
		}
	}
}

seductive_exchange = {
	icon = intrigue
	
	is_valid = {
		is_current_phase_active = yes
		any_attending_character = {
			has_activity_intent = woo_attendee_intent
			is_physically_able_ai_adult = yes
			location = scope:province
			intent_target = {
				is_physically_able_ai_adult = yes
				location = scope:province
				is_ai = yes
			}
		}
	}

	weight = {
		value = 0.3
		if = {
			limit = {
				any_attending_character = {
					has_activity_intent = woo_attendee_intent
					is_physically_able_ai_adult = yes
					location = scope:province
					is_ai = no
					intent_target = {
						is_physically_able_ai_adult = yes
						location = scope:province
						is_ai = yes
					}
				}
			}
			add = 0.2
		}
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		
		random_attending_character = {
			limit = {
				has_activity_intent = woo_attendee_intent
				is_physically_able_ai_adult = yes
				location = scope:province
				intent_target = {
					is_physically_able_ai_adult = yes
					location = scope:province
					is_ai = yes
				}
			}
			save_scope_as = first
		}
		scope:first.intent_target = { save_scope_as = second }

		add_activity_log_entry = {
			key = seductive_exchange
			tags = { pulse_action }
			character = scope:first
			target = scope:second
			
			scope:first = {
				progress_towards_lover_effect = {
					CHARACTER = scope:second
					OPINION = default_lover_opinion
					REASON = lover_wedding_seductive_exchange
				}
			}
		}
	}
}

poetry_performance = {
	icon = public
	
	is_valid = {
		is_current_phase_active = yes
		any_attending_character = {
			OR = {
				has_trait = lifestyle_poet
				AND = {
					has_court_position = court_poet_court_position
					aptitude = {
						court_position = court_poet_court_position
						value >= 3
					}
					court_owner = scope:host
				}
			}
			is_physically_able_ai_adult = yes
			location = scope:province
		}
	}

	weight = {
		value = 1
		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_wedding
					has_activity_option = {
						category = wedding_option_entertainment
						option = wedding_entertainment_good
					}
				}
			}
			add = 0.5
		}
		if = {
			limit = {
				scope:host = { has_trait = lifestyle_poet }
			}
			add = 0.5
		}
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		if = {
			limit = {
				scope:host = {
					has_trait = lifestyle_poet
					is_physically_able_ai_adult = yes
					location = scope:province
				}
			}
			scope:host = { save_scope_as = first }
		}
		else = {
			random_attending_character = {
				limit = {
					OR = {
						has_trait = lifestyle_poet
						AND = {
							has_court_position = court_poet_court_position
							aptitude = {
								court_position = court_poet_court_position
								value >= 3
							}
							court_owner = scope:host
						}
					}
					is_physically_able_ai_adult = yes
					location = scope:province
				}
				save_scope_as = first
			}
		}

		add_activity_log_entry = {
			key = poetry_performance
			tags = { pulse_action }
			character = scope:first
			
			scope:first = {
				add_prestige = minor_prestige_gain
			}
			if = {
				limit = {
					scope:first != scope:host
				}
				scope:host = {
					add_prestige = minor_prestige_gain
				}
			}
		}
	}
}

music_performance = {
	icon = public
	
	is_valid = {
		is_current_phase_active = yes
		any_attending_character = {
			trigger_if = {
				limit = {
					scope:activity = { has_activity_type = activity_wedding }
				}
				NOR = {
					this = scope:host
					this = scope:activity.special_guest:spouse_1
					this = scope:activity.special_guest:spouse_2
				}
			}
			trigger_if = {
				limit = {
					scope:activity = { has_activity_type = activity_coronation }
				}
				NOR = {
					this = scope:host
					scope:activity.var:officiator ?= this
				}
			}
			is_physically_able_ai_adult = yes
			location = scope:province
			has_court_position = court_musician_court_position
			aptitude = {
				court_position = court_musician_court_position
				value >= 3
			}
			court_owner = scope:host
		}
	}

	weight = {
		value = 1
		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_wedding
					has_activity_option = {
						category = wedding_option_entertainment
						option = wedding_entertainment_good
					}
				}
			}
			add = 1
		}
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		
		random_attending_character = {
			limit = {
				trigger_if = {
					limit = {
						scope:activity = { has_activity_type = activity_wedding }
					}
					NOR = {
						this = scope:host
						this = scope:activity.special_guest:spouse_1
						this = scope:activity.special_guest:spouse_2
					}
				}
				trigger_if = {
					limit = {
						scope:activity = { has_activity_type = activity_coronation }
					}
					NOR = {
						this = scope:host
						scope:activity.var:officiator ?= this
					}
				}
				is_physically_able_ai_adult = yes
				location = scope:province
				has_court_position = court_musician_court_position
				aptitude = {
					court_position = court_musician_court_position
					value >= 3
				}
				court_owner = scope:host
			}
			save_scope_as = first
		}

		add_activity_log_entry = {
			key = music_performance
			tags = { pulse_action }
			character = scope:first
			
			scope:first = {
				add_prestige = minor_prestige_gain
			}
			scope:host = {
				add_prestige = minor_prestige_gain
			}
		}
	}
}

floral_exhibit = {
	icon = courtly
	
	is_valid = {
		is_current_phase_active = yes
		any_attending_character = {
			trigger_if = {
				limit = {
					scope:activity = { has_activity_type = activity_wedding }
				}
				NOR = {
					this = scope:host
					this = scope:activity.special_guest:spouse_1
					this = scope:activity.special_guest:spouse_2
				}
			}
			trigger_if = {
				limit = {
					scope:activity = { has_activity_type = activity_coronation }
				}
				NOR = {
					this = scope:host
					scope:activity.var:officiator ?= this
				}
			}
			is_physically_able_ai_adult = yes
			location = scope:province
			has_court_position = court_gardener_court_position
			aptitude = {
				court_position = court_gardener_court_position
				value >= 3
			}
			court_owner = scope:host
		}
	}

	weight = {
		value = 1
		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_wedding
					has_activity_option = {
						category = wedding_option_entertainment
						option = wedding_entertainment_good
					}
				}
			}
			add = 1
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = ceremony_size
						option = coronation_large_ceremony
					}
				}
			}
			add = 1
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = ceremony_size
						option = coronation_medium_ceremony
					}
				}
			}
			add = 0.5
		}
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		
		random_attending_character = {
			limit = {
				trigger_if = {
					limit = {
						scope:activity = { has_activity_type = activity_wedding }
					}
					NOR = {
						this = scope:host
						this = scope:activity.special_guest:spouse_1
						this = scope:activity.special_guest:spouse_2
					}
				}
				trigger_if = {
					limit = {
						scope:activity = { has_activity_type = activity_coronation }
					}
					NOR = {
						this = scope:host
						scope:activity.var:officiator ?= this
					}
				}
				is_physically_able_ai_adult = yes
				location = scope:province
				has_court_position = court_gardener_court_position
				aptitude = {
					court_position = court_gardener_court_position
					value >= 3
				}
				court_owner = scope:host
			}
			save_scope_as = first
		}

		add_activity_log_entry = {
			key = floral_exhibit
			tags = { pulse_action }
			character = scope:first
			
			scope:first = {
				add_prestige = minor_prestige_gain
			}
			scope:host = {
				add_prestige = minor_prestige_gain
			}
		}
	}
}

spouse_impressed = {
	icon = wedding
	
	is_valid = {
		is_current_phase_active = yes
		any_attending_character = {
			this != scope:host
			is_spouse_of = scope:host
			is_physically_able_ai_adult = yes
			location = scope:province
		}
	}

	weight = {
		value = 1
		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_wedding
					has_activity_option = {
						category = wedding_option_decoration
						option = wedding_decoration_good
					}
				}
			}
			add = 0.5
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_wedding
					has_activity_option = {
						category = wedding_option_food
						option = wedding_food_good
					}
				}
			}
			add = 0.5
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_wedding
					has_activity_option = {
						category = wedding_option_entertainment
						option = wedding_entertainment_good
					}
				}
			}
			add = 0.5
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_coronation
					has_activity_option = {
						category = ceremony_size
						option = coronation_large_ceremony
					}
				}
			}
			add = 1
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_coronation
					has_activity_option = {
						category = ceremony_size
						option = coronation_medium_ceremony
					}
				}
			}
			add = 0.5
		}
	}

	effect = {
		scope:host = {
			save_scope_as = root_scope
		}
		
		random_attending_character = {
			limit = {
				this != scope:host
				is_spouse_of = scope:host
				is_physically_able_ai_adult = yes
				location = scope:province
			}
			save_scope_as = first
		}
		scope:host = { save_scope_as = second }

		add_activity_log_entry = {
			key = spouse_impressed
			tags = { pulse_action }
			character = scope:first
			target = scope:second
			
			scope:first = {
				add_opinion = {
					modifier = impressed_opinion
					target = scope:host
					opinion = 10
				}
			}
		}
	}
}
