﻿namespace = regula_orgy_default

##################################################
# "Default" events for the Regula Orgy
# These are Magister themed events (as in the Magister should be host/player)
# They are used as filler for the Regula Orgy
### Events
## 1000 - 1999: Self-triggered Events
	# 1010: Lay with Devoted
	# 1020: Receive blowjob from Devoted
		# 1021: Fill her stomach
		# 1022: Coat her face (pregnancy chance)
	# 1050: Lay with Guest
	# 1060: Receive blowjob from Guest
		# 1061: Make her swallow it
		# 1062: Spray it across her face (pregnancy chance)

## 2000 - 2999: Misc Events
	# 2010: Two Devoted come to you, which is next on your "todo" list?
	# 2020: Servants arguing about your "Prowess"
	# 2030: A guest is impressed by your Regula Magic (Chance to Charm)
	# 2040: Everyone is scared of your dreadful reputation
	# 2050: You practice Regula magic on a devoted
	# 2060: You get caught in the act (with a servant) by a non-charmed guest!
		# 2061: You convince them
			# You manage to convince your guest that you are helping your servant (Diplomacy + Learning)
			# You manage to convince your guest that you love the servant (Diplomacy + Intrigue)
			# You manage to convince your guest that its part of their training (Diplomacy + Martial)
			# You manage to convince your guest that it was a coniencde (Diplomacy + Stewardship)
		# 2062: You fail to convince them
## 3000 - 3999: Secrets & Hooks
	# 3010: Devoted reveals her secrets to you
	# 3020: Servant reveals secret about someone
## 4000 - 4999: Relation Events
	# 4010: Have a good time with friend in garden
	# 4020: Get with non-devoted lover, Domina shows up as well (Easy Charm)
##################################################
##################################################
# 1000 - 1999: Self-triggered Events
# By Ban10
##################################################
# 1010: Lay with Devoted
regula_orgy_default.1010 = {
	type = activity_event
	title = regula_orgy_default.1010.t
	desc = regula_orgy_default.1010.desc
	theme = regula_orgy_theme

	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:devoted
		animation = love
	}

	trigger = {
		# Make sure we have at least one devoted wife (domina/paelex)
		scope:activity = {
			any_attending_character = {
				is_regula_leader_devoted_trigger = yes
			}
		}
	}

	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					is_regula_leader_devoted_trigger = yes
				}
				# We weight non-pregnant characters much higher
				weight = {
					base = 1
					modifier = {
						factor = 10
						is_pregnant = no
					}
				}
				save_scope_as = devoted
			}
		}

		regula_sex_with_target_normal = { TARGET = scope:devoted }

		scope:devoted = {
			add_opinion = {
				target = scope:host
				modifier = love_opinion
				opinion = 20
			}
		}
	}

	option = {
		name = regula_orgy_default.1010.a

		add_piety = 100
		add_prestige = 50
	}
}

# 1050: Lay with Guest
regula_orgy_default.1050 = {
	type = activity_event
	title = regula_orgy_default.1050.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:guest = { is_regula_devoted_trigger = yes }
				}
				desc = regula_orgy_default.1050.desc_devoted
			}
			desc = regula_orgy_default.1050.desc_default
		}
	}
	theme = regula_orgy_theme

	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:guest
		animation = love
	}

	trigger = {
		scope:activity = {
			any_attending_character = {
				is_any_guest_lay_target = yes
				is_regula_leader_devoted_trigger = no
			}
		}
	}

	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					is_any_guest_lay_target = yes
					is_regula_leader_devoted_trigger = no
				}
				# We weight non-pregnant characters much higher
				weight = {
					base = 1
					modifier = {
						factor = 10
						is_pregnant = no
					}
				}
				save_scope_as = guest
			}
		}

		regula_sex_with_target_normal = { TARGET = scope:guest }

		scope:guest = {
			add_opinion = {
				target = scope:host
				modifier = love_opinion
				opinion = 20
			}
		}
	}

	option = {
		name = regula_orgy_default.1050.a

		add_piety = 50
		add_prestige = 50
	}
}

# 1051: Lay with Guests (up to three)
# Event text by Kupumatapokere
regula_orgy_default.1051 = {
	type = activity_event
	title = regula_orgy_default.1051.t

	# Build the event text
	# We always start with the intro, which assumes guest_1 exists
	# guest_1 always exists as that is what makes our starting trigger valid to run this event
	# guest_2 and guest_3 might not exist, so we check for them when appending descs onto the event
	desc = {
		desc = regula_orgy_default.1051.intro
		triggered_desc = {
			trigger = {
				exists = scope:guest_2
			}
			desc = regula_orgy_default.1051.guest_2
		}
		triggered_desc = {
			trigger = {
				exists = scope:guest_3
			}
			desc = regula_orgy_default.1051.guest_3
		}

		# This picks the first valid desc from the triggered_descs below
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:guest_2
					exists = scope:guest_3
				}
				desc = regula_orgy_default.1051.outro_all_guests
			}
			triggered_desc = {
				trigger = {
					exists = scope:guest_2
				}
				desc = regula_orgy_default.1051.outro_extra_guest
			}
			desc = regula_orgy_default.1051.outro_single_guest
		}
	}

	theme = regula_orgy_theme

	override_background = {
		reference = bedchamber
	}

	left_portrait = {
		character = scope:guest_1
		animation = love
	}

	center_portrait = {
		character = scope:guest_2
		animation = happiness
		trigger = {
			exists = scope:guest_2
		}
	}

	right_portrait = {
		character = scope:guest_3
		animation = throne_room_bow_1
		trigger = {
			exists = scope:guest_3
		}
	}

	# Do we at least one guest that like us in the Orgy?
	# Ideally we have three, but only check one here to make the event "valid" for use
	trigger = {
		scope:activity = {
			any_attending_character = {
				is_any_guest_lay_target = yes
			}
		}
	}

	# When the event starts, we grab our characters and set them as values
	# Making sure to not have the same one appear multiple times!
	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					is_any_guest_lay_target = yes
				}
				# We weight non-pregnant characters much higher
				weight = {
					base = 1
					modifier = {
						factor = 10
						is_pregnant = no
					}
				}
				save_scope_as = guest_1
			}

			random_attending_character = {
				limit = {
					is_any_guest_lay_target = yes
					NOT = { this = scope:guest_1 }
				}
				# We weight non-pregnant characters much higher
				weight = {
					base = 1
					modifier = {
						factor = 10
						is_pregnant = no
					}
				}
				save_scope_as = guest_2
			}

			random_attending_character = {
				limit = {
					is_any_guest_lay_target = yes
					NOT = { this = scope:guest_1 }
					NOT = { this = scope:guest_2 }
				}
				# We weight non-pregnant characters much higher
				weight = {
					base = 1
					modifier = {
						factor = 10
						is_pregnant = no
					}
				}
				save_scope_as = guest_3
			}

		}

		scope:guest_1 = {
			add_opinion = {
				target = scope:host
				modifier = love_opinion
				opinion = 20
			}
			add_character_flag = {
				flag = is_naked
				days = 1
			}
			regula_sex_with_target_normal = { TARGET = scope:guest_1 }
		}

		# The ?= here just means that we only run this if scope:guest_2 exists
		# its basically shorthand for checking
		# if = {
		#	limit = {
		#		exists = scope:guest_2
		#	}
		#  do_effects = yes
		# }
		scope:guest_2 ?= {
			add_opinion = {
				target = scope:host
				modifier = love_opinion
				opinion = 20
			}
			add_character_flag = {
				flag = is_naked
				days = 1
			}
			regula_sex_with_target_normal = { TARGET = scope:guest_2 }
		}

		scope:guest_3 ?= {
			add_opinion = {
				target = scope:host
				modifier = love_opinion
				opinion = 20
			}
			add_character_flag = {
				flag = is_naked
				days = 1
			}
			regula_sex_with_target_normal = { TARGET = scope:guest_3 }
		}
	}

	option = {
		name = regula_orgy_default.1051.a

		# We get more prestige/piety for each guest we have
		add_piety = {
			value = 50
			if = {
				limit = {
					exists = scope:guest_2
				}
				add = 25
			}
			if = {
				limit = {
					exists = scope:guest_3
				}
				add = 25
			}
		}

		add_prestige = {
			value = 50
			if = {
				limit = {
					exists = scope:guest_2
				}
				add = 25
			}
			if = {
				limit = {
					exists = scope:guest_3
				}
				add = 25
			}
		}
	}
}

#Receive blowjob from Devoted
#by CashinCheckin
regula_orgy_default.1020 = {
	type = activity_event
	title = regula_orgy_default.1020.t
	desc = regula_orgy_default.1020.desc
	theme = regula_orgy_theme

	left_portrait = {
		character = root
		outfit_tags = { no_cloak no_hat no_pants no_clothes }
		animation = happiness
	}
	right_portrait = {
		character = scope:devoted
		outfit_tags = { no_cloak no_hat no_pants no_clothes }
		animation = love
	}

	trigger = {
		# Make sure we have at least one devoted wife (domina/paelex)
		scope:activity = {
			any_attending_character = {
				is_any_guest_lay_target = yes
				is_regula_leader_devoted_trigger = yes
			}
		}
	}

	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					is_any_guest_lay_target = yes
					is_regula_leader_devoted_trigger = yes
				}

				weight = {
					base = 1
					modifier = {
						factor = 10
						is_pregnant = no
					}
				}

				save_scope_as = devoted
			}

		}

		scope:devoted = {
			add_opinion = {
				target = scope:host
				modifier = love_opinion
				opinion = 20
			}
		}
	}

	#Fill her stomach
	option = {
		name = regula_orgy_default.1020.a
		trigger_event = regula_orgy_default.1021
		add_prestige = minor_prestige_gain

		regula_sex_with_target_normal_oral_inside = { TARGET = scope:devoted }

		scope:devoted = {
			if = {
				limit = {
					OR = {
						has_trait = lustful
						has_trait = gluttonous
						has_trait = trusting
						has_trait = calm
					}
				}
				add_prestige = medium_prestige_gain
			}
			else = {
				add_prestige = minor_prestige_gain
			}
		}
	}

	#Coat her face
	option = {
		name = regula_orgy_default.1020.b
		trigger_event = regula_orgy_default.1022
		add_piety = minor_piety_gain

		regula_sex_with_target_normal_oral_outside = { TARGET = scope:devoted }

		scope:devoted = {
			if = {
				limit = {
					OR = {
						has_trait = lustful
						has_trait = zealous
						has_trait = shy
						has_trait = content
					}
				}
				add_piety = medium_piety_gain
			}
			else = {
				add_piety = minor_piety_gain
			}
		}
	}
}

#Fill her stomach
regula_orgy_default.1021 = {
	type = activity_event
	title = regula_orgy_default.1020.t
	desc = regula_orgy_default.1021.desc
	theme = regula_orgy_theme

	left_portrait = {
		character = root
		outfit_tags = { no_cloak no_hat no_pants no_clothes }
		animation = happiness
	}
	right_portrait = {
		character = scope:devoted
		outfit_tags = { no_cloak no_hat no_pants no_clothes }
		animation = love
	}

	option = {
		name = regula_orgy_default.1021.a
	}

	after = {
		hidden_effect = {
 			scope:activity = {
				add_activity_log_entry = {
					key = regula_orgy_blowjob_devoted_log
					tags = { good }
					score = 10
					character = root
				}
			}
		}
	}
}

#Coat her face
regula_orgy_default.1022 = {
	type = activity_event
	title = regula_orgy_default.1020.t
	desc = regula_orgy_default.1022.desc
	theme = regula_orgy_theme

	left_portrait = {
		character = root
		outfit_tags = { no_cloak no_hat no_pants no_clothes }
		animation = happiness
	}
	right_portrait = {
		character = scope:devoted
		outfit_tags = { no_cloak no_hat no_pants no_clothes }
		animation = love
	}

	option = {
		name = regula_orgy_default.1022.a

	}

	immediate = {
		hidden_effect = {
			scope:host = {
				regula_sex_with_target_no_stress = { TARGET = scope:devoted }
			}
		}
	}

	after = {
		hidden_effect = {
 			scope:activity = {
				add_activity_log_entry = {
					key = regula_orgy_blowjob_devoted_log
					tags = { good }
					score = 10
					character = root
				}
			}
		}
	}
}

#Receive blowjob from guest
#by CashinCheckin
regula_orgy_default.1060 = {
	type = activity_event
	title = regula_orgy_default.1060.t
	desc = regula_orgy_default.1060.desc
	theme = regula_orgy_theme

	left_portrait = {
		character = root
		outfit_tags = { no_cloak no_hat no_pants no_clothes }
		animation = happiness
	}
	right_portrait = {
		character = scope:guest
		outfit_tags = { no_cloak no_hat no_pants no_clothes }
		animation = love
	}

	trigger = {
		# Our guest is not leader devoted (Paelex/Domina) as they have a seperate event
		scope:activity = {
			any_attending_character = {
				is_regula_leader_devoted_trigger = no
				is_any_guest_lay_target  = yes
			}
		}
	}

	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					is_regula_leader_devoted_trigger = no
					is_any_guest_lay_target  = yes
				}

				# We weight non-pregnant characters much higher
				weight = {
					base = 1
					modifier = {
						factor = 10
						is_pregnant = no
					}
				}

				save_scope_as = guest
			}
		}

		# We don't know if we went inside or outside so show as tooltip here then do action later in option block
		show_as_tooltip = {
			scope:host = {
				regula_sex_with_target_normal_oral_inside = { TARGET = scope:guest }
			}
		}

		scope:guest = {
			add_opinion = {
				target = scope:host
				modifier = love_opinion
				opinion = 20
			}
		}
	}

	#Make her swallow it
	option = {
		name = regula_orgy_default.1060.a
		trigger_event = regula_orgy_default.1061
		add_prestige = minor_prestige_gain

		hidden_effect = {
			scope:host = {
				regula_sex_with_target_normal_oral_inside = { TARGET = scope:guest }
			}
		}

		scope:guest = {
			if = {
				limit = {
					OR = {
						has_trait = lustful
						has_trait = gluttonous
						has_trait = trusting
						has_trait = calm
					}
				}
				add_prestige = medium_prestige_gain
			}
			else = {
				add_prestige = minor_prestige_gain
			}
		}
	}

	#Spray it across her face
	option = {
		name = regula_orgy_default.1060.b
		trigger_event = regula_orgy_default.1062
		add_piety = minor_piety_gain

		hidden_effect = {
			scope:host = {
				regula_sex_with_target_normal_oral_outside = { TARGET = scope:guest }
			}
		}

		scope:guest = {
			if = {
				limit = {
					OR = {
						has_trait = lustful
						has_trait = zealous
						has_trait = shy
						has_trait = content
					}
				}
				add_piety = medium_piety_gain
			}
			else = {
				add_piety = minor_piety_gain
			}
		}
	}
}

#Make her swallow it
regula_orgy_default.1061 = {
	type = activity_event
	title = regula_orgy_default.1060.t
	desc = regula_orgy_default.1061.desc
	theme = regula_orgy_theme

	left_portrait = {
		character = root
		outfit_tags = { no_cloak no_hat no_pants no_clothes }
		animation = laugh
	}
	right_portrait = {
		character = scope:guest
		outfit_tags = { no_cloak no_hat no_pants no_clothes }
		animation = poison
	}

	option = {
		name = regula_orgy_default.1061.a
	}

	after = {
		hidden_effect = {
 			scope:activity = {
				add_activity_log_entry = {
					key = regula_orgy_blowjob_guest_log
					tags = { good }
					score = 10
					character = root
				}
			}
		}
	}
}

#Spray it across her face
regula_orgy_default.1062 = {
	type = activity_event
	title = regula_orgy_default.1060.t
	desc = regula_orgy_default.1062.desc
	theme = regula_orgy_theme

	left_portrait = {
		character = root
		outfit_tags = { no_cloak no_hat no_pants no_clothes }
		animation = happiness
	}
	right_portrait = {
		character = scope:guest
		outfit_tags = { no_cloak no_hat no_pants no_clothes }
		animation = love
	}

	option = {
		name = regula_orgy_default.1062.a
		scope:guest = {
			if = {
				limit = {
					OR = {
						has_trait = brave
						has_trait = ambitious
					}
					NOR = {
						has_trait = craven
						has_trait = content
					}
				}
				add_prestige = major_prestige_gain
			}
			else = {
				add_prestige = medium_prestige_gain
			}
		}
	}

	immediate = {
		hidden_effect = {
			scope:host = {
				regula_sex_with_target_no_stress = { TARGET = scope:guest }
			}
		}
	}

	after = {
		hidden_effect = {
 			scope:activity = {
				add_activity_log_entry = {
					key = regula_orgy_blowjob_guest_log
					tags = { good }
					score = 10
					character = root
				}
			}
		}
	}
}

##################################################
# 2000 - 2999: Misc Events
# By Ban10
##################################################

# 2060: You get caught in the act (with a servant) by a non-charmed guest!
	# 2061: You convince them
		# You manage to convice your guest that you are helping your servant (Diplomacy + Learning)
		# You manage to convice your guest that you love the servant (Diplomacy + Intrigue)
		# You manage to convice your guest that its part of their training (Diplomacy + Martial)
		# You manage to convice your guest that it was a coniencde (Diplomacy + Stewardship)
	# 2062: You fail to convice them

##################################################
# 3000 - 3999: Secrets & Hooks
# By Ban10
##################################################

##################################################
# 4000 - 4999: Relation Events
# By Ban10
##################################################

##################################################
# 1000 - 1999: Self-triggered Events
# By Ban10
##################################################
